In the spirit of Google Guava, Tuweni is a set of libraries and other tools to aid development of blockchain and other decentralized software in Java and other JVM languages.

All Types

org.apache.tuweni.crypto.sodium.AES256GCM

Authenticated Encryption with Additional Data using AES-GCM.

WARNING: Despite being the most popular AEAD construction due to its use in TLS, safely using AES-GCM in a different context is tricky.

No more than ~350 GB of input data should be encrypted with a given key. This is for ~16 KB messages -- Actual figures vary according to message sizes.

In addition, nonces are short and repeated nonces would totally destroy the security of this scheme. Nonces should thus come from atomic counters, which can be difficult to set up in a distributed environment.

Unless you absolutely need AES-GCM, use XChaCha20Poly1305 instead. It doesn't have any of these limitations. Or, if you don't need to authenticate additional data, just stick to Sodium#crypto_box(byte[], byte[], long, byte[], byte[], byte[]).

This class depends upon the JNR-FFI library being available on the classpath, along with its dependencies. See https://github.com/jnr/jnr-ffi. JNR-FFI can be included using the gradle dependency 'com.github.jnr:jnr-ffi'.

org.apache.tuweni.scuttlebutt.lib.model.query.AboutQuery
org.apache.tuweni.scuttlebutt.lib.model.query.AboutQueryResponse

A response to querying for the profile details of a user.

org.apache.tuweni.bytes.AbstractBytes

An abstract Bytes value that provides implementations of #equals(Object), #hashCode() and #toString().

org.apache.tuweni.eth.Address

An Ethereum account address.

org.apache.tuweni.crypto.sodium.Allocated

Allocated objects track allocation of memory using Sodium.

org.apache.tuweni.concurrent.AsyncCompletion (extensions in package org.apache.tuweni.concurrent.coroutines)
org.apache.tuweni.concurrent.AsyncCompletion

A completion that will be complete at a future time.

org.apache.tuweni.trie.AsyncMerkleStorage

A MerkleStorage implementation using AsyncResult's.

org.apache.tuweni.concurrent.AsyncResult (extensions in package org.apache.tuweni.concurrent.coroutines)
org.apache.tuweni.concurrent.AsyncResult

A result that will be available at a future time.

org.apache.tuweni.concurrent.AtomicSlotMap

An atomic map that locates available keys within a DiscreteDomain.

This is an atomic map that will allocate key slots based on availability. It will attempt to keep the range compact by filling slots as they become available.

This implementation should be used with small sets, as addition is an O(N) operation.

org.apache.tuweni.crypto.sodium.Auth

Secret-key authentication.

These operations computes an authentication tag for a message and a secret key, and provides a way to verify that a given tag is valid for a given message and a key.

The function computing the tag is deterministic: the same (message, key) tuple will always produce the same output.

However, even if the message is public, knowing the key is required in order to be able to compute a valid tag. Therefore, the key should remain confidential. The tag, however, can be public.

A typical use case is:

  • A prepares a message, add an authentication tag, sends it to B
  • A doesn't store the message
  • Later on, B sends the message and the authentication tag to A
  • A uses the authentication tag to verify that it created this message.

This operation does not encrypt the message. It only computes and verifies an authentication tag.

org.apache.tuweni.scuttlebutt.lib.model.Author

A post author

org.apache.tuweni.crypto.mikuli.BLS12381

This Boneh-Lynn-Shacham (BLS) signature implementation is constructed from a pairing friendly elliptic curve, the BLS12-381 curve. It uses parameters as defined in https://z.cash/blog/new-snark-curve and the points in groups G1 and G2 are defined https://github.com/zkcrypto/pairing/blob/master/src/bls12_381/README.md

This class depends upon the Apache Milagro library being available. See https://milagro.apache.org.

Apache Milagro can be included using the gradle dependency 'org.miracl.milagro.amcl:milagro-crypto-java'.

org.apache.tuweni.io.Base32

Utility methods for encoding and decoding base32 strings.

org.apache.tuweni.io.Base64

Utility methods for encoding and decoding base64 strings.

org.apache.tuweni.io.Base64URLSafe

Utility methods for encoding and decoding base64 URL safe strings.

org.apache.tuweni.units.bigints.BaseUInt256Value

Base class for UInt256Value.

This class is abstract as it is not meant to be used directly, but it has no abstract methods. As mentioned in UInt256Value, this is used to create strongly-typed type aliases of UInt256. In other words, this allow to "tag" numbers with the unit of what they represent for the type-system, which can help clarity, but also forbid mixing numbers that are mean to be of different units (the strongly-typed part).

This class implements UInt256Value, but also adds a few operations that take a UInt256 directly, for instance #multiply(UInt256). The rational is that multiplying a given quantity of something by a "raw" number is always meaningful, and return a new quantity of the same thing.

org.apache.tuweni.units.bigints.BaseUInt32Value

Base class for UInt32Value.

This class is abstract as it is not meant to be used directly, but it has no abstract methods. As mentioned in UInt32Value, this is used to create strongly-typed type aliases of UInt32. In other words, this allow to "tag" numbers with the unit of what they represent for the type-system, which can help clarity, but also forbid mixing numbers that are mean to be of different units (the strongly-typed part).

This class implements UInt32Value, but also adds a few operations that take a UInt32 directly, for instance #multiply(UInt32). The rational is that multiplying a given quantity of something by a "raw" number is always meaningful, and return a new quantity of the same thing.

org.apache.tuweni.units.bigints.BaseUInt384Value

Base class for UInt384Value.

This class is abstract as it is not meant to be used directly, but it has no abstract methods. As mentioned in UInt384Value, this is used to create strongly-typed type aliases of UInt384. In other words, this allow to "tag" numbers with the unit of what they represent for the type-system, which can help clarity, but also forbid mixing numbers that are mean to be of different units (the strongly-typed part).

This class implements UInt384Value, but also adds a few operations that take a UInt384 directly, for instance #multiply(UInt384). The rational is that multiplying a given quantity of something by a "raw" number is always meaningful, and return a new quantity of the same thing.

org.apache.tuweni.units.bigints.BaseUInt64Value

Base class for UInt64Value.

