Merge branch 'queryReg' into develop
This commit is contained in:
@@ -95,14 +95,14 @@ The first account is flush with cash, while the second account doesn't exist.
|
||||
Let's send funds from the first account to the second:
|
||||
|
||||
```
|
||||
basecoin tx send --to 0x1DA7C74F9C219229FD54CC9F7386D5A3839F0090 --amount 10
|
||||
basecoin tx send --to 0x1DA7C74F9C219229FD54CC9F7386D5A3839F0090 --amount 10mycoin
|
||||
```
|
||||
|
||||
By default, the CLI looks for a `priv_validator.json` to sign the transaction with,
|
||||
so this will only work if you are in the `$GOPATH/src/github.com/tendermint/basecoin/data`.
|
||||
To specify a different key, we can use the `--from` flag.
|
||||
|
||||
Now if we check the second account, it should have `10` coins!
|
||||
Now if we check the second account, it should have `10` 'mycoin' coins!
|
||||
|
||||
```
|
||||
basecoin account 0x1DA7C74F9C219229FD54CC9F7386D5A3839F0090
|
||||
@@ -111,7 +111,7 @@ basecoin account 0x1DA7C74F9C219229FD54CC9F7386D5A3839F0090
|
||||
We can send some of these coins back like so:
|
||||
|
||||
```
|
||||
basecoin tx send --to 0x1B1BE55F969F54064628A63B9559E7C21C925165 --from key2.json --amount 5
|
||||
basecoin tx send --to 0x1B1BE55F969F54064628A63B9559E7C21C925165 --from key2.json --amount 5mycoin
|
||||
```
|
||||
|
||||
Note how we use the `--from` flag to select a different account to send from.
|
||||
@@ -119,7 +119,7 @@ Note how we use the `--from` flag to select a different account to send from.
|
||||
If we try to send too much, we'll get an error:
|
||||
|
||||
```
|
||||
basecoin tx send --to 0x1B1BE55F969F54064628A63B9559E7C21C925165 --from key2.json --amount 100
|
||||
basecoin tx send --to 0x1B1BE55F969F54064628A63B9559E7C21C925165 --from key2.json --amount 100mycoin
|
||||
```
|
||||
|
||||
See `basecoin tx send --help` for additional details.
|
||||
|
||||
@@ -132,10 +132,9 @@ OPTIONS:
|
||||
--node value Tendermint RPC address (default: "tcp://localhost:46657")
|
||||
--chain_id value ID of the chain for replay protection (default: "test_chain_id")
|
||||
--from value Path to a private key to sign the transaction (default: "key.json")
|
||||
--amount value Amount of coins to send in the transaction (default: 0)
|
||||
--coin value Specify a coin denomination (default: "mycoin")
|
||||
--amount value Coins to send in transaction of the format <amt><coin>,<amt2><coin2>,... (eg: 1btc,2gold,5silver)
|
||||
--gas value The amount of gas for the transaction (default: 0)
|
||||
--fee value The transaction fee (default: 0)
|
||||
--fee value Coins for the transaction fee of the format <amt><coin>
|
||||
--sequence value Sequence number for the account (default: 0)
|
||||
--valid Set this to make the transaction valid
|
||||
```
|
||||
@@ -366,25 +365,25 @@ example-plugin start --in-proc
|
||||
In another window, we can try sending some transactions:
|
||||
|
||||
```
|
||||
example-plugin tx send --to 0x1B1BE55F969F54064628A63B9559E7C21C925165 --amount 100 --coin gold --chain_id example-chain
|
||||
example-plugin tx send --to 0x1B1BE55F969F54064628A63B9559E7C21C925165 --amount 100gold --chain_id example-chain
|
||||
```
|
||||
|
||||
Note the `--coin` and `--chain_id` flags. In the [previous tutorial](basecoin-basics.md),
|
||||
we didn't need them because we were using the default coin type ("mycoin") and chain ID ("test_chain_id").
|
||||
Now that we're using custom values, we need to specify them explicitly on the command line.
|
||||
Note the `--chain_id` flag. In the [previous tutorial](basecoin-basics.md),
|
||||
we didn't include it because we were using the default chain ID ("test_chain_id").
|
||||
Now that we're using a custom chain, we need to specify the chain explicitly on the command line.
|
||||
|
||||
Ok, so that's how we can send a `SendTx` transaction using our `example-plugin` CLI,
|
||||
but we were already able to do that with the `basecoin` CLI.
|
||||
With our new CLI, however, we can also send an `ExamplePluginTx`:
|
||||
|
||||
```
|
||||
example-plugin tx example --amount 1 --coin gold --chain_id example-chain
|
||||
example-plugin tx example --amount 1gold --chain_id example-chain
|
||||
```
|
||||
|
||||
The transaction is invalid! That's because we didn't specify the `--valid` flag:
|
||||
|
||||
```
|
||||
example-plugin tx example --valid --amount 1 --coin gold --chain_id example-chain
|
||||
example-plugin tx example --valid --amount 1gold --chain_id example-chain
|
||||
```
|
||||
|
||||
Tada! We successfuly created, signed, broadcast, and processed our custom transaction type.
|
||||
@@ -404,7 +403,7 @@ which contains only an integer.
|
||||
If we send another transaction, and then query again, we'll see the value increment:
|
||||
|
||||
```
|
||||
example-plugin tx example --valid --amount 1 --coin gold --chain_id example-chain
|
||||
example-plugin tx example --valid --amount 1gold --chain_id example-chain
|
||||
example-plugin query ExamplePlugin.State
|
||||
```
|
||||
|
||||
|
||||
+4
-4
@@ -231,13 +231,13 @@ export CHAIN_FLAGS2="--chain_id $CHAIN_ID2 --from ./data/chain2/basecoin/key.jso
|
||||
Let's start by registering `test_chain_1` on `test_chain_2`:
|
||||
|
||||
```
|
||||
basecoin tx ibc --amount 10 $CHAIN_FLAGS2 register --chain_id $CHAIN_ID1 --genesis ./data/chain1/tendermint/genesis.json
|
||||
basecoin tx ibc --amount 10mycoin $CHAIN_FLAGS2 register --chain_id $CHAIN_ID1 --genesis ./data/chain1/tendermint/genesis.json
|
||||
```
|
||||
|
||||
Now we can create the outgoing packet on `test_chain_1`:
|
||||
|
||||
```
|
||||
basecoin tx ibc --amount 10 $CHAIN_FLAGS1 packet create --from $CHAIN_ID1 --to $CHAIN_ID2 --type coin --payload 0xDEADBEEF --sequence 1
|
||||
basecoin tx ibc --amount 10mycoin $CHAIN_FLAGS1 packet create --from $CHAIN_ID1 --to $CHAIN_ID2 --type coin --payload 0xDEADBEEF --sequence 1
|
||||
```
|
||||
|
||||
Note our payload is just `DEADBEEF`.
|
||||
@@ -265,7 +265,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 10 $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,7 +275,7 @@ 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 10 $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 + 1> --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
|
||||
|
||||
Reference in New Issue
Block a user