Deadalus wallet allow to run a full cardano node and allow to run a cardano-cli
Mac Path:
/Applications/Daedalus Mainnet.app/Contents/MacOS
/Applications/Daedalus Testnet.app/Contents/MacOS
Update Environment variables
export PATH=$PATH:"/Applications/Daedalus Testnet.app/Contents/MacOS"
How works daedalus
Daedalus is the UI of cardano-wallet → cardano-wallet interact with cardano-node
Cardano socket file
get it with command:
ps -ef | grep cardano-node
output example
501 59465 59454 0 8:54AM ?? 149:12.43 cardano-node run --socket-path cardano-node.socket --shutdown-ipc 3 --topology /Applications/Daedalus Testnet.app/Contents/Resources/topology.yaml --database-path chain --port 60215 --config /Applications/Daedalus Testnet.app/Contents/Resources/config.yaml 501 59466 59454 0 8:54AM ?? 68:41.57 cardano-wallet serve --shutdown-handler --port 60216 --database /Users/valeriomellini/Library/Application Support/Daedalus Testnet/wallets --tls-ca-cert /Users/valeriomellini/Library/Application Support/Daedalus Testnet/tls/server/ca.crt --tls-sv-cert /Users/valeriomellini/Library/Application Support/Daedalus Testnet/tls/server/server.crt --tls-sv-key /Users/valeriomellini/Library/Application Support/Daedalus Testnet/tls/server/server.key --token-metadata-server https://metadata.cardano-testnet.iohkdev.io --sync-tolerance 300s --testnet /Applications/Daedalus Testnet.app/Contents/Resources/genesis.json --node-socket /Users/valeriomellini/Library/Application Support/Daedalus Testnet/cardano-node.socket
export CARDANO_NODE_SOCKET_PATH="/Users/valeriomellini/Library/Application Support/Daedalus Testnet/cardano-node.socket"
To check if everything works fine
cardano-cli query tip --testnet-magic 1097911063
cardano-cli query tip --mainnet
export magicnumber="1097911063"
cardano-cli address key-gen --verification-key-file payment.vkey --signing-key-file payment.skey
#TESTNET
cardano-cli address build --payment-verification-key-file payment.vkey --out-file payment.addr --testnet-magic=$magicnumber
#MAINNET
cardano-cli address build --payment-verification-key-file payment.vkey --out-file payment.addr --testnet-magic=$magicnumber
export address=[INSERT DESTINATION ADDRESS]
#TESTNET
cardano-cli query utxo --address $(< payment.addr) --testnet-magic=$magicnumber
#MAINNET
cardano-cli query utxo --address $(< payment.addr) --mainnet
#TESTNET
cardano-cli query protocol-parameters --testnet-magic=$magicnumber --out-file protocol.json
#MAINNET
cardano-cli query protocol-parameters --mainnet --out-file protocol.json
Every asset on Cardano has a policy.
The policy-id is required to create a unique token on cardano blockchain
mkdir policy
cardano-cli address key-gen \
--verification-key-file policy/policy.vkey \
--signing-key-file policy/policy.skey
touch policy/policy.script && echo "" > policy/policy.script
the hash of the key has to be inserted into the json file "policy.script"
echo "{" >> policy/policy.script
echo " \"keyHash\": \"$(cardano-cli address key-hash --payment-verification-key-file policy/policy.vkey)\"," >> policy/policy.script
echo " \"type\": \"sig\"" >> policy/policy.script
echo "}" >> policy/policy.script
cardano-cli transaction policyid --script-file ./policy/policy.script >> policy/policyID
Call the command:
#TESTNET
cardano-cli query utxo --address $(< payment.addr) --testnet-magic=$magicnumber
#MAINNET
cardano-cli query utxo --address $(< payment.addr) --mainnet
export txhash="insert your txhash here"
export txix="insert your TxIx here"
export funds="insert Amount here"
export policyid=$(cat policy/policyID)
export tokenname="ZEN"
export tokenamount="100000000"
export fee="0"
export output="0"
cardano-cli transaction build-raw \
--fee $fee \
--tx-in $txhash#$txix \
--tx-out $address+$output+"$tokenamount $policyid.$tokenname" \
--mint="$tokenamount $policyid.$tokenname" \
--minting-script-file policy/policy.script \
--out-file matx.raw
Here is where part one of the magic happens. For the --tx-out, we need to specify which address will receive our transaction. In our case, we send the tokens to our own address.
NOTE
The syntax is very important, so here it is word for word. There are no spaces unless explicitly stated:
- address hash
- a plus sign
- the output in Lovelace (ada) (output = input amount — fee)
- a plus sign
- quotation marks
- the amount of the token
- a blank/space
- the policy id
- a dot
- the token name (optional if you want multiple/different tokens: a blank, a plus, a blank, and start over at 6.)
- quotation marks
# TESTNET
export fee=$(cardano-cli transaction calculate-min-fee --tx-body-file matx.raw --tx-in-count 1 --tx-out-count 1 --witness-count 1 --testnet-magic=$magicnumber --protocol-params-file protocol.json | cut -d " " -f1)
#MAINNET
export fee=$(cardano-cli transaction calculate-min-fee --tx-body-file matx.raw --tx-in-count 1 --tx-out-count 1 --witness-count 1 --mainnet --protocol-params-file protocol.json | cut -d " " -f1)
export output=$(expr $funds - $fee)
Do the transaction again
cardano-cli transaction build-raw \
--fee $fee \
--tx-in $txhash#$txix \
--tx-out $address+$output+"$tokenamount $policyid.$tokenname" \
--mint="$tokenamount $policyid.$tokenname" \
--minting-script-file policy/policy.script \
--out-file matx.raw
Sign the transaction la transazione
#TESTNET
cardano-cli transaction sign \
--signing-key-file payment.skey \
--signing-key-file policy/policy.skey \
--testnet-magic $magicnumber --tx-body-file matx.raw \
--out-file matx.signed
#MAINNET
cardano-cli transaction sign \
--signing-key-file payment.skey \
--signing-key-file policy/policy.skey \
--mainnet --tx-body-file matx.raw \
--out-file matx.signed
#TESTNET
cardano-cli transaction submit --tx-file matx.signed --testnet-magic $magicnumber
#MAINNET
cardano-cli transaction submit --tx-file matx.signed --mainnet