This template allows anyone to write their arbitrary code logic in typescript and get it's execution proof via Risc0.
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 .
- Write your custom ts scripts in
package/run.tsfile 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. - 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"
]
}
chmod +xfor both the scripts (install.sh and compile.sh) please.- Build the project using
./scripts/install.sh - Run
./scripts/compile.shto compile your ts logic into wasm via asc (assembly script) cargo runto run your compiled wasm into RiscV environment via wasmi.
- This template is under work and hence not production ready and currently only support arguments and return types as
i32, i64, u32 and u64.