godprotocol 1.0.789 → 1.0.791
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/.babelrc +3 -0
- package/Objects/Account.js +260 -80
- package/Objects/Manager.js +2 -3
- package/Objects/Opcodes.js +75 -12
- package/Objects/Virtual_machine.js +242 -105
- package/build/Account.js +173 -0
- package/build/Block.js +103 -0
- package/build/Blockweb.js +78 -0
- package/build/Chain.js +205 -0
- package/build/Explorer.js +85 -0
- package/build/Filesystem.js +165 -0
- package/build/Frame.js +108 -0
- package/build/Index.js +19 -0
- package/build/Manager.js +178 -0
- package/build/Opcodes.js +102 -0
- package/build/Oracle.js +84 -0
- package/build/Virtual_machine.js +128 -0
- package/build/add.js +41 -0
- package/build/create_server.js +495 -0
- package/build/framer.js +88 -0
- package/build/functions.js +127 -0
- package/build/hash.js +14 -0
- package/build/jmp.js +19 -0
- package/build/main.js +339 -0
- package/build/opcodes.js +42 -0
- package/build/privacy.js +27 -0
- package/build/services.js +96 -0
- package/build/std.js +11 -0
- package/package.json +1 -1
- package/readme.md +94 -71
package/readme.md
CHANGED
|
@@ -10,111 +10,134 @@ npm install godprotocol --save
|
|
|
10
10
|
|
|
11
11
|
### Brief Description
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
It is to help provide multiple compute instances for servers and also data flexibility and transactions.
|
|
13
|
+
God Protocol makes data sharing and processing easy for apps. With simple APIs, developers can add advanced features like AI, distribution, and scaling. Here are the main endpoints:
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
### Endpoints
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
- [**/create_account:**](#create_account) Create a new machine account.
|
|
18
|
+
- [**/load:**](#load) Load and send an instruction sequence to the server.
|
|
19
|
+
- [**/run:**](#run) Execute the instruction sequence.
|
|
20
|
+
- [**/parse:**](#parse) Retrieve and process results from the server.
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## /create_account
|
|
25
|
+
|
|
26
|
+
The /create_account endpoint creates a new account in the God Protocol. This account is necessary for using other features and handling data and tasks in the decentralised system.
|
|
27
|
+
|
|
28
|
+
### Example Usage
|
|
21
29
|
|
|
22
30
|
```js
|
|
23
|
-
import
|
|
31
|
+
import manager from "godprotocol";
|
|
24
32
|
|
|
25
|
-
|
|
26
|
-
let
|
|
27
|
-
// if private is set to `true`, communication to the account instance must be validated by sigining with the private key.
|
|
28
|
-
// N.B your keypairs are generated offline.
|
|
33
|
+
let account = manager.add_account("name");
|
|
34
|
+
let private_account = manager.add_account("public_key", { private: true });
|
|
29
35
|
```
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
### Parameters
|
|
38
|
+
|
|
39
|
+
- `name` (string): The name to associate with the new account.
|
|
40
|
+
- `meta` (object): Optional. Configuration object for account settings. Use `{ private: true }` to create a [private account](https://godprotocol-web.vercel.app/accounts/private).
|
|
41
|
+
|
|
42
|
+
| Parameter | Possible Values | Default Value | Type | Description |
|
|
43
|
+
| --------- | ---------------- | ------------- | ------- | ------------------------------------------------------------- |
|
|
44
|
+
| `name` | Any string | `initiator` | string | The name to associate with the new account. |
|
|
45
|
+
| `meta` | `{private:true}` | `{}` | object | Optional. Configuration object for account settings. |
|
|
46
|
+
| `private` | `true`, `false` | `false` | boolean | Nested in `meta`. Specifies if the account should be private. |
|
|
35
47
|
|
|
36
|
-
##
|
|
48
|
+
## /load
|
|
37
49
|
|
|
38
|
-
The load
|
|
39
|
-
It is used to set your programs into the network web,
|
|
40
|
-
where its data can continue to be accessed, and subsequent
|
|
41
|
-
calls can be made on the loaded program.
|
|
50
|
+
The /load endpoint in the God Protocol framework loads a program with specified instructions and manages associated accounts.
|
|
42
51
|
|
|
43
|
-
### Usage
|
|
52
|
+
### Example Usage
|
|
44
53
|
|
|
45
54
|
```js
|
|
46
|
-
|
|
47
|
-
{
|
|
48
|
-
instructions: ["
|
|
49
|
-
account:
|
|
55
|
+
account.load({
|
|
56
|
+
program: {
|
|
57
|
+
instructions: ["instruction1", "instruction2"],
|
|
58
|
+
account: "account_id",
|
|
50
59
|
},
|
|
51
|
-
|
|
52
|
-
)
|
|
60
|
+
signature: "signature_string",
|
|
61
|
+
callback: () => {
|
|
62
|
+
// Callback function logic
|
|
63
|
+
},
|
|
64
|
+
});
|
|
53
65
|
```
|
|
54
66
|
|
|
55
|
-
Type
|
|
67
|
+
| **Paramters** | **Possible Values** | **Default Value** | **Type** | **Description** |
|
|
68
|
+
| ---------------------- | ----------------------------------- | ----------------- | ---------------------- | ----------------------------------------------------------------- |
|
|
69
|
+
| `program` | `{ instructions: [], account: "" }` | None | object | Object containing program instructions and associated account. |
|
|
70
|
+
| `program.instructions` | Array of strings | [] | array | Array of program instructions. |
|
|
71
|
+
| `program.account` | Any string | `"initiator"` | string | Associated account for program execution. |
|
|
72
|
+
| `signature` | String | None | string | Optional. Signature for private account access. |
|
|
73
|
+
| `callback` | Function or `account.run{}` | None | `function` or `object` | Optional. Function to call upon completion of the load operation. |
|
|
56
74
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
| `program` | object | `instructions` | An array of opcode-operands generated by the [`Loader Sequence`](https://godprotocol-web.vercel.app/loader_sequence) |
|
|
60
|
-
| | | `account` | Account instance to load and execute the program in. |
|
|
61
|
-
| `cb` | function | | A function that is called with the blocks mined during the execution. |
|
|
75
|
+
Description:
|
|
76
|
+
The /load endpoint loads a program with instructions (program.instructions) and links it to an account (program.account). For private accounts, include a signature of the `program` for access. Optionally, provide a callback function to handle completion events, which may include additional execution payload (account.run).
|
|
62
77
|
|
|
63
|
-
##
|
|
78
|
+
## `/run`
|
|
64
79
|
|
|
65
|
-
The run
|
|
80
|
+
The /run endpoint runs a program in the provided payload, physical address, and account details.
|
|
66
81
|
|
|
67
|
-
### Usage
|
|
82
|
+
### Example Usage
|
|
68
83
|
|
|
69
84
|
```js
|
|
70
|
-
|
|
71
|
-
{
|
|
72
|
-
physical_address: "
|
|
73
|
-
|
|
74
|
-
|
|
85
|
+
account.run({
|
|
86
|
+
payload: {
|
|
87
|
+
physical_address: "Accounts/name/path",
|
|
88
|
+
account: "account_id",
|
|
89
|
+
query: `blocks:0`,
|
|
90
|
+
},
|
|
91
|
+
signature: "signature_string",
|
|
92
|
+
callback: () => {
|
|
93
|
+
// Callback function logic
|
|
75
94
|
},
|
|
76
|
-
|
|
77
|
-
);
|
|
78
|
-
// N.B If query is missing, then VM starts execution from the block-index-0
|
|
95
|
+
});
|
|
79
96
|
```
|
|
80
97
|
|
|
81
|
-
Type
|
|
82
|
-
|
|
83
|
-
| `
|
|
84
|
-
|
|
|
85
|
-
| `payload`
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
| `
|
|
98
|
+
| Parameters | Possible Values | Default Value | Type | Descriptions |
|
|
99
|
+
| -------------------------- | ----------------------------------------------------------------------------- | ------------- | ---------------------- | ------------------------------------------------------------------- |
|
|
100
|
+
| `payload` | `{ physical_address: "", account: "", query: "" }` | None | object | Object containing the physical address, account, and query details. |
|
|
101
|
+
| `payload.physical_address` | Any [`physical_address`](https://godprotocol-web.vercel.app/physical_address) | None | string | The physical address path for the account. |
|
|
102
|
+
| `payload.account` | Any string | None | string | Associated account for execution. |
|
|
103
|
+
| `payload.query` | [`Query Strings`](https://godprotocol-web.vercel.app/explorer/query) | None | string | Query string to specify blocks or other parameters. |
|
|
104
|
+
| `signature` | String | None | string | Optional. Signature for private account access. |
|
|
105
|
+
| `callback` | Function or `account.run{}` | None | `function` or `object` | Optional. Function to call upon execution completion. |
|
|
89
106
|
|
|
90
|
-
|
|
107
|
+
**Description:**
|
|
108
|
+
The /run endpoint in the God Protocol framework allows users to execute a program with a specified payload, which includes the physical address (`payload.physical_address`), associated account (`payload.account`), and query (`payload.query`). If the account is private, a payload `signature` is required. An optional `callback` function can be provided to handle completion events, which may include further execution instructions (`account.run`).
|
|
91
109
|
|
|
92
|
-
|
|
110
|
+
## /parse Endpoint
|
|
93
111
|
|
|
94
|
-
|
|
112
|
+
The /parse endpoint parses data from a specified payload and returns matched blocks or the entire chain if no query is included.
|
|
95
113
|
|
|
96
|
-
|
|
114
|
+
### Example Usage
|
|
97
115
|
|
|
98
116
|
```js
|
|
99
|
-
|
|
100
|
-
{
|
|
101
|
-
physical_address: "
|
|
102
|
-
|
|
103
|
-
|
|
117
|
+
account.parse({
|
|
118
|
+
payload: {
|
|
119
|
+
physical_address: "Accounts/name/path",
|
|
120
|
+
account: "account_id",
|
|
121
|
+
query: "blocks:0",
|
|
104
122
|
},
|
|
105
|
-
|
|
106
|
-
)
|
|
107
|
-
//
|
|
123
|
+
signature: "signature_string",
|
|
124
|
+
callback: () => {
|
|
125
|
+
// Callback function logic
|
|
126
|
+
},
|
|
127
|
+
});
|
|
108
128
|
```
|
|
109
129
|
|
|
110
|
-
Type
|
|
111
|
-
|
|
112
|
-
| `
|
|
113
|
-
|
|
|
114
|
-
| `payload`
|
|
115
|
-
|
|
|
116
|
-
|
|
|
117
|
-
| `
|
|
130
|
+
| Parameters | Possible Values | Default Value | Type | Descriptions |
|
|
131
|
+
| -------------------------- | ----------------------------------------------------------------------------- | ------------- | ---------------------- | ------------------------------------------------------------------- |
|
|
132
|
+
| `payload` | `{ physical_address: "", account: "", query: "" }` | None | object | Object containing the physical address, account, and query details. |
|
|
133
|
+
| `payload.physical_address` | Any [`physical_address`](https://godprotocol-web.vercel.app/physical_address) | None | string | The physical address path for the account. |
|
|
134
|
+
| `payload.account` | Any string | None | string | Associated account for execution. |
|
|
135
|
+
| `payload.query` | [`Query Strings`](https://godprotocol-web.vercel.app/explorer/query) | None | string | Query string to specify blocks or other parameters. |
|
|
136
|
+
| `signature` | String | None | string | Optional. Signature for private account access. |
|
|
137
|
+
| `callback` | Function or `account.run{}` | None | `function` or `object` | Optional. Function to call upon execution completion. |
|
|
138
|
+
|
|
139
|
+
**Description:**
|
|
140
|
+
The /parse endpoint in the God Protocol framework parses data from the specified payload, which includes the physical address (`payload.physical_address`), associated account (`payload.account`), and an optional query (`payload.query`). If the account is private, a payload `signature` is required. An optional `callback` function can be provided to handle completion events, which may include further execution instructions (`account.run`). This endpoint returns the matched block to the callback if a query is included, or the entire chain of the path if no query is provided.
|
|
118
141
|
|
|
119
142
|
See the [package source](https://github.com/immanuel-savvy/godprotocol.git) for more details.
|
|
120
143
|
|