AION blockchain is written in Java language.

If you are a developer, you may want to setup your own AION blockchain development environment :

To develop applications on AION platform

To learn how AION blockchain works

To test different provided APIs.

I am using Ubuntu 16.04 LTS OS for my setup. But you can also use any later version of Ubuntu.

A) Download and Extract

Download the latest release binary of AION from https://github.com/aionnetwork/aion/releases Extract the .bz2 file (aion-xxx.tar.bz2) into a folder.

$> bunzip2 aion-xxx.tar.bz2 $> tar xvf aion-xxx.tar

3. Once the extraction is done, there should be a sub folder “aion”.

B) Create few test AION addresses

AION distribution comes with a shell script (aion.sh) which can be used to create new accounts. You can find aion.sh directly under aion folder.

To create a test account:

Run the following command

$> ./aion.sh -a create

2. You will be asked to enter a passphrase. You need to use this passphrase to unlock the account later.

3. The script will then output the public key of newly generated account.

4. The keys for the generated accounts are stored under “keystore” folder in an encrypted form.

C) Get the private key for the newly created address

To export the private key for a AION address, you can use the following command. The command will show the prompt to enter passphrase.

$> ./aion.sh -a export <public_key>

The above command will print the private key of the account in the console.

You may need multiple test accounts during your development and testing. So you can create few test accounts.

D) Configuration change for local blockchain node

The default configuration file in the release binary points to AION main net nodes. So you need to change the config file to start your own blockchain.

Go to the config folder. Edit config.xml file with the following changes.

Remove default bootstrap nodes. You need to remove all nodes under <nodes> tag.

<nodes>

</nodes>

2. You can enable mining and assign one of your test account as mining address. Just keep other properties as it is.

<consensus>

<mining>true</mining>

<miner-address>0xaxxxxxxxxxxxxxxxxxxxxxxxxxxx</miner-address>

…

</consensus>

So now all mined coins in your single node network will go the above mentioned address.

E) Set up for genesis block

To pre-allocate aion coins to other test accounts, you need to change genesis.json file. This file can be found under config folder.

Alternatively, you can copy the content of testnet.json config file to genesis.json file. You can replace an existing public address in the alloc section with your test account address. You can remove all other allocated accounts.

config/genesis.json

{

“alloc”: {

“0xa0533b62f336640303620dd74ae58ac31c9e2376b85c76c85xxxxxxxxxx”: {

“balance”: “314159000000000000000000”

},

“0xa01112158d69a368dfebb9db63a903738cf404449d6xxxxxxxxdf3”: {

“balance”: “314159000000000000000000”

}

},

“networkBalanceAlloc”: {

“0”: {

“balance”: “465934586660000000000000000”

}

},

“energyLimit”: “10000000”,

“nonce”: “0x00”,

“difficulty”: “0x10”,

“coinbase”: “0x0000000000000000000000000000000000000000000000000000000000000000”,

“timestamp”: “1497536993”,

“parentHash”: “0x0000000000000000000000000000000000000000000000000000000000000000”,

“chainId”: “2”

}

Now you are ready to mine the genesis block and start your own local AION blockchain.

F) Start AION node

To start aion node, run the following script under aion folder

$> ./aion.sh

The aion node will be starting now and the node will start mining your own AION coin. If all ok, you should see the output similar to below sample.

18–07–29 12:00:13.926 INFO GEN [main]:

_____

.’. | .~ ~. |.. |

.’ `. | | | | ``.. |

.’’’’’’’’`. | | | | ``.. |

.’ `. | `._____.’ | ``| NETWORK v0.2.8.ef5df39c 18–07–29 12:00:14.245 INFO GEN [main]: DB is empty — adding Genesis

18–07–29 12:00:14.266 INFO GEN [main]: loaded genesis block <num=0, root=15bd1193c56460e82bd79c90ac3755a136ac35830a7c9fd2bc9022de3aa9179e>

18–07–29 12:00:14.306 INFO GEN [main]: <node-started endpoint=p2p://84bfd279–6152–468d-b694-b7e26e810dee@0.0.0.0:30304>

18–07–29 12:00:14.310 INFO CONS [main]: <delayed-start-sealing>

18–07–29 12:00:14.319 INFO API [main]: AionAPI Implementation Initiated

18–07–29 12:00:14.320 INFO API [zmq-api]: Starting Aion Api Server <port=8548>

18–07–29 12:00:14.373 INFO API [main]: <rpc-server — started on 0.0.0.0:8546>

18–07–29 12:00:24.317 INFO CONS [Timer-0]: sealer starting ? {1}

18–07–29 12:00:24.320 INFO CONS [Timer-0]: sealer 1 starting. 18–07–29 12:00:46.538 INFO CONS [EpPow]: block sealed <num=1, hash=a6c5c7, diff=16, tx=0>

18–07–29 12:00:48.702 INFO CONS [EpPow]: block sealed <num=2, hash=1b21bf, diff=16, tx=0>

18–07–29 12:00:50.853 INFO CONS [EpPow]: block sealed <num=3, hash=7d07c8, diff=17, tx=0>

18–07–29 12:00:54.318 INFO CONS [miner_status]: Aion internal miner generating 2.2 solutions per second

Congratulations !!! Your own AION blockchain is now up and running.

In my next few posts, I will explain how to access and develop on this local AION blockchain using java API provided by AION.