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 .
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.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 +x
for both the scripts (install.sh and compile.sh) please../scripts/install.sh
./scripts/compile.sh
to compile your ts logic into wasm via asc (assembly script)cargo run
to run your compiled wasm into RiscV environment via wasmi.i32, i64, u32 and u64
.