Install and Configure Blockchain App Builder CLI

The following platforms are supported:
Once you've completed the install:

Prerequisites for Mac OSX and Linux

Before you install Blockchain App Builder CLI on your local system, you must install the prerequisites.

  • Docker v18.09.0 or later
  • Docker Compose v1.23.0 or later
  • Node v10.18.1 or later (tested with 10.22.1)
  • npm v6.x (tested with 6.13.4)
  • If you are developing Go chaincodes, you need to install Go v1.14
  • If you want to use the Synchronization feature of App Builder, Git should be installed and your username and email should be configured as follows.
    > git config --global user.name "<your_name>" 
    > git config --global user.email "<email>"

You also need to download the Blockchain App Builder CLI package (oracle-ochain-cli-1.0.0.tgz) from your Oracle Blockchain Platform console. It can be found on the Developer Tools tab on the Blockchain App Builder pane.

Install Node and npm using nvm

We suggest using nvm to install Node and npm because it will give you the ability to run more commands without sudo.
  1. Install nvm:
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
  2. Add the below code snippet to ~/.bash_profile, ~/.profile, ~/.bashrc or ~/.zshrc.
    export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf
    %s "${XDG_CONFIG_HOME}/nvm")"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
  3. Log out and log back in to your operating system.
  4. Verify the nvm installation:
    nvm version
  5. Install Node and npm:
    nvm install 10.18.1
  6. Set Node 10.18.1 as the default in nvm:
    nvm alias default 10.18.1

Install Blockchain App Builder on Mac OSX or Linux

Mac OSX

  1. Install Xcode or the XCode command line tools (xcode-select).
    sudo xcode-select –install
  2. Install Blockchain App Builder:
    npm install -g oracle-ochain-cli-1.4.0.tgz
Note that Mac OS Catalina can have issues with xcode-select. If this happens, reset and restart:
xcode-select –-reset
Oracle Enterprise Linux
  1. Ensure that yum is updated and pointing to the current repository based on your kernel. See the following two articles for information on how to do this:
  2. Install the required libraries:
    sudo yum install gcc gcc-c++ docker-engine -y
  3. Ensure the current user has access to Docker:
    sudo groupadd docker
    sudo usermod -aG docker $USER
  4. Enable the Docker service:
    sudo systemctl enable docker
    sudo systemctl start docker
  5. Install Blockchain App Builder:
    npm install -g oracle-ochain-cli-1.4.0.tgz
  6. Log out the current user and log in again for group membership to take effect.

Prerequisites for Windows

Before you install Blockchain App Builder CLI on your local system, you must install the prerequisites.

  • Docker Desktop for Windows v2.x (tested with 2.5.0.1). When prompted by Docker, provide the Filesharing permissions (required for App Builder).
  • Node v10.18.1 or later (tested with 10.22.1)
  • npm v6.x (tested with 6.13.4)
  • Perl v5.x (tested with ActiveState Perl 5.28)
  • Install Windows Build Tools in a powershell with administrative access. npm install --global windows-build-tools
  • If you are developing Go smart contracts, install Go v1.14
  • If you want to use the Synchronization feature of App Builder, Git should be installed and your username and email should be configured as follows.
    > git config --global user.name "<your_name>" 
    > git config --global user.email "<email>"
  • Download and build OpenSSL

Download and Build OpenSSL

  1. Download OpenSSL from: https://www.openssl.org/source/old/1.0.2/openssl-1.0.2u.tar.gz
  2. Unzip the tarball.
  3. Open the Visual C++ 2017/2019 Native Tools command prompt. In the Windows search bar, search for x64 Native Tools Command Prompt for VS.
  4. Navigate to the extracted OpenSSL folder. Run the following commands as an administrator:
    > perl Configure VC-WIN64A –prefix=C:\OpenSSL-Win64
    > ms\do_win64a
    > nmake -f ms\ntdll.mak          This can take up to 15 minutes to complete.
    > cd out32dll
    > ..\ms\test
    > cd ..
    > md C:\OpenSSL-Win64
    > md C:\OpenSSL-Win64\bin
    > md C:\OpenSSL-Win64\lib
    > md C:\OpenSSL-Win64\include
    > md C:\OpenSSL-Win64\include\openssl
    > copy /b inc32\openssl\* C:\OpenSSL-Win64\include\openssl
    > copy /b out32dll\ssleay32.lib C:\OpenSSL-Win64\lib
    > copy /b out32dll\libeay32.lib C:\OpenSSL-Win64\lib
    > copy /b out32dll\ssleay32.dll C:\OpenSSL-Win64\bin
    > copy /b out32dll\libeay32.dll C:\OpenSSL-Win64\bin
    > copy /b out32dll\openssl.exe C:\OpenSSL-Win64\bin
    > copy /b C:\OpenSSL-Win64\bin\libeay32.dll C:\Windows\System32\libeay32.dll
    > copy /b C:\OpenSSL-Win64\bin\ssleay32.dll C:\Windows\System32\ssleay32.dll

Install Blockchain App Builder on Windows

When you've installed all the prerequisite software, install Blockchain App Builder:
> npm install -g oracle-ochain-cli-1.x.x.tgz

Verify the Install

In your terminal, type ochain -v. The output should list the Blockchain App Builder CLI usage, options, and commands.

Additional Setup for Go Chaincode Projects

In order to develop a Go project, you will need to setup the GOPATH environment variable. This will allow Go to properly locate your workspace in order to run your code.

Linux and Mac

Before setting your GOPATH, make sure you have a go/ folder in your $HOME. If not, create go/ in your home directory:
mkdir $HOME/go
Set your GOPATH by adding this variables in your ~/.bash_profile, ~/.profile, ~/.bashrc or ~/.zshrc file.
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
After editing, run the following to make your changes take effect immediately:
source ~/.bash_profile

Alternatively, you can apply this change system wide by adding the above variables in the /etc/bashrc file.

Windows

Create go/ in your home directory: C:\Users\<username>\go