Implementing a Truly Decentralized Solidity Smart Contract Capable EVM (Ethereum) Side-Chain to HIVE and the Future Decentralization of the Hive.Loans Chain Moving Forward.

in #hive-dev3 years ago (edited)

image.png

The Hive.Loans Idea

Many months ago before starting the Hive.Loans development the idea was fleshed out with a few users on here and myself as I'd had the initial idea but was completely unsure of the feasibility of it all. Once it was determined the basis of "account as collateral" would in-fact work given the plethora of operations available to users here on the HIVE blockchain secondary thoughts began to surface in my own mind on how to make the idea better:

  • "Can we make this FULLY decentralized in time?"
  • "Will it be possible to make this so everyone can run a lending site of their own?"
  • "Can support for multiple token types such as Hive-Engine and SMTs be baked in?"
  • "Is it possible to create a truly decentralized side chain to operate the lending?"

After enough time to think about all of these things the answer that came back for all of the above questions was a resounding YES.. Although the exact details of it all had yet to be worked out in my head.. I knew I could do decentralized websites via IPFS hosting on multiple nodes to ensure the website / front end would be not limited to being served on one server, which solved the front end decentralization issue.. But what about the back end stuff? How would it be possible to make a decentralized back end to operate all the contract code and whatnot that ultimately drove the functionality of the website? The answer came from a place I didn't honestly expect.

Bringing Solidity Smart Contracts via Decentralized EVM

image.png

While up until recently I was basically 100% against Ethereum for various reasons, the realization that condemning such a useful technology and all of its components due to my own beliefs was brought to the forefront of my mind and after working my way through why I didn't like Ethereum it was decided that I don't necessarily have to like ETH in order to take advantage of the incredible technology under it's hood which is the Ethereum Virtual Machine or EVM. With EVM you can run smart contracts written in a number of different languages which are then compiled down to Web Assembly bytecodes and then can be run on the EVM stack for all to see. One neat feature of the Ethereum chain I didn't realize up until a few days ago was that a person could effectively set up a private EVM instance (sort of like Binance Chain BnB) and use that to run smart contracts on. With even further research into this thing it was discovered that even though the EVM chain was "private" it could be run on multiple nodes, thus implementing proper decentralization into the mix.

With all of this now discovered my mind quickly put all of the parts together and came up with a solution not only for how to properly decentralize the Hive.Loans back end contract stuff.. But also on how to bring proper decentralization and smart contract capability to a HIVE sidechain which will come in the form of a heavily modified private EVM instance that will eventually operate as a PoW sidechain that uses HIVE instead of ETH for gas fees, with the majority of the HIVE gas fees being paid out to miners who help calculate the functions on the EVM stack. Using this method not only will the Hive.Loans back end be hosted on various nodes thus providing proper decentralization of the contracts but also bringing proper "DeFi" and smart contracts to the HIVE blockchain via the Hive.Loans EVM Side-Chain.

This will allow for ANY Ethereum smart contract code to be ported over to the Hive.Loans smart contract capable EVM instance as well as bring fourth the ability for the Hive.Loans chain to host things like ERC-20 tokens, Ethereum like NFT offers and full support for basically anything that Ethereum can do being ported onto HIVE. If Binance exchange can run a centralized private EVM chain and have it's price go up and over $200 a token there... Imagine the future price of HIVE if we were, as a community, able to offer the same capability of Ethereum and it's EVM for 1/1000th of the price of the original Ethereum network but with HIVE being used as gas? Right though? That is a hell of an exciting concept and one that most certainly will be the focus of Hive.Loans development.

Future Decentralization of the Hive.Loans Chain

image.png

While hopefully included in the v1.0.0 release of Hive.Loans which is aimed to launch around mid April, the total decentralization of the the Hive.Loans project and the implementation of the Hive.Loans EVM sidechain are something that is coming to HIVE here in the upcoming months. I'm currently working on getting a non-decentralized proof of concept built and tested to release regardless of the EVM side chain getting released just so we have something to lend on regardless of the progress of the Hive.Loans Private EVM Chain but the ultimate goal is to have Hive.Loans run most of it's back end stuff regarding contracts on the Hive.Loans EVM chain.

A ton of work still needs to be done to make this a reality and I'm not 100% sure I'll have all of the parts in place and working by mid April to facilitate this but that is the goal. To have a 100% decentralized open-sourced lending platform with tribe owners running their own Hive.Loans instance featuring their token and an EVM node to help bolster decentralization. Given that the Hive.Loans EVM chain will likely end up some form of Proof of Work it might also be possible in the future to allow for the release of a client that any user can run on their desktop computer to act as a Hive.Loans EVM mining node that would be paid in HIVE for the work they do and ultimately exist for the sole purpose of further decentralization of the Hive.Loans EVM chain. The biggest part of all this will be reverse engineering and modifying Ethereum in order to accept cross chain transfers of HIVE as gas fee but once this issue is solved then we're golden.

