Monitor chatter on the Enigma network.
$ node main.js --help
Usage: node main.js [options]
Options:
--bootstrap: Comma separated list of bootstrap nodes libp2p multiaddr.
(default: [])
--enigma-contract-address: Ethereum address of the Enigma smart contract.
(default: null)
--enigma-contract-json-path: Path to the compiled JSON file of the Enigma smart contract.
(default: null)
--web3-provider: URL of the web3 provider.
(default: "ws://localhost:9545")
git clone --single-branch -b develop --depth 1 https://github.com/enigmampc/enigma-p2p.git /tmp/enigma-p2p
cd /tmp/enigma-p2p
npm install
cd test/ethereum/scripts
rm -rf build
npx truffle compile
npx truffle develop
This will print to the screen an accounts list. We'll chose one and call it $ETHEREUM_ACCOUNT
and chose another and call it $ETHEREUM_STAKING_ACCOUNT
.
This is so that our workers will have gas to make transactions on the Ethereum blockchain (E.g. registering as a worker, deploying secret contracts, etc.)
cd /tmp/enigma-p2p/test/ethereum/scripts
npx truffle migrate --reset 2>/dev/null | grep -A 4 "Replacing 'Enigma'" | grep 'contract address' | awk '{print $NF}'
This will deploy and print to the screen the Enigma contract address on the Ethereum blockchain.
Lets call it $ENIGMA_CONTRACT_ADDRESS
.
cd /tmp/enigma-p2p
node src/cli/cli_app.js -i B1 -p B1 --auto-init --mock-core --core 127.0.0.1:3456 --ethereum-address "$ETHEREUM_ACCOUNT" --staking-address "$ETHEREUM_STAKING_ACCOUNT" --ethereum-contract-address "$ENIGMA_CONTRACT_ADDRESS"
Note:
B1
is hard coded for debugging and testing purposes. It's libp2p ID isQmcrQZ6RJdpYuGvZqD5QEHAv6qX4BrQLJLQPQUrTrzdcgm
and it listens to porttcp/10300
.
Note:
To skip the next step we could also run the bootstrap node with
--lonely-node
, which'll make it register without waiting for another node in the network.
cd /tmp/enigma-p2p
node src/cli/cli_app.js -b "/ip4/127.0.0.1/tcp/10300/ipfs/QmcrQZ6RJdpYuGvZqD5QEHAv6qX4BrQLJLQPQUrTrzdcgm" --auto-init --mock-core --core 127.0.0.1:3456 --ethereum-address "$ETHEREUM_ACCOUNT" --staking-address "$ETHEREUM_STAKING_ACCOUNT" --ethereum-contract-address "$ENIGMA_CONTRACT_ADDRESS"
Note:
It's also possible to use
-b B1
instead of-b "/ip4/127.0.0.1/tcp/10300/ipfs/QmcrQZ6RJdpYuGvZqD5QEHAv6qX4BrQLJLQPQUrTrzdcgm"
.
Note:
To skip this step we could also run the bootstrap node with
--lonely-node
, which'll make it register without waiting for another node in the network.
git clone https://github.com/enigmampc/enigma-p2p-monitor.git /tmp/enigma-p2p-monitor
cd /tmp/enigma-p2p-monitor
yarn install
node main.js --bootstrap "/ip4/127.0.0.1/tcp/10300/ipfs/QmcrQZ6RJdpYuGvZqD5QEHAv6qX4BrQLJLQPQUrTrzdcgm" --enigma-contract-json-path "/tmp/enigma-p2p/test/ethereum/scripts/build/contracts/Enigma.json" --enigma-contract-address "$ENIGMA_CONTRACT_ADDRESS"
It'll now connect to the enigma-p2p
nodes.
broadcast banana
broadcast papaya
See https://github.com/enigmampc/docker-environment/blob/debug-docs/DEBUG.md#enigma-p2p-monitor