Solana Devnet Development Tutorials, Guides & Insights
Unlock 3+ expert-curated solana devnet tutorials, real-world code snippets, and modern dev strategies. From fundamentals to advanced topics, boost your solana devnet skills on DeveloperBreeze.
Adblocker Detected
It looks like you're using an adblocker. Our website relies on ads to keep running. Please consider disabling your adblocker to support us and access the content.
Tutorial
javascript nodejs
Tracking Solana Address for New Trades and Amounts
Create a new file called index.js and add the following code to connect to the Solana blockchain:
const solanaWeb3 = require('@solana/web3.js');
// Connect to the Solana Devnet
const connection = new solanaWeb3.Connection(
solanaWeb3.clusterApiUrl('devnet'),
'confirmed'
);
console.log('Connected to Solana Devnet');Aug 09, 2024
Read More Tutorial
javascript nodejs
Tracking Newly Created Tokens on Solana
async function getNewTokens(startSlot) {
try {
const currentSlot = await connection.getSlot();
const signatures = await connection.getConfirmedSignaturesForAddress2(
new solanaWeb3.PublicKey(solanaWeb3.TOKEN_PROGRAM_ID),
{ startSlot, limit: 100 }
);
console.log('Newly Created Tokens:');
for (const signatureInfo of signatures) {
const transaction = await connection.getConfirmedTransaction(signatureInfo.signature);
const transactionInstructions = transaction.transaction.message.instructions;
transactionInstructions.forEach((instruction) => {
if (instruction.programId.equals(solanaWeb3.TOKEN_PROGRAM_ID)) {
const data = Buffer.from(instruction.data);
const command = data.readUInt8(0);
// Command 1 represents the Token Mint To instruction
if (command === 1) {
const mintAccount = instruction.keys[0].pubkey.toBase58();
console.log(`- New Token Mint: ${mintAccount}`);
}
}
});
}
} catch (error) {
console.error('Error fetching new tokens:', error);
}
}
// Replace with the starting slot number
const startSlot = 1000000;
getNewTokens(startSlot);- Token Program ID: The
TOKEN_PROGRAM_IDis used to filter transactions that involve token operations. We're interested in the Mint To instruction, which indicates new token creation. - Fetch Signatures: We fetch the confirmed signatures for transactions involving the SPL Token Program starting from a specified slot.
- Process Instructions: We inspect the transaction instructions to identify those that correspond to the Mint To operation, which indicates token creation.
Aug 09, 2024
Read More Tutorial
javascript bash +2
Building a Simple Solana Smart Contract with Anchor
nano tests/counter.jsAdd the following JavaScript code:
Aug 09, 2024
Read More