Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/chainsafe/chainbridge-ethereum-trie

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/chainsafe/chainbridge-ethereum-trie

  • v0.0.0-20210330141217-8026f463c3e6
  • Source
  • Go
  • Socket score

Version published
Created
Source

chainbridge-ethereum-trie

This package exposes the transaction trie from go-ethereum, so it can be used to (re)construct tries and compute proofs.

Example Usage

Here is an example of how this library could be used.

// assume trieDB is some already instantiated leveldb instance
// assume the listener has retrieved the transactions root (txRoot), transactions (txList), and key of the transaction of interest (txPath) for some block while polling

// instantiate new instance of TxTries object
txTries := NewTxTries(3)

// add new trie to the txtries object with relevant txRoot, transactions, and triedb
txTries.AddNewTrie(txRoot, txList, trieDB)

// we can retrieve a proof for our transaction of interest and verify it as follows
txProof := txTries.RetrieveProof(txRoot, txPath)
exists := VerifyProof(txRoot, txPath, txProof)

if exists {
    // we know the transaction exists in our trie
    // perform some action
}

// we can also retrieve the encoded version of the proof for our transaction of interest as follows:
encodedTxProof := txTries.RetrieveEncodedProof(txRoot, txPath)

FAQs

Package last updated on 30 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc