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,598
2
votes
How to call PACK in JavaScript
Taquito has this functionality: the packData method in the RPC client package.
- 886
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 ...
- 886
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: ...
- 729
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
bytes × 5smartpy × 2
encoding × 2
serialization × 2
string × 2
pack × 2
smart-contracts × 1
michelson × 1
taquito × 1
contract × 1
javascript × 1
types × 1
documentation × 1