This repository has been archived by the owner on Sep 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from paritytech/snd-deployment-guide
deployment guide and other improvements to docs
- Loading branch information
Showing
7 changed files
with
234 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
# deployment guide | ||
|
||
this guide assumes that you are one of the authorities of | ||
a PoA chain `foreign` and want to use the bridge to connect | ||
`foreign` to another chain `home`. | ||
this will create an ERC20 token on `foreign` that is backed by | ||
ether on `home`. | ||
|
||
since all bridge authorities use the same contracts on `foreign` and `home` | ||
one authority has to go ahead and deploy them. | ||
|
||
let's call this the **deploying authority**. | ||
|
||
if the process is done correctly the other non-deploying authorities don't have to trust | ||
the deploying authority. | ||
|
||
upfront you must know the addresses of all authorities (`authorities`) | ||
es well as the number of `required_signatures` | ||
|
||
## initial deployment steps for any authority (deploying and non-deploying) | ||
|
||
given you are authority with `authority_address`. | ||
|
||
[build and install the bridge](README.md#build) | ||
|
||
install parity. | ||
we tested it with [parity 1.8.10](https://github.com/paritytech/parity/releases/tag/v1.8.10) | ||
though it should work with the latest stable release. | ||
|
||
start a parity node that connects to `home` chain, has `authority_address` unlocked | ||
and ipc enabled at `home.ipc`. TODO add instructions. please refer to | ||
the parity documentation for now. | ||
|
||
start a parity node that connects to `foreign` chain, has `authority_address` unlocked | ||
and ipc enabled at `foreign.ipc`. TODO add instructions. please refer to | ||
the parity documentation for now. | ||
|
||
### configure the bridge | ||
|
||
copy [integration-tests/bridge_config.toml](integration-tests/bridge_config.toml) | ||
to a local `bridge_config.toml`. | ||
|
||
within `bridge_config.toml` resolve/fill-in all the `ACTION REQUIRED`s. | ||
|
||
for help refer to the comments, [the config option documentation](README.md#configuration). | ||
or [![Join the chat at https://gitter.im/paritytech/parity-bridge](https://badges.gitter.im/paritytech/parity-bridge.svg)](https://gitter.im/paritytech/parity-bridge?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
|
||
[if you're the **leading** authority continue here](#further-deployment-steps-for-leading-authority) | ||
|
||
[if you're a non-leading authority continue here](#further-deployment-steps-for-non-leading-authorities) | ||
|
||
## further deployment steps for leading authority | ||
|
||
start the bridge by executing: | ||
|
||
``` | ||
env RUST_LOG=info bridge --config bridge_config.toml --database bridge.db | ||
``` | ||
|
||
it should eventually print something like this: | ||
|
||
``` | ||
INFO:bridge: Deployed new bridge contracts | ||
INFO:bridge: | ||
home_contract_address = "0xebd3944af37ccc6b67ff61239ac4fef229c8f69f" | ||
foreign_contract_address = "0xebd3944af37ccc6b67ff61239ac4fef229c8f69f" | ||
home_deploy = 1 | ||
foreign_deploy = 1 | ||
checked_deposit_relay = 1 | ||
checked_withdraw_relay = 1 | ||
checked_withdraw_confirm = 1 | ||
``` | ||
|
||
**congratulations! the bridge has successfully deployed its contracts on both chains** | ||
|
||
`bridge.db` should now look similar to this: | ||
|
||
``` | ||
home_contract_address = "0xebd3944af37ccc6b67ff61239ac4fef229c8f69f" | ||
foreign_contract_address = "0xebd3944af37ccc6b67ff61239ac4fef229c8f69f" | ||
home_deploy = 1 | ||
foreign_deploy = 1 | ||
checked_deposit_relay = 3 | ||
checked_withdraw_relay = 4 | ||
checked_withdraw_confirm = 4 | ||
``` | ||
|
||
(verify the contracts deployed to `home_contract_address` and | ||
`foreign_contract_address` using | ||
https://etherscan.io/verifyContract so the other authorities | ||
can verify that you did an honest deploy without having to trust you.) | ||
|
||
give the `bridge.db` file to the other authorities. | ||
for example by posting it as a gist. | ||
the database file doesn't contain any sensitive information. | ||
|
||
ask the other authorities to follow **this guide you're reading**. | ||
|
||
ensure the process keeps running. else the bridge won't function. | ||
(outside the scope of this guide, your devops team knows what to do). | ||
|
||
## further deployment steps for non-leading authorities | ||
|
||
you MUST receive a `bridge.db` from the leading authority. | ||
|
||
it should look similar to this: | ||
|
||
``` | ||
home_contract_address = "0xebd3944af37ccc6b67ff61239ac4fef229c8f69f" | ||
foreign_contract_address = "0xebd3944af37ccc6b67ff61239ac4fef229c8f69f" | ||
home_deploy = 1 | ||
foreign_deploy = 1 | ||
checked_deposit_relay = 3 | ||
checked_withdraw_relay = 4 | ||
checked_withdraw_confirm = 4 | ||
``` | ||
|
||
(check that the contracts deployed to | ||
`home_contract_address` and `foreign_contract_address` are | ||
verified on https://etherscan.io and that the source code matches | ||
the code in the repo.) | ||
|
||
start the bridge by executing: | ||
|
||
``` | ||
env RUST_LOG=info bridge --config bridge_config.toml --database bridge.db | ||
``` | ||
|
||
it should eventually print this line: | ||
|
||
``` | ||
INFO:bridge: Starting listening to events | ||
``` | ||
|
||
**congratulations! the bridge has successfully started and joined the other authorities** | ||
|
||
ensure the process keeps running. else the bridge won't function. | ||
(outside the scope of this guide, your devops team knows what to do). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,65 @@ | ||
# READ THE CONFIG DOCUMENTATION AT: | ||
# https://github.com/paritytech/parity-bridge/#configuration | ||
|
||
# ACTION REQUIRED: for test deployment set this to `"100000"` | ||
estimated_gas_cost_of_withdraw = "0" | ||
|
||
# limits total balance on `home` and therefore total ether that could get lost | ||
# if the bridge is faulty or compromised in any way! | ||
# set to `"0"` to disable limit (not recommended at this point) | ||
# currently set to 10 ether. | ||
max_total_home_contract_balance = "10000000000000000000" | ||
|
||
# set to `"0"` to disable limit (not recommended at this point) | ||
max_single_deposit_value = "1000000000000000000" | ||
|
||
[home] | ||
# ACTION REQUIRED: set to your authority address | ||
account = "0x00bd138abd70e2f00903268f3db08f2d25677c9e" | ||
# ACTION REQUIRED: set the the ipc socket of the parity node that has `home.account` unlocked | ||
ipc = "./home.ipc" | ||
# ACTION REQUIRED: for test deployment set this to 12 | ||
required_confirmations = 0 | ||
|
||
[home.contract] | ||
# READ THE CONFIG DOCUMENTATION AT: | ||
# https://github.com/paritytech/parity-bridge/#configuration | ||
bin = "../compiled_contracts/HomeBridge.bin" | ||
|
||
[foreign] | ||
# ACTION REQUIRED: set to your authority address | ||
account = "0x00bd138abd70e2f00903268f3db08f2d25677c9e" | ||
# ACTION REQUIRED: set the the ipc socket of the parity node that has `foreign.account` unlocked | ||
ipc = "./foreign.ipc" | ||
# ACTION REQUIRED: for test deployment set this to 12 | ||
required_confirmations = 0 | ||
|
||
[foreign.contract] | ||
# READ THE CONFIG DOCUMENTATION AT: | ||
# https://github.com/paritytech/parity-bridge/#configuration | ||
bin = "../compiled_contracts/ForeignBridge.bin" | ||
|
||
[authorities] | ||
# ACTION REQUIRED: set this to the addresses of the authority list | ||
accounts = [ | ||
"0x00bd138abd70e2f00903268f3db08f2d25677c9e", | ||
] | ||
# ACTION REQUIRED: set this to a (super-)majority of `authorities.accounts` | ||
# example: set to 3 for 5 authorities. set to 7 for 10 authorities | ||
required_signatures = 1 | ||
|
||
[transactions] | ||
home_deploy = { gas = 1000000 } | ||
foreign_deploy = { gas = 3000000 } | ||
deposit_relay = { gas = 150000 } | ||
withdraw_relay = { gas = 100000 } | ||
withdraw_confirm = { gas = 300000 } | ||
# `gas` below should be good defaults for test deployment. | ||
# ACTION REQUIRED: you have to set `gas_price` for each transaction | ||
# if your authority can't do free transactions on the chain. | ||
# `gas_price` might need adjustment once in a while. | ||
|
||
# these happen on `home`: | ||
home_deploy = { gas = 1000000 , gas_price = 0 } | ||
withdraw_relay = { gas = 100000 , gas_price = 0 } | ||
|
||
# these happen on `foreign`: | ||
foreign_deploy = { gas = 3000000 , gas_price = 0 } | ||
deposit_relay = { gas = 150000 , gas_price = 0 } | ||
|
||
withdraw_confirm = { gas = 300000 , gas_price = 0 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.