Ethereum <-> Parity Substrate Blockchain bridge for self transfers of DAI Token (ERC20) to sDAI (ERC20 representation).
- Make sure you have Ethereum and Substrate extensions. Typical choices would be:
a.Metamask
(or any other Ethereum extension) and switch it toKovan
b.polkadot{.js}
- Go here
- Connect with both extensions(two pop-up windows should appear)
- You will see that your balances from extensions should appear on the page.
- Transfer some Kovan test DAI to our Substrate-based chain.
- Transfer some DAI from our chain to your Ethereum account.
It should be pretty obvious from this point. If you hit any problems, please feel free to file an issue!
├── bridge │ ├── ethereum │ ├── frontend │ └── validator - Validator service to connect Substrate to Ethereum. ├── runtime ├── scripts ├── src
curl https://sh.rustup.rs -sSf | sh
./scripts/init.sh
./scripts/build.sh
cargo build
Follow the validator README instructions.
Follow the frontend README instructions.
cargo run -- --name node-name
You can start a development chain with:
cargo run -- --dev
Detailed logs may be shown by running the node with the following environment variables set: RUST_LOG=debug RUST_BACKTRACE=1 cargo run -- --dev
.
If you want to see the multi-node consensus algorithm in action locally, then you can create a local testnet with two validator nodes for Alice and Bob, who are the initial authorities of the genesis chain that have been endowed with testnet units. Give each node a name and expose them so they are listed on the Polkadot telemetry site. You'll need two terminal windows open.
We'll start Alice's Substrate node first on default TCP port 30333 with her chain database stored locally at /tmp/alice
. The bootnode ID of her node is QmQZ8TjTqeDj3ciwr93EJ95hxfDsb9pEYDizUAbWpigtQN
, which is generated from the --node-key
value that we specify below:
cargo run -- \
--base-path /tmp/alice \
--chain=local \
--alice \
--node-key 0000000000000000000000000000000000000000000000000000000000000001 \
--telemetry-url ws://telemetry.polkadot.io:1024 \
--validator
In the second terminal, we'll start Bob's Substrate node on a different TCP port of 30334, and with his chain database stored locally at /tmp/bob
. We'll specify a value for the --bootnodes
option that will connect his node to Alice's bootnode ID on TCP port 30333:
cargo run -- \
--base-path /tmp/bob \
--bootnodes /ip4/127.0.0.1/tcp/30333/p2p/QmQZ8TjTqeDj3ciwr93EJ95hxfDsb9pEYDizUAbWpigtQN \
--chain=local \
--bob \
--port 30334 \
--telemetry-url ws://telemetry.polkadot.io:1024 \
--validator
Additional CLI usage options are available and may be shown by running cargo run -- --help
.
In case you want to test it in a customise-all-the-things fashion, buckle up for some extra work!
This guide will walk you through how to create an account and how to connect to AkropolisOSChain Testnet.
-
Run the node (previous steps, Build -> Run)
-
Open Akropolis UI (it’s polkadotJS app working with Substrate v.1.0). You can also use Polkadot UI.
-
Go to Settings, open Developer tab. Insert in textbox description of types (copy&paste from here) and Save it.
{
"Count": "u64",
"MemberId": "u64",
"ProposalId": "u64",
"TokenBalance": "u64",
"TokenId": "u32",
"Token": {
"token_id": "u32",
"decimals": "u16",
"symbol": "Vec<u8>"
},
"Status": {
"_enum":[
"Pending",
"Deposit",
"Withdraw",
"Approved",
"Canceled",
"Confirmed"
]
},
"Message": {
"message_id": "H256",
"eth_address": "H160",
"substrate_address": "AccountId",
"amount": "TokenBalance",
"status": "Status",
"direction": "Status"
},
"BridgeTransfer": {
"transfer_id": "ProposalId",
"message_id": "H256",
"open": "bool",
"votes": "MemberId"
}
}
-
Create an account for each validator you want to launch. Go to Accounts and generate new account(and modify validators mnemonic phrase in .env file) for each validator.
-
Repeat step 4 for each validator in case you have more than one.
-
Modify validators in chain_spec.rs in GenesisConfig -> bridge
-
Repeat Build + Run instructions
-
Launch bridge/frontend(you also might need to tweak the keys and endpoints there)
-
Enjoy your local ERC20 Substrate <--> Ethereum bridge in your browser