This repository was archived by the owner on Apr 6, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 335
Add OP Scan Block Explorer #1102
Closed
Closed
Changes from 2 commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
5828dc0
Add OP Scan Block Explorer
saimeunt e33b435
Add missing files
saimeunt 51c1e54
Update cross-chain-message.mdx
zainbacchus 8b29d73
fix lint warning
krofax eb24a1c
remove word
krofax 766a836
Update pages/stack/interop/cross-chain-message.mdx
krofax f6a249a
updated text
krofax 8fff156
improved word
krofax 24ecff7
Improve Grammar and Consistency in Glossary Term Template
Noisyxl d12e0c8
Update suggest_tutorial.yaml
Noisyxl 95f0401
Updated docs files with errors
Anon-im 562b257
Typo Update CONTRIBUTING.md
mdqst f46ab56
Clean up explainer
zainbacchus 1baceef
remove duplicate
krofax 9b2d714
correct spelling
krofax eadccee
fix spacing
krofax 8942e00
improve text
krofax 014db79
improve text
krofax f15d94a
Update explainer.mdx
zainbacchus 6716511
reworded for clarity
krofax 65ab7a4
improve text
krofax 6b11565
Update home page capitalization
bradleycamacho 08a1af9
Fix breadcrumb and title casing
bradleycamacho 8172140
Typo Update content-reuse.md
voronor dbb9429
Added starter kit
krofax 654f104
fix lint error
krofax f258618
Collapsing walkthrough section and disabling changed file summary
bradleycamacho 44e1963
replace the SDK link with viem
krofax 0adff39
changes op mainnet to op stack
krofax dd292f3
Deploy the L1 contract command path updated
BalrajHariharanA 823c428
Refactor JSDoc for WipCallout to Improve Clarity and Precision Update…
0xbryer 911b42c
Fix invalid stroke-width attribute Update Loader.tsx
voronor 4488df3
Update components/calculator/Loader.tsx
krofax ba611db
Created a script that checks for borken links
krofax e8d2b35
updated the link checker
krofax dc23b5e
Documented the steps involved to automate the redirect
krofax 11f7939
revert changes made in lychee
krofax 7458aef
revert previous changes to lychee file
krofax 071e411
Update notes/fix-redirects.md
krofax 4a791af
fix lint issues
krofax ccf1313
update the command
krofax 5148ca9
revert changes
krofax f902d7e
Typo Update OpProposerDescriptionShort.md
0xbryer 7e3ac40
docs: fix SuperchainERC20 deployment guide URL
codeesura 21b3dc5
Update rollup.mdx
brokewhale e9e04e5
Update addresses.mdx
Hopium21 b7814fa
Update security-policy.mdx
Hopium21 b05ddc5
Update 404.mdx
Hopium21 2390a3a
Update index.mdx
Hopium21 0cdd15a
Update pages/404.mdx
sbvegan 0e80025
Update oracles.mdx tags
brokewhale e6d3bc3
fix lint issues
krofax 4a9df6f
Sync with latest README
saimeunt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,157 @@ | ||||||
| --- | ||||||
| title: op-scan | ||||||
| lang: en-US | ||||||
| description: Learn how to launch OP Scan, a block explorer designed for your OP Stack chain. | ||||||
| --- | ||||||
|
|
||||||
| import { Callout } from "nextra/components"; | ||||||
|
|
||||||
| # 🔎 OP Scan | ||||||
|
|
||||||
| [OP Scan](https://github.com/walnuthq/op-scan) is a transaction explorer tailored specifically for the [OP Stack](https://docs.optimism.io/builders/chain-operators/tutorials/create-l2-rollup) and the [Superchain vision](https://www.youtube.com/watch?v=O6vYNgrQ1LE). | ||||||
| It's purpose built to be lightweight, so that anyone can run it locally next to their OP Stack nodes, when working on a new rollup. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix grammatical errors in the introduction. There are two grammatical issues in this line:
-It's purpose built to be lightweight, so that anyone can run it locally next to their OP Stack nodes, when working on a new rollup.
+Its purpose built to be lightweight so that anyone can run it locally next to their OP Stack nodes when working on a new rollup.📝 Committable suggestion
Suggested change
🧰 Tools🪛 LanguageTool[typographical] ~12-~12: The conjunction “so that” does not require a comma. (SO_THAT_UNNECESSARY_COMMA) |
||||||
|
|
||||||
| <Callout> | ||||||
| Check out the [OP Scan README](https://github.com/walnuthq/op-scan) for | ||||||
| up-to-date information on how to launch OP Scan. | ||||||
| </Callout> | ||||||
|
|
||||||
|  | ||||||
|
|
||||||
| # ⚙️ Installation | ||||||
|
|
||||||
| The app requires the following dependencies: | ||||||
|
|
||||||
| ``` | ||||||
| NodeJS >= 22 | ||||||
| pnpm >= 9 | ||||||
| ``` | ||||||
|
|
||||||
| ### Explorer Configuration | ||||||
|
|
||||||
| Clone this repository: | ||||||
|
|
||||||
| ```sh | ||||||
| git clone git@github.com:walnuthq/op-scan | ||||||
| ``` | ||||||
|
|
||||||
| Install the dependencies: | ||||||
|
|
||||||
| ```sh | ||||||
| pnpm install | ||||||
| ``` | ||||||
|
|
||||||
| You will need to copy `.env.local.example` into `.env.local` at the root of your repository and populate it with your own values. | ||||||
|
|
||||||
| In particular you will need to provide configuration for both L1 and L2 chains: | ||||||
|
|
||||||
| ``` | ||||||
| NEXT_PUBLIC_L1_CHAIN_ID="11155111" | ||||||
| NEXT_PUBLIC_L1_NAME="Sepolia" | ||||||
| NEXT_PUBLIC_L1_RPC_URL="https://eth-sepolia.g.alchemy.com/v2/API_KEY" | ||||||
| NEXT_PUBLIC_L2_CHAIN_ID="42069" | ||||||
| NEXT_PUBLIC_L2_NAME="OP Local" | ||||||
| NEXT_PUBLIC_L2_RPC_URL="http://localhost:8545" | ||||||
| ``` | ||||||
|
|
||||||
| You can get free node rpcs url by signing up to services such as [Alchemy](https://www.alchemy.com/) or [Infura](https://www.infura.io/). | ||||||
|
|
||||||
| You will also need to provide your L1 contracts addresses: | ||||||
|
|
||||||
| ``` | ||||||
| NEXT_PUBLIC_OPTIMISM_PORTAL_ADDRESS="..." | ||||||
| NEXT_PUBLIC_L1_CROSS_DOMAIN_MESSENGER_ADDRESS="..." | ||||||
| ``` | ||||||
|
|
||||||
| You will find theses addresses in your rollup deployment artifacts in `contracts-bedrock/deployments/your-deployment/L1Contract.json`. | ||||||
| Note that you always need to provide the proxy address, not the underlying contract. | ||||||
|
|
||||||
| If you don't want to run the explorer with your local chain setup, you will find all the necessary environment variables commented in `.env.local.example` to configure the explorer with OP Sepolia or OP Mainnet. | ||||||
|
|
||||||
| If you want to be able to use the Write Contract feature on verified contracts, you will also need to provide a [Reown](https://docs.reown.com/) project ID. | ||||||
|
|
||||||
| ``` | ||||||
| NEXT_PUBLIC_REOWN_PROJECT_ID="..." | ||||||
| ``` | ||||||
|
|
||||||
| ### Indexer Configuration | ||||||
|
|
||||||
| To run the indexer, you first need to setup your `DATABASE_URL` in `.env.local` as well as websocket connections to your L1/L2 chains (once again you can get them from a 3rd-party provider): | ||||||
|
|
||||||
| ``` | ||||||
| DATABASE_URL="file:dev.db" | ||||||
| L1_RPC_WS="wss://eth-mainnet.g.alchemy.com/v2/API_KEY" | ||||||
| L2_RPC_WS="wss://opt-mainnet.g.alchemy.com/v2/API_KEY" | ||||||
| ``` | ||||||
|
|
||||||
| Then you can sync your local database with the Prisma schema: | ||||||
|
|
||||||
| ```sh | ||||||
| pnpm prisma:db:push | ||||||
| ``` | ||||||
|
|
||||||
| We use [Bun](https://bun.sh/) to run the indexer as a long-running script so make sure it is installed globally on your system. | ||||||
| Now you will be able to start indexing the blockchain by running the `op-indexer` command: | ||||||
|
|
||||||
| ```sh | ||||||
| pnpm op-indexer | ||||||
| ``` | ||||||
|
|
||||||
| You should start seeing blocks getting indexed in your terminal and you can explore the state of your local database using Prisma studio: | ||||||
|
|
||||||
| ```sh | ||||||
| pnpm prisma:studio | ||||||
| ``` | ||||||
|
|
||||||
| If you need to change the Prisma schema at some point, make sure to regenerate the Prisma client and push to your local database: | ||||||
|
|
||||||
| ```sh | ||||||
| pnpm prisma:generate | ||||||
| pnpm prisma:db:push | ||||||
| ``` | ||||||
|
|
||||||
| Indexing a blockchain is putting a heavy load on the RPC as you need to perform a large number of JSON-RPC requests to fully index a block (along with transactions and logs). | ||||||
| When indexing non-local chains you will probably encounter 429 errors related to rate-limiting, you may provide up to 3 fallback RPC URLs in case this happens: | ||||||
|
|
||||||
| ``` | ||||||
| NEXT_PUBLIC_L1_FALLBACK1_RPC_URL="https://opt-mainnet.g.alchemy.com/v2/FALLBACK1_API_KEY" | ||||||
| NEXT_PUBLIC_L2_FALLBACK1_RPC_URL="https://opt-mainnet.g.alchemy.com/v2/FALLBACK1_API_KEY" | ||||||
| NEXT_PUBLIC_L1_FALLBACK2_RPC_URL="https://opt-mainnet.g.alchemy.com/v2/FALLBACK2_API_KEY" | ||||||
| NEXT_PUBLIC_L2_FALLBACK2_RPC_URL="https://opt-mainnet.g.alchemy.com/v2/FALLBACK2_API_KEY" | ||||||
| NEXT_PUBLIC_L1_FALLBACK3_RPC_URL="https://opt-mainnet.g.alchemy.com/v2/FALLBACK3_API_KEY" | ||||||
| NEXT_PUBLIC_L2_FALLBACK3_RPC_URL="https://opt-mainnet.g.alchemy.com/v2/FALLBACK3_API_KEY" | ||||||
| ``` | ||||||
|
|
||||||
| You can pass several parameters to the indexer to control the indexing range and execution: | ||||||
|
|
||||||
| - `--l2-from-block` (short `-f`, defaults to latest block) start indexing from this L2 block. | ||||||
| - `--l2-index-block` (short `-b`) index this particular L2 block number. | ||||||
| - `--l1-from-block` (defaults to latest block) start indexing from this L1 block. | ||||||
| - `--l1-index-block` index this particular L1 block number. | ||||||
| - `--index-delay` (short `-d`, defaults to 1000) delay in ms between indexing 2 blocks to avoid overloading the RPC. | ||||||
|
|
||||||
| Example of running the indexer: | ||||||
|
|
||||||
| ```sh | ||||||
| pnpm op-indexer -f 123416717 --l1-index-block 20426733 --l1-index-block 20426726 -d 500 | ||||||
| ``` | ||||||
|
|
||||||
| ### Running the Explorer | ||||||
|
|
||||||
| When you're done configuring your environment variables you can build the app: | ||||||
|
|
||||||
| ```sh | ||||||
| pnpm build | ||||||
| ``` | ||||||
|
|
||||||
| Make sure your local chain is started and the indexer is running, then launch the explorer to see it live at `http://localhost:3000` | ||||||
|
|
||||||
| ```sh | ||||||
| pnpm start | ||||||
| ``` | ||||||
|
|
||||||
| Alternatively you can launch the explorer in dev mode if you want to customize it | ||||||
|
|
||||||
| ```sh | ||||||
| pnpm dev | ||||||
| ``` | ||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Missing documentation file for OP Scan Block Explorer
The
_meta.jsonfile includes an entry for "op-scan" but there's no corresponding documentation file in the directory. The existingexplorer.mdxis specifically about deploying Blockscout and is unrelated to OP Scan. You should:pages/builders/chain-operators/tools/directory_meta.jsonas they represent different tools (Blockscout and OP Scan)🔗 Analysis chain
Please clarify the relationship with existing explorer entry.
The addition follows the correct format and maintains alphabetical ordering. However, there's already an existing "explorer" entry. Could you clarify if:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 225
Script:
Length of output: 2457