Native token bridging
Various aspects of the subject technology relate to systems, methods, and machine-readable media for bridging native tokens. Various aspects may include initializing a first blockchain by allocating a plurality of native tokens. Aspects may also include transferring, using a bridge, one or more transactions from a second blockchain to the first blockchain using locked tokens on the second blockchain as collateral. Aspects may also include minting new native tokens at the first blockchain when a value of transactions sum to the plurality of native tokens and the plurality of native tokens are backed by the locked tokens. Aspects may also include reporting, to the second blockchain, the amount of tokens used for the transaction fees in the one or more transactions. Aspects may also include burning, at the second blockchain, tokens corresponding to the amount of tokens used for paying transaction fees.
1 . A computer-implemented method for bridging tokens, the method comprising:
initializing a first blockchain by allocating to the first blockchain a plurality of native tokens that are native tokens of a second blockchain;
maintaining, at a bridge, a reserve imbalance value corresponding to unbacked tokens in the plurality of native tokens;
receiving, at the bridge, a transfer request for one or more transactions for a transfer of assets from the second blockchain to the first blockchain;
in response to receiving the transfer request, locking a portion of the plurality of native tokens on the second blockchain to back the one or more transactions;
collateralizing the bridge using the locked portion of the plurality of native tokens for transactions on the first blockchain;
determining, at the bridge, a total value of the one or more transactions;
updating the reserve imbalance value in accordance with the total value of the one or more transactions, the reserve imbalance value representing collateralized backing that secures transactions executed on the first blockchain, wherein;
the total value summing to the reserve imbalance value indicates that the plurality of native tokens allocated to the first blockchain are backed by tokens on the second blockchain, and based on the total value summing to the reserve imbalance value, minting new native tokens at the first blockchain for subsequent transactions;
identifying, at the bridge, a first amount of tokens from the plurality of native tokens used for paying transaction fees for the one or more transactions; and
reporting, to the second blockchain, the first amount of tokens used for the transaction fees.
2 . The computer-implemented method of claim 1 , wherein the plurality of native tokens on the first blockchain are defined at creation and correspond to native tokens on the second blockchain.
3 . The computer-implemented method of claim 1 , wherein the plurality of native tokens is allotted in a genesis block corresponding to a first block in the first blockchain.
4 . The computer-implemented method of claim 1 , wherein transferring tokens, using the bridge, through the one or more transactions from the second blockchain to the first blockchain further comprises:
locking, at the second blockchain, a second amount of tokens for the transactions, wherein at least a portion of the reserve imbalance value is collateralized in accordance with the second amount of tokens locked at the second blockchain;
generating, for each transaction, an authenticated message indicating the second amount of tokens locked on the second blockchain; and
transferring, to the first blockchain, the authenticated message within the transaction.
5 . The computer-implemented method of claim 1 , further comprising, based on the total amount of tokens in the transactions being less than the reserve imbalance value, backing tokens from the plurality of native tokens in accordance with the total amount of tokens in the transactions.
6 . The computer-implemented method of claim 1 , further comprising, based on the total amount of tokens in the transactions exceeding the plurality of native tokens, backing the reserve imbalance value by the total amount of tokens, and minting new native tokens corresponding to a surplus in the total amount of tokens compared to the reserve imbalance value.
7 . The computer-implemented method of claim 1 , further comprising burning, at the second blockchain, tokens corresponding to the first amount of tokens from the plurality of native tokens used for paying the transaction fees on the first blockchain.
8 . The computer-implemented method of claim 1 , wherein the plurality of native tokens corresponds to stablecoins.
9 . The computer-implemented method of claim 1 , further comprising:
crediting the transaction fees to a designated address on the first blockchain; and
tracking the first amount of tokens used for transaction fees as a balance of the designated address, wherein tokens assigned to the designated address correspond to tokens burned as the transaction fees.
10 . The computer-implemented method of claim 1 , further comprising scaling token amounts from the second blockchain to the first blockchain, wherein for a first token bridged from the second blockchain, a corresponding scaled second token is minted on the first blockchain.
11 . A system for bridging tokens, comprising:
one or more processors; and
a memory comprising instructions stored thereon, which when executed by the one or more processors, causes the one or more processors to:
initialize a first blockchain by allocating to the first blockchain a plurality of native tokens that are native tokens of a second blockchain;
maintain, at a bridge, a reserve imbalance value corresponding to the plurality of native tokens;
receive, at the bridge, a transfer request for one or more transactions for a transfer of assets from the second blockchain to the first blockchain;
in response to receiving the transfer request, lock a portion of the plurality of native tokens on the second blockchain to back the one or more transactions;
collateralize the bridge using the locked portion of the plurality of native tokens for transactions on the first blockchain;
determine, at the bridge, a total value of the one or more transactions;
update the reserve imbalance value in accordance with the total value of the one or more transactions, the reserve imbalance value representing collateralized backing that secures transactions executed on the first blockchain, wherein
the total value summing to the reserve imbalance value indicates that the plurality of native tokens allocated to the first blockchain are backed by tokens on the second blockchain, and based on the total value summing to the reserve imbalance value, mint new native tokens at the first blockchain for subsequent transactions;
identify, at the bridge, a first amount of tokens from the plurality of native tokens used for paying transaction fees for the one or more transactions; and
report, to the second blockchain, the first amount of tokens used for the transaction fees.
12 . The system of claim 11 , wherein the plurality of native tokens on the first blockchain are defined at creation and correspond to native tokens on the second blockchain.
13 . The system of claim 11 , wherein the plurality of native tokens is allotted in a genesis block corresponding to a first block in the first blockchain.
14 . The system of claim 11 , wherein the instructions, when executed by the one or more processors, cause the one or more processors to:
lock, at the second blockchain, a second amount of tokens for the transactions, wherein at least a portion of the reserve imbalance value is collateralized in accordance with the second amount of tokens locked at the second blockchain;
generate, for each transaction, an authenticated message indicating the second amount of tokens locked on the second blockchain; and
transfer, to the first blockchain, the authenticated message within the transaction.
15 . The system of claim 11 , wherein the instructions, when executed by the one or more processors, cause the one or more processors to, based on the total amount of tokens in the transactions being less than the reserve imbalance value, back tokens from the plurality of native tokens in accordance with the total amount of tokens in the transactions.
16 . The system of claim 11 , wherein the instructions, when executed by the one or more processors, cause the one or more processors to, based on the total amount of tokens in the transactions exceeding the plurality of native tokens, back the reserve imbalance value by the total amount of tokens, and mint new native tokens corresponding to a surplus in the total amount of tokens compared to the reserve imbalance value.
17 . The system of claim 11 , wherein the instructions, when executed by the one or more processors, cause the one or more processors to burn, at the second blockchain, tokens corresponding to the first amount of tokens from the plurality of native tokens used for paying the transaction fees on the first blockchain.
18 . The system of claim 11 , further comprising stored sequences of instructions, which when executed by the one or more processors, cause the one or more processors to:
credit the transaction fees to a designated address on the first blockchain; and
track the first amount of tokens used for transaction fees as a balance of the designated address, wherein tokens assigned to the designated address correspond to tokens burned as the transaction fees.
19 . The system of claim 11 , further comprising stored sequences of instructions, which when executed by the one or more processors, cause the one or more processors to scale token amounts from the second blockchain to the first blockchain, wherein for a first token bridged from the second blockchain, a corresponding scaled second token is minted on the first blockchain.
20 . A non-transitory computer-readable storage medium comprising instructions stored thereon, which when executed by one or more processors, cause the one or more processors to perform operations for bridging tokens, comprising:
initializing a first blockchain by allocating to the first blockchain a plurality of native tokens that are native tokens of a second blockchain;
maintaining, at a bridge, a reserve imbalance value corresponding to the plurality of native tokens;
receiving, at the bridge, a transfer request for one or more transactions for a transfer of assets from the second blockchain to the first blockchain;
in response to receiving the transfer request, locking a portion of the plurality of native tokens on the second blockchain to back the one or more transactions;
collateralizing the bridge using the locked portion of the plurality of native tokens for transactions on the first blockchain;
determining, at the bridge, a total value of the one or more transactions;
updating the reserve imbalance value in accordance with the total value of the one or more transactions, the reserve imbalance value representing collateralized backing that secures transactions executed on the first blockchain, wherein
the total value summing to the reserve imbalance value indicates that the plurality of native tokens allocated to the first blockchain are backed by tokens on the second blockchain, and based on the total value summing to the reserve imbalance value, minting new native tokens at the first blockchain for subsequent transactions;
identifying, at the bridge, a first amount of tokens from the plurality of native tokens used for paying transaction fees for the one or more transactions; and
reporting, to the second blockchain, the first amount of tokens used for the transaction fees, wherein, tokens corresponding to the first amount of tokens used for transaction fees are burned at the second blockchain.