Sally MacFarlane
5c2498ea6b
|
5 years ago | |
---|---|---|
contracts | 5 years ago | |
docker | 5 years ago | |
migrations | 5 years ago | |
public | 5 years ago | |
scripts | 5 years ago | |
src | 5 years ago | |
test | 5 years ago | |
.dockerignore | 5 years ago | |
.editorconfig | 5 years ago | |
.gitignore | 5 years ago | |
.prettierignore | 5 years ago | |
.solcover.js | 5 years ago | |
.soliumignore | 6 years ago | |
.soliumrc.json | 6 years ago | |
.yarnrc | 5 years ago | |
CLA.md | 6 years ago | |
CODE-OF-CONDUCT.md | 6 years ago | |
CONTRIBUTING.md | 6 years ago | |
GOVERNANCE.md | 6 years ago | |
Jenkinsfile | 5 years ago | |
Jenkinsfile.release | 5 years ago | |
LICENSE | 6 years ago | |
README.md | 5 years ago | |
genesis.json | 5 years ago | |
jest.config.js | 5 years ago | |
mocha-reporter-config.json | 6 years ago | |
package.json | 5 years ago | |
truffle-box.json | 6 years ago | |
truffle-config.js | 5 years ago | |
tsconfig.json | 5 years ago | |
yarn.lock | 5 years ago |
README.md
Permissioning Smart Contracts
Note: The contracts in this repository are currently in the process of going through a third party audit. Please contact us before using in a production environment.
Using
The Pantheon documentation describes how to use the contracts for onchain permissioning.
Development
Note: The build process for the Dapp is currently not supported on Windows. Please use the provided distribution available at projects release page if on Windows.
Initialise dependencies
Run yarn install
to initialise project dependencies. This step is only required when setting up project
for the first time.
Linting
Linting is set up using solium. To run it over your code execute yarn run lint
.
Testing
yarn test
Permissioning Management Dapp
The Dapp will facilitate managing permissioning rules and maintaining the list of admin accounts that can edit rules.
This is the easiest way to get started for development with the permissioning Dapp:
Compile and migrate the contracts
- Get rid of your environment variables named
NODE_INGRESS_CONTRACT_ADDRESS
andACCOUNT_INGRESS_CONTRACT_ADDRESS
- you might need to restart your terminal session after removing it to have your changes applied. If you are using a.env
file, you can comment out the variables. - Start a terminal session and start a truffle Ganache node running
truffle develop
. This will start a Ganache node and create a truffle console session. - In the truffle console, run all migrations from scratch with
migrate --reset
. Keep this terminal session open to maintain your Ganache node running.
Start the development server
- Run
yarn run build
to build the Dapp. - Run
yarn run start
to start the web server that is serving our Dapp. - In your browser, connect Metamask to the Ganache network (the default endpoint is
http://127.0.0.1:9545/
) - When you start Ganache, it gives you a list of accounts and private keys. Import the first one in Metamask to impersonate the first admin of the system.
- Navigate to
http://localhost:3000
to access the Permissioning Dapp. - All changes made to the smart contracts or to the Dapp code are automatically refreshed on the website. There is no need to restart the web server after making changes.
Build the permissioning Dapp for deployment
- Compile and migrate the contracts
- Run
yarn run build
will assemble index.html and all other files inbuild/
- You can use your preferred web server technology to serve the contents of
build/
as static files. - You will need to set up MetaMask as for the development server
Deployment
The deployment process covers 3 steps:
- Starting a Pantheon node with the required configurations.
- Migrating the contracts provided in this repository to the running chain.
- Running the Dapp on a webserver.
Starting a Pantheon node
- Have a Pantheon node running a chain that has the Node Ingress and Account Ingress contracts in its genesis accounts as shown in the alloc block of the example genesis file
Deploying the contracts
- Configure environment variables or provide a .env file in the root of this project that configures the following variables
NODE_INGRESS_CONTRACT_ADDRESS
: The address of the node ingress contract from the genesis accountsACCOUNT_INGRESS_CONTRACT_ADDRESS
: The address of the account ingress contract from the genesis accountsPANTHEON_NODE_PERM_ACCOUNT
: The address of the account that will be used to deploy the contractsPANTHEON_NODE_PERM_KEY
: The private key associated with the deploying account's addressPANTHEON_NODE_PERM_ENDPOINT
: The json rpc url endpoint that can be used to communicate with your Pantheon node
- If this is the first time setting up the project, run
yarn install
to initialise project dependencies, otherwise skip this step. - With these environment variables provided run
truffle migrate --reset
to deploy the contracts
Deploying the Dapp
- Obtain the most recent release (tarball or zip) from the projects release page
- Unpack the distribution into a folder that will be available to your webserver
- Add to the root of that folder a file
config.json
with the following contents
Note: The networkID
is defined as the chainID
in the genesis file.
{
"accountIngressAddress": "<Address of the account ingress contract>",
"nodeIngressAddress": "<Address of the node ingress contract>",
"networkId": "<ID of your ethereum network>"
}
- Use a webserver of your choice to host the contents of the folder as static files directing root requests to
index.html