Habtor Node

Learn how to run a Habtor node (replica)

The habtor_community/habtor-node repo runs a replica of the Habtor L2geth, which is useful for generating analytics for blockexplorers and other specialized use cases.

Basic Considerations

  1. Running a local Habtor node (replica) does not allow you to mine BNB, OMG, or HABTOR. There is no mining on L2.

  2. If you looking for best possible rpc read data (lowest possible latency) you are strongly advised not to run your own node, but to use https://lightning-replica.habtor.com. This is an autoscaling rpc endpoint that speaks directly to the core Habtor L2 geth.

  3. The Habtor L2 is (at present) a single proposer/sequencer system and the only way to write transactions is via https://mainnet.habtor.com. You cannot use a local node to write transactions.

  4. If your application does not need autoscaling and low latency, and can tolerate sync delays, you can run your own Habtor node (replica). This replica will try to follow the core L2 geth via data provided by Infura and https://lightning-replica.habtor.com, so it will necessarily lag behind https://lightning-replica.habtor.com.

  5. Please design your rpc connectors in a resource efficient manner. Notably, calling eth_getLogs(fromBlock: 0) 1000 times per second serves no conceivable purpose since the BSC mainnet blocktime is 12 seconds and the Habtor blocktime is > 1 second. All that does is to degrade your replica and trigger rate-limiting and/or IP blocking at https://lightning-replica.habtor.com.

Start Replica service

Requirements: you will need a command line and Docker. Before proceeding, please make sure Docker is running.

Open a terminal window. Clone the project and install needed dependencies:

$ git clone [email protected]:habtorcom/optimism-v2.git
$ cd optimism-v2
$ yarn install
$ yarn build

Then, add your Infura key to habtor_community/habtor-node/docker-compose-replica.yaml. If you do not have an Infura key, you can obtain one for free from Infura.

x-l1_rpc_dtl: &l1_rpc_dtl
  DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT: 'https://mainnet.infura.io/v3/YOUR_INFURA_KEY'

x-l1_rpc_geth: &l1_rpc_geth
  ETH1_HTTP: 'https://mainnet.infura.io/v3/YOUR_INFURA_KEY'

Next, build the packages:

Finally, bring up the services

The system will start and the Replica L2 Geth will begin to sync with the Habtor L2. The sync process can take 1/2 hour to complete. During the sync, you will see the Replica gradually catch up with the Habtor L2. Once it has synced up with the Habtor L2, you can use the replica for rpc reads.

Last updated