Minka Ledger Docs

Deposit funds

Describing the process of adding new balances to the Ledger system


Use case

One of the most fundamental use cases is deposit/withdrawal functionality.

A bank might want to deposit funds that can be used inside the Minka Ledger and transact with other participants (accounts/wallets) in the system (banks, private or business accounts, etc.)

A bank might also want to withdraw excess funds from the Ledger system.

And in this tutorial we will go through the process of issuing new balances.

Creating a bank wallet

Creating a bank wallet is something a bank usually does with its own signer. To showcase deposit/withdraw functionality we need a "demo" bank wallet, so we will create bank signer and bank wallet using that signer.

To create a wallet we will pretend to be a bank and do the same steps we did previously:

  • create a new "bank" signer (demo-bank)
  • create a wallet using that signer
$ minka signer create
? Handle: demo-bank
? Key pair source: Generate new key pair
? Add custom data? No
? Signer password: [hidden]
? Repeat password: [hidden]
Signer demo-bank saved locally.
? Store to ledger? No
 
✅ Signer created successfully:
 
Signer summary:
---------------------------------------------------------------------------
Handle: demo-bank
Public: RiQu4adTcR1elbgSSSOW84rviHLofGhXJQpOYdvHcQc=
 
Access rules:
#0
  - Action: any
  - Signer:
    - public: RiQu4adTcR1elbgSSSOW84rviHLofGhXJQpOYdvHcQc=
 
⚠️  WARNING::  Secret or private key is critical data that should be handled
with care. Private keys are used to modify balances and it is important to
understand that anyone who has access to that key can perform sensitive
ledger operations.

In real life, this bank signer would never be on our (clearinghouse) computer and we would never have access to a private key (secret) from the bank. But here we're creating it so we can have a bank wallet on this ledger. And then we can showcase other actions that are possible for clearinghouse (publishing and removing currency from the system).

Now our "demo-bank" will create its wallet:

$ minka wallet create
? Handle: demo-bank-wallet
? Bridge: [none]
? Add custom data? No
? Add routes? No
? Signer: demo-bank
? Signer password for demo-bank [hidden]
 
✅ Wallet created successfully:
 
Wallet summary:
---------------------------------------------------------------------------
Handle: demo-bank-wallet
 
Access rules:
#0
  - Action: any
  - Signer:
    - public: RiQu4adTcR1elbgSSSOW84rviHLofGhXJQpOYdvHcQc=
 
Status: created
 
Luid: $wlt.-00e5aGYCTTf7TONk
Handle: demo-bank
Public: RiQu4adTcR1elbgSSSOW84rviHLofGhXJQpOYdvHcQc=

Notice how luid from this record starts with $wlt..., indicating it's a wallet record.

And also note, we used demo-bank signer to create this wallet, and not the clearinghouse signer.

Here is how we can check the balance of this newly created wallet:

$ minka wallet balances demo-bank-wallet
Balances:
No balances found

The wallet is empty, but now we can go to the next step, and that's issuing money to bank's wallet.

Publish (issue) new balance

We will issue $1,000 to the demo-bank-wallet using usd currency we created in previous tutorial.

Balance change in the wallet is represented in Minka Ledger system by intent. And intent is just another type of record.

To learn more about how wallet balance updates work, and where they are stored, check out this document.

$ minka intent create
? Handle: 1tBaX8vZcH1V0bFmU7XKP
? Action: issue
? Target: demo-bank-wallet
? Symbol: usd
? Amount: 1000
? Add another action? No
? Add custom data for this intent? No
? Signers: clearinghouse
? Signer password for clearinghouse [hidden]
 
Intent summary:
---------------------------------------------------------------------------
Handle: 1tBaX8vZcH1V0bFmU7XKP
 
Action: issue
 - Target: demo-bank-wallet
 - Symbol: usd
 - Amount: $1,000.00
 
 
? Sign this intent using signer clearinghouse? Yes
 
✅ Intent signed and sent to ledger tutorial-ledger
 
Intent summary:
---------------------------------------------------------------------------
Handle: 1tBaX8vZcH1V0bFmU7XKP
 
Action: issue
 - Target: demo-bank-wallet
 - Symbol: usd
 - Amount: $1,000.00
 
 
Access rules:
#0
  - Action: any
  - Signer:
    - public: eIHlrG0Wr5vl3pDi5Vgqzu5WGE7q/60jsysBmehYKtg=
Luid: $int.-00eg3W9K0qai6mml

handle is a record ID which you can set to whatever value you want. But in most cases you can just leave the default one.

The defult handle is is created automatically (just for intents) as a convenience.

We can see new intent is created and luid starts with $int... which indicates intent record.

And it is signed with clearinghouse signer.

We can also list all the intents using the following command:

$ minka intent list
 
╔══════════════════════════════════════════════════════════════════════════════════════════════════╗
║  Handle                   Action    Source              Target         Amount          Status    ║
╟──────────────────────────────────────────────────────────────────────────────────────────────────╢
║  1tBaX8vZcH1V0bFmU7XKP     Issue         -    demo-bank-wallet    $1,000.00    usd    completed  ║
╚══════════════════════════════════════════════════════════════════════════════════════════════════╝

And we can check demo-bank-wallet balance and see that the new amount is $1,000:

$ minka wallet balances demo-bank-wallet
Balances:
$1,000.00 (usd)

On this page