xpi-ts 0.2.23 → 0.3.1
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.
- package/.mcp.json +8 -0
- package/README.md +9 -2
- package/dist/cjs/lib/bitcore/crypto/point.js +2 -2
- package/dist/cjs/lib/bitcore/script.js +16 -50
- package/dist/cjs/lib/bitcore/transaction/transaction.js +3 -0
- package/dist/esm/lib/bitcore/crypto/point.js +2 -2
- package/dist/esm/lib/bitcore/script.js +16 -50
- package/dist/esm/lib/bitcore/transaction/transaction.js +3 -0
- package/dist/esm/package.json +3 -1
- package/dist/types/gulpfile.d.ts +10 -0
- package/dist/types/gulpfile.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/bitcore/address.d.ts +116 -0
- package/dist/types/lib/bitcore/address.d.ts.map +1 -1
- package/dist/types/lib/bitcore/block/block.d.ts +214 -0
- package/dist/types/lib/bitcore/block/block.d.ts.map +1 -1
- package/dist/types/lib/bitcore/block/blockheader.d.ts +220 -0
- package/dist/types/lib/bitcore/block/blockheader.d.ts.map +1 -1
- package/dist/types/lib/bitcore/block/merkleblock.d.ts +206 -0
- package/dist/types/lib/bitcore/block/merkleblock.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/bn.d.ts +224 -0
- package/dist/types/lib/bitcore/crypto/bn.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/ecdsa.d.ts +122 -0
- package/dist/types/lib/bitcore/crypto/ecdsa.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/hash.d.ts +56 -0
- package/dist/types/lib/bitcore/crypto/hash.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/index.d.ts +4 -0
- package/dist/types/lib/bitcore/crypto/index.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/musig2.d.ts +282 -0
- package/dist/types/lib/bitcore/crypto/musig2.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/point.d.ts +87 -0
- package/dist/types/lib/bitcore/crypto/point.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/random.d.ts +48 -0
- package/dist/types/lib/bitcore/crypto/random.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/schnorr.d.ts +203 -0
- package/dist/types/lib/bitcore/crypto/schnorr.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/signature.d.ts +452 -0
- package/dist/types/lib/bitcore/crypto/signature.d.ts.map +1 -1
- package/dist/types/lib/bitcore/crypto/sigtype.d.ts +46 -0
- package/dist/types/lib/bitcore/crypto/sigtype.d.ts.map +1 -1
- package/dist/types/lib/bitcore/encoding/base58.d.ts +68 -0
- package/dist/types/lib/bitcore/encoding/base58.d.ts.map +1 -1
- package/dist/types/lib/bitcore/encoding/base58check.d.ts +58 -0
- package/dist/types/lib/bitcore/encoding/base58check.d.ts.map +1 -1
- package/dist/types/lib/bitcore/encoding/bufferreader.d.ts +112 -0
- package/dist/types/lib/bitcore/encoding/bufferreader.d.ts.map +1 -1
- package/dist/types/lib/bitcore/encoding/bufferwriter.d.ts +144 -0
- package/dist/types/lib/bitcore/encoding/bufferwriter.d.ts.map +1 -1
- package/dist/types/lib/bitcore/encoding/varint.d.ts +86 -0
- package/dist/types/lib/bitcore/encoding/varint.d.ts.map +1 -1
- package/dist/types/lib/bitcore/errors.d.ts +4 -0
- package/dist/types/lib/bitcore/errors.d.ts.map +1 -1
- package/dist/types/lib/bitcore/hdprivatekey.d.ts +59 -0
- package/dist/types/lib/bitcore/hdprivatekey.d.ts.map +1 -1
- package/dist/types/lib/bitcore/hdpublickey.d.ts +145 -0
- package/dist/types/lib/bitcore/hdpublickey.d.ts.map +1 -1
- package/dist/types/lib/bitcore/index.d.ts +4 -0
- package/dist/types/lib/bitcore/index.d.ts.map +1 -1
- package/dist/types/lib/bitcore/message.d.ts +63 -0
- package/dist/types/lib/bitcore/message.d.ts.map +1 -1
- package/dist/types/lib/bitcore/mnemonic/errors.d.ts +4 -0
- package/dist/types/lib/bitcore/mnemonic/errors.d.ts.map +1 -1
- package/dist/types/lib/bitcore/mnemonic/index.d.ts +4 -0
- package/dist/types/lib/bitcore/mnemonic/index.d.ts.map +1 -1
- package/dist/types/lib/bitcore/mnemonic/mnemonic.d.ts +106 -0
- package/dist/types/lib/bitcore/mnemonic/mnemonic.d.ts.map +1 -1
- package/dist/types/lib/bitcore/mnemonic/pbkdf2.d.ts +13 -0
- package/dist/types/lib/bitcore/mnemonic/pbkdf2.d.ts.map +1 -1
- package/dist/types/lib/bitcore/mnemonic/words/english.d.ts +4 -0
- package/dist/types/lib/bitcore/mnemonic/words/english.d.ts.map +1 -1
- package/dist/types/lib/bitcore/mnemonic/words/french.d.ts +5 -0
- package/dist/types/lib/bitcore/mnemonic/words/french.d.ts.map +1 -1
- package/dist/types/lib/bitcore/mnemonic/words/index.d.ts +4 -0
- package/dist/types/lib/bitcore/mnemonic/words/index.d.ts.map +1 -1
- package/dist/types/lib/bitcore/musig2/index.d.ts +14 -0
- package/dist/types/lib/bitcore/musig2/index.d.ts.map +1 -1
- package/dist/types/lib/bitcore/musig2/session.d.ts +254 -0
- package/dist/types/lib/bitcore/musig2/session.d.ts.map +1 -1
- package/dist/types/lib/bitcore/musig2/signer.d.ts +212 -0
- package/dist/types/lib/bitcore/musig2/signer.d.ts.map +1 -1
- package/dist/types/lib/bitcore/networks.d.ts +17 -0
- package/dist/types/lib/bitcore/networks.d.ts.map +1 -1
- package/dist/types/lib/bitcore/opcode.d.ts +151 -0
- package/dist/types/lib/bitcore/opcode.d.ts.map +1 -1
- package/dist/types/lib/bitcore/privatekey.d.ts +80 -0
- package/dist/types/lib/bitcore/privatekey.d.ts.map +1 -1
- package/dist/types/lib/bitcore/publickey.d.ts +195 -0
- package/dist/types/lib/bitcore/publickey.d.ts.map +1 -1
- package/dist/types/lib/bitcore/script/chunk.d.ts +51 -0
- package/dist/types/lib/bitcore/script/chunk.d.ts.map +1 -1
- package/dist/types/lib/bitcore/script/interpreter/condition-stack.d.ts +60 -0
- package/dist/types/lib/bitcore/script/interpreter/condition-stack.d.ts.map +1 -1
- package/dist/types/lib/bitcore/script/interpreter/index.d.ts +23 -0
- package/dist/types/lib/bitcore/script/interpreter/index.d.ts.map +1 -1
- package/dist/types/lib/bitcore/script/interpreter/interpreter.d.ts +86 -0
- package/dist/types/lib/bitcore/script/interpreter/interpreter.d.ts.map +1 -1
- package/dist/types/lib/bitcore/script/interpreter/script-num.d.ts +115 -0
- package/dist/types/lib/bitcore/script/interpreter/script-num.d.ts.map +1 -1
- package/dist/types/lib/bitcore/script/interpreter/types.d.ts +119 -0
- package/dist/types/lib/bitcore/script/interpreter/types.d.ts.map +1 -1
- package/dist/types/lib/bitcore/script/taproot.d.ts +297 -0
- package/dist/types/lib/bitcore/script/taproot.d.ts.map +1 -1
- package/dist/types/lib/bitcore/script.d.ts +511 -1
- package/dist/types/lib/bitcore/script.d.ts.map +1 -1
- package/dist/types/lib/bitcore/taproot/musig2.d.ts +153 -0
- package/dist/types/lib/bitcore/taproot/musig2.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/input/multisig.d.ts +8 -0
- package/dist/types/lib/bitcore/transaction/input/multisig.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/input/multisigscripthash.d.ts +8 -0
- package/dist/types/lib/bitcore/transaction/input/multisigscripthash.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/input/publickey.d.ts +8 -0
- package/dist/types/lib/bitcore/transaction/input/publickey.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/input/publickeyhash.d.ts +14 -0
- package/dist/types/lib/bitcore/transaction/input/publickeyhash.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/input/taproot.d.ts +22 -0
- package/dist/types/lib/bitcore/transaction/input/taproot.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/input.d.ts +418 -0
- package/dist/types/lib/bitcore/transaction/input.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/outpoint.d.ts +110 -0
- package/dist/types/lib/bitcore/transaction/outpoint.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/output.d.ts +83 -0
- package/dist/types/lib/bitcore/transaction/output.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/sighash.d.ts +69 -0
- package/dist/types/lib/bitcore/transaction/sighash.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/signature.d.ts +98 -0
- package/dist/types/lib/bitcore/transaction/signature.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/transaction.d.ts +384 -0
- package/dist/types/lib/bitcore/transaction/transaction.d.ts.map +1 -1
- package/dist/types/lib/bitcore/transaction/unspentoutput.d.ts +61 -0
- package/dist/types/lib/bitcore/transaction/unspentoutput.d.ts.map +1 -1
- package/dist/types/lib/bitcore/unit.d.ts +140 -0
- package/dist/types/lib/bitcore/unit.d.ts.map +1 -1
- package/dist/types/lib/bitcore/uri.d.ts +34 -0
- package/dist/types/lib/bitcore/uri.d.ts.map +1 -1
- package/dist/types/lib/bitcore/util/base32.d.ts +55 -0
- package/dist/types/lib/bitcore/util/base32.d.ts.map +1 -1
- package/dist/types/lib/bitcore/util/bits.d.ts +76 -0
- package/dist/types/lib/bitcore/util/bits.d.ts.map +1 -1
- package/dist/types/lib/bitcore/util/buffer.d.ts +135 -0
- package/dist/types/lib/bitcore/util/buffer.d.ts.map +1 -1
- package/dist/types/lib/bitcore/util/convertBits.d.ts +15 -0
- package/dist/types/lib/bitcore/util/convertBits.d.ts.map +1 -1
- package/dist/types/lib/bitcore/util/js.d.ts +19 -0
- package/dist/types/lib/bitcore/util/js.d.ts.map +1 -1
- package/dist/types/lib/bitcore/util/merkle.d.ts +85 -0
- package/dist/types/lib/bitcore/util/merkle.d.ts.map +1 -1
- package/dist/types/lib/bitcore/util/preconditions.d.ts +29 -0
- package/dist/types/lib/bitcore/util/preconditions.d.ts.map +1 -1
- package/dist/types/lib/bitcore/util.d.ts +7 -0
- package/dist/types/lib/bitcore/util.d.ts.map +1 -1
- package/dist/types/lib/bitcore/xaddress.d.ts +117 -0
- package/dist/types/lib/bitcore/xaddress.d.ts.map +1 -1
- package/dist/types/lib/lokad.d.ts +292 -0
- package/dist/types/lib/lokad.d.ts.map +1 -1
- package/dist/types/lib/nft.d.ts +434 -0
- package/dist/types/lib/nft.d.ts.map +1 -1
- package/dist/types/lib/rank/api.d.ts +13 -0
- package/dist/types/lib/rank/api.d.ts.map +1 -1
- package/dist/types/lib/rank/index.d.ts +153 -0
- package/dist/types/lib/rank/index.d.ts.map +1 -1
- package/dist/types/lib/rank/opcode.d.ts +6 -2
- package/dist/types/lib/rank/opcode.d.ts.map +1 -1
- package/dist/types/lib/rank/script.d.ts +10 -0
- package/dist/types/lib/rank/script.d.ts.map +1 -1
- package/dist/types/lib/rank/transaction.d.ts +11 -0
- package/dist/types/lib/rank/transaction.d.ts.map +1 -1
- package/dist/types/lib/rpc.d.ts +176 -0
- package/dist/types/lib/rpc.d.ts.map +1 -1
- package/dist/types/utils/constants.d.ts +27 -0
- package/dist/types/utils/constants.d.ts.map +1 -1
- package/dist/types/utils/env.d.ts +15 -0
- package/dist/types/utils/env.d.ts.map +1 -1
- package/dist/types/utils/string.d.ts +57 -0
- package/dist/types/utils/string.d.ts.map +1 -1
- package/dist/types/utils/wallet.d.ts +43 -1
- package/dist/types/utils/wallet.d.ts.map +1 -1
- package/package.json +10 -7
- package/tsconfig.types.json +2 -1
|
@@ -1,49 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Block implementation for the Lotus blockchain
|
|
3
|
+
*
|
|
4
|
+
* Represents a complete Lotus block (CBlock in lotusd) containing a header,
|
|
5
|
+
* extended metadata fields, and transactions.
|
|
6
|
+
*
|
|
7
|
+
* Serialization order:
|
|
8
|
+
* CBlockHeader(160 bytes) + varint(metadata count) + metadata fields +
|
|
9
|
+
* varint(tx count) + transactions
|
|
10
|
+
*
|
|
11
|
+
* Lotus merkle tree construction:
|
|
12
|
+
* Each transaction contributes two leaves: txhash (SHA256d of serialized tx)
|
|
13
|
+
* and txid (merkle-based identifier). These are combined per-transaction as
|
|
14
|
+
* SHA256d(txhash || txid) before building the merkle tree.
|
|
15
|
+
*
|
|
16
|
+
* @see lotusd: src/primitives/block.h, src/primitives/block.cpp
|
|
17
|
+
*/
|
|
1
18
|
import { Buffer } from 'buffer/';
|
|
2
19
|
import { BufferReader } from '../encoding/bufferreader.js';
|
|
3
20
|
import { BufferWriter } from '../encoding/bufferwriter.js';
|
|
4
21
|
import { Transaction } from '../transaction/index.js';
|
|
5
22
|
import { BlockHeader, type BlockHeaderData, type BlockHeaderObject } from './blockheader.js';
|
|
6
23
|
import { MerkleBlock } from './merkleblock.js';
|
|
24
|
+
/**
|
|
25
|
+
* Block data interface for construction (internal format).
|
|
26
|
+
* Used when creating a Block from deserialized data or objects.
|
|
27
|
+
*/
|
|
7
28
|
export interface BlockData {
|
|
29
|
+
/** Block header (BlockHeader instance or BlockHeaderData) */
|
|
8
30
|
header?: BlockHeader | BlockHeaderData;
|
|
31
|
+
/** Array of transactions in this block */
|
|
9
32
|
transactions?: Transaction[];
|
|
10
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Block object interface for serialization/JSON.
|
|
36
|
+
* All values converted to serializable formats.
|
|
37
|
+
*/
|
|
11
38
|
export interface BlockObject {
|
|
39
|
+
/** Block hash (big-endian hex) */
|
|
12
40
|
id: string;
|
|
41
|
+
/** Block hash (big-endian hex, alias for id) */
|
|
13
42
|
hash: string;
|
|
43
|
+
/** Serialized block header object */
|
|
14
44
|
header: BlockHeaderObject;
|
|
45
|
+
/** Array of serialized transaction objects */
|
|
15
46
|
transactions: unknown[];
|
|
16
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Represents a complete Lotus blockchain block.
|
|
50
|
+
*
|
|
51
|
+
* A Block extends the BlockHeader with metadata and transactions, providing
|
|
52
|
+
* methods for serialization, merkle tree computation, and validation.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* // Create from hex string
|
|
57
|
+
* const block = Block.fromString(hexString)
|
|
58
|
+
*
|
|
59
|
+
* // Create from buffer
|
|
60
|
+
* const block = Block.fromBuffer(buffer)
|
|
61
|
+
*
|
|
62
|
+
* // Access block hash
|
|
63
|
+
* console.log(block.id)
|
|
64
|
+
*
|
|
65
|
+
* // Validate merkle root
|
|
66
|
+
* if (block.validMerkleRoot()) {
|
|
67
|
+
* console.log('Merkle root is valid')
|
|
68
|
+
* }
|
|
69
|
+
*
|
|
70
|
+
* // Create SPV proof for specific transactions
|
|
71
|
+
* const merkleBlock = block.toMerkleBlock(['txid1...'])
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
17
74
|
export declare class Block {
|
|
75
|
+
/** Maximum block size (32 MiB) */
|
|
18
76
|
static readonly MAX_BLOCK_SIZE: number;
|
|
77
|
+
/** 32-byte zero hash constant */
|
|
19
78
|
static readonly NULL_HASH: Buffer;
|
|
79
|
+
/** Block header */
|
|
20
80
|
header: BlockHeader;
|
|
81
|
+
/** Transactions in this block */
|
|
21
82
|
transactions: Transaction[];
|
|
83
|
+
/** Cached block hash */
|
|
22
84
|
private _id?;
|
|
85
|
+
/**
|
|
86
|
+
* Create a new Block
|
|
87
|
+
*
|
|
88
|
+
* @param serialized - Input data: BlockData object, Block instance,
|
|
89
|
+
* Buffer, or hex string
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* // From hex string
|
|
94
|
+
* const block = new Block(hexString)
|
|
95
|
+
*
|
|
96
|
+
* // From object
|
|
97
|
+
* const block = new Block({ header: headerData, transactions: [] })
|
|
98
|
+
*
|
|
99
|
+
* // Empty block
|
|
100
|
+
* const block = new Block()
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
23
103
|
constructor(serialized?: BlockData | Block | Buffer | string);
|
|
104
|
+
/**
|
|
105
|
+
* Create a shallow copy of a block by serializing and deserializing it.
|
|
106
|
+
*
|
|
107
|
+
* @param block - Block to copy
|
|
108
|
+
* @returns New Block instance with the same data
|
|
109
|
+
*/
|
|
24
110
|
static shallowCopy(block: Block): Block;
|
|
111
|
+
/**
|
|
112
|
+
* Create a Block from an object containing header and transactions.
|
|
113
|
+
*
|
|
114
|
+
* @param obj - BlockData object
|
|
115
|
+
* @returns New Block instance
|
|
116
|
+
*/
|
|
25
117
|
static fromObject(obj: BlockData): Block;
|
|
118
|
+
/**
|
|
119
|
+
* Create a Block from a BufferReader.
|
|
120
|
+
*
|
|
121
|
+
* @param br - BufferReader positioned at block data
|
|
122
|
+
* @returns New Block instance
|
|
123
|
+
*/
|
|
26
124
|
static fromBufferReader(br: BufferReader): Block;
|
|
125
|
+
/**
|
|
126
|
+
* Create a Block from a Buffer.
|
|
127
|
+
*
|
|
128
|
+
* @param buf - Buffer containing serialized block data
|
|
129
|
+
* @returns New Block instance
|
|
130
|
+
*/
|
|
27
131
|
static fromBuffer(buf: Buffer): Block;
|
|
132
|
+
/**
|
|
133
|
+
* Create a Block from a hex string.
|
|
134
|
+
*
|
|
135
|
+
* @param str - Hex-encoded serialized block
|
|
136
|
+
* @returns New Block instance
|
|
137
|
+
*/
|
|
28
138
|
static fromString(str: string): Block;
|
|
139
|
+
/**
|
|
140
|
+
* Create a Block from raw block data (e.g., from disk or network).
|
|
141
|
+
*
|
|
142
|
+
* @param data - Raw block data as Buffer or binary string
|
|
143
|
+
* @returns New Block instance
|
|
144
|
+
*/
|
|
29
145
|
static fromRawBlock(data: Buffer | string): Block;
|
|
146
|
+
/**
|
|
147
|
+
* Convert to a plain JavaScript object.
|
|
148
|
+
*
|
|
149
|
+
* @returns BlockObject with all values serialized
|
|
150
|
+
*/
|
|
30
151
|
toObject(): BlockObject;
|
|
152
|
+
/**
|
|
153
|
+
* Convert to JSON (alias for toObject)
|
|
154
|
+
*/
|
|
31
155
|
toJSON(): BlockObject;
|
|
156
|
+
/**
|
|
157
|
+
* Serialize the block to a Buffer.
|
|
158
|
+
*
|
|
159
|
+
* Format: header + varint(0 metadata) + varint(tx count) + transactions
|
|
160
|
+
*
|
|
161
|
+
* @returns Buffer containing serialized block data
|
|
162
|
+
*/
|
|
32
163
|
toBuffer(): Buffer;
|
|
164
|
+
/**
|
|
165
|
+
* Serialize the block to a hex string.
|
|
166
|
+
*
|
|
167
|
+
* @returns Hex-encoded serialized block
|
|
168
|
+
*/
|
|
33
169
|
toString(): string;
|
|
170
|
+
/**
|
|
171
|
+
* Write block data to a BufferWriter.
|
|
172
|
+
*
|
|
173
|
+
* Serializes header, metadata vector (currently empty), and transactions
|
|
174
|
+
* to match lotusd CBlock serialization format.
|
|
175
|
+
*
|
|
176
|
+
* @param bw - Optional BufferWriter to reuse
|
|
177
|
+
* @returns BufferWriter containing the serialized block data
|
|
178
|
+
*/
|
|
34
179
|
toBufferWriter(bw?: BufferWriter): BufferWriter;
|
|
180
|
+
/**
|
|
181
|
+
* Compute combined transaction hashes for merkle tree construction.
|
|
182
|
+
*
|
|
183
|
+
* In Lotus, each transaction contributes two identifiers:
|
|
184
|
+
* - **hash**: SHA256d of the serialized transaction data
|
|
185
|
+
* - **txid**: Merkle-based identifier (inputs/outputs merkle roots)
|
|
186
|
+
*
|
|
187
|
+
* These are combined as SHA256d(hash || txid) per transaction.
|
|
188
|
+
*
|
|
189
|
+
* @returns Array of 32-byte hash buffers, one per transaction.
|
|
190
|
+
* Returns [NULL_HASH] if the block has no transactions.
|
|
191
|
+
*/
|
|
35
192
|
getTransactionHashes(): Buffer[];
|
|
193
|
+
/**
|
|
194
|
+
* Build the full merkle tree from transaction hashes.
|
|
195
|
+
*
|
|
196
|
+
* Constructs the tree by iteratively hashing pairs of nodes. If a level
|
|
197
|
+
* has an odd number of elements, a null hash is appended to make it even.
|
|
198
|
+
*
|
|
199
|
+
* @returns Array of Buffers representing all tree nodes.
|
|
200
|
+
* The merkle root is the last element.
|
|
201
|
+
*/
|
|
36
202
|
getMerkleTree(): Buffer[];
|
|
203
|
+
/**
|
|
204
|
+
* Compute the merkle root from the transactions in this block.
|
|
205
|
+
*
|
|
206
|
+
* @returns 32-byte merkle root buffer
|
|
207
|
+
*/
|
|
37
208
|
getMerkleRoot(): Buffer;
|
|
209
|
+
/**
|
|
210
|
+
* Verify that the computed merkle root matches the header merkle root.
|
|
211
|
+
*
|
|
212
|
+
* @returns True if the merkle roots match
|
|
213
|
+
*/
|
|
38
214
|
validMerkleRoot(): boolean;
|
|
215
|
+
/**
|
|
216
|
+
* Create a MerkleBlock containing a partial merkle tree for specific
|
|
217
|
+
* transactions. Used for SPV (Simplified Payment Verification).
|
|
218
|
+
*
|
|
219
|
+
* @param txids - Array of transaction IDs to include in the proof
|
|
220
|
+
* @returns MerkleBlock with partial merkle tree
|
|
221
|
+
*
|
|
222
|
+
* @throws {TypeError} If txids is empty or contains invalid format
|
|
223
|
+
* @throws {Error} If block has no transactions
|
|
224
|
+
*/
|
|
39
225
|
toMerkleBlock(txids: string[]): MerkleBlock;
|
|
226
|
+
/**
|
|
227
|
+
* Block hash in display format (big-endian hex).
|
|
228
|
+
* Delegates to the header hash computation.
|
|
229
|
+
*/
|
|
40
230
|
get hash(): string;
|
|
231
|
+
/**
|
|
232
|
+
* Block ID (alias for hash)
|
|
233
|
+
*/
|
|
41
234
|
get id(): string;
|
|
235
|
+
/**
|
|
236
|
+
* String representation for console/debugging
|
|
237
|
+
*/
|
|
42
238
|
inspect(): string;
|
|
239
|
+
/**
|
|
240
|
+
* Dispatch construction from Buffer or object.
|
|
241
|
+
*/
|
|
43
242
|
private static _from;
|
|
243
|
+
/**
|
|
244
|
+
* Create BlockData from an object, normalizing header and transactions.
|
|
245
|
+
*/
|
|
44
246
|
private static _fromObject;
|
|
247
|
+
/**
|
|
248
|
+
* Read a complete block from a BufferReader.
|
|
249
|
+
*
|
|
250
|
+
* Reads: header + metadata vector + transaction vector
|
|
251
|
+
* (matches lotusd CBlock serialization)
|
|
252
|
+
*/
|
|
45
253
|
private static _readFromBuffer;
|
|
254
|
+
/**
|
|
255
|
+
* Initialize an empty block with default header and no transactions.
|
|
256
|
+
*/
|
|
46
257
|
private _initEmpty;
|
|
258
|
+
/**
|
|
259
|
+
* Deserialize block from a hex string (instance method).
|
|
260
|
+
*/
|
|
47
261
|
private _fromString;
|
|
48
262
|
}
|
|
49
263
|
//# sourceMappingURL=block.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/block/block.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/block/block.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGhC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAG1D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAGrD,OAAO,EACL,WAAW,EACX,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACvB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,WAAW,GAAG,eAAe,CAAA;IACtC,0CAA0C;IAC1C,YAAY,CAAC,EAAE,WAAW,EAAE,CAAA;CAC7B;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAA;IACV,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAA;IACZ,qCAAqC;IACrC,MAAM,EAAE,iBAAiB,CAAA;IACzB,8CAA8C;IAC9C,YAAY,EAAE,OAAO,EAAE,CAAA;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,KAAK;IA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;;;OAIG;IACH,eAAe,IAAI,OAAO;IAM1B;;;;;;;;;OASG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,WAAW;IAgE3C;;;OAGG;IACH,IAAI,IAAI,IAAI,MAAM,CAKjB;IAED;;OAEG;IACH,IAAI,EAAE,IAAI,MAAM,CAEf;IAED;;OAEG;IACH,OAAO,IAAI,MAAM;IAQjB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,KAAK;IASpB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAoB1B;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAwB9B;;OAEG;IACH,OAAO,CAAC,UAAU;IAKlB;;OAEG;IACH,OAAO,CAAC,WAAW;CAMpB"}
|
|
@@ -1,80 +1,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BlockHeader implementation for the Lotus blockchain
|
|
3
|
+
*
|
|
4
|
+
* Represents the header portion of a Lotus block (CBlockHeader in lotusd).
|
|
5
|
+
* Implements the Lotus-specific 3-layer hashing algorithm and custom field
|
|
6
|
+
* sizes for time (6 bytes), size (7 bytes), nonce (8 bytes), etc.
|
|
7
|
+
*
|
|
8
|
+
* Serialization order (160 bytes total):
|
|
9
|
+
* prevHash(32) + bits(4) + time(6) + reserved(2) + nonce(8) +
|
|
10
|
+
* version(1) + size(7) + height(4) + epochBlock(32) +
|
|
11
|
+
* merkleRoot(32) + extendedMetadata(32)
|
|
12
|
+
*
|
|
13
|
+
* Hash algorithm (3-layer SHA256):
|
|
14
|
+
* Layer 3: SHA256(version || size || height || epochBlock || merkleRoot || extendedMetadata)
|
|
15
|
+
* Layer 2: SHA256(bits || time || reserved || nonce || layer3Hash)
|
|
16
|
+
* Layer 1: SHA256(prevHash || layer2Hash)
|
|
17
|
+
*
|
|
18
|
+
* @see lotusd: src/primitives/block.h, src/primitives/block.cpp
|
|
19
|
+
*/
|
|
1
20
|
import { Buffer } from 'buffer/';
|
|
2
21
|
import { BufferReader } from '../encoding/bufferreader.js';
|
|
3
22
|
import { BufferWriter } from '../encoding/bufferwriter.js';
|
|
4
23
|
import { BN } from '../crypto/bn.js';
|
|
24
|
+
/**
|
|
25
|
+
* Block header data interface for internal/deserialized format.
|
|
26
|
+
* Uses native types: Buffer for hashes, BN for large numbers.
|
|
27
|
+
*/
|
|
5
28
|
export interface BlockHeaderData {
|
|
29
|
+
/** Hash of the previous block (32 bytes, little-endian) */
|
|
6
30
|
prevHash?: Buffer;
|
|
31
|
+
/** Compact representation of the target difficulty */
|
|
7
32
|
bits?: number;
|
|
33
|
+
/** Block timestamp in seconds since Unix epoch */
|
|
8
34
|
time?: number;
|
|
35
|
+
/** Reserved field for future use (always 0) */
|
|
9
36
|
reserved?: number;
|
|
37
|
+
/** Nonce used for proof of work (8 bytes) */
|
|
10
38
|
nonce?: BN;
|
|
39
|
+
/** Block header version number (1 byte, always 0x01) */
|
|
11
40
|
version?: number;
|
|
41
|
+
/** Advertised block size (7 bytes) */
|
|
12
42
|
size?: BN;
|
|
43
|
+
/** Block height in the chain */
|
|
13
44
|
height?: number;
|
|
45
|
+
/** Hash of the epoch block (32 bytes, little-endian) */
|
|
14
46
|
epochBlock?: Buffer;
|
|
47
|
+
/** Merkle root of all transactions (32 bytes, little-endian) */
|
|
15
48
|
merkleRoot?: Buffer;
|
|
49
|
+
/** Extended metadata hash (32 bytes, little-endian) */
|
|
16
50
|
extendedMetadata?: Buffer;
|
|
51
|
+
/** Precomputed block hash for validation (display format, big-endian hex) */
|
|
17
52
|
hash?: string;
|
|
18
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Block header object interface for serialization/JSON.
|
|
56
|
+
* All values are converted to serializable formats (strings and numbers).
|
|
57
|
+
* Hash fields are in display format (big-endian hex).
|
|
58
|
+
*/
|
|
19
59
|
export interface BlockHeaderObject {
|
|
60
|
+
/** Computed block hash (big-endian hex) */
|
|
20
61
|
hash: string;
|
|
62
|
+
/** Hash of the previous block (big-endian hex) */
|
|
21
63
|
prevHash: string;
|
|
64
|
+
/** Compact representation of the target difficulty */
|
|
22
65
|
bits: number;
|
|
66
|
+
/** Block timestamp in seconds since Unix epoch */
|
|
23
67
|
time: number;
|
|
68
|
+
/** Reserved field for future use */
|
|
24
69
|
reserved: number;
|
|
70
|
+
/** Nonce as decimal string */
|
|
25
71
|
nonce: string;
|
|
72
|
+
/** Block header version number */
|
|
26
73
|
version: number;
|
|
74
|
+
/** Advertised block size as number */
|
|
27
75
|
size: number;
|
|
76
|
+
/** Block height in the chain */
|
|
28
77
|
height: number;
|
|
78
|
+
/** Hash of the epoch block (big-endian hex) */
|
|
29
79
|
epochBlock: string;
|
|
80
|
+
/** Merkle root of all transactions (big-endian hex) */
|
|
30
81
|
merkleRoot: string;
|
|
82
|
+
/** Extended metadata hash (big-endian hex) */
|
|
31
83
|
extendedMetadata: string;
|
|
32
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Represents a Lotus blockchain block header.
|
|
87
|
+
*
|
|
88
|
+
* Implements the CBlockHeader structure from lotusd with Lotus-specific
|
|
89
|
+
* features including 3-layer SHA256 hashing, 6-byte timestamps, 7-byte
|
|
90
|
+
* block sizes, and epoch block references.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* // Create from buffer
|
|
95
|
+
* const header = BlockHeader.fromBuffer(headerBuffer)
|
|
96
|
+
*
|
|
97
|
+
* // Get block hash
|
|
98
|
+
* console.log(header.id)
|
|
99
|
+
*
|
|
100
|
+
* // Validate proof of work
|
|
101
|
+
* if (header.validProofOfWork()) {
|
|
102
|
+
* console.log('Valid PoW')
|
|
103
|
+
* }
|
|
104
|
+
*
|
|
105
|
+
* // Serialize to buffer
|
|
106
|
+
* const buffer = header.toBuffer()
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
33
109
|
export declare class BlockHeader {
|
|
110
|
+
/** Start buffer position in raw block data */
|
|
34
111
|
static readonly START_OF_HEADER = 0;
|
|
112
|
+
/** Maximum time offset (2 hours) a block timestamp can be ahead of current time */
|
|
35
113
|
static readonly MAX_TIME_OFFSET: number;
|
|
114
|
+
/** Largest possible hash value (2^256) for difficulty calculations */
|
|
36
115
|
static readonly LARGEST_HASH: BN;
|
|
116
|
+
/** Total serialized size of a block header */
|
|
37
117
|
static readonly HEADER_SIZE = 160;
|
|
118
|
+
/** Number of blocks per epoch */
|
|
38
119
|
static readonly EPOCH_NUM_BLOCKS = 5040;
|
|
120
|
+
/** Constants structure for backward compatibility */
|
|
39
121
|
static readonly Constants: {
|
|
40
122
|
START_OF_HEADER: number;
|
|
41
123
|
MAX_TIME_OFFSET: number;
|
|
42
124
|
LARGEST_HASH: BN;
|
|
43
125
|
};
|
|
126
|
+
/** Hash of the previous block (32 bytes, little-endian) */
|
|
44
127
|
readonly prevHash: Buffer;
|
|
128
|
+
/** Compact target difficulty */
|
|
45
129
|
readonly bits: number;
|
|
130
|
+
/** Block timestamp in seconds since Unix epoch */
|
|
46
131
|
readonly time: number;
|
|
132
|
+
/** Alias for time (backward compatibility) */
|
|
47
133
|
readonly timestamp: number;
|
|
134
|
+
/** Reserved field (always 0) */
|
|
48
135
|
readonly reserved: number;
|
|
136
|
+
/** Nonce used for proof of work */
|
|
49
137
|
readonly nonce: BN;
|
|
138
|
+
/** Header version (always 0x01) */
|
|
50
139
|
readonly version: number;
|
|
140
|
+
/** Advertised block size */
|
|
51
141
|
readonly size: BN;
|
|
142
|
+
/** Block height in the chain */
|
|
52
143
|
readonly height: number;
|
|
144
|
+
/** Hash of the epoch block (32 bytes, little-endian) */
|
|
53
145
|
readonly epochBlock: Buffer;
|
|
146
|
+
/** Merkle root of transactions (32 bytes, little-endian) */
|
|
54
147
|
readonly merkleRoot: Buffer;
|
|
148
|
+
/** Extended metadata hash (32 bytes, little-endian) */
|
|
55
149
|
readonly extendedMetadata: Buffer;
|
|
150
|
+
/** Cached block hash (big-endian hex, display format) */
|
|
56
151
|
private _id?;
|
|
152
|
+
/**
|
|
153
|
+
* Create a new BlockHeader
|
|
154
|
+
*
|
|
155
|
+
* @param arg - BlockHeaderData object or existing BlockHeader instance
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```typescript
|
|
159
|
+
* // Empty header with defaults
|
|
160
|
+
* const header = new BlockHeader()
|
|
161
|
+
*
|
|
162
|
+
* // From deserialized data
|
|
163
|
+
* const header = new BlockHeader({ prevHash: buf, bits: 0x1d00ffff, ... })
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
57
166
|
constructor(arg?: BlockHeaderData | BlockHeader);
|
|
167
|
+
/**
|
|
168
|
+
* Create from a BlockHeaderObject (serialized/JSON format).
|
|
169
|
+
* Hash fields are expected in display format (big-endian hex strings).
|
|
170
|
+
*
|
|
171
|
+
* @param obj - BlockHeaderObject with display-format hashes
|
|
172
|
+
* @returns New BlockHeader instance
|
|
173
|
+
*/
|
|
58
174
|
static fromObject(obj: BlockHeaderObject): BlockHeader;
|
|
175
|
+
/**
|
|
176
|
+
* Create from raw block data (binary string or Buffer)
|
|
177
|
+
*
|
|
178
|
+
* @param data - Raw block data
|
|
179
|
+
* @returns New BlockHeader instance
|
|
180
|
+
*/
|
|
59
181
|
static fromRawBlock(data: Buffer | string): BlockHeader;
|
|
182
|
+
/**
|
|
183
|
+
* Create from a Buffer containing a serialized block header
|
|
184
|
+
*
|
|
185
|
+
* @param buf - Buffer with serialized header data
|
|
186
|
+
* @returns New BlockHeader instance
|
|
187
|
+
*/
|
|
60
188
|
static fromBuffer(buf: Buffer): BlockHeader;
|
|
189
|
+
/**
|
|
190
|
+
* Create from a hex string
|
|
191
|
+
*
|
|
192
|
+
* @param str - Hex-encoded serialized block header
|
|
193
|
+
* @returns New BlockHeader instance
|
|
194
|
+
*/
|
|
61
195
|
static fromString(str: string): BlockHeader;
|
|
196
|
+
/**
|
|
197
|
+
* Create from a BufferReader
|
|
198
|
+
*
|
|
199
|
+
* @param br - BufferReader positioned at the start of header data
|
|
200
|
+
* @returns New BlockHeader instance
|
|
201
|
+
*/
|
|
62
202
|
static fromBufferReader(br: BufferReader): BlockHeader;
|
|
203
|
+
/**
|
|
204
|
+
* Convert to a plain JavaScript object (serializable format).
|
|
205
|
+
* Hash fields are in display format (big-endian hex).
|
|
206
|
+
*
|
|
207
|
+
* @returns BlockHeaderObject with all values as strings/numbers
|
|
208
|
+
*/
|
|
63
209
|
toObject(): BlockHeaderObject;
|
|
210
|
+
/**
|
|
211
|
+
* Convert to JSON (alias for toObject)
|
|
212
|
+
*/
|
|
64
213
|
toJSON(): BlockHeaderObject;
|
|
214
|
+
/**
|
|
215
|
+
* Serialize to a Buffer (160 bytes)
|
|
216
|
+
*
|
|
217
|
+
* @returns Buffer containing the serialized block header
|
|
218
|
+
*/
|
|
65
219
|
toBuffer(): Buffer;
|
|
220
|
+
/**
|
|
221
|
+
* Serialize to a hex string
|
|
222
|
+
*
|
|
223
|
+
* @returns Hex-encoded serialized block header
|
|
224
|
+
*/
|
|
66
225
|
toString(): string;
|
|
226
|
+
/**
|
|
227
|
+
* Write header fields to a BufferWriter.
|
|
228
|
+
*
|
|
229
|
+
* Serialization order matches lotusd CBlockHeader::SERIALIZE_METHODS:
|
|
230
|
+
* prevHash(32) + bits(4) + time(6) + reserved(2) + nonce(8) +
|
|
231
|
+
* version(1) + size(7) + height(4) + epochBlock(32) +
|
|
232
|
+
* merkleRoot(32) + extendedMetadata(32)
|
|
233
|
+
*
|
|
234
|
+
* @param bw - Optional BufferWriter to reuse
|
|
235
|
+
* @returns BufferWriter containing the serialized data
|
|
236
|
+
*/
|
|
67
237
|
toBufferWriter(bw?: BufferWriter): BufferWriter;
|
|
238
|
+
/**
|
|
239
|
+
* Block hash in display format (big-endian hex).
|
|
240
|
+
* Computed using the Lotus 3-layer SHA256 algorithm.
|
|
241
|
+
*/
|
|
68
242
|
get hash(): string;
|
|
243
|
+
/**
|
|
244
|
+
* Block ID (alias for hash)
|
|
245
|
+
*/
|
|
69
246
|
get id(): string;
|
|
247
|
+
/**
|
|
248
|
+
* Calculate the target difficulty from compact bits encoding.
|
|
249
|
+
*
|
|
250
|
+
* @param bits - Optional compact bits value (defaults to this.bits)
|
|
251
|
+
* @returns Target as a BN value
|
|
252
|
+
*/
|
|
70
253
|
getTargetDifficulty(bits?: number): BN;
|
|
254
|
+
/**
|
|
255
|
+
* Calculate the human-readable difficulty value.
|
|
256
|
+
*
|
|
257
|
+
* @returns Difficulty as a floating-point number
|
|
258
|
+
*/
|
|
71
259
|
getDifficulty(): number;
|
|
260
|
+
/**
|
|
261
|
+
* Check if the block timestamp is not too far in the future.
|
|
262
|
+
*
|
|
263
|
+
* @returns True if the timestamp is within the acceptable range
|
|
264
|
+
*/
|
|
72
265
|
validTimestamp(): boolean;
|
|
266
|
+
/**
|
|
267
|
+
* Check if the proof-of-work hash satisfies the target difficulty.
|
|
268
|
+
*
|
|
269
|
+
* @returns True if the block hash is below the target
|
|
270
|
+
*/
|
|
73
271
|
validProofOfWork(): boolean;
|
|
272
|
+
/**
|
|
273
|
+
* String representation for console/debugging
|
|
274
|
+
*/
|
|
74
275
|
inspect(): string;
|
|
276
|
+
/**
|
|
277
|
+
* Compute the block hash using the Lotus 3-layer SHA256 algorithm.
|
|
278
|
+
*
|
|
279
|
+
* Layer 3: SHA256(nHeaderVersion || vSize || nHeight || hashEpochBlock || hashMerkleRoot || hashExtendedMetadata)
|
|
280
|
+
* Layer 2: SHA256(nBits || vTime || nReserved || nNonce || layer3Hash)
|
|
281
|
+
* Layer 1: SHA256(hashPrevBlock || layer2Hash)
|
|
282
|
+
*
|
|
283
|
+
* @returns 32-byte hash buffer (little-endian)
|
|
284
|
+
*/
|
|
75
285
|
private _computeHash;
|
|
286
|
+
/**
|
|
287
|
+
* Normalize BlockHeaderData input, filling in defaults for missing fields.
|
|
288
|
+
*/
|
|
76
289
|
private static _normalizeData;
|
|
290
|
+
/**
|
|
291
|
+
* Create default header data (all zeroes).
|
|
292
|
+
*/
|
|
77
293
|
private static _defaultData;
|
|
294
|
+
/**
|
|
295
|
+
* Read header fields from a BufferReader.
|
|
296
|
+
* Order matches lotusd CBlockHeader serialization.
|
|
297
|
+
*/
|
|
78
298
|
private static _readFromBuffer;
|
|
79
299
|
}
|
|
80
300
|
//# sourceMappingURL=blockheader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blockheader.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/block/blockheader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"blockheader.d.ts","sourceRoot":"","sources":["../../../../../lib/bitcore/block/blockheader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGhC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAE1D,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAA;AAWpC;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,EAAE,CAAA;IACV,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,sCAAsC;IACtC,IAAI,CAAC,EAAE,EAAE,CAAA;IACT,gCAAgC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,uDAAuD;IACvD,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,6EAA6E;IAC7E,IAAI,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