Skip to main content

Getting Started

The Strata Protocol lets you effortlessly create tokens and networks of Tokens (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 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";

anchor.setProvider(anchor.Provider.local());
const provider = anchor.getProvider();

const tokenCollectiveSdk, tokenBondingSdk, tokenMetadataSdk;
async function getPrograms() {
tokenCollectiveSdk = await SplTokenCollective.init(provider);
tokenBondingSdk = await SplTokenBonding.init(provider);
tokenMetadataSdk = await SplTokenMetadata.init(provider);
return {
tokenCollectiveSdk,
tokenBondingSdk,
tokenMetadataSdk
}
}
getPrograms().catch(console.error);

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.

Loading...

We can fetch the accounts we just created

Loading...

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:

Loading...

Now, we can buy the social token using our 10 OPEN tokens:

Loading...

Now we can check the balance:

Loading...

We can also do the last two steps all at once:

Loading...

Now check the balance:

Loading...

We can also sell those tokens

Loading...

Now check the balance:

Loading...

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