API Reference
Comprehensive API documentation for interacting with the EigenKub blockchain
JSON-RPC API
EigenKub provides a standard Ethereum JSON-RPC API that is 100% compatible with Ethereum. You can use any Ethereum library or tool to interact with the EigenKub blockchain.
Endpoint
The main JSON-RPC endpoint for EigenKub is:
https://rpc.eigenkub.com
Supported Methods
EigenKub supports all standard Ethereum JSON-RPC methods, including:
eth_blockNumber
- Returns the current block numbereth_getBalance
- Returns the balance of an accounteth_sendTransaction
- Sends a transactioneth_call
- Executes a new message calleth_getTransactionByHash
- Returns information about a transactioneth_getTransactionReceipt
- Returns the receipt of a transactioneth_getLogs
- Returns logs matching the filter criterianet_version
- Returns the current network IDweb3_clientVersion
- Returns the current client version
JavaScript Libraries
You can interact with the EigenKub blockchain using popular Ethereum JavaScript libraries like web3.js and ethers.js.
Web3.js
Here's how to use web3.js to interact with the EigenKub blockchain:
const Web3 = require('web3');
const web3 = new Web3('https://rpc.eigenkub.com');
// Get the latest block number
web3.eth.getBlockNumber()
.then(console.log);
// Get account balance
web3.eth.getBalance('0x1234567890123456789012345678901234567890')
.then(balance => {
console.log(web3.utils.fromWei(balance, 'ether'));
});
Smart Contract Interaction
You can interact with smart contracts deployed on EigenKub using web3.js or ethers.js:
// Using web3.js
const contract = new web3.eth.Contract(abi, contractAddress);
// Call a read-only function
contract.methods.balanceOf('0x1234...').call()
.then(console.log);
// Send a transaction
contract.methods.transfer('0x5678...', '1000000000000000000')
.send({ from: '0x1234...' })
.on('receipt', console.log);
// Using ethers.js
const contract = new ethers.Contract(contractAddress, abi, provider);
const signer = provider.getSigner();
const contractWithSigner = contract.connect(signer);
// Call a read-only function
const balance = await contract.balanceOf('0x1234...');
console.log(balance.toString());
// Send a transaction
const tx = await contractWithSigner.transfer('0x5678...', ethers.utils.parseEther('1'));
await tx.wait();
console.log('Transaction confirmed');
WebSocket API
EigenKub also provides a WebSocket API for subscribing to blockchain events:
wss://ws.eigenkub.com
You can use the WebSocket API to subscribe to new blocks, pending transactions, and logs.