3

I am trying to manually parse an operation. By asking the (testnet) tezos node to parse an operation, one can get data to compare:

tezos-client -P 18732 rpc post chains/main/blocks/head/helpers/parse/operations \
  with '{ "operations": [{"branch":"BMUQYkq83VVyhgRLjsWqJZhmEVKyzj22ogLP3QTNC4ziEwqaLHU",
                          "data":"6c00b07ee75b490cfd65c4fe5cef27888754c76751418c0bc2b724e852ac02c48aa401000011dbc55dddc843df043d6f36a162d2f4a8c2176d004bd63386731a940609ded1d37bef4ea373304c05389000eb1d16fd44480a9b6231c8859fd26b78d98ab410cfd399f329495caa64a1856b53a13c19f141168306" }]}'

which gives:

[ { "branch": "BMUQYkq83VVyhgRLjsWqJZhmEVKyzj22ogLP3QTNC4ziEwqaLHU",
    "contents":
      [ { "kind": "transaction",
          "source": "tz1bjFeJnrEU3zjhDW8uG1Xtd7MRyHkp5VQd", "fee": "1420",
          "counter": "596930", "gas_limit": "10600", "storage_limit": "300",
          "amount": "2688324",
          "destination": "tz1MGTTLMhikC7qkfduaS9XKNMvHEkSxMq4X" } ],
    "signature":
      "sigXukL1KWLCddQtZYPxp3NdXpqSVufPQBU1QwdYQCM8dsFvow6UwdBoFgJynfdDUNuwDPguTK6Jq9YyoFgi5PtrQ8cs4c8e" } ]

Converting the source, tz1bjFeJnrEU3zjhDW8uG1Xtd7MRyHkp5VQd from Base58 to hex gives 06a19fb07ee75b490cfd65c4fe5cef27888754c76751419acb5dba. When I remove the first three and the last four bytes I get a match: b07ee75b490cfd65c4fe5cef27888754c7675141.

Similarly with the destination.

The tezos node however requires branch as an input and I do not understand why. Now, I have not decoded the amount yet, but so far I cannot see what I need branch for. What is it I do not understand? What piece of the puzzle do I not get by omitting that in my effort to parse the operation?

5

Every transaction in current and past Tezos protocols must reference a recent block (the "branch"). This acts as

  1. an informal checkpointing mechanism
  2. a replay protection mechanism
  3. an effective time-to-live limit on transactions

edit: As to why it is required for parsing, it is because the node uses the branch to determine which protocol it should use to parse the operation.

| improve this answer | |
  • This does not yet answer the question in my opinion: Why does the parse endpoint need branch to parse the operation when the source, amount, destination, and other fields can be read directly from the raw hex without knowing what branch is? – Thorkil Værge Oct 13 at 7:54
  • 3
    Ah, I see. One guess would be that it needs to know the branch to find out which protocol to call since the parsing is protocol specific. – Arthur B Oct 13 at 10:16
  • Thank you. I would like to accept your comment as the answer. Can you edit your original answer? – Troels Bjørnskov Oct 14 at 12:42
  • done, thank you – Arthur B Oct 14 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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