From d87dfce8e4db5c46fa349951f9de5be15c1b428e Mon Sep 17 00:00:00 2001 From: Zach Ramsay Date: Thu, 31 May 2018 09:16:12 -0400 Subject: [PATCH] docs: rst => md --- docs/conf.py | 14 +++-- docs/guides/sdk/install.md | 42 +++++++++++++ docs/guides/sdk/install.rst | 48 --------------- docs/guides/sdk/key-management.md | 17 ++++++ docs/guides/sdk/key-management.rst | 18 ------ docs/guides/staking/testnet.md | 94 ++++++++++++++++++++++++++++++ docs/index.rst | 7 ++- 7 files changed, 167 insertions(+), 73 deletions(-) create mode 100644 docs/guides/sdk/install.md delete mode 100644 docs/guides/sdk/install.rst create mode 100644 docs/guides/sdk/key-management.md delete mode 100644 docs/guides/sdk/key-management.rst create mode 100644 docs/guides/staking/testnet.md diff --git a/docs/conf.py b/docs/conf.py index 73a0220fd..3f7cb19b5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -38,9 +38,15 @@ templates_path = ['_templates'] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: -# -# source_suffix = ['.rst', '.md'] -source_suffix = '.rst' + +from recommonmark.parser import CommonMarkParser + +source_parsers = { + '.md': CommonMarkParser, +} + +source_suffix = ['.rst', '.md'] +#source_suffix = '.rst' # The master toctree document. master_doc = 'index' @@ -69,7 +75,7 @@ language = None # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'old'] +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '_attic', 'spec'] # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' diff --git a/docs/guides/sdk/install.md b/docs/guides/sdk/install.md new file mode 100644 index 000000000..f34d0bd72 --- /dev/null +++ b/docs/guides/sdk/install.md @@ -0,0 +1,42 @@ +# Install + +Cosmos SDK can be installed to +`$GOPATH/src/github.com/cosmos/cosmos-sdk` like a normal Go program: + +``` +go get github.com/cosmos/cosmos-sdk +``` + +If the dependencies have been updated with breaking changes, or if +another branch is required, `dep` is used for dependency management. +Thus, assuming you've already run `go get` or otherwise cloned the repo, +the correct way to install is: + +``` +cd $GOPATH/src/github.com/cosmos/cosmos-sdk +make get_vendor_deps +make install +make install_examples +``` + +This will install `gaiad` and `gaiacli` and four example binaries: +`basecoind`, `basecli`, `democoind`, and `democli`. + +Verify that everything is OK by running: + +``` +gaiad version +``` + +you should see: + +``` +0.17.3-a5a78eb +``` + +then with: + +``` +gaiacli version +``` +you should see the same version (or a later one for both). diff --git a/docs/guides/sdk/install.rst b/docs/guides/sdk/install.rst deleted file mode 100644 index 03b219cb5..000000000 --- a/docs/guides/sdk/install.rst +++ /dev/null @@ -1,48 +0,0 @@ -Install -======= - -Cosmos SDK can be installed to -``$GOPATH/src/github.com/cosmos/cosmos-sdk`` like a normal Go program: - -:: - - go get github.com/cosmos/cosmos-sdk - -If the dependencies have been updated with breaking changes, or if -another branch is required, ``dep`` is used for dependency management. -Thus, assuming you've already run ``go get`` or otherwise cloned the -repo, the correct way to install is: - -:: - - cd $GOPATH/src/github.com/cosmos/cosmos-sdk - make get_vendor_deps - make install - make install_examples - -This will install ``gaiad`` and ``gaiacli`` and four example binaries: -``basecoind``, ``basecli``, ``democoind``, and ``democli``. - -Verify that everything is OK by running: - -:: - - gaiad version - -you should see: - -:: - - 0.15.0-rc1-9d90c6b - -then with: - -:: - - gaiacli version - -you should see: - -:: - - 0.15.0-rc1-9d90c6b diff --git a/docs/guides/sdk/key-management.md b/docs/guides/sdk/key-management.md new file mode 100644 index 000000000..a4c0f5501 --- /dev/null +++ b/docs/guides/sdk/key-management.md @@ -0,0 +1,17 @@ +# Key Management + +Here we cover many aspects of handling keys within the Cosmos SDK +framework. + +## Pseudo Code + +Generating an address for an ed25519 public key (in pseudo code): + +``` +const TypeDistinguisher = HexToBytes("1624de6220") + +// prepend the TypeDistinguisher as Bytes +SerializedBytes = TypeDistinguisher ++ PubKey.asBytes() + +Address = ripemd160(SerializedBytes) +``` diff --git a/docs/guides/sdk/key-management.rst b/docs/guides/sdk/key-management.rst deleted file mode 100644 index d2b657729..000000000 --- a/docs/guides/sdk/key-management.rst +++ /dev/null @@ -1,18 +0,0 @@ -Key Management -============== - -Here we cover many aspects of handling keys within the Cosmos SDK framework. - -Pseudo Code ------------ - -Generating an address for an ed25519 public key (in pseudo code): - -:: - - const TypeDistinguisher = HexToBytes("1624de6220") - - // prepend the TypeDistinguisher as Bytes - SerializedBytes = TypeDistinguisher ++ PubKey.asBytes() - - Address = ripemd160(SerializedBytes) diff --git a/docs/guides/staking/testnet.md b/docs/guides/staking/testnet.md new file mode 100644 index 000000000..b2bbd8f1a --- /dev/null +++ b/docs/guides/staking/testnet.md @@ -0,0 +1,94 @@ +# Testnet Setup + +**Note:** This document is incomplete and may not be up-to-date with the +state of the code. + +See the [installation guide](../sdk/install.html) for details on +installation. + +Here is a quick example to get you off your feet: + +First, generate a couple of genesis transactions to be incorporated into +the genesis file, this will create two keys with the password +`1234567890`: + +``` +gaiad init gen-tx --name=foo --home=$HOME/.gaiad1 +gaiad init gen-tx --name=bar --home=$HOME/.gaiad2 +gaiacli keys list +``` + +**Note:** If you've already run these tests you may need to overwrite +keys using the `--owk` flag When you list the keys you should see two +addresses, we'll need these later so take note. Now let's actually +create the genesis files for both nodes: + +``` +cp -a ~/.gaiad2/config/gentx/. ~/.gaiad1/config/gentx/ +cp -a ~/.gaiad1/config/gentx/. ~/.gaiad2/config/gentx/ +gaiad init --gen-txs --home=$HOME/.gaiad1 --chain-id=test-chain +gaiad init --gen-txs --home=$HOME/.gaiad2 --chain-id=test-chain +``` + +**Note:** If you've already run these tests you may need to overwrite +genesis using the `-o` flag. What we just did is copy the genesis +transactions between each of the nodes so there is a common genesis +transaction set; then we created both genesis files independently from +each home directory. Importantly both nodes have independently created +their `genesis.json` and `config.toml` files, which should be identical +between nodes. + +Great, now that we've initialized the chains, we can start both nodes in +the background: + +``` +gaiad start --home=$HOME/.gaiad1 &> gaia1.log & +NODE1_PID=$! +gaia start --home=$HOME/.gaiad2 &> gaia2.log & +NODE2_PID=$! +``` + +Note that we save the PID so we can later kill the processes. You can +peak at your logs with `tail gaia1.log`, or follow them for a bit with +`tail -f gaia1.log`. + +Nice. We can also lookup the validator set: + +``` +gaiacli validatorset +``` + +Then, we try to transfer some `steak` to another account: + +``` +gaiacli account +gaiacli account +gaiacli send --amount=10steak --to= --name=foo --chain-id=test-chain +``` + +**Note:** We need to be careful with the `chain-id` and `sequence` + +Check the balance & sequence with: + +``` +gaiacli account +``` + +To confirm for certain the new validator is active, check tendermint: + +``` +curl localhost:46657/validators +``` + +Finally, to relinquish all your power, unbond some coins. You should see +your VotingPower reduce and your account balance increase. + +``` +gaiacli unbond --chain-id= --name=test +``` + +That's it! + +**Note:** TODO demonstrate edit-candidacy **Note:** TODO demonstrate +delegation **Note:** TODO demonstrate unbond of delegation **Note:** +TODO demonstrate unbond candidate diff --git a/docs/index.rst b/docs/index.rst index 77b030743..3a2237a3c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -17,8 +17,9 @@ SDK .. toctree:: :maxdepth: 1 - guides/sdk/install.rst - guides/sdk/key-management.rst + guides/sdk/install.md + guides/sdk/key-management.md + .. sdk/overview.rst # needs to be updated .. old/glossary.rst # not completely up to date but has good content @@ -47,7 +48,7 @@ Staking .. toctree:: :maxdepth: 1 - guides/staking/testnet.rst + guides/staking/testnet.md .. staking/intro.rst .. staking/key-management.rst .. staking/local-testnet.rst