How to use the merkle-patricia-tree/secure.prove function in merkle-patricia-tree

To help you get started, we’ve selected a few merkle-patricia-tree examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ethereumjs / ethereumjs-vm / lib / stateless.ts View on Github external
this.origState._getStorageTrie(addr, (err: Error, trie: any) => {
        if (err) return cb(err, null)

        if (trie.root.equals(ethUtil.KECCAK256_RLP)) {
          return cb(null, value)
        }

        SecureTrie.prove(trie, key, (err: Error, proof: Buffer[]) => {
          if (err) return cb(err, null)
          for (const n of proof) {
            const h = ethUtil.keccak256(n)
            this.proofNodes.set(h.toString('hex'), n)
          }
        })
      })
github ethereumjs / ethereumjs-vm / lib / stateless.ts View on Github external
super.getAccount(addr, (err: Error, res: Account) => {
      if (!err && !this.seenKeys.has(addr.toString('hex'))) {
        this.seenKeys.add(addr.toString('hex'))

        const trie = this.origState._trie.copy()

        SecureTrie.prove(trie, addr, (err: Error, proof: Buffer[]) => {
          if (err) {
            return cb(err, null)
          }
          for (const n of proof) {
            const h = ethUtil.keccak256(n)
            this.proofNodes.set(h.toString('hex'), n)
          }
          cb(null, res)
        })
      } else {
        cb(err, res)
      }
    })
  }