openethereum/src/bin/client.rs

43 lines
912 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;
extern crate log;
2016-01-09 23:21:57 +01:00
extern crate env_logger;
2015-12-22 22:19:50 +01:00
use std::io::*;
use std::env;
use log::{LogRecord, LogLevelFilter};
use env_logger::LogBuilder;
2016-01-07 16:08:12 +01:00
use util::hash::*;
2016-01-13 23:15:44 +01:00
use ethcore::service::ClientService;
use ethcore::ethereum;
2015-12-22 22:19:50 +01:00
fn setup_log() {
let format = |record: &LogRecord| {
format!("{} - {}", record.level(), record.args())
};
let mut builder = LogBuilder::new();
builder.format(format).filter(None, LogLevelFilter::Info);
if env::var("RUST_LOG").is_ok() {
builder.parse(&env::var("RUST_LOG").unwrap());
}
builder.init().unwrap();
}
2015-12-22 22:19:50 +01:00
fn main() {
setup_log();
let spec = ethereum::new_frontier();
2016-01-13 23:15:44 +01:00
let mut _service = ClientService::start(spec).unwrap();
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;
}
}
}