# bloXroute: Solana Trader API

The **Solana Trading API** provides faster transaction propagation on Solana network, as well as additional features, such as MEV protection while utilizing bloXroute's infrastructure (SWQoS) under the hood.

You can use the API along with RPC Fast's infrastructure and send transactions at no base cost. The fees applicable: 0.001 SOL tip per transaction (charged by bloXroute) + priority fees (paid to Solana network). Check the [bloXroute's Docs](https://docs.bloxroute.com/core-solutions/solana-core-solutions) for more details about the Solana Trading API – Transaction execution and protection solution.

Below, you'll find an instruction on how to use the integration.

### How to enable Trader API?

* Add `blxr_enable=1` query arg, i.e. `https://solana-rpc.rpcfast.net/?blxr_enable=1`
* Or add `/trader` to request path, i.e. `https://solana-rpc.rpcfast.net/trader`

### Authentication options

* via HTTP header `X-TOKEN: your_token`
* via HTTP query argument `api_key=your_token`

### Submit transaction via API

We have integrated Trader API with default Solana `sendTransaction` RPC method, so it is compatible with all Solana language libraries, i.e. solana/web3.js, solana.py, gagliardetto/solana-go etc.

**Example request with curl**

```bash
curl -XPOST -H 'X-TOKEN: your_token' \
https://solana-rpc.rpcfast.net/trader?tx_submit_mode=fastest&tip_amount=1000000 -d '
{
	"jsonrpc": "2.0",
	"method": "sendTransaction",
	"params": [
		"your_signed_transaction",
		{
			"encoding": "base64"
		}
	],
	"id": 1
}'
```

**Query parameters**

| **Parameter**       | **Description**                                                     | **Allowed values**                   | **Required**                              |
| ------------------- | ------------------------------------------------------------------- | ------------------------------------ | ----------------------------------------- |
| `blxr_enable`       | Enable BloXRoute Trader API integration                             | `1`                                  | Yes, except when using `/trader` endpoint |
| `tx_submit_mode`    | Transaction submission mode                                         | `fastest`, `mev_protect`, `balanced` | No                                        |
| `tip_amount`        | Tip amount in Lamports **SaaS users only**                          | min. `1000000`                       | Yes (SaaS users only)                     |
| `fallback`          | Whether to fallback to default sendTransaction on reaching CU limit | `true`, `false`                      | No                                        |
| `mev_protect_level` | MEV protection level, affects tx landing speed                      | `low`, `medium`, `high`              | No                                        |

### Transaction submission modes

| **Mode**      | **Description**                                                                                |
| ------------- | ---------------------------------------------------------------------------------------------- |
| not specified | Transaction is sent through BloXRoute's network                                                |
| `fastest`     | Transaction is send to staked nodes allowing for the fastest propagation                       |
| `mev_protect` | Enable front-running protection in cost of slower transaction propagation, routed through Jito |
| `balanced`    | Balanced mode between tx landing speed and front-running protection                            |

### Tip fee for sending transactions

Tip should be specified in lamports (1 SOL = 1,000,000,000 lamports).

The minimum required tip amount is 0.001 SOL or 1,000,000 Lamports.

**RPC Fast SaaS** users must specify tip fee using `tip_amount` query argument, it will be automatically converted to Compute Units and debited from balance.

**RPC Fast Dedicated node** users must create tip fee instruction by themselves and include it inside the transaction body. [Read more](https://docs.bloxroute.com/solana/trader-api/best-performance-for-landing-transactions#optimizing-transaction-performance).

{% hint style="success" %}
Setting a larger tip will increase propagation speed.
{% endhint %}

{% hint style="warning" %}
To check most up-to-date recommended tip amount, consider [subscribing to websocket endpoint](https://docs.rpcfast.com/rpc-fast-saas-solana/sending-transactions/solana-trader-api/websocket-endpoints).
{% endhint %}

### Transaction priority fee

**Priority fee** is an optional fee, priced in [micro-lamports](https://solana.com/docs/references/terminology#lamport) per [Compute Unit](https://solana.com/docs/references/terminology#compute-units) (e.g. small amounts of SOL), appended to transactions to make them economically compelling for validator nodes to include in blocks on the network.

Please check the [official Solana documentation](https://solana.com/developers/guides/advanced/how-to-use-priority-fees) on how to add priority fee to your transaction.

{% hint style="warning" %}
To receive up-to-date priority fees, consider subscribing to [priority fee stream websocket](https://docs.rpcfast.com/rpc-fast-saas-solana/sending-transactions/solana-trader-api/websocket-endpoints).
{% endhint %}
