Futaba
TwitterBlog
  • 🌱Introduction
    • Introduction
    • Concept
    • Architecture
  • 🛠️Protocol
    • Gateway
      • Send
      • Receive
      • Estimate fee
      • Cache
    • Light Client
      • Request Query
      • Verify
      • Estimate fee
    • Relayer
    • Konoha
      • Chainlink Oracle
      • Herodotus
      • Lagrange
  • 💡Guide
    • Futaba Testnet
      • Balance query
      • Custom query
      • Access cache
      • Cross-chain voting
    • Quick Start
    • Customize Light Client
    • Example Apps
  • 📗References
    • FAQ
    • Contract addresses
    • Glossary
  • 🔗Links
    • Twitter
    • Blog
Powered by GitBook
On this page

Was this helpful?

  1. Guide

Customize Light Client

Build your own Light Client Contract

PreviousQuick StartNextExample Apps

Last updated 1 year ago

Was this helpful?

As mentioned , Futaba allows you to build the verification logic part at will.

If the target contract extends ILightClient.sol and defines verify() , requestQuery() and estimateFee() You can build your own logic at a minimum.

ILightClient.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;

import "../QueryType.sol";

/**
 * @title Light client interface
 * @notice This interface is for the verification of proof
 */

interface ILightClient {
    /**
     * @notice This function is intended to make Light Client do something when a query request is made (mock emit events to Oracle)
     * @param queries request query data
     */
    function requestQuery(QueryType.QueryRequest[] memory queries) external;

    /**
     * @notice This function is for validation upon receipt of query(mock verifies account proof and storage proof)
     * @param message response query data
     */
    function verify(
        bytes memory message
    ) external returns (bool, bytes[] memory);

    /**
     * @notice Estimated fees to be collected on the LightClient Contract side
     * @param queries request query data
     */
    function estimateFee(
        QueryType.QueryRequest[] memory queries
    ) external view returns (uint256);
}

By default, the block header (state root) supplied by Oracle and the storage proof received from Relayer are verified by Merkle Patricia Trie (MPT).

When customizing, it may be necessary to build your own Relayer separate from the current Relayer.

In the future, we can develop modules using zkp and a block hash Aggregator such as .

💡
here
Hashi