1.0.1 • Published 4 years ago

@ostdotcom/ost-block-scanner v1.0.1

Weekly downloads
1
License
LGPL-3.0
Repository
github
Last release
4 years ago

OST Block Scanner

Latest version Downloads per month

OST Block Scanner parse Ethereum based chains and store data in DynamoDB. It supports multiple chains as well.

Install

  npm install @ostdotcom/ost-block-scanner --save

Setup

1. Install Prerequisites

2. Run DynamoDBLocal.jar, if you are not using AWS DynamoDB Service

  # NOTE: Make sure to change DYNAMODB_PATH
  export DYNAMODB_PATH=~/dynamodb_local_latest
  java -Djava.library.path=$DYNAMODB_PATH/DynamoDBLocal_lib/ -jar $DYNAMODB_PATH/DynamoDBLocal.jar -sharedDb -dbPath $DYNAMODB_PATH/

3. Create OST Block Scanner config file

Refer ./node_modules/@ostdotcom/ost-block-scanner/config.json.example to create a new configuration file. Also set CONFIG_STRATEGY_PATH environment variable

4. Create Global DynamoDB tables:

  node ./node_modules/@ostdotcom/ost-block-scanner/tools/initialSetup.js --configFile $CONFIG_STRATEGY_PATH

5. Add a new Chain and create chain specific shared DynamoDB tables:

  • Mandatory parameters: chainId, networkId, configFile
  • Optional parameters (defaults to 1): blockShardCount, economyShardCount, economyAddressShardCount, transactionShardCount

  # NOTE:
  # Make sure chain configuration is already present in config file, before starting this step. 
  # Optional parameters are used to create entity specific sharded tables. 
  # By default only one shard is created for each entity. 
  node ./node_modules/@ostdotcom/ost-block-scanner/tools/addChain.js --configFile $CONFIG_STRATEGY_PATH --chainId 2000 --networkId 1 --blockShardCount 2 --economyShardCount 2 --economyAddressShardCount 2 --transactionShardCount 2

How to add additional shards to existing chains?

  • Additional block specific data shards:
  node ./node_modules/@ostdotcom/ost-block-scanner/tools/createShards/byBlock.js --configFile $CONFIG_STRATEGY_PATH --chainId 2000 --shardNumber 1
  • Additional economy user(s) specific data shards:
  node ./node_modules/@ostdotcom/ost-block-scanner/tools/createShards/byEconomyAddress.js --configFile $CONFIG_STRATEGY_PATH --chainId 2000 --shardNumber 1
  • Additional transaction specific data shards:
  node ./node_modules/@ostdotcom/ost-block-scanner/tools/createShards/byTransaction.js --configFile $CONFIG_STRATEGY_PATH --chainId 2000 --shardNumber 1

Start Block Scanner

  • Mandatory parameters: chainId, configFile
  • Optional parameters: startBlockNumber, endBlockNumber
  node ./node_modules/@ostdotcom/ost-block-scanner/executables/blockScanner.js --configFile $CONFIG_STRATEGY_PATH --chainId 2000 --startBlockNumber 0 --endBlockNumber 100