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

# Getting Started

> Stake on Monad programmatically with the P2P.org Staking API.

Staking on the Monad network using the Staking API consists of several main steps:

1. Create a delegate request.
2. Sign and send the transaction to the network.

[Get an authentication token](/docs/authentication) to start using Staking API.

Request examples are provided using [cURL](https://curl.se/).

```mermaid theme={null}
sequenceDiagram
    participant Client
    participant P2P API
    participant Blockchain
    Client->>P2P API: Create delegate transaction
    P2P API-->>Client: Unsigned transaction
    Client->>Client: Sign transaction locally
    Client->>P2P API: Broadcast signed transaction
    P2P API->>Blockchain: Submit transaction
    Blockchain-->>P2P API: Transaction hash
    P2P API-->>Client: Transaction status
```

<Steps>
  <Step title="Create delegate request">
    Send a POST request to [/api/v2/monad/\{network}/delegators/\{delegatorAddress}/stakes/delegations](/reference/monad-delegators-create-delegation).

    Example request (for `testnet` network):

    <CodeGroup>
      ```bash curl theme={null}
      curl --request POST \
           --url https://api-test.p2p.org/api/v2/monad/testnet/delegators/0x1234567890abcdef1234567890abcdef12345678/stakes/delegations \
           --header 'accept: application/json' \
           --header 'authorization: Bearer <token>' \
           --header 'content-type: application/json' \
           --data '
      {
        "gas": {
          "priorityPricePerGas": "21000",
          "maxPricePerGas": "1000000000"
        },
        "amount": "1000000000000000000"
      }
      '
      ```

      ```typescript TypeScript theme={null}
      const response = await fetch(
        "https://api-test.p2p.org/api/v2/monad/testnet/delegators/0x1234567890abcdef1234567890abcdef12345678/stakes/delegations",
        {
          method: "POST",
          headers: {
            "accept": "application/json",
            "authorization": "Bearer <token>",
            "content-type": "application/json",
          },
          body: JSON.stringify({
            gas: {
              priorityPricePerGas: "21000",
              maxPricePerGas: "1000000000",
            },
            amount: "1000000000000000000",
          }),
        }
      );
      const data = await response.json();
      console.log(data);
      ```

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

      response = requests.post(
          "https://api-test.p2p.org/api/v2/monad/testnet/delegators/0x1234567890abcdef1234567890abcdef12345678/stakes/delegations",
          headers={
              "accept": "application/json",
              "authorization": "Bearer <token>",
              "content-type": "application/json",
          },
          json={
              "gas": {
                  "priorityPricePerGas": "21000",
                  "maxPricePerGas": "1000000000",
              },
              "amount": "1000000000000000000",
          },
      )
      print(response.json())
      ```

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

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

      func main() {
      	payload := map[string]interface{}{
      		"gas": map[string]interface{}{
      			"priorityPricePerGas": "21000",
      			"maxPricePerGas":      "1000000000",
      		},
      		"amount": "1000000000000000000",
      	}
      	body, _ := json.Marshal(payload)
      	req, _ := http.NewRequest("POST", "https://api-test.p2p.org/api/v2/monad/testnet/delegators/0x1234567890abcdef1234567890abcdef12345678/stakes/delegations", bytes.NewBuffer(body))
      	req.Header.Set("accept", "application/json")
      	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>

    * `delegatorAddress` — delegator address on the Monad network.

    * `amount` — amount of tokens to delegate in Wei (1 MON = 10¹⁸ Wei).

    * `gas` — computational effort required to execute the transaction measured in gas units (optional). If not specified, the values will be set due to the network load.

      * `priorityPricePerGas` — price per unit of gas in Wei, which is added to the EIP-1559 block's base fee. This added fee is used to incentivize validators to prioritize this transaction.
      * `maxPricePerGas` — maximum price per unit of gas this transaction will pay for the combined EIP-1559 block's base fee and this transaction's priority fee in Wei.

    Example response:

    <CodeGroup>
      ```json theme={null}
      {
          "result": {
            "amount": "1000000000000000000",
            "createdAt": "2025-05-06T10:40:00.000Z",
            "delegatorAddress": "0x1234567890abcdef1234567890abcdef12345678",
            "gas": {
              "gasLimit": "260850",
              "priorityPricePerGas": "1000000000",
              "maxPricePerGas": "2000000000"
            },
            "unsignedTransaction": "0x02f8758301e24004...",
            "validatorId": 1
          },
          "error": {}
        }
      ```
    </CodeGroup>

    * `amount` — amount of tokens to delegate in Wei (1 MON = 10¹⁸ Wei).

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

    * `delegatorAddress` — delegator address on the Monad network.

    * `gas` — computational effort required to execute the transaction measured in gas units:

      * `gasLimit` — maximum gas limit for the transaction.
      * `priorityPricePerGas` — price per unit of gas in Wei, which is added to the EIP-1559 block's base fee. This added fee is used to incentivize validators to prioritize this transaction.
      * `maxPricePerGas` — maximum price per unit of gas this transaction will pay for the combined EIP-1559 block's base fee and this transaction's priority fee in Wei.

    * `unsignedTransaction` — unsigned transaction in the hexadecimal format. Sign the transaction and submit it to the blockchain to perform the called action.

    * `validatorId` — ID of the validator to which tokens are delegated.
  </Step>

  <Step title="Sign and send transaction">
    Use `unsignedTransaction` to [sign and send](/docs/signing-transaction-monad) the transaction to the Monad network.

    To check the transaction status, send a GET request to [/api/v2/monad/\{network}/transactions/\{transactionHash}/status](/reference/aptos-transaction-status).

    Example request (for `testnet` network):

    <CodeGroup>
      ```bash curl theme={null}
      curl --request GET \
           --url https://api-test.p2p.org/api/v2/monad/testnet/transactions/0x8d80b8ed85b578eeb873731101a926221701ee48218f6c9b83895f7ac1535641/status \
           --header 'accept: application/json' \
           --header 'authorization: Bearer <token>' \
           --header 'content-type: application/json'
      ```

      ```typescript TypeScript theme={null}
      const response = await fetch(
        "https://api-test.p2p.org/api/v2/monad/testnet/transactions/0x8d80b8ed85b578eeb873731101a926221701ee48218f6c9b83895f7ac1535641/status",
        {
          method: "GET",
          headers: {
            "accept": "application/json",
            "authorization": "Bearer <token>",
            "content-type": "application/json",
          },
        }
      );
      const data = await response.json();
      console.log(data);
      ```

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

      response = requests.get(
          "https://api-test.p2p.org/api/v2/monad/testnet/transactions/0x8d80b8ed85b578eeb873731101a926221701ee48218f6c9b83895f7ac1535641/status",
          headers={
              "accept": "application/json",
              "authorization": "Bearer <token>",
              "content-type": "application/json",
          },
      )
      print(response.json())
      ```

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

      import (
      	"fmt"
      	"io"
      	"net/http"
      )

      func main() {
      	req, _ := http.NewRequest("GET", "https://api-test.p2p.org/api/v2/monad/testnet/transactions/0x8d80b8ed85b578eeb873731101a926221701ee48218f6c9b83895f7ac1535641/status", nil)
      	req.Header.Set("accept", "application/json")
      	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>

    * `transactionHash` — hash of the transaction.

    Example response:

    <CodeGroup>
      ```json theme={null}
      {
          "result": {
            "transactionHash": "0xdef456...789abc",
            "status": "success",
            "blockNumber": 1234567,
            "gasUsed": 21000,
            "createdAt": "2025-05-06T10:40:00.000Z"
          },
          "error": {}
        }
      ```
    </CodeGroup>

    * `transactionHash` — hash of the transaction.
    * `status` — transaction status: `pending`, `success`, `reverted` or `unknown`.
    * `blockNumber` — unique identifier of the block in which the transaction has been included. Only defined if the transaction status is `success` or `reverted`.
    * `gasUsed` — amount of gas spent for the transaction.
    * `createdAt` — timestamp of the transaction in the ISO 8601 format.

    After this transaction has been successfully executed, the delegator starts actively participating in staking through the P2P validator.

    Since the rewards are not auto-compounded, use the separate endpoints to manually [claim](/reference/monad-delegators-claim-rewards) or [compound rewards](/reference/monad-delegators-compound-rewards) to the staked validator.
  </Step>
</Steps>


## Related topics

- [Sign and Broadcast Transaction](/docs/signing-transaction-monad.md)
- [Withdrawal](/docs/withdrawal-monad.md)
- [Staking API reference](/reference/monad-delegators-create-delegation.md)
