-
Notifications
You must be signed in to change notification settings - Fork 5
Build a new project with PL^G
<- Back to Installing Dev Environment
This guide shows you how to run a node in development
mode. This mode is ideal for testing and getting started with PL^G, because it comes preconfigured with a bunch of test accounts with funds.
git clone -b 1.0.0-rc4.2 https://github.com/plugblockchain/plug-blockchain.git
cd plug-blockchain/bin/node-template/
cargo build -p node-template
This will run the built PL^G node. The purge-chain
command ensures the node runs a fresh blockchain ledger.
The --validator
and --alice
flags set up the node as a development-chain authorised validator so that it will start producing blocks on its own.
../../target/debug/node-template purge-chain
../../target/debug/node-template --chain=dev --base-path=/tmp/plug-test --validator --alice
You may have to replace the --base-path with a valid path on your OS.
You should see something similar to:
20xx-xx-xx 12:17:34 Substrate Node
20xx-xx-xx 12:17:34 version 2.0.0-alpha.5-ffffffff-x86_64-macos
20xx-xx-xx 12:17:34 by Anonymous, 2017-2020
20xx-xx-xx 12:17:34 π Chain specification: Development
20xx-xx-xx 12:17:34 π· Node name: pricey-roof-2938
20xx-xx-xx 12:17:34 π€ Roles: AUTHORITY
20xx-xx-xx 12:17:35 π¨ Initializing Genesis block/state (state: 0x2c98β¦8264, header-hash: 0x334bβ¦c99f)
20xx-xx-xx 12:17:35 Loading GRANDPA authority set from genesis on what appears to be first startup.
20xx-xx-xx 12:17:35 Loaded block-time = 6000 milliseconds from genesis on first-launch
20xx-xx-xx 12:17:35 π¦ Highest known block at #0
Navigate to node-template/node/src/main.rs
Change the sc_cli::VersionInfo
:
name: "Awesome Node",
commit: env!("VERGEN_SHA_SHORT"),
version: env!("CARGO_PKG_VERSION"),
executable_name: "awesome-node",
author: "Peter Parker",
description: "Node to run on the decentralised Awesome network",
support_url: "support.awesome.io",
copyright_start_year: 2099,
In the node/Cargo.toml
file change the following:
[package]
name = "awesome-node"
[[bin]]
name = "awesome-node"
Compile and run it again - this time the binary has changed to awesome-node
cargo build -p awesome-node
../../target/debug/awesome-node purge-chain
../../target/debug/awesome-node --chain=dev --base-path=/tmp/awesome-test --validator --alice
You should now see your "Awesome node":
20xx-xx-xx 12:35:21 Awesome Node
20xx-xx-xx 12:35:21 version 2.0.0-alpha.5-54c2032ff-x86_64-macos
20xx-xx-xx 12:35:21 by Peter Parker, 2099-2020
20xx-xx-xx 12:35:21 π Chain specification: Development
20xx-xx-xx 12:35:21 π· Node name: womanly-activity-3970
20xx-xx-xx 12:35:21 π€ Roles: AUTHORITY
20xx-xx-xx 12:35:31 π¨ Initializing Genesis block/state (state: 0x2c98β¦8264, header-hash: 0x334bβ¦c99f)
20xx-xx-xx 12:35:31 Loading GRANDPA authority set from genesis on what appears to be first startup.
20xx-xx-xx 12:35:31 Loaded block-time = 6000 milliseconds from genesis on first-launch
20xx-xx-xx 12:35:31 π¦ Highest known block at #0
The node template has a few important files:
-
node/src/main.rs
- This is where you configure binary details (like in step 4) -
node/Cargo.toml
- Contains the binary build configuration -
runtime/src/lib.rs
- This is where we configure many of the features of your PL^G blockchain
Getting Started
PL^G Component Guides
- Attestation
- Doughnut
- Generic Assets (coming soon)
Advanced Topics
External Links