Weekly Dev Update #14
THORChain Weekly Dev Update for Week 22–28 Oct 2019
BEPSwap Goes Cross-chain
BEPSwap is THORChain’s first go-to market product, built on a statechain to Binance Chain. BEPSwap was intended to only support BEP2 assets to minimise complexity with external chains.
Two recent breakthroughs made by the THORChain development team in how to consider the cross-chain environment, as well as increasing the number of consensus participants, mean the team have now re-considered the scope of mainnet launch.
Instead of launching the BEPSwap chain and decommissioning/hard-forking it into the THORChain mainnet, the team believe a network that supports cross-chain from the start can be built now. As such, THORChain will be launched, with support for Binance Chain, Bitcoin and Ethereum at Genesis. Binance Chain assets will be immediately supported, with Bitcoin and Ethereum enabled sometime in 2020. This will prevent large changes needing to occur post-mainnet launch.
These two breakthroughs will be discussed in a future blog, but the team describe them as “Cross-chain Pools” and “Asynchronous Liquidity Delegation”.
Cross-chain Pools.
Cross-chain pools solve two key problems:
- Security
- User Experience.
The first is that the network only holds assets that are in pools which are staked against Rune. This massively simpifies the attack surface of the network, since the network only needs to ensure that the amount of bonded Rune is always double the amount of staked Rune. This means that even if network participants *could* attack the network, they wouldn’t, because they can only steal 50% of what they bonded. Thus no rational actor would steal external assets.
The second characteristic is the User Experience, in that neither pegged tokens, nor atomic swaps are used. Users who wish to swap BTC to ETH send in on-chain BTC, and will receive on-chain ETH immediately (and vice versa). The target speed for BTC->ETH will be 20 seconds. The target speed for ETH->BTC will be 10 minutes (1 block).
Users who wish to stake, will stake on-chain BTC with on-chain Rune. Withdrawing their assets will mean they receive on-chain BTC and on-chain Rune. No pegging out, and no pegging in.
Asynchronous Liquidity Delegation.
The second breakthrough is how liquidity is managed in the system. The initial design had a single large Threshold Signature pool that held all the funds. While extremely secure, large committee memberships mean very long signing speeds (minutes for 67/100), which impacts the user experience. The team wish to target a signing speed of less than 5 seconds, which means TSS pools should be less than 11 participants.
However, due to the incentive structure created by Cross-chain pools, no node has an incentive to steal assets — even if they were given individual custody of assets. This is because they are always bonding twice as much Rune as there is Rune staked in pools. A node that “exit-scams” the network is the equivalent to simply selling 50% of their bonded Rune to assets and leaving disorderly. The network can rebuild the pools by simply disbursing the node’s abandoned bond back into the pools, and churning in a new node. Thus it is resilient to even internal attacks. This setup even works for a node that goes offline — while offline they are unable to respond and they get “fined” from their bond for every transaction they couldn’t honour in a timely fashion.
The final design is a large TSS pool that acts as a global custodian of bonded assets and incoming liquidity ( 22 of 33
is the initial target number), with 11 2 of 3
“satellite” pools which hold 50% of the staked assets. This means nodes can be delegated to asynchronously send out liquidity (swaps and withdrawals) with the signing speed of 2 of 3
, but the security of 22 of 33
.
Over time, the team will target 200 of 300
nodes, with 100 2 of 3
satellite pools.
BEPSwap Development
The team are working on 4 parallel streams of effort. Cross-chain infrastructure has now been merged into a single repo called “THORNode”.
- THORChain
- Threshold Signature Scheme implementation
- Front-end Integration for BEPSwap
- Other development activities
StateChain
A lot of new work was done to make the statechain cross-chain, with agnostic treatment to chain data. The first three chains will be BNB, BTC and ETH. A global re-factor of naming conventions surrounding cross-chain assets was made.
- add chain to pools
- issue140 if the ticker and coin are the same , thus we don’t need to swap just refund
- Issue150 add GAS result in a pool in suspended status
- Auto-seed the development environment after a deploy.
- Add Asset and Symbol common structs
- Get stage seeding on nightly deploys.
- Continue importing asset into thornode
- Change coin.Denom to coin.Asset
- Replace “Token” → “asset”
- issue135 update stake logic to check ticker match coin
- issue151 add cors support
- Feature/docker compose updated build pipelines
- Issue138 fix signer use wrong symbol issue , which cause issue with refund
- Per chain gas policy
- remove binance specific logic
- Choose rune asset based on mainnet vs testnet
- Genesis ceremony
- Added seed and smoke-test targets to .PHONY
FrontEnd
Based on community feedback, the front-end is being refreshed. A lot of the past weeks updates were fixing small bugs and implementing the fresh design:
- Resolve “Update theme variables and sizes”
- Resolve “Update API endpoint with the prefix in the Front-End”
- Resolve “Update Tab, Button, CoinButton component”
- Resolve “BUG: Token amount selection doesn’t work properly in the Pool Stake”
- Resolve “Update header, content layout”
- Resolve “Build components for swap detail page”
- Resolve “Implement Swap Detail Page”
- Resolve “Fix issue for token amount input component”
Threshold Signature Scheme implementation
Work was done to clean up the code for peer-review, as well as implementing whitelisting for key-generation procedure.
The TSS implementation is being integrated into the Statechain this week, in time to validate Asgard churn.
Whats Next?
To ship mainnet, the team are aiming for this:
Frontend:
Feature complete with excellent swapping and staking experience.
Chain Service:
Feature complete public RESTful API.
Statechain:
Feature complete with 22 of 33
Asgard, weekly churn, 2 of 3
satellite pools, asynchronous liquidity delegation and cross-chain support.
Timelines
The team are working for these milestones.
Other Development:
- RUNEVault: July 2019
shipped
- Telegram Bot: August 2019
shipped
- Bep2Bot: August 2019
shipped
BEPSwap:
- Testnet: August 2019
shipped
- Community Testing:
shipped
THORChain:
- Internal Freeze: 20 November 2019
on-time
- Audit: 20 December 2019
on-time
- Genesis: 03 January 2020
on-time
Community
To keep up to date, please monitor community channels, particularly Telegram and Twitter:
- Twitter: https://twitter.com/thorchain_org
- Telegram Community: https://t.me/thorchain_org
- Telegram Announcements: https://t.me/thorchain
- Reddit: https://reddit.com/r/thorchain
- Github: https://github.com/thorchain
- Medium: https://medium.com/thorchain