Private peer-to-peer off-chain txs
In this section, we show you how to make private transactions and send funds to another account using the Miden client.
Prerequisite steps
- You should have already followed the prerequisite steps and get started documents.
- You should not have reset the state of your local client.
Create a second account¶
Tip
Remember to use the Miden client documentation for clarifications.
-
Create a second account to send funds with. Previously, we created a type
basic-mutable
account (account A). Now, create anotherbasic-mutable
(account B) using the following command:miden-client account new basic-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 tx new p2id --note-type private <regular-account-id-A> <regular-account-id-B> <faucet-account-id> 50
Note
The faucet account id is
0xad904b3138d71d3e
and can also be found on the Miden faucet website under the title Miden faucet.This generates a private Pay-to-ID (
P2ID
) note containing50
assets, transferred from one account to the other. -
First, sync the accounts.
miden-client sync
-
Get the second note id.
miden-client input-notes list
-
Have the second account consume the note.
miden-client tx new consume-notes <regular-account-ID-B> <input-note-id>
Tip
It’s possible to use a short version of the note id: 7 characters after the
0x
is sufficient, e.g.0x6ae613a
.You should now see both accounts containing faucet assets with amounts transferred from
Account A
toAccount B
.Tip
Remember. The original amount was
333
tokens. -
Check the second account:
miden-client account show <regular-account-ID-B> -v # Show account B's vault assets (50 fungible tokens)
-
Check the original account:
miden-client account show <regular-account-ID-A> -v
Wanna do more? Sending public notes