Access FloodBoy sensor data directly from the blockchain without any API dependencies. Use these commands to query real-time flood monitoring data from JIBCHAIN L1.
FloodBoy sensors store data in smart contracts with a standardized field system. Each sensor records multiple measurements (water depth, battery voltage, installation height) with precise timestamps.
Chain ID: 8899 (JIBCHAIN L1)
๐ JIBCHAIN L1 RPC URL List (Sorted by Performance)
| RPC Server Address | Latency | Status |
|---|---|---|
| https://rpc-l1.inan.in.th | 0.137s | Active |
| https://rpc-l1.jibchain.net Primary | 0.049s | Active |
| https://rpc2-l1.jbc.xpool.pw Performance | 0.047s | Active |
| https://rpc-l1.jbc.xpool.pw | 0.072s | Active |
๐ก Tip: Start with the primary endpoint (rpc-l1.jibchain.net) for maximum reliability. If you encounter rate limits, rotate through the high-performance fallbacks in the order listed above.
Block Explorer:
https://exp.jibchain.netCurrent Block Height: ~5,947,910
FloodBoy001 Store: 0xCd3Ec17ddFDa24f8F97131fa0FDf20e7cbd1A8Bb
Universal Signer: 0xcB0e58b011924e049ce4b4D62298Edf43dFF0BDd
What is Cast?
Cast is Foundry's command-line tool for performing Ethereum RPC calls. It provides a user-friendly interface for interacting with smart contracts, automatically handling ABI encoding/decoding and formatting outputs in human-readable format.
Installation:
curl -L https://foundry.paradigm.xyz | bash foundryup
โ Advantages:
๐ Requirements:
cast call 0xCd3Ec17ddFDa24f8F97131fa0FDf20e7cbd1A8Bb "getAllFields()((string,string,string)[])" --rpc-url https://rpc-l1.jibchain.net
cast call 0xCd3Ec17ddFDa24f8F97131fa0FDf20e7cbd1A8Bb "getLatestRecord(address)(uint256,int256[])" 0xcB0e58b011924e049ce4b4D62298Edf43dFF0BDd --rpc-url https://rpc-l1.jibchain.net
What is Viem?
Viem is a modern TypeScript interface for Ethereum. It provides type-safe contract interactions, automatic ABI encoding/decoding, and excellent developer experience for building web applications that interact with smart contracts.
โ Benefits:
๐ฆ Installation:
npm install viem
Works with React, Vue, Node.js, and any JavaScript environment
import { createPublicClient, http } from 'viem'
const JIBCHAIN_RPC_ENDPOINTS = [
'https://rpc-l1.jibchain.net',
'https://rpc2-l1.jbc.xpool.pw',
'https://rpc-l1.jbc.xpool.pw',
'https://rpc-l1.inan.in.th',
] as const
// JIBCHAIN L1 network configuration
const jibchain = {
id: 8899,
name: 'JIBCHAIN L1',
nativeCurrency: { name: 'JBC', symbol: 'JBC', decimals: 18 },
rpcUrls: {
default: { http: [...JIBCHAIN_RPC_ENDPOINTS] },
public: { http: [...JIBCHAIN_RPC_ENDPOINTS] },
},
blockExplorers: {
default: { name: 'JIBCHAIN Explorer', url: 'https://exp.jibchain.net' }
}
}
// Create client
const client = createPublicClient({
chain: jibchain,
transport: http(JIBCHAIN_RPC_ENDPOINTS[0])
})
// Contract addresses
const STORE_ADDRESS = '0xCd3Ec17ddFDa24f8F97131fa0FDf20e7cbd1A8Bb'
const UNIVERSAL_SIGNER = '0xcB0e58b011924e049ce4b4D62298Edf43dFF0BDd' // ABI for getAllFields function
const getAllFieldsABI = [
{
name: 'getAllFields',
type: 'function',
stateMutability: 'view',
inputs: [],
outputs: [
{
type: 'tuple[]',
components: [
{ name: 'name', type: 'string' },
{ name: 'unit', type: 'string' },
{ name: 'dtype', type: 'string' }
]
}
]
}
] as const
// Get all fields
async function getAllFields() {
try {
const fields = await client.readContract({
address: STORE_ADDRESS,
abi: getAllFieldsABI,
functionName: 'getAllFields'
})
console.log('Fields:', fields)
// Returns: [
// { name: "water_depth", unit: "m x10000", dtype: "int256" },
// { name: "battery_voltage", unit: "V x100", dtype: "int256" },
// ...
// ]
return fields
} catch (error) {
console.error('Error fetching fields:', error)
throw error
}
} // ABI for getLatestRecord function
const getLatestRecordABI = [
{
name: 'getLatestRecord',
type: 'function',
stateMutability: 'view',
inputs: [{ name: 'sensor', type: 'address' }],
outputs: [
{ name: '', type: 'uint256' }, // timestamp
{ name: '', type: 'int256[]' } // values array
]
}
] as const
// Get latest sensor record
async function getLatestRecord() {
try {
const [timestamp, values] = await client.readContract({
address: STORE_ADDRESS,
abi: getLatestRecordABI,
functionName: 'getLatestRecord',
args: [UNIVERSAL_SIGNER]
})
console.log('Timestamp:', timestamp) // 1748044727n (BigInt)
console.log('Raw values:', values) // [2700n, 1291n, 30200n, ...]
return { timestamp, values }
} catch (error) {
console.error('Error fetching latest record:', error)
throw error
}
} What is JSON-RPC?
JSON-RPC is the standard protocol for communicating with Ethereum nodes. These curl commands send raw JSON requests directly to the blockchain, giving you complete control over the interaction. No additional tools required - works anywhere curl is available.
โ Advantages:
โ ๏ธ Considerations:
๐ก Pro Tip:
Add | jq to the end of curl commands for pretty JSON formatting. Install jq: brew install jq or apt install jq
curl 'https://rpc-l1.jibchain.net' -H 'content-type: application/json' --data-raw '{"jsonrpc":"2.0","id":4,"method":"eth_call","params":[{"data":"0x92208228","to":"0xCd3Ec17ddFDa24f8F97131fa0FDf20e7cbd1A8Bb","value":"0x0"},"latest"]}' | jq curl 'https://rpc-l1.jibchain.net' -H 'content-type: application/json' --data-raw '{"jsonrpc":"2.0","id":2,"method":"eth_call","params":[{"data":"0x2f63bd6a000000000000000000000000cb0e58b011924e049ce4b4d62298edf43dff0bdd","to":"0xCd3Ec17ddFDa24f8F97131fa0FDf20e7cbd1A8Bb","value":"0x0"},"latest"]}' | jq getAllFields(): 0x92208228
getLatestRecord(address): 0x2f63bd6a
FloodBoy002: 0x81ECfbd31D86bc8f3A581bD2f7c0f54B7498AC94
FloodBoy003: 0x935B21D73bE382ba9D5Af56007502ea1d5E3348B
FloodBoy004: 0xD591c530F8c8A62576349a5a0cc9F08C30a50Fab
See /stores page for complete list of 100 deployed stores
๐ข Understanding Scaling Factors
FloodBoy stores decimal values as integers to avoid floating-point precision issues on the blockchain. Each field includes a scaling factor that tells you how to convert the raw integer back to the real value.
Raw: 1291
Formula: 1291 รท 100 = 12.91
Result: 12.91 V
Range typically 11-14V for healthy battery
Raw: 2700
Formula: 2700 รท 10000 = 0.27
Result: 0.27 m
Depth from sensor to water surface
Installation Height: Fixed distance from sensor to ground level (e.g., 3.02m)
Water Depth: Current distance from sensor to water surface (e.g., 0.27m)
Flood Level: Installation Height - Water Depth = 3.02m - 0.27m = 2.75m above ground
๐ก Lower water depth readings = Higher flood levels!
Format: Unix timestamp (seconds since 1970-01-01)
Example: 1748044727 โ 2025-01-23 12:25:27 UTC
JavaScript: new Date(timestamp * 1000)
Python: datetime.fromtimestamp(timestamp)