Skip to content

everFinance/arsyncer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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, subscribeType)

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 subscribeType subscribe tx or block, or both.

Run

syncer.Run()

SubscribeTx

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

Example

  1. Get all transactions and blocks 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

Related

How to implement a high-performance arweave txs synchroniser?
https://medium.com/everfinance/arsyncer-arweave-transaction-synchroniser-3ebcf0e741ec