This class is abstract as it is not meant to be used directly, but it has no abstract methods. As mentioned in UInt64Value, this is used to create strongly-typed type aliases of UInt64. In other words, this allow to "tag" numbers with the unit of what they represent for the type-system, which can help clarity, but also forbid mixing numbers that are mean to be of different units (the strongly-typed part).

This class implements UInt64Value, but also adds a few operations that take a UInt64 directly, for instance #multiply(UInt64). The rational is that multiplying a given quantity of something by a "raw" number is always meaningful, and return a new quantity of the same thing.

org.apache.tuweni.eth.Block

An Ethereum block.

org.apache.tuweni.eth.BlockBody

An Ethereum block body.

org.apache.tuweni.eth.BlockHeader

An Ethereum block header.

org.apache.tuweni.eth.repository.BlockHeaderFields

Block header index fields.

org.apache.tuweni.eth.repository.BlockchainIndex

A Lucene-backed indexer capable of indexing blocks and block headers.

org.apache.tuweni.eth.repository.BlockchainIndexReader

Reader of a blockchain index.

org.apache.tuweni.eth.repository.BlockchainIndexWriter

Indexer for blockchain elements.

org.apache.tuweni.eth.repository.BlockchainRepository

Repository housing blockchain information.

org.apache.tuweni.junit.BouncyCastleExtension

A junit5 extension, that installs a BouncyCastle security provider.

org.apache.tuweni.crypto.sodium.Box

Public-key authenticated encryption.

Using public-key authenticated encryption, Bob can encrypt a confidential message specifically for Alice, using Alice's public key.

Using Bob's public key, Alice can compute a shared secret key. Using Alice's public key and his secret key, Bob can compute the exact same shared secret key. That shared secret key can be used to verify that the encrypted message was not tampered with, before eventually decrypting it.

Alice only needs Bob's public key, the nonce and the ciphertext. Bob should never ever share his secret key, even with Alice.

And in order to send messages to Alice, Bob only needs Alice's public key. Alice should never ever share her secret key either, even with Bob.

Alice can reply to Bob using the same system, without having to generate a distinct key pair.

The nonce doesn't have to be confidential, but it should be used with just one encryption for a particular pair of public and secret keys.

One easy way to generate a nonce is to use Nonce#random(), considering the size of the nonces the risk of any random collisions is negligible. For some applications, if you wish to use nonces to detect missing messages or to ignore replayed messages, it is also acceptable to use an incrementing counter as a nonce.

When doing so you must ensure that the same value can never be re-used (for example you may have multiple threads or even hosts generating messages using the same key pairs).

As stated above, senders can decrypt their own messages, and compute a valid authentication tag for any messages encrypted with a given shared secret key. This is generally not an issue for online protocols.

This class depends upon the JNR-FFI library being available on the classpath, along with its dependencies. See https://github.com/jnr/jnr-ffi. JNR-FFI can be included using the gradle dependency 'com.github.jnr:jnr-ffi'.

kotlin.ByteArray (extensions in package org.apache.tuweni.kademlia)
org.apache.tuweni.bytes.Bytes

A value made of bytes.

This interface makes no thread-safety guarantee, and a Bytes value is generally not thread safe. However, specific implementations may be thread-safe. For instance, the value returned by #copy is guaranteed to be thread-safe as it is immutable.

org.apache.tuweni.bytes.Bytes32

A Bytes value that is guaranteed to contain exactly 32 bytes.

org.apache.tuweni.bytes.Bytes48

A Bytes value that is guaranteed to contain exactly 48 bytes.

org.apache.tuweni.scuttlebutt.handshake.vertx.ClientHandler

Handler managing a stream over SecureScuttlebutt originating from the Vert.x client

org.apache.tuweni.scuttlebutt.handshake.vertx.ClientHandlerFactory

Factory creating stream handlers, managing client-side connections.

org.apache.tuweni.trie.CompactEncoding

Compact (Hex-prefix) encoding and decoding.

An implementation of Compact (Hex-prefix) encoding.

org.apache.tuweni.concurrent.CompletableAsyncCompletion

An AsyncCompletion that can later be completed successfully or with a provided exception.

org.apache.tuweni.concurrent.CompletableAsyncResult

An AsyncResult that can be later completed successfully with a provided value, or completed with an exception.

org.apache.tuweni.crypto.sodium.Concatenate

Concatenate elements allocated to Sodium memory.

org.apache.tuweni.config.Configuration

Represents collection of configuration properties, optionally validated against a schema.

org.apache.tuweni.config.ConfigurationError

Provides details regarding an error in the configuration.

org.apache.tuweni.config.ConfigurationErrors

Factory methods for collections of ConfigurationError.

org.apache.tuweni.config.ConfigurationValidator

A validator for a configuration.

Validators of this type are invoked during verification after all property validators. However, errors returned by property validators do not prevent this validator being evaluated, so properties of the configuration may be missing or invalid.

org.apache.tuweni.scuttlebutt.rpc.mux.exceptions.ConnectionClosedException
org.apache.tuweni.net.coroutines.CoroutineByteChannel

A co-routine channel that can read and write bytes.

org.apache.tuweni.net.coroutines.CoroutineChannelGroup

A grouping of co-routine channels for the purpose of resource sharing.

org.apache.tuweni.net.coroutines.CoroutineDatagramChannel

A co-routine based datagram-oriented network channel.

org.apache.tuweni.concurrent.coroutines.CoroutineLatch

A co-routine synchronization aid that allows co-routines to wait until a set of operations being performed has completed.

org.apache.tuweni.net.coroutines.CoroutineNetworkChannel

A co-routine based network channel.

kotlinx.coroutines.CoroutineScope (extensions in package org.apache.tuweni.concurrent.coroutines)
org.apache.tuweni.net.coroutines.CoroutineSelector

A selector for co-routine based channel IO.

org.apache.tuweni.net.coroutines.CoroutineServerSocketChannel

A co-routine based network channel for stream-oriented connection listening.

org.apache.tuweni.net.coroutines.CoroutineSocketChannel

A co-routine based stream-oriented network channel.

org.apache.tuweni.scuttlebutt.lib.model.CouldNotSerializeException
org.apache.tuweni.rlpx.wire.DefaultWireConnection

