@t3rn/eth2-proof
v0.2.1
Published
Source merkle proofs to check against:
Downloads
6
Readme
eth2-proof
Source merkle proofs to check against:
- transaction_root
- state_root
- receipt_root
Supports and checks against roots as per latest RLP-encoding; extended with support to RLP-encode 3 currently supported transaction types:
- Legacy
- EIP-1559
- EIP-2930
get state proof
Usage: node build/cli.js state <accountId> <storageId> <blockNumber>
Example input:
tsc && node build/cli.js state "0xdfe97868233d1aa22e815a266982f2cf17685a27" "0x02" "latest"
Example output:
{
accountProof: [
'0xf90211a0d021083e172ddfc1435d709f937c65994ad23cf5b8af09e4394c126b2d0d608ca0da535eeeb2177375fb31135c3afd34a99bd7d1b4f2648cf7f03a7ce6448cd097a0c430fb9eb1d12406078f77264d781fb682a4b68bc0c2be095f756afd5278721fa0114c0ce8ff7913b191e266f1b970b3f9bc13a3c04ee02117b181cfb389e7146aa019cdcdfcec98fe9eb3c153dc0e440e9a9d814329906f73eeee55349d46b50242a0cf3c435d71470d20164bd257b5e5dba666cd9a66efea0ec1a812dcc8a240e8d5a09c60ef5d814f342d76917b99fec15528e6380b85ea98420d6247fc13a4afca2da0af1c79732f852c14b24e5237281d471e91411f16592884b996b098d86f70ec86a0445df98a747d244f6f20148a4d4dd816969c7661da06d1aef552ed4955c2b54ea02021fabc9867a7ab0cd69a9227b3f46c8d785bf36df67c568d7324480a373e14a08bc04e2fb49bb0a47a893dc2ea17b9a944ec50bfec0be744c68147afee1c4952a082874a2c6a40a27e5a6b3702e5f0e42c62bccd437b6ce8b3dec8b02c29d4c795a0e48a12aaee211bc6effb447e52b75e2e8af73ce4a1b9e0425749974c021ef791a06d8d9768d54f1f7396f413fcd27266128a36cc7bc2dec93c7a803a33218e072ca0fd4c54f4cdd7a90a4dc0d4ada8f155941620c46e6ccb2fff4eb1ddb3fd329efba0fcbb06056678e9aa255e17c561932d4ae8c4461398ed9d7218714ef30761d5b780',
'0xf90211a051c0d20c35cd4b6ccaed48afaf91364020361587f27bda9a1237dadfb8d10084a0d65fbc61d1500c11e68c2d0f94804041a27290aefcd766b23e257ba118ec1269a0ab333a5a8af034bf4233f1b9eff24fea533d5dff54ab5624c31f52a848291af1a0487de9a08bad8d79a7e951293dcb5c80d69f526ef8abd16cb22279615cfbf3baa0329959a3b8d0bb9a8da046260631c8c82cac50d5ebb0847b310c9d6039a5f74fa00fb376660d035e1ae5c66f6141c98a25e398dc36af5e37155faef90676363378a09a16feaf7af4355815344640551eeaeadd9d76ed5db892f18ca8271ed31f8307a012e22f98af8fa4ac723e93855dd714722c1ad36022ed2e9cc881b1d662980a5da013069cc603aa0dd3505f9fd9372a19c25b0e059352ea393546feda8e4ca85f6ca02452d186b8012d552903309e5a196237697f3dd32037319691ecaeb3cf753d5ca0b23c927bd3c0adf95c476de7b13ab484e22239095f2e412fc14b9dc998c3eaf7a086b961f9c9a506611034e31c708d9792cff9074fac82de7d4b900fc8c326583ba078ddc9dce564c0a6762c33ea3cf0672fe22788479c86c9e0b5525d838ed52482a091078f7d8d691d118edb3b58579843c167b7c5156368b36c000f1e34d59ab1f1a0b267752522feddceed800b2ff6bc4e612c7f17b2f3d7a7f423f3688b42e893fda06f57be019ae922868eeecf0dbf9db85bc82177d0420160dbf5c31e8f4bc0adc580',
'0xf90211a0dc9fe5b93c14bbba3a213d281a2ff0f9b87b20ff6d31279304641c59d51f7e58a0e8691a6c1c7a5333cf1ab07c2046b3afdb98ee695959fbb2e1e6c67c8a8183f9a0b5c75a068c6e8a1b83637fc24d192277f1d7ee16b56164d8d7d5cb5f1ddcbee1a0f07801bd44f6e59417c4ccdb15046d88cc8a7911c7f3d283950450762f4605d9a04943d27cb7c244e1022377a995d9eaf4c89b529a034226f0dd005b1d49923056a0748b08be662290712d8af0e0610f634407a68f70c894980a76e6b4eebf67856aa04b3fc97be4be1756b233fada99431c8ccd3de9fa2f29577d667ec8e1f61b391aa0fe5cef6438d078dee1e89e9d8c4761f0aaf8af23850dd5868ef903bc8f281b69a0c2cca6f9c0f84e7565937f5b1c5a2153f57a250a18f8d9e2f13c77829e7a23baa057ba1b3ad640709ff7a0f7fce24baf6a3ed4bd713bfc2e227ac4ddc02430002da0f7345460056a5c9d228866b50f0bc129dbc3659f95bf6ee0a3a1645efa441f32a007cd1fa4f12e2f6ff46e5016335c05fc2b6f86f9c1c137c707ad10ec7608b925a050af26616fa0a3cb8eb76f6360ee2fdc887058794d69c555ef22e0097fb2778da04d7b568dd002bf78d3a8a91abf27dc27a3b71d414ab4f2d5cb1943de25ca05a4a09b60839b195f4913f12d7b0f97e61b2c961c7de74a9efc335f12cd684cd8168aa0f689db85dafb3f21017ad2376b2840e7ba9e5c6229adb7dfddd186033abf62d780',
'0xf90211a0a8bd157f234110e6d2d0be65694c115db29b9d83d81a8135cb9bf93bb1219de9a0c4f995963c771893d34126d045cc6fd3b0c7bddcba7c963ce6fa03a15fed216aa0eea37ad0d51f6e66cbcc16b7792b0fe64f218b5b281fd264d67cb18dfd299351a0ed0e40beec3a59be243a6d8f9c091bff42e7c893fe90d7a02e9aaa67ad36086fa0471abe28c5b8cdb1abf3b275bc5c2041b6604820b2cff27f72f5610ad58fc108a0b36bd0142bbfcd2c16affa6b8c50e49a89db77cbdcc5fcc2b29731b4391d8ceea0ba724610cdd1c85597be289b9dbbf65d3586ff8d26c6ad6ce20226745d29d8b7a075da80362098c25ffeca7c24357c4feef547e3152c77eded0abe1c34ae1f449ba0642fff41679e85c0885bbf5f84922777a2a519c24b6f7b0190c36e4b1654911ea0235a8e35820a3d159f872009fee7341baea61400d3ba7dfdfba5720d3211ff8da0b7414621744636fb0edda310da5f2f837a57d66d777ab7ed6000fb4dd76b0e4fa01f7bf46f77f3fada33c38bf131d32f314dc2f3c8420c65297761e5990d2e37fea08bba2f413805dc520711ff765d08c0e9b8bd13cb6b34a20ea73ec062fc3ddf97a03a265e2be19f68e5bc90f8c5086946ebd6e7d6b1ac421df4b618985c1222fdd3a05b09320ee19fd79e4da6b0ed1a278057ca343d7beafe35ac84c0ef3886cbb4ada0388ee443dcd5c82d288aeeab53270fa8653a80b89748029999d36941684e235480',
'0xf90211a08218feff417e3c3417703117be944bf1925e01f11b1446a04b8abefcfc40a854a0a7bb1361935ffe57be007db2af1863997599e1c506c65fcfc6e8a40d1ed3f2fba094fb0cd2204b8fd3504374247233b960318f2c231144d653e5b2babf7736e136a03632f8aeca1ca9a72323bff25304b0b9fce214f69bd035a101d9d11dafee80b3a0103162a1c786792f631ea45bd2cb314ad54e6d8813c49df0706d1ce105efc55ca08c6875cfb1743284cb7dfa2e01f8bbbbe6f752fe9b392487d2fc0b60a2705ed6a007e11de0b2c0c1f7b135e214599aab9fdb19c5ca21413e71c6ee65a13a6b2104a0ba804d1b0293cc4a5adbe4ccd9ce630f0afece4b14f6f00c0d2f1c81ed1edde5a08de41523a53e15f20297e14d521c586fd98a708599b2ea0aca645880f742074aa09341470dbf2f98ccbfe1efc11550b7307cbf7b46a625bf1a3d5c9bf298a8d431a0010e558db573a7463f8924e36e9422d05b7e8cd633a4ff841c5da27ed07c6feca039235ca42dc99b364829b054d04f9685fec62816bdc6460d6eacaf0672d3b6e2a034ce7d875a201d5a656e74ef6fed90391b3ba7bb50f2aa4cccaa3e9071aa6c76a06f2c3ae654eb767ace29dc8a63f1a8a7bf342a7b2119c151b862fe8772b60a9fa0e4fcd4c82bd07741b85f9694c1afffb90af48743eebc345b420e0da6f6df773aa04947fe5b49499dde003590b404d5af0fb7fb760cf2a2d2f0a439815ad81e206b80',
'0xf90111a0c5c421b52d62edd63b7bd13ae271707a1772846be4e5f72178ed847e5b6cad12a050ff58a8c04442916e6dd2efec049926e278ac7b6a97ded9a86e0e583d41d6618080a08f30126d68c0e18561a10c3af36ba4e60a60d00b63d2b66731c630951a31c585808080a05772f0baa91152827e5c798ecf3033d653e722cafb62d0216612b84f52431f86a032276823f02023b7f6d69ba1b86337d26713e3818f2c69c67b5f22636a8e98b5a005f88fa968d07eae893be97a90d76faf120437ca7f643ae876bafc71f37475758080a0242f4a42ca88d289db2edebb3e37a816b9dc34bcd737ad9161f9bdb261797371a0b496b7ec8002c4c813b338dd93cd7dfca7273548a871334eb1378d9e0b9f61ed8080'
],
balance: 0n,
codeHash: '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470',
nonce: 0n,
storageHash: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
storageProof: [
{
key: '0x0000000000000000000000000000000000000000000000000000000000000002',
proof: [],
value: 0n
}
]
}
get receipt proof
Usage: node build/cli.js receipt <transactionId>
Example input:
tsc && node build/cli.js receipt 0x569a367d4cea332568a00e1fa4389c1fc2d79a7be4224bef179716d768605bae
Example output:
⬅️found receipt for tx: 0x569a367d4cea332568a00e1fa4389c1fc2d79a7be4224bef179716d768605bae
🔃parsed receipt to hex form
⬅️found block for receipt: 0x2dddaa24be610e158797de525e5cfcab24f7af65b58968187807ac1c80c9d84b 3154935n
⬅️fetched all 47 sibling transaction receipts
Computed Root: 1fc3f6f35cd2d116fc1fcb611b55dc03dfebc6df6bbce905526a5889f503e49b
🧮proof-calculated receipts root vs block receipts root: 0x1fc3f6f35cd2d116fc1fcb611b55dc03dfebc6df6bbce905526a5889f503e49b 0x1fc3f6f35cd2d116fc1fcb611b55dc03dfebc6df6bbce905526a5889f503e49b
{
proof: [
'f891a080298c92db9bde8ca20e2df38bff1ff24608504c710fe533c2e500406fefd134a000dce763fd4535bf27444cb96101316826a515a457a32f61457ae8bf2ffc17d4a0fbcba203b3103d8d73e2b128a50fc6c7e710ed746d2ceec57dea10d8c31a9eb98080808080a008f4a0eaec0e5829f0d31b1984afc71b82bb4d584b7b22448e1d7f92fbe9bf318080808080808080',
'f90211a0cea545a257ae38075fef0a904e0c11197bd3a22837f971e1491dc12ae299f590a0472205b5fef3bddc9dd874c0fcb96d5e2395308b785ccfa1e29f3046dc6a3277a006e9c0e0a44712169fbe20af548b37b85ad3d0de1553926e7200ceab0b837fa4a0f00a9b4083647baa1a6a0c4fc5425255476171b129e776722ab095688b77aa3fa07ff92702b3ef9eb7a941698d1116660b16ba1730d697bf7500a9efa4e2dda7f4a0db1a837728cb27389061a085acb9e6a7a4ade9bd04450b432ddefb06178ab308a037214840726ad01886709f8d13d38cac07afb7b8fe4138c2d37329ecac123a81a08c9fc645123dc9a0d3363754f469fcffdeceb7a79651568571ba011739448b52a0f122b314b070a232645e47819cdbe4a6f2bd059890594662f0fd5146b0119056a0f92631a2242b17fae3f2ca0124c34eca856066446ddeaa5cdfbd86030ca252ada063c0e65ef44b66d51950a8ad776f5f381a2a288963861f98c082f88a179093cca09c0134170b90fa547e80ddb7c25680f9df83fde2475db69a6edd5cdc7eb59d4aa0e51b57aeb5719fd1d66dc6abcc1de43482281c319f8b4de0b5c7a22fa856656ca0825a5ab6c789e11673440b1c8c547366adfba8ad347cb78489f498c897f724d7a0e278aba6fe770ac3065f14946e52d587b1cb7a29945c60396afe28346ababcc8a092cd65459ded618a71e36a709f719c6f8afc14afc8c73e8df3943549dc3d799580',
'f9011020b9010cf9010901831e1358b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0'
],
root: '1fc3f6f35cd2d116fc1fcb611b55dc03dfebc6df6bbce905526a5889f503e49b',
index: Uint8Array(1) [ 29 ],
value: 'f9010901831e1358b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0'
}
get transaction proof
Usage: node build/cli.js transaction <transactionId>
Example input:
tsc && node build/cli.js transaction 0x569a367d4cea332568a00e1fa4389c1fc2d79a7be4224bef179716d768605bae
Example output:
⬅️found receipt for tx: 0x569a367d4cea332568a00e1fa4389c1fc2d79a7be4224bef179716d768605bae
🔃parsed receipt to hex form
⬅️found block for receipt: 0x2dddaa24be610e158797de525e5cfcab24f7af65b58968187807ac1c80c9d84b 3154935n
⬅️fetched all 47 sibling transaction receipts
Computed Root: 1fc3f6f35cd2d116fc1fcb611b55dc03dfebc6df6bbce905526a5889f503e49b
🧮proof-calculated receipts root vs block receipts root: 0x1fc3f6f35cd2d116fc1fcb611b55dc03dfebc6df6bbce905526a5889f503e49b 0x1fc3f6f35cd2d116fc1fcb611b55dc03dfebc6df6bbce905526a5889f503e49b
{
proof: [
'f891a080298c92db9bde8ca20e2df38bff1ff24608504c710fe533c2e500406fefd134a000dce763fd4535bf27444cb96101316826a515a457a32f61457ae8bf2ffc17d4a0fbcba203b3103d8d73e2b128a50fc6c7e710ed746d2ceec57dea10d8c31a9eb98080808080a008f4a0eaec0e5829f0d31b1984afc71b82bb4d584b7b22448e1d7f92fbe9bf318080808080808080',
'f90211a0cea545a257ae38075fef0a904e0c11197bd3a22837f971e1491dc12ae299f590a0472205b5fef3bddc9dd874c0fcb96d5e2395308b785ccfa1e29f3046dc6a3277a006e9c0e0a44712169fbe20af548b37b85ad3d0de1553926e7200ceab0b837fa4a0f00a9b4083647baa1a6a0c4fc5425255476171b129e776722ab095688b77aa3fa07ff92702b3ef9eb7a941698d1116660b16ba1730d697bf7500a9efa4e2dda7f4a0db1a837728cb27389061a085acb9e6a7a4ade9bd04450b432ddefb06178ab308a037214840726ad01886709f8d13d38cac07afb7b8fe4138c2d37329ecac123a81a08c9fc645123dc9a0d3363754f469fcffdeceb7a79651568571ba011739448b52a0f122b314b070a232645e47819cdbe4a6f2bd059890594662f0fd5146b0119056a0f92631a2242b17fae3f2ca0124c34eca856066446ddeaa5cdfbd86030ca252ada063c0e65ef44b66d51950a8ad776f5f381a2a288963861f98c082f88a179093cca09c0134170b90fa547e80ddb7c25680f9df83fde2475db69a6edd5cdc7eb59d4aa0e51b57aeb5719fd1d66dc6abcc1de43482281c319f8b4de0b5c7a22fa856656ca0825a5ab6c789e11673440b1c8c547366adfba8ad347cb78489f498c897f724d7a0e278aba6fe770ac3065f14946e52d587b1cb7a29945c60396afe28346ababcc8a092cd65459ded618a71e36a709f719c6f8afc14afc8c73e8df3943549dc3d799580',
'f9011020b9010cf9010901831e1358b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0'
],
root: '1fc3f6f35cd2d116fc1fcb611b55dc03dfebc6df6bbce905526a5889f503e49b',
index: Uint8Array(1) [ 29 ],
value: 'f9010901831e1358b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0'
}