CosmWasm + zkVM RISC-V EFI template

Overview

cosmwasm-risc0-example

CosmWasm + RISC-V zkVM gm example

Overview

This example exists to explore the patterns of use of CosmWasm and risc0 to build smart contracts that allow the possibility to carry out general purpose computation privatel.

zkVM

A zero-knowledge virtual machine (zkVM) is a virtual machine that runs trusted code and generates proofs that authenticate the zkVM output. RISC Zero's zkVM implementation, based on the RISC-V architecture, executes code and produces a computational receipt.

The codebase was adapted from risc0-rust-starter repository and is intended to be a minimal starting point for CosmWasm development. In this instance, we perform multiplication to prove that we know the factors of 1337.

What's next?

tic-tac-toe!

You might also like...
A simple example demonstrating cross-contract calls in CosmWasm smart contracts

Cross-contract calls This tutorial demonstrates cross-contract calls with CosmWasm v1. Overview An end user calls the reservation contract to register

CosmWasm multi-contract testing framework

Multi Test: Test helpers for multi-contract interactions Warning: Alpha Software Designed for internal use only. This is used for testing cw-plus cont

A Multi-chain Decentralized Exchange (DEX) built on CosmWasm for the WYND DAO.

WynDex A Multi-chain Decentralized Exchange (DEX) built on CosmWasm for the WYND DAO. Overview License The initial pool types were copied from astropo

A blazingly fast compiling & optimization tool for CosmWasm smart contracts.
A blazingly fast compiling & optimization tool for CosmWasm smart contracts.

cw-optimizoor A blazingly fast alternative to CosmWasm/rust-optimizer for compiling & optimizing CW smart contracts. It's primarily meant to speed up

An example CosmWasm contract for connecting contracts over IBC.

CosmWasm IBC Example This is a simple IBC enabled CosmWasm smart contract. It expects to be deployed on two chains and, when prompted, will send messa

CKB's vm, based on open source RISC-V ISA

Nervos CKB VM About CKB VM CKB VM is a pure software implementation of the RISC-V instruction set used as scripting VM in CKB. Right now it implements

Generate Nice Solana Address By Template

Yes, I know about GPU generators. https://smith-mcf.medium.com/solana-vanity-address-using-gpus-5a68ad94d1d4 ./solana-nice-address --help solana-nice-

Substrate Node Template Generator

Substrate Node Template Generator A tool to generate stand-alone node templates of a customized Substrate clients used in "Substrate Library Extension

Simple template for building smart contract(Rust) and RPC Client(web3.js) on Solana (WIP) ⛏👷🚧⚠️
Simple template for building smart contract(Rust) and RPC Client(web3.js) on Solana (WIP) ⛏👷🚧⚠️

Solana BPF Boilerplate Simple template for building smart contract(Rust) and RPC Client(web3.js) on Solana This boilerplate provides the following. Si

