Skip to Content
Getting StartedGuidesContractsSilex by ExampleOverview

Introduction

This guide is a hands-on Silex tour inspired by the “by example” style. Each page introduces one idea, gives you a complete contract snippet, and links directly to Playground with the code preloaded.

Examples that only use pure language features can be compiled and run directly in Playground. Examples that use constructors, deposits, transfers, asset creation, scheduled executions, contract events, inter-contract calls, or RPC events need wallet/daemon RPC and an on-chain deployment on devnet.

Entries without an explicit return type use the default u64 exit code: 0 for success, or > 0 for a contract-defined error code. Examples with explicit return types demonstrate typed exit values; on-chain, those values are stored in contract logs and are limited to 256 encoded bytes.

Tour

Useful references

What to try next

  • Add pagination to the BTree leaderboard by passing start_key and page_size.
  • Extend the vault to support any deposited asset with get_deposits().
  • Combine the publisher/listener examples with scheduled executions to batch oracle updates.
  • Add signature checks to owner-only admin entries.
  • Return the commitment() and handle() points from the ciphertext example to inspect its curve data.
  • Create an asset, mint it to the contract balance, transfer it to users, then accept it as a deposit in another contract.
Last updated on