Skip to content

Instantly share code, notes, and snippets.

@caike
Last active November 30, 2022 23:52
Show Gist options
  • Save caike/886053249dfaeb6c22ead1db272b81a8 to your computer and use it in GitHub Desktop.
Save caike/886053249dfaeb6c22ead1db272b81a8 to your computer and use it in GitHub Desktop.
Addresses and Keys for Smart Contract demo
cardano-cli address key-gen --verification-key-file 02.vkey --signing-key-file 02.skey
cardano-cli address build \
--payment-verification-key-file 02.vkey \
--out-file 02.addr --testnet-magic 2
# Optional for debugging
## generates key files for staking address
cardano-cli stake-address key-gen \
--verification-key-file 01-stake.vkey \
--signing-key-file 01-stake.skey
## builds an address which can both receive payments and
# delegate to stake pools. this includes payment information (01.vkey)
# and staking information (01-stake.vkey).
cardano-cli address build \
--payment-verification-key-file 01.vkey \
--stake-verification-key-file 01-stake.vkey \
--out-file 01-staking.addr \
--testnet-magic 2
## builds a stake address. cannot receive payments, but can be used
## to receive rewards.
cardano-cli stake-address build \
--stake-verification-key-file 01-stake.vkey \
--out-file 01-stake.addr \
--testnet-magic 2
echo $(cat 01.addr)
echo $(cat 01-staking.addr)
bech32 <<< $(cat 01.addr)
bech32 <<< $(cat 01-staking.addr)
bech32 <<< $(cat 01-stake.addr)
# Produces PubHeyHash from vkey
cardano-cli address key-hash --payment-verification-key-file 01.vkey --out-file 01.pkh
# Produces PubKeyHash from payment addr
bech32 <<< $(cat 01.addr) | cut -c 3-
# Produces PubKeyHash from staking addr
bech32 <<< $(cat 01-staking.addr) | cut -c 3- | cut -c -56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment