> ## Documentation Index
> Fetch the complete documentation index at: https://docs.p2p.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Sign and Broadcast Transaction

> To complete any staking or withdrawal operation on Story Protocol, sign the unsigned transaction provided by the Staking API and broadcast it to the network.

## 1. Prepare the transaction

Obtain the `unsignedTransaction` object provided by a transaction builder or the relevant Staking API endpoint, e.g., `/staking/stake` or `/staking/withdraw`.

## 2. Sign the transaction

Use the [P2P Signer SDK](/docs/signer-sdk-overview) to sign the unsigned data following protocol specific configuration.

## 3. Send the transaction

Send the signed transaction to the Story network by making a POST request to [/api/v1/story/\{network}/tx/send](/reference/story-transaction-send).

Example request (for `aeneid` network):

<CodeGroup>
  ```bash curl theme={null}
  curl --request POST \
       --url https://api-test.p2p.org/api/v1/story/aeneid/tx/send \
       --header 'Authorization: Bearer <token>' \
       --header 'Content-Type: application/json' \
       --data '{
         "signedTransaction": "<hex_signed_tx>"
       }'
  ```

  ```typescript TypeScript theme={null}
  const response = await fetch("https://api-test.p2p.org/api/v1/story/aeneid/tx/send", {
    method: "POST",
    headers: {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      signedTransaction: "<hex_signed_tx>",
    }),
  });
  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api-test.p2p.org/api/v1/story/aeneid/tx/send",
      headers={
          "Authorization": "Bearer <token>",
          "Content-Type": "application/json",
      },
      json={
          "signedTransaction": "<hex_signed_tx>",
      },
  )
  print(response.json())
  ```

  ```go Go theme={null}
  package main

  import (
  	"bytes"
  	"encoding/json"
  	"fmt"
  	"io"
  	"net/http"
  )

  func main() {
  	payload := map[string]interface{}{
  		"signedTransaction": "<hex_signed_tx>",
  	}
  	body, _ := json.Marshal(payload)
  	req, _ := http.NewRequest("POST", "https://api-test.p2p.org/api/v1/story/aeneid/tx/send", bytes.NewBuffer(body))
  	req.Header.Set("Authorization", "Bearer <token>")
  	req.Header.Set("Content-Type", "application/json")
  	resp, _ := http.DefaultClient.Do(req)
  	defer resp.Body.Close()
  	respBody, _ := io.ReadAll(resp.Body)
  	fmt.Println(string(respBody))
  }
  ```
</CodeGroup>

* `signedTransaction` — signed transaction in the hexadecimal format.

Example response:

<CodeGroup>
  ```json theme={null}
  {
      "result": {
        "transactionId": "0xadcba25d1bcedaa2fd17ff5db6b45d5e7060cf3a3c17e263feebf7b460f742c9",
        "signerAccounts": [
          "0x3202B5B0602274197CcB22B8c02CEC9539990c7c"
        ],
        "createdAt": "2025-07-22T14:08:23.456Z"
      }
    }
  ```
</CodeGroup>

* `transactionId` — hash of the transaction included in the Story Protocol chain.
* `signerAccounts` — list of account addresses that signed the transaction.
* `createdAt` — timestamp of the transaction in the ISO 8601 format.


## Related topics

- [Getting Started](/docs/staking-story.md)
- [Withdrawal](/docs/withdrawal-story.md)
- [Staking API reference](/reference/story-staking-stake.md)
