Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

riscvdemo/v0 package

Overview

Package riscvdemo runs real compiled machine code on chain, a slice at a time.

It is a demo of two libraries and carries no logic of its own: p/moul/x/vm/riscv(/p/moul/x/vm/riscv/v0) is the RV32IM hart, and p/moul/x/vm/vmkit(/p/moul/x/vm/vmkit/v0) is the host ABI, the fuel meter and the instance store.

What it exists to show is that the guest was not written for gno. The programs on the front page are flat .text images: the same bytes `rustc --target riscv32im-unknown-none-elf` emits, uploaded as hex. The realm holds the snapshot between transactions, so one computation finishes across several of them, and realm code cannot do that for itself.

Function

UploadSample

func UploadSample(cur realm, name, input string, budget int64) string

UploadSample stores one of the programs the front page offers. Writing RV32IM by hand is not the point of this realm, and without this nobody without a cross compiler could press a button.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/moul/x/vm/riscvdemo/v0" -func "UploadSample" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/x/vm/riscvdemo/v0" -func "UploadSample" -args $'' -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx