Ethereum
Unified API + Ethereum Integration Workflow
In the following guide, the integration process for the eth-ssv
chain is covered. The Ethereum (SSV On-Chain) 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 Ethereum-specific details
chain
— always set toeth_ssv
for Ethereum-related requests.network
— environment in which the transaction is processed (testnet
ormainnet
).stakerAddress
— account address initiating staking, unstaking or withdrawal transactions.
Staking Flow
1. Create Staking Request
Send a POST request to /api/v1/unified/staking/stake.
Example request (for testnet
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": "eth_ssv",
"network": "testnet",
"stakerAddress": "0x3202B5B0602274197CcB22B8c02CEC9539990c7c",
"amount": 32
}'
chain
— blockchain network, always set toeth_ssv
for Ethereum-related requests.network
— environment in which the transaction is processed (testnet
ormainnet
).stakerAddress
— account address initiating the staking transaction.amount
— amount of tokens to stake in ETH.
Example response:
{
"error": null,
"result": {
"amount": "32000000000000000000",
"stakerAddress": "0x3202B5B0602274197CcB22B8c02CEC9539990c7c",
"unsignedTransactionData": "0x02f9023882426880830f42408463aeabb88398968094e9dfc1850110dadf68402ec6ad2b9bdfb79807338901bc16d674ec800000b90204746bd1000100000000000000000000003202b5b0602274197ccb22b8c02cec9539990c7c000000000000000000000000000000000000000000000001bc16d674ec800000000000000000000000000000000000000000000000000000000000000000251c0000000000000000000000003202b5b0602274197ccb22b8c02cec9539990c7c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000e8ffb2afa84510d1814e8d74478b71041c42db7fe128144fdd7a268bf448ba856345ad5b70b23bae824295c393fa1df1d3dcc203112022ca0cfe23b069877d20ea1e5dd64fffec475f7b0d0200182525b28bf76e1e6110ba0db5edd87b39799b7d01bceefe4af93f0a94fac12291a9f0b5b093fb11c220581de0ff2e20f126105918e2b27ed42c9bccda8e949d0bc0ff8be8c4a57741db21c30ff2fefdce7ecf8722ea53db9800d6612c4f0a81a54334b6ab08f52dd6c28f5f363dd5a59a1bab46e2a2fc30bf2c83ae388fa15e0faf4a3d2da85b1b8a180b77906286eaf4443d9e4825a7df8a7cf940000000000000000000000000000000000000000000000000c0",
"extraData": {
"to": "0xE9DfC1850110DadF68402Ec6AD2B9bDfB7980733",
"gasLimit": "10000000",
"data": "0x746bd1000100000000000000000000003202b5b0602274197ccb22b8c02cec9539990c7c000000000000000000000000000000000000000000000001bc16d674ec800000000000000000000000000000000000000000000000000000000000000000251c0000000000000000000000003202b5b0602274197ccb22b8c02cec9539990c7c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000e8ffb2afa84510d1814e8d74478b71041c42db7fe128144fdd7a268bf448ba856345ad5b70b23bae824295c393fa1df1d3dcc203112022ca0cfe23b069877d20ea1e5dd64fffec475f7b0d0200182525b28bf76e1e6110ba0db5edd87b39799b7d01bceefe4af93f0a94fac12291a9f0b5b093fb11c220581de0ff2e20f126105918e2b27ed42c9bccda8e949d0bc0ff8be8c4a57741db21c30ff2fefdce7ecf8722ea53db9800d6612c4f0a81a54334b6ab08f52dd6c28f5f363dd5a59a1bab46e2a2fc30bf2c83ae388fa15e0faf4a3d2da85b1b8a180b77906286eaf4443d9e4825a7df8a7cf940000000000000000000000000000000000000000000000000",
"chainId": 17000,
"type": 2,
"maxFeePerGas": "1672391608",
"maxPriorityFeePerGas": "1000000"
}
}
}
amount
— amount of tokens to stake denominated in Gwei (1 ETH = 10⁻⁹ Gwei)stakerAddress
— staking account address receiving the staked tokens.unsignedTransactionData
— unsigned transaction in Base64 encrypted format. Sign the transaction and submit it to the blockchain to perform the called action.extraData
— additional transaction details:to
— recipient address for this transaction.gasLimit
— maximum gas limit for this block.data
— transaction data.chainId
— chain ID this transaction is authorized on, as specified by EIP-155.type
— EIP-2718 type of this transaction envelope.maxFeePerGas
— 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.maxPriorityFeePerGas
— 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 miners to prioritize this transaction.
2. Sign and Send Transaction
Use unsignedTransactionData
to sign the transaction, following the Ethereum-specific signing logic.
To broadcast the signed transaction to the Ethereum network, send a POST request to /api/v1/unified/transaction/broadcast.
Unstaking Flow
1. Create Withdrawal Request
Send a POST request to /api/v1/unified/staking/withdraw.
Example request (for testnet
network):
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": "eth_ssv",
"network": "testnet",
"stakerAddress": "0x3202B5B0602274197CcB22B8c02CEC9539990c7c",
"amount": 32,
"signedTransaction": "AdtQhLeM0eOMdV7rvagYx3V8mra6CMaiVgeNTcgTds8ltjDUwJi3LMGhZ+Txqj26nJMJa7MxFWe5lmIxAnjKsQUBAAIEep+wazhVDEf2XiuHusgypzGMGyd4WaFZ6lzpHIypRJ3qFo72gQoaoUsCAJcUGGTQGdOONNYMBdVbIhEKwGitMwah2BeRN1QqmDQ3vf4qerJVf1NcinhyK2ikncAAAAAABqfVFxjHdMkoVmOYaR1etoteuKObS21cc1VbIQAAAABojzQ55lMuIXx6AWTccH48p4L12JlvUuCfHkOik1nJLAECAwEDAAQFAAAA"
}'
chain
— blockchain network, always set toeth_ssv
for Ethereum-related requests.network
— environment in which the transaction is processed (testnet
ormainnet
).stakerAddress
— account address initiated the staking transaction.amount
— amount of tokens to unstake in ETH.
Example response:
{
"error": null,
"result": {
"extraData": {
"list": [
{
"serializeTx": "0x02f901ae82426880830f4240830f432c83989680947d5a8de7e3721f6692d88a8d30b9c927fffcdbb480b9018432afd02f000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003083340b237f8f07cc3569b94d66e1c1616c5d96ec1f57c75bb81d824eead70f1aa4ffae2dbb32b7aebe8e6bc9dc40eb9c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000050d000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000005130000000000000000000000000000000000000000000000000000000000000516c0",
"to": "0x7D5a8De7E3721F6692d88A8D30B9C927fffcDBb4",
"gasLimit": "10000000",
"data": "0x32afd02f000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003083340b237f8f07cc3569b94d66e1c1616c5d96ec1f57c75bb81d824eead70f1aa4ffae2dbb32b7aebe8e6bc9dc40eb9c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000050d000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000005130000000000000000000000000000000000000000000000000000000000000516",
"value": "0",
"chainId": 17000,
"type": 2,
"maxFeePerGas": "1000236",
"maxPriorityFeePerGas": "1000000"
}
]
}
}
}
unsignedTransactionData
— unsigned transaction in Base64 encrypted format. Sign the transaction and submit it to the blockchain to perform the called action.extraData
— additional transaction details:to
— recipient address for this transaction.gasLimit
— maximum gas limit for this block.data
— transaction data.chainId
— chain ID this transaction is authorized on, as specified by EIP-155.type
— EIP-2718 type of this transaction envelope.maxFeePerGas
— 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.maxPriorityFeePerGas
— 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 miners to prioritize this transaction.
2. Sign and Send Transaction
Use unsignedTransactionData
to sign and send the transaction following the Ethereum-specific signing logic.
What's Next?
Updated 7 days ago