Differences to CCompactSize and CVarInt Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Bitcoind crashes directly after startingEmbedding P2Pool technology in Bitcoin CoreI run Bitcoin Core 0.14.1, for Segwit they tell me to “upgrade” to 0.13.1. So confusingCan a raspberry pi zero run bitcoin core 0.16.1 and sync up without downloading the entire blockchain?Solving Bitcoin core's 'ActivateBestChain failed'It's October 2018. ./bitcoin-qt -reindex-chainstate takes forever. Is there a way to speed this up?Extract sender ID and recipient ID of a bitcoin transactionCreate a Double sha256 block and trandactionHow happens the serealization the data in the file blkxxxx.dat in the bitcoinScript Null into raw trasaction bitcoin core

How to change the tick of the color bar legend to black

Trying to understand entropy as a novice in thermodynamics

Moving a wrapfig vertically to encroach partially on a subsection title

Resize vertical bars (absolute-value symbols)

Project Euler #1 in C++

Found this skink in my tomato plant bucket. Is he trapped? Or could he leave if he wanted?

Special flights

Select every other edge (they share a common vertex)

What does it mean that physics no longer uses mechanical models to describe phenomena?

Asymptotics question

How to force a browser when connecting to a specific domain to be https only using only the client machine?

Did Mueller's report provide an evidentiary basis for the claim of Russian govt election interference via social media?

RSA find public exponent

Getting out of while loop on console

How can a team of shapeshifters communicate?

Does the Black Tentacles spell do damage twice at the start of turn to an already restrained creature?

Tips to organize LaTeX presentations for a semester

Delete free apps from library

Is CEO the "profession" with the most psychopaths?

Is it dangerous to install hacking tools on my private linux machine?

Is openssl rand command cryptographically secure?

A term for a woman complaining about things/begging in a cute/childish way

Is there public access to the Meteor Crater in Arizona?

Understanding p-Values using an example



Differences to CCompactSize and CVarInt



Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Bitcoind crashes directly after startingEmbedding P2Pool technology in Bitcoin CoreI run Bitcoin Core 0.14.1, for Segwit they tell me to “upgrade” to 0.13.1. So confusingCan a raspberry pi zero run bitcoin core 0.16.1 and sync up without downloading the entire blockchain?Solving Bitcoin core's 'ActivateBestChain failed'It's October 2018. ./bitcoin-qt -reindex-chainstate takes forever. Is there a way to speed this up?Extract sender ID and recipient ID of a bitcoin transactionCreate a Double sha256 block and trandactionHow happens the serealization the data in the file blkxxxx.dat in the bitcoinScript Null into raw trasaction bitcoin core










1















I'm developing a parser bitcoin core and I have a problem whit the type CVarInt, I using the decodifier mode of the CCompact size but at the block 976 I Have a problem whit the type, because the value id is unusually, so I have a question why the bitcoin core decided the change implementation to
CCompact size into CVarInt?



What was introduced in the bitcoin core versions to require a change of implementation?



Sorry for my terrible English but I'm learning.










