Skip to content
/ ts-riscv-template Public template

A template to write arbitrary ts code and generate it's proof (ts -> wasm -> RISCV)

Notifications You must be signed in to change notification settings

RizeLabs/ts-riscv-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📄 TS-RISCV-Template

This template allows anyone to write their arbitrary code logic in typescript and get it's execution proof via Risc0.

🏗️ How does it works

This template is configured with assemblyscript and Risc0 starter template. You can write your code logic in typescript. For generating proof of computation you typescript code get compiled into wasm via assemblyscript and the wasm file run inside Risc0 with your custom inputs using wasmi which is a webassembly interpreter .

🧑‍💻 Steps to use it

  1. Write your custom ts scripts in package/run.ts file and make sure to use rust compatible types (for example instead of using number as a type you can use i32, i64 etc) and ignore the type error meanwhile.
  2. Define your I/O types in config.json
{
    "argument_types": [ // input argument types of your ts function
        "i64" 
    ],
    "return_types": [ // output argument types of your ts function
        "i64"
    ],
    "inputs":[ // input for your ts function
        "10"
    ]
}
  1. chmod +x for both the scripts (install.sh and compile.sh) please.
  2. Build the project using ./scripts/install.sh
  3. Run ./scripts/compile.sh to compile your ts logic into wasm via asc (assembly script)
  4. cargo run to run your compiled wasm into RiscV environment via wasmi.

🖊️ Note

  • This template is under work and hence not production ready and currently only support arguments and return types as i32, i64, u32 and u64.

About

A template to write arbitrary ts code and generate it's proof (ts -> wasm -> RISCV)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published