sendTransaction
Submit a real transaction to the Stellar network. This is the only way to make changes "on-chain".
Unlike Horizon, this does not wait for transaction completion. It simply validates and enqueues the transaction. Clients should call getTransactionStatus to learn about transaction success/failure.
This supports all transactions, not only smart contract-related transactions.
- TODO: Decide on submit-vs-send for naming
- TODO: Add a return value that would represent the minimal amount of time the client would need to wait before calling getTransactionStatus
Parameters
<xdr.TransactionEnvelope>
- The signed transaction to broadcast (serialized in base64)
Returns
<object>
id
:<hash>
The transaction hash (in an hex-encoded string), and the initial transaction status, ("pending" or something), unless we can reject it immediately.status
:<status>
- the current status of the transaction by hash, one of:pending
success
error
error
:<object>
- (optional) If the transaction was rejected immediately, this will be an error object. SeegetTransactionStatus
for format.
Possible Errors
- TODO: Fewer than existing txsub as not waiting for completion
Examples
Request
The following example request uses a transaction to invoke the increment
method of the increment
example contract.
{
"jsonrpc": "2.0",
"id": 8675309,
"method": "sendTransaction",
"params": {
"transaction": "AAAAAgAAAAAdq+kGxmBG/ikQNdYHQ2fBAG+8Av/xp1ZfPZ9Xt42ragAAJxAAAoAqAAAAEAAAAAEAAAAAAAAAAAAAAABjzuUjAAAAAAAAAAEAAAAAAAAAGAAAAAAAAAACAAAABAAAAAEAAAAGAAAAIBv6ziOnWcVRdGMZjtFKSWnLSndMp9JPVLLXxQqAvKqJAAAABQAAAAlpbmNyZW1lbnQAAAAAAAACAAAABhv6ziOnWcVRdGMZjtFKSWnLSndMp9JPVLLXxQqAvKqJAAAAAwAAAAMAAAAH1CpZRz0BSN27PmqtsmBhv+AAJJwHgmrvJNPrHRAl9l8AAAABAAAABhv6ziOnWcVRdGMZjtFKSWnLSndMp9JPVLLXxQqAvKqJAAAABQAAAAdDT1VOVEVSAAAAAAAAAAABt42ragAAAECMEuou2IDSTtqTu62ZOBkJZJc3aYL10ZlsRg9CMXXYwk1Lv6c23Iy3HawBPKOE2DQKhbi49cdPkMI5n/QtnkgE"
}
}
Response
{
"jsonrpc": "2.0",
"id": 8675309,
"result": {
"id": "d70916f8b8aa55c13d5974a38e32a3efe440ef6870c0f0a07075d1c128d23698",
"status": "pending",
"error": null
}
}