pub struct DigitalDNA {
pub sequence: Vec<u8>,
pub generation: u64,
pub mutations: Vec<Mutation>,
pub fitness: f64,
pub parent_hash: Option<String>,
pub created_at: u64,
pub keypair: DNAKeypair,
pub metadata: DNAMetadata,
}
Expand description
Digital DNA - The genetic foundation of TRON organisms
Fields§
§sequence: Vec<u8>
Cryptographic sequence that defines the organism’s identity
generation: u64
Current generation number (starts at 0)
mutations: Vec<Mutation>
List of mutations applied to this DNA
fitness: f64
Current fitness level (0.0 to 1.0+)
parent_hash: Option<String>
Hash of parent DNA (if created through reproduction)
created_at: u64
Timestamp when DNA was created
keypair: DNAKeypair
Cryptographic keypair for identity and signing
metadata: DNAMetadata
DNA-specific metadata
Implementations§
Source§impl DigitalDNA
impl DigitalDNA
Sourcepub fn generate_new() -> Result<Self, DNAError>
pub fn generate_new() -> Result<Self, DNAError>
Generate completely new DNA with random cryptographic identity
Sourcepub fn from_signing_key(signing_key: SigningKey) -> Result<Self, DNAError>
pub fn from_signing_key(signing_key: SigningKey) -> Result<Self, DNAError>
Create DNA from existing signing key (for testing/reproduction)
Sourcepub fn mutate(&mut self, mutation: Mutation) -> Result<(), DNAError>
pub fn mutate(&mut self, mutation: Mutation) -> Result<(), DNAError>
Apply a mutation to the DNA
Sourcepub fn generate_random_mutation(&self) -> Mutation
pub fn generate_random_mutation(&self) -> Mutation
Generate a random mutation based on current mutation rate
Sourcepub fn crossover(&self, other: &DigitalDNA) -> Result<DigitalDNA, DNAError>
pub fn crossover(&self, other: &DigitalDNA) -> Result<DigitalDNA, DNAError>
Perform biological crossover with another DNA
Sourcepub fn evolve_keys(&mut self, new_generation: u64) -> Result<(), DNAError>
pub fn evolve_keys(&mut self, new_generation: u64) -> Result<(), DNAError>
Evolve cryptographic keys to next generation
Sourcepub fn sign_data(&self, data: &[u8]) -> Result<Vec<u8>, DNAError>
pub fn sign_data(&self, data: &[u8]) -> Result<Vec<u8>, DNAError>
Sign data with DNA’s private key
Sourcepub fn verify_signature(&self, data: &[u8], signature: &[u8]) -> bool
pub fn verify_signature(&self, data: &[u8], signature: &[u8]) -> bool
Verify signature with DNA’s public key
Sourcepub fn genetic_distance(&self, other: &DigitalDNA) -> f64
pub fn genetic_distance(&self, other: &DigitalDNA) -> f64
Calculate genetic distance from another DNA
Sourcepub fn update_fitness(&mut self, performance_score: f64)
pub fn update_fitness(&mut self, performance_score: f64)
Update fitness based on performance
Trait Implementations§
Source§impl Clone for DigitalDNA
impl Clone for DigitalDNA
Source§fn clone(&self) -> DigitalDNA
fn clone(&self) -> DigitalDNA
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more