Swanky Node
Swanky Node is a Substrate based blockchain configured to enable pallet-contracts
(a smart contract module), and other features that assist local development of Wasm smart contracts.
Features
- pallet-contracts
grandpa
&aura
consensus were removed. Instead,instant-seal
&manual-seal
are used. Blocks are authored & finalized (1) as soon as a transaction get in the pool (2) whenengine_createBlock
engine_finalizeBlock
RPC called respectively.pallet-dapps-staking
pallet-assets
pallet-assets
chain extensionpallet-dapps-staking
chain extension
Swanky Node is optimized for local development, while removing unnecessary components such as P2P. Additional features and pallets, such as to interact between (Contract <-> Runtime), will be added in the future.
Compatible ink! version
ink! v4.0.0
or lower is supported.
Installation
Download Binary
The easiest method of installation is by downloading and executing a precompiled binary from the Release Page
Build Locally
If you would like to build the source locally, you should first complete the basic Rust setup instructions. Once Rust is installed and configured, you will be able to build the node with:
cargo build --release
Embedded Docs :book:
Once the project has been built, the following command can be used to explore all parameters and subcommands:
./target/release/swanky-node -h
Usage
This command will start the single-node development chain with a persistent state.
./target/release/swanky-node
If you would prefer to run the node in non-persistent mode, use tmp option.
./target/release/swanky-node --tmp
# or
./target/release/swanky-node --dev
Purge the development chain's state.
./target/release/swanky-node purge-chain
Development Accounts
The alice development account will be the authority and sudo account as declared in the genesis state. While at the same time, the following accounts will be pre-funded:
- Alice
- Bob
- Charlie
- Dave
- Eve
- Ferdie
- Alice//stash
- Bob//stash
- Charlie//stash
- Dave//stash
- Eve//stash
- Ferdie//stash
Show only Errors and Contract Debug Output
To print errors and contract debug output to the console log, supply -lerror,runtime::contracts=debug
when starting the node.
./target/release/swanky-node -lerror,runtime::contracts=debug
Important: Debug output is only printed for RPC calls or off-chain tests ‒ not for transactions.
See the ink! FAQ for more details: How do I print something to the console from the runtime?.
Connect with Polkadot.js Apps Portal
Once the Swanky Node is running locally, you will be able to connect to it from the Polkadot-JS Apps front-end, in order to interact with your chain. Click here connecting the Apps to your local Swanky Node.
Run in Docker
First, install Docker and Docker Compose.
Then run the following command to start a single node development chain.
mkdir .local # this is mounted by container
./scripts/docker_run.sh
This command will compile the code, and then start a local development network. You can
also replace the default command
(cargo build --release && ./target/release/swanky-node --dev --ws-external
)
by appending your own. A few useful commands are shown below:
# Run Substrate node without re-compiling
./scripts/docker_run.sh ./target/release/swanky-node --ws-external
# Purge the local dev chain
./scripts/docker_run.sh ./target/release/swanky-node purge-chain
# Check whether the code is compilable
./scripts/docker_run.sh cargo check