MCPcopy Index your code
hub / github.com/emeraldpay/etherjar

github.com/emeraldpay/etherjar @v0.13.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.13.0 ↗ · + Follow
1,886 symbols 3,931 edges 189 files 454 documented · 24%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

EtherJar

Build Status codecov license

Framework agnostic modular Java 17+ integration library for Ethereum blockchains

  • Latest Stable Version: 0.13.0
  • Latest Snapshot Version: 0.14.0-SNAPSHOT

Modules

Structure of dependencies between modules:

  • etherjar-abi
  • etherjar-domain
  • etherjar-hex
  • etherjar-domain
  • etherjar-hex
  • etherjar-rlp
  • etherjar-rpc-json
  • etherjar-domain
  • etherjar-hex
  • etherjar-rpc-api
  • etherjar-rpc-json
  • etherjar-domain
  • etherjar-hex
  • etherjar-rpc-emerald
  • etherjar-rpc-api
  • etherjar-rpc-kotlin
  • etherjar-rpc-api
  • etherjar-rpc-json
  • etherjar-rpc-emerald-kotlin
  • etherjar-rpc-api
  • etherjar-rpc-kotlin
  • etherjar-rpc-http-ktor
  • etherjar-rpc-api
  • etherjar-rpc-json
  • etherjar-rpc-kotlin
  • etherjar-rpc-http
  • etherjar-rpc-api
  • etherjar-domain
  • etherjar-hex
  • etherjar-rpc-ws
  • etherjar-rpc-api
  • etherjar-solidity
  • etherjar-abi
  • etherjar-domain
  • etherjar-tx
  • etherjar-rlp
  • etherjar-domain
  • etherjar-contract
  • etherjar-abi
  • etherjar-domain
  • etherjar-rpc-api
  • etherjar-erc20
  • etherjar-abi
  • etherjar-domain
  • etherjar-contract

where

  • etherjar-abi - Smart contract Application Binary Interface (ABI)
  • etherjar-contract - Methods to organize contract call
  • etherjar-domain - Core module contains pure domain logic (Address, Block, Transaction , Wei and so on)
  • etherjar-erc20 - Classes to simplify use of ERC-20 tokens
  • etherjar-hex - Hexadecimal encoding and encoding utils for String, BigInteger, byte arrays
  • etherjar-rlp - Reading and writing RLP (Recursive Length Prefix) encoded data
  • etherjar-rpc-json - JSON mapping to/from Java objects
  • etherjar-rpc-api - JSON-RPC API generic implementation
  • etherjar-rpc-kotlin - Kotlin coroutines client for JSON-RPC API data-layer
  • etherjar-rpc-http-ktor - Ktor based Kotlin coroutines transport for JSON-RPC API data-layer
  • etherjar-rpc-emerald - gRPC transport, see Emerald Dshackle
  • etherjar-rpc-emerald-kotlin - Kotlin coroutines gRPC transport for Emerald API
  • etherjar-rpc-http - HTTP transport implementation for JSON-RPC API data-layer
  • etherjar-rpc-ws - WebSocket transport to subscribe to new blocks
  • etherjar-solidity - Thin wrapper around solc Solidity compiler
  • etherjar-tx - Read, verify and manipulate Transactions

Usage

Maven

<repositories>
    <repository>
      <id>etherjar</id>
      <url>https://maven.emrld.io</url>
    </repository>
</repositories>

<dependency>
  <groupId>io.emeraldpay.etherjar</groupId>
  <artifactId>etherjar-rpc-http</artifactId>
  <version>0.12.0</version>
</dependency>

Gradle

repositories {
  maven {
    url "https://maven.emrld.io"
  }
}

dependencies {
    implementation "io.emeraldpay.etherjar:etherjar-rpc-http:0.12.0"
}

Examples

How to call web3_clientVersion low-level JSON-RPC API method:

public class GetClientVersion {
    public static void main(String[] args)
            throws URISyntaxException, IOException, ExecutionException, InterruptedException {        
        try (RpcTransport transport = HttpRpcTransport.newBuilder().connectTo("http://127.0.0.1:8545").build()) {
            RpcClient client = new DefaultRpcClient(transport);
            Future<String> req = client.execute(Commands.web3().clientVersion());

            System.out.println(String.format("Client version: %s", req.get()));
        }
    }
}

How to call eth_gasPrice low-level JSON-RPC API method:

public class GetGasPrice {

    public static void main(String[] args)
            throws URISyntaxException, IOException, ExecutionException, InterruptedException {

        try (RpcTransport transport = HttpRpcTransport.newBuilder().connectTo("http://127.0.0.1:8545").build()) {
            RpcClient client = new DefaultRpcClient(transport);
            Future<Wei> req = client.execute(Commands.eth().getGasPrice());

            System.out.println(String.format("Gas Price: %s Ether", req.get().toEthers(12)));
        }
    }
}

