Crynux Network
HomeBlogGitHubTwitterDiscordNetstats
  • Crynux Network
  • Releases
    • Helium Network
    • Hydrogen Network
  • System Design
    • Network Architecture
    • Consensus Protocol
      • Inference Task Validation
      • Training/FT Task Validation
    • Verifiable Secret Sampling
    • Task Lifecycle
      • Task State Transitions
    • Task Dispatching
    • Task Pricing
    • Quality of Service (QoS)
    • Model Distribution
  • Node Hosting
    • Start a Node
      • Start a Node - Windows
      • Start a Node - Mac
      • Start a Node - Linux
      • Start a Node - Docker
      • Start a Node - Vast
    • Get the Test CNX Tokens
    • Private Key Security
    • Assign GPU to the Node
    • Proxy Settings
    • Docker Compose Options
    • Advanced Configuration
  • Application Development
    • How to Run LLM using Crynux Network
    • Application Workflow
    • Execute Tasks
      • Text-to-Image Task
      • Text-to-Text Task
      • Text-to-Music Task
      • Text-to-Video Task
      • Fine-Tuning Task
    • Crynux Bridge
    • API Specification of the Relay
    • Crynux SDK
  • Crynux Token
    • Wallet Configuration
      • Metamask
  • Troubleshooting
    • FAQ
    • Locate the Error Message
    • Exceptions in WebUI
  • Misc
    • Privacy Policy
Powered by GitBook
On this page
  • Inference API
  • Node Hosting
  • Consensus Protocol
  • The Blockchain In Use
  • The Relay In Use
Edit on GitHub
  1. Releases

Hydrogen Network

[Nov 8, 2023] Decentralized Stable Diffusion Task Execution Engine

PreviousHelium NetworkNextNetwork Architecture

Last updated 10 months ago

Hydrogen Network is the first testnet of the Crynux Network. Hydrogen Network implements an AI inference task execution engine that supports running the Stable Diffusion image generation tasks for the applications.

The computation power comes from a decentralized network of home computers and servers that are coordinated by a consensus protocol running on the Blockchain. The individuals who have the spared computation power could connect their devices to the network, exchanging the computation power for tokens by running the inference tasks for the applications.

Inference API

To the applications, Hydrogen Network is an inference API service that could be used to generate images using the Stable Diffusion.

The application should prepare a wallet, to pay the tokens for the inference task. But other than that, the invocation of the API is no different than the invocation of a traditional API service on AWS. The decentralized execution process is completely invisible to the applications.

If you are an application developer, get started from here:

Stable Diffusion Task Framework

A general framework to define and execute the Stable Diffusion tasks is developed to be used in the Hydrogen Network. A wide range of the common task types and configurations are supported. Just describe the task using JSON, and send it to the inference API:

  • Unified task definition for Stable Diffusion 1.5, 2.1 and Stable Diffusion XL

  • SDXL - Base + Refiner () and standalone Refiner

  • Controlnet and various preprocessing methods

  • LoRA

  • VAE

  • Textual Inversion

  • Long prompt

  • Prompt weighting using

  • Auto LoRA and Textual Inversion model downloading from non-Huggingface URL

The following document gives more information on how to write a Stable Diffusion task:

And more examples can be found in the GitHub repository:

The Image Generator

The users could select between different versions of the Stable Diffusion models, such as Stable Diffusion 1.5 and Stable Diffusion XL, and apply a LoRA model on it by specifying the download link of the LoRA model on Civitai.

Thanks to the Hydrogen Network, the application could be used on the devices that do not have a capable GPU integrated. If the browser exists, the Image Generator could be used.

Give it a try:

The Image Generator also serves as a reference implementation for the traditional centralized applications who want to integrate the inference API. The source code of the Image Generator is also hosted on GitHub:

The backend:

The Crynux Bridge is serving as the backend of the Image Generator. The bridge transparently handles the blockchain transaction processing and wallet signatures at the backend, and provides simple traditional APIs to the web UI:

