Wrapped Hive Update - Testnet ready

in #whive4 months ago

Wrapped Hive - Testnet

wHE-token.jpg
original image source


Hello, it's been some time since the last Wrapped Hive development update. I've been working hard behind the scenes, and now I have a few exciting news to share.

Private Testnet

On Friday, I announced the successful launch of the first private testnet

I had 3 validators running on this first testnet:

  • @gorbisan (0xaB8aDa86340b31c616Bf57007cfaF153F114e491)
  • @fbslo.pay (0x79fd2eC310457aE0137426526c05Fda2d3B02DAd)
  • @posh-bot (0x720Bc451363d5f9F5Cc03861760bff29A3a1083a)

Token contract: 0xedf8a74f4271c3ce1007e117187b102802c85a55
Multisig contract: 0xf072ee84895abeabbc4b47d2d713836c732883af

First transactions were sent from Hive to Ethereum and back. Here is a list of transactions required for the first trustless (well, all validators were controlled by me this time) cross-chain transfer.


HIVE to wHIVE.


wHIVE to HIVE

Wrapped Hive Network

tl;dr: Network of nodes must sign transactions and by using multi-signature wallets, tokens can be transferred only if a certain percentage of nodes approved it.

Governance

I spent a lot of time thinking about the governance issue for Wrapped Hive. There are a few different ways to elect validators into the network. The most popular governance models in crypto are PoW (not really suitable for this project), PoS, and DPoS.
I was thinking about using a similar way of voting for validators as Hive is using to vote for witnesses. But using Hive stake is not a very good way, since not every hive whale is doing what's best for the project, and in the case of attack, we can't just fork, since this is not a separate blockchain.

For now, I have decided to use a similar system as XRP or Diem/Libra: A limited number of trusted validators (like top witnesses, known community members...). While new validators can be added to the network, they have to be added and approved manually by the entire network first (limiting /preventing Sybil attacks). Misbehaving nodes will still get kicked automatically.

There is a high threshold (80%) required for consensus so in order to steal funds, an attacker would need to control at least 80% of all nodes. But with only 20%, the network can be paralyzed and funds would be frozen. While this is still better than a complete take-over, it's much easier to achieve and there are still financial incentives to attempt to paralyze the Wrapped Hive network (for example, shorting WHIVE token and crashing the price by blocking any cross-chain transfers).

Transfers

From HIVE to ERC20: When a new transaction is detected, one of the validators ("head validator"), selected every 5000 blocks (4.166 hours), will propose new transactions to the network. The remaining validators will check the proposed transaction, and if it's valid, they will sign it and broadcast their signatures in custom_json.

User (or more likely wHive helper app) will they collect all signatures and the user will have to call a multi-signature smart contract on Ethereum. The contract will verify enough signatures are valid and then mint new WHIVE tokens.
Compared to the current system where wHive oracle is paying for gas fees, this has several advantages. First, there is no need for validators to have ETH to pay for transactions. Users also have much more control over how much they want to pay in gas fees (since Ethereum signatures are not time-sensitive, users can choose to wait until the gas price is lower).

Of course, there are some drawbacks, multi-signature contract require quite some computational power, and it will have high gas cost. With 3 validators, around 170k gas was used. I did some testing with 40 signatures and over 600k gas was used (~$40 at the moment (50 gwei, $1.2k/ETH)). My goal is to have Wrapped Hive Network as a backbone of this system, but for smaller amounts, I expect different smaller centralized bridges (similar to Hive-Engine and LeoDex/BeeSwap) to be launched.

From ERC20 to HIVE: When the user wants to unwrap WHIVE, he must call the convertToken method on WHIVE token smart contract. This will allow adding Hive username to the token burn, and validators will know who should receive HIVE. Again, the head validator will propose a transaction, validators will check the proposed transaction, and if it's valid, they will sign it and broadcast their signatures in custom_json. Someone (head validator, but it doesn't matter if someone else is faster) will collect signatures and broadcasted the transaction to Hive.

Wrapped Hive Network Development History

I started working on decentralized Wrapped Hive almost immediately after the first centralized Wrapped Hive was released in late August. My first attempt to decentralize it was described in this post. Master/validators were using REST API to communicate. A similar system is used for my recently proposed system to decentralized HBD Potato.

slika.png
It should be validation, not verification

But it has some drawbacks. While it's much more secure than a centralized version, it's still pretty centralized.
2nd attempt was actually started by @ederaleng, but sadly he had to leave the project soon and I took over development. It was using WebSocket (actually socket.io, not pure WebSocket). After some time, I become concerned about some features (and the way I implemented them) and I also managed to turn code into spaghetti, and I was afraid that maintaining could turn into a nightmare.

So I just scrapped the entire codebase and started from scratch (keeping the only original p2p code from @ederaleng). This time, I followed the clean arhitecture as closely as I could. I tried to write parts of the code as separated as possible, so for example, 95% of the app has no idea what database is it using. If I decided that MySQL/MongoDB/MariaDB/PostgreSQL... is better, I could switch the entire app in only a few minutes (compared to having to modify much larger parts).

This was also pretty useful when I decided (pretty far into development) that socket.io is not the best way of communication between nodes and switched it for custom_json on Hive.

Roadmap

While the first testnet is an important milestone, we are still far from the final product.

  • 2-4 weeks: Completing some other core features (self-healing of the network, sync (for nodes entering network after launch), setup scripts)
  • 2 weeks: Public testnet & testing
  • 2-4 weeks: Security audit of both validator node and multi-sig smart contract
  • 2 weeks for any possible delays and to fix issues found during audits & on testnet.
  • Launch!

My goal is to launch the network on block 53,000,000 (April 13, 2021).

In case of delays, the launch will be delayed by 500k blocks (as many times as necesarry).

@fbslo

If you like my work, please support me by voting for my Hive Witness!
Witness announcement

Sort:  

What if people earn for gov token for staking hive in w-hive? It could be used for gov at in some time as an exchange token if the success would be big, for example with smts.

The Gov token can be something less expensive like a HE token.

Would split the power to people that "risk/invest" their tokens. As long we have no real reward mechanic for it, something like this would be a big deal.

I think add liquidity should be rewarded with 5%+ up to 10%+ pa. Most easy to archive that without a hardfork would be a gov token :)

The best case would be at some time a uniswap version on hive with smart contracts. That would add unlimited use cases :)

Like always, good work!

Hive on!

This is a great idea!

I was thinking about using governance tokens but wasn't really sure how to distribute them as decentralized as possible without risking the security. I'm planning on upgrading governance once the network is large enough (maybe in 6 months). Tokens will probably be airdropped to liquidity providers.

that's cool. Hit me up if the system is running, so I can add some liquidity :)

What was again the purpose of the wrapped Hive? I am missing the big picture!

wHive is an ERC20 token, meaning we can be listed on decentralized exchanges such as Uniswap. This is good for liquidity, and good for decentralization. Right now we depend on binance, bittrex etc to list us on their exchanges.

It gets it involved in Ethereum DeFi.

Hive (wHIVE) could be bought using uniswap for example.

Great news :D good job my friend, can’t wait to see it fully working ! Hive on

Great work, @fbslo, for the community.😎 👏

great work!

Great work on advancing this @fbslo! We are lucky to have you focusing your efforts here.

Thank you for your hard work.

Can’t wait for the wHIVE launch

@fbslo excellent development of the wrapped HIVE.
And thank you for your assistance when I tried to use this service.

I'll keep in touch.
@Yehey

Wow muy intersante lo que has explayado, gracias por compartir.

Wrapped hive is gonna change lives

Sounds interesting.

Well done @fbslo! Congrats and definitely an exciting project!

@fbslo let me get this clear as possible. You are building a system that integrates HIVE into Ethereum blockchain as NFTs using wHIVE?
If so, it's freaking cool , that will definitely rise HIVE price. 😎
If not, please explain it to me as if I was a 5yo kid. 🙏

Not exactly as NFTs, but it will allow using Hive in the Ethereum ecosystem since wHive is an ERC20 token and it's compatible with smart contracts.

Wonder if the hives could be done easier on EOS instead of ETH. Specially when there is also pTokens and mainy available ones like pEth pBTC and others.
https://ptokens.io/

The main reason why I decided to use ETH is that most of DeFi is happening on Ethereum ($25B locked in DeFI). It's also more developer-friendly since Ethereum is using Solidity for smart contracts while EOS is using C++.

Defi is happening on ethereum because it has a first mover advantage, but technically it wont provide any advantage, most people wont think we are on ethereum because we wont. Just like ETC or Binance Chain (ethereum clones). Not to mention the inheritance huge burden of the ethereum slippage and fees. So we get 0 advantages from the branding and all the headaches from the baggage.

Also Solidity is less popular than C++ which has more history and most people that went to CS has some sort of knowledge of the language vs Solidity which only blockchain devs know that it exist, let alone know about it. That said there are many bridges on EOS (and Steemit/Hive) to the ABI on JS, Python, Go, Rust and other languages.
https://github.com/Netherdrake/awesome-eos

Nice. Is there a post somewhere which explains how this architecture is different to the way wLEO has been done?

Congratulations @fbslo! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :

You distributed more than 97000 upvotes. Your next target is to reach 98000 upvotes.
You received more than 23000 as payout for your posts. Your next target is to reach a total payout of 24000

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Its good to visit your profile let's connect

This is so many levels of amazing! My hats off to you 🎓

Wow! Great work! read another inspirative content in Indonesian Language at KUYOU.ID! https://kuyou.id/homepage