This add-on is operated by Object Frontier Software
Enterprise Blockchain Made Easy.
Last updated 09 May 2018
The OFS Blockchain add-on is currently in beta.
Table of Contents
ObjectFrontier Blockchain is an add-on that installs a private Ethereum blockchain instance in your Heroku environment. Use the OFS Admin App to:
- Configure your private network
- Compile and deploy solidity-based smart contracts
- Create new application experiences
- View each block in the chain
OFS Blockchain provisions a default master account and preloads private tokens to get you started with developing your blockchain applications and smart contracts.
- A new Heroku app with no code deployed (click here to create one, or use the Heroku CLI)
Provisioning the add-on
Run the following Heroku CLI command to provision OFS Blockchain:
$ heroku addons:create blockchain:test -a blockchaindocumentation Creating blockchain:test on ⬢ blockchaindocumentation... free Your add on is being provisioned Created blockchain-encircled-58201 as BLOCKCHAIN_LOAN_APP_URL, BLOCKCHAIN_SERVICE_URL Use heroku addons:docs blockchain to view documentation
blockchain:test plan is provisioned, OFS Blockchain is shown in the “Add-ons” section of your app under the “Resources” tab:
Configure your private blockchain
From the Resources tab of your Heroku app, click the OFS Blockchain add-on to launch the Deployment Wizard:
Click Provision now for [your app name].
This launches an OAuth prompt requesting access to your Heroku app to install the OFS Private Blockchain master instance:
Click Allow to proceed with the full installation.
After OAuth succeeds, you are redirected to your Heroku app’s Overview page. There you can see the private Ethereum image build in progress:
If you’d like to see what’s happening during the Ethereum build & deploy process, you can observe build logs as follows:
After a successful build, deployment of the private Ethereum instance starts automatically. You can also view the deployment logs by clicking the View logs option under More:
After a successful deployment, you will see the following:
As noted in the log viewer, please wait about 5 minutes before accessing the OFS Blockchain Admin Console and starting to deploy smart contracts. The Ethereum DAG generation is still happening at this point and will be completed within the 5-minute period.
During the build process, you might encounter an R14 (Memory Quota Exceeded) error:
If you do, it’s probably because you need to use a
performance-m dyno for your app’s
web process. Fix the error from your app’s Resources tab like so:
The blockchain administration console
Click Open app in the Heroku dashboard to view your blockchain administration console. You can also open it with the following command from your app’s root directory:
$ heroku open
Default account with preloaded tokens
Add new admin account
Add a peer node
Use this feature to add another node as a peer to your blockchain network. The steps are as follows:
- Go to the admin console of the node you would like to add as a peer.
- View the node’s Admin Node Info as shown above.
- Copy the node’s enode URL.
- Paste the URL into the eNode field of the Add Peers form:
- Click Add as peer.
The two nodes will start synchronizing the blockchain.
Tokens are mandatory to deploy smart contracts from an account.
Lock and unlock accounts
Provides an option to lock/unlock an account. Only an unlocked account can be used to deploy smart contracts.
Newly added accounts are locked by default.
Start and Stop Mining
Smart contracts can be deployed only when there is a mining node in the network. By default, your node will be started as a mining mode. You can start/stop mining from the admin console.
Mining will add new tokens to the default account. You can then transfer tokens to the accounts you desire.
The admin conosle is prepackaged with a demo smart contract for a Loan Application.
Upload a Solidity file
Upload a Solidity smart contract file to compile and deploy to blockchain.
Constructor arguments cannot be passed dynamically yet.
Compile your contract
Deploy the compiled contract to your blockchain
Contract ID and Application Binary Interface (ABI)
You will need them both for developing DApps
Always displays the last 50 blocks.
Filter Blocks with Transactions Only
This helps you explore blocks that have transactions in them. For example, you can view a block that has the transaction deploying your smart contract and view the transaction input - the byte code of the input data
Deploy the demo loan DApp
The demo loan application has the following entities:
- The applicant
- The loan program
- The loan
All the above entities are deployed as smart contracts in the blockchain.
The applicant smart contract is an immutable record of the applicant details that can be passed around to vendors and partners involved in loan processing.
The loan program is a Decentralized Autonomous Organization (DAO) deployed by the bank or the loan provider.
The loan is the actual loan offered to the applicant. The entire service lifecycle of the loan, including credit status, approval, and payments are all handled through its smart contract functions.
Complete the following steps to deploy the loan program.
Step 1: Compile the loan program
The admin console is prepackaged with a sample smart contract that can be used with the demo app. Specify a name for the loan program and compile the contract:
Step 2: Deploy the loan program
Step 3: Copy and store the contract ID after deployment
Step 4: Deploy the loan demo DApp to Heroku
Deploying the loan demo DApp to Heroku is simple. Just click the Launch Demo Loan App button, which navigates you to the Heroku app deployment page:
You must set the following fields before deploying the app to Heroku:
- The app name (set to whatever you like)
BLOCKCHAIN_SERVICE_URLconfig var. Specify the URL of your OFS Blockchain app, with
/blockchainappended to it (e.g.,
LOANPROGRAM_CONTRACT_IDconfig var. Specify the smart contract ID of the loan program you deployed in Step 3.
Click the Deploy App button to initiate the build and deployment:
After successful deployment, click View:
The loan application demo DApp
The loan program you deployed through admin console
Manage/Service the loan
Removing the add-on
You can remove OFS Blockchain via the CLI:
This will destroy all associated data and cannot be undone!
$ heroku addons:destroy blockchain -----> Removing blockchain from sharp-mountain-4005... done, v20 (free)
All OFS Blockchain support and runtime issues should be submitted via the Heroku Support channels. Reach out to firstname.lastname@example.org for other questions and service offerings.