Nosana Jobs
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
Info | Description |
---|---|
Type | Solana Program |
Source Code | GitHub |
Build Status | Anchor Verified |
Accounts | 4 |
Instructions | 15 |
Types | 3 |
Errors | 15 |
Domain | nosana-jobs.sol |
Address | nosJhNRqr2bc9g1nfGDcXXTXvYUmxD4cVwy2pMWhrYM |
Instructions
A number of 15 instruction are defined in the Nosana Jobs program.
To load the program with Anchor.
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.
Name | Type | Description |
---|---|---|
mint | The token Mint address for this instruction. | |
market | The MarketAccount address. | |
vault | The VaultAccount address. | |
authority | The signing authority of the program invocation. | |
accessKey | The Node Access Key address. | |
rent | The official Solana rent address. Responsible for lamports. | |
systemProgram | The official Solana system program address. Responsible for system CPIs. | |
tokenProgram | The official SPL Token Program address. Responsible for token CPIs. |
Arguments
The following 5 arguments should also be provided when invoking this instruction.
Name | Type | Size | Offset | Description |
---|---|---|---|---|
jobExpiration | i64 | 16 | 0 | The expiration time in seconds for jobs. |
jobPrice | u64 | 8 | 16 | The price for jobs in this market. |
jobTimeout | i64 | 16 | 24 | The timeout time in seconds for jobs. |
jobType | u8 | 1 | 40 | The JobType number. |
nodeXnosMinimum | u128 | 16 | 41 | The 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 TS.
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();
Update
Update a MarketAccount's configurations.
Account Info
The following 3 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
market | The MarketAccount address. | |
accessKey | The Node Access Key address. | |
authority | The signing authority of the program invocation. |
Arguments
The following 5 arguments should also be provided when invoking this instruction.
Name | Type | Size | Offset | Description |
---|---|---|---|---|
jobExpiration | i64 | 16 | 0 | The expiration time in seconds for jobs. |
jobPrice | u64 | 8 | 16 | The price for jobs in this market. |
jobType | u8 | 1 | 24 | The JobType number. |
nodeStakeMinimum | u128 | 16 | 25 | The amount of xNOS a node needs to qualify for a market. |
jobTimeout | i64 | 16 | 41 | The timeout time in seconds for jobs. |
Solana Dispatch ID
The Solana dispatch ID for the Update Instruction
is dbc858b09e3ffd7f
,
which can also be expressed as an 8 byte discriminator:
[219,200,88,176,158,63,253,127]
Example with Anchor
To invoke the Update Instruction
with Anchor TS.
let tx = await program.methods
.update(
jobExpiration, // type: i64
jobPrice, // type: u64
jobType, // type: u8
nodeStakeMinimum, // type: u128
jobTimeout, // type: i64
)
.accounts({
market, // β writable, π signer
accessKey, // π writable, π signer
authority, // π writable, β signer
})
.signers([authorityKey])
.rpc();
Close
Close a MarketAccount and the associated VaultAccount.
Account Info
The following 5 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
market | The MarketAccount address. | |
vault | The VaultAccount address. | |
user | The user token account that will debit/credit the tokens. | |
authority | The signing authority of the program invocation. | |
tokenProgram | The official SPL Token Program address. Responsible for token CPIs. |
Solana Dispatch ID
The Solana dispatch ID for the Close Instruction
is 62a5c9b16c41ce60
,
which can also be expressed as an 8 byte discriminator:
[98,165,201,177,108,65,206,96]
Example with Anchor
To invoke the Close Instruction
with Anchor TS.
let tx = await program.methods
.close()
.accounts({
market, // β writable, π signer
vault, // β writable, π signer
user, // β writable, π signer
authority, // π writable, β signer
tokenProgram, // π writable, π signer
})
.signers([authorityKey])
.rpc();
Close Admin
Close a MarketAccount and the associated VaultAccount.
Account Info
The following 5 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
market | The MarketAccount address. | |
vault | The VaultAccount address. | |
user | The user token account that will debit/credit the tokens. | |
authority | The signing authority of the program invocation. | |
tokenProgram | The official SPL Token Program address. Responsible for token CPIs. |
Solana Dispatch ID
The Solana dispatch ID for the Close Admin Instruction
is cab6b98ed0a191bd
,
which can also be expressed as an 8 byte discriminator:
[202,182,185,142,208,161,145,189]
Example with Anchor
To invoke the Close Admin Instruction
with Anchor TS.
let tx = await program.methods
.closeAdmin()
.accounts({
market, // β writable, π signer
vault, // β writable, π signer
user, // β writable, π signer
authority, // π writable, β signer
tokenProgram, // π writable, π signer
})
.signers([authorityKey])
.rpc();
List
Create a JobAccount and optional RunAccount.
Account Info
The following 12 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
job | The JobAccount address. | |
market | The MarketAccount address. | |
run | The RunAccount address. | |
user | The user token account that will debit/credit the tokens. | |
vault | The VaultAccount address. | |
payer | The paying identy for the rent. | |
rewardsReflection | The Nosana Rewards Program's ReflectionAccount address. | |
rewardsVault | The Nosana Rewards Program's VaultAccount address. | |
authority | The signing authority of the program invocation. | |
rewardsProgram | The Nosana Rewards Program address. | |
tokenProgram | The official SPL Token Program address. Responsible for token CPIs. | |
systemProgram | The official Solana system program address. Responsible for system CPIs. |
Arguments
The following 2 arguments should also be provided when invoking this instruction.
Name | Type | Size | Offset | Description |
---|---|---|---|---|
ipfsJob | ["u8",32] | 32 | 0 | The byte array representing the IPFS hash to the job. |
timeout | i64 | 16 | 32 | The timeout time in seconds for a job. |
Solana Dispatch ID
The Solana dispatch ID for the List Instruction
is 36aec14311298426
,
which can also be expressed as an 8 byte discriminator:
[54,174,193,67,17,41,132,38]
Example with Anchor
To invoke the List Instruction
with Anchor TS.
let tx = await program.methods
.list(
ipfsJob, // type: ["u8",32]
timeout, // type: i64
)
.accounts({
job, // β writable, β signer
market, // β writable, π signer
run, // β writable, β signer
user, // β writable, π signer
vault, // β writable, π signer
payer, // β writable, β signer
rewardsReflection, // β writable, π signer
rewardsVault, // β writable, π signer
authority, // π writable, β signer
rewardsProgram, // π writable, π signer
tokenProgram, // π writable, π signer
systemProgram, // π writable, π signer
})
.signers([jobKey, runKey, payerKey, authorityKey])
.rpc();
Recover
Recover funds from a JobAccount that has been quit.
Account Info
The following 7 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
job | The JobAccount address. | |
market | The MarketAccount address. | |
vault | The VaultAccount address. | |
user | The user token account that will debit/credit the tokens. | |
payer | The paying identy for the rent. | |
authority | The signing authority of the program invocation. | |
tokenProgram | The official SPL Token Program address. Responsible for token CPIs. |
Solana Dispatch ID
The Solana dispatch ID for the Recover Instruction
is 6cd8263a6d927411
,
which can also be expressed as an 8 byte discriminator:
[108,216,38,58,109,146,116,17]
Example with Anchor
To invoke the Recover Instruction
with Anchor TS.
let tx = await program.methods
.recover()
.accounts({
job, // β writable, π signer
market, // π writable, π signer
vault, // β writable, π signer
user, // β writable, π signer
payer, // β writable, π signer
authority, // π writable, β signer
tokenProgram, // π writable, π signer
})
.signers([authorityKey])
.rpc();
Extend
Extend a job timeout
Account Info
The following 9 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
job | The JobAccount address. | |
market | The MarketAccount address. | |
user | The user token account that will debit/credit the tokens. | |
vault | The VaultAccount address. | |
rewardsReflection | The Nosana Rewards Program's ReflectionAccount address. | |
rewardsVault | The Nosana Rewards Program's VaultAccount address. | |
authority | The signing authority of the program invocation. | |
rewardsProgram | The Nosana Rewards Program address. | |
tokenProgram | The official SPL Token Program address. Responsible for token CPIs. |
Arguments
The following 1 arguments should also be provided when invoking this instruction.
Name | Type | Size | Offset | Description |
---|---|---|---|---|
timeout | i64 | 16 | 0 | The timeout time in seconds for a job. |
Solana Dispatch ID
The Solana dispatch ID for the Extend Instruction
is e47f0001e39a36a8
,
which can also be expressed as an 8 byte discriminator:
[228,127,0,1,227,154,54,168]
Example with Anchor
To invoke the Extend Instruction
with Anchor TS.
let tx = await program.methods
.extend(
timeout, // type: i64
)
.accounts({
job, // β writable, π signer
market, // π writable, π signer
user, // β writable, π signer
vault, // β writable, π signer
rewardsReflection, // β writable, π signer
rewardsVault, // β writable, π signer
authority, // π writable, β signer
rewardsProgram, // π writable, π signer
tokenProgram, // π writable, π signer
})
.signers([authorityKey])
.rpc();
Work
Enters the MarketAccount queue, or create a RunAccount.
Account Info
The following 8 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
run | The RunAccount address. | |
market | The MarketAccount address. | |
payer | The paying identy for the rent. | |
stake | The StakeAccount address. | |
nft | The Token Account address that holds the NFT. | |
metadata | The Metaplex Metadata address, that belongs to the NFT. | |
authority | The signing authority of the program invocation. | |
systemProgram | The official Solana system program address. Responsible for system CPIs. |
Solana Dispatch ID
The Solana dispatch ID for the Work Instruction
is 0f432dc3d789e52f
,
which can also be expressed as an 8 byte discriminator:
[15,67,45,195,215,137,229,47]
Example with Anchor
To invoke the Work Instruction
with Anchor TS.
let tx = await program.methods
.work()
.accounts({
run, // β writable, β signer
market, // β writable, π signer
payer, // β writable, β signer
stake, // π writable, π signer
nft, // π writable, π signer
metadata, // π writable, π signer
authority, // π writable, β signer
systemProgram, // π writable, π signer
})
.signers([runKey, payerKey, authorityKey])
.rpc();
Stop
Exit the node queue from MarketAccount.
Account Info
The following 2 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
market | The MarketAccount address. | |
authority | The signing authority of the program invocation. |
Solana Dispatch ID
The Solana dispatch ID for the Stop Instruction
is 2a85203cabfdb89b
,
which can also be expressed as an 8 byte discriminator:
[42,133,32,60,171,253,184,155]
Example with Anchor
To invoke the Stop Instruction
with Anchor TS.
let tx = await program.methods
.stop()
.accounts({
market, // β writable, π signer
authority, // π writable, β signer
})
.signers([authorityKey])
.rpc();
Claim
Claim a job that is stopped.
Account Info
The following 9 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
job | The JobAccount address. | |
run | The RunAccount address. | |
market | The MarketAccount address. | |
stake | The StakeAccount address. | |
nft | The Token Account address that holds the NFT. | |
metadata | The Metaplex Metadata address, that belongs to the NFT. | |
payer | The paying identy for the rent. | |
authority | The signing authority of the program invocation. | |
systemProgram | The official Solana system program address. Responsible for system CPIs. |
Solana Dispatch ID
The Solana dispatch ID for the Claim Instruction
is 3ec6d6c1d59f6cd2
,
which can also be expressed as an 8 byte discriminator:
[62,198,214,193,213,159,108,210]
Example with Anchor
To invoke the Claim Instruction
with Anchor TS.
let tx = await program.methods
.claim()
.accounts({
job, // β writable, π signer
run, // β writable, β signer
market, // π writable, π signer
stake, // π writable, π signer
nft, // π writable, π signer
metadata, // π writable, π signer
payer, // β writable, β signer
authority, // π writable, β signer
systemProgram, // π writable, π signer
})
.signers([runKey, payerKey, authorityKey])
.rpc();
Finish
Post the result for a JobAccount to finish it and get paid.
Account Info
The following 10 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
job | The JobAccount address. | |
run | The RunAccount address. | |
market | The MarketAccount address. | |
vault | The VaultAccount address. | |
user | The user token account that will debit/credit the tokens. | |
deposit | n/a | |
payer | The paying identy for the rent. | |
project | The project that listed this job. | |
authority | The signing authority of the program invocation. | |
tokenProgram | The official SPL Token Program address. Responsible for token CPIs. |
Arguments
The following 1 arguments should also be provided when invoking this instruction.
Name | Type | Size | Offset | Description |
---|---|---|---|---|
ipfsResult | ["u8",32] | 32 | 0 | The byte array representing the IPFS hash to the results. |
Solana Dispatch ID
The Solana dispatch ID for the Finish Instruction
is 434aaa847de9b625
,
which can also be expressed as an 8 byte discriminator:
[67,74,170,132,125,233,182,37]
Example with Anchor
To invoke the Finish Instruction
with Anchor TS.
let tx = await program.methods
.finish(
ipfsResult, // type: ["u8",32]
)
.accounts({
job, // β writable, π signer
run, // β writable, π signer
market, // π writable, π signer
vault, // β writable, π signer
user, // β writable, π signer
deposit, // β writable, π signer
payer, // β writable, π signer
project, // β writable, π signer
authority, // π writable, β signer
tokenProgram, // π writable, π signer
})
.signers([authorityKey])
.rpc();
Quit
Quit a JobAccount that you have started.
Account Info
The following 4 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
job | The JobAccount address. | |
run | The RunAccount address. | |
payer | The paying identy for the rent. | |
authority | The signing authority of the program invocation. |
Solana Dispatch ID
The Solana dispatch ID for the Quit Instruction
is bf678df050816799
,
which can also be expressed as an 8 byte discriminator:
[191,103,141,240,80,129,103,153]
Example with Anchor
To invoke the Quit Instruction
with Anchor TS.
let tx = await program.methods
.quit()
.accounts({
job, // β writable, π signer
run, // β writable, π signer
payer, // β writable, π signer
authority, // π writable, β signer
})
.signers([authorityKey])
.rpc();
Quit Admin
Quit a JobAccount that you have started.
Account Info
The following 3 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
run | The RunAccount address. | |
payer | The paying identy for the rent. | |
authority | The signing authority of the program invocation. |
Solana Dispatch ID
The Solana dispatch ID for the Quit Admin Instruction
is 67ee6e08b61438c4
,
which can also be expressed as an 8 byte discriminator:
[103,238,110,8,182,20,56,196]
Example with Anchor
To invoke the Quit Admin Instruction
with Anchor TS.
let tx = await program.methods
.quitAdmin()
.accounts({
run, // β writable, π signer
payer, // β writable, π signer
authority, // π writable, β signer
})
.signers([authorityKey])
.rpc();
Clean
Close an JobAccount.
Account Info
The following 3 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
job | The JobAccount address. | |
market | The MarketAccount address. | |
payer | The paying identy for the rent. |
Solana Dispatch ID
The Solana dispatch ID for the Clean Instruction
is fabf388096fb0167
,
which can also be expressed as an 8 byte discriminator:
[250,191,56,128,150,251,1,103]
Example with Anchor
To invoke the Clean Instruction
with Anchor TS.
let tx = await program.methods
.clean()
.accounts({
job, // β writable, π signer
market, // π writable, π signer
payer, // β writable, π signer
})
.rpc();
Clean Admin
Close an JobAccount as an admin.
Account Info
The following 3 account addresses should be provided when invoking this instruction.
Name | Type | Description |
---|---|---|
job | The JobAccount address. | |
payer | The paying identy for the rent. | |
authority | The signing authority of the program invocation. |
Solana Dispatch ID
The Solana dispatch ID for the Clean Admin Instruction
is f55abc44fdebab69
,
which can also be expressed as an 8 byte discriminator:
[245,90,188,68,253,235,171,105]
Example with Anchor
To invoke the Clean Admin Instruction
with Anchor TS.
let tx = await program.methods
.cleanAdmin()
.accounts({
job, // β writable, π signer
payer, // β writable, π signer
authority, // π writable, β signer
})
.signers([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 10,211
bytes.
Name | Type | Size | Offset | Description |
---|---|---|---|---|
authority | publicKey | 32 | 8 | The signing authority of the program invocation. |
jobExpiration | i64 | 16 | 40 | The expiration time in seconds for jobs. |
jobPrice | u64 | 8 | 56 | The price for jobs in this market. |
jobTimeout | i64 | 16 | 64 | The timeout time in seconds for jobs. |
jobType | u8 | 1 | 80 | The JobType number. |
vault | publicKey | 32 | 81 | The VaultAccount address. |
vaultBump | u8 | 1 | 113 | The bump for the VaultAccount. |
nodeAccessKey | publicKey | 32 | 114 | The NFT collection address of an NFT that the node holds, in order to access this market. |
nodeXnosMinimum | u128 | 16 | 146 | The amount of xNOS a node needs to qualify for a market. |
queueType | u8 | 1 | 162 | The QueueType of the queue. Either Nodes or Jobs. |
queue | Vec<publicKey> | 10048 | 163 | The 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]
Job Account
The JobAccount
struct holds all the information about any individual jobs.
The total size of this account is 257
bytes.
Name | Type | Size | Offset | Description |
---|---|---|---|---|
ipfsJob | ["u8",32] | 32 | 8 | The byte array representing the IPFS hash to the job. |
ipfsResult | ["u8",32] | 32 | 40 | The byte array representing the IPFS hash to the results. |
market | publicKey | 32 | 72 | The MarketAccount address. |
node | publicKey | 32 | 104 | The node that runs this job. |
payer | publicKey | 32 | 136 | The paying identy for the rent. |
price | u64 | 8 | 168 | The price in $NOS. |
project | publicKey | 32 | 176 | The project that listed this job. |
state | u8 | 1 | 208 | n/a |
timeEnd | i64 | 16 | 209 | The unix time this job has finished running. |
timeStart | i64 | 16 | 225 | The unix time this job has started running. |
timeout | i64 | 16 | 241 | The timeout time in seconds for a job. |
Anchor Account Discriminator
The first 8 bytes, also known as Anchor's 8 byte discriminator, for the Job Account
are 5b10a2052dd27d41
, which can also be expressed in byte array:
[91,16,162,5,45,210,125,65]
Run Account
The RunAccount
struct holds temporary information that matches nodes to jobs.
The total size of this account is 121
bytes.
Name | Type | Size | Offset | Description |
---|---|---|---|---|
job | publicKey | 32 | 8 | The JobAccount address. |
node | publicKey | 32 | 40 | The node that runs this job. |
payer | publicKey | 32 | 72 | The paying identy for the rent. |
state | u8 | 1 | 104 | n/a |
time | i64 | 16 | 105 | n/a |
Anchor Account Discriminator
The first 8 bytes, also known as Anchor's 8 byte discriminator, for the Run Account
are c2a96ee6eb0be116
, which can also be expressed in byte array:
[194,169,110,230,235,11,225,22]
Vault Account
The VaultAccount
is a regular Solana Token Account.
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
:
Name | Number |
---|---|
Job | 0 |
Node | 1 |
Empty | 2 |
Job State
The JobState
describes the status of a job.
A number of 3 variants are defined in this enum
:
Name | Number |
---|---|
Queued | 0 |
Done | 1 |
Stopped | 2 |
Job Type
The JobType
describes the type of any job.
A number of 6 variants are defined in this enum
:
Name | Number |
---|---|
Default | 0 |
Small | 1 |
Medium | 2 |
Large | 3 |
Gpu | 4 |
Unknown | 255 |
Errors
A number of 15 errors are defined in the Nosana Jobs Program.
Nosana Error
6000
- Invalid Market Account
This market account is not valid.
Nosana Error
6001
- Invalid Job Account
This job account is not valid.
Nosana Error
6002
- Job In Wrong State
This job does not have the right status.
Nosana Error
6003
- Job Not Expired
The job has not yet expired.
Nosana Error
6004
- Job Result Null
The job result can not be null.
Nosana Error
6005
- Job Invalid Project
The job has a different project owner.
Nosana Error
6006
- Job Timeout Not Greater
The new job timeout should be larger than the current one.
Nosana Error
6007
- Node Queue Does Not Match
This node queue does not match.
Nosana Error
6008
- Node Stake Unauthorized
This node is not authorizing this stake.
Nosana Error
6009
- Node Not Enough Stake
This node has not staked enough tokens.
Nosana Error
6010
- Node Already Queued
This node is already present in the queue.
Nosana Error
6011
- Node Nft Wrong Metadata
This metadata does not have the correct address.
Nosana Error
6012
- Node Nft Wrong Owner
This NFT is not owned by this node.
Nosana Error
6013
- Node Nft Invalid Amount
Access NFT amount cannot be 0.
Nosana Error
6014
- Node Key Invalid Collection
This access key does not belong to a verified collection.
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.
Job Queue
Vise versa, When there a more jobs than nodes in a given Market, the queue will fill up with jobs.
The QueueType
will be Job
in this case.
Empty Queue
Finally, at the point when the market is satisfied, the queue will be empty.
The QueueType
will be Unknown
in this case.