Expand description

Eigen Trust

A library for managing trust in a distributed network with zero-knowledge features.

Main characteristics:

Self-policing - the shared ethics of the user population is defined and enforced by the peers themselves and not by some central authority.

Minimal - computation, infrastructure, storage, and message complexity are reduced to a minimum.

Incorruptible - Reputation should be obtained by consistent good behavior through several transactions. This is enforced for all users, so no one can cheat the system and obtain a higher reputation. It is also resistant to malicious collectives.


use eigen_trust::{EigenError, Keypair, LevelFilter, Multiaddr, Node, NodeConfig, PeerId};
use std::str::FromStr;

const BOOTSTRAP_PEERS: [(&str, &str, f64); 2] = [

const DEFAULT_ADDRESS: &str = "/ip4/";

struct Config;
impl NodeConfig for Config {
	const INTERVAL: u64 = 2;
	const NUM_CONNECTIONS: usize = 12;
	const PRE_TRUST_WEIGHT: f64 = 0.2;

async fn main() -> Result<(), EigenError> {
	let local_key = Keypair::generate_ed25519();
	let local_address =
		Multiaddr::from_str(DEFAULT_ADDRESS).map_err(|_| EigenError::InvalidAddress)?;

	let mut bootstrap_nodes = Vec::new();
	for info in BOOTSTRAP_PEERS.iter() {
		let peer_addr = Multiaddr::from_str(info.0).map_err(|_| EigenError::InvalidAddress)?;
		let peer_id = PeerId::from_str(info.1).map_err(|_| EigenError::InvalidPeerId)?;

		bootstrap_nodes.push((peer_id, peer_addr, info.2));

	let node = Node::<Config>::new(local_key, local_address, bootstrap_nodes)?;



The library is implemented according to the original Eigen Trust paper. It is developed under the Ethereum Foundation grant.


Epoch struct, which is a wrapper around epoch number and timestamp.

Representation of a Multiaddr.

The Node struct.

The peer struct.

Identifier of a peer of the network.


The crate-wide error variants.

Identity keypair of a node.

An enum representing the available verbosity level filters of the logger.


Node configuration crate.