@enigmampc/discovery-cli v0.1.9
discovery-cli
Command Line Interface (CLI) for the Discovery Enigma Protocol developer testnet.
Requirements
- Docker
- Docker Compose version 1.23.2 or higher. Please be aware that docker-compose introduced a bug in 1.23.0 (also present in 1.23.1) that appended random strings to container names that causes this network configuration to break.
- Git
- Node.js (version 10 or higher):
nodeandnpm - Rust:
rustup,rustcandcargo
Installation
discovery-cli should be installed as a global package:
npm install -g @enigmampc/discovery-cliFor detailed instructions on how to install all the required dependencies, see the Installation instructions
Usage
$ discovery <command>
Commands:
discovery init Initialize Enigma Discovery development environment
discovery compile Compile Secret Contracts and Smart Contracts
discovery migrate Migrate Secret Contracts and Smart Contracts
discovery pull Pull the latest images for the containers in the network
discovery start Launch the Discovery Docker network
discovery stop Stop the network by stopping and removing all containers
discovery test Test Secret Contracts and Smart Contracts
Options:
--help Show help [boolean]
--version Show version number [boolean]Advanced Usage
By default discovery-cli will run a docker network with one worker. As of version 0.1.0, if you want to have more than 1 worker node in the network, you can specify the environment variable NODES to specify any number of nodes between 1 and 9. For example, to have 3 worker nodes, we would run:
NODES=3 discovery startNOTE: In order for the network to operate robustly with more than one node, you have to edit your .env file and change the following line (until we merge the changes in develop to stable in the docker images, at which point we will remove this notice)
DOCKER_TAG=developAs of version 0.1.6, the initialization of discovery init can be automated to bypass user input on the terminal, by adding the following optional parameters:
discovery init -y --mode=hw|sw
where --mode takes either hw for hardware mode or sw for software mode.
Uninstall
npm remove -g @enigmampc/discovery-cliHow it works
This repo provides an intuitive and user-friendly interface for dApp developers of secret contracts. It uses an analogous workflow and functionality to Truffle Suite. In fact, it builds on truffle packages and adapts the existing workflow to incorporate the functionality needed to compile, migrate and test secret contracts when having a running instance of the Enigma network.
For a detailed walkthrough guide on how to use this repo following a step-by-step example, refer to Getting Started with Enigma: An Intro to Secret Contracts.
What follows is more geared to advanced users that want to understand what happens under the hood:
discovery initcalls init() to initialize the folder structure and download the required files for any given project. Specifically:- Checks that the following list of dependecies exist in the system.
- Creates the following directory structure:
{your_project_folder} | ├-- build | ├-- enigma_contracts | └-- secret_contracts ├-- client ├-- migrations ├-- smart_contracts ├-- secret_contracts | └-- sample_contract └-- test - Downloads the required files populating the above folder structure
- Asks the user whether to run in SGX Hardware or Software mode, and configures it accordingly
- Pulls the required docker images from enigmampc Docker Hub
discovery startlaunches a dockerized version of the Discovery release of the Enigma network. This is the analogous command totruffle developorganache-cli. It is a more streamlined version of the discovery-docker-network configured through either one of the followingdocker-compose.ymlfiles: hardware version, software version. It exposes these two ports to the host:9545(Ganache/Truffle) and3333(Peer-to-Peer/Nginx proxy: the client entry point to the P2P network). Make sure that these two ports are free and available on the host. Having this command running is a prerequisite to runningdiscovery compile,discovery migrateanddiscovery test.discovery stopis the countercommand todiscovery startto properly shut down the network. It is automatically called before starting the network to ensure that it starts from a blank state every time.discovery pullpulls the latest docker images for the network. It's a shortcut fordocker-compose pulldiscovery compilecalls deps/compile which in turn calls firsttruffle compileand then executes Rustcargoto compile all secret contract to their WebAssembly format. Puts both sets of contracts under their respective subfolders under thebuildfolder.discovery migrateruns the migrations in themigrationsfolder. Specifically, the 2_deploy_contracts.js file is a customized migration Javascript file that migrates both the Smart Contracts and Secret Contracts, following the Truffle specs.discovery testrun the tests in thetestfolder. Similarly as above, test_simple_addition.js is a customized Javascript test file that tests the samplesimple_additioncontract provided in this repo, following the Truffle specs.
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago