Skip to content

thirdweb-example/solana-token-deploy

main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

Solana Token deploy

This project demonstrates how you can create and deploy your own token on the Solana blockchain using thirdweb's Solana SDK.

Tools:

Using This Template

Create a project using this example:

npx thirdweb create --template solana-token-deploy
  • Export your wallet private key from phantom wallet and add it to the .env file.
PRIVATE_KEY=your_private_key

How It Works

Using the thirdweb SDK, you can create and deploy your own token on the Solana blockchain. We use @solana/web3.js package to create a wallet from the private key and pass it into thirdweb to initialize the SDK. Finally, we use the initialised sdk to create and deploy the token.

const sdk = ThirdwebSDK.fromNetwork("devnet");
const keypair = Keypair.fromSecretKey(
  Buffer.from(Bs58.decode(process.env.PRIVATE_KEY))
);
sdk.wallet.connect(keypair);

// Define the metadata for your program
const metadata = {
  symbol: "TOK",
  description: "My token",
  name: "My Token",
  initialSupply: 100,
};

// And deploy a new program from the connected wallet
const address = await sdk.deployer.createToken(metadata);

Next, we use the getToken function to get the token detail and show the total Supply:

const token = await sdk.getToken(address);
const supply = await token.totalSupply();

Join our Discord!

For any questions or suggestions, join our discord at https://discord.gg/thirdweb.

About

Deploy a token program using the TypeScript SDK

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published