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 ensurepath
brew install pipx
pipx ensurepath
Confirm installation:
pipx --version
The MultiversX CLI (mxpy
) is a versatile tool for interacting with the blockchain and managing smart contracts.
Install mxpy
:
pipx install multiversx-sdk-cli --force
Rust is essential for compiling smart contracts.
sudo apt install build-essential pkg-config libssl-dev
xcode-select --install
Install Rust using mxpy
:
mxpy deps install rust --overwrite
Verify installation:
mxpy --version
rustup show
To create an empty smart contract project:
sc-meta new --template empty --name crypto-zombies
Verify the project setup:
cargo check
Compile the smart contract source code into WebAssembly (WASM) bytecode:
sc-meta all build
This 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" \
--send
Replace <your-wallet-keyfile>.json
with your wallet file name. The command will ask for your password twice.