I'd briefly considered creating my own sidechain token similar to how Binance has BnB but decided that the best way to bring value to the HIVE network as a whole is to utilize HIVE as the token on the Hive.Loans EVM chain not only to bring a greater demand for the token but also to help curb inflation. Perhaps the Hive.Loans EVM chain burns a percentage of the HIVE gas fees and distributes the rest to the miner calculating the EVM step.. Plenty of ways this could be done and ultimately it'll be developed in a way that maximizes its positive effects on the HIVE ecosystem, with stuff like the Hive.Loans site profit taking a back seat to HIVE as a whole profiting.

I appologize for the wall of text in this post.. But there is a lot to explain regarding the future of Hive.Loans and it's fully capable EVM based chain. This post only scratches the surface of the incredible amount of potential that this sort of thing could bring to HIVE and in future posts I'll dive deeper into how exactly this will become a reality and it's future ramifications here on HIVE.

Assuming this all gets built properly and is proven to be secure and feasible this could very well be the beginning of HIVE not only becoming a house hold name but also completely decimating any competing chains. I'll post more info on the implementation of this as more progress is made but after the centralized version of Hive.Loans is shown to be operational the EVM version is the #1 priority.. As the result of it coming online will change everything we know about the future of HIVE.


image.png

Vote KLYE for Witness, Every Single Vote Helps, Thanks for the Support!

Need to get in Contact with KLYE?
Join the Official #KLYE Discord Server Today!


image.png
Looking for an Affordable, Secure & Reliable Server Host for Your Witness Server or Other Web Related Projects? Check out Privex.io!

Sort:  

TL:DR;

Ethereum smart contract capabilities are coming to HIVE because Hive.Loans needed to find a way to decentralize their lending contracts. Decided that everyone should be able to use this sidechain and that HIVE will be it's base currency for gas fees.
Any ethereum smart contract code will be able to be deployed to the sidechain with some minor modifications.

All the perks and features of Ethereum at 0.01% the cost. ERC-20 style tokens, mining with HIVE rewards and properly decentralized "DeFi" applications for anyone wishing to use it. Seems like an overall win for Hive.Loans and the community!

Potential Side-Chain Names:

HSC - Hive side chain
EOH - Ethereum on Hive
HOE - Hive on Ethereum
??? - Type your name below!

Since Binance did this with BSC - Binance Smart Chain,

I think it would make sense to call it HSC - Hive Smart Chain so that everyone knows instantly what it is

HSC would be a great name.

What do you mean Hive on Ethereum is a bad name? XD

Yeah I agree though. We might end up going with that.

This sounds amazing

@kyle - good initiative

just to understand more,

Are you thinking of adding the EVM logic inside the Grapahene/Hive so that the smart contracts written in Solidity/Vyper can be executed in the EVM

or

Keeping the EVM elsewhere on different machines and then the results passed to Hive

Open to suggestions. The architecture of the sidechain itself is something I've been exploring possibility wise the past week and a half. If you have some insight or working knowledge of this sort of thing please let me know, would certainly allow you to contribute to our communities functionality upgrade.

Talk soon captain!

I have done a Bitcoin-Peerplays(Graphene) sidechain and all the documents are here : https://peerplays.gitbook.io/community-project-docs/son/bitcoin-sons

This is a trust-less, decentralized system.

Development Work on a similar system for Hive-Peerplays is on going and the Ethereum-Peerplays is under design.

The second model I am familiar with but not hands on is bringing EVM inside the Hive/Grapehene Core. But not in a position to suggest more details as I couldn't really test it beyond playing with the code.

Oh hell yeah right on man! Will certainly have a detailed look on how you've built this! Highly appreciate the share of knowledge and letting me take a peak behind the curtains of how you're done your sidechain. :)

Facilitating widely accepted cross chain communication is a topic I'm having to seriously read more and more into, seems the more research I do the more interesting technology comes to the surface.

Is the code for all this tucked away somewhere where it's publicly accessible or you close sourcing it for now? I'd love to se how you've got it all set up and if the architecture would lend itself having EVM integrated into it.

Thanks again captain!

Is the code for all this tucked away somewhere where it's publicly accessible or you close sourcing it for now? I'd love to se how you've got it all set up and if the architecture would lend itself having EVM integrated into it.
:-)

  1. code is here : https://github.com/peerplays-network/peerplays
  2. docs : https://www.peerplays.tech/technology/sidechain-operator-nodes-sons

