Skip to main content

Virtual Machine

This component of the REST API allows one to call view functions (pure functions) of Smart Contracts, or, to put it in other words, to query values stored within contracts.

POST Compute Output of Pure Function

https://gateway.multiversx.com/vm-values/query

This endpoint allows one to execute - with no side-effects - a pure function of a Smart Contract and retrieve the execution results (the Virtual Machine Output).

Body Parameters

ParamRequiredTypeDescription
scAddressREQUIREDstringThe Address (bech32) of the Smart Contract.
funcNameREQUIREDstringThe name of the Pure Function to execute.
argsREQUIREDarrayThe arguments of the Pure Function, as hex-encoded strings. The array can be empty.
callerOPTIONALstringThe Address (bech32) of the caller.
valueOPTIONALstringThe Value to transfer (can be zero).

Here's an example of a request:

POST https://gateway.multiversx.com/vm-values/query HTTP/1.1
Content-Type: application/json

{
"scAddress": "erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqllls0lczs7",
"funcName": "get",
"caller": "erd1k2s324ww2g0yj38qn2ch2jwctdy8mnfxep94q9arncc6xecg3xaq6mjse8",
"value": "0",
"args": ["d98d..."]
}

POST Compute Hex Output of Pure Function

https://gateway.multiversx.com/vm-values/hex

This endpoint allows one to execute - with no side-effects - a pure function of a Smart Contract and retrieve the first output value as a hex-encoded string.

Body Parameters

ParamRequiredTypeDescription
scAddressREQUIREDstringThe Address (bech32) of the Smart Contract.
funcNameREQUIREDstringThe name of the Pure Function to execute.
argsREQUIREDarrayThe arguments of the Pure Function, as hex-encoded strings. The array can be empty.
callerOPTIONALstringThe Address (bech32) of the caller.
valueOPTIONALstringThe Value to transfer (can be zero).

POST Compute String Output of Pure Function

https://gateway.multiversx.com/vm-values/string

This endpoint allows one to execute - with no side effects - a pure function of a Smart Contract and retrieve the first output value as a string.

Body Parameters

ParamRequiredTypeDescription
scAddressREQUIREDstringThe Address (bech32) of the Smart Contract.
funcNameREQUIREDstringThe name of the Pure Function to execute.
argsREQUIREDarrayThe arguments of the Pure Function, as hex-encoded strings. The array can be empty.
callerOPTIONALstringThe Address (bech32) of the caller.
valueOPTIONALstringThe Value to transfer (can be zero).

POST Get Integer Output of Pure Function

https://gateway.multiversx.com/vm-values/int

This endpoint allows one to execute - with no side-effects - a pure function of a Smart Contract and retrieve the first output value as an integer.

Body Parameters

ParamRequiredTypeDescription
scAddressREQUIREDstringThe Address (bech32) of the Smart Contract.
funcNameREQUIREDstringThe name of the Pure Function to execute.
argsREQUIREDarrayThe arguments of the Pure Function, as hex-encoded strings. The array can be empty.
callerOPTIONALstringThe Address (bech32) of the caller.
valueOPTIONALstringThe Value to transfer (can be zero).