Genesis, version changes and doc for testnet2 (#865)

* Bump up crates versions

* Finally add a Cargo.lock to avoid dependency breakages

* Build doc update for testnet2

* Fix test framework not really using its mining config

* Testnet2 genesis, best so far at 128 difficulty (a nice number)

* Minor build doc update
This commit is contained in:
Ignotus Peverell 2018-03-26 09:48:46 +00:00 committed by Yeastplume
parent 1a332a9e69
commit 327293d28e
18 changed files with 2547 additions and 130 deletions

2475
Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
[package] [package]
name = "grin" name = "grin"
version = "0.1.0" version = "0.2.0"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"] authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
exclude = ["**/*.grin", "**/*.grin2"] exclude = ["**/*.grin", "**/*.grin2"]
publish = false publish = false

View file

@ -1,6 +1,6 @@
[package] [package]
name = "grin_api" name = "grin_api"
version = "0.1.0" version = "0.2.0"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"] authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
workspace = ".." workspace = ".."
publish = false publish = false

View file

@ -1,6 +1,6 @@
[package] [package]
name = "grin_chain" name = "grin_chain"
version = "0.1.0" version = "0.2.0"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"] authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
workspace = ".." workspace = ".."
publish = false publish = false

View file

@ -1,6 +1,6 @@
[package] [package]
name = "grin_config" name = "grin_config"
version = "0.1.0" version = "0.2.0"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"] authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
workspace = ".." workspace = ".."
publish = false publish = false

View file

@ -1,6 +1,6 @@
[package] [package]
name = "grin_core" name = "grin_core"
version = "0.1.0" version = "0.2.0"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"] authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
workspace = ".." workspace = ".."
publish = false publish = false

View file

@ -83,22 +83,23 @@ pub fn genesis_testnet2() -> core::Block {
height: 0, height: 0,
previous: core::hash::Hash([0xff; 32]), previous: core::hash::Hash([0xff; 32]),
timestamp: time::Tm { timestamp: time::Tm {
tm_year: 2017 - 1900, tm_year: 2018 - 1900,
tm_mon: 3, tm_mon: 3,
tm_mday: 21, tm_mday: 26,
tm_hour: 22, tm_hour: 16,
..time::empty_tm() ..time::empty_tm()
}, },
//TODO: Check this is over-estimated at T2 launch //TODO: Check this is over-estimated at T2 launch
total_difficulty: Difficulty::from_num(global::initial_block_difficulty()), total_difficulty: Difficulty::from_num(global::initial_block_difficulty()),
nonce: 70081, nonce: 5100,
pow: core::Proof::new(vec![ pow: core::Proof::new(vec![
0x43ee48, 0x18d5a49, 0x2b76803, 0x3181a29, 0x39d6a8a, 0x39ef8d8, 0x478a0fb, 0xc959ec, 0x16c10da, 0x186c549, 0x3045401, 0x38226e3, 0x42d041b, 0x49bf309,
0x69c1f9e, 0x6da4bca, 0x6f8782c, 0x9d842d7, 0xa051397, 0xb56934c, 0xbf1f2c7, 0x5295ae9, 0x6ae4490, 0x763ba88, 0x78e711e, 0x8459fc9, 0x8579418, 0x8fbfc38,
0xc992c89, 0xce53a5a, 0xfa87225, 0x1070f99e, 0x107b39af, 0x1160a11b, 0x11b379a8, 0xbf735f0, 0xc30a750, 0xcf1df67, 0xea54fb7, 0xec30a7e, 0xf285691, 0x115b6000,
0x12420e02, 0x12991602, 0x12cc4a71, 0x13d91075, 0x15c950d0, 0x1659b7be, 0x1682c2b4, 0x11a68288, 0x11a6a1be, 0x1257f383, 0x12ec0836, 0x14357351, 0x14b25747,
0x1796c62f, 0x191cf4c9, 0x19d71ac0, 0x1b812e44, 0x1d150efe, 0x1d15bd77, 0x1d172841, 0x14d9e57c, 0x14f6755c, 0x14f99326, 0x17fe205f, 0x19523912, 0x1973f000,
0x1d51e967, 0x1ee1de39, 0x1f35c9b3, 0x1f557204, 0x1fbf884f, 0x1fcf80bf, 0x1fd59d40, 0x19a433b1, 0x19ff0f3a, 0x1bc050d1, 0x1da8c0cb, 0x1de11b30, 0x1eded1f7,
0x1f10dc08, 0x1f9a491c, 0x1fa004f8,
]), ]),
..Default::default() ..Default::default()
}, },

