Nosana Nodes
The Nosana Nodes program allows users to register machine in the Nosana Network.
Program Information
| Info | Description |
|---|---|
| Type | Solana Program |
| Source Code | GitHub |
| Build Status | Anchor Verified |
| Accounts | 2 |
| Instructions | 3 |
| Types | 2 |
| Errors | 7 |
| Domain | nosana-nodes.sol |
| Address | nosNeZR64wiEhQc5j251bsP4WqDabT6hmz4PHyoHLGD |
Instructions
A number of 3 instruction are defined in the Nosana Nodes program.
To load the program with Anchor.
const programId = new PublicKey('nosNeZR64wiEhQc5j251bsP4WqDabT6hmz4PHyoHLGD');
const idl = await Program.fetchIdl(programId.toString());
const program = new Program(idl, programId);Register
Register a node to the Nosana Network
Account Info
The following 4 account addresses should be provided when invoking this instruction.
| Name | Type | Description |
|---|---|---|
node | The node that runs this job. | |
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. |
Arguments
The following 10 arguments should also be provided when invoking this instruction.
| Name | Type | Size | Offset | Description |
|---|---|---|---|---|
architectureType | u8 | 1 | 0 | The ArchitectureType of the node. |
countryCode | u16 | 2 | 1 | The CountryCode of the node. |
cpu | u16 | 2 | 3 | The number of vCPU cores a node has. |
gpu | u16 | 2 | 5 | The number of GPU cores a node has. |
memory | u16 | 2 | 7 | Memory capacity of a node in GB. |
iops | u16 | 2 | 9 | Input/output operations per second of a node. |
storage | u16 | 2 | 11 | Storage capacity of a node in GB. |
endpoint | string | undefined | 13 | HTTP endpoint for log streaming and results. |
icon | string | undefined | NaN | n/a |
version | string | undefined | NaN | The version of the nosana node software they are running. |
Solana Dispatch ID
The Solana dispatch ID for the Register Instruction is d37c430fd3c2b2f0, which can also be expressed as an 8 byte discriminator:
[211,124,67,15,211,194,178,240]Example with Anchor
To invoke the Register Instruction with Anchor TS.
let tx = await program.methods
.register(
architectureType, // type: u8
countryCode, // type: u16
cpu, // type: u16
gpu, // type: u16
memory, // type: u16
iops, // type: u16
storage, // type: u16
endpoint, // type: string
icon, // type: string
version, // type: string
)
.accounts({
node, // ✓ writable, 𐄂 signer
payer, // ✓ writable, ✓ signer
authority, // 𐄂 writable, ✓ signer
systemProgram, // 𐄂 writable, 𐄂 signer
})
.signers([payerKey, authorityKey])
.rpc();Accounts
A number of 2 accounts make up for the Nosana Nodes Program's state.
Node Account
The NodeAccount struct holds all the information for any given node. The total size of this account is NaN bytes.
| Name | Type | Size | Offset | Description |
|---|---|---|---|---|
authority | publicKey | 32 | 8 | The signing authority of the program invocation. |
audited | bool | 1 | 40 | n/a |
architecture | u8 | 1 | 41 | n/a |
country | u16 | 2 | 42 | n/a |
cpu | u16 | 2 | 44 | The number of vCPU cores a node has. |
gpu | u16 | 2 | 46 | The number of GPU cores a node has. |
memory | u16 | 2 | 48 | Memory capacity of a node in GB. |
iops | u16 | 2 | 50 | Input/output operations per second of a node. |
storage | u16 | 2 | 52 | Storage capacity of a node in GB. |
endpoint | string | undefined | 54 | HTTP endpoint for log streaming and results. |
icon | string | undefined | NaN | n/a |
version | string | undefined | NaN | The version of the nosana node software they are running. |
Anchor Account Discriminator
The first 8 bytes, also known as Anchor's 8 byte discriminator, for the Node Account are 7da61292c37f56dc, which can also be expressed in byte array:
[125,166,18,146,195,127,86,220]Types
A number of 2 type variants are defined in the Nosana Nodes Program's state.
Architecture Type
The ArchitectureType describes the type of chip architecture the node has
A number of 11 variants are defined in this enum:
| Name | Number |
|---|---|
Amd64 | 0 |
Arm32v6 | 1 |
Arm32v7 | 2 |
Arm64v8 | 3 |
WindowsAmd64 | 4 |
Ppc64le | 5 |
S390x | 6 |
Mips64le | 7 |
Riscv64 | 8 |
I386 | 9 |
Unknown | 255 |