Oracle, Vault & Staked Relayer
This project is currently under active development.
Download and start Bitcoin Core:
bitcoind -regtest -server
Build and run the PolkaBTC Parachain:
git clone [email protected]:interlay/btc-parachain.git
cd btc-parachain
cargo run --release -- --dev
Generate an address and mine some blocks:
address=`bitcoin-cli -regtest getnewaddress`
bitcoin-cli -regtest generatetoaddress 101 $address
Note: This may require
rpcuser
andrpcpassword
to be set.
Alternatively run bitcoin-cli
from docker:
docker run --network host --entrypoint bitcoin-cli ruimarinho/bitcoin-core:0.20 -regtest -rpcuser=rpcuser -rpcpassword=rpcpassword ${COMMAND}
Building requires Rust nightly
. Run the following commands to set it up:
rustup toolchain install nightly-2021-01-25
rustup default nightly-2021-01-25
PolkaBTC requires a price oracle to calculate collateralization rates, for local development we can run this client to automatically update the exchange rate at a pre-determined time interval.
cargo run --bin oracle
The Staked Relayer client is responsible for submitting Bitcoin block headers to PolkaBTC and reporting on various error states.
source .env
cargo run --bin staked-relayer -- --http-addr '[::0]:3030'
To interact with PolkaBTC directly, use the testdata-gen client.
source .env
cargo run --bin testdata-gen -- --keyring bob set-exchange-rate --exchange-rate 1
The Vault client is used to intermediate assets between Bitcoin and PolkaBTC.
source .env
cargo run --bin vault
Too many open files
On cargo test
the embedded parachain node in the integration tests can consume a lot of resources. Currently the best workaround is to increase the resource limits of the current user.
Use ulimit -a
to list the current resource limits. To increase the maximum number of files set ulimit -n 4096
or some other reasonable limit.