Skip to content

mlabs-haskell/congested-testnet

Repository files navigation

congested-testnet

The goal of this project is to operate a cardano testnet under constant congestion. Therefore, an additional component, a spammer, is included. This component continuously generates transactions to simulate periods of congestion commonly observed on the mainnet.

how to use

faucet

To obtain tADA, we need to submit a public key through an HTTP query. This will provide us with 1000 ADA

# we can generate key pairs with cardano-cli

cardano-cli address key-gen \
    --verification-key-file "key.vkey" \
    --signing-key-file "key.skey" 


# to get tADA we need to provide public key hash
PUBKEYHASHHEX=$(cardano-cli address key-hash --payment-verification-key-file "key.vkey")


# now get ada with query
curl -X POST "congested-testnet.staging.mlabs.city:8000" -H "Content-Type: application/json" -d "{\"pubKeyHashHex\": \"$PUBKEYHASHHEX\"}"

this part can be executed using nix flakes inside current repo nix run .#get-tada

submit transactions

To submit a transaction on the testnet, we can use ogmios and kupo. An example using the purescript CTL can be found here. Additionally, there are ogmios clients and tx examples available in other languages. Whichever client you choose to use, simply use next addresses congested-testnet.staging.mlabs.city:1337 and congested-testnet.staging.mlabs.city:1442

verify transaction

We can verify that the transaction is on the ledger with kupo.

curl http://congested-testnet.staging.mlabs.city:1442/matches/*@<transactionHash>

tests

We can run bats tests using nix run .#tests. Additionally, we can monitor Cardano testnet statistics with prometheus-db. We can find in Prometheus await_time_tx metrics which measure verify transaction time for simple transaction.

deployment

Run

nixos-rebuild test --flake .#congested-testnet --target-host [email protected]