#![allow(unused_imports)]
use bincode::serialize;
use hex_literal::hex;
use crate::block::*;
use crate::tx::*;
use crate::user::*;
use serde::*;
use serde_json::*;
use std::collections::HashMap;
use std::fs;
use std::time::{Duration, Instant, SystemTime};
use sha3::*;
use k256::{
Secp256k1,
ecdsa::{signature::Signer, Signature, SigningKey, VerifyingKey},
SecretKey,
elliptic_curve::{ sec1::*, PublicKey},
};
use rand_core::OsRng;
pub mod tx;
pub mod block;
pub mod user;
fn main() {
println!("Chuck coin: where a kid can be a kid!");
println!("Take a coin kiddo:\n");
println!("{}", fs::read_to_string("asciiart.txt").unwrap());
let state = State::with_genesis_block();
let new_block = Block::new();
let serialized = bincode::serialize(&state).expect("Error serializing");
fs::write("state.bin", serialized).expect("Error writing to file");
let serialized = fs::read("state.bin").expect("Error reading file");
let state: State = bincode::deserialize(&serialized).expect("Error deserializing");
let verify_result = state.verify_all_blocks();
assert!(verify_result.is_ok());
println!("Serialiaze and deserialize successful!!! :D");
}