🧠How it works
Last updated
Last updated
The neuron app is designed to simplify the experience of bridging between chains providing a clean and reliable user experience. Behind the scenes, a number of things happen when funds are transferred.
At a high level the following occurs when a user visits neuron to bridge:
User selects where their funds are and where they want to sent them to
A transaction sending funds at the source source chain is signed by the user
Shortly afterwards the neuron chain watchers pick up the transaction, wait for sufficient time to pass to achieve soft finality
A neuron chain executor on the destination chain will take the deposit proof and send funds to the nominated wallet at the destination
The process is relatively simple, however each of these stages we explain in more detail below.
Initially a user will visit the neuron app (or interact via the API) which will display all the currently supported chains and tokens along with the expected bridging time and cost. Once they've committed to the parameters of the bridging transfer (source, destination, token, address and fee) then will need to sign some transactions.
This step is only relevant for transferring ERC20 tokens from the source chain. For native token transfers this is not required.
Once the source and destination chain and tokens are selected, if the funds being bridged are ERC20 tokens, then there will likely be a spend approval requirement. The user will be prompted to approve a transaction giving the neuron bridge permission to spend their funds.
This step is necessary due to the design of ERC20 tokens and the underlying Ethereum blockchain. ERC20 tokens implement a standard set of functions, including transfer
and transferFrom
, which allow users to transfer tokens between accounts. However, in order to enable secure and controlled transfers, ERC20 tokens introduce the concept of allowances.
The "approve" transaction is used to grant permission to another address or contract to spend a specified amount of tokens from the sender's account. By approving an allowance, the token holder effectively delegates the transfer rights to the approved address.
This additional step is crucial for several reasons. Firstly, it ensures that token holders have full control over their funds and can decide which addresses can spend their tokens. Secondly, it provides a layer of security by preventing unauthorized transfers from occurring without explicit approval. Lastly, it enables more complex token transfer scenarios, such as token allowances for decentralized exchanges or smart contract interactions.
Next the user will be prompted to sign a transaction which will transfer their funds to the source chain smart contract.
By depositing funds into a smart contract, user initiates a process where their tokens are locked within the contract's control until the bridging process is completed. This ensures that the tokens are held securely and can be reliably transferred to the destination blockchain. Additionally, the deposit acts as collateral, providing assurance that the user has committed the tokens for the bridging transaction.
Depositing funds to a smart contract also enables the verification and validation of the transaction. The smart contract can perform necessary checks, such as verifying the token balance, confirming the availability of the required tokens, and enforcing any relevant bridging rules or protocols. This validation process helps maintain the integrity of the bridging service and ensures that only valid and authorized transactions are processed.
Information about destination chain and recipient address is securely encrypted using asymetric cryptography and stored as part of a metadata payload that is sent on-chain along with the deposit transaction. Information within the deposit transaction can only be decrypted by chain executors to ensure privacy and not anyone watching deposit events going on chain using a block explorer.
The bridging process utilizing secure messaging involves a series of steps to ensure the secure and reliable transfer of tokens between blockchain networks. Once a user initiates a bridging transaction by depositing funds into a smart contract, the process is as follows:
neuron chain watchers continuously monitor the source blockchain for new transactions. They scan the blockchain to identify bridging transactions initiated by users and validate destination and token information.
Once a bridging transaction is detected, the chain watchers begin monitoring the transaction's progress. They track the number of confirmations received, which are successive blocks added to the blockchain after the transaction is included.
The chain transaction executor on the destination chain, which is responsible for executing transactions sending funds to users on that chain, monitors the bridging transaction's confirmations. Once a sufficient number of confirmations is reached, the chain transaction executor automatically executes the bridging transaction on the destination chain.
The execution of the bridging transaction on the destination chain involves the transfer of funds from the locked smart contract to the user's address on the destination chain.
Once the transaction is successfully executed on the destination chain, the user receives their funds in the form of tokens native to that chain. The tokens are transferred to the user's designated address on the destination chain.
This process ensures that the bridging transaction is executed securely and reliably using neuron's off chain infrastructure. The involvement of chain watchers, confirmations, and the chain transaction executor adds layers of verification and validation to the bridging process, ensuring that the funds are transferred accurately and that the user receives their funds on the destination chain.