Skip to content

Latest commit

 

History

History
132 lines (107 loc) · 6.8 KB

transactions-create.md

File metadata and controls

132 lines (107 loc) · 6.8 KB
title clientData replacement
Post Transaction

Posts a new transaction to the Stellar Network. Note that creating a valid transaction and signing it properly is the responsibility of your client library.

Transaction submission and the subsequent validation and inclusion into the Stellar Network's ledger is a complicated and asynchronous process. To reduce the complexity, horizon manages these asynchronous processes for the client and will wait to hear results from the Stellar Network before returning an HTTP response to a client.

Transaction submission to horizon aims to be idempotent: a client can submit a given transaction to horizon more than once and horizon will behave the same each time. If the transaction has already been successfully applied to the ledger, horizon will simply return the saved result and not attempt to submit the transaction again. Only in cases where a transaction's status is unknown (and thus will have a chance of being included into a ledger) will a resubmission to the network occur.

Information about building transactions in JavaScript.

Timeout

If you are encountering this error it means that either:

  • Horizon has not received a confirmation from the Core server that the transaction you are trying to submit to the network was included in a ledger in a timely manner or:
  • Horizon has not sent a response to a reverse-proxy before in a specified time.

The former case may happen because there was no room for your transaction in the 3 consecutive ledgers. In such case, Core server removes a transaction from a queue. To solve this you can either:

  • Keep resubmitting the same transaction (with the same sequence number) and wait until it finally is added to a new ledger or:
  • Increase the fee.

Request

POST /transactions

Arguments

name loc notes example description
tx body required AAAAAO....f4yDBA== Base64 representation of transaction envelope XDR

curl Example Request

curl -X POST \
     -F "tx=AAAAAOo1QK/3upA74NLkdq4Io3DQAQZPi4TVhuDnvCYQTKIVAAAACgAAH8AAAAABAAAAAAAAAAAAAAABAAAAAQAAAADqNUCv97qQO+DS5HauCKNw0AEGT4uE1Ybg57wmEEyiFQAAAAEAAAAAZc2EuuEa2W1PAKmaqVquHuzUMHaEiRs//+ODOfgWiz8AAAAAAAAAAAAAA+gAAAAAAAAAARBMohUAAABAPnnZL8uPlS+c/AM02r4EbxnZuXmP6pQHvSGmxdOb0SzyfDB2jUKjDtL+NC7zcMIyw4NjTa9Ebp4lvONEf4yDBA==" \
  "https://horizon-testnet.stellar.org/transactions"

Response

A successful response (i.e. any response with a successful HTTP response code) indicates that the transaction was successful and has been included into the ledger.

If the transaction failed or errored, then an error response will be returned. Please see the errors section below.

Attributes

The response will include all fields from the transaction resource.

Example Response

{
  "_links": {
    "self": {
      "href": "https://horizon-testnet.stellar.org/transactions/264226cb06af3b86299031884175155e67a02e0a8ad0b3ab3a88b409a8c09d5c"
    },
    "account": {
      "href": "https://horizon-testnet.stellar.org/accounts/GAIH3ULLFQ4DGSECF2AR555KZ4KNDGEKN4AFI4SU2M7B43MGK3QJZNSR"
    },
    "ledger": {
      "href": "https://horizon-testnet.stellar.org/ledgers/697121"
    },
    "operations": {
      "href": "https://horizon-testnet.stellar.org/transactions/264226cb06af3b86299031884175155e67a02e0a8ad0b3ab3a88b409a8c09d5c/operations{?cursor,limit,order}",
      "templated": true
    },
    "effects": {
      "href": "https://horizon-testnet.stellar.org/transactions/264226cb06af3b86299031884175155e67a02e0a8ad0b3ab3a88b409a8c09d5c/effects{?cursor,limit,order}",
      "templated": true
    },
    "precedes": {
      "href": "https://horizon-testnet.stellar.org/transactions?order=asc&cursor=2994111896358912"
    },
    "succeeds": {
      "href": "https://horizon-testnet.stellar.org/transactions?order=desc&cursor=2994111896358912"
    }
  },
  "id": "264226cb06af3b86299031884175155e67a02e0a8ad0b3ab3a88b409a8c09d5c",
  "paging_token": "2994111896358912",
  "successful": true,
  "hash": "264226cb06af3b86299031884175155e67a02e0a8ad0b3ab3a88b409a8c09d5c",
  "ledger": 697121,
  "created_at": "2019-04-09T20:14:25Z",
  "source_account": "GAIH3ULLFQ4DGSECF2AR555KZ4KNDGEKN4AFI4SU2M7B43MGK3QJZNSR",
  "fee_account": "GAIH3ULLFQ4DGSECF2AR555KZ4KNDGEKN4AFI4SU2M7B43MGK3QJZNSR",
  "source_account_sequence": "4660039994869",
  "fee_charged": 100,
  "max_fee": 100,
  "operation_count": 1,
  "envelope_xdr": "AAAAABB90WssODNIgi6BHveqzxTRmIpvAFRyVNM+Hm2GVuCcAAAAZAAABD0AB031AAAAAAAAAAAAAAABAAAAAAA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