Skip to content

Commit

Permalink
Merge f0b1664 into 3d0c548
Browse files Browse the repository at this point in the history
  • Loading branch information
rnistuk authored Mar 2, 2020
2 parents 3d0c548 + f0b1664 commit 9f1ced0
Show file tree
Hide file tree
Showing 8 changed files with 444 additions and 66 deletions.
82 changes: 16 additions & 66 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,22 @@
[![Coverage Status](https://coveralls.io/repos/github/bluzelle/curium/badge.svg?branch=devel)](https://coveralls.io/github/bluzelle/curium?branch=devel)
# Curium Application
[![Build Status](https://travis-ci.com/bluzelle/curium.svg?branch=devel)](https://travis-ci.com/bluzelle/curium) [![Coverage Status](https://coveralls.io/repos/github/bluzelle/curium/badge.svg?branch=devel)](https://coveralls.io/github/bluzelle/curium?branch=devel)

https://github.com/cosmos/sdk-tutorials/tree/master/nameservice
The Bluzelle Curium Application
===============================

**TODO: Marketing description of the product here**

This project will form the basis of the Bluzelle <????> Swarm Application.
Bluzelle Curium Multi-Validator Zone Installation
-------------------------------------------------

These are steps involved in setting up the OS, Dev Environment, building and deploying a multi-node Curium Zone.

## Building and running the example
1. [OS Setup for Curium](./docs/setup/os.md)
2. [Development Environment Setup](./docs/setup/devenv.md)
3. [Build the Curium Project](./docs/setup/build.md)
4. [Deploy the Initial Node](./docs/setup/deploy.md)
5. [Deploy Additional Nodes](./docs/setup/deployaddl.md)

* Install Golang version 1.13.4 from https://golang.org
* Optionally install your favourite Golang IDE (JetBrains Goland is a good one). Vim or emacs is probably all you need, though.
* make sure your Environment paths are set in your profile or rc file, for example:
`export GOPATH=/Users/rnistuk/go`
`export GOBIN=${GOPATH}/bin`
`export PATH=$PATH:$GOBIN`
* cd to the project root folder
* build and install the project
`make`
`make install`
* This will create the command line interface `blzcli` and the daemon `blzd` applications in your $GOBIN
* Now you can spool up a node and try it out!
* Open a new terminal for the daemon
* In the daemon terminal use blzd init to initialize the config files and genesis file
`blzd init <moniker> --chain-id namechain`
moniker will be the name of the node, e.g.) Bluzelle
* In another terminal we will use the cli `blzcli` to set up a user or two
`blzcli keys add rich`
"rich" is the name of the user to be added. Follow the crypto related instructions from the blzcli
* Use the daemon to give yourself some nametokens
`blzd add-genesis-account $(blzcli keys show rich -a) 1000nametoken,1000000000stake`
note the use of blzcli to get the identifier for rich, try running the keys function on it's own
* Do some configure magic (we're not sure what a couple of these do yet...)
`blzcli config chain-id namechain`
`blzcli config output json`
`blzcli config indent true`
`blzcli config trust-node true`
* generate and validate a genesis transaction to start up the blockchain.
`blzd gentx --name rich`
`blzd collect-gentxs`
`blzd validate-genesis`
* In the daemon terminal start the node
`blzd start`
* Query the node and make some transactions.

#Here are some Example queries transactions:

\# Initialize configuration files and genesis file
\# moniker is the name of your node
blzd init <moniker> --chain-id namechain


\# Copy the `Address` output here and save it for later use
\# [optional] add "--ledger" at the end to use a Ledger Nano S
blzcli keys add jack

\# Copy the `Address` output here and save it for later use
blzcli keys add alice

\# Add both accounts, with coins to the genesis file
blzd add-genesis-account $(blzcli keys show jack -a) 1000nametoken,100000000stake
blzd add-genesis-account $(blzcli keys show alice -a) 1000nametoken,100000000stake

\# Configure your CLI to eliminate need for chain-id flag
blzcli config chain-id namechain
blzcli config output json
blzcli config indent true
blzcli config trust-node true

blzd gentx --name jack <or your key_name>`

Using the Bluzelle Curium Multi-Validator Zone
----------------------------------------------
- [Queries and Transactions](./docs/commands/qAndTX.md)
- [Useful Operations](./docs/commands/useful.md)
20 changes: 20 additions & 0 deletions docs/commands/qAndTX.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[prev](../setup/deployaddl.md) | [next](../commands/useful.md)
***
Using the Bluzelle Curium Zone
==============================
# Queries
The querying subcommands provide access to the unsigned functinality of the the Curium cli. These commands do not use gas and results are returned directly.

The CLI can provide usage help for the queries with the following command:

$ blzcli q --help

# Transactions
Transactional commands can be crytographically signed and require gas to perform. Where a command has a return value users must employ the "tx" query to retrieve the response.

The CLI can provide usage help for the queries with the following command:

$ blzcli tx --help

***
[prev](../setup/deployaddl.md) | [next](../commands/useful.md)
10 changes: 10 additions & 0 deletions docs/commands/useful.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[prev](./qAndTX.md)
***

Useful Commands
===============

# TBD

***
[prev](./qAndTX.md)
100 changes: 100 additions & 0 deletions docs/setup/build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
[prev](./devenv.md) | [next](./deploy.md)
***

Build the Curium Project
========================

1. cd to the project folder

$ cd ~/go/src/github.com/bluzelle/curium

2. Install blzd and blzcli

$ make install

3. Ensure blzcli and blzd work by executing the binaries, you should be able to execute the apps from your user folder:

$ cd
$ blzcli
Bluzelle CRUD Client
Usage:
blzcli [command]

Available Commands:
status Query remote node for status
config Create or query an application CLI configuration file
query Querying subcommands
tx Transactions subcommands
rest-server Start LCD (light-client daemon), a local REST server
keys Add or view local private keys
version Print the app version
help Help about any command
Flags:
--chain-id string Chain ID of tendermint node
-e, --encoding string Binary encoding (hex|b64|btc) (default "hex")
-h, --help help for blzcli
--home string directory for config and data (default "/Users/rnistuk/.blzcli")
-o, --output string Output format (text|json) (default "text")
--trace print out full stack trace on errors

Use "blzcli [command] --help" for more information about a command.

the daemon:

$ cd
$ blzd
Bluzelle CRUD Daemon (server)
Usage:
blzd [command]
Available Commands:
init Initialize private validator, p2p, genesis, and application configuration files
collect-gentxs Collect genesis txs and output a genesis.json file
gentx Generate a genesis tx carrying a self delegation
validate-genesis validates the genesis file at the default location or at the location passed as an arg
add-genesis-account Add genesis account to genesis.json
start Run the full node
unsafe-reset-all Resets the blockchain database, removes address book files, and resets priv_validator.json to the genesis state
tendermint Tendermint subcommands
export Export state to JSON
version Print the app version
help Help about any command
Flags:
-h, --help help for blzd
--home string directory for config and data (default "/Users/rnistuk/.blzd")
--log_level string Log level (default "main:info,state:info,*:error")
--trace print out full stack trace on errors
Use "blzd [command] --help" for more information about a command.

4. You can also verify the build versions with the following commands. They should match the git commit hash of the tip (git rev-parse HEAD) you cloned above.

$ blzcli version --long
name: BluzelleService
server_name: blzd
client_name: blzcli
version: 0.0.0-24-g3253c8b
commit: 3253c8b6b4e40b125c0ccdfd6a81a06a02a5e018
build_tags: ledger,cosmos-sdk v0.37.4
go: go version go1.13.4 darwin/amd64

$ blzd version --long
name: BluzelleService
server_name: blzd
client_name: blzcli
version: 0.0.0-24-g3253c8b
commit: 3253c8b6b4e40b125c0ccdfd6a81a06a02a5e018
build_tags: ledger,cosmos-sdk v0.37.4
go: go version go1.13.4 darwin/amd64

***
[prev](./devenv.md) | [next](./deploy.md)
104 changes: 104 additions & 0 deletions docs/setup/deploy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
[prev](./build.md) | [next](./deployaddl.md)
***

Deploy the Initial Node
=======================

1. Before initializing a node, remove the previous node config folders from your home folder, if they exist

$ rm -rf .blz*

2. Initialize the daemon

$ blzd init [moniker] [flags]

where moniker is a human readable name for the current node, an appropriate flag would be a string for --chain-id, for example

$ blzd init curium00 --chain-id bluzelle 2>&1 | jq .node_id

Use the jq command to parse the node_id from the json output. Note the “2>&1” argument, blzd init, in this case sends its output to stderr, so we need to redirect the output back to stdout.

The JSON output will contain the node_id, note that value so that it can be used to identify this node to other nodes in the zone (in their respective “persistent_peers” value in config.toml).

3. Edit “./blzd/config/config.toml” to add

output = "json"

after the line

##### advanced configuration options #####

4. Edit “.blzd/config/genesis.json” to change bond_denom from “stake” to “bnt”. This genesis.json file will be used to initialize the blockchain for this zone. This can be done from the command line with sed

$ sed -i -e 's/"bond_denom": "stake"/"bond_denom": "bnt"/g' \
~/.blzd/config/genesis.json

5. Edit .blzd/config/app.toml in a text editor and set the minimum-gas-prices to “0.01bnt”. Every node should have at least this minimum. This can also be done from the command line with sed:

$ sed -i -e 's/minimum-gas-prices = ""/minimum-gas-prices = "0.01bnt"/g' \
~/.blzd/config/app.toml

6. Set the client configuration settings:
$ blzcli config chain-id bluzelle
$ blzcli config output json
$ blzcli config indent true
$ blzcli config trust-node true
where “bluzelle” is the zone’s chain-id.

7. Derive a new key that will label the validator account for this node, call it “validator”:

$ blzcli keys add validator
Enter a passphrase to encrypt your key to disk:
Repeat the passphrase:
- name: validator
type: local
address: bluzelle1akcrplttpq2qvp90g8l7ttgj25q00rvj0e9d6k
pubkey: bluzellepub1addwnpepqtzzdysc4mukmzzk7aexmfyjdq305ztgu2dkggytqazvvpxv3xma56r8c4n
mnemonic: ""
threshold: 0
pubkeys: []
**Important** write this mnemonic phrase in a safe place.
It is the only way to recover your account if you ever forget your password.
amused silk skull latin symbol together resemble blind march achieve angle rib innocent reflect weapon critic quarter empty crime pride fluid hint finish switch

Note the address, with the “bluzelle” prefix, and the mnemonic. The mnemonic will be used by the Bluzelle javascript client to send transactions to the node.

8. Add the first account to the blockchain using the validator key as the account identifier

$ blzd add-genesis-account $(blzcli keys show validator -a) 10000000000bnt
this command is an alias for “tx staking create-validator”. The amount given for the bnt tokens here will be the total amount of tokens available to the zone.

9. As this is the first node in the zone, it needs a transaction that will be the first transaction in the blockchain.

$ blzd gentx --name vuser --amount 100000000bnt
Password to sign with 'validator':
Genesis transaction written to "/home/rich/.blzd/config/gentx/gentx-6ccdb7764f4b6762bca9ce254ee9db49a687cc9c.json"
remember to specify the amount of coins to bond using the --amount parameter so that bnt is used as stake, if this is neglected the bonding denomination will be stake. Open the genesis transaction JSON file and note the value for the validator_address, it will have the prefix “bluzellevaloper”, this id will be used to get account info later.

10. Create the genesis file from the first transaction:

$ blzd collect-gentxs
the output of this command will also contain the validator_address, prefixed with bluzellevaloper. If you have not done so in the previous step, note the validator_address.

This command creates the signed genesis.json (.blzd/config/genesis.json) that will be copied to the rest of the nodes in the zone.

11. The node can be started with the Bluzelle daemon:

$ blzd start
12. On a second terminal the http server can be started with the Bluzelle client

$ blzcli rest-server

If external access to the rest server is required add the _--laddr_ argument

$ blzcli rest-server --laddr tcp://0.0.0.0:1317

***
[prev](./build.md) | [next](./deployaddl.md)
Loading

0 comments on commit 9f1ced0

Please sign in to comment.