-
Notifications
You must be signed in to change notification settings - Fork 6
3_keys_and_addresses
In the Shelley era of Cardano, every stakeholder can have two sets of keys and addresses:
- Payment Keys and addresses: To send and receive transactions
- Stake Keys and addresses: To control protocol participation, create a stake pool, delegate and receive rewards.
To generate a payment key pair:
cardano-cli address key-gen \
--verification-key-file payment.vkey \
--signing-key-file payment.skey
This creates two files payment.vkey
(the public verification key) and payment.skey
(the private signing key).
To generate Byron-era _payment key:
Payment key files use the following format:
{
"type": "PaymentSigningKeyByron_ed25519_bip32",
"description": "Payment Signing Key",
"cborHex": "hex-here"
}
Where the hex-here
is generated as 0x5880 | xprv | pub | chaincode
To generate a stake key pair :
cardano-cli stake-address key-gen \
--verification-key-file stake.vkey \
--signing-key-file stake.skey
Both verification keys (payment.vkey
and stake.vkey
) are used to build the address and the resulting payment address
is associated with these keys.
cardano-cli address build \
--payment-verification-key-file payment.vkey \
--stake-verification-key-file stake.vkey \
--out-file payment.addr \
--mainnet
To generate a stake address
:
cardano-cli stake-address build \
--stake-verification-key-file stake.vkey \
--out-file stake.addr \
--mainnet
This address CAN'T receive payments but will receive the rewards from participating in the protocol.
NOTE: Ensure that your node has synced to the current block height which can be checked at explorer.cardano.org. If it is not, you may see an error referring to the Byron Era.
To query the balance of an address we need a running node and the environment variable CARDANO_NODE_SOCKET_PATH
set to the path of the node.socket:
cardano-cli query utxo \
--address $(cat payment.addr) \
--mainnet
TxHash TxIx Amount
--------------------------------------------------------------------------------------------
Note--mainnet
identifies the Cardano mainnet, for preproduction testnet use --testnet-magic 1
and for preview testnet use --testnet-magic 2
The cardano-node
wiki has moved. Please go to (https://github.com/input-output-hk/cardano-node-wiki/wiki) and look for the page there.