Skip to content

AschPlatform/cctime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CCTime (Backend)

CCTime is a decentralized application (Dapp) based on the Asch sidechain Dapp SDK. A Dapp that communicate with the Asch mainchain. The CCTime application will not issue tokens internally. The tokens will be created on the main chain. We will register a publisher called CCTime on the Asch main chain, and then use this publisher to register an asset named XCT. The full name of this asset is CCTime.XCT currency.

XCT (time coin) issues a limit of 10 billion tokens. The team has set aside 5% tokens, 10% to partners, and the remaining 85% will all be airdropped to restore the nature of ICO (Initial Crypto-Token Offering).

Important

This repository is the backend part of the CCTime Dapp. Please follow this installation tutorial first and then start the cctime-frontend part.

CCTIME


1 Installation

1.1 Preparation

Please follow the following steps carefully, to register your cctime Dapp on your localnet.

1.1.1 Clone cctime

Clone this repository:

git clone https://github.com/AschPlatform/cctime

1.1.2 Install Asch Blockchain

If you haven't installed the Asch Blockchain, the installation instructions are located here or here.

After the installation of the Asch Blockchain you should have the following file structure: idealFolderStructe

1.2 Register cctime

In order to register your CCTime dapp, first install asch-redeploy

npm install --global asch-redeploy

Change directory:

cd cctime

Then execute asch-redeploy in the cctime folder:

asch-redeploy --publisher CCTime --asset XCT

After a few seconds the dapp should be successfully registered on the local Asch Blockchain:

DappId

The new <dapp Id> for our Dapp is ed409eda243950a4702c0d4551740301c2e2ae7cf5dc512c03b04d9b2b07ee98
(yours will be different)

dappRegistered

1.2.1 Dapp Registration behind the scenes

Registration Account
The following account was used for the registration of the CCTime Dapp. This account is also the default account asch-redeploy is using for the Dapp registration.

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

You can use your own account with the following option: asch-redeploy --master <secret>



Publisher and Asset

Many steps are executed during the automatic CCTime Dapp registration. Let's have a look:

The publisher CCTime was registered:

img

The asset CCTime.XCT was registered and after that 20000 CCTime.XCT tokens were minted:

img

And 500 CCTime.XCT tokens were credited to your Dapp. This operation is called Dapp Refuel.

img


Dapp Refuel

A Dapp Refuel is necessary because every Dapp has its account balance. In order to spend CCTime.XCT tokens on the CCTime Dapp you need to transfer tokens to your Dapp. You are using the same account with the same secret, wheter your are on the Asch mainchain or on the CCTime Dapp. Every account has its own account balance, on the Asch Mainchain and on the CCTime Dapp. This concept is visualized below:

Your Asch Mainchain account has a balance of 20000 CCTime.XCT tokens. We are going to refuel our CCTime Dapp with 500 CCTime.XCT.
img


After we refueled our Dapp with 500 CCTime.XCT tokens we can spend them for Dapp services. That wasn't possible before.

img


Check token balance on Mainchain account:

curl http://localhost:4096/api/uia/balances/AHMCKebuL2nRYDgszf9J2KjVZzAw95WUyB

# returns
{
  "success": true,
  "balances": [
    {
      "currency": "CCTime.XCT",
      "balance":"1950000000000",
      "maximum":"1000000000000000000",
      "precision":8,
      "quantity":"2000000000000",
      "writeoff":0,
      "allowWriteoff":0,
      "allowWhitelist":0,
      "allowBlacklist":0,
      "maximumShow":"10000000000",
      "quantityShow":"20000",
      "balanceShow":"19500" // 19500 CCTime.XCT
    }
  ],
  "count":1
}

Check token balance on Sidechain account:

curl http://localhost:4096/api/dapps/<your Dapp Id>/balances/AHMCKebuL2nRYDgszf9J2KjVZzAw95WUyB

# returns
{
  "balances": [
    {
      "currency": "CCTime.XCT",
      "balance":"50000000000" // 500 CCTime.XCT
    }
  ],
  "success":true
}


License

The GPLv3 License.

Copyright (c) 2017-2018 Asch

About

Decentralized news channel for crypto currency

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published