當前位置: 首頁>>代碼示例>>Python>>正文


Python base58.b58encode_check方法代碼示例

本文整理匯總了Python中base58.b58encode_check方法的典型用法代碼示例。如果您正苦於以下問題:Python base58.b58encode_check方法的具體用法?Python base58.b58encode_check怎麽用?Python base58.b58encode_check使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在base58的用法示例。


在下文中一共展示了base58.b58encode_check方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: export_to_wif

# 需要導入模塊: import base58 [as 別名]
# 或者: from base58 import b58encode_check [as 別名]
def export_to_wif(self, compressed=None):
        """Export a key to WIF.

        :param compressed: False if you want a standard WIF export (the most
            standard option). True if you want the compressed form (Note that
            not all clients will accept this form). Defaults to None, which
            in turn uses the self.compressed attribute.
        :type compressed: bool
        See https://en.bitcoin.it/wiki/Wallet_import_format for a full
        description.
        """
        # Add the network byte, creating the "extended key"
        extended_key_hex = self.get_extended_key()
        extended_key_bytes = unhexlify(extended_key_hex)
        if compressed is None:
            compressed = self.compressed
        if compressed:
            extended_key_bytes += '\01'
        # And return the base58-encoded result with a checksum
        return ensure_str(base58.b58encode_check(extended_key_bytes)) 
開發者ID:BlockIo,項目名稱:multimerchant-python,代碼行數:22,代碼來源:keys.py

示例2: to_address

# 需要導入模塊: import base58 [as 別名]
# 或者: from base58 import b58encode_check [as 別名]
def to_address(self, compressed=None):
        """Create a public address from this key.

        :param compressed: False if you want a normal uncompressed address
            (the most standard option). True if you want the compressed form.
            Note that most clients will not accept compressed addresses.
            Defaults to None, which in turn uses the self.compressed attribute.
        :type compressed: bool

        https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses
        """
        key = unhexlify(self.get_key(compressed))
        # First get the hash160 of the key
        hash160_bytes = hash160(key)
        # Prepend the network address byte
        network_hash160_bytes = \
            chr_py2(self.network.PUBKEY_ADDRESS) + hash160_bytes
        # Return a base58 encoded address with a checksum
        return ensure_str(base58.b58encode_check(network_hash160_bytes)) 
開發者ID:BlockIo,項目名稱:multimerchant-python,代碼行數:21,代碼來源:keys.py

示例3: export_to_wif

# 需要導入模塊: import base58 [as 別名]
# 或者: from base58 import b58encode_check [as 別名]
def export_to_wif(self, compressed=None):
        """Export a key to WIF.

        :param compressed: False if you want a standard WIF export (the most
            standard option). True if you want the compressed form (Note that
            not all clients will accept this form). Defaults to None, which
            in turn uses the self.compressed attribute.
        :type compressed: bool
        See https://en.bitcoin.it/wiki/Wallet_import_format for a full
        description.
        """
        # Add the network byte, creating the "extended key"
        extended_key_hex = self.get_extended_key()
        extended_key_bytes = unhexlify(ensure_bytes(extended_key_hex))
        if compressed is None:
            compressed = self.compressed
        if compressed:
            extended_key_bytes += b'\01'
        # And return the base58-encoded result with a checksum
        return ensure_str(base58.b58encode_check(extended_key_bytes)) 
開發者ID:sbuss,項目名稱:bitmerchant,代碼行數:22,代碼來源:keys.py

示例4: to_address

# 需要導入模塊: import base58 [as 別名]
# 或者: from base58 import b58encode_check [as 別名]
def to_address(self, compressed=None):
        """Create a public address from this key.

        :param compressed: False if you want a normal uncompressed address
            (the most standard option). True if you want the compressed form.
            Note that most clients will not accept compressed addresses.
            Defaults to None, which in turn uses the self.compressed attribute.
        :type compressed: bool

        https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses
        """
        key = unhexlify(ensure_bytes(self.get_key(compressed)))
        # First get the hash160 of the key
        hash160_bytes = hash160(key)
        # Prepend the network address byte
        network_hash160_bytes = \
            chr_py2(self.network.PUBKEY_ADDRESS) + hash160_bytes
        # Return a base58 encoded address with a checksum
        return ensure_str(base58.b58encode_check(network_hash160_bytes)) 
開發者ID:sbuss,項目名稱:bitmerchant,代碼行數:21,代碼來源:keys.py

示例5: address

# 需要導入模塊: import base58 [as 別名]
# 或者: from base58 import b58encode_check [as 別名]
def address(self, compressed=True, testnet=False):
        """ Address property that returns the Base58Check
        encoded version of the HASH160.

        Args:
            compressed (bool): Whether or not the compressed key should
               be used.
            testnet (bool): Whether or not the key is intended for testnet
               usage. False indicates mainnet usage.

        Returns:
            bytes: Base58Check encoded string
        """
        version = '0x'
        return version + binascii.hexlify(self.keccak[12:]).decode('ascii')
        # Put the version byte in front, 0x00 for Mainnet, 0x6F for testnet
        # version = bytes([self.TESTNET_VERSION]) if testnet else bytes([self.MAINNET_VERSION])
        # return base58.b58encode_check(version + self.hash160(compressed)) 
開發者ID:ranaroussi,項目名稱:pywallet,代碼行數:20,代碼來源:ethereum.py

示例6: change_version_byte

# 需要導入模塊: import base58 [as 別名]
# 或者: from base58 import b58encode_check [as 別名]
def change_version_byte(address, new_version=None, new_crypto=None):
    """
    Convert the passed in address (or any base58 encoded string), and change the
    version byte to `new_version`.
    """
    if not new_version and new_crypto:
        try:
            new_version = crypto_data[new_crypto]['address_version_byte']
        except KeyError:
            raise CurrencyNotSupported("Unknown currency symbol: " + new_crypto)

        if not new_version:
            raise CurrencyNotSupported("Can't yet make %s addresses." % new_crypto)

    payload = b58decode_check(address)[1:]
    if is_py2:
        byte = chr(new_version)
    else:
        byte = bytes(chr(new_version), 'ascii')

    return b58encode_check(byte + payload) 
開發者ID:priestc,項目名稱:moneywagon,代碼行數:23,代碼來源:__init__.py

示例7: create

# 需要導入模塊: import base58 [as 別名]
# 或者: from base58 import b58encode_check [as 別名]
def create(cls, flagbyte, ownerentropy, factorb, derivedhalf1, derivedhalf2, addresshash):
        pointb = compress(*fast_multiply(G, factorb))
        pointbprefix = bytearray([ord(pointb[:1]) ^ (ord(derivedhalf2[-1:]) & 1)])

        aes = AES.new(derivedhalf2)
        block1 = long(hexlify(pointb[1:17]), 16) ^ long(hexlify(derivedhalf1[:16]), 16)

        pointbx1 = aes.encrypt(unhexlify("%0.32x" % block1))
        block2 = long(hexlify(pointb[17:]), 16) ^ long(hexlify(derivedhalf1[16:]), 16)
        pointbx2 = aes.encrypt(unhexlify("%0.32x" % block2))

        #  33 bytes           1            16         16
        encryptedpointb = pointbprefix + pointbx1 + pointbx2

        #           5 (cfrm38 prefix)          1            4             8               33
        payload = b'\x64\x3B\xF6\xA8\x9A' + flagbyte + addresshash + ownerentropy + encryptedpointb
        return cls(b58encode_check(payload)) 
開發者ID:priestc,項目名稱:moneywagon,代碼行數:19,代碼來源:bip38.py

示例8: b58encode

# 需要導入模塊: import base58 [as 別名]
# 或者: from base58 import b58encode_check [as 別名]
def b58encode(self) -> str:
        """ Generates a Base58Check encoding of this key.
        """
        return base58.b58encode_check(bytes(self)).decode('ascii') 
開發者ID:ontio,項目名稱:ontology-python-sdk,代碼行數:6,代碼來源:hd_public_key.py

示例9: b58encode

# 需要導入模塊: import base58 [as 別名]
# 或者: from base58 import b58encode_check [as 別名]
def b58encode(self) -> str:
        """
        Generates a Base58Check encoding of this private key.
        """
        return base58.b58encode_check(bytes(self)).decode('ascii') 
