Odak modu
This tutorial demonstrates how to build a basic smart contract to run on a Substrate-based chain.
In this tutorial, you'll explore using ink! as a programming language for writing Rust-based smart contracts.
Install the CLI tool
We will first update our Rust environment -
rustup target add wasm32-unknown-unknown --toolchain nightly
Now let’s go ahead and install the CLI tool -
rustup component add rust-src
cargo install --force --locked cargo-contract --version 2.0.0-rc
cargo contract --help
Create a new smart contract project
Here we are assuming that you already have a precompiled substrate node install
To generate files for an ink! Project -
Deploy contract
Now that we have compiled the contract, we just need to start the node and deploy it
substrate-contracts-node --log info,runtime::contracts=debug 2>&1
cargo contract instantiate --constructor new --args "false" --suri //Alice --salt $(date +%s)
Interact with contract
Since the smart contract has been deployed, let’s interact with it -
cargo contract call --contract $INSTANTIATED_CONTRACT_ADDRESS --message get --suri //Alice --dry-run
cargo contract call --contract $INSTANTIATED_CONTRACT_ADDRESS --message flip --suri //Alice
Yazılım Kariyerinde İlerlemeni Hızlandıracak Programlar
Patika+ programlarımız ile 4-8 aylık yoğun yazılım kamplarına katıl, temel bilgilerden başlayarak kapsamlı bilgiler edin, yazılım kariyerine başla!
Yorum yapabilmek için derse kayıt olmalısın!