1.0.4 • Published 6 years ago

asch-redeploy v1.0.4

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

Build Status License Platform


asch-redeploy

A hassle-free local asch environment. Watch for changes on your Dapp and re-deploy it automatically.

Warning

This program is currently only ready for local Dapp development. Do not use it in production.

Installation

Install the newest asch-redeploy version:

npm install --global asch-redeploy

Usage

asch-redeploy automates many manual steps during local Dapp development. If you are developing your Dapp then asch-redeploy listens for file changes and registers your Dapp on your local Asch blockchain every time a file changes.

You don't need to start the asch blockchain asch-redeploy starts it for you.

Start asch-redeploy in your Dapp directory:

$ asch-redeploy

start

asch-redeploy Options

--publisher name

--publisher Registers the master account (see below) as a publisher. With the publisher it is possible to register multiple assets. One account can only be registered as one publisher.

--asset name

--asset Registers an asset

Example:
Publisher: CCTime, Asset: XCT
Creates asset CCTime.XCT, this asset can be used in Dapps.

--asch directory

-a --asch Points to the asch directory where the local Asch blockchain lives. Default ../asch

--host name

-h --host Set the host name on which the local Asch node should be started. Default http://localhost

--port number

-p --port Set the port on which the local Asch node should be started. Default 4096

--magic string

--magic Set the HTTP-Header "Magic" in order to install Dapps on the local Asch node, default 594fe0f3

--genesis secret

-g --genesis Set the genesis secret of the local Asch node. The genesis account is the account where all the money of the local blockchain is initally located. This account has hundred million XAS (XAS is our standard currency). This Genesis account is used to provide our master account with enough money.

Default Genesis account:

{
  "secret": "stone elephant caught wrong spend traffic success fetch inside blush virtual element",
  "publicKey": "116025d5664ce153b02c69349798ab66144edd2a395e822b13587780ac9c9c09",
  "address": "ABuH9VHV3cFi9UKzcHXGMPGnSC4QqT2cZ5"
}

--master secret

-m, --master Set the secret for our master account. This account manages the preparation and registration of new Dapps.

Default Master Secret:

{
  "secret": "sentence weasel match weather apple onion release keen lens deal fruit matrix",
  "publicKey": "a7cfd49d25ce247568d39b17fca221d9b2ff8402a9f6eb6346d2291a5c81374c",
  "address": "AHMCKebuL2nRYDgszf9J2KjVZzAw95WUyB",
}

If you want to use another account, you can:

--master2 secret

-2 --master2 Set the 2nd secret of our master account. This is only necessary if this account has the 2nd secret enabled.

--delegates list of secrets

-d, --delegates List all delegate secrets with which the Dapp should be registered with. This secrets will enable the Dapp to produce blocks. Provide a string with comma separated secrets. According to this scheme: --delegates "secret1 secret1 secret1, secret2 secret2 secret2, secret3 secret3 secret3"

Example:

asch-redeploy --delegates "flame bottom dragon rely endorse garage supply urge turtle team demand put, thrive veteran child enforce puzzle buzz valley crew genuine basket start top, black tool gift useless bring nothing huge vendor asset mix chimney weird"

--output file

-o, --output You can specify a file to which the new DappId will be written every time a new Dapp was registered at the local Asch blockchain. This file can be very useful combined with a build server for frontend Dapp development. Every time the new Dapp will be registered the frontend rebuilds and automatically connects to the newest DappId.

Usage:

asch-redeploy --output ./dappId.json

Produces the following dappId.json file:

{
  "host": "http://localhost",
  "port": "4096",
  "dappId": "4160d918edfbcae7fa508ed9ae2fce836537b8a2e6355a8ae69f8924867c16cb"
}

--help

--help Display help information.

How does asch-redeploy work?

The asch-redeploy package automates numerous manual steps to register and install your Dapp on your local Asch blockchain.

  1. Prepare master account
    1.1 Transfer 20000 XAS from genesis account to master account - only if not previously transferred
  2. (optional) Prepare Publisher, Asset, Tokens
    2.1 Register publisher (e.g publisher CCTime with --publisher CCTime) on local Asch blockchain
    2.2 Register asset (e.g asset XCT with --asset XCT) on local Asch blockchain
    2.3 Create 20000 CCTime.XCT Tokens - only if not previously created
  3. Register Dapp on local Asch blockchain
    3.1 Create random name for Dapp - two Dapps with same name are not allowed
    3.2 Create Dapp registration transaction - the resulting transactionId of this operation is our new dappId which uniquely identifies our Dapp
  4. Install Dapp on local Asch blockchain
    4.1 Add new dappId to asch/config.json file
    4.2 Copy smart contract files (your working directory) to asch/dapps/dappId
    4.3 Restart local Asch blockchain to finish installation
  5. Watch for file changes and start with 1. if a file changes

If you want you can also follow the manual steps as described here

Example Dapps