Skip to content

Seth-McKilla/pocket-portal-tx-viewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to the Simple Ethereum Transaction Explorer 👋

image

View the Live Site

This repo serves as my submittal for the Pocket Network DAO Global Bounty - Integrate A Pocket-Powered Endpoint Into Your Project

image

Check out the short demo video

Steps Involved to create this project

It is SO easy to get up and running with the pocket portal! The following is a basic step-by-step outline of how I integrated a pocket portal into my project.

1. Created and minted an RPC endpoint:

image Note: MVPP = Minimum Viable Pocket Portal 😉 Refer to the official documentation for a detailed step-by-step of this process.

2. Enabled security for the app

image

3. Spun up a NextJS app:

npx create-next-app@latest pocket-portal-tx-viewer

4. Created simple requests to the RPC endpoint within my app using Basic HTTP Authentication, here's an example of one:

export async function getServerSideProps() {
  const body = {
    jsonrpc: "2.0",
    id: 1,
    method: "eth_getBlockByNumber",
    params: ["latest", null],
  };

  const response = await fetch(
    `https://user:${process.env.POCKET_SECRET}@eth-mainnet.gateway.pokt.network/v1/lb/618d53223853830035c7a414`,
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      body: JSON.stringify(body),
    }
  );
  const { result } = await response.json();
  return {
    props: { result },
  };
}

That's all folks, thanks for stopping by!

About

A simple dApp to view transactions on the latest ethereum block.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published