update demo and ibc guide

This commit is contained in:
Ethan Buchman 2017-03-13 20:46:40 -04:00
parent fd6c20739d
commit f1ce14c284
5 changed files with 23 additions and 17 deletions

View File

@ -35,6 +35,6 @@ See the [install guide](/docs/guide/install.md) for more details.
1. See some [more example applications](/docs/guide/more-examples.md)
1. More features of the [Basecoin tool](/docs/guide/basecoin-tool.md)
1. Learn how to use [InterBlockchain Communication (IBC)](/docs/guide/ibc.md)
1. [Deploy testnets](deployment.md) running your basecoin application.
1. [Deploy testnets](/docs/guide/deployment.md) running your basecoin application.

View File

@ -60,29 +60,34 @@ function waitForBlock() {
done
}
# make basecoin root vars
export BASECOIN_ROOT="."
BCROOT1="./data/chain1/basecoin"
BCROOT2="./data/chain2/basecoin"
# grab the chain ids
CHAIN_ID1=$(cat ./data/chain1/basecoin/genesis.json | jq .[1])
CHAIN_ID1=$(cat $BCROOT1/genesis.json | jq .[1])
CHAIN_ID1=$(removeQuotes $CHAIN_ID1)
CHAIN_ID2=$(cat ./data/chain2/basecoin/genesis.json | jq .[1])
CHAIN_ID2=$(cat $BCROOT2/genesis.json | jq .[1])
CHAIN_ID2=$(removeQuotes $CHAIN_ID2)
echo "CHAIN_ID1: $CHAIN_ID1"
echo "CHAIN_ID2: $CHAIN_ID2"
# make reusable chain flags
CHAIN_FLAGS1="--chain_id $CHAIN_ID1 --from ./data/chain1/basecoin/key.json"
CHAIN_FLAGS2="--chain_id $CHAIN_ID2 --from ./data/chain2/basecoin/key.json --node tcp://localhost:36657"
CHAIN_FLAGS1="--chain_id $CHAIN_ID1 --from $BCROOT1/key.json"
CHAIN_FLAGS2="--chain_id $CHAIN_ID2 --from $BCROOT2/key.json --node tcp://localhost:36657"
echo ""
echo "... starting chains"
echo ""
# start the first node
TMROOT=./data/chain1/tendermint tendermint node --skip_upnp --log_level=info &> $LOG_DIR/chain1_tendermint.log &
basecoin start --dir ./data/chain1/basecoin &> $LOG_DIR/chain1_basecoin.log &
BASECOIN_ROOT=$BCROOT1 basecoin start --abci-server &> $LOG_DIR/chain1_basecoin.log &
# start the second node
TMROOT=./data/chain2/tendermint tendermint node --skip_upnp --log_level=info --node_laddr tcp://localhost:36656 --rpc_laddr tcp://localhost:36657 --proxy_app tcp://localhost:36658 &> $LOG_DIR/chain2_tendermint.log &
basecoin start --address tcp://localhost:36658 --dir ./data/chain2/basecoin &> $LOG_DIR/chain2_basecoin.log &
BASECOIN_ROOT=$BCROOT2 basecoin start --address tcp://localhost:36658 --abci-server &> $LOG_DIR/chain2_basecoin.log &
echo ""
echo "... waiting for chains to start"

View File

@ -1,9 +1,8 @@
## Deployment
Up until this point, we have only been testing the code as a stand-alone abci app,
which is nice for developing, but it is no blockchain. Just a blockchain-ready application.
Up until this point, we have only been testing the code as a blockchain with a single validator node running locally.
This is nice for developing, but it's not a real distributed application yet.
This section will demonstrate how to launch your basecoin-based application along
with a tendermint testnet and initialize the genesis block for fun and profit.
**TODO** Maybe we link to a blog post for this???
We do this using the [mintnet-kubernetes tool](https://github.com/tendermint/mintnet-kubernetes).

View File

@ -310,7 +310,7 @@ If you've already run a basecoin blockchain, reset the data with
basecoin unsafe_reset_all
```
To start the blockchain, simply run
To start the blockchain with your new plugin, simply run
```
example-plugin start

View File

@ -195,14 +195,14 @@ We can start the two chains as follows:
```
TMROOT=./data/chain1/tendermint tendermint node &> chain1_tendermint.log &
basecoin start --dir ./data/chain1/basecoin &> chain1_basecoin.log &
BASECOIN_ROOT=./data/chain1/basecoin basecoin start --abci-server &> chain1_basecoin.log &
```
and
```
TMROOT=./data/chain2/tendermint tendermint node --node_laddr tcp://localhost:36656 --rpc_laddr tcp://localhost:36657 --proxy_app tcp://localhost:36658 &> chain2_tendermint.log &
basecoin start --address tcp://localhost:36658 --dir ./data/chain2/basecoin &> chain2_basecoin.log &
BASECOIN_ROOT=./data/chain2/basecoin basecoin start --abci-server --address tcp://localhost:36658 &> chain2_basecoin.log &
```
Note how we refer to the relevant data directories. Also note how we have to set the various addresses for the second node so as not to conflict with the first.
@ -226,6 +226,8 @@ export CHAIN_ID2=test_chain_2
export CHAIN_FLAGS1="--chain_id $CHAIN_ID1 --from ./data/chain1/basecoin/key.json"
export CHAIN_FLAGS2="--chain_id $CHAIN_ID2 --from ./data/chain2/basecoin/key.json --node tcp://localhost:36657"
export BASECOIN_ROOT="."
```
Let's start by registering `test_chain_1` on `test_chain_2`:
@ -265,7 +267,7 @@ The former is used as input for later commands; the latter is human-readable, so
Let's send this updated information about `test_chain_1` to `test_chain_2`:
```
basecoin tx ibc --amount 10mycoin $CHAIN_FLAGS2 update --header 0x<header>--commit 0x<commit>
basecoin tx ibc --amount 10mycoin $CHAIN_FLAGS2 update --header 0x<header> --commit 0x<commit>
```
where `<header>` and `<commit>` are the hex-encoded header and commit returned by the previous `block` command.
@ -275,10 +277,10 @@ along with proof the packet was committed on `test_chain_1`. Since `test_chain_2
of `test_chain_1`, it will be able to verify the proof!
```
basecoin tx ibc --amount 10mycoin $CHAIN_FLAGS2 packet post --from $CHAIN_ID1 --height <height + 1> --packet 0x<packet> --proof 0x<proof>
basecoin tx ibc --amount 10mycoin $CHAIN_FLAGS2 packet post --from $CHAIN_ID1 --height <height> --packet 0x<packet> --proof 0x<proof>
```
Here, `<height + 1>` is one greater than the height retuned by the previous `query` command, and `<packet>` and `<proof>` are the
Here, `<height>` is the height retuned by the previous `query` command, and `<packet>` and `<proof>` are the
`value` and `proof` returned in that same query.
Tada!