Comments
  • Implementing a zkCosmWasm game and necessary private state transition patterns 🎡

    Implementing a zkCosmWasm game and necessary private state transition patterns 🎡

    rps BOUNTY: 1337.42069 $JUNO

    Acceptance 🔍

    (PLEASE READ: all of the below items are mandatory for bounty payout)

    • bounty claims need to be submitted as non-Draft fully runnable Pull Requests against main in this repository
    • feature complete UI for 🪨📄✂️ integrating Keplr wallet and all the necessary contract interactions as QueryMsg, ExecuteMsg etc.
    • zkCosmWasm game backend implementation feature complete and diagram of its operation clearly documented
    • a pattern for Keplr / DID encrypted private state accesses by each user from zkVM code using a well-studied scheme
    • game to be accessed via a set of HTTP requests and barebones UI hosted on the same machine as zkVM / CosmWasm backend code
    • game needs to be played by p > 2 players w/ different wallets
    • tests to show several games can be happening at the same time in arbitrary order
      • unit tests
      • multitest contract simulation tests
      • (GODMODE) wallet simulation tests
    • if PR is approved and merged, the developer needs to start the process of merging the zkCosmWasm example back into the risc0/ organization.

    Congrats, when your code is merged to main here, please open the PR to risc0/ will be sufficient as the last step that allows you to post your claim as a comment here, together with a Junø address, and any comments about the dev experience that you care to share for posterity.

    Why 🤔

    We now have the zkCosmWasm smart contract execution pathway using the 1337 multiplication example, and the overall pattern for client interactions is now established (adapted from the NEAR battleship example): Client (Keplr / DID) 🔜 Verifier (CosmWasm) 🔛 Prover (zkVM ELF) ...it is now time to build something even more fun to further develop / discover the zkCW pattens: an imperfect information zero-sum game that ze Germans call Schnick-Schnack-Schnuck 🐊

    What 🌀

    • single-command spinup of the game and HTTP server hosting game UI, zkVM, and barebones cosmwasm runtime
    • feature-complete game wallet-connected UI that users can reach over HTTP (e.g. over the same LAN / VPC)
    • application of the ability to pass structs in and out of the zkVM code using env
    • a pattern to encrypt, persist, and associate given state to a specific cryptographically-enabled identity (Keplr wallet, for simplicity)
    • unit and multitest tests implementing the simplest pass of How

    How 👩🏻‍💻

    Note: ৹POINTS here for simplicity represent u128 / Uint128 recorded in a private matter in any convenient manner; in the future, these can become native or cw20 tokens in a simple wasmd game chain.

    Gameplay 🃏

    (to be enabled using various ExecuteMsg types, as well as QueryMsg that help the players know if they are gmi or ngmi) The RPS game consists of the following loop:

    • new players each start with 1230 ৹POINTS that they can use to form up games
    • each player seeking to enter the game puts down at least 123 ৹POINTS
    • players join a new GAME_ID and indicate readiness to start round
    • GAME_ID drafting begins when n > 1 players have indicated they are ready via ExecuteMessage
    • players select their played gesture out of the initial set of {R, P, S}
    • when all players have selected their gestures are revealed
    • those who have not submitted gestures within any subsequent GAME_ID game completing, automatically forefeit a given round
    • rounds go on until there is one person left standing, or the stalemate - same gesture - lasts for more than 3 rounds
    • several games each with a unique GAME_ID should be able to interact with CosmWasm simultaneously

    WinRAR 📚

    If there is a winning player ("last one standing"), 42 ৹POINTS from the amount of total ৹POINTS put down by the players is sent to the pre-designated 'croupier wallet' (foreshadowing DAO treasury / bank module).

    If the game ends in stalemate, all the ৹POINTS are sent to the second player to submit a gesture choice for this GAME_ID (their identity not known to the other players, but determined in a verifiably correct manner).

    (optional) Theory 🕹

    https://archive.org/details/isbn_9780465009381 https://www.sciencedirect.com/science/article/abs/pii/S0378437119314499?via%3Dihub https://iopscience.iop.org/article/10.1209/0295-5075/134/48001 https://www.nature.com/articles/380240a0

    opened by bmorphism 1
Owner
barton
applied categorical cyberneticist building tools for scaling agency 🤖☸️
barton
A "Type 0" zkEVM. Prove validity of Ethereum blocks using RISC Zero's zkVM

zeth NEW: Zeth now supports Optimism blocks! Just pass in --network=optimism! Zeth is an open-source ZK block prover for Ethereum built on the RISC Ze

RISC Zero 222 Oct 26, 2023
CosmWasm-Examples is a collection of example contracts and applications built using the CosmWasm framework

CosmWasm-Examples is a collection of example contracts and applications built using the CosmWasm framework. CosmWasm is a secure and efficient smart contract platform designed specifically for the Cosmos ecosystem.

Vitalii Tsyhulov 20 Jun 9, 2023
CosmWasm/Sylvia counting contract w/ IBC enabled (Cosmos, Rust, CosmWasm, Sylvia)

CosmWasm/Sylvia counting contract w/ IBC enabled (Cosmos, Rust, CosmWasm, Sylvia) This repository contains counting contract created during the study

Alex Cryp 3 Nov 13, 2023
RISC Zero is a zero-knowledge verifiable general computing platform based on zk-STARKs and the RISC-V microarchitecture.

RISC Zero WARNING: This software is still experimental, we do not recommend it for production use (see Security section). RISC Zero is a zero-knowledg

RISC Zero 653 Jan 3, 2023
Template for multi-contract CosmWasm projects

CosmWasm Template Template for multi-contract CosmWasm projects How to Use Install cargo-make: cargo install --force cargo-make Run formatter: cargo m

null 11 Jan 28, 2023
Examples and helpers to build NFT contracts on CosmWasm

CosmWasm NFTS This repo is the official repository to work on all NFT standard and examples in the CosmWasm ecosystem. cw721 and cw721-base were moved

CosmWasm 147 Jan 4, 2023
My code for the terra.academy course on CosmWasm smart contracts

CosmWasm Starter Pack This is a template to build smart contracts in Rust to run inside a Cosmos SDK module on all chains that enable it. To understan

Alex Incerti 0 Nov 7, 2021
A CosmWasm Tutorial by Terra Academy.

CosmWasm Starter Pack This is a template to build smart contracts in Rust to run inside a Cosmos SDK module on all chains that enable it. To understan

Tantatorn Suksangwarn 1 Dec 24, 2021
Beaker helps simplify CosmWasm development workflow.

Beaker Beaker makes it easy to scaffold a new cosmwasm app, with all of the dependencies for osmosis hooked up, interactive console, and a sample fron

null 62 Dec 29, 2022
A gRPC-based scripting library for interacting with CosmWasm smart-contracts.

Cosmos Rust Script Smart contract scripting library to ease CosmWasm smart contract development and deployment. cosm-script is inspired by terra-rust-

null 11 Nov 3, 2022