How do you properly fuel a smart contract platform?

in #smart-contracts4 years ago (edited)

A few months ago I started writing the Virtual Machine (VM) that will power the new 2nd layer Smart Contract platform I'm building for Hive. Building a VM is not that complicated. Really. Where I'm struggling right now is how to build a Smart Contract platform that's user and dev friendly.

There are different approaches to fuel Smart Contracts, but so far none of these has proven to be the best. Ethereum is one of the best place out there to host your contracts, the problem is that the gas implementation is just ridiculous. The speculation on Ether ruined it. Then you have EOS. The idea on paper is good, but it turns out that speculation ruined it too...It seems obvious now that if you want to run a Smart Contract platform on the cheap side you'll have to make up a way to fuel it with something that people won't speculate on.

That's when it gets very difficult because you also have to think about people that will run your software. No one will do that for free. So you have to find a way to remunerate them as well.

One idea is to make the platform's utility token a stable coin. 1 utility token would represent $1 on the platform. That's achievable through oracles, you just need to provide the smart contract platform with the price of Hive periodically. The Hive tokens received (in a centralized account) would be used to pay for the nodes owners and the platform developments.

Also, what I want to do is to let the devs of the smart contracts choose who will pay for the storage and the execution of their contracts. Let's say I need to issue tokens, then me, the developer, will pay for that. The users want to transfer tokens to someone else, then maybe I'll make them pay for that. (That's one thing I like about EOS, you decide who pays for the storage).

What do you think about these ideas? How would you fuel your smart contract platform if you were to create one? Don't tell me you would make it "free" for everyone, there's no such thing 🙂

PS: I'm planning on setting up a testnet soon. Maybe I'll first release a version without "gas" or maybe something where you'll be limited on how much "storage"/"execution time" you can use.

Sort:  

Getting back to basics here. There are no transaction fees on Hive and the block producers get compensated by inflation, if token holders vote for them as witnesses. Why does the second layer have to have transaction fees as a model for compensating block producers?

That's definitely a good question!
There are transaction fees on Hive, they just work differently than most of other blockchains. You could definitely pay block producers (BP) with inflation on the second layer too. But, then you have to find a utility for these tokens otherwise your BPs are "working" for free (or for tokens that are worth nothing). Also, having such tokens will definitely trigger speculation, which I would really like to avoid. Let's say a transaction costs $0.00001, then no matter how the price of Hive goes, you'll still pay $0.00001 for your transactions. I'm not saying that the users have to pay for everything, developers can pay for the fees (or part of them). When you host your app on AWS, you have to pay for the usage, same goes for blockchains. Also, when you let people run arbitrary code on your platform, you want to have a way to limit them, otherwise they'll start eat up all the ressources available.

Yep, so the concept of Resource Credits was born to quantify and put limits on resource usage. It sounds like you are dealing with all the same problems of the base layer. And these problems were solved well on the base layer (Hive), or at least it seems like that to me, but I don't know if you see it the same way.

Delegating Resource Credits also seems another quite useful feature that's coming which I imagine could be useful also to the second layer if it utilizes something like RCs.

Regarding utility, don't you have that problem anyways? If you pay BPs with crypto, whether directly or through inflation, the token you pay them with has to be worth something.

Regarding speculation - if the price of Hive goes up, does the cost of transactions go up? I am not sure. Maybe you have more insight. The cost of transactions is quantified by Resource Credits and it stays the same regardless of Hive price. But you accumulate RCs if you stake Hive, so there is an indirect connection between Hive price and RCs/transactions. But we've seen Hive (well, Steem) prices of $6-$7 and it didn't create any problems with transactions becoming expensive. Maybe for newcomers who have to stake it is more expensive, but it is a one-time expense to stake the tokens and then your RCs get continuously replenished. So that's a fundamental difference between the RCs model and models where you pay for transactions with a token that can be speculated on.

I need to think if there is a way to leverage the Hive RCs (or Hive Power), and maybe couple this with a "stable" token. Let's say you have 1,000 Hive Power and today the price of Hive is $1, then you have 1,000 credits available on the side chain. With 1,000 credits, you can probably trigger a bunch of smart contracts that will use up your credits at 1 credit equals $1. Tomorrow, the Hive price goes down to $0.5, that only gives you 500 credits to use up on the sidechain, but your credits are still worth $1 on the sidechain (so you're not paying less or more to interact with the sidechain, you just have less ressources available). At this point, there are no bad ideas I think...

