> For the complete documentation index, see [llms.txt](https://docs.flash.trade/flash-trade/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flash.trade/flash-trade/~/revisions/xKAncpdYLJG7bPOyq6YW/flash-trade-protocol/build-on-flash.md).

# Build On Flash

### Introduction

Flash.trade SDK written in typescript provides the easist way for developers, partners and others to integrate with flash.trade. This page will walk you through setting up the flash client, creating transactions and executing them.

### Install the Flash SDK

```bash
npm install flash-sdk

yarn add flash-sdk
```

### Setting up the Flash SDK

{% code overflow="wrap" %}

```typescript
import { AnchorProvider, BN } from "@coral-xyz/anchor";
import { PerpetualsClient, PoolConfig } from 'flash-sdk';

const RPC_URL = process.env.RPC_URL;

// Configure the AnchorProvider
const provider: AnchorProvider = AnchorProvider.local(RPC_URL, {
    commitment: 'processed',
    preflightCommitment: 'processed',
    skipPreflight: true,
});

// Configure the pool you want to interact with 
// for devnet : devnet.1,devnet.2,devnet.3,devnet.4,devnet.5
// for mainnet : Crypto.1,Virtual.1,Governance.1,Community.1,Community.2
// all the pool details can be found by running `code ./node_modules/flash-sdk/dist/PoolConfig.json`
const POOL_CONFIG = PoolConfig.fromIdsByName('Crypto.1', 'mainnet-beta'); 

// You can now setup the Flash client
const flashClient = new PerpetualsClient(
    provider,
    POOL_CONFIG.programId,
    POOL_CONFIG.perpComposibilityProgramId,
    POOL_CONFIG.fbNftRewardProgramId,
    POOL_CONFIG.rewardDistributionProgram.programId,
    {
        prioritizationFee: 0, // this can be set dynamically by calling flashClient.setPrioritizationFee
    }
)
```

{% endcode %}

{% hint style="success" %}
Detailed Example:

Checkout the public repo [here](https://github.com/flash-trade/flash-trade-sdk/tree/main/examples).
{% endhint %}

{% hint style="info" %}
NOTE : if you are using AnchorProvider it is necessary to pass ANCHOR\_WALLET as an environment variable. This wallet/keypair doesn't have to sign the transaction but if you are using it as part of the view functions then this wallet pubkey will be used for simulations. It also needs be initialized, i.e has to have some SOL in it.&#x20;
{% endhint %}


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.flash.trade/flash-trade/~/revisions/xKAncpdYLJG7bPOyq6YW/flash-trade-protocol/build-on-flash.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