Documentation

Bugs and Feedback

For bugs, questions and discussions please use the GitHub Issues.

Licence

Copyright 2021 EmeraldPay, Inc

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Extension points exported contracts — how you extend this code

ReactorRpcTransport (Interface)
Interface for an actual executor of call on an upstream [20 implementers]
etherjar-rpc-http/src/main/java/io/emeraldpay/etherjar/rpc/http/ReactorRpcTransport.java
TransactionRef (Interface)
Transaction reference [8 implementers]
etherjar-domain/src/main/java/io/emeraldpay/etherjar/domain/TransactionRef.java
FuturesRpcClient (Interface)
(no doc) [21 implementers]
etherjar-rpc-api/src/main/java/io/emeraldpay/etherjar/rpc/FuturesRpcClient.java
SimpleType (Interface)
Fixed-size elementary type (32 bytes length only).
etherjar-abi/src/main/java/io/emeraldpay/etherjar/abi/SimpleType.java
HexEncoding (Interface)
Hex-encoded String for java.math.BigInteger instances.
etherjar-hex/src/main/java/io/emeraldpay/etherjar/hex/HexEncoding.java
Factory (Interface)
Factory that can read Event details from a TransactionLogJson @param type of event
etherjar-contract/src/main/java/io/emeraldpay/etherjar/contract/ContractEvent.java
RpcConverter (Interface)
(no doc) [2 implementers]
etherjar-rpc-json/src/main/java/io/emeraldpay/etherjar/rpc/RpcConverter.java
SubscriptionListener (Interface)
Listener for new data coming through WS subscription @author Igor Artamonov
etherjar-rpc-ws/src/main/java/io/emeraldpay/etherjar/rpc/ws/SubscriptionListener.java

Core symbols most depended-on inside this repo

getBytes
called by 95
etherjar-hex/src/main/java/io/emeraldpay/etherjar/hex/HexData.java
add
called by 79
etherjar-rpc-api/src/main/java/io/emeraldpay/etherjar/rpc/Batch.java
write
called by 73
etherjar-rlp/src/main/java/io/emeraldpay/etherjar/rlp/RlpWriter.java
get
called by 59
etherjar-erc20/src/main/java/io/emeraldpay/etherjar/erc20/ERC20Result.java
create
called by 57
etherjar-rpc-json/src/main/java/io/emeraldpay/etherjar/rpc/RpcCall.java
toHex
called by 53
etherjar-hex/src/main/java/io/emeraldpay/etherjar/hex/HexEncoding.java
hash
called by 41
etherjar-tx/src/main/java/io/emeraldpay/etherjar/tx/Signer.java
getType
called by 36
etherjar-rpc-json/src/main/java/io/emeraldpay/etherjar/rpc/json/StateDiffJson.java

Shape

Method 1,611
Class 239
Interface 22
Enum 11
Function 3

Languages

Java96%
Kotlin4%

Modules by API surface

etherjar-erc20/src/main/java/io/emeraldpay/etherjar/erc20/ERC20Call.java75 symbols
etherjar-rpc-json/src/main/java/io/emeraldpay/etherjar/rpc/json/TraceItemJson.java59 symbols
etherjar-rpc-json/src/main/java/io/emeraldpay/etherjar/rpc/json/BlockJson.java57 symbols
etherjar-rpc-json/src/main/java/io/emeraldpay/etherjar/rpc/json/StateDiffJson.java56 symbols
etherjar-rpc-json/src/main/java/io/emeraldpay/etherjar/rpc/json/TransactionJson.java50 symbols
etherjar-tx/src/main/java/io/emeraldpay/etherjar/tx/EIP712MessageSigner.java36 symbols
etherjar-rpc-json/src/main/java/io/emeraldpay/etherjar/rpc/json/TransactionReceiptJson.java36 symbols
etherjar-rpc-json/src/main/java/io/emeraldpay/etherjar/rpc/json/TransactionCallJson.java36 symbols
etherjar-solidity/src/main/java/io/emeraldpay/etherjar/solidity/Compiler.java32 symbols
etherjar-erc20/src/main/java/io/emeraldpay/etherjar/erc20/ERC20Result.java30 symbols
etherjar-tx/src/main/java/io/emeraldpay/etherjar/tx/TransactionWithSetCode.java29 symbols
etherjar-rpc-api/src/main/java/io/emeraldpay/etherjar/rpc/EthCommands.java29 symbols

For agents

$ claude mcp add etherjar \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact