4.4 API Layer
Last updated
Last updated
DxChain 3.0 will provide various RPC services, such as the HTTP/HTTPs-based RPC server, communication between WebSocket and local processes, and in-process RPC services. The JSON-RPC used in DxChain 3.0 is a remote procedure call protocol encoded in JSON, has the characteristics of small data of text transmission and is easy to debug and expand.
The RPC services provided by DxChain nodes can be divided into three categories: public RPC interfaces, private RPC interfaces, and DPOS-RPC.
1. Public RPC interface
The public RPC interface refers to an API that all RPC clients can call and execute, is fully compatible and supports all public RPC interfaces of Ethereum.
2. Private RPC interface
The private RPC interface is prohibited from being executed by HTTP and WS clients by default unless the API that external users can access is specified when gdx is started, including modules such as admin, miner, debug, account, and eth.
3. DPOS-RPC interface
The DPOS-RPC interface is designed to provide query and operation functions for the DPOS consensus. Users can query DPOS related services through this interface, including data query of validator, candidate, voting and staking, etc.
In addition to traditional JSON-RPC, in order to allow various applications to conveniently call the blockchain and smart contract services provided by DxChain, DxChain will also support web3 packages in multiple languages to provide a foundation for various applications to access the DxChain. The web3 service provides a layer of encapsulation for RPC interface calls on the chain, shielding the format of HTTP message encapsulation and the technical details of the Ethereum interface, which significantly facilitates the rapid integration of DxChain services and various Dapps.