Ethereum
Introduction
The Ethereum (SSV On-Chain) integration aligns with the general Getting Started process, with network-specific parameters highlighted below. parameters and network-specific logic.
Key Ethereum-Specific Details
chain
— always set toeth_ssv
for Ethereum-related requests.network
— specifies the environment (testnet
ormainnet
).stakerAddress
— represents the account address used for staking, unstaking, and withdrawal operations.
Unsigned Transactions — use Ethereum-specific signing logic for unsignedTransactionData
. For details, refer to Transaction Signing.
Quick Steps for Ethereum
Staking Flow
- Create a Stake Transaction: Refer to Create Stake Transaction to send the transaction details.
- Sign and Broadcast Transaction: Use Ethereum-specific signing logic as outlined in Sign and Broadcast transaction.
Unstaking Flow
- Create Withdrawal Transaction: Refer to the Create Withdrawal Transaction section for request structure.
- Sign and Broadcast Transaction: Use Ethereum-specific signing logic as outlined in Sign and Broadcast transaction.
Unified API + Ethereum Integration Workflow
Staking Flow
Step 1. Create Staking Transaction
Send a POST request to https://api-test.p2p.org/api/v1/unified/staking/stake.
Example request:
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
}'
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"
}
}
}
Step 2. Sign and Broadcast transaction
Use unsignedTransactionData
to sign the transaction.
Send a POST request to https://api-test.p2p.org/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": "eth_ssv",
"network": "testnet",
"stakerAddress": "0x3202B5B0602274197CcB22B8c02CEC9539990c7c",
"amount": 32,
"signedTransaction": "AdtQhLeM0eOMdV7rvagYx3V8mra6CMaiVgeNTcgTds8ltjDUwJi3LMGhZ+Txqj26nJMJa7MxFWe5lmIxAnjKsQUBAAIEep+wazhVDEf2XiuHusgypzGMGyd4WaFZ6lzpHIypRJ3qFo72gQoaoUsCAJcUGGTQGdOONNYMBdVbIhEKwGitMwah2BeRN1QqmDQ3vf4qerJVf1NcinhyK2ikncAAAAAABqfVFxjHdMkoVmOYaR1etoteuKObS21cc1VbIQAAAABojzQ55lMuIXx6AWTccH48p4L12JlvUuCfHkOik1nJLAECAwEDAAQFAAAA"
}'
Example response:
{
"error": null,
"result": {
"extraData": {
"transactionId": "2Bno5j3tex8VmcCR2M6JQnjtPxDuqAvSAUjSDpd6gaasRfEQeoWH9MRQdU7ANNtFFbG9UQAGByG1UwPS1qersmyd",
"slot": 307375529,
"signerAccounts": [
"9i5cTqci1W6DHdYfT7WbiNhP5DXvnPNTXvS9fTBFfuSw",
"6GtymMn8cDTy3xHH9AitwP6skbKvBkD53XBE2xSu1tCR",
"11111111111111111111111111111111",
"A93XLdBKfc4pwEMAvdFeyxnF6HauN5erNDFbUsemWiaB",
"Stake11111111111111111111111111111111111111",
"StakeConfig11111111111111111111111111111111",
"SysvarC1ock11111111111111111111111111111111",
"SysvarRent111111111111111111111111111111111",
"SysvarStakeHistory1111111111111111111111111"
],
"createdAt": "2024-12-17T19:41:27.450Z"
}
}
}
Unstaking Flow
Step 1. Create Withdrawal Transaction
Send a POST request to https://api-test.p2p.org/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": "eth_ssv",
"network": "testnet",
"stakerAddress": "0x3202B5B0602274197CcB22B8c02CEC9539990c7c",
"amount": 32,
"signedTransaction": "AdtQhLeM0eOMdV7rvagYx3V8mra6CMaiVgeNTcgTds8ltjDUwJi3LMGhZ+Txqj26nJMJa7MxFWe5lmIxAnjKsQUBAAIEep+wazhVDEf2XiuHusgypzGMGyd4WaFZ6lzpHIypRJ3qFo72gQoaoUsCAJcUGGTQGdOONNYMBdVbIhEKwGitMwah2BeRN1QqmDQ3vf4qerJVf1NcinhyK2ikncAAAAAABqfVFxjHdMkoVmOYaR1etoteuKObS21cc1VbIQAAAABojzQ55lMuIXx6AWTccH48p4L12JlvUuCfHkOik1nJLAECAwEDAAQFAAAA"
}'
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"
}
]
}
}
}
Step 2. Sign and Broadcast Withdrawal Transaction
Sign and broadcast the transaction as outlined above.
What's Next?
Updated 1 day ago