Git Product home page Git Product logo

substrate-stencil's Introduction

substrate-stencil

A template for kick starting a Rust and Blockchain project using Substrate.

Features

This template includes the minimum required components to start a PoS testnet, inspired by substrate-node-template.

  • Consensus related pallets: Babe & GRANDPA
  • Staking related pallets: staking, session, authorship, im-online, offences, utility
  • Governance related pallets: collective, membership, elections-phragmen, democracy, treasure

Notes: The code is un-audited and not production ready, use it at your own risk.

Getting Started

Follow the steps below to get started.

Rust Setup

First, complete the Dev Docs Installation.

Build and Run

Use the following command to build the node and run it after build successfully:

cargo build --release
./target/release/substrate-stencil --dev

Run public testnet

  • Modify the genesis config in chain_spec.rs
  • Build spec, ./target/release/substrate-stencil build-spec --chain staging > stencil-staging.json
  • Change original spec to encoded raw spec, ./target/release/substrate-stencil build-spec --chain=stencil-staging.json --raw > stencil-staging-raw.json
  • Start your bootnodes, node key can be generate with command ./target/release/substrate-stencil key generate-node-key.
    ./target/release/substrate-stencil \
         --node-key <your-node-key> \
         --base-path /tmp/bootnode1 \
         --chain stencil-staging-raw.json \
         --name bootnode1
  • Start your initial validators,
    ./target/release/substrate-stencil \
        --base-path  /tmp/validator1 \
        --chain   stencil-staging-raw.json \
        --bootnodes  /ip4/<your-bootnode-ip>/tcp/30333/p2p/<your-bootnode-peerid> \
          --port 30336 \
          --ws-port 9947 \
          --rpc-port 9936 \
        --name  validator1 \
        --validator
  • Insert session keys
  • Attract enough validators from community in waiting
  • Call force_new_era in staking pallet with sudo, rotate to PoS validators
  • Enable governance, and remove sudo
  • Enable transfer and other functions

substrate-stencil's People

Contributors

kaichaosun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

substrate-stencil's Issues

Stash does not have enough balance to bond.

Hi, I just cloned your project and build it.
When I run your node by this command, ./target/release/substrate-stencil --dev, it is getting this error.

Thread 'main' panicked at 'Stash does not have enough balance to bond.', /home/mersaid/.cargo/git/checkouts/substrate-7e08433d4c370a21/fc3fd07/frame/staking/src/pallet/mod.rs:561

This is a bug. Please report it at:

	support.anonymous.an

How can I solve this problem?

build error

--- stderr
      Finished release [optimized] target(s) in 0.02s
       Running `/root/my-project/target/release/wbuild-runner/node-template-runtime13295693451984955962/target/x86_64-unknown-linux-gnu/release/wasm-build-runner-impl`
     Compiling sp-arithmetic v2.0.0
     Compiling sp-application-crypto v2.0.0
     Compiling sp-finality-tracker v2.0.0
  error[E0282]: type annotations needed
      --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-arithmetic-2.0.0/src/fixed_point.rs:541:9
       |
  541  |                   let accuracy = P::ACCURACY.saturated_into();
       |                       ^^^^^^^^ consider giving `accuracy` a type
  ...
  1595 | / implement_fixed!(
  1596 | |     FixedI64,
  1597 | |     test_fixed_i64,
  1598 | |     i64,
  ...    |
  1601 | |     "_Fixed Point 64 bits signed, range = [-9223372036.854775808, 9223372036.854775807]_",
  1602 | | );
       | |_- in this macro invocation
       |
       = note: this error originates in the macro `implement_fixed` (in Nightly builds, run with -Z macro-backtrace for more info)

  error[E0282]: type annotations needed
      --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-arithmetic-2.0.0/src/fixed_point.rs:541:9
       |
  541  |                   let accuracy = P::ACCURACY.saturated_into();
       |                       ^^^^^^^^ consider giving `accuracy` a type
  ...
  1604 | / implement_fixed!(
  1605 | |     FixedI128,
  1606 | |     test_fixed_i128,
  1607 | |     i128,
  ...    |
  1611 | |         [-170141183460469231731.687303715884105728, 170141183460469231731.687303715884105727]_",
  1612 | | );
       | |_- in this macro invocation
       |
       = note: this error originates in the macro `implement_fixed` (in Nightly builds, run with -Z macro-backtrace for more info)

  error[E0282]: type annotations needed
      --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-arithmetic-2.0.0/src/fixed_point.rs:541:9
       |
  541  |                   let accuracy = P::ACCURACY.saturated_into();
       |                       ^^^^^^^^ consider giving `accuracy` a type
  ...
  1614 | / implement_fixed!(
  1615 | |     FixedU128,
  1616 | |     test_fixed_u128,
  1617 | |     u128,
  ...    |
  1621 | |         [0.000000000000000000, 340282366920938463463.374607431768211455]_",
  1622 | | );
       | |_- in this macro invocation
       |
       = note: this error originates in the macro `implement_fixed` (in Nightly builds, run with -Z macro-backtrace for more info)

  For more information about this error, try `rustc --explain E0282`.
  error: could not compile `sp-arithmetic` due to 3 previous errors
  warning: build failed, waiting for other jobs to finish...
  error: build failed
