eth_coinbase
Returns the client coinbase address.
Parameters
None.
Examples
- cURL
- Ethers.js v6
- Viem
- web3.py
curl -X POST https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_coinbase",
"params": [],
"id": 1
}'
import { JsonRpcProvider } from 'ethers';
const provider = new JsonRpcProvider(
'https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY'
);
const coinbase = await provider.send('eth_coinbase', []);
console.log('Coinbase address:', coinbase);
import { createPublicClient, http, defineChain } from 'viem';
const chiliz = defineChain({
id: 88888,
name: 'Chiliz',
nativeCurrency: {
decimals: 18,
name: 'CHZ',
symbol: 'CHZ',
},
rpcUrls: {
default: {
http: ['https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY'],
},
},
blockExplorers: {
default: { name: 'ChilizScan', url: 'https://chiliscan.com' },
},
});
const client = createPublicClient({
chain: chiliz,
transport: http('https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY'),
});
const coinbase = await client.request({ method: 'eth_coinbase' });
console.log('Coinbase address:', coinbase);
from web3 import Web3
w3 = Web3(Web3.HTTPProvider(
'https://api-chiliz-mainnet-archive.n.dwellir.com/YOUR_API_KEY'
))
coinbase = w3.eth.coinbase
print('Coinbase address:', coinbase)
Response
Returns the coinbase address as a hex string. Common error responses:
{"code": -32700, "message": "Parse error"}
- Invalid JSON{"code": -32602, "message": "Invalid params"}
- Invalid parameters{"code": -32603, "message": "Internal error"}
- Server error