bash test cleanup

int
This commit is contained in:
rigel rozanski
2017-06-21 16:30:53 +02:00
committed by Ethan Frey
parent 22057b910f
commit a78a24bbe9
7 changed files with 115 additions and 122 deletions
+9 -13
View File
@@ -9,17 +9,13 @@ this example we explore a simple plugin named `counter`.
## Example Plugin
The design of the `basecoin` and `basecli` tools makes it easy to extend for custom
functionality. We provide examples of such extensions in the basecoin repository under `docs/guide/counter`.
You can install them from the basecoin directory with:
```
`go install ./docs/guide/counter/cmd/...
```
This will give you both the `counter` and `countercli` binaries.
The former is just like `basecoin`, but with the counter plugin activated.
The latter is just like `basecli`, but with support for sending transactions to the counter plugin.
The design of the `basecoin` tool makes it easy to extend for custom
functionality. The Counter plugin is bundled with basecoin, so if you have
already [installed basecoin](install.md) and run `make install` then you should
be able to run a full node with `counter` and the a light-client `countercli`
from terminal. The Counter plugin is just like the `basecoin` tool. They
both use the same library of commands, including one for signing and
broadcasting `SendTx`.
Counter transactions take two custom inputs, a boolean argument named `valid`,
and a coin amount named `countfee`. The transaction is only accepted if both
@@ -83,7 +79,7 @@ The Counter value should be 2, because we sent a second valid transaction.
And this time, since we sent a countfee (which must be less than or equal to the
total amount sent with the tx), it stores the `TotalFees` on the counter as well.
Keep it mind that, just like with `basecli`, the `countercli` verifies a proof
Keep it mind that, just like with `basecli`, the `countercli` verifies a proof
that the query response is correct and up-to-date.
Now, before we implement our own plugin and tooling, it helps to understand the
@@ -170,7 +166,7 @@ alone, but you should change any occurrences of `counter` to whatever your
plugin tool is going to be called. You must also register your plugin(s) with
the basecoin app with `RegisterStartPlugin`.
The light-client is located in `cmd/countercli/main.go` and allows for
The light-client is located in `cmd/countercli/main.go` and allows for
transaction and query commands. This file can also be left mostly alone besides replacing the application name and adding
references to new plugin commands.
+13 -13
View File
@@ -210,7 +210,7 @@ Otherwise, open up 5 (yes 5!) terminal tabs....
All commands will be prefixed by the name of the terminal window in which to
run it...
```bash
```
# first, clean up any old garbage for a fresh slate...
rm -rf ~/.ibcdemo/
```
@@ -218,7 +218,7 @@ rm -rf ~/.ibcdemo/
Set up some accounts so we can init everything nicely:
**Client1**
```bash
```
export BCHOME=~/.ibcdemo/chain1/client
CHAIN_ID=test-chain-1
PORT=12347
@@ -229,7 +229,7 @@ basecli keys new gotnone
Prepare the genesis block and start the server:
**Server1**
```bash
```
# set up the directory, chainid and port of this chain...
export BCHOME=~/.ibcdemo/chain1/server
CHAIN_ID=test-chain-1
@@ -245,7 +245,7 @@ Attach the client to the chain and confirm state. The first account should
have money, the second none:
**Client1**
```bash
```
basecli init --chain-id=${CHAIN_ID} --node=tcp://localhost:${PORT}
ME=$(basecli keys get money | awk '{print $2}')
YOU=$(basecli keys get gotnone | awk '{print $2}')
@@ -261,7 +261,7 @@ on this chain, as the "cool" key only has money on chain 1.
**Client2**
```bash
```
export BCHOME=~/.ibcdemo/chain2/client
CHAIN_ID=test-chain-2
PORT=23457
@@ -272,7 +272,7 @@ basecli keys new broke
Prepare the genesis block and start the server:
**Server2**
```bash
```
# set up the directory, chainid and port of this chain...
export BCHOME=~/.ibcdemo/chain2/server
CHAIN_ID=test-chain-2
@@ -288,7 +288,7 @@ Attach the client to the chain and confirm state. The first account should
have money, the second none:
**Client2**
```bash
```
basecli init --chain-id=${CHAIN_ID} --node=tcp://localhost:${PORT}
ME=$(basecli keys get moremoney | awk '{print $2}')
YOU=$(basecli keys get broke | awk '{print $2}')
@@ -307,7 +307,7 @@ for now, we have to transfer some cash from the rich accounts before we start
the actual relay.
**Client1**
```bash
```
# note that this key.json file is a hardcoded demo for all chains, this will
# be updated in a future release
RELAY_KEY=${BCHOME}/../server/key.json
@@ -317,7 +317,7 @@ basecli query account $RELAY_ADDR
```
**Client2**
```bash
```
# note that this key.json file is a hardcoded demo for all chains, this will
# be updated in a future release
RELAY_KEY=${BCHOME}/../server/key.json
@@ -327,7 +327,7 @@ basecli query account $RELAY_ADDR
```
**Relay**
```bash
```
# lots of config...
SERVER_1=~/.ibcdemo/chain1/server
SERVER_2=~/.ibcdemo/chain2/server
@@ -358,7 +358,7 @@ a secure relay between them. Now we can enjoy the fruits of our labor...
**Client2**
```bash
```
# this should be empty
basecli query account $YOU
# now, we get the key to copy to the other terminal
@@ -367,14 +367,14 @@ echo $YOU
**Client1**
```bash
```
# set TARGET to be $YOU from the other chain
basecli tx send --amount=12345mycoin --sequence=2 --to=test-chain-2/$TARGET --name=money
```
**Client2**
```bash
```
# give it time to arrive...
sleep 1
# now you should see 12345 coins!