This tutorial will show how to setup a Node-Red development environment to prototype dAPPs running on the ARK Public Blockchain Network or an ARK Bridgechain. The ARK Typescript SDK will be used to interact with the blockchain however ARK also provides an extensive SDK available in 6 programming languages.
The ARK Public Network powered by ARK Core uses DPoS(delegated proof of stake) consensus, making it one of the fastest, efficient, and scalable Blockchain networks available.
ARK has created a suite of easy to use open source wallets and tools which make it easy to launch your own sovereign blockchain(referred to as a Bridgechain) based on their core technology. ARK’s Deployer tool removes the heavy lifting making the deployment of your blockchain simple and quick.
This guide is written for installation on Raspberry Pi 4 running Ubuntu 21.10 however setup would be nearly identical on a basic VPS. A $5/month VPS from Digital Ocean would be sufficient for this project.
I have previously published a guide for using Node-Red to read blockchain data via the ARK REST API. It might be useful to go through that tutorial prior to this one.
1. Install Ubuntu Server 21.10
See this guide for a secure basic installation of Ubuntu 21.10.
2. Install Node-Red (Tested with Version 2.1.4)
See this guide for installation of Node-Red
3. Install Ark Core Crypto and Client Modules
The SDK consists of 2 parts. The Client module is used for reading and writing from the blockchain. The Crypto module is used for creating transactions and other functions such as message signing.
The following steps are used to download the SDK for a Version 3.0 ARK blockchain.
- Change to Node-Red directory in user account(not root)
- Install @arkecosystem/crypto NodeJS module
npm install @arkecosystem/crypto
- Install @arkecosystem/client NodeJS module
npm install @arkecosystem/client
4. Install Additional Node-Red Nodes
- Install node-red-contrib-config Node. This node is used for setting flow and global context values at start up.
npm install node-red-contrib-config
- Restart Node-Red
5. Create ARK Devnet Wallet
The example flow provided in step 6 include private passphrase for a wallet that can be used for testing on the ARK Devnet(Development). Including wallet keys like this is of course a terrible thing to do when securing cryptocurrency assets for a “real” network.
It is easy to get ARK devnet tokens for your own wallet. Create a devnet wallet in the ARK Wallet and you can go to the official ARK discord to get test tokens via a faucet.
ARK Devnet Test Wallet:
Public Key: 0376690fba1b908459d4d4fcf63b1e52b788c46fc32165b909404baba9d03dd3c4
Private Passphrase: group evolve roast cattle vessel tray clump calm practice velvet awake cream
6. Importing Node-Red Example Flow
If you are new to Node-Red then I recommend starting with this tutorial to learn about the development environment with some basic examples.
I have created an example flow that configures the ARK SDK for the ARK Devnet chain and provides a template showing how to use common blockchain functions.
Download this example flow from the following link and import it into Node-Red:
Use this guide for help with importing flows.
7. Example Flow Tutorial
The example flow will look like the following:
Functions are labeled with a number for easy reference in the rest of this guide.
- Configure Blockchain Relay Node IP address
- Configure Sender Wallet Passphrase, Address, TX fee
- Configure Explorer URL
- Configure Recipient Address
- Network Configuration that runs automatically at start of script
- Retrieves Relay Node’s status
- Retrieve list of other peers
- Get Nonce of the sender wallet
- Send standard transaction
- Send IPFS transaction
- Check for Valid wallet address
- Sign message using ECDSA and Verify
- Sign message using Schnorr and Verify