The Graph
Unified API + The Graph Integration Workflow
In the following guide, the integration process for the grt
chain is covered. The Graph integration aligns with the general Unified API process but with network-specific parameters.
Get an authentication token to start using the Unified API.
Request examples are provided using cURL.
To check the integration guides for other chains, refer to the Networks section.
Key Graph-specific details
chain
— always set togrt
for Graph-related requests.network
— environment in which the transaction is processed (mainnet
only).stakerAddress
— wallet address initiating staking, unstaking, or withdrawal transactions.amount
— amount of tokens in GRT (minimum: 1 GRT).- Unbonding period: 28 days.
- Only full unstake is supported (the entire delegation is removed, regardless of the passed parameter).
Staking Flow
1. Create Approval Request
Send a POST request to /api/v1/unified/staking/stake.
Example request (for mainnet
network):
curl --request POST \
--url https://api-test.p2p.org/api/v1/unified/staking/stake \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
"chain": "grt",
"network": "mainnet",
"stakerAddress": "0x368f823e4dfe271dc820f4ea14689917bf8e4a21",
"amount": "1",
"extra": {
"operationType": "approve"
}
}'
chain
— blockchain network, always set togrt
for The Graph-related requests.network
— environment in which the transaction is processed (mainnet
only).stakerAddress
— Ethereum-compatible wallet address.amount
— amount of GRT tokens to stake (minimum 1).extra.operationType
— set to"approve"
to approve GRT token transfer.
Example response:
{
"error": null,
"result": {
"amount": 1,
"stakerAddress": "0x368f823e4dfe271dc820f4ea14689917bf8e4a21",
"unsignedTransactionData": "{\"from\":\"0x368F823e4dfe271dc820f4Ea14689917bf8e4a21\",\"gasLimit\":\"0x012bee\",\"to\":\"0x9623063377AD1B27544C965cCd7342f7EA7e88C7\",\"data\":\"0x095ea7b3...\",\"nonce\":13,\"type\":2,\"maxFeePerGas\":\"0x01312d00\",\"maxPriorityFeePerGas\":\"0x00\",\"chainId\":42161}",
"createdAt": "2025-05-29T00:19:57.734Z",
"extraData": {
"transactionId": "d3e006d5-3652-4265-b54b-dcff52753622",
"stakeId": "5eacf5b6-a366-4376-beab-84e50c426a31",
"gasEstimate": {
"amount": "0.000001535640000000",
"gasLimit": "76782"
}
}
}
}
amount
— amount of GRT to approve.stakerAddress
— address initiating the approval.unsignedTransactionData
— unsigned approval transaction in JSON format (EIP-1559).createdAt
— timestamp in ISO 8601 format.extraData.transactionId
— internal transaction identifier.extraData.stakeId
— unique stake session ID.extraData.gasEstimate
— gas usage estimates.
2. Sign and Send Transaction
Use unsignedTransactionData
to sign the transaction.
To broadcast the signed transaction to the Graph network, send a POST request to /api/v1/unified/transaction/broadcast.
Example request:
curl --request POST \
--url https://api-test.p2p.org/api/v1/unified/transaction/broadcast \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
"chain": "grt",
"network": "mainnet",
"signedTransaction": "<signed_approval_tx_hex>",
"stakerAddress": "0x368f823e4dfe271dc820f4ea14689917bf8e4a21",
"extra": {
"transactionId": "d3e006d5-3652-4265-b54b-dcff52753622"
}
}'
chain
— blockchain network.network
— environment in which the transaction is processed.signedTransaction
— signed approval transaction as a hex string.stakerAddress
— address initiating the transaction.extra.transactionId
— transaction ID from the approval response.
Example response:
{
"error": null,
"result": {
"extraData": {
"transactionHash": "0x8592d8d4657b735b3662132c0f7b271f49796a8a716ae81bc448513bcefc880f"
}
}
}
extraData.transactionHash
— approval transaction hash.
3. Create Staking Request
Send a POST request to /api/v1/unified/staking/stake.
Example request (for mainnet
network):
curl --request POST \
--url https://api-test.p2p.org/api/v1/unified/staking/stake \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
"chain": "grt",
"network": "mainnet",
"stakerAddress": "0x368f823e4dfe271dc820f4ea14689917bf8e4a21",
"amount": "1"
}'
chain
— blockchain network.network
— environment.stakerAddress
— address initiating the staking.amount
— amount of GRT to delegate.
Example response:
{
"error": null,
"result": {
"amount": 1,
"stakerAddress": "0x368f823e4dfe271dc820f4ea14689917bf8e4a21",
"unsignedTransactionData": "{\"from\":\"0x368F823e4dfe271dc820f4Ea14689917bf8e4a21\",\"gasLimit\":\"0x01f998\",\"to\":\"0x00669A4CF01450B64E8A2A20E9b1FCB71E61eF03\",\"data\":\"0x026e402b...\",\"nonce\":15,\"type\":2,\"maxFeePerGas\":\"0x014f4420\",\"maxPriorityFeePerGas\":\"0x00\",\"chainId\":42161}",
"createdAt": "2025-05-29T00:28:32.621Z",
"extraData": {
"transactionId": "1a605e71-ecae-4b50-b202-092b163a1b0f",
"stakeId": "2a0269a7-6aeb-42e5-8f46-2f8fb69d48ac",
"gasEstimate": {
"amount": "0.000002843879904000",
"gasLimit": "129432"
}
}
}
}
amount
— amount of GRT to delegate.stakerAddress
— address initiating the staking.unsignedTransactionData
— unsigned staking transaction (JSON, EIP-1559).createdAt
— transaction creation timestamp.extraData.transactionId
— unique transaction ID.extraData.stakeId
— stake operation identifier.extraData.gasEstimate.amount
— estimated transaction fee in ETH.extraData.gasEstimate.gasLimit
— gas limit.
4. Sign and Send Transaction
Use unsignedTransactionData
to sign and send the transaction following the Graph-specific signing logic.
Unstaking Flow
1. Create Unstaking Request
Note: only full unstake is supported (the entire delegation is removed regardless of the amount).
Send a POST request to /api/v1/unified/staking/unstake.
Example request:
curl --request POST \
--url https://api-test.p2p.org/api/v1/unified/staking/unstake \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
"chain": "grt",
"network": "mainnet",
"stakerAddress": "0x368f823e4dfe271dc820f4ea14689917bf8e4a21",
"extra": {
"amount": 1
}
}'
chain
— blockchain network.network
— environment.stakerAddress
— address initiating the unstaking.extra.amount
— amount to unstake (ignored, full unstake will be performed).
Example response:
{
"error": null,
"result": {
"amount": 1,
"stakerAddress": "0x368f823e4dfe271dc820f4ea14689917bf8e4a21",
"unsignedTransactionData": "{\"from\":\"0x368F823e4dfe271dc820f4Ea14689917bf8e4a21\",\"gasLimit\":\"0x01b174\",\"to\":\"0x00669A4CF01450B64E8A2A20E9b1FCB71E61eF03\",\"data\":\"0x4d99dd16...\",\"nonce\":16,\"type\":2,\"maxFeePerGas\":\"0x01de5520\",\"maxPriorityFeePerGas\":\"0x00\",\"chainId\":42161}",
"createdAt": "2025-05-29T00:30:26.502Z",
"extraData": {
"transactionId": "57481121-14fa-4c31-ab29-13b80cf26242",
"stakeId": "7763655a-6e2b-466c-8c9f-997e848a5787",
"gasEstimate": {
"amount": "0.000003478499472000",
"gasLimit": "110964"
}
}
}
}
amount
— amount requested to unstake (actual operation is full unstake).stakerAddress
— address initiating the unstaking.unsignedTransactionData
— unsigned unstake transaction.createdAt
— transaction creation timestamp.extraData.transactionId
— unique transaction ID.extraData.stakeId
— stake operation identifier.extraData.gasEstimate.amount
— estimated transaction fee.extraData.gasEstimate.gasLimit
— gas limit.
2. Sign and Send Transaction
Use unsignedTransactionData
to sign and send the transaction following the Graph-specific signing logic.
3. Create Withdrawal Request
Send a POST request to /api/v1/unified/staking/withdraw.
Example request:
curl --request POST \
--url https://api-test.p2p.org/api/v1/unified/staking/withdraw \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
"chain": "grt",
"network": "mainnet",
"stakerAddress": "0x368f823e4dfe271dc820f4ea14689917bf8e4a21",
"extra": {}
}'
chain
— blockchain network.network
— environment.stakerAddress
— address initiating the withdrawal.
Example response:
{
"error": null,
"result": {
"amount": 1,
"stakerAddress": "0x368f823e4dfe271dc820f4ea14689917bf8e4a21",
"unsignedTransactionData": "{\"from\":\"0x368F823e4dfe271dc820f4Ea14689917bf8e4a21\",\"gasLimit\":\"0x01b174\",\"to\":\"0x00669A4CF01450B64E8A2A20E9b1FCB71E61eF03\",\"data\":\"0x4d99dd16...\",\"nonce\":16,\"type\":2,\"maxFeePerGas\":\"0x01de5520\",\"maxPriorityFeePerGas\":\"0x00\",\"chainId\":42161}",
"createdAt": "2025-05-29T00:30:26.502Z",
"extraData": {
"transactionId": "57481121-14fa-4c31-ab29-13b80cf26242",
"stakeId": "7763655a-6e2b-466c-8c9f-997e848a5787",
"gasEstimate": {
"amount": "0.000003478499472000",
"gasLimit": "110964"
}
}
}
}
amount
— amount to withdraw.stakerAddress
— address initiating the withdrawal.unsignedTransactionData
— unsigned withdrawal transaction.createdAt
— transaction creation timestamp.extraData.transactionId
— unique transaction ID.extraData.stakeId
— withdrawal operation identifier.extraData.gasEstimate.amount
— estimated transaction fee.extraData.gasEstimate.gasLimit
— gas limit.
4. Sign and Send Transaction
Use unsignedTransactionData
to sign and send the transaction following the Graph-specific signing logic.
What's Next?
Updated 1 day ago