Skip to content

wjsrobertson/kevem

Repository files navigation

Kevem - Kotlin Ethereum Virtual Machine

License Documentation Status Build Status Coverage Status

Kevem is an Ethereum client for testing web3j-based Kotlin/Java/JVM code.

It is an implementation of the Ethereum Virtual Machine written in Kotlin.

It allows running web3j tests completely in-process using JUnit etc. Alternatively it can be run as a standalone RPC server.

It supports most EVM / Ethereum JSON-RPC behaviour but a list of missing features and limitations can be found in the missing feature issues list.

Documentation

The latest documentation can be found on the Kevem readthedocs site.

Running in-process

🔷 For full information and options on running in-process see the kotlin DSL documentation on readthedocs.

Ensure kevem-dsl-nodep.jar is on your classpath along with kotlin-stdlib plus web3j version 5.3.x and its transitive dependencies.

Then use the Kotlin DSL to create a web3j instance. This example creates one account with one ETH balance based on a specified primary key:

import org.kevem.dsl.*

val web3j = kevem {
   account {
        balance = eth(1)
        privateKey = "0x68598e3adfd9904dbefaa024153e7c05fa2e95ccfc8846d80bd7f973cbce5395"
    }
}.toWeb3j()

It can then be used as you would use a normal web3j instance backed by a remote server - e.g. to deploy a HelloWorld contract and call a hello function on it:

val txManager = ...
val gasProvider = ...

val contract = HelloWorld.deploy(web3j, txManager, gasProvider).send()
val txHash = contract.callHello().send().transactionHash

Running as a standalone application

🔷 For full standalone execution instructions and options see the running standalone documentation on readthedocs.

Use java 1.8 or greater to execute the kevem-app-0.1.0-SNAPSHOT.jar jar

e.g. start on localhost, port 8545 generating 10 accounts:

java -jar kevem-app-0.1.0-SNAPSHOT.jar

Building

Building Kevem requires Java 1.8 or better and Gradle 5 or better

At the project root:

gradle shadow

This will create two main artifacts:

  • app/build/libs/kevem-app.jar - a runnable fat jar containing Kevem classes and all dependencies
  • dsl/build/libs/kevem-dsl-nodep.jar - a jar containing Kevem classes required to use the DSL feature

About

Kevem is an Ethereum client for testing web3j-based Kotlin/Java/JVM code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors