A few quick, copy-pasteable examples for the MultiversX CLI (mxpy).
Replace mxpy with the name of your executable (mxpy-windows.exe, mxpy-macos, mxpy-linux, or your custom name if
you renamed it).
Tip: add
--proxyand--chainto target a network
- mainnet:
--proxy https://gateway.multiversx.com --chain 1- devnet:
--proxy https://devnet-gateway.multiversx.com --chain D- testnet:
--proxy https://testnet-gateway.multiversx.com --chain T
mxpy wallet newCreates a mnemonic and prints it to your terminal. To also save files, use --format and --outfile (see next
example).
mxpy wallet new \
--format pem \
--outfile wallet.pemThis writes a PEM file you can later use with --pem.
mxpy wallet new \
--format pem \
--address-hrp vibe \
--outfile wallet-vibe.pemSets the bech32 human-readable part (HRP) to vibe for addresses generated from this wallet file.
mxpy wallet sign-message \
--pem wallet.pem \
--message "Hello world!"Signs arbitrary text with the private key in wallet.pem.
mxpy get account \
--address erd1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \
--proxy https://gateway.multiversx.comAdd --balance if you only want the balance.
mxpy get transaction \
--hash {TRANSACTION_HASH} \
--proxy https://gateway.multiversx.comWrapping/Unwrapping EGLD is done by EGLD wrappers smart contracts. The usual callable endpoint is wrapEgld (and
unwrapEgld for the reverse). Replace the address below with the wrapper contract address for your network and wallet's
shard.
mxpy tx new \
--receiver {EGLD_WRAPPER_CONTRACT_ADDRESS} \
--value 0.01 \
--data wrapEgld \
--pem wallet.pem \
--proxy https://gateway.multiversx.com \
--chain 1 \
--sendmxpy contract deploy \
--bytecode ./contract.wasm \
--pem wallet.pem \
--gas-limit 60000000 \
--proxy https://devnet-gateway.multiversx.com \
--chain D \
--sendYou can add --abi ./contract.abi.json and metadata flags like --metadata-not-upgradeable if needed. For mainnet,
switch --proxy and --chain accordingly.
- Use
--wait-resultwith--timeout <seconds>to wait for confirmations on commands that support it. - For queries & calls to contracts, prefer
mxpy contract queryandmxpy contract call.