The EVM stuff is private for the time being. We need to figure out the next steps with it.

I have started to learn Solidity a few days ago. I bought one course on Udemy.

Posted using Dapplr

Great!

I took my first foray into Solidity and EVM a few months back and was captivated by the technology..

I don't really like Ethereum.. But I dig the EVM stack!

Did you walk through some online courses? Or did you just read some documentation?

A lot of it for me was diving into other people's github code and messing around with trial and error.

More of a hands on learning type so actually coding it and running it was the best way for me to learn.
Still tons of stuff I need to learn about EVM and solidity to be a master, but I understand enough to use it now.

Truly awesome stuff, and I'd imagine you'd easily get support for having more devs work on this. Just let us know what you need. I really like and appreciate what you are envisioning.

Thanks captain!

I've contacted a buddy of mine who would fit the bill to come help me build this thing out, as it's grown beyond the scope of 1 developer to get done in the allotted time.. Ah well. More the merrier!

<3

Really exciting stuff here my friend. You stuck gold with this in my opinion although I didnt fully grasp about 40% of what you wrote. Anyway, when it comes to the coding, I know you know your stuff so the excitement you have is encouraging.

I like the thought that if someone else can set it up like Binance or Bangor, so can we. This is really going to add to the utility of the Hive token if you can put all this together.

Great write up too. Dont worry about being wordy when you truly have something to say.

Aye man. I apologize for not making it easier to digest, often forget that not everyone has the terminology in their heads that I do.. Will try to make it more user readable and less tech jargon in the future here.

The big takeaway from this though is that if all goes well there is NOTHING (other than some development time) stopping us from launching our own version of Ethereum or Binance Chain that uses HIVE instead of ETH or BnB for gas fees.

Could you imagine ERC-20 tokens here on HIVE? I can and I did and that is part of the reason the back end of Hive.Loans will live on a decentralized EVM capable sidechain that is powered by HIVE instead of a proprietary token.

That part I caught. LOL

And it is truly exciting. If that can be pulled off, which you believe it can, that is truly revolutionary. We will be able to leverage what is here to much greater heights.

This is really welcome news.

A Hive Side Chain that provides all that Ethereum and BSC do.

That will be amazing.

I'm 100% it can be pulled off. While not 100% a ETH or BnB clone most of the code is already written. It's now just simply a matter of back engineering ETH to run on HIVE and we're off to the races.

Some minor details like how addresses work and whatnot will likely get tweaked eventually as well but for the start the focus will be on getting EVM to work with HIVE.. Once that is done there will be literally no reason for us to use ETH anymore as we'll have all the functionality of it here on HIVE, paid for with HIVE, supporting HIVE. :)

If I remember right @therealwolf had a recent Twitter discussion about that. I really think having a Hive Side Chain would give Hive what it needs to take-off.

Well.. If the centralized Binance chain is worth $200+ a token... If we ported their market cap over to the HIVE supply it works out to something like $85 pre a HIVE..

I don't know about you but that would make me pretty darn happy.

Me too. 😅

Having an "EVM-compatible" sidechain would be priceless to Hive. We would be able to "port" so many great projects from Ethereum/BSC. Literally, there won't be a reason not to use Hive Ecosystem.

P.S. Maybe I'm biased or slightly exaggerating, who knows... 😅

It would give us the ability to use our native token to do the same functions as many of the top market cap coins..

But yeah.. I imagine the explosion of apps with true DEFI, uniswap clones and yield farms going up all over the place. One other thing is I plan to make sure we're able to bridge the other token types and address them within the EVM stack itself so nothing prevents us from doing HE token smart contracts or future SMT contracts with it.

It's going to be an assload of work, but it was born out of my own necesitty and will very likely have a great upwards price adjustment effect on the chain as the inflation gets leveled out by the EVM gas fees which ultimately get in part burnt (sent to null), distributed to miners and pay a small developer fee.

!PIZZA I love the sound of this @klye !BEER

Connect

Trade


@klye! I sent you a slice of $PIZZA on behalf of @hivecoffee.

Learn more about $PIZZA Token at hive.pizza (1/10)


Hey @klye, here is a little bit of BEER from @hivecoffee for you. Enjoy it!

Learn how to earn FREE BEER each day by staking your BEER.

Building & integrating something like this into Hive is difficult; so I'd take everything somebody is promising in that regards with a grain of salt. Since Blocktrades & Team is basically leading Hive core-development, they have to be on-board; otherwise, it won't be a smooth integration that we need.

