Private peer-to-peer transfer
In this section, we show you how to make private transactions and send funds to another account using the Miden client.
- You should have already followed the prerequisite steps and create account documents.
- You should not have reset the state of your local client.
Create a second account
Remember to use the Miden client documentation for clarifications.
-
Create a second account to send funds with. Previously, we created a type
mutableaccount (Account A). Now, create anothermutable(Account B) using the following command:miden-client new-wallet --mutable -
List and view the newly created accounts with the following command:
miden-client account -l -
You should see two accounts:
Transfer assets between accounts
-
Now we can transfer some of the tokens we received from the faucet to our second
Account B.To do this, run:
miden-client send --sender <regular-account-id-A> --target <regular-account-id-B> --asset 50::<faucet-account-id> --note-type privateThe faucet account ID can be found on the Miden faucet website under the title Miden faucet.
This generates a private Pay-to-ID (
P2ID) note containing50assets, transferred from one account to the other. -
First, sync the accounts.
miden-client sync -
Get the second note id.
miden-client notes -
Have the second account consume the note.
miden-client consume-notes --account <regular-account-ID-B> <input-note-id>It's possible to use a short version of the note id: 7 characters after the
0xis sufficient, e.g.0x6ae613a.You should now see both accounts containing faucet assets with amounts transferred from
Account AtoAccount B. -
Check the second account:
miden-client account --show <regular-account-ID-B> -
Check the original account:
miden-client account --show <regular-account-ID-A>
Wanna do more? Sending public notes
Using the note transport network
The steps above assume that the client owns both accounts. To exchange notes with other users, the note transport network can be used.
For this the sender (Account A) will need the address (bech32 string) of the recipient (Account B).
After creating the note (step 1 above), get the created note ID with miden-client notes --list. Then send that note through the note transport network,
miden-client notes --send <note-id> <address-B>
Then the recipient can fetch that note using miden-client sync, or more specifically,
miden-client notes --fetch
The note will then be available to be consumed.
The client will fetch notes for tracked note tags.
By default, note tags are derived from the recipient's account ID. However these can also be random to increase privacy.
In this case, to track a specific tag, run miden-client tags --add <tag>.
Congratulations!
You have successfully configured and used the Miden client to interact with a Miden rollup and faucet.
You have performed basic Miden rollup operations like submitting proofs of transactions, generating and consuming notes.
For more information on the Miden client, refer to the Miden client documentation.
Clear data
All state is maintained in store.sqlite3, located in the directory defined in the miden-client.toml file.
To clear all state, delete this file. It recreates on any command execution.