Git Product home page Git Product logo

theoffchainresolver.sol's Introduction

TheOffchainResolver.sol

TOR — a trustless universal hybrid off-chain ENS and DNS resolver contract and protocol.

TOR Protocol

  • bytes requestData = calldata from CCIP-Read
  • bytes responseData = the answer to that request
  • bytes32 requestHash = keccak256 of requestData
  • bytes32 responseHash = keccak256 of responseData
  • uint64 expires = expiration time in seconds (Ethereum time, since 1/1/1970)
  • address resolver = TOR contract address
    • use different endpoints to service multiple resolvers (main vs test, DNS vs ENS)
  • bytes signedData = abi.encoded (resolver, expires, requestHash, responseHash)
  • bytes32 signedHash = keccak256 of signedData
  • bytes signature = signature of signedHash with private key
  • bytes data = abi.encoded (signature, expires, signedData)
  • reply with data

Implementations

Context Format

CONTEXT = ${SIGNER} ${ENDPOINT}

  • SIGNER = 0x-prefixed public address of signing key
    • ethers.computeAddress(new ethers.SigningKey("..."))
  • ENDPOINT = URL of your CCIP-Read server

Setup

  • "I have a DNS name"
    • DNS TXT = ENS1 ${TheOffchainResolver} ${CONTEXT}
      • Mainnet Example: ezccip.raffy.xyz
      • Context: 0xd00d726b2aD6C81E894DC6B87BE6Ce9c5572D2cd https://raffy.xyz/ezccip/
      • For full wildcard coverage, set @ (basename) and * (descendents)
  • "I have an ENS name"
    • ENS.setResolver() = ${TheOffchainResolver}
    • setText("ccip.context") = CONTEXT
      • Sepolia Example: ezccip.eth
      • Context: 0xd00d726b2aD6C81E894DC6B87BE6Ce9c5572D2cd https://raffy.xyz/ezccip/s

That's it! 🎉️


DNSTORWithENSProtocol.sol

DNS part of TOR but uses standard ENS signing protocol that is compatible with official ENS Offchain Resolver.


eXclusivelyOnchainResolver.sol

XOR — a trustless on-chain wildcard resolver contract that translates ENSIP-10 calls into non-ENSIP-10 calls.

Usage

Append .onchain.eth to any ENS name and resolve!


OffchainTunnel.sol

An on-chain function registry for arbitrary CCIP-Read functions.

Function Registry

When selector is called with CCIP-Read, the calldata is forwarded to the endpoint and the response must be signed by signer. The function selector is associated with an (owner, index)–pair which points to a (endpoint, signer)–pair. The CCIP-Read exchange follows the TOR protocol.

  • claimAndSetContext(bytes4 selector, address signer, string calldata endpoint, uint96 index)
  • claim(bytes4 selector, uint256 index) + setContext(address signer, string calldata endpoint, uint96 index)

Gasless Debugging

call(address signer, string memory endpoint, bytes memory request) does the same thing as above, except the (signer, endpoint)–pair is provided.

Testing

All contracts have end-to-end adraffy/blocksmith tests.

  1. foundryup
  2. npm i
  3. npm run test

theoffchainresolver.sol's People

Contributors

adraffy avatar aslobodnik avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.