github.com/Finschia/finschia-sdk@v0.48.1/x/evidence/atlas/atlas-v0.41.x.md (about) 1 # x/evidence 2 3 The `x/evidence` module is responsible for handling multi-asset coin transfers between 4 accounts and tracking special-case pseudo-transfers which must work differently 5 with particular kinds of accounts. 6 7 ## Usage 8 9 1. Import the module. 10 11 ```go 12 import ( 13 "github.com/Finschia/finschia-sdk/x/evidence" 14 evidencekeeper "github.com/Finschia/finschia-sdk/x/evidence/keeper" 15 evidencetypes "github.com/Finschia/finschia-sdk/x/evidence/types" 16 ) 17 ``` 18 19 2. Add `AppModuleBasic` to your `ModuleBasics`. 20 21 ```go 22 var ( 23 ModuleBasics = module.NewBasicManager( 24 // ... 25 evidence.AppModuleBasic{}, 26 } 27 ) 28 ``` 29 30 3. Add the evidence keeper to your apps struct. 31 32 ```go 33 type app struct { 34 // ... 35 EvidenceKeeper evidencekeeper.Keeper 36 // ... 37 } 38 ``` 39 40 4. Add the evidence store key to the group of store keys. 41 42 ```go 43 func NewApp(...) *App { 44 // ... 45 keys := sdk.NewKVStoreKeys( 46 evidencetypes.StoreKey, 47 ) 48 // ... 49 } 50 ``` 51 52 5. Create the keeper. Note, the `x/evidence` module depends on the `x/staking` and `x/slashing` modules. Evidence has expected interfaces, these interfaces are linked to slashing and staking. You can find these interfaces [here](https://github.com/cosmos/cosmos-sdk/blob/v0.41.0/x/evidence/types/expected_keepers.go) 53 54 ```go 55 func NewApp(...) *App { 56 // ... 57 // create evidence keeper with router 58 evidenceKeeper := evidencekeeper.NewKeeper( 59 appCodec, keys[evidencetypes.StoreKey], &app.StakingKeeper, app.SlashingKeeper, 60 ) 61 } 62 ``` 63 64 6. Add the `x/evidence` module to the app's `ModuleManager`. 65 66 ```go 67 func NewApp(...) *App { 68 // ... 69 app.mm = module.NewManager( 70 // ... 71 evidence.NewAppModule(app.EvidenceKeeper), 72 // ... 73 ) 74 } 75 ``` 76 77 7. Set the `x/evidence` module begin blocker order. 78 79 ```go 80 func NewApp(...) *App { 81 // ... 82 app.mm.SetOrderBeginBlockers( 83 // ... 84 evidencetypes.ModuleName, 85 // ... 86 ) 87 } 88 ``` 89 90 8. Set the `x/evidence` module genesis order. 91 92 ```go 93 func NewApp(...) *App { 94 // ... 95 app.mm.SetOrderInitGenesis(..., evidencetypes.ModuleName, ...) 96 } 97 ``` 98 99 9. Add the `x/evidence` module to the simulation manager (if you have one set). 100 101 ```go 102 func NewApp(...) *App { 103 // ... 104 app.sm = module.NewSimulationManager( 105 // ... 106 evidence.NewAppModule(app.EvidenceKeeper), 107 // ... 108 ) 109 } 110 111 ## Genesis 112 113 The `x/evidence` module defines its genesis state as follows: 114 115 ```proto 116 type GenesisState struct { 117 // evidence defines all the evidence at genesis. 118 Evidence []*types.Any `protobuf:"bytes,1,rep,name=evidence,proto3" json:"evidence,omitempty"` 119 } 120 ``` 121 122 ## Messages 123 <!-- todo: change to v0.41 when its available --> 124 125 View supported messages at [docs.cosmos.network/v0.40/modules/evidence](https://docs.cosmos.network/v0.40/modules/evidence/03_messages.html) 126 127 ## Client 128 129 Evidence supports querying of old evidence and submission of new evidence. There are two queries. One for all the evidence, and one for a specific piece of evidence. 130 131 ### CLI 132 133 The evidence module supports the blow command to query evidence. 134 135 ```sh 136 Usage: 137 app query evidence [flags] 138 139 Flags: 140 --count-total count total number of records in evidence to query for 141 --height int Use a specific height to query state at (this can error if the node is pruning state) 142 -h, --help help for evidence 143 --limit uint pagination limit of evidence to query for (default 100) 144 --node string <host>:<port> to Tendermint RPC interface for this chain (default "tcp://localhost:26657") 145 --offset uint pagination offset of evidence to query for 146 -o, --output string Output format (text|json) (default "text") 147 --page uint pagination page of evidence to query for. This sets offset to a multiple of limit (default 1) 148 --page-key string pagination page-key of evidence to query for 149 ``` 150 151 ### REST 152 153 Evidence REST API supports only queries of evidence. To submit evidence please use gRPC or the cli. 154 155 ### gRPC 156 157 Evidence supports both querying and submitting transactions via gRPC 158 159 #### Query 160 161 [gRPC query](https://docs.cosmos.network/master/core/proto-docs.html#cosmos/evidence/v1beta1/query.proto) 162 163 #### Tx 164 165 [gRPC Tx](https://docs.cosmos.network/master/core/proto-docs.html#cosmos-evidence-v1beta1-tx-proto) 166 167 View supported messages at [docs.cosmos.network/v0.40/modules/evidence](https://docs.cosmos.network/v0.40/modules/evidence/03_messages.html)