DelphinusLab / zkWasm

Apache License 2.0
479 stars 95 forks source link

Doc: Need better documentation for bootstrap C and Rust projects. #40

Closed aseaday closed 1 year ago

aseaday commented 2 years ago

Description

Seeing that we now have a CLI binary, users and developers could have a easy use case on zkwasm. The current docments is a design document than a getting started or quick introduction We may give a better and clean README.md for people to be interested in our projects.

naps62 commented 1 year ago

@aseaday I was trying to look around for something like this, so I could explore the project. currently having a hard time understanding some possibly basic things:

xgaozoyoe commented 1 year ago

We now have zkWASM-C repo as a project template: https://github.com/DelphinusLab/zkWasm-C. rust to zkWASM problem is solved in #69. Will leave this thread to track the progress of documentation.

xgaozoyoe commented 1 year ago

We now have two more demo projects: Rust project demo: https://github.com/xgaozoyoe/zkWasm-Rust-Demo Assembly script demo: https://github.com/DelphinusLab/zkWasm-AssemblyScript-Demo

KuTuGu commented 1 year ago

@xgaozoyoe I'm still not sure how to read input in rust? Basically how do I call wasm_input?
This is not shown in the rust demo, could you help me?

naps62 commented 1 year ago

@KuTuGu here's an example:

extern "C" {
    fn wasm_input(x: i32) -> i64;
}

#[wasm_bindgen]
pub fn add() -> i64 {
    let x = unsafe { wasm_input(1) };
    let y = 5;

    x + y
}