Witnesses as Oracles: Vastly Underutilized Resource

in LeoFinance3 years ago

crystalball.jpg

A big part of the project I'm trying to build right now DEPENDS on the witness price feed. While we are trapped in the void behind the firewall the only way to guess how much FIRE tokens are worth will be to assume they are pegged to Hive. Not a great solution but it should be good enough in the beginning. Considering the only way to create FIRE will be to send HIVE to @null it makes sense that it would maintain the peg for at least long enough to come up with some better solutions.

This peg is very important because it will estimate the value of FIRE. Using that estimation I'll figure out the value of all the other tokens (MANA, LIGHTNING, ICE) so if the value of FIRE is wrong the value of all the other tokens will also be proportionately incorrect.

I'm starting to realize that even though the price of FIRE should be hard-pegged to the upside due to being able to destroy HIVE for it, this is actually not the case. It's possible that FIRE is worth more than Hive and users wouldn't realize it because there is no other baseline but the price feed.

When it really comes down to it, the only way to know how much something is worth is to track how much users on the outside of the network are paying for it. When I boot up this project there will be very little connection to the outside so this will be quite hard to calculate. I'll figure it out. Definitely need to set up over-the-counter trades. Shouldn't be too hard.

witness.jpg

Do you solemnly swear to to tell the truth, the whole truth, and nothing but the truth?

Sure, why not?

But the point of this post is to showcase how ridiculous Hive is in many aspects. I always get reminded of these facts when I find the strength to continue development and learning about the API. Our documentation is trash and our functions are cluttered and nonsensical half the time. We always need more devs. Hopefully this time around we'll actually be able to retain them rather than lose them to the bear market.

t1.jpg

So yesterday I started tracking the price feed.

There are so many things wrong here I don't even know where to begin. First of all lets start with why the price feed exists. Hive does not know how much HBD to print without it. If 1 Hive is worth 10 cents very little HBD will get printed because HBD printing needs to match inflation. If our inflation rate is only 8% we need to print less HBD when the price is low so we don't print too much. If 1 Hive was worth $10 we'd print x100 times more HBD than if it was 10 cents.

So what's wrong.

So so many things... first of all, this 'feed_publish' operation isn't the only way for witnesses to change the feed. Many witnesses started doing it another way more recently.

https://github.com/someguy123/hivefeed-js

@someguy123
@drakos
@yabapmatt
@rishi556 (@hextech witness)

So apparently even my own witness team has a hand in this.
There's a new way to post price feed that looks like this:

t1.jpg

witness_set_properties

By changing the hbd_exchange_rate on the witness properties this gives witnesses another way to change the feed. Why is this useful? Because the feed_publish operation requires the active key and the witness_set_properties only requires the witness' signing key. It's a nice way to add some protection to the active key so that funds can be less easily stolen in the event of a hack.

The problem with this clusterfuck is that how the hell am I supposed to convert this gigantic hex string into the useful price feed that I actually require?

19020000000000000353424400000000e80300000000000003535445454d0000

17020000000000000353424400000000e80300000000000003535445454d0000

fa010000000000000353424400000000e80300000000000003535445454d0000

18020000000000000353424400000000e80300000000000003535445454d0000

79020000000000000353424400000000e80300000000000003535445454d0000

85020000000000000353424400000000e80300000000000003535445454d0000

Upon further review, the only numbers that change are the first four digits. This makes sense as only the HBD price changes while the other three variables remain static. So what happens when we run this thing through a HEX decoder?

https://codebeautify.org/hex-string-converter

t1.jpg

SBD and STEEM!!!!!

GAH, I thought we were past this bullshit! The ghost of Christmas Hostile Takeover remains. Not only that, it wasn't even able to decode the beginning part that I actually need. Here's what it's supposed to look like:

base: '0.505 HBD', quote: '1.000 HIVE'

Considering there are only 4 parts to this hex it's probably:

0.505 SBD 1.000 STEEM

That's being stored in the code. The reason why 3 of the parts remain static across all witness_set_properties updates is because "SBD 1.000 STEEM" never changes.

No problem, right?

I should easily be able to find the documentation on this. All I have to do is decode 4 hex digits. How hard could it be? Over an hour later and all I have is more questions as I fall down the rabbit hole of shitty documentation wondering how this patchwork hackjob operates.

https://openhive-network.github.io/dhive/index.html

I use this DHIVE API. There are many clues here.

t1.jpg

It appears as though the price has been serialized into this hexadecimal form. Serialization is a very important process that occurs when we need every node to be on exactly the same page. A single digit out of place would cause an error and possibly even an unintended fork of the network.

So how do I decode this shit?

Someone who actually knows what they are doing will let me know. 100% upvote pending. This is the future of development: getting paid to help people with their tech problems is a must. https://stackoverflow.com/ is due for a huge upgrade.

In any case

There's still a lot more stuff to say. First of all, it is very foolish to even pretend that this operation is an HDB EXCHANGE RATE. @Dan Larimar was a little to big for his britches on that one. This is not an HBD price feed it is VERY OBVIOUSLY a USD price feed. The network simply assumes that HBD is pegged to USD, which of course it is not. On top of HBD not being pegged, not using the correct verbiage is downright confusing and betrays what is actually happening in the background.

USD PRICE FEED

We need to know how much Hive is worth in terms of USD, not HBD. Why? Because USD is the larger network connected to a much bigger community. The stability of USD allows the feed to anchor Hive to the greater network, just like I'm trying to anchor my project to Hive with Fire tokens.

