# 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="/files/reYW0pK98GrJzSC7xRwv" 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](/bastion-sdk/nextjs-tutorial/part-1-connect-wallet-using-metamask-and-mint-an-nft.md) section.


---

# Agent Instructions: 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://docs.bastionwallet.io/bastion-sdk/introduction/getting-started.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.
