Skip to content

Commit 29d25e3

Browse files
committed
Merge pull request #43 from jorisbontje/41-genesis-block-not-found
make genesis block configurable
2 parents f49968c + f1a0271 commit 29d25e3

File tree

12 files changed

+55
-9
lines changed

12 files changed

+55
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
22
TODO
3+
.node-xmlhttprequest-sync-*

boilerplate/config/blockchain.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ development:
33
rpc_port: 8101
44
rpc_whitelist: "*"
55
minerthreads: 1
6+
genesis_block: config/genesis.json
67
datadir: /tmp/embark
78
mine_when_needed: true
89
gas_limit: 500000
@@ -20,7 +21,7 @@ staging:
2021
console: true
2122
account:
2223
init: false
23-
address:
24+
address:
2425
production:
2526
rpc_host: localhost
2627
rpc_port: 8101
@@ -30,4 +31,4 @@ production:
3031
console: true
3132
account:
3233
init: false
33-
address:
34+
address:

boilerplate/config/genesis.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"nonce": "0x0000000000000042",
3+
"difficulty": "0x40000",
4+
"alloc": {
5+
},
6+
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
7+
"coinbase": "0x0000000000000000000000000000000000000000",
8+
"timestamp": "0x00",
9+
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
10+
"extraData": "0x",
11+
"gasLimit": "0x4c4b40"
12+
}

demo/config/blockchain.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ development:
33
rpc_port: 8101
44
rpc_whitelist: "*"
55
minerthreads: 1
6+
genesis_block: config/genesis.json
67
datadir: /tmp/embark
78
mine_when_needed: true
89
gas_limit: 500000
@@ -20,7 +21,7 @@ staging:
2021
console: true
2122
account:
2223
init: false
23-
address:
24+
address:
2425
production:
2526
rpc_host: localhost
2627
rpc_port: 8101
@@ -30,4 +31,4 @@ production:
3031
console: true
3132
account:
3233
init: false
33-
address:
34+
address:

demo/config/genesis.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"nonce": "0x0000000000000042",
3+
"difficulty": "0x40000",
4+
"alloc": {
5+
},
6+
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
7+
"coinbase": "0x0000000000000000000000000000000000000000",
8+
"timestamp": "0x00",
9+
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
10+
"extraData": "0x",
11+
"gasLimit": "0x4c4b40"
12+
}

demo_meteor/config/blockchain.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ development:
33
rpc_port: 8101
44
rpc_whitelist: "*"
55
minerthreads: 1
6+
genesis_block: config/genesis.json
67
datadir: /tmp/embark
78
mine_when_needed: true
89
gas_limit: 500000
@@ -20,4 +21,4 @@ staging:
2021
console: true
2122
account:
2223
init: false
23-
address:
24+
address:

demo_meteor/config/genesis.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"nonce": "0x0000000000000042",
3+
"difficulty": "0x40000",
4+
"alloc": {
5+
},
6+
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
7+
"coinbase": "0x0000000000000000000000000000000000000000",
8+
"timestamp": "0x00",
9+
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
10+
"extraData": "0x",
11+
"gasLimit": "0x4c4b40"
12+
}

lib/blockchain.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ Blockchain.prototype.generate_basic_command = function() {
2626
}
2727

2828
cmd += "--mine ";
29+
if (config.genesisBlock !== void 0) {
30+
cmd += "--genesis=\"" + config.genesisBlock + "\" ";
31+
}
2932

3033
//TODO: this should be configurable
3134
cmd += "--maxpeers 0 ";

lib/config/blockchain.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ BlockchainConfig.prototype.config = function(env) {
3838
gasPrice: config.gas_price || 10000000000000,
3939
rpcWhitelist: config.rpc_whitelist,
4040
minerthreads: config.minerthreads,
41+
genesisBlock: config.genesis_block,
4142
datadir: config.datadir,
4243
networkId: networkId,
4344
port: config.port || "30303",
@@ -50,4 +51,3 @@ BlockchainConfig.prototype.config = function(env) {
5051
};
5152

5253
module.exports = BlockchainConfig;
53-

test/blockchain.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('embark.blockchain', function() {
1010
var blockchain = new Blockchain(blockchainConfig);
1111

1212
it('should return correct cmd', function() {
13-
assert.strictEqual(blockchain.generate_basic_command(), "geth --datadir=\"/tmp/embark\" --logfile=\"/tmp/embark.log\" --port 30303 --rpc --rpcport 8101 --networkid "+blockchainConfig.networkId+" --rpccorsdomain \"*\" --minerthreads \"1\" --mine --maxpeers 0 --password config/password ");
13+
assert.strictEqual(blockchain.generate_basic_command(), "geth --datadir=\"/tmp/embark\" --logfile=\"/tmp/embark.log\" --port 30303 --rpc --rpcport 8101 --networkid "+blockchainConfig.networkId+" --rpccorsdomain \"*\" --minerthreads \"1\" --mine --genesis=\"config/genesis.json\" --maxpeers 0 --password config/password ");
1414
});
1515
});
1616

0 commit comments

Comments
 (0)