@ethereumjs/trie / TrieOpts
• Optional
cacheSize: number
LRU cache for trie nodes to allow for faster node retrieval.
Default: 0 (deactivated)
• Optional
common: CommonInterface
@ethereumjs/common Common
instance (an alternative to passing in a customHashingFunction
)
packages/trie/src/types.ts:102
• Optional
db: DB
<string
, string
| Uint8Array
>
A database instance.
• 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)
• Optional
root: Uint8Array
A Uint8Array
for the root of a previously stored trie
• 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
.
• Optional
useKeyHashingFunction: HashKeysFunction
Hash function used for hashing trie node and securing key.
• 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
• Optional
useRootPersistence: boolean
Store the root inside the database after every write
operation
• Optional
valueEncoding: ValueEncoding
ValueEncoding of the database (the values which are put
/get
in the db are of this type). Defaults to string