Skip to content

Proof of concept for the Hydra Head protocol 👷

License

Notifications You must be signed in to change notification settings

HachiSecurity/hydra-poc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hydra Proof of Concept (POC)

A home to our colorful experiments and prototypes.

🌄 Introduction

Hydra is the layer-two scalability solution for Cardano, which aims to increase the speed of transactions (low latency, high throughput) and minimize transaction cost.

This repository contains the proof-of-concept implementation the Hydra engineering team has put together during exploration and can be considered a "developer preview". It outlines the basic architecture of a hydra-node, which runs a simplified (coordinated) Hydra Head protocol, connects to other hydra-nodes, interfaces the Cardano blockchain and provides an API to clients such as the included terminal user interface hydra-tui.

⚠️ This is still prototypical and exploratory work shared here for your interest - it is NOT ready for production (yet) ⚠️

Please also note that as we did develop this while in "move fast, break things" experimentation mode, the code quality seen around here may not always represent our best practices and you will find many code smells and dirty hacks.

Thanks for visiting and enjoy!

🌈 Features

Proof of concept:

  • Coordinated Hydra Head protocol
  • Single Head per hydra-node
  • Stubbed chain using external process
  • Network statically configured, direct TCP connections
  • WebSocket, message-based API Server
  • Terminal user interface client

Later:

  • Cardano-node integration (direct or via PAB)
  • Persisted Head state
  • Multiple Heads per hydra-node, managed via API
  • Support for external wallets (e.g. hardware wallets)
  • Optimistic Head closure and incremental de-/commit protocol extension
  • Relay-capable, mesh network

🚀 Getting started

The quickest way to get a hydra-node running is to use our docker images.

docker pull inputoutput/hydra:hydra-node-latest
docker run -rm inputoutput/hydra:hydra-node-latest --help

In the POC, a hydra-node can only participate in a single Head and thus needs a single signing key --me. Also, we use simplified keys for easier debugging.

To generate a new key:

head -c8 /dev/random > test.sk

Using this you can now start a hydra-node, our (currently) stubbed mock-chain and connect a hydra-tui (or any websocket client) to it:

docker run -d --name hydra-node --network host -v $PWD:/data inputoutput/hydra:hydra-node-latest --me data/test.sk
docker run -d --name mock-chain --network host inputoutput/hydra:mock-chain-latest
docker run --rm -it --network host inputoutput/hydra:hydra-tui-latest

Now you should see the terminal user interface connected to your node and you can initialize a Head, commit (generated) funds to it, send transactions and close the Head using the Commands/Hotkeys shown. Admittedly, as there are no other participants, this is a bit pointless. For a more interesting scenario with three nodes connected off-chain and three Head participants, check out our demo section.

❓ Contributing

The best way to contribute right now is to provide feedback. Give the demo a test drive and have a look at our documentation. Should you have any questions, ideas or issues, we would like to hear from you:

When contributing to this project and interacting with other contributors, please follow our Code of Conduct.

🔧 Development

See the Wiki

📚 Documentation

Adding onto the information found here and the wiki there is some technical documentation, which is also published online at https://input-output-hk.github.io/hydra-poc.

API Documentation is available for:

Haddock documentation is also published for each package:

About

Proof of concept for the Hydra Head protocol 👷

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Haskell 96.8%
  • Shell 1.7%
  • Other 1.5%