ethereumjs-monorepo

@ethereumjs/trie / TrieOpts

Interface: TrieOpts

Table of contents

Properties

Properties

cacheSize

Optional cacheSize: number

LRU cache for trie nodes to allow for faster node retrieval.

Default: 0 (deactivated)

Defined in

packages/trie/src/types.ts:97


common

Optional common: CommonInterface

@ethereumjs/common Common instance (an alternative to passing in a customHashingFunction)

Defined in

packages/trie/src/types.ts:102


db

Optional db: DB<string, string | Uint8Array>

A database instance.

Defined in

packages/trie/src/types.ts:42


keyPrefix

Optional keyPrefix: Uint8Array

Add a prefix to the trie node keys

(potential performance benefits if multiple tries are stored within the same DB, e.g. all storage tries being stored in the outer account state DB)

Defined in

packages/trie/src/types.ts:74


root

Optional root: Uint8Array

A Uint8Array for the root of a previously stored trie

Defined in

packages/trie/src/types.ts:47


useKeyHashing

Optional useKeyHashing: boolean

Create as a secure Trie where the keys are automatically hashed using the keccak256 hash function or alternatively the custom hash function provided. Default: false

This is the flavor of the Trie which is used in production Ethereum networks like Ethereum Mainnet.

Note: This functionality has been refactored along the v5 release and was before provided as a separate inherited class SecureTrie. Just replace with Trie instantiation with useKeyHashing set to true.

Defined in

packages/trie/src/types.ts:61


useKeyHashingFunction

Optional useKeyHashingFunction: HashKeysFunction

Hash function used for hashing trie node and securing key.

Defined in

packages/trie/src/types.ts:66


useNodePruning

Optional useNodePruning: boolean

Flag to prune the trie. When set to true, each time a value is overridden, unreachable nodes will be pruned (deleted) from the trie

Defined in

packages/trie/src/types.ts:90


useRootPersistence

Optional useRootPersistence: boolean

Store the root inside the database after every write operation

Defined in

packages/trie/src/types.ts:84


valueEncoding

Optional valueEncoding: ValueEncoding

ValueEncoding of the database (the values which are put/get in the db are of this type). Defaults to string

Defined in

packages/trie/src/types.ts:79