A fully validating Bitcoin node with Utreexo support

btcd

Build Status Coverage Status ISC License GoDoc

btcd is an alternative full node bitcoin implementation written in Go (golang).

This project is currently under active development and is in a Beta state. It is extremely stable and has been in production use since October 2013.

It properly downloads, validates, and serves the block chain using the exact rules (including consensus bugs) for block acceptance as Bitcoin Core. We have taken great care to avoid btcd causing a fork to the block chain. It includes a full block validation testing framework which contains all of the 'official' block acceptance tests (and some additional ones) that is run on every pull request to help ensure it properly follows consensus. Also, it passes all of the JSON test data in the Bitcoin Core code.

It also properly relays newly mined blocks, maintains a transaction pool, and relays individual transactions that have not yet made it into a block. It ensures all individual transactions admitted to the pool follow the rules required by the block chain and also includes more strict checks which filter transactions based on miner requirements ("standard" transactions).

One key difference between btcd and Bitcoin Core is that btcd does NOT include wallet functionality and this was a very intentional design decision. See the blog entry here for more details. This means you can't actually make or receive payments directly with btcd. That functionality is provided by the btcwallet and Paymetheus (Windows-only) projects which are both under active development.

Requirements

Go 1.14 or newer.

Installation

https://github.com/btcsuite/btcd/releases

Linux/BSD/MacOSX/POSIX - Build from Source

  • Install Go according to the installation instructions here: http://golang.org/doc/install

  • Ensure Go was installed properly and is a supported version:

$ go version
$ go env GOROOT GOPATH

NOTE: The GOROOT and GOPATH above must not be the same path. It is recommended that GOPATH is set to a directory in your home directory such as ~/goprojects to avoid write permission issues. It is also recommended to add $GOPATH/bin to your PATH at this point.

  • Run the following commands to obtain btcd, all dependencies, and install it:
$ cd $GOPATH/src/github.com/btcsuite/btcd
$ GO111MODULE=on go install -v . ./cmd/...
  • btcd (and utilities) will now be installed in $GOPATH/bin. If you did not already add the bin directory to your system path during Go installation, we recommend you do so now.

Updating

Linux/BSD/MacOSX/POSIX - Build from Source

  • Run the following commands to update btcd, all dependencies, and install it:
$ cd $GOPATH/src/github.com/btcsuite/btcd
$ git pull
$ GO111MODULE=on go install -v . ./cmd/...

Getting Started

btcd has several configuration options available to tweak how it runs, but all of the basic operations described in the intro section work with zero configuration.

Linux/BSD/POSIX/Source

$ ./btcd

IRC

  • irc.libera.chat
  • channel #btcd
  • webchat

Issue Tracker

The integrated github issue tracker is used for this project.

Documentation

The documentation is a work-in-progress. It is located in the docs folder.

Release Verification

Please see our documentation on the current build/verification process for all our releases for information on how to verify the integrity of published releases using our reproducible build system.

License

btcd is licensed under the copyfree ISC License.

