Skip to content

Commit

Permalink
AUTO: Sync ScalarDL docs (versioned) to docs site repo
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-wong committed Feb 14, 2024
1 parent 7a12195 commit 0185803
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 8 deletions.
46 changes: 42 additions & 4 deletions docs/3.7/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,44 @@ The Client SDK is a set of user-facing programs to interact with Ledger and Audi
ScalarDL (Ledger and Auditor) abstracts data as a set of assets, where each asset is composed of the history of a record identified by a key called `asset_id` and a historical version number called `age`.
In this document, you will create a very simple application to manage an asset's status using ScalarDL Client SDK.

## Install a JDK

Because ScalarDL is written in Java, using Java is one of the easiest ways to build a ScalarDL applications.
In such a case, you must have one of the following Java Development Kits (JDKs) installed in your environment:

- [Oracle JDK](https://www.oracle.com/java/technologies/downloads/) LTS version (8, 11, or 17)
- [OpenJDK](https://openjdk.org/install/) LTS version (8, 11, or 17)

{% capture notice--warning %}
**Attention**

Since ScalarDL is built with JDK 8, contracts must be a JDK 8-compatible binary.
If you use a version other than JDK 8, you must configure your build tool to build the JDK 8-compatible binary.
There are several ways to specify binary compatibility, including using the `--release 8` option for javac or setting Gradle (or Maven) configurations to use the JDK 8 toolchain as follows.

```gradle
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
```

For more details about the Gradle and Maven configurations, see [Toolchains for JVM projects for Gradle](https://docs.gradle.org/current/userguide/toolchains.html) and [Guide to Using Toolchains for Maven](https://maven.apache.org/guides/mini/guide-using-toolchains.html).
{% endcapture %}

<div class="notice--warning">{{ notice--warning | markdownify }}</div>

{% capture notice--info %}
**Note**

We recommend using the LTS versions mentioned above, but other non-LTS versions may work.

In addition, other JDKs should work with ScalarDL, but we haven't tested them.
{% endcapture %}

<div class="notice--info">{{ notice--info | markdownify }}</div>

## Download the Client SDK

The Client SDK library is available on [Maven Central](https://search.maven.org/search?q=a:scalardl-java-client-sdk). You can install it in your application using your build tool such as Gradle.
Expand Down Expand Up @@ -77,7 +115,7 @@ Next, let's register your certificate to ScalarDL Ledger. Please check [caclient
This time, let's use a simple tool to register your certificate as follows.

```shell
client/bin/register-cert --properties client.properties
client/bin/scalardl register-cert --properties client.properties
```

The registered certificate will allow you to register and execute contracts and will also be used for detecting Byzantine faults in databases.
Expand Down Expand Up @@ -138,7 +176,7 @@ This will generate `build/classes/java/main/com/org1/contract/StateUpdater.class
Let's register your contract. Here again we use a simple tool.

```shell
client/bin/register-contract --properties client.properties --contract-id StateUpdater --contract-binary-name com.org1.contract.StateUpdater --contract-class-file build/classes/java/main/com/org1/contract/StateUpdater.class
client/bin/scalardl register-contract --properties client.properties --contract-id StateUpdater --contract-binary-name com.org1.contract.StateUpdater --contract-class-file build/classes/java/main/com/org1/contract/StateUpdater.class
```

Please set a globally unique ID for the contract ID (e.g. `StateUpdater` in the above command).
Expand All @@ -151,7 +189,7 @@ For example, let's think about a voting application. In the application, anyone
Now you are ready to execute the contract with the following command.

```shell
client/bin/execute-contract --properties client.properties --contract-id StateUpdater --contract-argument '{"asset_id":"some_asset", "state":3}'
client/bin/scalardl execute-contract --properties client.properties --contract-id StateUpdater --contract-argument '{"asset_id":"some_asset", "state":3}'
```

In the contract argument, the value specified with the key `asset_id` must be unique globally for each asset.
Expand All @@ -161,7 +199,7 @@ In the contract argument, the value specified with the key `asset_id` must be un
You can validate the states of Ledger by executing the following command.

```shell
client/bin/validate-ledger --properties client.properties --asset-id="some_asset"
client/bin/scalardl validate-ledger --properties client.properties --asset-id="some_asset"
```

What the validation does is depending on how you set up and configure ScalarDL.
Expand Down
46 changes: 42 additions & 4 deletions docs/3.8/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,44 @@ The Client SDK is a set of user-facing programs to interact with Ledger and Audi
ScalarDL (Ledger and Auditor) abstracts data as a set of assets, where each asset is composed of the history of a record identified by a key called `asset_id` and a historical version number called `age`.
In this document, you will create a very simple application to manage an asset's status using ScalarDL Client SDK.

## Install a JDK

Because ScalarDL is written in Java, using Java is one of the easiest ways to build a ScalarDL applications.
In such a case, you must have one of the following Java Development Kits (JDKs) installed in your environment:

- [Oracle JDK](https://www.oracle.com/java/technologies/downloads/) LTS version (8, 11, or 17)
- [OpenJDK](https://openjdk.org/install/) LTS version (8, 11, or 17)

{% capture notice--warning %}
**Attention**

Since ScalarDL is built with JDK 8, contracts must be a JDK 8-compatible binary.
If you use a version other than JDK 8, you must configure your build tool to build the JDK 8-compatible binary.
There are several ways to specify binary compatibility, including using the `--release 8` option for javac or setting Gradle (or Maven) configurations to use the JDK 8 toolchain as follows.

```gradle
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}
```

For more details about the Gradle and Maven configurations, see [Toolchains for JVM projects for Gradle](https://docs.gradle.org/current/userguide/toolchains.html) and [Guide to Using Toolchains for Maven](https://maven.apache.org/guides/mini/guide-using-toolchains.html).
{% endcapture %}

<div class="notice--warning">{{ notice--warning | markdownify }}</div>

{% capture notice--info %}
**Note**

We recommend using the LTS versions mentioned above, but other non-LTS versions may work.

In addition, other JDKs should work with ScalarDL, but we haven't tested them.
{% endcapture %}

<div class="notice--info">{{ notice--info | markdownify }}</div>

## Download the Client SDK

The Client SDK library is available on [Maven Central](https://search.maven.org/search?q=a:scalardl-java-client-sdk). You can install it in your application using your build tool such as Gradle.
Expand Down Expand Up @@ -77,7 +115,7 @@ Next, let's register your certificate to ScalarDL Ledger. Please check [caclient
This time, let's use a simple tool to register your certificate as follows.

```shell
client/bin/register-cert --properties client.properties
client/bin/scalardl register-cert --properties client.properties
```

The registered certificate will allow you to register and execute contracts and will also be used for detecting Byzantine faults in databases.
Expand Down Expand Up @@ -138,7 +176,7 @@ This will generate `build/classes/java/main/com/org1/contract/StateUpdater.class
Let's register your contract. Here again we use a simple tool.

```shell
client/bin/register-contract --properties client.properties --contract-id StateUpdater --contract-binary-name com.org1.contract.StateUpdater --contract-class-file build/classes/java/main/com/org1/contract/StateUpdater.class
client/bin/scalardl register-contract --properties client.properties --contract-id StateUpdater --contract-binary-name com.org1.contract.StateUpdater --contract-class-file build/classes/java/main/com/org1/contract/StateUpdater.class
```

Please set a globally unique ID for the contract ID (e.g. `StateUpdater` in the above command).
Expand All @@ -151,7 +189,7 @@ For example, let's think about a voting application. In the application, anyone
Now you are ready to execute the contract with the following command.

```shell
client/bin/execute-contract --properties client.properties --contract-id StateUpdater --contract-argument '{"asset_id":"some_asset", "state":3}'
client/bin/scalardl execute-contract --properties client.properties --contract-id StateUpdater --contract-argument '{"asset_id":"some_asset", "state":3}'
```

In the contract argument, the value specified with the key `asset_id` must be unique globally for each asset.
Expand All @@ -161,7 +199,7 @@ In the contract argument, the value specified with the key `asset_id` must be un
You can validate the states of Ledger by executing the following command.

```shell
client/bin/validate-ledger --properties client.properties --asset-id="some_asset"
client/bin/scalardl validate-ledger --properties client.properties --asset-id="some_asset"
```

What the validation does is depending on how you set up and configure ScalarDL.
Expand Down

0 comments on commit 0185803

Please sign in to comment.