Published in


Weekly Dev Update #46

THORChain Weekly Dev Update for Week 01–08 June 2020


The team spent the week preparing the public testnet.

Testnet 1

The first testnet prepared ended in a consensus failure, which the team hadn’t seen before, but put it down to a change in node configuration. The testnet had a large amount of testnet funds on it, so the team spent the time investing in building a tool to enable a hard fork to a new version. The team eventually realised that the current tendermint infrastructure is not suitable for hard forking THORChain. This is because when a hard fork happens, the entire blockchain is replayed from scratch (block 1) and in the case of THORChain, previously spent txOuts will be respent. This is a known issue for Tendermint (to set an optional height to replay from) and is here:

The team have a solution and will implement it, but prefer to include Tendermint’s official fix when ready. The team was ultimately able to recover funds from the TSS vaults, and are confident that should a chain-halt happen on mainnet, a hard fork can be pushed to recover the state. Assuming the hard fork is *non-malicious* then all node operators should upgrade, since all of their funds would be locked up and the only way to get their funds back would be to restart the chain in a manner that is non-malicious.

Testnet 2

The team then deployed a second testnet on 08 June, which was publicly announced. This testnet ended in being intentionally shut down (by stopping all nodes) due to two issues which had cascading problems, but ultimately easily fixed.

The root cause was that one of the nodes was restarted (this is fine, because the network only needs 67% online), but it was unable to download the TSS address book (the addresses of the other nodes) so it could not key-sign TSS. This meant that 3 out of every 4 outbound transactions could not be completed until that node was removed from the TSS party. The other 3 nodes (who were all connected) were then able to complete all pending transactions. Users of the testnet would notice that swaps were going through fine (10 seconds) but then delayed for 10mins for around 25 min periods. A second issue which caused pending transactions to be retried but not accounted for, allowed THORChain to double-spend outbound transactions. This then caused THORChain to go insolvent and Midgard’s data to underflow.

The fixes are:

  1. Save the address book in local storage for all nodes (WIP: add function to export the p2p address for every successful tss operation)
  2. Mark transactions and all retries as complete when one is successful. ([bugfix] txout outhash marks all tx outs)

Once the TSS issue is fixed, testnet can be re-launched. These issues so far hadn’t been seen in testing before, but are very likely to arise in a public test environment. The team will keep launching public testnets until it extremely reliable.

Dynamic Network Fees

This has been pushed to THORChain and now follows this logic:

  • THORNodes regularly report on gas fees used in each chain, and a trailing average of gas fees is stored in THORChain.
  • Users are now charged 3*the trailing average gas fee, but in RUNE, which is moved to the Reserve.
  • THORNodes are instructed to use a gas price of 1.5*the trailing average.
  • The stakers are reimbursed an amount of 2*the gas used, in RUNE, paid to the pool.


  1. The trailing average for gas fees on Bitcoin is 10 sat/byte, using 2500 sats each transaction.
  2. A user swapping to Bitcoin is charged 7500 sats, which is moved to the Reserve in RUNE.
  3. The nodes will use 15 sats/byte for outgoing transactions, with a final cost of 15 * 250 bytes = 3750 sats, which is deducted from the Bitcoin pool (and thus all Bitcoin stakers pay for the gas).
  4. The Bitcoin stakers are then paid back 7500 Sats in RUNE, which causes arbitrage and for at least 3750 Sats to be recovered from the market, making the Bitcoin stakers whole.

The realisation is then:

  1. During periods of Bitcoin mempool saturation it will be *expensive* to buy Bitcoin. Bitcoin buyers will be paying at least 3 times the cost of a normal transaction, which could be anywhere from $3 to $90 (based off historical gas prices). This will drive up swap sizes, since small swaps will be net-negative.
  2. This will then drive arbitrage volume to wrapped Bitcoin alternatives, where fees will be much less (Ethereum: 20–60c, Binance Chain: 1–3c). Traders will be able to arbitrage Bitcoin using cheap wrapped alternatives, re-balancing back to L1 Bitcoin when fees are reduced, or arbitrage deltas are worth it. This will have an interesting effect on the wrapped Bitcoin ecosystem, where for the first time there exists a tangible financial reason to trade into alternatives, choosing on the trust-convenience continuum.


Bugfixes from testnets, as well as implementing Dynamic Network Fees.


Bugfixes and feature requests as required for the clients.


BEPSwap Client

Numerous UI/UX tweaks from testnet feedback:


Ongoing work to port in the user interface.

ASGARDEX Libraries

  • asgardex-midgard is the new name for the Midgard API client required by all ASGARDEX clients.
  • asgardex-crypto has been scoped and will control all crypto-related functions, including handling thorchain keystore files.

Community Work

The community are building out:

In addition, the team are also talking with a mobile wallet provider as well as potentially a team to build a blockchain exporter


The team have receive the first draft of the Kudelski audit, with no major issues found.

Gauntlet are preparing their final THORChain report.

Next Milestones

The testnet is being re-deployed and will be made public soon. Chaosnet is expected once testnet has been fully-validated in several environments. There currently isn’t any known blockers to Chaosnet release.


To keep up to date, please monitor community channels, particularly Telegram and Twitter:



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store

The official team for THORChain — the decentralized liquidity network.