We changed our privacy policy. Read more.

Hot answers tagged


Base58 encodes characters by appending a prefix, treating the bytes as a big endian number and writing that big endian number in base 58. Therefore, specific prefixes can pin down the most significant "digits" in Base58. The python script b58_prefix.py in the scripts directory of the Tezos repo can help find those prefixes. Note that to run it you will ...


Your magicbyte seems to be wrong. If you take the decimal byte values from the original, convert them to hex, then pad it with a leading zero, you get >>> struct.unpack('>L', b'\x00\x57\x52\x00')[0] 5722624 This value should produce the expected result: >>> payload = '...


It looks like you are only actually grabbing 2 bytes of data (4 hex chars). I verified this by decoding the result you got, and it only returning two bytes of data for the given magic byte. Try making the following change: def get_chain_id(self): chainid = bytes.fromhex(self.payload[2:10]) return bitcoin.bin_to_b58check(chainid, magicbyte=5722583)


Base58 prefixes will always produce a prefixed output for a set length of output. So the input address is 20 bytes + the 3 byte prefix gives a 36 char long address with tz1. You calculate these prefixes by guess and check.


You can find those bytes at the bottom of this file https://gitlab.com/tezos/tezos/blob/master/src/lib_crypto/base58.ml In your case, "\013\015\037\217"


You can use the tezos-codec binary from the latest mainnet-staging branch to parse these bytes. So, signing request are indeed prefixed by the tag 1 + <chain_id> for the block cases. The remaining part is the unsigned block header itself which can be decoded : ./tezos-codec decode 005-PsBabyM1.block_header.unsigned from ...


First of all, many thanks! You've helped me with solving the block signature mystery :) You can use pytezos.encoding package: from pytezos.encoding import base58_encode def get_chain_id(self): chainid = bytes.fromhex(self.payload[2:10]) return base58_encode(chain_id, b'Net')


Try pytezos: >>> from pytezos import Key >>> public_key = 'edpku976gpuAD2bXyx1XGraeKuCo1gUZ3LAJcHM12W1ecxZwoiu22R' >>> pytezos.Key.from_public_point(public_key.encode()).public_key_hash() 'tz1KtUYJRPHCYiakAji1pfi6JyjZngYmReKF'


Have a look at this library for Tezos, written in Go. This function in particular generates a new wallet from random bytes (mnemonic and password can both be considered as random bytes) and creates an unencrypted secret key, public key, and public address.

Only top voted, non community-wiki answers of a minimum length are eligible