Hot answers tagged

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 ...
2 votes

How to call PACK in JavaScript

Taquito has this functionality: the packData method in the RPC client package.
1 vote
Accepted

How do you submit a pair when calling an entrypoint on a contract with Taquito?

Your code is correct, but you have to use the methodsObject property instead of methods if you want to use a JavaScript object as the parameter of the contract call. Alternatively, you can split the ...
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 ...
  • 359
1 vote
Accepted

How are strings serialized in Tezos?

Strings are serialized as follows: 01 to indicate type string Four bytes (eight hex chars) to indicate length of string: 0000000c=0x0c=12 in your case The string represented by its ASCII values: ...

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