This commit is contained in:
Simon
2017-10-16 17:37:24 -07:00
parent ac5b16d5be
commit 5c4f3d50a4
13 changed files with 528 additions and 9 deletions

View File

@@ -1,3 +1,18 @@
# ZSL on Quorum Example
This repository contains a modified 7nodes example to demonstrate [ZSL on Quroum](https://github.com/jpmorganchase/zsl-q/blob/master/README.md)
The following changes have been made:
* ZSL precompiles added to `genesis.json` between address 0x8801 - 0x8804
* Node 2 is unlocked in `raft-start.sh`
* Symbolic links added for accessing ZSL parameters (proving and verification keys) when the example is run inside Vagrant. These symbolic links can be replaced with actual parameter files if running from the local host machine, and not inside Vagrant.
* New file `tracker.js` contains note tracking and other helper functions.
There are examples of using ZSL on 7nodes documented in [ZSL on Quorum](https://github.com/jpmorganchase/zsl-q/tree/master/README.md)
Original README follows.
# Quorum Examples
This repository contains setup examples for Quorum.

2
Vagrantfile vendored
View File

@@ -9,6 +9,6 @@ Vagrant.configure(2) do |config|
config.vm.network "forwarded_port", guest: 22005, host: 22005
config.vm.network "forwarded_port", guest: 22006, host: 22006
config.vm.provider "virtualbox" do |v|
v.memory = 4096
v.memory = 16384
end
end

View File

@@ -1,5 +1,21 @@
{
"alloc": {
"0x0000000000000000000000000000000000008801": {
"balance": "1000000000000000000000000000",
"code": "0x00"
},
"0x0000000000000000000000000000000000008802": {
"balance": "1000000000000000000000000000",
"code": "0x00"
},
"0x0000000000000000000000000000000000008803": {
"balance": "1000000000000000000000000000",
"code": "0x00"
},
"0x0000000000000000000000000000000000008804": {
"balance": "1000000000000000000000000000",
"code": "0x00"
},
"0x0000000000000000000000000000000000000020": {
"code": "0x606060405236156100c45760e060020a60003504631290948581146100c9578063284d163c146100f957806342169e4814610130578063488099a6146101395780634fe437d514610154578063559c390c1461015d57806368bb8bb61461025d57806372a571fc146102c857806386c1ff681461036957806398ba676d146103a0578063a7771ee31461040b578063adfaa72e14610433578063cf5289851461044e578063de8fa43114610457578063e814d1c71461046d578063f4ab9adf14610494575b610002565b610548600435600160a060020a03331660009081526003602052604090205460ff16156100c45760018190555b50565b610548600435600160a060020a03331660009081526005602052604090205460ff16156100c4576004546001141561055e57610002565b61045b60025481565b61054a60043560056020526000908152604090205460ff1681565b61045b60015481565b61045b60043560006000600060006000600050600186038154811015610002579080526002027f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5630192505b60018301548110156105d75760018301805484916000918490811015610002576000918252602080832090910154835282810193909352604091820181205485825292869052205410801561023257506001805490840180548591600091859081101561000257906000526020600020900160005054815260208101919091526040016000205410155b156102555760018301805482908110156100025760009182526020909120015491505b6001016101a8565b610548600435602435600160a060020a03331660009081526003602052604081205460ff16156100c4578054839010156105e45780548084038101808355908290829080158290116105df576002028160020283600052602060002091820191016105df919061066b565b610548600435600160a060020a03331660009081526005602052604090205460ff16156100c457600160a060020a0381166000908152604090205460ff1615156100f65760406000819020805460ff191660019081179091556004805490910190558051600160a060020a038316815290517f1a4ce6942f7aa91856332e618fc90159f13a340611a308f5d7327ba0707e56859181900360200190a16100f6565b610548600435600160a060020a03331660009081526003602052604090205460ff16156100c4576002546001141561071457610002565b61045b600435602435600060006000600050600185038154811015610002579080526002027f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5630181509050806001016000508381548110156100025750825250602090200154919050565b61054a600435600160a060020a03811660009081526003602052604090205460ff165b919050565b61054a60043560036020526000908152604090205460ff1681565b61045b60045481565b6000545b60408051918252519081900360200190f35b61054a600435600160a060020a03811660009081526005602052604090205460ff1661042e565b610548600435600160a060020a03331660009081526003602052604090205460ff16156100c457600160a060020a03811660009081526003602052604090205460ff1615156100f65760406000818120600160a060020a0384169182905260036020908152815460ff1916600190811790925560028054909201909155825191825291517f0ad2eca75347acd5160276fe4b5dad46987e4ff4af9e574195e3e9bc15d7e0ff929181900390910190a16100f6565b005b604080519115158252519081900360200190f35b600160a060020a03811660009081526005602052604090205460ff16156100f65760406000819020805460ff19169055600480546000190190558051600160a060020a038316815290517f8cee3054364d6799f1c8962580ad61273d9d38ca1ff26516bd1ad23c099a60229181900360200190a16100f6565b509392505050565b505050505b60008054600019850190811015610002578382526002027f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563016020819052604082205490925014156106b8578060010160005080548060010182818154818355818115116106a5578183600052602060002091820191016106a5919061068d565b50506002015b808211156106a157600181018054600080835591825260208220610665918101905b808211156106a1576000815560010161068d565b5090565b5050506000928352506020909120018290555b600082815260208281526040918290208054600101905581514381529081018490528151600160a060020a033316927f3d03ba7f4b5227cdb385f2610906e5bcee147171603ec40005b30915ad20e258928290030190a2505050565b600160a060020a03811660009081526003602052604090205460ff16156100f65760406000819020805460ff19169055600280546000190190558051600160a060020a038316815290517f183393fc5cffbfc7d03d623966b85f76b9430f42d3aada2ac3f3deabc78899e89181900360200190a16100f656",
"storage": {

View File

@@ -20,7 +20,7 @@ echo "[*] Starting node 1"
PRIVATE_CONFIG=tm1.conf nohup geth --datadir qdata/dd1 $GLOBAL_ARGS --raftport 50401 --rpcport 22000 --port 21000 --unlock 0 --password passwords.txt 2>>qdata/logs/1.log &
echo "[*] Starting node 2"
PRIVATE_CONFIG=tm2.conf nohup geth --datadir qdata/dd2 $GLOBAL_ARGS --raftport 50402 --rpcport 22001 --port 21001 2>>qdata/logs/2.log &
PRIVATE_CONFIG=tm2.conf nohup geth --datadir qdata/dd2 $GLOBAL_ARGS --raftport 50402 --rpcport 22001 --port 21001 --unlock 0 --password passwords.txt 2>>qdata/logs/2.log &
echo "[*] Starting node 3"
PRIVATE_CONFIG=tm3.conf nohup geth --datadir qdata/dd3 $GLOBAL_ARGS --raftport 50403 --rpcport 22002 --port 21002 2>>qdata/logs/3.log &

View File

@@ -0,0 +1 @@
/vagrant/shielding.pk

View File

@@ -0,0 +1 @@
/vagrant/shielding.vk

1
examples/7nodes/transfer.pk Symbolic link
View File

@@ -0,0 +1 @@
/vagrant/transfer.pk

1
examples/7nodes/transfer.vk Symbolic link
View File

@@ -0,0 +1 @@
/vagrant/transfer.vk

View File

@@ -0,0 +1 @@
/vagrant/unshielding.pk

View File

@@ -0,0 +1 @@
/vagrant/unshielding.vk

5
examples/7nodes/zdemo.js Normal file
View File

@@ -0,0 +1,5 @@
var alice = "0xed9d02e382b34818e88b88a309c7fe71e65f419d";
var bob = "0xca843569e3427144cead5e4d5999a3d0ccf92b8e";
var alice_constellation = "BULeR8JyUWhiuuCMU/HLA0Q5pzkYT+cHII3ZKBey3Bo=";
var bob_constellation = "QfeDAys9MPDs2XHExtc84jKGHxZg/aj52DTh0vtA3Xc=";
loadScript("ztracker.js");

466
examples/7nodes/ztracker.js Normal file

File diff suppressed because one or more lines are too long

View File

@@ -23,14 +23,25 @@ rm -f $GOREL
PATH=$PATH:/usr/local/go/bin
echo 'PATH=$PATH:/usr/local/go/bin' >> /home/ubuntu/.bashrc
# ZSL START
# During the development phase, there is no public access to the repository
# so we compile geth and bootnode locally and place them in the /vagrant
# shared folder which the VM can access.
# make/install quorum
git clone https://github.com/getamis/quorum.git
pushd quorum >/dev/null
git checkout feature/istanbul
make all
cp build/bin/geth /usr/local/bin
cp build/bin/bootnode /usr/local/bin
popd >/dev/null
# git clone https://github.com/getamis/quorum.git
# pushd quorum >/dev/null
# git checkout feature/istanbul
# make all
# cp build/bin/geth /usr/local/bin
# cp build/bin/bootnode /usr/local/bin
# popd >/dev/null
echo 'Copying geth and bootnode from /vagrant/zsl-tmp into the VM /usr/local/bin'
cp /vagrant/zsl-tmp/geth /usr/local/bin
cp /vagrant/zsl-tmp/bootnode /usr/local/bin
mkdir /home/ubuntu/quorum
#ZSL END
# install Porosity
wget -q https://github.com/jpmorganchase/quorum/releases/download/v1.2.0/porosity