A stateful connection between two peers under the Devp2p wire protocol.

kotlinx.coroutines.Deferred (extensions in package org.apache.tuweni.concurrent.coroutines)
org.apache.tuweni.crypto.sodium.DetachedEncryptionResult

The result from a detached encryption.

org.apache.tuweni.devp2p.DevP2PPeerRoutingTable

A Peer routing table for the Ethereum ÐΞVp2p network.

org.apache.tuweni.crypto.sodium.DiffieHelman

Sodium provides an API to perform scalar multiplication of elliptic curve points.

This can be used as a building block to construct key exchange mechanisms, or more generally to compute a public key from a secret key.

On current libsodium versions, you generally want to use the crypto_kx API for key exchange instead.

org.apache.tuweni.rlpx.wire.DisconnectReason

Enumeration of all reasons disconnect may happen.

org.apache.tuweni.devp2p.DiscoveryService

An Ethereum ÐΞVp2p discovery service.

org.apache.tuweni.config.DocumentPosition

A position in an input document.

org.apache.tuweni.discovery.ENRNode
org.apache.tuweni.discovery.ENRTree
org.apache.tuweni.discovery.ENRTreeLink
org.apache.tuweni.discovery.ENRTreeRoot
org.apache.tuweni.rlp.EndOfRLPException

Indicates the end of the RLP source has been reached unexpectedly.

org.apache.tuweni.ssz.EndOfSSZException

Indicates the end of the SSZ source has been reached unexpectedly.

org.apache.tuweni.devp2p.Endpoint

An Ethereum node endpoint.

org.apache.tuweni.devp2p.EnodeUriComponents

The components of an enode URI.

org.apache.tuweni.devp2p.EphemeralPeerRepository

An in-memory peer repository.

org.apache.tuweni.plumtree.EphemeralPeerRepository

In-memory peer repository.

org.apache.tuweni.ethash.EthHash

Implementation of EthHash utilities for Ethereum mining algorithms.

org.apache.tuweni.rlpx.EthereumIESEncryptionEngine

Support class for constructing integrated encryption ciphers for doing basic message exchanges on top of key agreement ciphers. Follows the description given in IEEE Std 1363a.

org.apache.tuweni.devp2p.EthereumNodeRecord

Ethereum Node Record (ENR) as described in EIP-778.

org.apache.tuweni.concurrent.ExpiringMap

A concurrent hash map that stores values along with an expiry. Values are stored in the map until their expiry is reached, after which they will no longer be available and will appear as if removed. The actual removal is done lazily whenever the map is accessed, or when the #purgeExpired() method is invoked.

org.apache.tuweni.concurrent.ExpiringSet

A concurrent hash set that stores values along with an expiry. Elements are stored in the set until their expiry is reached, after which they will no longer be available and will appear as if removed. The actual removal is done lazily whenever the set is accessed, or when the #purgeExpired() method is invoked.

org.apache.tuweni.scuttlebutt.lib.model.FeedMessage

A scuttlebutt feed message

org.apache.tuweni.scuttlebutt.lib.model.FeedMessageDeserializer
org.apache.tuweni.scuttlebutt.lib.FeedService

A service for operations that concern scuttlebutt feeds. Should be accessed via a ScuttlebuttClient instance.

org.apache.tuweni.scuttlebutt.lib.model.FeedValue

The metadata and contents of a message

org.apache.tuweni.io.file.Files

Utility methods for working with files.

org.apache.tuweni.net.tls.FingerprintRepository

Repository of remote peer fingerprints.

org.apache.tuweni.units.ethereum.Gas

A unit measure of Gas as used by the Ethereum VM.

org.apache.tuweni.net.coroutines.GatheringCoroutineByteChannel

A channel that can write bytes from a sequence of buffers.

org.apache.tuweni.crypto.sodium.GenericHash

Generic hashing utility (BLAKE2b).

org.apache.tuweni.gossip.GossipApp

Application running a gossip client, taking configuration from command line or a configuration file.

org.apache.tuweni.crypto.sodium.HMACSHA256

Message authentication code support for HMAC-SHA-256.

org.apache.tuweni.crypto.sodium.HMACSHA512

Message authentication code support for HMAC-SHA-512.

org.apache.tuweni.crypto.sodium.HMACSHA512256

Message authentication code support for HMAC-SHA-512-256.

HMAC-SHA-512-256 is implemented as HMAC-SHA-512 with the output truncated to 256 bits. This is slightly faster than HMAC-SHA-256. Note that this construction is not the same as HMAC-SHA-512/256, which is HMAC using the SHA-512/256 function.

org.apache.tuweni.scuttlebutt.handshake.HandshakeException

Exceptions thrown during handshake because of invalid messages or different network identifiers.

org.apache.tuweni.rlpx.HandshakeMessage

Contents of a message sent as part of a RLPx handshake.

org.apache.tuweni.crypto.Hash

Various utilities for providing hashes (digests) of arbitrary data. Requires the BouncyCastleProvider to be loaded and available. See https://www.bouncycastle.org/wiki/display/JA1/Provider+Installation for detail.

org.apache.tuweni.eth.Hash

An Ethereum hash.

org.apache.tuweni.rlpx.wire.HelloMessage
org.apache.tuweni.hobbits.HobbitsTransport

Hobbits is a peer-to-peer transport stack specified at https://www.github.com/deltap2p/hobbits.

org.apache.tuweni.io.IOConsumer

Represents an operation that accepts a single input argument and returns no result.

org.apache.tuweni.scuttlebutt.Identity

A Scuttlebutt identity, backed by a public key. Currently supported: Ed25519 and SECP256K1.

org.apache.tuweni.kv.InfinispanKeyValueStore

A key-value store backed by Infinispan

org.apache.tuweni.config.InvalidConfigurationPropertyTypeException

An exception thrown when an invalid type is encountered.

org.apache.tuweni.discovery.InvalidEntryException
org.apache.tuweni.rlpx.InvalidMACException

Exception thrown when the message contents do not match the Message Authentication Code.

org.apache.tuweni.rlp.InvalidRLPEncodingException

Indicates that invalid RLP encoding was encountered.

