@_koii/task-node 1.12.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # K2-Node:
2
+ ****
3
+ ## TL;DR
4
+ # How to to run a node:
5
+
6
+ 1. Clone the repo repo : https://gitlab.com/koii-network/task-node
7
+ 2. do `npm install`
8
+ 3. do `npm run build:watch`
9
+ 4. on another terminal do `npm start ` this will start a **K2** node with attention game running.
10
+ ****
11
+ ## Full Guide
12
+ ## How Attention game works
13
+
14
+ The node collects PoRTs for a whole epoch and generates a distribution list and add its to the attention account of the node using a uploader contract which breaks the data into small chunks and then combines it into a big data chunk in the program. The node will also expose the port list on an endpoint
15
+ On the next Epoch the node will do voting by getting all the attention accounts and pings all the registered nodes and get all the posts the generates distribution list after verifying that teh list is correct or not.
16
+
17
+
18
+ # How to run
19
+ ## Deploy Uploader Program
20
+ First airdrop 1000 tokens to your default wallet.
21
+ after that clone https://github.com/koii-network/k2-contracts this repo and deployed the uploader program by running `init.sh` file after installing dependencies using `npm install`. This will deploy the uploader program used by attention game.
22
+
23
+ ## Run Node:
24
+ ### Prerequisites:
25
+ 1. You will need to create a task staking account in order to run tasks other than the attention contract.
26
+ 1.1 You can create a staking wallet by using the staking cli `npm run stake`
27
+
28
+ ### Running a Node:
29
+ To run a node run `npm run build:watch` and ona different terminal run `npm start` to start the node.
30
+
31
+ ### Working of stakes
32
+
33
+ The attention program needs 2 accounts one is the attentions staking account and data program account. Which executable makes from the mainAccount according to the stake amount set in the env variable (no preconfiguration needed)
34
+
35
+ In-order to run tasks other than attention program, you need to make a staking account `npm run stake`, allocate some funds in that wallet and then the task you want to execute stake some tokens to that task id using the cli. After that you will be able to execute task and make rewards out of that.
36
+
37
+
38
+ #### Note: Attention task is different than the other tasks
39
+ ****
40
+ # Trouble Shooting:
41
+ ## Insufficient Balance:
42
+ You might get this error if you have restated the network and you are trying to run deploy uploader program or running attention game. In this cases try `solana airdrop <AMOUNT> <ADDRESS> `.
43
+
44
+ ## Program doesn't exists
45
+ You will get this error if you have restarted the network (Wiped out the data) and you are trying to run run attention game attention game, deleting `namespace/Attention22222222222222222222222222222222222/attentionAccountWallet.json` and `namespace/Attention22222222222222222222222222222222222/uploadAccountWallet.json` will fix the issue.
46
+
47
+
48
+
49
+ ****
@@ -0,0 +1,225 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * @param {any} val
5
+ * @returns {any}
6
+ */
7
+ export function bincode_js_deserialize(val: any): any;
8
+ /**
9
+ * @param {any} val
10
+ * @returns {any}
11
+ */
12
+ export function borsh_bpf_js_deserialize(val: any): any;
13
+ /**
14
+ * Initialize Javascript logging and panic handler
15
+ */
16
+ export function solana_program_init(): void;
17
+ /**
18
+ * A hash; the 32-byte output of a hashing algorithm.
19
+ *
20
+ * This struct is used most often in `solana-sdk` and related crates to contain
21
+ * a [SHA-256] hash, but may instead contain a [blake3] hash, as created by the
22
+ * [`blake3`] module (and used in [`Message::hash`]).
23
+ *
24
+ * [SHA-256]: https://en.wikipedia.org/wiki/SHA-2
25
+ * [blake3]: https://github.com/BLAKE3-team/BLAKE3
26
+ * [`blake3`]: crate::blake3
27
+ * [`Message::hash`]: crate::message::Message::hash
28
+ */
29
+ export class Hash {
30
+ free(): void;
31
+ /**
32
+ * Create a new Hash object
33
+ *
34
+ * * `value` - optional hash as a base58 encoded string, `Uint8Array`, `[number]`
35
+ * @param {any} value
36
+ */
37
+ constructor(value: any);
38
+ /**
39
+ * Return the base58 string representation of the hash
40
+ * @returns {string}
41
+ */
42
+ toString(): string;
43
+ /**
44
+ * Checks if two `Hash`s are equal
45
+ * @param {Hash} other
46
+ * @returns {boolean}
47
+ */
48
+ equals(other: Hash): boolean;
49
+ /**
50
+ * Return the `Uint8Array` representation of the hash
51
+ * @returns {Uint8Array}
52
+ */
53
+ toBytes(): Uint8Array;
54
+ }
55
+ /**
56
+ * A directive for a single invocation of a Solana program.
57
+ *
58
+ * An instruction specifies which program it is calling, which accounts it may
59
+ * read or modify, and additional data that serves as input to the program. One
60
+ * or more instructions are included in transactions submitted by Solana
61
+ * clients. Instructions are also used to describe [cross-program
62
+ * invocations][cpi].
63
+ *
64
+ * [cpi]: https://docs.solana.com/developing/programming-model/calling-between-programs
65
+ *
66
+ * During execution, a program will receive a list of account data as one of
67
+ * its arguments, in the same order as specified during `Instruction`
68
+ * construction.
69
+ *
70
+ * While Solana is agnostic to the format of the instruction data, it has
71
+ * built-in support for serialization via [`borsh`] and [`bincode`].
72
+ *
73
+ * [`borsh`]: https://docs.rs/borsh/latest/borsh/
74
+ * [`bincode`]: https://docs.rs/bincode/latest/bincode/
75
+ *
76
+ * # Specifying account metadata
77
+ *
78
+ * When constructing an [`Instruction`], a list of all accounts that may be
79
+ * read or written during the execution of that instruction must be supplied as
80
+ * [`AccountMeta`] values.
81
+ *
82
+ * Any account whose data may be mutated by the program during execution must
83
+ * be specified as writable. During execution, writing to an account that was
84
+ * not specified as writable will cause the transaction to fail. Writing to an
85
+ * account that is not owned by the program will cause the transaction to fail.
86
+ *
87
+ * Any account whose lamport balance may be mutated by the program during
88
+ * execution must be specified as writable. During execution, mutating the
89
+ * lamports of an account that was not specified as writable will cause the
90
+ * transaction to fail. While _subtracting_ lamports from an account not owned
91
+ * by the program will cause the transaction to fail, _adding_ lamports to any
92
+ * account is allowed, as long is it is mutable.
93
+ *
94
+ * Accounts that are not read or written by the program may still be specified
95
+ * in an `Instruction`'s account list. These will affect scheduling of program
96
+ * execution by the runtime, but will otherwise be ignored.
97
+ *
98
+ * When building a transaction, the Solana runtime coalesces all accounts used
99
+ * by all instructions in that transaction, along with accounts and permissions
100
+ * required by the runtime, into a single account list. Some accounts and
101
+ * account permissions required by the runtime to process a transaction are
102
+ * _not_ required to be included in an `Instruction`s account list. These
103
+ * include:
104
+ *
105
+ * - The program ID &mdash; it is a separate field of `Instruction`
106
+ * - The transaction's fee-paying account &mdash; it is added during [`Message`]
107
+ * construction. A program may still require the fee payer as part of the
108
+ * account list if it directly references it.
109
+ *
110
+ * [`Message`]: crate::message::Message
111
+ *
112
+ * Programs may require signatures from some accounts, in which case they
113
+ * should be specified as signers during `Instruction` construction. The
114
+ * program must still validate during execution that the account is a signer.
115
+ */
116
+ export class Instruction {
117
+ free(): void;
118
+ }
119
+ /**
120
+ */
121
+ export class Instructions {
122
+ free(): void;
123
+ /**
124
+ */
125
+ constructor();
126
+ /**
127
+ * @param {Instruction} instruction
128
+ */
129
+ push(instruction: Instruction): void;
130
+ }
131
+ /**
132
+ * A Solana transaction message (legacy).
133
+ *
134
+ * See the [`message`] module documentation for further description.
135
+ *
136
+ * [`message`]: crate::message
137
+ *
138
+ * Some constructors accept an optional `payer`, the account responsible for
139
+ * paying the cost of executing a transaction. In most cases, callers should
140
+ * specify the payer explicitly in these constructors. In some cases though,
141
+ * the caller is not _required_ to specify the payer, but is still allowed to:
142
+ * in the `Message` structure, the first account is always the fee-payer, so if
143
+ * the caller has knowledge that the first account of the constructed
144
+ * transaction's `Message` is both a signer and the expected fee-payer, then
145
+ * redundantly specifying the fee-payer is not strictly required.
146
+ */
147
+ export class Message {
148
+ free(): void;
149
+ /**
150
+ * The id of a recent ledger entry.
151
+ */
152
+ recent_blockhash: Hash;
153
+ }
154
+ /**
155
+ * The address of a [Solana account][acc].
156
+ *
157
+ * Some account addresses are [ed25519] public keys, with corresponding secret
158
+ * keys that are managed off-chain. Often, though, account addresses do not
159
+ * have corresponding secret keys &mdash; as with [_program derived
160
+ * addresses_][pdas] &mdash; or the secret key is not relevant to the operation
161
+ * of a program, and may have even been disposed of. As running Solana programs
162
+ * can not safely create or manage secret keys, the full [`Keypair`] is not
163
+ * defined in `solana-program` but in `solana-sdk`.
164
+ *
165
+ * [acc]: https://docs.solana.com/developing/programming-model/accounts
166
+ * [ed25519]: https://ed25519.cr.yp.to/
167
+ * [pdas]: https://docs.solana.com/developing/programming-model/calling-between-programs#program-derived-addresses
168
+ * [`Keypair`]: https://docs.rs/solana-sdk/latest/solana_sdk/signer/keypair/struct.Keypair.html
169
+ */
170
+ export class Pubkey {
171
+ free(): void;
172
+ /**
173
+ * Create a new Pubkey object
174
+ *
175
+ * * `value` - optional public key as a base58 encoded string, `Uint8Array`, `[number]`
176
+ * @param {any} value
177
+ */
178
+ constructor(value: any);
179
+ /**
180
+ * Return the base58 string representation of the public key
181
+ * @returns {string}
182
+ */
183
+ toString(): string;
184
+ /**
185
+ * Check if a `Pubkey` is on the ed25519 curve.
186
+ * @returns {boolean}
187
+ */
188
+ isOnCurve(): boolean;
189
+ /**
190
+ * Checks if two `Pubkey`s are equal
191
+ * @param {Pubkey} other
192
+ * @returns {boolean}
193
+ */
194
+ equals(other: Pubkey): boolean;
195
+ /**
196
+ * Return the `Uint8Array` representation of the public key
197
+ * @returns {Uint8Array}
198
+ */
199
+ toBytes(): Uint8Array;
200
+ /**
201
+ * Derive a Pubkey from another Pubkey, string seed, and a program id
202
+ * @param {Pubkey} base
203
+ * @param {string} seed
204
+ * @param {Pubkey} owner
205
+ * @returns {Pubkey}
206
+ */
207
+ static createWithSeed(base: Pubkey, seed: string, owner: Pubkey): Pubkey;
208
+ /**
209
+ * Derive a program address from seeds and a program id
210
+ * @param {any[]} seeds
211
+ * @param {Pubkey} program_id
212
+ * @returns {Pubkey}
213
+ */
214
+ static createProgramAddress(seeds: any[], program_id: Pubkey): Pubkey;
215
+ /**
216
+ * Find a valid program address
217
+ *
218
+ * Returns:
219
+ * * `[PubKey, number]` - the program address and bump seed
220
+ * @param {any[]} seeds
221
+ * @param {Pubkey} program_id
222
+ * @returns {any}
223
+ */
224
+ static findProgramAddress(seeds: any[], program_id: Pubkey): any;
225
+ }