Install and Configure the Blockchain App Builder Extension for Visual Studio Code

The Blockchain App Builder extension for Visual Studio Code can be downloaded through the Oracle Blockchain Platform console.

The following platforms are supported:
  • macOS
  • Oracle Linux 8.0 or 9.0
  • Microsoft Windows 10 or 11

Prerequisites

Before you install Blockchain App Builder 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), and npm v8.x or 9.x (tested with 9.5.0 and 9.5.1)

    Check the Node.js version by running the following command: node --version

    Check the npm version by running the following command: npm --version

    If you use a manager such as nvm or nodenv to install Node.js and npm, set the default/global version and then restart Visual Studio Code so that the version will be detected by the Prerequisites page.

    Do not use versions of Node.js earlier or later than version 18.

  • Go version v1.20.10. After installing Blockchain App Builder, see Additional Setup for Go Chaincode Projects.

    Check the Go version by running the following command: go version

  • If you plan 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>"
  • Visual Studio Code version 1.66.0 or later

    Check the Visual Studio Code version by running the following command: code --version

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
    
    The output of the command is the following text:
    default -> 18.16.0 (-> v18.16.0)

Prerequisites

  • Docker v18.09.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), and npm v8.x or v9.x (tested with 9.5.0 and 9.5.1)

    Check the Node.js version by running the following command: node --version

    Check the npm version by running the following command: npm --version

    If you use a manager such as nvm or nodenv to install Node.js and npm, set the default/global version and then restart Visual Studio Code so that the version will be detected by the Prerequisites page.

    Do not use versions of Node.js earlier or later than version 18.

  • Go version v1.20.10. After installing Blockchain App Builder, see Additional Setup for Go Chaincode Projects.

    Check the Go version by running the following command: go version

  • If you plan 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>"
  • Visual Studio Code version 1.66.0 or later

    Check the Visual Studio Code version by running the following command: code --version

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
    
    The output of the command is the following text:
    default -> 18.16.0 (-> v18.16.0)

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 the Blockchain App Builder Extension

  1. Download the extension from the Developer Tools tab on the Blockchain App Builder pane of the Oracle Blockchain Platform console. On the Blockchain App Builder pane, under the Download section, select Visual Studio Code Extension.
  2. In Visual Studio Code, open the Extensions panel and then from the More Actions menu, select Install from VSIX.
  3. Locate the downloaded oracle-ochain-extension-x.x.x.vsix file and then click Install. (Adjust the name of the .vsix file for the version that you are installing.)
  4. Restart Visual Studio Code to complete installation of the extension.
  5. To use the specification file validation functions, which automatically validate the specification file as you type, install the YAML extension from Red Hat. Open the Extensions panel, search for YAML, install the YAML Language Support extension, and then restart Visual Studio Code.

After installation, you can use the Oracle Blockchain App Builder icon on the left side of Visual Studio Code to open the Blockchain App Builder panel.

Additionally, the Blockchain App Builder command line interface (CLI) is automatically installed as part of the extension for Visual Studio Code if you haven't already installed it separately. The CLI commands can be run from any terminal application, including the Visual Studio Code console window. Blockchain App Builder is installed globally, so you can run the CLI commands from any location in the file system.

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.