How to Get Started with EAL
This guide will provide a simple path to get up and running with Raiinmaker Network Enterprise Application Layer (EAL) no matter the size or scale of the project from startup to Enterprise.
Setup
Before going further, please install the Raiinmaker Network EAL command line tool/shell (coiin) with:
Transactions
The core of a blockchain is a verifiably secure and immutable ledger. The most basic use case for a chain is ledgering data and state changes. As time goes on, each change is added on top of the last, forming a cryptographically secure chain of data transformations that can be easily traced from start to finish.
To follow along with this tutorial, you will need access keys to your business chain.
Before your business chain will accept any transactions, you will need to create and register a transaction type
. To do so, run the transactionType create
command from the coiin
shell. For more detail, refer to the transaction types page. While transaction types are extensible and designed to support complex work flows, this example is of a simple ledger transaction called quickstart
.
Verify that the type has been created using coiin
:
Now that the chain has a transaction type, it will accept new transactions. Raiinmaker Network EAL business chains support indexing and searching transactions based on their transaction type. This helps provide logical separation between a business’ various data types.
Creating a transaction is as easy as providing a payload to coiin
:
To find the transaction, get it directly by id:
Smart Contracts
Hello world
To create and execute a smart contract with custom business logic on the your business chain, three simple steps are necessary: (1) create a contract locally (including a fully-featured test environment), (2) build the image, (3) and run it!
To see how easy this is, copy and paste the following 3 commands to your console:
Once completed, the contract will output:
These commands create a contract locally (including a fully-featured test environment), build the image, and run it! That’s all it takes to start building a smart contract on Raiinmaker Network EAL!
A Little More About Smart Contracts
Unlike other blockchains where developers have to write smart contracts in specific languages so that the code can compile on the blockchain’s virtual machine, the Raiinmaker Network EAL Platform makes use of Docker to deploy independently scalable smart contracts in any programming language they desire (limited only by Docker). Developers may use JSON for input and output, test locally, deploy frequently, and even update or delete existing smart contracts. This model offers unprecedented flexibility in blockchain development.
To get started building a smart contract, navigate to an empty directory and run the following:
Running contract init
sets up the environment to develop a smart contract. Contract init
supports several languages, but this example uses the nodejs
language. The init
command also creates a few test files with sample tests to help you start your development effort.
Replace the code in handler.js
with the following:
Use the command docker build . -t my-contract
to build the image. The image needs to be pushed to a remotely accessible docker repository before the contract can be deployed. Alternately, coiin
can be used to test the smart contract locally with the following:
coiin
can also be used to deploy the contract my-contract
with the following command:
Once a contract is deployed, you need to create a transaction type that can be used to invoke the contract:
Once a contract deploys successfully, it can be invoked.
And that’s all you need to get started ledgering transactions and create smart contracts on your business chain!
Last updated