home / skills / multiversx / mx-ai-skills / mvx_sdk_py_core

mvx_sdk_py_core skill

/antigravity/skills/mvx_sdk_py_core

This skill helps you interact with MultiversX Python SDK core by managing entrypoints, providers, and network queries for seamless transactions.

npx playbooks add skill multiversx/mx-ai-skills --skill mvx_sdk_py_core

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.2 KB
---
name: mvx_sdk_py_core
description: Core SDK operations for MultiversX Python SDK - Entrypoints, Providers, and Network.
---

# MultiversX SDK-Py Core Operations

This skill covers the fundamental building blocks of the `multiversx-sdk` v2 library.

## Entrypoints

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` |

```python
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")
```

## Entrypoint Methods

| 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 |

## Network Providers

Lower-level network access:

| Provider | Use Case |
|----------|----------|
| `ApiNetworkProvider` | Standard API queries (recommended) |
| `ProxyNetworkProvider` | Direct node interaction via gateway |

```python
# 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")
```

## Provider Methods

| 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) |

## Transaction Lifecycle

```python
# 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}")
```

## Best Practices

1. **Use Entrypoints**: Simplifies configuration
2. **Sync nonce**: Before creating any transaction
3. **Handle exceptions**: Wrap network calls
4. **Use integers**: For amounts (18 decimals for EGLD)

Overview

This skill implements core SDK operations for the MultiversX Python SDK: entrypoints, network providers, and common transaction flows. It exposes network-specific clients (Devnet, Testnet, Mainnet, Localnet), simplified APIs for sending transactions, and lower-level providers for direct node or gateway access. It’s designed to make building, broadcasting, and monitoring transactions predictable and reproducible.

How this skill works

Entrypoints are high-level clients preconfigured for common networks and provide helpers to create accounts, controllers, and network providers. Network providers (ApiNetworkProvider and ProxyNetworkProvider) expose raw calls for chain config, blocks, accounts, storage, and VM queries. Typical flow: sync an account nonce, create a transaction via a transfers controller, broadcast with entrypoint.send_transaction, and wait for finality with await_completed_transaction.

When to use it

  • Building applications that interact with MultiversX networks (devnet/testnet/mainnet/localnet).
  • Rapid prototyping where default network URLs and clients reduce boilerplate.
  • When you need both high-level helpers (entrypoints/controllers) and low-level API access (provider queries).
  • Automated testing against localnet or devnet endpoints.
  • Integrating transaction lifecycle management into backend services.

Best practices

  • Prefer Entrypoint classes to centralize network URL and mode configuration.
  • Always recall and sync account nonce before creating or signing transactions.
  • Wrap network calls in exception handling and add retries for transient failures.
  • Use integer amounts (EGLD uses 18 decimals) to avoid floating point issues.
  • Choose ApiNetworkProvider for standard API usage and ProxyNetworkProvider when direct gateway behavior is required.

Example use cases

  • Create and fund new accounts on devnet using DevnetEntrypoint and create_account().
  • Build a backend transfer service: recall_account_nonce(), create transaction via transfers controller, send_transaction(), await_completed_transaction().
  • Query smart contract storage and run read-only VM queries using provider.query_contract().
  • Run local integration tests against LocalnetEntrypoint with predictable URLs and no external dependencies.
  • Fetch block or transaction details for analytics dashboards using ApiNetworkProvider.get_block() and get_transaction().

FAQ

Which entrypoint should I use for production?

Use MainnetEntrypoint with the official API URL for production workloads. Use Testnet or Devnet for testing and Localnet for isolated local development.

When should I use ProxyNetworkProvider instead of ApiNetworkProvider?

Use ProxyNetworkProvider when interacting through a gateway or when you need behavior specific to proxy endpoints; use ApiNetworkProvider for standard API queries and recommended production access.