org.apache.tuweni.rlp.InvalidRLPTypeException

Indicates that an unexpected type was encountered when decoding RLP.

org.apache.tuweni.crypto.InvalidSEC256K1SecretKeyStoreException

Exception thrown when reading a store that contains an invalid SEC256K1 private keys.

org.apache.tuweni.ssz.InvalidSSZTypeException

Indicates that an unexpected type was encountered when decoding SSZ.

org.apache.tuweni.scuttlebutt.Invite

An invite code as defined by the Secure Scuttlebutt protocol guide.

See https://ssbc.github.io/scuttlebutt-protocol-guide/ for a detailed description of invites.

org.apache.tuweni.scuttlebutt.lib.model.query.IsFollowingQuery
org.apache.tuweni.scuttlebutt.lib.model.query.IsFollowingResponse
kotlinx.coroutines.Job (extensions in package org.apache.tuweni.concurrent.coroutines)
org.apache.tuweni.kademlia.KademliaRoutingTable

A Kademlia Routing Table

org.apache.tuweni.crypto.sodium.KeyDerivation

Key derivation.

Multiple secret subkeys can be derived from a single master key.

Given the master key and a key identifier, a subkey can be deterministically computed. However, given a subkey, an attacker cannot compute the master key nor any other subkeys.

org.apache.tuweni.crypto.sodium.KeyExchange

Key exchange.

Allows two parties to securely compute a set of shared keys using their peer's public key and their own secret key.

org.apache.tuweni.scuttlebutt.lib.KeyFileLoader

Utility class for loading scuttlebutt keys from the file system.

org.apache.tuweni.crypto.mikuli.KeyPair

KeyPair represents a public and private key.

org.apache.tuweni.kv.KeyValueStore

A key-value store.

org.apache.tuweni.les.LESSubprotocol

The LES subprotocol entry point class, to be used in conjunction with RLPxService

org.apache.tuweni.kv.LevelDBKeyValueStore

A key-value store backed by LevelDB.

org.apache.tuweni.crypto.sodium.LibSodium
org.apache.tuweni.les.LightClient

Calls to LES functions from the point of view of the consumer of the subprotocol.

org.apache.tuweni.scuttlebutt.discovery.LocalIdentity

Representation of an identity associated with an IP and port, used for Scuttlebutt local discovery.

See https://ssbc.github.io/scuttlebutt-protocol-guide/ for a detailed description of this identity.

org.apache.tuweni.eth.Log

A log entry is a tuple of a logger’s address (the address of the contract that added the logs), a series of 32-bytes log topics, and some number of bytes of data.

org.apache.tuweni.eth.LogsBloomFilter

Bloom filter implementation for storing persistent logs, describes a 2048-bit representation of all log entries of a transaction, except data. Sets the bits of the 2048 byte array, where indices are given by: The lower order 11-bits, of the first three double-bytes, of the SHA3, of each value. For instance the address "0x0F572E5295C57F15886F9B263E2F6D2D6C7B5EC6" results in the KECCAK256 hash "bd2b01afcd27800b54d2179edc49e2bffde5078bb6d0b204694169b1643fb108", of which the corresponding double-bytes are: bd2b, 01af, cd27, corresponding to the following bits in the bloom filter: 1323, 431, 1319

org.apache.tuweni.junit.LuceneIndex

A parameter annotation for injecting a Lucene index directory into junit5 tests.

org.apache.tuweni.junit.LuceneIndexWriter

A parameter annotation for injecting a Lucene index writer into junit5 tests.

org.apache.tuweni.junit.LuceneIndexWriterExtension

A junit5 extension, that provides a memory-backed Lucene index writer for tests. The index writer is created for the test suite and injected into any tests with parameters annotated by LuceneIndexWriter.

org.apache.tuweni.scuttlebutt.MalformedInviteCodeException
org.apache.tuweni.kv.MapDBKeyValueStore

A key-value store backed by a MapDB instance.

org.apache.tuweni.kv.MapKeyValueStore

A key-value store backed by an in-memory Map.

org.apache.tuweni.rlpx.MemoryWireConnectionsRepository

In-memory implementation of the wire connections repository.

org.apache.tuweni.trie.MerklePatriciaTrie

An in-memory MerkleTrie.

org.apache.tuweni.trie.MerkleStorage

Storage for use in a StoredMerklePatriciaTrie.

org.apache.tuweni.trie.MerkleStorageException

This exception is thrown when there is an issue retrieving or decoding values from MerkleStorage.

org.apache.tuweni.trie.MerkleTrie

A Merkle Trie.

org.apache.tuweni.hobbits.Message

Hobbits message.

org.apache.tuweni.plumtree.MessageHashing

Produces an identifiable footprint for a message (generally a hash) that can be passed on to other peers to identify uniquely a message being propagated.

org.apache.tuweni.plumtree.MessageListener

Listens to an incoming message, along with its attributes.

org.apache.tuweni.plumtree.MessageSender

Interface to sending messages to other peers.

org.apache.tuweni.plumtree.MessageValidator

Validator for a message and a peer. This validator is called prior to gossiping the message from that peer to other peers.

org.apache.tuweni.scuttlebutt.rpc.mux.Multiplexer

Multiplexes asynchronous requests and streams across a connection to a node. Handles multiple active requests and streams across one connection.

org.apache.tuweni.bytes.MutableByteBufferWrappingBytes
org.apache.tuweni.bytes.MutableBytes

A mutable Bytes value.

org.apache.tuweni.bytes.MutableBytes32

A mutable Bytes32, that is a mutable Bytes value of exactly 32 bytes.

org.apache.tuweni.bytes.MutableBytes48

A mutable Bytes48, that is a mutable Bytes value of exactly 48 bytes.

kotlin.collections.MutableList (extensions in package org.apache.tuweni.kademlia)
org.apache.tuweni.scuttlebutt.lib.NetworkService

A service for operations that connect nodes together and other network related operations

Assumes the standard 'ssb-gossip' plugin is installed and enabled on the node that we're connected to (or that RPC functions meeting its manifest's contract are available.).

Should not be constructed directly, should be used via an ScuttlebuttClient instance.

