Bitcoin Core integration/staging tree

Bitcoin Core integration/staging tree

For an immediately usable, binary version of the Bitcoin Core software, see

Further information about Bitcoin Core is available in the doc folder.

What is Bitcoin?

Bitcoin is an experimental digital currency that enables instant payments to anyone, anywhere in the world. Bitcoin uses peer-to-peer technology to operate with no central authority: managing transactions and issuing money are carried out collectively by the network. Bitcoin Core is the name of open source software which enables the use of this currency.

For more information read the original Bitcoin whitepaper.


Bitcoin Core is released under the terms of the MIT license. See COPYING for more information or see

Development Process

The master branch is regularly built (see doc/build-*.md for instructions) and tested, but it is not guaranteed to be completely stable. Tags are created regularly from release branches to indicate new official, stable release versions of Bitcoin Core.

The repository is used exclusively for the development of the GUI. Its master branch is identical in all monotree repositories. Release branches and tags do not exist, so please do not fork that repository unless it is for development reasons.

The contribution workflow is described in and useful hints for developers can be found in doc/


Testing and code review is the bottleneck for development; we get more pull requests than we can review and test on short notice. Please be patient and help out by testing other people's pull requests, and remember this is a security-critical project where any mistake might cost people lots of money.

Automated Testing

Developers are strongly encouraged to write unit tests for new code, and to submit new unit tests for old code. Unit tests can be compiled and run (assuming they weren't disabled in configure) with: make check. Further details on running and extending unit tests can be found in /src/test/

There are also regression and integration tests, written in Python. These tests can be run (if the test dependencies are installed) with: test/functional/

The CI (Continuous Integration) systems make sure that every pull request is built for Windows, Linux, and macOS, and that unit/sanity tests are run automatically.

Manual Quality Assurance (QA) Testing

Changes should be tested by somebody other than the developer who wrote the code. This is especially important for large or high-risk changes. It is useful to add a test plan to the pull request description if testing the changes is not straightforward.


Changes to translations as well as new translations can be submitted to Bitcoin Core's Transifex page.

Translations are periodically pulled from Transifex and merged into the git repository. See the translation process for details on how this works.

Important: We do not accept translation changes as GitHub pull requests because the next pull from Transifex would automatically overwrite them again.

  • BIP-68: Mempool-only sequence number constraint verification

    BIP-68: Mempool-only sequence number constraint verification

    Essentially enforces sequence numbers as a relative lock-time as an IsStandard() rule to make it easy to test applications using it; blocks containing transactions with invalid sequence numbers given the age of their inputs per BIP 68 are still accepted.

    This pull-req is not a soft-fork nor does it contain any code to start that process.

    This pull request builds on top of #6177.

    Background: BIP 68, Consensus-enforced transaction replacement signalled via sequence numbers

  • Add a getutxos command to the p2p protocol

    Add a getutxos command to the p2p protocol


    The getutxo command allows querying of the UTXO set given a set of of outpoints. It has a simple implementation and the results are not authenticated in any way. Despite this, there are times when it is a useful capability to have. I believe @jgarzik also has a use case for this, though I don't know what it is.

    As a motivating example I present Lighthouse, an app I'm writing that implements assurance contracts:

    Lighthouse works by collecting pledges, which contain an invalid transaction signed with SIGHASH_ANYONECANPAY. Once sufficient pledges are collected to make the combination valid, we say the contract is complete and it can be broadcast onto the network, spending the pledged outputs. Before that occurs however, a pledge can be revoked and the pledged money redeemed by double spending the pledged output. For instance you might want to do this if it becomes clear not enough people care about the assurance contract for it to reach its goal in a timely manner, or if you simply need the money back due to some kind of cashflow crunch.

    It is convenient to be able to see when a pledge has been revoked, so the user interface can be updated, and so when the final contract is created revoked pledges can be left out. For this purpose "getutxos" is used.


    The getutxos message takes a boolean which controls whether outputs in the memory pool are considered, and a vector of COutPoint structures. It returns a bitmap with the same number of bits as outputs specified rounded up to the nearest 8 bits, and then a list of CTxOut structures, one for each set bit in the bitmap. The bitmap encodes whether the UTXO was found (i.e. is indeed unspent).


    The results of getutxos is not authenticated. This is because the obvious way to do this requires the work maaku has been doing on UTXO commitments to be merged, activated by default, miners to upgrade and a forking change made to enforce their accuracy. All this is a big project that may or may not ever come to fruition.

    For the Lighthouse security model however, this doesn't matter much. The reason is that the pledge transactions you're getting (which may be malicious) don't come from the P2P network. They come in the form of files either from a simple rendezvous server, or e.g. a shared folder or email attachments. The people sending these files have no way to influence the choice of peers made by the app. Once the outputs are returned, they are used to check the signatures on the pledge, thus verifying that the pledge spends the UTXO returned by the P2P network.

    So we can be attacked in the following ways:

    • The pledge may be attempting to pledge non-existent outputs, but this will be detected if the majority of peers are honest.
    • The peers may be malicious and return a wrong or bogus output, but this will be detected when the signature is checked, except for the value (!) but we want to fix this by including the value into the sighash at some point anyway because we need it to make the TREZOR efficient/faster.
    • The peers may bogusly claim no such UTXO exists when it does, but this would result in the pledge being seen as invalid. When the project creator asks the pledgor why they revoked their money, and learns that in fact they never did, the bogus peers will be detected. No money is at risk as the pledges cannot be spent.
    • If the pledgor AND all the peers collaborate (i.e. the pledgor controls your internet connection) then they can make you believe you have a valid pledge when you don't. This would result in the app getting "jammed" and attempting to close an uncloseable contract. No money is at risk and the user will eventually wonder why their contract is not confirming. Once they get to a working internet connection the subterfuge will be discovered.

    There is a final issue: the answer to getutxos can of course change the instant the result is generated, thus leading you to construct an uncloseable transaction if the process of revocation races with the construction. The app can detect this by watching for either a reject message, or an inv requesting one of the inputs that is supposed to be in the UTXO set (i.e. the remote peer thinks it's an orphan). This can then cause the app to re-request the UTXO set and drop the raced pledge.

    In practice I do not anticipate such attacks are likely to occur, as they're complicated to pull off and it's not obvious what the gain is.

    There may be other apps that wish to use getutxos, with different security models. They may find this useful despite the lack of UTXO commitments, and the fact that the answer can change a moment later, if:

    • They are connecting to a trusted peer, i.e. localhost.
    • They trust their internet connection and peer selection, i.e. because they don't believe their datacenter or ISP will commit financial fraud against them, or they are tunnelling via endpoints they trust like a randomly chosen Tor exit.
    • They are not using the response for anything important or worth attacking, like some kind of visualisation.


    If enforced UTXO commitments are added to the block chain in future, it would make sense to rev the P2P protocol to add the proofs (merkle branches) to the response.


    I attempted to write unit tests for this, but Core has no infrastructure for building test chains .... the miner_tests.cpp code does it but at the cost of not allowing any other unit test to do so, as it doesn't reset or clean up the global state afterwards! I tried to fix this and ended up down a giant rabbit hole.

    So instead I've tested it with a local test app I wrote, which also exercises the client side part in bitcoinj.


    If the code is ACKd then I will write a short BIP explaining the new message.


    On IRC I have discussed this patch a little bit before. One objection that was raised is that we shouldn't add anything to the P2P protocol unless it's unattackable, because otherwise it's a sharp knife that people might use to cut themselves.

    I personally disagree with this notion for the following reasons.

    Firstly, many parts of the P2P protocol are not completely unattackable: malicious remote nodes can withhold broadcast transactions, invent fictional ones (you'd think they're orphans), miss out Bloom filter responses, send addr messages for IP's that were never announced, etc. We shouldn't hold new messages to a standard existing messages don't meet.

    Secondly, even with UTXO commitments in the block chain, given the sick state of mining this only requires a collaboration of two people to undo, although that failure would be publicly detectable which is at least something. But anyway, there's a clean upgrade path if/when UTXO authentication becomes available.

    Thirdly, we have a valid use case that's actually implemented. This isn't some academic pie in the sky project.

    Finally, Bitcoin is already the sharpest knife imaginable. I don't think we should start rejecting useful features on the grounds that someone else might screw up with them.

    If the above analysis ends up not holding for some reason, and people do get attacked due to the lack of authentication, then Lighthouse and other apps can always fall back to connecting to trusted nodes (perhaps over SSL). But I would like to optimistically assume success up front and see what happens, than pessimistically assume the worst and centralise things up front.

  • Treat dust outputs as non-standard, un-hardcode TX_FEE constants

    Treat dust outputs as non-standard, un-hardcode TX_FEE constants

    This is a quick, safe fix for transaction fee handling. A riskier, more complicated fix still needs to happen, but will take more time to code/test/etc.

    Two motivations for this pull:

    First, to discourage people from bloating users' wallets and the UTXO set with tiny outputs.

    This pull defines 'uneconomic dust' as 54.3 uBTC (5430 satoshis, about $0.007 at current prices), and treats any transaction with outputs less than 5430 satoshis as non-standard (won't be relayed, won't be mined). 5430 satoshis is derived from the cost (in fees) to spend a TxOut/TxIn. See for proportion of recent outputs this will (eventually) affect.

    Second, we have no idea what will happen to Bitcoin prices or transaction volume / competition for space in blocks. So this patch lets users and miners specify the minimum transaction fees at startup, using the -mintxfee / -mintxrelayfee options (which I'm intentionally leaving undocumented for now). The dust/nonstandard test is based on the -mintxrelayfee.

    Qt and RPC both now tell the user why CreateTransaction fails, if it fails; Qt error reporting is a little wonky (try to send one satoshi, and you get two modal dialog boxes, one after the other; I don't care enough to try to fix that).

    Note: I spent several hours trying, and failing, to create unit tests for this patch; CWallet::fFileBacked is ignored by several of the wallet routines used by CWallet::CreateNewTransaction. In the end, I decided thatrefactoring CWallet to support unit testing would be much more extensive and riskier than these changes.

  • ERROR: ReadBlockFromDisk : Deserialize or I/O error - ReadCompactSize() : size too large

    ERROR: ReadBlockFromDisk : Deserialize or I/O error - ReadCompactSize() : size too large

    Client info

    2015-01-15 18:15:21 Bitcoin version v0.10.99.0-4f73a8f-dirty (2015-01-09 20:21:19 -0800) 2015-01-15 18:15:21 Using OpenSSL version OpenSSL 1.0.1f 6 Jan 2014 2015-01-15 18:15:21 Using BerkeleyDB version Berkeley DB 5.3.28: (September 9, 2013) 2015-01-15 18:15:21 Default data directory /home/fredrik/.bitcoin 2015-01-15 18:15:21 Using data directory /home/fredrik/.bitcoin 2015-01-15 18:15:21 Using config file /home/fredrik/.bitcoin/bitcoin.conf 2015-01-15 18:15:21 Using at most 200 connections (1024 file descriptors available) 2015-01-15 18:15:21 Using 0 threads for script verification 2015-01-15 18:15:21 Binding RPC on address ::1 port 8332 (IPv4+IPv6 bind any: 0) 2015-01-15 18:15:21 Binding RPC on address port 8332 (IPv4+IPv6 bind any: 0) 2015-01-15 18:15:21 Using wallet wallet.dat 2015-01-15 18:15:21 init message: Verifying wallet... 2015-01-15 18:15:21 CDBEnv::Open : LogDir=/home/fredrik/.bitcoin/database ErrorFile=/home/fredrik/.bitcoin/db.log 2015-01-15 18:15:21 Bound to [::]:8333 2015-01-15 18:15:21 Bound to 2015-01-15 18:15:21 init message: Loading block index... 2015-01-15 18:15:21 Opening LevelDB in /home/fredrik/.bitcoin/blocks/index 2015-01-15 18:15:22 Opened LevelDB successfully 2015-01-15 18:15:22 Opening LevelDB in /home/fredrik/.bitcoin/chainstate 2015-01-15 18:15:28 Opened LevelDB successfully 2015-01-15 18:15:32 LoadBlockIndexDB: last block file = 218 2015-01-15 18:15:32 LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=274, size=115501816, heights=338812...339085, time=2015-01-13...2015-01-15) 2015-01-15 18:15:32 Checking all blk files are present... 2015-01-15 18:15:32 LoadBlockIndexDB(): transaction index disabled 2015-01-15 18:15:32 LoadBlockIndexDB(): hashBestChain=0000000000000000188de542fd76b1676c4be6c380b39ddea119358c290cebd7 height=339085 date=2015-01-15 18:07:14 progress=0.999987 2015-01-15 18:15:32 init message: Verifying blocks... 2015-01-15 18:15:32 Verifying last 288 blocks at level 3

    log before crash

    2015-01-13 22:15:27 UpdateTip: new best=0000000000000000159e7d66c954312bccb5f12de808f2991b3859205665c442 height=338819 log2_work=81.997891 tx=56658614 date=2015-01-13 22:14:41 progress=0.999999 cache=6969 2015-01-13 22:15:58 ResendWalletTransactions() 2015-01-13 22:17:06 receive version message: /Satoshi:0.9.2/ version 70002, blocks=338819, us=, peer=2855 2015-01-13 22:17:25 receive version message: /libbitcoin:2.0/: version 60000, blocks=0, us=, peer=2856 2015-01-13 22:17:25 Added time data, samples 200, offset -5 (+0 minutes) 2015-01-13 22:18:06 socket recv error Connection reset by peer (104) 2015-01-13 22:18:13 receive version message: /bitcoinseeder:0.01/: version 60000, blocks=230000, us=, peer=2857 2015-01-13 22:18:31 receive version message: / version 70002, blocks=338818, us=, peer=2858 2015-01-13 22:19:16 receive version message: /Satoshi:0.9.3/: version 70002, blocks=338817, us=, peer=2859 2015-01-13 22:19:16 Added time data, samples 200, offset -2 (+0 minutes) 2015-01-13 22:19:32 receive version message: /Snoopy:0.1/: version 60001, blocks=0, us=, peer=2860 2015-01-13 22:19:47 receive version message: /bitcoinseeder:0.01/: version 60000, blocks=230000, us=, peer=2861 2015-01-13 22:22:36 receive version message: / version 70002, blocks=338819, us=, peer=2862 2015-01-13 22:22:44 ERROR: AcceptToMemoryPool : inputs already spent 2015-01-13 22:22:45 receive version message: / Mapper:0.01/: version 60000, blocks=230000, us=, peer=2863 2015-01-13 22:22:47 receive version message: /BitCoinJ:0.11.2/MultiBit:0.5.18/: version 70001, blocks=338819, us=, peer=2864 2015-01-13 22:22:47 Added time data, samples 200, offset +10 (+0 minutes) 2015-01-13 22:23:00 receive version message: /Satoshi:0.8.4/: version 70001, blocks=338819, us=, peer=2865 2015-01-13 22:23:00 Added time data, samples 200, offset -7 (+0 minutes) 2015-01-13 22:23:53 receive version message: /Satoshi: version 70001, blocks=336635, us=, peer=2866 2015-01-13 22:23:53 Added time data, samples 200, offset +14 (+0 minutes) 2015-01-13 22:24:13 receive version message: /Satoshi:0.9.3/: version 70002, blocks=338735, us=, peer=2867 2015-01-13 22:24:13 Added time data, samples 200, offset -5 (+0 minutes) 2015-01-13 22:25:06 receive version message: /Snoopy:0.1/: version 60001, blocks=0, us=, peer=2868 2015-01-13 22:25:49 receive version message: /bitcoinseeder:0.01/: version 60000, blocks=230000, us=, peer=2869 2015-01-13 22:26:33 UpdateTip: new best=00000000000000001829e20898eaff72aa667d3715a94535afae5ae7ada07bc0 height=338820 log2_work=81.997947 tx=56659414 date=2015-01-13 22:25:41 progress=0.999999 cache=9596 2015-01-13 22:26:35 ERROR: AcceptToMemoryPool : inputs already spent 2015-01-13 22:26:43 ERROR: AcceptToMemoryPool : nonstandard transaction: dust 2015-01-13 22:26:48 ERROR: AcceptToMemoryPool : inputs already spent 2015-01-13 22:26:58 ERROR: AcceptToMemoryPool : inputs already spent 2015-01-13 22:27:01 receive version message: /bitcoinseeder:0.01/: version 60000, blocks=230000, us=, peer=2870 2015-01-13 22:27:20 ERROR: AcceptToMemoryPool : inputs already spent 2015-01-13 22:27:22 ERROR: AcceptToMemoryPool : inputs already spent 2015-01-13 22:27:46 UpdateTip: new best=000000000000000008b332686e0043a4b95ca7e46d1b0785536981b543dfc755 height=338821 log2_work=81.998004 tx=56659415 date=2015-01-13 22:36:09 progress=1.000013 cache=9706 2015-01-13 22:28:29 ERROR: AcceptToMemoryPool : inputs already spent 2015-01-13 22:28:34 ERROR: AcceptToMemoryPool : inputs already spent 2015-01-13 22:28:48 ERROR: AcceptToMemoryPool : inputs already spent 2015-01-13 22:28:52 receive version message: / version 70002, blocks=338819, us=, peer=2871 2015-01-13 22:29:22 ERROR: AcceptToMemoryPool : inputs already spent 2015-01-13 22:30:29 ERROR: ReadBlockFromDisk : Deserialize or I/O error - ReadCompactSize() : size too large 2015-01-15 18:02:07

  • Use std::filesystem. Remove Boost Filesystem & System

    Use std::filesystem. Remove Boost Filesystem & System

    This PR replaces our Boost Filesystem usage with std::filesystem and includes dropping Boost System as a dependency. It includes a squashed down version of the changes from #19245.

    A macro has been added, modelling how we check for -latomic to facilitate linking with -lstdc++fs when required. This is ~GCC < 9.1 & ~Clang < 9.0, however not always. i.e you could be using Clang 7 on top of a GCC 9 installation (i.e Ubuntu Focal) and use <filesystem> without passing any additional arguments. I've tested this with GCC 8 on Bionic, Clang 7 on Focal & with Apple Clang 12.0.0 on macOS.

    Guix build:

    bash-5.1# find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
    c1f9b326f9be4140f00cebeae5ff8de428a2fb8ecced539fcc36c53f53bfecf4  guix-build-07269321f38e/output/aarch64-linux-gnu/SHA256SUMS.part
    b44aca3bcf5ea92a3a6c48c24d6f85576f425f59b73528d4d00c20e950cf2128  guix-build-07269321f38e/output/aarch64-linux-gnu/bitcoin-07269321f38e-aarch64-linux-gnu-debug.tar.gz
    27a5553f7bd14797293fc40c5fb131c91e98a61d5481a283f13a1d0497eb5ed8  guix-build-07269321f38e/output/aarch64-linux-gnu/bitcoin-07269321f38e-aarch64-linux-gnu.tar.gz
    99e55a88823f6095864a09c9eaa824e24d9ec527380eb394f751c7205b930f69  guix-build-07269321f38e/output/arm-linux-gnueabihf/SHA256SUMS.part
    b720b2724fa47fde584f58ed3b587f1d1183523540777fd367ab7e582605cfea  guix-build-07269321f38e/output/arm-linux-gnueabihf/bitcoin-07269321f38e-arm-linux-gnueabihf-debug.tar.gz
    c19c247f4e9e0d7f888ac8ba9de1c12d382f48fa828a685d4fe02818a18abd1f  guix-build-07269321f38e/output/arm-linux-gnueabihf/bitcoin-07269321f38e-arm-linux-gnueabihf.tar.gz
    55b49ccb38de03bb95101354a16fd8d2190abede5ccc0d9b00b40c0cd526a2f6  guix-build-07269321f38e/output/arm64-apple-darwin/SHA256SUMS.part
    baa44752470a6be9acae1c2f8fd1b9bc37afb00971787ea11fbaeddc9ab7c4aa  guix-build-07269321f38e/output/arm64-apple-darwin/bitcoin-07269321f38e-arm64-apple-darwin.tar.gz
    ad7df4d8026d5bcce1321cdccc2e1820e8a8bb7e1064ed16e20a7ea354057fd2  guix-build-07269321f38e/output/arm64-apple-darwin/bitcoin-07269321f38e-osx-unsigned.dmg
    f342066dc34a14d67c47779a2413a14633a996e8e7ddca89ae0184e23ef99efd  guix-build-07269321f38e/output/arm64-apple-darwin/bitcoin-07269321f38e-osx-unsigned.tar.gz
    f6905346a5d48f57805fb062d0247ab5007c89047070a0b3125941dd1a2b8aa6  guix-build-07269321f38e/output/dist-archive/bitcoin-07269321f38e.tar.gz
    a1f6c4b2b118dbd89770801f0bcffd2218b82df408cd227e34c40493469bb7a2  guix-build-07269321f38e/output/powerpc64-linux-gnu/SHA256SUMS.part
    ba8359426e523bf013d93579c1bedc57380214c8170a9743b64ec1a8a3bbccbf  guix-build-07269321f38e/output/powerpc64-linux-gnu/bitcoin-07269321f38e-powerpc64-linux-gnu-debug.tar.gz
    b0bb500c274a683ea28ecbc1e8f18c618a9f8acb00045f80ae43c515288402c0  guix-build-07269321f38e/output/powerpc64-linux-gnu/bitcoin-07269321f38e-powerpc64-linux-gnu.tar.gz
    38c85e9589e092cd3aa08996aa383c0ccd5c73208943389741355a6eb7f72537  guix-build-07269321f38e/output/powerpc64le-linux-gnu/SHA256SUMS.part
    50fcba7942ff48d91e84c093fda0affc17e46167fe1d5137c6e14c5c41f289d1  guix-build-07269321f38e/output/powerpc64le-linux-gnu/bitcoin-07269321f38e-powerpc64le-linux-gnu-debug.tar.gz
    fa08ef1ceca072e014faa95ffee945954b2976fa28f90926b87ab0e5f15f8ca5  guix-build-07269321f38e/output/powerpc64le-linux-gnu/bitcoin-07269321f38e-powerpc64le-linux-gnu.tar.gz
    e52dd80a9c306d6aeb544acaa1f4ed560b6b92b5184764a05026d45451aa2e94  guix-build-07269321f38e/output/riscv64-linux-gnu/SHA256SUMS.part
    864e0a16c485b4159cec3ee0a83b046f1b1c3bc821670011c5ac5cd09ddfb91f  guix-build-07269321f38e/output/riscv64-linux-gnu/bitcoin-07269321f38e-riscv64-linux-gnu-debug.tar.gz
    4a061172181322e7ad0cf06405bf74f4c8683eaba3a67ecfd46158cba7627f62  guix-build-07269321f38e/output/riscv64-linux-gnu/bitcoin-07269321f38e-riscv64-linux-gnu.tar.gz
    876d82251853205420dffe7237523fc6ee3d09f78bf74cc03dc71f548446f335  guix-build-07269321f38e/output/x86_64-apple-darwin/SHA256SUMS.part
    3f82b2e62c60eee68e7b8fc28e4792e069e3c2cd780ee2d67290ca422cdbc47c  guix-build-07269321f38e/output/x86_64-apple-darwin/bitcoin-07269321f38e-osx-unsigned.dmg
    4ccdd4c410cac9d627e54ce83ee4816608681735da3cb93c60c5eb70ca86337a  guix-build-07269321f38e/output/x86_64-apple-darwin/bitcoin-07269321f38e-osx-unsigned.tar.gz
    2179d36b2f60e28c15262d4e51f27465b5ae077f60e550345e125683ca611066  guix-build-07269321f38e/output/x86_64-apple-darwin/bitcoin-07269321f38e-osx64.tar.gz
    b377e72fe84b6a982b8d414d60c85e6319523dff50dc852a0ba907f6d850ddd0  guix-build-07269321f38e/output/x86_64-linux-gnu/SHA256SUMS.part
    8547e2f582ce05ae6a6224793b64efb2eb63f2816bf0bed5d53fcc4786274597  guix-build-07269321f38e/output/x86_64-linux-gnu/bitcoin-07269321f38e-x86_64-linux-gnu-debug.tar.gz
    83b64805aa39f31a6fa4c2ed41e029c3be084e6dea06b90fac1ebca5c95bce29  guix-build-07269321f38e/output/x86_64-linux-gnu/bitcoin-07269321f38e-x86_64-linux-gnu.tar.gz
  • Relay and alert user to double spends

    Relay and alert user to double spends

    Rebased version of #3354.

    Instead of dropping double-spend transactions, relay them to peers. This is crucial to allowing all parts of the network to detect double-spend attempts as quickly as possible, i.e. reducing the "confirmation" time for buying coffee to a time on par with credit card transactions. Only the first respend seen is relayed.

    I successfully completed a primary test running 3 copies of bitcoin-qt in regtest mode with this patch applied, connected in a node1-newtorknode-node2 configuration.

    I used the rawtransaction API for steps 2 and 3, but with -salvagewallet and a single funding transaction, tests would be possible that did not require rawtransactions.

    Still TODO: Regression test plan

    Primary Test Details Step 1

    • Send transaction from node1 to a node2 address
    • * Transaction is relayed through networknode, to node2
    • * Transaction appears in node2 wallet

    Step 2

    • Restart node1 with -salvagewallet (so it forgets about 1st spend)
    • Send new transaction using same input (first double-spend), using rawtransaction API
    • * Transaction is relayed through networknode, to node2
    • * node2 does not accept the double-spend into its mempool and it does not appear in node2 wallet

    Step 3

    • Restart node1 with -salvagewallet again
    • Send transaction using same input (second double spend), using rawtransaction API
    • * Transaction is not relayed through networknode

    Step 4 One more test for good measure

    • Restart node1 with -salvagewallet again
    • Using regular UI (not rawtransaction API), send entire wallet balance to node2 (third double spend). This included additional inputs besides the spent one.
    • * Transaction is not relayed through networknode
  • BIP-325: Signet [consensus]

    BIP-325: Signet [consensus]

    This PR is a part of BIP-325 (, and is a sub-PR of #16411.

    • Signet consensus (this)
    • Signet RPC tools (pending)
    • Signet utility scripts (contrib/signet) (pending)
  • Add normalized transaction hash

    Add normalized transaction hash

    This is just a very basic implementation for exposure/review, with lacking documentation, and no functionality to look up transactions by normalized txid.

  • Testchains: Introduce custom chain whose constructor...

    Testchains: Introduce custom chain whose constructor...

    ...reads from runtime params and simplify the creation of partitioned chains by simply generating different gensis block hashes from a given custom name.

    It also allows to customize any chain param in these custom chains (but not the other chains).


    • [ ] Testschains: Many regtests with different genesis and default datadir #17037
    • [ ] Tests: Chainparams: Make regtest almost fully customizable #17032
    • [ ] Tests: Use self.chain instead of 'regtest' in all current tests #16681
    • [x] Preparations for more testchains #16680
    • [x] Use a proper factory for creating chainparams #8855 ~~- [ ] Really don't validate genesis block #9102~~
    • [x] Introduce an ArgsManager class encapsulating cs_args, mapArgs and mapMultiArgs #9494
    • [x] QA: s/find_unspent/find_spendable_utxo/ #11869
    • [x] Refactor: One CBaseChainParams should be enough #12128

    Other features:

    • [x] Uses a custom chain for all python tests.
    • [X] Create new testchains with different genesis hashes at will.
    • [X] Load chainparams from ~~separated~~ file or command line. (file left for later, see )
    • [X] New chains are neither orange, blue nor green: they're purple and have your custom chain petname shown in the GUI.
    • Extra context: some people asked for signed blocks but that's way more disruptive and this is already review-thirsty (see #9177 ).
  • LevelDB corruption with 0.8.x Mac client

    LevelDB corruption with 0.8.x Mac client

    I've run bitcoin-qt Mac client on the latest OSX version since 0.3.x thru to 0.7.2 with literally zero problems ever, on essentially this same hardware setup.

    Since the 0.8 update and switch to LevelDB none of the three Mac client releases have worked stably for me and I've had to downgrade to 0.7.2 (with the May 15 workaround) to maintain a stable bitcoin wallet.

    Current setup is: MacBook Pro Retina, OSX 10.8.4, bitcoin-qt 0.8.2

    I saw that some of the known corruption issues/bugs were fixed/closed with the 0.8.2 release, so I decided to try the upgrade again. After re-indexing and working fine for hours at time (much better than 0.8.1 at least) upon restart I get "Error opening block database. Do you want to rebuild the block database?" which of course I don't want to do because it takes forever, even on this world's fastest Mac with SSD drive. This has happened 6 times now, and the interesting line in debug.log is:

    Verifying last 288 blocks at level 3 LevelDB read failure: Corruption: block checksum mismatch

    More details here:

    Downgrading to 0.7.2 again, please help permanently fix this in the next 0.8.x release.

  • Speedy trial support for versionbits

    Speedy trial support for versionbits

    BIP9-based implementation of "speedy trial" activation specification, see

    Edge cases are tested by fuzzing added in #21380.

  • Question: consensus on the moving average

    Question: consensus on the moving average


    I research on consensus and need a forced delay between submittability of new blocks. In bitcoin you use stochastics + processor clock speed. This allows you to choose an expected forced delay, which you chose to be 10min.

    Quote from White Paper: "To compensate for increasing hardware speed and varying interest in running nodes over time, the proof-of-work difficulty is determined by a moving average targeting an average number of blocks per hour. If they're generated too fast, the difficulty increases."

    I do not see a way to find consensus on the present value of the moving average without yet implementing another consensus mechanism. But it appears necessary to have a very accurate global consensus on the exact value of the average because this value determines the mining difficulty. So how do you do it? Please give all the details in a novice-comprehensible way.

  • bench: Add missed `ECCVerifyHandle` instance

    bench: Add missed `ECCVerifyHandle` instance

    To clearly observe the lack of an ECCVerifyHandle instance,

    • apply the following diff:
    --- a/src/Makefile.bench.include
    +++ b/src/Makefile.bench.include
    @@ -19,11 +19,9 @@ bench_bench_bitcoin_SOURCES = \
       bench/bench.h \
       bench/bench_bitcoin.cpp \
       bench/block_assemble.cpp \
    -  bench/ccoins_caching.cpp \
       bench/chacha20.cpp \
       bench/chacha_poly_aead.cpp \
       bench/checkblock.cpp \
    -  bench/checkqueue.cpp \
       bench/crypto_hash.cpp \
       bench/data.cpp \
       bench/data.h \
    @@ -46,8 +44,7 @@ bench_bench_bitcoin_SOURCES = \
       bench/rpc_blockchain.cpp \
       bench/rpc_mempool.cpp \
       bench/strencodings.cpp \
    -  bench/util_time.cpp \
    -  bench/verify_script.cpp
    +  bench/util_time.cpp
     nodist_bench_bench_bitcoin_SOURCES = $(GENERATED_BENCH_FILES)
    • then
    $ ./autogen
    $ ./configure
    $ make clean
    $ make
    • then
    $ ./src/bench/bench_bitcoin -filter=ExpandDescriptor
    bench_bitcoin: pubkey.cpp:296: bool CPubKey::IsFullyValid() const: Assertion `secp256k1_context_verify && "secp256k1_context_verify must be initialized to use CPubKey."' failed.
    Aborted (core dumped)
  • refactor / kernel: Move non-gArgs chainparams functionality to kernel

    refactor / kernel: Move non-gArgs chainparams functionality to kernel

    This pull request is mostly a code-move of chainparams related functionality into the kernel library. @dongcarl is the original author of this patchset, these commits were taken from


    The bitcoin kernel library currently relies on code containing user configurations through the ArgsManager. This is not optimal, since as a stand-alone library it should not rely on most of the user-defined configuration. Instead, its interfaces should accept control and options structs that control the kernel library's desired configuration.

    A lot of tweakable parameters are defined within CChainParams and depend on access on the global ArgsManager gArgs instance.


    This PR splits the chainparams code of chainparams.cpp/h and chainparamsbase.cpp/h into parts depending on gArgs access and parts that don't. These are then moved into separate files within the kernel/ directory.

    Though a lot of code had to be moved and reshuffled to accommodate to the validation of both gArgs and options structs, the behavior should not change by the hand of this PR.

    Similar work towards decoupling the ArgsManager from the kernel has been done in, and Similar PR's are open in and

    Currently Identified Drawbacks

    The patches touch a large amount of consensus critical code. I tried to keep the change sets as incremental and easy to review as possible, but a lot of manual comparison of diffs will have to be done.

    There is no patch done yet introducing the kernel/chainparams.cpp/h into the kernel namespace. Such a change would be very intrusive to the entire codebase and hard to review as part of this patch set. Due to its intrusiveness, I am not sure whether this is the correct path forward or not.

    The globalChainBaseParams global had to be moved into the kernel chainparamsbase.cpp in order to allow calls to BaseParams() from contexts without access to gArgs. This is not ideal, but was the only way forward I could think of so far without basing this pull request on more prior work decoupling gArgs from the various call sites of BaseParams().

  • Opening bitcoin-24.0rc1-arm64-apple-darwin.dmg does not open Finder window

    Opening bitcoin-24.0rc1-arm64-apple-darwin.dmg does not open Finder window

    When I open bitcoin-24.0rc1-arm64-apple-darwin.dmg the volume is mounted silently, but does not open Finder window leading to very confusing user experience.

    OS: macOS 12.6 (21G115) on MacBook Air (M1, 2020)

    This is a regression from bitcoin-23.0-arm64-apple-darwin.dmg which opens the following Finder window:

    Screenshot 2022-09-24 at 17 31 58

    PS: I downloaded the file from

  • v24.0 testing

    v24.0 testing

    Umbrella issue for 24.0 testing. Please help testing on a wide variety of supported platforms, as well as interaction with different software.

    Let us know which version you tested on which operating system.

    If you find an issue, please search Github for known issues first and then open a new Github issue.

    This meta issue should not be used to report bugs, as a single thread makes it impossible to track more than one topic.

    See 24.0 Draft Release Notes for a list of changes, and testing reports for earlier releases (#24501, #22634), for an idea what to test.

A full node Bitcoin (BSV) implementation written in Go

bsvd bsvd is a full node Bitcoin (BSV) implementation written in Go (golang). This project is a port of the bchd codebase to Bitcoin (BSV). It provide

Feb 7, 2022
A db for bitcoin-sv & BTC

Welcome to go-svdb Project =========== Boquan Team The Boquan is a team dedicated to promoting and developing true bitcoin. The team has successfully

Sep 3, 2021
Moeing chain is an EVM&Web3 compatible sidechain for Bitcoin Cash

Full node client of smartBCH This repository contains the code of the full node client of smartBCH, an EVM&Web3 compatible sidechain for Bitcoin Cash.

Sep 15, 2022
Store data on Bitcoin for 350 sats/KB up to 185 KB by using P2SH-P2WSH witness scripts

Bitcandle Store data on Bitcoin for 350 sats/KB up to 185 kB by using P2SH-P2WSH witness scripts. 225ed8bc432d37cf434f80717286fd5671f676f12b573294db72

Aug 12, 2022
A curated Golang toolkit for creating Bitcoin SV powered apps
A curated Golang toolkit for creating Bitcoin SV powered apps

bsv A curated Golang toolkit for creating Bitcoin SV powered apps Table of Contents Installation Maintainers License Installation bsv requires a suppo

May 10, 2022
A work-in-progress Bitcoin wallet based on Output Descriptors

go-wallet A work-in-progress Bitcoin wallet Descriptors go-wallet is designed around Bitcoin Descriptors. It implements a Output Script Descriptors la

May 4, 2022
The go-to Bitcoin Node (BN) Go library.

go-bitcoin Go wrapper for bitcoin RPC RPC services Start by creating a connection to a bitcoin node b, err := New("rcp host", rpc port, "rpc usernam

Feb 13, 2022
Bitcoin CPU miner written in Go.

CPU Miner Bitcoin CPU miner written in Go. Introduction This is a CPU miner written in Go. It is a proof of concept and is not intended for production

Jan 6, 2022
A fully validating Bitcoin node with Utreexo support

btcd btcd is an alternative full node bitcoin implementation written in Go (golang). This project is currently under active development and is in a Be

Sep 5, 2022
Bitcoin futures curve from Deribit as a JSON webservice

Curve Bitcoin futures curve from Deribit as a JSON webservice Building go build . Running ./curve Expiration date and annualised yield of each contr

Dec 13, 2021
Mastering Bitcoin 2nd Edition - Programming the Open Blockchain

Code Examples: Mastering Bitcoin Mastering Bitcoin is a book for developers, although the first two chapters cover bitcoin at a level that is also app

Sep 25, 2022
Bitcoin Improvement Proposals

People wishing to submit BIPs, first should propose their idea or document to the [email protected] mailing list (do not assign a

Sep 14, 2022
Full bitcoin solution written in Go (golang)
Full bitcoin solution written in Go (golang)

About Gocoin Gocoin is a full Bitcoin solution written in Go language (golang). The software architecture is focused on maximum performance of the nod

Sep 13, 2022
A simple, concurrent bitcoin miner framework implemented in Go.

Bitcoin Miner A simple, concurrent bitcoin miner framework implemented in Go. Disclaimer: this is not a product intended to be used for real mining, s

May 30, 2022
Bitcoin address balance checker on steroids.

BTCSteroids Bitcoin address balance checker on steroids. Table of contents Quick start What's included Use Cases Thanks Copyright and license Quick st

Sep 6, 2022
Btc-globe - Visualize Bitcoin node locations using golang
Btc-globe - Visualize Bitcoin node locations using golang

btc-globe Visualize Bitcoin nodes by location using Golang

Jan 19, 2022
Bitcoin UTXO & xPub Management Suite
Bitcoin UTXO & xPub Management Suite

BUX Bitcoin UTXO & xPub Management Suite Table of Contents About Installation Documentation Examples & Tests Benchmarks Code Standards Usage Contribut

Sep 22, 2022
Home Assistant custom integration for e-distribución
Home Assistant custom integration for e-distribución

DEPRECATED! En primer lugar, gracias a todos por vuestra participación identificando fallos o proponiendo mejoras, pero debido a los últimos movimient

Sep 7, 2022
BitClout core node
BitClout core node

About BitClout BitClout is a blockchain built from the ground up to support a fully-featured social network. Its architecture is similar to Bitcoin, o

Aug 30, 2022