go-dvote/service/README.md
service/README.mdRaw
1## dvot-process http service
2
3#### start http server
4
5```
6processHttp.T.Init()
7processHttp.Listen(1500, "http", "")
8```
9
10To enable authentication (using pubKey signature):
11
12```
13pubK := "39f54ce5293520b689f6658ea7f3401f4ff931fa3d90dea21ff901cdf82bb8aa"
14processHttp.Listen(1500, "http", pubK)
15```
16
17
18#### add claims
19
20```
21curl -d '{"censusID":"GoT_Favorite","claimData":"Jon Snow"}' http://localhost:1500/addClaim
22{"error":false,"response":""}
23```
24
25```
26curl -d '{"censusID":"GoT_Favorite",
27"claimData":"Jon Snow",
28"timeStamp":"1547814675",
29"signature":"a117c4ce12b29090884112ffe57e664f007e7ef142a1679996e2d34fd2b852fe76966e47932f1e9d3a54610d0f361383afe2d9aab096e15d136c236abb0a0d0e"}' http://localhost:1500/addClaim
30{"error":false,"response":""}
31```
32
33The signature message is a concatenation of the following strings: `censusID, claimData, timeStamp`
34
35```
36curl -d '{"censusID":"GoT_Favorite","claimData":"Tyrion"}' http://localhost:1500/addClaim
37{"error":false,"response":""}
38```
39
40#### generate proof
41
42```
43curl -d '{"censusID":"GoT_Favorite","claimData":"Jon Snow"}' http://localhost:1500/genProof
44{"error":false,"response":"0x000000000000000000000000000000000000000000000000000000000000000352f3ca2aaf635ec2ae4452f6a65be7bca72678287a8bb08ad4babfcccd76c2fef1aac7675261bf6d12c746fb7907beea6d1f1635af93ba931eec0c6a747ecc37"}
45```
46
47#### check proof
48
49```
50curl -d '{"censusID":"GoT_Favorite","claimData":"Jon Snow", "proofData": "0x0000000000000000000000000000000000000000000000000000000000000000000123"}' http://localhost:1500/checkProof
51{"error":false,"response":"invalid"}
52```
53
54```
55curl -d '{"censusID":"GoT_Favorite","claimData":"Jon Snow", "proofData": "0x000000000000000000000000000000000000000000000000000000000000000352f3ca2aaf635ec2ae4452f6a65be7bca72678287a8bb08ad4babfcccd76c2fef1aac7675261bf6d12c746fb7907beea6d1f1635af93ba931eec0c6a747ecc37"}' http://localhost:1500/checkProof
56{"error":false,"response":"valid"}
57```