When the witness post their "HBD" feeds they are really posting "USD" feeds and calling it HBD as if HBD is the same thing as USD. Pretty ridiculous on every level. What do you think, @blocktrades? An HBD feed isn't useful; a USD feed is (which is exactly what we have but we call it HBD to act like we have a functioning hard-pegged stable coin). Even if we did have a hard-pegged stable coin it would still be a USD feed, as the only purpose is to determine the price according to the outside world.

oracleprophecycrystal.jpg

Underutilized

It's very clear to me that we are completely wasting one of the most valuable resources we have: witnesses. Networks like ChainLink are working day and night to come up with decentralized oracle systems, and Hive already has a decentralized oracle system built in and we don't even use it.

The only oracle service Witnesses are providing at the moment is this price feed. Why? There are so many things we could be doing with this. For example, if witnesses were feeding Bitcoin block hashes into the system we could be running lotteries and other unhackable gambling dapps on Hive. Project Lottoshi comes to mind. If witnesses were monitoring certain Bitcoin wallets or wallets on other networks we could be doing atomic swaps right now.

Conclusion

At the end of the day we always need more devs, cleaner code, and better documentation. We're constantly touting that Hive is a great place to build because "it scales". Yeah that's great. Too bad the learning curve and the documentation is dogshit. I shouldn't have to waste an hour trying to figure out how to decode a price feed. That's fucking ridiculous. Multiply that frustration by x1000 to know what it's like to try and build here. We've got a long way to go. As Jeff Bezos would say: "It's still day one."

Posted Using LeoFinance Beta

Sort:  

Speak network plans to bring oracles to Hive. We are very close to that being finished.

Why not use a price feed from coingecko.com or does that introduce other problems?

Even the devs I talk to tell me the same thing.

The problem is that I'm creating an oracle consensus algorithm (proof-of-burn).
So if the price feed gets hacked what am I going to say?
Sorry guys I guess we shouldn't have trusted a random corporation for this information!
Yeah, no shit.

This is exactly why elected politicians (witnesses) must be trusted with relaying this valuable information.
It's the entire foundation of DPOS.

But yeah if I can cheat in the beginning while everything is centralized I probably will.

The interesting thing here to note is that our witnesses don't come up with the information themselves. Their nodes reach out to other nodes like coinmarketcap, coingecko, or better yet exchange APIs like Binance, Huobi, and Bittrex to divine the info and report it to the blockchain.

The goal is to keep my node as basic as possible so that anyone can run one.
My focus is to start with only using Hive full nodes to get the info I need.
Will expand from there once I actually have a working product.

And if HBD is eliminated, would that be a solution?

I ask this because I have seen it in the opinions of other programmers.

Posted Using LeoFinance Beta

Nah we need to fix HBD it's not that hard to fix the peg.
Having a stable-coin on chain is too valuable to throw away.

Doubt solved

it won't be truly fixed till we have DeFi, CDP minting, and governance votes to stabilize the system.

But a hive defi? that would be a interesting proyect..

A CDP In what way would it help Hive?

But a hive defi? that would be a interesting proyect..

A CDP In what way would it help Hive?

So many questions about this post. I haven't been able to keep up with everything because I don't know much about cryptocurrency. But as I see the central issue is thinking we can be getting more for the coin if we weren't pegging it to USD or that the issue lies deep within the code. The reference to SBD and STEEM is a matter of comparison, right? That crypto seems to be doing better on account of having figured out their strings of code?

Also, I understand the danger of pegging the price of HBD to other decentralized currencies, but I guess in economy there's a certain element of gambit. If there's another Big Depression would that mean the prices of HBD will go to the bottom? Or could these currencies stay afloat among a scenario like that?

HBD is supposed to be pegged to $1.
Next hardfork it will be a lot more stable as anyone can print HBD for $1.05 worth of Hive.
This should cap HBD to $1.05 until we hit the haircut level,
Which is if HBD > 10% of our total market cap the pegs breaks in both directions.
We might have to raise it above 10%.

Oh, I see.

We use witness_set_properties instead of feed_publish because it only requires the signing key, which means that if someone does manage to get into our server, they won't be able to steal our funds. I recently added that feature to hivefeed-js as its the feed publisher that we use and I'd like to have our keys be as secure as possible.

Why is this useful? Because the feed_publish operation requires the active key and the witness_set_properties only requires the witness' signing key. It's a nice way to add some protection to the active key so that funds can be less easily stolen in the event of a hack.

So you'd say this statement is accurate?

I feel like feed_publish could probably be depreciated in favour of the other method since it's more secure.

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

You got more than 17500 replies.
Your next target is to reach 18000 replies.

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

Check out the last post from @hivebuzz:

Hive Tour Update - Decentralized blacklists and Mutes lists
Support the HiveBuzz project. Vote for our proposal!

Keep up the good fight for documentation devs.... ^>^ one day we might have something... Til then, I'm just hoping a full rewrite, top down comes along and sweeps me off my little feet.

Your project sound so nice and Plus goes doing a double check of what is underneath the frontend. I feel sorry that I can help little before reading this information I wasn't aware of these problems.I peak from time to time on the proposal and witness pages but most of the time I kinda forget. I thing I would love is a more Clear central hub where to see the roadmaps and project currently under construction. I sketched it a bit but left unfinished