Comments
  • Header validation

    Header validation

    Added the functions that would be required for header validation at the time of header download. The changes to existing functions are commented until these functions are incorporated completely so that the functioning is not affected.

  • go.yml: Fix github workflow and linting errors

    go.yml: Fix github workflow and linting errors

    GoLint was not being installed correctly, so it was throwing error code 127 when we were running the workflow. Fixed that issue, so that it is installed correctly. Also, there were some linting errors that were arising since now an updated golangci-lint is being used.

  • blockchain, wire: Change utreexo library

    blockchain, wire: Change utreexo library

    The utreexo library is switched over to github.com/utreexo/utreexo, which support the new accumulator algorithms that are more efficient in proof size and execution speed.

  • Not able to download the go modules to get started

    Not able to download the go modules to get started

    The command doesn't work properly and is not downloading the go modules required to start working on the project => $ go install -v . ./cmd/... image I am facing this error for that. $ GO111MODULE=on go install ./... Used this command and all the go modules were properly downloaded to get it started. Also maybe we can update the documentation , also it can be improved in terms of getting started. Let me know if it would need a PR, would love to work on that as an initial contribution.

  • blockchain: Add ReconsiderBlock

    blockchain: Add ReconsiderBlock

    ReconsiderBlock is added to BlockChain and it enables the ability to reconsider invalid blocks and the branch that the invalid block is included in. This is useful for undoing the effects of invalidateBlock.

  • blockchain: Add invalidateblock method to BlockChain

    blockchain: Add invalidateblock method to BlockChain

    This PR adds the missing invalidateblock rpc call. The call is useful for both manually testing changes with the cli or creating automated tests.

    The behavior of Bitcoin Core is mimicked. However, since we currently don't keep track of which block was received first, the prioritization of choosing whichever block is received first for the active chain tip is omitted.

  • Add watchonly wallet

    Add watchonly wallet

    The watch only wallet keeps supports registering addresses and xpubs and it keeps track of relevant utxos and the utreexo proof for those utxos.

    This allows users running Utreexo compact state nodes to keep track of the proofs for their own utxos, allowing the compact state nodes to prove txs to each other.

    The watch only wallet is currently a work in progress ands registering xpubs are not supported yet. However, it can keep track of relevant utxos and the utreexo proof and supports handling reorgs as well.

  • wire: Add custom json marshaling for leaf data

    wire: Add custom json marshaling for leaf data

    The leaf data is also useful for wallets as it's all the data they need to prove that their utxo exists to other utreexo nodes. Having json marshal support allows users to easily store the data as in json format.

  • blockchain: Fix CSN reorg bug

    blockchain: Fix CSN reorg bug

    Utreexo compact state nodes would try to flush the utxo cache during a reorg, resulting in a segfault. Code is changed so that a utreeox compact state node does not try to flush the utxo cache.

  • Tx broke my node

    Tx broke my node

    I think this repo didn't pull the fix for the parsing errors, now this transaction makes my signet node get stuck at height 118240.
    Here's what the log says:

    2022-11-29 19:18:36.235 [ERR] PEER: Can't read message from [scrubbed](outbound): readScript: script witness item is larger than the max allowed size [count 14317, max 11000]
    
  • indexers/flatutreexoproofindex: Generate multi block proof

    indexers/flatutreexoproofindex: Generate multi block proof

    Support for multi-range block proofs are now added to Flatutreexoproofindex. Csn sync tests are also added to ensure that the multi-block proofs validate on the receiving side. Support for changing the interval via flags are to be added in the future.

    There needs to be more tests run but there are are proof size reductions as you use greater and greater intervals. There lies the tradeoff of caching more to decrease the bandwidth so it'd be good to look for a sweet spot with more research.

  • main, rpcclient: Add rpc for invalidateblock and reconsiderblock

    main, rpcclient: Add rpc for invalidateblock and reconsiderblock

    The invalidateblock and reconsiderblock methods on BlockChain are now exposed through rpc. These two functions are useful to have as they make it easier to test things on regtest.

  • Sliding blocks window

    Sliding blocks window

    Adding the sliding window functionality where the syncManager maintains a moving window that contains all the headers that have been validated and are ready for block download. We slide forward on the window and requests for the blocks to be downloaded.

  • server: Ask for utreexo enabled nodes when --utreexo flag is on

    server: Ask for utreexo enabled nodes when --utreexo flag is on

    Only utreexo archival nodes should be connected to for node with the flag --utreexo on (aka CSNs).

    There's currently no seeders that are seeding utreexo nodes and that'll have to be done later.

utreexo blockchain skeleton
utreexo blockchain skeleton

sunyata sunyata is a blockchain skeleton. It implements a minimally-functional proof-of-work blockchain, including consensus algorithms, p2p networkin

May 24, 2022
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

Dec 25, 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
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
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.

Nov 29, 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
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

Dec 29, 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
Bitcoin Core integration/staging tree

Bitcoin Core integration/staging tree https://bitcoincore.org For an immediately usable, binary version of the Bitcoin Core software, see https://bitc

Dec 30, 2022
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

Jan 1, 2023
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

Jan 2, 2023
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

Dec 20, 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

Dec 29, 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

Dec 12, 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

Dec 19, 2022
Automatic HTTPS for any Go program: fully-managed TLS certificate issuance and renewal
Automatic HTTPS for any Go program: fully-managed TLS certificate issuance and renewal

Easy and Powerful TLS Automation The same library used by the Caddy Web Server Caddy's automagic TLS features—now for your own Go programs—in one powe

Jan 8, 2023