To test plutus scripts and transactions, I want to have a lightweight environment which I can use when I have no internet. So, how can I deploy a local testnet in the Babbage era for testing?
1 Answer
A local testnet can easily be deployed in the babbage era via the following script in the node repository (1). This method requires you to quickly sequence some commands. This is due to this and failing to launch the stake pools within the 30 seconds will result in not correctly deploying the testnet. I think you can change the 30 start_time
yourself to overcome this. The scripts also assumes that the cardano-node
and cardano-cli
binaries are in your path. Personally, I just enter a nix-shell in the node repository to have these available.
To use this script, you must run it from the cardano-node/
directory via the command
./scripts/babbage/mkfiles.sh
This will create the directory cardano-node/example
. In this folder, there are three other scripts that each deploy a stake pool for the testnet (node-spo*.sh
). These need to be deployed before the start_time
(30 seconds from the mkfiles.sh
script execution), so it is good practice to have 3 terminals ready. These node-spo*.sh
scripts also need to be executed from the cardano-node/
directory, not the cardano-node/example/
directory. This is because there are some file structures hard-coded in the scripts. To launch the first stake pool, execute the command,
./example/node-spo1.sh
Do the same for node-spo2.sh
and node-spo3.sh
. The testnet is now running!
The example folder contains the following files. Most notably, you have geneses UTxO keys in the example/utxo-keys/
folder, where the address can be derived via the command,
cardano-cli genesis initial-addr --verification-key-file utxo-keys/utxo1.vkey --testnet-magic 42
.
├── byron-gen-command
│ ├── genesis-keys.000.key
│ ├── genesis-keys.001.key
│ └── genesis-keys.002.key
├── byron.genesis.spec.json
├── configuration.yaml
├── delegate-keys
│ ├── delegate1.counter
│ ├── delegate1.kes.skey
│ ├── delegate1.kes.vkey
│ ├── delegate1.skey
│ ├── delegate1.vkey
│ ├── delegate1.vrf.skey
│ ├── delegate1.vrf.vkey
│ ├── delegate2.counter
│ ├── delegate2.kes.skey
│ ├── delegate2.kes.vkey
│ ├── delegate2.skey
│ ├── delegate2.vkey
│ ├── delegate2.vrf.skey
│ ├── delegate2.vrf.vkey
│ ├── delegate3.counter
│ ├── delegate3.kes.skey
│ ├── delegate3.kes.vkey
│ ├── delegate3.skey
│ ├── delegate3.vkey
│ ├── delegate3.vrf.skey
│ ├── delegate3.vrf.vkey
│ ├── opcert1.cert
│ ├── opcert2.cert
│ └── opcert3.cert
├── genesis
│ ├── byron
│ │ └── genesis.json
│ └── shelley
│ ├── genesis.alonzo.json
│ └── genesis.json
├── genesis.alonzo.spec.json
├── genesis-keys
│ ├── genesis1.skey
│ ├── genesis1.vkey
│ ├── genesis2.skey
│ ├── genesis2.vkey
│ ├── genesis3.skey
│ └── genesis3.vkey
├── genesis.spec.json
├── main.sock -> node-spo1/node.sock
├── node-spo1
│ ├── byron-delegate.key
│ ├── byron-delegation.cert
│ ├── db
│ │ ├── immutable
│ │ │ ├── 00000.chunk
│ │ │ ├── 00000.primary
│ │ │ └── 00000.secondary
│ │ ├── ledger
│ │ ├── lock
│ │ ├── protocolMagicId
│ │ └── volatile
│ │ └── blocks-0.dat
│ ├── kes.skey
│ ├── node.log
│ ├── node.sock
│ ├── opcert.cert
│ ├── port
│ ├── topology.json
│ └── vrf.skey
├── node-spo1.sh
├── node-spo2
│ ├── byron-delegate.key
│ ├── byron-delegation.cert
│ ├── db
│ │ ├── immutable
│ │ │ ├── 00000.chunk
│ │ │ ├── 00000.primary
│ │ │ └── 00000.secondary
│ │ ├── ledger
│ │ ├── lock
│ │ ├── protocolMagicId
│ │ └── volatile
│ │ └── blocks-0.dat
│ ├── kes.skey
│ ├── node.log
│ ├── node.sock
│ ├── opcert.cert
│ ├── port
│ ├── topology.json
│ └── vrf.skey
├── node-spo2.sh
├── node-spo3
│ ├── byron-delegate.key
│ ├── byron-delegation.cert
│ ├── db
│ │ ├── immutable
│ │ │ ├── 00000.chunk
│ │ │ ├── 00000.primary
│ │ │ └── 00000.secondary
│ │ ├── ledger
│ │ ├── lock
│ │ ├── protocolMagicId
│ │ └── volatile
│ │ └── blocks-0.dat
│ ├── kes.skey
│ ├── node.log
│ ├── node.sock
│ ├── opcert.cert
│ ├── port
│ ├── topology.json
│ └── vrf.skey
├── node-spo3.sh
├── pools
│ ├── cold1.skey
│ ├── cold1.vkey
│ ├── cold2.skey
│ ├── cold2.vkey
│ ├── cold3.skey
│ ├── cold3.vkey
│ ├── kes1.vkey
│ ├── kes2.vkey
│ ├── kes3.vkey
│ ├── opcert1.counter
│ ├── opcert2.counter
│ ├── opcert3.counter
│ ├── staking-reward1.skey
│ ├── staking-reward1.vkey
│ ├── staking-reward2.skey
│ ├── staking-reward2.vkey
│ ├── staking-reward3.skey
│ ├── staking-reward3.vkey
│ ├── vrf1.vkey
│ ├── vrf2.vkey
│ └── vrf3.vkey
├── run
│ └── all.sh
├── stake-delegator-keys
│ ├── payment1.skey
│ ├── payment1.vkey
│ ├── payment2.skey
│ ├── payment2.vkey
│ ├── payment3.skey
│ ├── payment3.vkey
│ ├── staking1.skey
│ ├── staking1.vkey
│ ├── staking2.skey
│ ├── staking2.vkey
│ ├── staking3.skey
│ └── staking3.vkey
└── utxo-keys
├── utxo1.skey
├── utxo1.vkey
├── utxo2.skey
├── utxo2.vkey
├── utxo3.skey
└── utxo3.vkey
EDIT: Recently the example/run/all.sh
has been added to the repo, this lets you run all three example/node-spo*.sh
all at once.