Prepare now for the Solana Agave 2.0 upgrade
The Solana Agave 2.0 upgrade is just around the corner, and Chainstack is fully prepared to support you through this major release! This is more than just an upgrade—it’s a significant step in enhancing the decentralization, security, and performance of the Solana blockchain. As a Web3 developer, here’s everything you need to prepare for a seamless transition.
Why Solana Agave 2.0 matters?
Agave, the new Rust-based client for Solana, is designed to bolster network resilience by moving toward a multi-client structure. Alongside Agave, Solana is introducing the C-based Firedancer client. Together, these clients will decentralize and strengthen the network, requiring all nodes to transition to Agave v2.0 by October 21, 2024.
The Agave 2.0 upgrade affects various API methods, phasing out older methods and replacing them with optimized ones. This shift aims to minimize any potential disruptions, with backward-compatible replacements already widely available.
Key changes to prepare for
If you’re using any of the following deprecated API methods, now is the time to update your calls to ensure compatibility with Agave 2.0:
Deprecated method | Replacement method |
---|---|
confirmTransaction | getSignatureStatuses |
getSignatureStatus | getSignatureStatuses |
getSignatureConfirmation | getSignatureStatuses |
getConfirmedSignaturesForAddress | getSignaturesForAddress |
getConfirmedBlock | getBlock |
getConfirmedBlocks | g e tBlocks |
getConfirmedBlocksWithLimit | getBlocksWithLimit |
getConfirmedTransaction | getTransaction |
getConfirmedSignaturesForAddress2 | getSignaturesForAddress |
getRecentBlockhash | getLatestBlockhash |
getFees | getFeeForMessage |
getFeeCalculatorForBlockhash | isBlockhashValid or getFeeForMessage |
getFeeRateGovernor | getFeeForMessage |
getSnapshotSlot | getHighestSnapshotSlot |
getStakeActivation | getAccountInfo | Solana (alternative approach) |
How to replace confirmTransaction
with getSignaturesStatuses
?
To replace the deprecated confirmTransaction
method with its getSignaturesStatuses
replacement, you can use the following:
import { Connection, Transaction, SendOptions } from '@solana/web3.js';
async function sendAndConfirmTransaction(
connection: Connection,
transaction: Transaction,
timeout: number = 30000, // 30 seconds default timeout
options?: SendOptions
): Promise<string> {
// Send the transaction
const signature = await connection.sendTransaction(transaction, options?.signers || [], {
...options,
skipPreflight: options?.skipPreflight || false
});
// Create a promise that will reject after the timeout
const timeoutPromise = new Promise((_, reject) => {
setTimeout(() => {
reject(new Error(`Transaction confirmation timeout after ${timeout}ms`));
}, timeout);
});
// Create the confirmation promise
const confirmationPromise = (async () => {
let done = false;
while (!done) {
// Get the status of the transaction
const response = await connection.getSignatureStatuses([signature]);
const status = response.value[0];
if (status) {
if (status.err) {
throw new Error(`Transaction failed: ${status.err.toString()}`);
}
// Check if we have enough confirmations
if (status.confirmationStatus === 'finalized') {
done = true;
return signature;
}
}
// Wait a bit before checking again
await new Promise(resolve => setTimeout(resolve, 1000));
}
})();
// Race between timeout and confirmation
try {
return await Promise.race([confirmationPromise, timeoutPromise]);
} catch (error) {
// If it's a timeout error, we should still return the signature
if (error.message.includes('timeout')) {
return signature;
}
throw error;
}
}
// Example usage
async function example() {
const connection = new Connection('CHAINSTACK_NODE');
const transaction = new Transaction();
// ... add your transaction instructions here ...
try {
const signature = await sendAndConfirmTransaction(connection, transaction, 60000, {
skipPreflight: false,
// ... other options
});
console.log('Transaction confirmed:', signature);
} catch (error) {
console.error('Transaction failed:', error);
}
}
Chainstack: Ready for Agave 2.0
At Chainstack, we’ve ensured that your infrastructure is fully prepared for Agave 2.0, offering you a smooth and uninterrupted transition:
- Seamless transition: Chainstack services are ready and fully compatible with Agave 2.0.
- Enhanced security: Benefit from Agave’s multi-client architecture, designed to increase decentralization and security.
- Optimized performance: Transitioning to updated API methods means faster and more reliable interaction with the Solana network.
To get ready for Agave 2.0, review the Agave v2.0 transition guide and adjust your API calls as needed. Our support team is on standby to assist, ensuring this transition is as seamless as possible for you.
Further reading
- How Chainstack supports high-performance trading on Solana: Learn how Solana Trader nodes ensure 100% landing rates with Priority Fees support and integrate them.
- Solana reloaded and next gen RPCs: Explore our massive Solana infrastructure update to optimize latency, coverage, and speed for Global Elastic Nodes.
- How to use Program Derived Addresses: Learn how to use Program Derived Addresses for state management in Solana, their benefits, creation process, and practical applications.
- How to calculate transaction fees programmatically: Get to know Solana’s deterministic fee model and learn how to calculate transaction fees programmatically to optimize your project.
- How to retrieve historical data effectively: Learn how to retrieve historical data on Solana effectively, using transaction replay, Geyser plugins, 3rd-party services, and others.
- Master guide to troubleshooting common development errors: Learn how to tackle common Solana errors like Rust version conflicts, Borsh serialization, blockstore errors, and more.
- How to overcome the 1000 transaction limit: Learn to handle Solana’s 1000 transaction limit with getSignaturesForAddress. Use pagination and recursion to fetch large transaction lists.
- What is the right transaction commitment level: Get to know what transaction commitment levels are on Solana and how to make the right choice when it comes to your use case.
- The ultimate Solana developer guide: Master Solana development all across the board with this ultimate guide, covering everything from pastable snippets to advanced integrations.
Bringing it all together
The Solana Agave 2.0 upgrade is a crucial step forward for the network, and at Chainstack, we’re ensuring that you can harness its full potential without any disruptions. By aligning our infrastructure with the Agave 2.0 upgrade, we’re giving you the tools you need to continue building scalable, secure, and high-performance DApps on Solana.
Stay informed, stay ahead, and build the future of Web3 together with Chainstack and Solana Agave 2.0.
Power-boost your project on Chainstack
- Discover how you can save thousands in infra costs every month with our unbeatable pricing on the most complete Web3 development platform.
- Input your workload and see how affordable Chainstack is compared to other RPC providers.
- Connect to Ethereum, Solana, BNB Smart Chain, Polygon, Arbitrum, Base, Optimism, Avalanche, TON, Ronin, zkSync Era, Starknet, Scroll, Aptos, Fantom, Cronos, Gnosis Chain, Klaytn, Moonbeam, Celo, Aurora, Oasis Sapphire, Polygon zkEVM, Bitcoin, Tezos and Harmony mainnet or testnets through an interface designed to help you get the job done.
- To learn more about Chainstack, visit our Developer Portal or join our Discord server and Telegram group.
- Are you in need of testnet tokens? Request some from our faucets. Multi-chain faucet, Sepolia faucet, Holesky faucet, BNB faucet, zkSync faucet, Scroll faucet.
Have you already explored what you can achieve with Chainstack? Get started for free today.