2

I am trying to verify a proof that a contract has some value stored at a specified key using the contracts storage root and a proof received from a web3.eth.getProof call. Here are the results:

storageHash: '0x030748d1533b7bd4a22bba317ba2caa7c244bcbdb5671b95c324766a19edbdbd',
storageProof: {  
     key: '0x2',  
     value: '0x24ffaf4fd513facfcd1461d1ab0ddd43bb9ca373',  
     proof: [  
     '0xf901f1a01d250391f720e45d1b6ee889bd3f9fc594a28f0d69a947caf133c2d7b694af40a0c1d82b90949c58e4200397295a02ab919513a11403e8feb7d85ca3f52de98e9fa0f24979a76d80eff6c1bc2bb39056a55964e3f4ac3e2040ed86403a4dc7a64cd7a072ec73bb8f3d2ca366885bd0cc44ca9849cb1f32e7deee54d1a26ab93c0ba24aa09a57a25c359a21ed3b1c650a79656d9a9ccfadf0822a25c224e7460b0239603ca09e31a59c9d63e796f1d8b7f8fd0325e722cc902e6f0878f3902336e1a03e2011a03a9658f65258e095f5c4647b2510dd74371e4e509daae8073bec8ee693312591a0b614b0d2d8f8dd8761ae0738616d2d42ee15a45028aa77cf50429d1ba70dc1bba028a3c1d515bba627f6da4545b456799a0ba443cc10cc448a8521e32d098824f8a0d487fb20a0093d093d4c017e71b97e6a13c2673e238d0767464d099707a54fa9a0cbd75c361c63065f79546c236dcf40927bf29099910b42676de4f9475652a6e8a04afd022206bed7f3a9247ede3fc7c08221168b6219632dbbeba4aaa6c02077d2a0f0d0b63a7c983e4705bafd301b948cf809a29dc5b2d15055a66fb3090745909ea09a700f4cbdcbdf0b3d5af2ee694ab63ef2face4cdad0ad0e10d596f5d9ed827d80a09cb8dd96a2a93d38c514a4426737bd63978cda8a061ec4e8d56761c9d68bed1180',  
     '0xf891a0763902fd427b8f29c5f26e793ad3ea6705b120edef718690f785bd1ee1e404258080808080a01a08e4a438b60cca94c89097eb98f85782a124e8ebdfcee7f4697af0a9b4d441808080a0cbc0156d648e34e4a2405a4f68bc44e2071992077bf0cce9ef0394fc0ed5d11f80808080a00a39726d15dd00726445876325da5f10fdc05e5f9884d59e10cbd23a5664969e80',  
     '0xf8518080808080a0fbf384e26e9ea66e28445ee01b9cc85c31496158d390bf17a42d35ad559a6e7480a0055de1019e7abe1a23cffb7a102e8cbe19d1c5e2dc8253022439355a1a55a852808080808080808080',          
     '0xf69f3787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace959424ffaf4fd513facfcd1461d1ab0ddd43bb9ca373'  
        ]  
      }  
    ]

I am not sure why the proof includes 4 nodes when the key is only 1 nibble long. Could someone explain how to verify this proof and how exactly it was constructed?

It looks like (from putting the proof nodes in a trie, that the data 9424ffaf4fd513facfcd1461d1ab0ddd43bb9ca373 is stored under key 405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace. Not exactly sure how to interprest this as the data I'm looking for is the fixed size (obviously) address 24ffaf4fd513facfcd1461d1ab0ddd43bb9ca373 under storage key 2. Pretty confused...

Thanks :)

1 Answer 1

1
  1. The full key is "0x00.....02". it has 32 bytes, but to minimize the storage in leveldb, it trim the redundant zeros.
  2. You can put the content proof to python rlp package to see what happened, like rlp.decode(proof.stoargeProof[0]). The proof array is rlp-encoded trie node.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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