-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spike: Hydra Head in Head #1590
Comments
Notes from exploration today:
|
Worked on the End-to-end test today and achieved it in #1603. Notes from exploration:
|
Next steps:
|
Bigger chunks that need solving / would help a proper implementation of this significantly:
|
Wrote a how-to open a head in a head interactively using this branch. While it's in the How-to: Open a head in a headStart the L1 devnet and an L2 head: nix run .#hydra-cluster -- --devnet --publish-hydra-scripts --state-directory inception-demo Explain briefly the UTxO on the L1 (and keep open): watch -n1 cardano-cli query utxo --whole-utxo --socket-path inception-demo/node.socket --testnet-magic 42 Show L2 utxo state and demonstrate 1-2 transactions: nix run .#hydra-tui -- -c 0.0.0.0:4001 -k inception-demo/wallet.sk Publish hydra scripts on L2: mkdir -p inception-demo/l3
curl localhost:4001/protocol-parameters > inception-demo/l3/protocol-parameters.json
function publishScripts() {
nix run .#hydra-node -- publish-scripts \
--inception 0.0.0.0:4001 \
--cardano-signing-key inception-demo/wallet.sk
}
export HYDRA_SCRIPTS_TX_ID_ON_L2="$(publishScripts)" Prepare another key to separate fuel from funds: mkdir -p inception-demo/l3
cardano-cli address key-gen --normal-key \
--verification-key-file inception-demo/l3/wallet.vk \
--signing-key-file inception-demo/l3/wallet.sk
echo "Send some funds to commit to L3 to:"
cardano-cli address build --testnet-magic 42 --payment-verification-key-file inception-demo/l3/wallet.vk Use the TUI on the L2 to separate fuel from funds using the interactive Start a hydra-node on L2: nix run .#hydra-node -- \
--node-id "l3" \
--api-port 4003 \
--port 5003 \
--inception 0.0.0.0:4001 \
--hydra-scripts-tx-id ${HYDRA_SCRIPTS_TX_ID_ON_L2} \
--persistence-dir inception-demo/l3 \
--cardano-signing-key inception-demo/wallet.sk \
--hydra-signing-key demo/bob.sk \
--ledger-protocol-parameters inception-demo/l3/protocol-parameters.json Open the head on L2 with the tui: nix run .#hydra-tui -- -c 0.0.0.0:4003 -k inception-demo/wallet.sk Then, inside this TUI you must initialize the head by pressing Commit via terminal (tui only supports direct node) export WALLET_L3_ADDR=$(cardano-cli address build --testnet-magic 42 --payment-verification-key-file inception-demo/l3/wallet.vk)
cd inception-demo
curl 0.0.0.0:4001/snapshot/utxo \
| jq "with_entries(select(.value.address == \"${WALLET_L3_ADDR}\"))" \
> l2-commit-utxo.json
curl -X POST 0.0.0.0:4003/commit \
--data @l2-commit-utxo.json \
> commit-tx.json
cardano-cli transaction sign \
--tx-file commit-tx.json \
--signing-key-file l3/wallet.sk \
--out-file commit-tx-signed.json
cat commit-tx-signed.json | jq -c '{tag: "NewTx", transaction: .}' | websocat "ws://0.0.0.0:4001?history=no" |
Recorded a demo for this: https://www.youtube.com/watch?v=Y_Pw3MVooxg |
Was successfully reviewed by @noonio and this concludes this spike. |
Why
When a Hydra head is opened a part of the underlying ledger state gets locked up and made available off-chain to a small group of participants. While this is already quite a "small world" to process transactions, we encountered use cases where it would make sense to even open further heads with different/even smaller groups of participants on parts of the L2 state into L3 heads.
While the Interhead Hydra protocol eventually would allow to create L3 heads across multiple L2 heads, this spike is deliberately only exploring opening a head in-side an existing head.
What
How
Hydra.Chain.Hydra
chain backend that can be used as an alternative to the cardano-node and Blockfrost chain layer #1305SnapshotConfirmed
as blocks and submit transactions usingNewTx
commands--inception <hydra-node-api-host>
--start-chain-from
givenThe text was updated successfully, but these errors were encountered: