basecoin init, default to in-proc, fix up guide
This commit is contained in:
@@ -5,77 +5,34 @@ and how to send transactions between accounts using the `basecoin` tool.
|
||||
|
||||
## Install
|
||||
|
||||
Make sure you have [basecoin installed](install.md).
|
||||
You will also need to [install Tendermint](https://tendermint.com/intro/getting-started/download).
|
||||
Installing basecoin is simple:
|
||||
|
||||
**Note** All code is on the 0.9 pre-release branch, you may have to
|
||||
[install Tendermint from source](https://tendermint.com/docs/guides/install)
|
||||
until 0.9 is released. (Make sure to add `git checkout develop` to the linked install instructions)
|
||||
```
|
||||
go get -u github.com/tendermint/basecoin/cmd/basecoin
|
||||
```
|
||||
|
||||
If you have trouble, see the [installation guide](install.md).
|
||||
|
||||
## Initialization
|
||||
|
||||
Basecoin is an ABCI application that runs on Tendermint, so we first need to initialize Tendermint:
|
||||
To initialize a new Basecoin blockchain, run:
|
||||
|
||||
```
|
||||
tendermint init
|
||||
basecoin init
|
||||
```
|
||||
|
||||
This will create the necessary files for a single Tendermint node in `~/.tendermint`.
|
||||
If you had previously run Tendermint, make sure you reset the chain
|
||||
(note this will delete all chain data, so back it up if you need it):
|
||||
|
||||
```
|
||||
tendermint unsafe_reset_all
|
||||
```
|
||||
|
||||
Now we need some initialization files for basecoin.
|
||||
We have included some defaults in the basecoin directory, under `data`.
|
||||
For purposes of convenience, change to that directory:
|
||||
|
||||
```
|
||||
cd $GOPATH/src/github.com/tendermint/basecoin/data
|
||||
```
|
||||
|
||||
The directory contains a genesis file and two private keys.
|
||||
|
||||
You can generate your own private keys with `tendermint gen_validator`,
|
||||
and construct the `genesis.json` as you like.
|
||||
Note, however, that you must be careful with the `chain_id` field,
|
||||
as every transaction must contain the correct `chain_id`
|
||||
(default is `test_chain_id`).
|
||||
This will create the necessary files for a Basecoin blockchain with one validator and one account in `~/.basecoin`.
|
||||
For more options on setup, see the [guide to using the Basecoin tool](/docs/guide/basecoin-tool.md).
|
||||
|
||||
## Start
|
||||
|
||||
Now we can start basecoin:
|
||||
|
||||
```
|
||||
basecoin start --in-proc
|
||||
```
|
||||
|
||||
This will initialize the chain with the `genesis.json` file from the current directory.
|
||||
If you want to specify another location, you can run:
|
||||
|
||||
```
|
||||
basecoin start --in-proc --dir PATH/TO/CUSTOM/DATA
|
||||
```
|
||||
|
||||
Note that `--in-proc` stands for "in process", which means
|
||||
basecoin will be started with the Tendermint node running in the same process.
|
||||
To start Tendermint in a separate process instead, use:
|
||||
|
||||
```
|
||||
basecoin start
|
||||
```
|
||||
|
||||
and in another window:
|
||||
|
||||
```
|
||||
tendermint node
|
||||
```
|
||||
|
||||
In either case, you should see blocks start streaming in!
|
||||
Note, however, that currently basecoin currently requires the
|
||||
`develop` branch of Tendermint for this to work.
|
||||
You should see blocks start streaming in!
|
||||
|
||||
## Send transactions
|
||||
|
||||
@@ -98,8 +55,7 @@ Let's send funds from the first account to the second:
|
||||
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`.
|
||||
By default, the CLI looks for a `key.json` to sign the transaction with.
|
||||
To specify a different key, we can use the `--from` flag.
|
||||
|
||||
Now if we check the second account, it should have `10` 'mycoin' coins!
|
||||
|
||||
Reference in New Issue
Block a user