Skip to main content
Call read-only smart contract functions (view functions) without submitting a transaction. The Gateway routes the query to the shard hosting the smart contract.

VM query endpoints

MethodPathReturns
POST/vm-values/queryFull VM response (all return data, gasUsed, returnCode)
POST/vm-values/hexFirst return value as hex string
POST/vm-values/stringFirst return value as UTF-8 string
POST/vm-values/intFirst return value as decimal big-integer string

Request body

{
  "scAddress": "erd1qqqqqqqqqqqqqpgq...",
  "funcName": "getBalance",
  "args": ["hex-encoded-arg1", "hex-encoded-arg2"],
  "caller": "erd1...",
  "value": "0"
}
FieldTypeRequiredDescription
scAddressstringyesBech32 address of the smart contract
funcNamestringyesView function name
argsstring[]noHex-encoded arguments
callerstringnoSimulated caller address
valuestringnoSimulated EGLD value sent
Arguments must be hex-encoded. To pass the number 100, encode it as "64" (hex representation of 100).

Choose the right endpoint

  • /vm-values/query: returns the full response (multiple return values, gas used, return code).
  • /vm-values/hex: returns raw bytes (e.g., reading a storage mapper).
  • /vm-values/string: returns string data (e.g., token names).
  • /vm-values/int: returns numeric values (e.g., balances, counters).

Read a token balance from a smart contract

curl -X POST "https://rust-gateway.xoxno.com/vm-values/int" \
  -H "Content-Type: application/json" \
  -d '{
    "scAddress": "erd1qqqqqqqqqqqqqpgqfzydqmdw7m2vazsp6u5p95yxz76t2p9rd8ss0zp9ts",
    "funcName": "getBalance",
    "args": ["b13a017423c366caff8cecfb77a12610a130f4888134122c7937feae0d6d7d4e"]
  }'

Historical queries

Add ?blockNonce=12345678 or ?blockHash=abcdef... to query VM state at a specific block.
POST /vm-values/int?blockNonce=12345678
Historical VM queries require full-history observer nodes. The Gateway routes to full-history observers when block parameters are present.