当前位置: 首页>>代码示例>>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;未经允许,请勿转载。