Run a ScalarDL Application through ScalarDL Ledger
This guide explains how to run a ScalarDL application through ScalarDL Ledger. This document assumes that you have already tried the Get Started with ScalarDL Ledger tutorial and created your application that integrates ScalarDL by using the Client SDK by referring to the How to Write Applications guide.
Decide on configurations
Before running ScalarDL applications through Ledger, you first need to configure Ledger and the client that interacts with Ledger.
There are several important options that you must set and decisions to make as described below.
Disable Auditor
You must disable Auditor since you'll be running your applications through only Ledger. Disabling Auditor has to be done in the client and Ledger configurations as follows.
- In the client configuration, set
scalar.dl.client.auditor.enabled
tofalse
. (Sincefalse
is the default value, you can choose to omit this property.) - In the Ledger configuration, set
scalar.dl.ledger.auditor.enabled
tofalse
. (Sincefalse
is the default value, you can choose to omit this property.)
If you are using the scalardl-samples environment, see the ledger.properties file for the corresponding storage.
For details about the configurations, see the following:
Decide on which authentication method to use
You must decide which authentication method to use for clients: digital signature or HMAC. As a simple comparison, the digital-signature method provides non-repudiation in addition to authentication but is slow, whereas the HMAC method provides only authentication but is fast.
You can configure an authentication method as follows:
- In the client configuration, set
scalar.dl.client.authentication.method
todigital-signature
orhmac
(depending on which method you choose). - In the Ledger configuration, set
scalar.dl.ledger.authentication.method
todigital-signature
orhmac
(depending on which method you choose).
You also need to prepare some secret information. If you're using the digital-signature method you need to prepare a certificate and a private key. If you're using the HMAC method, you need to prepare a secret key. For more details about the authentication in ScalarDL, check out the ScalarDL Authentication Guide.
For details about the configurations, see the following:
Decide which database to use
Ledger uses ScalarDB to interact with databases, which enables you to run ScalarDL on top of various databases. So, you need to decide on a database that ScalarDB supports based on your applications' requirements. For databases and their versions that ScalarDB supports, see Requirements.
You can configure a database as follows:
- In the Ledger configuration, set
scalar.db.storage
,scalar.db.contact_points
,scalar.db.username
, andscalar.db.password
to the appropriate values based on the database that you'll be using.
For details about the above configurations, see ScalarDB Configurations.
Decide which isolation level to use
Ledger relies on the Consensus Commit transaction manager of ScalarDB to manage transactions. The transaction manager is responsible for guaranteeing the isolation property of transactions, which is crucial for ensuring the consistency and correctness of transactions.
You can configure the isolation level of Ledger. If you are unsure about which isolation level to use, use SERIALIZABLE
.
You can configure the isolation level as follows:
- In the Ledger configuration, set
scalar.db.consensus_commit.isolation_level
to an isolation level of your choice. The default value isSNAPSHOT
.
For details about the above configurations, see ScalarDB Configurations.
Decide which other configurations to use
You can also apply other configurations, such as TLS and gRPC configurations, for Ledger. For details about the configurations, see the following:
Start Ledger
After configuring Ledger and the client, you need to start up Ledger. You can start up Ledger with your preferred database that ScalarDB supports. For databases and their versions that ScalarDB supports, see Requirements.
For details on how to locally start up Ledger by using Docker Compose, see Getting Started with ScalarDL Ledger. For how to start up Ledger in local or cloud-based Kubernetes environments, see Deploy ScalarDL in your local Kubernetes environmentL or Deploy ScalarDL in a cloud-based Kubernetes environment, respectively.
Download the Client SDK
If you need to run ScalarDL commands, you need to download the Client SDK. For instructions, see Download the Client SDK.
Register a certificate or a secret key from a client
For the digital-signature authentication method, you can register a certificate with Ledger by using the following command. For details about the command, see the ScalarDL Client Command Reference.
scalardl register-cert --properties <CLIENT_PROPERTIES_FILE>
For the HMAC authentication method, you can register a secret key with Ledger by using the following command. For details about the command, see the ScalarDL Client Command Reference.
scalardl register-secret --properties <CLIENT_PROPERTIES_FILE>
You can also register certificates and secrets by using ClientService in the ScalarDL Java Client SDK.
Register contracts and functions from a client
You can register contracts with Ledger by using the following command. For details about the command, see the ScalarDL Client Command Reference.
scalardl register-contract --properties <CLIENT_PROPERTIES_FILE> --contract-id <CONTRACT_ID> --contract-binary-name <CONTRACT_BINARY_NAME> --contract-class-file <CONTRACT_CLASS_FILE>
You can register functions with Ledger by using the following command. For details about the command, see the ScalarDL Client Command Reference.
scalardl register-function --properties <CLIENT_PROPERTIES_FILE> --function-id <FUNCTION_ID> --function-binary-name <FUNCTION_BINARY_NAME> --function-class-file <FUNCTION_CLASS_FILE>
You can also register contracts and functions with Ledger by using ClientService in the ScalarDL Java Client SDK.
Run your application
Now that you have registered contracts and functions from a client, you can now run your application that integrates ScalarDL.