Date | Responsible | Changes |
---|---|---|
September 7, 2022 | @Željko Rumenjak | Initial version |
February 2, 2023 | @Anonymous | Destroy intent corrected |
February 27, 2023 | @Anonymous | Added Version to Ledger URL |
March 7, 2023 | @Anonymous | Changed the URL to ldg-stg.one |
March 10, 2023 | @Anonymous | Using placeholders for Ledger URL when connecting and explained the format of this URL. Updated cli inputs and outputs according to latest CLI. |
In this tutorial you are going to build a ledger that manages business account balances and allows businesses to make payments to other businesses using a simple REST API.
<aside> 💡 This example represents a simplified banking core.
</aside>
In order to follow this tutorial you have to have nodeJS v18 or newer installed on your machine. This tutorial uses a Minka Ledger, so our first task is to connect to it, for this we will use the Minka CLI tool.
Install the Minka CLI through your terminal:
**$ npm install -g @minka/cli**
<aside>
💡 After installing the CLI tool, you will be able to interact with local or remote ledger instances by using the minka
command. Checkout all the commands available by typing minka --help
.
</aside>
After we have installed a CLI, we can connect to a ledger by typing:
**$ minka server connect
? Server URL: <ledger URL>**
✅ **Connected to server <server name>** (<server URL>)
**Active ledger: <ledger name>**
Ledger URL required as input has the following format:
https://<ledger name>.<server domain>/api/v2
<ledger name>
will automatically be set as active ledger which can be later changed with minka ledger select
commandNow we have everything ready to start tracking balances in the ledger.
Before storing data in the ledger, we need to create a signer.
Minka Ledger security model is based on asymmetric cryptography, because of that we need to sign each request using a public and private key pair. A signer is a ledger concept that encapsulates those keys with optional metadata.
First, we will create a treasury
key that we will use to control the money supply of our system: