@zuhaibnoor/zigchain-sdk 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +1 -1
  2. package/dist/circuit/ChainCircuitApi.d.ts.map +1 -1
  3. package/dist/circuit/ChainCircuitApi.js.map +1 -1
  4. package/dist/consensus/ChainConsensusApi.d.ts +5 -0
  5. package/dist/consensus/ChainConsensusApi.d.ts.map +1 -1
  6. package/dist/consensus/ChainConsensusApi.js +16 -0
  7. package/dist/consensus/ChainConsensusApi.js.map +1 -1
  8. package/dist/consensus/types.d.ts +55 -0
  9. package/dist/consensus/types.d.ts.map +1 -1
  10. package/dist/dex/ChainDexApi.d.ts.map +1 -1
  11. package/dist/dex/ChainDexApi.js.map +1 -1
  12. package/dist/distribution/ChainDistributionApi.d.ts.map +1 -1
  13. package/dist/distribution/ChainDistributionApi.js +0 -1
  14. package/dist/distribution/ChainDistributionApi.js.map +1 -1
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +1 -1
  18. package/dist/index.js.map +1 -1
  19. package/dist/staking/ChainStakingApi.d.ts +1 -5
  20. package/dist/staking/ChainStakingApi.d.ts.map +1 -1
  21. package/dist/staking/ChainStakingApi.js +9 -7
  22. package/dist/staking/ChainStakingApi.js.map +1 -1
  23. package/dist/upgrade/ChainUpgradeApi.d.ts.map +1 -1
  24. package/dist/validator-set/ChainValidator.d.ts +8 -0
  25. package/dist/validator-set/ChainValidator.d.ts.map +1 -0
  26. package/dist/validator-set/ChainValidator.js +15 -0
  27. package/dist/validator-set/ChainValidator.js.map +1 -0
  28. package/docs/block.md +325 -38
  29. package/docs/circuit.md +164 -35
  30. package/docs/consensus.md +600 -0
  31. package/docs/dex.md +313 -63
  32. package/docs/distribution.md +664 -93
  33. package/docs/evidence.md +117 -122
  34. package/docs/factory.md +308 -62
  35. package/docs/gov.md +268 -70
  36. package/docs/ibc/ibcChannel.md +736 -249
  37. package/docs/ibc/ibcClient.md +608 -139
  38. package/docs/ibc-transfer.md +349 -90
  39. package/docs/interchain-accounts.md +151 -48
  40. package/docs/mint.md +173 -36
  41. package/docs/runtime.md +81 -42
  42. package/docs/slashing.md +209 -61
  43. package/docs/staking.md +534 -411
  44. package/docs/tokenwrapper.md +221 -64
  45. package/docs/txs.md +447 -0
  46. package/docs/upgrade.md +281 -58
  47. package/docs/validator-set.md +177 -0
  48. package/package.json +1 -1
  49. package/docs/comet-validator-set.md +0 -70
package/docs/evidence.md CHANGED
@@ -1,18 +1,53 @@
1
1
  # Evidence Module
2
2
 
3
- The **Evidence module** exposes information about **misbehavior evidence** that has been submitted to the blockchain.
4
- Evidence is used by the network to **prove validator misbehavior**, such as double-signing or light-client attacks, and is a critical part of the **slashing and security mechanism** in Cosmos-SDK–based chains like ZigChain.
3
+ ## What is the Evidence Module?
5
4
 
6
- This module allows developers to:
5
+ The **Evidence module** is responsible for handling **cryptographic proof of validator misbehavior** on ZigChain.
7
6
 
8
- * Inspect individual evidence records by hash
9
- * List all submitted evidence (paginated)
7
+ It allows the chain to objectively verify faults such as:
10
8
 
11
- All queries in this module use **LCD endpoints**.
9
+ * Double-signing (signing two different blocks at the same height)
10
+ * Or other consensus rule violations
11
+
12
+ Once verified, this evidence is forwarded to the **Slashing module**, which may:
13
+
14
+ * Slash validator stake
15
+ * Jail the validator
16
+ * Tombstone the validator (permanent ban)
17
+
18
+ This module is part of ZigChain’s **core security layer**.
19
+
20
+ ---
21
+
22
+ ## Important Terminology
23
+
24
+ ### Evidence
25
+
26
+ **Evidence** is a cryptographic proof that a validator violated consensus rules.
27
+
28
+ It contains enough data for the blockchain to independently verify the misbehavior without trusting any party.
29
+
30
+ Evidence is:
31
+
32
+ * Public
33
+ * Immutable once accepted
34
+ * Automatically processed by the chain
12
35
 
13
36
  ---
14
37
 
15
- ## Initialization
38
+ ### Evidence Hash
39
+
40
+ Each evidence record has a **unique hash** that identifies it on-chain.
41
+
42
+ This hash is used to query a specific evidence record via:
43
+
44
+ ```bash
45
+ zigchaind query evidence evidence <hash>
46
+ ```
47
+
48
+ ---
49
+
50
+ ## Setup
16
51
 
17
52
  ```ts
18
53
  import {
@@ -27,30 +62,39 @@ const evidenceApi = new ChainEvidenceApi(endpoints)
27
62
 
28
63
  ---
29
64
 
30
- ## `fetchEvidence`
65
+ # 1️⃣ fetchEvidence
66
+
67
+ ## Method
31
68
 
32
69
  ```ts
33
70
  async fetchEvidence(hash: string)
34
71
  ```
35
72
 
36
- **CLI equivalent**
73
+ ## CLI Equivalent
37
74
 
38
75
  ```bash
39
76
  zigchaind query evidence evidence <hash>
40
77
  ```
41
78
 
42
- ### Description
79
+ ## Description
43
80
 
44
81
  Fetches a **single evidence record** using its unique evidence hash.
45
- This is useful when you already know an evidence hash (for example, from logs, explorers, or governance discussions) and want to inspect the exact misbehavior details.
46
82
 
47
- ### Parameters
83
+ This is useful when:
48
84
 
49
- | Name | Type | Description |
50
- | ------ | -------- | ------------------------------------ |
51
- | `hash` | `string` | Unique hash identifying the evidence |
85
+ * You obtained a hash from logs or an explorer
86
+ * You are auditing a slashing event
87
+ * You are investigating validator misbehavior
52
88
 
53
- ### Example
89
+ If the hash does not exist, the chain will return an error.
90
+
91
+ ## Parameters
92
+
93
+ | Name | Type | Description |
94
+ | ---- | ------ | ------------------------------------------- |
95
+ | hash | string | Unique hash identifying the evidence record |
96
+
97
+ ## Usage Example
54
98
 
55
99
  ```ts
56
100
  const evidence = await evidenceApi.fetchEvidence(
@@ -60,140 +104,91 @@ const evidence = await evidenceApi.fetchEvidence(
60
104
  console.dir(evidence, { depth: null })
61
105
  ```
62
106
 
63
- ### When to use
64
-
65
- * Inspect a **specific validator misbehavior**
66
- * Debug or audit slashing events
67
- * Explorer or monitoring tools
68
-
69
- ---
70
-
71
- ## `fetchAllEvidence`
107
+ ## Response Structure
72
108
 
73
109
  ```ts
74
- async fetchAllEvidence()
110
+ {
111
+ evidence: {
112
+ type_url: string
113
+ value: any
114
+ }
115
+ }
75
116
  ```
76
117
 
77
- **CLI equivalent**
118
+ ### `evidence`
78
119
 
79
- ```bash
80
- zigchaind query evidence list
81
- ```
120
+ | Field | Description |
121
+ ----------|------------|
122
+ | `type_url` | Identifies the evidence type (e.g., duplicate vote) |
123
+ | `value` | Evidence-specific structure (depends on type) |
82
124
 
83
- ### Description
125
+ ## When to Use
84
126
 
85
- Returns **all submitted evidence records** on the chain.
86
- The response is **paginated**, meaning large networks may return results in chunks.
127
+ * Debugging validator slashing
128
+ * Explorer implementations
129
+ * Governance/security monitoring
130
+ * Auditing historical faults
87
131
 
88
- This method is ideal for:
132
+ ---
89
133
 
90
- * Block explorers
91
- * Security dashboards
92
- * Chain analytics tools
134
+ # 2️⃣ fetchAllEvidence
93
135
 
94
- ### Example
136
+ ## Method
95
137
 
96
138
  ```ts
97
- const allEvidence = await evidenceApi.fetchAllEvidence()
98
- console.dir(allEvidence, { depth: null })
139
+ async fetchAllEvidence()
99
140
  ```
100
141
 
101
- ### Notes
142
+ ## CLI Equivalent
102
143
 
103
- * Evidence types can vary, so the `value` field is returned as a flexible structure.
104
- * Pagination info is included if the dataset is large.
144
+ ```bash
145
+ zigchaind query evidence list
146
+ ```
105
147
 
106
- ---
148
+ ## Description
107
149
 
108
- ## Response Types Overview
150
+ Returns **all submitted evidence records** currently stored on-chain.
109
151
 
110
- ### `Evidence`
152
+ On ZigChain testnet, this typically returns:
111
153
 
112
- ```ts
154
+ ```json
113
155
  {
114
- type_url: string
115
- value: any
156
+ "evidence": [],
157
+ "pagination": {
158
+ "next_key": null,
159
+ "total": "0"
160
+ }
116
161
  }
117
162
  ```
118
163
 
119
- * `type_url` Identifies the evidence type (e.g. double-sign evidence)
120
- * `value` → Evidence-specific data (structure depends on evidence type)
121
-
122
- ---
123
-
124
- ## Summary Table
125
-
126
- | Function | CLI Command | Purpose |
127
- | ------------------ | ------------------------------------------ | -------------------------------- |
128
- | `fetchEvidence` | `zigchaind query evidence evidence <hash>` | Query a specific evidence record |
129
- | `fetchAllEvidence` | `zigchaind query evidence list` | List all submitted evidence |
130
-
131
- ---
132
-
133
- ## How Evidence Works
134
-
135
- ### Who Submits Evidence?
136
-
137
- Evidence is **not submitted by regular users**.
164
+ This simply means no validator misbehavior has been recorded.
138
165
 
139
- It is submitted by:
166
+ ## Parameters
140
167
 
141
- * **Validators** (automatically by their node software)
142
- * **Full nodes** that detect misbehavior
143
- * **Light clients** (for light-client attack proofs)
144
-
145
- In most cases, evidence is **automatically generated and broadcast** by the blockchain software when a validator’s misbehavior is detected.
146
-
147
- ---
148
-
149
- ### What Does Evidence Contain?
150
-
151
- Evidence is a **cryptographic proof** of validator misbehavior.
152
- It contains enough information for the blockchain to **verify the fault without trust**.
153
-
154
- Depending on the evidence type, it may include:
155
-
156
- * Validator consensus address
157
- * Block height at which misbehavior occurred
158
- * Conflicting block headers or signatures
159
- * Timestamp of the infraction
160
- * Power (stake) of the validator at that time
161
-
162
- Once verified, this evidence can trigger **slashing**, **jailing**, or **tombstoning** of the validator.
163
-
164
- ---
168
+ None.
165
169
 
166
- ### Common Types of Evidence
170
+ ## Usage Example
167
171
 
168
- The Cosmos SDK currently supports multiple evidence types, including:
169
-
170
- * **Duplicate Vote Evidence**
171
- Proof that a validator signed **two different blocks at the same height** (double-signing).
172
-
173
- * **Light Client Attack Evidence**
174
- Proof of malicious behavior aimed at misleading light clients.
175
-
176
- Each evidence type is identified by its `type_url` field in the response.
177
-
178
- ---
179
-
180
- ### Why Evidence Is Important
181
-
182
- The Evidence module ensures:
183
-
184
- * **Network security** through objective proof
185
- * **Automatic punishment** without human intervention
186
- * **Trustless verification** of validator behavior
187
-
188
- Because evidence is cryptographically verifiable, it **cannot be faked or disputed** once accepted by the chain.
189
-
190
- ---
172
+ ```ts
173
+ const allEvidence = await evidenceApi.fetchAllEvidence()
174
+ console.dir(allEvidence, { depth: null })
175
+ ```
191
176
 
192
- ### Key Characteristics
177
+ ## Response Structure
193
178
 
194
- * Evidence is **immutable** once submitted
195
- * Evidence is **publicly queryable**
196
- * Evidence directly feeds into the **Slashing module**
197
- * Evidence is **time-sensitive** (old evidence may be rejected)
179
+ ```ts
180
+ {
181
+ evidence: Evidence[]
182
+ pagination: {
183
+ next_key: string | null
184
+ total: string
185
+ }
186
+ }
187
+ ```
198
188
 
189
+ ## When to Use
199
190
 
191
+ * Building blockchain explorers
192
+ * Monitoring validator behavior
193
+ * Security dashboards
194
+ ---