openethereum/src/bin/client.rs

31 lines
768 B
Rust
Raw Normal View History

2015-12-22 22:19:50 +01:00
extern crate ethcore_util as util;
2016-01-07 16:08:12 +01:00
extern crate ethcore;
extern crate rustc_serialize;
2015-12-22 22:19:50 +01:00
use std::io::*;
2016-01-07 16:08:12 +01:00
use std::env;
use std::sync::Arc;
use util::hash::*;
2015-12-22 22:19:50 +01:00
use util::network::{NetworkService};
2016-01-07 16:08:12 +01:00
use ethcore::client::Client;
use ethcore::sync::EthSync;
2016-01-09 18:40:13 +01:00
use ethcore::spec::Spec;
2015-12-22 22:19:50 +01:00
fn main() {
2016-01-07 16:08:12 +01:00
let mut service = NetworkService::start().unwrap();
2016-01-07 20:49:36 +01:00
//TODO: replace with proper genesis and chain params.
2016-01-09 18:40:13 +01:00
let frontier = Spec::new_frontier();
2016-01-07 16:08:12 +01:00
let mut dir = env::temp_dir();
dir.push(H32::random().hex());
2016-01-09 18:40:13 +01:00
let client = Arc::new(Client::new(&frontier.genesis_block(), &dir));
EthSync::register(&mut service, client);
2015-12-22 22:19:50 +01:00
loop {
let mut cmd = String::new();
stdin().read_line(&mut cmd).unwrap();
2016-01-07 16:08:12 +01:00
if cmd == "quit\n" || cmd == "exit\n" || cmd == "q\n" {
2015-12-22 22:19:50 +01:00
break;
}
}
}