Git: d00d391 (2026-01-29) โ€ข RPC: checking... โ€ข Block: ... โ€ข Load: ...
Blockchain Stores Open Data Open Code Open Prompts Simulator AI Speaking

FloodBoy Open Data Access

Direct Blockchain Access

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.

๐Ÿ” Understanding FloodBoy Data Structure

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.

๐Ÿ“Š What getAllFields() Returns
  • Field Name: "water_depth", "battery_voltage"
  • Unit: "m x10000", "V x100" (scaling factor)
  • Data Type: "int256" (signed integer)
๐Ÿ“ˆ What getLatestRecord() Returns
  • Timestamp: Unix time when data was recorded
  • Values Array: Raw sensor readings (needs scaling)
  • Order: Values match field order from getAllFields()

Network Information

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.net

Current Block Height: ~5,947,910

FloodBoy001 Store: 0xCd3Ec17ddFDa24f8F97131fa0FDf20e7cbd1A8Bb

Universal Signer: 0xcB0e58b011924e049ce4b4D62298Edf43dFF0BDd

Cast Commands (Foundry)

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:

  • Human-readable output
  • Automatic ABI decoding
  • Built-in error handling
  • Type safety

๐Ÿ“‹ Requirements:

  • Foundry installed locally
  • Terminal/command line access
  • Internet connection to RPC

Get All Fields

cast call 0xCd3Ec17ddFDa24f8F97131fa0FDf20e7cbd1A8Bb "getAllFields()((string,string,string)[])" --rpc-url https://rpc-l1.jibchain.net

Get Latest Record

cast call 0xCd3Ec17ddFDa24f8F97131fa0FDf20e7cbd1A8Bb "getLatestRecord(address)(uint256,int256[])" 0xcB0e58b011924e049ce4b4D62298Edf43dFF0BDd --rpc-url https://rpc-l1.jibchain.net

Viem.js TypeScript Examples

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:

  • Full TypeScript support
  • Tree-shakeable & lightweight
  • Automatic type inference
  • Built-in error handling
  • Modern async/await syntax

๐Ÿ“ฆ Installation:

npm install viem

Works with React, Vue, Node.js, and any JavaScript environment

Setup & Configuration

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'

Get All Fields

// 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
  }
}

Get Latest Record

// 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
  }
}

Curl Commands (JSON-RPC)

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:

  • Works on any system with curl
  • No installation required
  • Direct blockchain access
  • Scriptable and automatable
  • Language agnostic

โš ๏ธ Considerations:

  • Returns raw hex data
  • Requires manual ABI decoding
  • Need to understand data types
  • More complex error handling

๐Ÿ’ก Pro Tip:

Add | jq to the end of curl commands for pretty JSON formatting. Install jq: brew install jq or apt install jq

Get All Fields

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

Get Latest Record

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

Function Selectors

getAllFields(): 0x92208228

getLatestRecord(address): 0x2f63bd6a

Alternative Store Addresses

FloodBoy002: 0x81ECfbd31D86bc8f3A581bD2f7c0f54B7498AC94

FloodBoy003: 0x935B21D73bE382ba9D5Af56007502ea1d5E3348B

FloodBoy004: 0xD591c530F8c8A62576349a5a0cc9F08C30a50Fab

See /stores page for complete list of 100 deployed stores

Data Processing & Interpretation

๐Ÿ”ข 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.

โšก Battery Voltage (x100)

Raw: 1291

Formula: 1291 รท 100 = 12.91

Result: 12.91 V

Range typically 11-14V for healthy battery

๐ŸŒŠ Water Depth (x10000)

Raw: 2700

Formula: 2700 รท 10000 = 0.27

Result: 0.27 m

Depth from sensor to water surface

๐Ÿ“ Installation Height vs Water Depth

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!

๐Ÿ•’ Timestamp Processing

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)

Git: d00d391 (2026-01-29)
Factory (JIBCHAIN): 0x63bB...a5Bb