Implementing a New Chain Driver

It is very easy to add support for a new blockchain or create your own implementation. All you need to do is implement the ChainDriver interface which only takes around 200 lines of code (see our EthDriver code). If you do this, it would be greatly appreciated if it is shared with us via GitHub or Discord, so we can add it to our Supported Chains!

Development Notes

  • Most of the required logic should already be implemented by existing libraries or APIs of that blockchain (e.g. ethers for Ethereum). Most functions only require you to handle and call one of these functions. For example, isValidAddress(address) => return ethers.utils.isAddress(address).

Importance of Functions

Depending on the needs of your project, you may choose to only implement what is necessary.

Mandatory: These functions are mandatory to be implemented by all ChainDriver implementations. Blockin directly calls and depends on these functions for its core functionality. They must be implemented no matter what. These do not requiring querying the blockchain state and are expected to be offline-compatible.

If all you need is basic signature verification and no additional Blockin features, you only need to implement the following functions.

  • verifySignature

  • parseChallengeStringFromBytesToSign

  • isValidAddress

Mandatory for Asset Sign-Ins: Blockin calls these functions if it requires querying the blockchain in some way. If all you need is signature verifications, you do not need these functions. But if you want to utilize Blockin's additional features such as signing in with assets (NFTs), these must be implemented. Implementations may require the internet (if not using a snapshot) and API keys (dependent on the implementation).

  • verifyAssets

Last updated