Skip to content

Commit

Permalink
feat(@embark/dapps): Add blockchain config to simple template
Browse files Browse the repository at this point in the history
Add blockchain config to simple template, and supporting files (ie passwords, genesis) that aid in examples set forth in the blockchain config.
  • Loading branch information
emizzle authored and 0x-r4bbit committed Mar 23, 2020
1 parent a454ae8 commit 5fe318b
Show file tree
Hide file tree
Showing 9 changed files with 257 additions and 6 deletions.
79 changes: 79 additions & 0 deletions dapps/templates/simple/config/blockchain.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// This file contains only the basic configuration you need to run Embark's node
// For additional configurations, see: https://framework.embarklabs.io/docs/blockchain_configuration.html
module.exports = {
// default applies to all environments
default: {
enabled: true,
client: "geth" // Can be ganache-cli, geth or parity (default: geth)
},

development: {
client: 'ganache-cli',
clientConfig: {
miningMode: 'dev' // Mode in which the node mines. Options: dev, auto, always, off
}
},

privatenet: {
// Accounts to use as node accounts
// The order here corresponds to the order of `web3.eth.getAccounts`, so the first one is the `defaultAccount`
// For more account configurations, see: https://framework.embarklabs.io/docs/blockchain_accounts_configuration.html
accounts: [
{
nodeAccounts: true, // Accounts use for the node
numAddresses: "1", // Number of addresses/accounts (defaults to 1)
password: "config/development/password" // Password file for the accounts
}
],
clientConfig: {
datadir: ".embark/privatenet/datadir", // Data directory for the databases and keystore
miningMode: 'auto',
genesisBlock: "config/privatenet/genesis.json" // Genesis block to initiate on first creation of a development node
}
},

privateparitynet: {
client: "parity",
genesisBlock: "config/privatenet/genesis-parity.json",
datadir: ".embark/privatenet/datadir",
miningMode: 'off'
},

externalnode: {
endpoint: "URL_OF_THE_NODE", // Endpoint of an node to connect to. Can be on localhost or on the internet
accounts: [
{
mnemonic: "YOUR_MNEMONIC",
hdpath: "m/44'/60'/0'/0/",
numAddresses: "1"
}
]
},

testnet: {
networkType: "testnet", // Can be: testnet(ropsten), rinkeby, livenet or custom, in which case, it will use the specified networkId
syncMode: "light",
accounts: [
{
nodeAccounts: true,
password: "config/testnet/password"
}
]
},

livenet: {
networkType: "livenet",
syncMode: "light",
accounts: [
{
nodeAccounts: true,
password: "config/livenet/password"
}
]
}

// you can name an environment with specific settings and then specify with
// "embark run custom_name" or "embark blockchain custom_name"
//custom_name: {
//}
};
File renamed without changes.
1 change: 1 addition & 0 deletions dapps/templates/simple/config/development/password
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dev_password
147 changes: 147 additions & 0 deletions dapps/templates/simple/config/privatenet/genesis-parity.json

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions dapps/templates/simple/config/privatenet/genesis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"config": {
"homesteadBlock": 0,
"byzantiumBlock": 0,
"eip155Block": 0,
"eip158Block": 0,
"daoForkSupport": true
},
"nonce": "0x0000000000000042",
"difficulty": "0x0",
"alloc": {
"0x3333333333333333333333333333333333333333": {"balance": "15000000000000000000"}
},
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x3333333333333333333333333333333333333333",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x",
"gasLimit": "0x7a1200"
}
1 change: 1 addition & 0 deletions dapps/templates/simple/config/privatenet/password
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dev_password
1 change: 1 addition & 0 deletions dapps/templates/simple/config/testnet/password
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test_password
10 changes: 6 additions & 4 deletions dapps/templates/simple/embark.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"contracts": ["contracts/**"],
"contracts": [
"contracts/**"
],
"app": {},
"buildDir": "build/",
"config": {
"contracts": "contracts.js",
"blockchain": false,
"contracts": "config/contracts.js",
"blockchain": "config/blockchain.js",
"storage": false,
"communication": false,
"webserver": false
Expand All @@ -21,4 +23,4 @@
"optimize-runs": 200
}
}
}
}
4 changes: 2 additions & 2 deletions dapps/templates/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"homepage": "https://github.com/embarklabs/embark/tree/master/dapps/templates/simple#readme",
"bugs": "https://github.com/embarklabs/embark/issues",
"files": [
"config/*",
"contracts",
"contracts.js",
"dot.gitignore",
"dot.npmrc",
"embark.json",
Expand Down Expand Up @@ -36,4 +36,4 @@
"embarkjs-web3": "^5.3.0-nightly.11",
"rimraf": "3.0.0"
}
}
}

0 comments on commit 5fe318b

Please sign in to comment.