hydra icon indicating copy to clipboard operation
hydra copied to clipboard

The hydra node can publish hydra scripts via blockfrost using `--blockfrost`

Open noonio opened this issue 1 year ago • 0 comments

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 PublishOptions to 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.hs to handle transaction building using the Blockfrost API.

  • [ ] Add Hydra/Chain/Blockfrost/ScriptRegistry.hs to manage Hydra script publishing via Blockfrost.

  • [ ] Extend hydra-node/Main.hs to support publishing scripts using the modules above.

noonio avatar Sep 30 '24 08:09 noonio