github.com/decred/politeia@v1.4.0/politeiad/cmd/politeia/README.md (about) 1 # politeia refclient examples 2 3 ``` 4 Available commands: 5 identity Get server identity 6 new Submit new record 7 Args: [metadata:<id>:metadataJSON]... <filepaths>... 8 verify Verify record was accepted 9 Args: <serverkey> <token> <signature> <filepaths>... 10 edit Edit record 11 Args: [actionMetadata:<id>:metadataJSON]... 12 <actionfile:filename>... token:<token> 13 editmetadata Edit record metdata 14 Args: [actionMetadata:<id>:metadataJSON]... token:<token> 15 setstatus Set record status 16 Args: <token> <status> 17 record Get a record 18 Args: <token> 19 inventory Get the record inventory 20 Args (optional): <state> <status> <page> 21 ``` 22 23 ## Obtain politeiad identity 24 25 The politeiad identity contains the public key that is used to verify replies 26 from politeiad. 27 28 ``` 29 $ politeia -v -testnet -rpchost 127.0.0.1 -rpcuser=user -rpcpass=pass identity 30 31 Key : e88df79a4b02699e6c051adbae05f21f2a2f24942e0f27cade165548ec3d6387 32 Fingerprint: 6I33mksCaZ5sBRrbrgXyHyovJJQuDyfK3hZVSOw9Y4c= 33 34 Save to /home/user/.politeia/identity.json or ctrl-c to abort 35 Identity saved to: /home/user/.politeia/identity.json 36 ``` 37 38 ## Submit a new record 39 40 Args: `[metadata:<id>:metadataJSON]... <filepaths>...` 41 42 At least one file must be submitted. This example uses an `index.md` file. 43 44 Metadata is submitted as JSON and must be identified by a `pluginID` string and 45 a `streamID` uint32. Metadata is passed in as an argument by prefixing the JSON 46 with `metadata:[pluginID][streamID]:`. Below is an example metadata argument 47 where the plugin ID is `testid` and the stream ID is `1`. 48 49 `metadata:testid1:{"foo":"bar"}` 50 51 ``` 52 $ politeia -v -testnet -rpchost 127.0.0.1 -rpcuser=user -rpcpass=pass new \ 53 'metadata:testid1:{"moo":"lala"}' 'metadata:testid12:{"foo":"bar"}' index.md 54 55 Record submitted: 56 Status : unreviewed 57 Timestamp : 2021-03-25 16:36:40 +0000 UTC 58 Version : 1 59 Censorship record: 60 Merkle : 2d00aaa0768701fd011943fbe8ae92f84ee268ca134d6b14f877c3153072bb3c 61 Token : 39868e5e91c78255 62 Signature: b2a69823f85b62941d845c439726a2504026a0d29fd50ecabe5648b0128328c2fade0ddb354594d48a209dff24e73795ec9cb175d028155cbfa1901114f4b608 63 File (00) : 64 Name : index.md 65 MIME : text/plain; charset=utf-8 66 Digest : 2d00aaa0768701fd011943fbe8ae92f84ee268ca134d6b14f877c3153072bb3c 67 Metadata stream testid 01: 68 {"moo":"lala"} 69 Metadata stream testid 12: 70 {"foo":"bar"} 71 Server public key: e88df79a4b02699e6c051adbae05f21f2a2f24942e0f27cade165548ec3d6387 72 ``` 73 74 ## Verify record 75 76 Args: `<serverKey> <token> <signature> <filepaths>...` 77 78 Verify a record was recieved by the server by verifying the censorship 79 record signature. 80 81 ``` 82 $ politeia verify \ 83 e88df79a4b02699e6c051adbae05f21f2a2f24942e0f27cade165548ec3d6387 \ 84 39868e5e91c78255 \ 85 b2a69823f85b62941d845c439726a2504026a0d29fd50ecabe5648b0128328c2fade0ddb354594d48a209dff24e73795ec9cb175d028155cbfa1901114f4b608 \ 86 index.md 87 88 Server key : e88df79a4b02699e6c051adbae05f21f2a2f24942e0f27cade165548ec3d6387 89 Token : 39868e5e91c78255 90 Merkle root: 2d00aaa0768701fd011943fbe8ae92f84ee268ca134d6b14f877c3153072bb3c 91 Signature : b2a69823f85b62941d845c439726a2504026a0d29fd50ecabe5648b0128328c2fade0ddb354594d48a209dff24e73795ec9cb175d028155cbfa1901114f4b608 92 93 Record successfully verified 94 ``` 95 96 ## Edit record 97 98 Args: `[actionMetadata:<id>:metadataJSON]... <actionfile:filename>... 99 token:<token>` 100 101 Metadata can be updated using the arguments: 102 `'appendmetadata:[pluginID][streamID]:[metadataJSON]'` 103 `'overwritemetadata:[pluginID][streamID]:[metadataJSON]'` 104 105 Files can be updated using the arguments: 106 `add:[filepath]` 107 `del:[filename]` 108 109 The token is specified using the argument: 110 `token:[token]` 111 112 Metadata provided using the `overwritemetadata` argument does not have to 113 already exist. 114 115 ``` 116 $ politeia -v -testnet -rpchost 127.0.0.1 -rpcuser=user -rpcpass=pass edit \ 117 'appendmetadata:testid1:{"foo":"bar"}' \ 118 'overwritemetadata:testid12:{"12foo":"12bar"}' \ 119 del:index.md add:updated.md token:39868e5e91c78255 120 121 Record updated: 122 Status : unreviewed 123 Timestamp : 2021-03-25 16:38:59 +0000 UTC 124 Version : 2 125 Censorship record: 126 Merkle : db09a4371b32086241999b7db196c4bda04bd93194cdb90940a88741d5bbf166 127 Token : 39868e5e91c78255 128 Signature: 7f26ab5d5fc4a67cfe6320fa1a1c2cbb5d6dadbfcd74d255d0c048c32e9da413cfb8cdcc9440c53300ce0907c7d274435d4e98c36c189dfcc81dbecc44e79003 129 File (00) : 130 Name : updated.md 131 MIME : text/plain; charset=utf-8 132 Digest : db09a4371b32086241999b7db196c4bda04bd93194cdb90940a88741d5bbf166 133 Metadata stream testid 12: 134 {"12foo":"12bar"} 135 Metadata stream testid 01: 136 {"moo":"lala"}{"foo":"bar"} 137 Server public key: e88df79a4b02699e6c051adbae05f21f2a2f24942e0f27cade165548ec3d6387 138 ``` 139 140 ## Edit record metadata 141 142 Args: `[actionMetadata:<id>:metadataJSON]... token:<token>` 143 144 Metadata can be updated when updating the record files or the client can 145 perform a metadata only update using this command. Updating only the metadata 146 will not change the censorship record signature. 147 148 Metadata can be updated using the arguments: 149 `'appendmetadata:[pluginID][streamID]:[metadataJSON]'` 150 `'overwritemetadata:[pluginID][streamID]:[metadataJSON]'` 151 152 The token is specified using the argument: 153 `token:[token]` 154 155 Metadata provided using the `overwritemetadata` argument does not have to 156 already exist. 157 158 ``` 159 $ politeia -v -testnet -rpchost 127.0.0.1 -rpcuser=user -rpcpass=pass editmetadata \ 160 'appendmetadata:testid1:{"foo":"bar"}' \ 161 'overwritemetadata:testid12:{"123foo":"123bar"}' \ 162 token:39868e5e91c78255 163 164 Record metadata updated: 165 Status : unreviewed 166 Timestamp : 2021-03-25 16:39:35 +0000 UTC 167 Version : 2 168 Censorship record: 169 Merkle : db09a4371b32086241999b7db196c4bda04bd93194cdb90940a88741d5bbf166 170 Token : 39868e5e91c78255 171 Signature: 7f26ab5d5fc4a67cfe6320fa1a1c2cbb5d6dadbfcd74d255d0c048c32e9da413cfb8cdcc9440c53300ce0907c7d274435d4e98c36c189dfcc81dbecc44e79003 172 File (00) : 173 Name : updated.md 174 MIME : text/plain; charset=utf-8 175 Digest : db09a4371b32086241999b7db196c4bda04bd93194cdb90940a88741d5bbf166 176 Metadata stream testid 12: 177 {"123foo":"123bar"} 178 Metadata stream testid 01: 179 {"moo":"lala"}{"foo":"bar"}{"foo":"bar"} 180 Server public key: e88df79a4b02699e6c051adbae05f21f2a2f24942e0f27cade165548ec3d6387 181 ``` 182 183 ## Set record status 184 185 Args: `<token> <status>` 186 187 You can update the status of a record using one of the following statuses: 188 - `public` - make the record a public 189 - `archived` - lock the record from further edits 190 - `censored` - lock the record from further edits and delete all files 191 192 Note, token is not prefixed with `token:` in this command. 193 194 ``` 195 $ politeia -v -testnet -rpchost 127.0.0.1 -rpcuser=user -rpcpass=pass setstatus 39868e5e91c78255 public 196 197 Record status updated: 198 Status : public 199 Timestamp : 2021-03-25 16:40:40 +0000 UTC 200 Version : 1 201 Censorship record: 202 Merkle : db09a4371b32086241999b7db196c4bda04bd93194cdb90940a88741d5bbf166 203 Token : 39868e5e91c78255 204 Signature: 7f26ab5d5fc4a67cfe6320fa1a1c2cbb5d6dadbfcd74d255d0c048c32e9da413cfb8cdcc9440c53300ce0907c7d274435d4e98c36c189dfcc81dbecc44e79003 205 File (00) : 206 Name : updated.md 207 MIME : text/plain; charset=utf-8 208 Digest : db09a4371b32086241999b7db196c4bda04bd93194cdb90940a88741d5bbf166 209 Metadata stream testid 01: 210 {"moo":"lala"}{"foo":"bar"}{"foo":"bar"} 211 Metadata stream testid 12: 212 {"123foo":"123bar"} 213 Server public key: e88df79a4b02699e6c051adbae05f21f2a2f24942e0f27cade165548ec3d6387 214 ``` 215 216 ## Get record 217 218 Retrieve a record. 219 220 ``` 221 $ politeia -v -testnet -rpchost 127.0.0.1 -rpcuser=user -rpcpass=pass record 39868e5e91c78255 222 223 Record: 224 Status : public 225 Timestamp : 2021-03-25 16:40:40 +0000 UTC 226 Version : 1 227 Censorship record: 228 Merkle : db09a4371b32086241999b7db196c4bda04bd93194cdb90940a88741d5bbf166 229 Token : 39868e5e91c78255 230 Signature: 7f26ab5d5fc4a67cfe6320fa1a1c2cbb5d6dadbfcd74d255d0c048c32e9da413cfb8cdcc9440c53300ce0907c7d274435d4e98c36c189dfcc81dbecc44e79003 231 File (00) : 232 Name : updated.md 233 MIME : text/plain; charset=utf-8 234 Digest : db09a4371b32086241999b7db196c4bda04bd93194cdb90940a88741d5bbf166 235 Metadata stream testid 12: 236 {"123foo":"123bar"} 237 Metadata stream testid 01: 238 {"moo":"lala"}{"foo":"bar"}{"foo":"bar"} 239 Server public key: e88df79a4b02699e6c051adbae05f21f2a2f24942e0f27cade165548ec3d6387 240 ``` 241 242 ## Inventory 243 244 Retrieve the censorship record tokens of the records in the inventory, 245 categorized by their record state and record status. 246 247 The user can request a page of tokens from a specific record state and record 248 status by providing the <state> <status> <pageNumber> arguments. 249 250 States: `unvetted`, `vetted` 251 Statuses: `unreviewed`, `public`, `censored`, `abandoned` 252 253 ``` 254 $ politeia -v -testnet -rpchost 127.0.0.1 -rpcuser=user -rpcpass=pass inventory unvetted unreviewed 1 255 256 Unvetted 257 { 258 "unreviewed": [ 259 "d0545038224c5054", 260 "ea260a4ab9170d70" 261 ] 262 } 263 ``` 264 265 If not arguments are provided then a page of tokens for every state and status 266 will be returned. 267 268 ``` 269 $ politeia -v -testnet -rpchost 127.0.0.1 -rpcuser=user -rpcpass=pass inventory 270 271 Unvetted 272 { 273 "censored": [ 274 "de127f2cb24c702b", 275 ], 276 "unreviewed": [ 277 "d0545038224c5054", 278 "ea260a4ab9170d70" 279 ] 280 } 281 Vetted 282 { 283 "archived": [ 284 "77396eccc387b07e" 285 ], 286 "censored": [ 287 "0439c5355ef94e36" 288 ], 289 "public": [ 290 "39868e5e91c78255", 291 "2f5d6bbb15b63e76", 292 "f1f7337397a79b51" 293 ] 294 } 295 ```