oxen-io / oxen-core

Oxen core repository, containing oxend and oxen cli wallets
https://oxen.io
Other
317 stars 120 forks source link

Loki Proof of work is being exploited by FPGA (without mergemining will be a major issue) #661

Closed SomethingGettingWrong closed 4 years ago

SomethingGettingWrong commented 5 years ago

Hello Loki Team

Thankyou for taking the time to read this long post! I realize it might be duanting but its imperative you read it as the exact same thing happening to graft is currently happening to loki. The only protection has been the massive mergemining hashrate!" Once turtle forks away you will be in the same if not worse boat then graft! I will use graft as an example as I have written it out for them by request!

I would like to first point out I have been in and out of crypto since 2009. I have a background in Biomedical engineering, Electrical engineering, Physics, and Chemistry! This has led me to be very decisive and recognize patterns. One of my best online crypto friends Jagarman42 is an economist as well as a Computer science major. I approached him in a private message a few months back and explained that I saw patterns in crypto and basically asked him questions until I had enough with his help that I fully understood the majority of block chain. With these thoughts I was able to rearrange some equations and create some of my own that allowed me to view the block chain as a miner and allowed me to mathematically predict profitability among other things.

Without going into too much detail on the equations as it is my miner’s edge and I don’t care to really share them.(im not doing myself a favor... doing this) I was however asked nicely by a friend Tiago from graft to explain some things and it is just as much pertinent to loki! So I decided to go ahead and share some of them with everyone in an attempt to explain the current state of graft and why FPGAS are bad for the network and other coins in this situation and to what end which selection of Algo matters!

First you need to understand a few things about the blockchain network and mining before you will begin to understand and grasp why FPGAS are bad for the network! Ultimately their hash rate doesn’t translate to increased price with the difficulty raised on the network! This might be a little tough to follow but I will do the best I can to explain it in English. A miner’s job is to be a part of emission. It should cost him as much to mint a coin as it cost on the exchange. The emission curve is set by a project. It consists of a block target time and a block reward (that may expand or shrink with time). There are also a few equations as mentioned above we need to discuss. Among them are two important ones for mining profitability.

*Difficulty=Networkhashrateblocktargettime**

The networks Difficulty raises by a factor of the Blocktarget time everytime more hash is added to the network. The Difficulty of the network is the number at which a block is found. It happens approximately every 120 seconds on Graft and on loki. But for the examples I have already calculated it out for graft. The hash’s on each cpu/gpu/fpga are all rolling in an attempt to randomly roll that number.

Let us use graft as an example. (another coin with this same exact issue)

*_120,000,000=1megahash120seconds._**

If the network was 1 megahash then if a hash was rolled over 120 million then the node that the hash belonged too would result in it getting the block reward. It is broadcast across the network and everyone starts rolling again. Now something you must understand about a miner is that they will not mine at a loss. They have a certain amount of electricity they pay for daily! Also depending upon the algo that they are mining it changes how much electricity it cost. Something else that changes is Hashvalue. Both of these are what determine if a miner stays are leaves a network.

Hashvalue is how much each hash on the network is worth. It’s the total network hashrate split among exchange price.

Hashvalue= (blockrewardexchangeprice)/(networkhashrateblocktargettime)

Simply put that means that each individual hash on the network is determined by the amount of people on the network multiplied by how often a block is found divided into the amount of graft in the block and the corresponding price each graft is sold for on the exchange.

*_networkhasrateblocktargettime=diffiulty_**

*_Hashvalue=(blockrewardexhangeprie)/difficulty_**

With graft as an example (but with loki dealing wit the same issue) *_57230satoshis/651,435,893 = ‭2.63418092008633e-5‬ satoshis per hash per second_**

if we take this amount and multiply it by our miners hashrate (5000 hash) and 86,400 seconds that are in a day we come out to a profit of ‭11,379.66157477295‬ satoshis per day mining graft.

When converted it will convert to about 1.24 usd a day.

Now something else a miner will need would be how much in electricity on an algo it cost to mine daily. ON Reverse waltz my Rig gets about 840 watts. I pay 9.5 cents per kilowatthour.

Rigcostperday = ((costperkillowatt/1000)rigwattusagepersecond24hours) totalcost=((0.095/1000)840)24) totalcost=1.9152 USD per day.

