Hydra Provider (beta)
Layer 2 scaling solution for Cardano that increases transaction throughput and ensures cost efficiency while maintaining security.
The Hydra Head protocol is a layer 2 scaling solution for Cardano rooted in peer-reviewed research that increases transaction throughput and ensures cost efficiency while maintaining rigorous security.
Get started:
Connect Hydra Head
Connects to the Hydra Head. This command is a no-op when a Head is already open.
Connect a new Head.
Initializes a new Hydra Head
Initializes a new Head. This command is a no-op when a Head is already open and the server will output an CommandFailed
message should this happen.
Initializes a new Head.
Commit to Hydra Head
Commit a particular UTxO to the head. This will make the UTxO available on the layer 2.
Commit a utxo to the hydra head
Aborts a head
Aborts a head before it is opened. This can only be done before all participants have committed. Once opened, the head can't be aborted anymore but it can be closed using: `Close`.
Aborts a head before it is opened.
New Transaction
Submit a transaction through the head. Note that the transaction is only broadcast if well-formed and valid.
You can also the await provider.submitTx(signedTx)
method to submit a signed transaction.
The newTx
method accepts the following arguments:
Here is an example of how to create a transaction using the Hydra provider, Mesh wallet and Mesh transaction builder:
Decommit
Request to decommit a UTxO from a Head by providing a decommit tx. Upon reaching consensus, this will eventually result in corresponding transaction outputs becoming available on the layer 1.
The decommit
method accepts the following arguments:
Close Hydra Head
Terminate a head with the latest known snapshot. This effectively moves the head from the Open state to the Close state where the contestation phase begin. As a result of closing a head, no more transactions can be submitted via NewTx.
Terminate a head with the latest known snapshot.
Contest
Challenge the latest snapshot announced as a result of a head closure from another participant. Note that this necessarily contest with the latest snapshot known of your local Hydra node. Participants can only contest once.
Challenge the latest snapshot announced.
Fanout
Finalize a head after the contestation period passed. This will distribute the final (as closed and maybe contested) head state back on the layer 1.
Finalize a head after the contestation period passed.
Listens for new messages from Hydra node
Listens for new messages from Hydra node. The callback function will be called with the message as the only argument. Check all events emitted by the Hydra node.
The callback function is typed, so you can access the message properties directly.
Fetch Address UTxOs
Fetch UTxOs controlled by an address.
Optionally, you can filter UTXOs containing a particular asset by providing asset
, where it is the concatenation of policy ID and asset.
Fetch UTxOs from address
Fetch UTxOs from address with asset
Fetch Protocol Parameters
Fetch the latest protocol parameters.
Optionally, you can provide an epoch number to fetch the protocol parameters of that epoch.
Fetch protocol parameters of the blockchain by epoch
Fetch UTxOs
Get UTxOs for a given hash.
Optionally, you can specify the index of the index output.
Fetch UTxOs given hash
Submit Transaction
Submit a serialized transaction to the network.