share|improve this question


























    1















    I'm developing a parser bitcoin core and I have a problem whit the type CVarInt, I using the decodifier mode of the CCompact size but at the block 976 I Have a problem whit the type, because the value id is unusually, so I have a question why the bitcoin core decided the change implementation to
    CCompact size into CVarInt?



    What was introduced in the bitcoin core versions to require a change of implementation?



    Sorry for my terrible English but I'm learning.










    share|improve this question
























      1












      1








      1








      I'm developing a parser bitcoin core and I have a problem whit the type CVarInt, I using the decodifier mode of the CCompact size but at the block 976 I Have a problem whit the type, because the value id is unusually, so I have a question why the bitcoin core decided the change implementation to
      CCompact size into CVarInt?



      What was introduced in the bitcoin core versions to require a change of implementation?



      Sorry for my terrible English but I'm learning.










      share|improve this question














      I'm developing a parser bitcoin core and I have a problem whit the type CVarInt, I using the decodifier mode of the CCompact size but at the block 976 I Have a problem whit the type, because the value id is unusually, so I have a question why the bitcoin core decided the change implementation to
      CCompact size into CVarInt?



      What was introduced in the bitcoin core versions to require a change of implementation?



      Sorry for my terrible English but I'm learning.







      bitcoin-core script bitcoincore-development






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 5 hours ago









      vincenzopalazzovincenzopalazzo

      256




      256




















          1 Answer
          1






          active

          oldest

          votes


















          2














          CVarInt encoding is only used in the storage of the UTXO set internally, and never in the P2P protocol. CCompactSize is used in a number of places, including the number of transactions per block, the number of inputs and outputs per transaction, and the length of scripts.



          If you're parsing block data, you will never encounter a CVarInt. If you're running into problems, it's almost certainly something else, or there is a bug in your CCompactSize decoder.






          share|improve this answer























          • Oh this is a good news, Unfortunately I don't know exactly what block gives me problems reading the script, because for every blk file I create a json file with the list of blocks, so if I get an error reading I can't generate the json, apparte if not active the logger logs the code, which I will do soon, but for now I know that the last block that reads me converting it to json is the following This

            – vincenzopalazzo
            3 hours ago












          • plus i use the library to read bitcoin core files the file is serialize.he exception that raises me is the following C ++ exception with description" ReadCompactSize (): size too large: iostream error "thrown in the test body.

            – vincenzopalazzo
            3 hours ago












          • @vincenzopalazzo That probably means you're trying to decode garbage. There is no guarantee that all bytes in the block file belong to a block; there may be gaps etc

            – Pieter Wuille
            3 hours ago











          • So it is not guaranteed that all blocks have only the declared data? I mean, does this mean that in the beginning there may be other things that are not useful data for me? but in this way there must be a reference somewhere to see what is in that beginning file no? Because if bitcoin core uses that data then behind the serialization there is logic

            – vincenzopalazzo
            2 hours ago












          • Blocks have well defined data only. But the files can contain garbage in addition to the blocks. There is an index database that stores which position each block is stored at. There is no guarantee that there isn't garbage between blocks (for example, for a crash while writing a block).

            – Pieter Wuille
            2 hours ago











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "308"
          ;
          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',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          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
          ,
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fbitcoin.stackexchange.com%2fquestions%2f86159%2fdifferences-to-ccompactsize-and-cvarint%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          CVarInt encoding is only used in the storage of the UTXO set internally, and never in the P2P protocol. CCompactSize is used in a number of places, including the number of transactions per block, the number of inputs and outputs per transaction, and the length of scripts.



          If you're parsing block data, you will never encounter a CVarInt. If you're running into problems, it's almost certainly something else, or there is a bug in your CCompactSize decoder.






          share|improve this answer























          • Oh this is a good news, Unfortunately I don't know exactly what block gives me problems reading the script, because for every blk file I create a json file with the list of blocks, so if I get an error reading I can't generate the json, apparte if not active the logger logs the code, which I will do soon, but for now I know that the last block that reads me converting it to json is the following This

            – vincenzopalazzo
            3 hours ago












          • plus i use the library to read bitcoin core files the file is serialize.he exception that raises me is the following C ++ exception with description" ReadCompactSize (): size too large: iostream error "thrown in the test body.

            – vincenzopalazzo
            3 hours ago












          • @vincenzopalazzo That probably means you're trying to decode garbage. There is no guarantee that all bytes in the block file belong to a block; there may be gaps etc

            – Pieter Wuille
            3 hours ago











          • So it is not guaranteed that all blocks have only the declared data? I mean, does this mean that in the beginning there may be other things that are not useful data for me? but in this way there must be a reference somewhere to see what is in that beginning file no? Because if bitcoin core uses that data then behind the serialization there is logic

            – vincenzopalazzo
            2 hours ago












          • Blocks have well defined data only. But the files can contain garbage in addition to the blocks. There is an index database that stores which position each block is stored at. There is no guarantee that there isn't garbage between blocks (for example, for a crash while writing a block).

            – Pieter Wuille
            2 hours ago















          2














          CVarInt encoding is only used in the storage of the UTXO set internally, and never in the P2P protocol. CCompactSize is used in a number of places, including the number of transactions per block, the number of inputs and outputs per transaction, and the length of scripts.



          If you're parsing block data, you will never encounter a CVarInt. If you're running into problems, it's almost certainly something else, or there is a bug in your CCompactSize decoder.






          share|improve this answer























          • Oh this is a good news, Unfortunately I don't know exactly what block gives me problems reading the script, because for every blk file I create a json file with the list of blocks, so if I get an error reading I can't generate the json, apparte if not active the logger logs the code, which I will do soon, but for now I know that the last block that reads me converting it to json is the following This

            – vincenzopalazzo
            3 hours ago












          • plus i use the library to read bitcoin core files the file is serialize.he exception that raises me is the following C ++ exception with description" ReadCompactSize (): size too large: iostream error "thrown in the test body.

            – vincenzopalazzo
            3 hours ago












          • @vincenzopalazzo That probably means you're trying to decode garbage. There is no guarantee that all bytes in the block file belong to a block; there may be gaps etc

            – Pieter Wuille
            3 hours ago











          • So it is not guaranteed that all blocks have only the declared data? I mean, does this mean that in the beginning there may be other things that are not useful data for me? but in this way there must be a reference somewhere to see what is in that beginning file no? Because if bitcoin core uses that data then behind the serialization there is logic

            – vincenzopalazzo
            2 hours ago












          • Blocks have well defined data only. But the files can contain garbage in addition to the blocks. There is an index database that stores which position each block is stored at. There is no guarantee that there isn't garbage between blocks (for example, for a crash while writing a block).

            – Pieter Wuille
            2 hours ago













          2












          2








          2







          CVarInt encoding is only used in the storage of the UTXO set internally, and never in the P2P protocol. CCompactSize is used in a number of places, including the number of transactions per block, the number of inputs and outputs per transaction, and the length of scripts.



          If you're parsing block data, you will never encounter a CVarInt. If you're running into problems, it's almost certainly something else, or there is a bug in your CCompactSize decoder.






          share|improve this answer













          CVarInt encoding is only used in the storage of the UTXO set internally, and never in the P2P protocol. CCompactSize is used in a number of places, including the number of transactions per block, the number of inputs and outputs per transaction, and the length of scripts.



          If you're parsing block data, you will never encounter a CVarInt. If you're running into problems, it's almost certainly something else, or there is a bug in your CCompactSize decoder.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 4 hours ago









          Pieter WuillePieter Wuille

          48.6k3100163




          48.6k3100163












          • Oh this is a good news, Unfortunately I don't know exactly what block gives me problems reading the script, because for every blk file I create a json file with the list of blocks, so if I get an error reading I can't generate the json, apparte if not active the logger logs the code, which I will do soon, but for now I know that the last block that reads me converting it to json is the following This

            – vincenzopalazzo
            3 hours ago












          • plus i use the library to read bitcoin core files the file is serialize.he exception that raises me is the following C ++ exception with description" ReadCompactSize (): size too large: iostream error "thrown in the test body.

            – vincenzopalazzo
            3 hours ago












          • @vincenzopalazzo That probably means you're trying to decode garbage. There is no guarantee that all bytes in the block file belong to a block; there may be gaps etc

            – Pieter Wuille
            3 hours ago











          • So it is not guaranteed that all blocks have only the declared data? I mean, does this mean that in the beginning there may be other things that are not useful data for me? but in this way there must be a reference somewhere to see what is in that beginning file no? Because if bitcoin core uses that data then behind the serialization there is logic

            – vincenzopalazzo
            2 hours ago












          • Blocks have well defined data only. But the files can contain garbage in addition to the blocks. There is an index database that stores which position each block is stored at. There is no guarantee that there isn't garbage between blocks (for example, for a crash while writing a block).

            – Pieter Wuille
            2 hours ago

















          • Oh this is a good news, Unfortunately I don't know exactly what block gives me problems reading the script, because for every blk file I create a json file with the list of blocks, so if I get an error reading I can't generate the json, apparte if not active the logger logs the code, which I will do soon, but for now I know that the last block that reads me converting it to json is the following This

            – vincenzopalazzo
            3 hours ago












          • plus i use the library to read bitcoin core files the file is serialize.he exception that raises me is the following C ++ exception with description" ReadCompactSize (): size too large: iostream error "thrown in the test body.

            – vincenzopalazzo
            3 hours ago












          • @vincenzopalazzo That probably means you're trying to decode garbage. There is no guarantee that all bytes in the block file belong to a block; there may be gaps etc

            – Pieter Wuille
            3 hours ago











          • So it is not guaranteed that all blocks have only the declared data? I mean, does this mean that in the beginning there may be other things that are not useful data for me? but in this way there must be a reference somewhere to see what is in that beginning file no? Because if bitcoin core uses that data then behind the serialization there is logic

            – vincenzopalazzo
            2 hours ago












          • Blocks have well defined data only. But the files can contain garbage in addition to the blocks. There is an index database that stores which position each block is stored at. There is no guarantee that there isn't garbage between blocks (for example, for a crash while writing a block).

            – Pieter Wuille
            2 hours ago
















          Oh this is a good news, Unfortunately I don't know exactly what block gives me problems reading the script, because for every blk file I create a json file with the list of blocks, so if I get an error reading I can't generate the json, apparte if not active the logger logs the code, which I will do soon, but for now I know that the last block that reads me converting it to json is the following This

          – vincenzopalazzo
          3 hours ago






          Oh this is a good news, Unfortunately I don't know exactly what block gives me problems reading the script, because for every blk file I create a json file with the list of blocks, so if I get an error reading I can't generate the json, apparte if not active the logger logs the code, which I will do soon, but for now I know that the last block that reads me converting it to json is the following This

          – vincenzopalazzo
          3 hours ago














          plus i use the library to read bitcoin core files the file is serialize.he exception that raises me is the following C ++ exception with description" ReadCompactSize (): size too large: iostream error "thrown in the test body.

          – vincenzopalazzo
          3 hours ago






          plus i use the library to read bitcoin core files the file is serialize.he exception that raises me is the following C ++ exception with description" ReadCompactSize (): size too large: iostream error "thrown in the test body.

          – vincenzopalazzo
          3 hours ago














          @vincenzopalazzo That probably means you're trying to decode garbage. There is no guarantee that all bytes in the block file belong to a block; there may be gaps etc

          – Pieter Wuille
          3 hours ago





          @vincenzopalazzo That probably means you're trying to decode garbage. There is no guarantee that all bytes in the block file belong to a block; there may be gaps etc

          – Pieter Wuille
          3 hours ago













          So it is not guaranteed that all blocks have only the declared data? I mean, does this mean that in the beginning there may be other things that are not useful data for me? but in this way there must be a reference somewhere to see what is in that beginning file no? Because if bitcoin core uses that data then behind the serialization there is logic

          – vincenzopalazzo
          2 hours ago






          So it is not guaranteed that all blocks have only the declared data? I mean, does this mean that in the beginning there may be other things that are not useful data for me? but in this way there must be a reference somewhere to see what is in that beginning file no? Because if bitcoin core uses that data then behind the serialization there is logic

          – vincenzopalazzo
          2 hours ago














          Blocks have well defined data only. But the files can contain garbage in addition to the blocks. There is an index database that stores which position each block is stored at. There is no guarantee that there isn't garbage between blocks (for example, for a crash while writing a block).

          – Pieter Wuille
          2 hours ago





          Blocks have well defined data only. But the files can contain garbage in addition to the blocks. There is an index database that stores which position each block is stored at. There is no guarantee that there isn't garbage between blocks (for example, for a crash while writing a block).

          – Pieter Wuille
          2 hours ago

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Bitcoin Stack Exchange!


          • 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%2fbitcoin.stackexchange.com%2fquestions%2f86159%2fdifferences-to-ccompactsize-and-cvarint%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

          Are there any AGPL-style licences that require source code modifications to be public? Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Force derivative works to be publicAre there any GPL like licenses for Apple App Store?Do you violate the GPL if you provide source code that cannot be compiled?GPL - is it distribution to use libraries in an appliance loaned to customers?Distributing App for free which uses GPL'ed codeModifications of server software under GPL, with web/CLI interfaceDoes using an AGPLv3-licensed library prevent me from dual-licensing my own source code?Can I publish only select code under GPLv3 from a private project?Is there published precedent regarding the scope of covered work that uses AGPL software?If MIT licensed code links to GPL licensed code what should be the license of the resulting binary program?If I use a public API endpoint that has its source code licensed under AGPL in my app, do I need to disclose my source?

          2013 GY136 Descoberta | Órbita | Referências Menu de navegação«List Of Centaurs and Scattered-Disk Objects»«List of Known Trans-Neptunian Objects»

          Button changing it's text & action. Good or terrible? The 2019 Stack Overflow Developer Survey Results Are Inchanging text on user mouseoverShould certain functions be “hard to find” for powerusers to discover?Custom liking function - do I need user login?Using different checkbox style for different checkbox behaviorBest Practices: Save and Exit in Software UIInteraction with remote validated formMore efficient UI to progress the user through a complicated process?Designing a popup notice for a gameShould bulk-editing functions be hidden until a table row is selected, or is there a better solution?Is it bad practice to disable (replace) the context menu?