開發者ID:ontio,項目名稱:ontology-python-sdk,代碼行數:7,代碼來源:hd_private_key.py

示例10: b58xprv

# 需要導入模塊: import base58 [as 別名]
# 或者: from base58 import b58encode_check [as 別名]
def b58xprv(parent_fingerprint, private_key, chain, depth, childnr):
    """ Private key b58 serialization format. """

    raw = (
        b'\x04\x88\xad\xe4' +
        bytes(chr(depth), 'utf-8') +
        parent_fingerprint +
        childnr.to_bytes(4, byteorder='big') +
        chain +
        b'\x00' +
        private_key)

    return b58encode_check(raw) 
開發者ID:vergl4s,項目名稱:ethereum-mnemonic-utils,代碼行數:15,代碼來源:mnemonic_utils.py

示例11: b58xpub

# 需要導入模塊: import base58 [as 別名]
# 或者: from base58 import b58encode_check [as 別名]
def b58xpub(parent_fingerprint, public_key, chain, depth, childnr):
    """ Public key b58 serialization format. """

    raw = (
        b'\x04\x88\xb2\x1e' +
        bytes(chr(depth), 'utf-8') +
        parent_fingerprint +
        childnr.to_bytes(4, byteorder='big') +
        chain +
        public_key)

    return b58encode_check(raw) 
開發者ID:vergl4s,項目名稱:ethereum-mnemonic-utils,代碼行數:14,代碼來源:mnemonic_utils.py

示例12: export_to_wif

# 需要導入模塊: import base58 [as 別名]
# 或者: from base58 import b58encode_check [as 別名]
def export_to_wif(self):
        """Export a key to WIF.

        See https://en.bitcoin.it/wiki/Wallet_import_format for a full
        description.
        """
        # Add the network byte, creating the "extended key"
        extended_key_hex = self.private_key.get_extended_key()
        # BIP32 wallets have a trailing \01 byte
        extended_key_bytes = unhexlify(extended_key_hex) + b'\01'
        # And return the base58-encoded result with a checksum
        return base58.b58encode_check(extended_key_bytes) 
開發者ID:BlockIo,項目名稱:multimerchant-python,代碼行數:14,代碼來源:bip32.py

示例13: serialize_b58

# 需要導入模塊: import base58 [as 別名]
# 或者: from base58 import b58encode_check [as 別名]
def serialize_b58(self, private=True):
        """Encode the serialized node in base58."""
        return ensure_str(
            base58.b58encode_check(unhexlify(self.serialize(private)))) 
開發者ID:BlockIo,項目名稱:multimerchant-python,代碼行數:6,代碼來源:bip32.py

示例14: to_address

# 需要導入模塊: import base58 [as 別名]
# 或者: from base58 import b58encode_check [as 別名]
def to_address(self):
        """Create a public address from this Wallet.

        Public addresses can accept payments.

        https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses
        """
        key = unhexlify(self.get_public_key_hex())
        # First get the hash160 of the key
        hash160_bytes = hash160(key)
        # Prepend the network address byte
        network_hash160_bytes = \
            chr_py2(self.network.PUBKEY_ADDRESS) + hash160_bytes
        # Return a base58 encoded address with a checksum
        return ensure_str(base58.b58encode_check(network_hash160_bytes)) 
開發者ID:BlockIo,項目名稱:multimerchant-python,代碼行數:17,代碼來源:bip32.py

示例15: export_to_wif

# 需要導入模塊: import base58 [as 別名]
# 或者: from base58 import b58encode_check [as 別名]
def export_to_wif(self):
        """Export a key to WIF.

        See https://en.bitcoin.it/wiki/Wallet_import_format for a full
        description.
        """
        # Add the network byte, creating the "extended key"
        extended_key_hex = self.private_key.get_extended_key()
        # BIP32 wallets have a trailing \01 byte
        extended_key_bytes = unhexlify(ensure_bytes(extended_key_hex)) + b'\01'
        # And return the base58-encoded result with a checksum
        return base58.b58encode_check(extended_key_bytes) 
開發者ID:sbuss,項目名稱:bitmerchant,代碼行數:14,代碼來源:bip32.py


注:本文中的base58.b58encode_check方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。