> For the complete documentation index, see [llms.txt](https://blockin.gitbook.io/blockin/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://blockin.gitbook.io/blockin/developer-docs/getting-started/chaindrivers/setting-chain-drivers.md).

# Setting Chain Drivers

With custom implementations (not outsourced), you can implement and setup your own ChainDrivers. Mix and match drivers as you wish according to your application's requirements. See [Supported Chains](/blockin/developer-docs/getting-started/chaindrivers/list-of-implemented-chain-drivers.md) to see some already implemented ChainDrivers, or see [Adding a New Chain](/blockin/developer-docs/getting-started/chaindrivers/implementing-a-new-chain-driver.md) for how to create your own!

1\) For each chain you want to support in your application, you will need a ChainDriver implementation for that blockchain (see below). You can either implement the interface yourself (see [Adding a New Chain](/blockin/developer-docs/getting-started/chaindrivers/implementing-a-new-chain-driver.md)), or Blockin and its community provide some already implemented ChainDrivers (see [Supported Chains](/blockin/developer-docs/getting-started/chaindrivers/list-of-implemented-chain-drivers.md)) that you import (or use as starting points).

2\) Once you have your ChainDriver implementations that you want to use in your application, you will need to handle getting it where needed.

<pre class="language-typescript"><code class="lang-typescript"><strong>import EthDriver from './EthDriver';
</strong>import CosmosDriver from './CosmosDriver';
import SolDriver from './SolDriver';
import BtcDriver from './BtcDriver';

const ethDriver = new EthDriver('0x1', undefined);
const solDriver = new SolDriver('');
const cosmosDriver = new CosmosDriver('bitbadges_1-1');

export const getChainDriver = (chain: string) => {
  switch (chain) {
    case 'Cosmos':
      return cosmosDriver;
    case 'Ethereum':
      return ethDriver;
    case 'Solana':
      return solDriver;
    default:
      return ethDriver;
  }
}

//getChainDriver(...).verifySignature(...); //Use one of the driver's functions
//verifyChallenge(chainDriver, .....)
</code></pre>

**Option 1 - Directly Import:** For the Blockin built or preexisting drivers, if all you need is the standard out of the box functionality you can install pre-existing ChainDrivers via:

```
npm i blockin-eth-driver
npm i blockin-cosmos-driver
npm i blockin-algo-driver
```

and

```typescript
import { setChainDriver, ... } from 'blockin';
import AlgoDriver from 'blockin-algo-driver';
import EthDriver from 'blockin-eth-driver';
...
const EthereumDriver = new EthDriver(...);
const AlgorandDriver = new AlgoDriver(...);
```

**Option 2 - Copy/Paste (Recommended):** However, we actually find it a lot more flexible to simply copy and paste the driver files such as <https://github.com/Blockin-Labs/blockin-eth-driver/tree/main/src> and use them directly in your project that way instead of importing via a library. They are small (only \~200 lines of code), and this allows you to perform minor tweaks and customization as needed, as well as seeing how they work behind the scenes.

```typescript
import EthDriver from './customImplementation/EthDriver';
const EthereumDriver = new EthDriver(...);
```

See <https://github.com/BitBadges/bitbadges-indexer/tree/master/src/blockin>.&#x20;

**Option 3 - Implement Your Own:** Implement your own from scratch!


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://blockin.gitbook.io/blockin/developer-docs/getting-started/chaindrivers/setting-chain-drivers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