Great idea. Looking forward to this.

With all the other sidechain projects going on here with HIVE figured if I was going to do one it had to be something groundbreaking. Hopefully able to get my friend on board to help develop and test the thing.

Pretty excited about this though to be honest.

You're are owning mate!

Have a q though, there was already a talk (unofficially) to fork BSC and create HSC by the same method, however, the stakeholders would get to vote for the new set of witnesses instead of needing to rely on BNB validators.

Is this something you've been told about or it's just a coincidence?

Hope you get what I wanted to say haha.

I personally don't see a sense in integrating a DPOS system into the sidechain because truth be told between you and I.. I think the DPOS system has some glaring weaknesses that tend to push it towards functioning in ways politically that I find to be detrimental to the whole decentralization concept.

Not to take a shot at our witnesses.. They are great dudes and ladies.. But it's not terribly far back in the past where you can see some of the glaring faults of DPOS based systems costed people millions of dollars out of their own pockets in addition to all the years spent promoting the chain we fled from.

Eventually anyone with a computer will be able to become a HSC mining node and thus be able to help protect the sidechain through decentralization all the while earning a little HIVE on the side for their efforts. My guess is that out of the box when HSC launches though it'll be only those techy types that run a Hive.Loans fork and their own lending platform which will under the hood be running a HSC instance that will communicate with the genesis node which starts the EVM under the hood of Hive.Loans.

Hmm so it be some sort of CPU POW mining? If it is, then it be ideal to use something like Komodod DPOW to secure the POW with bitcoin hash while still having CPU.

POW is just POS but where instead of token holders deciding the fate of the chain it is done by miners with the biggest fiat wallets that can purshase hardware. And then you have the whole scalability and high fee issues that POW has. There is a reason why Ethereum is on the path to transfer to POS.

You can't avoid politics, you either design the chain with on-chain governance or you leave it with one that is ad hoc that can only be resolved via contentious forks, hashing wars and 51% attacks.

The way I see it the main issue with the current DPOS implementation is that the only way to protect the chain is with long staking periods that gives little incentive for money attacks. The whole Stinc debacle could have been avoided if the system was designed to avoid minority attacks.

The 30 day governance waiting period that was included in the last hive HF is a stop gap. You "only" need 65.5 million hive to take over consensus which is about half of what is on the exchanges. The main design changes that I would make to DPOS is to remove the 30 vote rule and change it to a "one hive = one vote" system and give an economic incentive to participate in governance by only paying staking rewards to the accounts that vote for block producers.

In such a system you could still vote for several witnesses but each additional vote would decrease the strength of each one instead of multiplying it by 30 like we have today.

You're thinking of public chain settings using standard release builds where anyone can come in and do POW hashing provided they have your network ID. The HSC isn't going to provide that ability one in part because the EVM executable itself is going to be a heavily modified instance that won't even be able to understand classic ETH clients and also because there are ways to mitigate the advantage that having a large amount of hashpower will yield miners depending on how you configure the chain to select block miner. It's doable to have a properly decentralized private EVM chain setup between PoW users without favouring hashrate and by going this route by the look of it we should be able to avoid a lot of the classical failures of small PoW networks.

You can avoid politics if you make it trustless and human interaction completely optional. Because HSC v1.0 will actually serve as a means of burning HIVE rather than adding to inflation I think you'll see that it ends up actually attracting more decentralization as mining clients become available allowing even low power devices the chance to hash blocks to earn some HIVE which comes from the gas fees paid in HIVE.

I'm not making anything DPOS on this sidechain.. There isn't going to be a risk of 51% attacks or lots of the other classical ETH downfalls due to the EVM binary itself changing to a point where it can't be directly compared to existing popular EVM capable chains. It's going to be of based around an already existing chain with it's own set of rules, It merely adds more ways to utilize your HIVE, but not a free transaction like base layer chain operations.. You pay the sidechain to pay the miners to mine the blocks to do your decentralized function call or whatever. It all runs on HIVE, the total HIVE token cap is slightly reduced by burning some percentage of the gas fee to @null. Most goes to the miner of that block then a sustainable amount goes to a developer fund for future R&D.

DPOS used to be qutie strong in my eyes but Sun Yuchen totally spooked me off it being bulletproof. :/

Yeah. In the event that HIVE gets taken over again we just fork and do our own thing again.. :(

It's doable to have a properly decentralized private EVM chain setup between PoW users without favouring hashrate...

Now you peaked my interest, it will be very interesting to see how the game theory plays out which such a design. Thanks for the detailed explanation.

No problem! You certainly raised some very valid points though for anyone just going in and cloning ETH without much thought to how it needs to operate given it's determined goal. Much appreciated!

some weeks ago I had a conversation on Twitter about the same thing with realwolf :D BSC to Hive :)

