Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
90 lines (60 sloc) 4.27 KB

Getting Started with Scalar DL Sandbox

This document explains how to get started with Scalar DL Sandbox.

Purpose of Sandbox

The Sandbox environment is for playing around with Scalar DL to roughly understand what Scalar DL does and how to write contracts. This is not for verifying or benchmarking the reliability, scalability and/or performance of Scalar DL. If you want to interact with Scalar DL more deeply, please contact us.

Get an auth token and a key pair (a certificate and a private key)

From here, you will need a GitHub account. If you don't have one, please create a free account.

We will authorize you through GitHub OAuth to grant you access to the Sandbox environment. Please visit our sandbox site, read the terms of use, and press the button Try Now. We will provide you with a zip file containing the necessary access token, key pair and configuration file. The access token is only used for authentication with Sandbox API gateway. The key pair is used for communicating with Scalar DL network.

Please note that we generate a key pair for ease of use for the Sandbox environment, but it is usually required to create your private key in your own environment.

Before running your first contract

Please make sure you have the Oracle JDK 8 installed before continuing. Now you can download the Scalar DL client SDK to interact with Scalar DL network. and clone Scalar DL client SDK to interact with Scalar DL network.

$ git clone 

Unzip the downloaded zip file into this directory.

Scalar DL manages data as a set of assets, where each asset is composed of a history of data identified by a key called asset_id and historical version number called age. asset_id is an arbitrary, but unique, string specified by users to manage their assets.

Since the Sandbox is a shared environment that anyone can access, take special care when choosing appropriate names for your asset_ids so that they will not conflict with the asset_ids chosen by other user. One recommended way to do this is to append your username to the asset name, for example <username>-<your-asset-name>. Also, the same care is needed when choosing contract IDs and we recommend using <username>-<your-contract-class-name>.

Register your certificate

Next, let's register your certificate in the Scalar DL network. The registered certificate will allow you to register and execute contracts, and is also used for tamper detection of the data stored in the network.

In the scalardl-client-sdk directory:

$ client/bin/register-cert -properties
  • The should be the same file from the zip downloaded earlier.

Run the StateUpdater contract

We will run the contract scr/main/java/com/org1/contract/, which manages status of some asset.

In the scalardl-client-sdk directory:

  1. Compile the contract

    $ ./gradlew assemble

    This will generate build/classes/java/main/com/org1/contract/StateUpdater.class.

  2. Register the contract

    NOTE: Please replace <username> with your GitHub username.

    $ client/bin/register-contract -properties -contract-id <username>-StateUpdater -contract-binary-name com.org1.contract.StateUpdater -contract-class-file build/classes/java/main/com/org1/contract/StateUpdater.class
  3. Execute the contract

    NOTE: Please replace <username> with your GitHub username.

    $ client/bin/execute-contract -properties -contract-id <username>-StateUpdater -contract-argument '{"asset_id": "<username>-myasset", "state": 3}'

What's next

Please take a look at Getting Started with Scalar DL to learn more about Scalar DL.