Inspiration

I sincerely believe that Oracles is a crucial piece of the blockchain infrastructure. They enable smooth communication between the external world and on-chain environments in a trustless manner. A lot of DeFi use cases would not be possible without oracles: lending protocols, synthetic assets, parametric insurance, stablecoins, and many more.

Currently, Total Value Secured by Oracles is higher than $20b, and it is constantly growing 🚀

The problem

Oracle solutions that are currently available on the NEAR chain are secure and stable, but, unfortunately, not really scalable. Which means that oracle data providers can not deliver data more frequently or just provide much more data on-chain. If they do, their operational costs will skyrocket and make them too expensive for consumers (DeFi protocols).

NEAR blockchain is very performant and scalable thanks to its unique and innovative technology. However, it can't become truly scalable without truly Scalable Oracles. Such situation limits NEAR’s scaling and mass adoption of DeFi.

There are already a lot of underserved areas (in terms of available oracle data) in the Web3 space, such as data related to NFT, gaming, insurance, sports statistics, green bonds or even credit scoring.

The solution

That's why I decided to integrate Infinitely Scalable RedStone Oracles with the NEAR chain and unlock its real potential, allowing developers to build the next generation of data-powered dApps on NEAR.

RedStone on Near meme

Simple summary of the idea

Blockchains are often compared to computers, as they essentially are (public, cryptographically secure, distributed, and often quite expensive) computers. Thus, oracles can be considered as the internet connection to these computers.

So, my goal for this Hackathon was to connect "the NEAR Computer" to "the way Faster Internet" and make the NEAR users happier!

As it's always better to have faster internet, right? 😉

What is RedStone

RedStone is a data ecosystem that delivers frequently updated, reliable and diverse data for dApps and smart contracts.

It uses a radically different way of putting oracle data on-chain:

  • RedStone data providers need to sign provided data and broadcast it using the decentralized Streamr pub-sub network. Providers don't need to push the data on-chain, which allows them to provide way more types of data with significantly higher update frequency
  • End users can receive signed oracle data from the Streamr network and self-deliver it on-chain, attaching it to their transactions
  • On-chain Smart Contracts can verify the data integrity using cryptographic signatures and timestamps

Additionally, RedStone:

  • Uses token incentives to motivate data providers to maintain data integrity and uninterrupted service
  • Leverages Arweave blockchain as a cheap and permanent decentralized storage for archiving Oracle data and maintaining data providers' accountability

To learn more about RedStone oracles use the following links:

How we built it

During the hackathon, I was focused on preparing all the needed tools, samples, and documentation for NEAR dApp developers, so that they can easily integrate RedStone oracles in their dApps.

Built and published during the hackathon

What technologies can devs use to integrate RedStone oracles on NEAR

Before the hackathon Now
Solidity (on Aurora)
RUST (on NEAR)
JS (on NEAR)

Challenges we ran into

It took some time to handle conversion between different types of bytes representations and make built-in (NEAR env) crypto functions work properly.

I've also put much effort into verifying if everything works stable & scalable in the NEAR ecosystem. Integration went harder than I thought, but I am glad I managed to finish with a reliable solution for Web3 builders on NEAR 🛠

Accomplishments that we're proud of

  • End-to-end integration RedStone oracles with the NEAR chain
  • Learning a lot about the NEAR ecosystem and technology
  • Developing all the required tools and docs for NEAR devs to integrate RedStone oracles in any preferred language
  • Secure implementation of data extraction and ECDSA signature verification (both in RUST and Typescript)
  • Covering source code of the created tools with automated tests
  • Publishing helpful libs on NPM and Crates.io registries
  • In general - making the project production ready so that in can be used by NEAR Builders!

What we learned

  • How to develop, test, and deploy NEAR Smart Contracts
  • How to connect NEAR Contracts to frontend
  • How to use cryptographic functions from NEAR SDK env module (keccak256, ecrecover)
  • How to publish RUST libs on crates.io :)
  • I understood deeper the structure of ECDSA signatures, as I needed to parse it before integrating with the built-in NEAR functions
  • I am not really experienced with RUST, so learned a bit more RUST to implement RUST connector and RUST NEAR smart contracts examples

What's next for Scalable oracles for scalable chain

  • Code security and performance audits
  • Promotion in the NEAR ecosystem
  • Getting feedback from NEAR developers
  • Adding more data requested by NEAR dApp developers
  • Improving our tools and docs
  • Integrating threshold signatures to make the system even more scalable and secure

Built With

Share this project:

Updates