arsyncer


Install

go get github.com/everFinance/arsyncer

Introduction

arsyncer is the high performance arweave network transaction synchronisation component.

Principle

Based on goar’s getBlockFromPeers and getTxFromPeers methods.
it is possible to achieve 100% pull to each block.
then parse the tx_list in the block.
and pull 100% of each tx(not return tx_data).
and all transactions are returned in on-chain order.

New

syncer := New(startHeight, filterParams, arNode, conNum, stableBlockDistance)

startHeight block height at the start of the sync
filterParams filter tx
arNode arweave node url
conNum runtime concurrency number, default is 10
stableBlockDistance stable block height distance, default is 15

Run

syncer.Run()

SubscribeTx

for {
     select{
	 case sTx := <-s.SubscribeTxCh():
	 // process sTx
	    ...
    }
}

Example

  1. Get all transactions example: ./example/all-tx-syncer.go
  2. Get the transactions for the specified sender: ./example/from-tx-syncer.go
  3. Get the transactions for the specified target: ./example/target-tx-syncer.go
  4. Get all smart contract transactions: ./example/swc-syncer.go

GitHub

View Github