urbit / azimuth

General-purpose PKI on Ethereum
MIT License
134 stars 36 forks source link

Azimuth

Build Status MIT License npm

A general-purpose PKI, live on the Ethereum blockchain.

Overview

This is just a quick summary of the different contracts and their purposes. For more detailed descriptions, see the inline documentation in the contracts themselves.

Live contracts

The core Azimuth contracts can be found on the Ethereum blockchain.

Galactic Senate

A suggested process for publicizing the proposals voted on by the Galactic Senate is described in senate.md. Following that process, proposals that have been voted on and achieved majority can be found in proposals/.

Running

As a pre-requisite, truffle is required to be installed globally:

npm install -g truffle

Install dependencies. Most notable inclusion is Zeppelin-Solidity.

npm install

Build, deploy and test via Truffle using the following commands:

npx truffle compile
npx truffle deploy
npx truffle test

When verifying deployed contracts on services like Etherscan, be sure to use truffle-flattener for flattening contracts into single files.

Tests

To run the contract test suite automatically, use a simple:

npm test

This will spin up a local Ganache node in the background. If you'd like to use a persistent node, you can run

npx ganache-cli --gasLimit 6000000

and then test via npx truffle test.

For testing Ecliptic upgrades against whatever version of the contract is on mainnet, first run:

npm run fork-mainnet

This will start a local fork of mainnet, with the ownership addresses of the first 128 galaxies unlocked. Once that's ready, you can run the following in a separate terminal:

npm run test-upgrade
//  or, to upgrade to a pre-existing contract, specify its address:
npm run test-upgrade -- --target='0xabcd...'

This will deploy the Ecliptic contract currently in the repository to the local fork (or refer to the specified upgrade target), and test if it can be upgraded to cleanly. Because this involves many transactions (for voting), this may take a couple minutes.

There are also tests located in test-extras that are not meant to be run via a basic npx truffle test as they can fail nondeterministically. You can run these via:

npm run test-extras