Began adding chain logic
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Jake Hillion 2021-06-14 22:43:43 +01:00
parent 9188221ce4
commit e0dc8c845a
4 changed files with 47 additions and 0 deletions

4
Cargo.lock generated
View File

@ -1,5 +1,9 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "currency"
version = "0.1.0"
[[package]]
name = "farm"
version = "0.1.0"

View File

@ -1,6 +1,7 @@
[workspace]
members = [
"currency",
"farm",
"node",
"plot",

9
currency/Cargo.toml Normal file
View File

@ -0,0 +1,9 @@
[package]
name = "currency"
version = "0.1.0"
authors = ["Jake Hillion <jake@hillion.co.uk>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

33
currency/src/lib.rs Normal file
View File

@ -0,0 +1,33 @@
use std::collections::HashMap;
type Hash = [u8; 64];
type Signature = [u8; 64];
type Address = [u8; 32];
type ChainHeight = u64;
type ChainSize = u64;
type Cost = u128;
type ChainIndex = u64;
pub struct BeaconEntry {
pub prev: Hash,
pub height: ChainHeight,
}
pub struct ShardEntry {
pub prev: Hash,
pub height: ChainHeight,
pub transactions: Vec<Transaction>,
}
pub struct Transaction {
pub address: Address,
pub signature: Signature,
}
impl Transaction {
fn get_cost(transaction: &Transaction, sizes: HashMap<ChainIndex, ChainSize>) -> Cost {
todo!()
}
}