|
| 1 | +# Packaging D-Voting in an installable .deb file |
| 2 | + |
| 3 | +## Requirements |
| 4 | + |
| 5 | +- gem |
| 6 | +- build-essential |
| 7 | +- git |
| 8 | +- fpm (`sudo gem install fpm`) |
| 9 | +- go (see https://go.dev/doc/install) |
| 10 | + |
| 11 | +```sh |
| 12 | +sudo apt install rubygems build-essential git |
| 13 | +``` |
| 14 | + |
| 15 | +## Get the code |
| 16 | + |
| 17 | +```sh |
| 18 | +git clone --branch packaging https://github.com/dedis/d-voting.git --recursive |
| 19 | +``` |
| 20 | + |
| 21 | +## Build the deb package |
| 22 | + |
| 23 | +from the root folder, use make: |
| 24 | + |
| 25 | +```sh |
| 26 | +make deb |
| 27 | +``` |
| 28 | + |
| 29 | +Make sure that a git tag exist, i.e `git describe` shows your tag. |
| 30 | + |
| 31 | +The resulting .deb can be found in the `dist/` folder. |
| 32 | + |
| 33 | +## Things to do after install |
| 34 | + |
| 35 | +### Network config |
| 36 | + |
| 37 | +Ensure that the public address is correct. For instance, in `network.env`, replace: |
| 38 | +```sh |
| 39 | +export dela_public="//localhost:9000" |
| 40 | +``` |
| 41 | +with the node's public address: |
| 42 | +```sh |
| 43 | +export dela_public="//172.16.253.150:9000" |
| 44 | +``` |
| 45 | + |
| 46 | +### Leader's node |
| 47 | + |
| 48 | +Get the token and certificate (24h * 30 = 720): |
| 49 | + |
| 50 | +```sh |
| 51 | +sudo memcoin --config /var/opt/dedis/dvoting/data/dela minogrpc token \ |
| 52 | + --expiration 720h |
| 53 | +``` |
| 54 | + |
| 55 | +This result, which looks like as follow, will be given to node's operators: |
| 56 | + |
| 57 | +``` |
| 58 | +--token b6VhdQEPXKOtZHpng8E8jw== --cert-hash oNeyrA864P2cP+TT6IE6GvkeEI/Ec4rOlZWEWiQkQKk= |
| 59 | +``` |
| 60 | + |
| 61 | +### Participants (node's operators) |
| 62 | + |
| 63 | +Join the network. This operation will make the node share its certificate to the |
| 64 | +MASTER node, which, in turn, will share its known certificates to the node. Note |
| 65 | +that the certificates are stored in the DB, which means that this operation must |
| 66 | +be re-done in case the DB is reset. |
| 67 | + |
| 68 | +```sh |
| 69 | +sudo memcoin --config /var/opt/dedis/dvoting/data/dela minogrpc join \ |
| 70 | + --address <MASTER NODE ADDRESS> --token <TOKEN> --cert-hash <CERT HASH> |
| 71 | +``` |
| 72 | + |
| 73 | +Example of `<MASTER NODE ADDRESS>`: `'//172.16.253.150:9000'` |
| 74 | + |
| 75 | +Get the node's address and public key: |
| 76 | + |
| 77 | +```sh |
| 78 | +sudo memcoin --config /var/opt/dedis/dvoting/data/dela ordering export |
| 79 | +``` |
| 80 | + |
| 81 | +This will yield a base64 encoded string `<ADDRESS>:<PUB KEY>`. |
| 82 | + |
| 83 | +It will have to be provided to EPFL. |
| 84 | + |
| 85 | +## Setup the chain, from EPFL |
| 86 | + |
| 87 | +**1: Create the chain**: |
| 88 | + |
| 89 | +Do not forget to include ourself, the EPFL node! |
| 90 | + |
| 91 | +```sh |
| 92 | +sudo memcoin --config /var/opt/dedis/dvoting/data/dela ordering setup \ |
| 93 | + --member <RESULT FROM ordering export>\ |
| 94 | + --member <...> |
| 95 | + ... |
| 96 | +``` |
| 97 | + |
| 98 | +**2: grant access for each node to sign transactions on the evoting smart contract**: |
| 99 | + |
| 100 | +```sh |
| 101 | +PK=<> # taken from the "ordering export", the part after ":" |
| 102 | +sudo memcoin --config /var/opt/dedis/dvoting/data/dela pool add \ |
| 103 | + --key /home/user/master.key \ |
| 104 | + --args go.dedis.ch/dela.ContractArg --args go.dedis.ch/dela.Access \ |
| 105 | + --args access:grant_id --args 0300000000000000000000000000000000000000000000000000000000000000 \ |
| 106 | + --args access:grant_contract --args go.dedis.ch/dela.Evoting \ |
| 107 | + --args access:grant_command --args all \ |
| 108 | + --args access:identity --args $PK \ |
| 109 | + --args access:command --args GRANT |
| 110 | +``` |
| 111 | + |
| 112 | +You should also grant access to the master key. |
| 113 | + |
| 114 | +### Test |
| 115 | + |
| 116 | +```sh |
| 117 | +sudo memcoin --config /var/opt/dedis/dvoting/data/dela e-voting scenarioTest \ |
| 118 | + --proxy-addr1 "http://192.168.232.133:9080" \ |
| 119 | + --proxy-addr2 "http://192.168.232.134:9080" \ |
| 120 | + --proxy-addr3 "http://192.168.232.135:9080" |
| 121 | +``` |
0 commit comments