Blockchain ledger storage











up vote
0
down vote

favorite












I've been studying Blockchain since a while and I've been looking out for information explaining where the blockchain ledger is saved and how it is saved locally (as in, locally in a full node). What I have most of the time found is state database being used by Ethereum or Hyperledger Fabric using LevelDB or RocksDB e.t.c for saving state information. I've been struggling real hard to know where the blockchain ledger gets saved apart from states being saved in some on-disk key-value store/database as I am studying LinkedList and Merkle Tree (Hash Tree) which are being used to store new blocks that gets created and being hashed and saved in merkle tree for verification purpose by full nodes and half nodes can query & verify if transactions exist.



Thanks and best,



Rohit










share|improve this question


























    up vote
    0
    down vote

    favorite












    I've been studying Blockchain since a while and I've been looking out for information explaining where the blockchain ledger is saved and how it is saved locally (as in, locally in a full node). What I have most of the time found is state database being used by Ethereum or Hyperledger Fabric using LevelDB or RocksDB e.t.c for saving state information. I've been struggling real hard to know where the blockchain ledger gets saved apart from states being saved in some on-disk key-value store/database as I am studying LinkedList and Merkle Tree (Hash Tree) which are being used to store new blocks that gets created and being hashed and saved in merkle tree for verification purpose by full nodes and half nodes can query & verify if transactions exist.



    Thanks and best,



    Rohit










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I've been studying Blockchain since a while and I've been looking out for information explaining where the blockchain ledger is saved and how it is saved locally (as in, locally in a full node). What I have most of the time found is state database being used by Ethereum or Hyperledger Fabric using LevelDB or RocksDB e.t.c for saving state information. I've been struggling real hard to know where the blockchain ledger gets saved apart from states being saved in some on-disk key-value store/database as I am studying LinkedList and Merkle Tree (Hash Tree) which are being used to store new blocks that gets created and being hashed and saved in merkle tree for verification purpose by full nodes and half nodes can query & verify if transactions exist.



      Thanks and best,



      Rohit










      share|improve this question













      I've been studying Blockchain since a while and I've been looking out for information explaining where the blockchain ledger is saved and how it is saved locally (as in, locally in a full node). What I have most of the time found is state database being used by Ethereum or Hyperledger Fabric using LevelDB or RocksDB e.t.c for saving state information. I've been struggling real hard to know where the blockchain ledger gets saved apart from states being saved in some on-disk key-value store/database as I am studying LinkedList and Merkle Tree (Hash Tree) which are being used to store new blocks that gets created and being hashed and saved in merkle tree for verification purpose by full nodes and half nodes can query & verify if transactions exist.



      Thanks and best,



      Rohit







      linked-list hyperledger-fabric blockchain ethereum merkle-tree






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 20 at 9:13









      rohitpaniker

      1971213




      1971213
























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote













          In Bitcoin-core, the blocks are stored in .dat files in the blocks filder under the data directory (default on linux is ~/.bitcoin). These files are not necessarily numbered or organized in any strict fashion, because they are downloaded as available, instead of waiting for each sequential block to become available for download from a peer. For those reasons, the .dat files There is a levelDB (in ~/.bitcoin/blocks/index) which indexes the blockchain by storing the names and locations of the .dat files.



          Linked lists and merkle trees are not data storage mechanisms, but abstract data types, which can exist in a database, as flat files, etc. A merkle tree can make validation much faster because it improves the efficiency of the verification algorithms, usually a hash function.






          share|improve this answer























          • Oh okay so if there are 100 transactions then there would be 100 .dat files, one .dat file per transaction and each transaction is being stored in LevelDB ?
            – rohitpaniker
            Nov 21 at 11:22










          • Not quite, one.dat file can contain multiple blocks, which each contains many transactions. LevelDB contains references to the files.
            – JBaczuk
            Nov 21 at 12:17


















          up vote
          1
          down vote













          In Hyperledger Fabric, the state database is not for storing all the blocks, it saves the current state of an asset only e.g. if a bank account has a transaction of 10 debit and another transaction of 2 credit, the state DB will have the current value of 8.



          The actual blocks are saved in in a local file in peers, which can be queried via the SDK.






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            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: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53389668%2fblockchain-ledger-storage%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote













            In Bitcoin-core, the blocks are stored in .dat files in the blocks filder under the data directory (default on linux is ~/.bitcoin). These files are not necessarily numbered or organized in any strict fashion, because they are downloaded as available, instead of waiting for each sequential block to become available for download from a peer. For those reasons, the .dat files There is a levelDB (in ~/.bitcoin/blocks/index) which indexes the blockchain by storing the names and locations of the .dat files.



            Linked lists and merkle trees are not data storage mechanisms, but abstract data types, which can exist in a database, as flat files, etc. A merkle tree can make validation much faster because it improves the efficiency of the verification algorithms, usually a hash function.






            share|improve this answer























            • Oh okay so if there are 100 transactions then there would be 100 .dat files, one .dat file per transaction and each transaction is being stored in LevelDB ?
              – rohitpaniker
              Nov 21 at 11:22










            • Not quite, one.dat file can contain multiple blocks, which each contains many transactions. LevelDB contains references to the files.
              – JBaczuk
              Nov 21 at 12:17















            up vote
            1
            down vote













            In Bitcoin-core, the blocks are stored in .dat files in the blocks filder under the data directory (default on linux is ~/.bitcoin). These files are not necessarily numbered or organized in any strict fashion, because they are downloaded as available, instead of waiting for each sequential block to become available for download from a peer. For those reasons, the .dat files There is a levelDB (in ~/.bitcoin/blocks/index) which indexes the blockchain by storing the names and locations of the .dat files.



            Linked lists and merkle trees are not data storage mechanisms, but abstract data types, which can exist in a database, as flat files, etc. A merkle tree can make validation much faster because it improves the efficiency of the verification algorithms, usually a hash function.






            share|improve this answer























            • Oh okay so if there are 100 transactions then there would be 100 .dat files, one .dat file per transaction and each transaction is being stored in LevelDB ?
              – rohitpaniker
              Nov 21 at 11:22










            • Not quite, one.dat file can contain multiple blocks, which each contains many transactions. LevelDB contains references to the files.
              – JBaczuk
              Nov 21 at 12:17













            up vote
            1
            down vote










            up vote
            1
            down vote









            In Bitcoin-core, the blocks are stored in .dat files in the blocks filder under the data directory (default on linux is ~/.bitcoin). These files are not necessarily numbered or organized in any strict fashion, because they are downloaded as available, instead of waiting for each sequential block to become available for download from a peer. For those reasons, the .dat files There is a levelDB (in ~/.bitcoin/blocks/index) which indexes the blockchain by storing the names and locations of the .dat files.



            Linked lists and merkle trees are not data storage mechanisms, but abstract data types, which can exist in a database, as flat files, etc. A merkle tree can make validation much faster because it improves the efficiency of the verification algorithms, usually a hash function.






            share|improve this answer














            In Bitcoin-core, the blocks are stored in .dat files in the blocks filder under the data directory (default on linux is ~/.bitcoin). These files are not necessarily numbered or organized in any strict fashion, because they are downloaded as available, instead of waiting for each sequential block to become available for download from a peer. For those reasons, the .dat files There is a levelDB (in ~/.bitcoin/blocks/index) which indexes the blockchain by storing the names and locations of the .dat files.



            Linked lists and merkle trees are not data storage mechanisms, but abstract data types, which can exist in a database, as flat files, etc. A merkle tree can make validation much faster because it improves the efficiency of the verification algorithms, usually a hash function.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 20 at 14:35

























            answered Nov 20 at 14:28









            JBaczuk

            5,36852549




            5,36852549












            • Oh okay so if there are 100 transactions then there would be 100 .dat files, one .dat file per transaction and each transaction is being stored in LevelDB ?
              – rohitpaniker
              Nov 21 at 11:22










            • Not quite, one.dat file can contain multiple blocks, which each contains many transactions. LevelDB contains references to the files.
              – JBaczuk
              Nov 21 at 12:17


















            • Oh okay so if there are 100 transactions then there would be 100 .dat files, one .dat file per transaction and each transaction is being stored in LevelDB ?
              – rohitpaniker
              Nov 21 at 11:22










            • Not quite, one.dat file can contain multiple blocks, which each contains many transactions. LevelDB contains references to the files.
              – JBaczuk
              Nov 21 at 12:17
















            Oh okay so if there are 100 transactions then there would be 100 .dat files, one .dat file per transaction and each transaction is being stored in LevelDB ?
            – rohitpaniker
            Nov 21 at 11:22




            Oh okay so if there are 100 transactions then there would be 100 .dat files, one .dat file per transaction and each transaction is being stored in LevelDB ?
            – rohitpaniker
            Nov 21 at 11:22












            Not quite, one.dat file can contain multiple blocks, which each contains many transactions. LevelDB contains references to the files.
            – JBaczuk
            Nov 21 at 12:17




            Not quite, one.dat file can contain multiple blocks, which each contains many transactions. LevelDB contains references to the files.
            – JBaczuk
            Nov 21 at 12:17












            up vote
            1
            down vote













            In Hyperledger Fabric, the state database is not for storing all the blocks, it saves the current state of an asset only e.g. if a bank account has a transaction of 10 debit and another transaction of 2 credit, the state DB will have the current value of 8.



            The actual blocks are saved in in a local file in peers, which can be queried via the SDK.






            share|improve this answer

























              up vote
              1
              down vote













              In Hyperledger Fabric, the state database is not for storing all the blocks, it saves the current state of an asset only e.g. if a bank account has a transaction of 10 debit and another transaction of 2 credit, the state DB will have the current value of 8.



              The actual blocks are saved in in a local file in peers, which can be queried via the SDK.






              share|improve this answer























                up vote
                1
                down vote










                up vote
                1
                down vote









                In Hyperledger Fabric, the state database is not for storing all the blocks, it saves the current state of an asset only e.g. if a bank account has a transaction of 10 debit and another transaction of 2 credit, the state DB will have the current value of 8.



                The actual blocks are saved in in a local file in peers, which can be queried via the SDK.






                share|improve this answer












                In Hyperledger Fabric, the state database is not for storing all the blocks, it saves the current state of an asset only e.g. if a bank account has a transaction of 10 debit and another transaction of 2 credit, the state DB will have the current value of 8.



                The actual blocks are saved in in a local file in peers, which can be queried via the SDK.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 20 at 16:28









                adnan.c

                373112




                373112






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53389668%2fblockchain-ledger-storage%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    404 Error Contact Form 7 ajax form submitting

                    How to know if a Active Directory user can login interactively

                    TypeError: fit_transform() missing 1 required positional argument: 'X'