KenCloud-Tech / prolly-tree-oracle

Prolly Tree Oracle for IPLD Datasets
Apache License 2.0
2 stars 1 forks source link

Prolly Tree Oracle

What

API:

Architecture

Blockchain and decentralized applications (DApps) are increasingly important for establishing trust and transparency in data storage and computing. However, on-chain transactions are often costly and slow. To overcome this challenge, off-chain nodes can be used to store and compute data. Blockchain oracles are introduced and implemented in the form of application programming interfaces (APIs) to connect the real world to the blockchain. Prolly Tree Oracle connects the IPLD Prolly Tree storage service to the blockchain, allowing users to store large amounts of data off-chain at a fraction of the cost while enjoying the transparency and security brought by the blockchain.

Constructor:

constructor(uint basefee, uint bytefee) payable {
        owner = payable(msg.sender);
        baseGasFee = basefee;
        gasPerByte = bytefee;
        CurrentReqID = 1;
    }

When deploying the oracle contract, you can set the basic service fee for each service and the service fee per byte of data when importing data using the Put method.
So users should make sure to carry enough fees to pay the service fee when calling the API.

API Implementation:

Usage

Click here to learn how to start the service

Consumer Contract

The Consumer Contract used for testing is located at contracts/test.sol, and there is an example of a WebApp project that interacts directly with the oracle: ./webApp

Compile the Consumer Contract to obtain the ABI file, and use the abigen to generate Golang package corresponding to the contract: abigen --abi={ Path to abi.json } --pkg={ Package name } --out={ The path to the generated .go file }

Golang Client

Use a Golang test program golangServer/test/Oracle_test.go to call the request function in the Consumer Contract for testing the oracle.