How do I convert an address type to a string type in LIGO?

1 Answer 1


You cannot convert an address to a string in Michelson. You could cheat by going through pack and inspecting the binary representation but it is unlikely something you would want to do.

  • OK. I solved my problem another way, by changing the JS signature generation. I still am curious about the answer, though. How would you achieve this? We can probably learn something from getting this explanation. Commented Oct 6, 2020 at 13:33
  • Cheating involves going through pack and inspecting the binary representation. Very ugly.
    – FFF
    Commented Oct 6, 2020 at 13:58
  • Voted up. Will gladly accept answer if you show the specific code to do this. Either in an actual programming language or as pseudo code. Commented Oct 7, 2020 at 8:09
  • 4
    You first compute pack(my_address) then you can do a for loop on each byte of the meaningful part (not the prefix) with slice and associate a string by using a pre-determined dictionary. If you want to write the exact address, you need to implement the base 58 translation in Michelson. It’s obviously super cumbersome to do. You possibly also need to take entry points in addresses into account but I guess that, at this point, you should really have stopped caring.
    – FFF
    Commented Oct 7, 2020 at 8:44
  • i need to do this inside a unit test is there an explicit example to get the string of a contract.address
    – 0x10
    Commented May 2, 2022 at 4:39

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.