4

I am trying to query the RPC parse operation method and I found another question about it. But I can't figure out why operation bytes with the same data are different (58 vs 90 bytes), moreover: Query:

https://alphanet-node.tzscan.io/chains/main/blocks/head/helpers/parse/operations

Body:

{
"operations": [
    {
        "data": "0800002122d44d997e158c36c60649d198c4175dad425efa09d2a405f44e00f6f0b40201420eaa410ac21addf427211cddd6115cba385a94000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "branch": "BLpcXF8ADJbGuyUKNv7TypXRd5rqnoPn3PMqJLNBeRSr4VFeUuK"
    }
]}

Response:

[{
        "branch": "BLpcXF8ADJbGuyUKNv7TypXRd5rqnoPn3PMqJLNBeRSr4VFeUuK",
        "contents": [{
                "kind": "transaction",
                "source": "tz1NfEiS2uJsX43vowNjau5pdqg3Nvy8whvc",
                "fee": "1274",
                "counter": "86610",
                "gas_limit": "10100",
                "storage_limit": "0",
                "amount": "5060726",
                "destination": "KT1Ec3jNXyxyA54nezwcjGDRoutECJCQjpya"
            }
        ],
        "signature": "edsigtXomBKi5CTRf5cjATJWSyaRvhfYNHqSUGrn4SdbYRcGwQrUGjzEfQDTuqHhuA8b2d8NarZjz8TRf65WkpQmo423BtomS8Q"
    }
]

Then I'm trying to forge this data without signature:

{
"branch": "BLpcXF8ADJbGuyUKNv7TypXRd5rqnoPn3PMqJLNBeRSr4VFeUuK",
"contents": [{
        "kind": "transaction",
        "source": "tz1NfEiS2uJsX43vowNjau5pdqg3Nvy8whvc",
        "fee": "1274",
        "counter": "86610",
        "gas_limit": "10100",
        "storage_limit": "0",
        "amount": "5060726",
        "destination": "KT1Ec3jNXyxyA54nezwcjGDRoutECJCQjpya"
    }
]}

Response:

"92122a7e654cdff09e22a7be1b7d41bd279ffa197a0137e6fea0d3ed3ce95fc00800002122d44d997e158c36c60649d198c4175dad425efa09d2a405f44e00f6f0b40201420eaa410ac21addf427211cddd6115cba385a940000"

Response is much bigger than parsed data. And if I try to add to response 64 zero bytes or signature bytes I get "operation.cannot_parse" error.

3

If we put the hex strings next to each other and find out where they match it becomes easy to see why they differ.

__________________________Branch________________________________0800002122d44d997e158c36c60649d198c4175dad425efa09d2a405f44e00f6f0b40201420eaa410ac21addf427211cddd6115cba385a94000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
92122a7e654cdff09e22a7be1b7d41bd279ffa197a0137e6fea0d3ed3ce95fc00800002122d44d997e158c36c60649d198c4175dad425efa09d2a405f44e00f6f0b40201420eaa410ac21addf427211cddd6115cba385a940000_____________________________________________________Signature__________________________________________________________________

As you can see the first hex string consists of contents + signature and the second one of branch + contents. When we inject an operation, it should contain branch + contents + signature. That forge and parse isn't exactly each other’s opposites probably have to do with their intended use-cases. Forge is something you typically do before you append the signature, so it would be hard for it to return a signature at that stage.

| improve this answer | |

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.