Process to find out an account's balance in the past

The name of the pictureThe name of the pictureThe name of the pictureClash 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?







share|improve this question




















  • 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















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?







share|improve this question




















  • 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













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?







share|improve this question












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?









share|improve this question











share|improve this question




share|improve this question










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

















  • 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











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).






share|improve this answer



























    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.






    share|improve this answer




















    • 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










    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "642"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    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






























    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).






    share|improve this answer
























      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).






      share|improve this answer






















        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).






        share|improve this answer












        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).







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 1 at 22:24









        jabone

        664




        664




















            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.






            share|improve this answer




















            • 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














            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.






            share|improve this answer




















            • 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












            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.






            share|improve this answer












            The second parameter to eth_getBalance is a block number. That will give you the account's balance at that block.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            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
















            • 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

















             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            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













































































            Comments

            Popular posts from this blog

            What does second last employer means? [closed]

            List of Gilmore Girls characters

            Confectionery