A Python-based tool for collecting and analyzing blockchain data from Base network.
- Tag: v1.3.0
- Last Updated: May 5, 2024
- Features:
- Real-time indexing with configurable duration (5 minutes)
- Collects data from latest blocks on Base network
- Analyzes different transaction types (normal, contract creation)
- Implements rate limiting and error handling
- Stores data in Supabase for efficient querying
- Includes data validation and duplicate checking
- Provides performance metrics and detailed logging
- Parallel processing with batching
- Block data prefetching and caching
- Quick contract creation detection
- Comprehensive logging with timestamps
- Graceful shutdown and cleanup
- Final report generation
- Clone the repository:
git clone https://github.com/tolgadizmen/indexing_blockchain_data.git- Install dependencies:
pip install -r requirements.txt- Set up environment variables:
- Create a
.envfile with:
BASE_MAINNET_RPC_URL=your_rpc_url_here
SUPABASE_URL=your_supabase_url_here
SUPABASE_KEY=your_supabase_key_here
tx_hash(TEXT, primary key) - Transaction hash of the contract creationblock_number(BIGINT) - Block number where the contract was createdcreator_address(TEXT) - Address of the contract creatorcontract_address(TEXT) - Address of the created contractcreation_timestamp(TIMESTAMP) - When the contract was createdinit_code_hash(TEXT) - Hash of the contract's initialization codegas_used(BIGINT) - Amount of gas used for contract creationstatus(BOOLEAN) - Whether the transaction was successfullogs_count(INTEGER) - Number of event logs emittedmetadata(JSONB) - Additional metadata for future extensibility
Run the script:
python3 contract_scanner.pyThe script will:
- Connect to Base Mainnet
- Connect to Supabase
- Scan blocks in real-time for 5 minutes
- Store block and transaction data
- Validate transaction counts
- Log performance metrics
- Generate final report on completion
- Duration: 300.80 seconds (5 minutes)
- Blocks Processed: 150 blocks
- Blocks per Second: 0.50
- Contract Creations Found: 20
- Contracts per Second: 0.07
- Block Gap: 1 block (0.00% gap)
- RPC Success Rate: 100%
- Average Block Processing Time: ~2.0 seconds
- Memory Usage: Stable throughout runtime
- Parallel Processing: 8 concurrent batches
- Transaction Batching: 25 transactions per batch
- Block Data Prefetching: 5 blocks ahead
- Block Data Caching: 20 blocks
- The script uses rate limiting to avoid RPC endpoint restrictions
- Data is validated to ensure consistency
- Duplicate blocks are automatically skipped
- All changes are tracked in Git with version tags
- Performance metrics help identify bottlenecks
- Parallel processing significantly improves performance
- Quick contract detection reduces processing time
- Comprehensive logging provides clear visibility
- Graceful shutdown ensures clean process termination
- Final reports provide comprehensive performance metrics
git checkout v1.3.0