cardano course
  • Welcome!
  • Video lessons
  • Handbook
    • Module 1. Building and running the node
      • Building the node
      • Running the node and connecting to a network
    • Module 2. Basic operations
      • Creating keys and addresses
      • Creating a simple transaction
      • Registering the stake address and delegating
    • Module 3. Protocol parameters and configuration files
      • Protocol parameters
      • Byron genesis file
      • Shelley genesis file
      • Alonzo genesis file
      • Conway genesis file
      • Node configuration file
      • Topology file
    • Module 4. Peer-to-peer (P2P) networking
    • Module 5. Creating a stake pool
      • The setup
      • Generating keys
      • Registering a stake pool
      • Runtime system options
      • Running the nodes
      • Stake snapshots
      • Upgrading cardano-node and cardano-cli
      • Pool operations and maintenance
      • Retiring a stake pool
    • Module 6. Monitoring the nodes
    • Module 7. Cardano governance
      • Update proposals
      • Polls
    • Module 8. Setting up a local cluster
      • Creating a local cluster
      • Spending the genesis UTXO
      • From Byron to Shelley
      • Moving funds to a Shelley address
      • Creating a first stake pool
      • Bringing decentralization parameter down to .80
      • From Shelley to Alonzo
      • Creating a second stake pool before moving to the Babbage era
      • Redelegating genesis keys
      • Vasil hard fork
      • Creating a local cluster with the mkfiles script
    • Module 9. Simple scripts and Plutus scripts
    • Module 10. New tracing system
    • Module 11. Running the SMASH server
    • Module 12. Running the token metadata server
  • Curated playlist
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. Handbook
  2. Module 8. Setting up a local cluster

Creating a local cluster with the mkfiles script

PreviousVasil hard forkNextModule 9. Simple scripts and Plutus scripts

Last updated 1 year ago

Was this helpful?

Now that you know how the internals of a local cluster work, you can benefit from some automation. We have a script that can help you start a cluster that forks into Babbage era at epoch 0. It is located here:

Make sure to use cardano-node 8.0.0

cardano-node --version
cardano-node 8.0.0 - linux-x86_64 - ghc-8.10
git rev 69a117b7be3db0f4ce6d9fc5cd4c16a2a409dcb8

To create a local-cluster using mkfiles.sh, please clone cardano-node repo and checkout tagged version 8.0.0

git colne https://github.com/input-output-hk/cardano-node.git
git checkout tags/8.0.0

mkfiles.sh script is currently set to start the cluster on Conway era, but Conway development is still in progress and most of the functionalities of cardano-node will not work just yet.

# echo "TestConwayHardForkAtEpoch: 0" >> "${ROOT}/configuration.yaml" 

Save your changes,

It is recommended to have 3 additional terminals ready, one for each node. When you are ready, run the mkfiles.sh script.

./scripts/babbage/mkfiles.sh
generated genesis with: 3 genesis keys, 3 non-delegating UTxO keys, 3 stake pools, 3 delegating UTxO keys, 3 delegation map entries,
example/node-spo1.sh
example/node-spo2.sh
example/node-spo3.sh
CARDANO_NODE_SOCKET_PATH=example/node-spo1/node.sock

Then, run a node on each terminal. For example:

Terminal 1

example/node-spo1.sh

Terminal 2

example/node-spo2.sh

Terminal 3

example/node-spo3.sh

Note that you have 30 seconds to start the 3 nodes. To give yourself more tim, you can change this line on the mkfiles.sh script:

START_TIME="$(${DATE} -d "now + 30 seconds" +%s)"

After starting your nodes, make sure to set the CARDANO_NODE_SOCKET_PATH on your working terminal:

CARDANO_NODE_SOCKET_PATH=example/node-spo1/node.sock

and voilà! We have a cluster running on Babbage era with very little effort:

cardano-cli query tip --testnet-magic 42
{
    "block": 3519,
    "epoch": 70,
    "era": "Babbage",
    "hash": "dd38083ef4392502218e71c6364bcfefdef1f9e6563f27fa1db2196e1c65b786",
    "slot": 35361,
    "slotInEpoch": 361,
    "slotsToEpochEnd": 139,
    "syncProgress": "100.00"
}

We need to edit the file file to ensure that our cluster starts in Babbage era. All we have to do is comment (#) this line on the script:

scripts/babbage/mkfiles.sh
Logocardano-node/mkfiles.sh at master · input-output-hk/cardano-nodeGitHub