Skip to content

Latest commit

 

History

History
85 lines (65 loc) · 2.52 KB

README.md

File metadata and controls

85 lines (65 loc) · 2.52 KB

Template for a Hyle-Risc0 smart contract

This basic implementation is based on "counter" contract, that increment / decrement a value.

Prerequisites

Clone the hyle repo, checkout the version you need, and run:

export RISC0_DEV_MODE=1
cargo run -- --pg

Quickstart

Build and register the contract

To build and register the smart contract on the local node, run:

cargo run -- register-contract

The expected output on the node is 📝 Registering contract counter.

Executing the Project Locally in Development Mode

During development, faster iteration upon code changes can be achieved by leveraging dev-mode, we strongly suggest activating it during your early development phase.

RISC0_DEV_MODE=1 cargo run

Execute the contract & send a tx on-chain

RISC0_DEV_MODE=1 cargo run -- increment

Directory Structure

It is possible to organize the files for these components in various ways. However, in this starter template we use a standard directory structure for zkVM applications, which we think is a good starting point for your applications.

project_name
├── Cargo.toml
├── contract 
│   ├── Cargo.toml
│   └── src
│       └── lib.rs         <-- [Contract code goes here, common to host & guest]
├── host
│   ├── Cargo.toml
│   └── src
│       └── main.rs        <-- [Host code goes here]
└── methods
    ├── Cargo.toml
    ├── build.rs
    ├── guest
    │   ├── Cargo.toml
    │   └── src
    │       └── main.rs    <-- [Guest code goes here]
    └── src
        └── lib.rs