The frontend:

Node Hosting

The contributor of the spared computation power could join the network by hosting a node on the local computer. The node could be easily started in just a few steps:

Consensus Protocol

The consensus protocol ensures that all the malicious behaviors could be identified and panelized in the network. Thanks to the consensus protocol, the Hydrogen Network allows everyone to join freely as the computation power contributor, without asking for permissions.

The consensus protocol works by asking the node to stake certain amount of tokens before joining the network, and if the malicious behavior is detected from the node, the staked tokens will be slashed. By a calculation based on the probability, the attacking against the network will highly likely to cause the attacker to loose money rather than earn.

The malicious behaviors are discovered by dispatching the same task to 3 nodes randomly at the same time, and compare the results returned by the nodes on the Blockchain. A similarity score is used to overcome the randomness problem in the inference computation.

The consensus protocol is described in detail in the following doc:

The Blockchain In Use

The Hydrogen Network is running on a private blockchain whose node can be accessed using the RPC endpoint:

https://block-node.crynux.ai/rpc

Our focus right now, however, is to support more features, such as the GPT tasks and training tasks. And we will launch a network on the public blockchain when the network has a rich set of features, and is ready to be used by a large number of applications. The layer 2 solution will be implemented when we are close to it.

When the test networks are running on the private blockchain, the test tokens are free to acquire from our community. The node providers are contributing their computation power for free in a belief of the open and democratized future. And their contributions are recorded by the private blockchain. We believe their efforts will be paid out eventually.

The test tokens are required for both starting a node, or calling the inference API. To get the test tokens, just join the Discord of Crynux and bind your wallet address using the bot:

The Hydrogen Network is coordinated by three smart contracts on the Blockchain:

Contract
Address

Token

0x95E7e7Ed5463Ff482f61585605a0ff278e0E1FFb

Node

0xB0E9A451Ce0CC181EA9888C7B42BB8Ad90b73C78

Task

0xba2489a25A5f542877D3825Ab802651f28878C4a

The CNX token is just an standard ERC20 token. The tokens will be operated by the other contracts to implement the required functions.

The source code of the smart contracts is hosted on the GitHub:

The Relay In Use

The relay server could be accessed at:

https://relay.h.crynux.ai

The source code of the relay is hosted at:

The Image Generator is a showcase application that provides a web interface (just like ) for the users to generate images in the browser.

The reason for a private Blockchain is that public Blockchains with strong consensus protocol, such as Ethereum, is not fast enough alone to support the throughput of the Hydrogen Network, or any other networks of Crynux in the future. The solution will be a layer 2 scaling tech such as . We will be either using a generalized solution that is well known to the industry, or developing our own for better performance(under the limit of our use cases).

The private blockchain in use in the Hydrogen Network is built using the , which contains an EVM running on top of the . The Blockchain is Ethereum compatible, most of the existing tools for the Ethereum can be used directly.

Application Workflow
ensemble of expert denoisers
Compel
Text-to-Image Task
stable-diffusion-webui
Start a Node
Consensus Protocol
ZK-Rollups
Frontier project
Substrate Blockchain
https://github.com/crynux-ai/stable-diffusion-task/tree/main/examples
Image Generator
Logo
GitHub - crynux-ai/crynux-bridge: Crynux Bridge connects traditional applications to the Crynux Network. The bridge provides simple APIs to create task and receive results. All the wallet and blockchain related stuff are transparently taken care of at the bridge.GitHub
GitHub - crynux-ai/ig-web: Stable Diffusion image generator web ui using Crynux NetworkGitHub
HappyAIGen | Crynux Network
GitHub - crynux-ai/crynux-contracts: The solidity contracts to coordinate the nodes and tasks.GitHub
GitHub - crynux-ai/crynux-relay: The relay server for the Crynux node in the Hydrogen(H) NetworkGitHub
Logo
Logo
Logo
Logo
Logo