> For the complete documentation index, see [llms.txt](https://docs.stacks.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stacks.co/reference/api/stacks-node-rpc/transactions.md).

# Transactions

Operations related to broadcasting and retrieving transactions.

## Broadcast raw transaction

> Broadcast raw transactions on the network. You can use the \[@stacks/transactions]\(<https://github.com/blockstack/stacks.js)\\>
> project to generate a raw transaction payload.\
> \
> The node performs static validation checks on transactions before accepting them into the mempool, including:\
> \- Transaction format validation\
> \- Signature verification\
> \- Nonce checking\
> \- Fee validation\
> \- Size limits<br>

```json
{"openapi":"3.1.0","info":{"title":"Stacks 3.0+ RPC API","version":"1.0.0"},"tags":[{"name":"Transactions","description":"Operations related to broadcasting and retrieving transactions."}],"servers":[{"url":"http://localhost:20443","description":"Local Stacks Node"}],"security":[],"paths":{"/v2/transactions":{"post":{"summary":"Broadcast raw transaction","tags":["Transactions"],"description":"Broadcast raw transactions on the network. You can use the [@stacks/transactions](https://github.com/blockstack/stacks.js)\nproject to generate a raw transaction payload.\n\nThe node performs static validation checks on transactions before accepting them into the mempool, including:\n- Transaction format validation\n- Signature verification\n- Nonce checking\n- Fee validation\n- Size limits\n","operationId":"broadcastTransaction","requestBody":{"required":true,"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary","minLength":1}},"application/json":{"schema":{"type":"object","required":["tx"],"properties":{"tx":{"type":"string","pattern":"^[0-9a-f]+$","description":"Hex-encoded transaction"},"attachment":{"type":"string","pattern":"^[0-9a-f]+$","description":"Optional hex-encoded attachment for contract-call transactions"}}}}}},"responses":{"200":{"description":"Transaction ID of successful post of a raw tx to the node's mempool.","content":{"application/json":{"schema":{"type":"string","pattern":"^[0-9a-f]{64}$"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionSubmissionError"}},"text/plain":{"schema":{"type":"string"}}}},"500":{"$ref":"#/components/responses/InternalServerError"}}}}},"components":{"schemas":{"TransactionSubmissionError":{"description":"Describes a transaction submission error response","type":"object","required":["error","reason","txid"],"properties":{"error":{"type":"string","description":"The error"},"reason":{"type":"string","description":"The reason for the error"},"reason_data":{"type":"object","description":"More details about the reason","properties":{"actual":{"type":"integer"},"expected":{"type":"integer"},"is_origin":{"type":"boolean"},"principal":{"type":"string"}}},"txid":{"type":"string","description":"The relevant transaction id"}}}},"responses":{"InternalServerError":{"description":"Internal Server Error","content":{"text/plain":{"schema":{"type":"string"}}}}}}}
```

## Retrieve transaction details by TXID

> Get a JSON with the transaction details including the \`index\_block\_hash\`,\
> the hex-encoded transaction body, and the \`result\`.<br>

```json
{"openapi":"3.1.0","info":{"title":"Stacks 3.0+ RPC API","version":"1.0.0"},"tags":[{"name":"Transactions","description":"Operations related to broadcasting and retrieving transactions."}],"servers":[{"url":"http://localhost:20443","description":"Local Stacks Node"}],"security":[],"paths":{"/v3/transaction/{txid}":{"get":{"summary":"Retrieve transaction details by TXID","tags":["Transactions"],"description":"Get a JSON with the transaction details including the `index_block_hash`,\nthe hex-encoded transaction body, and the `result`.\n","operationId":"getTransactionById","parameters":[{"name":"txid","in":"path","required":true,"description":"Transaction ID (64 hexadecimal characters)","schema":{"type":"string","pattern":"^[0-9a-f]{64}$"}}],"responses":{"200":{"description":"Transaction JSON with index_block_hash, transaction body and result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionInfo"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"},"501":{"description":"Transaction indexing not enabled","content":{"text/plain":{"schema":{"type":"string"}}}}}}}},"components":{"schemas":{"TransactionInfo":{"type":"object","required":["index_block_hash","tx","result"],"properties":{"index_block_hash":{"type":"string","description":"Block hash where the transaction was included","pattern":"^[0-9a-f]{64}$"},"tx":{"type":"string","description":"Hex-encoded transaction"},"result":{"type":"string","description":"Transaction execution result (Clarity value)"},"block_height":{"type":["integer","null"],"description":"Height of the block where the transaction was included"},"is_canonical":{"type":"boolean","description":"Whether the block where this transaction was included is in the canonical chain tip"}}}},"responses":{"BadRequest":{"description":"Bad request","content":{"text/plain":{"schema":{"type":"string"}}}},"NotFound":{"description":"Not found","content":{"text/plain":{"schema":{"type":"string"}}}},"InternalServerError":{"description":"Internal Server Error","content":{"text/plain":{"schema":{"type":"string"}}}}}}}
```

## Get unconfirmed transaction

> Get an unconfirmed transaction by its transaction ID.\
> This looks in both the mempool and unconfirmed microblock stream.<br>

```json
{"openapi":"3.1.0","info":{"title":"Stacks 3.0+ RPC API","version":"1.0.0"},"tags":[{"name":"Transactions","description":"Operations related to broadcasting and retrieving transactions."}],"servers":[{"url":"http://localhost:20443","description":"Local Stacks Node"}],"security":[],"paths":{"/v2/transactions/unconfirmed/{txid}":{"get":{"summary":"Get unconfirmed transaction","tags":["Transactions"],"operationId":"getUnconfirmedTransactionById","description":"Get an unconfirmed transaction by its transaction ID.\nThis looks in both the mempool and unconfirmed microblock stream.\n","parameters":[{"name":"txid","in":"path","required":true,"description":"Transaction ID (64 hexadecimal characters)","schema":{"type":"string","pattern":"^[0-9a-f]{64}$"}}],"responses":{"200":{"description":"Unconfirmed transaction details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnconfirmedTransaction"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}},"components":{"schemas":{"UnconfirmedTransaction":{"type":"object","properties":{"tx":{"type":"string","description":"Hex-encoded transaction data"},"status":{"oneOf":[{"type":"object","properties":{"Microblock":{"type":"object","properties":{"block_hash":{"type":"string","description":"Block hash containing the microblock"},"seq":{"type":"integer","description":"Microblock sequence number"}}}}},{"type":"string","enum":["Mempool"]}]}}}},"responses":{"BadRequest":{"description":"Bad request","content":{"text/plain":{"schema":{"type":"string"}}}},"NotFound":{"description":"Not found","content":{"text/plain":{"schema":{"type":"string"}}}},"InternalServerError":{"description":"Internal Server Error","content":{"text/plain":{"schema":{"type":"string"}}}}}}}
```

## Query mempool for missing transactions

> Query the mempool for transactions that might be missing from the requesting node.\
> This endpoint supports pagination and streaming of transaction data.<br>

```json
{"openapi":"3.1.0","info":{"title":"Stacks 3.0+ RPC API","version":"1.0.0"},"tags":[{"name":"Transactions","description":"Operations related to broadcasting and retrieving transactions."}],"servers":[{"url":"http://localhost:20443","description":"Local Stacks Node"}],"security":[],"paths":{"/v2/mempool/query":{"post":{"summary":"Query mempool for missing transactions","tags":["Transactions"],"operationId":"queryMempool","description":"Query the mempool for transactions that might be missing from the requesting node.\nThis endpoint supports pagination and streaming of transaction data.\n","parameters":[{"name":"page_id","in":"query","description":"Transaction ID to start pagination from","schema":{"type":"string","pattern":"^[0-9a-f]{64}$"}}],"requestBody":{"required":true,"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary","minLength":1,"description":"Binary SIP-003 encoding of `MemPoolSyncData`\n(`BloomFilter` or `TxTags` variants).\n"}}}},"responses":{"200":{"description":"Stream of missing transactions","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary","description":"Binary stream of transactions and pagination data.\nThe stream contains serialized transactions followed by a page ID for continuation.\n"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}},"components":{"responses":{"BadRequest":{"description":"Bad request","content":{"text/plain":{"schema":{"type":"string"}}}},"InternalServerError":{"description":"Internal Server Error","content":{"text/plain":{"schema":{"type":"string"}}}}}}}
```

## Simulate a single transaction on top of a chain tip

> Simulate a single transaction in an ephemeral block built on top of\
> the given chain tip, or the canonical chain tip if the \`tip\` query\
> parameter is omitted (no data is written in the MARF), and return its\
> result, events, and execution cost. The simulation runs with the full\
> tenure execution budget, independent of the cost already consumed in\
> the current tenure. The transaction must be fully signed and valid\
> (correct nonce, sufficient balance for the fee). The simulation\
> enforces the same per-transaction wall-clock and memory limits the\
> signers apply during block proposal validation (the\
> \`connection\_options.block\_proposal\_max\_tx\_execution\_time\_secs\`,\
> \`block\_proposal\_max\_tx\_analysis\_time\_secs\`, and\
> \`block\_proposal\_max\_tx\_mem\_bytes\` options), so a transaction which\
> exceeds them fails to simulate.\
> \
> A \`tip\` naming a block that does not exist returns 404. A \`tip\` naming\
> a block that exists but cannot be simulated by this endpoint (for\
> example an epoch-2.x block) returns 400.<br>

```json
{"openapi":"3.1.0","info":{"title":"Stacks 3.0+ RPC API","version":"1.0.0"},"tags":[{"name":"Transactions","description":"Operations related to broadcasting and retrieving transactions."}],"servers":[{"url":"http://localhost:20443","description":"Local Stacks Node"}],"security":[{"rpcAuth":[]}],"components":{"securitySchemes":{"rpcAuth":{"type":"apiKey","in":"header","name":"authorization","description":"Plain-text secret value that must exactly equal the node's\nconfigured password, which is set as `connection_options.auth_token`\nin the node's configuration file.\n"}},"parameters":{"tip":{"name":"tip","in":"query","schema":{"type":"string","pattern":"^(latest|[0-9a-f]{64})?$","maxLength":64},"description":"Stacks chain tip to query from. Options:\n- (empty/omitted): Use latest anchored tip (canonical confirmed state)\n- `latest`: Use latest known tip including unconfirmed microblocks.\n  If no unconfirmed state is available, falls back to the confirmed canonical tip.\n  If the unconfirmed state check fails with an error, returns 404.\n- `{block_id}`: Use specific block ID (64 lowercase hex characters)\n\n**Note:** If `tip` is present but contains an invalid or malformed value\n(i.e., not `latest` and not a valid 64-character hex block ID),\nthe node silently falls back to the latest anchored tip (same as omitting `tip`).\n"}},"schemas":{"ExecutionCost":{"type":"object","additionalProperties":false,"required":["read_count","write_count","read_length","write_length","runtime"],"properties":{"read_count":{"type":"integer","minimum":0},"read_length":{"type":"integer","minimum":0},"runtime":{"type":"integer","minimum":0},"write_count":{"type":"integer","minimum":0},"write_length":{"type":"integer","minimum":0}}}},"responses":{"BadRequest":{"description":"Bad request","content":{"text/plain":{"schema":{"type":"string"}}}},"Unauthorized":{"description":"Unauthorized. Invalid or missing authentication token.","content":{"text/plain":{"schema":{"type":"string"}}}},"NotFound":{"description":"Not found","content":{"text/plain":{"schema":{"type":"string"}}}},"InternalServerError":{"description":"Internal Server Error","content":{"text/plain":{"schema":{"type":"string"}}}}}},"paths":{"/v3/transactions/simulate":{"post":{"summary":"Simulate a single transaction on top of a chain tip","tags":["Transactions"],"operationId":"transactionSimulate","parameters":[{"$ref":"#/components/parameters/tip"}],"description":"Simulate a single transaction in an ephemeral block built on top of\nthe given chain tip, or the canonical chain tip if the `tip` query\nparameter is omitted (no data is written in the MARF), and return its\nresult, events, and execution cost. The simulation runs with the full\ntenure execution budget, independent of the cost already consumed in\nthe current tenure. The transaction must be fully signed and valid\n(correct nonce, sufficient balance for the fee). The simulation\nenforces the same per-transaction wall-clock and memory limits the\nsigners apply during block proposal validation (the\n`connection_options.block_proposal_max_tx_execution_time_secs`,\n`block_proposal_max_tx_analysis_time_secs`, and\n`block_proposal_max_tx_mem_bytes` options), so a transaction which\nexceeds them fails to simulate.\n\nA `tip` naming a block that does not exist returns 404. A `tip` naming\na block that exists but cannot be simulated by this endpoint (for\nexample an epoch-2.x block) returns 400.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["transaction_hex"],"properties":{"transaction_hex":{"type":"string","minLength":2,"pattern":"^([0-9a-fA-F]{2})+$","description":"SIP-005-encoded transaction in hex format"}}}}}},"responses":{"200":{"description":"Result of the simulated transaction","content":{"application/json":{"schema":{"type":"object","properties":{"txid":{"type":"string","description":"The transaction ID"},"tip_block_id":{"type":"string","description":"The block ID of the chain tip the transaction was simulated on top of"},"consensus_hash":{"type":"string","description":"Consensus hash of the tenure the simulated block would extend"},"block_height":{"type":"integer","description":"Height of the ephemeral block the transaction was simulated in"},"result_hex":{"type":"string","pattern":"^0x([0-9a-fA-F]{2})+$","description":"Clarity value returned by the transaction, encoded as a 0x-prefixed hex string"},"stx_burned":{"type":"integer","description":"Amount of microSTX burned"},"execution_cost":{"$ref":"#/components/schemas/ExecutionCost","description":"Execution cost consumed by the transaction"},"execution_limit":{"$ref":"#/components/schemas/ExecutionCost","description":"The execution limit the simulation ran under (the full tenure budget)"},"events":{"type":"array","items":{"type":"object"},"description":"Events generated by the transaction"},"post_condition_aborted":{"type":"boolean","description":"Whether the transaction was aborted by a post-condition"},"vm_error":{"type":["string","null"],"description":"VM error, if any"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stacks.co/reference/api/stacks-node-rpc/transactions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
