Exchange Integration

Learn how to integrate your exchange with the EVM-Compatible Lux LUExchange-Chain.

Overview

The objective of this document is to provide a brief overview of how to integrate with the EVM-Compatible Lux LUExchange-Chain.

For teams that already support ETH, supporting the LUExchange-Chain is as straightforward as spinning up an Lux node (which has the same API as go-ethereum) and populating Lux's ChainID (43114) when constructing transactions.

Additionally, Lux Network maintains an implementation of the Rosetta API for the LUExchange-Chain called lux-rosetta. You can learn more about this standardized integration path on the attached Rosetta API website.

Integration Using EVM Endpoints

Running an Lux Node

If you want to build your node form source or include it in a docker image, reference the LuxGo GitHub repository. To quickly get up and running, you can use the node installation script that automates installing and updating LuxGo node as a systemd service on Linux, using prebuilt binaries.

Configuring an Lux Node

All configuration options and their default values are described here.

You can supply configuration options on the command line, or use a config file, which can be easier to work with when supplying many options. You can specify the config file location with —config-file=config.json, where config.json is a JSON file whose keys and values are option names and values.

Individual chains, including the LUExchange-Chain, have their own configuration options which are separate from the node-level options. These can also be specified in a config file. For more details, see here.

The LUExchange-Chain config file should be at $HOME/.luxgo/configs/chains/C/config.json. You can also tell LuxGo to look somewhere else for the LUExchange-Chain config file with option --chain-config-dir. An example LUExchange-Chain config file:

If you need Ethereum's Archive Node functionality, you need to disable LUExchange-Chain pruning, which has been enabled by default since LuxGo v1.4.10. To disable pruning, include "pruning-enabled": false in the LUExchange-Chain config file as shown below.

{
  "coreth-admin-api-enabled": false,
  "local-txs-enabled": true,
  "pruning-enabled": false,
  "eth-apis": [
    "internal-eth",
    "internal-blockchain",
    "internal-transaction",
    "internal-tx-pool",
    "internal-account",
    "internal-personal",
    "debug-tracer",
    "web3",
    "eth",
    "eth-filter",
    "admin",
    "net"
  ]
}

Interacting with the LUExchange-Chain

Interacting with the LUExchange-Chain is identical to interacting with go-ethereum. You can find the reference material for LUExchange-Chain API here.

Please note that personal_ namespace is turned off by default. To turn it on, you need to pass the appropriate command line switch to your node, like in the above config example.

Integration Using Rosetta

Rosetta is an open-source specification and set of tools that makes integrating with different blockchain networks easier by presenting the same set of APIs for every network. The Rosetta API is made up of 2 core components, the Data API and the Construction API.

Together, these APIs allow for anyone to read and write to blockchains in a standard format over a standard communication protocol. The specifications for these APIs can be found in the rosetta-specifications repository.

You can find the Rosetta server implementation for Lux LUExchange-Chain here, all you need to do is install and run the server with proper configuration. It comes with a Dockerfile that packages both the server and the Lux client. Detailed instructions can be found in the linked repository.

Constructing Transactions

Lux LUExchange-Chain transactions are identical to standard EVM transactions with 2 exceptions:

  • They must be signed with Lux's ChainID (43114).
  • The detailed dynamic gas fee can be found here.

For development purposes, Lux supports all the popular tooling for Ethereum, so developers familiar with Ethereum and Solidity can feel right at home. Popular development environments include:

Ingesting On-Chain Data

You can use any standard way of ingesting on-chain data you use for Ethereum network.

Determining Finality

Lux consensus provides fast and irreversible finality with 1-2 seconds. To query the most up-to-date finalized block, query any value (that is block, balance, state, etc) with the latest parameter. If you query above the last finalized block (that is eth_blockNumber returns 10 and you query 11), an error will be thrown indicating that unfinalized data cannot be queried (as of [email protected]).

(Optional) Custom Golang SDK

If you plan on extracting data from the LUExchange-Chain into your own systems using Golang, we recommend using our custom ethclient. The standard go-ethereum Ethereum client does not compute block hashes correctly (when you call block.Hash()) because it doesn't take into account the added ExtDataHash header field in Lux LUExchange-Chain blocks, which is used move LUX between chains (Exchange-Chain and Platform-Chain). You can read more about our multi-chain abstraction here (out of scope for a normal LUExchange-Chain integration).

If you plan on reading JSON responses directly or use web3.js (doesn't recompute hash received over the wire) to extract on-chain transaction data/logs/receipts, you shouldn't have any issues!

Support

If you have any problems or questions, reach out either directly to our developers, or on our public Discord server.

Is this guide helpful?