Skip to content

Code structure

Jhelison Uchoa edited this page Dec 21, 2022 · 9 revisions

Table of contents

Epic code structure

Epic is built in Rust, a memory-safe, compiled language. Performance critical parts like the Cuckoo mining algorithm are built as plugins, making it easy to swap between algorithm implementations for various hardware. Epic comes with CPU and experimental GPU support.

Files in the root of the project

List of files tracked in git and some files you'll create when you use epic.

  • Cargo.toml - defines how to the project code is to be compiled and built
  • LICENSE - Apache 2.0 license
  • README - The first document you should read, with pointers to find more detail.
  • rustfmt.toml - configuration file for rustfmt. Required before contributing new code

.epic structure

The path .epic is created at the execution of the Epic Cash binaries, they have the following structure:

  • chain_data
    Files related to the chain, and a database with the blockchain blocks and related information
  • tor
    Tor wallet connection.
  • wallet_data
    Files related to the wallet and a database storing your "outputs", that once confirmed and matured, can be spent with the [epic wallet send] command.

Epic server code structure

After checking out epic, building and using, these are the folders you'll have:

  • api
    Code for ApiEndpoints accessible over REST.
  • chain
    The blockchain implementation. Accepts a block (see pipe.rs) and adds it to the chain, or reject it.
  • config
    Code for handling configuration.
  • core
    All core types: Hash, Block, Input, Output, and how to serialize them. Core mining algorithm, and more.
  • debian
    Tools to build our .deb packages.
  • doc
    All documentation.
  • etc
    Docker files and others shell helpers.
  • features
    Feature files for cucumber tests.
  • keychain
    Code for working safely with keys and doing blinding.
  • p2p
    All peer to peer connection and protocol-related logic (handshake, block propagation, etc.).
  • pool
    Code for the transaction pool implementation.
  • servers
    Many parts (adapters, lib, miner, seed, server, sync, types) that the epic server needs, including mining server.
  • src
    Code for the epic binary.
  • store
    Data store - Epic uses a near-zero-cost Rust wrapper around LMDB, key-value embedded data store.
  • target
    Where the epic binary ends up, after the compile and build process finishes.
  • tests
    Cumcumber tests.
  • util
    Low-level rust utilities.

Epic Wallet code structure

After checking out epic-wallet, building and using, these are the folders you'll have:

  • api
    Code for ApiEndpoints accessible over REST.
  • config
    Code for handling configuration.
  • controller
    Library module for the main wallet functionalities.
  • debian
    Tools to build our .deb packages.
  • doc
    All documentation.
  • etc
    Docker files and others shell helpers.
  • impls
    Concrete implementations of types found in libwallet, are organized this way mostly to avoid any circular dependencies of any kind Functions in this crate should not use the wallet api crate directly.
  • integration
    Integration tests
  • libwallet
    Higher level wallet functions which can be used by callers to operate on the wallet, as well as helpers to invoke and instantiate wallets and listeners.
  • src
    Code for the epic-wallet binary.
  • target
    Where the epic binary ends up, after the compile and build process finishes.
  • tests
    Cumcumber tests.
  • util
    Low-level rust utilities.

Epic Miner code structure

After checking out epic-miner, building and using, these are the folders you'll have:

  • config
    Code for handling configuration.
  • core
    All core types: Hash, Block, Input, Output, and how to serialize them. Core mining algorithm, and more.
  • cuckoo-miner
    Code for handling the cuckoo miner.
  • debian
    Tools to build our .deb packages.
  • etc
    Docker files and others shell helpers.
  • features
    Feature files for cucumber tests.
  • ocl_cuckaroo
    Implementation for opencl cuckaroo.
  • plugin
    Device specific plugins for the epic miner.
  • progpow-miner
    Progpow miner implementation.
  • src
    Code for the epic-wallet binary.
  • target
    Where the epic binary ends up, after the compile and build process finishes.
  • tests
    Cumcumber tests.
  • util
    Low-level rust utilities.