9 votes
Accepted

Base58 encoding/decoding of addresses in Micheline

Optimized addresses are 22 bytes, which follows the following format: The first byte is a tag, either 00 for implicit (tz) or 01 for originated (KT) If the first byte is 00 and we are working with ...
user avatar
7 votes
Accepted

How to convert bytes to an address

Those 22 bytes are: 2 bytes - encoded prefix (tz1, tz2, tz3, KT1); 20 bytes - depending on the address type: for tz-addresses it's public key hash; for KT-addresses it's hash of the origination ...
user avatar
  • 2,327
7 votes
Accepted

How to decode raw transaction?

Taquito can parse forged bytes using the parse() method in the @taquito/local-forging package. TypeDocs are here. You can see the unit tests here. Implementation to decode a signed transaction: ...
user avatar
7 votes

How to decode raw transaction?

You can use the tezos-codec binary to decode this: tezos-codec decode 006-PsCARTHA.operation from ...
user avatar
6 votes

Format of public key, signature and key_hash literals

1) About the ed25519 public key, and how it is in bytes: From [1]: Ed25519 keys start life as a 32-byte (256-bit) uniformly random binary seed (e.g. the output of SHA256 on some random input). The ...
user avatar
  • 697
6 votes
Accepted

Format of public key, signature and key_hash literals

There are some Python code to do that in this blog and a comment posted by Alain: http://www.ocamlpro.com/2018/11/21/an-introduction-to-tezos-rpcs-signing-operations/
user avatar
  • 3,278
5 votes
Accepted

How do I base58 encode the chain ID using Python?

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\...
user avatar
  • 288
4 votes

How do I base58 encode the chain ID using Python?

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 ...
user avatar
4 votes

Contract's address format specification

When your originate a contract, you send an "operation" to the network. This operation is then serialized into byte format and a hash is derived - this is the operation hash for the given operation. ...
user avatar
4 votes
Accepted

Documentation for Serializing Contract Call Data/Parameters

There is https://tezos.gitlab.io/whitedoc/micheline.html#binary-serialization which mostly tells to run tezos-codec describe alpha.script.expr binary schema for a complete description of the binary ...
user avatar
3 votes
Accepted

Why does `sp.pack('some string')` prepend `0x05010000002e` before the actual bytes?

0x05 means "this is a packed Michelson value". 0x01 means "this is a string". The remaining 4 bytes represent the length of the string. A complete description of the binary format ...
user avatar
3 votes

How to convert bytes to an address

Something to note from the accepted answer is that the KT1 addresses do not have a "public key hash". The hash used there is the blake2b 20 byte digest hash of the operation group hash and ...
user avatar
3 votes

Base58 encoding/decoding of addresses in Micheline

I believe you should be able to make use of Stephen Andrews eztz library to access various tools from a js environment I would speculate the function is this one where you use the KT prefix ...
user avatar
  • 6,006
2 votes

How do I base58 encode the chain ID using Python?

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): ...
user avatar
2 votes

Format of public key, signature and key_hash literals

In Michelson, those types accept two different formats of data (as you mention) - optimized and readable. The readable versions are the base58-check encoded strings (edpk*, tz1*, edsig*, KT1* etc). ...
user avatar
2 votes

How to decode raw transaction?

You can use the RPC endpoint: /chains/main/blocks/head/helpers/parse/operations to do that. Example: await axios.post( `${nodeURL}/chains/main/blocks/head/helpers/parse/operations`, ...
user avatar
  • 444
1 vote
Accepted

How do you convert a string sent to an entrypoint into its byte representation?

I struggled on this for a while but finally reached a solution. It's a bit hacky, but you just have to remove the 6 bytes that sp.pack prepends onto the bytes you actually want with sp.slice before ...
user avatar
  • 439

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