Skip to content

PolkaBTC Clients | Vault, Staked Relayer, Oracle, Faucet

License

Notifications You must be signed in to change notification settings

sander2/polkabtc-clients

 
 

Repository files navigation

PolkaBTC Clients

Oracle, Vault & Staked Relayer

This project is currently under active development.

Prerequisites

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 and rpcpassword 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}

Development

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

Getting Started

Oracle

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

Staked Relayer

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'

Testdata

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

Vault

The Vault client is used to intermediate assets between Bitcoin and PolkaBTC.

source .env
cargo run --bin vault

Troubleshooting

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.

About

PolkaBTC Clients | Vault, Staked Relayer, Oracle, Faucet

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 98.2%
  • Other 1.8%