[lbry] docs: update docs for LBRY

Co-authored-by: Roy Lee <roylee17@gmail.com>
This commit is contained in:
Brannon King 2021-08-19 14:41:48 -04:00 committed by Roy Lee
parent 1b823c055f
commit 4dd4505706
47 changed files with 836 additions and 3414 deletions

1230
CHANGES

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,6 @@
ISC License ISC License
Copyright (c) 2021 The LBRY developers
Copyright (c) 2013-2017 The btcsuite developers Copyright (c) 2013-2017 The btcsuite developers
Copyright (c) 2015-2016 The Decred developers Copyright (c) 2015-2016 The Decred developers

168
README.md
View file

@ -1,121 +1,133 @@
btcd # lbcd
====
[![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)
[![Coverage Status](https://coveralls.io/repos/github/btcsuite/btcd/badge.svg?branch=master)](https://coveralls.io/github/btcsuite/btcd?branch=master) [![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) [![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 This project is currently under active development and is in a Beta state while
is extremely stable and has been in production use since October 2013. 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 Note: `lbcd` does *NOT* include wallet functionality. That functionality is provided by the
rules (including consensus bugs) for block acceptance as Bitcoin Core. We have [lbcwallet](https://github.com/lbryio/lbcwallet) and the [LBRY SDK](https://github.com/lbryio/lbry-sdk).
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 ## Security
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 We take security seriously. Please contact [security](mailto:security@lbry.com) regarding any security issues.
wallet functionality and this was a very intentional design decision. See the Our PGP key is [here](https://lbry.com/faq/pgp-key) if you need it.
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 We maintain a mailing list for notifications of upgrades, security issues,
directly with btcd. That functionality is provided by the and soft/hard forks. To join, visit [fork list](https://lbry.com/forklist)
[btcwallet](https://github.com/btcsuite/btcwallet) and
[Paymetheus](https://github.com/btcsuite/Paymetheus) (Windows-only) projects
which are both under active development.
## Requirements ## Requirements
[Go](http://golang.org) 1.16 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 ## Installation
https://github.com/btcsuite/btcd/releases Acquire binary files from [releases](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: Install Go according to its [installation instructions](http://golang.org/doc/install).
http://golang.org/doc/install
- Ensure Go was installed properly and is a supported version: ``` sh
git clone https://github.com/lbryio/lbcd
cd lbcd
```bash # Build lbcd
$ go version go build .
$ go env GOROOT GOPATH
# Build lbcctl
go build ./cmd/lbcctl
``` ```
NOTE: The `GOROOT` and `GOPATH` above must not be the same path. It is Both [GoLand](https://www.jetbrains.com/go/)
recommended that `GOPATH` is set to a directory in your home directory such as and [VS Code](https://code.visualstudio.com/docs/languages/go) IDEs are supported.
`~/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: ## Usage
```bash By default, data and logs are stored in `<LBCDDIR>`:
$ cd $GOPATH/src/github.com/btcsuite/btcd
$ GO111MODULE=on go install -v . ./cmd/... - Linux: `~/.lbcd/`
- MacOS: `/Users/<username>/Library/Application Support/Lbcd/`
To enable RPC access a username and password is required. Example:
``` sh
./lbcd --rpcuser=rpcuser --rpcpass=rpcpass
``` ```
- btcd (and utilities) will now be installed in ```$GOPATH/bin```. If you did Interact with lbcd via RPC using `lbcctl`
not already add the bin directory to your system path during Go installation,
we recommend you do so now.
## Updating ``` sh
./lbcctl --rpcuser=rpcuser --rpcpass=rpcpass getblockcount
#### Linux/BSD/MacOSX/POSIX - Build from Source ./lbcctl --rpcuser=rpcuser --rpcpass=rpcpass getblocktemplate
- 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 By default, the RPCs are served over TLS. `lbcd` generates (if not exists) `rpc.cert` and
`rpc.key` under `<LBCDDIR>` where `lbcctl` would search and use them.
btcd has several configuration options available to tweak how it runs, but all The RPCs can also be served without TLS *(on localhost only)* using (`--notls`)
of the basic operations described in the intro section work with zero
configuration.
#### Linux/BSD/POSIX/Source ``` sh
./lbcd --rpcuser=rpcuser --rpcpass=rpcpass --notls
```bash ./lbcctl --rpcuser=rpcuser --rpcpass=rpcpass --notls getblockcount
$ ./btcd
``` ```
## IRC ## Working with Different Networks
- irc.libera.chat By default, `lbcd` and `lbcctl` use the following ports for different networks respectively:
- channel #btcd
- [webchat](https://web.libera.chat/gamja/?channels=btcd)
## Issue Tracker | Network | RPC Port | Network Port |
| ------- | -------- | ------------ |
| mainnet | 9245 | 9246 |
| testnet | 19245 | 19246 |
| regtest | 29245 | 29246 |
The [integrated github issue tracker](https://github.com/btcsuite/btcd/issues) Running `lbcd` and `lbcctl` with `--testnet` or `--regtest` would use different chain params as well as default RPC and Network ports.
is used for this project.
## Documentation ``` sh
./lbcd --rpcuser=rpcuser --rpcpass=rpcpass --regtest
./lbcctl --rpcuser=rpcuser --rpcpass=rpcpass --regtest getblockcount
```
The documentation is a work-in-progress. It is located in the [docs](https://github.com/btcsuite/btcd/tree/master/docs) folder. The default Network and RPC ports of `lbcd` can be overriden using `--listen` and `--rpclisten`
`lbcctl` can also connect to RPC server specified by `--rpcserver`
## Release Verification ``` sh
./lbcd --rpcuser=rpcuser --rpcpass=rpcpass --regtest --listen=127.0.0.1:29248 --rpclisten=127.0.0.1:29247
./lbcctl --rpcuser=rpcuser --rpcpass=rpcpass --regtest --rpcserver=127.0.0.1:29247 getblockcount
```
Note: Wallet related RPCs are provided by [lbcwallet](https://github.com/lbryio/lbcwallet).
## Contributing
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 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 releases for information on how to verify the integrity of published releases
using our reproducible build system. using our reproducible build system.
-->
## License ## License
btcd is licensed under the [copyfree](http://copyfree.org) ISC License. lbcd is licensed under the [copyfree](http://copyfree.org) ISC License.

View file

@ -1,30 +1,9 @@
blockchain 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) [![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. ### Bitcoin Chain Processing Overview
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
Before a block is allowed into the block chain, it must go through an intensive 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 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 - Run the transaction scripts to verify the spender is allowed to spend the
coins coins
- Insert the block into the block database - 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.

View file

@ -1,9 +1,9 @@
fullblocktests 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) [![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 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 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 ## Installation and Updating
```bash ```bash
$ go get -u github.com/btcsuite/btcd/blockchain/fullblocktests $ go get -u github.com/lbryio/lbcd/blockchain/fullblocktests
``` ```
## License ## License

View file

@ -1,9 +1,9 @@
indexers 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) [![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. Package indexers implements optional block chain indexes.
@ -23,7 +23,7 @@ via an RPC interface.
## Installation ## Installation
```bash ```bash
$ go get -u github.com/btcsuite/btcd/blockchain/indexers $ go get -u github.com/lbryio/lbcd/blockchain/indexers
``` ```
## License ## License

View file

@ -1,68 +1,11 @@
btcec 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) [![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 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 standard crypto/ecdsa packages provided with go. A comprehensive suite of test
is provided to ensure proper functionality. Package btcec was originally based 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 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 signficantly diverged since then.
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.

View file

@ -1,70 +1,8 @@
btcjson 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) [![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 Package btcjson implements concrete types for marshalling to and from the
bitcoin JSON-RPC API. A comprehensive suite of tests is provided to ensure bitcoin JSON-RPC API. A comprehensive suite of tests is provided to ensure
proper functionality. 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.

View file

@ -1,85 +1,8 @@
chaincfg 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) [![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 Package chaincfg defines chain configuration parameters for the three standard
Bitcoin networks and provides the ability for callers to define their own custom LBRY networks and provides the ability for callers to define their own custom
Bitcoin networks. LBRY 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.

View file

@ -1,9 +1,9 @@
chainhash 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) [![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 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 ## Installation and Updating
```bash ```bash
$ go get -u github.com/btcsuite/btcd/chaincfg/chainhash $ go get -u github.com/lbryio/lbcd/chaincfg/chainhash
``` ```
## GPG Verification Key ## GPG Verification Key

View file

@ -1,13 +1,11 @@
connmgr 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) [![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 Connection Manager handles all the general connection concerns such as
maintaining a set number of outbound connections, sourcing peers, banning, 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 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. 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 - Notifications on connections or disconnections
- Handle failures and retry new addresses from the source - Handle failures and retry new addresses from the source
- Connect only to specified addresses - Connect only to specified addresses
- Permanent connections with increasing backoff retry timers - Permanent connections with increasing backoff retry timers
- Disconnect or Remove an established connection - 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.

View file

@ -1,9 +1,7 @@
database 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) [![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. 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. and that entity will be btcd.
When a client wants programmatic access to the data provided by btcd, they'll 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) 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/btcsuite/btcd/tree/master/docs/json_rpc_api.md). 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 However, this package could be extremely useful for any applications requiring
Bitcoin block storage capabilities. 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 - Iteration support including cursors with seek capability
- Supports registration of backend databases - Supports registration of backend databases
- Comprehensive test coverage - 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.

View file

@ -1,9 +1,9 @@
ffldb 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) [![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 Package ffldb implements a driver for the database package that uses leveldb for

View file

@ -1,9 +1,9 @@
treap 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) [![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 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. key/value pairs using a combination of binary search tree and heap semantics.

6
doc.go
View file

@ -71,8 +71,8 @@ Application Options:
fee to the given amount in thousands of bytes per fee to the given amount in thousands of bytes per
minute (default: 15) minute (default: 15)
--listen= Add an interface/port to listen for connections --listen= Add an interface/port to listen for connections
(default all interfaces port: 8333, testnet: (default all interfaces port: 9246, testnet:
18333, signet: 38333) 19246, regtest: 29246, signet: 39246)
--logdir= Directory to log output --logdir= Directory to log output
--maxorphantx= Max number of orphan transactions to keep in --maxorphantx= Max number of orphan transactions to keep in
memory (default: 100) memory (default: 100)
@ -123,7 +123,7 @@ Application Options:
--rpclimitpass= Password for limited RPC connections --rpclimitpass= Password for limited RPC connections
--rpclimituser= Username for limited RPC connections --rpclimituser= Username for limited RPC connections
--rpclisten= Add an interface/port to listen for RPC --rpclisten= Add an interface/port to listen for RPC
connections (default port: 8334, testnet: 18334) connections (default port: 9245, testnet: 19245, regtest: 29245)
--rpcmaxclients= Max number of RPC clients for standard --rpcmaxclients= Max number of RPC clients for standard
connections (default: 10) connections (default: 10)
--rpcmaxconcurrentreqs= Max number of concurrent RPC requests that may be --rpcmaxconcurrentreqs= Max number of concurrent RPC requests that may be

View file

@ -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.
Heres 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 doesnt 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, were 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 theres 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
- [&nbsp;&nbsp;] All changes are Go version 1.3 compliant
- [&nbsp;&nbsp;] The code being submitted is commented according to the
[Code Documentation and Commenting](#CodeDocumentation) section
- [&nbsp;&nbsp;] For new code: Code is accompanied by tests which exercise both
the positive and negative (error paths) conditions (if applicable)
- [&nbsp;&nbsp;] For bug fixes: Code is accompanied by new tests which trigger
the bug being fixed to prevent regressions
- [&nbsp;&nbsp;] Any new logging statements use an appropriate subsystem and
logging level
- [&nbsp;&nbsp;] Code has been formatted with `go fmt`
- [&nbsp;&nbsp;] Running `go test` does not fail any tests
- [&nbsp;&nbsp;] Running `go vet` does not report any issues
- [&nbsp;&nbsp;] 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.

View file

@ -1,11 +1,11 @@
# Configuration # Configuration
btcd has a number of [configuration](https://pkg.go.dev/github.com/btcsuite/btcd) lbcd has a number of configuration
options, which can be viewed by running: `$ btcd --help`. options, which can be viewed by running: `$ lbcd --help`.
## Peer server listen interface ## 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 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 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). configuration file without the -- prefix (as can all long command line options).
@ -17,41 +17,41 @@ interfaces as a couple of the examples below illustrate.
Command Line Examples: Command Line Examples:
| Flags | Comment | | Flags | Comment |
|----------|------------| | ------------------------------------------- | -------------------------------------------------------------------------------------------- |
| --listen= | all interfaces on default port which is changed by `--testnet` and `--regtest` (**default**) | | --listen= | all interfaces on default port which is changed by `--testnet` and `--regtest` (**default**) |
| --listen=0.0.0.0 | all IPv4 interfaces on default port which is changed by `--testnet` and `--regtest` | | --listen=0.0.0.0 | all IPv4 interfaces on default port which is changed by `--testnet` and `--regtest` |
| --listen=:: | all IPv6 interfaces on default port which is changed by `--testnet` and `--regtest` | | --listen=:: | all IPv6 interfaces on default port which is changed by `--testnet` and `--regtest` |
|--listen=:8333|all interfaces on port 8333| | --listen=:9246 | all interfaces on port 9246 |
|--listen=0.0.0.0:8333|all IPv4 interfaces on port 8333| | --listen=0.0.0.0:9246 | all IPv4 interfaces on port 9246 |
|--listen=[::]:8333|all IPv6 interfaces on port 8333| | --listen=[::]:9246 | all IPv6 interfaces on port 9246 |
|--listen=127.0.0.1:8333|only IPv4 localhost on port 8333| | --listen=127.0.0.1:9246 | only IPv4 localhost on port 9246 |
|--listen=[::1]:8333|only IPv6 localhost on port 8333| | --listen=[::1]:9246 | only IPv6 localhost on port 9246 |
|--listen=:8336|all interfaces on non-standard port 8336| | --listen=:9247 | all interfaces on non-standard port 9247 |
|--listen=0.0.0.0:8336|all IPv4 interfaces on non-standard port 8336| | --listen=0.0.0.0:9247 | all IPv4 interfaces on non-standard port 9247 |
|--listen=[::]:8336|all IPv6 interfaces on non-standard port 8336| | --listen=[::]:9247 | all IPv6 interfaces on non-standard port 9247 |
|--listen=127.0.0.1:8337 --listen=[::1]:8333|IPv4 localhost on port 8337 and IPv6 localhost on port 8333| | --listen=127.0.0.1:9248 --listen=[::1]:9246 | IPv4 localhost on port 9248 and IPv6 localhost on port 9246 |
|--listen=:8333 --listen=:8337|all interfaces on ports 8333 and 8337| | --listen=:9246 --listen=:9248 | all interfaces on ports 9246 and 9248 |
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 ```text
[Application Options] [Application Options]
listen=127.0.0.1:8333 listen=127.0.0.1:9246
listen=[::1]:8333 listen=[::1]:9246
``` ```
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 available via a hostname, then you will need to generate the TLS
certificates for that host. For example, 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 ## 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` to setup configurations with varying levels of complexity. The `rpclisten`
parameter can be specified on the command line as shown below with the -- prefix 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 or in the configuration file without the -- prefix (as can all long command line
@ -77,22 +77,22 @@ A few things to note regarding the RPC server:
Command Line Examples: Command Line Examples:
| Flags | Comment | | Flags | Comment |
|----------|------------| | ---------------------------------------------- | ------------------------------------------------------------------- |
| --rpclisten= | all interfaces on default port which is changed by `--testnet` | | --rpclisten= | all interfaces on default port which is changed by `--testnet` |
| --rpclisten=0.0.0.0 | all IPv4 interfaces on default port which is changed by `--testnet` | | --rpclisten=0.0.0.0 | all IPv4 interfaces on default port which is changed by `--testnet` |
| --rpclisten=:: | all IPv6 interfaces on default port which is changed by `--testnet` | | --rpclisten=:: | all IPv6 interfaces on default port which is changed by `--testnet` |
|--rpclisten=:8334|all interfaces on port 8334| | --rpclisten=:9245 | all interfaces on port 9245 |
|--rpclisten=0.0.0.0:8334|all IPv4 interfaces on port 8334| | --rpclisten=0.0.0.0:9245 | all IPv4 interfaces on port 9245 |
|--rpclisten=[::]:8334|all IPv6 interfaces on port 8334| | --rpclisten=[::]:9245 | all IPv6 interfaces on port 9245 |
|--rpclisten=127.0.0.1:8334|only IPv4 localhost on port 8334| | --rpclisten=127.0.0.1:9245 | only IPv4 localhost on port 9245 |
|--rpclisten=[::1]:8334|only IPv6 localhost on port 8334| | --rpclisten=[::1]:9245 | only IPv6 localhost on port 9245 |
|--rpclisten=:8336|all interfaces on non-standard port 8336| | --rpclisten=:9247 | all interfaces on non-standard port 9247 |
|--rpclisten=0.0.0.0:8336|all IPv4 interfaces on non-standard port 8336| | --rpclisten=0.0.0.0:9247 | all IPv4 interfaces on non-standard port 9247 |
|--rpclisten=[::]:8336|all IPv6 interfaces on non-standard port 8336| | --rpclisten=[::]:9247 | all IPv6 interfaces on non-standard port 9247 |
|--rpclisten=127.0.0.1:8337 --listen=[::1]:8334|IPv4 localhost on port 8337 and IPv6 localhost on port 8334| | --rpclisten=127.0.0.1:9248 --listen=[::1]:9245 | IPv4 localhost on port 9248 and IPv6 localhost on port 9245 |
|--rpclisten=:8334 --listen=:8337|all interfaces on ports 8334 and 8337| | --rpclisten=:9245 --listen=:9248 | all interfaces on ports 9245 and 9248 |
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 ```text
[Application Options] [Application Options]
@ -102,21 +102,21 @@ rpclisten=
## Default ports ## 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 the following is intended to be a quick reference for the default ports used so
port forwarding can be configured as required. 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 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 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 access to your lbcd from external sources such as in more advanced network
configurations. configurations. You can disable UPnP with the `--noupnp` daemon option.
| Name | Port | | Name | Port |
|----|----| | ------------------------- | -------- |
|Default Bitcoin peer-to-peer port|TCP 8333| | Default peer-to-peer port | TCP 9246 |
|Default RPC port|TCP 8334| | Default RPC port | TCP 9245 |
## Using bootstrap.dat ## 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 See [this](https://bitcointalk.org/index.php?topic=145386.0) thread on
bitcointalk for more details. 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 block chain from other peers through the Bitcoin protocol with no extra
configuration needed. 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 that not only is it a valid chain, but it is the same chain that everyone else
is using. 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 `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. 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 1. Stop lbcd 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. 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. 2. Note the path to the downloaded bootstrap.dat file.
3. Run the addblock utility with the `-i` argument pointing to the location of 3. Run the addblock utility with the `-i` argument pointing to the location of
boostrap.dat: boostrap.dat:
@ -180,7 +180,7 @@ and we prefer to keep the daemon itself as lightweight as possible.
**Windows:** **Windows:**
```bat ```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:** **Linux/Unix/BSD/POSIX:**

View file

@ -1,9 +1,9 @@
# Configuring TOR # 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) [Tor Project](https://www.torproject.org/), including [client-only](#Client)
and [hidden service](#HiddenService) configurations along with 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 mode](#Bridge) which is not anonymous, but allows it to operate as a
bridge between regular nodes and hidden service nodes without routing the bridge between regular nodes and hidden service nodes without routing the
regular connections through Tor. regular connections through Tor.
@ -15,15 +15,15 @@ hidden service for this reason.
## Client-only ## 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 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 typically needs to be done is to specify the `--proxy` flag via the lbcd command
line or in the btcd configuration file. Typically the Tor proxy address will be 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 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, Browser Bundle). If you have Tor configured to require a username and password,
you may specify them with the `--proxyuser` and `--proxypass` flags. 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 hence will send all traffic, including DNS resolution requests, via the
specified proxy. specified proxy.
@ -34,7 +34,7 @@ not be reachable for inbound connections unless you also configure a Tor
### Command line example ### Command line example
```bash ```bash
./btcd --proxy=127.0.0.1:9050 ./lbcd --proxy=127.0.0.1:9050
``` ```
### Config file example ### 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 for this can be found on the Tor project website
[here](https://www.torproject.org/docs/tor-hidden-service.html.en). However, [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 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 In short, the instructions linked above entail modifying your `torrc` file to
add something similar to the following, restarting Tor, and opening the 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. address.
```text ```text
HiddenServiceDir /var/tor/btcd HiddenServiceDir /var/tor/lbcd
HiddenServicePort 8333 127.0.0.1:8333 HiddenServicePort 9246 127.0.0.1:9246
``` ```
Once Tor is configured to provide the hidden service and you have obtained your 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: three flags:
* `--proxy` to identify the Tor (SOCKS 5) proxy to use for outgoing traffic. * `--proxy` to identify the Tor (SOCKS 5) proxy to use for outgoing traffic.
@ -76,7 +76,7 @@ three flags:
### Command line example ### Command line example
```bash ```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 ### Config file example
@ -91,13 +91,13 @@ externalip=fooanon.onion
## Bridge mode (not anonymous) ## 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 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. from a .onion address is sent through Tor while other traffic is sent normally.
_As a result, this mode is **NOT** anonymous._ _As a result, this mode is **NOT** anonymous._
This mode works by specifying an onion-specific proxy, which is pointed at Tor, 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 configuration file. If you have Tor configured to require a username and
password, you may specify them with the `--onionuser` and `--onionpass` flags. 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 ### Command line example
```bash ```bash
./btcd --onion=127.0.0.1:9050 --externalip=fooanon.onion ./lbcd --onion=127.0.0.1:9050 --externalip=fooanon.onion
``` ```
### Config file example ### Config file example
@ -128,13 +128,13 @@ externalip=fooanon.onion
Tor stream isolation forces Tor to build a new circuit for each connection Tor stream isolation forces Tor to build a new circuit for each connection
making it harder to correlate connections. 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. flag. This option requires --proxy or --onionproxy to be set.
### Command line example ### Command line example
```bash ```bash
./btcd --proxy=127.0.0.1:9050 --torisolation ./lbcd --proxy=127.0.0.1:9050 --torisolation
``` ```
### Config file example ### Config file example

View file

@ -1,15 +0,0 @@
# Contact
## IRC
* [irc.libera.chat](irc://irc.libera.chat), 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.

View file

@ -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 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). btcd does 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 **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: RPC username and password or both an RPC limited username and password:
* btcd.conf configuration file * lbcd.conf configuration file
```bash ```bash
[Application Options] [Application Options]
@ -15,7 +15,7 @@ rpclimituser=mylimituser
rpclimitpass=Limitedp4ssw0rd rpclimitpass=Limitedp4ssw0rd
``` ```
* btcctl.conf configuration file * lbcctl.conf configuration file
```bash ```bash
[Application Options] [Application Options]
@ -31,4 +31,4 @@ rpclimituser=mylimituser
rpclimitpass=Limitedp4ssw0rd rpclimitpass=Limitedp4ssw0rd
``` ```
For a list of available options, run: `$ btcctl --help` For a list of available options, run: `$ lbcctl --help`

View file

@ -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.

View file

@ -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) [![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 ## Contents
* [Installation](installation.md)
* [Update](update.md)
* [Configuration](configuration.md) * [Configuration](configuration.md)
* [Configuring TOR](configuring_tor.md) * [Configuring TOR](configuring_tor.md)
* [Docker](using_docker.md)
* [Controlling](controlling.md) * [Controlling](controlling.md)
* [Mining](mining.md) * [Mining](mining.md)
* [Wallet](wallet.md)
* [Developer resources](developer_resources.md)
* [JSON RPC API](json_rpc_api.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.

View file

@ -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.16 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)

View file

@ -27,27 +27,19 @@
### 1. Overview ### 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 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: differences between lbcd and bitcoind as far as how RPCs are serviced:
* Unlike bitcoind that has the wallet and chain intermingled in the same process * lbcd is secure by default which means that the RPC connection is TLS-enabled
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
by default 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 [HTTP POST](http://en.wikipedia.org/wiki/POST_%28HTTP%29) requests and
[Websockets](http://en.wikipedia.org/wiki/WebSocket) [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 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:8334/ws`. `wss://your_ip_or_domain:9245/ws`.
In addition to the [standard API](#Methods), an [extension API](#WSExtMethods) In addition to the [standard API](#Methods), an [extension API](#WSExtMethods)
has been developed that is exclusive to clients using Websockets. In its current has been developed that is exclusive to clients using Websockets. In its current
@ -64,7 +56,7 @@ The original bitcoind/bitcoin-qt JSON-RPC API documentation is available at [htt
### 2. HTTP POST Versus Websockets ### 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). requests and the preferred [Websockets](http://en.wikipedia.org/wiki/WebSocket).
All of the [standard](#Methods) and [extension](#ExtensionMethods) methods All of the [standard](#Methods) and [extension](#ExtensionMethods) methods
described in this documentation can be accessed through both. As the name described in this documentation can be accessed through both. As the name
@ -72,13 +64,13 @@ indicates, the [Websocket-specific extension](#WSExtMethods) methods can only be
accessed when connected via Websockets. accessed when connected via Websockets.
As mentioned in the [overview](#Overview), the websocket connection endpoint for As mentioned in the [overview](#Overview), the websocket connection endpoint for
btcd is `wss://your_ip_or_domain:8334/ws`. lbcd is `wss://your_ip_or_domain:9245/ws`.
The most important differences between the two transports as it pertains to the The most important differences between the two transports as it pertains to the
JSON-RPC API are: JSON-RPC API are:
| | HTTP POST Requests | Websockets | | | HTTP POST Requests | Websockets |
|---|------------------|----------| | --------------------------------------------------- | ------------------ | ---------- |
| Allows multiple requests across a single connection | No | Yes | | Allows multiple requests across a single connection | No | Yes |
| Supports asynchronous notifications | No | Yes | | Supports asynchronous notifications | No | Yes |
| Scales well with large numbers of requests | No | Yes | | Scales well with large numbers of requests | No | Yes |
@ -92,18 +84,18 @@ JSON-RPC API are:
**3.1 Authentication Overview**<br /> **3.1 Authentication Overview**<br />
The following authentication details are needed before establishing a connection 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 * **rpcuser** is the full-access username configured for the lbcd RPC server
* **rpcpass** is the full-access password configured for the btcd RPC server * **rpcpass** is the full-access password configured for the lbcd RPC server
* **rpclimituser** is the limited username configured for the btcd RPC server * **rpclimituser** is the limited username configured for the lbcd RPC server
* **rpclimitpass** is the limited password configured for the btcd 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 btcd * **rpccert** is the PEM-encoded X.509 certificate (public key) that the lbcd
server is configured with. It is automatically generated by btcd and placed server is configured with. It is automatically generated by lbcd and placed
in the btcd home directory (which is typically `%LOCALAPPDATA%\Btcd` on in the lbcd home directory (which is typically `%LOCALAPPDATA%\lbcd` on
Windows and `~/.btcd` on POSIX-like OSes) 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** server is not running unless configured with a **rpcuser** and **rpcpass**
and/or a **rpclimituser** and **rpclimitpass**, and uses TLS authentication for and/or a **rpclimituser** and **rpclimitpass**, and uses TLS authentication for
all connections. all connections.
@ -117,7 +109,7 @@ two, mutually exclusive, methods.
**3.2 HTTP Basic Access Authentication**<br /> **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 and **rpcpass** detailed above. If the supplied credentials are invalid, you
will be disconnected immediately upon making the connection. 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 ### 4. Command-line Utility
btcd comes with a separate utility named `btcctl` which can be used to issue lbcd comes with a separate utility named `lbcctl` which can be used to issue
these RPC commands via HTTP POST requests to btcd after configuring it with the these RPC commands via HTTP POST requests to lbcd after configuring it with the
information in the [Authentication](#Authentication) section above. It can also information in the [Authentication](#Authentication) section above. It can also
be used to communicate with any server/daemon/service which provides a JSON-RPC be used to communicate with any server/daemon/service which provides a JSON-RPC
API compatible with the original bitcoind/bitcoin-qt client. API compatible with the original bitcoind/bitcoin-qt client.
@ -157,7 +149,7 @@ The following is an overview of the RPC methods and their current status. Click
the method name for further details such as parameter and return information. the method name for further details such as parameter and return information.
| # | Method | Safe for limited user? | Description | | # | Method | Safe for limited user? | Description |
|---|------|----------|-----------| | --- | --------------------------------------------- | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1 | [addnode](#addnode) | N | Attempts to add or remove a persistent peer. | | 1 | [addnode](#addnode) | N | Attempts to add or remove a persistent peer. |
| 2 | [createrawtransaction](#createrawtransaction) | Y | Returns a new transaction spending the provided inputs and sending to the provided addresses. | | 2 | [createrawtransaction](#createrawtransaction) | Y | Returns a new transaction spending the provided inputs and sending to the provided addresses. |
| 3 | [decoderawtransaction](#decoderawtransaction) | Y | Returns a JSON object representing the provided serialized, hex-encoded transaction. | | 3 | [decoderawtransaction](#decoderawtransaction) | Y | Returns a JSON object representing the provided serialized, hex-encoded transaction. |
@ -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. | | 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. | | 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. | | 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>| | 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 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.| | 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 btcd.| | 27 | [stop](#stop) | N | Shutdown lbcd. |
| 28 | [submitblock](#submitblock) | Y | Attempts to submit a new serialized, hex-encoded block to the network. | | 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. | | 30 | [verifychain](#verifychain) | N | Verifies the block chain database. |
<a name="MethodDetails" /> <a name="MethodDetails" />
@ -196,7 +188,7 @@ the method name for further details such as parameter and return information.
<a name="addnode"/> <a name="addnode"/>
| | | | | |
|---|---| | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | addnode | | Method | addnode |
| Parameters | 1. peer (string, required) - ip address and port of the peer to operate on<br />2. command (string, required) - `add` to add a persistent peer, `remove` to remove a persistent peer, or `onetry` to try a single connection to a peer | | Parameters | 1. peer (string, required) - ip address and port of the peer to operate on<br />2. command (string, required) - `add` to add a persistent peer, `remove` to remove a persistent peer, or `onetry` to try a single connection to a peer |
| Description | Attempts to add or remove a persistent peer. | | Description | Attempts to add or remove a persistent peer. |
@ -207,7 +199,7 @@ the method name for further details such as parameter and return information.
<a name="createrawtransaction"/> <a name="createrawtransaction"/>
| | | | | |
|---|---| | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | createrawtransaction | | Method | createrawtransaction |
| Parameters | 1. transaction inputs (JSON array, required) - json array of json objects<br />`[`<br />&nbsp;&nbsp;`{`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"txid": "hash", (string, required) the hash of the input transaction`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"vout": n (numeric, required) the specific output of the input transaction to redeem`<br />&nbsp;&nbsp;`}, ...`<br />`]`<br />2. addresses and amounts (JSON object, required) - json object with addresses as keys and amounts as values<br />`{`<br />&nbsp;&nbsp;`"address": n.nnn (numeric, required) the address to send to as the key and the amount in BTC as the value`<br />&nbsp;&nbsp;`, ...`<br />`}`<br />3. locktime (int64, optional, default=0) - specifies the transaction locktime. If non-zero, the inputs will also have their locktimes activated. | | Parameters | 1. transaction inputs (JSON array, required) - json array of json objects<br />`[`<br />&nbsp;&nbsp;`{`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"txid": "hash", (string, required) the hash of the input transaction`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"vout": n (numeric, required) the specific output of the input transaction to redeem`<br />&nbsp;&nbsp;`}, ...`<br />`]`<br />2. addresses and amounts (JSON object, required) - json object with addresses as keys and amounts as values<br />`{`<br />&nbsp;&nbsp;`"address": n.nnn (numeric, required) the address to send to as the key and the amount in BTC as the value`<br />&nbsp;&nbsp;`, ...`<br />`}`<br />3. locktime (int64, optional, default=0) - specifies the transaction locktime. If non-zero, the inputs will also have their locktimes activated. |
| Description | Returns a new transaction spending the provided inputs and sending to the provided addresses.<br />The transaction inputs are not signed in the created transaction.<br />The `signrawtransaction` RPC command provided by wallet must be used to sign the resulting transaction. | | Description | Returns a new transaction spending the provided inputs and sending to the provided addresses.<br />The transaction inputs are not signed in the created transaction.<br />The `signrawtransaction` RPC command provided by wallet must be used to sign the resulting transaction. |
@ -220,7 +212,7 @@ the method name for further details such as parameter and return information.
<a name="decoderawtransaction"/> <a name="decoderawtransaction"/>
| | | | | |
|---|---| | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | decoderawtransaction | | Method | decoderawtransaction |
| Parameters | 1. data (string, required) - serialized, hex-encoded transaction | | Parameters | 1. data (string, required) - serialized, hex-encoded transaction |
| Description | Returns a JSON object representing the provided serialized, hex-encoded transaction. | | Description | Returns a JSON object representing the provided serialized, hex-encoded transaction. |
@ -232,7 +224,7 @@ the method name for further details such as parameter and return information.
<a name="decodescript"/> <a name="decodescript"/>
| | | | | |
|---|---| | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | decodescript | | Method | decodescript |
| Parameters | 1. script (string, required) - hex-encoded script | | Parameters | 1. script (string, required) - hex-encoded script |
| Description | Returns a JSON object with information about the provided hex-encoded script. | | Description | Returns a JSON object with information about the provided hex-encoded script. |
@ -244,21 +236,21 @@ the method name for further details such as parameter and return information.
<a name="getaddednodeinfo"/> <a name="getaddednodeinfo"/>
| | | | | |
|---|---| | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | getaddednodeinfo | | Method | getaddednodeinfo |
| Parameters | 1. dns (boolean, required) - specifies whether the returned data is a JSON object including DNS and connection information, or just a list of added peers<br />2. node (string, optional) - only return information about this specific peer instead of all added peers. | | Parameters | 1. dns (boolean, required) - specifies whether the returned data is a JSON object including DNS and connection information, or just a list of added peers<br />2. node (string, optional) - only return information about this specific peer instead of all added peers. |
| Description | Returns information about manually added (persistent) peers. | | Description | Returns information about manually added (persistent) peers. |
| Returns (dns=false) | `["ip:port", ...]` | | Returns (dns=false) | `["ip:port", ...]` |
| Returns (dns=true) | `[ (json array of objects)`<br />&nbsp;&nbsp;`{ (json object)`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"addednode": "ip_or_domain", (string) the ip address or domain of the added peer`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"connected": true or false, (boolean) whether or not the peer is currently connected`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"addresses": [ (json array or objects) DNS lookup and connection information about the peer`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`{ (json object)`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`"address": "ip", (string) the ip address for this DNS entry`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`"connected": "inbound/outbound/false" (string) the connection 'direction' (if connected)`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`}, ...`<br />&nbsp;&nbsp;&nbsp;&nbsp;`]`<br />&nbsp;&nbsp;`}, ...`<br />`]` | | Returns (dns=true) | `[ (json array of objects)`<br />&nbsp;&nbsp;`{ (json object)`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"addednode": "ip_or_domain", (string) the ip address or domain of the added peer`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"connected": true or false, (boolean) whether or not the peer is currently connected`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"addresses": [ (json array or objects) DNS lookup and connection information about the peer`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`{ (json object)`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`"address": "ip", (string) the ip address for this DNS entry`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`"connected": "inbound/outbound/false" (string) the connection 'direction' (if connected)`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`}, ...`<br />&nbsp;&nbsp;&nbsp;&nbsp;`]`<br />&nbsp;&nbsp;`}, ...`<br />`]` |
|Example Return (dns=false)|`["192.168.0.10:8333", "mydomain.org:8333"]`| | Example Return (dns=false) | `["192.168.0.10:9246", "mydomain.org:9246"]` |
|Example Return (dns=true)|`[`<br />&nbsp;&nbsp;`{`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"addednode": "mydomain.org:8333",`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"connected": true,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"addresses": [`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`{`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`"address": "1.2.3.4",`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`"connected": "outbound"`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`},`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`{`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`"address": "5.6.7.8",`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`"connected": "false"`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`}`<br />&nbsp;&nbsp;&nbsp;&nbsp;`]`<br />&nbsp;&nbsp;`}`<br />`]`| | Example Return (dns=true) | `[`<br />&nbsp;&nbsp;`{`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"addednode": "mydomain.org:9246",`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"connected": true,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"addresses": [`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`{`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`"address": "1.2.3.4",`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`"connected": "outbound"`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`},`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`{`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`"address": "5.6.7.8",`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`"connected": "false"`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`}`<br />&nbsp;&nbsp;&nbsp;&nbsp;`]`<br />&nbsp;&nbsp;`}`<br />`]` |
[Return to Overview](#MethodOverview)<br /> [Return to Overview](#MethodOverview)<br />
*** ***
<a name="getbestblockhash"/> <a name="getbestblockhash"/>
| | | | | |
|---|---| | -------------- | ----------------------------------------------------------------------------------- |
| Method | getbestblockhash | | Method | getbestblockhash |
| Parameters | None | | Parameters | None |
| Description | Returns the hash of the of the best (most recent) block in the longest block chain. | | Description | Returns the hash of the of the best (most recent) block in the longest block chain. |
@ -270,9 +262,9 @@ the method name for further details such as parameter and return information.
<a name="getblock"/> <a name="getblock"/>
| | | | | |
|---|---| | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | getblock | | Method | getblock |
|Parameters|1. block hash (string, required) - the hash of the block<br />2. verbosity (int, optional, default=1) - Specifies whether the block data should be returned as a hex-encoded string (0), as parsed data with a slice of TXIDs (1), or as parsed data with parsed transaction data (2). | Parameters | 1. block hash (string, required) - the hash of the block<br />2. verbosity (int, optional, default=1) - Specifies whether the block data should be returned as a hex-encoded string (0), as parsed data with a slice of TXIDs (1), or as parsed data with parsed transaction data (2). |
| Description | Returns information about a block given its hash. | | Description | Returns information about a block given its hash. |
| Returns (verbosity=0) | `"data" (string) hex-encoded bytes of the serialized block` | | Returns (verbosity=0) | `"data" (string) hex-encoded bytes of the serialized block` |
| Returns (verbosity=1) | `{ (json object)`<br />&nbsp;&nbsp;`"hash": "blockhash", (string) the hash of the block (same as provided)`<br />&nbsp;&nbsp;`"confirmations": n, (numeric) the number of confirmations`<br />&nbsp;&nbsp;`"strippedsize", n (numeric) the size of the block without witness data`<br />&nbsp;&nbsp;`"size": n, (numeric) the size of the block`<br />&nbsp;&nbsp;`"weight": n, (numeric) value of the weight metric`<br />&nbsp;&nbsp;`"height": n, (numeric) the height of the block in the block chain`<br />&nbsp;&nbsp;`"version": n, (numeric) the block version`<br />&nbsp;&nbsp;`"merkleroot": "hash", (string) root hash of the merkle tree`<br />&nbsp;&nbsp;`"tx": [ (json array of string) the transaction hashes`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"transactionhash", (string) hash of the parent transaction`<br />&nbsp;&nbsp;&nbsp;&nbsp;`...`<br />&nbsp;&nbsp;`]`<br />&nbsp;&nbsp;`"time": n, (numeric) the block time in seconds since 1 Jan 1970 GMT`<br />&nbsp;&nbsp;`"nonce": n, (numeric) the block nonce`<br />&nbsp;&nbsp;`"bits", n, (numeric) the bits which represent the block difficulty`<br />&nbsp;&nbsp;`difficulty: n.nn, (numeric) the proof-of-work difficulty as a multiple of the minimum difficulty`<br />&nbsp;&nbsp;`"previousblockhash": "hash", (string) the hash of the previous block`<br />&nbsp;&nbsp;`"nextblockhash": "hash", (string) the hash of the next block (only if there is one)`<br />`}` | | Returns (verbosity=1) | `{ (json object)`<br />&nbsp;&nbsp;`"hash": "blockhash", (string) the hash of the block (same as provided)`<br />&nbsp;&nbsp;`"confirmations": n, (numeric) the number of confirmations`<br />&nbsp;&nbsp;`"strippedsize", n (numeric) the size of the block without witness data`<br />&nbsp;&nbsp;`"size": n, (numeric) the size of the block`<br />&nbsp;&nbsp;`"weight": n, (numeric) value of the weight metric`<br />&nbsp;&nbsp;`"height": n, (numeric) the height of the block in the block chain`<br />&nbsp;&nbsp;`"version": n, (numeric) the block version`<br />&nbsp;&nbsp;`"merkleroot": "hash", (string) root hash of the merkle tree`<br />&nbsp;&nbsp;`"tx": [ (json array of string) the transaction hashes`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"transactionhash", (string) hash of the parent transaction`<br />&nbsp;&nbsp;&nbsp;&nbsp;`...`<br />&nbsp;&nbsp;`]`<br />&nbsp;&nbsp;`"time": n, (numeric) the block time in seconds since 1 Jan 1970 GMT`<br />&nbsp;&nbsp;`"nonce": n, (numeric) the block nonce`<br />&nbsp;&nbsp;`"bits", n, (numeric) the bits which represent the block difficulty`<br />&nbsp;&nbsp;`difficulty: n.nn, (numeric) the proof-of-work difficulty as a multiple of the minimum difficulty`<br />&nbsp;&nbsp;`"previousblockhash": "hash", (string) the hash of the previous block`<br />&nbsp;&nbsp;`"nextblockhash": "hash", (string) the hash of the next block (only if there is one)`<br />`}` |
@ -285,7 +277,7 @@ the method name for further details such as parameter and return information.
<a name="getblockcount"/> <a name="getblockcount"/>
| | | | | |
|---|---| | -------------- | -------------------------------------------------------- |
| Method | getblockcount | | Method | getblockcount |
| Parameters | None | | Parameters | None |
| Description | Returns the number of blocks in the longest block chain. | | Description | Returns the number of blocks in the longest block chain. |
@ -297,7 +289,7 @@ the method name for further details such as parameter and return information.
<a name="getblockhash"/> <a name="getblockhash"/>
| | | | | |
|---|---| | -------------- | ------------------------------------------------------------------ |
| Method | getblockhash | | Method | getblockhash |
| Parameters | 1. block height (numeric, required) | | Parameters | 1. block height (numeric, required) |
| Description | Returns hash of the block in best block chain at the given height. | | Description | Returns hash of the block in best block chain at the given height. |
@ -309,7 +301,7 @@ the method name for further details such as parameter and return information.
<a name="getblockheader"/> <a name="getblockheader"/>
| | | | | |
|---|---| | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Method | getblockheader | | Method | getblockheader |
| Parameters | 1. block hash (string, required) - the hash of the block<br />2. verbose (boolean, optional, default=true) - specifies the block header is returned as a JSON object instead of a hex-encoded string | | Parameters | 1. block hash (string, required) - the hash of the block<br />2. verbose (boolean, optional, default=true) - specifies the block header is returned as a JSON object instead of a hex-encoded string |
| Description | Returns hex-encoded bytes of the serialized block header. | | Description | Returns hex-encoded bytes of the serialized block header. |
@ -323,7 +315,7 @@ the method name for further details such as parameter and return information.
<a name="getconnectioncount"/> <a name="getconnectioncount"/>
| | | | | |
|---|---| | -------------- | ------------------------------------------------------- |
| Method | getconnectioncount | | Method | getconnectioncount |
| Parameters | None | | Parameters | None |
| Description | Returns the number of active connections to other peers | | Description | Returns the number of active connections to other peers |
@ -335,7 +327,7 @@ the method name for further details such as parameter and return information.
<a name="getdifficulty"/> <a name="getdifficulty"/>
| | | | | |
|---|---| | -------------- | ----------------------------------------------------------------------------- |
| Method | getdifficulty | | Method | getdifficulty |
| Parameters | None | | Parameters | None |
| Description | Returns the proof-of-work difficulty as a multiple of the minimum difficulty. | | Description | Returns the proof-of-work difficulty as a multiple of the minimum difficulty. |
@ -347,7 +339,7 @@ the method name for further details such as parameter and return information.
<a name="getgenerate"/> <a name="getgenerate"/>
| | | | | |
|---|---| | ----------- | ------------------------------------------------------------ |
| Method | getgenerate | | Method | getgenerate |
| Parameters | None | | Parameters | None |
| Description | Return if the server is set to generate coins (mine) or not. | | Description | Return if the server is set to generate coins (mine) or not. |
@ -358,7 +350,7 @@ the method name for further details such as parameter and return information.
<a name="gethashespersec"/> <a name="gethashespersec"/>
| | | | | |
|---|---| | ----------- | ------------------------------------------------------------------------------------------- |
| Method | gethashespersec | | Method | gethashespersec |
| Parameters | None | | Parameters | None |
| Description | Returns a recent hashes per second performance measurement while generating coins (mining). | | Description | Returns a recent hashes per second performance measurement while generating coins (mining). |
@ -369,11 +361,11 @@ the method name for further details such as parameter and return information.
<a name="getinfo"/> <a name="getinfo"/>
| | | | | |
|---|---| | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Method | getinfo | | Method | getinfo |
| Parameters | None | | Parameters | None |
| Description | Returns a JSON object containing various state info. | | 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 />&nbsp;&nbsp;`"version": n, (numeric) the version of the server`<br />&nbsp;&nbsp;`"protocolversion": n, (numeric) the latest supported protocol version`<br />&nbsp;&nbsp;`"blocks": n, (numeric) the number of blocks processed`<br />&nbsp;&nbsp;`"timeoffset": n, (numeric) the time offset`<br />&nbsp;&nbsp;`"connections": n, (numeric) the number of connected peers`<br />&nbsp;&nbsp;`"proxy": "host:port", (string) the proxy used by the server`<br />&nbsp;&nbsp;`"difficulty": n.nn, (numeric) the current target difficulty`<br />&nbsp;&nbsp;`"testnet": true or false, (boolean) whether or not server is using testnet`<br />&nbsp;&nbsp;`"relayfee": n.nn, (numeric) the minimum relay fee for non-free transactions in BTC/KB`<br />`}` | | Returns | `{ (json object)`<br />&nbsp;&nbsp;`"version": n, (numeric) the version of the server`<br />&nbsp;&nbsp;`"protocolversion": n, (numeric) the latest supported protocol version`<br />&nbsp;&nbsp;`"blocks": n, (numeric) the number of blocks processed`<br />&nbsp;&nbsp;`"timeoffset": n, (numeric) the time offset`<br />&nbsp;&nbsp;`"connections": n, (numeric) the number of connected peers`<br />&nbsp;&nbsp;`"proxy": "host:port", (string) the proxy used by the server`<br />&nbsp;&nbsp;`"difficulty": n.nn, (numeric) the current target difficulty`<br />&nbsp;&nbsp;`"testnet": true or false, (boolean) whether or not server is using testnet`<br />&nbsp;&nbsp;`"relayfee": n.nn, (numeric) the minimum relay fee for non-free transactions in BTC/KB`<br />`}` |
| Example Return | `{`<br />&nbsp;&nbsp;`"version": 70000`<br />&nbsp;&nbsp;`"protocolversion": 70001, `<br />&nbsp;&nbsp;`"blocks": 298963,`<br />&nbsp;&nbsp;`"timeoffset": 0,`<br />&nbsp;&nbsp;`"connections": 17,`<br />&nbsp;&nbsp;`"proxy": "",`<br />&nbsp;&nbsp;`"difficulty": 8000872135.97,`<br />&nbsp;&nbsp;`"testnet": false,`<br />&nbsp;&nbsp;`"relayfee": 0.00001,`<br />`}` | | Example Return | `{`<br />&nbsp;&nbsp;`"version": 70000`<br />&nbsp;&nbsp;`"protocolversion": 70001, `<br />&nbsp;&nbsp;`"blocks": 298963,`<br />&nbsp;&nbsp;`"timeoffset": 0,`<br />&nbsp;&nbsp;`"connections": 17,`<br />&nbsp;&nbsp;`"proxy": "",`<br />&nbsp;&nbsp;`"difficulty": 8000872135.97,`<br />&nbsp;&nbsp;`"testnet": false,`<br />&nbsp;&nbsp;`"relayfee": 0.00001,`<br />`}` |
[Return to Overview](#MethodOverview)<br /> [Return to Overview](#MethodOverview)<br />
@ -382,19 +374,19 @@ the method name for further details such as parameter and return information.
<a name="getmempoolinfo"/> <a name="getmempoolinfo"/>
| | | | | |
|---|---| | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | getmempoolinfo | | Method | getmempoolinfo |
| Parameters | None | | Parameters | None |
| Description | Returns a JSON object containing mempool-related information. | | Description | Returns a JSON object containing mempool-related information. |
| Returns | `{ (json object)`<br />&nbsp;&nbsp;`"bytes": n, (numeric) size in bytes of the mempool`<br />&nbsp;&nbsp;`"size": n, (numeric) number of transactions in the mempool`<br />`}` | | Returns | `{ (json object)`<br />&nbsp;&nbsp;`"bytes": n, (numeric) size in bytes of the mempool`<br />&nbsp;&nbsp;`"size": n, (numeric) number of transactions in the mempool`<br />`}` |
Example Return|`{`<br />&nbsp;&nbsp;`"bytes": 310768,`<br />&nbsp;&nbsp;`"size": 157,`<br />`}`| | Example Return | `{`<br />&nbsp;&nbsp;`"bytes": 310768,`<br />&nbsp;&nbsp;`"size": 157,`<br />`}` |
[Return to Overview](#MethodOverview)<br /> [Return to Overview](#MethodOverview)<br />
*** ***
<a name="getmininginfo"/> <a name="getmininginfo"/>
| | | | | |
|---|---| | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | getmininginfo | | Method | getmininginfo |
| Parameters | None | | Parameters | None |
| Description | Returns a JSON object containing mining-related information. | | Description | Returns a JSON object containing mining-related information. |
@ -406,7 +398,7 @@ Example Return|`{`<br />&nbsp;&nbsp;`"bytes": 310768,`<br />&nbsp;&nbsp;`"size":
<a name="getnettotals"/> <a name="getnettotals"/>
| | | | | |
|---|---| | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | getnettotals | | Method | getnettotals |
| Parameters | None | | Parameters | None |
| Description | Returns a JSON object containing network traffic statistics. | | Description | Returns a JSON object containing network traffic statistics. |
@ -418,7 +410,7 @@ Example Return|`{`<br />&nbsp;&nbsp;`"bytes": 310768,`<br />&nbsp;&nbsp;`"size":
<a name="getnetworkhashps"/> <a name="getnetworkhashps"/>
| | | | | |
|---|---| | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | getnetworkhashps | | Method | getnetworkhashps |
| Parameters | 1. blocks (numeric, optional, default=120) - The number of blocks, or -1 for blocks since last difficulty change<br />2. height (numeric, optional, default=-1) - Perform estimate ending with this height or -1 for current best chain block height | | Parameters | 1. blocks (numeric, optional, default=120) - The number of blocks, or -1 for blocks since last difficulty change<br />2. height (numeric, optional, default=-1) - Perform estimate ending with this height or -1 for current best chain block height |
| Description | Returns the estimated network hashes per second for the block heights provided by the parameters. | | Description | Returns the estimated network hashes per second for the block heights provided by the parameters. |
@ -430,19 +422,19 @@ Example Return|`{`<br />&nbsp;&nbsp;`"bytes": 310768,`<br />&nbsp;&nbsp;`"size":
<a name="getpeerinfo"/> <a name="getpeerinfo"/>
| | | | | |
|---|---| | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | getpeerinfo | | Method | getpeerinfo |
| Parameters | None | | Parameters | None |
| Description | Returns data about each connected network peer as an array of json objects. | | Description | Returns data about each connected network peer as an array of json objects. |
| Returns | `[`<br />&nbsp;&nbsp;`{`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"addr": "host:port", (string) the ip address and port of the peer`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"services": "00000001", (string) the services supported by the peer`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"lastrecv": n, (numeric) time the last message was received in seconds since 1 Jan 1970 GMT`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"lastsend": n, (numeric) time the last message was sent in seconds since 1 Jan 1970 GMT`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"bytessent": n, (numeric) total bytes sent`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"bytesrecv": n, (numeric) total bytes received`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"conntime": n, (numeric) time the connection was made in seconds since 1 Jan 1970 GMT`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"pingtime": n, (numeric) number of microseconds the last ping took`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"pingwait": n, (numeric) number of microseconds a queued ping has been waiting for a response`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"version": n, (numeric) the protocol version of the peer`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"subver": "useragent", (string) the user agent of the peer`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"inbound": true_or_false, (boolean) whether or not the peer is an inbound connection`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"startingheight": n, (numeric) the latest block height the peer knew about when the connection was established`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"currentheight": n, (numeric) the latest block height the peer is known to have relayed since connected`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"syncnode": true_or_false, (boolean) whether or not the peer is the sync peer`<br />&nbsp;&nbsp;`}, ...`<br />`]` | | Returns | `[`<br />&nbsp;&nbsp;`{`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"addr": "host:port", (string) the ip address and port of the peer`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"services": "00000001", (string) the services supported by the peer`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"lastrecv": n, (numeric) time the last message was received in seconds since 1 Jan 1970 GMT`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"lastsend": n, (numeric) time the last message was sent in seconds since 1 Jan 1970 GMT`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"bytessent": n, (numeric) total bytes sent`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"bytesrecv": n, (numeric) total bytes received`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"conntime": n, (numeric) time the connection was made in seconds since 1 Jan 1970 GMT`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"pingtime": n, (numeric) number of microseconds the last ping took`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"pingwait": n, (numeric) number of microseconds a queued ping has been waiting for a response`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"version": n, (numeric) the protocol version of the peer`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"subver": "useragent", (string) the user agent of the peer`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"inbound": true_or_false, (boolean) whether or not the peer is an inbound connection`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"startingheight": n, (numeric) the latest block height the peer knew about when the connection was established`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"currentheight": n, (numeric) the latest block height the peer is known to have relayed since connected`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"syncnode": true_or_false, (boolean) whether or not the peer is the sync peer`<br />&nbsp;&nbsp;`}, ...`<br />`]` |
|Example Return|`[`<br />&nbsp;&nbsp;`{`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"addr": "178.172.xxx.xxx:8333",`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"services": "00000001",`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"lastrecv": 1388183523,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"lastsend": 1388185470,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"bytessent": 287592965,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"bytesrecv": 780340,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"conntime": 1388182973,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"pingtime": 405551,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"pingwait": 183023,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"version": 70001,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"subver": "/btcd:0.4.0/",`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"inbound": false,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"startingheight": 276921,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"currentheight": 276955,`<br/>&nbsp;&nbsp;&nbsp;&nbsp;`"syncnode": true,`<br />&nbsp;&nbsp;`}`<br />`]`| | Example Return | `[`<br />&nbsp;&nbsp;`{`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"addr": "178.172.xxx.xxx:9246",`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"services": "00000001",`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"lastrecv": 1388183523,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"lastsend": 1388185470,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"bytessent": 287592965,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"bytesrecv": 780340,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"conntime": 1388182973,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"pingtime": 405551,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"pingwait": 183023,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"version": 70001,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"subver": "/lbcd:0.4.0/",`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"inbound": false,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"startingheight": 276921,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"currentheight": 276955,`<br/>&nbsp;&nbsp;&nbsp;&nbsp;`"syncnode": true,`<br />&nbsp;&nbsp;`}`<br />`]` |
[Return to Overview](#MethodOverview)<br /> [Return to Overview](#MethodOverview)<br />
*** ***
<a name="getrawtransaction"/> <a name="getrawtransaction"/>
| | | | | |
|---|---| | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | getrawtransaction | | Method | getrawtransaction |
| Parameters | 1. transaction hash (string, required) - the hash of the transaction<br />2. verbose (int, optional, default=0) - specifies the transaction is returned as a JSON object instead of hex-encoded string | | Parameters | 1. transaction hash (string, required) - the hash of the transaction<br />2. verbose (int, optional, default=0) - specifies the transaction is returned as a JSON object instead of hex-encoded string |
| Description | Returns information about a transaction given its hash. | | Description | Returns information about a transaction given its hash. |
@ -456,7 +448,7 @@ Example Return|`{`<br />&nbsp;&nbsp;`"bytes": 310768,`<br />&nbsp;&nbsp;`"size":
<a name="help"/> <a name="help"/>
| | | | | |
|---|---| | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Method | help | | Method | help |
| Parameters | 1. command (string, optional) - the command to get help for | | Parameters | 1. command (string, optional) - the command to get help for |
| Description | Returns a list of all commands or help for a specified command.<br />When no `command` parameter is specified, a list of avaialable commands is returned<br />When `command` is a valid method, the help text for that method is returned. | | Description | Returns a list of all commands or help for a specified command.<br />When no `command` parameter is specified, a list of avaialable commands is returned<br />When `command` is a valid method, the help text for that method is returned. |
@ -468,7 +460,7 @@ Example Return|`{`<br />&nbsp;&nbsp;`"bytes": 310768,`<br />&nbsp;&nbsp;`"size":
<a name="ping"/> <a name="ping"/>
| | | | | |
|---|---| | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Method | ping | | Method | ping |
| Parameters | None | | Parameters | None |
| Description | Queues a ping to be sent to each connected peer.<br />Ping times are provided by [getpeerinfo](#getpeerinfo) via the `pingtime` and `pingwait` fields. | | Description | Queues a ping to be sent to each connected peer.<br />Ping times are provided by [getpeerinfo](#getpeerinfo) via the `pingtime` and `pingwait` fields. |
@ -479,11 +471,11 @@ Example Return|`{`<br />&nbsp;&nbsp;`"bytes": 310768,`<br />&nbsp;&nbsp;`"size":
<a name="getrawmempool"/> <a name="getrawmempool"/>
| | | | | |
|---|---| | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | getrawmempool | | Method | getrawmempool |
| Parameters | 1. verbose (boolean, optional, default=false) | | 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. | | 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 />&nbsp;&nbsp;`"transactionhash", (string) hash of the transaction`<br />&nbsp;&nbsp;`...`<br />`]` | | Returns (verbose=false) | `[ (json array of string)`<br />&nbsp;&nbsp;`"transactionhash", (string) hash of the transaction`<br />&nbsp;&nbsp;`...`<br />`]` |
| Returns (verbose=true) | `{ (json object)`<br />&nbsp;&nbsp;`"transactionhash": { (json object)`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"size": n, (numeric) transaction size in bytes`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"vsize": n, (numeric) transaction virtual size`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"weight": n, (numeric) The transaction's weight (between vsize*4-3 and vsize*4)`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"fee" : n, (numeric) transaction fee in bitcoins`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"time": n, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"height": n, (numeric) block height when transaction entered the pool`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"startingpriority": n, (numeric) priority when transaction entered the pool`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"currentpriority": n, (numeric) current priority`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"depends": [ (json array) unconfirmed transactions used as inputs for this transaction`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`"transactionhash", (string) hash of the parent transaction`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`...`<br />&nbsp;&nbsp;&nbsp;&nbsp;`]`<br />&nbsp;&nbsp;`}, ...`<br />`}` | | Returns (verbose=true) | `{ (json object)`<br />&nbsp;&nbsp;`"transactionhash": { (json object)`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"size": n, (numeric) transaction size in bytes`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"vsize": n, (numeric) transaction virtual size`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"weight": n, (numeric) The transaction's weight (between vsize*4-3 and vsize*4)`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"fee" : n, (numeric) transaction fee in bitcoins`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"time": n, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"height": n, (numeric) block height when transaction entered the pool`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"startingpriority": n, (numeric) priority when transaction entered the pool`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"currentpriority": n, (numeric) current priority`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"depends": [ (json array) unconfirmed transactions used as inputs for this transaction`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`"transactionhash", (string) hash of the parent transaction`<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`...`<br />&nbsp;&nbsp;&nbsp;&nbsp;`]`<br />&nbsp;&nbsp;`}, ...`<br />`}` |
| Example Return (verbose=false) | `[`<br />&nbsp;&nbsp;`"3480058a397b6ffcc60f7e3345a61370fded1ca6bef4b58156ed17987f20d4e7",`<br />&nbsp;&nbsp;`"cbfe7c056a358c3a1dbced5a22b06d74b8650055d5195c1c2469e6b63a41514a"`<br />`]` | | Example Return (verbose=false) | `[`<br />&nbsp;&nbsp;`"3480058a397b6ffcc60f7e3345a61370fded1ca6bef4b58156ed17987f20d4e7",`<br />&nbsp;&nbsp;`"cbfe7c056a358c3a1dbced5a22b06d74b8650055d5195c1c2469e6b63a41514a"`<br />`]` |
@ -494,11 +486,11 @@ Example Return|`{`<br />&nbsp;&nbsp;`"bytes": 310768,`<br />&nbsp;&nbsp;`"size":
<a name="setgenerate"/> <a name="setgenerate"/>
| | | | | |
|---|---| | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Method | setgenerate | | 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 | | 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. | | 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 | | Returns | Nothing |
[Return to Overview](#MethodOverview)<br /> [Return to Overview](#MethodOverview)<br />
@ -506,11 +498,11 @@ Example Return|`{`<br />&nbsp;&nbsp;`"bytes": 310768,`<br />&nbsp;&nbsp;`"size":
<a name="sendrawtransaction"/> <a name="sendrawtransaction"/>
| | | | | |
|---|---| | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Method | sendrawtransaction | | 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 | | 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. | | 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` | | Returns | `"hash" (string) the hash of the transaction` |
| Example Return | `"1697a19cede08694278f19584e8dcc87945f40c6b59a942dd8906f133ad3f9cc"` | | Example Return | `"1697a19cede08694278f19584e8dcc87945f40c6b59a942dd8906f133ad3f9cc"` |
[Return to Overview](#MethodOverview)<br /> [Return to Overview](#MethodOverview)<br />
@ -519,7 +511,7 @@ Example Return|`{`<br />&nbsp;&nbsp;`"bytes": 310768,`<br />&nbsp;&nbsp;`"size":
<a name="submitblock"/> <a name="submitblock"/>
| | | | | |
|---|---| | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| Method | submitblock | | Method | submitblock |
| Parameters | 1. data (string, required) serialized, hex-encoded block<br />2. params (json object, optional, default=nil) this parameter is currently ignored | | Parameters | 1. data (string, required) serialized, hex-encoded block<br />2. params (json object, optional, default=nil) this parameter is currently ignored |
| Description | Attempts to submit a new serialized, hex-encoded block to the network. | | Description | Attempts to submit a new serialized, hex-encoded block to the network. |
@ -530,18 +522,18 @@ Example Return|`{`<br />&nbsp;&nbsp;`"bytes": 310768,`<br />&nbsp;&nbsp;`"size":
<a name="stop"/> <a name="stop"/>
| | | | | |
|---|---| | ----------- | --------------------------- |
| Method | stop | | Method | stop |
| Parameters | None | | Parameters | None |
|Description|Shutdown btcd.| | Description | Shutdown lbcd. |
|Returns|`"btcd stopping."` (string)| | Returns | `"lbcd stopping."` (string) |
[Return to Overview](#MethodOverview)<br /> [Return to Overview](#MethodOverview)<br />
*** ***
<a name="validateaddress"/> <a name="validateaddress"/>
| | | | | |
|---|---| | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | validateaddress | | Method | validateaddress |
| Parameters | 1. address (string, required) - bitcoin address | | Parameters | 1. address (string, required) - bitcoin address |
| Description | Verify an address is valid. | | Description | Verify an address is valid. |
@ -552,11 +544,11 @@ Example Return|`{`<br />&nbsp;&nbsp;`"bytes": 310768,`<br />&nbsp;&nbsp;`"size":
<a name="verifychain"/> <a name="verifychain"/>
| | | | | |
|---|---| | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | verifychain | | 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 | | 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.| | 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">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>| | 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) | | Returns | `true` or `false` (boolean) |
| Example Return | `true` | | Example Return | `true` |
[Return to Overview](#MethodOverview)<br /> [Return to Overview](#MethodOverview)<br />
@ -570,13 +562,13 @@ Example Return|`{`<br />&nbsp;&nbsp;`"bytes": 310768,`<br />&nbsp;&nbsp;`"size":
**6.1 Method Overview**<br /> **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 | | # | Method | Safe for limited user? | Description |
|---|------|----------|-----------| | --- | ----------------------------------------------- | ---------------------- | -------------------------------------------------------------------------------- |
| 1 | [debuglevel](#debuglevel) | N | Dynamically changes the debug logging level. | | 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 | | 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 | | 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 | | 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 | | 6 | [generate](#generate) | N | When in simnet or regtest mode, generate a set number of blocks. | None |
@ -591,13 +583,13 @@ The following is an overview of the RPC methods which are implemented by btcd, b
<a name="debuglevel"/> <a name="debuglevel"/>
| | | | | |
|---|---| | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | debuglevel | | Method | debuglevel |
| Parameters | 1. _levelspec_ (string) | | 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 | | Returns | string |
| Example Return | `Done.` | | 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 /> [Return to Overview](#ExtMethodOverview)<br />
*** ***
@ -605,7 +597,7 @@ The following is an overview of the RPC methods which are implemented by btcd, b
<a name="getbestblock"/> <a name="getbestblock"/>
| | | | | |
|---|---| | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Method | getbestblock | | Method | getbestblock |
| Parameters | None | | Parameters | None |
| Description | Get block height and hash of best block in the main chain. | | Description | Get block height and hash of best block in the main chain. |
@ -617,10 +609,10 @@ The following is an overview of the RPC methods which are implemented by btcd, b
<a name="getcurrentnet"/> <a name="getcurrentnet"/>
| | | | | |
|---|---| | -------------- | -------------------------------------------------- |
| Method | getcurrentnet | | Method | getcurrentnet |
| Parameters | None | | Parameters | None |
|Description|Get bitcoin network btcd is running on.| | Description | Get bitcoin network lbcd is running on. |
| Returns | numeric | | Returns | numeric |
| Example Return | `3652501241` (mainnet)<br />`118034699` (testnet3) | | Example Return | `3652501241` (mainnet)<br />`118034699` (testnet3) |
[Return to Overview](#ExtMethodOverview)<br /> [Return to Overview](#ExtMethodOverview)<br />
@ -630,7 +622,7 @@ The following is an overview of the RPC methods which are implemented by btcd, b
<a name="searchrawtransactions"/> <a name="searchrawtransactions"/>
| | | | | |
|---|---| | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | searchrawtransactions | | Method | searchrawtransactions |
| Parameters | 1. address (string, required) - bitcoin address <br /> 2. verbose (int, optional, default=true) - specifies the transaction is returned as a JSON object instead of hex-encoded string <br />3. skip (int, optional, default=0) - the number of leading transactions to leave out of the final response <br /> 4. count (int, optional, default=100) - the maximum number of transactions to return <br /> 5. vinextra (int, optional, default=0) - Specify that extra data from previous output will be returned in vin <br /> 6. reverse (boolean, optional, default=false) - Specifies that the transactions should be returned in reverse chronological order | | Parameters | 1. address (string, required) - bitcoin address <br /> 2. verbose (int, optional, default=true) - specifies the transaction is returned as a JSON object instead of hex-encoded string <br />3. skip (int, optional, default=0) - the number of leading transactions to leave out of the final response <br /> 4. count (int, optional, default=100) - the maximum number of transactions to return <br /> 5. vinextra (int, optional, default=0) - Specify that extra data from previous output will be returned in vin <br /> 6. reverse (boolean, optional, default=false) - Specifies that the transactions should be returned in reverse chronological order |
| Description | Returns raw data for transactions involving the passed address. Returned transactions are pulled from both the database, and transactions currently in the mempool. Transactions pulled from the mempool will have the `"confirmations"` field set to 0. Usage of this RPC requires the optional `--addrindex` flag to be activated, otherwise all responses will simply return with an error stating the address index has not yet been built up. Similarly, until the address index has caught up with the current best height, all requests will return an error response in order to avoid serving stale data. | | Description | Returns raw data for transactions involving the passed address. Returned transactions are pulled from both the database, and transactions currently in the mempool. Transactions pulled from the mempool will have the `"confirmations"` field set to 0. Usage of this RPC requires the optional `--addrindex` flag to be activated, otherwise all responses will simply return with an error stating the address index has not yet been built up. Similarly, until the address index has caught up with the current best height, all requests will return an error response in order to avoid serving stale data. |
@ -643,7 +635,7 @@ The following is an overview of the RPC methods which are implemented by btcd, b
<a name="node"/> <a name="node"/>
| | | | | |
|---|---| | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | node | | Method | node |
| Parameters | 1. command (string, required) - `connect` to add a peer (defaults to temporary), `remove` to remove a persistent peer, or `disconnect` to remove all matching non-persistent peers <br /> 2. peer (string, required) - ip address and port, or ID of the peer to operate on<br /> 3. connection type (string, optional) - `perm` indicates the peer should be added as a permanent peer, `temp` indicates a connection should only be attempted once. | | Parameters | 1. command (string, required) - `connect` to add a peer (defaults to temporary), `remove` to remove a persistent peer, or `disconnect` to remove all matching non-persistent peers <br /> 2. peer (string, required) - ip address and port, or ID of the peer to operate on<br /> 3. connection type (string, optional) - `perm` indicates the peer should be added as a permanent peer, `temp` indicates a connection should only be attempted once. |
| Description | Attempts to add or remove a peer. | | Description | Attempts to add or remove a peer. |
@ -655,7 +647,7 @@ The following is an overview of the RPC methods which are implemented by btcd, b
<a name="generate"/> <a name="generate"/>
| | | | | |
|---|---| | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | generate | | Method | generate |
| Parameters | 1. numblocks (int, required) - The number of blocks to generate | | Parameters | 1. numblocks (int, required) - The number of blocks to generate |
| Description | When in simnet or regtest mode, generates `numblocks` blocks. If blocks arrive from elsewhere, they are built upon but don't count toward the number of blocks to generate. Only generated blocks are returned. This RPC call will exit with an error if the server is already CPU mining, and will prevent the server from CPU mining for another command while it runs. | | Description | When in simnet or regtest mode, generates `numblocks` blocks. If blocks arrive from elsewhere, they are built upon but don't count toward the number of blocks to generate. Only generated blocks are returned. This RPC call will exit with an error if the server is already CPU mining, and will prevent the server from CPU mining for another command while it runs. |
@ -667,12 +659,12 @@ The following is an overview of the RPC methods which are implemented by btcd, b
<a name="version"/> <a name="version"/>
| | | | | |
|---|---| | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | version | | Method | version |
| Parameters | None | | Parameters | None |
|Description|Returns the version of the JSON-RPC API built into this release of btcd.| | Description | Returns the version of the JSON-RPC API built into this release of lbcd. |
|Returns|`{ (json object)`<br />&nbsp;&nbsp;`"btcdjsonrpcapi": {`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"versionstring": "x.y.z", (string) the version of the JSON-RPC API`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"major": x, (numeric) the major version of the JSON-RPC API`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"minor": y, (numeric) the minor version of the JSON-RPC API`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"patch": z, (numeric) the patch version of the JSON-RPC API`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"prerelease": "", (string) prerelease info for the JSON-RPC API`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"buildmetadata": "" (string) metadata about the server build`<br />&nbsp;&nbsp;`}`<br />`}`| | Returns | `{ (json object)`<br />&nbsp;&nbsp;`"lbcdjsonrpcapi": {`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"versionstring": "x.y.z", (string) the version of the JSON-RPC API`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"major": x, (numeric) the major version of the JSON-RPC API`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"minor": y, (numeric) the minor version of the JSON-RPC API`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"patch": z, (numeric) the patch version of the JSON-RPC API`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"prerelease": "", (string) prerelease info for the JSON-RPC API`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"buildmetadata": "" (string) metadata about the server build`<br />&nbsp;&nbsp;`}`<br />`}` |
|Example Return|`{`<br />&nbsp;&nbsp;`"btcdjsonrpcapi": {`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"versionstring": "1.0.0",`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"major": 1, `<br />&nbsp;&nbsp;&nbsp;&nbsp;`"minor": 0,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"patch": 0,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"prerelease": "",`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"buildmetadata": ""`<br />&nbsp;&nbsp;`}`<br />`}`| | Example Return | `{`<br />&nbsp;&nbsp;`"lbcdjsonrpcapi": {`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"versionstring": "1.0.0",`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"major": 1, `<br />&nbsp;&nbsp;&nbsp;&nbsp;`"minor": 0,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"patch": 0,`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"prerelease": "",`<br />&nbsp;&nbsp;&nbsp;&nbsp;`"buildmetadata": ""`<br />&nbsp;&nbsp;`}`<br />`}` |
[Return to Overview](#MethodOverview)<br /> [Return to Overview](#MethodOverview)<br />
*** ***
@ -680,7 +672,7 @@ The following is an overview of the RPC methods which are implemented by btcd, b
<a name="getheaders"/> <a name="getheaders"/>
| | | | | |
|---|---| | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | getheaders | | Method | getheaders |
| Parameters | 1. Block Locators (JSON array, required)<br />&nbsp;`[ (json array of strings)`<br />&nbsp;&nbsp;`"blocklocator", (string) the known block hash`<br />&nbsp;&nbsp;`...`<br />&nbsp;`]`<br />2. hashstop (string) - last desired block's hash | | Parameters | 1. Block Locators (JSON array, required)<br />&nbsp;`[ (json array of strings)`<br />&nbsp;&nbsp;`"blocklocator", (string) the known block hash`<br />&nbsp;&nbsp;`...`<br />&nbsp;`]`<br />2. hashstop (string) - last desired block's hash |
| Description | Returns block headers starting with the first known block hash from the request. | | Description | Returns block headers starting with the first known block hash from the request. |
@ -702,7 +694,7 @@ The following is an overview of the RPC method requests available exclusively to
user. Click the method name for further details such as parameter and return information. user. Click the method name for further details such as parameter and return information.
| # | Method | Description | Notifications | | # | Method | Description | Notifications |
|---|------|-----------|-------------| | --- | ------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 1 | [authenticate](#authenticate) | Authenticate the connection against the username and passphrase configured for the RPC server.<br /><font color="orange">NOTE: This is only required if an HTTP Authorization header is not being used.</font> | None | | 1 | [authenticate](#authenticate) | Authenticate the connection against the username and passphrase configured for the RPC server.<br /><font color="orange">NOTE: This is only required if an HTTP Authorization header is not being used.</font> | None |
| 2 | [notifyblocks](#notifyblocks) | Send notifications when a block is connected or disconnected from the best chain. | [blockconnected](#blockconnected), [blockdisconnected](#blockdisconnected), [filteredblockconnected](#filteredblockconnected), and [filteredblockdisconnected](#filteredblockdisconnected) | | 2 | [notifyblocks](#notifyblocks) | Send notifications when a block is connected or disconnected from the best chain. | [blockconnected](#blockconnected), [blockdisconnected](#blockdisconnected), [filteredblockconnected](#filteredblockconnected), and [filteredblockdisconnected](#filteredblockdisconnected) |
| 3 | [stopnotifyblocks](#stopnotifyblocks) | Cancel registered notifications for whenever a block is connected or disconnected from the main (best) chain. | None | | 3 | [stopnotifyblocks](#stopnotifyblocks) | Cancel registered notifications for whenever a block is connected or disconnected from the main (best) chain. | None |
@ -724,7 +716,7 @@ user. Click the method name for further details such as parameter and return in
<a name="authenticate"/> <a name="authenticate"/>
| | | | | |
|---|---| | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | authenticate | | Method | authenticate |
| Parameters | 1. username (string, required)<br />2. passphrase (string, required) | | Parameters | 1. username (string, required)<br />2. passphrase (string, required) |
| Description | Authenticate the connection against the username and password configured for the RPC server.<br /> Invoking any other method before authenticating with this command will close the connection.<br /><font color="orange">NOTE: This is only required if an HTTP Authorization header is not being used.</font> | | Description | Authenticate the connection against the username and password configured for the RPC server.<br /> Invoking any other method before authenticating with this command will close the connection.<br /><font color="orange">NOTE: This is only required if an HTTP Authorization header is not being used.</font> |
@ -736,7 +728,7 @@ user. Click the method name for further details such as parameter and return in
<a name="notifyblocks"/> <a name="notifyblocks"/>
| | | | | |
|---|---| | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | notifyblocks | | Method | notifyblocks |
| Notifications | [blockconnected](#blockconnected), [blockdisconnected](#blockdisconnected), [filteredblockconnected](#filteredblockconnected), and [filteredblockdisconnected](#filteredblockdisconnected) | | Notifications | [blockconnected](#blockconnected), [blockdisconnected](#blockdisconnected), [filteredblockconnected](#filteredblockconnected), and [filteredblockdisconnected](#filteredblockdisconnected) |
| Parameters | None | | Parameters | None |
@ -749,7 +741,7 @@ user. Click the method name for further details such as parameter and return in
<a name="stopnotifyblocks"/> <a name="stopnotifyblocks"/>
| | | | | |
|---|---| | ------------- | ---------------------------------------------------------------------------------------------------------- |
| Method | stopnotifyblocks | | Method | stopnotifyblocks |
| Notifications | None | | Notifications | None |
| Parameters | None | | Parameters | None |
@ -762,7 +754,7 @@ user. Click the method name for further details such as parameter and return in
<a name="notifyreceived"/> <a name="notifyreceived"/>
| | | | | |
|---|---| | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Method | notifyreceived | | Method | notifyreceived |
| Notifications | [recvtx](#recvtx) and [redeemingtx](#redeemingtx) | | Notifications | [recvtx](#recvtx) and [redeemingtx](#redeemingtx) |
| Parameters | 1. Addresses (JSON array, required)<br />&nbsp;`[ (json array of strings)`<br />&nbsp;&nbsp;`"bitcoinaddress", (string) the bitcoin address`<br />&nbsp;&nbsp;`...`<br />&nbsp;`]` | | Parameters | 1. Addresses (JSON array, required)<br />&nbsp;`[ (json array of strings)`<br />&nbsp;&nbsp;`"bitcoinaddress", (string) the bitcoin address`<br />&nbsp;&nbsp;`...`<br />&nbsp;`]` |
@ -775,7 +767,7 @@ user. Click the method name for further details such as parameter and return in
<a name="stopnotifyreceived"/> <a name="stopnotifyreceived"/>
| | | | | |
|---|---| | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | stopnotifyreceived | | Method | stopnotifyreceived |
| Notifications | None | | Notifications | None |
| Parameters | 1. Addresses (JSON array, required)<br />&nbsp;`[ (json array of strings)`<br />&nbsp;&nbsp;`"bitcoinaddress", (string) the bitcoin address`<br />&nbsp;&nbsp;`...`<br />&nbsp;`]` | | Parameters | 1. Addresses (JSON array, required)<br />&nbsp;`[ (json array of strings)`<br />&nbsp;&nbsp;`"bitcoinaddress", (string) the bitcoin address`<br />&nbsp;&nbsp;`...`<br />&nbsp;`]` |
@ -788,11 +780,11 @@ user. Click the method name for further details such as parameter and return in
<a name="notifyspent"/> <a name="notifyspent"/>
| | | | | |
|---|---| | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | notifyspent | | Method | notifyspent |
| Notifications | [redeemingtx](#redeemingtx) | | Notifications | [redeemingtx](#redeemingtx) |
| Parameters | 1. Outpoints (JSON array, required)<br />&nbsp;`[ (JSON array)`<br />&nbsp;&nbsp;`{ (JSON object)`<br />&nbsp;&nbsp;&nbsp;`"hash":"data", (string) the hex-encoded bytes of the outpoint hash`<br />&nbsp;&nbsp;&nbsp;`"index":n (numeric) the txout index of the outpoint`<br />&nbsp;&nbsp;`},`<br />&nbsp;&nbsp;`...`<br />&nbsp;`]` | | Parameters | 1. Outpoints (JSON array, required)<br />&nbsp;`[ (JSON array)`<br />&nbsp;&nbsp;`{ (JSON object)`<br />&nbsp;&nbsp;&nbsp;`"hash":"data", (string) the hex-encoded bytes of the outpoint hash`<br />&nbsp;&nbsp;&nbsp;`"index":n (numeric) the txout index of the outpoint`<br />&nbsp;&nbsp;`},`<br />&nbsp;&nbsp;`...`<br />&nbsp;`]` |
|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 | | Returns | Nothing |
[Return to Overview](#WSExtMethodOverview)<br /> [Return to Overview](#WSExtMethodOverview)<br />
@ -801,7 +793,7 @@ user. Click the method name for further details such as parameter and return in
<a name="stopnotifyspent"/> <a name="stopnotifyspent"/>
| | | | | |
|---|---| | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | stopnotifyspent | | Method | stopnotifyspent |
| Notifications | None | | Notifications | None |
| Parameters | 1. Outpoints (JSON array, required)<br />&nbsp;`[ (JSON array)`<br />&nbsp;&nbsp;`{ (JSON object)`<br />&nbsp;&nbsp;&nbsp;`"hash":"data", (string) the hex-encoded bytes of the outpoint hash`<br />&nbsp;&nbsp;&nbsp;`"index":n (numeric) the txout index of the outpoint`<br />&nbsp;&nbsp;`},`<br />&nbsp;&nbsp;`...`<br />&nbsp;`]` | | Parameters | 1. Outpoints (JSON array, required)<br />&nbsp;`[ (JSON array)`<br />&nbsp;&nbsp;`{ (JSON object)`<br />&nbsp;&nbsp;&nbsp;`"hash":"data", (string) the hex-encoded bytes of the outpoint hash`<br />&nbsp;&nbsp;&nbsp;`"index":n (numeric) the txout index of the outpoint`<br />&nbsp;&nbsp;`},`<br />&nbsp;&nbsp;`...`<br />&nbsp;`]` |
@ -814,7 +806,7 @@ user. Click the method name for further details such as parameter and return in
<a name="rescan"/> <a name="rescan"/>
| | | | | |
|---|---| | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | rescan | | Method | rescan |
| Notifications | [recvtx](#recvtx), [redeemingtx](#redeemingtx), [rescanprogress](#rescanprogress), and [rescanfinished](#rescanfinished) | | Notifications | [recvtx](#recvtx), [redeemingtx](#redeemingtx), [rescanprogress](#rescanprogress), and [rescanfinished](#rescanfinished) |
| Parameters | 1. BeginBlock (string, required) block hash to begin rescanning from<br />2. Addresses (JSON array, required)<br />&nbsp;`[ (json array of strings)`<br />&nbsp;&nbsp;`"bitcoinaddress", (string) the bitcoin address`<br />&nbsp;&nbsp;`...` <br />&nbsp;`]`<br />3. Outpoints (JSON array, required)<br />&nbsp;`[ (JSON array)`<br />&nbsp;&nbsp;`{ (JSON object)`<br />&nbsp;&nbsp;&nbsp;`"hash":"data", (string) the hex-encoded bytes of the outpoint hash`<br />&nbsp;&nbsp;&nbsp;`"index":n (numeric) the txout index of the outpoint`<br />&nbsp;&nbsp;`},`<br />&nbsp;&nbsp;`...`<br />&nbsp;`]`<br />4. EndBlock (string, optional) hash of final block to rescan | | Parameters | 1. BeginBlock (string, required) block hash to begin rescanning from<br />2. Addresses (JSON array, required)<br />&nbsp;`[ (json array of strings)`<br />&nbsp;&nbsp;`"bitcoinaddress", (string) the bitcoin address`<br />&nbsp;&nbsp;`...` <br />&nbsp;`]`<br />3. Outpoints (JSON array, required)<br />&nbsp;`[ (JSON array)`<br />&nbsp;&nbsp;`{ (JSON object)`<br />&nbsp;&nbsp;&nbsp;`"hash":"data", (string) the hex-encoded bytes of the outpoint hash`<br />&nbsp;&nbsp;&nbsp;`"index":n (numeric) the txout index of the outpoint`<br />&nbsp;&nbsp;`},`<br />&nbsp;&nbsp;`...`<br />&nbsp;`]`<br />4. EndBlock (string, optional) hash of final block to rescan |
@ -827,7 +819,7 @@ user. Click the method name for further details such as parameter and return in
<a name="notifynewtransactions"/> <a name="notifynewtransactions"/>
| | | | | |
|---|---| | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | notifynewtransactions | | Method | notifynewtransactions |
| Notifications | [txaccepted](#txaccepted) or [txacceptedverbose](#txacceptedverbose) | | Notifications | [txaccepted](#txaccepted) or [txacceptedverbose](#txacceptedverbose) |
| Parameters | 1. verbose (boolean, optional, default=false) - specifies which type of notification to receive. If verbose is true, then the caller receives [txacceptedverbose](#txacceptedverbose), otherwise the caller receives [txaccepted](#txaccepted) | | Parameters | 1. verbose (boolean, optional, default=false) - specifies which type of notification to receive. If verbose is true, then the caller receives [txacceptedverbose](#txacceptedverbose), otherwise the caller receives [txaccepted](#txaccepted) |
@ -840,7 +832,7 @@ user. Click the method name for further details such as parameter and return in
<a name="stopnotifynewtransactions"/> <a name="stopnotifynewtransactions"/>
| | | | | |
|---|---| | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | stopnotifynewtransactions | | Method | stopnotifynewtransactions |
| Notifications | None | | Notifications | None |
| Parameters | None | | Parameters | None |
@ -853,7 +845,7 @@ user. Click the method name for further details such as parameter and return in
<a name="session"/> <a name="session"/>
| | | | | |
|---|---| | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | session | | Method | session |
| Notifications | None | | Notifications | None |
| Parameters | None | | Parameters | None |
@ -867,7 +859,7 @@ user. Click the method name for further details such as parameter and return in
<a name="loadtxfilter"/> <a name="loadtxfilter"/>
| | | | | |
|---|---| | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | loadtxfilter | | Method | loadtxfilter |
| Notifications | [relevanttxaccepted](#relevanttxaccepted) | | Notifications | [relevanttxaccepted](#relevanttxaccepted) |
| Parameters | 1. Reload (boolean, required) - Load a new filter instead of adding data to an existing one<br />2. Addresses (JSON array, required) - Array of addresses to add to the transaction filter<br />3. Outpoints (JSON array, required) - Array of outpoints to add to the transaction filter | | Parameters | 1. Reload (boolean, required) - Load a new filter instead of adding data to an existing one<br />2. Addresses (JSON array, required) - Array of addresses to add to the transaction filter<br />3. Outpoints (JSON array, required) - Array of outpoints to add to the transaction filter |
@ -880,7 +872,7 @@ user. Click the method name for further details such as parameter and return in
<a name="rescanblocks"/> <a name="rescanblocks"/>
| | | | | |
|---|---| | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Method | rescanblocks | | Method | rescanblocks |
| Notifications | None | | Notifications | None |
| Parameters | 1. Blockhashes (JSON array, required) - List of hashes to rescan. Each next block must be a child of the previous. | | Parameters | 1. Blockhashes (JSON array, required) - List of hashes to rescan. Each next block must be a child of the previous. |
@ -893,7 +885,7 @@ user. Click the method name for further details such as parameter and return in
### 8. Notifications (Websocket-specific) ### 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" /> <a name="NotificationOverview" />
@ -902,7 +894,7 @@ btcd uses standard JSON-RPC notifications to notify clients of changes, rather t
The following is an overview of the JSON-RPC notifications used for Websocket connections. Click the method name for further details of the context(s) in which they are sent and their parameters. The following is an overview of the JSON-RPC notifications used for Websocket connections. Click the method name for further details of the context(s) in which they are sent and their parameters.
| # | Method | Description | Request | | # | Method | Description | Request |
|---|------|-----------|-------| | --- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| 1 | [blockconnected](#blockconnected) | *DEPRECATED, for similar functionality see [filteredblockconnected](#filteredblockconnected)*<br />Block connected to the main chain. | [notifyblocks](#notifyblocks) | | 1 | [blockconnected](#blockconnected) | *DEPRECATED, for similar functionality see [filteredblockconnected](#filteredblockconnected)*<br />Block connected to the main chain. | [notifyblocks](#notifyblocks) |
| 2 | [blockdisconnected](#blockdisconnected) | *DEPRECATED, for similar functionality see [filteredblockdisconnected](#filteredblockdisconnected)*<br />Block disconnected from the main chain. | [notifyblocks](#notifyblocks) | | 2 | [blockdisconnected](#blockdisconnected) | *DEPRECATED, for similar functionality see [filteredblockdisconnected](#filteredblockdisconnected)*<br />Block disconnected from the main chain. | [notifyblocks](#notifyblocks) |
| 3 | [recvtx](#recvtx) | *DEPRECATED, for similar functionality see [relevanttxaccepted](#relevanttxaccepted) and [filteredblockconnected](#filteredblockconnected)*<br />Processed a transaction output spending to a wallet address. | [notifyreceived](#notifyreceived) and [rescan](#rescan) | | 3 | [recvtx](#recvtx) | *DEPRECATED, for similar functionality see [relevanttxaccepted](#relevanttxaccepted) and [filteredblockconnected](#filteredblockconnected)*<br />Processed a transaction output spending to a wallet address. | [notifyreceived](#notifyreceived) and [rescan](#rescan) |
@ -922,7 +914,7 @@ The following is an overview of the JSON-RPC notifications used for Websocket co
<a name="blockconnected"/> <a name="blockconnected"/>
| | | | | |
|---|---| | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | blockconnected | | Method | blockconnected |
| Request | [notifyblocks](#notifyblocks) | | Request | [notifyblocks](#notifyblocks) |
| Parameters | 1. BlockHash (string) hex-encoded bytes of the attached block hash<br />2. BlockHeight (numeric) height of the attached block<br />3. BlockTime (numeric) unix time of the attached block | | Parameters | 1. BlockHash (string) hex-encoded bytes of the attached block hash<br />2. BlockHeight (numeric) height of the attached block<br />3. BlockTime (numeric) unix time of the attached block |
@ -935,7 +927,7 @@ The following is an overview of the JSON-RPC notifications used for Websocket co
<a name="blockdisconnected"/> <a name="blockdisconnected"/>
| | | | | |
|---|---| | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | blockdisconnected | | Method | blockdisconnected |
| Request | [notifyblocks](#notifyblocks) | | Request | [notifyblocks](#notifyblocks) |
| Parameters | 1. BlockHash (string) hex-encoded bytes of the disconnected block hash<br />2. BlockHeight (numeric) height of the disconnected block<br />3. BlockTime (numeric) unix time of the disconnected block | | Parameters | 1. BlockHash (string) hex-encoded bytes of the disconnected block hash<br />2. BlockHeight (numeric) height of the disconnected block<br />3. BlockTime (numeric) unix time of the disconnected block |
@ -948,7 +940,7 @@ The following is an overview of the JSON-RPC notifications used for Websocket co
<a name="recvtx"/> <a name="recvtx"/>
| | | | | |
|---|---| | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Method | recvtx | | Method | recvtx |
| Request | [rescan](#rescan) or [notifyreceived](#notifyreceived) | | Request | [rescan](#rescan) or [notifyreceived](#notifyreceived) |
| Parameters | 1. Transaction (string) full transaction encoded as a hex string<br />2. Block details (object, optional) details about a block and the index of the transaction within a block, if the transaction is mined | | Parameters | 1. Transaction (string) full transaction encoded as a hex string<br />2. Block details (object, optional) details about a block and the index of the transaction within a block, if the transaction is mined |
@ -961,7 +953,7 @@ The following is an overview of the JSON-RPC notifications used for Websocket co
<a name="redeemingtx"/> <a name="redeemingtx"/>
| | | | | |
|---|---| | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | redeemingtx | | Method | redeemingtx |
| Requests | [notifyspent](#notifyspent) and [rescan](#rescan) | | Requests | [notifyspent](#notifyspent) and [rescan](#rescan) |
| Parameters | 1. Transaction (string) full transaction encoded as a hex string<br />2. Block details (object, optional) details about a block and the index of the transaction within a block, if the transaction is mined | | Parameters | 1. Transaction (string) full transaction encoded as a hex string<br />2. Block details (object, optional) details about a block and the index of the transaction within a block, if the transaction is mined |
@ -974,7 +966,7 @@ The following is an overview of the JSON-RPC notifications used for Websocket co
<a name="txaccepted"/> <a name="txaccepted"/>
| | | | | |
|---|---| | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Method | txaccepted | | Method | txaccepted |
| Request | [notifynewtransactions](#notifynewtransactions) | | Request | [notifynewtransactions](#notifynewtransactions) |
| Parameters | 1. TxHash (string) hex-encoded bytes of the transaction hash<br />2. Amount (numeric) sum of the value of all the transaction outpoints | | Parameters | 1. TxHash (string) hex-encoded bytes of the transaction hash<br />2. Amount (numeric) sum of the value of all the transaction outpoints |
@ -987,7 +979,7 @@ The following is an overview of the JSON-RPC notifications used for Websocket co
<a name="txacceptedverbose"/> <a name="txacceptedverbose"/>
| | | | | |
|---|---| | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | txacceptedverbose | | Method | txacceptedverbose |
| Request | [notifynewtransactions](#notifynewtransactions) | | Request | [notifynewtransactions](#notifynewtransactions) |
| Parameters | 1. RawTx (json object) the transaction as a json object (see getrawtransaction json object details) | | Parameters | 1. RawTx (json object) the transaction as a json object (see getrawtransaction json object details) |
@ -1000,7 +992,7 @@ The following is an overview of the JSON-RPC notifications used for Websocket co
<a name="rescanprogress"/> <a name="rescanprogress"/>
| | | | | |
|---|---| | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Method | rescanprogress | | Method | rescanprogress |
| Request | [rescan](#rescan) | | Request | [rescan](#rescan) |
| Parameters | 1. Hash (string) hash of the last processed block<br />2. Height (numeric) height of the last processed block<br />3. Time (numeric) UNIX time of the last processed block | | Parameters | 1. Hash (string) hash of the last processed block<br />2. Height (numeric) height of the last processed block<br />3. Time (numeric) UNIX time of the last processed block |
@ -1013,7 +1005,7 @@ The following is an overview of the JSON-RPC notifications used for Websocket co
<a name="rescanfinished"/> <a name="rescanfinished"/>
| | | | | |
|---|---| | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Method | rescanfinished | | Method | rescanfinished |
| Request | [rescan](#rescan) | | Request | [rescan](#rescan) |
| Parameters | 1. Hash (string) hash of the last rescanned block<br />2. Height (numeric) height of the last rescanned block<br />3. Time (numeric) UNIX time of the last rescanned block | | Parameters | 1. Hash (string) hash of the last rescanned block<br />2. Height (numeric) height of the last rescanned block<br />3. Time (numeric) UNIX time of the last rescanned block |
@ -1026,7 +1018,7 @@ The following is an overview of the JSON-RPC notifications used for Websocket co
<a name="relevanttxaccepted"/> <a name="relevanttxaccepted"/>
| | | | | |
|---|---| | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | relevanttxaccepted | | Method | relevanttxaccepted |
| Request | [loadtxfilter](#loadtxfilter) | | Request | [loadtxfilter](#loadtxfilter) |
| Parameters | 1. Transaction (string) hex-encoded serialized transaction matching the client's filter loaded ith [loadtxfilter](#loadtxfilter) | | Parameters | 1. Transaction (string) hex-encoded serialized transaction matching the client's filter loaded ith [loadtxfilter](#loadtxfilter) |
@ -1038,7 +1030,7 @@ The following is an overview of the JSON-RPC notifications used for Websocket co
<a name="filteredblockconnected"/> <a name="filteredblockconnected"/>
| | | | | |
|---|---| | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | filteredblockconnected | | Method | filteredblockconnected |
| Request | [notifyblocks](#notifyblocks), [loadtxfilter](#loadtxfilter) | | Request | [notifyblocks](#notifyblocks), [loadtxfilter](#loadtxfilter) |
| Parameters | 1. BlockHeight (numeric) height of the attached block<br />2. Header (string) hex-encoded serialized header of the attached block<br />3. Transactions (JSON array) hex-encoded serialized transactions matching the filter for the client connection loaded with [loadtxfilter](#loadtxfilter) | | Parameters | 1. BlockHeight (numeric) height of the attached block<br />2. Header (string) hex-encoded serialized header of the attached block<br />3. Transactions (JSON array) hex-encoded serialized transactions matching the filter for the client connection loaded with [loadtxfilter](#loadtxfilter) |
@ -1051,7 +1043,7 @@ The following is an overview of the JSON-RPC notifications used for Websocket co
<a name="filteredblockdisconnected"/> <a name="filteredblockdisconnected"/>
| | | | | |
|---|---| | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Method | filteredblockdisconnected | | Method | filteredblockdisconnected |
| Request | [notifyblocks](#notifyblocks), [loadtxfilter](#loadtxfilter) | | Request | [notifyblocks](#notifyblocks), [loadtxfilter](#loadtxfilter) |
| Parameters | 1. BlockHeight (numeric) height of the disconnected block<br />2. Header (string) hex-encoded serialized header of the disconnected block | | Parameters | 1. BlockHeight (numeric) height of the disconnected block<br />2. Header (string) hex-encoded serialized header of the disconnected block |
@ -1075,7 +1067,7 @@ various languages.
**9.1 Go** **9.1 Go**
This section provides examples of using the RPC interface using Go and the 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 getblockcount to Retrieve the Current Block Height](#ExampleGetBlockCount)
* [Using getblock to Retrieve the Genesis Block](#ExampleGetBlock) * [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 /> **9.1.1 Using getblockcount to Retrieve the Current Block Height**<br />
The following is an example Go application which uses the The following is an example Go application which uses the
[rpcclient](https://github.com/btcsuite/btcd/tree/master/rpcclient) package to connect with [rpcclient](https://github.com/lbryio/lbcd/tree/master/rpcclient) package to connect with
a btcd instance via Websockets, issues [getblockcount](#getblockcount) to a lbcd instance via Websockets, issues [getblockcount](#getblockcount) to
retrieve the current block height, and displays it. retrieve the current block height, and displays it.
```Go ```Go
@ -1099,16 +1091,16 @@ import (
"log" "log"
"path/filepath" "path/filepath"
"github.com/btcsuite/btcd/rpcclient" "github.com/lbryio/lbcd/rpcclient"
"github.com/btcsuite/btcutil" btcutil "github.com/lbryio/lbcutil"
) )
func main() { func main() {
// Load the certificate for the TLS connection which is automatically // 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. // have one.
btcdHomeDir := btcutil.AppDataDir("btcd", false) lbcdHomeDir := btcutil.AppDataDir("lbcd", false)
certs, err := ioutil.ReadFile(filepath.Join(btcdHomeDir, "rpc.cert")) certs, err := ioutil.ReadFile(filepath.Join(lbcdHomeDir, "rpc.cert"))
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
@ -1116,8 +1108,8 @@ func main() {
// Create a new RPC client using websockets. Since this example is // Create a new RPC client using websockets. Since this example is
// not long-lived, the connection will be closed as soon as the program // not long-lived, the connection will be closed as soon as the program
// exits. // exits.
connCfg := &rpcclient.ConnConfig{ connCfg := &btcrpcclient.ConnConfig{
Host: "localhost:8334", Host: "localhost:9245",
Endpoint: "ws", Endpoint: "ws",
User: "yourrpcuser", User: "yourrpcuser",
Pass: "yourrpcpass", Pass: "yourrpcpass",
@ -1149,8 +1141,8 @@ Which results in:
**9.1.2 Using getblock to Retrieve the Genesis Block**<br /> **9.1.2 Using getblock to Retrieve the Genesis Block**<br />
The following is an example Go application which uses the The following is an example Go application which uses the
[rpcclient](https://github.com/btcsuite/btcd/tree/master/rpcclient) package to connect with [rpcclient](https://github.com/lbryio/lbcd/tree/master/rpcclient) package to connect with
a btcd instance via Websockets, issues [getblock](#getblock) to retrieve a lbcd instance via Websockets, issues [getblock](#getblock) to retrieve
information about the Genesis block, and display a few details about it. information about the Genesis block, and display a few details about it.
```Go ```Go
@ -1162,17 +1154,17 @@ import (
"path/filepath" "path/filepath"
"time" "time"
"github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/lbryio/lbcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/rpcclient" "github.com/lbryio/lbcd/rpcclient"
"github.com/btcsuite/btcutil" btcutil "github.com/lbryio/lbcutil"
) )
func main() { func main() {
// Load the certificate for the TLS connection which is automatically // 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. // have one.
btcdHomeDir := btcutil.AppDataDir("btcd", false) lbcdHomeDir := btcutil.AppDataDir("lbcd", false)
certs, err := ioutil.ReadFile(filepath.Join(btcdHomeDir, "rpc.cert")) certs, err := ioutil.ReadFile(filepath.Join(lbcdHomeDir, "rpc.cert"))
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
@ -1180,8 +1172,8 @@ func main() {
// Create a new RPC client using websockets. Since this example is // Create a new RPC client using websockets. Since this example is
// not long-lived, the connection will be closed as soon as the program // not long-lived, the connection will be closed as soon as the program
// exits. // exits.
connCfg := &rpcclient.ConnConfig{ connCfg := &btcrpcclient.ConnConfig{
Host: "localhost:18334", Host: "localhost:19245",
Endpoint: "ws", Endpoint: "ws",
User: "yourrpcuser", User: "yourrpcuser",
Pass: "yourrpcpass", Pass: "yourrpcpass",
@ -1239,8 +1231,8 @@ Num transactions: 1
Notifications (Websocket-specific)**<br /> Notifications (Websocket-specific)**<br />
The following is an example Go application which uses the The following is an example Go application which uses the
[rpcclient](https://github.com/btcsuite/btcd/tree/master/rpcclient) package to connect with [rpcclient](https://github.com/lbryio/lbcd/tree/master/rpcclient) package to connect with
a btcd instance via Websockets and registers for a lbcd instance via Websockets and registers for
[blockconnected](#blockconnected) and [blockdisconnected](#blockdisconnected) [blockconnected](#blockconnected) and [blockdisconnected](#blockdisconnected)
notifications with [notifyblocks](#notifyblocks). It also sets up handlers for notifications with [notifyblocks](#notifyblocks). It also sets up handlers for
the notifications. the notifications.
@ -1254,9 +1246,9 @@ import (
"path/filepath" "path/filepath"
"time" "time"
"github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/lbryio/lbcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/rpcclient" "github.com/lbryio/lbcd/rpcclient"
"github.com/btcsuite/btcutil" btcutil "github.com/lbryio/lbcutil"
) )
func main() { func main() {
@ -1272,17 +1264,17 @@ func main() {
} }
// Load the certificate for the TLS connection which is automatically // 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. // have one.
btcdHomeDir := btcutil.AppDataDir("btcd", false) lbcdHomeDir := btcutil.AppDataDir("lbcd", false)
certs, err := ioutil.ReadFile(filepath.Join(btcdHomeDir, "rpc.cert")) certs, err := ioutil.ReadFile(filepath.Join(lbcdHomeDir, "rpc.cert"))
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
// Create a new RPC client using websockets. // Create a new RPC client using websockets.
connCfg := &rpcclient.ConnConfig{ connCfg := &btcrpcclient.ConnConfig{
Host: "localhost:8334", Host: "localhost:9245",
Endpoint: "ws", Endpoint: "ws",
User: "yourrpcuser", User: "yourrpcuser",
Pass: "yourrpcpass", Pass: "yourrpcpass",
@ -1337,7 +1329,7 @@ Example output:
**9.2.1 Using notifyblocks to be Notified of Block Connects and Disconnects**<br /> **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) 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 issues [notifyblocks](#notifyblocks) to register for
[blockconnected](#blockconnected) and [blockdisconnected](#blockdisconnected) [blockconnected](#blockconnected) and [blockdisconnected](#blockdisconnected)
notifications, and displays all incoming messages. notifications, and displays all incoming messages.
@ -1347,17 +1339,17 @@ var fs = require('fs');
var WebSocket = require('ws'); var WebSocket = require('ws');
// Load the certificate for the TLS connection which is automatically // 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. // 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 user = "yourusername";
var password = "yourpassword"; 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 // its own certificate authority, so it needs to be specified in the 'ca' array
// for the certificate to properly validate. // for the certificate to properly validate.
var ws = new WebSocket('wss://127.0.0.1:8334/ws', { var ws = new WebSocket('wss://127.0.0.1:9245/ws', {
headers: { headers: {
'Authorization': 'Basic '+new Buffer(user+':'+password).toString('base64') 'Authorization': 'Basic '+new Buffer(user+':'+password).toString('base64')
}, },

View file

@ -1,6 +1,6 @@
# Mining # Mining
btcd supports the `getblocktemplate` RPC. lbcd supports the `getblocktemplate` RPC.
The limited user cannot access this RPC. The limited user cannot access this RPC.
## Add the payment addresses with the `miningaddr` option ## Add the payment addresses with the `miningaddr` option
@ -13,18 +13,20 @@ miningaddr=12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX
miningaddr=1M83ju3EChKYyysmM2FXtLNftbacagd8FR 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. 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 `btcd` RPC Since curl validates the certificate by default, we must install the `lbcd` RPC
certificate into the default system Certificate Authority list. certificate into the default system Certificate Authority list.
## Ubuntu ## Ubuntu
1. Copy rpc.cert to /usr/share/ca-certificates: `# cp /home/user/.btcd/rpc.cert /usr/share/ca-certificates/btcd.crt` 1. Copy rpc.cert to /usr/share/ca-certificates: `# cp /home/user/.lbcd/rpc.cert /usr/share/ca-certificates/lbcd.crt`
2. Add btcd.crt to /etc/ca-certificates.conf: `# echo btcd.crt >> /etc/ca-certificates.conf` 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` 3. Update the CA certificate list: `# update-ca-certificates`
## Set your mining software url to use https ## Set your mining software url to use https
`cgminer -o https://127.0.0.1:8334 -u rpcuser -p rpcpassword` `cgminer -o https://127.0.0.1:9245 -u rpcuser -p rpcpassword`
Alternatively, you can disable TLS with the `--notls` option for the server.

View file

@ -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)

View file

@ -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/...
```

View file

@ -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:
```

View file

@ -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.

View file

@ -1,13 +1,8 @@
integration 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) [![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org)
This contains integration tests which make use of the 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. package to programmatically drive nodes via RPC.
## License
This code is licensed under the [copyfree](http://copyfree.org) ISC License.

View file

@ -1,9 +1,7 @@
rpctest 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) [![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 Package rpctest provides a btcd-specific RPC testing harness crafting and
executing integration tests by driving a `btcd` instance via the `RPC` 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 `btcd`. However, the constructs presented are general enough to be adapted to
any project wishing to programmatically drive a `btcd` instance of its any project wishing to programmatically drive a `btcd` instance of its
systems/integration tests. 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.

View file

@ -1,9 +1,7 @@
mempool 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) [![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. 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 to other peers on the network and notifying the mining process that new
transactions are available. 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 ## Feature Overview
The following is a quick overview of the major features. It is not intended to The following is a quick overview of the major features. It is not intended to
@ -70,14 +63,3 @@ be an exhaustive list.
- The starting priority for the transaction - The starting priority for the transaction
- Manual control of transaction removal - Manual control of transaction removal
- Recursive removal of all dependent transactions - 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.

View file

@ -1,21 +1,8 @@
mining 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) [![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 ## Overview
This package is currently a work in progress. 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.

View file

@ -1,9 +1,9 @@
cpuminer 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) [![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 ## Overview
@ -16,7 +16,7 @@ now.
## Installation and Updating ## Installation and Updating
```bash ```bash
$ go get -u github.com/btcsuite/btcd/mining/cpuminer $ go get -u github.com/lbryio/lbcd/mining/cpuminer
``` ```
## License ## License

View file

@ -1,9 +1,7 @@
netsync 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) [![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 ## 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 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 sync peer that it downloads all blocks from until it is up to date with the
longest chain the sync peer is aware of. 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.

View file

@ -1,16 +1,11 @@
peer 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) [![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 Package peer provides a common base for creating and managing bitcoin network
peers. 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 ## Overview
This package builds upon the wire package, which provides the fundamental 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 - Ability to wait for shutdown/disconnect
- Comprehensive test coverage - 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.

View file

@ -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.

View file

@ -1,13 +1,11 @@
rpcclient 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) [![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 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 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. Bitcoin JSON-RPC API.
## Status ## 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 the infrastructure is complete. However, there are still several RPCs left to
implement and the API is not stable yet. 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 ## Major Features
* Supports Websockets (btcd/btcwallet) and HTTP POST mode (bitcoin core) * Supports Websockets (lbcd/lbcwallet) and HTTP POST mode (bitcoin core)
* Provides callback and registration functions for btcd/btcwallet notifications * Provides callback and registration functions for lbcd/lbcwallet notifications
* Supports btcd extensions * Supports lbcd extensions
* Translates to and from higher-level and easier to use Go types * Translates to and from higher-level and easier to use Go types
* Offers a synchronous (blocking) and asynchronous API * Offers a synchronous (blocking) and asynchronous API
* When running in Websockets mode (the default): * When running in Websockets mode (the default):
@ -44,13 +27,3 @@ implement and the API is not stable yet.
* Registered notifications are automatically reregistered * Registered notifications are automatically reregistered
* Back-off support on reconnect attempts * 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.

View file

@ -10,7 +10,7 @@ block count.
The first step is to use `go get` to download and install the rpcclient package: The first step is to use `go get` to download and install the rpcclient package:
```bash ```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 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: Finally, navigate to the example's directory and run it with:
```bash ```bash
$ cd $GOPATH/src/github.com/btcsuite/btcd/rpcclient/examples/bitcoincorehttp $ cd $GOPATH/src/github.com/lbryio/lbcd/rpcclient/examples/bitcoincorehttp
$ go run *.go $ go run *.go
``` ```

View file

@ -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: The first step is to use `go get` to download and install the rpcclient package:
```bash ```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 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: Finally, navigate to the example's directory and run it with:
```bash ```bash
$ cd $GOPATH/src/github.com/btcsuite/btcd/rpcclient/examples/bitcoincorehttp $ cd $GOPATH/src/github.com/lbryio/lbcd/rpcclient/examples/bitcoincorehttp
$ go run *.go $ go run *.go
``` ```

View file

@ -13,7 +13,7 @@ demonstrate clean shutdown.
The first step is to use `go get` to download and install the rpcclient package: The first step is to use `go get` to download and install the rpcclient package:
```bash ```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 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: Finally, navigate to the example's directory and run it with:
```bash ```bash
$ cd $GOPATH/src/github.com/btcsuite/btcd/rpcclient/examples/btcdwebsockets $ cd $GOPATH/src/github.com/lbryio/lbcd/rpcclient/examples/btcdwebsockets
$ go run *.go $ go run *.go
``` ```

View file

@ -14,7 +14,7 @@ demonstrate clean shutdown.
The first step is to use `go get` to download and install the rpcclient package: The first step is to use `go get` to download and install the rpcclient package:
```bash ```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 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: Finally, navigate to the example's directory and run it with:
```bash ```bash
$ cd $GOPATH/src/github.com/btcsuite/btcd/rpcclient/examples/btcwalletwebsockets $ cd $GOPATH/src/github.com/lbryio/lbcd/rpcclient/examples/btcwalletwebsockets
$ go run *.go $ go run *.go
``` ```

View file

@ -9,7 +9,7 @@ implementing the `name_show` command from Namecoin Core.
The first step is to use `go get` to download and install the rpcclient package: The first step is to use `go get` to download and install the rpcclient package:
```bash ```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 Next, modify the `main.go` source to specify the correct RPC username and
@ -23,7 +23,7 @@ password for the RPC server of your Namecoin Core node:
Finally, navigate to the example's directory and run it with: Finally, navigate to the example's directory and run it with:
```bash ```bash
$ cd $GOPATH/src/github.com/btcsuite/btcd/rpcclient/examples/customcommand $ cd $GOPATH/src/github.com/lbryio/lbcd/rpcclient/examples/customcommand
$ go run *.go $ go run *.go
``` ```

View file

@ -9,8 +9,8 @@ import (
"encoding/json" "encoding/json"
"log" "log"
"github.com/btcsuite/btcd/btcjson" "github.com/lbryio/lbcd/btcjson"
"github.com/btcsuite/btcd/rpcclient" "github.com/lbryio/lbcd/rpcclient"
) )
// NameShowCmd defines the name_show JSON-RPC command. // NameShowCmd defines the name_show JSON-RPC command.

View file

@ -6,12 +6,12 @@
; The directory to store data such as the block chain and peer addresses. The ; 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. ; 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, ; The default is ~/.lbcd/data on POSIX OSes, $LOCALAPPDATA/Lbcd/data on Windows,
; ~/Library/Application Support/Btcd/data on Mac OS, and $home/btcd/data on ; ~/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 ; Plan9. Environment variables are expanded so they may be used. NOTE: Windows
; environment variables are typically %VARIABLE%, but they must be accessed with ; environment variables are typically %VARIABLE%, but they must be accessed with
; $VARIABLE here. Also, ~ is expanded to $LOCALAPPDATA on Windows. ; $VARIABLE here. Also, ~ is expanded to $LOCALAPPDATA on Windows.
; datadir=~/.btcd/data ; datadir=~/.lbcd/data
; ------------------------------------------------------------------------------ ; ------------------------------------------------------------------------------
@ -52,7 +52,7 @@
; upnp=1 ; upnp=1
; Specify the external IP addresses your node is listening on. One address per ; 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 ; 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 ; reachable address unless you specify it here or enable the 'upnp' option (and
; have a supported device). ; have a supported device).
@ -64,7 +64,7 @@
; ;
; Only one of the following two options, 'addpeer' and 'connect', may be ; 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 ; 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 ; 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. ; those described below, you probably won't need to modify anything here.
; ;
@ -86,9 +86,9 @@
; You may specify each IP address with or without a port. The default port will ; You may specify each IP address with or without a port. The default port will
; be added automatically if one is not specified here. ; be added automatically if one is not specified here.
; addpeer=192.168.1.1 ; addpeer=192.168.1.1
; addpeer=10.0.0.2:8333 ; addpeer=10.0.0.2:9246
; addpeer=fe80::1 ; addpeer=fe80::1
; addpeer=[fe80::2]:8333 ; addpeer=[fe80::2]:9246
; Add persistent peers that you ONLY want to connect to as desired. One peer ; Add persistent peers that you ONLY want to connect to as desired. One peer
; per line. You may specify each IP address with or without a port. The ; per line. You may specify each IP address with or without a port. The
@ -96,9 +96,9 @@
; NOTE: Specifying this option has other side effects as described above in ; NOTE: Specifying this option has other side effects as described above in
; the 'addpeer' versus 'connect' summary section. ; the 'addpeer' versus 'connect' summary section.
; connect=192.168.1.1 ; connect=192.168.1.1
; connect=10.0.0.2:8333 ; connect=10.0.0.2:9246
; connect=fe80::1 ; connect=fe80::1
; connect=[fe80::2]:8333 ; connect=[fe80::2]:9246
; Maximum number of inbound and outbound peers. ; Maximum number of inbound and outbound peers.
; maxpeers=125 ; maxpeers=125
@ -124,7 +124,7 @@
; whitelist=192.168.0.0/24 ; whitelist=192.168.0.0/24
; whitelist=fd00::/16 ; 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. ; DNS to query for available peers to connect with.
; nodnsseed=1 ; nodnsseed=1
@ -138,16 +138,16 @@
; listen=0.0.0.0 ; listen=0.0.0.0
; All ipv6 interfaces on default port: ; All ipv6 interfaces on default port:
; listen=:: ; listen=::
; All interfaces on port 8333: ; All interfaces on port 9246:
; listen=:8333 ; listen=:9246
; All ipv4 interfaces on port 8333: ; All ipv4 interfaces on port 9246:
; listen=0.0.0.0:8333 ; listen=0.0.0.0:9246
; All ipv6 interfaces on port 8333: ; All ipv6 interfaces on port 9246:
; listen=[::]:8333 ; listen=[::]:9246
; Only ipv4 localhost on port 8333: ; Only ipv4 localhost on port 9246:
; listen=127.0.0.1:8333 ; listen=127.0.0.1:9246
; Only ipv6 localhost on port 8333: ; Only ipv6 localhost on port 9246:
; listen=[::1]:8333 ; listen=[::1]:9246
; Only ipv4 localhost on non-standard port 8336: ; Only ipv4 localhost on non-standard port 8336:
; listen=127.0.0.1:8336 ; listen=127.0.0.1:8336
; All interfaces on non-standard port 8336: ; All interfaces on non-standard port 8336:
@ -185,7 +185,7 @@
; ------------------------------------------------------------------------------ ; ------------------------------------------------------------------------------
; RPC server options - The following options control the built-in RPC server ; 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 ; NOTE: The RPC server is disabled by default if rpcuser AND rpcpass, or
; rpclimituser AND rpclimitpass, are not specified. ; rpclimituser AND rpclimitpass, are not specified.
@ -369,7 +369,7 @@
; Debug logging level. ; Debug logging level.
; Valid levels are {trace, debug, info, warn, error, critical} ; Valid levels are {trace, debug, info, warn, error, critical}
; You may also specify <subsystem>=<level>,<subsystem2>=<level>,... to set ; 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. ; available subsystems.
; debuglevel=info ; debuglevel=info

View file

@ -1,15 +1,11 @@
txscript 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 Package txscript implements the bitcoin transaction script language. There is
a comprehensive test suite. a comprehensive test suite.
This package has intentionally been designed so it can be used as a standalone This package has been augmented to include support for LBRY's custom claim operations.
package for any projects needing to use or validate bitcoin transaction scripts. See https://lbry.tech/spec
## Bitcoin Scripts ## Bitcoin Scripts
@ -17,51 +13,3 @@ Bitcoin provides a stack-based, FORTH-like language for the scripts in
the bitcoin transactions. This language is not turing complete the bitcoin transactions. This language is not turing complete
although it is still fairly powerful. A description of the language although it is still fairly powerful. A description of the language
can be found at https://en.bitcoin.it/wiki/Script 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.
* [Counting Opcodes in Scripts](http://godoc.org/github.com/decred/dcrd/txscript#example-ScriptTokenizer)
Demonstrates creating a script tokenizer instance and using it to count the
number of opcodes a script contains.
## 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.

View file

@ -1,26 +1,14 @@
wire 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 Package wire implements the bitcoin wire protocol. A comprehensive suite of
tests with 100% test coverage is provided to ensure proper functionality. tests with 100% test coverage is provided to ensure proper functionality.
There is an associated blog post about the release of this package 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/). [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 This package has been augmented from the original btcd implementation.
package for any projects needing to interface with bitcoin peers at the wire The block header was modified to contain the claimtrie hash.
protocol level.
## Installation and Updating
```bash
$ go get -u github.com/btcsuite/btcd/wire
```
## Bitcoin Message Overview ## Bitcoin Message Overview
@ -86,28 +74,3 @@ from a remote peer is:
// Log and handle the error // 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.