To follow the lecture you need a 100% sync node, follow the steps in lesson 2 that you find here

Create a wallet with your node

let’s create a folder:

mkdir excercise01

now we create the wallet with:

cardano-cli address key-gen --verification-key-file payment.vkey --signing-key-file payment.skey

and to see the address use the following command:

cardano-cli address build --payment-verification-key-file payment.vkey --out-file payment.addr

and then

cat payment.addr

And we now see our address!

Checking funds in wallet

Let’s run the command

cardano-cli query utxo --address $(cat payment.addr) --mainnet

we will see that there are no transactions so 0 ADA

Sending funds

Let’s send some ADA to the wallet from our main wallet (try with 5 ADA) and run again the command to check the transactions:

cardano-cli query utxo --address $(cat payment.addr) --mainnet

now we should se some ADA, 5000000 lovelace for instance means 2 ADA

Check funds of any address

if you want to check ada inside any wallet the command becomes:

cardano-cli query utxo --address ADDRESSTOCHECKHERE --mainnet

and the result is all the transactions containing ada and nfts in the address

Creating the raw transaction

let’s copy the transaction hash that contain the 5 ADA and the index

cardano-cli transaction build-raw --fee 0 --tx-in HASHOFUNSPENTTRANSACTION#INDEX --tx-out ADDRESSRECEIVER+2000000 --tx-out $(cat payment.addr)+0 --mainnet --out-file matx.raw

Calculate the fee

we must calculate the fee according to the network parameters that we get with the following:

cardano-cli query protocol-parameters --mainnet --out-file protocol.json

 (In the video I made a typo)


cardano-cli transaction calculate-min-fee --tx-body-file matx.raw --tx-in-count 1 --tx-out-count 2 --witness-count 1 --mainnet --protocol-params-file protocol.json

and we get the fee we should pay at least

#build the final transaction

now we can finally build the complete transaction with:

cardano-cli transaction build-raw --fee FEE_WE_CALCULATED --tx-in HASHOFUNSPENTTRANSACTION#INDEX  --tx-out ADDRESSRECEIVER+2000000 --tx-out $(cat payment.addr)+BALANCE_MINUS_FEES_MINUS_2_ADA --mainnet --out-file matx.raw

At this point the transaction is finished, we must sign it with the key to prove we are the owners

Signing the transaction and submit it to the blockchain

cardano-cli transaction sign --signing-key-file payment.skey --mainnet --tx-body-file matx.raw --out-file matx.signed

now using the key in the folder we approved the transactions, we can send it to the blockchain

Submitting the transaction

To send it to the blockchain we can launch the following

cardano-cli transaction submit --tx-file matx.signed

and now after it has been processed our balance will decrease

Support the project

You can support our videos and development you can check one of our NFT project:

@jurassikchained 10k onchain dinos
@cardano_waifus 1/1 waifus that can change background
@fabul_art   Interactive 3D art Fabergè eggs