Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/v1.1.4 #1257

Merged
merged 63 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
758d997
Merge pull request #1220 from ainblockchain/release/v1.1.3
platfowner Dec 12, 2023
58fc007
Tweak README.md
platfowner Dec 19, 2023
301e477
Merge pull request #1223 from ainblockchain/feature/platfowner/feature
platfowner Dec 19, 2023
51a139c
Update README.md
platfowner Jan 2, 2024
3cfb23e
Merge pull request #1224 from ainblockchain/platfowner-patch-1
platfowner Jan 2, 2024
f423aa4
Add JSON_RPC_API.md with transaction apis
platfowner Jan 2, 2024
33e8bc0
Merge pull request #1225 from ainblockchain/feature/platfowner/feature
platfowner Jan 2, 2024
9a0fcad
Add block apis to JSON_RPC_API.md
platfowner Jan 3, 2024
1168976
Merge pull request #1226 from ainblockchain/feature/platfowner/feature
platfowner Jan 4, 2024
2809a22
Add database api and account api to json_rpc_api.md file
platfowner Jan 4, 2024
1cdb20e
Merge pull request #1227 from ainblockchain/feature/platfowner/feature
platfowner Jan 4, 2024
bf80b2b
Add network api to json_rpc_api.md file
platfowner Jan 8, 2024
d708705
Merge pull request #1228 from ainblockchain/feature/platfowner/feature
platfowner Jan 8, 2024
a7d1502
Update README.md
platfowner Jan 10, 2024
de5a6de
Merge pull request #1229 from ainblockchain/platfowner-patch-2
platfowner Jan 10, 2024
c71603b
Update JSON_RPC_API.md
platfowner Jan 11, 2024
e532064
Merge pull request #1230 from ainblockchain/platfowner-patch-3
platfowner Jan 11, 2024
47f7aa1
Fix curl command line options in the json rpc md file
platfowner Jan 30, 2024
907c2f3
Merge pull request #1231 from ainblockchain/feature/platfowner/feature
platfowner Jan 30, 2024
54b87d5
Add match apis to json rpc api md file
platfowner Jan 31, 2024
783232a
Add eval apis to json rpc api md file
platfowner Jan 31, 2024
57a62c0
Add ain_getStateProof api to JSON_RPC_API.md file
platfowner Jan 31, 2024
2efaeb7
Add ain_getProofHash api to JSON_RPC_API.md file
platfowner Jan 31, 2024
2ef360b
Add ain_getStateInfo, ain_getStateUsage apis to JSON_RPC_API.md file
platfowner Jan 31, 2024
29e2538
Update contents table of JSON_RPC_API.md file
platfowner Feb 1, 2024
e4101eb
Merge pull request #1232 from ainblockchain/bugfix/platfowner/bugfix
platfowner Feb 1, 2024
37fbe9a
Add or update account APIs of JSON_RPC_API.md file
platfowner Feb 1, 2024
e04c5be
Merge pull request #1233 from ainblockchain/bugfix/platfowner/bugfix
platfowner Feb 2, 2024
15ecd67
Update or add transaction APIs to JSON_RPC_API.md file
platfowner Feb 2, 2024
b9a996c
Merge pull request #1236 from ainblockchain/feature/platfowner/feature
platfowner Feb 2, 2024
9c55487
Fix ain_getPendingTransactions API
platfowner Feb 5, 2024
53db36f
Spin off Consensus section from Block secsion
platfowner Feb 5, 2024
f4596d6
Merge pull request #1237 from ainblockchain/bugfix/platfowner/bugfix
platfowner Feb 5, 2024
9179091
Re-arrange block apis
platfowner Feb 5, 2024
d5071e7
Fix or update block apis
platfowner Feb 5, 2024
5ba09ad
Re-arrange block apis in json_rpc/block.js
platfowner Feb 5, 2024
af9e336
Spin off consensus apis from block apis in json_rpc/block.js
platfowner Feb 5, 2024
a3bc69a
Merge pull request #1238 from ainblockchain/feature/platfowner/feature
platfowner Feb 5, 2024
07bb948
Merge pull request #1239 from ainblockchain/bugfix/platfowner/bugfix
platfowner Feb 7, 2024
cbe033e
Fix or update Consensus APIs in JSON_RPC_API.md file
platfowner Feb 8, 2024
f6ade8c
Fix consensus api import issue
platfowner Feb 8, 2024
8a415da
Fix validator info stake balance bug
platfowner Feb 8, 2024
86a6a91
Merge pull request #1242 from ainblockchain/bugfix/platfowner/bugfix
platfowner Feb 8, 2024
68a23d1
Merge pull request #1241 from ainblockchain/feature/platfowner/feature
platfowner Feb 8, 2024
e0b508e
Update network apis in JSON_RPC_API.md file
platfowner Feb 13, 2024
b5456ad
Consensus API -> Blockchain Node API
platfowner Feb 13, 2024
8fd9227
Add descriptions about protoVer parameter
platfowner Feb 13, 2024
5036716
Rename: Consensus API -> Blockchain Node API
platfowner Feb 13, 2024
e8599f7
Merge pull request #1244 from ainblockchain/feature/platfowner/feature
platfowner Feb 13, 2024
3c5838a
Merge pull request #1245 from ainblockchain/bugfix/platfowner/bugfix
platfowner Feb 13, 2024
c3b2624
Add descriptions about get and set operations to JSON_RPC_API.md
platfowner Feb 14, 2024
46e15a9
Fix descriptions about unordered nonce and ordered nonce
platfowner Feb 14, 2024
9b8a80e
Merge pull request #1246 from ainblockchain/feature/platfowner/feature
platfowner Feb 16, 2024
45282f6
Fix JSON_RPC_API.md
platfowner Feb 22, 2024
4272b1f
Merge pull request #1247 from ainblockchain/platfowner-patch-4
platfowner Feb 22, 2024
27f2508
Fix a typo
platfowner Feb 26, 2024
825058d
Merge pull request #1249 from ainblockchain/bugfix/platfowner/bugfix
platfowner Feb 27, 2024
5fd5e43
Tweak net apis on JSON_RPC_API.md
platfowner Mar 8, 2024
f800bc4
Re-order json rpc methods in network.js
platfowner Mar 8, 2024
4aabe88
Merge pull request #1251 from ainblockchain/bugfix/platfowner/bugfix
platfowner Mar 8, 2024
1c97cc6
Increase GET_RESP_MAX_SIBLINGS node param to 20000 from 5000
platfowner Mar 15, 2024
f4235f5
Merge pull request #1256 from ainblockchain/bugfix/platfowner/bugfix
platfowner Mar 15, 2024
8028d6d
Upgrade blockchain package version to v1.1.4
platfowner Mar 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,378 changes: 3,378 additions & 0 deletions JSON_RPC_API.md

Large diffs are not rendered by default.

102 changes: 61 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,27 @@
### [AI Network](https://ainetwork.ai) | [Whitepaper](https://c9ede755-23ca-410d-8a9d-e5b895cd95bb.filesusr.com/ugd/4f6eb2_482a2386addb4c3283ee6e26f8ad42e6.pdf) | [Documentation](https://docs.ainetwork.ai/)
Official Javascript implementation of AI Network Blockchain.

## JSON-RPC API

For accessing AIN Blockchain nodes, see [JSON_RPC_API.md](./JSON_RPC_API.md).

## Install Environment (Last update at 6th of Dec 2021)
### OS

- macOS 10.15 (macos-latest)
- Ubuntu 20.04 (ubuntu-latest)
- macOS 13.5 (macos-latest)
- Ubuntu 22.04 (ubuntu-latest)

### Node version
### NodeJs version

- v16.x
- v14.x
- v18.x

## Tracker

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.
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.

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

### Running without Docker
### Running Tracker without Docker

#### Local

Expand All @@ -44,26 +47,22 @@ You can override default port numbering system by setting `PORT` and `P2P_PORT`
```
gcloud init
# For genesis deploy
bash deploy_blockchain_genesis_gcp.sh {dev|staging|spring|summer} <# of Shards> [--setup]
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]
# For incremental deploy
bash deploy_blockchain_incremental_gcp.sh {dev|staging|spring|summer} <# of Shards> <Begin Parent Node Index> <End Parent Node Index> [--setup]
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]
```
- Set up Ubuntu machine (if it's on a new VM)
```
bash setup_blockchain_ubuntu.sh
```
- Copy files to a sharable folder & install yarn packages
```
source setup_tracker_gcp.sh
```
- Start tracker server job
```
cd ain-blockchain/
bash start_tracker_genesis_gcp.sh
bash start_tracker_genesis_gcp.sh <GCP Username> [--keep-code|--no-keep-code]
```

<!--
### Running with Docker
### Running Tracker with Docker

- Build Docker image
```
Expand All @@ -80,21 +79,21 @@ docker run --network="host" -d ainblockchain/tracker-server:latest
```
-->

### Client API for development and debugging
### Tracker Client API for development and testing purposes

#### Tracker health check
#### Tracker protocol version check & health check

GET http://<ip_address>:5000/
GET http://<ip_address>:8080/

#### Node status check
#### Network status check

GET http://<ip_address>:5000/peer_nodes
GET http://<ip_address>:8080/network_status

## Node
## Blockchain Node

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.

### Running without Docker
### Running Blockchain Node without Docker

#### Local

Expand Down Expand Up @@ -131,24 +130,20 @@ BLOCKCHAIN_CONFIGS_DIR=blockchain-configs/afan-shard MIN_NUM_VALIDATORS=1 DEBUG=
```
gcloud init
# For genesis deploy
bash deploy_blockchain_genesis_gcp.sh {dev|staging|spring|summer} <# of Shards> [--setup]
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]
# For incremental deploy
bash deploy_blockchain_incremental_gcp.sh {dev|staging|spring|summer} <# of Shards> <Begin Parent Node Index> <End Parent Node Index> [--setup]
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]
```
- Set up Ubuntu machine (if it's on a new VM)
```
bash setup_blockchain_ubuntu.sh
```
- Copy files to a sharable folder & install yarn packages
```
source setup_node_gcp.sh
```
- Start Node server job (set shard index to 0 if you're running a root chain node)
```
bash start_node_genesis_gcp.sh {dev|spring|summer} <SHARD_INDEX> <SERVER_INDEX>
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]
```

### Running with Docker
### Running Blockchain Node with Docker

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

### How to run tests
### Testing How-Tos

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

Some individual tests already definded in the package.json.
```
yarn run test_chain_util
yarn run test_state_util
yarn run test_block_pool
yarn run test_db
yarn run test_node
yarn run test_blockchain
yarn run test_dapp
yarn run test_sharding
yarn run test_unit_block_pool
yarn run test_unit_blockchain
yarn run test_unit_common_util
yarn run test_unit_consensus
yarn run test_unit_db
yarn run test_unit_event_handler
yarn run test_unit_functions
yarn run test_unit_object_util
yarn run test_unit_p2p
yarn run test_unit_p2p_util
yarn run test_unit_radix_node
yarn run test_unit_radix_tree
yarn run test_unit_rule_util
yarn run test_unit_state_manager
yarn run test_unit_state_node
yarn run test_unit_state_util
yarn run test_unit_traffic_db
yarn run test_unit_traffic_sm
yarn run test_unit_tx
yarn run test_unit_tx_pool
yarn run test_integration_dapp
yarn run test_integration_blockchain
yarn run test_integration_consensus
yarn run test_integration_event_handler
yarn run test_integration_function
yarn run test_integration_node
yarn run test_integration_he_protocol
yarn run test_integration_he_sharding
yarn run test_integration_sharding
```

The load test is also supported.
```
yarn run loadtest
```

### Client API for development and debugging
### Blockchain Node Client API for development and testing purposes

#### Node health check
#### Node protocol version check

GET http://<ip_address>:8080/

#### Node health check

GET http://<ip_address>:8080/health_check

#### Fetch latest blocks in the blockchain (up to 20 blocks)

GET http://<ip_address>:8080/blocks
Expand Down
2 changes: 1 addition & 1 deletion blockchain-configs/afan-shard/node_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
"GET_OP_LIST_SIZE_LIMIT": 50,
"GET_RESP_BYTES_LIMIT": 20000000,
"GET_RESP_MAX_SIBLINGS": 5000,
"GET_RESP_MAX_SIBLINGS": 20000,
"HOSTING_ENV": "local",
"LIGHTWEIGHT": false,
"MAX_BLOCKCHAIN_API_RATE_LIMIT": 20,
Expand Down
2 changes: 1 addition & 1 deletion blockchain-configs/base/node_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
"GET_OP_LIST_SIZE_LIMIT": 50,
"GET_RESP_BYTES_LIMIT": 20000000,
"GET_RESP_MAX_SIBLINGS": 5000,
"GET_RESP_MAX_SIBLINGS": 20000,
"HOSTING_ENV": "local",
"LIGHTWEIGHT": false,
"MAX_BLOCKCHAIN_API_RATE_LIMIT": 20,
Expand Down
2 changes: 1 addition & 1 deletion blockchain-configs/he-shard/node_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
"GET_OP_LIST_SIZE_LIMIT": 50,
"GET_RESP_BYTES_LIMIT": 20000000,
"GET_RESP_MAX_SIBLINGS": 5000,
"GET_RESP_MAX_SIBLINGS": 20000,
"HOSTING_ENV": "local",
"LIGHTWEIGHT": false,
"MAX_BLOCKCHAIN_API_RATE_LIMIT": 20,
Expand Down
2 changes: 1 addition & 1 deletion blockchain-configs/mainnet-prod/node_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
"GET_OP_LIST_SIZE_LIMIT": 50,
"GET_RESP_BYTES_LIMIT": 20000000,
"GET_RESP_MAX_SIBLINGS": 5000,
"GET_RESP_MAX_SIBLINGS": 20000,
"HOSTING_ENV": "gcp",
"LIGHTWEIGHT": false,
"MAX_BLOCKCHAIN_API_RATE_LIMIT": 20,
Expand Down
2 changes: 1 addition & 1 deletion blockchain-configs/sim-shard/node_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
"GET_OP_LIST_SIZE_LIMIT": 50,
"GET_RESP_BYTES_LIMIT": 20000000,
"GET_RESP_MAX_SIBLINGS": 5000,
"GET_RESP_MAX_SIBLINGS": 20000,
"HOSTING_ENV": "local",
"LIGHTWEIGHT": false,
"MAX_BLOCKCHAIN_API_RATE_LIMIT": 20,
Expand Down
2 changes: 1 addition & 1 deletion blockchain-configs/testnet-dev/node_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
"GET_OP_LIST_SIZE_LIMIT": 50,
"GET_RESP_BYTES_LIMIT": 20000000,
"GET_RESP_MAX_SIBLINGS": 5000,
"GET_RESP_MAX_SIBLINGS": 20000,
"HOSTING_ENV": "gcp",
"LIGHTWEIGHT": false,
"MAX_BLOCKCHAIN_API_RATE_LIMIT": 20,
Expand Down
2 changes: 1 addition & 1 deletion blockchain-configs/testnet-exp/node_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
"GET_OP_LIST_SIZE_LIMIT": 50,
"GET_RESP_BYTES_LIMIT": 20000000,
"GET_RESP_MAX_SIBLINGS": 5000,
"GET_RESP_MAX_SIBLINGS": 20000,
"HOSTING_ENV": "gcp",
"LIGHTWEIGHT": false,
"MAX_BLOCKCHAIN_API_RATE_LIMIT": 20,
Expand Down
2 changes: 1 addition & 1 deletion blockchain-configs/testnet-prod/node_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
"GET_OP_LIST_SIZE_LIMIT": 50,
"GET_RESP_BYTES_LIMIT": 20000000,
"GET_RESP_MAX_SIBLINGS": 5000,
"GET_RESP_MAX_SIBLINGS": 20000,
"HOSTING_ENV": "gcp",
"LIGHTWEIGHT": false,
"MAX_BLOCKCHAIN_API_RATE_LIMIT": 20,
Expand Down
2 changes: 1 addition & 1 deletion blockchain-configs/testnet-sandbox/node_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
"GET_OP_LIST_SIZE_LIMIT": 50,
"GET_RESP_BYTES_LIMIT": 20000000,
"GET_RESP_MAX_SIBLINGS": 5000,
"GET_RESP_MAX_SIBLINGS": 20000,
"HOSTING_ENV": "gcp",
"LIGHTWEIGHT": false,
"MAX_BLOCKCHAIN_API_RATE_LIMIT": 20,
Expand Down
2 changes: 1 addition & 1 deletion blockchain-configs/testnet-staging/node_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"FREE_TX_POOL_SIZE_LIMIT_RATIO_PER_ACCOUNT": 0.1,
"GET_OP_LIST_SIZE_LIMIT": 50,
"GET_RESP_BYTES_LIMIT": 20000000,
"GET_RESP_MAX_SIBLINGS": 5000,
"GET_RESP_MAX_SIBLINGS": 20000,
"HOSTING_ENV": "gcp",
"LIGHTWEIGHT": false,
"MAX_BLOCKCHAIN_API_RATE_LIMIT": 20,
Expand Down
3 changes: 3 additions & 0 deletions client/protocol_versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,8 @@
},
"1.1.3": {
"min": "1.0.0"
},
"1.1.4": {
"min": "1.0.0"
}
}
15 changes: 0 additions & 15 deletions json_rpc/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,5 @@ module.exports = function getAccountApis(node) {
trafficStatsManager.addEvent(TrafficEventTypes.JSON_RPC_GET, latency);
done(null, JsonRpcUtil.addProtocolVersion({ result }));
},

[JSON_RPC_METHODS.AIN_GET_VALIDATOR_INFO]: function(args, done) {
const beginTime = Date.now();
const addr = args.address;
const isWhitelisted = node.db.getValue(PathUtil.getConsensusProposerWhitelistAddrPath(addr)) || false;
const stake = node.db.getValue(PathUtil.getServiceAccountBalancePath(addr)) || 0;
const latency = Date.now() - beginTime;
trafficStatsManager.addEvent(TrafficEventTypes.JSON_RPC_GET, latency);
done(null, JsonRpcUtil.addProtocolVersion({
result: {
isWhitelisted,
stake,
}
}));
},
};
};
Loading
Loading