warning: build failed, waiting for other jobs to finish...
error: build failed                                                                                      

Is it possible to start a substrate BABE blockchain with no Grandpa authorities and BABE validators?

I'm trying to implement a PoS network on substrate using substrate provided pallets - pallet_session, pallet_staking, pallet_babe, etc. The current Runtime and chain spec implementation is similar to what is found in the substrate repository. I've realized that I need to set Session keys for GenesisConfig before starting the blockchain. I also noticed that the Session keys set for SessionConfig are used to configure the grandpa authorities.

My questions are:

Is there a way to start the blockchain such that no session keys are set?

Do all grandpa authorities need to be hardcoded in the chain spec? If not, how are the authorities added after nodes have gone live?

when rustup default nightly-2020-10-05

error: failed to run custom build command for `node-template-runtime v2.0.0 (/root/llc/runtime)`                                                                                 

Caused by:
  process didn't exit successfully: `/root/llc/target/release/build/node-template-runtime-99a36cd731b55158/build-script-build` (exit code: 1)
  --- stderr
      Finished release [optimized] target(s) in 0.04s
       Running `/root/llc/target/release/wbuild-runner/node-template-runtime17963775831616643517/target/x86_64-unknown-linux-gnu/release/wasm-build-runner-impl`
  Rust WASM toolchain not installed, please install it!

  Further error information:
  ------------------------------------------------------------
     Compiling wasm-test v1.0.0 (/tmp/.tmpHJV6hO)
  error[E0463]: can't find crate for `std`
    |
    = note: the `wasm32-unknown-unknown` target may not be installed

  error: aborting due to previous error

  For more information about this error, try `rustc --explain E0463`.
  error: could not compile `wasm-test`

  To learn more, run the command again with --verbose.
  ------------------------------------------------------------

warning: build failed, waiting for other jobs to finish...
error: build failed 

no method named `as_fd` found for struct `Async` in the current scope

I'm unable to build the master branch on macOS.

