Go to file
5chdn 904db19ec0
Update README to reflect changes to logging.
2017-08-29 15:44:04 +02:00
bencher lost files 2017-08-14 10:24:57 +03:00
chain fixed grumbles 2017-08-28 09:10:49 +03:00
crypto hash block and transactions while reading them 2016-12-13 18:06:46 +01:00
db rollback command implemented 2017-08-23 12:24:09 +03:00
doc Merge branch 'master' of github.com:paritytech/parity-bitcoin into csv 2017-05-03 14:37:54 +02:00
docker fix strip in docker 2017-05-12 21:05:01 +03:00
import cleanup docs 2016-12-15 16:03:59 +01:00
keys keys::Address remote serialization 2017-05-06 17:55:17 +02:00
logs Improved logging to console (#440) 2017-08-17 22:45:36 +02:00
message segwit: initial flush 2017-08-22 14:39:10 +03:00
miner uahf: REQ-7 difficulty adjustment 2017-08-08 18:33:55 +03:00
network uahf: input_index check is back in SignatureHash 2017-08-23 13:48:49 +03:00
p2p segwit: sync changes 2017-08-22 14:40:04 +03:00
pbtc Default to default logging sync=info 2017-08-29 15:36:26 +02:00
primitives segwit: initial flush 2017-08-22 14:39:10 +03:00
rpc segwit: initial flush 2017-08-22 14:39:10 +03:00
script fixed OP_NOP 2017-08-23 17:26:38 +03:00
serialization segwit: optimized size_with_witness 2017-08-23 12:49:22 +03:00
serialization_derive serialization_derive does depend on serialization 2017-07-22 16:25:42 +02:00
snap Add the packaging metadata to build the parity-bitcoin snap 2017-06-11 16:47:13 +00:00
sync Merge pull request #444 from paritytech/support_segwit 2017-08-28 15:37:33 +03:00
test-data segwit: initial flush 2017-08-22 14:39:10 +03:00
tools chain uses serialization_derive 2017-07-22 02:53:02 +02:00
verification add script error to TransactionError::Signature 2017-08-23 17:26:19 +03:00
.dockerignore basic docker setup 2017-04-05 16:29:46 +07:00
.editorconfig tests for block hash, .editorconfig and bitcoin network enum 2016-08-16 14:32:24 +02:00
.gitignore Merge branch 'master' into mempool 2016-10-16 21:38:04 +03:00
.gitlab-ci.yml fix typo 2017-05-12 17:57:00 +03:00
.gitmodules Regtests on the CI (#244) 2016-12-02 10:27:48 +01:00
.travis.yml generate documentation only for pbtc 2017-05-20 17:42:34 +02:00
Cargo.lock segwit: commitment check + weight check 2017-08-22 14:39:10 +03:00
Cargo.toml chain uses serialization_derive 2017-07-22 02:53:02 +02:00
LICENSE Initial commit 2016-08-15 11:30:16 +02:00
README.md Update README to reflect changes to logging. 2017-08-29 15:44:04 +02:00

README.md

parity-bitcoin

The Parity Bitcoin client

Build Status Snap Status

Gitter Gitter https://gitter.im/paritytech/parity-bitcoin

Installing from source

Installing pbtc from source requires rustc and cargo.

Minimal supported version is rustc 1.16.0 (30cf806ef 2017-03-10)

Install rustc and cargo

Both rustc and cargo are a part of rust toolchain.

An easy way to install the stable binaries for Linux and Mac is to run this in your shell:

curl -sSf https://static.rust-lang.org/rustup.sh | sh

Windows binaries can be downloaded from rust-lang website.

Install C and C++ compilers

You will need the cc and gcc compilers to build some of the dependencies.

sudo apt-get update
sudo apt-get install build-essential

Clone and build pbtc

Now let's clone pbtc and enter it's directory:

git clone https://github.com/paritytech/parity-bitcoin
cd parity-bitcoin

pbtc can be build in two modes. --debug and --release. Debug is the default.

# builds pbtc in debug mode
cargo build -p pbtc
# builds pbtc in release mode
cargo build -p pbtc --release

pbtc is now available at either ./target/debug/pbtc or ./target/release/pbtc.

Installing the snap

In any of the supported Linux distros:

sudo snap install parity-bitcoin --edge

Running tests

pbtc has internal unit tests and it conforms to external integration tests.

Running unit tests

Assuming that repo is already cloned, we can run unit tests with this command:

./tools/test.sh

Running external integration tests

Running integration tests is automated, as regtests repo is one of the submodules. Let's download it first:

git submodule update --init

Now we can run them:

./tools/regtests.sh

It's also possible to run regtests manually:

# let's start pbtc in regtest compatible mode
./target/release/pbtc --regtest

# now in second shell window
cd $HOME
git clone https://github.com/TheBlueMatt/test-scripts
cd test-scripts
java -jar pull-tests-f56eec3.jar

Going online

By default parity connects to bitcoind seednodes. Full list is here.

To start syncing the mainnet, just start the client:

./target/release/pbtc

To start syncing the testnet:

./target/release/pbtc --testnet

To not print any syncing progress add --quiet flag:

./target/release/pbtc --quiet

Importing bitcoind database

It it is possible to import existing bitcoind database:

# where $BITCOIND_DB is path to your bitcoind database, e.g., "/Users/user/Library/Application Support"
./target/release/pbtc import "$BITCOIND_DB/Bitcoin/blocks"

By default import verifies imported the blocks. You can disable this, by adding `--skip-verification flag.

./target/release/pbtc import "#BITCOIND_DB/Bitcoin/blocks" --skip-verification

Command line interface

Full list of CLI options, which is available under pbtc --help:

pbtc 0.1.0
Parity Technologies <info@parity.io>
Parity Bitcoin client

USAGE:
    pbtc [FLAGS] [OPTIONS] [SUBCOMMAND]

FLAGS:
        --bitcoin-cash    Use Bitcoin Cash verification rules.
    -h, --help            Prints help information
        --no-jsonrpc      Disable the JSON-RPC API server.
    -q, --quiet           Do not show any synchronization information in the console.
        --regtest         Use a private network for regression tests.
        --segwit2x        Enable SegWit2x verification rules.
        --testnet         Use the test network (Testnet3).
    -V, --version         Prints version information

OPTIONS:
        --blocknotify <COMMAND>            Execute COMMAND when the best block changes (%s in COMMAND is replaced by the block hash).
    -c, --connect <IP>                     Connect only to the specified node.
    -d, --data-dir <PATH>                  Specify the database and configuration directory PATH.
        --db-cache <SIZE>                  Sets the database cache size.
        --jsonrpc-apis <APIS>              Specify the APIs available through the JSONRPC interface. APIS is a comma-delimited list of API names.
        --jsonrpc-cors <URL>               Specify CORS header for JSON-RPC API responses.
        --jsonrpc-hosts <HOSTS>            List of allowed Host header values.
        --jsonrpc-interface <INTERFACE>    The hostname portion of the JSONRPC API server.
        --jsonrpc-port <PORT>              Specify the PORT for the JSONRPC API server.
        --only-net <NET>                   Only connect to nodes in network version <NET> (ipv4 or ipv6).
        --port <PORT>                      Listen for connections on PORT.
    -s, --seednode <IP>                    Connect to a seed-node to retrieve peer addresses, and disconnect.
        --verification-edge <BLOCK>        Non-default verification-level is applied until a block with given hash is met.
        --verification-level <LEVEL>       Sets the Blocks verification level to full (default), header (scripts are not verified), or none (no verification at all).

SUBCOMMANDS:
    help        Prints this message or the help of the given subcommand(s)
    import      Import blocks from a Bitcoin Core database.
    rollback    Rollback the database to given canonical-chain block.

JSON-RPC

TODO

Logging

This is a section only for dev / power users.

You can enable detailed client logging by setting env variable RUST_LOG, e.g.,

RUST_LOG=verification=info ./target/release/pbtc --quiet

pbtc started with this env variable will print all logs comming from verification module with verbosity info or higher. Available log levels are:

  • error
  • warn
  • info
  • debug
  • trace

It's also possible to start logging from multiple modules in the same time:

RUST_LOG=sync=trace,p2p=trace,verification=trace,db=trace ./target/release/pbtc --quiet

Note: RUST_LOG does only work together with command line option --quiet which will surpress the default sync=info logging.

Internal documentation

Once released, pbtc documentation will be available here. Meanwhile it's only possible to build it locally:

cd parity-bitcoin
./tools/doc.sh
open target/doc/pbtc/index.html