Skip to content

Welcome to WakeUp Labs' implementation of RFG1 from the Optimism Grants Council! Our service allows you to query the blockchain for specific past moments.

License

Notifications You must be signed in to change notification settings

wakeuplabs/rfg1-optimism

Repository files navigation

⏰ RFG1 - Optimism Grants Council - WakeUp Labs

Welcome to WakeUp Labs implementation of the Optimism Request For Grants #1 RFG1 from the Optimism Grants Council!

You can take a look at the final Delivery and Feedback Thread in our post at the Optimism Governance Forum.

The service allows anyone to query the blockchain for specific past moments.

Introduction

This is a service that will be able to query the blockchain for specific moments in the past ⏰. Specifically, the queries will be enabled for any public view function of any smart contract deployed on the Optimism blockchain from its first block until the current moment. It could be extended to any EVM blockchain.

The implementation is fully open source with MIT license.

How to run

Local Setup Guide

Prerequisites

  • Node.js installed on your machine
  • Git installed for cloning the repository
  • PostgreSQL installed and running or any database deployed

Steps to Run Locally

  1. Clone the repository:
 git clone https://github.com/WakeUpLabs/RFG1-Optimism-Project.git
  1. Complete the environment variables in a .env file
  URL=
  PORT=
  RPC_TESTNET_URL=
  RPC_MAINNET_URL=
  DATABASE_URL=
  • URL: The base URL for the application. If you want to run it locally, it will be set to http://localhost.
  • PORT: Specifies the port number on which the server will listen for incoming requests.
  • RPC_URL: Refers to the Remote Procedure Call (RPC) endpoint for connecting to the Optimism blockchain. This variable is crucial for interacting with the blockchain, fetching data, or executing transactions.
  • PRIVATE_KEY: Represents the private key used for authentication or signing transactions. Ensure that this key is kept confidential and not shared publicly.
  • DATABASE_URL: Specifies the URL for connecting to the PostgreSQL database.
  1. Run database migrations:
 npm run migrate
  1. Install dependencies:
 npm install
  1. Start the local server:
 npm run start

Our architecture

Our service is designed for easy integration, streamlined maintenance, and adaptable extensibility with external services.

image.png

This RESTful API seamlessly interacts with the OP blockchain, persisting invoked functions in a dedicated database. Subsequently, users can conveniently bypass providing ABI information on following interactions.

Moreover, an additional component empowers project owners to populate the database with smart contracts they deem pertinent.


To grasp the full spectrum of possibilities, delve into our sequence diagrams:

This diagram shows how to leverage pre-loaded contracts. In that way, the user could check which are those contracts considered most popular and avoid the need to manually load the ABI information.

image.png

Nevertheless, users always have the option to inspect any contract using a generic endpoint by passing the necessary parameters.

image.png

Try It Out - Quick Demo

Sometimes, examples speak louder than words.

We've also coded the first implementation of these APIs. The main idea behind the integration is to provide a user-friendly UI where users can define a specific Address or ENS and determine the amount of OP tokens it holds on a specific date on the Optimism Blockchain.

Try it out here: https://rfg1-demo.wakeuplabs.link/

Demo

Try It Out - Dedicated Instance

For your convenience, WakeUp Labs offers an easier solution by providing a deployed version and dedicated instance that is ready to use and seamlessly integrates with your services via REST APIs. To get started, simply log in to the WakeUp Platform and obtain your free apikey.

Integration via WakeUp Platform REST APIs

1. Sign Up & Get Free API Key

To use the service, you need to sign up and create a free API key with your email account.

Once you have completed the registration process, go to the API Key section to view your API key information.

image.png

Copy the generated API key and keep it safe, as it will be your credential for accessing our services 🔐

2. Use the REST API

You can explore the service's capabilities in the WakeUp Platform API Docs

Follow the instructions to use the REST API as you please. These are some API endpoints you will find and be able to use to try RFG1 implementation:

About

Welcome to WakeUp Labs' implementation of RFG1 from the Optimism Grants Council! Our service allows you to query the blockchain for specific past moments.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published