A stripped down version of the node template, ready for hackin'.
We have prepared a FRAME-less runtime. It does, by all means nothing as it is now.
Try and do as many of the following, in the same order:
Make it a flipper: it stores one bool value, and per each transaction, flips that value.Make it an adder: it stores one u32 value, and each transaction specifies a number, which is added to this value and stored onchain again.Extend your transaction so that the runtime can be either an adder or a multiplier.Add a kill-switch to this runtime. Look into well_known_keys to see which key you have to wipe.Make this runtime upgradable! The upgrade operation can simply be protected by a "password" as you don't have any notion of accounts yet.Add a notion of accounts and nonces and signatures.- Add a notion of balances
- Write a custom runtime API, and try to call it over the RPC.
- Implement a tx-pool api, implement tipping, priority, longevity etc.
.. you can virtually do endless experiments on top of the frameless runtime. Make good ues of it, and you will learn a lot about the fundamentals of substrate!
Moreover, this is the perfect intro to FRAME. You feel the pain of how hard it is to code your own blockchain from scratch 😈.
The cargo run
command will perform an initial build. Use the following command to build the node
without launching it:
cargo b -r
Once the project has been built, the following command can be used to explore all parameters and subcommands:
./target/release/node-template -h
This command will start the single-node development chain with non-persistent state:
./target/release/node-template --dev
Purge the development chain's state:
./target/release/node-template purge-chain --dev
Start the development chain with detailed logging:
RUST_BACKTRACE=1 ./target/release/node-template -ldebug --dev
In case of being interested in maintaining the chain's state between runs a base path must be added:
// Create a folder to use as the db base path
$ mkdir my-chain-state
// Use of that folder to store the chain state
$ ./target/release/node-template --dev --base-path ./my-chain-state/
// Check the folder structure created inside the base path after running the chain
$ ls ./my-chain-state
chains
$ ls ./my-chain-state/chains/
dev
$ ls ./my-chain-state/chains/dev
db keystore network