Skip to content

Conversation

@michalrus
Copy link
Member

@michalrus michalrus commented Dec 18, 2025

Resolves #277

Resolves #400

Related to:

Context

We want to set up an opt-in Layer 2 micropayments channel between the Platform and the Gateway.

Every few requests (configurable) a micro-transaction is sent over that channel. After N such microtransactions, the state is flushed to Layer 1.

How to use

Use this branch of the Gateway.

In the Gateway config, set the following new keys:

[hydra]
max_concurrent_hydra_nodes = 2
cardano_signing_key = "/some/path/to/gateway-transaction-fee-funds.sk"
node_socket_path = "/run/node.sock"
commit_ada = 3.0
lovelace_per_request = 100_000
requests_per_microtransaction = 10
microtransactions_per_fanout = 2

Run the Gateway, potentially with a new feature, dev_mock_db, to skip the whole Icebreaker registration in Postgres:

cargo run --features dev_mock_db -- --config ./config/development.toml

Now, go back to the Platform repository.

Export BLOCKFROST_GATEWAY_URL=http://127.0.0.1:3001 (or analogously).

Run the platform with a new CLI option:

--hydra-cardano-signing-key /some/path/to/platform-transaction-fee-funds.sk

Note that the Layer 2 ceremony will also eat funds from this second Platform-side signing key for the large Hydra transaction fees (~13 ADA per L2 session in total).

Now make requests to the Platform through the Gateway – otherwise they won’t be counted by the Gateway.

Observe in logs the sending of transactions, Fanout to L1, and re-opening of the Hydra Head.

Verify with cardano-cli query utxo --address $reward_address that the funds are really moved on L1 to the set reward address.

@michalrus michalrus self-assigned this Dec 18, 2025
@michalrus michalrus added the enhancement New feature or request label Dec 18, 2025
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 18, 2025

Deploying blockfrost-platform with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4330e59
Status: ✅  Deploy successful!
Preview URL: https://71bbc4e7.blockfrost-platform.pages.dev
Branch Preview URL: https://feat-hydra-payments.blockfrost-platform.pages.dev

View logs

@michalrus michalrus linked an issue Dec 19, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make hydra-node work from behind NAT, over our WebSocket Hopper: Hydra payment channels between platform and gateway

4 participants