Skip to content
This repository has been archived by the owner on Jan 15, 2020. It is now read-only.

A simple Aion DApp that permanently records a 140 character message into the Aion Network blockchain.

License

Notifications You must be signed in to change notification settings

nodesmith/aion-for-the-record

Repository files navigation

aion-for-the-record

A simple web app that permanently records a 140 character message into the Aion Network blockchain. View a running demo at https://aion-for-the-record.herokuapp.com/.

View the full tutorial here: https://medium.com/nodesmith-blog/for-the-record-a-web-app-starter-kit-built-on-aion-6dee39e1597b

This sample isn't a 'pure' dApp, because it utilizes a lightweight server component to handle writing transactions to the Aion network. However, this is a very useful pattern when you wish to pay the transaction fees for your users. This repository will soon have a sister repo that utilizes the Aiwa Wallet to provide a client only experience.

Quick Start

Prerequisites

Setup & Running Locally

0) Install dependencies

Run npm install.

1) Create your private key string from an Aion Keystore

First, you will need to extract the keystore for an account to a known location. Here are instructions for doing this from the Aion Desktop Wallet.

Make note of the location of the exported keystore and the password that you chose to protect the keystore.

Next, run the following script npm run generateKey -- PATH_TO_KEYSTORE KEYSTORE_PASSWORD with PATH_TO_KEYSTORE and KEYSTORE_PASSWORD replaced with the correct values. For example: npm run generateKey -- ./contract/demoKeyStore 123. This script will generate a private key based on your keystore. Keep this private key safe, and never store it client side.

Finally, replace FTR_PRIVATE_KEY in ./contract/constants.js with this value. Alternatively, you can set the FTR_PRIVATE_KEY environment variable.

2) Configure your Nodesmith endpoint

Replace NODESMITH_API_KEY in ./contract/constants.js with your API Key. Alternatively, you can set the NODESMITH_API_KEY environment variable.

The Nodesmith endpoint is currently configured to use the Mastery testnet. When you are ready to deploy your contract on the mainnet, you can edit the NODESMITH_ENDPOINT in that file to point to the mainnet.

3) Fund your account with some test Aion coin

In order to deploy a contract and send transaction, your account will need some Aion coin.

You can request some testnet Aion from the Mastery Faucet.

3) Compile & deploy the contract

The main contract can be found in ./contract/ForTheRecord.sol.

  • Run npm run deploy to compile & deploy the contract.
  • Replace FTR_CONTRACT_ADDRESS in ./contract/constants.js with the contract address printed out in the deploy script. Alternatively, you can set the FTR_CONTRACT_ADDRESS environment variable.

Note: You can run npm run compile if you wish to just compile the contract but not deploy it.

4) Run the sample locally

  • Run npm start to start the client
  • Open localhost:8080 in your browser

Technologies Used

Develop Mode

To speed up development, you can utilize a few tools:

  • Run npm run dev in one shell, and node server.js in another. Then open localhost:3000. This will enable hot loading, so you can merely make a client side change and the site will auto-reresh with changes.
  • There are configurations in the .vscode folder to run the server and deploy script through visual studio in order to use a debugger.

Deployment

One of the reasons we chose to build this as an express app was to make deployment easy.

The simplest way to deploy this sample is to use Heroku. The repository already has the necessary config files to run on Heroku (the Procfile and app.json).

About

A simple Aion DApp that permanently records a 140 character message into the Aion Network blockchain.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published