> For the complete documentation index, see [llms.txt](https://docs.lighter.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lighter.xyz/developers/reference/priority-transactions.md).

# Priority Transactions

Priority Transactions offer a way to interact with the Lighter protocol directly via Ethereum directly. You can think of them as censorship-resistant operations - and use them to e.g. cancel all orders or withdraw your collateral. They can be executed via Lighter's proxy smart contract on Ethereum, which holds the platform's collateral: `0x3B4D794a66304F130a4Db8F2551B0070dfCf5ca7`. Everything here works even if Lighter's API is unavailable.

**Read functions**:

* `addressToAccountIndex`: the master account index of a layer 1 address.
* `desertMode`: boolean, set to False unless desert mode gets activated.
* `getPendingBalance`: the pending balance for a certain layer 1 account, you can find a complete list of asset IDs via the assetDetails [endpoint](https://docs.lighter.xyz/api/orders).
* `getPendingBalanceLegacy`: the pending balance for a certain layer 1 account before the spot upgrade. In this case, it can only be a USDC value.
* `lastAccountIndex`: the highest account index assigned. Only accounts that deposit get assigned an account index, so that would represent the total number of wallets on the exchange.
* `tokenToAssetIndex`: match an ERC20 contract address to its corresponding asset\_index on the Lighter protocol

Most have been left out, but you can check out all functions on Ethereum block explorers, e.g. [Etherscan](https://etherscan.io/address/0x3B4D794a66304F130a4Db8F2551B0070dfCf5ca7#readProxyContract).

**Write functions**:

* `activateDesertMode`
* `burnShares`: allows you to burn shares of a Public Pool.
* `cancelAllorders`: cancels all open orders on Lighter for the specified account index.
* `cancelOustandingDepositsForDesertMode`
* `changePubKey`: assign a newly created api key to an account index. Each key is tied to a single account index (if you use sub-accounts, you'll need to create new ones).
* `createOrder`: submit reduce-only IOC orders
* `deposit`: deposit assets to the platform. See [Deposits, Transfers and Withdrawals](/developers/integration-guides/deposits-transfers-and-withdrawals.md) for more details.
* `depositBatch`: deposit to multiple addresses.
* `transferERC20`: transfer non-ETH spot assets between addresses.
* `transferETH`: transfer mainnet ETH between addresses.
* `withdraw`: withdraw assets from the platform. See [Deposits, Transfers and Withdrawals](/developers/integration-guides/deposits-transfers-and-withdrawals.md) for more details.
* `withdrawPendingBalance`: claim an existing secure withdrawal. Whenever the gas isn't too steep in price, withdrawals will be claimed by the platform on the users' behalf.
* `withdrawPendingBalanceLegacy`: claim an existing secure withdrawal that was requested before the addition of spot assets to the protocol.

Unlisted functions are reserved for the governor (a multi-sig controlled by the protocol) to manage markets and the protocol's settings. If you specify an account\_index, you should sign with the wallet that controls said index.

Audits and the vulnerability disclosure policy: [docs.lighter.xyz/security](https://docs.lighter.xyz/security/security-audits).


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.lighter.xyz/developers/reference/priority-transactions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