View file

@ -57,10 +57,8 @@ pub const TESTING_CUT_THROUGH_HORIZON: u32 = 20;
/// Testing initial block difficulty /// Testing initial block difficulty
pub const TESTING_INITIAL_DIFFICULTY: u64 = 1; pub const TESTING_INITIAL_DIFFICULTY: u64 = 1;
/// Testing initial block difficulty, testnet 2 /// Testnet 2 initial block difficulty, high to see how it goes
/// we want to overestimate here as well pub const TESTNET2_INITIAL_DIFFICULTY: u64 = 1000;
/// Setting to 1 for development, but should be 1000 at T2 launch
pub const TESTNET2_INITIAL_DIFFICULTY: u64 = 1;
/// The target is the 32-bytes hash block hashes must be lower than. /// The target is the 32-bytes hash block hashes must be lower than.
pub const MAX_PROOF_TARGET: [u8; 8] = [0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]; pub const MAX_PROOF_TARGET: [u8; 8] = [0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff];

View file

@ -12,37 +12,31 @@ What's working so far?
## Requirements ## Requirements
See [Requirements on the wiki](https://github.com/mimblewimble/docs/wiki/Building).
But basically: But basically:
- rust 1.21+ (use [rustup]((https://www.rustup.rs/))- i.e. `curl https://sh.rustup.rs -sSf | sh; source $HOME/.cargo/env`) - rust 1.21+ (use [rustup]((https://www.rustup.rs/))- i.e. `curl https://sh.rustup.rs -sSf | sh; source $HOME/.cargo/env`)
- cmake 3.2+ (for [Cuckoo mining plugins]((https://github.com/mimblewimble/cuckoo-miner))) - cmake 3.2+ (for [Cuckoo mining plugins]((https://github.com/mimblewimble/cuckoo-miner)))
- rocksdb + libs for compiling rocksdb: - rocksdb + libs for compiling rocksdb:
- clang (clanglib or clang-devel or libclang-dev) - clang (clanglib or clang-devel or libclang-dev)
- llvm (Fedora llvm-devel, Debian llvm-dev) - llvm (Fedora llvm-devel, Debian llvm-dev)
- ncurses and libs (ncurses ncurses5w) - ncurses and libs (ncurses, ncurses5w)
- linux-headers (reported needed on Alpine linux) - linux-headers (reported needed on Alpine linux)
## Build steps ## Build steps
```sh ```sh
git clone https://github.com/mimblewimble/grin.git git clone https://github.com/mimblewimble/grin.git
cd grin cd grin
# Decide yourself if you want master, another branch, or tag cargo build
cargo update # first time, in case you have some old stuff
cargo build
# or: cargo install && cargo clean # if you don't plan to build again soon
``` ```
### Cross-builds ### Cross-platform builds
Rust (cargo) can build grin for many platforms, so in theory running `grin` Rust (cargo) can build grin for many platforms, so in theory running `grin`
as a validating node on your low powered device might be possible. as a validating node on your low powered device might be possible.
To cross-compile `grin` on a x86 Linux platform and produce ARM binaries, To cross-compile `grin` on a x86 Linux platform and produce ARM binaries,
say, for a Raspberry Pi, uncomment or add the `no-plugin-build` feature in say, for a Raspberry Pi.
`grin.toml` to avoid the mining plugins.
### Building the Cuckoo-Miner plugins ### Building the Cuckoo-Miner plugins
@ -58,7 +52,8 @@ features=["no-plugin-build"]
and that it's not commented out. and that it's not commented out.
## Build errors ### Build errors
See [Troubleshooting](https://github.com/mimblewimble/docs/wiki/Troubleshooting) See [Troubleshooting](https://github.com/mimblewimble/docs/wiki/Troubleshooting)
## What was built? ## What was built?
@ -66,12 +61,14 @@ See [Troubleshooting](https://github.com/mimblewimble/docs/wiki/Troubleshooting)
A successful build gets you: A successful build gets you:
- `target/debug/grin` - the main grin binary - `target/debug/grin` - the main grin binary
- `target/debug/plugins/*` - mining plugins (optional) - `target/debug/plugins/*` - mining plugins (optional)
With the included `grin.toml` unchanged, Grin is still sensitive to the directory from which it's run. Make sure you
if you execute `cargo run` always run it within a directory that contains a `grin.toml` configuration and
you get a `.grin` subfolder that grin starts filling up. stay consistent as to where it's run from.
With the included `grin.toml` unchanged, if you execute `cargo run` you get a
`.grin` subfolder that grin starts filling up with blockchain data.
While testing, put the grin binary on your path like this: While testing, put the grin binary on your path like this:
@ -79,10 +76,17 @@ While testing, put the grin binary on your path like this:
export PATH=/path/to/grin/dir/target/debug:$PATH export PATH=/path/to/grin/dir/target/debug:$PATH
``` ```
You can then run `grin` directly (try `grin help` for more options).
*Important Note*: if you used Grin in testnet1, running the wallet listener
manually isn't requred anymore. Grin will create a seed file and run the
listener automatically on start.
# Configuration # Configuration
Grin has a good defaults, a configuration file `grin.toml` that's documented inline that can override the defaults, Grin has a good defaults, a configuration file `grin.toml` that's documented
and command line switches that has top priority and overrides all others. inline that can override the defaults, and command line switches that has top
priority and overrides all others.
The `grin.toml` file can placed in one of several locations, using the first one it finds: The `grin.toml` file can placed in one of several locations, using the first one it finds:
@ -98,71 +102,9 @@ grin wallet help
grin client help grin client help
``` ```
# Using grin # Using grin
The wiki page [How to use grin](https://github.com/mimblewimble/docs/wiki/How-to-use-grin) The wiki page [How to use grin](https://github.com/mimblewimble/docs/wiki/How-to-use-grin)
and linked pages have more information on what features we have, and linked pages have more information on what features we have,
troubleshooting, etc. troubleshooting, etc.
## Basic usage
Running just `grin` with no command line switches starts `grin server` using defaults and any settings from `grin.toml` if found.
## Simulating: a chain and a few nodes
For a basic example, make a directory 'node1' and enter it.
We'll run a wallet listener and a server that creates a new local blockchain.
Copy over the grin.toml file from the grin folder and into your new node1 folder.
The miner needs a wallet to send mining rewards to, or else it can't mine.
So begin with the wallet listener in node1:
```
node1$ grin wallet init
node1$ grin wallet -p "password" listen
```
Also try `grin wallet help`.
The above created a wallet listener on the default port 13415,
using the wallet.seed and the password "password".
Now open another terminal window on the same machine.
Go to the 'node1' directory, and run a node that is mining:
```
node1$ grin server -m run
```
A new .grin folder is created, and starts filling up with new blocks having
just one coinbase transaction
Note that `server run` starts two services listening on two default ports:
- port 13414 for the peer-to-peer (P2P) service which keeps all nodes synchronized
- and 13413 for the Rest API service that can verify transactions and post new transactions to the pool.
The port numbers can be configured in grin.toml or on the command line, explained above.
Let the mining server find a few blocks, then stop (just ctrl-c) the mining server and the wallet server.
Now take a look in .grin. Here grin built the blockchain, peer data, and more.
You should also have a wallet.dat file which contains some coinbase mining rewards.
They are created each time the server starts on a new block.
If you have multiple miners active, you might see unused coinbase rewards,
and/or if your transaction gets orphaned, a similar situation can occur.
The not usable outputs are expected to be cleaned out over time, so it's ok
and nothing to worry about.
And if you see "slogger: dropped messages" in your mining node window it's
nothing to worry. It means your grin is so busy that it can't show on screen
(or in grin.log) all the details, unless you slow it down.
## Advanced Examples
See [usage](usage.md) and on the wiki
[How to use grin](https://github.com/mimblewimble/docs/wiki/How-to-use-grin).

View file

@ -1,6 +1,6 @@
[package] [package]
name = "grin_grin" name = "grin_grin"
version = "0.1.0" version = "0.2.0"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"] authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
workspace = ".." workspace = ".."
publish = false publish = false

View file

@ -189,28 +189,6 @@ impl LocalServerContainer {
seeds = vec![self.config.seed_addr.to_string()]; seeds = vec![self.config.seed_addr.to_string()];
} }
let s = grin::Server::new(grin::ServerConfig {
api_http_addr: api_addr,
db_root: format!("{}/.grin", self.working_dir),
p2p_config: p2p::P2PConfig {
port: self.config.p2p_server_port,
..p2p::P2PConfig::default()
},
seeds: Some(seeds),
seeding_type: seeding_type,
chain_type: core::global::ChainTypes::AutomatedTesting,
skip_sync_wait: Some(true),
..Default::default()
}).unwrap();
self.p2p_server_stats = Some(s.get_server_stats().unwrap());
if self.config.start_wallet == true {
self.run_wallet(duration_in_seconds + 5);
// give a second to start wallet before continuing
thread::sleep(time::Duration::from_millis(1000));
}
let mut plugin_config = pow::types::CuckooMinerPluginConfig::default(); let mut plugin_config = pow::types::CuckooMinerPluginConfig::default();
let mut plugin_config_vec: Vec<pow::types::CuckooMinerPluginConfig> = Vec::new(); let mut plugin_config_vec: Vec<pow::types::CuckooMinerPluginConfig> = Vec::new();
plugin_config.type_filter = String::from("mean_cpu"); plugin_config.type_filter = String::from("mean_cpu");
@ -227,6 +205,29 @@ impl LocalServerContainer {
..Default::default() ..Default::default()
}; };
let s = grin::Server::new(grin::ServerConfig {
api_http_addr: api_addr,
db_root: format!("{}/.grin", self.working_dir),
p2p_config: p2p::P2PConfig {
port: self.config.p2p_server_port,
..p2p::P2PConfig::default()
},
seeds: Some(seeds),
seeding_type: seeding_type,
chain_type: core::global::ChainTypes::AutomatedTesting,
skip_sync_wait: Some(true),
mining_config: Some(miner_config.clone()),
..Default::default()
}).unwrap();
self.p2p_server_stats = Some(s.get_server_stats().unwrap());
if self.config.start_wallet == true {
self.run_wallet(duration_in_seconds + 5);
// give a second to start wallet before continuing
thread::sleep(time::Duration::from_millis(1000));
}
if self.config.start_miner == true { if self.config.start_miner == true {
println!("starting Miner on port {}", self.config.p2p_server_port); println!("starting Miner on port {}", self.config.p2p_server_port);
s.start_miner(miner_config); s.start_miner(miner_config);

View file

@ -1,6 +1,6 @@
[package] [package]
name = "grin_keychain" name = "grin_keychain"
version = "0.1.0" version = "0.2.0"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"] authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
workspace = '..' workspace = '..'
publish = false publish = false

View file

@ -1,6 +1,6 @@
[package] [package]
name = "grin_p2p" name = "grin_p2p"
version = "0.1.0" version = "0.2.0"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"] authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
workspace = ".." workspace = ".."
publish = false publish = false

View file

@ -1,6 +1,6 @@
[package] [package]
name = "grin_pool" name = "grin_pool"
version = "0.1.0" version = "0.2.0"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"] authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
workspace = '..' workspace = '..'
publish = false publish = false

View file

@ -1,6 +1,6 @@
[package] [package]
name = "grin_pow" name = "grin_pow"
version = "0.1.0" version = "0.2.0"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"] authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
workspace = ".." workspace = ".."
publish = false publish = false

View file

@ -1,6 +1,6 @@
[package] [package]
name = "grin_store" name = "grin_store"
version = "0.1.0" version = "0.2.0"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"] authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
workspace = ".." workspace = ".."
publish = false publish = false

View file

@ -1,6 +1,6 @@
[package] [package]
name = "grin_util" name = "grin_util"
version = "0.1.0" version = "0.2.0"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"] authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
workspace = ".." workspace = ".."
publish = false publish = false

View file

@ -1,6 +1,6 @@
[package] [package]
name = "grin_wallet" name = "grin_wallet"
version = "0.1.0" version = "0.2.0"
authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"] authors = ["Grin Developers <mimblewimble@lists.launchpad.net>"]
workspace = '..' workspace = '..'
publish = false publish = false