home / skills / multiversx / mx-ai-skills / mvx_sdk_py_transactions

mvx_sdk_py_transactions skill

/antigravity/skills/mvx_sdk_py_transactions

This skill helps you create and manage MultiversX transactions and token operations in Python, simplifying transfers, token issues, and parsing events for

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

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

Files (1)
SKILL.md
2.8 KB
---
name: mvx_sdk_py_transactions
description: Transaction creation and token operations for MultiversX Python SDK.
---

# MultiversX SDK-Py Transactions & Tokens

This skill covers creating transactions using Controllers and Factories.

## Transfers

### Native EGLD Transfer
```python
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
)
```

### ESDT Token Transfer
```python
from multiversx_sdk import TokenTransfer

tx = controller.create_transaction_for_transfer(
    sender=account,
    nonce=account.get_nonce_then_increment(),
    receiver=receiver_address,
    token_transfers=[
        TokenTransfer.fungible_from_amount("TOKEN-123456", 100.5, 18)
    ]
)
```

### NFT/SFT Transfer
```python
tx = controller.create_transaction_for_transfer(
    sender=account,
    nonce=account.get_nonce_then_increment(),
    receiver=receiver_address,
    token_transfers=[
        TokenTransfer.nft_from_amount("NFT-123456", 1, 1)
    ]
)
```

## Token Management

### Issue Fungible Token
```python
controller = entrypoint.create_token_management_controller()

tx = controller.create_transaction_for_issuing_fungible(
    sender=account,
    nonce=account.get_nonce_then_increment(),
    token_name="MyToken",
    token_ticker="MTK",
    initial_supply=1000000000000,
    num_decimals=6,
    can_freeze=False,
    can_wipe=True,
    can_pause=False,
    can_change_owner=True,
    can_upgrade=True,
    can_add_special_roles=True
)

tx_hash = entrypoint.send_transaction(tx)
outcome = controller.await_completed_issue_fungible(tx_hash)
print(outcome[0].token_identifier)
```

## Transaction Parsing

### Decoding Transaction Data
```python
from multiversx_sdk import TransactionDecoder

decoded = TransactionDecoder.decode_transaction(tx)
print(decoded.function)
print(decoded.arguments)
```

### Parsing Events
```python
tx_on_network = entrypoint.get_transaction(tx_hash)

for event in tx_on_network.logs.events:
    print(f"Event: {event.identifier}")
    for topic in event.topics:
        print(f"Topic: {topic.hex()}")
```

## Relayed Transactions (V3)

```python
tx = Transaction(
    sender=user_address,
    receiver=receiver_address,
    relayer=relayer_address,
    gas_limit=150000,  # +50k for relayed
    data=b"endpoint@args"
)

tx.signature = user_account.sign_transaction(tx)
tx.relayer_signature = relayer_account.sign_transaction(tx)

entrypoint.send_transaction(tx)
```

## Best Practices

1. **Use `TokenTransfer` helpers**: handles decimals correctly
2. **Check issuance outcome**: tokens get random suffix
3. **Relayed transactions**: sender and relayer must be in same shard
4. **Gas estimation**: Controllers generally handle basic estimation

Overview

This skill implements transaction creation and token operations for the MultiversX Python SDK. It provides Controllers and Factories to build native EGLD transfers, ESDT token transfers (fungible and non-fungible), token issuance transactions, and relayed transactions. It also includes utilities for decoding transaction data and parsing on-chain events.

How this skill works

Controllers expose high-level methods to build transactions: transfers, token issuance, and token management actions. TokenTransfer helpers normalize amounts and decimals for ESDT operations. Transactions can be signed by sender and relayer when using relayed (V3) flows, and the SDK includes decoding/parsing helpers to inspect transaction function calls and events.

When to use it

  • To send native EGLD between accounts with correct nonce handling.
  • To transfer fungible ESDT tokens while preserving decimal precision.
  • To transfer NFTs or SFTs with the correct token amount encoding.
  • To issue new fungible tokens and await on-chain issuance outcome.
  • To create and submit relayed transactions requiring both sender and relayer signatures.
  • To decode transaction payloads and parse on-chain events for auditing or UI updates.

Best practices

  • Use TokenTransfer helper constructors (fungible_from_amount, nft_from_amount) to avoid manual decimal mistakes.
  • Always increment or fetch nonce via account.get_nonce_then_increment() to prevent replay or nonce conflicts.
  • Check issuance outcome after sending token-creation transactions — issued identifiers include randomized suffixes.
  • When using relayed transactions ensure sender and relayer accounts are in the same shard and allocate extra gas for relayer execution.
  • Rely on Controller gas estimation for common flows but validate gas limits for complex smart contract interactions.

Example use cases

  • Create and send a simple EGLD transfer from a custodial account to a user.
  • Transfer 100.5 units of a fungible ESDT token to a marketplace contract using TokenTransfer helpers.
  • Issue a new fungible token with custom permissions and retrieve the generated token identifier after confirmation.
  • Transfer an NFT/SFT from a user to another address as part of a marketplace settlement.
  • Build a relayed transaction where the user signs the payload and a relayer pays gas and appends a relayer signature.
  • Decode transaction data and iterate contract event logs to extract emitted identifiers and topics for indexing.

FAQ

How do I handle decimals for ESDT transfers?

Use TokenTransfer.fungible_from_amount(name, amount, num_decimals) so the SDK converts human amounts into integer token units correctly.

How can I get the new token identifier after issuing a token?

Send the issuance transaction, then await the controller's completed issuance outcome which returns the created token identifier with its randomized suffix.