Sounds very exciting!

I really like this idea, making the gas nonspeculative and one way to do is make the utility token a stable coin. On 3Speak we have the same issue, "RC's" for posting to the IPFS storage system for videos. We separated the utility token, stripped it of everything but its utility, and are doing sorta of a hybrid between how Hive works with RC's and how GAS works with Neo.

But I believe the idea of pagging the utility token as a stable coin.

Yeah, I wish that HBD was more stable than it is right now. That could have been a really nice asset to leverage for the "gas" implementation!
I'd like to read more about your implementation for 3speak, is there someone I can reach out? Or maybe some posts/documents I can read? That sounds interesting.

We are about 95% done with the whitepaper, I'll send it over once it's finished. Should be this week.

Here are some of my thoughts. I am definitely not an expert, so I would appreciate a response pointing out the flaws in my comment.

The costs of smart contracts is, like everything else, based on supply and demand. Running smart contracts on Eth was pretty cheap when the network wasn't clogged and there wasn't so much demand. Since demand has been constantly increasing, the problem that needs to be solved is supply.

The question becomes: Is it possible to to increase the supply?

The answer is yes. More nodes, more storage. We need a lot of technological improvements in hardware before witnessing the birth of scalable blockchains.
It is also maybe possible to have some algorithms that consume less resources. But this still can't allow full scalability for all of humanity.

So before technology makes everything cheaper, I think we're doomed to have very expensive smart contracts, or to have a very small amount of people using them.

If I understood correctly, your method will remove the speculation premium costs on EOS, but how much more scalable will that be? 10X or 100X? Still not enough imo.

Well, basically, it could only be as scalable as Hive is. All the second layer transactions first go through Hive. So, even if you go fast, you can't go faster than 1 block every 3 seconds. I'm not trying to make the fastest or the most scalable second layer blockchain, we just need to be as fast as Hive.
What I'm trying to do is to make the usage of that second layer tool as smooth as using Hive.

I see. Will keep an eye on this project it sounds interesting.

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

You received more than 3250 upvotes. Your next target is to reach 3500 upvotes.

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

How to incetevize humans in the right way :)

How do you plan to be cheaper than Eth?

make it interoperable with hive engine tokens.

Think of the following scenario: developer A writes a piece of code to be executed as a "smart contract" (distributed, trust-minimized computation). That means redundant execution, or else the "trust minimization" part disapears and then it's just a piece of code like the current-day apps using Hive as blockchain back-end.

The piece of code is advertised by developer A as doing ... something ... However, it is its users who are able to say whether indeed that piece of code does indeed what it claims to be doing ... or whether there has been a misrepresentation (whether accidental or intended) by developer A of its code's utility ...

Yet that "reconciliation" between "what developer A claims" and "what the users experience" can be done only after the code has been executed on several nodes (which has costs). This introduces a notion of "credit".

Normally the users should pay for the code execution. It is up to them to decide how much "trust minimization" they need, i.e. on how many machines the code should run. Perhaps it's just one (as in the current Hive and Steem apps) or perhaps it's 20 machines - knowing that the price will increase proportionnally ...

The price for running the code on a machine should be asked by the machines offering to run it ... so ideally you'll need a market where people with VMs ask various prices to run any given piece of code and then users who want to have that code run come and "bid" for those runs at their respective prices ... or less (the principle of a market ... perhaps the code is not well written and consumes too much machine resources with respect to the perceived utility it provides to users).

Indeed these markets (one per smart contract) should be quoted in a stable coin such as the HBD.

So what I would suggest is to create a "factory" that can instantiate an "internal market", like in bitShares. In hive we only have Hive <-> HBD but here instead of "Hive" anyone would be able to bid and ask for "runs of a given smart contract".

What do you think ?