hydra
hydra copied to clipboard
The hydra node can publish hydra scripts via blockfrost using `--blockfrost`
Why
As Hydra moves towards using Blockfrost as a chain layer, we need to extend the functionality to publish Hydra scripts via the Blockfrost API. This follows up on #1305 and builds upon our initial exploration on #1631.
What
Introduce the capability to publish Hydra scripts using Blockfrost as follows:
mkdir -p blockfrost-demo/
curl localhost:4001/protocol-parameters > blockfrost-demo/protocol-parameters.json
function publishScripts() {
nix run .#hydra-node -- publish-scripts \
--blockfrost 0.0.0.0:4001 \
--project-path "file_path_project_token_hash" \
--cardano-signing-key blockfrost-demo/wallet.sk
}
export HYDRA_SCRIPTS_TX_ID_ON_BLOCKFROST="$(publishScripts)"
How
Taking the inception spike as inspiration, we need to:
- [ ] Refactor
PublishOptionsto support Blockfrost options:newtype PublishOptions = PublishOptions { publishChainConfig :: ChainConfig } deriving stock (Show, Eq) data ChainConfig = Offline OfflineChainConfig | Direct DirectChainConfig | Blockfrost BlockfrostChainConfig deriving stock (Eq, Show, Generic)
The path to the Blockfrost project token hash will be passed as part of these new options.
-
[ ] Add
Hydra/Chain/Blockfrost/Client.hsto handle transaction building using the Blockfrost API. -
[ ] Add
Hydra/Chain/Blockfrost/ScriptRegistry.hsto manage Hydra script publishing via Blockfrost. -
[ ] Extend
hydra-node/Main.hsto support publishing scripts using the modules above.