JSON-RPC APIs
WorldLand supports the standard Ethereum JSON-RPC API, enabling interaction with the blockchain via HTTP, WebSocket, and IPC transports.
JSON-RPC Server
WorldLand has three transport protocols that can use the JSON-RPC API:
| Feature | HTTP | WebSocket | IPC |
|---|---|---|---|
| Subscribe to events | ❌ | ✅ | ✅ |
| Remote Access | ✅ | ✅ | ❌ |
| Metadata overhead per message | High | Low | Low |
HTTP Server
HTTP is a one-way transport protocol that connects clients and servers. The client sends a request and the server returns a response. HTTP is the most widely used protocol.
Enable the HTTP server:
./worldland -httpThe HTTP server runs on localhost (127.0.0.1) and port 8545 by default. Customize the address and port:
./worldland -http -http.port 3334 -http.addr 129.38.5.26The HTTP server accepts only JSON-RPC requests for the eth, net, web3 modules by default. Enable additional modules:
./worldland -http -http.api eth,net,web3WARNING
Be careful when enabling additional API modules via HTTP as it increases your security risk.
For cross-origin access, add domains using the -http.corsdomain flag:
./worldland -http -http.corsdomain https://remix.ethereum.orgAllow all web pages:
./worldland -http.corsdomain '*'WebSocket Server
WebSocket is a persistent, bidirectional transport protocol that keeps connections alive until terminated. Suitable for sending a large number of requests as it saves the handshake procedure.
The flag command pattern mirrors HTTP. The default port is 8546:
./worldland -ws -ws.port 3334 -ws.api eth,net,web3For cross-origin WebSocket requests:
./worldland -ws -ws.origins https://remix.ethereum.orgDANGER
HTTP and WebSocket servers allow external connections. This means an external attacker can control accounts inside WorldLand. When activated, node accounts are locked. You can forcefully unlock an account by including the --allow-insecure-unlock flag, but this is not secure. Be aware that attacker bots constantly scan HTTP/WebSocket servers.
IPC Server
IPC can be used in local environments where the node and console exist on the same machine. WorldLand creates a local file socket for the connection.
The IPC server is enabled by default and has access to all JSON-RPC modules. Sockets are placed in the same directory as the node.
- Linux/Mac:
~/DATA_DIR/geth.ipc - Windows:
\\.\pipe\geth.ipc
Change or disable the IPC socket:
./worldland -ipcpath /custom/path/geth.ipc
./worldland -ipcdisableJSON-RPC Console
You can start an interactive session by providing the console command when WorldLand starts:
./worldland <other flags> console 2> /dev/nullRedirect and save logs to a file with a custom verbosity level (1-6):
./worldland <other flags> console --verbosity 3 2> worldland.logCommon Console Commands
Check the balance of the first account:
> eth.getBalance(eth.accounts[0])Send a transaction:
> eth.sendTransaction({
from: eth.accounts[0],
to: eth.accounts[1],
value: web3.toWei(0.5, 'ether')
})Load a pre-built JavaScript file:
./worldland console --preload "/my/scripts/folder/utils.js"Exit the console:
> exitOr press Ctrl+D.
APIs
WorldLand supports the same JSON-RPC modules as Ethereum. See the JSON-RPC APIs of Ethereum and go-ethereum for details.
WorldLand-Specific Modules
In addition to the standard modules, WorldLand exposes:
| Module | Description |
|---|---|
eth | Ethereum-compatible blockchain interaction |
net | Network information |
web3 | Web3 utilities |
personal | Account management |
admin | Node administration |
debug | Debug utilities |
ecc | WorldLand ECCPoW-specific APIs |
engine | Engine-related APIs |
miner | Mining control |
txpool | Transaction pool inspection |