> ## 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 Hyperliquid, sign the unsigned transaction provided by the Staking API and broadcast it to the network.

## 1. Prepare the transaction

Retrieve an `unsignedTransaction` object from the relevant API endpoint, e.g., `/staking/transfer`, `/staking/delegate`, `/staking/undelegate`, `/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

Broadcast the signed transaction to the Hyperliquid network by sending a POST request to [/api/v1/hyperliquid/\{network}/transaction/send](/reference/hyperliquid-send).

Example request (for `testnet` network):

<CodeGroup>
  ```bash curl theme={null}
  curl --request POST \
       --url https://api-test.p2p.org/api/v1/hyperliquid/testnet/transaction/send \
       --header 'accept: application/json' \
       --header 'authorization: Bearer <token>' \
       --header 'content-type: application/json' \
       --data '
  {
    "signedTransaction": "string"
  }
  '
  ```

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

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

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

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

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

  func main() {
  	payload := map[string]interface{}{
  		"signedTransaction": "string",
  	}
  	body, _ := json.Marshal(payload)
  	req, _ := http.NewRequest("POST", "https://api-test.p2p.org/api/v1/hyperliquid/testnet/transaction/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 which needs to be broadcasted to the network.

Example response:

<CodeGroup>
  ```json theme={null}
  {
      "result": {
        "createdAt": "2025-10-10T05:28:10.434Z",
        "network": "mainnet"
      },
      "error": {}
    }
  ```
</CodeGroup>

* `createdAt` — timestamp of the transaction in the ISO 8601 format.
* `network` — network name.


## Related topics

- [Staking API reference](/reference/hyperliquid-transfer.md)
