Getting Started
The Unified API is designed to simplify and standardize interactions across all supported networks. For both staking and unstaking, the process follows a consistent and straightforward flow, ensuring seamless integration for all networks.
This article describes how the Unified API process works in general. To see the detailed staking guides for separate chains and networks, refer to the Networks section.
Each network integration supports three key operations:
stake
: Initiate a staking transaction to delegate the assets.unstake
: Initiate an unstaking transaction, beginning the process of withdrawing the assets.withdraw
: Complete the process by withdrawing the unstaked assets to the wallet.
For each operation, the Unified API returns an unsigned transaction. Thus, the common flow consists of the following steps:
- Transaction Preparation: The API generates a raw unsigned transaction for
stake
,unstake
, orwithdraw
operation. - Transaction Signing: The user signs the transaction using the preferred method of signing. P2P.org also provides separate, detailed transaction signing instructions for various networks.
- Transaction Broadcasting: The user uses the API’s dedicated
broadcast
method to submit the signed transaction to the network.
How it works
Below, a high-level diagram of the process is provided.
- The user initiates an operation (
stake
,unstake
, orwithdraw
) by sending a request to the client system. - Client system issues a POST request to the Unified API, specifying one of four supported actions: stake, send transaction, unstake, or withdraw.
- The Unified API adapter receives the request, validates the parameters and forwards it to the appropriate network-specific API in the required format.
- The network-specific API processes the request and returns a raw response to the Unified API adapter.
- The Unified API adapter processes the raw response, transforming it into a standardized unified format to ensure consistent structure across all supported networks.
General flow
Staking:
- Create a staking transaction by sending a POST request to /api/v1/unified/staking/stake/.
- Sign the transaction, using the chain-specific signing logic .
- Broadcast the signed transaction to the network by sending a POST request to /api/v1/unified/transaction/broadcast.
Unstaking:
- Create an unstaking transaction by sending a POST request to /api/v1/unified/staking/unstake/.
- Sign and send the unsigned transaction the same way as for staking flow.
- Create a withdrawal transaction by sending a POST request to /api/v1/unified/staking/withdraw.
- Sign and send the unsigned transaction to the network.
Note that requests contain network-specific details
While the general process remains consistent, there is the distinction between networks lying in the specific POST request parameters required.
The chain and network mapping table can be found in Overview.
To start using the Unified API, get an authentication token and see the appropriate integration guide from the Networks section.
What's Next?
Updated 1 day ago