2015-01-18 18:16:43 +01:00
### Table of Contents
1. [About ](#About )
2. [Getting Started ](#GettingStarted )
1. [Installation ](#Installation )
1. [Windows ](#WindowsInstallation )
2. [Linux/BSD/MacOSX/POSIX ](#PosixInstallation )
2015-11-08 21:55:08 +01:00
1. [Gentoo Linux ](#GentooInstallation )
2015-01-18 18:16:43 +01:00
2. [Configuration ](#Configuration )
3. [Controlling and Querying btcd via btcctl ](#BtcctlConfig )
4. [Mining ](#Mining )
3. [Help ](#Help )
1. [Startup ](#Startup )
1. [Using bootstrap.dat ](#BootstrapDat )
2. [Network Configuration ](#NetworkConfig )
3. [Wallet ](#Wallet )
4. [Contact ](#Contact )
1. [IRC ](#ContactIRC )
2. [Mailing Lists ](#MailingLists )
5. [Developer Resources ](#DeveloperResources )
1. [Code Contribution Guidelines ](#ContributionGuidelines )
2. [JSON-RPC Reference ](#JSONRPCReference )
2015-05-01 08:28:01 +02:00
3. [The btcsuite Bitcoin-related Go Packages ](#GoPackages )
2015-01-18 18:16:43 +01:00
< a name = "About" / >
### 1. About
btcd is a full node bitcoin implementation written in [Go ](http://golang.org ),
licensed under the [copyfree ](http://www.copyfree.org ) ISC License.
2016-03-11 21:36:32 +01:00
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.
2015-01-18 18:16:43 +01:00
It currently properly downloads, validates, and serves the block chain using the
exact rules (including bugs) for block acceptance as the reference
implementation, [bitcoind ](https://github.com/bitcoin/bitcoin ). We have taken
great care to avoid btcd causing a fork to the block chain. It passes all of
the '[official](https://github.com/TheBlueMatt/test-scripts/)' block acceptance
tests.
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 into the block chain and also includes the vast majority of the more
strict checks which filter transactions based on miner requirements ("standard"
transactions).
2016-03-11 21:36:32 +01:00
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 ](https://blog.conformal.com/btcd-not-your-moms-bitcoin-daemon )
for more details. This means you can't actually make or receive payments
directly with btcd. That functionality is provided by the
2015-01-18 18:16:43 +01:00
[btcwallet ](https://github.com/btcsuite/btcwallet ) and
2016-03-11 21:36:32 +01:00
[Paymetheus ](https://github.com/btcsuite/Paymetheus ) (Windows-only) projects
which are both under active development.
2015-01-18 18:16:43 +01:00
< a name = "GettingStarted" / >
### 2. Getting Started
< a name = "Installation" / >
**2.1 Installation**< br / >
The first step is to install btcd. See one of the following sections for
details on how to install on the supported operating systems.
< a name = "WindowsInstallation" / >
**2.1.1 Windows Installation**< br / >
* Install the MSI available at: https://github.com/btcsuite/btcd/releases
* Launch btcd from the Start Menu
< a name = "PosixInstallation" / >
**2.1.2 Linux/BSD/MacOSX/POSIX Installation**< br / >
* Install Go according to the installation instructions here: http://golang.org/doc/install
* Run the following command to ensure your Go version is at least version 1.2: `$ go version`
* Run the following command to obtain btcd, its dependencies, and install it: `$ go get github.com/btcsuite/btcd/...` < br />
* To upgrade, run the following command: `$ go get -u github.com/btcsuite/btcd/...`
* Run btcd: `$ btcd`
2015-11-08 21:55:08 +01:00
< a name = "GentooInstallation" / >
**2.1.2.1 Gentoo Linux Installation**< br / >
* Install Layman and enable the Bitcoin overlay.
* https://gitlab.com/bitcoin/gentoo
* Copy or symlink `/var/lib/layman/bitcoin/Documentation/package.keywords/btcd-live` to `/etc/portage/package.keywords/`
* Install btcd: `$ emerge net-p2p/btcd`
2015-01-18 18:16:43 +01:00
< a name = "Configuration" / >
**2.2 Configuration**< br / >
btcd has a number of [configuration ](http://godoc.org/github.com/btcsuite/btcd )
options, which can be viewed by running: `$ btcd --help` .
< a name = "BtcctlConfig" / >
**2.3 Controlling and Querying btcd via btcctl**< br / >
btcctl is a command line utility that can be used to both control and query btcd
via [RPC ](http://www.wikipedia.org/wiki/Remote_procedure_call ). btcd does
**not** enable its RPC server by default; You must configure at minimum both an
2015-03-30 19:45:31 +02:00
RPC username and password or both an RPC limited username and password:
2015-01-18 18:16:43 +01:00
* btcd.conf configuration file
```
[Application Options]
rpcuser=myuser
rpcpass=SomeDecentp4ssw0rd
2015-03-30 19:45:31 +02:00
rpclimituser=mylimituser
rpclimitpass=Limitedp4ssw0rd
2015-01-18 18:16:43 +01:00
```
* btcctl.conf configuration file
```
[Application Options]
rpcuser=myuser
rpcpass=SomeDecentp4ssw0rd
```
2015-03-30 19:45:31 +02:00
OR
```
[Application Options]
2015-05-06 18:46:04 +02:00
rpclimituser=mylimituser
rpclimitpass=Limitedp4ssw0rd
2015-03-30 19:45:31 +02:00
```
2015-01-18 18:16:43 +01:00
For a list of available options, run: `$ btcctl --help`
< a name = "Mining" / >
**2.4 Mining**< br / >
btcd supports both the `getwork` and `getblocktemplate` RPCs although the
2015-03-30 19:45:31 +02:00
`getwork` RPC is deprecated and will likely be removed in a future release.
The limited user cannot access these RPCs.< br / >
2015-01-18 18:16:43 +01:00
**1. Add the payment addresses with the `miningaddr` option.**< br />
```
[Application Options]
rpcuser=myuser
rpcpass=SomeDecentp4ssw0rd
miningaddr=12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX
miningaddr=1M83ju3EChKYyysmM2FXtLNftbacagd8FR
```
**2. Add btcd's RPC TLS certificate to system Certificate Authority list.**< br / >
`cgminer` uses [curl ](http://curl.haxx.se/ ) to fetch data from the RPC server.
Since curl validates the certificate by default, we must install the `btcd` RPC
certificate into the default system Certificate Authority list.
**Ubuntu**< br / >
1. Copy rpc.cert to /usr/share/ca-certificates: `# cp /home/user/.btcd/rpc.cert /usr/share/ca-certificates/btcd.crt` < br />
2. Add btcd.crt to /etc/ca-certificates.conf: `# echo btcd.crt >> /etc/ca-certificates.conf` < br />
3. Update the CA certificate list: `# update-ca-certificates` < br />
**3. Set your mining software url to use https.**< br / >
`$ cgminer -o https://127.0.0.1:8334 -u rpcuser -p rpcpassword`
< a name = "Help" / >
### 3. Help
< a name = "Startup" / >
**3.1 Startup**< br / >
Typically btcd will run and start downloading the block chain with no extra
configuration necessary, however, there is an optional method to use a
`bootstrap.dat` file that may speed up the initial block chain download process.
< a name = "BootstrapDat" / >
**3.1.1 bootstrap.dat**< br / >
* [Using bootstrap.dat ](https://github.com/btcsuite/btcd/tree/master/docs/using_bootstrap_dat.md )
< a name = "NetworkConfig" / >
**3.1.2 Network Configuration**< br / >
* [What Ports Are Used by Default? ](https://github.com/btcsuite/btcd/tree/master/docs/default_ports.md )
* [How To Listen on Specific Interfaces ](https://github.com/btcsuite/btcd/tree/master/docs/configure_peer_server_listen_interfaces.md )
* [How To Configure RPC Server to Listen on Specific Interfaces ](https://github.com/btcsuite/btcd/tree/master/docs/configure_rpc_server_listen_interfaces.md )
* [Configuring btcd with Tor ](https://github.com/btcsuite/btcd/tree/master/docs/configuring_tor.md )
< a name = "Wallet" / >
**3.1 Wallet**< br / >
btcd was intentionally developed without an integrated wallet for security
reasons. Please see [btcwallet ](https://github.com/btcsuite/btcwallet ) for more
information.
< a name = "Contact" / >
### 4. Contact
< a name = "ContactIRC" / >
**4.1 IRC**< br / >
2015-05-12 20:01:58 +02:00
* [irc.freenode.net ](irc://irc.freenode.net ), channel #btcd
2015-01-18 18:16:43 +01:00
< a name = "MailingLists" / >
**4.2 Mailing Lists**< br / >
* < a href = "mailto:btcd+subscribe@opensource.conformal.com" > btcd</ a > : discussion
of btcd and its packages.
* < a href = "mailto:btcd-commits+subscribe@opensource.conformal.com" > btcd-commits</ a > :
readonly mail-out of source code changes.
< a name = "DeveloperResources" / >
### 5. Developer Resources
< a name = "ContributionGuidelines" / >
* [Code Contribution Guidelines ](https://github.com/btcsuite/btcd/tree/master/docs/code_contribution_guidelines.md )
< a name = "JSONRPCReference" / >
* [JSON-RPC Reference ](https://github.com/btcsuite/btcd/tree/master/docs/json_rpc_api.md )
* [RPC Examples ](https://github.com/btcsuite/btcd/tree/master/docs/json_rpc_api.md#ExampleCode )
< a name = "GoPackages" / >
2015-05-01 08:28:01 +02:00
* The btcsuite Bitcoin-related Go Packages:
2015-01-18 18:16:43 +01:00
* [btcrpcclient ](https://github.com/btcsuite/btcrpcclient ) - Implements a
robust and easy to use Websocket-enabled Bitcoin JSON-RPC client
* [btcjson ](https://github.com/btcsuite/btcjson ) - Provides an extensive API
for the underlying JSON-RPC command and return values
2015-02-06 00:54:04 +01:00
* [wire ](https://github.com/btcsuite/btcd/tree/master/wire ) - Implements the
Bitcoin wire protocol
peer: Refactor peer code into its own package.
This commit introduces package peer which contains peer related features
refactored from peer.go.
The following is an overview of the features the package provides:
- Provides a basic concurrent safe bitcoin peer for handling bitcoin
communications via the peer-to-peer protocol
- Full duplex reading and writing of bitcoin protocol messages
- Automatic handling of the initial handshake process including protocol
version negotiation
- Automatic periodic keep-alive pinging and pong responses
- Asynchronous message queueing of outbound messages with optional
channel for notification when the message is actually sent
- Inventory message batching and send trickling with known inventory
detection and avoidance
- Ability to wait for shutdown/disconnect
- Flexible peer configuration
- Caller is responsible for creating outgoing connections and listening
for incoming connections so they have flexibility to establish
connections as they see fit (proxies, etc.)
- User agent name and version
- Bitcoin network
- Service support signalling (full nodes, bloom filters, etc.)
- Maximum supported protocol version
- Ability to register callbacks for handling bitcoin protocol messages
- Proper handling of bloom filter related commands when the caller does
not specify the related flag to signal support
- Disconnects the peer when the protocol version is high enough
- Does not invoke the related callbacks for older protocol versions
- Snapshottable peer statistics such as the total number of bytes read
and written, the remote address, user agent, and negotiated protocol
version
- Helper functions for pushing addresses, getblocks, getheaders, and
reject messages
- These could all be sent manually via the standard message output
function, but the helpers provide additional nice functionality such
as duplicate filtering and address randomization
- Full documentation with example usage
- Test coverage
In addition to the addition of the new package, btcd has been refactored
to make use of the new package by extending the basic peer it provides to
work with the blockmanager and server to act as a full node. The
following is a broad overview of the changes to integrate the package:
- The server is responsible for all connection management including
persistent peers and banning
- Callbacks for all messages that are required to implement a full node
are registered
- Logic necessary to serve data and behave as a full node is now in the
callback registered with the peer
Finally, the following peer-related things have been improved as a part
of this refactor:
- Don't log or send reject message due to peer disconnects
- Remove trace logs that aren't particularly helpful
- Finish an old TODO to switch the queue WaitGroup over to a channel
- Improve various comments and fix some code consistency cases
- Improve a few logging bits
- Implement a most-recently-used nonce tracking for detecting self
connections and generate a unique nonce for each peer
2015-10-02 08:03:20 +02:00
* [peer ](https://github.com/btcsuite/btcd/tree/master/peer ) -
Provides a common base for creating and managing Bitcoin network peers.
2015-02-08 19:07:23 +01:00
* [blockchain ](https://github.com/btcsuite/btcd/tree/master/blockchain ) -
Implements Bitcoin block handling and chain selection rules
2015-02-06 00:54:04 +01:00
* [txscript ](https://github.com/btcsuite/btcd/tree/master/txscript ) -
Implements the Bitcoin transaction scripting language
2015-02-08 19:07:23 +01:00
* [btcec ](https://github.com/btcsuite/btcd/tree/master/btcec ) - Implements
support for the elliptic curve cryptographic functions needed for the
Bitcoin scripts
2015-01-27 22:38:23 +01:00
* [database ](https://github.com/btcsuite/btcd/tree/master/database ) -
2015-01-28 02:17:54 +01:00
Provides a database interface for the Bitcoin block chain
2015-01-18 18:16:43 +01:00
* [btcutil ](https://github.com/btcsuite/btcutil ) - Provides Bitcoin-specific
2015-05-06 18:46:04 +02:00
convenience functions and types