home / skills / multiversx / mx-ai-skills / mvx_sdk_go_core
This skill enables efficient blockchain data access with the MultiversX Go SDK core, covering proxy setup, VM queries, and shard coordination.
npx playbooks add skill multiversx/mx-ai-skills --skill mvx_sdk_go_coreReview the files below or copy the command above to add this skill to your agents.
---
name: mvx_sdk_go_core
description: Core network operations for MultiversX Go SDK - Proxy, VM Queries.
---
# MultiversX SDK-Go Core Operations
This skill covers the `blockchain` package and network interactions.
## Proxy (Network Client)
Setup the proxy to interact with the blockchain:
```go
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)
```
## Reading Data
```go
// 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)
```
## VM Queries (Smart Contract Reads)
Reading state from a smart contract without sending a transaction.
```go
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
```
## Shard Coordination
Working with sharded addresses.
```go
// Create Coordinator
coordinator, err := blockchain.NewShardCoordinator(3, 0) // 3 shards, current 0
// Get Shard for Address
shardID := coordinator.ComputeId(address)
```
## Best Practices
1. **Reuse Proxy**: It maintains connection pools/caches
2. **Context**: Always pass context with timeout to avoid hanging
3. **VM Queries**: Preferred for reading state (instant, free)
4. **Error Handling**: Check for specific network errors
This skill explains core network operations for the MultiversX Go SDK, focusing on proxy client setup, VM queries, and shard coordination. It summarizes how to create and reuse a proxy, perform smart contract read queries, and compute shard IDs for addresses. The guidance highlights practical workflows and safety considerations for reliable network interactions.
You configure a Proxy client that wraps HTTP connections, caching, and sync checks to interact with gateway endpoints. For reading smart contract state, the VmQueryGetter executes queries via the proxy and returns raw byte responses without creating transactions. A ShardCoordinator maps addresses to shard IDs so you can route requests or partition logic across shards.
Do VM queries cost gas or require signing?
No. VM queries read contract state via the gateway and do not create on-chain transactions, so they do not consume gas or require signing.
Should I create a new Proxy for each request?
No. Reuse a single Proxy instance to benefit from connection pooling, caching, and reduced resource use.