https://github.com/wetrustplatform/poa-interchain-node
Transfer ether between a main chain and a PoA side chain using multisig wallets
https://github.com/wetrustplatform/poa-interchain-node
dapp ethereum native-dapp proof-of-authority sidechain
Last synced: 5 months ago
JSON representation
Transfer ether between a main chain and a PoA side chain using multisig wallets
- Host: GitHub
- URL: https://github.com/wetrustplatform/poa-interchain-node
- Owner: WeTrustPlatform
- License: gpl-3.0
- Created: 2018-05-16T06:41:12.000Z (about 8 years ago)
- Default Branch: develop
- Last Pushed: 2018-06-27T08:51:33.000Z (almost 8 years ago)
- Last Synced: 2026-01-14T19:24:18.817Z (5 months ago)
- Topics: dapp, ethereum, native-dapp, proof-of-authority, sidechain
- Language: Go
- Homepage:
- Size: 82 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PoA Interchain Node [](https://travis-ci.com/WeTrustPlatform/poa-interchain-node)
The PoA Interchain Node allows ethereum users to transfer funds between a main chain and a PoA side chain using multisig wallets.
## Dependencies
* solc
* abigen
* go
### Dependencies of the development environment:
* geth
* bootnode
* eth-contract-address
### GOPATH
In your .bashrc:
```
export GOPATH="$HOME/go"
export PATH="$GOPATH/bin:$PATH"
```
### Setup dependencies on OSX:
```
brew tap ethereum/ethereum
brew install ethereum
brew install solidity
go get github.com/kivutar/eth-contract-address
go install github.com/kivutar/eth-contract-address
```
`abigen` is supposed to be provided by the ethereum brew package on OSX. For some reasons, the installation of abigen doesn't always happen. (But it does install properly in Travis CI)
You may have to build it from source:
```
go get github.com/ethereum/go-ethereum
cd $GOPATH/src/github.com/ethereum/go-ethereum/cmd/abigen/
go build
sudo cp abigen /usr/local/bin/abigen
```
## Getting the source code
go get github.com/WeTrustPlatform/poa-interchain-node
But as the repo is still private, you will have to clone the repo directly in your go path:
mkdir -p $GOPATH/src/github.com/WeTrustPlatform/
cd $GOPATH/src/github.com/WeTrustPlatform/
git clone --recurse-submodules git@github.com:WeTrustPlatform/poa-interchain-node.git
cd poa-interchain-node
go generate ./...
go get -t -v ./...
## Run the test suite
go test -cover -v ./...
## Run the development environment
The interchain node comes with a helper in the form of a Makefile. This Makefile is not required to build the interchain node and use it. It is there to test the interchain node with the real geth. It will setup 3 instances of geth, 2 chains, and a few test accounts.
If you don't need to test the interchain node on geth, please skip all of the following steps and rely on the test suite only.
In 3 separate terminals:
```
cd dev/
make run_mainchain
make run_sidechain
make run_sidechain2
```
Wait 10 seconds between each call
## Deploy the multisig wallet on both chains
make mainchain_wallet sidechain_wallet
## Sending ether to arbitrary addresses offchain
Our multisig wallets have a function called `deposit` which allows you to transfer ether from your address on the chain A to a receiver on the chain B.
Instead of paying to the wallet address, you call the `deposit` method using the geth console or our utility program `icn-deposit.go`:
go run ../cmd/icn-deposit/main.go --mainchain --keyjson=mainchain/keystore/ --password="dummy" --endpoint=mainchain/geth.ipc --wallet=`cat mainchain/wallet` --receiver=`cat sidechain/sealer` --value="25000000000000000000"
Usage:
```
Usage:
main [OPTIONS]
Application Options:
-m, --mainchain Target the main chain wallet
-s, --sidechain Target the side chain wallet
-k, --keyjson= Path to the JSON private key file of the sealer
-p, --password= Passphrase needed to unlock the sealer's JSON key
-e, --endpoint= URL or path of the origin chain endpoint
-w, --wallet= Ethereum address of the multisig wallet on the origin chain
-r, --receiver= Ethereum address of the receiver on the target chain
-v, --value= Value (wei) to transfer to the receiver
Help Options:
-h, --help Show this help message
```
The interchain node will notice your call and mirror the transaction on the other chain.
## Run the interchain node
For each sealer, run the interchain node:
go run ../cmd/icn/main.go -k sidechain/keystore/ --mainchainendpoint=mainchain/geth.ipc --sidechainendpoint=sidechain/geth.ipc -p dummy --mainchainwallet=`cat mainchain/wallet` --sidechainwallet=`cat sidechain/wallet` -d=sealer1db
go run ../cmd/icn/main.go -k sidechain2/keystore/ --mainchainendpoint=mainchain/geth.ipc --sidechainendpoint=sidechain2/geth.ipc -p dummy --mainchainwallet=`cat mainchain/wallet` --sidechainwallet=`cat sidechain/wallet` -d=sealer2db
```
Usage:
main [OPTIONS]
Application Options:
-m, --mainchain Watch the main chain
-s, --sidechain Watch the side chain
-k, --keyjson= Path to the JSON private key file of the sealer
-p, --password= Passphrase needed to unlock the sealer's JSON key
--mainchainendpoint= URL or path of the main chain endpoint
--sidechainendpoint= URL or path of the side chain endpoint
--mainchainwallet= Ethereum address of the multisig wallet on the main chain
--sidechainwallet= Ethereum address of the multisig wallet on the side chain
Help Options:
-h, --help Show this help message
```