Dapp Development Guide


2.Dapp Template Structure

Download NASGO-DAPP-Template form github repository

dapps/your dapp id/
├── blockchain.db        
├── config.json                                                                   
├── contract              
│   └── mycontract.js        
├── dapp.json             
├── genesis.json           
├── init.js               
├── interface             
│   └── api.js
├── logs                  
├── model
│   └── table.js    
└── public
    └── css
    └── js
    └── index.html

3. Customize Your Dapp Configuration

3.1 dapp.json

  • Dapp Name #The name of Dapp, e.g. "Hello World"

  • Dapp Descryption #The description of Dapp

  • Delegates List #Input the list of public keys of DApp's initial delegates, seperated by comma. you should specify at least 5 delegates

      "name": "Hello World",
      "description": "My first Dapp",
      "delegates": [

4.Implement Your Dapp

  • Define your data model of Dapp
  • Implement contract of Dapp
  • Implemet Http Interface of Dapp

5.Deploying your Dapp on Mainnet

  1. create genesis block
./nasgo-dev createGenesis -e "account secret"

​ copy result and paste into genesis.json

  "delegate": "eec16080247e802ed2e1b9ca14a8f64a3263bcd65a954db1edadfb98be131f86",
  "height": 1,
  "pointId": null,
  "pointHeight": null,
  "transactions": [],
  "timestamp": 0,
  "payloadLength": 0,
  "payloadHash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
  "count": 0,
  "signature": "68fa8253ca25a1917736bea091ea80be320bc573e2c29ae00312b25bc736f45ffe7bb430ef6616951e2adc2f025f534302715095d5620abce9d85471ac909804",
  "id": "643c18eaef0cf24191b75bbf2f7bca05de4eb381769d3c2b09b3be18137e4bff"
  1. Deploy in NASGO Mainnet
./nasgo-dev publishDapp -f path/to/dapp.json -e "account secret" -s "sercure code if set"

you will get a transaction id if your dapp is deployed in NASGO MainNet successfully


notice: the transaction id is used as your Dapp's ID

6.Running your dapp

  • Rename your dapp project folder's name to the deployment transaction id

  • move your dapp project folder into NASGO-Node-root-directory/dapps

  • restart NASGO-Node

    ./nasgo stop
    ./nasgo start
  • Access your dapp in browser

    http://NASGO-Node's IP:9040/dapps/dappid

results matching ""

    No results matching ""