@@ -32,6 +32,7 @@ An object that represents the block.
3232* [ serialize] ( _block_.block.md#serialize )
3333* [ toJSON] ( _block_.block.md#tojson )
3434* [ validate] ( _block_.block.md#validate )
35+ * [ validateData] ( _block_.block.md#validatedata )
3536* [ validateDifficulty] ( _block_.block.md#validatedifficulty )
3637* [ validateGasLimit] ( _block_.block.md#validategaslimit )
3738* [ validateTransactions] ( _block_.block.md#validatetransactions )
@@ -49,7 +50,7 @@ An object that represents the block.
4950
5051\+ ** new Block** (` header? ` : [ BlockHeader] ( _header_.blockheader.md ) , ` transactions ` : Transaction[ ] , ` uncleHeaders ` : [ BlockHeader] ( _header_.blockheader.md ) [ ] , ` opts ` : [ BlockOptions] ( ../interfaces/_index_.blockoptions.md ) ): * [ Block] ( _block_.block.md ) *
5152
52- * Defined in [ block.ts:82 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L82 ) *
53+ * Defined in [ block.ts:92 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L92 ) *
5354
5455This constructor takes the values, validates them, assigns them and freezes the object.
5556Use the static factory methods to assist in creating a Block object from varying data types and options.
111112
112113▸ ** canonicalDifficulty** (` parentBlock ` : [ Block] ( _block_.block.md ) ): * BN*
113114
114- * Defined in [ block.ts:245 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L245 ) *
115+ * Defined in [ block.ts:286 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L286 ) *
115116
116117Returns the canonical difficulty for this block.
117118
129130
130131▸ ** genTxTrie** (): * Promise‹void›*
131132
132- * Defined in [ block.ts:137 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L137 ) *
133+ * Defined in [ block.ts:150 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L150 ) *
133134
134135Generates transaction trie for validation.
135136
141142
142143▸ ** hash** (): * Buffer*
143144
144- * Defined in [ block.ts:116 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L116 ) *
145+ * Defined in [ block.ts:129 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L129 ) *
145146
146147Produces a hash the RLP of the block.
147148
153154
154155▸ ** isGenesis** (): * boolean*
155156
156- * Defined in [ block.ts:123 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L123 ) *
157+ * Defined in [ block.ts:136 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L136 ) *
157158
158159Determines if this block is the genesis block.
159160
165166
166167▸ ** raw** (): * [ BlockBuffer] ( ../modules/_index_.md#blockbuffer ) *
167168
168- * Defined in [ block.ts:105 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L105 ) *
169+ * Defined in [ block.ts:118 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L118 ) *
169170
170171 Returns a Buffer Array of the raw Buffers of this block, in order.
171172
177178
178179▸ ** serialize** (): * Buffer*
179180
180- * Defined in [ block.ts:130 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L130 ) *
181+ * Defined in [ block.ts:143 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L143 ) *
181182
182183Returns the rlp encoding of the block.
183184
189190
190191▸ ** toJSON** (): * [ JsonBlock] ( ../interfaces/_index_.jsonblock.md ) *
191192
192- * Defined in [ block.ts:270 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L270 ) *
193+ * Defined in [ block.ts:312 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L312 ) *
193194
194195Returns the block in JSON format.
195196
@@ -199,17 +200,41 @@ ___
199200
200201### validate
201202
202- ▸ ** validate** (` blockchain? ` : [ Blockchain] ( ../interfaces/_index_.blockchain.md ) ): * Promise‹void›*
203+ ▸ ** validate** (` blockchain ` : [ Blockchain] ( ../interfaces/_index_.blockchain.md ) ): * Promise‹void›*
204+
205+ * Defined in [ block.ts:209] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L209 ) *
203206
204- * Defined in [ block.ts:188 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L188 ) *
207+ Performs the following consistency checks on the block:
205208
206- Validates the block, throwing if invalid.
209+ - Value checks on the header fields
210+ - Signature and gasLimit validation for included txs
211+ - Validation of the tx trie
212+ - Consistency checks and header validation of included uncles
213+
214+ Throws if invalid.
207215
208216** Parameters:**
209217
210218Name | Type | Description |
211219------ | ------ | ------ |
212- ` blockchain? ` | [ Blockchain] ( ../interfaces/_index_.blockchain.md ) | additionally validate against a @ethereumjs/blockchain |
220+ ` blockchain ` | [ Blockchain] ( ../interfaces/_index_.blockchain.md ) | validate against a @ethereumjs/blockchain |
221+
222+ ** Returns:** * Promise‹void›*
223+
224+ ___
225+
226+ ### validateData
227+
228+ ▸ ** validateData** (): * Promise‹void›*
229+
230+ * Defined in [ block.ts:222] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L222 ) *
231+
232+ Validates the block data, throwing if invalid.
233+ This can be checked on the Block itself without needing access to any parent block
234+ It checks:
235+ - All transactions are valid
236+ - The transactions trie is valid
237+ - The uncle hash is valid
213238
214239** Returns:** * Promise‹void›*
215240
219244
220245▸ ** validateDifficulty** (` parentBlock ` : [ Block] ( _block_.block.md ) ): * boolean*
221246
222- * Defined in [ block.ts:254 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L254 ) *
247+ * Defined in [ block.ts:295 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L295 ) *
223248
224249Checks that the block's ` difficulty ` matches the canonical difficulty.
225250
237262
238263▸ ** validateGasLimit** (` parentBlock ` : [ Block] ( _block_.block.md ) ): * boolean*
239264
240- * Defined in [ block.ts:263 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L263 ) *
265+ * Defined in [ block.ts:305 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L305 ) *
241266
242- Validates the gasLimit.
267+ Validates if the block gasLimit remains in the
268+ boundaries set by the protocol.
243269
244270** Parameters:**
245271
@@ -255,15 +281,15 @@ ___
255281
256282▸ ** validateTransactions** (): * boolean*
257283
258- * Defined in [ block.ts:167 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L167 ) *
284+ * Defined in [ block.ts:181 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L181 ) *
259285
260- Validates the transactions .
286+ Validates transaction signatures and minimum gas requirements .
261287
262288** Returns:** * boolean*
263289
264290▸ ** validateTransactions** (` stringError ` : false): * boolean*
265291
266- * Defined in [ block.ts:168 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L168 ) *
292+ * Defined in [ block.ts:182 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L182 ) *
267293
268294** Parameters:**
269295
@@ -275,7 +301,7 @@ Name | Type |
275301
276302▸ ** validateTransactions** (` stringError ` : true): * string[ ] *
277303
278- * Defined in [ block.ts:169 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L169 ) *
304+ * Defined in [ block.ts:183 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L183 ) *
279305
280306** Parameters:**
281307
@@ -291,27 +317,39 @@ ___
291317
292318▸ ** validateTransactionsTrie** (): * Promise‹boolean›*
293319
294- * Defined in [ block.ts:150 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L150 ) *
320+ * Defined in [ block.ts:164 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L164 ) *
295321
296- Validates the transaction trie.
322+ Validates the transaction trie by generating a trie
323+ and do a check on the root hash.
297324
298325** Returns:** * Promise‹boolean›*
299326
300327___
301328
302329### validateUncles
303330
304- ▸ ** validateUncles** (` blockchain? ` : [ Blockchain] ( ../interfaces/_index_.blockchain.md ) ): * Promise‹void›*
331+ ▸ ** validateUncles** (` blockchain ` : [ Blockchain] ( ../interfaces/_index_.blockchain.md ) ): * Promise‹void›*
332+
333+ * Defined in [ block.ts:262] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L262 ) *
305334
306- * Defined in [ block.ts:221] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L221 ) *
335+ Consistency checks and header validation for uncles included,
336+ in the block, if any.
307337
308- Validates the uncles that are in the block, if any. This method throws if they are invalid.
338+ Throws if invalid.
339+
340+ The rules of uncles are the following:
341+ Uncle Header is a valid header.
342+ Uncle Header is an orphan, i.e. it is not one of the headers of the canonical chain.
343+ Uncle Header has a parentHash which points to the canonical chain. This parentHash is within the last 7 blocks.
344+ Uncle Header is not already included as uncle in another block.
345+ Header has at most 2 uncles.
346+ Header does not count an uncle twice.
309347
310348** Parameters:**
311349
312350Name | Type | Description |
313351------ | ------ | ------ |
314- ` blockchain? ` | [ Blockchain] ( ../interfaces/_index_.blockchain.md ) | additionally validate against a @ethereumjs/blockchain |
352+ ` blockchain ` | [ Blockchain] ( ../interfaces/_index_.blockchain.md ) | additionally validate against an @ethereumjs/blockchain instance |
315353
316354** Returns:** * Promise‹void›*
317355
321359
322360▸ ** validateUnclesHash** (): * boolean*
323361
324- * Defined in [ block.ts:211 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L211 ) *
362+ * Defined in [ block.ts:241 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L241 ) *
325363
326364Validates the uncle's hash.
327365
331369
332370### ` Static ` fromBlockData
333371
334- ▸ ** fromBlockData** (` blockData ` : [ BlockData] ( ../interfaces/_index_.blockdata.md ) , ` opts ` : [ BlockOptions] ( ../interfaces/_index_.blockoptions.md ) ): * [ Block] ( _block_.block.md ) ‹›*
372+ ▸ ** fromBlockData** (` blockData ` : [ BlockData] ( ../interfaces/_index_.blockdata.md ) , ` opts? ` : [ BlockOptions] ( ../interfaces/_index_.blockoptions.md ) ): * [ Block] ( _block_.block.md ) ‹›*
335373
336374* Defined in [ block.ts:20] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L20 ) *
337375
@@ -340,51 +378,51 @@ ___
340378Name | Type | Default |
341379------ | ------ | ------ |
342380` blockData ` | [ BlockData] ( ../interfaces/_index_.blockdata.md ) | {} |
343- ` opts ` | [ BlockOptions] ( ../interfaces/_index_.blockoptions.md ) | {} |
381+ ` opts? ` | [ BlockOptions] ( ../interfaces/_index_.blockoptions.md ) | - |
344382
345383** Returns:** * [ Block] ( _block_.block.md ) ‹›*
346384
347385___
348386
349387### ` Static ` fromRLPSerializedBlock
350388
351- ▸ ** fromRLPSerializedBlock** (` serialized ` : Buffer, ` opts ` : [ BlockOptions] ( ../interfaces/_index_.blockoptions.md ) ): * [ Block] ( _block_.block.md ) ‹›*
389+ ▸ ** fromRLPSerializedBlock** (` serialized ` : Buffer, ` opts? ` : [ BlockOptions] ( ../interfaces/_index_.blockoptions.md ) ): * [ Block] ( _block_.block.md ) ‹›*
352390
353- * Defined in [ block.ts:42 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L42 ) *
391+ * Defined in [ block.ts:46 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L46 ) *
354392
355393** Parameters:**
356394
357- Name | Type | Default |
358- ------ | ------ | ------ |
359- ` serialized ` | Buffer | - |
360- ` opts ` | [ BlockOptions] ( ../interfaces/_index_.blockoptions.md ) | {} |
395+ Name | Type |
396+ ------ | ------ |
397+ ` serialized ` | Buffer |
398+ ` opts? ` | [ BlockOptions] ( ../interfaces/_index_.blockoptions.md ) |
361399
362400** Returns:** * [ Block] ( _block_.block.md ) ‹›*
363401
364402___
365403
366404### ` Static ` fromValuesArray
367405
368- ▸ ** fromValuesArray** (` values ` : [ BlockBuffer] ( ../modules/_index_.md#blockbuffer ) , ` opts ` : [ BlockOptions] ( ../interfaces/_index_.blockoptions.md ) ): * [ Block] ( _block_.block.md ) ‹›*
406+ ▸ ** fromValuesArray** (` values ` : [ BlockBuffer] ( ../modules/_index_.md#blockbuffer ) , ` opts? ` : [ BlockOptions] ( ../interfaces/_index_.blockoptions.md ) ): * [ Block] ( _block_.block.md ) ‹›*
369407
370- * Defined in [ block.ts:52 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L52 ) *
408+ * Defined in [ block.ts:56 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L56 ) *
371409
372410** Parameters:**
373411
374- Name | Type | Default |
375- ------ | ------ | ------ |
376- ` values ` | [ BlockBuffer] ( ../modules/_index_.md#blockbuffer ) | - |
377- ` opts ` | [ BlockOptions] ( ../interfaces/_index_.blockoptions.md ) | {} |
412+ Name | Type |
413+ ------ | ------ |
414+ ` values ` | [ BlockBuffer] ( ../modules/_index_.md#blockbuffer ) |
415+ ` opts? ` | [ BlockOptions] ( ../interfaces/_index_.blockoptions.md ) |
378416
379417** Returns:** * [ Block] ( _block_.block.md ) ‹›*
380418
381419___
382420
383421### ` Static ` genesis
384422
385- ▸ ** genesis** (` blockData ` : [ BlockData] ( ../interfaces/_index_.blockdata.md ) , ` opts ` : [ BlockOptions] ( ../interfaces/_index_.blockoptions.md ) ): * [ Block] ( _block_.block.md ) ‹›*
423+ ▸ ** genesis** (` blockData ` : [ BlockData] ( ../interfaces/_index_.blockdata.md ) , ` opts? ` : [ BlockOptions] ( ../interfaces/_index_.blockoptions.md ) ): * [ Block] ( _block_.block.md ) ‹›*
386424
387- * Defined in [ block.ts:79 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L79 ) *
425+ * Defined in [ block.ts:89 ] ( https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L89 ) *
388426
389427Alias for Block.fromBlockData() with initWithGenesisHeader set to true.
390428
@@ -393,6 +431,6 @@ Alias for Block.fromBlockData() with initWithGenesisHeader set to true.
393431Name | Type | Default |
394432------ | ------ | ------ |
395433` blockData ` | [ BlockData] ( ../interfaces/_index_.blockdata.md ) | {} |
396- ` opts ` | [ BlockOptions] ( ../interfaces/_index_.blockoptions.md ) | {} |
434+ ` opts? ` | [ BlockOptions] ( ../interfaces/_index_.blockoptions.md ) | - |
397435
398436** Returns:** * [ Block] ( _block_.block.md ) ‹›*
0 commit comments