godprotocol 1.0.753 → 1.0.761

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/Objects/Chain.js CHANGED
@@ -78,6 +78,7 @@ class Chain extends Explorer {
78
78
  let obj = {};
79
79
 
80
80
  obj.physical_address = this.physical_address;
81
+ obj.height = this.blocks.length;
81
82
  obj.parent = this.parent.path;
82
83
  obj.account = this.parent.account.name;
83
84
  obj.name = this.name;
@@ -4,6 +4,9 @@ class Explorer {
4
4
  chain_props = ["blocks"];
5
5
 
6
6
  explore = (query) => {
7
+ if (!query) return;
8
+
9
+ if (query.startsWith("{")) query = query.slice(1, -1);
7
10
  query = query.split(":");
8
11
 
9
12
  query[0] = query[0].split(".");
@@ -53,6 +53,17 @@ class Virtual_machine extends Opcodes {
53
53
  return arg;
54
54
  };
55
55
 
56
+ run_block = () => {
57
+ if (!this.running) return;
58
+
59
+ let context = this.get_context();
60
+ let instructions = [];
61
+ for (let b = 0; b < context.blocks.length; b++) {
62
+ let blk = context.blocks[b];
63
+ // let last_ blk.data.slice(-1)[0]
64
+ }
65
+ };
66
+
56
67
  execute = (instruction, track) => {
57
68
  this.track = track;
58
69
 
@@ -79,6 +90,7 @@ class Virtual_machine extends Opcodes {
79
90
  chain = context.parent.add_chain(args);
80
91
  this.contexts.push(chain);
81
92
 
93
+ this.run_block();
82
94
  chain.append_buffer();
83
95
 
84
96
  break;
@@ -95,6 +107,7 @@ class Virtual_machine extends Opcodes {
95
107
  chain.append_buffer();
96
108
 
97
109
  this.contexts.push(chain);
110
+ this.run_block();
98
111
 
99
112
  break;
100
113
  case "listen":
@@ -107,7 +120,9 @@ class Virtual_machine extends Opcodes {
107
120
 
108
121
  break;
109
122
  case "run":
123
+ this.running = true;
110
124
  this.account.run({ query: original_arg }, this.stdin);
125
+ this.running = false;
111
126
  break;
112
127
  case "pop":
113
128
  let blk;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "godprotocol",
3
- "version": "1.0.753",
3
+ "version": "1.0.761",
4
4
  "description": "A data mediator.",
5
5
  "main": "Index.js",
6
6
  "types": "index.d.ts",
package/readme.md ADDED
@@ -0,0 +1,129 @@
1
+ # God Protocol
2
+
3
+ ### A data mediator
4
+
5
+ ## Installation
6
+
7
+ ```
8
+ npm install godprotocol --save
9
+ ```
10
+
11
+ ### Brief Description
12
+
13
+ This package is developing a framework for the Web 4.0
14
+ It is to help provide multiple compute instances for servers and also data flexibility and transactions.
15
+
16
+ You can get overall comprehension in just 4 method calls.
17
+
18
+ ## Create an Account
19
+
20
+ Accounts comes with their own VM, thereby providing concurrency on processes being executed.
21
+
22
+ ```js
23
+ import { start } from "godprotocol";
24
+
25
+ // Create an initial account
26
+ let initiator = start(`public_key`, { private: true | false });
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.
29
+ ```
30
+
31
+ | `Parameters` | Type | Description |
32
+ | ------------ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
33
+ | `name` | string | Account names can be any valid variable string. Such as a Public Key |
34
+ | `private` | object:boolean | default `false`, if set to true, then any payloads sent to the account must be signed using the private key belonging to the account `name` |
35
+
36
+ ## Load Instructions
37
+
38
+ The load method is the second in the pipeline,
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.
42
+
43
+ ### Usage
44
+
45
+ ```js
46
+ initiator.load(
47
+ {
48
+ instructions: ["link Account/initiator/Datatypes/Number", "write 7", "pop"],
49
+ account: `public_key`,
50
+ },
51
+ cb
52
+ );
53
+ ```
54
+
55
+ Type `method`
56
+
57
+ | `Parameters` | Type | Destructure | Description |
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. |
62
+
63
+ ## Run Program
64
+
65
+ The run is technically the second in the pipeline.
66
+
67
+ ### Usage
68
+
69
+ ```js
70
+ initiator.run(
71
+ {
72
+ physical_address: "Account/initiator/Datatypes/Number", // This points to a chain
73
+ query: { blocks: 0 }, // Basically saying, index 0 block in physical_address chain, run again its instructions.
74
+ account: `public_key`,
75
+ },
76
+ cb
77
+ );
78
+ // N.B If query is missing, then VM starts execution from the block-index-0
79
+ ```
80
+
81
+ Type `method`
82
+
83
+ | `Parameters` | Type | Destructure | Description |
84
+ | ------------ | -------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
85
+ | `payload` | object | `physical_address` | [`Physical Addresses`](https://godprotocol-web.vercel.app/physical_address) are logical namespace locations of tokens. They are derived from the high-level representation of the program's instructions. |
86
+ | | object | `query` | A valid blockweb explorer query, you can read the explorer documentation [here](https://godprotocol-web.vercel.app/explorer) |
87
+ | | string | `account` | Account instance to execute the instructions in. |
88
+ | `cb` | function | | A function that is called with the blocks mined during the execution. |
89
+
90
+ ## Parse Result
91
+
92
+ The parse is technically the third of the pipeline. It takes like parameters as the `run` method.
93
+
94
+ ### Usage
95
+
96
+ It is used to retrieve blocks and chains, and also extract their properties.
97
+
98
+ ```js
99
+ initiator.parse(
100
+ {
101
+ physical_address: "Account/initiator/Datatypes/Number", // This points to a chain
102
+ query: { blocks: 0 }, // Basically saying, index 0 block in physical_address chain, retrieve it.
103
+ account: `public_key`,
104
+ },
105
+ cb
106
+ );
107
+ // N.B If query isn't provided, then you parse the chain.
108
+ ```
109
+
110
+ Type `method`
111
+
112
+ | `Parameters` | Type | Destructure | Description |
113
+ | ------------ | -------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
114
+ | `payload` | object | `physical_address` | [`Physical Addresses`](https://godprotocol-web.vercel.app/physical_address) are logical namespace locations of tokens. They are derived from the high-level representation of the program's instructions. |
115
+ | | object | `query` | A valid blockweb explorer query, you can read the explorer documentation [here](https://godprotocol-web.vercel.app/explorer) |
116
+ | | string | `account` | Account instance to execute the instructions in. |
117
+ | `cb` | function | | A function that is called with the blocks mined during the execution. |
118
+
119
+ See the [package source](https://github.com/immanuel-savvy/godprotocol.git) for more details.
120
+
121
+ [npm-url]: https://npmjs.org/package/godprotocol
122
+ [downloads-url]: https://npmjs.org/package/godprotocol
123
+
124
+ ## References
125
+
126
+ [Web Documentation]('https://godprotocol-web.vercel.app')
127
+ [`Physical Addresses`](https://godprotocol-web.vercel.app/physical_address)
128
+ [Explorer](https://godprotocol-web.vercel.app/explorer)
129
+ [`Loader Sequence`](https://godprotocol-web.vercel.app/loader_sequence)