# Using providers

As explained previously, the 0xcert Framework tends to be platform-agnostic, meaning that it is not created for merely one blockchain or one specific platform. It aims to provide a consistently optimal developing experience, regardless of the platform you employ.

Each provider operates on the same principles, but can also have its own distinctive characteristics. The current version of the Framework supports the Ethereum and the Wanchain blockchain. Soon, more platforms will be added.

Even within the same blockchain, multiple providers are available depending on your needs. If you would like to communicate with blockchain on the front-end, you would use MetamaskProvider, while for communication on the back-end you would use HttpProvider. For more information about other providers for Ethereum such as Bitski, please click here, and to learn more about providers for Wanchain, please click here.

Learn by example

Click here to check the live example for this section.

# Installation process

The 0xcert Framework supports multiple providers that enable the communication with platforms. However, in this guide, we will employ an example on the most common and straightforward blockchain provider called MetaMask, which allows for communication with the Ethereum network in the browser.

MetaMask is a popular plug-in that allows you to create and store the private keys for your Ethereum account inside your browser or mobile device. It works as a bridge between your browser and the Ethereum blockchain through its own infrastructure. MetaMask can also be paired with hardware wallets such as Ledger or Trezor.

We recommend you employ the provider module as an NPM package in your application.

$ npm i --save @0xcert/ethereum-metamask-provider

On our official GitHub repository, we also host a compiled and minimized JavaScript file that can be directly implemented in your website. Please refer to the API section to learn more about other providers.

# Usage overview

To start developing the application, we have to first instantiate the MetamaskProvider provider class. This is usually only needed once within the application.

import { MetamaskProvider } from '@0xcert/ethereum-metamask-provider';

const provider = new MetamaskProvider();

MetaMask needs to be authorized and unlocked to be used on the website. This is specific to this provider. Therefore, before you start interacting with the Ethereum node, you should check whether the MetaMask account has been enabled. If not, you have to enable it, as shown in the example below.

if (!await provider.isEnabled()) {
    await provider.enable();

Now that we're connected to the Ethereum blockchain, we can begin performing query and mutation requests.


When you connect to MetaMask, provider.accountId represents your selected account.


Make sure your MetaMask is connected to the Ethereum Ropsten network.


To perform this deployment step, you'll need to pay some gas on the Ethereum network. You can get free Ether into your wallet on the Ropsten network via this link.

Our connection to the blockchain is now successfully established. Next off, we will learn about assets and how to use them within our framework.