Wait a minute….. im spending 1.9152 usd per day to mine graft but im only getting 1.24 usd of Graft! That means it is unprofitable to mine therefore I will move to another coin…

This is the thinking of a miner. He leaves and moves to something that’s algo is equal to are as profitable as it cost on the exchange or he will mine at a loss until the exchange price hash value was profitable for him. This is where trust and FPGA comes into play! The miners trust has to outweigh algo discrepancies and you never want to tick off your miners by saying they dump the price. They do not until they lose trust! They will then dump what they accumulated hoping for a time when the algo isn't exploited. At best they spend as much on electricity as an investor does on an exchange for graft directly. They are different in that even if the coin isnt worth that price... they are still spending it... But they are actually supporting the price while doing it. In this since they are as important if not more then investors. Because as a true investor joins.. The miners hold up the new price. Miners don't dump a price they only leave the network. Therefore miners have to trust the network and a project if they mine at a loss otherwise they just mine when it is profitable and leave when it is not. However on Graft we have a unique situation (and one on loki as well the below holds true along with mergemining). The network hash rate has dictated a difficulty far above the profitability of the network. … Something is amiss because miners don’t mine at a loss… No one does. Why would I mint a coin that cost me 1.91 in electricity but those coins are only worth 1.24 usd. That makes no since. To understand why it will make since you need to understand efficacy of an algo and trust!

If a miner trusts a network or a project he will eat the cost of electricity and mine at a loss knowing full well that the coin price will go up! However if it goes on for months he will eventually lose trust and leave. Cut his losses. But much more than that. If the difficulty is staying up for months at a time something is getting wrong. Someone has to be profiting to keep difficulty this high. So then we need to understand why. Different Gpus have different efficiency levels between 0.8x to 1.1x profitability across generations. But FPGA and Asics are 3x to 10x profitability. If the difficulty is staying up and the price is low that must mean that there is something getting profit at this increased Hash rate.

I have pegged the issue to an FPGA being on several coins currently Loki and Graft. Remember a miner never operates at a loss. Therefore if the price is 30 satoshis to the fpga but the gpu profitability breaks even point is 90 satoshis… then he is 3x as efficient. What this means is that he will dump all coins down to his profitability. So all GPUS leave and there trust for the project deteriorates. Because once it is known that FPGAs are on the network unless there is a change. Everyone knows that the profitability is equal to the fpga profitability not the gpu profitability.

In a perfect world. The difficulty is almost equal to the exchange price. As the price goes up Miners will fill in to exchange price. As the price goes down miners leave. So what is happening in proof of work is that whatever the exchange price is equates to exactly how much it cost the miner in electricity to mint it. Of course there are opportunities where an investor will bump the price up and until miners fill in the hashrate some miners get the profit difference. But ultimately a miner is a step in emission and at the end of the day on a specific reward he should get no more coins with his money spent on electricity then if buying them from the exchange. This is why block rewards should decrease as well and never ever stay equal. The job of a miner on a perfect algo is to mine at the same cost and hold it until the block reward shrinks…. At that point the trust of the network means miners keep mining and since no one sells for more then they paid for in electricity the price will go up to difficulty as the miners will sell only at a profit or if its equal in electricity. Therefore if you are a miner and you “Hodl” then you sell at lower block reward to profit.

However with the algo being exploited then all gpu miners will leave and you will have the fpga absorption of any profit difference down to his profitability. And with the fact his profitability always dictates Gpus 3x in effiency they will never mine. So he ultimately will kill a coin. Because FPGAS drain the trust out of normal GPU miners of a projects ability to do what they say they will. The Normal GPU miners are not going to trust that a price of a coin will come up later to meet their price if FPGAS are constantly dumping it down and profiting. So any FPGAS allowed to remain on a network take the trust of the community out of a project directly because no one will trust to mine at a loss. Because the exchange price will be reduced to equal the difficulty of the most efficient miner the FPGA Basicly the emission will always be what the profitability of the fpga is. . I have calculated that amount down to 30 satoshis on average. Depending upon how many GPUS leave and go as trust is broken.

