-
Notifications
You must be signed in to change notification settings - Fork 704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DNM: IBC-Gaia Integration #130
Changes from 13 commits
0f68573
601ea4c
e6563ce
d6b9f98
38e34ca
609c4b8
bbc7aed
d3e21d2
e583706
6102c55
90abacc
114be93
18a6b52
edffb9c
b96de61
dd2f1e9
3dcbc39
0d7afc9
4848be2
3ecb299
171ae0f
513e0cd
409d5ff
ced210a
176c722
2c4c56b
7eec0a3
c1c09be
121357d
6df9ff7
9248903
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
# IBC instruction | ||
|
||
// temporal document | ||
|
||
## Dependencies | ||
|
||
This branch uses non-canonical branch of cosmos-sdk. Before building, run `go mod vendor` on the root directory to retrive the dependencies. To build: | ||
|
||
```shell | ||
git clone git@github.com:cosmos/gaia | ||
cd gaia | ||
go mod vendor | ||
make install | ||
gaiad version | ||
gaiacli version | ||
``` | ||
|
||
Stub out testnet files for 2 nodes, this example does so in your $HOME directory: | ||
|
||
```shell | ||
cd ~ && mkdir ibc-testnets && cd ibc-testnet | ||
fedekunze marked this conversation as resolved.
Show resolved
Hide resolved
fedekunze marked this conversation as resolved.
Show resolved
Hide resolved
|
||
gaiad testnet -o ibc0 --v 1 --chain-id ibc0 --node-dir-prefix n | ||
gaiad testnet -o ibc1 --v 1 --chain-id ibc1 --node-dir-prefix n | ||
``` | ||
|
||
Fix the configuration files to allow both chains/nodes to run on the same machine | ||
|
||
```shell | ||
# Configure the proper database backend for each node | ||
sed -i '' 's/"leveldb"/"goleveldb"/g' ibc0/n0/gaiad/config/config.toml | ||
sed -i '' 's/"leveldb"/"goleveldb"/g' ibc1/n0/gaiad/config/config.toml | ||
|
||
# Configure chain ibc1 to have different listening ports | ||
sed -i '' 's#"tcp://0.0.0.0:26656"#"tcp://0.0.0.0:26556"#g' ibc1/n0/gaiad/config/config.toml | ||
sed -i '' 's#"tcp://0.0.0.0:26657"#"tcp://0.0.0.0:26557"#g' ibc1/n0/gaiad/config/config.toml | ||
sed -i '' 's#"localhost:6060"#"localhost:6061"#g' ibc1/n0/gaiad/config/config.toml | ||
sed -i '' 's#"tcp://127.0.0.1:26658"#"tcp://127.0.0.1:26558"#g' ibc1/n0/gaiad/config/config.toml | ||
``` | ||
|
||
Then configure your `gaiacli` instances for each chain: | ||
|
||
```bash | ||
gaiacli config --home ibc0/n0/gaiacli/ chain-id ibc0 | ||
gaiacli config --home ibc1/n0/gaiacli/ chain-id ibc1 | ||
gaiacli config --home ibc0/n0/gaiacli/ node http://localhost:26657 | ||
gaiacli config --home ibc1/n0/gaiacli/ node http://localhost:26557 | ||
|
||
# Add the key from ibc1 to the ibc0 cli | ||
jq -r '.secret' ibc1/n0/gaiacli/key_seed.json | pbcopy | ||
|
||
# Paste the mnemonic from the above command after setting password (12345678) | ||
gaiacli --home ibc0/n0/gaiacli keys add n1 --recover | ||
``` | ||
|
||
After configuration is complete, start each node in a seperate terminal window: | ||
|
||
```bash | ||
gaiad --home ibc0/n0/gaiad start | ||
gaiad --home ibc1/n0/gaiad start | ||
``` | ||
|
||
## Client | ||
|
||
Create a client on ibc1: | ||
|
||
```bash | ||
gaiacli --home ibc0/n0/gaiacli q ibc client path > path0.json | ||
gaiacli --home ibc0/n0/gaiacli q ibc client consensus-state > state0.json | ||
gaiacli --home ibc1/n0/gaiacli tx ibc client create c1 ./state0.json --from n0 | ||
gaiacli --home ibc1/n0/gaiacli q ibc client client c1 | ||
``` | ||
|
||
Create a client on ibc0: | ||
|
||
```bash | ||
gaiacli --home ibc1/n0/gaiacli q ibc client path > path1.json | ||
gaiacli --home ibc1/n0/gaiacli q ibc client consensus-state > state1.json | ||
gaiacli --home ibc0/n0/gaiacli tx ibc client create c0 ./state1.json --from n0 | ||
gaiacli --home ibc0/n0/gaiacli q ibc client client c0 | ||
``` | ||
|
||
## Connection | ||
|
||
Connections can be established with `connection.sh $CLIENTID` command. It will print | ||
|
||
```shell | ||
gaiacli \ | ||
--home ibc0/n0/gaiacli \ | ||
tx ibc connection handshake \ | ||
conn0 c0 path1.json \ | ||
conn1 c1 path0.json \ | ||
--from1 n0 --from2 n1 \ | ||
--node1 tcp://localhost:26657 \ | ||
--node2 tcp://localhost:26557 | ||
``` | ||
|
||
Once the connection is established you should be able to query it: | ||
|
||
```bash | ||
gaiacli --home ibc0/n0/gaiacli q ibc connection connection conn0 --trust-node | ||
``` | ||
|
||
## Channel | ||
|
||
To establish a channel using the `ibc-mock` application protocol run the following command: | ||
|
||
``` | ||
gaiacli \ | ||
--home ibc0/n0/gaiacli \ | ||
tx ibc channel handshake \ | ||
ibc-mock chan0 conn0 \ | ||
ibc-mock chan1 conn1 \ | ||
--from1 n0 --from2 n1 | ||
``` | ||
|
||
You can query the channel after establishment by | ||
|
||
```bash | ||
gaiacli --home ibc0/n0/gaiacli query ibc channel channel ibc-mock chan0 --trust-node | ||
``` | ||
|
||
## Send Packet | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both send-packet commands are using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How should the commands look? This part of the instructions are left over from the loopback demo There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mossid so how would you rewrite the example? |
||
|
||
To send a packet using the `ibc-mock` application protocol run the following command: | ||
|
||
``` | ||
gaiacli --home ibc0/n0/gaiacli q ibcmocksend sequence chan0 | ||
``` | ||
|
||
The command will return the latest sent sequence(0 if not exists). Run command with next sequence. | ||
|
||
``` | ||
gaiacli --home ibc0/n0/gaiacli tx ibcmocksend sequence chan0 (sequence+1) | ||
``` | ||
|
||
## Receive Packet | ||
|
||
To receive packets using the `ibc-mock` application protocol run the following command: | ||
|
||
``` | ||
gaiacli --home ibc0/n0/gaiacli tx ibc channel flush ibcmocksend chan0 --trust-node | ||
``` | ||
|
||
To see the updated sequence run the following command: | ||
|
||
``` | ||
gaiacli --home ibc1/n0/gaiacli q ibcmockrecv sequence chan1 --trust-node | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmmm how comes? Did you have any issues with
-mod=readonly
? Is there anything I can help out with?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! I was having issues with
-mod=readonly
!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this the case @alessio?