Home | Core


Getting Started




Command Line Interface (CLI)




How-To Guides

Upgrade Guides

Release Guides

V3 Testing

Creating Your First Core Module

Step 1: Prepare Your Local Development Environment

Many components are required to have a proper environment setup for the development of your ARK Core module. You can view instructions on how to setup your development environment here:

Step 2: Create A New Module From A Template

GitHub learning repository has a starter module template project available. You can create a new module by creating a new GitHub repository and selecting the correct template: learn-ark/dapp-core-module-template.

After your repository has been created, you can add it as a submodule within the core/plugins folder and start changing the defaults.

cd plugins/
git submodule add -f https://github.com/your-username/your-core-plugin-repo-name

1.1 Module Configuration

We need to make some changes to the project first. Make sure to modify the default names for the files:

The name of our module is @vendorname/your-dapp-name. Make sure to change the name in your package.json accordingly. It is recommended to scope your packages with a prefix like @your-vendor/ to distinguish it from other npm packages. Check https://docs.npmjs.com/misc/scope for more information.

1.2 Adding Module Dependencies

If your package relies on any dependencies you should install them via lerna add the plugin you are developing.

lerna add dependency-name [email protected]/demo-plugin --dev

Once everything is set up and configured, we can move on to developing the plugin.

Step 3: Module Registration Within Network Configuration

In order to make sure that your plugin is registered and loaded when core node starts you need to modify the plugin.js file related to the current network run mode.

Since, we are running local development environment we need to edit the Testnet configuration (folder: core/packages/core/bin/config/testnet/plugins.js and add our module name to the list of loaded modules. This is also a good place to set up module default properties, that are defined in default.ts file in our module root folder.


module.exports = {
    // Order is IMPORTANT!
    // Modules are loaded in the same order as they are listed
    "@arkecosystem/core-event-emitter": {},
    "@arkecosystem/core-logger-pino": {},
    "@arkecosystem/core-p2p": {},
    "@arkecosystem/core-blockchain": {},
    "@arkecosystem/core-snapshots": {},
    ... // other core plugins and their settings
    "@your-vendor/your-module-name-from-package.json": {
        // Here we set the module properties that are defined in defaults.ts file
        enabled: true,
        host: "",
        port: 8081,

Make sure to run yarn setup from the core root folder when you change or add code to core/plugins. This command takes a long time, just let it finish.

After yarn setup completes you should see the following output:

lerna success - @arkecosystem/core-vote-report
lerna success - @arkecosystem/core-wallet-api
lerna success - @arkecosystem/core-webhooks
lerna success - @arkecosystem/core
lerna success - @arkecosystem/crypto
lerna success - @vendorname/dappname # Your Module

Every plugin that is being registered in this file will be automatically loaded one after another to guarantee that all required data is available, so make sure your custom modules are placed in the right spot.

Step 4: Running Your dApp

Start local blockchain with Testnet running on your developer computer. Follow steps defined in here:

If you already have compiled and running core, just go to core/packages/core and run the yarn full:testnet command.

After the local Testnet starts, the log should show that dApp Module was loaded and run. Console output should look like this (if you haven’t changed the source code from the template):

[2019-10-22 11:13:27.161] INFO : Starting dApp
[2019-10-22 11:13:27.161] INFO : Initialization of dApp

Congratulations. Your first distributed blockchain application is loaded, running and compatible with any ARK Core based blockchain.

Feel free to look into helper class common/base-service.ts that exposes important Core Platform building blocks that you can work with. Your newly developed classes can extend this class and gain access to:

  • wallets and state
  • transaction pool
  • blockchain protocol
  • events
  • database
  • api
  • logger
  • well…actually any core-module :)
2021 © ARK.io | All rights reserved An ARK.io Product