org.apache.tuweni.config.NoConfigurationPropertyException

An exception thrown when a requested configuration property is not found.

This exception can be avoided by using a schema that provides a default value or asserts that a value has been provided in the configuration.

org.apache.tuweni.crypto.sodium.PasswordHash

The Argon2 memory-hard hashing function.

Argon2 summarizes the state of the art in the design of memory-hard functions.

It aims at the highest memory filling rate and effective use of multiple computing units, while still providing defense against tradeoff attacks.

It prevents ASICs from having a significant advantage over software implementations.

Guidelines for choosing the parameters

Start by determining how much memory the function can use. What will be the highest number of threads/processes evaluating the function simultaneously (ideally, no more than 1 per CPU core)? How much physical memory is guaranteed to be available?

Set memlimit to the amount of memory you want to reserve for password hashing.

Then, set opslimit to 3 and measure the time it takes to hash a password.

If this it is way too long for your application, reduce memlimit, but keep opslimit set to 3.

If the function is so fast that you can afford it to be more computationally intensive without any usability issues, increase opslimit.

For online use (e.g. login in on a website), a 1 second computation is likely to be the acceptable maximum.

For interactive use (e.g. a desktop application), a 5 second pause after having entered a password is acceptable if the password doesn't need to be entered more than once per session.

For non-interactive use and infrequent use (e.g. restoring an encrypted backup), an even slower computation can be an option.

This class depends upon the JNR-FFI library being available on the classpath, along with its dependencies. See https://github.com/jnr/jnr-ffi. JNR-FFI can be included using the gradle dependency 'com.github.jnr:jnr-ffi'.

org.apache.tuweni.devp2p.Peer

An Ethereum P2P network peer.

org.apache.tuweni.plumtree.Peer

A peer part of the gossip system.

org.apache.tuweni.scuttlebutt.lib.model.Peer
org.apache.tuweni.plumtree.PeerPruning

Interface to decide whether to prune peers when they send messages late. Pruned peers become "lazy peers". They send message attestations (IHAVE).

org.apache.tuweni.devp2p.PeerRepository

A repository of peers in an Ethereum network.

org.apache.tuweni.plumtree.PeerRepository

Repository of active peers associating with a gossip tree.

org.apache.tuweni.devp2p.PeerRoutingTable

A routing table for ÐΞVp2p peers.

org.apache.tuweni.scuttlebutt.lib.model.PeerStateChange
org.apache.tuweni.scuttlebutt.lib.model.Profile

Represents a user profile.

org.apache.tuweni.progpow.ProgPoW

