-
Notifications
You must be signed in to change notification settings - Fork 0
API Reference
Mondoshawan implements an Ethereum-compatible JSON-RPC API on port 8545.
http://localhost:8545
1338 (0x53a)
Returns the chain ID.
Request:
{
"jsonrpc": "2.0",
"method": "eth_chainId",
"params": [],
"id": 1
}Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x53a"
}Returns the current block number.
Request:
{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x10"
}Returns the balance of an address.
Parameters:
-
address- 20-byte address -
block- Block number or "latest"
Request:
{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": ["0x742d35Cc6634C0532925a3b844Bc9e7595f8dE1B", "latest"],
"id": 1
}Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x56bc75e2d63100000"
}Returns the nonce of an address.
Parameters:
-
address- 20-byte address -
block- Block number or "latest"
Request:
{
"jsonrpc": "2.0",
"method": "eth_getTransactionCount",
"params": ["0x742d35Cc6634C0532925a3b844Bc9e7595f8dE1B", "latest"],
"id": 1
}Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x5"
}Submits a signed transaction.
Parameters:
-
data- Signed transaction data (RLP encoded)
Request:
{
"jsonrpc": "2.0",
"method": "eth_sendRawTransaction",
"params": ["0xf86c..."],
"id": 1
}Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x..."
}Executes a read-only contract call.
Parameters:
-
transaction- Transaction object -
block- Block number or "latest"
Request:
{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [{
"from": "0x742d35Cc6634C0532925a3b844Bc9e7595f8dE1B",
"to": "0x1234567890123456789012345678901234567890",
"data": "0x2e64cec1"
}, "latest"],
"id": 1
}Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x0000000000000000000000000000000000000000000000000000000000000064"
}Returns contract bytecode.
Parameters:
-
address- Contract address -
block- Block number or "latest"
Request:
{
"jsonrpc": "2.0",
"method": "eth_getCode",
"params": ["0x1234567890123456789012345678901234567890", "latest"],
"id": 1
}Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x6080604052..."
}Returns contract storage at a slot.
Parameters:
-
address- Contract address -
slot- Storage slot (32 bytes) -
block- Block number or "latest"
Request:
{
"jsonrpc": "2.0",
"method": "eth_getStorageAt",
"params": [
"0x1234567890123456789012345678901234567890",
"0x0",
"latest"
],
"id": 1
}Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x0000000000000000000000000000000000000000000000000000000000000064"
}Returns block by number.
Parameters:
-
block- Block number or "latest" -
fullTransactions- Include full transaction objects
Request:
{
"jsonrpc": "2.0",
"method": "eth_getBlockByNumber",
"params": ["latest", true],
"id": 1
}Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"number": "0x10",
"hash": "0x...",
"parentHash": "0x...",
"timestamp": "0x...",
"transactions": [...]
}
}Returns block by hash.
Parameters:
-
hash- Block hash -
fullTransactions- Include full transaction objects
Request:
{
"jsonrpc": "2.0",
"method": "eth_getBlockByHash",
"params": ["0x...", true],
"id": 1
}Returns transaction receipt.
Parameters:
-
hash- Transaction hash
Request:
{
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": ["0x..."],
"id": 1
}Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"transactionHash": "0x...",
"blockNumber": "0x10",
"blockHash": "0x...",
"status": "0x1",
"gasUsed": "0x5208",
"contractAddress": null
}
}Estimates gas for a transaction.
Parameters:
-
transaction- Transaction object
Request:
{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [{
"from": "0x742d35Cc6634C0532925a3b844Bc9e7595f8dE1B",
"to": "0x1234567890123456789012345678901234567890",
"value": "0x0",
"data": "0x..."
}],
"id": 1
}Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x5208"
}Returns current gas price.
Request:
{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": [],
"id": 1
}Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x3b9aca00"
}Returns network ID.
Request:
{
"jsonrpc": "2.0",
"method": "net_version",
"params": [],
"id": 1
}Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "1338"
}Returns if node is listening.
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}Returns peer count.
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x5"
}Returns client version.
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": "Mondoshawan/v0.1.0"
}Returns mining statistics.
Request:
{
"jsonrpc": "2.0",
"method": "mshw_getMiningStats",
"params": [],
"id": 1
}Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"hashrate": "1000000",
"blocksFound": 100,
"streamA": { "blocks": 40, "hashrate": "300000" },
"streamB": { "blocks": 35, "hashrate": "400000" },
"streamC": { "blocks": 25, "hashrate": "300000" }
}
}Returns sharding statistics.
Request:
{
"jsonrpc": "2.0",
"method": "mshw_getShardStats",
"params": [],
"id": 1
}Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"shardCount": 4,
"shards": [
{ "id": 0, "blockCount": 100, "txPoolSize": 50 },
{ "id": 1, "blockCount": 98, "txPoolSize": 45 }
]
}
}Returns risk score for an address.
Parameters:
-
address- Address to analyze
Request:
{
"jsonrpc": "2.0",
"method": "mshw_getRiskScore",
"params": ["0x742d35Cc6634C0532925a3b844Bc9e7595f8dE1B"],
"id": 1
}Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"score": 0.15,
"label": "Low Risk",
"factors": ["new_address", "small_transactions"]
}
}| Code | Message | Description |
|---|---|---|
| -32700 | Parse error | Invalid JSON |
| -32600 | Invalid request | Invalid request object |
| -32601 | Method not found | Unknown method |
| -32602 | Invalid params | Invalid parameters |
| -32603 | Internal error | Internal server error |
| -32000 | Server error | Generic server error |
| Setting | Value |
|---|---|
| Network Name | Mondoshawan Testnet |
| RPC URL | http://localhost:8545 |
| Chain ID | 1338 |
| Currency Symbol | QMON |
| Block Explorer | http://localhost:3000 |
const { ethers } = require('ethers');
const provider = new ethers.JsonRpcProvider('http://localhost:8545');
// Get balance
const balance = await provider.getBalance('0x742d35Cc6634C0532925a3b844Bc9e7595f8dE1B');
console.log('Balance:', ethers.formatEther(balance));
// Get block number
const blockNumber = await provider.getBlockNumber();
console.log('Block:', blockNumber);
// Send transaction
const wallet = new ethers.Wallet(privateKey, provider);
const tx = await wallet.sendTransaction({
to: '0x1234567890123456789012345678901234567890',
value: ethers.parseEther('1.0')
});
await tx.wait();from web3 import Web3
w3 = Web3(Web3.HTTPProvider('http://localhost:8545'))
# Get balance
balance = w3.eth.get_balance('0x742d35Cc6634C0532925a3b844Bc9e7595f8dE1B')
print(f'Balance: {w3.from_wei(balance, "ether")} QMON')
# Get block number
block = w3.eth.block_number
print(f'Block: {block}')curl -X POST http://localhost:8545 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'- Getting Started - Setup guide
- Architecture Overview - System design
- Module Reference - Module documentation