Skip to main content

Β· 10 min read
Noah Prince

Splash

Automated Governance on your Anchor Programs

Have you been deploying your programs with solana program deploy with deploy keys on your local file system? While it works for prototyping, it's not great for a production program on mainnet that's holding real money.

Local file system deploy keys are a security risk. If your computer is compromised, a hacker could take the deploy keys and do whatever they want with your program; including siphon all funds stored in or owned by the program.

Multisigs are great for simplicity, but with governance you can transfer voting shares around. You can also change the voting settings as the project evolves. It's also got a nifty UI!

In addition to the security risks of deploying locally, there's also several risks associated with manually deploying to mainnet, including:

  • Accidentally deploying dev code to mainnet because you ran the wrong command
  • Updating the program but not the IDL
  • Forgetting to publish a verified build
  • Inconsistency with your git repository and what's deployed, making debugging difficult.

Let's instead set up automation so we get something like this:

Governance on Mainnet

By the end of this guide, we'll set up automation such that when you issue a release on github, you'll get a Governance proposal to deploy the contract. All you need to do is vote yes on the proposal, then execute the transaction. For devnet, you'll get a new proposal every time the rust code changes on master.

note

Do this in devnet before you try it on mainnet

In this guide, we're going to:

  • Issue governance voting shares
  • Setup SPL Governance around an Anchor Program
  • Deploying a program using governance without CI/CD
  • Automate program deployments using CI/CD
  • Setup Anchor Verifiable Builds

Issue Govenance Voting Shares

Governance works by creating and executing proposals to upgrade the program. These proposals are voted on by governance token holders. In a simple case, the governance token holders may just be the founders of the company. If all hold an even number of tokens, this acts like a multisig.

Let's issue a governance token. We're going to use Metaplex spl-token-metadata to asssociate a name and symbol with our governance token, so it's easy to use in wallets. You can edit the name and symbol in createMetadata to name your own token.

import { ASSOCIATED_TOKEN_PROGRAM_ID, Token, TOKEN_PROGRAM_ID, u64 } from "@solana/spl-token";
import { Connection, Keypair, sendAndConfirmTransaction, SystemProgram, Transaction } from '@solana/web3.js';
import { createMetadata, Data } from "@strata-foundation/spl-utils";
Loading...

Take note of the mint address above. Mine was "65uCXAukbwXFMUdT75SjmBfr6HhFL4h17QtzsM5MdmLD"

Change your wallet network to devnet. If you check your wallet, you should see our test governance token. After you're done with this guide, you can send it to anyone you'd like.

Wallet

Setup SPL Governance

First, to setup governance we must have deployed the anchor program once. If you haven't yet, run

anchor build
solana program deploy ./target/deploy/<YOUR_PROGRAM>.so -u devnet

You'll also want to init the idl:

anchor idl init <YOUR_PROGRAM_ADDRESS> --filepath target/idl/<YOUR_PROGRAM>.json --provider.cluster devnet

Since you likely deployed with a local deploy key, you will want to temporarily transfer the authority to your current web wallet.

caution

This command cannot be undone without the new upgrade authority signing off. Make absolute sure your wallet address is correct here.

solana program set-upgrade-authority -u devnet <PROGRAM_ADDRESS> --new-upgrade-authority <YOUR_WALLET_ADDRESS>

Now we will need to create a realm. Navigate to: https://realms.today/realms?cluster=devnet

Once you connect your wallet, you should be able to click Create Realm:

Add Realm

You'll want to choose the second option, as bespoke realm:

Bespoke Realm

Fill out this form with your mint from earlier as the community mint id:

Realm Form

You should be taken to a new page. This is your realm page. Bookmark this.

Deposit your governance tokens using the deposit button

Now, we're going to add our program. Click the plus button next to assets to add a program asset:

Add Asset

Fill out your program information. You can also fill out voting threshold information:

Create New Program Governance

Deploy Your First Update

Deploying with governance works in two steps. First, we'll write a buffer to Solana. Then, we'll create a Proposal to deploy that buffer. This allows us to separate building from signing to deploy.

solana program write-buffer /path/to/your/deploy/contract.so -u devnet