Ethereum ProgPoW mining algorithm, based on revision 0.9.2. This implements the ProgPoW algorithm (https://github.com/ifdefelse/ProgPOW). This algorithm is licensed under CC0 1.0 Universal (CC0 1.0) Public Domain Dedication (https://creativecommons.org/publicdomain/zero/1.0/)

org.apache.tuweni.config.PropertyValidator

A validator associated with a specific configuration property.

org.apache.tuweni.hobbits.Protocol
org.apache.tuweni.crypto.mikuli.PublicKey

This class represents a BLS12-381 public key.

org.apache.tuweni.rlp.RLP

Recursive Length Prefix (RLP) encoding and decoding.

org.apache.tuweni.rlp.RLPException

Base type for all RLP encoding and decoding exceptions.

org.apache.tuweni.rlp.RLPReader

A reader for consuming values from an RLP encoded source.

org.apache.tuweni.rlp.RLPWriter

A writer for encoding values to RLP.

org.apache.tuweni.rlpx.RLPxConnection

Connection between 2 peers over the RLPx protocol.

The RLPx protocol creates a exchange of unique secrets during an initial handshake. The peers proceed to communicate using the shared secrets.

This connection allows encrypting and decrypting messages with a remote peer.

org.apache.tuweni.rlpx.RLPxConnectionFactory

Factory creating RLPxConnection, either from initiating a handshake or responding to a handshake request.

org.apache.tuweni.rlpx.RLPxMessage

Message exchanged over a RLPx connection.

The message is identified by a negotiated code, offset according to the subprotocol mapping.

The message includes the raw content of the message as bytes.

org.apache.tuweni.rlpx.RLPxService

Service allowing connections to remote peers over RLPx connections.

org.apache.tuweni.scuttlebutt.rpc.RPCAsyncRequest
org.apache.tuweni.scuttlebutt.rpc.RPCCodec

Encoder responsible for encoding requests.

This encoder is stateful as it maintains a counter to provide different request ids over time.

org.apache.tuweni.scuttlebutt.rpc.RPCErrorBody

An RPC message response body which contains an error

org.apache.tuweni.scuttlebutt.rpc.RPCFlag

Defines constants for dealing with SecureScuttlebutt RPC flags.

org.apache.tuweni.scuttlebutt.rpc.RPCFunction

A scuttlebutt RPC function namespace and name representation.

org.apache.tuweni.scuttlebutt.rpc.mux.RPCHandler

Handles RPC requests and responses from an active connection to a scuttlebutt node.

org.apache.tuweni.scuttlebutt.rpc.RPCMessage

Decoded RPC message, making elements of the message available directly.

org.apache.tuweni.scuttlebutt.rpc.RPCRequestBody

The request payload of an RPC request to another node. The fields are as specified in the scuttlebutt protocol docs

org.apache.tuweni.scuttlebutt.rpc.mux.exceptions.RPCRequestFailedException
org.apache.tuweni.scuttlebutt.rpc.RPCRequestType

The available type of Scuttlebutt RPC requests

org.apache.tuweni.scuttlebutt.rpc.RPCResponse

A successful RPC response.

org.apache.tuweni.scuttlebutt.rpc.RPCStreamRequest

A request which returns a 'source' type result (e.g. opens up a stream that is followed by the request ID.)

org.apache.tuweni.scuttlebutt.lib.RawRequestService

Intended to make RPC requests which aren't supported by the higher level services possible. We cannot support every desired RPC request with higher level abstractions because it's possible to define custom plugins with custom endpoints.

org.apache.tuweni.net.coroutines.ReadableCoroutineByteChannel

A co-routine channel that can read bytes.

org.apache.tuweni.kv.RedisKeyValueStore

A key-value store backed by Redis.

org.apache.tuweni.junit.RedisPort

A parameter annotation for injecting the running Redis server port into junit5 tests.

org.apache.tuweni.junit.RedisServerExtension

A junit5 extension, that sets up an ephemeral Redis server for tests. The ephemeral Redis server is created with a random free port for the test suite and injected into any tests with parameters of type Integer annotated with RedisPort NOTE: Redis does not support picking a random port on its own. This extension tries its best to test free ports and avoid collisions.

org.apache.tuweni.hobbits.Relayer

Relays messages between two endpoints, with an interceptor reading passed messages.

org.apache.tuweni.relayer.RelayerApp

Relayer application, allowing to set a relay between two hobbits endpoints.

org.apache.tuweni.io.Resources

Methods for resolving resources. Supports recursive discovery and glob matching on the filesystem and in jar archives.

org.apache.tuweni.kv.RocksDBKeyValueStore

A key-value store backed by RocksDB.

org.apache.tuweni.crypto.SECP256K1

An Elliptic Curve Digital Signature using parameters as used by Bitcoin, and defined in Standards for Efficient Cryptography (SEC) (Certicom Research, http://www.secg.org/sec2-v2.pdf).

This class depends upon the BouncyCastle library being available and added as a java.security.Provider. See https://www.bouncycastle.org/wiki/display/JA1/Provider+Installation.

BouncyCastle can be included using the gradle dependency 'org.bouncycastle:bcprov-jdk15on'.

org.apache.tuweni.crypto.sodium.SHA256Hash

SHA-256 hashing. The SHA-256 and SHA-512 functions are provided for interoperability with other applications. If you are looking for a generic hash function and not specifically SHA-2, using crypto_generichash() (BLAKE2b) might be a better choice.

These functions are also not suitable for hashing passwords or deriving keys from passwords. Use one of the password hashing APIs instead.

These functions are not keyed and are thus deterministic. In addition, the untruncated versions are vulnerable to length extension attacks.

org.apache.tuweni.kv.SQLKeyValueStore

A key-value store backed by a relational database.

org.apache.tuweni.ssz.SSZ

Simple Serialize (SSZ) encoding and decoding.

org.apache.tuweni.ssz.SSZException

Base type for all SSZ encoding and decoding exceptions.

org.apache.tuweni.ssz.SSZReader

A reader for consuming values from an SSZ encoded source.

org.apache.tuweni.ssz.SSZWriter

A writer for encoding values to SSZ.

org.apache.tuweni.net.coroutines.ScatteringCoroutineByteChannel

A channel that can read bytes into a sequence of buffers.

org.apache.tuweni.config.Schema

A schema for a configuration, providing default values and validation rules.

org.apache.tuweni.config.SchemaBuilder

This interface allows customers to determine a schema to associate with a configuration to validate the entries read from configuration files, and provide default values if no value is present in the configuration file.

org.apache.tuweni.scuttlebutt.lib.ScuttlebuttClient

A client for making requests to a scuttlebutt instance with. This is the entry point for accessing service classes which perform operations related to different logical areas. Should be constructed using the ScuttlebuttClientFactory factory class.

org.apache.tuweni.scuttlebutt.lib.ScuttlebuttClientFactory

A factory for constructing a new instance of ScuttlebuttClient with the given configuration parameters

org.apache.tuweni.scuttlebutt.discovery.ScuttlebuttLocalDiscoveryService

Scuttlebutt local discovery service, based on the Scuttlebutt network protocol defined here. This service offers two functions:

It broadcasts to the local network every minute Scuttlebutt identities, as individual packets.

It listens to broadcasted packets on the local network and relays Scuttlebutt identities identified to listeners.

org.apache.tuweni.scuttlebutt.lib.model.ScuttlebuttMessageContent

Classes that are to be posted to the scuttlebutt feed should implement this interface

org.apache.tuweni.scuttlebutt.rpc.mux.ScuttlebuttStreamHandler

Handles incoming items from a result stream

org.apache.tuweni.crypto.sodium.SecretBox

Secret-key authenticated encryption.

Encrypts a message with a key and a nonce to keep it confidential, and computes an authentication tag. The tag is used to make sure that the message hasn't been tampered with before decrypting it.

A single key is used both to encrypt/sign and verify/decrypt messages. For this reason, it is critical to keep the key confidential.

The nonce doesn't have to be confidential, but it should never ever be reused with the same key. The easiest way to generate a nonce is to use randombytes_buf().

Messages encrypted are assumed to be independent. If multiple messages are sent using this API and random nonces, there will be no way to detect if a message has been received twice, or if messages have been reordered.

This class depends upon the JNR-FFI library being available on the classpath, along with its dependencies. See https://github.com/jnr/jnr-ffi. JNR-FFI can be included using the gradle dependency 'com.github.jnr:jnr-ffi'.

org.apache.tuweni.crypto.sodium.SecretDecryptionStream

Used to decrypt a sequence of messages, or a single message split into arbitrary chunks.

org.apache.tuweni.crypto.sodium.SecretEncryptionStream

Used to encrypt a sequence of messages, or a single message split into arbitrary chunks.

org.apache.tuweni.crypto.mikuli.SecretKey

This class represents a BLS12-381 private key.

org.apache.tuweni.scuttlebutt.handshake.SecureScuttlebuttHandshakeClient

Class responsible for performing a Secure Scuttlebutt handshake with a remote peer, as defined in the Secure Scuttlebutt protocol guide

Please note that only handshakes over the Ed25519 curve are supported.

This class manages the state of one handshake. It should not be reused across handshakes. If the handshake fails, a HandshakeException will be thrown.

org.apache.tuweni.scuttlebutt.handshake.SecureScuttlebuttHandshakeServer

Class responsible for performing a Secure Scuttlebutt handshake with a remote peer, as defined in the Secure Scuttlebutt protocol guide

Please note that only handshakes over the Ed25519 curve are supported.

This class manages the state of one handshake. It should not be reused across handshakes. If the handshake fails, a HandshakeException will be thrown.

org.apache.tuweni.scuttlebutt.handshake.SecureScuttlebuttStreamClient

Interface used to encrypt and decrypt messages to and from a server.

org.apache.tuweni.scuttlebutt.handshake.SecureScuttlebuttStreamServer

Interface used to encrypt and decrypt messages to and from a client.

org.apache.tuweni.scuttlebutt.handshake.vertx.SecureScuttlebuttVertxClient

Secure Scuttlebutt client using Vert.x to manage persistent TCP connections.

org.apache.tuweni.scuttlebutt.handshake.vertx.SecureScuttlebuttVertxServer

Secure Scuttlebutt server using Vert.x to manage persistent TCP connections.

org.apache.tuweni.scuttlebutt.handshake.vertx.ServerHandler

Handler managing a stream over SecureScuttlebutt originating from the Vert.x server

org.apache.tuweni.scuttlebutt.handshake.vertx.ServerHandlerFactory

Factory creating stream handlers, managing server-side connections.

org.apache.tuweni.crypto.mikuli.Signature

This class represents a Signature on G2

org.apache.tuweni.crypto.sodium.Signature

Public-key signatures.

In this system, a signer generates a key pair:

  • a secret key, that will be used to append a signature to any number of messages
  • a public key, that anybody can use to verify that the signature appended to a message was actually issued by the creator of the public key.

Verifiers need to already know and ultimately trust a public key before messages signed using it can be verified.

Warning: this is different from authenticated encryption. Appending a signature does not change the representation of the message itself.

This class depends upon the JNR-FFI library being available on the classpath, along with its dependencies. See https://github.com/jnr/jnr-ffi. JNR-FFI can be included using the gradle dependency 'com.github.jnr:jnr-ffi'.

org.apache.tuweni.crypto.mikuli.SignatureAndPublicKey

This class represents a signature and a public key

org.apache.tuweni.scuttlebutt.lib.SocialService

Operations for querying the follow graph, and fetching the profiles of users. Assumes that the standard 'ssb-about' and 'ssb-friends' plugins are installed on the target instance (or that RPC functions meeting their manifests' contracts are available.) Should not be instantiated directly - an instance should be acquired via the ScuttlebuttClient instance

org.apache.tuweni.crypto.sodium.Sodium

Access to the sodium native library.

This class provides static methods for checking or loading the sodium native library.

org.apache.tuweni.crypto.sodium.SodiumException

An exception that is thrown when an error occurs using the native sodium library.

org.apache.tuweni.crypto.sodium.SodiumVersion

Details of a sodium native library version.

org.apache.tuweni.plumtree.State

Local state to our peer, representing the make-up of the tree of peers.

org.apache.tuweni.trie.StoredMerklePatriciaTrie

A MerkleTrie that persists trie nodes to a MerkleStorage key/value store.

org.apache.tuweni.scuttlebutt.handshake.StreamException
org.apache.tuweni.scuttlebutt.lib.model.StreamHandler
org.apache.tuweni.io.Streams

Utilities for working with streams.

org.apache.tuweni.rlpx.wire.SubProtocol

Defines a subprotocol to be used for wire connections

org.apache.tuweni.rlpx.wire.SubProtocolHandler

Handler managing messages and new connections of peers related for a given subprotocol.

org.apache.tuweni.rlpx.wire.SubProtocolIdentifier

Identifier of a subprotocol, comprised of a name and version.

org.apache.tuweni.net.tls.TLS

Common utilities for TLS.

This class depends upon the BouncyCastle library being available and added as a java.security.Provider. See https://www.bouncycastle.org/wiki/display/JA1/Provider+Installation.

BouncyCastle can be included using the gradle dependencies org.bouncycastle:bcprov-jdk15on and org.bouncycastle:bcpkix-jdk15on.

org.apache.tuweni.junit.TempDirectory

A parameter annotation for injecting a temporary directory into junit5 tests.

org.apache.tuweni.junit.TempDirectoryExtension

A junit5 extension, that provides a temporary directory for tests. The temporary directory is created for the test suite and injected into any tests with parameters annotated by TempDirectory.

org.apache.tuweni.toml.Toml

Methods for parsing data stored in Tom's Obvious, Minimal Language (TOML).

org.apache.tuweni.toml.TomlArray

An array of TOML values.

org.apache.tuweni.toml.TomlInvalidTypeException

An exception thrown when an invalid type is encountered.

org.apache.tuweni.toml.TomlParseError

An error that occurred while parsing.

org.apache.tuweni.toml.TomlParseResult

The result from parsing a TOML document.

org.apache.tuweni.toml.TomlPosition

A position in an input document.

org.apache.tuweni.toml.TomlTable

An interface for accessing data stored in Tom's Obvious, Minimal Language (TOML).

org.apache.tuweni.toml.TomlVersion

Supported TOML specification versions.

org.apache.tuweni.eth.Transaction

An Ethereum transaction.

org.apache.tuweni.eth.TransactionReceipt

A transaction receipt, containing information pertaining a transaction execution.

Transaction receipts have two different formats: state root-encoded and status-encoded. The difference between these two formats is that the state root-encoded transaction receipt contains the state root for world state after the transaction has been processed (e.g. not invalid) and the status-encoded transaction receipt instead has contains the status of the transaction (e.g. 1 for success and 0 for failure). The other transaction receipt fields are the same for both formats: logs, logs bloom, and cumulative gas used in the block. The TransactionReceiptType attribute is the best way to check which format has been used.

org.apache.tuweni.eth.repository.TransactionReceiptFields

Transaction receipt index fields.

org.apache.tuweni.hobbits.Transport

Transport types supported.

org.apache.tuweni.net.tls.TrustManagerFactories

Trust manager factories for fingerprinting clients and servers.

org.apache.tuweni.units.bigints.UInt256

An unsigned 256-bit precision number. This is a raw UInt256Value - a 256-bit precision unsigned number of no particular unit.

org.apache.tuweni.units.bigints.UInt256Domain

A DiscreteDomain over UInt256.

org.apache.tuweni.units.bigints.UInt256Value

Represents a 256-bit (32 bytes) unsigned integer value.

A UInt256Value is an unsigned integer value stored with 32 bytes, so whose value can range between 0 and 2^256-1.

This interface defines operations for value types with a 256-bit precision range. The methods provided by this interface take parameters of the same type (and also long. This provides type safety by ensuring calculations cannot mix different UInt256Value types.

Where only a pure numerical 256-bit value is required, UInt256 should be used.

It is strongly advised to extend BaseUInt256Value rather than implementing this interface directly. Doing so provides type safety in that quantities of different units cannot be mixed accidentally.

org.apache.tuweni.units.bigints.UInt256ValueDomain

A DiscreteDomain over a UInt256Value.

org.apache.tuweni.units.bigints.UInt256s

Static utility methods on UInt256 values.

org.apache.tuweni.units.bigints.UInt32

An unsigned 32-bit precision number. This is a raw UInt32Value - a 32-bit precision unsigned number of no particular unit.

org.apache.tuweni.units.bigints.UInt32Domain

A DiscreteDomain over UInt32.

org.apache.tuweni.units.bigints.UInt32Value

Represents a 32-bit (8 bytes) unsigned integer value.

A UInt32Value is an unsigned integer value whose value can range between 0 and 2^32-1.

This interface defines operations for value types with a 32-bit precision range. The methods provided by this interface take parameters of the same type (and also long. This provides type safety by ensuring calculations cannot mix different UInt32Value types.

Where only a pure numerical 32-bit value is required, UInt32 should be used.

It is strongly advised to extend BaseUInt32Value rather than implementing this interface directly. Doing so provides type safety in that quantities of different units cannot be mixed accidentally.

org.apache.tuweni.units.bigints.UInt32ValueDomain

A DiscreteDomain over a UInt32Value.

org.apache.tuweni.units.bigints.UInt32s

Static utility methods on UInt32 values.

org.apache.tuweni.units.bigints.UInt384

An unsigned 384-bit precision number. This is a raw UInt384Value - a 384-bit precision unsigned number of no particular unit.

org.apache.tuweni.units.bigints.UInt384Domain

A DiscreteDomain over UInt384.

org.apache.tuweni.units.bigints.UInt384Value

Represents a 384-bit (48 bytes) unsigned integer value.

A UInt384Value is an unsigned integer value stored with 48 bytes, so whose value can range between 0 and 2^384-1.

This interface defines operations for value types with a 384-bit precision range. The methods provided by this interface take parameters of the same type (and also long. This provides type safety by ensuring calculations cannot mix different UInt384Value types.

Where only a pure numerical 384-bit value is required, UInt384 should be used.

It is strongly advised to extend BaseUInt384Value rather than implementing this interface directly. Doing so provides type safety in that quantities of different units cannot be mixed accidentally.

org.apache.tuweni.units.bigints.UInt384ValueDomain

A DiscreteDomain over a UInt384Value.

org.apache.tuweni.units.bigints.UInt384s

Static utility methods on UInt384 values.

org.apache.tuweni.units.bigints.UInt64

An unsigned 64-bit precision number. This is a raw UInt64Value - a 64-bit precision unsigned number of no particular unit.

org.apache.tuweni.units.bigints.UInt64Domain

A DiscreteDomain over UInt64.

org.apache.tuweni.units.bigints.UInt64Value

Represents a 64-bit (8 bytes) unsigned integer value.

A UInt64Value is an unsigned integer value whose value can range between 0 and 2^64-1.

This interface defines operations for value types with a 64-bit precision range. The methods provided by this interface take parameters of the same type (and also long. This provides type safety by ensuring calculations cannot mix different UInt64Value types.

Where only a pure numerical 64-bit value is required, UInt64 should be used.

It is strongly advised to extend BaseUInt64Value rather than implementing this interface directly. Doing so provides type safety in that quantities of different units cannot be mixed accidentally.

org.apache.tuweni.units.bigints.UInt64ValueDomain

A DiscreteDomain over a UInt64Value.

org.apache.tuweni.units.bigints.UInt64s

Static utility methods on UInt64 values.

org.apache.tuweni.scuttlebutt.lib.model.UpdateNameMessage

A message that when persisted to the feed updates the name of the given user

org.apache.tuweni.junit.VertxExtension

A junit5 extension, that provides a Vert.X instance for tests. The Vert.X instance created for the test suite and injected into any tests with parameters annotated by VertxInstance.

org.apache.tuweni.plumtree.vertx.VertxGossipServer

Vert.x implementation of the plumtree gossip. This implementation is provided as an example and relies on a simplistic JSON serialization of messages.

org.apache.tuweni.junit.VertxInstance

A parameter annotation for injecting a temporary Vert.X instance into junit5 tests.

org.apache.tuweni.rlpx.vertx.VertxRLPxService

Implementation of RLPx service using Vert.x.

org.apache.tuweni.net.tls.VertxTrustOptions

Vert.x TrustOptions for fingerprinting clients and servers.

This class depends upon the Vert.X library being available on the classpath, along with its dependencies. See https://vertx.io/download/. Vert.X can be included using the gradle dependency 'io.vertx:vertx-core'.

org.apache.tuweni.units.ethereum.Wei

A unit measure of Wei as used by the Ethereum VM.

org.apache.tuweni.scuttlebutt.lib.model.query.WhoAmIResponse
org.apache.tuweni.rlpx.wire.WireConnection

A stateful connection between two peers under the Devp2p wire protocol.

org.apache.tuweni.rlpx.WireConnectionRepository

A repository managing wire connections.

org.apache.tuweni.net.coroutines.WritableCoroutineByteChannel

A co-routine channel that can write bytes.

org.apache.tuweni.crypto.sodium.XChaCha20Poly1305

Authenticated Encryption with Additional Data using XChaCha20-Poly1305.

The XChaCha20-Poly1305 construction can safely encrypt a practically unlimited number of messages with the same key, without any practical limit to the size of a message (up to ~ 2^64 bytes).

As an alternative to counters, its large nonce size (192-bit) allows random nonces to be safely used.

For this reason, and if interoperability with other libraries is not a concern, this is the recommended AEAD construction.

This class depends upon the JNR-FFI library being available on the classpath, along with its dependencies. See https://github.com/jnr/jnr-ffi. JNR-FFI can be included using the gradle dependency 'com.github.jnr:jnr-ffi'.