4
4
5
5
This class stores and interacts with blocks.
6
6
7
- _ ** remarks** _ : This class performs write operations. Making a backup of your data before trying this module is recommended. Otherwise, you can end up with a compromised DB state.
8
-
9
7
## Hierarchy
10
8
11
9
** Blockchain**
@@ -54,7 +52,7 @@ _**remarks**_: This class performs write operations. Making a backup of your dat
54
52
55
53
⊕ ** new Blockchain** (opts?: _ [ BlockchainOptions] ( ../interfaces/blockchainoptions.md ) _ ): [ Blockchain] ( blockchain.md )
56
54
57
- _ Defined in [ index.ts:131 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/f54802f /src/index.ts#L131 ) _
55
+ _ Defined in [ index.ts:127 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/29a8a30 /src/index.ts#L127 ) _
58
56
59
57
Creates new Blockchain object
60
58
@@ -80,7 +78,7 @@ The old separated DB constructor parameters `opts.blockDB` and `opts.detailsDb`
80
78
81
79
** ● db** : _ ` any ` _
82
80
83
- _ Defined in [ index.ts:124 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/f54802f /src/index.ts#L124 ) _
81
+ _ Defined in [ index.ts:120 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/29a8a30 /src/index.ts#L120 ) _
84
82
85
83
---
86
84
@@ -90,7 +88,7 @@ _Defined in [index.ts:124](https://github.com/ethereumjs/ethereumjs-blockchain/b
90
88
91
89
** ● dbManager** : _ ` DBManager ` _
92
90
93
- _ Defined in [ index.ts:125 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/f54802f /src/index.ts#L125 ) _
91
+ _ Defined in [ index.ts:121 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/29a8a30 /src/index.ts#L121 ) _
94
92
95
93
---
96
94
@@ -100,7 +98,7 @@ _Defined in [index.ts:125](https://github.com/ethereumjs/ethereumjs-blockchain/b
100
98
101
99
** ● ethash** : _ ` any ` _
102
100
103
- _ Defined in [ index.ts:126 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/f54802f /src/index.ts#L126 ) _
101
+ _ Defined in [ index.ts:122 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/29a8a30 /src/index.ts#L122 ) _
104
102
105
103
---
106
104
@@ -110,7 +108,7 @@ _Defined in [index.ts:126](https://github.com/ethereumjs/ethereumjs-blockchain/b
110
108
111
109
** ● validate** : _ ` boolean ` _
112
110
113
- _ Defined in [ index.ts:131 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/f54802f /src/index.ts#L131 ) _
111
+ _ Defined in [ index.ts:127 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/29a8a30 /src/index.ts#L127 ) _
114
112
115
113
A flag indicating if this Blockchain validates blocks or not.
116
114
@@ -124,7 +122,7 @@ A flag indicating if this Blockchain validates blocks or not.
124
122
125
123
** get meta** (): ` object `
126
124
127
- _ Defined in [ index.ts:186 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/f54802f /src/index.ts#L186 ) _
125
+ _ Defined in [ index.ts:182 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/29a8a30 /src/index.ts#L182 ) _
128
126
129
127
Returns an object with metadata about the Blockchain. It's defined for backwards compatibility.
130
128
@@ -140,7 +138,7 @@ Returns an object with metadata about the Blockchain. It's defined for backwards
140
138
141
139
▸ ** delBlock** (blockHash: _ ` Buffer ` _ , cb: _ ` any ` _ ): ` void `
142
140
143
- _ Defined in [ index.ts:834 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/f54802f /src/index.ts#L834 ) _
141
+ _ Defined in [ index.ts:830 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/29a8a30 /src/index.ts#L830 ) _
144
142
145
143
Deletes a block from the blockchain. All child blocks in the chain are deleted and any encountered heads are set to the parent block.
146
144
@@ -161,7 +159,7 @@ Deletes a block from the blockchain. All child blocks in the chain are deleted a
161
159
162
160
▸ ** getBlock** (blockTag: _ ` Buffer ` \| ` number ` \| ` BN ` _ , cb: _ ` any ` _ ): ` void `
163
161
164
- _ Defined in [ index.ts:571 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/f54802f /src/index.ts#L571 ) _
162
+ _ Defined in [ index.ts:567 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/29a8a30 /src/index.ts#L567 ) _
165
163
166
164
Gets a block by its hash.
167
165
@@ -182,7 +180,7 @@ Gets a block by its hash.
182
180
183
181
▸ ** getBlocks** (blockId: _ ` Buffer ` \| ` number ` _ , maxBlocks: _ ` number ` _ , skip: _ ` number ` _ , reverse: _ ` boolean ` _ , cb: _ ` any ` _ ): ` void `
184
182
185
- _ Defined in [ index.ts:594 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/f54802f /src/index.ts#L594 ) _
183
+ _ Defined in [ index.ts:590 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/29a8a30 /src/index.ts#L590 ) _
186
184
187
185
Looks up many blocks relative to blockId
188
186
@@ -206,7 +204,7 @@ Looks up many blocks relative to blockId
206
204
207
205
▸ ** getDetails** (\_ : _ ` string ` _ , cb: _ ` any ` _ ): ` void `
208
206
209
- _ Defined in [ index.ts:635 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/f54802f /src/index.ts#L635 ) _
207
+ _ Defined in [ index.ts:631 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/29a8a30 /src/index.ts#L631 ) _
210
208
211
209
This method used to return block details by its hash. It's only here for backwards compatibility.
212
210
@@ -229,7 +227,7 @@ _**deprecated**_:
229
227
230
228
▸ ** getHead** (name: _ ` any ` _ , cb?: _ ` any ` _ ): ` void `
231
229
232
- _ Defined in [ index.ts:282 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/f54802f /src/index.ts#L282 ) _
230
+ _ Defined in [ index.ts:278 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/29a8a30 /src/index.ts#L278 ) _
233
231
234
232
Returns the specified iterator head.
235
233
@@ -250,7 +248,7 @@ Returns the specified iterator head.
250
248
251
249
▸ ** getLatestBlock** (cb: _ ` any ` _ ): ` void `
252
250
253
- _ Defined in [ index.ts:322 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/f54802f /src/index.ts#L322 ) _
251
+ _ Defined in [ index.ts:318 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/29a8a30 /src/index.ts#L318 ) _
254
252
255
253
Returns the latest full block in the canonical chain.
256
254
@@ -270,7 +268,7 @@ Returns the latest full block in the canonical chain.
270
268
271
269
▸ ** getLatestHeader** (cb: _ ` any ` _ ): ` void `
272
270
273
- _ Defined in [ index.ts:305 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/f54802f /src/index.ts#L305 ) _
271
+ _ Defined in [ index.ts:301 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/29a8a30 /src/index.ts#L301 ) _
274
272
275
273
Returns the latest header in the canonical chain.
276
274
@@ -290,7 +288,7 @@ Returns the latest header in the canonical chain.
290
288
291
289
▸ ** iterator** (name: _ ` string ` _ , onBlock: _ ` any ` _ , cb: _ ` any ` _ ): ` void `
292
290
293
- _ Defined in [ index.ts:968 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/f54802f /src/index.ts#L968 ) _
291
+ _ Defined in [ index.ts:964 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/29a8a30 /src/index.ts#L964 ) _
294
292
295
293
Iterates through blocks starting at the specified iterator head and calls the onBlock function on each block. The current location of an iterator head can be retrieved using the ` getHead() ` method.
296
294
@@ -312,7 +310,7 @@ Iterates through blocks starting at the specified iterator head and calls the on
312
310
313
311
▸ ** putBlock** (block: _ ` object ` _ , cb: _ ` any ` _ , isGenesis?: _ ` undefined ` \| ` false ` \| ` true ` _ ): ` void `
314
312
315
- _ Defined in [ index.ts:351 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/f54802f /src/index.ts#L351 ) _
313
+ _ Defined in [ index.ts:347 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/29a8a30 /src/index.ts#L347 ) _
316
314
317
315
Adds a block to the blockchain.
318
316
@@ -334,7 +332,7 @@ Adds a block to the blockchain.
334
332
335
333
▸ ** putBlocks** (blocks: _ ` Array ` <` any ` >_ , cb: _ ` any ` _ ): ` void `
336
334
337
- _ Defined in [ index.ts:335 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/f54802f /src/index.ts#L335 ) _
335
+ _ Defined in [ index.ts:331 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/29a8a30 /src/index.ts#L331 ) _
338
336
339
337
Adds many blocks to the blockchain.
340
338
@@ -355,7 +353,7 @@ Adds many blocks to the blockchain.
355
353
356
354
▸ ** putGenesis** (genesis: _ ` any ` _ , cb: _ ` any ` _ ): ` void `
357
355
358
- _ Defined in [ index.ts:272 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/f54802f /src/index.ts#L272 ) _
356
+ _ Defined in [ index.ts:268 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/29a8a30 /src/index.ts#L268 ) _
359
357
360
358
Puts the genesis block in the database
361
359
@@ -376,7 +374,7 @@ Puts the genesis block in the database
376
374
377
375
▸ ** putHeader** (header: _ ` object ` _ , cb: _ ` any ` _ ): ` void `
378
376
379
- _ Defined in [ index.ts:383 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/f54802f /src/index.ts#L383 ) _
377
+ _ Defined in [ index.ts:379 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/29a8a30 /src/index.ts#L379 ) _
380
378
381
379
Adds a header to the blockchain.
382
380
@@ -397,7 +395,7 @@ Adds a header to the blockchain.
397
395
398
396
▸ ** putHeaders** (headers: _ ` Array ` <` any ` >_ , cb: _ ` any ` _ ): ` void `
399
397
400
- _ Defined in [ index.ts:367 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/f54802f /src/index.ts#L367 ) _
398
+ _ Defined in [ index.ts:363 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/29a8a30 /src/index.ts#L363 ) _
401
399
402
400
Adds many headers to the blockchain.
403
401
@@ -418,7 +416,7 @@ Adds many headers to the blockchain.
418
416
419
417
▸ ** selectNeededHashes** (hashes: _ ` Array ` <` any ` >_ , cb: _ ` any ` _ ): ` void `
420
418
421
- _ Defined in [ index.ts:645 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/f54802f /src/index.ts#L645 ) _
419
+ _ Defined in [ index.ts:641 ] ( https://github.com/ethereumjs/ethereumjs-blockchain/blob/29a8a30 /src/index.ts#L641 ) _
422
420
423
421
Given an ordered array, returns to the callback an array of hashes that are not in the blockchain yet.
424
422
0 commit comments