16.3.0 • Published 2 years ago

dappy-cli v16.3.0

Weekly downloads
6
License
MIT
Repository
github
Last release
2 years ago

Dappy CLI

NodeJS utility to publish dapp and manage records in the dappy name system

What are record, and what is the dappy name system ?

The dappy name system is an alternative to the DNS, that is powered by the blockchain and a powerful, trustless co-resolution system that make it very secure, resilient and accurate. A record is simply an Top Level Domain / TLD entry in the dappy name system.

What are dapps in a dappy context ?

Dappy dapps are unique web applications, they are stored on the blockchain and loaded in the browser using a trustless co-resolution mechanism, making them very secure and censorship resistant.

Dapps are pushed as NFT in a NFT contract from rchain-token. The address contractId.purseId must then be referenced in a record to be loaded a dappy compatible browser.

fabco.gitbook.io/dappy-spec will provide you with more context.

installation

npm install dappy-cli

scripts

Scripts to add in your package.json :

{
  "dappy:init": "dappy-cli init",
  "dappy:push": "dappy-cli pushdapp",
  "dappy:pushrecord": "dappy-cli pushrecord"
}

Or with npx

npx dappy-cli init
npx dappy-cli pushdapp
npx dappy-cli pushrecord

General configuration

General configuration must be in a dappy.config.json file. You can initiate a template with npx dappy-cli init command.

// dappy.config.json
{
  ...
  "options": {
    "platform": "rchain", // leave "rchain"
    "readOnly": "https://observer.testnet.rchain.coop", // url of the read-only node
    "validator": "https://node2.testnet.rchain.coop", // url of the validator node
    "masterRegistryUri": "aaa", // rchain-token master registry URI
    "privateKey": "", // private key to use for deployments OR path to a text file
    "boxId": "mybox" // rchain-token box ID

    // only used for pushdapp
    "contractId": "mycontract", // rchain-token contract ID
    "purseId": "index", // rchain-token purse ID

    // only used for pushrecord
    "nameSystemContractId": "dappynamesystem", // rchain-token contract ID of the name system NFT contract²
  }
  ...
}

Records in the dappy name system

In dappy, records are the entry of the dappy name system, Amazon own amazon.com in the DNS, and they will own amazon record in the dappy name system.

Managing a record is done through the dappy.config.json file. You can do npm run dappy:init command to have a template file.

// dappy.config.json
{
  ...
  "record": {
    // the TLD you want to own in the dappy name system.
    "id": "amazoon"
    // values or an IP app / TLS website
    "values": [{
      "value": "192.168.0.1",
      "kind": "IPv4"
    }, {
      "value": "LS0tLS1CRUdJTiBD=",
      "kind": "caCert"
    }],
    // values for a dapp
    "values": [{
      "value": "mynftcontract.mypage",
      "kind": "dapp"
    }],
    // ca is a list of base64 certificate linked to the TLD, it will often
    // contain only one certificate, it may or may not be self signed
    "ca": ["123456789ABCDEF"]
  }
  ...
}

Check your config.options and run the following script to book or update your record.

npx dappy-cli pushrecord

Run the following scripts to know the minimal configuration for Apache or NGINX on your web server

# nginx
node index.js nginx
node index.js nginx --commands

# apache
node index.js apache
node index.js apache --commands

Dapps, or blockchain web applications

Value replacement before push

Dappy will replace the following expression if they are found in the bundled html file :

  • MASTER_REGISTRY_URI : replaced by the master registry URI from dappy.config.json
  • PUBLIC_KEY : replaced by the public key from dappy.config.json
  • FULL_ADDRESS : replaced with the full address of the file (CONTRACT_ID.PURSE_ID)
  • REV_ADDRESS : replaced with the REV address (obtained from private key)

dappy.config.json config file

This file defines some properties of your dappy application, the ressources you'll need like JS or CSS libraries, and finally the path of your app's ressources (main JS and CSS files).

To init the dappy.config.json file with default values run npm run dappy:init.

// dappy.config.json
{
  ...,
  "dapp": {
    "html": "dist/dapp.html", // This will only be used as the title of the .dpy file
    "js": "dist/bundle.min.js", // path of your main application js file
    "css": "dist/bundle.min.css" // path of your main application css file
  },
  ...
}

Check your config.options and run the following script to book or update your record.

npx dappy-cli pushdapp
16.3.0

2 years ago

16.1.0

2 years ago

15.0.2

2 years ago

15.0.3

2 years ago

15.0.0

2 years ago

16.2.0

2 years ago

16.0.0

2 years ago

14.0.2

3 years ago

14.0.0

3 years ago

11.0.0

3 years ago

11.0.1

3 years ago

10.0.0

3 years ago

9.0.0

3 years ago

0.7.0

3 years ago

0.5.9

3 years ago

0.6.0

3 years ago

0.5.8

3 years ago

0.5.7

3 years ago

0.5.4

3 years ago

0.5.3

3 years ago

0.5.6

3 years ago

0.5.5

3 years ago

0.5.2

3 years ago

0.5.1

3 years ago

0.5.0

3 years ago

0.4.9

3 years ago

0.4.8

3 years ago

0.4.7

3 years ago

0.4.6

3 years ago

0.4.5

3 years ago

0.4.4

3 years ago

0.4.1

4 years ago

0.4.2

4 years ago

0.4.0

4 years ago

0.3.9

4 years ago

0.3.8

4 years ago

0.3.6

4 years ago

0.3.7

4 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.9

4 years ago

0.2.7

4 years ago

0.2.8

4 years ago

0.2.6

4 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.0

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago