Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1801 from LiskHQ/1800-update-terminologies
Browse files Browse the repository at this point in the history
Update terminologies
  • Loading branch information
sameersubudhi authored Aug 16, 2023
2 parents cfe5cfe + d27184f commit 9708d01
Show file tree
Hide file tree
Showing 72 changed files with 404 additions and 383 deletions.
35 changes: 18 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,18 @@ Lisk Service comprises of multiple microservices that can operate independently

Every microservice is independently managed and placed in a separate directory under the [`services`](services) directory. They contain their own `package.json` and `Dockerfile` that are beneficial when running the applications.


| Service | Description |
| --------------------------------------------------------- | ----------- |
| [Gateway](services/gateway) | The Gateway exposes the API for Lisk Service users to access and use over HTTP and WS protocols. Its main purpose is to proxy API requests from users to the concerned Lisk Service microservices. It provides the users with a central point of data access that ensures existing application compatibility. |
| [Connector](services/blockchain-connector) | The Blockchain Connector connects with the node running a Lisk protocol-compliant blockchain application. It is primarily responsible for data transformation and caching, thus reducing the number of calls made to the node. |
| [Coordinator](services/blockchain-coordinator) | The Blockchain Coordinator service is primarily responsible for ensuring the completeness of the index. It performs periodic checks for any gaps in the index and schedules tasks to update it, along with the latest block updates. |
| Service | Description |
| --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Gateway](services/gateway) | The Gateway exposes the API for Lisk Service users to access and use over HTTP and WS protocols. Its main purpose is to proxy API requests from users to the concerned Lisk Service microservices. It provides the users with a central point of data access that ensures existing application compatibility. |
| [Connector](services/blockchain-connector) | The Blockchain Connector connects with the node running a Lisk protocol-compliant blockchain application. It is primarily responsible for data transformation and caching, thus reducing the number of calls made to the node. |
| [Coordinator](services/blockchain-coordinator) | The Blockchain Coordinator service is primarily responsible for ensuring the completeness of the index. It performs periodic checks for any gaps in the index and schedules tasks to update it, along with the latest block updates. |
| [Indexer](services/blockchain-indexer) | The Blockchain Indexer service, in the indexing mode, is primarily responsible to update the index, based on the scheduled jobs by the Blockchain Coordinator. In the data service mode, it serves user request queries made via the RESTful API or WebSocket-based RPC calls. It can run both the indexer and data service modes simultaneously, which is enabled by default. |
| [App Registry](services/blockchain-app-registry) | The Blockchain Application Registry service is primarily responsible for regularly synchronizing and providing off-chain metadata information for known blockchain applications in the Lisk ecosystem. The metadata is maintained in the Lisk [Application Registry](https://github.com/LiskHQ/app-registry) repository. |
| [Fee Estimator](services/fee-estimator) | The Fee Estimator service implements the [dynamic fee system](https://github.com/LiskHQ/lips/blob/main/proposals/lip-0013.md) algorithm to offer users transaction fee recommendations based on the network traffic. |
| [Transaction Statistics](services/transaction-statistics) | The Transaction Statistics service, as the name suggests, is primarily responsible to compute various transaction statistics to offer users various real-time network insights. |
| [Market](services/market) | The Market service allows price data retrieval. It supports multiple sources to keep the current Lisk token price up-to-date and available to the clients in real time. |
| [Export](services/export) | The Export service enables users to download the transaction history as a CSV file for any given account on the blockchain. |
| [Template](services/template) | The Template service is an abstract microservice from which all Lisk Service services are inherited. It allows all services to share a similar interface and design pattern. Its purpose is to reduce code duplication and increase consistency between each service, hence, simplifying code maintenance and testing. |
| [App Registry](services/blockchain-app-registry) | The Blockchain Application Registry service is primarily responsible for regularly synchronizing and providing off-chain metadata information for known blockchain applications in the Lisk ecosystem. The metadata is maintained in the Lisk [Application Registry](https://github.com/LiskHQ/app-registry) repository. |
| [Fee Estimator](services/fee-estimator) | The Fee Estimator service implements the [dynamic fee system](https://github.com/LiskHQ/lips/blob/main/proposals/lip-0013.md) algorithm to offer users transaction fee recommendations based on the network traffic. |
| [Transaction Statistics](services/transaction-statistics) | The Transaction Statistics service, as the name suggests, is primarily responsible to compute various transaction statistics to offer users various real-time network insights. |
| [Market](services/market) | The Market service allows price data retrieval. It supports multiple sources to keep the current Lisk token price up-to-date and available to the clients in real time. |
| [Export](services/export) | The Export service enables users to download the transaction history as a CSV file for any given account on the blockchain. |
| [Template](services/template) | The Template service is an abstract microservice from which all Lisk Service services are inherited. It allows all services to share a similar interface and design pattern. Its purpose is to reduce code duplication and increase consistency between each service, hence, simplifying code maintenance and testing. |

**Remarks**

Expand All @@ -48,14 +47,15 @@ Every microservice is independently managed and placed in a separate directory u
Inter-microservice communications are enabled with a message broker, typically an instance of Redis or NATS.

![Lisk Service Architecture](./docs/assets/architecture.png)

## API documentation

The Gateway service provides the following APIs, which all users of Lisk Service can access and use.

| API | Description |
| ---------------------------------------------------- | ----------- |
| [HTTP API](docs/api/version3.md) | HTTP API is the public RESTful API that provides blockchain data in standardized JSON format. |
| [WebSocket JSON-RPC API](docs/api/version3.md) | The WebSocket-based JSON-RPC API provides blockchain data in standardized JSON format. The API uses the Socket.IO library and is compatible with JSON-RPC 2.0 standards. |
| API | Description |
| ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [HTTP API](docs/api/version3.md) | HTTP API is the public RESTful API that provides blockchain data in standardized JSON format. |
| [WebSocket JSON-RPC API](docs/api/version3.md) | The WebSocket-based JSON-RPC API provides blockchain data in standardized JSON format. The API uses the Socket.IO library and is compatible with JSON-RPC 2.0 standards. |
| [Subscribe API](docs/api/websocket_subscribe_api.md) | The Subscribe API is an event-driven API. It uses a two-way streaming connection, which can notify the client about new data instantly as it arrives. It is responsible for updating users regarding changes in the blockchain network and markets. |

## Installation
Expand All @@ -65,7 +65,8 @@ The default port for REST API requests and Socket.IO-based communication is `990
WebSocket-based APIs can be used through the [Socket.IO](https://socket.io/) library available for many modern programming languages and frameworks.

To continue the installation ensure that you have the following dependencies installed:
- [NodeJS Active LTS - ^v16.15.0](https://nodejs.org/en/about/releases/)

- [NodeJS Active LTS - ^v18.16](https://nodejs.org/en/about/releases/)
- [MySQL - ^v8.0.29](https://dev.mysql.com/doc/relnotes/mysql/8.0/en/)
- [Docker](https://www.docker.com/) with [Docker compose](https://docs.docker.com/compose/install/)
- [GNU Make](https://www.gnu.org/software/make/) and [GNU Tar](https://www.gnu.org/software/tar/)
Expand Down
14 changes: 7 additions & 7 deletions docs/api/version3.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ _Supports pagination._
| blockID | String | `/^\b(?:[A-Fa-f0-9]){64}\b$/` | *(empty)* | |
| height | String | `/^(?:(?:\d+)\|(?::(?:\d+))\|(?:(?:\d+):(?:\d+)?))$/` | *(empty)* | Query by height or a height range. Can be expressed as an interval i.e. `1:20` or `1:` or `:20`. Specified values are inclusive. |
| timestamp | String | `/^(?:(?:\d+)\|(?::(?:\d+))\|(?:(?:\d+):(?:\d+)?))$/` | *(empty)* | Query by timestamp or a timestamp range. Can be expressed as an interval i.e. `1000000:2000000` or `1000000:` or `:2000000`. Specified values are inclusive. |
| executionStatus | String | `/^\b(?:pending\|success\|fail\|,){0,5}\b$/` | *(empty)* | Can be expressed as a CSV. |
| executionStatus | String | `/^\b(?:pending\|successful\|failed\|,){0,5}\b$/` | *(empty)* | Can be expressed as a CSV. |
| nonce | Number | `/^\d+$/` | *(empty)* | |
| limit | Number | `[1,100]` | 10 | |
| offset | Number | `[0,Inf)` | 0 | |
Expand Down Expand Up @@ -360,7 +360,7 @@ _Supports pagination._
"name": null
}
},
"executionStatus": "success",
"executionStatus": "successful",
"index": 0
},
],
Expand Down Expand Up @@ -454,7 +454,7 @@ or
{
"data": {
"result": 1,
"status": "ok",
"status": "valid",
"events": [
{
"data": {
Expand Down Expand Up @@ -5631,7 +5631,7 @@ _Supports pagination._
| --------- | ---- | ---------- | ------- | ------- |
| chainID | String | `/^\b(?:[a-fA-F0-9]{8}\|,)+\b$/` | *(empty)* | Can be expressed as a CSV. |
| name | String | `/^[\w!@$&.]{3,20}$/` | *(empty)* | |
| status | String | `/^\b(?:registered\|active\|terminated\|unregistered\|,){1,7}\b$/` | *(empty)* | Can be expressed as a CSV. |
| status | String | `/^\b(?:registered\|activated\|terminated\|unregistered\|,){1,7}\b$/` | *(empty)* | Can be expressed as a CSV. |
| search | String | `/^[\w!@$&.]{1,20}$/` | *(empty)* | Case-insensitive search by chain name. Supports both partial and full text search. |
| limit | Number | `[1,100]` | 10 | |
| offset | Number | `[0,Inf)` | 0 | |
Expand All @@ -5646,7 +5646,7 @@ _Supports pagination._
{
"name": "Lisk",
"chainID": "00000000",
"status": "active",
"status": "activated",
"address": "lskdwsyfmcko6mcd357446yatromr9vzgu7eb8y99",
"lastCertificateHeight": 160,
"lastUpdated": 1616008148
Expand Down Expand Up @@ -5697,7 +5697,7 @@ No parameters are required.
{
"data": {
"registered": 2503,
"active": 2328,
"activated": 2328,
"terminated": 35,
"totalSupplyLSK": "5000000",
"totalStakedLSK": "3000000",
Expand Down Expand Up @@ -5964,7 +5964,7 @@ _Supports pagination._
"displayName": "Lisk",
"chainID": "00000000",
"title": "Lisk blockchain application",
"status": "active",
"status": "activated",
"description": "Lisk is a blockchain application platform.",
"networkType": "mainnet",
"isDefault": true,
Expand Down
4 changes: 2 additions & 2 deletions docs/api/websocket_subscribe_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ Updates about included transactions within a newly generated block.
"name": null
}
},
"executionStatus": "success",
"executionStatus": "successful",
"index": 0
},
],
Expand Down Expand Up @@ -265,7 +265,7 @@ Updates about deleted transactions within a deleted block. This usually happens
"name": null
}
},
"executionStatus": "success",
"executionStatus": "successful",
"index": 0
},
],
Expand Down
2 changes: 1 addition & 1 deletion framework/bin/socket_io_rpc_multirequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
*/
/* eslint-disable no-console */

const io = require('socket.io-client');
const util = require('util');
const io = require('socket.io-client');
const colorize = require('json-colorizer');

if (process.argv.length < 3) {
Expand Down
5 changes: 2 additions & 3 deletions framework/src/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
* Removal or modification of this copyright notice is prohibited.
*
*/
const util = require('util');
const axios = require('axios');
const HttpStatus = require('http-status-codes');
const debug = require('debug')('http');
const util = require('util');

const delay = require('./delay');

Expand Down Expand Up @@ -83,8 +83,7 @@ const request = async (url, params = {}) => {

if (!httpParams.method) httpParams.method = 'get';

if (httpParams.method.toLowerCase() === 'get'
&& params.cacheTTL && params.cacheTTL > 0) {
if (httpParams.method.toLowerCase() === 'get' && params.cacheTTL && params.cacheTTL > 0) {
key = `${encodeURI(url)}:ttl=${params.cacheTTL}`;
response = await cache.get(key);
}
Expand Down
2 changes: 1 addition & 1 deletion framework/src/requireAllJs.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
* Removal or modification of this copyright notice is prohibited.
*
*/
const requireAll = require('require-all');
const path = require('path');
const requireAll = require('require-all');

const requireAllJs = absolutePath => requireAll({
filter: /(.+)\.js$/,
Expand Down
26 changes: 16 additions & 10 deletions framework/src/socketClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* Removal or modification of this copyright notice is prohibited.
*
*/
const util = require('util');
const io = require('socket.io-client');
const debug = require('debug')('framework:socket');
const util = require('util');

const connectionPool = {};

Expand Down Expand Up @@ -65,19 +65,25 @@ const SocketClient = endpoint => {
});

const emit = (event, data) => new Promise(resolve => {
socket.emit(event, data, answer => {
debug(`Emitting socket event ${event} with data ${util.inspect(data)}: ${util.inspect(answer)}`);
resolve(answer);
socket.emit(event, data, answer => {
debug(
`Emitting socket event ${event} with data ${util.inspect(data)}: ${util.inspect(answer)}`,
);
resolve(answer);
});
});
});

const requestRpc = params => new Promise(resolve => {
debug(`Emitting RPC request ${params}`);
socket.emit('request', params, answer => {
debug(`Received RPC answer for method ${params.method} with params ${params}: ${util.inspect(answer)}`);
answer(resolve);
debug(`Emitting RPC request ${params}`);
socket.emit('request', params, answer => {
debug(
`Received RPC answer for method ${params.method} with params ${params}: ${util.inspect(
answer,
)}`,
);
answer(resolve);
});
});
});

return {
emit,
Expand Down
2 changes: 1 addition & 1 deletion services/blockchain-app-registry/shared/database/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
* Removal or modification of this copyright notice is prohibited.
*
*/
const BluebirdPromise = require('bluebird');
const path = require('path');
const BluebirdPromise = require('bluebird');

const {
Logger,
Expand Down
4 changes: 2 additions & 2 deletions services/blockchain-app-registry/shared/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const MYSQL_ENDPOINT = config.endpoints.mysql;

const APP_STATUS = {
DEFAULT: 'unregistered',
ACTIVE: 'active',
ACTIVATED: 'activated',
};

const knownMainchainIDs = Object
Expand Down Expand Up @@ -213,7 +213,7 @@ const getBlockchainAppsMetadata = async (params) => {

if (await isMainchain()
&& knownMainchainIDs.includes(appMeta.chainID)) {
appMeta.status = APP_STATUS.ACTIVE;
appMeta.status = APP_STATUS.ACTIVATED;
} else {
const [blockchainApp] = (await requestIndexer('blockchain.apps', { chainID: appMeta.chainID })).data;
appMeta.status = blockchainApp ? blockchainApp.status : APP_STATUS.DEFAULT;
Expand Down
2 changes: 1 addition & 1 deletion services/blockchain-app-registry/shared/metadataIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
* Removal or modification of this copyright notice is prohibited.
*
*/
const BluebirdPromise = require('bluebird');
const path = require('path');
const BluebirdPromise = require('bluebird');

const {
Utils: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
* Removal or modification of this copyright notice is prohibited.
*
*/
const BluebirdPromise = require('bluebird');
const path = require('path');
const BluebirdPromise = require('bluebird');
const { Octokit } = require('octokit');

const {
Expand Down
Loading

0 comments on commit 9708d01

Please sign in to comment.