# Getting Started

{% hint style="info" %}
**Prerequisite:** You should have installed Node.js (version 18.10.0 or higher).
{% endhint %}

Install the npm package to get started with the Bastion SDK.

{% code title="In your terminal" %}

```bash
npm install --save bastion-wallet-sdk

OR

yarn add bastion-wallet-sdk
```

{% endcode %}

#### Step 0 - Create an API key

First, go to the [Bastion Dashboard](https://dashboard.bastionwallet.io/) and create an API key.

<figure><img src="https://1377651667-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJq2b09x9CbE3suSqM0QW%2Fuploads%2FhJjs1Vdx7Dg2dkItOuA9%2FScreenshot%202023-08-26%20at%205.20.11%20PM.png?alt=media&#x26;token=f886058a-a545-4765-be76-e024e9a6c0c1" alt=""><figcaption></figcaption></figure>

> We DO NOT charge for testnet transactions. For Mainnet transactions, if you want the gas to be sponsored by a Paymaster, then you need to top up your account on the Bastion dashboard and make sure that you have enough balance there for all the transactions to go through.

#### Step 1 - Import the Bastion SDK into your app

```typescript
import { Bastion } from "bastion-wallet-sdk"
```

#### Step 2 - Instantiate the Bastion SDK with an ether.js web3 provider

```typescript
const bastion = new Bastion();
const bastionConnect = await bastion.bastionConnect;

const CONFIG = {
	chainId: <chain_id>, // optional
	privateKey: <your_private_key>, //optional
	rpcUrl: <RPC_URL>, //optional
	apiKey: <your_api_key> //required
};			
await bastionConnect.init(<your_web3Provider>, CONFIG);
```

In the above code, replace the Config variables as required.

All the Config fields EXCEPT apiKey are optional. You can leave them empty if you pass a web3 provider with a signer (such as when using Metamask, Particle Auth, or web3 auth).

***Note:-** If you're using the SDK in a NodeJS backend environment and are not passing a web3Provider, then you NEED to pass a Private Key in the CONFIG.*

You can find more info about creating the web3 provider and the various configurations in the [Tutorials](https://docs.bastionwallet.io/bastion-sdk/nextjs-tutorial) section.
