> ## 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.

# Graph Transaction Signing

> Sign and broadcast Graph transactions built with the P2P.org Unified API.

To sign and broadcast the transaction to the Gprah network, follow these steps:

1. Prepare <Tooltip tip="A transaction that must be signed and broadcasted to the blockchain network.">unsigned transaction</Tooltip> in JSON format. Obtain the `unsignedTransactionData` field from the Unified API (staking, approval, unstake, or withdrawal). This field contains the full **EIP-1559** transaction as a JSON string.

2. Sign the transaction using the following code:

<CodeGroup>
  ```javascript theme={null}
  import { ethers } from 'ethers';

  // Replace with your wallet mnemonic and Arbitrum RPC URL
  const MNEMONIC = '<YOUR_MNEMONIC>';
  const RPC_URL = '<ARBITRUM_RPC_URL>'; // e.g., https://arb1.arbitrum.io/rpc
  const UNSIGNED_TX_JSON = `<UNSIGNED_TRANSACTION_DATA_FROM_API>`; // Stringified JSON from API

  async function main() {
      if (!UNSIGNED_TX_JSON || UNSIGNED_TX_JSON.length < 10) {
          throw new Error("❌ UNSIGNED_TX_JSON is missing or invalid.");
      }

      // Parse the unsigned transaction data
      const txData = JSON.parse(UNSIGNED_TX_JSON);

      // Set up provider and wallet
      const provider = new ethers.providers.JsonRpcProvider(RPC_URL);
      const wallet = ethers.Wallet.fromMnemonic(MNEMONIC).connect(provider);

      // Prepare the EIP-1559 transaction
      const tx: ethers.providers.TransactionRequest = {
          from: txData.from,
          to: txData.to,
          data: txData.data,
          nonce: txData.nonce,
          gasLimit: ethers.BigNumber.from(txData.gasLimit),
          maxFeePerGas: ethers.BigNumber.from(txData.maxFeePerGas),
          maxPriorityFeePerGas: ethers.BigNumber.from(txData.maxPriorityFeePerGas),
          chainId: txData.chainId,
          type: txData.type, // 2 for EIP-1559
      };

      // Sign the transaction (returns raw transaction hex)
      const signedTx = await wallet.signTransaction(tx);

      console.log("✅ Signed The Graph (Arbitrum) Tx (hex):");
      console.log(signedTx);
  }

  main().catch(console.error);

  ```
</CodeGroup>

Upon successful execution, the script prints the signed transaction in hexadecimal format, ready to be broadcasted:

<CodeGroup>
  ```bash theme={null}
  ✅ Signed The Graph (Arbitrum) Tx (hex): 0x...

  ```
</CodeGroup>

3. Broadcast the transaction to the Graph network by sending a POST request to [/api/v1/unified/transaction/broadcast](/reference/unified-transaction-send).


## Related topics

- [Networks Supported](/docs/unified-api-networks.md)
- [Getting Started](/docs/unified-api-getting-started.md)
- [Unified API Reference](/reference/unified-create-stake-transaction.md)
