Develop Blockchain Apps with Sidechain Technology — Part 1

ASCH
AschPlatform
Published in
4 min readJul 5, 2018

❤ Many thanks from our heart to a1300 for contributing this series of article to give a step by step tutorial on developing DApps on ASCH Platform.

Part 1 — Installing the blockchain
Part 2 — Create your first Sidechain
Part 3 — Build Frontend for Sidechain Dapp (Coming Soon)
Part 4 — Understanding Blockchain and Sidechain Architecture (Coming Soon)
Part 5 — Issue own Token (Coming Soon)

In this article series, we will be learning step by step how to install the ASCH blockchain and develop decentralized applications (DApps) on a separate sidechain. We will develop decentralized applications entirely in JavaScript. You don’t need to learn a new Smart Contract Language like Solidity.

Outlook

In this series of tutorial, we will develop a small decentralized application where every user can publish an article and other users can upvote them.

Structure of Article Series

I would like to take a different approach: We will get our hands dirty first and after that, we will have a look at the concepts behind blockchain and decentralized applications.

Prerequisites

You need to have at least one to two years experience with computer science. You don’t necessarily have to know anything about blockchain. You will learn this as we go along. Good to know: JavaScript, Node.js, Vue.js

The ASCH Blockchain Platform

The ASCH Platform is a blockchain platform using JavaScript, which makes it very easy to develop decentralized applications. The whole blockchain and all its components is written in JavaScript. Decentralized Applications (DApps) are also written in JavaScript. That makes it easy for developers who are readily familiar with JavaScript to start writing DApps on ASCH.

Install the Blockchain on Linux

I recommend running Ubuntu. But it should also work on other Linux distributions.
In the future, the installation process will also be possible on Windows, until then, you can install Linux into a virtual machine (Run-Linux-in-Windows-in-a-VirtualBox)

Install Node.js

First, install curl:

sudo apt-get install curl

Install node.js:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

Install Dependencies

Install all necessary dependencies.

# Install dependencies
sudo apt-get install curl sqlite3 ntp wget git libssl-dev openssl make gcc g++ autoconf automake python build-essential -y
# libsodium for ubuntu
sudo apt-get install libtool libtool-bin -y
# Install nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
# This loads nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# Install node and npm for current user.
nvm install 8.0.0
# check node version and it should be v8.x.x
node --version

Install git

sudo apt-get install git

Blockchain

Now clone the blockchain repository and install its packages.

git clone https://github.com/AschPlatform/asch && cd asch && chmod u+x aschd
npm install

Start the Blockchain

Finally, start the blockchain:

./aschd start

Now open your favourite browser and type localhost:4096/api/blocks

Here you can inspect the latest block, a new block is generated every 10 seconds. Try to refresh your browser a few times.

Stop the Blockchain

./aschd stop

Genesis Account (main chain)

The Genesis account is the account where all the money of the main chain blockchain is initially located. This account has hundred millions of XAS (our standard currency).

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

Access the Blockchain

You can send money and manage the local blockchain via the Command Line with asch-cli but it can be more pleasant to work with the GUI to manage your account. You have options. I will present both options:

Access the Blockchain with Command Line Interface

The asch-cli offers more control over the local blockchain than the GUI. All available options are documented here.

Install the Command Line Interface

Install asch-cli:

npm install --global asch-cli

Command Line Example

Use the secret of the Genesis account to access the local blockchain.
For this example to work, the local blockchain must be up and running already(./aschd start).

asch-cli openaccount "stone elephant caught wrong spend traffic success fetch inside blush virtual element"# server response:
{
"address": "ABuH9VHV3cFi9UKzcHXGMPGnSC4QqT2cZ5",
"unconfirmedBalance": 10000000000000000,
"balance": 10000000000000000,
"publicKey": "116025d5664ce153b02c69349798ab66144edd2a395e822b13587780ac9c9c09",
"unconfirmedSignature": false,
"secondSignature": false,
"secondPublicKey": "",
"multisignatures": [],
"u_multisignatures": [],
"lockHeight": 0
}

Conclusion

We learned how to install your own local Asch blockchain and started it for the first time.

In part 2, we will learn how to create your own sidechain.

Go to Part 2 Now

--

--