# Slashing Queries Endpoints reference: - `provider` chain RPC: `ics-consensus.stg.earthball.xyz:26657` - `salt` chain RPC: `ics-consensus.stg.earthball.xyz:26667` - `pepper` chain RPC: `ics-consensus.stg.earthball.xyz:26677` ## Block results: the `slash` event Querying for slashing events can be done via the block_results query on an RPC endpoint. For example, if we want to query the block results at height 2204 of the provider chain: ``` curl -s 'http://ics-consensus.stg.earthball.xyz:26657/block_results?height=2204' | jq '.result.begin_block_events[14]' ``` We get the following: ```json { "type": "slash", "attributes": [ { "key": "YWRkcmVzcw==", "value": "Y29zbW9zdmFsY29uczFqdnZzeDVjcG1mZnhlM3VkZXV0NTUzYThmN3E1cXk1MzU4YTdkYw==", "index": true }, { "key": "cG93ZXI=", "value": "MQ==", "index": true }, { "key": "cmVhc29u", "value": "bWlzc2luZ19zaWduYXR1cmU=", "index": true }, { "key": "amFpbGVk", "value": "Y29zbW9zdmFsY29uczFqdnZzeDVjcG1mZnhlM3VkZXV0NTUzYThmN3E1cXk1MzU4YTdkYw==", "index": true } ] } ``` The `key` and `value` keys are base64 encoded, so they must be decoded. This script is shown as reference: `slash.py` ```python! #!/usr/bin/env python import json import requests import base64 def decode_attributes(attrs): attrs['key'] = base64.b64decode(attrs['key']).decode('utf-8') attrs['value'] = base64.b64decode(attrs['value']).decode('utf-8') block_results_endpoint = 'http://ics-consensus.stg.earthball.xyz:26657/block_results?height=' height = 2204 block_results = (requests.get(f'{block_results_endpoint}{height}')).json() begin_block_events = block_results['result']['begin_block_events'] slash_event = begin_block_events[14] for attrs in slash_event['attributes']: decode_attributes(attrs) print(json.dumps(slash_event)) ``` This enables the following: ```bash! ./slash.py | jq -r '.' { "type": "slash", "attributes": [ { "key": "address", "value": "cosmosvalcons1jvvsx5cpmffxe3udeut553a8f7q5qy5358a7dc", "index": true }, { "key": "power", "value": "1", "index": true }, { "key": "reason", "value": "missing_signature", "index": true }, { "key": "jailed", "value": "cosmosvalcons1jvvsx5cpmffxe3udeut553a8f7q5qy5358a7dc", "index": true } ] } ``` If we check the validator set at block heights 2205 and 2206, we can see that the validator with consensus address `cosmosvalcons1jvvsx5cpmffxe3udeut553a8f7q5qy5358a7dc` has been removed in height 2206 due to missing signatures. We can confirm this by looking for ``"type": "liveness"`` events in earlier blocks. ``` curl -s 'http://ics-consensus.stg.earthball.xyz:26657/validators?height=2205' | jq -r '.result.validators[].address' B218725A22B9319FC8340E83601588438FEF11BD A49DAB77379B869F28E2AA35BF4D7F07866B0C10 9319035301DA526CC78DCF174A47A74F81401291 curl -s 'http://ics-consensus.stg.earthball.xyz:26657/validators?height=2206' | jq -r '.result.validators[].address' B218725A22B9319FC8340E83601588438FEF11BD A49DAB77379B869F28E2AA35BF4D7F07866B0C10 gaiad keys parse 9319035301DA526CC78DCF174A47A74F81401291 formats: - cosmos1jvvsx5cpmffxe3udeut553a8f7q5qy539q6hd2 - cosmospub1jvvsx5cpmffxe3udeut553a8f7q5qy536xky50 - cosmosvaloper1jvvsx5cpmffxe3udeut553a8f7q5qy53q5wzpe - cosmosvaloperpub1jvvsx5cpmffxe3udeut553a8f7q5qy53jhhpru - cosmosvalcons1jvvsx5cpmffxe3udeut553a8f7q5qy5358a7dc - cosmosvalconspub1jvvsx5cpmffxe3udeut553a8f7q5qy53rnvffd ``` The same result can be observed at heights 2573-2575 and 8011-8013. ## Consumer chain slashes The salt chain had slash events at block height 101, but the validator set did not start updating until block height 166. ```bash= curl -s 'http://ics-consensus.stg.earthball.xyz:26667/block_results?height=101' | jq -r '.result.begin_block_events[1]' ``` The pepper chain had slash events at block height 101, but the validator set did not change until block height 150. ```bash= curl -s 'http://ics-consensus.stg.earthball.xyz:26677/block_results?height=101' | jq -r '.result.begin_block_events[1]' ```