Learn to build smart contracts on the MultiversX blockchain through the Crypto Zombies course. This guide accompanies the MultiversX YouTube tutorials: Part 1 and Part 2.
MultiversX offers a robust blockchain platform with unparalleled performance and developer-friendly tools. Here's why you should consider it:
- Throughput: 15,000 transactions per second (TPS) with $0.001 transaction cost.
- Scalability: Adaptive State Sharding allows scaling beyond 100,000 TPS as the network grows.
- Efficiency: Achieved 263,000 TPS on testnet.
- IDE and Framework: MultiversX IDE, Rust-based framework, and debugging tools.
- Royalties: Developers earn 30% of the gas paid for smart contract execution.
- WebAssembly (WASM) VM: Support for smart contracts written in any language that compiles to WASM.
- Low-level, multi-paradigm language optimized for performance and safety.
- Enables high-efficiency, low-gas smart contracts.
pipx is the recommended way to install the MultiversX CLI (mxpy).
sudo apt update
sudo apt install pipx
pipx ensurepathbrew install pipx
pipx ensurepathConfirm installation:
pipx --versionThe MultiversX CLI (mxpy) is a versatile tool for interacting with the blockchain and managing smart contracts.
Install mxpy:
pipx install multiversx-sdk-cli --forceRust is essential for compiling smart contracts.
sudo apt install build-essential pkg-config libssl-devxcode-select --installInstall Rust using mxpy:
mxpy deps install rust --overwriteVerify installation:
mxpy --version
rustup showTo create an empty smart contract project:
sc-meta new --template empty --name crypto-zombiesVerify the project setup:
cargo checkCompile the smart contract source code into WebAssembly (WASM) bytecode:
sc-meta all buildThis generates an output directory containing:
output/
├── crypto-zombies.abi.json
├── crypto-zombies.imports.json
├── crypto-zombies.mxsc.json
└── crypto-zombies.wasm
crypto-zombies.wasm: The WASM bytecode to deploy to the blockchain.crypto-zombies.abi.json: The Application Binary Interface (ABI) defines how to interact with the smart contract.
To deploy the compiled contract:
mxpy --verbose contract deploy \
--recall-nonce \
--bytecode="./output/crypto-zombies.wasm" \
--keyfile="../<your-wallet-keyfile>.json" \
--gas-limit=100000000 \
--proxy="https://devnet-gateway.multiversx.com" \
--chain="D" \
--sendReplace <your-wallet-keyfile>.json with your wallet file name. The command will ask for your password twice.