Skip to content

amarinkovic/eth-tailz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eth-tailz

Purely functional stream processing of Ethereum transaction Event Logs for nayms/contracts-v3, implemented with ZIO and web3j.

Build native image

Application can be built as a native binary executable, that does not require the JVM runtime. Run the following to produce the native binary:

sbt nativeImage

Native image descriptors are produced by running the app with an agent:

sbt nativeImageRunAgent

Executable binary eth-tailz will be available inside the target folder.

Run it by giving it a contract address and a block number from which to start streaming. For example, you can run:

./target/eth-tailz --forever --polling-interval 12 --chunk-size 10000 0x39e2f550fef9ee15b459d16bD4B243b04b1f60e5 17088059

Workaround for the sbt-zio-cli plugin

Currently there is a problem with fetching the sbt-zio-cli jar from the internet. It is required to build it locally. Clone the zio-cli project locally and build the plugin and publish it to you local environment. To do that, first of all make sure the following is set for the sbt-zio-cli module of this project:

publish / skip     := false,

Then publish the jar file by starting the sbt and running the followint tasks:

project sbtZioCli
publishLocal

Jar file will be published locally somehere under:

~/.ivy2/local/zio.cli.sbt/sbt-zio-cli/scala_2.12/sbt_1.0/

Find the exact version produced and update it in this projects plugins.sbt

Workaround GraalVM issues

Current version of this code works with Graal VM Java 21.

Sbt native image plugin uses Coursier to detect java. Make sure to have Graal VM installed via Coursier.

Make sure to set GRAAL_HOME environment variable pointing to a GraalVM installation folder.

You might also get the following error:

[error] Failed to automatically install native-image. To fix this problem, install native-image manually and start sbt with the environment variable 'NATIVE_IMAGE_INSTALLED=true'

In that case make sure to have NATIVE_IMAGE_INSTALLED environment variable set to true.