Timeline for Can one read the contents of a private variable in a contract outside the contract? [duplicate]
Current License: CC BY-SA 4.0
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 13, 2021 at 11:03 | history | closed |
Richard Horrocks alberto Ismael♦ Majd TL CommunityBot |
Duplicate of How do I see the value of a string stored in a private variable? [duplicate] | |
Apr 12, 2021 at 23:13 | comment | added | Ram Patra |
cheers @RichardHorrocks, this worked for me web3.eth.getStorageAt('0xC05B6465914841FcFf642b6f9aDE6982b8B92175', 1, (e,v) => console.log(web3.utils.hexToAscii(v)));
|
|
Apr 12, 2021 at 22:43 | answer | added | Mikefrancis | timeline score: 0 | |
Apr 12, 2021 at 21:54 | comment | added | Richard Horrocks |
If you're running a full node, you could read the data direct from the levelDB state database, but that's even more difficult than using an RPC method like getStorageAt() .
|
|
Apr 12, 2021 at 21:54 | comment | added | Richard Horrocks |
I think you'll need to run web3.utils.hexToAscii() on the returned result - > web3.eth .getStorageAt('0xC05B6465914841FcFf642b6f9aDE6982b8B92175', 0) .then(result => { console.log(web3.utils.hexToAscii(result)); });
|
|
Apr 12, 2021 at 17:36 | comment | added | Ram Patra | Another question would be, is web3 api the only way then? Are there other ways/apis with which I can access? Thanks again for the help 🙏 | |
Apr 12, 2021 at 17:33 | history | edited | Ram Patra | CC BY-SA 4.0 |
added 1 character in body
|
Apr 12, 2021 at 17:29 | comment | added | Ram Patra |
Yes, this is it. I was thinking getStorageAt would be the way but wasn't sure of it. One last question though, I am getting 0x6a6f657900000000000000000000000000000000000000000000000000000008 when I do web3.eth.getStorageAt('0xC05B6465914841FcFf642b6f9aDE6982b8B92175', 1); but I do not know how to decode it. Any tips? I tried hex decode but doesn't work. Maybe I am missing something here.
|
|
Apr 12, 2021 at 16:51 | comment | added | Richard Horrocks | How about this one -> ethereum.stackexchange.com/questions/44893/… | |
Apr 12, 2021 at 16:44 | comment | added | Ram Patra | thanks for commenting, however, that answer still doesn't fully describe the 'how' part of it. | |
Apr 12, 2021 at 16:42 | history | edited | Ram Patra | CC BY-SA 4.0 |
added 2 characters in body
|
Apr 12, 2021 at 16:36 | history | edited | Ram Patra | CC BY-SA 4.0 |
added 951 characters in body
|
Apr 12, 2021 at 16:32 | review | Close votes | |||
Apr 13, 2021 at 11:03 | |||||
Apr 12, 2021 at 14:15 | history | asked | Ram Patra | CC BY-SA 4.0 |