error[E0599]: no method named as_fdfound for structAsyncin the current scope --> /Users/usamaali/.cargo/registry/src/github.com-1ecc6299db9ec823/async-process-1.5.0/src/lib.rs:514:16 | 514 | self.0.as_fd() | ^^^^^ method not found inAsyncstd::process::ChildStdin`

error[E0271]: type mismatch resolving <OwnedFd as TryFrom<Async<std::process::ChildStdin>>>::Error == std::io::Error
--> /Users/usamaali/.cargo/registry/src/github.com-1ecc6299db9ec823/async-process-1.5.0/src/lib.rs:523:17
|
523 | value.0.try_into()
| ^^^^^^^^ expected enum Infallible, found struct std::io::Error

error[E0277]: the trait bound OwnedFd: From<Async<std::process::ChildStdin>> is not satisfied
--> /Users/usamaali/.cargo/registry/src/github.com-1ecc6299db9ec823/async-process-1.5.0/src/lib.rs:523:17
|
523 | value.0.try_into()
| ^^^^^^^^ the trait From<Async<std::process::ChildStdin>> is not implemented for OwnedFd
|
= help: the following other types implement trait From<T>:
<OwnedFd as From>
<OwnedFd as From>
<OwnedFd as From>
<OwnedFd as From>
<OwnedFd as From>
<OwnedFd as From>
<OwnedFd as From>
<OwnedFd as Fromstd::process::ChildStderr>
and 2 others
= note: required for Async<std::process::ChildStdin> to implement Into<OwnedFd>
= note: required for OwnedFd to implement TryFrom<Async<std::process::ChildStdin>>
= note: required for Async<std::process::ChildStdin> to implement TryInto<OwnedFd>

error[E0599]: no method named as_fd found for struct Async in the current scope
--> /Users/usamaali/.cargo/registry/src/github.com-1ecc6299db9ec823/async-process-1.5.0/src/lib.rs:598:16
|
598 | self.0.as_fd()
| ^^^^^ method not found in Async<std::process::ChildStdout>

error[E0271]: type mismatch resolving <OwnedFd as TryFrom<Async<std::process::ChildStdout>>>::Error == std::io::Error
--> /Users/usamaali/.cargo/registry/src/github.com-1ecc6299db9ec823/async-process-1.5.0/src/lib.rs:607:17
|
607 | value.0.try_into()
| ^^^^^^^^ expected enum Infallible, found struct std::io::Error

error[E0277]: the trait bound OwnedFd: From<Async<std::process::ChildStdout>> is not satisfied
--> /Users/usamaali/.cargo/registry/src/github.com-1ecc6299db9ec823/async-process-1.5.0/src/lib.rs:607:17
|
607 | value.0.try_into()
| ^^^^^^^^ the trait From<Async<std::process::ChildStdout>> is not implemented for OwnedFd
|
= help: the following other types implement trait From<T>:
<OwnedFd as From>
<OwnedFd as From>
<OwnedFd as From>
<OwnedFd as From>
<OwnedFd as From>
<OwnedFd as From>
<OwnedFd as From>
<OwnedFd as Fromstd::process::ChildStderr>
and 2 others
= note: required for Async<std::process::ChildStdout> to implement Into<OwnedFd>
= note: required for OwnedFd to implement TryFrom<Async<std::process::ChildStdout>>
= note: required for Async<std::process::ChildStdout> to implement TryInto<OwnedFd>

error[E0599]: no method named as_fd found for struct Async in the current scope
--> /Users/usamaali/.cargo/registry/src/github.com-1ecc6299db9ec823/async-process-1.5.0/src/lib.rs:671:16
|
671 | self.0.as_fd()
| ^^^^^ method not found in Async<std::process::ChildStderr>

error[E0271]: type mismatch resolving <OwnedFd as TryFrom<Async<std::process::ChildStderr>>>::Error == std::io::Error
--> /Users/usamaali/.cargo/registry/src/github.com-1ecc6299db9ec823/async-process-1.5.0/src/lib.rs:680:17
|
680 | value.0.try_into()
| ^^^^^^^^ expected enum Infallible, found struct std::io::Error

error[E0277]: the trait bound OwnedFd: From<Async<std::process::ChildStderr>> is not satisfied
--> /Users/usamaali/.cargo/registry/src/github.com-1ecc6299db9ec823/async-process-1.5.0/src/lib.rs:680:17
|
680 | value.0.try_into()
| ^^^^^^^^ the trait From<Async<std::process::ChildStderr>> is not implemented for OwnedFd
|
= help: the following other types implement trait From<T>:
<OwnedFd as From>
<OwnedFd as From>
<OwnedFd as From>
<OwnedFd as From>
<OwnedFd as From>
<OwnedFd as From>
<OwnedFd as From>
<OwnedFd as Fromstd::process::ChildStderr>
and 2 others
= note: required for Async<std::process::ChildStderr> to implement Into<OwnedFd>
= note: required for OwnedFd to implement TryFrom<Async<std::process::ChildStderr>>
= note: required for Async<std::process::ChildStderr> to implement TryInto<OwnedFd>

Some errors have detailed explanations: E0271, E0277, E0599.
For more information about an error, try rustc --explain E0271.
error: could not compile async-process due to 9 previous errors`

I'm using following toolchain:
rustup show

Default host: x86_64-apple-darwin
rustup home:  /Users/<user>/.rustup

installed toolchains
--------------------

stable-x86_64-apple-darwin
nightly-2022-09-14-x86_64-apple-darwin (default)
nightly-x86_64-apple-darwin

installed targets for active toolchain
--------------------------------------

wasm32-unknown-unknown
x86_64-apple-darwin

active toolchain
----------------

nightly-2022-09-14-x86_64-apple-darwin (default)
rustc 1.65.0-nightly (17cbdfd07 2022-09-13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.