Skip to content

SubzeroLabs/rialo-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

151 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rialo Examples

Runnable example programs for the Rialo blockchain, built with the Venus PDK.

These examples are pinned to rialo v0.4.2 and target the public DevNet at https://devnet.rialo.com. If you're new here, start with the 10-minute tutorial.

Examples

Path What it demonstrates
venus/event-example/ Emitting on-chain events from a Venus program
venus/event-example/observer/ Subscribing to another program's events
venus/compliant-stablecoin/ A stablecoin with REX-gated denylist checks before every transfer
venus/predict/ A constant-product binary prediction market with REX-driven settlement

Each example has its own README with build, deploy, and invocation steps. The shortest end-to-end walkthrough is TUTORIAL.md.

Prerequisites

  1. rialoman — the Rialo toolchain manager. Install per the installation guide.
  2. The rialo CLI, installed by rialoman.
  3. A keypair, created locally:
    rialo keytool generate default
  4. A funded DevNet account:
    rialo --config-overrides cdk.network=devnet client airdrop
    rialo --config-overrides cdk.network=devnet client balance

The rialo Quick Start guide covers these in more detail.

Network configuration

The examples target DevNet by default. To point a single invocation at a different network:

rialo --config-overrides cdk.network=devnet client get-block-height

To make DevNet the default for the rest of your session, create a .rialoconfig.toml at the repo root:

[cli]
current_account = "default"

[cdk]
network = "devnet"

Build and deploy any example

From any example directory:

# Build the PolkaVM artifact
rialo-build

# Output lands under artifacts/<package-name>-riscv/<package_name_underscored>.polkavm
# Deploy it:
rialo client program deploy artifacts/<package-name>-riscv/<package_name_underscored>.polkavm

The deploy command prints the deployed program ID — save it; subsequent invocations need it.

Invocation is example-specific. Some examples (like event-example) have a dedicated rialo client subcommand baked into the CLI. Others (the more involved ones) are driven either by rialo-contract-e2e against their e2e-test.yaml, or by a custom client built with the Rust or TypeScript CDK. See each example's README for the specific commands.

Running automated tests

Each example ships an e2e-test.yaml describing a build → deploy → exercise → assert sequence. To run an example against a managed local network (auto-started and torn down):

cd venus/<example>/
rialo-contract-e2e --source . --managed-network

rialo-contract-e2e is part of the Rialo toolchain; if it's not on your PATH, install it from the rialo repo.

Repository layout

.
├── Cargo.toml                  # Workspace manifest — pins all rialo-* deps to ^0.4.2
├── venus/
│   ├── event-example/          # Event emitter program
│   │   ├── src/                # Venus program + native fallback
│   │   ├── e2e-test.yaml       # End-to-end test sequence
│   │   └── observer/           # Subscribes to events emitted by the parent
│   ├── compliant-stablecoin/   # Stablecoin with REX-gated compliance
│   └── predict/                # Binary prediction market with REX settlement
│       └── tests/              # Native-mode unit/integration tests
└── TUTORIAL.md                 # 10-minute end-to-end walkthrough

Versioning

This repo pins every rialo-* dependency to ^0.4.2. To use a different release line, change the pins in Cargo.toml (search for 0.4.2).

The examples are kept in sync with the published rialo crates on crates.io. If a release breaks compatibility, the examples here are updated to match.

Issues and contributions

  • For bugs in the examples themselves, open an issue on this repository.
  • For bugs in the underlying Rialo SDK or protocol, open an issue on SubzeroLabs/rialo.

License

Apache-2.0.

About

Rialo Examples

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages