Getting Started
The Strata Protocol lets you effortlessly create and price tokens and token collectives on Solana!
Looking to launch a token? Check out our launchpad at app.strataprotocol.com. The documentation behind the launchpad can be found under the "Launchpad" section of these docs.
Looking to learn more about chat? Chat Docs
Looking to learn more about tokens, systems of tokens, and bonding curves? Read on.
Initializing the SDK
Every smart contract on Strata comes with an SDK. The two main smart contracts are spl-token-collective
and spl-token-bonding
.
Let's get started by installing the sdks
yarn add @strata-foundation/spl-token-collective @strata-foundation/spl-token-bonding
Now, we can initialize the sdks:
import { PublicKey } from "@solana/web3.js"
import * as anchor from "@project-serum/anchor";
import { BN } from "bn.js";
import { SplTokenBonding } from "@strata-foundation/spl-token-bonding";
import { SplTokenCollective } from "@strata-foundation/spl-token-collective";
import { getAssociatedAccountBalance, SplTokenMetadata } from "@strata-foundation/spl-utils";
const provider = anchor.getProvider();
const tokenCollectiveSdk = await SplTokenCollective.init(provider);
const tokenBondingSdk = await SplTokenBonding.init(provider);
const tokenMetadataSdk = await SplTokenMetadata.init(provider);
Creating a Social Token
Live Code
You can run and edit all of the code blocks in this tutorial against Solana devnet! The above block contains all of the needed imports.
Use var
instead of let
or const
so that these blocks can be re-run
Let's create a Social Token named TEST within the Open Collective that gives us 10% of every TEST token minted in royalties.
We can fetch the accounts we just created
Buying a Social Token
To buy a social token, first we should buy into the collective of which that social token is a member. Let's buy 10 Open Collective tokens:
Now, we can buy the social token using our 10 OPEN tokens:
Now we can check the balance:
We can also do the last two steps all at once:
Now check the balance:
We can also sell those tokens
Now check the balance:
Next Steps
Interested in using Strata with React? Checkout our React Examples.
To gain a deeper understanding of the API through examples, check out the Learn pages on