We are happy to announce and integration of the Lighter exchange in CCXT.
It works similarly to any other CCXT exchange, but it has some particularities that might be confusing for some users but we will explain it in detail.
Credentials requirements
Lighter requires the following :
-
privateKey: the API key private key (hex) from Lighter’s API keys page, not the l1 privateKey (https://app.lighter.xyz/apikeys)-
apiKeyIndex in exchange.options: the index assigned to the API key you generated (typically 0–254) you can get it from the API Keys page as well-
accountIndex in exchange.options: — the Lighter internal account index (master account or sub-account). Each internal account has its own API key indices. You can checking by opening this link in the browser using your l1 address https://mainnet.zklighter.elliot.ai/api/v1/accountsByL1Address?l1_address=0xYOUR_ADDRESS_hereExample
lighter = ccxt.lighter({
'privateKey': 'XXXXXXX',
'options': {
'apiKeyIndex': 3,
'accountIndex': 715085
}
})Dependencies requirements
Since the signing algorithms and structs are not supported natively in all languages CCXT is using the officially distributed binaries and interacting with them in order to do the signing process (via FFI/WASM), so depending on the language you need to provide a path for that binary.
Python/C#/PHP users:
- The binaries can be downloaded here: https://github.com/elliottech/lighter-python/tree/main/lighter/signers
- The path to the binary needs to be provided as
libraryPath- You need to choose the binary according to your OS/architecture (macos/linux/window and arm64 or amd64)
lighter = ccxt.lighter({
'options': {
'libraryPath': 'path/to/lighter-signer-linux-arm64.so',
}
})Javascript/Typescript users
- CCXT is using the WASM binary built from the official package and it can be downloaded here https://github.com/ccxt/lighter-wasm or built from the source
- You also need to provide the path to
exec_wasm.js, you can either download it from the same repo or check the path to your local file (assuming Go is installed)lighter = ccxt.lighter({
'options': {
'libraryPath': '/user/cjg/Git/lighter-wasm/lighter.wasm',
'wasmExecPath': '/opt/homebrew/opt/go/libexec/lib/wasm/wasm_exec.js'
}
})GO users
- Nothing is required, CCXT is consuming the official GO package you just need to provide the credentials
If you need help or encounter any difficulties during the process, the CCXT team is ready to assist you.
Detailed instructions: https://github.com/ccxt/ccxt/wiki/FAQ#how-to-use-the-lighter-exchange-in-ccxt
This exchange is available in CCXT as of version 4.5.41. 🚀
Congrats, and welcome on board!
Yours, the CCXT Dev Team ✅