Skip to content

Commit

Permalink
PAN-2533: Updated docs with environment variable reading (Consensys#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucassaldanha authored Apr 9, 2019
1 parent 608424e commit f5dd954
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
## Initial setup
1. Run `npm install`.
1. Open `truffle-config.js`.
1. Update `address` and `privateKey` variable to match your account and the corresponding private key.
1. If your node is not using the default JSON-RPC host and port, update line 12 (`http://127.0.0.1:8545`) to match your node configuration.
1. Create the following environment variables:
- `PANTHEON_NODE_PERM_ACCOUNT` - Set the value to the adress of the account used to interact with the permissioning contracts.
- `PANTHEON_NODE_PERM_KEY` - Set the value to the private key associated with the account.
1. If your node is not using the default JSON-RPC host and port (`http://127.0.0.1:8545`), create a environment variable named `PANTHEON_NODE_PERM_ENDPOINT` and set its value to match your node endpoint.


## How to deploy and setup contracts
Expand Down Expand Up @@ -50,4 +52,4 @@ truffle(development)> { tx: '0xaecbc376089d8eba7154f93d08c6be3bdf7fa13bfe2d8dbdf
undefined
```

After this step, you should have the enode added to your whitelist. Please repeat this step for each enode that you want to add to the whitelist.
After this step, you should have the enode added to your whitelist. Please repeat this step for each enode that you want to add to the whitelist.
15 changes: 12 additions & 3 deletions truffle-config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
const HDWalletProvider = require('truffle-hdwallet-provider');
const dotenv = require('dotenv');

dotenv.config();

/* The adress used when sending transactions to the node */
var address = "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73";
var address = process.env.PANTHEON_NODE_PERM_ACCOUNT;

/* The private key associated with the address above */
var privateKey = "8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63";
var privateKey = process.env.PANTHEON_NODE_PERM_KEY;

/* The endpoint of the Ethereum node */
var endpoint = process.env.PANTHEON_NODE_PERM_ENDPOINT;
if (endpoint === undefined) {
endpoint = "http://127.0.0.1:8545";
}

module.exports = {
networks: {
development: {
provider: () => new HDWalletProvider(privateKey, "http://127.0.0.1:8545"),
provider: () => new HDWalletProvider(privateKey, endpoint),
host: "127.0.0.1",
port: 8545,
network_id: "*",
Expand Down

0 comments on commit f5dd954

Please sign in to comment.