To create a basic smart contract in Rust, you can use the ink!
framework which is specifically designed for building smart contracts on the Substrate blockchain. Here's a step-by-step guide on creating a simple smart contract using ink!
.
cargo new <project-name>
Cargo.toml
:165 chars6 lines
src
directory called lib.rs
lib.rs
:main.rs404 chars17 lines
mod my_contract
declaration:main.rs280 chars17 lines
cargo contract build
cargo contract test
cargo contract deploy -p my_contract --network dev --account $ACCOUNT_ID
, replacing $ACCOUNT_ID
with your account ID on the Substrate blockchain.This is just a basic example, but ink!
provides a lot of additional features for building more complex smart contracts. Check out the ink!
documentation for more information.
gistlibby LogSnag