I'm using liquidity lang, and define a storage:

type storage = {
  usersDocuments : (address,address set) big_map;
  documents: string set;

and I add in to usersDocuments https://pastebin.com/dkV4EtL2 as follows:

  let (op,docAddress) =
      ~storage: (fileHash,userAddress,Set,Set)
      ~amount:0tz (contract Document)

  let userDocuments = match Map.find userAddress storage.usersDocuments with
    | None -> Set
    | Some docSotrage -> docSotrage
  let userDocuments = Set.add docAddress userDocuments in

After that, I'm using the RPC api search from big_map, and the api returns:

        "bytes": "011cd5f135e80fd8ebb6e43335b24ca6116edeba6900"

How can I transform the byte array to a contract address, which is created from a smart contract?

1 Answer 1


This is the 'optimized' Micheline representation of an address value.

In the future, I think we should extend the client and RPC a bit, to make things easier here. For now...

You can see optimized encoding referenced in parse_data and unparse_data for the address type.

The encoding is defined in contract_repr.ml.

There is a 'tag' byte first:

  • If the first byte is 0x00, an implicit account public key hash follows. (This, in turn, will have a curve code byte for tz1/tz2/tz3, and then the key hash itself, as defined in signature.ml.)
  • If the first byte is 0x01, an originated account address follows, with an extra 0x00 byte of padding at the end.

So in your example, base58check-encoding the hex 1cd5f135e80fd8ebb6e43335b24ca6116edeba69 -- dropping the 0x01 tag and 0x00 padding bytes -- gives KT1BDEn6wobs7tDReKkGheXAhoq278TGaNn5.

  • Thanks! sorry where you decode , online service? Commented Feb 2, 2019 at 21:05
  • 1
    maybe tezos base58 encoding/decoding deserves its own question? :)
    – Tom
    Commented Feb 2, 2019 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.