Nosana Jobs

About 14 min

Nosana Jobs

Projects can post pipeline jobs through the Nosana Jobs program. It lets nodes in the Nosana Network earn tokens by doing those jobs.

Program Information

InfoDescription
TypeSolana Programopen in new window
Source CodeGitHubopen in new window
Build StatusAnchor Verifiedopen in new window
Accounts4
Instructions11
Types3
Errors11
Domainnosana-jobs.sol
AddressnosJhNRqr2bc9g1nfGDcXXTXvYUmxD4cVwy2pMWhrYMopen in new window

Instructions

A number of 11 instruction are defined in the Nosana Jobs program.

To load the program with Anchoropen in new window.

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

Open

Initialize a MarketAccount and VaultAccount.

Account Info

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

NameTypeDescription
mintThe token Mint address for this instruction.
marketThe MarketAccount address.
vaultThe VaultAccount address.
authorityThe signing authority of the program invocation.
accessKeyThe Node Access Key address.
rentThe official Solana rent address. Responsible for lamports.
systemProgramThe official Solana system program address. Responsible for system CPIs.
tokenProgramThe official SPL Token Program address. Responsible for token CPIs.

Arguments

The following 5 arguments should also be provided when invoking this instruction.

NameTypeSizeOffsetDescription
jobExpirationi64160The expiration time in seconds for jobs.
jobPriceu64816The price for jobs in this market.
jobTimeouti641624The timeout time in seconds for jobs.
jobTypeu8140The JobType number.
nodeXnosMinimumu1281641The amount of xNOS a node needs to qualify for a market.
Solana Dispatch ID

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

[228,220,155,71,199,189,60,45]
Example with Anchor

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

let tx = await program.methods
  .open(
    jobExpiration,     // type: i64
    jobPrice,          // type: u64
    jobTimeout,        // type: i64
    jobType,           // type: u8
    nodeXnosMinimum,   // type: u128
  )
  .accounts({
    mint,              // 𐄂 writable, 𐄂 signer
    market,            // βœ“ writable, βœ“ signer
    vault,             // βœ“ writable, 𐄂 signer
    authority,         // βœ“ writable, βœ“ signer
    accessKey,         // 𐄂 writable, 𐄂 signer
    rent,              // 𐄂 writable, 𐄂 signer
    systemProgram,     // 𐄂 writable, 𐄂 signer
    tokenProgram,      // 𐄂 writable, 𐄂 signer
  })
  .signers([marketKey, authorityKey])
  .rpc();

Accounts

A number of 4 accounts make up for the Nosana Jobs Program's state.

Market Account

The MarketAccount struct holds all the information about jobs and the nodes queue. The total size of this account is 3,363 bytes.

NameTypeSizeOffsetDescription
authoritypublicKey328The signing authority of the program invocation.
jobExpirationi641640The expiration time in seconds for jobs.
jobPriceu64856The price for jobs in this market.
jobTimeouti641664The timeout time in seconds for jobs.
jobTypeu8180The JobType number.
vaultpublicKey3281The VaultAccount address.
vaultBumpu81113The bump for the VaultAccount.
nodeAccessKeypublicKey32114The NFT collection address of an NFT that the node holds, in order to access this market.
nodeXnosMinimumu12816146The amount of xNOS a node needs to qualify for a market.
queueTypeu81162The QueueType of the queue. Either Nodes or Jobs.
queueVec<publicKey>3200163The queue of order in the market.
Anchor Account Discriminator

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

[201,78,187,225,240,198,201,251]

Types

A number of 3 type variants are defined in the Nosana Jobs Program's state.

Queue Type

The QueueType describes the type of queue

A number of 3 variants are defined in this enum:

NameNumber
Job0
Node1
Empty2

Errors

A number of 11 errors are defined in the Nosana Jobs Program.

Nosana Error

6000 - Invalid Market Account

This market account is not valid.

Diagram

Instruction Diagram

Queue Diagrams

Below a representation of the functioning for the different QueueTypes.

Node

When there a more nodes than jobs in a given Market, the queue will fill up with nodes. The QueueType will be Node in this case.

Last update: