Skip to content
This repository has been archived by the owner on Aug 21, 2020. It is now read-only.

heystraightedge/straightedge-node

 
 

Repository files navigation

straightedge-node

Straightedge is an:

  • On-chain Governed,
  • Proof-of-Stake (PoS) Blockchain
  • with a WASM Runtime.

For the Straightedge Mainnet Launch, we recommend the lockdrop allocation genesis spec with the following hashes. The hashes can be generated by running shasum and b2sum on the file node/service/src/genesis.json.

➜  straightedge-node git:(master) ✗ shasum node/service/src/genesis.json
`todo`  node/service/src/genesis.json
➜  straightedge-node git:(master) ✗ b2sum node/service/src/genesis.json
`todo`  node/service/src/genesis.json

At launch, you can run straightedge-node and recommended chainspec, as is. However, individuals are able to independently regenerate and verify that the recommended node/service/src/genesis.json hashes follow the straightedge-lockdrop specification. To do this, you'll need to:

  1. Clone edgeware-lockdrop
  2. Run node scripts/lockdrop.js --allocation to generate a lockdrop genesis.json in your working directory.
  3. Copy the genesis.json into your copy of the straightedge-node/node/service/src.
  4. Compute the hashes and verify they match.

From here, you can use the normal build and run commands.

We are now pegged to the master branch of: https://github.com/hicommonwealth/substrate.

To get started

  • Download this entire repository to the file system that you are using to run the validator node.

    • You can do this by going to this page and selecting "Clone or download" followed by "Download ZIP".
    • If you are installing via a command line interface (e.g. SSH into a remote server), you can download by running wget https://github.com/heystraightedge/straightedge-node/archive/master.zip or git clone github.com/heystraightedge/straightedge-node
    • Once you have downloaded the zip file, unzip the straightedge-node-master folder onto the file system. If you are using a command line interface, you can unzip by running unzip master.zip. If you git cloned the repository, you can just cd into there.
    • All commands referenced in this document need to be run from within the edgeware-node-master folder.
  • You will also need to install rust and cargo by installing rustup here. You can do it using the setup.sh bash script in the repo. See the section Fresh Start.

    • Note: at the end of the install, you will need to log out and log in again, or run the suggested source command to configure the current shell.

Fresh start

If your device is clean (such as a fresh cloud VM) you can use this script, otherwise, proceed with the Initial Setup.

./setup.sh

To create a keypair, install subkey with cargo install --force --git https://github.com/paritytech/substrate subkey. Then run the following:

subkey generate

To create an ED25519 keypair, run the following:

subkey -e generate

To create derived keypairs, use the mnemonic generated from a method above and run (use -e for ED25519):

subkey inspect "<mnemonic>"//<derive_path>

For example:

subkey inspect "west paper guide park design weekend radar chaos space giggle execute canoe"//edgewarerocks

Then proceed to the Running instructions or follow the instructions below for the manual setup.

Manual Setup

curl https://sh.rustup.rs -sSf | sh
rustup update stable
rustup update nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
cargo install --git https://github.com/alexcrichton/wasm-gc

You will also need to install the following packages:

Linux:

sudo apt install cmake pkg-config libssl-dev git clang libclang-dev

Mac:

brew install cmake pkg-config openssl git llvm

Building

cargo build --release

Running

Ensure you have a fresh start if updating from another version:

./scripts/purge-chain.sh

To start up the Straightedge node and connect to the mainnet (starts on September 15th), run:

./target/release/straightedge --chain=straightedge --name <INSERT_NAME>

Validating

In order to validate on Straightedge, follow the guide here: Validating on Straightedge

Implemented Modules

EDGE

SRML

Developing on Straightedge

Running A Local Chain

To run a chain locally for development purposes: ./target/release/straightedge --chain=local --alice --validator

To allow apps in your browser to connect, as well as anyone else on your local network, add the --rpc-cors=all flag.

To force your local to create new blocks, even if offline, add the --force-authoring flag.

Adding A Module

  1. Add its github repo to:
  1. Changes to the runtime:
  • Add it as an extern crate.
  • Implement its Trait with production types.
  • Add it to the construct_runtime macro with all implemented components.
  1. If its storage contains config elements, then you need to modify the chain spec:
  • Add it to the straightedge_runtime's list of Config types.
  • Add it to the testnet_genesis function, initializing all storage fields set to config().
  1. Build and run the chain.

Session Key Setup

If you plan to validate on Edgeware or a testnet with any non-default keys, then you will need to store the keys so that the node has access to them, for signing transactions and authoring new blocks. Keys in Edgeware are stored in the keystore in the file system. To store keys into this keystore, you need to use one of the two provided RPC calls.

If your keys are encrypted or should be encrypted by the keystore, you need to provide the key using one of the cli arguments --password, --password-interactive or --password-filename.

Recommended RPC call

For most users who want to run a validator node, the author_rotateKeys RPC call is sufficient. The RPC call will generate N Session keys for you and return their public keys. N is the number of session keys configured in the runtime. The output of the RPC call can be used as input for the session::set_keys transaction.

curl -H 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "method":"author_rotateKeys", "id":1 }' localhost:9933

Advanced RPC call

If the Session keys need to match a fixed seed, they can be set individually key by key. The RPC call expects the key seed and the key type. The key types supported by default in Edgeware are aura, gran, and imon.

curl -H 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "method":"author_insertKey", "params":["KEY_TYPE", "SEED", "PUBLIC_KEY"],"id":1 }' localhost:9933

KEY_TYPE - needs to be replaced with the 4-character key type identifier. SEED - is the seed of the key.

About

[DEPRECIATED] Substrate node implementing Straightedge

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 96.0%
  • Shell 3.6%
  • Dockerfile 0.4%