You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.4 KiB

6 years ago
  1. ## dvot-process http service
  2. #### start http server
  3. ```
  4. processHttp.T.Init()
  5. processHttp.Listen(1500, "http", "")
  6. ```
  7. To enable authentication (using pubKey signature):
  8. ```
  9. pubK := "39f54ce5293520b689f6658ea7f3401f4ff931fa3d90dea21ff901cdf82bb8aa"
  10. processHttp.Listen(1500, "http", pubK)
  11. ```
  12. #### add claims
  13. ```
  14. curl -d '{"censusID":"GoT_Favorite","claimData":"Jon Snow"}' http://localhost:1500/addClaim
  15. {"error":false,"response":""}
  16. ```
  17. ```
  18. curl -d '{"censusID":"GoT_Favorite",
  19. "claimData":"Jon Snow",
  20. "timeStamp":"1547814675",
  21. "signature":"a117c4ce12b29090884112ffe57e664f007e7ef142a1679996e2d34fd2b852fe76966e47932f1e9d3a54610d0f361383afe2d9aab096e15d136c236abb0a0d0e"}' http://localhost:1500/addClaim
  22. {"error":false,"response":""}
  23. ```
  24. The signature message is a concatenation of the following strings: `censusID, claimData, timeStamp`
  25. ```
  26. curl -d '{"censusID":"GoT_Favorite","claimData":"Tyrion"}' http://localhost:1500/addClaim
  27. {"error":false,"response":""}
  28. ```
  29. #### generate proof
  30. ```
  31. curl -d '{"censusID":"GoT_Favorite","claimData":"Jon Snow"}' http://localhost:1500/genProof
  32. {"error":false,"response":"0x000000000000000000000000000000000000000000000000000000000000000352f3ca2aaf635ec2ae4452f6a65be7bca72678287a8bb08ad4babfcccd76c2fef1aac7675261bf6d12c746fb7907beea6d1f1635af93ba931eec0c6a747ecc37"}
  33. ```
  34. #### check proof
  35. ```
  36. curl -d '{"censusID":"GoT_Favorite","claimData":"Jon Snow", "proofData": "0x0000000000000000000000000000000000000000000000000000000000000000000123"}' http://localhost:1500/checkProof
  37. {"error":false,"response":"invalid"}
  38. ```
  39. ```
  40. curl -d '{"censusID":"GoT_Favorite","claimData":"Jon Snow", "proofData": "0x000000000000000000000000000000000000000000000000000000000000000352f3ca2aaf635ec2ae4452f6a65be7bca72678287a8bb08ad4babfcccd76c2fef1aac7675261bf6d12c746fb7907beea6d1f1635af93ba931eec0c6a747ecc37"}' http://localhost:1500/checkProof
  41. {"error":false,"response":"valid"}
  42. ```
  43. #### make snapshot
  44. Snapshots are static and unmutable copies of a specific census
  45. ```
  46. curl -d '{"censusID":"GoT_Favorite"}' http://localhost:1500/snapshot
  47. {"error":false,"response":"snaphost.GoT_Favorite.1548169813"}
  48. ```
  49. The name for the snapshot is "snaphost.GoT_Favorite.1548169813"
  50. Now you can use it as censusID for checkProof, genProof and dump. But addClaim is not longer allowed.
  51. #### dump
  52. Dump contents of a specific censusID (values)
  53. ```
  54. curl -d '{"censusID":"GoT_Favorite"}' http://localhost:1500/dump
  55. {"error":false,"response":"[\"Tyrion\",\"Jon Snow\"]"}
  56. ```