This is an MVP (Minimum Viable Product) Blockchain project built using WebAssembly and Rust. The project includes a smart contract that manages basic blockchain transactions and a front-end interface to interact with it.
- Decentralization: The blockchain is managed by a smart contract deployed on a decentralized network.
- Security: Transactions are secure and stored immutably on the blockchain.
- Transparency: The blockchain is viewable, and all transactions are visible to the public.
mvp_blockchain/
├── app/ # Rust-based smart contract source code
├── wasm/ # WebAssembly project files
│ ├── src/ # Source files for the WebAssembly contract
│ ├── build.rs # Build script for generating IDL
│ └── Sails.idl # Interface definition for smart contract
└── Cargo.toml # Rust project dependencies and configuration
app/: Contains the Rust code for the blockchain smart contract.wasm/: Handles the WebAssembly build for the smart contract and includes the build script (build.rs).
Before you can build and run the project, ensure you have the following tools installed:
-
Rust Toolchain with WebAssembly target:
rustup target add wasm32-unknown-unknown
-
Binaryen (for WebAssembly optimization, optional):
- Ubuntu/Debian:
sudo apt install binaryen
- Ubuntu/Debian:
git clone https://github.com/lol90a/mvp_blockchain.git
cd mvp_blockchainNavigate to the wasm directory and build the WebAssembly smart contract:
cd wasm
cargo build --target wasm32-unknown-unknown --releaseThis will produce a .wasm file in the target/wasm32-unknown-unknown/release directory.
wasm/src/lib.rs: The main logic for the smart contract handling blockchain transactions.Sails.idl: Interface definition for the smart contract, describing the services and events.
- If you encounter
wasm-opterrors during the build, ensure it is installed and available in yourPATH. - If you're having issues with the IDL generation, check the enum and struct definitions in
wasm/src/lib.rsto ensure they are well-formed.
Feel free to open issues and submit pull requests if you encounter bugs or have ideas for improvements.
This project is licensed under the GPL-3.0 License
- Gear Protocol for the tools and frameworks used in this project.
- Vara-Lab Traffic Light Example for inspiration on integrating WebAssembly and Rust.