How to upgrade from Solana API v1 to v2 and access new features and better performance.
What's New in Version 2
See the comparison between v1 and v2 in the table below.
Key Points | v1 | v2 |
|---|---|---|
Network | Mainnet, Testnet | Mainnet, Testnet |
Supported | Supported | |
Supported | Supported | |
Supported | Supported | |
Not Officially Supported | Supported Allows us to split stake accounts ahead of deactivating. |
Let's delve into the details for each key point:
1. Stake Intent
➡️ v1
To create a stake intent to delegate funds to a validator.
curl --request POST \
--url https://svc.blockdaemon.com/boss/v1/solana/mainnet/stake-intents \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'X-API-Key: YOUR_KEY' \
--data '
{
"validator_address": "CcaHc2L43ZWjwCHART3oZoJvHLAe9hzT2DJNUpBzoTN1",
"delegator_address": "5xot9PVkphiX2adznghwrAuxGs2zeWisNSxMW6hU6Hkj",
"amount": "1943000000000"
}
'This would return a response below.
{
"stake_intent_id": "stake_intent_Wgx98Rbi8nQuL9ddn3mTk1",
"customer_id": "SatoshiNakamoto-xUYJbPw9hw",
"plan_id": "plan_Wgx98Rbi8nQuL9ddn3mTk1",
"protocol": "solana",
"network": "mainnet",
"solana": {
"stake_id": "stake_Wgx98Rbi8nQuL9ddn3mTk1",
"amount": "100",
"validator_public_key": "0xa1d1ad0714035353258038e964ae9675dc0252ee22cea896825c01458e1807bfad2f9969338798548d9858a571f7425c",
"staking_authority": "5xot9PVkphiX2adznghwrAuxGs2zeWisNSxMW6hU6Hkj",
"withdrawal_authority": "0xa1d1ad0714035353258038e964ae9675dc0252ee22cea896825c01458e1807bfad2f9969338798548d9858a571f7425c",
"stake_account_public_key": "5xot9PVkphiX2adznghwrAuxGs2zeWisNSxMW6hU6Hkj",
"unsigned_transaction": "0x22895118000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120087fed394b43849eebef1e88873cd9efdbe33136656e5148e659b8b2f33625d40000000000000000000000000000000000000000000000000000000000000030b81748644e23c4d950f9dd709f3eb73d5eacd9657997e1d9dde7c4ebd8a6519ecb9d0a7fb603d3b68e023278f9650122000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020010000000000000000000000c509bb854c526af4cee5e037089f7aa8e091d8870000000000000000000000000000000000000000000000000000000000000060b36b79b4b206c0310472c117fa40c05342b5dc3e89f98f42c9da3ce6450d4c603cad55248017fd4eca3ab277cca64569193e4d487f5b2ea78a2bcdc81926c313c05842a3af318967a775783bba22519e8b8886587efa99aa7dab5784f792b187\n",
"expiration_time": 1689939023
}
}➡️ v2
To achieve similar functionality in v2, you would need to change the validator_address to validator_vote_pubkey and updated url.
curl --request POST \
--url https://svc.blockdaemon.com/sia/v2/solana/mainnet/stake-intent \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'X-API-Key: YOUR_KEY' \
--data '
{
"amount": 10000000000,
"validator_vote_pubkey": "CcaHc2L43ZWjwCHART3oZoJvHLAe9hzT2DJNUpBzoTN1",
"delegator_address": "75q6kcecNQhawj1dCmPWhfootfQBnZh7iWnNjoXTJv79"
}
'This would return a response below.
{
"estimated_fee": 1000000000,
"instruction_count": 4,
"metadata": {
"minimum_rent_exemption": 500,
"total_cost": 1500
},
"network": "mainnet",
"stake_account_pubkey": "75q6kcecNQhawj1dCmPWhfootfQBnZh7iWnNjoXTJv79",
"unsigned_transaction": "0x22895118000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120087fed394b43849eebef1e88873cd9efdbe33136656e5148e659b8b2f33625d40000000000000000000000000000000000000000000000000000000000000030b81748644e23c4d950f9dd709f3eb73d5eacd9657997e1d9dde7c4ebd8a6519ecb9d0a7fb603d3b68e023278f9650122000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020010000000000000000000000c509bb854c526af4cee5e037089f7aa8e091d8870000000000000000000000000000000000000000000000000000000000000060b36b79b4b206c0310472c117fa40c05342b5dc3e89f98f42c9da3ce6450d4c603cad55248017fd4eca3ab277cca64569193e4d487f5b2ea78a2bcdc81926c313c05842a3af318967a775783bba22519e8b8886587efa99aa7dab5784f792b187",
"validator_vote_pubkey": "CcaHc2L43ZWjwCHART3oZoJvHLAe9hzT2DJNUpBzoTN1"
}2. Deactivate Intent
➡️ v1
To start the deactivation process for v1. We would calculate the amount a user is requesting and then build one or more transactions to satisfy that request. It would involving deactivation stake accounts and then splitting others.
curl --request POST \
--url https://svc.blockdaemon.com/boss/v1/solana/mainnet/deactivation-intents \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'X-API-Key: YOUR_KEY' \
--data '
{
"amount": "10000000",
"delegator_address": "5xot9PVkphiX2adznghwrAuxGs2zeWisNSxMW6hU6Hkj"
}
'This would return a response below.
{
"deactivate_intent_id": "4ba06e89-8c29-483e-ac36-318de5aa7364",
"customer_id": "SatoshiNakamoto-xUYJbPw9hw",
"protocol": "solana",
"network": "mainnet",
"solana": {
"deactivates": [
{
"unsigned_transaction": "0x22895118000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120087fed394b43849eebef1e88873cd9efdbe33136656e5148e659b8b2f33625d40000000000000000000000000000000000000000000000000000000000000030b81748644e23c4d950f9dd709f3eb73d5eacd9657997e1d9dde7c4ebd8a6519ecb9d0a7fb603d3b68e023278f9650122000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020010000000000000000000000c509bb854c526af4cee5e037089f7aa8e091d8870000000000000000000000000000000000000000000000000000000000000060b36b79b4b206c0310472c117fa40c05342b5dc3e89f98f42c9da3ce6450d4c603cad55248017fd4eca3ab277cca64569193e4d487f5b2ea78a2bcdc81926c313c05842a3af318967a775783bba22519e8b8886587efa99aa7dab5784f792b187\n",
"stake_account_authority": "5xot9PVkphiX2adznghwrAuxGs2zeWisNSxMW6hU6Hkj",
"stake_account_address": "5xot9PVkphiX2adznghwrAuxGs2zeWisNSxMW6hU6Hkj",
"withdrawal_authority": "5xot9PVkphiX2adznghwrAuxGs2zeWisNSxMW6hU6Hkj",
"stake_id": "stake_Wgx98Rbi8nQuL9ddn3mTk1",
"amount": "100",
"expiration_time": 1689939023
}
],
"splits": [
{
"unsigned_transaction": "0x22895118000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120087fed394b43849eebef1e88873cd9efdbe33136656e5148e659b8b2f33625d40000000000000000000000000000000000000000000000000000000000000030b81748644e23c4d950f9dd709f3eb73d5eacd9657997e1d9dde7c4ebd8a6519ecb9d0a7fb603d3b68e023278f9650122000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020010000000000000000000000c509bb854c526af4cee5e037089f7aa8e091d8870000000000000000000000000000000000000000000000000000000000000060b36b79b4b206c0310472c117fa40c05342b5dc3e89f98f42c9da3ce6450d4c603cad55248017fd4eca3ab277cca64569193e4d487f5b2ea78a2bcdc81926c313c05842a3af318967a775783bba22519e8b8886587efa99aa7dab5784f792b187\n",
"stake_account_authority": "5xot9PVkphiX2adznghwrAuxGs2zeWisNSxMW6hU6Hkj",
"new_stake_account_address": "5xot9PVkphiX2adznghwrAuxGs2zeWisNSxMW6hU6Hkj",
"new_stake_id": "stake_Wgx98Rbi8nQuL9ddn3mTk1",
"splitted_stake_account_address": "5xot9PVkphiX2adznghwrAuxGs2zeWisNSxMW6hU6Hkj",
"splitted_stake_id": "stake_Wgx98Rbi8nQuL9ddn3mTk1",
"amount": "100"
}
],
"total_deactivated_amount": "100"
}
}➡️ v2
To start the deactivation process for a particular stake account only.
curl --request POST \
--url https://svc.blockdaemon.com/sia/v2/solana/mainnet/stake-intent \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'X-API-Key: YOUR_KEY' \
--data '
{
"amount": 10000000000,
"validator_vote_pubkey": "CcaHc2L43ZWjwCHART3oZoJvHLAe9hzT2DJNUpBzoTN1",
"delegator_address": "75q6kcecNQhawj1dCmPWhfootfQBnZh7iWnNjoXTJv79"
}
'This would return a response below.
{
"estimated_fee": 5000,
"instruction_count": 3,
"metadata": {
"current_epoch": 620,
"deactivation_epoch": 621,
"was_active": true
},
"network": "mainnet",
"stake_account_pubkey": "75q6kcecNQhawj1dCmPWhfootfQBnZh7iWnNjoXTJv79",
"stake_authority_pubkey": "75q6kcecNQhawj1dCmPWhfootfQBnZh7iWnNjoXTJv79",
"unsigned_transaction": "0x22895118000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120087fed394b43849eebef1e88873cd9efdbe33136656e5148e659b8b2f33625d40000000000000000000000000000000000000000000000000000000000000030b81748644e23c4d950f9dd709f3eb73d5eacd9657997e1d9dde7c4ebd8a6519ecb9d0a7fb603d3b68e023278f9650122000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020010000000000000000000000c509bb854c526af4cee5e037089f7aa8e091d8870000000000000000000000000000000000000000000000000000000000000060b36b79b4b206c0310472c117fa40c05342b5dc3e89f98f42c9da3ce6450d4c603cad55248017fd4eca3ab277cca64569193e4d487f5b2ea78a2bcdc81926c313c05842a3af318967a775783bba22519e8b8886587efa99aa7dab5784f792b187"
}
Note:In v2, we deactivate a singular stake account at a time. The customer decides which one rather than us picking for them.
3. Withdrawal Intent
➡️ v1
To start the withdrawal process for v1 it will automatically identify recently deactivated accounts and use them.
curl --request POST \
--url https://svc.blockdaemon.com/boss/v1/solana/mainnet/withdrawal-intents \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'X-API-Key: YOUR_KEY' \
--data '
{
"amount": "100000000",
"withdrawal_address": "5xot9PVkphiX2adznghwrAuxGs2zeWisNSxMW6hU6Hkj",
"delegator_address": "5xot9PVkphiX2adznghwrAuxGs2zeWisNSxMW6hU6Hkj",
"withdrawal_authority": "5xot9PVkphiX2adznghwrAuxGs2zeWisNSxMW6hU6Hkj"
}
'This would return a response below.
{
"withdraw_intent_id": "4ba06e89-8c29-483e-ac36-318de5aa7364",
"customer_id": "SatoshiNakamoto-xUYJbPw9hw",
"protocol": "solana",
"network": "mainnet",
"solana": {
"withdraws": [
{
"unsigned_transaction": "0x22895118000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120087fed394b43849eebef1e88873cd9efdbe33136656e5148e659b8b2f33625d40000000000000000000000000000000000000000000000000000000000000030b81748644e23c4d950f9dd709f3eb73d5eacd9657997e1d9dde7c4ebd8a6519ecb9d0a7fb603d3b68e023278f9650122000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020010000000000000000000000c509bb854c526af4cee5e037089f7aa8e091d8870000000000000000000000000000000000000000000000000000000000000060b36b79b4b206c0310472c117fa40c05342b5dc3e89f98f42c9da3ce6450d4c603cad55248017fd4eca3ab277cca64569193e4d487f5b2ea78a2bcdc81926c313c05842a3af318967a775783bba22519e8b8886587efa99aa7dab5784f792b187",
"withdrawal_authority_public_key": "5xot9PVkphiX2adznghwrAuxGs2zeWisNSxMW6hU6Hkj",
"stake_account_address": "5xot9PVkphiX2adznghwrAuxGs2zeWisNSxMW6hU6Hkj",
"stake_id": "stake_Wgx98Rbi8nQuL9ddn3mTk1",
"amount": "100000000",
"expiration_time": 1689939023
}
],
"total_withdraw_amount": "100000000"
}
}➡️ v2
To start the withdrawal process for a particular stake account only.
curl --request POST \
--url https://svc.blockdaemon.com/sia/v2/solana/network/withdrawal-intent \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'X-API-Key: YOUR_KEY' \
--data '
{
"delegator_address": "75q6kcecNQhawj1dCmPWhfootfQBnZh7iWnNjoXTJv79",
"stake_account_pubkey": "S1a6ZBwdPmAZ23W3CNR81X9HJiDAgf2Ki3H3LcP4bVv",
"amount": 1000000
}
'This would return a response below.
{
"estimated_fee": 1000000000,
"instruction_count": 4,
"metadata": {
"available_withdraw_amount": 621,
"remaining_balance": 0,
"will_close_account": true
},
"network": "mainnet",
"stake_account_pubkey": "75q6kcecNQhawj1dCmPWhfootfQBnZh7iWnNjoXTJv79",
"unsigned_transaction": "0x22895118000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120087fed394b43849eebef1e88873cd9efdbe33136656e5148e659b8b2f33625d40000000000000000000000000000000000000000000000000000000000000030b81748644e23c4d950f9dd709f3eb73d5eacd9657997e1d9dde7c4ebd8a6519ecb9d0a7fb603d3b68e023278f9650122000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020010000000000000000000000c509bb854c526af4cee5e037089f7aa8e091d8870000000000000000000000000000000000000000000000000000000000000060b36b79b4b206c0310472c117fa40c05342b5dc3e89f98f42c9da3ce6450d4c603cad55248017fd4eca3ab277cca64569193e4d487f5b2ea78a2bcdc81926c313c05842a3af318967a775783bba22519e8b8886587efa99aa7dab5784f792b187",
"withdraw_authority_pubkey": "75q6kcecNQhawj1dCmPWhfootfQBnZh7iWnNjoXTJv79"
}
Note:In v2, we withdraw a singular stake account at a time. The customer decides which one rather than us picking for them.
4. Split Intent
➡️ v2
New to v2, we have a specific endpoint to split stake accounts. This is if you want to deactivate a smaller subset of an existing stake account. You would first perform a split and then have a new stake account you would deactivate.
curl --request POST \
--url https://svc.blockdaemon.com/sia/v2/solana/network/split-intent \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'X-API-Key: YOUR_KEY' \
--data '
{
"amount": 10000000,
"stake_account_pubkey": "75q6kcecNQhawj1dCmPWhfootfQBnZh7iWnNjoXTJv79"
}
'This would return a response below.
{
"estimated_fee": 1000000000,
"instruction_count": 3,
"metadata": {
"minimum_rent_exemption": 500
},
"network": "mainnet",
"new_stake_account_pubkey": "75q6kcecNQhawj1dCmPWhfootfQBnZh7iWnNjoXTJv79",
"stake_account_pubkey": "75q6kcecNQhawj1dCmPWhfootfQBnZh7iWnNjoXTJv79",
"stake_authority_pubkey": "75q6kcecNQhawj1dCmPWhfootfQBnZh7iWnNjoXTJv79",
"unsigned_transaction": "0x22895118000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120087fed394b43849eebef1e88873cd9efdbe33136656e5148e659b8b2f33625d40000000000000000000000000000000000000000000000000000000000000030b81748644e23c4d950f9dd709f3eb73d5eacd9657997e1d9dde7c4ebd8a6519ecb9d0a7fb603d3b68e023278f9650122000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020010000000000000000000000c509bb854c526af4cee5e037089f7aa8e091d8870000000000000000000000000000000000000000000000000000000000000060b36b79b4b206c0310472c117fa40c05342b5dc3e89f98f42c9da3ce6450d4c603cad55248017fd4eca3ab277cca64569193e4d487f5b2ea78a2bcdc81926c313c05842a3af318967a775783bba22519e8b8886587efa99aa7dab5784f792b187"
}