This skill helps you manage MultiversX backend operations by handling transactions, data ingestion, and API integration across Go, Python, and TypeScript.
npx playbooks add skill michavie/mx-ai-skills --skill backend
This skill governs all server-side interactions with the MultiversX blockchain, including transaction processing, data indexing, and API integration using Go, Python, or Node.js.
mx-sdk-go): High-performance, type-safe interaction. Preferred for microservices.@multiversx/sdk-core, NestJS): Ideal for API backends, serverless functions, and JS-native teams.mx-sdk-py): Scripting, data analysis, and simple automation.@multiversx/sdk-core, sdk-nestjs).@multiversx/sdk-core works in Node.js just like in the browser.@multiversx/sdk-nestjs for dependency injection of:ApiNetworkProvider / ProxyNetworkProviderCachingService (Redis)TransactionProcessor (Monitoring)NativeAuth (server-side) to verify login tokens signed by the frontend.When sending transactions from a backend service:
skills/expert/mvx_sdk_js_core/SKILL.md (Essential for Node.js)skills/expert/mvx_sdk_go_builders/SKILL.mdskills/expert/mvx_sdk_go_data/SKILL.mdskills/expert/mvx_sdk_py_transactions/SKILL.mdskills/expert/mvx_sdk_py_contracts/SKILL.mdtx := &data.Transaction{
Nonce: nonce,
Value: "1000000000000000000", // 1 EGLD
Receiver: destinationAddress,
Sender: senderAddress,
GasPrice: 1000000000,
GasLimit: 50000,
Data: []byte("memo"),
ChainID: "D", // Devnet
Version: 1,
}
err := interactor.SignTransaction(tx)
import { ApiNetworkProvider } from "@multiversx/sdk-core";
const provider = new ApiNetworkProvider("https://devnet-api.multiversx.com");
const networkConfig = await provider.getNetworkConfig();
import { NativeAuthServer } from "@multiversx/sdk-native-auth-server";
const server = new NativeAuthServer();
const result = await server.validate(accessToken);
// result.address, result.ttl, etc.
---
name: mvx_sdk_go_builders
description: Transaction construction and signing using Builders in Go SDK.
---
Using TxBuilder to construct and sign transactions.
import (
"github.com/multiversx/mx-sdk-go/builders"
"github.com/multiversx/mx-sdk-go/core"
"github.com/multiversx/mx-sdk-go/data"
)
// Initialize
txBuilder, err := builders.NewTxBuilder(core.Marshalizer)
// Manual Transaction Construction
tx := &data.Transaction{
Nonce: nonce,
Value: "1000000000000000000", // 1 EGLD
RcvAddr: receiverAddressString,
SndAddr: senderAddressString,
GasPrice: 1000000000,
GasLimit: 50000,
Data: []byte("memo"),
ChainID: "D",
Version: 1,
}
// Sign Transaction
err = txBuilder.ApplySignature(tx, privateKey)
// tx.Signature, tx.SenderUsername are updated
There are specific builders for SC interactions (often generated code or custom implementations), but the core pattern is:
data.Transaction structTxBuilderESDT transfers require specific data fields.
// Native EGLD
tx.Value = "1000000000000000000"
tx.Data = []byte("")
// ESDT Transfer
// Function: ESDTTransfer
// Args: TokenIdentifier (hex), Amount (hex)
tx.Value = "0"
tx.Data = []byte("ESDTTransfer@" + hexTokenId + "@" + hexAmount)
Constructing the inner transaction for a relayed call.
// Inner Tx (User)
innerTx := &data.Transaction{...}
// Sign Inner Tx
signature, _ := userPrivateKey.Sign(innerTxBytes)
// Relayer Tx
relayerTx := &data.Transaction{
Sender: relayerAddress,
Data: []byte("relayedTx@" + innerTxBytesHex + "@" + signatureHex),
...
}
The SDK uses a Marshalizer interface (usually JSON).
import "github.com/multiversx/mx-sdk-go/core"
bytes, err := core.Marshalizer.Marshal(tx)
Value field---
name: mvx_sdk_go_core
description: Core network operations for MultiversX Go SDK - Proxy, VM Queries.
---
This skill covers the blockchain package and network interactions.
Setup the proxy to interact with the blockchain:
import (
"github.com/multiversx/mx-sdk-go/blockchain"
"github.com/multiversx/mx-sdk-go/core/http"
)
// Configure Proxy
args := blockchain.ArgsProxy{
ProxyURL: "https://devnet-gateway.multiversx.com",
Client: http.NewHttpClientWrapper(nil, ""),
SameScState: false,
ShouldBeSynced: false,
FinalityCheck: false,
CacheExpirationTime: time.Minute,
EntityType: core.Proxy,
}
proxy, err := blockchain.NewProxy(args)
// Get Account
address := data.NewAddressFromBech32String("erd1...")
account, err := proxy.GetAccount(ctx, address)
// account.Nonce, account.Balance
// Get Network Config
config, err := proxy.GetNetworkConfig(ctx)
// Get Transaction
tx, err := proxy.GetTransaction(ctx, "txHash", true)
Reading state from a smart contract without sending a transaction.
argsQuery := blockchain.ArgsVmQueryGetter{
Proxy: proxy,
Timeout: 10 * time.Second,
}
vmQueryGetter, err := blockchain.NewVmQueryGetter(argsQuery)
// Execute Query
response, err := vmQueryGetter.ExecuteQueryReturningBytes(
contractAddress,
"getFunctionName",
[][]byte{arg1, arg2}, // Arguments as byte slices
)
// response is [][]byte
Working with sharded addresses.
// Create Coordinator
coordinator, err := blockchain.NewShardCoordinator(3, 0) // 3 shards, current 0
// Get Shard for Address
shardID := coordinator.ComputeId(address)
---
name: mvx_sdk_go_data
description: Core data structures and types for MultiversX Go SDK.
---
These types define the core objects interacting with the blockchain.
data.Transaction is the main struct for all network interactions.
type Transaction struct {
Nonce uint64 `json:"nonce"`
Value string `json:"value"`
RcvAddr string `json:"receiver"`
SndAddr string `json:"sender"`
GasPrice uint64 `json:"gasPrice,omitempty"`
GasLimit uint64 `json:"gasLimit,omitempty"`
Data []byte `json:"data,omitempty"`
Signature string `json:"signature,omitempty"`
ChainID string `json:"chainID"`
Version uint32 `json:"version"`
Options uint32 `json:"options,omitempty"`
Guardian string `json:"guardian,omitempty"`
GuardianSignature string `json:"guardianSignature,omitempty"`
Relayer string `json:"relayer,omitempty"`
RelayerSignature string `json:"relayerSignature,omitempty"`
}
type AddressWithType struct {
address []byte
hrp string // "erd" usually
}
// Methods
// NewAddressFromBech32String(bech32)
// NewAddressFromBytes(bytes)
// AddressAsBech32String()
type Account struct {
Address string `json:"address"`
Nonce uint64 `json:"nonce"`
Balance string `json:"balance"` // BigInt string
Username string `json:"username"`
CodeHash string `json:"codeHash"`
RootHash string `json:"rootHash"`
DeveloperReward string `json:"developerReward"`
}
type NetworkConfig struct {
ChainID string
MinGasLimit uint64
MinGasPrice uint64
GasPerDataByte uint64
GasPriceModifier float64
AdditionalGasForTxSize uint64
...
}
type VmValueRequest struct {
Address string `json:"scAddress"`
FuncName string `json:"funcName"`
CallValue string `json:"value"`
CallerAddr string `json:"caller"`
Args []string `json:"args"` // Hex encoded arguments
}
type VmValuesResponseData struct {
ReturnData []string `json:"returnData"` // Hex encoded return values
ReturnCode string `json:"returnCode"`
ReturnMessage string `json:"returnMessage"`
GasRemaining uint64 `json:"gasRemaining"`
GasRefund uint64 `json:"gasRefund"`
OutputAccounts map[string]*OutputAccount `json:"outputAccounts"`
}
Value as string: To prevent overflow (Go's int64 is too small for big token amounts).Data field is often hex-encoded when checking explorers, but SDK expects bytes/string.---
name: mvx_sdk_go_interactors
description: Components for interacting with the blockchain (Wallets, Transaction Interactors, Nonce Handlers) in Go.
---
Loading keys and addresses.
import "github.com/multiversx/mx-sdk-go/interactors"
wallet := interactors.NewWallet()
// Load PEM
privateKey, err := wallet.LoadPrivateKeyFromPemFile("wallet.pem")
// Load Keystore
privateKey, err := wallet.LoadPrivateKeyFromKeystoreFile("wallet.json", "password")
// Get Address
address, err := wallet.GetAddressFromPrivateKey(privateKey)
bech32Address := address.AddressAsBech32String()
Automatically fetches and increments nonces. Recommended way to manage nonces.
import "github.com/multiversx/mx-sdk-go/interactors/nonceHandlerV3"
// Initialize Handler
args := nonceHandlerV3.ArgsAddressNonceHandler{
Proxy: proxy,
Address: address,
}
handler, err := nonceHandlerV3.NewAddressNonceHandler(args)
// Fetch Initial Nonce
nonce, err := handler.GetNonce(ctx)
// Apply Nonce to Transaction & Increment
handler.ApplyNonceAndGasPrice(tx) // Sets tx.Nonce = current, then increments internal counter
High-level wrapper for sending transactions.
import "github.com/multiversx/mx-sdk-go/interactors"
// Setup
txInteractor, err := interactors.NewTransactionInteractor(proxy, txBuilder)
// Send Transaction
txHash, err := txInteractor.SendTransaction(ctx, tx, privateKey)
// Send Multiple Transactions
txHashes, err := txInteractor.SendTransactions(ctx, txs, privateKey)
// Helper to create new keypair
privateKey, publicKey := wallet.GeneratePrivateKey()
---
name: mvx_sdk_py_contracts
description: Smart contract operations for MultiversX Python SDK.
---
This skill covers ABI loading, deployments, calls, and queries.
from multiversx_sdk import Abi
from pathlib import Path
# Load from file
abi = Abi.load("contract.abi.json")
# Create controller with loaded ABI
controller = entrypoint.create_smart_contract_controller(abi=abi)
bytecode = Path("contract.wasm").read_bytes()
tx = controller.create_transaction_for_deploy(
sender=account,
nonce=account.get_nonce_then_increment(),
bytecode=bytecode,
gas_limit=60000000,
arguments=[42] # Typed automatically via ABI
)
tx_hash = entrypoint.send_transaction(tx)
parsed_outcome = controller.await_completed_deploy(tx_hash)
contract_address = parsed_outcome[0].contract_address
# Call endpoint
tx = controller.create_transaction_for_execute(
sender=account,
nonce=account.get_nonce_then_increment(),
contract=contract_address,
function="add",
arguments=[10],
gas_limit=5000000
)
# Call with token transfer (Transfer & Execute)
tx = controller.create_transaction_for_execute(
sender=account,
nonce=account.get_nonce_then_increment(),
contract=contract_address,
function="deposit",
gas_limit=10000000,
native_amount=1000000000000000000
)
Read-only calls to the contract state.
# Using controller (parsed output)
result = controller.query_contract(
contract=contract_address,
function="getSum",
arguments=[]
)
print(result[0]) # Typed output
If ABI is not available, use manual type hinting (less recommended).
from multiversx_sdk import SmartContractTransactionsFactory
factory = entrypoint.create_smart_contract_transactions_factory()
tx = factory.create_transaction_for_execute(
sender=account.address,
contract=contract_address,
function="add",
gas_limit=5000000,
arguments=[42] # Basic types inferred
)
new_bytecode = Path("contract_v2.wasm").read_bytes()
tx = controller.create_transaction_for_upgrade(
sender=account,
nonce=account.get_nonce_then_increment(),
contract=contract_address,
bytecode=new_bytecode,
gas_limit=60000000,
arguments=[]
)
---
name: mvx_sdk_py_core
description: Core SDK operations for MultiversX Python SDK - Entrypoints, Providers, and Network.
---
This skill covers the fundamental building blocks of the multiversx-sdk v2 library.
Network-specific clients that simplify common operations:
| Entrypoint | Network | Default URL |
|------------|---------|-------------|
| DevnetEntrypoint | Devnet | https://devnet-api.multiversx.com |
| TestnetEntrypoint | Testnet | https://testnet-api.multiversx.com |
| MainnetEntrypoint | Mainnet | https://api.multiversx.com |
| LocalnetEntrypoint | Local | http://localhost:7950 |
from multiversx_sdk import DevnetEntrypoint
# Default API
entrypoint = DevnetEntrypoint()
# Custom API
entrypoint = DevnetEntrypoint(url="https://custom-api.com")
# Proxy mode (gateway)
entrypoint = DevnetEntrypoint(url="https://devnet-gateway.multiversx.com", kind="proxy")
| Method | Description |
|--------|-------------|
| create_account() | Create a new account instance |
| create_network_provider() | Get underlying network provider |
| recall_account_nonce(address) | Fetch current nonce from network |
| send_transaction(tx) | Broadcast single transaction |
| send_transactions(txs) | Broadcast multiple transactions |
| get_transaction(tx_hash) | Fetch transaction by hash |
| await_completed_transaction(tx_hash) | Wait for finality |
Lower-level network access:
| Provider | Use Case |
|----------|----------|
| ApiNetworkProvider | Standard API queries (recommended) |
| ProxyNetworkProvider | Direct node interaction via gateway |
# From entrypoint
provider = entrypoint.create_network_provider()
# Manual instantiation
from multiversx_sdk import ApiNetworkProvider
api = ApiNetworkProvider("https://devnet-api.multiversx.com", client_name="my-app")
| Method | Description |
|--------|-------------|
| get_network_config() | Chain ID, gas settings |
| get_network_status() | Current epoch, nonce |
| get_block(block_hash) | Fetch block data |
| get_account(address) | Account balance, nonce |
| get_account_storage(address) | Contract storage |
| get_transaction(tx_hash) | Transaction details |
| query_contract(query) | VM query (read-only) |
# 1. Create account and sync nonce
account = Account.new_from_pem("wallet.pem")
account.nonce = entrypoint.recall_account_nonce(account.address)
# 2. Create transaction (via controller)
controller = entrypoint.create_transfers_controller()
tx = controller.create_transaction_for_transfer(
sender=account,
nonce=account.get_nonce_then_increment(),
receiver=receiver_address,
native_amount=1000000000000000000
)
# 3. Send
tx_hash = entrypoint.send_transaction(tx)
# 4. Wait for completion
result = entrypoint.await_completed_transaction(tx_hash)
print(f"Status: {result.status}")
---
name: mvx_sdk_py_transactions
description: Transaction creation and token operations for MultiversX Python SDK.
---
This skill covers creating transactions using Controllers and Factories.
controller = entrypoint.create_transfers_controller()
tx = controller.create_transaction_for_transfer(
sender=account,
nonce=account.get_nonce_then_increment(),
receiver=receiver_address,
native_amount=1000000000000000000
)
from multiversx_sdk importWeekly roundup of top Claude Code skills, MCP servers, and AI coding tips.