subsembly
  • Introduction
  • Getting Started
    • Overview
    • Substrate Essentials
    • CLI
      • subsembly init
      • subsembly compile
      • subsembly spec
  • Development
    • Runtime Development
    • Chain Specification
    • Runtime Execution
  • Modules
    • Core
      • System
      • Executive
      • Crypto
      • Log
    • Pre-built
      • Aura
      • Balances
      • Timestamp
      • TransactionPayment
  • Advanced
    • as-scale-codec
    • subsembly-core
    • Metadata
      • Dispatcher
  • Guides
    • Create Your First Subsembly Runtime
      • Set Up
      • Start the Node
      • PolkadotJS
    • Start Your Network
      • Prepare the Network
      • Launch Validator Nodes
      • Launch the Third Node
    • Create a New Module
      • Nicks Module
      • Launch the Node
      • PolkadotJs
Powered by GitBook
On this page
  • Overview
  • Compile
  • Launch

Was this helpful?

  1. Guides
  2. Create a New Module

Launch the Node

Overview

In this section, we will launch the node with our newly modified runtime.

Compile

First, we compile our new runtime:

subsembly compile

You can see that assembly/pallets/generated/dispatcher.ts file has changed. Namely, we now have a dispatch call for our new module:

/--snip--/

// Extrinsic calls of Nicks module
export enum NicksCalls {
    set_name = 0
}

/--snip--/

export namespace Dispatcher {
    export function dispatch(ext: UncheckedExtrinsic): u8[] {
        /--snip--/
        case Pallets.Nicks: {
            switch(ext.method.callIndex[1]) {
                case NicksCalls.set_name: {
                    let bytesReader = new BytesReader(ext.method.args);
                    const origin = bytesReader.readInto<AccountId>();
                    const name = bytesReader.readInto<ScaleString>();
                    return Nicks.set_name(origin, name);
                }
                default: {
                    return ResponseCodes.CALL_ERROR
                }
            }
        }
    }
    /--snip--/
}

Launch

Now that we have newly compiled runtime, it's time to launch the node. But first, make sure to generate new raw spec file, since we made changes in our runtime:

subsembly spec --src=./chain-spec.json

And now, this will launch the node:

make run-node-demo spec=./raw-chain-spec.json

Also, make sure to insert you Aura keys, so that the node starts the block production.

PreviousNicks ModuleNextPolkadotJs

Last updated 4 years ago

Was this helpful?