Sign and Broadcast Transaction
To complete any staking or withdrawal operation on Ethereum, sign the unsigned transaction provided by the Pooled Staking API and broadcast it to the network.
1. Prepare the transaction
Retrieve an unsigned serialized transaction from the relevant API endpoint, e.g., /staking/deposit, /staking/unstake or /staking/withdraw.
2. Sign the transaction
Use the P2P Signer SDK to sign the unsigned data following protocol specific configuration.
3. Send the transaction
Broadcast the signed transaction to the Ethereum network by sending a POST request to /api/v1/staking/pool/{network}/transaction/send.
Example request (for hoodi network):
curl --request POST \
--url https://api-test.p2p.org/api/v1/staking/pool/hoodi/transaction/send \
--header 'accept: application/json' \
--header 'authorization: Bearer <token>' \
--header 'content-type: application/json' \
--data '
{
"signedTransaction": "0x02f8b983088bb00e8459682f0084cf5f645482cb2694ba447498dc4c169f2b4f427b2c4d532320457e89872386f26fc10000b844f9609f08000000000000000000000000092af80778ff3c3d27fd2744c39f6e9326d9aaee0000000000000000000000000000000000000000000000000000000000000000c080a0709f764a37d31ed49fa84913082568b241b57a3cc7e660a597868f9d39bb4055a018ce04abc90fcceec21bf084c8966426ad7eda33a1cb541078b8a597ea7340a8"
}'signedTransaction— signed transaction in the hexadecimal format which needs to be broadcasted to the network.
Example response:
{
"error": null,
"result": {
"hash": "0x9945ee6bbbdb7c34565b8833d37d302da9c76d63262d12a36f7c8f822553fa84",
"status": "success",
"blockNumber": 791360,
"transactionIndex": 0,
"gasUsed": "51613",
"cumulativeGasUsed": "51613",
"effectiveGasPrice": "2606634082",
"from": "0x092Af80778ff3c3D27Fd2744C39f6e9326d9AaEe",
"to": "0xba447498DC4c169f2b4f427B2c4D532320457E89"
}
}hash— hash of the Ethereum transaction.status— transaction status:pending,confirmed, orfailed.blockNumber— block number in which the transaction has been included;nullif the transaction has not been confirmed yet.transactionIndex— value of the position of the transaction in the block in which it has been included.gasUsed— amount of gas spent for the transaction.cumulativeGasUsed— total amount of gas used by all transactions in a block up to this transaction.effectiveGasPrice— actual price per gas unit.from— sender address of this transaction.to— recipient address for this transaction.
What's next?
- Getting Started
- Withdrawal
- Pooled Staking API reference
Updated 8 days ago