This is a test V-App, with a few simple computations and functionalities to test various aspects of the Vanadium VM.
- app contains the Risc-V app, based on the V-app Sdk.
- client folder contains the client of the app, based on the V-app Client Sdk.
The client is a library crate (see lib.rs), but it also has a test executable (main.rs) to interact with the app from the command line.
In order to build the app for the Risc-V target, enter the app folder and run:
cargo build --release --target=riscv32imc-unknown-none-elfIn order to build the app for the native target, enter the app folder and run:
cargo build --releaseMake sure you built the V-App for the native target.
On a terminal in the app folder, simply run:
cargo runOn a different terminal in the client folder, run:
cargo run -- --nativeNote: you can customize the hostname and port of the app by setting the VAPP_ADDRESS environment variable.
Make sure you built the V-App for the RISC-V target.
Launch Vanadium on speculos. Then execute:
From the client folder
cargo runIf you want to run the V-app on a real device, execute instead:
cargo run -- --hidOnce the client is running, these are the available commands:
reverse <hex_buffer>- Reverses the given buffer.sha256 <hex_buffer>- Computes the sha256 hash of the given buffer.b58enc <hex_buffer>- Computes the base58 encoding of the given buffer (the output is in hex as well).addnumbers <n>- Computes the sum of the numbers between1andn.nprimes <n>- Counts the number of primes up tonusing the Sieve of Eratosthenes.panic <panic message>- Cause the V-App to panic. Everything written after 'panic' is the panic message.- An empty command will exit the V-App.