Process to find out an account's balance in the past
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
What would be the process to find out the balance of an account at a specific point in the past?
Is it correct to say that we have to get the balance from the current World State Trie and then roll back every single transaction involving the account from previous blocks until we reach the point in the past (block) that we want?
solidity transactions blockchain
add a comment |Â
up vote
3
down vote
favorite
What would be the process to find out the balance of an account at a specific point in the past?
Is it correct to say that we have to get the balance from the current World State Trie and then roll back every single transaction involving the account from previous blocks until we reach the point in the past (block) that we want?
solidity transactions blockchain
I have a blockchain -> SQL converter with historic balances, if interested , let me know. Its an open source project that is coming soon.
– Nulik
Sep 1 at 23:04
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
What would be the process to find out the balance of an account at a specific point in the past?
Is it correct to say that we have to get the balance from the current World State Trie and then roll back every single transaction involving the account from previous blocks until we reach the point in the past (block) that we want?
solidity transactions blockchain
What would be the process to find out the balance of an account at a specific point in the past?
Is it correct to say that we have to get the balance from the current World State Trie and then roll back every single transaction involving the account from previous blocks until we reach the point in the past (block) that we want?
solidity transactions blockchain
asked Sep 1 at 19:02


Ethersworn Canonist
422
422
I have a blockchain -> SQL converter with historic balances, if interested , let me know. Its an open source project that is coming soon.
– Nulik
Sep 1 at 23:04
add a comment |Â
I have a blockchain -> SQL converter with historic balances, if interested , let me know. Its an open source project that is coming soon.
– Nulik
Sep 1 at 23:04
I have a blockchain -> SQL converter with historic balances, if interested , let me know. Its an open source project that is coming soon.
– Nulik
Sep 1 at 23:04
I have a blockchain -> SQL converter with historic balances, if interested , let me know. Its an open source project that is coming soon.
– Nulik
Sep 1 at 23:04
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
0
down vote
accepted
Yes, this is right to say, you need to write your own function to restore this or use your ethereum client with "archive" option to remember past blocks when syncing (in geth --gcmode archive
).
add a comment |Â
up vote
3
down vote
The second parameter to eth_getBalance is a block number. That will give you the account's balance at that block.
I'd like to know how eth_getBalance get that information... what the function does behind the curtains...
– Ethersworn Canonist
Sep 1 at 19:12
You'd have to check the specific software you were curious about, but presumably the balances are just stored in a local database.
– smarx
Sep 1 at 19:15
If you're interested in geth's implementation, you might want to start reading here: github.com/ethereum/go-ethereum/blob/master/internal/ethapi/….
– smarx
Sep 1 at 19:20
I don't believe any client would store balance history. Probably this information is retrieved some other way.
– Ethersworn Canonist
Sep 1 at 19:22
I suspect you'll find that in popular nodes like geth and Parity, none of the state trie is ever deleted, so as long as you know the root hash (e.g. from the block headers), you can easily query the state at any block.
– smarx
Sep 1 at 19:32
 |Â
show 5 more comments
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
Yes, this is right to say, you need to write your own function to restore this or use your ethereum client with "archive" option to remember past blocks when syncing (in geth --gcmode archive
).
add a comment |Â
up vote
0
down vote
accepted
Yes, this is right to say, you need to write your own function to restore this or use your ethereum client with "archive" option to remember past blocks when syncing (in geth --gcmode archive
).
add a comment |Â
up vote
0
down vote
accepted
up vote
0
down vote
accepted
Yes, this is right to say, you need to write your own function to restore this or use your ethereum client with "archive" option to remember past blocks when syncing (in geth --gcmode archive
).
Yes, this is right to say, you need to write your own function to restore this or use your ethereum client with "archive" option to remember past blocks when syncing (in geth --gcmode archive
).
answered Sep 1 at 22:24
jabone
664
664
add a comment |Â
add a comment |Â
up vote
3
down vote
The second parameter to eth_getBalance is a block number. That will give you the account's balance at that block.
I'd like to know how eth_getBalance get that information... what the function does behind the curtains...
– Ethersworn Canonist
Sep 1 at 19:12
You'd have to check the specific software you were curious about, but presumably the balances are just stored in a local database.
– smarx
Sep 1 at 19:15
If you're interested in geth's implementation, you might want to start reading here: github.com/ethereum/go-ethereum/blob/master/internal/ethapi/….
– smarx
Sep 1 at 19:20
I don't believe any client would store balance history. Probably this information is retrieved some other way.
– Ethersworn Canonist
Sep 1 at 19:22
I suspect you'll find that in popular nodes like geth and Parity, none of the state trie is ever deleted, so as long as you know the root hash (e.g. from the block headers), you can easily query the state at any block.
– smarx
Sep 1 at 19:32
 |Â
show 5 more comments
up vote
3
down vote
The second parameter to eth_getBalance is a block number. That will give you the account's balance at that block.
I'd like to know how eth_getBalance get that information... what the function does behind the curtains...
– Ethersworn Canonist
Sep 1 at 19:12
You'd have to check the specific software you were curious about, but presumably the balances are just stored in a local database.
– smarx
Sep 1 at 19:15
If you're interested in geth's implementation, you might want to start reading here: github.com/ethereum/go-ethereum/blob/master/internal/ethapi/….
– smarx
Sep 1 at 19:20
I don't believe any client would store balance history. Probably this information is retrieved some other way.
– Ethersworn Canonist
Sep 1 at 19:22
I suspect you'll find that in popular nodes like geth and Parity, none of the state trie is ever deleted, so as long as you know the root hash (e.g. from the block headers), you can easily query the state at any block.
– smarx
Sep 1 at 19:32
 |Â
show 5 more comments
up vote
3
down vote
up vote
3
down vote
The second parameter to eth_getBalance is a block number. That will give you the account's balance at that block.
The second parameter to eth_getBalance is a block number. That will give you the account's balance at that block.
answered Sep 1 at 19:08


smarx
16.1k1515
16.1k1515
I'd like to know how eth_getBalance get that information... what the function does behind the curtains...
– Ethersworn Canonist
Sep 1 at 19:12
You'd have to check the specific software you were curious about, but presumably the balances are just stored in a local database.
– smarx
Sep 1 at 19:15
If you're interested in geth's implementation, you might want to start reading here: github.com/ethereum/go-ethereum/blob/master/internal/ethapi/….
– smarx
Sep 1 at 19:20
I don't believe any client would store balance history. Probably this information is retrieved some other way.
– Ethersworn Canonist
Sep 1 at 19:22
I suspect you'll find that in popular nodes like geth and Parity, none of the state trie is ever deleted, so as long as you know the root hash (e.g. from the block headers), you can easily query the state at any block.
– smarx
Sep 1 at 19:32
 |Â
show 5 more comments
I'd like to know how eth_getBalance get that information... what the function does behind the curtains...
– Ethersworn Canonist
Sep 1 at 19:12
You'd have to check the specific software you were curious about, but presumably the balances are just stored in a local database.
– smarx
Sep 1 at 19:15
If you're interested in geth's implementation, you might want to start reading here: github.com/ethereum/go-ethereum/blob/master/internal/ethapi/….
– smarx
Sep 1 at 19:20
I don't believe any client would store balance history. Probably this information is retrieved some other way.
– Ethersworn Canonist
Sep 1 at 19:22
I suspect you'll find that in popular nodes like geth and Parity, none of the state trie is ever deleted, so as long as you know the root hash (e.g. from the block headers), you can easily query the state at any block.
– smarx
Sep 1 at 19:32
I'd like to know how eth_getBalance get that information... what the function does behind the curtains...
– Ethersworn Canonist
Sep 1 at 19:12
I'd like to know how eth_getBalance get that information... what the function does behind the curtains...
– Ethersworn Canonist
Sep 1 at 19:12
You'd have to check the specific software you were curious about, but presumably the balances are just stored in a local database.
– smarx
Sep 1 at 19:15
You'd have to check the specific software you were curious about, but presumably the balances are just stored in a local database.
– smarx
Sep 1 at 19:15
If you're interested in geth's implementation, you might want to start reading here: github.com/ethereum/go-ethereum/blob/master/internal/ethapi/….
– smarx
Sep 1 at 19:20
If you're interested in geth's implementation, you might want to start reading here: github.com/ethereum/go-ethereum/blob/master/internal/ethapi/….
– smarx
Sep 1 at 19:20
I don't believe any client would store balance history. Probably this information is retrieved some other way.
– Ethersworn Canonist
Sep 1 at 19:22
I don't believe any client would store balance history. Probably this information is retrieved some other way.
– Ethersworn Canonist
Sep 1 at 19:22
I suspect you'll find that in popular nodes like geth and Parity, none of the state trie is ever deleted, so as long as you know the root hash (e.g. from the block headers), you can easily query the state at any block.
– smarx
Sep 1 at 19:32
I suspect you'll find that in popular nodes like geth and Parity, none of the state trie is ever deleted, so as long as you know the root hash (e.g. from the block headers), you can easily query the state at any block.
– smarx
Sep 1 at 19:32
 |Â
show 5 more comments
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fethereum.stackexchange.com%2fquestions%2f57897%2fprocess-to-find-out-an-accounts-balance-in-the-past%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
I have a blockchain -> SQL converter with historic balances, if interested , let me know. Its an open source project that is coming soon.
– Nulik
Sep 1 at 23:04