Skip to content

Commit 3b0ba96

Browse files
authored
Merge pull request #1257 from ainblockchain/release/v1.1.4
Release/v1.1.4
2 parents c6d3ab6 + 8028d6d commit 3b0ba96

File tree

20 files changed

+3560
-142
lines changed

20 files changed

+3560
-142
lines changed

JSON_RPC_API.md

Lines changed: 3378 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 61 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,27 @@
33
### [AI Network](https://ainetwork.ai) | [Whitepaper](https://c9ede755-23ca-410d-8a9d-e5b895cd95bb.filesusr.com/ugd/4f6eb2_482a2386addb4c3283ee6e26f8ad42e6.pdf) | [Documentation](https://docs.ainetwork.ai/)
44
Official Javascript implementation of AI Network Blockchain.
55

6+
## JSON-RPC API
7+
8+
For accessing AIN Blockchain nodes, see [JSON_RPC_API.md](./JSON_RPC_API.md).
9+
610
## Install Environment (Last update at 6th of Dec 2021)
711
### OS
812

9-
- macOS 10.15 (macos-latest)
10-
- Ubuntu 20.04 (ubuntu-latest)
13+
- macOS 13.5 (macos-latest)
14+
- Ubuntu 22.04 (ubuntu-latest)
1115

12-
### Node version
16+
### NodeJs version
1317

14-
- v16.x
15-
- v14.x
18+
- v18.x
1619

1720
## Tracker
1821

19-
Tracker server is required by new peers who wish to join the AIN network. Each peer is sent the ipaddress of 2 other nodes in the network. These nodes then gossip information through the network of all transactions and blocks.
22+
Tracker server is required by new peers who wish to join the AIN network. Each peer is sent the ip address of 2 other nodes in the network. These nodes then gossip information through the network of all transactions and blocks.
2023

2124
NOTE: Tracker Server must be started first before starting any blockchain node instances.
2225

23-
### Running without Docker
26+
### Running Tracker without Docker
2427

2528
#### Local
2629

@@ -44,26 +47,22 @@ You can override default port numbering system by setting `PORT` and `P2P_PORT`
4447
```
4548
gcloud init
4649
# For genesis deploy
47-
bash deploy_blockchain_genesis_gcp.sh {dev|staging|spring|summer} <# of Shards> [--setup]
50+
bash deploy_blockchain_genesis_gcp.sh [dev|staging|sandbox|exp|spring|summer|mainnet] <# of Shards> <Parent Node Index Begin> <Parent Node Index End> [--setup] [--keystore|--mnemonic|--private-key] [--keep-code|--no-keep-code] [--keep-data|--no-keep-data] [--full-sync|--fast-sync] [--chown-data|--no-chown-data] [--kill-only|--skip-kill]
4851
# For incremental deploy
49-
bash deploy_blockchain_incremental_gcp.sh {dev|staging|spring|summer} <# of Shards> <Begin Parent Node Index> <End Parent Node Index> [--setup]
52+
bash deploy_blockchain_incremental_gcp.sh [dev|staging|sandbox|exp|spring|summer|mainnet] <# of Shards> <Parent Node Index Begin> <Parent Node Index End> [--setup] [--keystore|--mnemonic|--private-key] [--keep-code|--no-keep-code] [--keep-data|--no-keep-data] [--full-sync|--fast-sync] [--chown-data|--no-chown-data]
5053
```
5154
- Set up Ubuntu machine (if it's on a new VM)
5255
```
5356
bash setup_blockchain_ubuntu.sh
5457
```
55-
- Copy files to a sharable folder & install yarn packages
56-
```
57-
source setup_tracker_gcp.sh
58-
```
5958
- Start tracker server job
6059
```
6160
cd ain-blockchain/
62-
bash start_tracker_genesis_gcp.sh
61+
bash start_tracker_genesis_gcp.sh <GCP Username> [--keep-code|--no-keep-code]
6362
```
6463

6564
<!--
66-
### Running with Docker
65+
### Running Tracker with Docker
6766
6867
- Build Docker image
6968
```
@@ -80,21 +79,21 @@ docker run --network="host" -d ainblockchain/tracker-server:latest
8079
```
8180
-->
8281

83-
### Client API for development and debugging
82+
### Tracker Client API for development and testing purposes
8483

85-
#### Tracker health check
84+
#### Tracker protocol version check & health check
8685

87-
GET http://<ip_address>:5000/
86+
GET http://<ip_address>:8080/
8887

89-
#### Node status check
88+
#### Network status check
9089

91-
GET http://<ip_address>:5000/peer_nodes
90+
GET http://<ip_address>:8080/network_status
9291

93-
## Node
92+
## Blockchain Node
9493

9594
Operates a single peer node instance of the AIN blockchain. A single blockchain node instance processes incoming transaction requests and maintains a local copy of the entire blockchain. The blockchain node first queries the tracker-server for ip addresses of other peers, and then syncs its local blockchain to the network consensus blockchain. If a node is included in the whitelist and has staked appropriate amount of AIN, it will then take part in the consensus protocol.
9695

97-
### Running without Docker
96+
### Running Blockchain Node without Docker
9897

9998
#### Local
10099

@@ -131,24 +130,20 @@ BLOCKCHAIN_CONFIGS_DIR=blockchain-configs/afan-shard MIN_NUM_VALIDATORS=1 DEBUG=
131130
```
132131
gcloud init
133132
# For genesis deploy
134-
bash deploy_blockchain_genesis_gcp.sh {dev|staging|spring|summer} <# of Shards> [--setup]
133+
bash deploy_blockchain_genesis_gcp.sh [dev|staging|sandbox|exp|spring|summer|mainnet] <# of Shards> <Parent Node Index Begin> <Parent Node Index End> [--setup] [--keystore|--mnemonic|--private-key] [--keep-code|--no-keep-code] [--keep-data|--no-keep-data] [--full-sync|--fast-sync] [--chown-data|--no-chown-data] [--kill-only|--skip-kill]
135134
# For incremental deploy
136-
bash deploy_blockchain_incremental_gcp.sh {dev|staging|spring|summer} <# of Shards> <Begin Parent Node Index> <End Parent Node Index> [--setup]
135+
bash deploy_blockchain_incremental_gcp.sh [dev|staging|sandbox|exp|spring|summer|mainnet] <# of Shards> <Parent Node Index Begin> <Parent Node Index End> [--setup] [--keystore|--mnemonic|--private-key] [--keep-code|--no-keep-code] [--keep-data|--no-keep-data] [--full-sync|--fast-sync] [--chown-data|--no-chown-data]
137136
```
138137
- Set up Ubuntu machine (if it's on a new VM)
139138
```
140139
bash setup_blockchain_ubuntu.sh
141140
```
142-
- Copy files to a sharable folder & install yarn packages
143-
```
144-
source setup_node_gcp.sh
145-
```
146141
- Start Node server job (set shard index to 0 if you're running a root chain node)
147142
```
148-
bash start_node_genesis_gcp.sh {dev|spring|summer} <SHARD_INDEX> <SERVER_INDEX>
143+
bash start_node_genesis_gcp.sh [dev|staging|sandbox|exp|spring|summer|mainnet] <GCP Username> <Shard Index> <Node Index> [--keystore|--mnemonic|--private-key] [--keep-code|--no-keep-code] [--keep-data|--no-keep-data] [--full-sync|--fast-sync] [--chown-data|--no-chown-data] [--json-rpc] [--update-front-db] [--rest-func] [--event-handler]
149144
```
150145

151-
### Running with Docker
146+
### Running Blockchain Node with Docker
152147

153148
- Pull Docker image from [Docker Hub](https://hub.docker.com/repository/docker/ainblockchain/ain-blockchain)
154149
```
@@ -207,7 +202,7 @@ cat logger/logs/8080/<log_file>
207202
```
208203
-->
209204

210-
### How to run tests
205+
### Testing How-Tos
211206

212207
How to run unit test and integration test all around.
213208
```
@@ -217,27 +212,52 @@ yarn run test_integration
217212

218213
Some individual tests already definded in the package.json.
219214
```
220-
yarn run test_chain_util
221-
yarn run test_state_util
222-
yarn run test_block_pool
223-
yarn run test_db
224-
yarn run test_node
225-
yarn run test_blockchain
226-
yarn run test_dapp
227-
yarn run test_sharding
215+
yarn run test_unit_block_pool
216+
yarn run test_unit_blockchain
217+
yarn run test_unit_common_util
218+
yarn run test_unit_consensus
219+
yarn run test_unit_db
220+
yarn run test_unit_event_handler
221+
yarn run test_unit_functions
222+
yarn run test_unit_object_util
223+
yarn run test_unit_p2p
224+
yarn run test_unit_p2p_util
225+
yarn run test_unit_radix_node
226+
yarn run test_unit_radix_tree
227+
yarn run test_unit_rule_util
228+
yarn run test_unit_state_manager
229+
yarn run test_unit_state_node
230+
yarn run test_unit_state_util
231+
yarn run test_unit_traffic_db
232+
yarn run test_unit_traffic_sm
233+
yarn run test_unit_tx
234+
yarn run test_unit_tx_pool
235+
yarn run test_integration_dapp
236+
yarn run test_integration_blockchain
237+
yarn run test_integration_consensus
238+
yarn run test_integration_event_handler
239+
yarn run test_integration_function
240+
yarn run test_integration_node
241+
yarn run test_integration_he_protocol
242+
yarn run test_integration_he_sharding
243+
yarn run test_integration_sharding
228244
```
229245

230246
The load test is also supported.
231247
```
232248
yarn run loadtest
233249
```
234250

235-
### Client API for development and debugging
251+
### Blockchain Node Client API for development and testing purposes
236252

237-
#### Node health check
253+
#### Node protocol version check
238254

239255
GET http://<ip_address>:8080/
240256

257+
#### Node health check
258+
259+
GET http://<ip_address>:8080/health_check
260+
241261
#### Fetch latest blocks in the blockchain (up to 20 blocks)
242262

243263
GET http://<ip_address>:8080/blocks

blockchain-configs/afan-shard/node_params.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
3737
"GET_OP_LIST_SIZE_LIMIT": 50,
3838
"GET_RESP_BYTES_LIMIT": 20000000,
39-
"GET_RESP_MAX_SIBLINGS": 5000,
39+
"GET_RESP_MAX_SIBLINGS": 20000,
4040
"HOSTING_ENV": "local",
4141
"LIGHTWEIGHT": false,
4242
"MAX_BLOCKCHAIN_API_RATE_LIMIT": 20,

blockchain-configs/base/node_params.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
3737
"GET_OP_LIST_SIZE_LIMIT": 50,
3838
"GET_RESP_BYTES_LIMIT": 20000000,
39-
"GET_RESP_MAX_SIBLINGS": 5000,
39+
"GET_RESP_MAX_SIBLINGS": 20000,
4040
"HOSTING_ENV": "local",
4141
"LIGHTWEIGHT": false,
4242
"MAX_BLOCKCHAIN_API_RATE_LIMIT": 20,

blockchain-configs/he-shard/node_params.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
3737
"GET_OP_LIST_SIZE_LIMIT": 50,
3838
"GET_RESP_BYTES_LIMIT": 20000000,
39-
"GET_RESP_MAX_SIBLINGS": 5000,
39+
"GET_RESP_MAX_SIBLINGS": 20000,
4040
"HOSTING_ENV": "local",
4141
"LIGHTWEIGHT": false,
4242
"MAX_BLOCKCHAIN_API_RATE_LIMIT": 20,

blockchain-configs/mainnet-prod/node_params.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
3636
"GET_OP_LIST_SIZE_LIMIT": 50,
3737
"GET_RESP_BYTES_LIMIT": 20000000,
38-
"GET_RESP_MAX_SIBLINGS": 5000,
38+
"GET_RESP_MAX_SIBLINGS": 20000,
3939
"HOSTING_ENV": "gcp",
4040
"LIGHTWEIGHT": false,
4141
"MAX_BLOCKCHAIN_API_RATE_LIMIT": 20,

blockchain-configs/sim-shard/node_params.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
3737
"GET_OP_LIST_SIZE_LIMIT": 50,
3838
"GET_RESP_BYTES_LIMIT": 20000000,
39-
"GET_RESP_MAX_SIBLINGS": 5000,
39+
"GET_RESP_MAX_SIBLINGS": 20000,
4040
"HOSTING_ENV": "local",
4141
"LIGHTWEIGHT": false,
4242
"MAX_BLOCKCHAIN_API_RATE_LIMIT": 20,

blockchain-configs/testnet-dev/node_params.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
3737
"GET_OP_LIST_SIZE_LIMIT": 50,
3838
"GET_RESP_BYTES_LIMIT": 20000000,
39-
"GET_RESP_MAX_SIBLINGS": 5000,
39+
"GET_RESP_MAX_SIBLINGS": 20000,
4040
"HOSTING_ENV": "gcp",
4141
"LIGHTWEIGHT": false,
4242
"MAX_BLOCKCHAIN_API_RATE_LIMIT": 20,

blockchain-configs/testnet-exp/node_params.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
3737
"GET_OP_LIST_SIZE_LIMIT": 50,
3838
"GET_RESP_BYTES_LIMIT": 20000000,
39-
"GET_RESP_MAX_SIBLINGS": 5000,
39+
"GET_RESP_MAX_SIBLINGS": 20000,
4040
"HOSTING_ENV": "gcp",
4141
"LIGHTWEIGHT": false,
4242
"MAX_BLOCKCHAIN_API_RATE_LIMIT": 20,

blockchain-configs/testnet-prod/node_params.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
3737
"GET_OP_LIST_SIZE_LIMIT": 50,
3838
"GET_RESP_BYTES_LIMIT": 20000000,
39-
"GET_RESP_MAX_SIBLINGS": 5000,
39+
"GET_RESP_MAX_SIBLINGS": 20000,
4040
"HOSTING_ENV": "gcp",
4141
"LIGHTWEIGHT": false,
4242
"MAX_BLOCKCHAIN_API_RATE_LIMIT": 20,

blockchain-configs/testnet-sandbox/node_params.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
3737
"GET_OP_LIST_SIZE_LIMIT": 50,
3838
"GET_RESP_BYTES_LIMIT": 20000000,
39-
"GET_RESP_MAX_SIBLINGS": 5000,
39+
"GET_RESP_MAX_SIBLINGS": 20000,
4040
"HOSTING_ENV": "gcp",
4141
"LIGHTWEIGHT": false,
4242
"MAX_BLOCKCHAIN_API_RATE_LIMIT": 20,

blockchain-configs/testnet-staging/node_params.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
3737
"GET_OP_LIST_SIZE_LIMIT": 50,
3838
"GET_RESP_BYTES_LIMIT": 20000000,
39-
"GET_RESP_MAX_SIBLINGS": 5000,
39+
"GET_RESP_MAX_SIBLINGS": 20000,
4040
"HOSTING_ENV": "gcp",
4141
"LIGHTWEIGHT": false,
4242
"MAX_BLOCKCHAIN_API_RATE_LIMIT": 20,

client/protocol_versions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,5 +134,8 @@
134134
},
135135
"1.1.3": {
136136
"min": "1.0.0"
137+
},
138+
"1.1.4": {
139+
"min": "1.0.0"
137140
}
138141
}

json_rpc/account.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,5 @@ module.exports = function getAccountApis(node) {
4040
trafficStatsManager.addEvent(TrafficEventTypes.JSON_RPC_GET, latency);
4141
done(null, JsonRpcUtil.addProtocolVersion({ result }));
4242
},
43-
44-
[JSON_RPC_METHODS.AIN_GET_VALIDATOR_INFO]: function(args, done) {
45-
const beginTime = Date.now();
46-
const addr = args.address;
47-
const isWhitelisted = node.db.getValue(PathUtil.getConsensusProposerWhitelistAddrPath(addr)) || false;
48-
const stake = node.db.getValue(PathUtil.getServiceAccountBalancePath(addr)) || 0;
49-
const latency = Date.now() - beginTime;
50-
trafficStatsManager.addEvent(TrafficEventTypes.JSON_RPC_GET, latency);
51-
done(null, JsonRpcUtil.addProtocolVersion({
52-
result: {
53-
isWhitelisted,
54-
stake,
55-
}
56-
}));
57-
},
5843
};
5944
};

0 commit comments

Comments
 (0)