sendTransaction
Submits a signed transaction to the network. This method uses 160 credits from your daily balance.
The method validates the transaction and enqueues it. It does not wait for the transaction to be included in a ledger.
Call getTransaction to learn whether it succeeded.
This method accepts any Stellar transaction, including transactions that do not call a smart contract.
Parameters
transaction: (string) [required] - Signed transaction envelope, as a base64-encoded string.
Returns
result: (object) - Submission status and the latest ledger.
hash: (string) - Hex-encoded transaction hash.status: (string) - Submission status. One ofPENDING,DUPLICATE,TRY_AGAIN_LATER, orERROR.latestLedger: (integer) - Sequence number of the latest ledger known to the node when it handled the request.latestLedgerCloseTime: (string) - Unix timestamp, as a string, of when that ledger closed.errorResultXdr: (string) [optional] - Base64-encodedTransactionResultexplaining why the transaction was rejected. Present whenstatusisERROR.diagnosticEventsXdr: (array) [optional] - Base64-encoded diagnostic events explaining why the transaction was rejected. Present whenstatusisERROR.
The sample envelope is not accepted by mainnet, so the node returns ERROR.
Request
- curl
curl https://stellar-mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "sendTransaction", "params": {"transaction": "AAAAAgAAAAAg4dbAxsGAGICfBG3iT2cKGYQ6hK4sJWzZ6or1C5v6GAAAAGQAJsOiAAAADQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAACgAAAAVIZWxsbwAAAAAAAAEAAAAMU29yb2JhbiBEb2NzAAAAAAAAAAELm/oYAAAAQATr6Ghp/DNO7S6JjEFwcJ9a+dvI6NJr7I/2eQttvoovjQ8te4zKKaapC3mbmx6ld6YKL5T81mxs45TjzdG5zw0="}}'
Response
- JSON
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"errorResultXdr": "AAAAAAAAAGT////4AAAAAA==",
"status": "ERROR",
"hash": "9117468ae90cc2752fb002b399b61b9402412ab8afb0807ec76bbbbb4acb71c5",
"latestLedger": 64923230,
"latestLedgerCloseTime": "1791901932"
}
}