Skip to content

Commit 43d0a86

Browse files
authored
Easily start a node from --busy exec out folder (#2099)
<!-- Describe your change here --> By creating a .env file containing HYDRA_SCRIPTS_TX_ID, similarly to how the demo works, we facilitate running a hydra-node on top after a busy exec out folder. --- ### Instructions: how to run a `hydra-node` on top of a --busy exec state 1. **Run a busy cluster (this publishes hydra scripts on dev)** ```bash cabal run hydra-cluster -- \ --busy \ --devnet \ --publish-hydra-scripts \ --state-directory baz ``` > Let it run for 10+ minutes to accumulate a realistic chain state (`baz/state-1/state` grows \~15MB+). 2. **Start a `cardano-node` with matching devnet config** ```bash cd baz && nix run github:IntersectMBO/cardano-node/10.4.1#cardano-node -- run \ --config cardano-node.json \ --topology topology.json \ --database-path db \ --socket-path node.socket \ --shelley-operational-certificate opcert.cert \ --shelley-kes-key kes.skey \ --shelley-vrf-key vrf.skey ``` 3. **Run a `hydra-node` using the generated`.env` and `state` files** ```bash source baz/.env && cabal run hydra-node -- \ --node-id 1 \ --listen 127.0.0.1:5001 \ --api-port 4001 \ --monitoring-port 6001 \ --hydra-signing-key baz/state-1/me.sk \ --hydra-scripts-tx-id $HYDRA_SCRIPTS_TX_ID \ --cardano-signing-key baz/alice.sk \ --ledger-protocol-parameters baz/state-1/protocol-parameters.json \ --testnet-magic 42 \ --node-socket baz/node.socket \ --persistence-dir baz/state-1 \ --contestation-period 100s \ --persistence-rotate-after 10000 ``` --- <!-- Consider each and tick it off one way or the other --> * [x] CHANGELOG updated or not needed * [x] Documentation updated or not needed * [x] Haddocks updated or not needed * [x] No new TODOs introduced or explained herafter
2 parents 5348f61 + 92c2530 commit 43d0a86

File tree

1 file changed

+4
-1
lines changed
  • hydra-cluster/exe/hydra-cluster

1 file changed

+4
-1
lines changed

hydra-cluster/exe/hydra-cluster/Main.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module Main where
55
import Hydra.Prelude
66

77
import CardanoNode (findRunningCardanoNode, waitForFullySynchronized, withCardanoNodeDevnet, withCardanoNodeOnKnownNetwork)
8-
import Hydra.Cardano.Api (TxId)
8+
import Hydra.Cardano.Api (TxId, serialiseToRawBytesHexText)
99
import Hydra.Chain.Backend (ChainBackend, blockfrostProjectPath)
1010
import Hydra.Chain.Blockfrost (BlockfrostBackend (..))
1111
import Hydra.Cluster.Faucet (publishHydraScriptsAs)
@@ -45,6 +45,9 @@ run options =
4545
Nothing -> do
4646
withCardanoNodeDevnet fromCardanoNode workDir $ \_ backend -> do
4747
txId <- publishOrReuseHydraScripts tracer backend
48+
let hydraScriptsTxId = intercalate "," $ toString . serialiseToRawBytesHexText <$> txId
49+
let envPath = workDir </> ".env"
50+
writeFile envPath $ "HYDRA_SCRIPTS_TX_ID=" <> hydraScriptsTxId
4851
singlePartyOpenAHead tracer workDir backend txId $ \client walletSk _headId -> do
4952
case scenario of
5053
Idle -> forever $ pure ()

0 commit comments

Comments
 (0)