This write buffer will be owned by you, so let's transfer it to your governance. To get the governance id, click your program under "Assets" then click Upgrade:

Upgrade

You should see Upgrade Authority. Copy that to clipboard

Gov ID

solana program set-buffer-authority <YOUR_BUFFER_FROM_ABOVE> --new-buffer-authority <GOVERNANCE_ID_FROM_CLIPBOARD> -u devnet

Now that we've deployed our buffer, let's propose an upgrade to our contract. Input your buffer from above into the upgrade form

Upgrade Form

Once you've created your proposal, you will be able to vote on it like so:

Vote Yes

Once the vote passes, click on the instructions drop down and scroll down to execute:

Execute

Done!! Now you've succesfully deployed your first program using SPL Governance!

CI/CD - Automation

If you're like me, you're probably thinking: "this could use some automation."

Yup. Let's set this up.

First, let's transfer the IDL to governance:

caution

This command cannot be undone without the new authority signing off. Make absolute sure the governance address is correct here

Gov ID

Make sure you're using this address, and double check it in the explorer to make sure it's owned by the governance program.

anchor idl set-authority --provider.cluster devnet --program-id <PROGRAM_ADDRESS> --new-authority <GOVERNANCE_ID>

Secrets

We'll need two github secrets

  • DEPLOY_KEYPAIR - A keypair that we will use to deploy buffers. This won't have permission to change the program, but we will need to load it with SOL to write the buffers.
  • ANCHOR_TOKEN - The authentication token for anchor.projectserum.com

To add a secret, navigate to Settings > Secrets in github:

Creating a Secret

First, head over to https://anchor.projectserum.com/ and sign up for an account. This is where we'll post our verified builds.

Click your Profile in the top right > Account Settings > New Token. Create a token for CI/CD. It will say:

anchor login <ANCHOR_TOKEN>

Copy that down. Fill that in for ANCHOR_TOKEN

Next, let's generate a keypair for deploys:

solana-keygen new -o deploy.json

Now cat that file and copy its contents and fill that in for DEPLOY_KEYPAIR

cat deploy.json

Deploy Wallet

We need to set this deploy wallet up with permissions to create proposals and write buffers. First, it will need some SOL:

Get the address:

solana address -k deploy.json

Now airdrop some sol to it (run this a few times). On mainnet, you will need to fund this wallet:

solana airdrop -u devnet 2 <DEPLOY_ADDRESS>

You may want to store the deploy key somewhere safe. Now delete that file so it cannot be compromised:

rm deploy.json

Now, go back to the govenance UI and withdraw your tokens. You will need to send 1% of them to the deploy wallet so that it can create proposals.

Now, we need to deposit those voting tokens. You can add the deploy to your wallet in phantom via "Add / Connect Wallet" > "Import private key". Re-visit your realm page using this wallet and deposit the tokens.

Github Actions

You'll want to setup github actions for your repo. Strata has two main workflows relating to this:

  • Devnet Proposal - When a commit is pushed to master, if the rust contracts have changed, create a proposal to devnet governance to release the new version
  • Mainnet Proposal - When a github release happens, if the rust contracts have changed, create a proposal to mainnet governance to release the new version

To get these in your repo, you'll want to clone https://github.com/StrataFoundation/strata

You will need to copy and edit the variables in:

  • .github/workflows/devnet-proposal.yaml - When a commit is pushed to master, if the rust contracts have changed, create a proposal to devnet governance to release the new version. Make sure to set governance to the dev governance address we got from the Upgrade Form.
  • .github/workflows/mainnet-proposal.yaml - When a github release happens, if the rust contracts have changed, create a proposal to mainnet governance to release the new version. Make sure to set governance to a production governance, you will need to follow the above steps on mainnet after you verify it works on devnet.

In particular, make sure there's an entry for each program, and that you set program, program-id, network, keypair, governance, name, description. If signatory is set, that account must "sign off" on the proposal to get it out of draft stage.

These workflows rely on some actions that you will probably not need to edit, but will need to copy:

  • .github/actions/anchor-publish - Action that publishes your anchor contract to Anchor Verified Builds.
    • If you do not want to do this, simply comment out this action in .github/workflows/mainnet-proposal.yaml
  • .github/actions/upload-bpf - Action that builds your smart contract and uploads it to solana via write-buffer
  • .github/actions/create-proposal - Uses a script we wrote to create a governance proposal to set your program to the one deployed via upload-bpf
  • .github/actions/deploy-with-gov-proposal - Execute upload-bpf then create-proposal, only if a proposal hasn't been created for this action.
  • .github/actions/setup - General setup
  • .github/actions/setup-anchor - Setting up anchor cli
  • .github/actions/setup-solana - Setting up solana cli

Test It

Create a fork of your repository. These hooks only run on the master branch, so you'll want to use a forked version of your repo until you get them stable.

Add the secrets to this fork, then push these actions to master. Go to the "Actions" tab on github and watch them go:

Actions

If it succeeds, you should be able to go to your realm and see the proposal!

Vote in Progress

Congrats! You're now running program governance on auto-pilot!

To test mainnet proposals, click the releases button on the side of your github repo. Draft a new release and publish it. Then go to the actions tab and make sure it runs successfuly.

Stuck?

There's a lot of steps in this process, it's easy for a misstep. If you're having trouble debugging, you can come join us in the Strata discord and we'll do our best to help you out:

Want to see more like this?

We'll be posting tips and tricks as we solve problems ourselves. If you're interested in launching a token or token(s), let us know! We can help with that too!

Β· 6 min read
Noah Prince
Bryan Zettler

Open Collective

The Open Collective

If you're not familiar with Strata, you can read more about the protocol here

A collective is for like minded creators that want to pool resources and bond their directional success to others. Collectives also allow fans to take directional positions on the success of groups or categories rather than individuals alone. Viewed through this lens, collectives can be seen as idea indices.

The Open Collective (OPEN) is the default collective on Strata. When a token is created without a collective or base mint specified, the default is to place that token into the Open Collective.

While some collectives can be exclusive, requiring permission to join, the Open Collective allows anyone to join. The Open Collective also takes no fees or royalties.

The Open Collective is truly decentralized. We, the Strata Team, get no cut of the OPEN token. We believe that taking a cut would stifle innovation.

Anatomy of the Open Collective

  • Token. This is the OPEN token. Every member of the collective will be bonded to it via a Bonding Curve
  • Bonding curve. Users can quickly purchase OPEN tokens using the SOL/OPEN bonding curve. The price is a function of the current supply.
    • Royalties. OPEN has no royalties on buy/sell through the bonding curve.
  • Exclusivity. The OPEN collective allows anyone to bind their token to OPEN and join the collective. It does not require sign off for new members
  • Configuration.
    • Limited royalties on sell: Users cannot set sell royalties unreasonably high, devaluing the token.
    • Unclaimed Token Settings
      • Symbol: UNCLAIMED
      • Social Token royalties on buy: 5%
      • All royalties are owned by the person who claims this token

Why buy OPEN?

Applications like Wum.bo use the Open Collective to make it possible to create tokens in one-click for users that have yet to join the platform.

As Wum.bo expands, OPEN-based tokens will be created for a variety of social media accounts, including Twitter.

The Community

Ultimately, the decision to buy OPEN is an investment in the community that will form around the Open Collective. It is backing every creator and unclaimed token that is based on the Open Collective.

No fees

The OPEN collective takes no fees. This means that, while you are still exposed to risk in fluctuating price, it costs nothing but the Solana transaction fees to get OPEN tokens.

This also makes the open collective a good choice for a creator that wants a social token, as there is no middle-man taking a cut.

The hope is that the Open Collective pushes future collectives to innovate. If a collective is going to pool resources in the form of royalties, it should offer something in return. That might mean building a website, setting up a storefront, or just riding on the network effects of a strong collective.

Network Effects

Creators can use the Open Collective to join an existing, established network. As the network of open collective improves its value, the value of every individual social token in the network is improved.

Trust

The Open Collective limits royalties on token sales. This keeps the authority on a token from completely devaluing the token for all holders. While OPEN tokens do still carry risk, the risk is in token holders selling and not necessarily changes from the authority.

The Open Collective ensures that all unclaimed tokens follow a similar, fairly shaped bonding curve. It also ensures that royalties are set aside to incentivize the token's owner to claim the token.

Access

Buying OPEN will allow you to buy the social tokens of anyone within the open collective

OPEN Risks

OPEN is just one of many collectives that will form on Strata. It has a distinct advantage in that it is the default collective, but it is also not being managed as an organization.

No fees

No royalties means that the Open Collective has no treasury. The Open Collective is not an organization. It will not provide services because it does not have funds to do so.

Members of the collective may choose to provide services because they are incentive aligned with the Open Collective.

No Team

Neither the Wum.bo team nor the Strata team own, or are taking any share of the Open Collective. As such, the Open Collective is not backed by a team. While the community that forms around the Open Collective will drive it forward because of the incentive alignment; there is no core team.

OPEN is a truly decentralized utility token.

OPEN in no way represents ownership in Strata or Wum.bo

The teams of both Strata and Wum.bo want to see the Open Collective succeed because they want to see the entire protocol succeed. They want to drive value into this newly forming economy. Neither team, however, will ever pick sides or choose winners amongst collectives.

Collective Movement

While not currently supported, the goal is to allow free movement of ones token from one collective to another. This ability may hurt or help the open collective. This will lead to higher competition between collectives. This could either drive users back to the Open Collective, if other Collectives fail to deliver. Or it could drive users away from the Open Collective, as other collectives that take royalties provide greater utility.

OPEN Fair Launch

The OPEN token will launch on a bonding curve with the formula

P=cβˆ—SkP = c * S^k

Choices for k and c have not yet been finalized

This plot visualizes the formula when c=1c = 1 and k=0.5k = 0.5

Visualization

Reward Early Adopters, not Bots

The curve above rewards whoever gets their transactions through first on launch day. In practice, that will be bots.

The solution to this is to have a curve that changes shape over time. All day-1 buyers get the same price. The bots had no advantage in getting their transactions through sooner, as they received the same price as everyone else.

Launch Day

After day 1, the curve begins to steepen:

Launch Day

Over time, the curve steepens to its final shape:

Final Curve Shape

Β· 6 min read
Noah Prince
Bryan Zettler

Strata is a social token protocol that makes it possible to build and monetize tokenized economies around a person, idea, or collective. Powered by Solana, it is the fastest and least expensive way to launch a token. After months in development, the Strata protocol was officially open sourced today. We owe a big thanks to the Wum.bo community and the Solana community for helping us get here. Get started here

Strata Social Tokens unlock local economies around individuals while Strata Collectives make it possible to pool resources and structure incentive models around networks of social tokens. The combination of these composable token mechanisms will fuel not only the Creator Economy, but will unlock a new Cooperation Economy that compounds the value of social token networks. Strata has the potential to upend entrenched, royalty-seeking business models which have taxed creators for decades and unlock a wider design space for social tokens.

Strata’s mission is simple: make it radically easier for people to coordinate social communities. The definition of community is up to you. Whether that means creating a community exclusively for your fans, building a membership-based record label, integrating social tokens into an existing network, or building local chapters within divisions for an international organization β€” the decision is yours to create.

Strata is for creators, builders, and entrepreneurs who seek to integrate tokens, and novel experiences around tokens, at the heart of their communities. No project is too big or too small β€” social tokens should be, and will be, everywhere. In addition to unlocking social tokens on Solana, Strata makes it incredibly easy and inexpensive to launch and experiment with them.

How Does Strata Work?

Social tokens are tokens typically associated with an individual, idea, project, or community. There are many flavors of social tokens but they typically provide access, status, and utility related to the individual they represent. Strata takes this idea further and provides a new way to bundle social token networks into collectives, which are networks of social tokens bound by a common collective token.

In addition to simple minting, Strata natively leverages automated market makers and bonding curves to guarantee liquidity for its tokens. If done right, there will be a long tail representing millions of social tokens powered by Strata. This ensures that there will always be a market for them.

Using Strata, creators can create, manage and build social tokens in just a few clicks. These tokens can be bound to SOL, USDC, or a collective.

Collectives are a new approach for like-minded creators to monetize the efforts of group cooperation. Collectives allow participants to pool resources under their collective token which is bound to their network of social tokens. They allow a community or business to structure incentive models designed to increase the value of the collective as a whole, in tandem with the efforts of individuals. Creators can join collectives by basing their tokens in the native collective token at the point of creation. Collective creators have the ability to make collectives open or closed.