With all of this said. If you put an FPGA resistant Algo on a network several key changes happen. There is not much of a mining efficiency discrepancy. Therefore what happens is that as the price pumps. The miners will rush into to fill that difficulty. And 1.91 cents in electricity nets them whatever coin amount equals 1.91 cents of that coin. There is no loss. There is no difference in them mining or buying. Afterall they are supporting the network by supporting the price! The amount of electricity they spend on the coin backs the coin and also if the coin price drops below it.. If a project is trustworthy and doesn’t lie and cheat and is open then what happens is that miners mine at a loss with trust. They will eat a percentage knowing that eventually the price will return and even if for a brief period of time they were spending 1.91 cents in electricity and got 1.24 cents in coin. Then they know that when the algo is fixed the coin will return to 1.91 cents worth or more and they would have profited for trusting the network for so long!

One of the things Graft did was change emission before to pump price. (like I said I DON’T LIKE GIVING OUT MY FORMULAS AS IT DOES MORE HARM TO ME THEN GOOD BUT BECAUSE I was asked I will share this information. (LOKI SHOULDNT DO THIS ALTHOUGH I DO RECCOMEND A DECLINING REWARD LOWER THEN 28) Graft doesn’t need to touch the blockreward at ALLL because this is a symptom of a bad algo. While changing the blockreward changes price it only works if there are more GPUS on the network then FPGAS. And it has a side effect of doubling the value of all previous mined coins… and thus makes people want to dump…. Which is bad.

*_Exchangeprice=HashvalueDifficulty/Blockreward 153 satoshis =1.005821278015073e-42,127,610,289/1398.69 306 satoshis=1.005821278015073e-42,127,610,289/699.345_**

In the previous block halving it bumped the price but as time went on it fail back down… and ultimately became the same issue of a low price becasuse FPGA didnt leave.

Back on topic.

There are several things when looking for an algo. But for sake of argument I will use the Algos above

Another thing I would be quick to point out would be check pointing. Check pointing is not a quick and easy thing. However when fundamentally put into the block chain core code. It would basically write a checkpoint that says blocks cannot be reorganized past this point. Basically negating any 51 percent attack via nice hash.

Reverse Waltz. REVERSE WALTZ

Reverse waltz uses about 840 watts on my rig. The introduction of Reverse Waltz took place from a network attack that took place on trade ogre. Jagarman42 found it and I reached out to Tradeogre and informed him a 51 percent attack was on the way. He froze the account but not before he had withdrawn 3 btc. After some discussion with Dan he Promptly agreed it was the best decision to do it the only down fall was RTA was a priority! I told him Cn-gpu was the best situation which he said he would look more into but at the time they defintley needed to do something about the 51 percent attack and so he promptly got his team to create reverse-waltz which was a quick fix but was unforeseen that FPGAS would be on it to a certain extent.

THis is my rig with no cards loaded!

with nothing on

These are all FPGA resistant

CN-GPU

CN-GPU

Cn-GPU uses about 875 watts on my rig. It is the most heavy algo because it its compute core heavy. There is hardly no memory scratchpad usage. It uses the pure 32 bit floating point capability of a piece of hardware in order to negate the fact it doesn’t matter what hardware you compile it on you are limited by physics and physical space. The FPGA that is most commonly used is 16 teraflop version made by SQRL /XIllinx. It is equal in floating point processing performance to a vega 64 slightly overclocked. Because it its FLOATINGPOINT BASED nvidia hashrate can be added as well…. Programming any fpga bitstream is moot because gpus are far more cheaper and cost the same.

With that being said. Nice hash doesn’t have this algo yet and check-pointing would make it moot anyway.

Conceal

Conceal

Conceal is the most energy efficient of the FPGA algos it is based on Turtle Algo however it has some added Floating point Math that is similar to CN-GPU. One of the advantages of turtle algo was its efficiency across multiple generations of GPUS! It was extremely efficient on ALL GCN architectures. From multiple cards across the last 8 years. The Compute Core of the 7950 is almost equal as a rx580 in performance, but because of the FPGA resistant math added. It makes FPGAS that would be programmed as efficient.

Conceal uses about 751 watts on my rig the least out of all of them.

CNR

Monero

CNR uses about 808 watts on my rig It has fpga bitstreams on it. Converting to this algo is far too late although any bistreams that are made for it are currently slightly only profitable however there is an issue. That the amount of bitstreams on it still outweigh grafts GPU on suh a small hashrate. If you went to CNR you would need Checkpointing done…. And you would get all the bad FPGAS that left monero once it swtichs to RandomX!

RANDOMX Optimized for cpus and most assuredly will be followed by nicehash. Once again checkpointing will need to be done are you will suffer a 51 percent attack. On top of that all fpgas will be made for this even if there not efficient.

With this information this leaves 2 good choices.

RandomX and CONCEAL.

I personally Like CN-GPU but the drawbacks are that older gpus while adhering to floating point performane are on a different diesize. So coupled with the fact that cn-gpu does indeed dictate hardware based floating point performance=hashrate almost.. the older generation of gpus.. are as inefficient as the topend gpus are to FPGAS…. And it uses the most electricity out of them all. In the end it was too good…

This leaves CONCEAL ALGO which im the only one of now who has voted for!

IT uses the least on my rig 751 watts.. has a high hashrate that makes it appear to be a thriving network before from a marketing perspective. The FPGAS don’t have an advantage anymore then the highend GPUS have over the Lower end older generation gpus. IT IS THE MOST DECENTRALIZED GPU ALGO that is efficent on all gpus and uses the least amount of electricity all the while being FPGA Resistant as close to possible without sacrificing older generation GPUS and can still be mined on a CPU!

Please feel free to ask questions. I don’t mind taking the time to answer individually.

Another note I would like to point out is here is some diffrences.. in algos.. without FPGA on them... vs some with them on them... (please take note that havens algo has bitstreams they are currently not on them though)

lokigrafttrade

as you can see the bubbles are how it reacts to btc movemnt... but the algos with FPGA on them.. slowly decent in price as trust is lost and miners lose incentive to support a price. it.

At the end of the day the best algos will be either CONCEAL which i like better then any other.. OR RANDOMX which you have checkpointing already for and will not have FPGAS on it iniitally. Later on they might and this might be an issue for a smaller network where if they move from monero to loki they will be a majority of hte network. But at the end of the day. RANDOMX or CONCEAL is the only 2 options loki really should take.

Mergemining on turtle is about to end as they fork over to their new PROOF OF WORK!

When this happens every FPGA on Turtle will jump to loki! Its imperative you guys change to a diffrent algo as responsive as you can. I realized I used the example of another coin but it was becasue I had already wrote it out and the examples are the same!

Please dont ignore this issue i gave some of my equations away i use as a miner to give me an edge make sure that you guys were aware of this!

Although the fork is 3 months away.. the fpgas are indeed pushing down anything far above the price you gusy believe they should not be profitable at! The algo needs to take place SOON! I personally havent decided if im going to profit off of the dips are ride it out staked. Personally im almost ready to stay unstaked till an algo can be chosen.

KeeJef commented 5 years ago

You raise some interesting points and questions, i think with Service Node checkpointing enabled we can to a certain worry much less about hashrate for security, but you are also making an argument for types of miners affecting the price of Loki.

I think the better solution here is potentially to wait until checkpointing kicks in on mainnet (about 11 days after the turtlecoin fork) and then slowly reduce the mining reward % of blocks and also consider a hashing algorithm change.

We could change things now, because there are problems with Large miners on the network with huge hashrates going towards single addresses, but i think i'm less convinced of the relationship between these miners and a price decrease or these miners attacking the network.

Additionally i think anything we would do would be really temporary and would siphon time from developers who are focused more on the inovative features of Loki, but i can see the arguments and am more on the fence about this one.

SomethingGettingWrong commented 5 years ago

Please forgive for the long Book once again! I think your conclusion is very logical. However I would like to point out a few things I want you to think about.

It doesn't matter how much of emission is coming from miners are coming from service nodes. The price is set by the cheapest emission. Please don't make the mistake of thinking the volume will dry up the emission. The FPGA will just wait till emission is dry and price has climbed and dump 40 percent and make you guys think people are dumping service nodes!

So what is happening in proof of work is that whatever the exchange price is equates to exactly how much it cost the miner in electricity to mint it. but that's only if its decentralized. by having FPGA its not so he makes GPUS leave and then reduces his hashrate to create emission at the cheapest electrical price and profits the same amount as if he had his FPGA at an extreme high price!

The fact that several projects think it doesn't have anything to do with price is exactly why its happening :) as of now you don't see it because of mergemining. The difficulty is raised to the profit price of 2 coins not just one. Once that other coin is gone. The profit from the other coin leaves. Then the hashrate will be far above the profitiblity of gpu and fpga so the GPU'S will leave and then the FPGA will all slowly reduce hashrate! They will reduce hashrate and increase hashrate to keep other GPU'S off the network This keeps hashrate from ever growing. Thus the price will equate to the cheapest emission... Whatever the FPGAS mint it at which is whatever difficulty they decide! (there could be competeing FPGAS as welll which would be okay but.. doubtful as no one releases bitstreams)

YOu will see huge huge buy volume and it will eat up the sell volume.. then you will see a huge massive dump! pushing the price all the way down. 40 or 50 percent. then a week later a repeat. What happens is the fpga miner waits for profit! The most profit he can get.

At first glance the solution might be to get rid of mining. But in Proof of Stake Completely You wont have the electrical usage it cost to create the coin to back it with the idea that "no one sells for less then it cost to mint". Instead you will have no one sells for less then it cost to rent a VPS! So while work is being done on the network. The only backing Is decentralized GPUS are the minimum price it cost to rent a VPS OR the TRUST of the VPS holders... however.. FPGA's will kill that though and they will be fighting over who dumps first! … all under the confusion.. that the FPGA was just a service node holder dumping!

Just my thoughts. I like the idea of the infinite tail emission but there's only so many service nodes that could ever be rented. My suggestion would be a tail emission that declines over like 100 years. from 28 to down to 7 or something. So that it takes forever.. but for those GPU Miners.. They can Mint at electrical cost... and by holding have something to sell into in the future for the new miners who would eat that cost and hold up difficulty to the price on the exchange previous to the miner dumping his amount he held from the past block reward.

Change to Random X or Conceal whichever is easier to implement. As you have checkpointing randomx would probably be the easiest. There is no point in changing a line change on it I think because if the FPGAS make a bitstream for randomx…. they can change that line too.. and then no one can nicehashwhich would be made of of ther gpus or FPGAS able to make it more difficult for him to dump price.

Last thoughts You got 3 months anyway. Just let checkpointing come and think about random x.. possibly a reduction in mining rewards...(but don't get rid of mining) if you do then the only backing is the minimum cost to rent a VPS vs and the TRUST of the Project. There will be service nodes that dump strategicly to buy back at a higher price. if the percentage of mining was around 15 percent it would be best in my thoughts.... You need enough emission in mining and enough difficulty to absorb service node dumps and they need to be GPUS. ! Please don't mistake the fpga dumps currently happening for service node dumps.

If the blockreward never shrinks then miners have no incentive to hold what they have in electrical price and they will dump in pumps only keeping it stagnant. (remember they don't wan the price to go down permenantly if they trust a project and they mine through the difficutly… the ONLY PROFIT they will see is on a block reward reduction in this since) This is also why at bitcoin and litecoin blockhalving price goes up!

And the price is always set by the cheapest emission. IF everything was going perfect.... on the mining end... if hte blockreward is the same then service nodes would eventually be the cheapest emission.

If you want any math done on the blockchain i prefer to do it in private please. Something people don't understand is that although the algo doesn't technicly dictate a price.. it does on an unexploited algo dictate the minimum cost to mint a coin and since you don't sell for less then you spend in electricity it very well does give incentive for a higher price! This is also why you need shrinking block rewards even if it takes place over 100 years.

Everything is about Incentives and Trust! Remember you have over 1200 members in the mining channel waiting haha! I have a tremendous amount of Trust for this project and the way everything is being done developement wise Keep it up guys!

SomethingGettingWrong commented 5 years ago

after thought you need to move to ARweaves Proof of work somehow. Maybe getting rid of mining on loki altogather and if you min areweave you get up to 15 percent of loki emission or something. This would strengthen arweave instead of loki however. There is no better proof of work then using electricty to encrypt and decrypt decentralized storage! In the meantime I would let checkpointing work. then go random X with no line change BEFORE meregmining ends!

If the fpga is allowed to mine at the emision he has he will destroy anonymoty of the network if he stakes his loki!