Install and Configure Blockchain App Builder CLI

The following platforms are supported:
  • macOS
  • Oracle Linux 8.0 or 9.0
  • Microsoft Windows 10 or 11
After you've completed the installation process:

Prerequisites

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

Note:

Blockchain App Builder coordinates with Oracle Blockchain Platform and its compilers. If you use any versions of the prerequisites other than the ones mentioned in the following section, deploying your chaincode to a remote Oracle Blockchain Platform network might fail.

When you install Blockchain App Builder, a prerequisites check runs first. If the prerequisites check fails, the installation process is stopped.

Prerequisites

  • Rancher Desktop (tested with 1.4.1). Blockchain App Builder can also work with Docker, but it has been tested and verified with Rancher Desktop. If you plan to use Rancher Desktop, uninstall Docker completely before installing Rancher Desktop. After you install Rancher Desktop, ensure that the container runtime is set to dockerd (moby). To verify the container runtime in Rancher Desktop 1.4.1, click Kubernetes Settings, and then Container Runtime.
  • The latest release of Node.js version 18 (tested with 18.15.0 and 18.16.0). Do not use versions of Node.js earlier or later than version 18.
  • npm v8.x or v9.x (tested with 9.5.0 and 9.5.1)
  • Go v1.20.10. After installing Blockchain App Builder, see Additional Setup for Go Chaincode Projects.
  • If you want to use the synchronization feature of Blockchain App Builder, install Git and then configure your user name and email as shown in the following commands. Specify your user name and email address in the place of <your_name> and <email>.
    git config --global user.name "<your_name>" 
    
    git config --global user.email "<email>"

Install Node.js and npm by Using nvm

Using nvm to install Node.js and npm gives you the ability to run more commands without sudo.
  1. Enter the following command to install nvm:
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
  2. Add the following code snippet to the applicable file: ~/.bash_profile, ~/.profile, ~/.bashrc or ~/.zshrc.
    export NVM_DIR="$HOME/.nvm"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
    [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
  3. Log out and then log back in to your operating system.
  4. Enter the following command to verify the nvm installation:
    nvm version
  5. Enter the following command to install Node.js and npm:
    nvm install 18.16.0
  6. Enter the following command to set Node.js 18.16.0 as the default in nvm:
    nvm alias default 18.16.0

Prerequisites

  • Docker v20.10.0 or later
  • Docker Compose v1.23.0 or later
  • The latest release of Node.js version 18 (tested with 18.15.0 and 18.16.0). Do not use versions of Node.js earlier or later than version 18.
  • npm v8.x or v9.x (tested with 9.5.0 and 9.5.1)
  • Go v1.20.10. After installing Blockchain App Builder, see Additional Setup for Go Chaincode Projects.
  • If you want to use the synchronization feature of Blockchain App Builder, install Git and then configure your user name and email as shown in the following commands. Specify your user name and email address in the place of <your_name> and <email>.
    git config --global user.name "<your_name>" 
    
    git config --global user.email "<email>"

Install Node.js and npm by Using nvm

Using nvm to install Node.js and npm gives you the ability to run more commands without sudo.
  1. Enter the following command to install nvm:
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
  2. Add the following code snippet to the applicable file: ~/.bash_profile, ~/.profile, ~/.bashrc or ~/.zshrc.
    export NVM_DIR="$HOME/.nvm"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
    [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
  3. Log out and then log back in to your operating system.
  4. Enter the following command to verify the nvm installation:
    nvm version
  5. Enter the following command to install Node.js and npm:
    nvm install 18.16.0
  6. Enter the following command to set Node.js 18.16.0 as the default in nvm:
    nvm alias default 18.16.0

Install Docker

Ensure that dnf is updated and pointing to the current repository based on your kernel.
  1. Enter the following command to add Docker to the repository list:
    sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
  2. Enter the following command to install Docker:
    dnf install docker-ce -y --allowerasing
  3. Enter the following command to start Docker as a service:
    sudo systemctl enable --now docker
  4. Enter the following commands to ensure that the current user has access to Docker:
    sudo groupadd docker
    sudo usermod -aG docker $USER
  5. Enter the following command to restart the system:
    sudo reboot

Install Docker Compose

  1. Enter the following curl command to get Docker Compose:
    sudo curl -L https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compos
  2. Enter the following command to add executable permissions to Docker Compose:
    sudo chmod +x /usr/local/bin/docker-compose

Prerequisites

  • Rancher Desktop (tested with 1.4.1). Blockchain App Builder can also work with Docker, but it has been tested and verified with Rancher Desktop.
  • The latest release of Node.js version 18 (tested with 18.15.0 and 18.16.0). Do not use versions of Node.js earlier or later than version 18.
  • npm v8.x or v9.x (tested with 9.5.0 and 9.5.1)
  • Go v1.20.10. After installing Blockchain App Builder, see Additional Setup for Go Chaincode Projects.
  • If you want to use the synchronization feature of Blockchain App Builder, install Git and configure your user name and email as shown in the following commands. Specify your user name and email address in the place of <your_name> and <email>.
    git config --global user.name "<your_name>" 
    
    git config --global user.email "<email>"

Install Rancher Desktop

Complete the following steps to install Rancher Desktop on Microsoft Windows.
  1. If Docker is installed on your local computer, uninstall it completely.
  2. Download and install Rancher Desktop.
  3. After the installation wizard completes, before you open Rancher Desktop, run the following commands:
    wsl --install
    wsl --set-default-version 2
    wsl --setdefault rancher-desktop
  4. Open Rancher Desktop to complete the setup process.
  5. After you install Rancher Desktop, ensure that the container runtime is set to dockerd (moby). To verify the container runtime in Rancher Desktop 1.4.1, click Kubernetes Settings, and then Container Runtime.

Install Blockchain App Builder

Download the Blockchain App Builder CLI package (oracle-ochain-cli-x.x.x.tgz) from the Developer Tools tab on the Blockchain App Builder pane of the Oracle Blockchain Platform console.

  1. Enter the following command to install Xcode or the XCode command line tools (xcode-select).
    sudo xcode-select –install
  2. Enter the following command to install Blockchain App Builder (adjust the name of the .tgz file for the version that you are installing):
    npm install -g oracle-ochain-cli-x.x.x.tgz
Note that Mac OS Catalina can have issues with xcode-select. If you encounter these issues, use the following command to reset and restart xcode-select:
xcode-select –-reset
  1. Enter the following command to install Blockchain App Builder (adjust the name of the .tgz file for the version that you are installing):
    npm install -g oracle-ochain-cli-x.x.x.tgz
  2. Log out as the current user and then log in again so that group membership takes effect.
After you've installed all the prerequisite software, enter the following command to install Blockchain App Builder (adjust the name of the .tgz file for the version that you are installing):
npm install -g oracle-ochain-cli-x.x.x.tgz

Verify the Installation

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

Additional Setup for Go Chaincode Projects

To develop a Go project, you must set the GOPATH environment variable. This allows Go to locate your workspace and run your code.

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

Alternately, you can apply the change system-wide by adding the previous variables to the /etc/bashrc file.

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

Alternately, you can apply the change system-wide by adding the previous variables to the /etc/bashrc file.

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