[lbry] docs: update docs for LBRY
This commit is contained in:
parent
f1314e2e2d
commit
47a2f0ca85
45 changed files with 237 additions and 3159 deletions
1
LICENSE
1
LICENSE
|
@ -1,5 +1,6 @@
|
|||
ISC License
|
||||
|
||||
Copyright (c) 2021 The LBRY developers
|
||||
Copyright (c) 2013-2017 The btcsuite developers
|
||||
Copyright (c) 2015-2016 The Decred developers
|
||||
|
||||
|
|
143
README.md
143
README.md
|
@ -1,121 +1,80 @@
|
|||
btcd
|
||||
lbcd
|
||||
====
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![Coverage Status](https://coveralls.io/repos/github/btcsuite/btcd/badge.svg?branch=master)](https://coveralls.io/github/btcsuite/btcd?branch=master)
|
||||
[![Build Status](https://github.com/lbryio/lbcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/lbryio/lbcd/actions)
|
||||
[![Coverage Status](https://coveralls.io/repos/github/lbryio/lbcd/badge.svg?branch=master)](https://coveralls.io/github/lbryio/lbcd?branch=master)
|
||||
[![ISC License](https://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/btcsuite/btcd)
|
||||
<!--[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/lbryio/lbcd)-->
|
||||
|
||||
btcd is an alternative full node bitcoin implementation written in Go (golang).
|
||||
lbcd is a full node implementation of LBRY's blockchain 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.
|
||||
This project is currently under active development and is in a Beta state while we
|
||||
ensure it matches LBRYcrd's functionality. The intention is that it properly downloads, validates, and serves the block chain using the exact
|
||||
rules (including consensus bugs) for block acceptance as LBRYcrd. We have
|
||||
taken great care to avoid lbcd causing a fork to the blockchain.
|
||||
|
||||
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.
|
||||
Note: lbcd does *NOT* include
|
||||
wallet functionality. That functionality is provided by the
|
||||
[lbcwallet](https://github.com/lbryio/lbcwallet) and the [LBRY SDK](https://github.com/lbryio/lbry-sdk).
|
||||
|
||||
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).
|
||||
## Security
|
||||
|
||||
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://web.archive.org/web/20171125143919/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
|
||||
[btcwallet](https://github.com/btcsuite/btcwallet) and
|
||||
[Paymetheus](https://github.com/btcsuite/Paymetheus) (Windows-only) projects
|
||||
which are both under active development.
|
||||
We take security seriously. Please contact [security](mailto:security@lbry.com) regarding any security issues.
|
||||
Our PGP key is [here](https://lbry.com/faq/pgp-key) if you need it.
|
||||
|
||||
We maintain a mailing list for notifications of upgrades, security issues,
|
||||
and soft/hard forks. To join, visit https://lbry.com/forklist
|
||||
|
||||
## Requirements
|
||||
|
||||
[Go](http://golang.org) 1.14 or newer.
|
||||
All common operating systems are supported. lbcd requires at least 8GB of RAM
|
||||
and at least 100GB of disk storage. Both RAM and disk requirements increase slowly over time.
|
||||
Using a fast NVMe disk is recommended.
|
||||
|
||||
lbcd is not immune to data loss. It expects a clean shutdown
|
||||
via SIGINT or SIGTERM. SIGKILL, immediate VM kills, and sudden power loss
|
||||
can cause data corruption, thus requiring chain resynchronization for recovery.
|
||||
|
||||
For compilation, [Go](http://golang.org) 1.16 or newer is required.
|
||||
|
||||
## Installation
|
||||
|
||||
https://github.com/btcsuite/btcd/releases
|
||||
Acquire binary files from https://github.com/lbryio/lbcd/releases
|
||||
|
||||
#### Linux/BSD/MacOSX/POSIX - Build from Source
|
||||
#### To build from Source on Linux/BSD/MacOSX/POSIX:
|
||||
|
||||
- Install Go according to the installation instructions here:
|
||||
http://golang.org/doc/install
|
||||
- Install Go according to its [installation instructions](http://golang.org/doc/install).
|
||||
- Use your favorite git tool to acquire the lbcd source.
|
||||
- lbcd has no non-Go dependencies; it can be built by simply running `go build .`
|
||||
- lbcctl can be built similarly:
|
||||
|
||||
- Ensure Go was installed properly and is a supported version:
|
||||
Both [GoLand](https://www.jetbrains.com/go/)
|
||||
and [VS Code](https://code.visualstudio.com/docs/languages/go) IDEs are supported.
|
||||
|
||||
```bash
|
||||
$ go version
|
||||
$ go env GOROOT GOPATH
|
||||
## Usage
|
||||
|
||||
By default, data and logs are stored in `~/.lbcd/`
|
||||
|
||||
To enable RPC access a username and password is required. Example:
|
||||
```
|
||||
|
||||
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:
|
||||
|
||||
```bash
|
||||
$ cd $GOPATH/src/github.com/btcsuite/btcd
|
||||
$ GO111MODULE=on go install -v . ./cmd/...
|
||||
./lbcd --notls --rpcuser=x --rpcpass=y --txindex &
|
||||
./lbcctl --notls --rpcuser=x --rpcpass=y getblocktemplate
|
||||
```
|
||||
<!-- TODO: explain how to use TLS certificates. -->
|
||||
|
||||
- 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.
|
||||
## Contributing
|
||||
|
||||
## Updating
|
||||
|
||||
#### Linux/BSD/MacOSX/POSIX - Build from Source
|
||||
|
||||
- Run the following commands to update btcd, all dependencies, and install it:
|
||||
|
||||
```bash
|
||||
$ 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
|
||||
|
||||
```bash
|
||||
$ ./btcd
|
||||
```
|
||||
|
||||
## IRC
|
||||
|
||||
- irc.freenode.net
|
||||
- channel #btcd
|
||||
- [webchat](https://webchat.freenode.net/?channels=btcd)
|
||||
|
||||
## Issue Tracker
|
||||
|
||||
The [integrated github issue tracker](https://github.com/btcsuite/btcd/issues)
|
||||
is used for this project.
|
||||
|
||||
## Documentation
|
||||
|
||||
The documentation is a work-in-progress. It is located in the [docs](https://github.com/btcsuite/btcd/tree/master/docs) folder.
|
||||
|
||||
## Release Verification
|
||||
Contributions to this project are welcome, encouraged, and compensated.
|
||||
The [integrated github issue tracker](https://github.com/lbryio/lbcd/issues)
|
||||
is used for this project. All pull requests will be considered.
|
||||
|
||||
<!-- ## Release Verification
|
||||
Please see our [documentation on the current build/verification
|
||||
process](https://github.com/btcsuite/btcd/tree/master/release) for all our
|
||||
process](https://github.com/lbryio/lbcd/tree/master/release) 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](http://copyfree.org) ISC License.
|
||||
lbcd is licensed under the [copyfree](http://copyfree.org) ISC License.
|
||||
|
|
|
@ -1,30 +1,9 @@
|
|||
blockchain
|
||||
==========
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/btcsuite/btcd/blockchain)
|
||||
|
||||
Package blockchain implements bitcoin block handling and chain selection rules.
|
||||
The test coverage is currently only around 60%, but will be increasing over
|
||||
time. See `test_coverage.txt` for the gocov coverage report. Alternatively, if
|
||||
you are running a POSIX OS, you can run the `cov_report.sh` script for a
|
||||
real-time report. Package blockchain is licensed under the liberal ISC license.
|
||||
|
||||
There is an associated blog post about the release of this package
|
||||
[here](https://blog.conformal.com/btcchain-the-bitcoin-chain-package-from-bctd/).
|
||||
|
||||
This package has intentionally been designed so it can be used as a standalone
|
||||
package for any projects needing to handle processing of blocks into the bitcoin
|
||||
block chain.
|
||||
|
||||
## Installation and Updating
|
||||
|
||||
```bash
|
||||
$ go get -u github.com/btcsuite/btcd/blockchain
|
||||
```
|
||||
|
||||
## Bitcoin Chain Processing Overview
|
||||
### Bitcoin Chain Processing Overview
|
||||
|
||||
Before a block is allowed into the block chain, it must go through an intensive
|
||||
series of validation rules. The following list serves as a general outline of
|
||||
|
@ -58,46 +37,3 @@ is by no means exhaustive:
|
|||
- Run the transaction scripts to verify the spender is allowed to spend the
|
||||
coins
|
||||
- Insert the block into the block database
|
||||
|
||||
## Examples
|
||||
|
||||
* [ProcessBlock Example](https://pkg.go.dev/github.com/btcsuite/btcd/blockchain#example-BlockChain-ProcessBlock)
|
||||
Demonstrates how to create a new chain instance and use ProcessBlock to
|
||||
attempt to add a block to the chain. This example intentionally
|
||||
attempts to insert a duplicate genesis block to illustrate how an invalid
|
||||
block is handled.
|
||||
|
||||
* [CompactToBig Example](https://pkg.go.dev/github.com/btcsuite/btcd/blockchain#example-CompactToBig)
|
||||
Demonstrates how to convert the compact "bits" in a block header which
|
||||
represent the target difficulty to a big integer and display it using the
|
||||
typical hex notation.
|
||||
|
||||
* [BigToCompact Example](https://pkg.go.dev/github.com/btcsuite/btcd/blockchain#example-BigToCompact)
|
||||
Demonstrates how to convert a target difficulty into the
|
||||
compact "bits" in a block header which represent that target difficulty.
|
||||
|
||||
## GPG Verification Key
|
||||
|
||||
All official release tags are signed by Conformal so users can ensure the code
|
||||
has not been tampered with and is coming from the btcsuite developers. To
|
||||
verify the signature perform the following:
|
||||
|
||||
- Download the public key from the Conformal website at
|
||||
https://opensource.conformal.com/GIT-GPG-KEY-conformal.txt
|
||||
|
||||
- Import the public key into your GPG keyring:
|
||||
```bash
|
||||
gpg --import GIT-GPG-KEY-conformal.txt
|
||||
```
|
||||
|
||||
- Verify the release tag with the following command where `TAG_NAME` is a
|
||||
placeholder for the specific tag:
|
||||
```bash
|
||||
git tag -v TAG_NAME
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
|
||||
Package blockchain is licensed under the [copyfree](http://copyfree.org) ISC
|
||||
License.
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
fullblocktests
|
||||
==============
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![Build Status](https://github.com/lbryio/lbcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/lbryio/lbcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/btcsuite/btcd/blockchain/fullblocktests)
|
||||
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/lbryio/lbcd/blockchain/fullblocktests)
|
||||
|
||||
Package fullblocktests provides a set of full block tests to be used for testing
|
||||
the consensus validation rules. The tests are intended to be flexible enough to
|
||||
|
@ -20,7 +20,7 @@ of blocks that exercise the consensus validation rules.
|
|||
## Installation and Updating
|
||||
|
||||
```bash
|
||||
$ go get -u github.com/btcsuite/btcd/blockchain/fullblocktests
|
||||
$ go get -u github.com/lbryio/lbcd/blockchain/fullblocktests
|
||||
```
|
||||
|
||||
## License
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
indexers
|
||||
========
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![Build Status](https://github.com/lbryio/lbcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/lbryio/lbcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://pkg.go.dev/github.com/btcsuite/btcd/blockchain/indexers?status.png)](https://pkg.go.dev/github.com/btcsuite/btcd/blockchain/indexers)
|
||||
[![GoDoc](https://pkg.go.dev/github.com/lbryio/lbcd/blockchain/indexers?status.png)](https://pkg.go.dev/github.com/lbryio/lbcd/blockchain/indexers)
|
||||
|
||||
Package indexers implements optional block chain indexes.
|
||||
|
||||
|
@ -23,7 +23,7 @@ via an RPC interface.
|
|||
## Installation
|
||||
|
||||
```bash
|
||||
$ go get -u github.com/btcsuite/btcd/blockchain/indexers
|
||||
$ go get -u github.com/lbryio/lbcd/blockchain/indexers
|
||||
```
|
||||
|
||||
## License
|
||||
|
|
|
@ -1,68 +1,11 @@
|
|||
btcec
|
||||
=====
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://pkg.go.dev/github.com/btcsuite/btcd/btcec?status.png)](https://pkg.go.dev/github.com/btcsuite/btcd/btcec)
|
||||
|
||||
Package btcec implements elliptic curve cryptography needed for working with
|
||||
btcec implements elliptic curve cryptography needed for working with
|
||||
Bitcoin (secp256k1 only for now). It is designed so that it may be used with the
|
||||
standard crypto/ecdsa packages provided with go. A comprehensive suite of test
|
||||
is provided to ensure proper functionality. Package btcec was originally based
|
||||
on work from ThePiachu which is licensed under the same terms as Go, but it has
|
||||
signficantly diverged since then. The btcsuite developers original is licensed
|
||||
under the liberal ISC license.
|
||||
|
||||
Although this package was primarily written for btcd, it has intentionally been
|
||||
designed so it can be used as a standalone package for any projects needing to
|
||||
use secp256k1 elliptic curve cryptography.
|
||||
|
||||
## Installation and Updating
|
||||
|
||||
```bash
|
||||
$ go get -u github.com/btcsuite/btcd/btcec
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
* [Sign Message](https://pkg.go.dev/github.com/btcsuite/btcd/btcec#example-package--SignMessage)
|
||||
Demonstrates signing a message with a secp256k1 private key that is first
|
||||
parsed form raw bytes and serializing the generated signature.
|
||||
|
||||
* [Verify Signature](https://pkg.go.dev/github.com/btcsuite/btcd/btcec#example-package--VerifySignature)
|
||||
Demonstrates verifying a secp256k1 signature against a public key that is
|
||||
first parsed from raw bytes. The signature is also parsed from raw bytes.
|
||||
|
||||
* [Encryption](https://pkg.go.dev/github.com/btcsuite/btcd/btcec#example-package--EncryptMessage)
|
||||
Demonstrates encrypting a message for a public key that is first parsed from
|
||||
raw bytes, then decrypting it using the corresponding private key.
|
||||
|
||||
* [Decryption](https://pkg.go.dev/github.com/btcsuite/btcd/btcec#example-package--DecryptMessage)
|
||||
Demonstrates decrypting a message using a private key that is first parsed
|
||||
from raw bytes.
|
||||
|
||||
## GPG Verification Key
|
||||
|
||||
All official release tags are signed by Conformal so users can ensure the code
|
||||
has not been tampered with and is coming from the btcsuite developers. To
|
||||
verify the signature perform the following:
|
||||
|
||||
- Download the public key from the Conformal website at
|
||||
https://opensource.conformal.com/GIT-GPG-KEY-conformal.txt
|
||||
|
||||
- Import the public key into your GPG keyring:
|
||||
```bash
|
||||
gpg --import GIT-GPG-KEY-conformal.txt
|
||||
```
|
||||
|
||||
- Verify the release tag with the following command where `TAG_NAME` is a
|
||||
placeholder for the specific tag:
|
||||
```bash
|
||||
git tag -v TAG_NAME
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Package btcec is licensed under the [copyfree](http://copyfree.org) ISC License
|
||||
except for btcec.go and btcec_test.go which is under the same license as Go.
|
||||
|
||||
signficantly diverged since then.
|
|
@ -1,70 +1,8 @@
|
|||
btcjson
|
||||
=======
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/btcsuite/btcd/btcjson)
|
||||
|
||||
Package btcjson implements concrete types for marshalling to and from the
|
||||
bitcoin JSON-RPC API. A comprehensive suite of tests is provided to ensure
|
||||
proper functionality.
|
||||
|
||||
Although this package was primarily written for the btcsuite, it has
|
||||
intentionally been designed so it can be used as a standalone package for any
|
||||
projects needing to marshal to and from bitcoin JSON-RPC requests and responses.
|
||||
|
||||
Note that although it's possible to use this package directly to implement an
|
||||
RPC client, it is not recommended since it is only intended as an infrastructure
|
||||
package. Instead, RPC clients should use the
|
||||
[btcrpcclient](https://github.com/btcsuite/btcrpcclient) package which provides
|
||||
a full blown RPC client with many features such as automatic connection
|
||||
management, websocket support, automatic notification re-registration on
|
||||
reconnect, and conversion from the raw underlying RPC types (strings, floats,
|
||||
ints, etc) to higher-level types with many nice and useful properties.
|
||||
|
||||
## Installation and Updating
|
||||
|
||||
```bash
|
||||
$ go get -u github.com/btcsuite/btcd/btcjson
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
* [Marshal Command](https://pkg.go.dev/github.com/btcsuite/btcd/btcjson#example-MarshalCmd)
|
||||
Demonstrates how to create and marshal a command into a JSON-RPC request.
|
||||
|
||||
* [Unmarshal Command](https://pkg.go.dev/github.com/btcsuite/btcd/btcjson#example-UnmarshalCmd)
|
||||
Demonstrates how to unmarshal a JSON-RPC request and then unmarshal the
|
||||
concrete request into a concrete command.
|
||||
|
||||
* [Marshal Response](https://pkg.go.dev/github.com/btcsuite/btcd/btcjson#example-MarshalResponse)
|
||||
Demonstrates how to marshal a JSON-RPC response.
|
||||
|
||||
* [Unmarshal Response](https://pkg.go.dev/github.com/btcsuite/btcd/btcjson#example-package--UnmarshalResponse)
|
||||
Demonstrates how to unmarshal a JSON-RPC response and then unmarshal the
|
||||
result field in the response to a concrete type.
|
||||
|
||||
## GPG Verification Key
|
||||
|
||||
All official release tags are signed by Conformal so users can ensure the code
|
||||
has not been tampered with and is coming from the btcsuite developers. To
|
||||
verify the signature perform the following:
|
||||
|
||||
- Download the public key from the Conformal website at
|
||||
https://opensource.conformal.com/GIT-GPG-KEY-conformal.txt
|
||||
|
||||
- Import the public key into your GPG keyring:
|
||||
```bash
|
||||
gpg --import GIT-GPG-KEY-conformal.txt
|
||||
```
|
||||
|
||||
- Verify the release tag with the following command where `TAG_NAME` is a
|
||||
placeholder for the specific tag:
|
||||
```bash
|
||||
git tag -v TAG_NAME
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Package btcjson is licensed under the [copyfree](http://copyfree.org) ISC
|
||||
License.
|
||||
|
|
|
@ -1,85 +1,8 @@
|
|||
chaincfg
|
||||
========
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/btcsuite/btcd/chaincfg)
|
||||
|
||||
Package chaincfg defines chain configuration parameters for the three standard
|
||||
Bitcoin networks and provides the ability for callers to define their own custom
|
||||
Bitcoin networks.
|
||||
|
||||
Although this package was primarily written for btcd, it has intentionally been
|
||||
designed so it can be used as a standalone package for any projects needing to
|
||||
use parameters for the standard Bitcoin networks or for projects needing to
|
||||
define their own network.
|
||||
|
||||
## Sample Use
|
||||
|
||||
```Go
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
)
|
||||
|
||||
var testnet = flag.Bool("testnet", false, "operate on the testnet Bitcoin network")
|
||||
|
||||
// By default (without -testnet), use mainnet.
|
||||
var chainParams = &chaincfg.MainNetParams
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
// Modify active network parameters if operating on testnet.
|
||||
if *testnet {
|
||||
chainParams = &chaincfg.TestNet3Params
|
||||
}
|
||||
|
||||
// later...
|
||||
|
||||
// Create and print new payment address, specific to the active network.
|
||||
pubKeyHash := make([]byte, 20)
|
||||
addr, err := btcutil.NewAddressPubKeyHash(pubKeyHash, chainParams)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println(addr)
|
||||
}
|
||||
```
|
||||
|
||||
## Installation and Updating
|
||||
|
||||
```bash
|
||||
$ go get -u github.com/btcsuite/btcd/chaincfg
|
||||
```
|
||||
|
||||
## GPG Verification Key
|
||||
|
||||
All official release tags are signed by Conformal so users can ensure the code
|
||||
has not been tampered with and is coming from the btcsuite developers. To
|
||||
verify the signature perform the following:
|
||||
|
||||
- Download the public key from the Conformal website at
|
||||
https://opensource.conformal.com/GIT-GPG-KEY-conformal.txt
|
||||
|
||||
- Import the public key into your GPG keyring:
|
||||
```bash
|
||||
gpg --import GIT-GPG-KEY-conformal.txt
|
||||
```
|
||||
|
||||
- Verify the release tag with the following command where `TAG_NAME` is a
|
||||
placeholder for the specific tag:
|
||||
```bash
|
||||
git tag -v TAG_NAME
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Package chaincfg is licensed under the [copyfree](http://copyfree.org) ISC
|
||||
License.
|
||||
LBRY networks and provides the ability for callers to define their own custom
|
||||
LBRY networks.
|
|
@ -1,9 +1,9 @@
|
|||
chainhash
|
||||
=========
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![Build Status](https://github.com/lbryio/lbcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/lbryio/lbcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/btcsuite/btcd/chaincfg/chainhash)
|
||||
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/lbryio/lbcd/chaincfg/chainhash)
|
||||
=======
|
||||
|
||||
chainhash provides a generic hash type and associated functions that allows the
|
||||
|
@ -12,7 +12,7 @@ specific hash algorithm to be abstracted.
|
|||
## Installation and Updating
|
||||
|
||||
```bash
|
||||
$ go get -u github.com/btcsuite/btcd/chaincfg/chainhash
|
||||
$ go get -u github.com/lbryio/lbcd/chaincfg/chainhash
|
||||
```
|
||||
|
||||
## GPG Verification Key
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
connmgr
|
||||
=======
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/btcsuite/btcd/connmgr)
|
||||
|
||||
Package connmgr implements a generic Bitcoin network connection manager.
|
||||
Package connmgr implements a generic network connection manager.
|
||||
|
||||
## Overview
|
||||
### Overview
|
||||
|
||||
Connection Manager handles all the general connection concerns such as
|
||||
maintaining a set number of outbound connections, sourcing peers, banning,
|
||||
|
@ -18,20 +16,10 @@ connection requests from a source or a set of given addresses, dial them and
|
|||
notify the caller on connections. The main intended use is to initialize a pool
|
||||
of active connections and maintain them to remain connected to the P2P network.
|
||||
|
||||
In addition the connection manager provides the following utilities:
|
||||
In addition, the connection manager provides the following utilities:
|
||||
|
||||
- Notifications on connections or disconnections
|
||||
- Handle failures and retry new addresses from the source
|
||||
- Connect only to specified addresses
|
||||
- Permanent connections with increasing backoff retry timers
|
||||
- Disconnect or Remove an established connection
|
||||
|
||||
## Installation and Updating
|
||||
|
||||
```bash
|
||||
$ go get -u github.com/btcsuite/btcd/connmgr
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Package connmgr is licensed under the [copyfree](http://copyfree.org) ISC License.
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
database
|
||||
========
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/btcsuite/btcd/database)
|
||||
|
||||
Package database provides a block and metadata storage database.
|
||||
|
||||
|
@ -13,8 +11,8 @@ one entity can have the database open at a time (for most database backends),
|
|||
and that entity will be btcd.
|
||||
|
||||
When a client wants programmatic access to the data provided by btcd, they'll
|
||||
likely want to use the [rpcclient](https://github.com/btcsuite/btcd/tree/master/rpcclient)
|
||||
package which makes use of the [JSON-RPC API](https://github.com/btcsuite/btcd/tree/master/docs/json_rpc_api.md).
|
||||
likely want to use the [rpcclient](https://github.com/lbryio/lbcd/tree/master/rpcclient)
|
||||
package which makes use of the [JSON-RPC API](https://github.com/lbryio/lbcd/tree/master/docs/json_rpc_api.md).
|
||||
|
||||
However, this package could be extremely useful for any applications requiring
|
||||
Bitcoin block storage capabilities.
|
||||
|
@ -33,25 +31,3 @@ storage, and strict checksums in key areas to ensure data integrity.
|
|||
- Iteration support including cursors with seek capability
|
||||
- Supports registration of backend databases
|
||||
- Comprehensive test coverage
|
||||
|
||||
## Installation and Updating
|
||||
|
||||
```bash
|
||||
$ go get -u github.com/btcsuite/btcd/database
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
* [Basic Usage Example](https://pkg.go.dev/github.com/btcsuite/btcd/database#example-package--BasicUsage)
|
||||
Demonstrates creating a new database and using a managed read-write
|
||||
transaction to store and retrieve metadata.
|
||||
|
||||
* [Block Storage and Retrieval Example](https://pkg.go.dev/github.com/btcsuite/btcd/database#example-package--BlockStorageAndRetrieval)
|
||||
Demonstrates creating a new database, using a managed read-write transaction
|
||||
to store a block, and then using a managed read-only transaction to fetch the
|
||||
block.
|
||||
|
||||
## License
|
||||
|
||||
Package database is licensed under the [copyfree](http://copyfree.org) ISC
|
||||
License.
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
ffldb
|
||||
=====
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![Build Status](https://github.com/lbryio/lbcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/lbryio/lbcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://pkg.go.dev/github.com/btcsuite/btcd/database/ffldb?status.png)](https://pkg.go.dev/github.com/btcsuite/btcd/database/ffldb)
|
||||
[![GoDoc](https://pkg.go.dev/github.com/lbryio/lbcd/database/ffldb?status.png)](https://pkg.go.dev/github.com/lbryio/lbcd/database/ffldb)
|
||||
=======
|
||||
|
||||
Package ffldb implements a driver for the database package that uses leveldb for
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
treap
|
||||
=====
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![Build Status](https://github.com/lbryio/lbcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/lbryio/lbcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://pkg.go.dev/github.com/btcsuite/btcd/database/internal/treap?status.png)](https://pkg.go.dev/github.com/btcsuite/btcd/database/internal/treap)
|
||||
[![GoDoc](https://pkg.go.dev/github.com/lbryio/lbcd/database/internal/treap?status.png)](https://pkg.go.dev/github.com/lbryio/lbcd/database/internal/treap)
|
||||
|
||||
Package treap implements a treap data structure that is used to hold ordered
|
||||
key/value pairs using a combination of binary search tree and heap semantics.
|
||||
|
|
296
docs/README.md
296
docs/README.md
|
@ -1,296 +0,0 @@
|
|||
### Table of Contents
|
||||
1. [About](#About)
|
||||
2. [Getting Started](#GettingStarted)
|
||||
1. [Installation](#Installation)
|
||||
1. [Windows](#WindowsInstallation)
|
||||
2. [Linux/BSD/MacOSX/POSIX](#PosixInstallation)
|
||||
1. [Gentoo Linux](#GentooInstallation)
|
||||
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)
|
||||
3. [The btcsuite Bitcoin-related Go Packages](#GoPackages)
|
||||
|
||||
<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.
|
||||
|
||||
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](https://web.archive.org/web/20171125143919/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
|
||||
[btcwallet](https://github.com/btcsuite/btcwallet) and
|
||||
[Paymetheus](https://github.com/btcsuite/Paymetheus) (Windows-only) projects
|
||||
which are both under active development.
|
||||
|
||||
<a name="GettingStarted" />
|
||||
|
||||
### 2. Getting Started
|
||||
|
||||
<a name="Installation" />
|
||||
|
||||
**2.1 Installation**
|
||||
|
||||
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**
|
||||
|
||||
|
||||
- Install Go according to the installation instructions here:
|
||||
http://golang.org/doc/install
|
||||
|
||||
- Ensure Go was installed properly and is a supported version:
|
||||
|
||||
```bash
|
||||
$ 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:
|
||||
|
||||
```bash
|
||||
$ git clone https://github.com/btcsuite/btcd $GOPATH/src/github.com/btcsuite/btcd
|
||||
$ 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**
|
||||
|
||||
- Run the following commands to update btcd, all dependencies, and install it:
|
||||
|
||||
```bash
|
||||
$ cd $GOPATH/src/github.com/btcsuite/btcd
|
||||
$ git pull && GO111MODULE=on go install -v . ./cmd/...
|
||||
```
|
||||
|
||||
<a name="GentooInstallation" />
|
||||
|
||||
**2.1.2.1 Gentoo Linux Installation**
|
||||
|
||||
* 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`
|
||||
|
||||
<a name="Configuration" />
|
||||
|
||||
**2.2 Configuration**
|
||||
|
||||
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**
|
||||
|
||||
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
|
||||
RPC username and password or both an RPC limited username and password:
|
||||
|
||||
* btcd.conf configuration file
|
||||
```
|
||||
[Application Options]
|
||||
rpcuser=myuser
|
||||
rpcpass=SomeDecentp4ssw0rd
|
||||
rpclimituser=mylimituser
|
||||
rpclimitpass=Limitedp4ssw0rd
|
||||
```
|
||||
* btcctl.conf configuration file
|
||||
```
|
||||
[Application Options]
|
||||
rpcuser=myuser
|
||||
rpcpass=SomeDecentp4ssw0rd
|
||||
```
|
||||
OR
|
||||
```
|
||||
[Application Options]
|
||||
rpclimituser=mylimituser
|
||||
rpclimitpass=Limitedp4ssw0rd
|
||||
```
|
||||
For a list of available options, run: `$ btcctl --help`
|
||||
|
||||
<a name="Mining" />
|
||||
|
||||
**2.4 Mining**
|
||||
|
||||
btcd supports the `getblocktemplate` RPC.
|
||||
The limited user cannot access this RPC.
|
||||
|
||||
|
||||
**1. Add the payment addresses with the `miningaddr` option.**
|
||||
|
||||
```
|
||||
[Application Options]
|
||||
rpcuser=myuser
|
||||
rpcpass=SomeDecentp4ssw0rd
|
||||
miningaddr=12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX
|
||||
miningaddr=1M83ju3EChKYyysmM2FXtLNftbacagd8FR
|
||||
```
|
||||
|
||||
**2. Add btcd's RPC TLS certificate to system Certificate Authority list.**
|
||||
|
||||
`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**
|
||||
|
||||
1. Copy rpc.cert to /usr/share/ca-certificates: `# cp /home/user/.btcd/rpc.cert /usr/share/ca-certificates/btcd.crt`
|
||||
2. Add btcd.crt to /etc/ca-certificates.conf: `# echo btcd.crt >> /etc/ca-certificates.conf`
|
||||
3. Update the CA certificate list: `# update-ca-certificates`
|
||||
|
||||
**3. Set your mining software url to use https.**
|
||||
|
||||
`$ cgminer -o https://127.0.0.1:9245 -u rpcuser -p rpcpassword`
|
||||
|
||||
<a name="Help" />
|
||||
|
||||
### 3. Help
|
||||
|
||||
<a name="Startup" />
|
||||
|
||||
**3.1 Startup**
|
||||
|
||||
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**
|
||||
|
||||
* [Using bootstrap.dat](https://github.com/btcsuite/btcd/tree/master/docs/using_bootstrap_dat.md)
|
||||
|
||||
<a name="NetworkConfig" />
|
||||
|
||||
**3.1.2 Network Configuration**
|
||||
|
||||
* [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**
|
||||
|
||||
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**
|
||||
|
||||
* [irc.freenode.net](irc://irc.freenode.net), channel `#btcd`
|
||||
|
||||
<a name="MailingLists" />
|
||||
|
||||
**4.2 Mailing Lists**
|
||||
|
||||
* <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" />
|
||||
|
||||
* The btcsuite Bitcoin-related Go Packages:
|
||||
* [btcrpcclient](https://github.com/btcsuite/btcd/tree/master/rpcclient) - Implements a
|
||||
robust and easy to use Websocket-enabled Bitcoin JSON-RPC client
|
||||
* [btcjson](https://github.com/btcsuite/btcd/tree/master/btcjson) - Provides an extensive API
|
||||
for the underlying JSON-RPC command and return values
|
||||
* [wire](https://github.com/btcsuite/btcd/tree/master/wire) - Implements the
|
||||
Bitcoin wire protocol
|
||||
* [peer](https://github.com/btcsuite/btcd/tree/master/peer) -
|
||||
Provides a common base for creating and managing Bitcoin network peers.
|
||||
* [blockchain](https://github.com/btcsuite/btcd/tree/master/blockchain) -
|
||||
Implements Bitcoin block handling and chain selection rules
|
||||
* [blockchain/fullblocktests](https://github.com/btcsuite/btcd/tree/master/blockchain/fullblocktests) -
|
||||
Provides a set of block tests for testing the consensus validation rules
|
||||
* [txscript](https://github.com/btcsuite/btcd/tree/master/txscript) -
|
||||
Implements the Bitcoin transaction scripting language
|
||||
* [btcec](https://github.com/btcsuite/btcd/tree/master/btcec) - Implements
|
||||
support for the elliptic curve cryptographic functions needed for the
|
||||
Bitcoin scripts
|
||||
* [database](https://github.com/btcsuite/btcd/tree/master/database) -
|
||||
Provides a database interface for the Bitcoin block chain
|
||||
* [mempool](https://github.com/btcsuite/btcd/tree/master/mempool) -
|
||||
Package mempool provides a policy-enforced pool of unmined bitcoin
|
||||
transactions.
|
||||
* [btcutil](https://github.com/btcsuite/btcutil) - Provides Bitcoin-specific
|
||||
convenience functions and types
|
||||
* [chainhash](https://github.com/btcsuite/btcd/tree/master/chaincfg/chainhash) -
|
||||
Provides a generic hash type and associated functions that allows the
|
||||
specific hash algorithm to be abstracted.
|
||||
* [connmgr](https://github.com/btcsuite/btcd/tree/master/connmgr) -
|
||||
Package connmgr implements a generic Bitcoin network connection manager.
|
|
@ -1,319 +0,0 @@
|
|||
# Code contribution guidelines
|
||||
|
||||
Developing cryptocurrencies is an exciting endeavor that touches a wide variety
|
||||
of areas such as wire protocols, peer-to-peer networking, databases,
|
||||
cryptography, language interpretation (transaction scripts), RPC, and
|
||||
websockets. They also represent a radical shift to the current fiscal system
|
||||
and as a result provide an opportunity to help reshape the entire financial
|
||||
system. There are few projects that offer this level of diversity and impact
|
||||
all in one code base.
|
||||
|
||||
However, as exciting as it is, one must keep in mind that cryptocurrencies
|
||||
represent real money and introducing bugs and security vulnerabilities can have
|
||||
far more dire consequences than in typical projects where having a small bug is
|
||||
minimal by comparison. In the world of cryptocurrencies, even the smallest bug
|
||||
in the wrong area can cost people a significant amount of money. For this
|
||||
reason, the btcd suite has a formalized and rigorous development process which
|
||||
is outlined on this page.
|
||||
|
||||
We highly encourage code contributions, however it is imperative that you adhere
|
||||
to the guidelines established on this page.
|
||||
|
||||
## Minimum Recommended Skillset
|
||||
|
||||
The following list is a set of core competencies that we recommend you possess
|
||||
before you really start attempting to contribute code to the project. These are
|
||||
not hard requirements as we will gladly accept code contributions as long as
|
||||
they follow the guidelines set forth on this page. That said, if you don't have
|
||||
the following basic qualifications you will likely find it quite difficult to
|
||||
contribute.
|
||||
|
||||
- A reasonable understanding of bitcoin at a high level (see the
|
||||
[Required Reading](#ReqReading) section for the original white paper)
|
||||
- Experience in some type of C-like language
|
||||
- An understanding of data structures and their performance implications
|
||||
- Familiarity with unit testing
|
||||
- Debugging experience
|
||||
- Ability to understand not only the area you are making a change in, but also
|
||||
the code your change relies on, and the code which relies on your changed code
|
||||
|
||||
Building on top of those core competencies, the recommended skill set largely
|
||||
depends on the specific areas you are looking to contribute to. For example,
|
||||
if you wish to contribute to the cryptography code, you should have a good
|
||||
understanding of the various aspects involved with cryptography such as the
|
||||
security and performance implications.
|
||||
|
||||
## Required Reading
|
||||
|
||||
- [Effective Go](http://golang.org/doc/effective_go.html) - The entire btcd
|
||||
suite follows the guidelines in this document. For your code to be accepted,
|
||||
it must follow the guidelines therein.
|
||||
- [Original Satoshi Whitepaper](http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCkQFjAA&url=http%3A%2F%2Fbitcoin.org%2Fbitcoin.pdf&ei=os3VUuH8G4SlsASV74GoAg&usg=AFQjCNEipPLigou_1MfB7DQjXCNdlylrBg&sig2=FaHDuT5z36GMWDEnybDJLg&bvm=bv.59378465,d.b2I) - This is the white paper that started it all. Having a solid
|
||||
foundation to build on will make the code much more comprehensible.
|
||||
|
||||
## Development Practices
|
||||
|
||||
Developers are expected to work in their own trees and submit pull requests when
|
||||
they feel their feature or bug fix is ready for integration into the master
|
||||
branch.
|
||||
|
||||
## Share Early, Share Often
|
||||
|
||||
We firmly believe in the share early, share often approach. The basic premise
|
||||
of the approach is to announce your plans **before** you start work, and once
|
||||
you have started working, craft your changes into a stream of small and easily
|
||||
reviewable commits.
|
||||
|
||||
This approach has several benefits:
|
||||
|
||||
- Announcing your plans to work on a feature **before** you begin work avoids
|
||||
duplicate work
|
||||
- It permits discussions which can help you achieve your goals in a way that is
|
||||
consistent with the existing architecture
|
||||
- It minimizes the chances of you spending time and energy on a change that
|
||||
might not fit with the consensus of the community or existing architecture and
|
||||
potentially be rejected as a result
|
||||
- Incremental development helps ensure you are on the right track with regards
|
||||
to the rest of the community
|
||||
- The quicker your changes are merged to master, the less time you will need to
|
||||
spend rebasing and otherwise trying to keep up with the main code base
|
||||
|
||||
## Testing
|
||||
|
||||
One of the major design goals of all core btcd packages is to aim for complete
|
||||
test coverage. This is financial software so bugs and regressions can cost
|
||||
people real money. For this reason every effort must be taken to ensure the
|
||||
code is as accurate and bug-free as possible. Thorough testing is a good way to
|
||||
help achieve that goal.
|
||||
|
||||
Unless a new feature you submit is completely trivial, it will probably be
|
||||
rejected unless it is also accompanied by adequate test coverage for both
|
||||
positive and negative conditions. That is to say, the tests must ensure your
|
||||
code works correctly when it is fed correct data as well as incorrect data
|
||||
(error paths).
|
||||
|
||||
Go provides an excellent test framework that makes writing test code and
|
||||
checking coverage statistics straight forward. For more information about the
|
||||
test coverage tools, see the [golang cover blog post](http://blog.golang.org/cover).
|
||||
|
||||
A quick summary of test practices follows:
|
||||
|
||||
- All new code should be accompanied by tests that ensure the code behaves
|
||||
correctly when given expected values, and, perhaps even more importantly, that
|
||||
it handles errors gracefully
|
||||
- When you fix a bug, it should be accompanied by tests which exercise the bug
|
||||
to both prove it has been resolved and to prevent future regressions
|
||||
|
||||
## Code Documentation and Commenting
|
||||
|
||||
- At a minimum every function must be commented with its intended purpose and
|
||||
any assumptions that it makes
|
||||
- Function comments must always begin with the name of the function per
|
||||
[Effective Go](http://golang.org/doc/effective_go.html)
|
||||
- Function comments should be complete sentences since they allow a wide
|
||||
variety of automated presentations such as [go.dev](https://go.dev)
|
||||
- The general rule of thumb is to look at it as if you were completely
|
||||
unfamiliar with the code and ask yourself, would this give me enough
|
||||
information to understand what this function does and how I'd probably want
|
||||
to use it?
|
||||
- Exported functions should also include detailed information the caller of the
|
||||
function will likely need to know and/or understand:
|
||||
|
||||
**WRONG**
|
||||
|
||||
```Go
|
||||
// convert a compact uint32 to big.Int
|
||||
func CompactToBig(compact uint32) *big.Int {
|
||||
```
|
||||
|
||||
**RIGHT**
|
||||
|
||||
```Go
|
||||
// CompactToBig converts a compact representation of a whole number N to a
|
||||
// big integer. The representation is similar to IEEE754 floating point
|
||||
// numbers.
|
||||
//
|
||||
// Like IEEE754 floating point, there are three basic components: the sign,
|
||||
// the exponent, and the mantissa. They are broken out as follows:
|
||||
//
|
||||
// * the most significant 8 bits represent the unsigned base 256 exponent
|
||||
// * bit 23 (the 24th bit) represents the sign bit
|
||||
// * the least significant 23 bits represent the mantissa
|
||||
//
|
||||
// -------------------------------------------------
|
||||
// | Exponent | Sign | Mantissa |
|
||||
// -------------------------------------------------
|
||||
// | 8 bits [31-24] | 1 bit [23] | 23 bits [22-00] |
|
||||
// -------------------------------------------------
|
||||
//
|
||||
// The formula to calculate N is:
|
||||
// N = (-1^sign) * mantissa * 256^(exponent-3)
|
||||
//
|
||||
// This compact form is only used in bitcoin to encode unsigned 256-bit numbers
|
||||
// which represent difficulty targets, thus there really is not a need for a
|
||||
// sign bit, but it is implemented here to stay consistent with bitcoind.
|
||||
func CompactToBig(compact uint32) *big.Int {
|
||||
```
|
||||
|
||||
- Comments in the body of the code are highly encouraged, but they should
|
||||
explain the intention of the code as opposed to just calling out the
|
||||
obvious
|
||||
|
||||
**WRONG**
|
||||
|
||||
```Go
|
||||
// return err if amt is less than 5460
|
||||
if amt < 5460 {
|
||||
return err
|
||||
}
|
||||
```
|
||||
|
||||
**RIGHT**
|
||||
|
||||
```Go
|
||||
// Treat transactions with amounts less than the amount which is considered dust
|
||||
// as non-standard.
|
||||
if amt < 5460 {
|
||||
return err
|
||||
}
|
||||
```
|
||||
|
||||
**NOTE:** The above should really use a constant as opposed to a magic number,
|
||||
but it was left as a magic number to show how much of a difference a good
|
||||
comment can make.
|
||||
|
||||
## Model Git Commit Messages
|
||||
|
||||
This project prefers to keep a clean commit history with well-formed commit
|
||||
messages. This section illustrates a model commit message and provides a bit
|
||||
of background for it. This content was originally created by Tim Pope and made
|
||||
available on his website, however that website is no longer active, so it is
|
||||
being provided here.
|
||||
|
||||
Here’s a model Git commit message:
|
||||
|
||||
```text
|
||||
Short (50 chars or less) summary of changes
|
||||
|
||||
More detailed explanatory text, if necessary. Wrap it to about 72
|
||||
characters or so. In some contexts, the first line is treated as the
|
||||
subject of an email and the rest of the text as the body. The blank
|
||||
line separating the summary from the body is critical (unless you omit
|
||||
the body entirely); tools like rebase can get confused if you run the
|
||||
two together.
|
||||
|
||||
Write your commit message in the present tense: "Fix bug" and not "Fixed
|
||||
bug." This convention matches up with commit messages generated by
|
||||
commands like git merge and git revert.
|
||||
|
||||
Further paragraphs come after blank lines.
|
||||
|
||||
- Bullet points are okay, too
|
||||
- Typically a hyphen or asterisk is used for the bullet, preceded by a
|
||||
single space, with blank lines in between, but conventions vary here
|
||||
- Use a hanging indent
|
||||
```
|
||||
|
||||
Prefix the summary with the subsystem/package when possible. Many other
|
||||
projects make use of the code and this makes it easier for them to tell when
|
||||
something they're using has changed. Have a look at [past
|
||||
commits](https://github.com/btcsuite/btcd/commits/master) for examples of
|
||||
commit messages.
|
||||
|
||||
Here are some of the reasons why wrapping your commit messages to 72 columns is
|
||||
a good thing.
|
||||
|
||||
- git log doesn’t do any special special wrapping of the commit messages. With
|
||||
the default pager of less -S, this means your paragraphs flow far off the edge
|
||||
of the screen, making them difficult to read. On an 80 column terminal, if we
|
||||
subtract 4 columns for the indent on the left and 4 more for symmetry on the
|
||||
right, we’re left with 72 columns.
|
||||
- git format-patch --stdout converts a series of commits to a series of emails,
|
||||
using the messages for the message body. Good email netiquette dictates we
|
||||
wrap our plain text emails such that there’s room for a few levels of nested
|
||||
reply indicators without overflow in an 80 column terminal.
|
||||
|
||||
## Code Approval Process
|
||||
|
||||
This section describes the code approval process that is used for code
|
||||
contributions. This is how to get your changes into btcd.
|
||||
|
||||
## Code Review
|
||||
|
||||
All code which is submitted will need to be reviewed before inclusion into the
|
||||
master branch. This process is performed by the project maintainers and usually
|
||||
other committers who are interested in the area you are working in as well.
|
||||
|
||||
## Code Review Timeframe
|
||||
|
||||
The timeframe for a code review will vary greatly depending on factors such as
|
||||
the number of other pull requests which need to be reviewed, the size and
|
||||
complexity of the contribution, how well you followed the guidelines presented
|
||||
on this page, and how easy it is for the reviewers to digest your commits. For
|
||||
example, if you make one monolithic commit that makes sweeping changes to things
|
||||
in multiple subsystems, it will obviously take much longer to review. You will
|
||||
also likely be asked to split the commit into several smaller, and hence more
|
||||
manageable, commits.
|
||||
|
||||
Keeping the above in mind, most small changes will be reviewed within a few
|
||||
days, while large or far reaching changes may take weeks. This is a good reason
|
||||
to stick with the [Share Early, Share Often](#ShareOften) development practice
|
||||
outlined above.
|
||||
|
||||
## What is the review looking for?
|
||||
|
||||
The review is mainly ensuring the code follows the [Development Practices](#DevelopmentPractices)
|
||||
and [Code Contribution Standards](#Standards). However, there are a few other
|
||||
checks which are generally performed as follows:
|
||||
|
||||
- The code is stable and has no stability or security concerns
|
||||
- The code is properly using existing APIs and generally fits well into the
|
||||
overall architecture
|
||||
- The change is not something which is deemed inappropriate by community
|
||||
consensus
|
||||
|
||||
## Rework Code (if needed)
|
||||
|
||||
After the code review, the change will be accepted immediately if no issues are
|
||||
found. If there are any concerns or questions, you will be provided with
|
||||
feedback along with the next steps needed to get your contribution merged with
|
||||
master. In certain cases the code reviewer(s) or interested committers may help
|
||||
you rework the code, but generally you will simply be given feedback for you to
|
||||
make the necessary changes.
|
||||
|
||||
This process will continue until the code is finally accepted.
|
||||
|
||||
## Acceptance
|
||||
|
||||
Once your code is accepted, it will be integrated with the master branch.
|
||||
Typically it will be rebased and fast-forward merged to master as we prefer to
|
||||
keep a clean commit history over a tangled weave of merge commits. However,
|
||||
regardless of the specific merge method used, the code will be integrated with
|
||||
the master branch and the pull request will be closed.
|
||||
|
||||
Rejoice as you will now be listed as a [contributor](https://github.com/btcsuite/btcd/graphs/contributors)!
|
||||
|
||||
## Contribution Standards
|
||||
|
||||
## Contribution Checklist
|
||||
|
||||
- [ ] All changes are Go version 1.3 compliant
|
||||
- [ ] The code being submitted is commented according to the
|
||||
[Code Documentation and Commenting](#CodeDocumentation) section
|
||||
- [ ] For new code: Code is accompanied by tests which exercise both
|
||||
the positive and negative (error paths) conditions (if applicable)
|
||||
- [ ] For bug fixes: Code is accompanied by new tests which trigger
|
||||
the bug being fixed to prevent regressions
|
||||
- [ ] Any new logging statements use an appropriate subsystem and
|
||||
logging level
|
||||
- [ ] Code has been formatted with `go fmt`
|
||||
- [ ] Running `go test` does not fail any tests
|
||||
- [ ] Running `go vet` does not report any issues
|
||||
- [ ] Running [golint](https://github.com/golang/lint) does not
|
||||
report any **new** issues that did not already exist
|
||||
|
||||
## Licensing of Contributions
|
||||
|
||||
All contributions must be licensed with the
|
||||
[ISC license](https://github.com/btcsuite/btcd/blob/master/LICENSE). This is
|
||||
the same license as all of the code in the btcd suite.
|
|
@ -1,11 +1,11 @@
|
|||
# Configuration
|
||||
|
||||
btcd has a number of [configuration](https://pkg.go.dev/github.com/btcsuite/btcd)
|
||||
options, which can be viewed by running: `$ btcd --help`.
|
||||
lbcd has a number of configuration
|
||||
options, which can be viewed by running: `$ lbcd --help`.
|
||||
|
||||
## Peer server listen interface
|
||||
|
||||
btcd allows you to bind to specific interfaces which enables you to setup
|
||||
lbcd allows you to bind to specific interfaces which enables you to setup
|
||||
configurations with varying levels of complexity. The listen parameter can be
|
||||
specified on the command line as shown below with the -- prefix or in the
|
||||
configuration file without the -- prefix (as can all long command line options).
|
||||
|
@ -32,7 +32,7 @@ Command Line Examples:
|
|||
|--listen=127.0.0.1:8337 --listen=[::1]:8333|IPv4 localhost on port 8337 and IPv6 localhost on port 8333|
|
||||
|--listen=:8333 --listen=:8337|all interfaces on ports 8333 and 8337|
|
||||
|
||||
The following config file would configure btcd to only listen on localhost for both IPv4 and IPv6:
|
||||
The following config file would configure lbcd to only listen on localhost for both IPv4 and IPv6:
|
||||
|
||||
```text
|
||||
[Application Options]
|
||||
|
@ -41,17 +41,17 @@ listen=127.0.0.1:8333
|
|||
listen=[::1]:8333
|
||||
```
|
||||
|
||||
In addition, if you are starting btcd with TLS and want to make it
|
||||
In addition, if you are starting lbcd with TLS and want to make it
|
||||
available via a hostname, then you will need to generate the TLS
|
||||
certificates for that host. For example,
|
||||
|
||||
```
|
||||
gencerts --host=myhostname.example.com --directory=/home/me/.btcd/
|
||||
gencerts --host=myhostname.example.com --directory=/home/me/.lbcd/
|
||||
```
|
||||
|
||||
## RPC server listen interface
|
||||
|
||||
btcd allows you to bind the RPC server to specific interfaces which enables you
|
||||
lbcd allows you to bind the RPC server to specific interfaces which enables you
|
||||
to setup configurations with varying levels of complexity. The `rpclisten`
|
||||
parameter can be specified on the command line as shown below with the -- prefix
|
||||
or in the configuration file without the -- prefix (as can all long command line
|
||||
|
@ -92,7 +92,7 @@ Command Line Examples:
|
|||
|--rpclisten=127.0.0.1:8337 --listen=[::1]:8334|IPv4 localhost on port 8337 and IPv6 localhost on port 8334|
|
||||
|--rpclisten=:8334 --listen=:8337|all interfaces on ports 8334 and 8337|
|
||||
|
||||
The following config file would configure the btcd RPC server to listen to all interfaces on the default port, including external interfaces, for both IPv4 and IPv6:
|
||||
The following config file would configure the lbcd RPC server to listen to all interfaces on the default port, including external interfaces, for both IPv4 and IPv6:
|
||||
|
||||
```text
|
||||
[Application Options]
|
||||
|
@ -102,21 +102,21 @@ rpclisten=
|
|||
|
||||
## Default ports
|
||||
|
||||
While btcd is highly configurable when it comes to the network configuration,
|
||||
While lbcd is highly configurable when it comes to the network configuration,
|
||||
the following is intended to be a quick reference for the default ports used so
|
||||
port forwarding can be configured as required.
|
||||
|
||||
btcd provides a `--upnp` flag which can be used to automatically map the bitcoin
|
||||
lbcd by default will automatically map the
|
||||
peer-to-peer listening port if your router supports UPnP. If your router does
|
||||
not support UPnP, or you don't wish to use it, please note that only the bitcoin
|
||||
not support UPnP, or you don't wish to use it, please note that only the
|
||||
peer-to-peer port should be forwarded unless you specifically want to allow RPC
|
||||
access to your btcd from external sources such as in more advanced network
|
||||
configurations.
|
||||
access to your lbcd from external sources such as in more advanced network
|
||||
configurations. You can disable UPnP with the `--noupnp` daemon option.
|
||||
|
||||
|Name|Port|
|
||||
|----|----|
|
||||
|Default Bitcoin peer-to-peer port|TCP 8333|
|
||||
|Default RPC port|TCP 8334|
|
||||
|Default peer-to-peer port|TCP 9246|
|
||||
|Default RPC port|TCP 9245|
|
||||
|
||||
## Using bootstrap.dat
|
||||
|
||||
|
@ -129,7 +129,7 @@ on the last time it was updated.
|
|||
See [this](https://bitcointalk.org/index.php?topic=145386.0) thread on
|
||||
bitcointalk for more details.
|
||||
|
||||
**NOTE:** Using bootstrap.dat is entirely optional. Btcd will download the
|
||||
**NOTE:** Using bootstrap.dat is entirely optional. lbcd will download the
|
||||
block chain from other peers through the Bitcoin protocol with no extra
|
||||
configuration needed.
|
||||
|
||||
|
@ -165,14 +165,14 @@ checkpoints for the known-good block chain at periodic intervals. This ensures
|
|||
that not only is it a valid chain, but it is the same chain that everyone else
|
||||
is using.
|
||||
|
||||
### How do I use bootstrap.dat with btcd?
|
||||
### How do I use bootstrap.dat with lbcd?
|
||||
|
||||
btcd comes with a separate utility named `addblock` which can be used to import
|
||||
lbcd comes with a separate utility named `addblock` which can be used to import
|
||||
`bootstrap.dat`. This approach is used since the import is a one-time operation
|
||||
and we prefer to keep the daemon itself as lightweight as possible.
|
||||
|
||||
1. Stop btcd if it is already running. This is required since addblock needs to
|
||||
access the database used by btcd and it will be locked if btcd is using it.
|
||||
1. Stop lbcd if it is already running. This is required since addblock needs to
|
||||
access the database used by lbcd and it will be locked if lbcd is using it.
|
||||
2. Note the path to the downloaded bootstrap.dat file.
|
||||
3. Run the addblock utility with the `-i` argument pointing to the location of
|
||||
boostrap.dat:
|
||||
|
@ -180,7 +180,7 @@ and we prefer to keep the daemon itself as lightweight as possible.
|
|||
**Windows:**
|
||||
|
||||
```bat
|
||||
"%PROGRAMFILES%\Btcd Suite\Btcd\addblock" -i C:\Path\To\bootstrap.dat
|
||||
"%PROGRAMFILES%\lbcd Suite\lbcd\addblock" -i C:\Path\To\bootstrap.dat
|
||||
```
|
||||
|
||||
**Linux/Unix/BSD/POSIX:**
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# Configuring TOR
|
||||
|
||||
btcd provides full support for anonymous networking via the
|
||||
lbcd provides full support for anonymous networking via the
|
||||
[Tor Project](https://www.torproject.org/), including [client-only](#Client)
|
||||
and [hidden service](#HiddenService) configurations along with
|
||||
[stream isolation](#TorStreamIsolation). In addition, btcd supports a hybrid,
|
||||
[stream isolation](#TorStreamIsolation). In addition, lbcd supports a hybrid,
|
||||
[bridge mode](#Bridge) which is not anonymous, but allows it to operate as a
|
||||
bridge between regular nodes and hidden service nodes without routing the
|
||||
regular connections through Tor.
|
||||
|
@ -15,15 +15,15 @@ hidden service for this reason.
|
|||
|
||||
## Client-only
|
||||
|
||||
Configuring btcd as a Tor client is straightforward. The first step is
|
||||
Configuring lbcd as a Tor client is straightforward. The first step is
|
||||
obviously to install Tor and ensure it is working. Once that is done, all that
|
||||
typically needs to be done is to specify the `--proxy` flag via the btcd command
|
||||
line or in the btcd configuration file. Typically the Tor proxy address will be
|
||||
typically needs to be done is to specify the `--proxy` flag via the lbcd command
|
||||
line or in the lbcd configuration file. Typically the Tor proxy address will be
|
||||
127.0.0.1:9050 (if using standalone Tor) or 127.0.0.1:9150 (if using the Tor
|
||||
Browser Bundle). If you have Tor configured to require a username and password,
|
||||
you may specify them with the `--proxyuser` and `--proxypass` flags.
|
||||
|
||||
By default, btcd assumes the proxy specified with `--proxy` is a Tor proxy and
|
||||
By default, lbcd assumes the proxy specified with `--proxy` is a Tor proxy and
|
||||
hence will send all traffic, including DNS resolution requests, via the
|
||||
specified proxy.
|
||||
|
||||
|
@ -34,7 +34,7 @@ not be reachable for inbound connections unless you also configure a Tor
|
|||
### Command line example
|
||||
|
||||
```bash
|
||||
./btcd --proxy=127.0.0.1:9050
|
||||
./lbcd --proxy=127.0.0.1:9050
|
||||
```
|
||||
|
||||
### Config file example
|
||||
|
@ -51,7 +51,7 @@ The first step is to configure Tor to provide a hidden service. Documentation
|
|||
for this can be found on the Tor project website
|
||||
[here](https://www.torproject.org/docs/tor-hidden-service.html.en). However,
|
||||
there is no need to install a web server locally as the linked instructions
|
||||
discuss since btcd will act as the server.
|
||||
discuss since lbcd will act as the server.
|
||||
|
||||
In short, the instructions linked above entail modifying your `torrc` file to
|
||||
add something similar to the following, restarting Tor, and opening the
|
||||
|
@ -59,12 +59,12 @@ add something similar to the following, restarting Tor, and opening the
|
|||
address.
|
||||
|
||||
```text
|
||||
HiddenServiceDir /var/tor/btcd
|
||||
HiddenServiceDir /var/tor/lbcd
|
||||
HiddenServicePort 8333 127.0.0.1:8333
|
||||
```
|
||||
|
||||
Once Tor is configured to provide the hidden service and you have obtained your
|
||||
generated .onion address, configuring btcd as a Tor hidden service requires
|
||||
generated .onion address, configuring lbcd as a Tor hidden service requires
|
||||
three flags:
|
||||
|
||||
* `--proxy` to identify the Tor (SOCKS 5) proxy to use for outgoing traffic.
|
||||
|
@ -76,7 +76,7 @@ three flags:
|
|||
### Command line example
|
||||
|
||||
```bash
|
||||
./btcd --proxy=127.0.0.1:9050 --listen=127.0.0.1 --externalip=fooanon.onion
|
||||
./lbcd --proxy=127.0.0.1:9050 --listen=127.0.0.1 --externalip=fooanon.onion
|
||||
```
|
||||
|
||||
### Config file example
|
||||
|
@ -91,13 +91,13 @@ externalip=fooanon.onion
|
|||
|
||||
## Bridge mode (not anonymous)
|
||||
|
||||
btcd provides support for operating as a bridge between regular nodes and hidden
|
||||
lbcd provides support for operating as a bridge between regular nodes and hidden
|
||||
service nodes. In particular this means only traffic which is directed to or
|
||||
from a .onion address is sent through Tor while other traffic is sent normally.
|
||||
_As a result, this mode is **NOT** anonymous._
|
||||
|
||||
This mode works by specifying an onion-specific proxy, which is pointed at Tor,
|
||||
by using the `--onion` flag via the btcd command line or in the btcd
|
||||
by using the `--onion` flag via the lbcd command line or in the lbcd
|
||||
configuration file. If you have Tor configured to require a username and
|
||||
password, you may specify them with the `--onionuser` and `--onionpass` flags.
|
||||
|
||||
|
@ -111,7 +111,7 @@ routed via Tor due to the `--onion` flag.
|
|||
### Command line example
|
||||
|
||||
```bash
|
||||
./btcd --onion=127.0.0.1:9050 --externalip=fooanon.onion
|
||||
./lbcd --onion=127.0.0.1:9050 --externalip=fooanon.onion
|
||||
```
|
||||
|
||||
### Config file example
|
||||
|
@ -128,13 +128,13 @@ externalip=fooanon.onion
|
|||
Tor stream isolation forces Tor to build a new circuit for each connection
|
||||
making it harder to correlate connections.
|
||||
|
||||
btcd provides support for Tor stream isolation by using the `--torisolation`
|
||||
lbcd provides support for Tor stream isolation by using the `--torisolation`
|
||||
flag. This option requires --proxy or --onionproxy to be set.
|
||||
|
||||
### Command line example
|
||||
|
||||
```bash
|
||||
./btcd --proxy=127.0.0.1:9050 --torisolation
|
||||
./lbcd --proxy=127.0.0.1:9050 --torisolation
|
||||
```
|
||||
|
||||
### Config file example
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
# Contact
|
||||
|
||||
## IRC
|
||||
|
||||
* [irc.freenode.net](irc://irc.freenode.net), channel `#btcd`
|
||||
|
||||
## Mailing Lists
|
||||
|
||||
* [btcd](mailto:btcd+subscribe@opensource.conformal.com): discussion of btcd and its packages.
|
||||
* [btcd-commits](mailto:btcd-commits+subscribe@opensource.conformal.com): readonly mail-out of source code changes.
|
||||
|
||||
## Issue Tracker
|
||||
|
||||
The [integrated github issue tracker](https://github.com/btcsuite/btcd/issues)
|
||||
is used for this project.
|
|
@ -1,11 +1,11 @@
|
|||
# Controlling and querying btcd via btcctl
|
||||
# Controlling and querying lbcd via lbcctl
|
||||
|
||||
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
|
||||
lbcctl is a command line utility that can be used to both control and query lbcd
|
||||
via [RPC](http://www.wikipedia.org/wiki/Remote_procedure_call). lbcd does
|
||||
**not** enable its RPC server by default; You must configure at minimum both an
|
||||
RPC username and password or both an RPC limited username and password:
|
||||
|
||||
* btcd.conf configuration file
|
||||
* lbcd.conf configuration file
|
||||
|
||||
```bash
|
||||
[Application Options]
|
||||
|
@ -15,7 +15,7 @@ rpclimituser=mylimituser
|
|||
rpclimitpass=Limitedp4ssw0rd
|
||||
```
|
||||
|
||||
* btcctl.conf configuration file
|
||||
* lbcctl.conf configuration file
|
||||
|
||||
```bash
|
||||
[Application Options]
|
||||
|
@ -31,4 +31,4 @@ rpclimituser=mylimituser
|
|||
rpclimitpass=Limitedp4ssw0rd
|
||||
```
|
||||
|
||||
For a list of available options, run: `$ btcctl --help`
|
||||
For a list of available options, run: `$ lbcctl --help`
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
# Developer Resources
|
||||
|
||||
* [Code Contribution Guidelines](https://github.com/btcsuite/btcd/tree/master/docs/code_contribution_guidelines.md)
|
||||
|
||||
* [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)
|
||||
|
||||
* The btcsuite Bitcoin-related Go Packages:
|
||||
* [btcrpcclient](https://github.com/btcsuite/btcd/tree/master/rpcclient) - Implements a
|
||||
robust and easy to use Websocket-enabled Bitcoin JSON-RPC client
|
||||
* [btcjson](https://github.com/btcsuite/btcd/tree/master/btcjson) - Provides an extensive API
|
||||
for the underlying JSON-RPC command and return values
|
||||
* [wire](https://github.com/btcsuite/btcd/tree/master/wire) - Implements the
|
||||
Bitcoin wire protocol
|
||||
* [peer](https://github.com/btcsuite/btcd/tree/master/peer) -
|
||||
Provides a common base for creating and managing Bitcoin network peers.
|
||||
* [blockchain](https://github.com/btcsuite/btcd/tree/master/blockchain) -
|
||||
Implements Bitcoin block handling and chain selection rules
|
||||
* [blockchain/fullblocktests](https://github.com/btcsuite/btcd/tree/master/blockchain/fullblocktests) -
|
||||
Provides a set of block tests for testing the consensus validation rules
|
||||
* [txscript](https://github.com/btcsuite/btcd/tree/master/txscript) -
|
||||
Implements the Bitcoin transaction scripting language
|
||||
* [btcec](https://github.com/btcsuite/btcd/tree/master/btcec) - Implements
|
||||
support for the elliptic curve cryptographic functions needed for the
|
||||
Bitcoin scripts
|
||||
* [database](https://github.com/btcsuite/btcd/tree/master/database) -
|
||||
Provides a database interface for the Bitcoin block chain
|
||||
* [mempool](https://github.com/btcsuite/btcd/tree/master/mempool) -
|
||||
Package mempool provides a policy-enforced pool of unmined bitcoin
|
||||
transactions.
|
||||
* [btcutil](https://github.com/btcsuite/btcutil) - Provides Bitcoin-specific
|
||||
convenience functions and types
|
||||
* [chainhash](https://github.com/btcsuite/btcd/tree/master/chaincfg/chainhash) -
|
||||
Provides a generic hash type and associated functions that allows the
|
||||
specific hash algorithm to be abstracted.
|
||||
* [connmgr](https://github.com/btcsuite/btcd/tree/master/connmgr) -
|
||||
Package connmgr implements a generic Bitcoin network connection manager.
|
|
@ -1,57 +1,11 @@
|
|||
# btcd
|
||||
# lbcd
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/btcsuite/btcd)
|
||||
|
||||
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](https://web.archive.org/web/20171125143919/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
|
||||
[btcwallet](https://github.com/btcsuite/btcwallet) and
|
||||
[Paymetheus](https://github.com/btcsuite/Paymetheus) (Windows-only) projects
|
||||
which are both under active development.
|
||||
|
||||
## Documentation
|
||||
|
||||
Documentation is a work-in-progress. It is available at [btcd.readthedocs.io](https://btcd.readthedocs.io).
|
||||
|
||||
## Contents
|
||||
|
||||
* [Installation](installation.md)
|
||||
* [Update](update.md)
|
||||
* [Configuration](configuration.md)
|
||||
* [Configuring TOR](configuring_tor.md)
|
||||
* [Docker](using_docker.md)
|
||||
* [Controlling](controlling.md)
|
||||
* [Mining](mining.md)
|
||||
* [Wallet](wallet.md)
|
||||
* [Developer resources](developer_resources.md)
|
||||
* [JSON RPC API](json_rpc_api.md)
|
||||
* [Code contribution guidelines](code_contribution_guidelines.md)
|
||||
* [Contact](contact.md)
|
||||
|
||||
## License
|
||||
|
||||
btcd is licensed under the [copyfree](http://copyfree.org) ISC License.
|
||||
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
# Installation
|
||||
|
||||
The first step is to install btcd. See one of the following sections for
|
||||
details on how to install on the supported operating systems.
|
||||
|
||||
## Requirements
|
||||
|
||||
[Go](http://golang.org) 1.11 or newer.
|
||||
|
||||
## GPG Verification Key
|
||||
|
||||
All official release tags are signed by Conformal so users can ensure the code
|
||||
has not been tampered with and is coming from the btcsuite developers. To
|
||||
verify the signature perform the following:
|
||||
|
||||
* Download the Conformal public key:
|
||||
https://raw.githubusercontent.com/btcsuite/btcd/master/release/GIT-GPG-KEY-conformal.txt
|
||||
|
||||
* Import the public key into your GPG keyring:
|
||||
|
||||
```bash
|
||||
gpg --import GIT-GPG-KEY-conformal.txt
|
||||
```
|
||||
|
||||
* Verify the release tag with the following command where `TAG_NAME` is a
|
||||
placeholder for the specific tag:
|
||||
|
||||
```bash
|
||||
git tag -v TAG_NAME
|
||||
```
|
||||
|
||||
## Windows Installation
|
||||
|
||||
* Install the MSI available at: [btcd windows installer](https://github.com/btcsuite/btcd/releases)
|
||||
* Launch btcd from the Start Menu
|
||||
|
||||
## Linux/BSD/MacOSX/POSIX Installation
|
||||
|
||||
* Install Go according to the [installation instructions](http://golang.org/doc/install)
|
||||
* Ensure Go was installed properly and is a supported version:
|
||||
|
||||
```bash
|
||||
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:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/btcsuite/btcd $GOPATH/src/github.com/btcsuite/btcd
|
||||
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.
|
||||
|
||||
## Gentoo Linux Installation
|
||||
|
||||
* [Install Layman](https://gitlab.com/bitcoin/gentoo) and enable the Bitcoin overlay.
|
||||
* Copy or symlink `/var/lib/layman/bitcoin/Documentation/package.keywords/btcd-live` to `/etc/portage/package.keywords/`
|
||||
* Install btcd: `$ emerge net-p2p/btcd`
|
||||
|
||||
## Startup
|
||||
|
||||
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.
|
||||
|
||||
* [Using bootstrap.dat](https://github.com/btcsuite/btcd/blob/master/docs/configuration.md#using-bootstrapdat)
|
|
@ -27,26 +27,18 @@
|
|||
|
||||
### 1. Overview
|
||||
|
||||
btcd provides a [JSON-RPC](http://json-rpc.org/wiki/specification) API that is
|
||||
lbcd provides a [JSON-RPC](http://json-rpc.org/wiki/specification) API that is
|
||||
fully compatible with the original bitcoind/bitcoin-qt. There are a few key
|
||||
differences between btcd and bitcoind as far as how RPCs are serviced:
|
||||
* Unlike bitcoind that has the wallet and chain intermingled in the same process
|
||||
which leads to several issues, btcd intentionally splits the wallet and chain
|
||||
services into independent processes. See the blog post
|
||||
[here](https://blog.conformal.com/btcd-not-your-moms-bitcoin-daemon/) for
|
||||
further details on why they were separated. This means that if you are
|
||||
talking directly to btcd, only chain-related RPCs are available. However both
|
||||
chain-related and wallet-related RPCs are available via
|
||||
[btcwallet](https://github.com/btcsuite/btcwallet).
|
||||
* btcd is secure by default which means that the RPC connection is TLS-enabled
|
||||
differences between lbcd and bitcoind as far as how RPCs are serviced:
|
||||
* lbcd is secure by default which means that the RPC connection is TLS-enabled
|
||||
by default
|
||||
* btcd provides access to the API through both
|
||||
* lbcd provides access to the API through both
|
||||
[HTTP POST](http://en.wikipedia.org/wiki/POST_%28HTTP%29) requests and
|
||||
[Websockets](http://en.wikipedia.org/wiki/WebSocket)
|
||||
|
||||
Websockets are the preferred transport for btcd RPC and are used by applications
|
||||
Websockets are the preferred transport for lbcd RPC and are used by applications
|
||||
such as [btcwallet](https://github.com/btcsuite/btcwallet) for inter-process
|
||||
communication with btcd. The websocket connection endpoint for btcd is
|
||||
communication with lbcd. The websocket connection endpoint for lbcd is
|
||||
`wss://your_ip_or_domain:9245/ws`.
|
||||
|
||||
In addition to the [standard API](#Methods), an [extension API](#WSExtMethods)
|
||||
|
@ -64,7 +56,7 @@ The original bitcoind/bitcoin-qt JSON-RPC API documentation is available at [htt
|
|||
|
||||
### 2. HTTP POST Versus Websockets
|
||||
|
||||
The btcd RPC server supports both [HTTP POST](http://en.wikipedia.org/wiki/POST_%28HTTP%29)
|
||||
The lbcd RPC server supports both [HTTP POST](http://en.wikipedia.org/wiki/POST_%28HTTP%29)
|
||||
requests and the preferred [Websockets](http://en.wikipedia.org/wiki/WebSocket).
|
||||
All of the [standard](#Methods) and [extension](#ExtensionMethods) methods
|
||||
described in this documentation can be accessed through both. As the name
|
||||
|
@ -72,7 +64,7 @@ indicates, the [Websocket-specific extension](#WSExtMethods) methods can only be
|
|||
accessed when connected via Websockets.
|
||||
|
||||
As mentioned in the [overview](#Overview), the websocket connection endpoint for
|
||||
btcd is `wss://your_ip_or_domain:9245/ws`.
|
||||
lbcd is `wss://your_ip_or_domain:9245/ws`.
|
||||
|
||||
The most important differences between the two transports as it pertains to the
|
||||
JSON-RPC API are:
|
||||
|
@ -92,18 +84,18 @@ JSON-RPC API are:
|
|||
**3.1 Authentication Overview**<br />
|
||||
|
||||
The following authentication details are needed before establishing a connection
|
||||
to a btcd RPC server:
|
||||
to a lbcd RPC server:
|
||||
|
||||
* **rpcuser** is the full-access username configured for the btcd RPC server
|
||||
* **rpcpass** is the full-access password configured for the btcd RPC server
|
||||
* **rpclimituser** is the limited username configured for the btcd RPC server
|
||||
* **rpclimitpass** is the limited password configured for the btcd RPC server
|
||||
* **rpccert** is the PEM-encoded X.509 certificate (public key) that the btcd
|
||||
server is configured with. It is automatically generated by btcd and placed
|
||||
in the btcd home directory (which is typically `%LOCALAPPDATA%\Btcd` on
|
||||
Windows and `~/.btcd` on POSIX-like OSes)
|
||||
* **rpcuser** is the full-access username configured for the lbcd RPC server
|
||||
* **rpcpass** is the full-access password configured for the lbcd RPC server
|
||||
* **rpclimituser** is the limited username configured for the lbcd RPC server
|
||||
* **rpclimitpass** is the limited password configured for the lbcd RPC server
|
||||
* **rpccert** is the PEM-encoded X.509 certificate (public key) that the lbcd
|
||||
server is configured with. It is automatically generated by lbcd and placed
|
||||
in the lbcd home directory (which is typically `%LOCALAPPDATA%\lbcd` on
|
||||
Windows and `~/.lbcd` on POSIX-like OSes)
|
||||
|
||||
**NOTE:** As mentioned above, btcd is secure by default which means the RPC
|
||||
**NOTE:** As mentioned above, lbcd is secure by default which means the RPC
|
||||
server is not running unless configured with a **rpcuser** and **rpcpass**
|
||||
and/or a **rpclimituser** and **rpclimitpass**, and uses TLS authentication for
|
||||
all connections.
|
||||
|
@ -117,7 +109,7 @@ two, mutually exclusive, methods.
|
|||
|
||||
**3.2 HTTP Basic Access Authentication**<br />
|
||||
|
||||
The btcd RPC server uses HTTP [basic access authentication](http://en.wikipedia.org/wiki/Basic_access_authentication) with the **rpcuser**
|
||||
The lbcd RPC server uses HTTP [basic access authentication](http://en.wikipedia.org/wiki/Basic_access_authentication) with the **rpcuser**
|
||||
and **rpcpass** detailed above. If the supplied credentials are invalid, you
|
||||
will be disconnected immediately upon making the connection.
|
||||
|
||||
|
@ -139,8 +131,8 @@ authenticated will cause the websocket to be closed immediately.
|
|||
|
||||
### 4. Command-line Utility
|
||||
|
||||
btcd comes with a separate utility named `btcctl` which can be used to issue
|
||||
these RPC commands via HTTP POST requests to btcd after configuring it with the
|
||||
lbcd comes with a separate utility named `lbcctl` which can be used to issue
|
||||
these RPC commands via HTTP POST requests to lbcd after configuring it with the
|
||||
information in the [Authentication](#Authentication) section above. It can also
|
||||
be used to communicate with any server/daemon/service which provides a JSON-RPC
|
||||
API compatible with the original bitcoind/bitcoin-qt client.
|
||||
|
@ -182,11 +174,11 @@ the method name for further details such as parameter and return information.
|
|||
| 22 | [getrawtransaction](#getrawtransaction) | Y | Returns information about a transaction given its hash. |
|
||||
| 23 | [help](#help) | Y | Returns a list of all commands or help for a specified command. |
|
||||
| 24 | [ping](#ping) | N | Queues a ping to be sent to each connected peer. |
|
||||
| 25 | [sendrawtransaction](#sendrawtransaction) | Y | Submits the serialized, hex-encoded transaction to the local peer and relays it to the network.<br /><font color="orange">btcd does not yet implement the `allowhighfees` parameter, so it has no effect</font> |
|
||||
| 26 | [setgenerate](#setgenerate) | N | Set the server to generate coins (mine) or not.<br/>NOTE: Since btcd does not have the wallet integrated to provide payment addresses, btcd must be configured via the `--miningaddr` option to provide which payment addresses to pay created blocks to for this RPC to function. |
|
||||
| 27 | [stop](#stop) | N | Shutdown btcd. |
|
||||
| 25 | [sendrawtransaction](#sendrawtransaction) | Y | Submits the serialized, hex-encoded transaction to the local peer and relays it to the network.<br /><font color="orange">lbcd does not yet implement the `allowhighfees` parameter, so it has no effect</font> |
|
||||
| 26 | [setgenerate](#setgenerate) | N | Set the server to generate coins (mine) or not.<br/>NOTE: Since lbcd does not have the wallet integrated to provide payment addresses, lbcd must be configured via the `--miningaddr` option to provide which payment addresses to pay created blocks to for this RPC to function. |
|
||||
| 27 | [stop](#stop) | N | Shutdown lbcd. |
|
||||
| 28 | [submitblock](#submitblock) | Y | Attempts to submit a new serialized, hex-encoded block to the network. |
|
||||
| 29 | [validateaddress](#validateaddress) | Y | Verifies the given address is valid. NOTE: Since btcd does not have a wallet integrated, btcd will only return whether the address is valid or not. |
|
||||
| 29 | [validateaddress](#validateaddress) | Y | Verifies the given address is valid. NOTE: Since lbcd does not have a wallet integrated, lbcd will only return whether the address is valid or not. |
|
||||
| 30 | [verifychain](#verifychain) | N | Verifies the block chain database. |
|
||||
|
||||
<a name="MethodDetails" />
|
||||
|
@ -373,7 +365,7 @@ the method name for further details such as parameter and return information.
|
|||
| Method | getinfo |
|
||||
| Parameters | None |
|
||||
| Description | Returns a JSON object containing various state info. |
|
||||
| Notes | NOTE: Since btcd does NOT contain wallet functionality, wallet-related fields are not returned. See getinfo in btcwallet for a version which includes that information. |
|
||||
| Notes | NOTE: Since lbcd does NOT contain wallet functionality, wallet-related fields are not returned. See getinfo in btcwallet for a version which includes that information. |
|
||||
| Returns | `{ (json object)`<br /> `"version": n, (numeric) the version of the server`<br /> `"protocolversion": n, (numeric) the latest supported protocol version`<br /> `"blocks": n, (numeric) the number of blocks processed`<br /> `"timeoffset": n, (numeric) the time offset`<br /> `"connections": n, (numeric) the number of connected peers`<br /> `"proxy": "host:port", (string) the proxy used by the server`<br /> `"difficulty": n.nn, (numeric) the current target difficulty`<br /> `"testnet": true or false, (boolean) whether or not server is using testnet`<br /> `"relayfee": n.nn, (numeric) the minimum relay fee for non-free transactions in BTC/KB`<br />`}` |
|
||||
| Example Return | `{`<br /> `"version": 70000`<br /> `"protocolversion": 70001, `<br /> `"blocks": 298963,`<br /> `"timeoffset": 0,`<br /> `"connections": 17,`<br /> `"proxy": "",`<br /> `"difficulty": 8000872135.97,`<br /> `"testnet": false,`<br /> `"relayfee": 0.00001,`<br />`}` |
|
||||
[Return to Overview](#MethodOverview)<br />
|
||||
|
@ -435,7 +427,7 @@ the method name for further details such as parameter and return information.
|
|||
| Parameters | None |
|
||||
| Description | Returns data about each connected network peer as an array of json objects. |
|
||||
| Returns | `[`<br /> `{`<br /> `"addr": "host:port", (string) the ip address and port of the peer`<br /> `"services": "00000001", (string) the services supported by the peer`<br /> `"lastrecv": n, (numeric) time the last message was received in seconds since 1 Jan 1970 GMT`<br /> `"lastsend": n, (numeric) time the last message was sent in seconds since 1 Jan 1970 GMT`<br /> `"bytessent": n, (numeric) total bytes sent`<br /> `"bytesrecv": n, (numeric) total bytes received`<br /> `"conntime": n, (numeric) time the connection was made in seconds since 1 Jan 1970 GMT`<br /> `"pingtime": n, (numeric) number of microseconds the last ping took`<br /> `"pingwait": n, (numeric) number of microseconds a queued ping has been waiting for a response`<br /> `"version": n, (numeric) the protocol version of the peer`<br /> `"subver": "useragent", (string) the user agent of the peer`<br /> `"inbound": true_or_false, (boolean) whether or not the peer is an inbound connection`<br /> `"startingheight": n, (numeric) the latest block height the peer knew about when the connection was established`<br /> `"currentheight": n, (numeric) the latest block height the peer is known to have relayed since connected`<br /> `"syncnode": true_or_false, (boolean) whether or not the peer is the sync peer`<br /> `}, ...`<br />`]` |
|
||||
| Example Return | `[`<br /> `{`<br /> `"addr": "178.172.xxx.xxx:8333",`<br /> `"services": "00000001",`<br /> `"lastrecv": 1388183523,`<br /> `"lastsend": 1388185470,`<br /> `"bytessent": 287592965,`<br /> `"bytesrecv": 780340,`<br /> `"conntime": 1388182973,`<br /> `"pingtime": 405551,`<br /> `"pingwait": 183023,`<br /> `"version": 70001,`<br /> `"subver": "/btcd:0.4.0/",`<br /> `"inbound": false,`<br /> `"startingheight": 276921,`<br /> `"currentheight": 276955,`<br/> `"syncnode": true,`<br /> `}`<br />`]` |
|
||||
| Example Return | `[`<br /> `{`<br /> `"addr": "178.172.xxx.xxx:8333",`<br /> `"services": "00000001",`<br /> `"lastrecv": 1388183523,`<br /> `"lastsend": 1388185470,`<br /> `"bytessent": 287592965,`<br /> `"bytesrecv": 780340,`<br /> `"conntime": 1388182973,`<br /> `"pingtime": 405551,`<br /> `"pingwait": 183023,`<br /> `"version": 70001,`<br /> `"subver": "/lbcd:0.4.0/",`<br /> `"inbound": false,`<br /> `"startingheight": 276921,`<br /> `"currentheight": 276955,`<br/> `"syncnode": true,`<br /> `}`<br />`]` |
|
||||
[Return to Overview](#MethodOverview)<br />
|
||||
|
||||
***
|
||||
|
@ -483,7 +475,7 @@ the method name for further details such as parameter and return information.
|
|||
| Method | getrawmempool |
|
||||
| Parameters | 1. verbose (boolean, optional, default=false) |
|
||||
| Description | Returns an array of hashes for all of the transactions currently in the memory pool.<br />The `verbose` flag specifies that each transaction is returned as a JSON object. |
|
||||
| Notes | <font color="orange">Since btcd does not perform any mining, the priority related fields `startingpriority` and `currentpriority` that are available when the `verbose` flag is set are always 0.</font> |
|
||||
| Notes | <font color="orange">Since lbcd does not perform any mining, the priority related fields `startingpriority` and `currentpriority` that are available when the `verbose` flag is set are always 0.</font> |
|
||||
| Returns (verbose=false) | `[ (json array of string)`<br /> `"transactionhash", (string) hash of the transaction`<br /> `...`<br />`]` |
|
||||
| Returns (verbose=true) | `{ (json object)`<br /> `"transactionhash": { (json object)`<br /> `"size": n, (numeric) transaction size in bytes`<br /> `"vsize": n, (numeric) transaction virtual size`<br /> `"weight": n, (numeric) The transaction's weight (between vsize*4-3 and vsize*4)`<br /> `"fee" : n, (numeric) transaction fee in bitcoins`<br /> `"time": n, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT`<br /> `"height": n, (numeric) block height when transaction entered the pool`<br /> `"startingpriority": n, (numeric) priority when transaction entered the pool`<br /> `"currentpriority": n, (numeric) current priority`<br /> `"depends": [ (json array) unconfirmed transactions used as inputs for this transaction`<br /> `"transactionhash", (string) hash of the parent transaction`<br /> `...`<br /> `]`<br /> `}, ...`<br />`}` |
|
||||
| Example Return (verbose=false) | `[`<br /> `"3480058a397b6ffcc60f7e3345a61370fded1ca6bef4b58156ed17987f20d4e7",`<br /> `"cbfe7c056a358c3a1dbced5a22b06d74b8650055d5195c1c2469e6b63a41514a"`<br />`]` |
|
||||
|
@ -498,7 +490,7 @@ the method name for further details such as parameter and return information.
|
|||
| Method | setgenerate |
|
||||
| Parameters | 1. generate (boolean, required) - `true` to enable generation, `false` to disable it<br />2. genproclimit (numeric, optional) - the number of processors (cores) to limit generation to or `-1` for default |
|
||||
| Description | Set the server to generate coins (mine) or not. |
|
||||
| Notes | NOTE: Since btcd does not have the wallet integrated to provide payment addresses, btcd must be configured via the `--miningaddr` option to provide which payment addresses to pay created blocks to for this RPC to function. |
|
||||
| Notes | NOTE: Since lbcd does not have the wallet integrated to provide payment addresses, lbcd must be configured via the `--miningaddr` option to provide which payment addresses to pay created blocks to for this RPC to function. |
|
||||
| Returns | Nothing |
|
||||
[Return to Overview](#MethodOverview)<br />
|
||||
|
||||
|
@ -510,7 +502,7 @@ the method name for further details such as parameter and return information.
|
|||
| Method | sendrawtransaction |
|
||||
| Parameters | 1. signedhex (string, required) serialized, hex-encoded signed transaction<br />2. allowhighfees (boolean, optional, default=false) whether or not to allow insanely high fees |
|
||||
| Description | Submits the serialized, hex-encoded transaction to the local peer and relays it to the network. |
|
||||
| Notes | <font color="orange">btcd does not yet implement the `allowhighfees` parameter, so it has no effect</font> |
|
||||
| Notes | <font color="orange">lbcd does not yet implement the `allowhighfees` parameter, so it has no effect</font> |
|
||||
| Returns | `"hash" (string) the hash of the transaction` |
|
||||
| Example Return | `"1697a19cede08694278f19584e8dcc87945f40c6b59a942dd8906f133ad3f9cc"` |
|
||||
[Return to Overview](#MethodOverview)<br />
|
||||
|
@ -533,8 +525,8 @@ the method name for further details such as parameter and return information.
|
|||
| ----------- | --------------------------- |
|
||||
| Method | stop |
|
||||
| Parameters | None |
|
||||
| Description | Shutdown btcd. |
|
||||
| Returns | `"btcd stopping."` (string) |
|
||||
| Description | Shutdown lbcd. |
|
||||
| Returns | `"lbcd stopping."` (string) |
|
||||
[Return to Overview](#MethodOverview)<br />
|
||||
|
||||
***
|
||||
|
@ -555,8 +547,8 @@ the method name for further details such as parameter and return information.
|
|||
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Method | verifychain |
|
||||
| Parameters | 1. checklevel (numeric, optional, default=3) - how in-depth the verification is (0=least amount of checks, higher levels are clamped to the highest supported level)<br />2. numblocks (numeric, optional, default=288) - the number of blocks starting from the end of the chain to verify |
|
||||
| Description | Verifies the block chain database.<br />The actual checks performed by the `checklevel` parameter is implementation specific. For btcd this is:<br />`checklevel=0` - Look up each block and ensure it can be loaded from the database.<br />`checklevel=1` - Perform basic context-free sanity checks on each block. |
|
||||
| Notes | <font color="orange">Btcd currently only supports `checklevel` 0 and 1, but the default is still 3 for compatibility. Per the information in the Parameters section above, higher levels are automatically clamped to the highest supported level, so this means the default is effectively 1 for btcd.</font> |
|
||||
| Description | Verifies the block chain database.<br />The actual checks performed by the `checklevel` parameter is implementation specific. For lbcd this is:<br />`checklevel=0` - Look up each block and ensure it can be loaded from the database.<br />`checklevel=1` - Perform basic context-free sanity checks on each block. |
|
||||
| Notes | <font color="orange">lbcd currently only supports `checklevel` 0 and 1, but the default is still 3 for compatibility. Per the information in the Parameters section above, higher levels are automatically clamped to the highest supported level, so this means the default is effectively 1 for lbcd.</font> |
|
||||
| Returns | `true` or `false` (boolean) |
|
||||
| Example Return | `true` |
|
||||
[Return to Overview](#MethodOverview)<br />
|
||||
|
@ -570,13 +562,13 @@ the method name for further details such as parameter and return information.
|
|||
|
||||
**6.1 Method Overview**<br />
|
||||
|
||||
The following is an overview of the RPC methods which are implemented by btcd, but not the original bitcoind client. Click the method name for further details such as parameter and return information.
|
||||
The following is an overview of the RPC methods which are implemented by lbcd, but not the original bitcoind client. Click the method name for further details such as parameter and return information.
|
||||
|
||||
| # | Method | Safe for limited user? | Description |
|
||||
| --- | ----------------------------------------------- | ---------------------- | -------------------------------------------------------------------------------- |
|
||||
| 1 | [debuglevel](#debuglevel) | N | Dynamically changes the debug logging level. |
|
||||
| 2 | [getbestblock](#getbestblock) | Y | Get block height and hash of best block in the main chain. | None |
|
||||
| 3 | [getcurrentnet](#getcurrentnet) | Y | Get bitcoin network btcd is running on. | None |
|
||||
| 3 | [getcurrentnet](#getcurrentnet) | Y | Get bitcoin network lbcd is running on. | None |
|
||||
| 4 | [searchrawtransactions](#searchrawtransactions) | Y | Query for transactions related to a particular address. | None |
|
||||
| 5 | [node](#node) | N | Attempts to add or remove a peer. | None |
|
||||
| 6 | [generate](#generate) | N | When in simnet or regtest mode, generate a set number of blocks. | None |
|
||||
|
@ -594,10 +586,10 @@ The following is an overview of the RPC methods which are implemented by btcd, b
|
|||
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Method | debuglevel |
|
||||
| Parameters | 1. _levelspec_ (string) |
|
||||
| Description | Dynamically changes the debug logging level.<br />The levelspec can either a debug level or of the form `<subsystem>=<level>,<subsystem2>=<level2>,...`<br />The valid debug levels are `trace`, `debug`, `info`, `warn`, `error`, and `critical`.<br />The valid subsystems are `AMGR`, `ADXR`, `BCDB`, `BMGR`, `BTCD`, `CHAN`, `DISC`, `PEER`, `RPCS`, `SCRP`, `SRVR`, and `TXMP`.<br />Additionally, the special keyword `show` can be used to get a list of the available subsystems. |
|
||||
| Description | Dynamically changes the debug logging level.<br />The levelspec can either a debug level or of the form `<subsystem>=<level>,<subsystem2>=<level2>,...`<br />The valid debug levels are `trace`, `debug`, `info`, `warn`, `error`, and `critical`.<br />The valid subsystems are `AMGR`, `ADXR`, `BCDB`, `BMGR`, `lbcd`, `CHAN`, `DISC`, `PEER`, `RPCS`, `SCRP`, `SRVR`, and `TXMP`.<br />Additionally, the special keyword `show` can be used to get a list of the available subsystems. |
|
||||
| Returns | string |
|
||||
| Example Return | `Done.` |
|
||||
| Example `show` Return | `Supported subsystems [AMGR ADXR BCDB BMGR BTCD CHAN DISC PEER RPCS SCRP SRVR TXMP]` |
|
||||
| Example `show` Return | `Supported subsystems [AMGR ADXR BCDB BMGR lbcd CHAN DISC PEER RPCS SCRP SRVR TXMP]` |
|
||||
[Return to Overview](#ExtMethodOverview)<br />
|
||||
|
||||
***
|
||||
|
@ -620,7 +612,7 @@ The following is an overview of the RPC methods which are implemented by btcd, b
|
|||
| -------------- | -------------------------------------------------- |
|
||||
| Method | getcurrentnet |
|
||||
| Parameters | None |
|
||||
| Description | Get bitcoin network btcd is running on. |
|
||||
| Description | Get bitcoin network lbcd is running on. |
|
||||
| Returns | numeric |
|
||||
| Example Return | `3652501241` (mainnet)<br />`118034699` (testnet3) |
|
||||
[Return to Overview](#ExtMethodOverview)<br />
|
||||
|
@ -670,9 +662,9 @@ The following is an overview of the RPC methods which are implemented by btcd, b
|
|||
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Method | version |
|
||||
| Parameters | None |
|
||||
| Description | Returns the version of the JSON-RPC API built into this release of btcd. |
|
||||
| Returns | `{ (json object)`<br /> `"btcdjsonrpcapi": {`<br /> `"versionstring": "x.y.z", (string) the version of the JSON-RPC API`<br /> `"major": x, (numeric) the major version of the JSON-RPC API`<br /> `"minor": y, (numeric) the minor version of the JSON-RPC API`<br /> `"patch": z, (numeric) the patch version of the JSON-RPC API`<br /> `"prerelease": "", (string) prerelease info for the JSON-RPC API`<br /> `"buildmetadata": "" (string) metadata about the server build`<br /> `}`<br />`}` |
|
||||
| Example Return | `{`<br /> `"btcdjsonrpcapi": {`<br /> `"versionstring": "1.0.0",`<br /> `"major": 1, `<br /> `"minor": 0,`<br /> `"patch": 0,`<br /> `"prerelease": "",`<br /> `"buildmetadata": ""`<br /> `}`<br />`}` |
|
||||
| Description | Returns the version of the JSON-RPC API built into this release of lbcd. |
|
||||
| Returns | `{ (json object)`<br /> `"lbcdjsonrpcapi": {`<br /> `"versionstring": "x.y.z", (string) the version of the JSON-RPC API`<br /> `"major": x, (numeric) the major version of the JSON-RPC API`<br /> `"minor": y, (numeric) the minor version of the JSON-RPC API`<br /> `"patch": z, (numeric) the patch version of the JSON-RPC API`<br /> `"prerelease": "", (string) prerelease info for the JSON-RPC API`<br /> `"buildmetadata": "" (string) metadata about the server build`<br /> `}`<br />`}` |
|
||||
| Example Return | `{`<br /> `"lbcdjsonrpcapi": {`<br /> `"versionstring": "1.0.0",`<br /> `"major": 1, `<br /> `"minor": 0,`<br /> `"patch": 0,`<br /> `"prerelease": "",`<br /> `"buildmetadata": ""`<br /> `}`<br />`}` |
|
||||
[Return to Overview](#MethodOverview)<br />
|
||||
|
||||
***
|
||||
|
@ -792,7 +784,7 @@ user. Click the method name for further details such as parameter and return in
|
|||
| Method | notifyspent |
|
||||
| Notifications | [redeemingtx](#redeemingtx) |
|
||||
| Parameters | 1. Outpoints (JSON array, required)<br /> `[ (JSON array)`<br /> `{ (JSON object)`<br /> `"hash":"data", (string) the hex-encoded bytes of the outpoint hash`<br /> `"index":n (numeric) the txout index of the outpoint`<br /> `},`<br /> `...`<br /> `]` |
|
||||
| Description | *DEPRECATED, for similar functionality see [loadtxfilter](#loadtxfilter)*<br />Send a redeemingtx notification when a transaction spending an outpoint appears in mempool (if relayed to this btcd instance) and when such a transaction first appears in a newly-attached block. |
|
||||
| Description | *DEPRECATED, for similar functionality see [loadtxfilter](#loadtxfilter)*<br />Send a redeemingtx notification when a transaction spending an outpoint appears in mempool (if relayed to this lbcd instance) and when such a transaction first appears in a newly-attached block. |
|
||||
| Returns | Nothing |
|
||||
[Return to Overview](#WSExtMethodOverview)<br />
|
||||
|
||||
|
@ -893,7 +885,7 @@ user. Click the method name for further details such as parameter and return in
|
|||
|
||||
### 8. Notifications (Websocket-specific)
|
||||
|
||||
btcd uses standard JSON-RPC notifications to notify clients of changes, rather than requiring clients to poll btcd for updates. JSON-RPC notifications are a subset of requests, but do not contain an ID. The notification type is categorized by the `method` field and additional details are sent as a JSON array in the `params` field.
|
||||
lbcd uses standard JSON-RPC notifications to notify clients of changes, rather than requiring clients to poll lbcd for updates. JSON-RPC notifications are a subset of requests, but do not contain an ID. The notification type is categorized by the `method` field and additional details are sent as a JSON array in the `params` field.
|
||||
|
||||
<a name="NotificationOverview" />
|
||||
|
||||
|
@ -1075,7 +1067,7 @@ various languages.
|
|||
**9.1 Go**
|
||||
|
||||
This section provides examples of using the RPC interface using Go and the
|
||||
[rpcclient](https://github.com/btcsuite/btcd/tree/master/rpcclient) package.
|
||||
[rpcclient](https://github.com/lbryio/lbcd/tree/master/rpcclient) package.
|
||||
|
||||
* [Using getblockcount to Retrieve the Current Block Height](#ExampleGetBlockCount)
|
||||
* [Using getblock to Retrieve the Genesis Block](#ExampleGetBlock)
|
||||
|
@ -1087,8 +1079,8 @@ This section provides examples of using the RPC interface using Go and the
|
|||
**9.1.1 Using getblockcount to Retrieve the Current Block Height**<br />
|
||||
|
||||
The following is an example Go application which uses the
|
||||
[rpcclient](https://github.com/btcsuite/btcd/tree/master/rpcclient) package to connect with
|
||||
a btcd instance via Websockets, issues [getblockcount](#getblockcount) to
|
||||
[rpcclient](https://github.com/lbryio/lbcd/tree/master/rpcclient) package to connect with
|
||||
a lbcd instance via Websockets, issues [getblockcount](#getblockcount) to
|
||||
retrieve the current block height, and displays it.
|
||||
|
||||
```Go
|
||||
|
@ -1099,16 +1091,16 @@ import (
|
|||
"log"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/btcsuite/btcd/rpcclient"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lbryio/lbcd/rpcclient"
|
||||
btcutil "github.com/lbryio/lbcutil"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Load the certificate for the TLS connection which is automatically
|
||||
// generated by btcd when it starts the RPC server and doesn't already
|
||||
// generated by lbcd when it starts the RPC server and doesn't already
|
||||
// have one.
|
||||
btcdHomeDir := btcutil.AppDataDir("btcd", false)
|
||||
certs, err := ioutil.ReadFile(filepath.Join(btcdHomeDir, "rpc.cert"))
|
||||
lbcdHomeDir := btcutil.AppDataDir("lbcd", false)
|
||||
certs, err := ioutil.ReadFile(filepath.Join(lbcdHomeDir, "rpc.cert"))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -1149,8 +1141,8 @@ Which results in:
|
|||
**9.1.2 Using getblock to Retrieve the Genesis Block**<br />
|
||||
|
||||
The following is an example Go application which uses the
|
||||
[rpcclient](https://github.com/btcsuite/btcd/tree/master/rpcclient) package to connect with
|
||||
a btcd instance via Websockets, issues [getblock](#getblock) to retrieve
|
||||
[rpcclient](https://github.com/lbryio/lbcd/tree/master/rpcclient) package to connect with
|
||||
a lbcd instance via Websockets, issues [getblock](#getblock) to retrieve
|
||||
information about the Genesis block, and display a few details about it.
|
||||
|
||||
```Go
|
||||
|
@ -1162,17 +1154,17 @@ import (
|
|||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/rpcclient"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lbryio/lbcd/chaincfg/chainhash"
|
||||
"github.com/lbryio/lbcd/rpcclient"
|
||||
btcutil "github.com/lbryio/lbcutil"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Load the certificate for the TLS connection which is automatically
|
||||
// generated by btcd when it starts the RPC server and doesn't already
|
||||
// generated by lbcd when it starts the RPC server and doesn't already
|
||||
// have one.
|
||||
btcdHomeDir := btcutil.AppDataDir("btcd", false)
|
||||
certs, err := ioutil.ReadFile(filepath.Join(btcdHomeDir, "rpc.cert"))
|
||||
lbcdHomeDir := btcutil.AppDataDir("lbcd", false)
|
||||
certs, err := ioutil.ReadFile(filepath.Join(lbcdHomeDir, "rpc.cert"))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -1239,8 +1231,8 @@ Num transactions: 1
|
|||
Notifications (Websocket-specific)**<br />
|
||||
|
||||
The following is an example Go application which uses the
|
||||
[rpcclient](https://github.com/btcsuite/btcd/tree/master/rpcclient) package to connect with
|
||||
a btcd instance via Websockets and registers for
|
||||
[rpcclient](https://github.com/lbryio/lbcd/tree/master/rpcclient) package to connect with
|
||||
a lbcd instance via Websockets and registers for
|
||||
[blockconnected](#blockconnected) and [blockdisconnected](#blockdisconnected)
|
||||
notifications with [notifyblocks](#notifyblocks). It also sets up handlers for
|
||||
the notifications.
|
||||
|
@ -1254,9 +1246,9 @@ import (
|
|||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/rpcclient"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lbryio/lbcd/chaincfg/chainhash"
|
||||
"github.com/lbryio/lbcd/rpcclient"
|
||||
btcutil "github.com/lbryio/lbcutil"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -1272,10 +1264,10 @@ func main() {
|
|||
}
|
||||
|
||||
// Load the certificate for the TLS connection which is automatically
|
||||
// generated by btcd when it starts the RPC server and doesn't already
|
||||
// generated by lbcd when it starts the RPC server and doesn't already
|
||||
// have one.
|
||||
btcdHomeDir := btcutil.AppDataDir("btcd", false)
|
||||
certs, err := ioutil.ReadFile(filepath.Join(btcdHomeDir, "rpc.cert"))
|
||||
lbcdHomeDir := btcutil.AppDataDir("lbcd", false)
|
||||
certs, err := ioutil.ReadFile(filepath.Join(lbcdHomeDir, "rpc.cert"))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -1337,7 +1329,7 @@ Example output:
|
|||
**9.2.1 Using notifyblocks to be Notified of Block Connects and Disconnects**<br />
|
||||
|
||||
The following is example node.js code which uses [ws](https://github.com/einaros/ws)
|
||||
(can be installed with `npm install ws`) to connect with a btcd instance,
|
||||
(can be installed with `npm install ws`) to connect with a lbcd instance,
|
||||
issues [notifyblocks](#notifyblocks) to register for
|
||||
[blockconnected](#blockconnected) and [blockdisconnected](#blockdisconnected)
|
||||
notifications, and displays all incoming messages.
|
||||
|
@ -1347,14 +1339,14 @@ var fs = require('fs');
|
|||
var WebSocket = require('ws');
|
||||
|
||||
// Load the certificate for the TLS connection which is automatically
|
||||
// generated by btcd when it starts the RPC server and doesn't already
|
||||
// generated by lbcd when it starts the RPC server and doesn't already
|
||||
// have one.
|
||||
var cert = fs.readFileSync('/path/to/btcd/appdata/rpc.cert');
|
||||
var cert = fs.readFileSync('/path/to/lbcd/appdata/rpc.cert');
|
||||
var user = "yourusername";
|
||||
var password = "yourpassword";
|
||||
|
||||
|
||||
// Initiate the websocket connection. The btcd generated certificate acts as
|
||||
// Initiate the websocket connection. The lbcd generated certificate acts as
|
||||
// its own certificate authority, so it needs to be specified in the 'ca' array
|
||||
// for the certificate to properly validate.
|
||||
var ws = new WebSocket('wss://127.0.0.1:9245/ws', {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Mining
|
||||
|
||||
btcd supports the `getblocktemplate` RPC.
|
||||
lbcd supports the `getblocktemplate` RPC.
|
||||
The limited user cannot access this RPC.
|
||||
|
||||
## Add the payment addresses with the `miningaddr` option
|
||||
|
@ -13,18 +13,20 @@ miningaddr=12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX
|
|||
miningaddr=1M83ju3EChKYyysmM2FXtLNftbacagd8FR
|
||||
```
|
||||
|
||||
## Add btcd's RPC TLS certificate to system Certificate Authority list
|
||||
## Add lbcd's RPC TLS certificate to system Certificate Authority list
|
||||
|
||||
`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
|
||||
Various miners use [curl](http://curl.haxx.se/) to fetch data from the RPC server.
|
||||
Since curl validates the certificate by default, we must install the `lbcd` RPC
|
||||
certificate into the default system Certificate Authority list.
|
||||
|
||||
## Ubuntu
|
||||
|
||||
1. Copy rpc.cert to /usr/share/ca-certificates: `# cp /home/user/.btcd/rpc.cert /usr/share/ca-certificates/btcd.crt`
|
||||
2. Add btcd.crt to /etc/ca-certificates.conf: `# echo btcd.crt >> /etc/ca-certificates.conf`
|
||||
1. Copy rpc.cert to /usr/share/ca-certificates: `# cp /home/user/.lbcd/rpc.cert /usr/share/ca-certificates/lbcd.crt`
|
||||
2. Add lbcd.crt to /etc/ca-certificates.conf: `# echo lbcd.crt >> /etc/ca-certificates.conf`
|
||||
3. Update the CA certificate list: `# update-ca-certificates`
|
||||
|
||||
## Set your mining software url to use https
|
||||
|
||||
`cgminer -o https://127.0.0.1:8334 -u rpcuser -p rpcpassword`
|
||||
|
||||
Alternatively, you can disable TLS with the `--notls` option for the server.
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
# Contents
|
||||
|
||||
* [Installation](installation.md)
|
||||
* [Update](update.md)
|
||||
* [Configuration](configuration.md)
|
||||
* [Configuring TOR](configuring_tor.md)
|
||||
* [Controlling](controlling.md)
|
||||
* [Mining](mining.md)
|
||||
* [Wallet](wallet.md)
|
||||
* [Developer resources](developer_resources.md)
|
||||
* [JSON RPC API](json_rpc_api.md)
|
||||
* [Code contribution guidelines](code_contribution_guidelines.md)
|
||||
* [Contact](contact.md)
|
|
@ -1,8 +0,0 @@
|
|||
# Update
|
||||
|
||||
* Run the following commands to update btcd, all dependencies, and install it:
|
||||
|
||||
```bash
|
||||
cd $GOPATH/src/github.com/btcsuite/btcd
|
||||
git pull && GO111MODULE=on go install -v . ./cmd/...
|
||||
```
|
|
@ -1,160 +0,0 @@
|
|||
# Using Docker
|
||||
|
||||
- [Using Docker](#using-docker)
|
||||
- [Introduction](#introduction)
|
||||
- [Docker volumes](#docker-volumes)
|
||||
- [Known error messages when starting the btcd container](#known-error-messages-when-starting-the-btcd-container)
|
||||
- [Examples](#examples)
|
||||
- [Preamble](#preamble)
|
||||
- [Full node without RPC port](#full-node-without-rpc-port)
|
||||
- [Full node with RPC port](#full-node-with-rpc-port)
|
||||
- [Full node with RPC port running on TESTNET](#full-node-with-rpc-port-running-on-testnet)
|
||||
|
||||
## Introduction
|
||||
|
||||
With Docker you can easily set up *btcd* to run your Bitcoin full node. You can find the official *btcd* Docker images on Docker Hub [btcsuite/btcd](https://hub.docker.com/r/btcsuite/btcd). The Docker source file of this image is located at [Dockerfile](https://github.com/btcsuite/btcd/blob/master/Dockerfile).
|
||||
|
||||
This documentation focuses on running Docker container with *docker-compose.yml* files. These files are better to read and you can use them as a template for your own use. For more information about Docker and Docker compose visit the official [Docker documentation](https://docs.docker.com/).
|
||||
|
||||
## Docker volumes
|
||||
|
||||
**Special diskspace hint**: The following examples are using a Docker managed volume. The volume is named *btcd-data* This will use a lot of disk space, because it contains the full Bitcoin blockchain. Please make yourself familiar with [Docker volumes](https://docs.docker.com/storage/volumes/).
|
||||
|
||||
The *btcd-data* volume will be reused, if you upgrade your *docker-compose.yml* file. Keep in mind, that it is not automatically removed by Docker, if you delete the btcd container. If you don't need the volume anymore, please delete it manually with the command:
|
||||
|
||||
```bash
|
||||
docker volume ls
|
||||
docker volume rm btcd-data
|
||||
```
|
||||
|
||||
For binding a local folder to your *btcd* container please read the [Docker documentation](https://docs.docker.com/). The preferred way is to use a Docker managed volume.
|
||||
|
||||
## Known error messages when starting the btcd container
|
||||
|
||||
We pass all needed arguments to *btcd* as command line parameters in our *docker-compose.yml* file. It doesn't make sense to create a *btcd.conf* file. This would make things too complicated. Anyhow *btcd* will complain with following log messages when starting. These messages can be ignored:
|
||||
|
||||
```bash
|
||||
Error creating a default config file: open /sample-btcd.conf: no such file or directory
|
||||
...
|
||||
[WRN] BTCD: open /root/.btcd/btcd.conf: no such file or directory
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Preamble
|
||||
|
||||
All following examples uses some defaults:
|
||||
|
||||
- container_name: btcd
|
||||
Name of the docker container that is be shown by e.g. ```docker ps -a```
|
||||
|
||||
- hostname: btcd **(very important to set a fixed name before first start)**
|
||||
The internal hostname in the docker container. By default, docker is recreating the hostname every time you change the *docker-compose.yml* file. The default hostnames look like *ef00548d4fa5*. This is a problem when using the *btcd* RPC port. The RPC port is using a certificate to validate the hostname. If the hostname changes you need to recreate the certificate. To avoid this, you should set a fixed hostname before the first start. This ensures, that the docker volume is created with a certificate with this hostname.
|
||||
|
||||
- restart: unless-stopped
|
||||
Starts the *btcd* container when Docker starts, except that when the container is stopped (manually or otherwise), it is not restarted even after Docker restarts.
|
||||
|
||||
To use the following examples create an empty directory. In this directory create a file named *docker-compose.yml*, copy and paste the example into the *docker-compose.yml* file and run it.
|
||||
|
||||
```bash
|
||||
mkdir ~/btcd-docker
|
||||
cd ~/btcd-docker
|
||||
touch docker-compose.yaml
|
||||
nano docker-compose.yaml (use your favourite editor to edit the compose file)
|
||||
docker-compose up (creates and starts a new btcd container)
|
||||
```
|
||||
|
||||
With the following commands you can control *docker-compose*:
|
||||
|
||||
```docker-compose up -d``` (creates and starts the container in background)
|
||||
|
||||
```docker-compose down``` (stops and delete the container. **The docker volume btcd-data will not be deleted**)
|
||||
|
||||
```docker-compose stop``` (stops the container)
|
||||
|
||||
```docker-compose start``` (starts the container)
|
||||
|
||||
```docker ps -a``` (list all running and stopped container)
|
||||
|
||||
```docker volume ls``` (lists all docker volumes)
|
||||
|
||||
```docker logs btcd``` (shows the log )
|
||||
|
||||
```docker-compose help``` (brings up some helpful information)
|
||||
|
||||
### Full node without RPC port
|
||||
|
||||
Let's start with an easy example. If you just want to create a full node without the need of using the RPC port, you can use the following example. This example will launch *btcd* and exposes only the default p2p port 8333 to the outside world:
|
||||
|
||||
```yaml
|
||||
version: "2"
|
||||
|
||||
services:
|
||||
btcd:
|
||||
container_name: btcd
|
||||
hostname: btcd
|
||||
image: btcsuite/btcd:latest
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- btcd-data:/root/.btcd
|
||||
ports:
|
||||
- 8333:8333
|
||||
|
||||
volumes:
|
||||
btcd-data:
|
||||
```
|
||||
|
||||
### Full node with RPC port
|
||||
|
||||
To use the RPC port of *btcd* you need to specify a *username* and a very strong *password*. If you want to connect to the RPC port from the internet, you need to expose port 8334(RPC) as well.
|
||||
|
||||
```yaml
|
||||
version: "2"
|
||||
|
||||
services:
|
||||
btcd:
|
||||
container_name: btcd
|
||||
hostname: btcd
|
||||
image: btcsuite/btcd:latest
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- btcd-data:/root/.btcd
|
||||
ports:
|
||||
- 8333:8333
|
||||
- 8334:8334
|
||||
command: [
|
||||
"--rpcuser=[CHOOSE_A_USERNAME]",
|
||||
"--rpcpass=[CREATE_A_VERY_HARD_PASSWORD]"
|
||||
]
|
||||
|
||||
volumes:
|
||||
btcd-data:
|
||||
```
|
||||
|
||||
### Full node with RPC port running on TESTNET
|
||||
|
||||
To run a node on testnet, you need to provide the *--testnet* argument. The ports for testnet are 18333 (p2p) and 18334 (RPC):
|
||||
|
||||
```yaml
|
||||
version: "2"
|
||||
|
||||
services:
|
||||
btcd:
|
||||
container_name: btcd
|
||||
hostname: btcd
|
||||
image: btcsuite/btcd:latest
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- btcd-data:/root/.btcd
|
||||
ports:
|
||||
- 18333:18333
|
||||
- 18334:18334
|
||||
command: [
|
||||
"--testnet",
|
||||
"--rpcuser=[CHOOSE_A_USERNAME]",
|
||||
"--rpcpass=[CREATE_A_VERY_HARD_PASSWORD]"
|
||||
]
|
||||
|
||||
volumes:
|
||||
btcd-data:
|
||||
```
|
|
@ -1,5 +0,0 @@
|
|||
# Wallet
|
||||
|
||||
btcd was intentionally developed without an integrated wallet for security
|
||||
reasons. Please see [btcwallet](https://github.com/btcsuite/btcwallet) for more
|
||||
information.
|
|
@ -1,13 +1,8 @@
|
|||
integration
|
||||
===========
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
|
||||
This contains integration tests which make use of the
|
||||
[rpctest](https://github.com/btcsuite/btcd/tree/master/integration/rpctest)
|
||||
[rpctest](https://github.com/lbryio/lbcd/tree/master/integration/rpctest)
|
||||
package to programmatically drive nodes via RPC.
|
||||
|
||||
## License
|
||||
|
||||
This code is licensed under the [copyfree](http://copyfree.org) ISC License.
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
rpctest
|
||||
=======
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/btcsuite/btcd/integration/rpctest)
|
||||
|
||||
Package rpctest provides a btcd-specific RPC testing harness crafting and
|
||||
executing integration tests by driving a `btcd` instance via the `RPC`
|
||||
|
@ -16,15 +14,3 @@ This package was designed specifically to act as an RPC testing harness for
|
|||
`btcd`. However, the constructs presented are general enough to be adapted to
|
||||
any project wishing to programmatically drive a `btcd` instance of its
|
||||
systems/integration tests.
|
||||
|
||||
## Installation and Updating
|
||||
|
||||
```bash
|
||||
$ go get -u github.com/btcsuite/btcd/integration/rpctest
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Package rpctest is licensed under the [copyfree](http://copyfree.org) ISC
|
||||
License.
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
mempool
|
||||
=======
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/btcsuite/btcd/mempool)
|
||||
|
||||
Package mempool provides a policy-enforced pool of unmined bitcoin transactions.
|
||||
|
||||
|
@ -33,11 +31,6 @@ proceed. Typically, this will involve things such as relaying the transactions
|
|||
to other peers on the network and notifying the mining process that new
|
||||
transactions are available.
|
||||
|
||||
This package has intentionally been designed so it can be used as a standalone
|
||||
package for any projects needing the ability create an in-memory pool of bitcoin
|
||||
transactions that are not only valid by consensus rules, but also adhere to a
|
||||
configurable policy.
|
||||
|
||||
## Feature Overview
|
||||
|
||||
The following is a quick overview of the major features. It is not intended to
|
||||
|
@ -71,13 +64,3 @@ be an exhaustive list.
|
|||
- Manual control of transaction removal
|
||||
- Recursive removal of all dependent transactions
|
||||
|
||||
## Installation and Updating
|
||||
|
||||
```bash
|
||||
$ go get -u github.com/btcsuite/btcd/mempool
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Package mempool is licensed under the [copyfree](http://copyfree.org) ISC
|
||||
License.
|
||||
|
|
|
@ -1,21 +1,8 @@
|
|||
mining
|
||||
======
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/btcsuite/btcd/mining)
|
||||
|
||||
## Overview
|
||||
|
||||
This package is currently a work in progress.
|
||||
|
||||
## Installation and Updating
|
||||
|
||||
```bash
|
||||
$ go get -u github.com/btcsuite/btcd/mining
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Package mining is licensed under the [copyfree](http://copyfree.org) ISC
|
||||
License.
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
cpuminer
|
||||
========
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![Build Status](https://github.com/lbryio/lbcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/lbryio/lbcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/btcsuite/btcd/mining/cpuminer)
|
||||
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/lbryio/lbcd/mining/cpuminer)
|
||||
=======
|
||||
|
||||
## Overview
|
||||
|
@ -16,7 +16,7 @@ now.
|
|||
## Installation and Updating
|
||||
|
||||
```bash
|
||||
$ go get -u github.com/btcsuite/btcd/mining/cpuminer
|
||||
$ go get -u github.com/lbryio/lbcd/mining/cpuminer
|
||||
```
|
||||
|
||||
## License
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
netsync
|
||||
=======
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/btcsuite/btcd/netsync)
|
||||
|
||||
## Overview
|
||||
|
||||
|
@ -13,13 +11,3 @@ download, keep the chain and unconfirmed transaction pool in sync, and announce
|
|||
new blocks connected to the chain. Currently the sync manager selects a single
|
||||
sync peer that it downloads all blocks from until it is up to date with the
|
||||
longest chain the sync peer is aware of.
|
||||
|
||||
## Installation and Updating
|
||||
|
||||
```bash
|
||||
$ go get -u github.com/btcsuite/btcd/netsync
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Package netsync is licensed under the [copyfree](http://copyfree.org) ISC License.
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
peer
|
||||
====
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/btcsuite/btcd/peer)
|
||||
|
||||
Package peer provides a common base for creating and managing bitcoin network
|
||||
peers.
|
||||
|
||||
This package has intentionally been designed so it can be used as a standalone
|
||||
package for any projects needing a full featured bitcoin peer base to build on.
|
||||
|
||||
## Overview
|
||||
|
||||
This package builds upon the wire package, which provides the fundamental
|
||||
|
@ -55,19 +50,3 @@ A quick overview of the major features peer provides are as follows:
|
|||
- Ability to wait for shutdown/disconnect
|
||||
- Comprehensive test coverage
|
||||
|
||||
## Installation and Updating
|
||||
|
||||
```bash
|
||||
$ go get -u github.com/btcsuite/btcd/peer
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
* [New Outbound Peer Example](https://pkg.go.dev/github.com/btcsuite/btcd/peer#example-package--NewOutboundPeer)
|
||||
Demonstrates the basic process for initializing and creating an outbound peer.
|
||||
Peers negotiate by exchanging version and verack messages. For demonstration,
|
||||
a simple handler for the version message is attached to the peer.
|
||||
|
||||
## License
|
||||
|
||||
Package peer is licensed under the [copyfree](http://copyfree.org) ISC License.
|
||||
|
|
|
@ -1,181 +0,0 @@
|
|||
# `btcd`'s Reproducible Build System
|
||||
|
||||
This package contains the build script that the `btcd` project uses in order to
|
||||
build binaries for each new release. As of `go1.13`, with some new build flags,
|
||||
binaries are now reproducible, allowing developers to build the binary on
|
||||
distinct machines, and end up with a byte-for-byte identical binary.
|
||||
Every release should note which Go version was used to build the release, so
|
||||
that version should be used for verifying the release.
|
||||
|
||||
## Building a New Release
|
||||
|
||||
### Tagging and pushing a new tag (for maintainers)
|
||||
|
||||
Before running release scripts, a few things need to happen in order to finally
|
||||
create a release and make sure there are no mistakes in the release process.
|
||||
|
||||
First, make sure that before the tagged commit there are modifications to the
|
||||
[CHANGES](../CHANGES) file committed.
|
||||
The CHANGES file should be a changelog that roughly mirrors the release notes.
|
||||
Generally, the PRs that have been merged since the last release have been
|
||||
listed in the CHANGES file and categorized.
|
||||
For example, these changes have had the following format in the past:
|
||||
```
|
||||
Changes in X.YY.Z (Month Day Year):
|
||||
- Protocol and Network-related changes:
|
||||
- PR Title One (#PRNUM)
|
||||
- PR Title Two (#PRNUMTWO)
|
||||
...
|
||||
- RPC changes:
|
||||
- Crypto changes:
|
||||
...
|
||||
|
||||
- Contributors (alphabetical order):
|
||||
- Contributor A
|
||||
- Contributor B
|
||||
- Contributor C
|
||||
...
|
||||
```
|
||||
|
||||
If the previous tag is, for example, `vA.B.C`, then you can get the list of
|
||||
contributors (from `vA.B.C` until the current `HEAD`) using the following command:
|
||||
```bash
|
||||
git log vA.B.C..HEAD --pretty="%an" | sort | uniq
|
||||
```
|
||||
After committing changes to the CHANGES file, the tagged release commit
|
||||
should be created.
|
||||
|
||||
The tagged commit should be a commit that bumps version numbers in `version.go`
|
||||
and `cmd/btcctl/version.go`.
|
||||
For example (taken from [f3ec130](https://github.com/btcsuite/btcd/commit/f3ec13030e4e828869954472cbc51ac36bee5c1d)):
|
||||
```diff
|
||||
diff --git a/cmd/btcctl/version.go b/cmd/btcctl/version.go
|
||||
index 2195175c71..f65cacef7e 100644
|
||||
--- a/cmd/btcctl/version.go
|
||||
+++ b/cmd/btcctl/version.go
|
||||
@@ -18,7 +18,7 @@ const semanticAlphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr
|
||||
const (
|
||||
appMajor uint = 0
|
||||
appMinor uint = 20
|
||||
- appPatch uint = 0
|
||||
+ appPatch uint = 1
|
||||
|
||||
// appPreRelease MUST only contain characters from semanticAlphabet
|
||||
// per the semantic versioning spec.
|
||||
diff --git a/version.go b/version.go
|
||||
index 92fd60fdd4..fba55b5a37 100644
|
||||
--- a/version.go
|
||||
+++ b/version.go
|
||||
@@ -18,7 +18,7 @@ const semanticAlphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr
|
||||
const (
|
||||
appMajor uint = 0
|
||||
appMinor uint = 20
|
||||
- appPatch uint = 0
|
||||
+ appPatch uint = 1
|
||||
|
||||
// appPreRelease MUST only contain characters from semanticAlphabet
|
||||
// per the semantic versioning spec.
|
||||
```
|
||||
|
||||
Next, this commit should be signed by the maintainer using `git commit -S`.
|
||||
The commit should be tagged and signed with `git tag <TAG> -s`, and should be
|
||||
pushed using `git push origin TAG`.
|
||||
|
||||
### Building a release on macOS/Linux/Windows (WSL)
|
||||
|
||||
No prior set up is needed on Linux or macOS is required in order to build the
|
||||
release binaries. However, on Windows, the only way to build the release
|
||||
binaries at the moment is by using the Windows Subsystem Linux. One can build
|
||||
the release binaries following these steps:
|
||||
|
||||
1. `git clone https://github.com/btcsuite/btcd.git`
|
||||
2. `cd btcd`
|
||||
3. `./release/release.sh <TAG> # <TAG> is the name of the next release/tag`
|
||||
|
||||
This will then create a directory of the form `btcd-<TAG>` containing archives
|
||||
of the release binaries for each supported operating system and architecture,
|
||||
and a manifest file containing the hash of each archive.
|
||||
|
||||
### Pushing a release (for maintainers)
|
||||
|
||||
Now that the directory `btcd-<TAG>` is created, the manifest file needs to be
|
||||
signed by a maintainer and the release files need to be published to GitHub.
|
||||
|
||||
Sign the `manifest-<TAG>.txt` file like so:
|
||||
```sh
|
||||
gpg --sign --detach-sig manifest-<TAG>.txt
|
||||
```
|
||||
This will create a file named `manifest-<TAG>.txt.sig`, which will must
|
||||
be included in the release files later.
|
||||
|
||||
#### Note before publishing
|
||||
Before publishing, go through the reproducible build process that is outlined
|
||||
in this document with the files created from `release/release.sh`. This includes
|
||||
verifying commit and tag signatures using `git verify-commit` and git `verify-tag`
|
||||
respectively.
|
||||
|
||||
Now that we've double-checked everything and have all of the necessary files,
|
||||
it's time to publish release files on GitHub.
|
||||
Follow [this documentation](https://docs.github.com/en/github/administering-a-repository/managing-releases-in-a-repository)
|
||||
to create a release using the GitHub UI, and make sure to write release notes
|
||||
which roughly follow the format of [previous release notes](https://github.com/btcsuite/btcd/releases/tag/v0.20.1-beta).
|
||||
This is different from the [CHANGES](../CHANGES) file, which should be before the
|
||||
tagged commit in the git history.
|
||||
Much of the information in the release notes will be the same as the CHANGES
|
||||
file.
|
||||
It's important to include the Go version used to produce the release files in
|
||||
the release notes, so users know the correct version of Go to use to reproduce
|
||||
and verify the build.
|
||||
When following the GitHub documentation, include every file in the `btcd-<TAG>`
|
||||
directory.
|
||||
|
||||
At this point, a signed commit and tag on that commit should be pushed to the main
|
||||
branch. The directory created from running `release/release.sh` should be included
|
||||
as release files in the GitHub release UI, and the `manifest-<TAG>.txt` file
|
||||
signature, called `manifest-<TAG>.txt.sig`, should also be included.
|
||||
A release notes document should be created and written in the GitHub release UI.
|
||||
Once all of this is done, feel free to click `Publish Release`!
|
||||
|
||||
## Verifying a Release
|
||||
|
||||
With `go1.13`, it's now possible for third parties to verify release binaries.
|
||||
Before this version of `go`, one had to trust the release manager(s) to build the
|
||||
proper binary. With this new system, third parties can now _independently_ run
|
||||
the release process, and verify that all the hashes of the release binaries
|
||||
match exactly that of the release binaries produced by said third parties.
|
||||
|
||||
To verify a release, one must obtain the following tools (many of these come
|
||||
installed by default in most Unix systems): `gpg`/`gpg2`, `shashum`, and
|
||||
`tar`/`unzip`.
|
||||
|
||||
Once done, verifiers can proceed with the following steps:
|
||||
|
||||
1. Acquire the archive containing the release binaries for one's specific
|
||||
operating system and architecture, and the manifest file along with its
|
||||
signature.
|
||||
2. Verify the signature of the manifest file with `gpg --verify
|
||||
manifest-<TAG>.txt.sig`. This will require obtaining the PGP keys which
|
||||
signed the manifest file, which are included in the release notes.
|
||||
3. Recompute the `SHA256` hash of the archive with `shasum -a 256 <filename>`,
|
||||
locate the corresponding one in the manifest file, and ensure they match
|
||||
__exactly__.
|
||||
|
||||
At this point, verifiers can use the release binaries acquired if they trust
|
||||
the integrity of the release manager(s). Otherwise, one can proceed with the
|
||||
guide to verify the release binaries were built properly by obtaining `shasum`
|
||||
and `go` (matching the same version used in the release):
|
||||
|
||||
4. Extract the release binaries contained within the archive, compute their
|
||||
hashes as done above, and note them down.
|
||||
5. Ensure `go` is installed, matching the same version as noted in the release
|
||||
notes.
|
||||
6. Obtain a copy of `btcd`'s source code with `git clone
|
||||
https://github.com/btcsuite/btcd` and checkout the source code of the
|
||||
release with `git checkout <TAG>`.
|
||||
7. Proceed to verify the tag with `git verify-tag <TAG>` and compile the
|
||||
binaries from source for the intended operating system and architecture with
|
||||
`BTCDBUILDSYS=OS-ARCH ./release/release.sh <TAG>`.
|
||||
8. Extract the archive found in the `btcd-<TAG>` directory created by the
|
||||
release script and recompute the `SHA256` hash of the release binaries (btcd
|
||||
and btcctl) with `shasum -a 256 <filename>`. These should match __exactly__
|
||||
as the ones noted above.
|
|
@ -1,13 +1,11 @@
|
|||
rpcclient
|
||||
=========
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/btcsuite/btcd/rpcclient)
|
||||
|
||||
rpcclient implements a Websocket-enabled Bitcoin JSON-RPC client package written
|
||||
in [Go](http://golang.org/). It provides a robust and easy to use client for
|
||||
interfacing with a Bitcoin RPC server that uses a btcd/bitcoin core compatible
|
||||
interfacing with a Bitcoin RPC server that uses a lbcd/bitcoin core compatible
|
||||
Bitcoin JSON-RPC API.
|
||||
|
||||
## Status
|
||||
|
@ -16,26 +14,11 @@ This package is currently under active development. It is already stable and
|
|||
the infrastructure is complete. However, there are still several RPCs left to
|
||||
implement and the API is not stable yet.
|
||||
|
||||
## Documentation
|
||||
|
||||
* [API Reference](https://pkg.go.dev/github.com/btcsuite/btcd/rpcclient)
|
||||
* [btcd Websockets Example](https://github.com/btcsuite/btcd/tree/master/rpcclient/examples/btcdwebsockets)
|
||||
Connects to a btcd RPC server using TLS-secured websockets, registers for
|
||||
block connected and block disconnected notifications, and gets the current
|
||||
block count
|
||||
* [btcwallet Websockets Example](https://github.com/btcsuite/btcd/tree/master/rpcclient/examples/btcwalletwebsockets)
|
||||
Connects to a btcwallet RPC server using TLS-secured websockets, registers for
|
||||
notifications about changes to account balances, and gets a list of unspent
|
||||
transaction outputs (utxos) the wallet can sign
|
||||
* [Bitcoin Core HTTP POST Example](https://github.com/btcsuite/btcd/tree/master/rpcclient/examples/bitcoincorehttp)
|
||||
Connects to a bitcoin core RPC server using HTTP POST mode with TLS disabled
|
||||
and gets the current block count
|
||||
|
||||
## Major Features
|
||||
|
||||
* Supports Websockets (btcd/btcwallet) and HTTP POST mode (bitcoin core)
|
||||
* Provides callback and registration functions for btcd/btcwallet notifications
|
||||
* Supports btcd extensions
|
||||
* Supports Websockets (lbcd/lbcwallet) and HTTP POST mode (bitcoin core)
|
||||
* Provides callback and registration functions for lbcd/lbcwallet notifications
|
||||
* Supports lbcd extensions
|
||||
* Translates to and from higher-level and easier to use Go types
|
||||
* Offers a synchronous (blocking) and asynchronous API
|
||||
* When running in Websockets mode (the default):
|
||||
|
@ -44,13 +27,3 @@ implement and the API is not stable yet.
|
|||
* Registered notifications are automatically reregistered
|
||||
* Back-off support on reconnect attempts
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ go get -u github.com/btcsuite/btcd/rpcclient
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Package rpcclient is licensed under the [copyfree](http://copyfree.org) ISC
|
||||
License.
|
||||
|
|
|
@ -10,7 +10,7 @@ block count.
|
|||
The first step is to use `go get` to download and install the rpcclient package:
|
||||
|
||||
```bash
|
||||
$ go get github.com/btcsuite/btcd/rpcclient
|
||||
$ go get github.com/lbryio/lbcd/rpcclient
|
||||
```
|
||||
|
||||
Next, modify the `main.go` source to specify the correct RPC username and
|
||||
|
@ -24,7 +24,7 @@ password for the RPC server:
|
|||
Finally, navigate to the example's directory and run it with:
|
||||
|
||||
```bash
|
||||
$ cd $GOPATH/src/github.com/btcsuite/btcd/rpcclient/examples/bitcoincorehttp
|
||||
$ cd $GOPATH/src/github.com/lbryio/lbcd/rpcclient/examples/bitcoincorehttp
|
||||
$ go run *.go
|
||||
```
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ This example shows how to use the rpclient package to connect to a Bitcoin Core
|
|||
The first step is to use `go get` to download and install the rpcclient package:
|
||||
|
||||
```bash
|
||||
$ go get github.com/btcsuite/btcd/rpcclient
|
||||
$ go get github.com/lbryio/lbcd/rpcclient
|
||||
```
|
||||
|
||||
Next, modify the `main.go` source to specify the correct RPC username and
|
||||
|
@ -22,7 +22,7 @@ password for the RPC server:
|
|||
Finally, navigate to the example's directory and run it with:
|
||||
|
||||
```bash
|
||||
$ cd $GOPATH/src/github.com/btcsuite/btcd/rpcclient/examples/bitcoincorehttp
|
||||
$ cd $GOPATH/src/github.com/lbryio/lbcd/rpcclient/examples/bitcoincorehttp
|
||||
$ go run *.go
|
||||
```
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ demonstrate clean shutdown.
|
|||
The first step is to use `go get` to download and install the rpcclient package:
|
||||
|
||||
```bash
|
||||
$ go get github.com/btcsuite/btcd/rpcclient
|
||||
$ go get github.com/lbryio/lbcd/rpcclient
|
||||
```
|
||||
|
||||
Next, modify the `main.go` source to specify the correct RPC username and
|
||||
|
@ -27,7 +27,7 @@ password for the RPC server:
|
|||
Finally, navigate to the example's directory and run it with:
|
||||
|
||||
```bash
|
||||
$ cd $GOPATH/src/github.com/btcsuite/btcd/rpcclient/examples/btcdwebsockets
|
||||
$ cd $GOPATH/src/github.com/lbryio/lbcd/rpcclient/examples/btcdwebsockets
|
||||
$ go run *.go
|
||||
```
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ demonstrate clean shutdown.
|
|||
The first step is to use `go get` to download and install the rpcclient package:
|
||||
|
||||
```bash
|
||||
$ go get github.com/btcsuite/btcd/rpcclient
|
||||
$ go get github.com/lbryio/lbcd/rpcclient
|
||||
```
|
||||
|
||||
Next, modify the `main.go` source to specify the correct RPC username and
|
||||
|
@ -28,7 +28,7 @@ password for the RPC server:
|
|||
Finally, navigate to the example's directory and run it with:
|
||||
|
||||
```bash
|
||||
$ cd $GOPATH/src/github.com/btcsuite/btcd/rpcclient/examples/btcwalletwebsockets
|
||||
$ cd $GOPATH/src/github.com/lbryio/lbcd/rpcclient/examples/btcwalletwebsockets
|
||||
$ go run *.go
|
||||
```
|
||||
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
|
||||
; The directory to store data such as the block chain and peer addresses. The
|
||||
; block chain takes several GB, so this location must have a lot of free space.
|
||||
; The default is ~/.btcd/data on POSIX OSes, $LOCALAPPDATA/Btcd/data on Windows,
|
||||
; ~/Library/Application Support/Btcd/data on Mac OS, and $home/btcd/data on
|
||||
; The default is ~/.lbcd/data on POSIX OSes, $LOCALAPPDATA/Lbcd/data on Windows,
|
||||
; ~/Library/Application Support/Lbcd/data on Mac OS, and $home/lbcd/data on
|
||||
; Plan9. Environment variables are expanded so they may be used. NOTE: Windows
|
||||
; environment variables are typically %VARIABLE%, but they must be accessed with
|
||||
; $VARIABLE here. Also, ~ is expanded to $LOCALAPPDATA on Windows.
|
||||
; datadir=~/.btcd/data
|
||||
; datadir=~/.lbcd/data
|
||||
|
||||
|
||||
; ------------------------------------------------------------------------------
|
||||
|
@ -52,7 +52,7 @@
|
|||
; upnp=1
|
||||
|
||||
; Specify the external IP addresses your node is listening on. One address per
|
||||
; line. btcd will not contact 3rd-party sites to obtain external ip addresses.
|
||||
; line. lbcd will not contact 3rd-party sites to obtain external ip addresses.
|
||||
; This means if you are behind NAT, your node will not be able to advertise a
|
||||
; reachable address unless you specify it here or enable the 'upnp' option (and
|
||||
; have a supported device).
|
||||
|
@ -64,7 +64,7 @@
|
|||
;
|
||||
; Only one of the following two options, 'addpeer' and 'connect', may be
|
||||
; specified. Both allow you to specify peers that you want to stay connected
|
||||
; with, but the behavior is slightly different. By default, btcd will query DNS
|
||||
; with, but the behavior is slightly different. By default, lbcd will query DNS
|
||||
; to find peers to connect to, so unless you have a specific reason such as
|
||||
; those described below, you probably won't need to modify anything here.
|
||||
;
|
||||
|
@ -121,7 +121,7 @@
|
|||
; whitelist=192.168.0.0/24
|
||||
; whitelist=fd00::/16
|
||||
|
||||
; Disable DNS seeding for peers. By default, when btcd starts, it will use
|
||||
; Disable DNS seeding for peers. By default, when lbcd starts, it will use
|
||||
; DNS to query for available peers to connect with.
|
||||
; nodnsseed=1
|
||||
|
||||
|
@ -172,7 +172,7 @@
|
|||
|
||||
; ------------------------------------------------------------------------------
|
||||
; RPC server options - The following options control the built-in RPC server
|
||||
; which is used to control and query information from a running btcd process.
|
||||
; which is used to control and query information from a running lbcd process.
|
||||
;
|
||||
; NOTE: The RPC server is disabled by default if rpcuser AND rpcpass, or
|
||||
; rpclimituser AND rpclimitpass, are not specified.
|
||||
|
@ -335,7 +335,7 @@
|
|||
; Debug logging level.
|
||||
; Valid levels are {trace, debug, info, warn, error, critical}
|
||||
; You may also specify <subsystem>=<level>,<subsystem2>=<level>,... to set
|
||||
; log level for individual subsystems. Use btcd --debuglevel=show to list
|
||||
; log level for individual subsystems. Use lbcd --debuglevel=show to list
|
||||
; available subsystems.
|
||||
; debuglevel=info
|
||||
|
|
@ -1,15 +1,11 @@
|
|||
txscript
|
||||
========
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://pkg.go.dev/github.com/btcsuite/btcd/txscript?status.png)](https://pkg.go.dev/github.com/btcsuite/btcd/txscript)
|
||||
|
||||
Package txscript implements the bitcoin transaction script language. There is
|
||||
a comprehensive test suite.
|
||||
|
||||
This package has intentionally been designed so it can be used as a standalone
|
||||
package for any projects needing to use or validate bitcoin transaction scripts.
|
||||
This package has been augmented to include support for LBRY's custom claim operations.
|
||||
See https://lbry.tech/spec
|
||||
|
||||
## Bitcoin Scripts
|
||||
|
||||
|
@ -17,47 +13,3 @@ Bitcoin provides a stack-based, FORTH-like language for the scripts in
|
|||
the bitcoin transactions. This language is not turing complete
|
||||
although it is still fairly powerful. A description of the language
|
||||
can be found at https://en.bitcoin.it/wiki/Script
|
||||
|
||||
## Installation and Updating
|
||||
|
||||
```bash
|
||||
$ go get -u github.com/btcsuite/btcd/txscript
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
* [Standard Pay-to-pubkey-hash Script](https://pkg.go.dev/github.com/btcsuite/btcd/txscript#example-PayToAddrScript)
|
||||
Demonstrates creating a script which pays to a bitcoin address. It also
|
||||
prints the created script hex and uses the DisasmString function to display
|
||||
the disassembled script.
|
||||
|
||||
* [Extracting Details from Standard Scripts](https://pkg.go.dev/github.com/btcsuite/btcd/txscript#example-ExtractPkScriptAddrs)
|
||||
Demonstrates extracting information from a standard public key script.
|
||||
|
||||
* [Manually Signing a Transaction Output](https://pkg.go.dev/github.com/btcsuite/btcd/txscript#example-SignTxOutput)
|
||||
Demonstrates manually creating and signing a redeem transaction.
|
||||
|
||||
## GPG Verification Key
|
||||
|
||||
All official release tags are signed by Conformal so users can ensure the code
|
||||
has not been tampered with and is coming from the btcsuite developers. To
|
||||
verify the signature perform the following:
|
||||
|
||||
- Download the public key from the Conformal website at
|
||||
https://opensource.conformal.com/GIT-GPG-KEY-conformal.txt
|
||||
|
||||
- Import the public key into your GPG keyring:
|
||||
```bash
|
||||
gpg --import GIT-GPG-KEY-conformal.txt
|
||||
```
|
||||
|
||||
- Verify the release tag with the following command where `TAG_NAME` is a
|
||||
placeholder for the specific tag:
|
||||
```bash
|
||||
git tag -v TAG_NAME
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Package txscript is licensed under the [copyfree](http://copyfree.org) ISC
|
||||
License.
|
||||
|
|
|
@ -1,26 +1,14 @@
|
|||
wire
|
||||
====
|
||||
|
||||
[![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions)
|
||||
[![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
|
||||
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/btcsuite/btcd/wire)
|
||||
=======
|
||||
|
||||
Package wire implements the bitcoin wire protocol. A comprehensive suite of
|
||||
tests with 100% test coverage is provided to ensure proper functionality.
|
||||
|
||||
There is an associated blog post about the release of this package
|
||||
[here](https://blog.conformal.com/btcwire-the-bitcoin-wire-protocol-package-from-btcd/).
|
||||
|
||||
This package has intentionally been designed so it can be used as a standalone
|
||||
package for any projects needing to interface with bitcoin peers at the wire
|
||||
protocol level.
|
||||
|
||||
## Installation and Updating
|
||||
|
||||
```bash
|
||||
$ go get -u github.com/btcsuite/btcd/wire
|
||||
```
|
||||
This package has been augmented from the original btcd implementation.
|
||||
The block header was modified to contain the claimtrie hash.
|
||||
|
||||
## Bitcoin Message Overview
|
||||
|
||||
|
@ -86,28 +74,3 @@ from a remote peer is:
|
|||
// Log and handle the error
|
||||
}
|
||||
```
|
||||
|
||||
## GPG Verification Key
|
||||
|
||||
All official release tags are signed by Conformal so users can ensure the code
|
||||
has not been tampered with and is coming from the btcsuite developers. To
|
||||
verify the signature perform the following:
|
||||
|
||||
- Download the public key from the Conformal website at
|
||||
https://opensource.conformal.com/GIT-GPG-KEY-conformal.txt
|
||||
|
||||
- Import the public key into your GPG keyring:
|
||||
```bash
|
||||
gpg --import GIT-GPG-KEY-conformal.txt
|
||||
```
|
||||
|
||||
- Verify the release tag with the following command where `TAG_NAME` is a
|
||||
placeholder for the specific tag:
|
||||
```bash
|
||||
git tag -v TAG_NAME
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Package wire is licensed under the [copyfree](http://copyfree.org) ISC
|
||||
License.
|
||||
|
|
Loading…
Reference in a new issue