Go to file
Yurii Rashkovskii 379973f315
Problem: tracking RequiredSignaturesChanged is complicated
This requires retreiving validators contract, calling
`requiredSignatures()` and carefully tracking
`RequiredSignaturesChanged` events.

Solution: use recently introduced additional parameter in
CollectedSignatures to obtain the number of required signatures.
2018-05-23 01:02:12 -07:00
bridge Problem: tracking RequiredSignaturesChanged is complicated 2018-05-23 01:02:12 -07:00
cli Problem: tracking RequiredSignaturesChanged is complicated 2018-05-23 01:02:12 -07:00
contracts Problem: tracking RequiredSignaturesChanged is complicated 2018-05-23 01:02:12 -07:00
examples Problem: required_signatures is static 2018-05-19 08:38:53 -07:00
integration-tests Problem: bridge should not deploy its contracts anymore 2018-05-01 09:43:34 -07:00
res res 2017-08-13 19:43:43 +02:00
tests Merge branch 'raw-transactions' into rpc+raw-transactions 2018-04-26 18:21:07 -07:00
tools tools/estimate_gas_costs.sh: improve wording 2018-01-04 16:27:49 +01:00
truffle verifySignatures -> hasEnoughValidSignatures and make it return bool 2018-02-13 17:18:24 +01:00
.editorconfig fixed signature validation in solidity, added truffle tests for it 2017-09-04 12:49:05 +02:00
.gitignore Problem: yarn.lock entry in gitignore 2018-04-19 09:51:37 -07:00
.travis.yml .travis.yml: run integration tests as part of stable, beta and nightly 2018-01-22 14:35:54 +01:00
Cargo.lock Prepare 0.2.0 2018-05-08 11:03:33 -07:00
Cargo.toml Problem: Cargo manifest still includes test_bridge_stuff 2018-04-19 09:51:37 -07:00
LICENSE LICENSE 2017-09-28 10:51:23 +02:00
Makefile Problem: bridge should not deploy its contracts anymore 2018-05-01 09:43:34 -07:00
README.md Problem: required_signatures is static 2018-05-19 08:38:53 -07:00

README.md

POA-Ethereum Bridge

Join the chat at https://gitter.im/poanetwork/poa-bridge Waffle.io - Columns and their card count

This is software to be operated by POA bridge validators to faciliate proof-of-authority based briding of POA to tokens on an another Ethereum-based blockchain.

The validators work with POA bridge contracts to convert ether on one chain into the same amount of ERC20 tokens on the other and back.

This software works in conjunction with other projects:

Functionality

The bridge connects two chains (home and foreign). When a user deposits ether into the bridge contract contract on home they get the same amount of ERC20 tokens on foreign, and they can convert them back as well.

Deposit

deposit

Withdraw

withdraw

How to build

Requires rust and cargo: installation instructions.

Requires solc to be in $PATH: installation instructions.

Assuming you've cloned the bridge (git clone git@github.com:poanetwork/poa-bridge.git), run

cd poa-bridge
make

and install ../target/release/bridge in your $PATH.

Running

bridge --config config.toml --database db.toml
  • --config - location of the configuration file. configuration file must exist
  • --database - location of the database file.

Exit Status Codes

Code Meaning
0 Success
1 Unknwon error
2 I/O error
3 Shutdown requested
4 Insufficient funds
5 Gas too low
6 Gas price is too low
7 Nonce reused
10 Cannot connect
11 Connection lost
12 Bridge crashed
20 RPC error

Configuration file example

keystore = "/path/to/keystore"

[home]
account = "0x006e27b6a72e1f34c626762f3c4761547aff1421"
rpc_host = "http://localhost"
rpc_port = 8545
required_confirmations = 0
password = "home_password.txt"

[foreign]
account = "0x006e27b6a72e1f34c626762f3c4761547aff1421"
rpc_host = "http://localhost"
rpc_port = 9545
required_confirmations = 0
password = "foreign_password.txt"

[authorities]
accounts = [
    "0x006e27b6a72e1f34c626762f3c4761547aff1421",
    "0x006e27b6a72e1f34c626762f3c4761547aff1421",
    "0x006e27b6a72e1f34c626762f3c4761547aff1421"
]

[transactions]
deposit_relay = { gas = 3000000, gas_price = 1000000000 }
withdraw_relay = { gas = 3000000, gas_price = 1000000000 }
withdraw_confirm = { gas = 3000000, gas_price = 1000000000 }

Options

  • keystore - path to a keystore directory with JSON keys

home/foreign options

  • home/foreign.account - authority address on the home (required)
  • home/foreign.rpc_host - RPC host (required)
  • home/foreign.rpc_port - RPC port (defaults to 8545)
  • home/foreign.required_confirmations - number of confirmation required to consider transaction final on home (default: 12)
  • home/foreign.poll_interval - specify how often home node should be polled for changes (in seconds, default: 1)
  • home/foreign.request_timeout - specify request timeout (in seconds, default: 3600)
  • home/foreign.password - path to the file containing a password for the validator's account (to decrypt the key from the keystore)

authorities options

  • authorities.account - all authorities (required)

transaction options

  • transaction.deposit_relay.gas - specify how much gas should be consumed by deposit relay
  • transaction.deposit_relay.gas_price - specify gas price for deposit relay
  • transaction.deposit_relay.concurrency - how many concurrent transactions can be sent (default: 100)
  • transaction.withdraw_confirm.gas - specify how much gas should be consumed by withdraw confirm
  • transaction.withdraw_confirm.gas_price - specify gas price for withdraw confirm
  • transaction.withdraw_confirm.concurrency - how many concurrent transactions can be sent (default: 100)
  • transaction.withdraw_relay.gas - specify how much gas should be consumed by withdraw relay
  • transaction.withdraw_relay.gas_price - specify gas price for withdraw relay
  • transaction.withdraw_relay.concurrency - how many concurrent transactions can be sent (default: 100)

Database file format

home_contract_address = "0x49edf201c1e139282643d5e7c6fb0c7219ad1db7"
foreign_contract_address = "0x49edf201c1e139282643d5e7c6fb0c7219ad1db8"
checked_deposit_relay = 120
checked_withdraw_relay = 121
checked_withdraw_confirm = 121

all fields are required

  • home_contract_address - address of the bridge contract on home chain
  • foreign_contract_address - address of the bridge contract on foreign chain
  • checked_deposit_relay - number of the last block for which an authority has relayed deposits to the foreign
  • checked_withdraw_relay - number of the last block for which an authority has relayed withdraws to the home
  • checked_withdraw_confirm - number of the last block for which an authority has confirmed withdraw