Transactions
Send Transactions to the Blockchain and query information about them.
POST Send Transaction
https://gateway.elrond.com/transaction/send
This endpoint allows one to send a signed Transaction to the Blockchain.
Body Parameters
Param | Required | Type | Description |
---|---|---|---|
version | REQUIRED | number | The Version of the Transaction (e.g. 1). |
chainID | REQUIRED | string | The Chain identifier. |
nonce | REQUIRED | number | The Nonce of the Sender. |
value | REQUIRED | string | The Value to transfer (can be zero). |
sender | REQUIRED | string | The Address (bech32) of the Sender. |
receiver | REQUIRED | string | The Address (bech32) of the Receiver. |
gasPrice | REQUIRED | number | The desired Gas Price (per Gas Unit). |
gasLimit | REQUIRED | number | The maximum amount of Gas Units to consume. |
data | OPTIONAL | string | The message (data) of the Transaction. |
signature | REQUIRED | string | The Signature (hex-encoded) of the Transaction. |
๐ข 200: OK
Transaction sent with success. A Transaction Hash is returned.
{
"txHash": "6c41c71946b5b428c2cfb560e3ea425f8a00345de4bb2eb1b784387790914277"
}
๐ด 400: Bad request
Invalid Transaction signature.
{
"error": "transaction generation failed: ed25519: invalid signature"
}
warning
For Nodes (Observers or Validators with the HTTP API enabled), this endpoint only accepts transactions whose sender is in the Node's Shard.
Here's an example of a request:
POST https://gateway.elrond.com/transaction/send HTTP/1.1
Content-Type: application/json
{
"version": 1,
"chainId": "v1.0.141",
"nonce": 42,
"value": "100000000000000000",
"receiver": "erd1cux02zersde0l7hhklzhywcxk4u9n4py5tdxyx7vrvhnza2r4gmq4vw35r",
"sender": "erd1njqj2zggfup4nl83x0nfgqjkjserm7mjyxdx5vzkm8k0gkh40ezqtfz9lg",
"gasPrice": 1000000000,
"gasLimit": 70000,
"data": "food for cats",
"signature": "93207c579bf57be03add632b0e1624a73576eeda8a1687e0fa286f03eb1a17ffb125ccdb008a264c402f074a360442c7a034e237679322f62268b614e926d10f"
}
POST Send Multiple Transactions
https://gateway.elrond.com/transaction/send-multiple
This endpoint allows one to send a bulk of Transactions to the Blockchain.
Body Parameters
Param | Required | Type | Description |
---|---|---|---|
version | REQUIRED | number | The Version of the Transaction (e.g. 1). |
chainID | REQUIRED | string | The Chain identifier. |
nonce | REQUIRED | number | The Nonce, for each Transaction. |
value | REQUIRED | string | The Value, for each Transaction. |
sender | REQUIRED | string | The Address of the Sender, for each Transaction. |
receiver | REQUIRED | string | The Address of the Receiver, for each Transaction. |
gasPrice | REQUIRED | number | The Gas Price, for each Transaction. |
gasLimit | REQUIRED | number | The Gas Limit, for each Transaction. |
data | OPTIONAL | string | The message (data), for each Transaction. |
signature | REQUIRED | string | The Signature, for each Transaction. |
๐ข 200: OK
A bulk of Transactions were successfully sent.
{
"numOfSentTxs": 2,
"txsHashes": {
"0": "6c41c71946b5b428c2cfb560e3ea425f8a00345de4bb2eb1b784387790914277",
"1": "fa8195bae93d4609a6fc5972a7a6176feece39a6c4821acae2276701aee12fb0"
}
}
warning
For Nodes (Observers or Validators with the HTTP API enabled), this endpoint only accepts transactions whose sender is in the Node's Shard.
Here's an example of a request:
POST https://gateway.elrond.com/transaction/send-multiple HTTP/1.1
Content-Type: application/json
[
{
"nonce": 42,
"value": "100000000000000000",
"receiver": "erd1cux02zersde0l7hhklzhywcxk4u9n4py5tdxyx7vrvhnza2r4gmq4vw35r",
"sender": "erd1njqj2zggfup4nl83x0nfgqjkjserm7mjyxdx5vzkm8k0gkh40ezqtfz9lg",
"gasPrice": 1000000000,
"gasLimit": 70000,
"data": "food for cats",
"chainId": "v1.0.141",
"version": 1,
"signature": "93207c579bf57be03add632b0e1624a73576eeda8a1687e0fa286f03eb1a17ffb125ccdb008a264c402f074a360442c7a034e237679322f62268b614e926d10f"
},
{
"nonce": 43,
"value": "100000000000000000",
"receiver": "erd1cux02zersde0l7hhklzhywcxk4u9n4py5tdxyx7vrvhnza2r4gmq4vw35r",
"sender": "erd1rhp4q3qlydyrrjt7dgpfzxk8n4f7yrat4wc6hmkmcnmj0vgc543s8h7hyl",
"gasPrice": 1000000000,
"gasLimit": 70000,
"data": "bus tickets",
"chainID": "v1.0.141",
"version": 1,
"signature": "01535fd1d40d98b7178ccfd1729b3f526ee4542482eb9f591d83433f9df97ce7b91db07298b1d14308e020bba80dbe4bba8617a96dd7743f91ee4b03d7f43e00"
}
]
POST Simulate Transaction
Nodes and observers
https://gateway.elrond.com/transaction/simulate
This endpoint allows one to send a signed Transaction to the Blockchain in order to simulate its execution.
This can be useful in order to check if the transaction will be successfully executed before actually sending it.
It receives the same request as the /transaction/send
endpoint.
Move balance successful transaction simulation
Body Parameters
Param | Required | Type | Description |
---|---|---|---|
version | REQUIRED | number | The Version of the Transaction (e.g. 1). |
chainID | REQUIRED | string | The Chain identifier. |
nonce | REQUIRED | number | The Nonce of the Sender. |
value | REQUIRED | string | The Value to transfer (can be zero). |
sender | REQUIRED | string | The Address (bech32) of the Sender. |
receiver | REQUIRED | string | The Address (bech32) of the Receiver. |
gasPrice | REQUIRED | number | The desired Gas Price (per Gas Unit). |
gasLimit | REQUIRED | number | The maximum amount of Gas Units to consume. |
data | OPTIONAL | string | The message (data) of the Transaction. |
signature | REQUIRED | string | The Signature (hex-encoded) of the Transaction. |
A full response contains the fields above: SimulationResults
Field | Type | Description |
---|---|---|
status | string | success, fail ... |
failReason | string | the error message |
scResults | []ApiSmartContractResult | an array of smart contract results (if any) |
receipts | []ApiReceipt | an array of the receipts (if any) |
hash | string | the hash of the transaction |
โ Note that fields that are empty won't be included in the response. This can be seen in the examples below
๐ข 200: OK
Transaction would be successful.
{
"status": "success",
"hash": "bb24ccaa2da8cddd6a3a8eb162e6ff62ad4f6e1914d9aa0cacde6772246ca2dd"
}
๐ข 200: Simulation was successful, but the transaction wouldn't be executed.
Invalid Transaction signature.
{
"status": "fail",
"failReason": "higher nonce in transaction",
"hash": "bb24ccaa2da8cddd6a3a8eb162e6ff62ad4f6e1914d9aa0cacde6772246ca2dd"
}
๐ด 400: Bad request
{
"error": "transaction generation failed: invalid chain ID"
}
Proxy
On the Proxy side, if the transaction to simulate is a cross-shard one, then the response format will contain two elements called senderShard
and receiverShard
which are of type SimulationResults
explained above.
Example response for cross-shard transactions:
{
"receiverShard": {
"status": "success",
"hash": "bb24ccaa2da8cddd6a3a8eb162e6ff62ad4f6e1914d9aa0cacde6772246ca2dd"
},
"senderShard": {
"status": "success",
"hash": "bb24ccaa2da8cddd6a3a8eb162e6ff62ad4f6e1914d9aa0cacde6772246ca2dd"
}
}
POST Estimate Cost of Transaction
https://gateway.elrond.com/transaction/cost
This endpoint allows one to estimate the cost of a transaction.
Body Parameters
Param | Required | Type | Description |
---|---|---|---|
version | REQUIRED | number | The Version of the Transaction (e.g. 1). |
chainID | REQUIRED | string | The Chain identifier. |
value | REQUIRED | string | The Value to transfer. |
sender | REQUIRED | string | TThe Address of the Sender. |
receiver | REQUIRED | string | The Address of the Receiver. |
data | OPTIONAL | string | The message (data) of the Transaction. |
๐ข 200: OK
The cost is estimated successfully.
{
"txGasUnits": "77000"
}
tip
This endpoint returns the cost on the transaction in gas units. The returned value can be used to fill in gasLimit field of the transaction.
Here's an example of a request:
POST https://gateway.elrond.com/transaction/cost HTTP/1.1
Content-Type: application/json
{
"value": "100000",
"sender": "erd1l453hd0gt5gzdp7czpuall8ggt2dcv5zwmfdf3sd3lguxseux2fsmsgldz",
"receiver": "erd188nydpkagtpwvfklkl2tn0w6g40zdxkwfgwpjqc2a2m2n7ne9g8q2t22sr",
"data": "this is an example",
"chainID": "v1.0.141",
"version": 1
}
GET Get Transaction
https://gateway.elrond.com/transaction/:txHash
This endpoint allows one to query the details of a Transaction.
Path Parameters
Param | Required | Type | Description |
---|---|---|---|
txHash | REQUIRED | string | The hash (identifier) of the Transaction. |
Query Parameters
Param | Required | Type | Description |
---|---|---|---|
sender | OPTIONAL | string | The Address of the sender - a hint to optimize the request. |
withResults | OPTIONAL | bool | Boolean parameter to specify if smart contract results and other details should be returned. |
๐ข 200: OK
Transaction details retrieved successfully.
{
"transaction": {
"type": "normal",
"nonce": 3,
"round": 186580,
"epoch": 12,
"value": "1000000000000000000",
"receiver": "erd1...",
"sender": "erd1...",
"gasPrice": 1000000000,
"gasLimit": 70000,
"data": "Zm9yIHRlc3Rz",
"signature": "1047...",
"sourceShard": 2,
"destinationShard": 1,
"blockNonce": 186535,
"miniblockHash": "e927...",
"blockHash": "50a1...",
"status": "executed"
}
}
Request URL:
https://gateway.elrond.com/transaction/:txHash?withResults=true
Response:
The response can contain additional fields such as smartContractResults
, or receipt
"transaction": {
"type": "normal",
"nonce": 3,
"round": 186580,
"epoch": 12,
"value": "1000000000000000000",
"receiver": "erd1...",
"sender": "erd1...",
"gasPrice": 1000000000,
"gasLimit": 70000,
"data": "Zm9yIHRlc3Rz",
"signature": "1047...",
"sourceShard": 2,
"destinationShard": 1,
"blockNonce": 186535,
"miniblockHash": "e927...",
"blockHash": "50a1...",
"status": "executed",
"receipt": {
"value": 100,
"sender": "erd1...",
"data": "...",
"txHash": "b37..."
},
"smartContractResults": [
{
"hash": "...",
"nonce": 5,
"value": 1000,
"receiver": "erd1...",
"sender": "erd1...",
"data": "@6f6b",
"prevTxHash": "3638...",
"originalTxHash": "3638...",
"gasLimit": 0,
"gasPrice": 1000000000,
"callType": 0
}
]
}
important
The optional query parameter sender
is only applicable to requests against the Proxy (not against the Observer Nodes).
GET Get Transaction Status
https://gateway.elrond.com/transaction/:txHash/status
This endpoint allows one to query the Status of a Transaction.
Path Parameters
Param | Required | Type | Description |
---|---|---|---|
txHash | REQUIRED | string | The hash (identifier) of the Transaction. |
Query Parameters
Param | Required | Type | Description |
---|---|---|---|
sender | OPTIONAL | string | The Address of the sender - a hint to optimize the request. |
๐ข 200: OK
Transaction status retrieved successfully.
{
"status": "executed"
}
important
The optional query parameter sender
is only applicable to requests against the Proxy (not against the Observer Nodes).