Ceramic Network is built to be blockchain-agnostic and multi-platform, with any key able to create and manage Ceramic documents. Ceramic documents are authored by DIDs (decentralized identifiers), which can be managed by any key.
The primary way this happens today is via 3ID Connect, a hosted account management and authentication system for browser-based Ceramic applications. 3ID Connect allows users to onboard to applications and transact with Ceramic documents by signing authentication messages with their blockchain wallets.
New blockchains can be supported through a few simple steps to add the keys and signing methods as a valid authentication method in 3ID Connect. As of this writing, Ethereum, Filecoin, Cosmos and EOS are already supported with several more in progress. This tutorial will detail how to add support for new blockchains.
Try a demo of 3ID Connect here. This is the final part of a three-part series on 3ID Connect. Previous posts:
All of the core functionality for supporting accounts from new blockchains/networks in 3ID and 3ID Connect is provided by the
@cermicnetwork/blockchain-utils-validation packages. These library allows the creation and validation of public links that cryptographically bind a blockchain account to a DID method using Ceramic documents. It also allows 3ID Connect and other similar 3ID account management/authentication libraries to create these public links as well as add the blockchain account as an authentication method capable of controlling a DID.
To add a new blockchain, you will need to implement a few functions in
@ceramicnetwork/blockchain-utils-*. Before beginning, take a peek at the library to explore examples of current blockchain implementations such as Ethereum, Polkadot, and Filecoin. Then, continue with the process outlined below.
Fork the js-ceramic repo
Start out by forking the
js-ceramic repository on Github. This will allow you to make changes locally to the
@cermicnetwork/blockchain-utils-validation packages, and then push everything up in a Pull Request once you're done.
Adhere to CAIP standards
In the interface seen below, note that
AccountID use ChainAgnostic (CAIP) standards.
namespace uses CAIP-2 which specifies a standard id to represent any blockchain and/or network. For example, this is 'eip155' for Ethereum and 'fil' for Filecoin.
AccountID uses CAIP-10 which defines a standardized way to represent any account on any blockchain.
If a CAIP standard for the blockchain or network you want to add support for does not already exist, follow directions in the CAIP Github repo to add it.
Implement support for your blockchain
Implement support for your blockchain in the packages. See the Support new Blockchain guide in the ceramic developer documentation for implementation details.
Open a pull request
Now that you have implemented the required interface and have included the necessary tests with adequate coverage, open a pull request in
js-ceramic. Once reviewed, it will be merged and released.
When opening a pull request, please be sure to minimize the size of new dependencies and/or try to use libraries that are likely shared across blockchain implementations. If you include large, one-off dependencies in your PR, support for the blockchain may not be included by default in other libraries.
Usage in 3ID Connect
After adding support for the blockchain in
js-ceramic, it is easy to use these newly supported blockchain accounts with 3ID Connect. 3ID Connect consumes this functionality through the AuthProvider which you've implemented in the
blockchain-utils-linking package. You can use this AuthProvider directly with 3ID Connect.
This tutorial covered how to implement support for any simple key pair account on any blockchain in 3ID Connect. However, these interfaces also allow support for more complex account implementations such as contract accounts that may support multi-sig accounts and other account or identity features. It may be possible to add support for other types of accounts in the future as well. If you have any interest in implementing or exploring these types, reach out to us on Discord.
Check out the other posts in this three-part series on 3ID Connect:
Reach out in the Ceramic Discord.