Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Add rpc methods to serialise the world state #656

Closed
JoranHonig opened this issue Oct 29, 2020 · 3 comments
Closed

Add rpc methods to serialise the world state #656

JoranHonig opened this issue Oct 29, 2020 · 3 comments

Comments

@JoranHonig
Copy link

It can be useful to be able to serialize the accounts & their states post deployment.

To allow external tools to interact with ganache and get this information there would need to be two additional rpc calls:

evm_getAccountState() -> to return a tuple (address, balance, nonce, code, storage)
evm_getAccounts() -> to return a list [address, address, ...]

Context

These two methods have single responsibilities, so there can be several applications.
I'm looking to construct a json object that looks like:

{
    evmState: {
        0xa03.....: {
            balance: 100,
            nonce: 0,
            code: "0x6064....",
            storage: {0: "0x00000000000001202030...", 1: "0x10"}
        }
    }
}
@JoranHonig
Copy link
Author

What's the proposed method of formulating the interface & return data structure for new custom rpc calls?

ps. I'm 100% down to contribute the code for these rpc calls 👍.

@gnidan
Copy link
Contributor

gnidan commented Mar 31, 2021

So @haltman-at petitioned turbo-geth to add a debug_accountAt method, which would cover most of your proposed evmState. See the corresponding ganache-core issue... except for only a specific account.

In addition, there's already debug_storageRangeAt implemented for the upcoming Ganache v7.0.0, which enumerates storage for a given account.

So the missing piece here seems like debug_accounts (e.g.), just to provide a list of known accounts.

If your offer to help implement still stands, I don't believe any work has started on the first mentioned method. Please let us know!

Hope this helps.

@gnidan
Copy link
Contributor

gnidan commented May 5, 2021

Closing this for issue maintenance. @JoranHonig let us know if you'd like to continue the conversation here and we can re-open. Thanks!

@gnidan gnidan closed this as completed May 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants