Skip to main content

Nosana Staking

About 10 min

Nosana Staking

The staking program allows users to stake NOS tokens for a variable amount of time.

The staking dashboard can be found here: https://explorer.nosana.io/stake/open in new window

There are 2 values associated with a users stake:

  • Staked NOS
  • xNOS (Staked NOS x duration)

The staked NOS is the amount of tokens that the vault actually holds for the user that can be slashed or unstaked,
while xNOS is a value indicating a users rank for purposes like giveaways and voting.

Program Information

InfoDescription
TypeSolana Programopen in new window
Source CodeGitHubopen in new window
Build StatusAnchor Verifiedopen in new window
Accounts3
Instructions10
Types0
Errors13
Domainnosana-staking.sol
AddressnosScmHY2uR24Zh751PmGj9ww9QRNHewh9H59AfrTJEopen in new window

Instructions

A number of 10 instruction are defined in the Nosana Staking program.

To load the program with Anchoropen in new window.

const programId = new PublicKey('nosScmHY2uR24Zh751PmGj9ww9QRNHewh9H59AfrTJE');
const idl = await Program.fetchIdl(programId.toString());
const program = new Program(idl, programId);
Init

Init

Initialize the SettingsAccount.

Account Info

The following 4 account addresses should be provided when invoking this instruction.

NameTypeDescription
settingsThe SettingsAccount address.
authorityThe signing authority of the program invocation.
systemProgramThe official Solana system program address. Responsible for system CPIs.
rentThe official Solana rent address. Responsible for lamports.
Solana Dispatch ID

The Solana dispatch ID for the Init Instruction
is dc3bcfec6cfa2f64,
which can also be expressed as an 8 byte discriminator:

[220,59,207,236,108,250,47,100]
Example with Anchor

To invoke the Init Instruction
with Anchor TSopen in new window.

let tx = await program.methods
  .init()
  .accounts({
    settings,          // βœ“ writable, 𐄂 signer
    authority,         // βœ“ writable, βœ“ signer
    systemProgram,     // 𐄂 writable, 𐄂 signer
    rent,              // 𐄂 writable, 𐄂 signer
  })
  .signers([authorityKey])
  .rpc();

Accounts

A number of 3 accounts make up for the Nosana Staking Program's state.

Settings Account

Settings Account

The SettingsAccount struct holds the information about the
slashing authority and token account.
The total size of this account is 72 bytes.

NameTypeSizeOffsetDescription
authoritypublicKey328The signing authority of the program invocation.
tokenAccountpublicKey3240The token account where slash deposits will go.
Anchor Account Discriminator

The first 8 bytes, also known as Anchor's 8 byte discriminator, for the Settings Account
are 3f59cb9b4ced733a, which can also be expressed in byte array:

[63,89,203,155,76,237,115,58]

Errors

A number of 13 errors are defined in the Nosana Staking Program.

6000

Nosana Error

6000 - Amount Not Enough

This amount is not enough.

Diagram

xNOS calculation

For people that like to know exactly how Nosana calculate a stakers's xNOS score,
we've written it down as a function f(NOS)=xNOS.
Where NOS denotes the number of Nosana Tokens a staker has staked in the Nosana Staking Program.

f(NOS)=xNOS=1s10512000Γ—NOSs.t.={s∈Z∣1209600≀s≀31536000}

The s parameter denotes time in seconds,
which represents the duration a staker has staked his or her tokens.
The parameter s is subject to a setopen in new window.
The stake duration s belongs to the set of integers Z,
such that s is greater than or equal to 1209600 seconds and less than or equal to 31536000 seconds.

Because it's somewhat difficult to intuitively understand numbers of this magnitude,
we can simplify above function to use days rather seconds, which are denoted d.

xNOS=1d12123Γ—NOSs.t.={d∈N∣14≀s≀365}

The stake duration d belongs to the set of natural numbers N,
such that d is greater than or equal to 14 days and less than or equal to 365 days.

In more simple phrasing.
A staker can stake Nosana Tokens for a minimum of two weeks and a maximum of one year.
The longer the duration of a stake, the higher the multiplier against the number of tokens in stake.
The maximum multiplier is this system is 4, because 136512123=4.

On the Nosana website you can find a xNOS calculatoropen in new window.

Last update: