Skip to content

Soon to be indexer and block explorer for Ethereum. Written in Go for the backend and Next.js for the frontend.

License

Notifications You must be signed in to change notification settings

CaelRowley/geth-indexer-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EVM Indexer

A work-in-progress EVM indexer and block explorer written in Go. The project aims to sync blockchain data onto a PostgreSQL database using Kafka and provide search and analytics using Elasticsearch.

Environment Variables

  • DB_URL: The URL connection to a PostgreSQL database server.

  • NODE_URL: WebSocket connection to Ethereum node.

  • MSG_BROKER_URL: The url to a Kafka broker

Flags

  • port: Specifies the port number where the service will run. Default is 8080. Use this flag to define a custom port for the service.

  • sync: Enables block synchronization with the node's database. By default, synchronization is turned off (false). Use this flag to initiate synchronization of blockchain data into the PostgreSQL database.

Getting Started

You can run the backend locally with go, make or Docker.

Note The backend runs on port 8080 and the DB on port 5432 so make sure those ports are free if running locally.

Running with Make

make dev

Running with Docker Compose

docker-compose -f docker-compose.yml up

Database Table Structure

blocks table:

Column Type Key Description
hash char(66) Primary The hash of the block header.
number numeric Numeric identifier of the block within the blockchain.
gas_limit numeric Maximum gas allowed for transactions in the block.
gas_used numeric Total gas consumed by transactions in the block.
difficulty varchar Difficulty level for mining this block.
time numeric Timestamp of when the block was mined, in seconds since the epoch.
parent_hash char(66) The hash of the parent block, the previous block in the blockchain.
nonce varchar A 64-bit hash used in mining to demonstrate PoW for a block. No longer used for PoS.
miner char(42) Address of the miner who mined the block.
size numeric Size of the block in bytes.
root_hash char(66) Root hash of transactions in the block.
uncle_hash char(66) Hash of the uncle blocks (or ommer blocks) included in this block.
tx_hash char(66) Hash of all transaction hashes in this block.
receipt_hash char(66) Hash of the receipts of all transactions in this block.
extra_data bytea Additional binary data associated with the block.

transcations table:

Column Type Key Description
hash char(66) Primary The hash of the transaction hash ID.
from char(42) The address of the sender.
to char(42) The receiving address.
contract char(66) The contract address.
value numeric Amount of ETH to transfer from sender to recipient.
data bytea Optional field to include arbitrary data.
gas numeric The gas limit of the transaction.
gas_price numeric The gas price of the transaction.
cost numeric (gas * gasPrice) + (blobGas * blobGasPrice) + value.
nonce numeric The sender account nonce of the transaction.
status numeric The execution status of the transaction.
block_hash char(66) Hash of the block that includes this transaction.

About

Soon to be indexer and block explorer for Ethereum. Written in Go for the backend and Next.js for the frontend.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published