To use the ChainPatrol SDK, you’ll need an API key. You can get one by emailing [email protected].

The most common use-case for using the ChainPatrol SDK is to provide scam detection in a browser extension-based wallet (ex. Metamask).

The code snippet below shows how to use the SDK in the background script of a browser extension, demonstrating 4 core concepts:

  • Instantiating the ThreatDetector
  • Listening for navigation events
  • Using the ThreatDetector to check a URL, and redirecting the user if the URL is a scam
  • Handling events from the warning page using the Relay class to forward events

These concepts are generally applicable to other environments as well. For example if you’re using the SDK in a messaging web application, instead of listening for navigation events using chrome.webNavigation, you would listen for navigation events for links clicked in the application, or you could instead wait until the user initiates a transaction and check the URL that initiated the transaction.

The next sections of the documentation will go into more detail about the different classes exported by the SDK, and how to use them.