It's so awesome and i really love that idea :)

Cool you look at it!!! Good job!!!

I must have heard the conversation in the collective unconscious then. Funny how this happens sometimes, you hear of an idea and somewhere else it gets kicking into action.

that's the power of hive :D

Share ideas are the best thing everybody can do. Someone pick it up and build awesome things :)

Are you guys ready?

I don't think they are.. This side chain will likely be thee "killer app" for HIVE this year.

Just wait till folks realize what's up ;) ;)

Posted via D.Buzz

Wow this is epic; I never understood you could run a private EVM instance.

Hope you get some help to get this moving.

I didn't understand we could do private EVM instances either until I started reading the whole technical documents on the thing either which was sparked by the curiosity of how Binance did their chain. :)

Hoping to Hire a friend to help me with this.

That would be so epic; this has the potential to change change everything for Hive.
Is the Binance EVM instance still PoW or did they move to POS?

Binance chain as far as I know is using a method of block production that doesn't involve other nodes but I might be wrong. There is a few ways you can set your chain up and not all of them involve multiple nodes or decentralization.

They kinda use a limited POS-POSA where select validators stake BNB and thus make blocks-think of it like the top 21.

I've looked into the various configurations that these private EVM's can be run in and honestly it was quite an eye opener and the reason that it was decided this was a path that must be explored and brought to fruition.

Not a huge fan of the way Ethereum is/was run tbh but I do dig the technology it's got under the hood.

Yeah Private Virtual machine aren't new. Counterparty once had it-softforking smartcontract on bitcoin though it wasn't on a sidechain and suffered support for it didn't use bitcoin as native gas token. Suprised that it now catching on though

I am excited. These are excellent prospects.

Greetings Michael

!invest_vote
!jeenger

@mima2606 denkt du hast ein Vote durch @investinthefutur verdient!
@mima2606 thinks you have earned a vote of @investinthefutur !

Your contribution was curated manually by @mima2606
Keep up the good work!

Wow exelente`post muy instructivo, gracias por compartir.

Leo Finance is working on a hive based DeFi too.
Would be cool if you both defi apps were on the same chain

There are a number of sidechain products all working on their own take of decentralized contracts. Interesting to see them all come up with their own spin or take on what they consider decentralization.

Honestly just looked at the market and decided against trying to make something "unique" and instead focus on implementing functionality we already know the entire crypto ecosystem is willing to pay good money for as evident by the top 10 coin market cap functionality.

Nobody from Leo has ever approached me in regards to anything development wise but I'd be interested to hear from them to see what their take on doing "DeFi" is.. Mine is simple give us the same tools that the networks that traditionally support "DeFi" and charge our native token for it.

Note that "DeFi" here is referring to those terrible HYIP and PONZI solidty smart contracts they have on Ethereum and BnB or whatever the cool kids crypto on these days. :P

Even if we aren't on the same chain the goal is to be able to build in cross chain bridges quite easily and perhaps even natively support some other side chain tokens off the hop. We'll see here shortly once my dev partner and I get out testnet started here locally. :)

Gotcha. Though cross-bridges are a pretty hard thing to do. Often many of these cross-bridges either new a unique extra code language that both chains need-Cosmos and Polkadot or use a POS/collateral secured relay i.e renbtc or tbtc. If there are plans, just know it pretty hard to "bridge out" with a common code relay. Anyways Best of luck!

Depends on whatever crazy block output the connecting chain has.. If it's something machine readable in a consistent and known format that can be spat out then it's pretty easy to pick up with another system.

Hell, it wouldn't be impossible to have a smart contract on HSC to do nothing but act as a gateway or access point for other sidechains.. That is the beauty about doing it the custom EVM route.

Hell you could use any ledger that these sidechains can get data out to really. even something like IPFS could be used to send stuff across chains. As for natively supported alternative tokens going to have to see what I can come up with.. have a few ideas but won't know for sure if they'll work as planned till I have a whack at it.

!wine


Congratulations, @theguruasia You Successfully Shared 0.300 WINE With @klye.
You Earned 0.300 WINE As Curation Reward.
You Utilized 3/3 Successful Calls.

wine-greeting
Total Purchase : 24005.572 WINE & Last Price : 0.290 HIVE
HURRY UP & GET YOUR SPOT IN WINE INITIAL TOKEN OFFERING -ITO-


WINE Current Market Price : 0.271 HIVE

I am still very interested in this.