Virtual Machine
Query values stored within Smart Contracts.
POST Compute Output of Pure Function
https://gateway.elrond.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
Param | Required | Type | Description |
---|---|---|---|
scAddress | REQUIRED | string | The Address (bech32) of the Smart Contract. |
funcName | REQUIRED | string | The name of the Pure Function to execute. |
args | REQUIRED | array | The arguments of the Pure Function, as hex-encoded strings. The array can be empty. |
caller | OPTIONAL | string | The Address (bech32) of the caller. |
value | OPTIONAL | string | The Value to transfer (can be zero). |
๐ข 200: OK
The VM Output is retrieved successfully.
{
"data": {
"ReturnData": [
"eyJSZ... (base64)"
],
"ReturnCode": 0,
"ReturnMessage": "",
"GasRemaining": 1500000000,
"GasRefund": 0,
"OutputAccounts": {
"...": {
"Address": "... (base64)",
"Nonce": 0,
"Balance": null,
"BalanceDelta": 0,
"StorageUpdates": null,
"Code": null,
"CodeMetadata": null,
"Data": null,
"GasLimit": 0,
"CallType": 0
}
},
"DeletedAccounts": null,
"TouchedAccounts": null,
"Logs": null
}
}
Here's an example of a request:
POST https://gateway.elrond.com/vm-values/query HTTP/1.1
Content-Type: application/json
{
"scAddress": "erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqllls0lczs7",
"funcName": "get",
"args": ["d98d..."],
"caller": "erd1k2s324ww2g0yj38qn2ch2jwctdy8mnfxep94q9arncc6xecg3xaq6mjse8",
"value": "0"
}
POST Compute Hex Output of Pure Function
https://gateway.elrond.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
Param | Required | Type | Description |
---|---|---|---|
scAddress | REQUIRED | string | The Address (bech32) of the Smart Contract. |
funcName | REQUIRED | string | The name of the Pure Function to execute. |
args | REQUIRED | array | The arguments of the Pure Function, as hex-encoded strings. The array can be empty. |
caller | OPTIONAL | string | The Address (bech32) of the caller. |
value | OPTIONAL | string | The Value to transfer (can be zero). |
๐ข 200: OK
The output value is retrieved successfully.
{
"data": "7b22..."
}
POST Compute String Output of Pure Function
https://gateway.elrond.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
Param | Required | Type | Description |
---|---|---|---|
scAddress | REQUIRED | string | The Address (bech32) of the Smart Contract. |
funcName | REQUIRED | string | The name of the Pure Function to execute. |
args | REQUIRED | array | The arguments of the Pure Function, as hex-encoded strings. The array can be empty. |
caller | OPTIONAL | string | The Address (bech32) of the caller. |
value | OPTIONAL | string | The Value to transfer (can be zero). |
๐ข 200: OK
The output value is retrieved successfully.
{
"data": "foobar"
}
POST Get Integer Output of Pure Function
https://gateway.elrond.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
Param | Required | Type | Description |
---|---|---|---|
scAddress | REQUIRED | string | The Address (bech32) of the Smart Contract. |
funcName | REQUIRED | string | The name of the Pure Function to execute. |
args | REQUIRED | array | The arguments of the Pure Function, as hex-encoded strings. The array can be empty. |
caller | OPTIONAL | string | The Address (bech32) of the caller. |
value | OPTIONAL | string | The Value to transfer (can be zero). |
๐ข 200: OK
The output value is retrieved successfully.
{
"data": "2020"
}