Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

Commit

Permalink
Update README (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
macfarla authored and lucassaldanha committed Apr 23, 2019
1 parent afb5e72 commit 916d6e7
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,14 @@
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.
- `INGRESS_CONTRACT_ADDRESS` "0x0000000000000000000000000000000000009999" - must match what is in the genesis file
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
1. add .env file with the address of the ingress contract (so that the Truffle migration scripts know where to find it)
```
INGRESS_CONTRACT_ADDRESS="0x0000000000000000000000000000000000009999"
```
1. Run `truffle migrate`

After this step, you should have your Rules contract deployed on the network. This will also update the Ingress contract with the name and version of the Rules contract.
After this step, you should have your Rules and Admin contracts deployed on the network. This will also update the Ingress contract with the name and version of the Rules and Admin contracts.

## Add and Remove Enodes to the whitelist
1. Run `truffle console`
Expand Down Expand Up @@ -58,22 +55,31 @@ 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.

**View the whitelist**
```
Rules.deployed().then(function(instance) {instance.getSize().then(function(txCount) {console.log("size of whitelist: " + txCount); var i=txCount; while(i>=0) {instance.getByIndex(i--).then(function(tx) {console.log(tx)})}});});
```

## Add and Remove Admin accounts

When you first deploy the Rules smart contract, the account used to deploy it will automatically be set as an Admin. Only Admin accounts can add or remove nodes from the whitelist.
When you first deploy the Rules and Admin smart contracts, the account used to deploy them will automatically be set as an Admin. Only Admin accounts can add or remove nodes from the whitelist.

If you want to add or remove accounts as Admins, use the following commands in `truffle console`:

**Add account `0x627306090abaB3A6e1400e9345bC60c78a8BEf57` to Admin list**
```
Rules.deployed().then(function(instance) {instance.addAdmin("0x627306090abaB3A6e1400e9345bC60c78a8BEf57").then(function(tx) {console.log(tx)});});
Admin.deployed().then(function(instance) {instance.addAdmin("0x627306090abaB3A6e1400e9345bC60c78a8BEf57").then(function(tx) {console.log(tx)});});
```

**Remove acccount `0x627306090abaB3A6e1400e9345bC60c78a8BEf57` from Admin list**
```
Rules.deployed().then(function(instance) {instance.removeAdmin("0x627306090abaB3A6e1400e9345bC60c78a8BEf57").then(function(tx) {console.log(tx)});});
Admin.deployed().then(function(instance) {instance.removeAdmin("0x627306090abaB3A6e1400e9345bC60c78a8BEf57").then(function(tx) {console.log(tx)});});
```

**View Admin list**
```
Admin.deployed().then(function(instance) {instance.getAdmins().then(function(tx) {console.log(tx)});});
```
## Development

### Linting
Expand Down

0 comments on commit 916d6e7

Please sign in to comment.