Introduce Merkle proof RPC API using Plebeia
Introduce two API
-
GET
/chains/<chain_id>/blocks/<block_id>/generate?key=<path_to_the_value> -
POST
/chains/<chain_id>/blocks/<block_id>/validate?key=<path_to_the_value>
How to use
#!/bin/sh
set -eux
BLOCK=$(./tezos-client rpc get /chains/main/blocks | jq -r ".[][]")
KEY=message
./tezos-client rpc get /chains/main/blocks/$BLOCK/merkle_proof/generate?key=$KEY > proof.json
./tezos-client rpc post /chains/main/blocks/$BLOCK/merkle_proof/validate?key=$KEY with "$(cat proof.json)"
+ ./tezos-client rpc get /chains/main/blocks
+ jq -r .[][]
+ BLOCK=BMCXiN9bqhpmasRVQEvxX9yEYrWwqni8iw2e9ToJKVkKDKRdy2k
+ KEY=message
+ ./tezos-client rpc get /chains/main/blocks/BMCXiN9bqhpmasRVQEvxX9yEYrWwqni8iw2e9ToJKVkKDKRdy2k/merkle_proof/generate?key=message
+ cat proof.json
+ ./tezos-client rpc post /chains/main/blocks/BMCXiN9bqhpmasRVQEvxX9yEYrWwqni8iw2e9ToJKVkKDKRdy2k/merkle_proof/validate?key=message with { "proof_stream":
[ [ "LLRL",
[ { "invalid_utf8_string":
[ 255, 86, 149, 253, 111, 140, 31, 103, 83, 206, 141, 190, 250,
6, 229, 163, 22, 29, 251, 202, 185, 16, 40, 212, 22, 1, 136,
232 ] },
{ "invalid_utf8_string":
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 173 ] } ],
[ { "invalid_utf8_string":
[ 143, 219, 88, 193, 203, 87, 100, 158, 55, 197, 70, 2, 118,
129, 36, 145, 22, 18, 98, 207, 90, 128, 167, 183, 37, 172,
24, 16 ] },
{ "invalid_utf8_string":
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 209,
149, 205, 209, 125, 141, 161, 133, 165, 185 ] } ],
[ { "invalid_utf8_string":
[ 9, 237, 41, 194, 82, 22, 180, 86, 250, 152, 215, 93, 203, 34,
197, 169, 225, 253, 186, 210, 21, 73, 124, 69, 119, 10, 124,
245 ] },
{ "invalid_utf8_string":
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5,
193, 201, 189, 209, 189, 141, 189, 177 ] } ],
"LRRLRRLRLRRLLRLRLRRRLLRRLRRRLLRRLRRLLLLRLRRLLRRRLRRLLRLR" ] ],
"data": "lvl 151899, fit 4457067, prio 0, 27 ops" }
true