Skip to content

Web3 API Reference

web3.eth

The web3-eth package allows you to interact with the WorldLand blockchain and smart contracts.

javascript
var Eth = require('web3-eth');

// Connect to WorldLand Seoul Mainnet
var eth = new Eth('https://seoul.worldland.foundation/');

// or using the web3 umbrella package
var Web3 = require('web3');
var web3 = new Web3('https://seoul.worldland.foundation/');
// -> web3.eth

Commonly Used Methods

Block & Network

MethodDescription
web3.eth.getBlockNumber()Returns the current block number
web3.eth.getBlock(blockNumber)Returns a block matching the block number
web3.eth.getChainId()Returns the chain ID (103 for Seoul)
web3.eth.isSyncing()Returns sync status of the node
web3.eth.getGasPrice()Returns the current gas price
web3.eth.getProtocolVersion()Returns the protocol version
web3.eth.getCoinbase()Returns the coinbase address
web3.eth.isMining()Returns whether the node is mining
web3.eth.getHashrate()Returns the current hashrate

Account & Balance

MethodDescription
web3.eth.getAccounts()Returns list of accounts
web3.eth.getBalance(address)Returns the balance of an address
web3.eth.getTransactionCount(address)Returns the nonce of an address
web3.eth.requestAccounts()Request accounts from the provider

Transaction

MethodDescription
web3.eth.sendTransaction(txObject)Sends a transaction
web3.eth.sendSignedTransaction(signedTx)Sends a signed transaction
web3.eth.getTransaction(txHash)Returns a transaction by hash
web3.eth.getTransactionReceipt(txHash)Returns a transaction receipt
web3.eth.getPendingTransactions()Returns pending transactions
web3.eth.getTransactionFromBlock(block, index)Returns transaction by block
web3.eth.signTransaction(txObject)Signs a transaction
web3.eth.sign(address, data)Signs data
web3.eth.call(callObject)Executes a message call
web3.eth.estimateGas(callObject)Estimates gas for a transaction

Contract & Storage

MethodDescription
web3.eth.getCode(address)Returns the code at an address
web3.eth.getStorageAt(address, position)Returns the storage at a position
web3.eth.getPastLogs(options)Returns past logs matching filter
web3.eth.getProof(address, keys, block)Returns the account proof

Mining

MethodDescription
web3.eth.getWork()Returns the current mining work
web3.eth.submitWork(nonce, header, digest)Submits a proof-of-work solution

Additional Modules

ModuleDescription
web3.eth.subscribeSubscribe to blockchain events (WebSocket only)
web3.eth.ContractInteract with smart contracts
web3.eth.IbanIBAN address conversion
web3.eth.personalAccount management functions
web3.eth.accountsAccount creation and signing
web3.eth.ensEthereum Name Service interaction
web3.eth.abiABI encoding/decoding
web3.eth.netNetwork properties

Provider Configuration

setProvider

javascript
web3.setProvider(new Web3.providers.HttpProvider('https://seoul.worldland.foundation/'));

Default Settings

PropertyDescription
web3.eth.defaultAccountDefault address used as from
web3.eth.defaultBlockDefault block (latest, pending, etc.)
web3.eth.defaultHardforkDefault hardfork
web3.eth.defaultChainDefault chain
web3.eth.transactionBlockTimeoutBlocks to wait before timeout (default: 50)
web3.eth.transactionConfirmationBlocksConfirmations needed (default: 24)
web3.eth.transactionPollingTimeoutPolling timeout in seconds
web3.eth.handleRevertReturn revert reason on failure

INFO

WorldLand supports the same JSON-RPC module as Ethereum. See the JSON-RPC APIs of Ethereum and go-ethereum for comprehensive details.

Decentralized GPU Infrastructure for the AI Era