Coder Social home page Coder Social logo

learn-ark / dapp-core-module-template Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 3.0 1.19 MB

A Basic Core dApp Module Application Template

Home Page: https://learn.ark.dev/application-development/how-to-write-core-modules

License: MIT License

TypeScript 100.00%
blockchain-technology dpos template dapp typescript dapp-development

dapp-core-module-template's Introduction

Imgur

Reusable ARK Core Module dApp Empty Template Project

This is a basic template project for ARK core dApp development. Create a new project based on this template and load your plugin into the corresponding network configuration by following the steps below.

This Example is currently operational only on our core/develop branch!

This template project provides initial structure for your dApp development.

dApp Creation Steps

STEP 0: Create New Project Based On This Template

STEP 1: Checkout Your New dApp Project As a GitSubmodule in core/plugins

You should already have a running core and a local testnet running. If not head over to https://learn.ark.dev/core-getting-started/spinning-up-your-first-testnet#step-2-testnet-network-boot.

cd plugins/ #location for loading of custom non-core dApps
git submodule add -f https://github.com/your-gh-handle/your-dapp-name
cd your-dapp-name

STEP 2: Load The dApp In The Corresponding Network Configurations.

We will enable our dApp @vendorname/dappname in the testnet network configuration. dApp name is taken from node package name as defined in package.json. You can change it to your needs.

Go to: core/packages/core/bin/testnet

cd packages/core/bin/config/testnet

Locate file plugins.js. We will add our dApp name to end of the list of the loaded plugins. This means that core will pickup the dapp and load it for a specific network configuration.

Add line "@arkecosystem/dappname": {}: to the end of the plugins.js file, so it looks something like this:

    "@arkecosystem/core-exchange-json-rpc": {
        enabled: process.env.CORE_EXCHANGE_JSON_RPC_ENABLED,
        host: process.env.CORE_EXCHANGE_JSON_RPC_HOST || "0.0.0.0",
        port: process.env.CORE_EXCHANGE_JSON_RPC_PORT || 8080,
        allowRemote: false,
        whitelist: ["127.0.0.1", "::ffff:127.0.0.1"],
    },
    "@arkecosystem/core-snapshots": {},
    "@vendorname/dappname": {}, //our application hook (here we load the plugin/dapp, as defined in your dapp package.json)

Make sure to run yarn setup from the core root folder when you change or add code to core/plugins

After yarn setup completes, you should see the following log

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

Last line showing that your dApp was detected and compiled.

STEP 3: Start Local Testnet Blockchain

Start local blockchain with testnet running on your developer computer. Follow steps defined in here: https://learn.ark.dev/core-getting-started/spinning-up-your-first-testnet#step-2-testnet-network-boot

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

After local testnet starts, the log should show that dApp was loaded. It should look like this (if you haven't changed the source code):

[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 and working and compatible with any ARK Core based blockchain.

Feel free to look into common/base-service.ts class that exposes important Core Platform classes 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 -... actually any module :)

Also check other packages/modules as they follow the same dApp structure.

Use Block Explorer To View Local Running Testnet

Click here to setup local blockchain explorer in a few simple steps: https://learn.ark.dev/core-getting-started/setup-local-blockchain-explorer


Congrats, your dapp is loaded. Now look at the resources below to understand more about our dapp development.

Security

If you discover a security vulnerability within this package, please send an e-mail to [email protected]. All security vulnerabilities will be promptly addressed.

License

MIT ยฉ ArkEcosystem

dapp-core-module-template's People

Contributors

kovaczan avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

dapp-core-module-template's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm tslint Unavailable

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency @sindresorhus/tsconfig to v5
  • chore(deps): update dependency @types/node to v20
  • chore(deps): update dependency del-cli to v5
  • chore(deps): update dependency jest-extended to v4
  • chore(deps): update dependency prettier to v3
  • chore(deps): update dependency typescript to v5
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

npm
package.json
  • @arkecosystem/core-container 2.7.1
  • @arkecosystem/core-interfaces 2.7.1
  • @sindresorhus/tsconfig 0.7.0
  • @types/jest 26.0.14
  • @types/node 12.12.62
  • tslint 6.1.3
  • tslint-config-prettier 1.18.0
  • typescript 4.0.3
  • typedoc 0.19.2
  • ts-jest 26.4.0
  • jest 26.4.2
  • jest-extended 0.11.5
  • regenerator-runtime 0.13.7
  • cross-env 7.0.2
  • del-cli 3.0.1
  • prettier 2.1.2

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.