github.com/Finschia/finschia-sdk@v0.48.1/x/evidence/spec/07_client.md (about) 1 # Client 2 3 ## CLI 4 5 A user can query and interact with the `evidence` module using the CLI. 6 7 ### Query 8 9 The `query` commands allows users to query `evidence` state. 10 11 ```bash 12 simd query evidence --help 13 ``` 14 15 ### evidence 16 17 The `evidence` command allows users to list all evidence or evidence by hash. 18 19 Usage: 20 21 ```bash 22 simd query evidence [flags] 23 ``` 24 25 To query evidence by hash 26 27 Example: 28 29 ```bash 30 simd query evidence "DF0C23E8634E480F84B9D5674A7CDC9816466DEC28A3358F73260F68D28D7660" 31 ``` 32 33 Example Output: 34 35 ```bash 36 evidence: 37 consensus_address: cosmosvalcons1ntk8eualewuprz0gamh8hnvcem2nrcdsgz563h 38 height: 11 39 power: 100 40 time: "2021-10-20T16:08:38.194017624Z" 41 ``` 42 43 To get all evidence 44 45 Example: 46 47 ```bash 48 simd query evidence 49 ``` 50 51 Example Output: 52 53 ```bash 54 evidence: 55 consensus_address: cosmosvalcons1ntk8eualewuprz0gamh8hnvcem2nrcdsgz563h 56 height: 11 57 power: 100 58 time: "2021-10-20T16:08:38.194017624Z" 59 pagination: 60 next_key: null 61 total: "1" 62 ``` 63 64 ## REST 65 66 A user can query the `evidence` module using REST endpoints. 67 68 ### Evidence 69 70 Get evidence by hash 71 72 ```bash 73 /cosmos/evidence/v1beta1/evidence/{evidence_hash} 74 ``` 75 76 Example: 77 78 ```bash 79 curl -X GET "http://localhost:1317/cosmos/evidence/v1beta1/evidence/DF0C23E8634E480F84B9D5674A7CDC9816466DEC28A3358F73260F68D28D7660" 80 ``` 81 82 Example Output: 83 84 ```bash 85 { 86 "evidence": { 87 "consensus_address": "cosmosvalcons1ntk8eualewuprz0gamh8hnvcem2nrcdsgz563h", 88 "height": "11", 89 "power": "100", 90 "time": "2021-10-20T16:08:38.194017624Z" 91 } 92 } 93 ``` 94 95 ### All evidence 96 97 Get all evidence 98 99 ```bash 100 /cosmos/evidence/v1beta1/evidence 101 ``` 102 103 Example: 104 105 ```bash 106 curl -X GET "http://localhost:1317/cosmos/evidence/v1beta1/evidence" 107 ``` 108 109 Example Output: 110 111 ```bash 112 { 113 "evidence": [ 114 { 115 "consensus_address": "cosmosvalcons1ntk8eualewuprz0gamh8hnvcem2nrcdsgz563h", 116 "height": "11", 117 "power": "100", 118 "time": "2021-10-20T16:08:38.194017624Z" 119 } 120 ], 121 "pagination": { 122 "total": "1" 123 } 124 } 125 ``` 126 127 ## gRPC 128 129 A user can query the `evidence` module using gRPC endpoints. 130 131 ### Evidence 132 133 Get evidence by hash 134 135 ```bash 136 cosmos.evidence.v1beta1.Query/Evidence 137 ``` 138 139 Example: 140 141 ```bash 142 grpcurl -plaintext -d '{"evidence_hash":"DF0C23E8634E480F84B9D5674A7CDC9816466DEC28A3358F73260F68D28D7660"}' localhost:9090 cosmos.evidence.v1beta1.Query/Evidence 143 ``` 144 145 Example Output: 146 147 ```bash 148 { 149 "evidence": { 150 "consensus_address": "cosmosvalcons1ntk8eualewuprz0gamh8hnvcem2nrcdsgz563h", 151 "height": "11", 152 "power": "100", 153 "time": "2021-10-20T16:08:38.194017624Z" 154 } 155 } 156 ``` 157 158 ### All evidence 159 160 Get all evidence 161 162 ```bash 163 cosmos.evidence.v1beta1.Query/AllEvidence 164 ``` 165 166 Example: 167 168 ```bash 169 grpcurl -plaintext localhost:9090 cosmos.evidence.v1beta1.Query/AllEvidence 170 ``` 171 172 Example Output: 173 174 ```bash 175 { 176 "evidence": [ 177 { 178 "consensus_address": "cosmosvalcons1ntk8eualewuprz0gamh8hnvcem2nrcdsgz563h", 179 "height": "11", 180 "power": "100", 181 "time": "2021-10-20T16:08:38.194017624Z" 182 } 183 ], 184 "pagination": { 185 "total": "1" 186 } 187 } 188 ```