Collectives allow fans and communities to take directional positions for the success of ideas, groups, or categorizes. Viewed through this lens, Collectives can be seen as an index for ideas. Imagine a group of artists forming a collective and working in partnership to create a custom marketplace for their genre. Or perhaps a Decentralized Autonomous Organization (DAO) formed by an organization of contributors with their individual tokens bound to the DAO token. Collectives are a way to form economies around ideas, and to seamlessly integrate Strata Protocol into your business model.

The first social token collective on Strata is the Open Collective (OPEN). The Open Collective was built to serve as the default collective for all social tokens issued on Strata, unless a creator specifically wishes to bond their tokens to SOL, USDC, or a new collective instead. The Open Collective serves as a springboard for creators and projects to get started quickly.

An example of one such project is Wum.bo, which was also developed by the Strata community. Wum.bo is a social token platform built on Strata that makes use of the Open Collective. It brings social tokens directly into social networks (Twitter, Twitch, Reddit, etc.) and makes it possible to see the economy surrounding an individual inline with their profile picture. Using Wum.bo, anyone can mint a social token that represents them or a creator they love. The value and mechanics of those tokens is up to them. For example, a creator could offer lunch with fans for the price of 100 of their native tokens; artists could offer pre-sales for limited edition works for fans who hold 1000 or more of their native tokens; brands may offer discounts for products for fans who burn 10 or more tokens, and so forth.

There are at least 5 projects currently building on Strata as we speak. Social tokens are an entirely new way for fans to engage the creators, brands, and stories they love. By building the core infrastructure and lowering the barriers to entry we hope to spur a tsunami of experimentation and innovation with social tokens.

Get started

The key to innovation is rapid iteration and exploration, and as such, Strata is completely open source and free for all to use. Get started here.

Strata is designed to become a standard for social tokens and bonding curves. The most innovative business models have yet to be discovered. As such, the smart contracts take no share of the tokens exchanged and the protocol remains as non-opinionated and flexible as possible. How you implement Strata is your canvas to paint.

You can customize everything from your curve's shape to its launch-time characteristics, to the royalties you collect, and so forth. This might sound complicated, but with sane defaults you don't have to reach under the hood.

Ready to get started? Here’s how you can create a social token on devnet right now:

Loading...

Now display it in React!

Loading...

Next Steps

Like what you see? Let’s build together! The community is great and we’ll be there to help you along the wayβ€”office hours, hands-on assistance, and more. We want to hear what you're building.

Not a dev? It’s all good. Wum.bo will be launching a chrome extension that makes it stupid easy to create social tokens with one click natively inside Twitter. It doesn't get much easier than that!

Join the Community

Β· 2 min read
Noah Prince

Wum.bo is Open Sourcing and migrating its smart contracts to Strata, a protocol for Community driven Social Tokens.

During the beta, you accumulated a Total Net Worth in bWUM. After the beta, a Net bWUM token was sent out that should be in your wallet.

You now have two options. You can either exchange for SOL now, or hold on to your tokens and wait for the launch of the Open Collective

The Open Collective

The Open Collective is the first token that will be launched on Strata. It is the default token that Social Tokens will be bound to; similar to bWUM in the Wum.bo beta. There are no fees or royalties on the Open Collective. It is bound to SOL, and is intended to create a base community on which users can align their Social Tokens. The reason this is not being called WUM is because Wum.bo will sell all collective tokens, not just the OPEN collective.

Wum.bo will be using the Open Collective for all unclaimed tokens, and users that claim their tokens will default to the Open Collective. Collectives are fluid, users are able to leave to join different collectives.

Exchange

When we launch the Open Collective, we'll take what is left of the Wum.bo beta prize pool, plus some extra SOL for sticking with us, and convert it into OPEN tokens.

If you'd like to switch back to SOL now, you can use the button below:

...

Chrome Webstore

You can now download the latest version of Wum.bo on the Chrome Webstore

This will eliminate the beta tags from your twitter, and we'll update it as soon as Wum.bo launches!