Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: newbtc101 on August 16, 2022, 05:55:21 PM



Title: BTC redundant code / latent bug please explain
Post by: newbtc101 on August 16, 2022, 05:55:21 PM
hi everyone,

I am following a project called "Bitgesell", basically, its btc fork. Recently the team posted a message on their thread stating:

I want also to congratulate our team member Emeka who managed to find a thing in the bitcoin source code!

https://github.com/bitcoin/bitcoin/issues/25682#issuecomment-1193296105

Here is the source:

https://bitcointalk.org/index.php?topic=5238559.980

I dont have a background in programming so I dont know what it means. Can anyone please explain me. Thanks in advance.


Title: Re: BTC redundant code / latent bug please explain
Post by: odolvlobo on August 16, 2022, 09:50:27 PM
The relevant code is:

Code:
         ...
         cnt++;
         ...
             if (cnt == 0) {
                 ...
         }
         ...

The code cnt++; adds 1 to the value of cnt.

The code if (cnt == 0) { checks if the value of cnt is 0, and executes the code that follows if it is.

Now, assuming that cnt is never less than 0, cnt can never be 0 after incrementing it. The result is that the code following the check is never executed. Including code that is never executed is typically done by mistake.


Title: Re: BTC redundant code / latent bug please explain
Post by: newbtc101 on August 17, 2022, 12:34:24 AM
Thank you for explaining it. I guess the developers of BGL corrected it in BGL code.

Just so you know BGL has many programmers contributed to this project on github, if this is something of your interest.

Also Emma Wu, BGL developer helps BTC become better:

https://github.com/bitcoin/bitcoin/pull/21764

Source:

https://bitcointalk.org/index.php?topic=5238559.380

I have contacted BGL developers but if by chance someone can help me with the following. I am running my node using a VPS with Ubuntu 16.04.7 LTS installed. When installing the bitgesell_0 package.1. 2_amd64. deb I get the following error.

The following packages have unmet dependencies:
 bitgesell : Depends: libc6 (>= 2.27) but 2.23-0ubuntu11.2 is to be installed
E: Unable to correct problems, you have held broken packages.

Should I use a later version of Ubuntu?


Title: Re: BTC redundant code / latent bug please explain
Post by: NotATether on August 17, 2022, 03:03:58 AM
The following packages have unmet dependencies:
 bitgesell : Depends: libc6 (>= 2.27) but 2.23-0ubuntu11.2 is to be installed
E: Unable to correct problems, you have held broken packages.

Should I use a later version of Ubuntu?

Yes. You cannot upgrade the libc version on your system without upgrading the distribution version (i.e. the entire operating system).


Title: Re: BTC redundant code / latent bug please explain
Post by: newbtc101 on August 17, 2022, 03:31:41 AM
Thank you. I am going to try a new version of Ubuntu like 18 or 20. Will let you know the outcome.

PS I am kind of new to crypto but I like the idea of BGL team to create a better version of BTC. Who knows maybe this will work in the future. After all, in 2010 nobody believed that bitcoin will rule the crypto world!


Title: Re: BTC redundant code / latent bug please explain
Post by: pooya87 on August 17, 2022, 05:39:29 AM
Who knows maybe this will work in the future.
We already know that altcoins that create an exact copy of bitcoin with minimal and meaningless changes (such as replacing SHA-256 with SHA3-256) and zero innovations is only going to create a copycatcoin aka a shitcoin not something that "could work in the future".


Title: Re: BTC redundant code / latent bug please explain
Post by: tromp on August 17, 2022, 06:19:23 AM
We already know that altcoins that create an exact copy of bitcoin with minimal and meaningless changes (such as replacing SHA-256 with SHA3-256) and zero innovations is only going to create a copycatcoin aka a shitcoin not something that "could work in the future".

Despite all that, Litecoin did pretty well for itself...


Title: Re: BTC redundant code / latent bug please explain
Post by: tromp on August 17, 2022, 06:21:50 AM
Now, assuming that cnt is never less than 0, cnt can never be 0 after incrementing it.

Of course it can. Have you never heard of wrap-around? Try incrementing 2^32-1 or 2^64-1.


Title: Re: BTC redundant code / latent bug please explain
Post by: pooya87 on August 17, 2022, 09:46:27 AM
Despite all that, Litecoin did pretty well for itself...
I don't consider anything about Litecoin being "pretty well". It is one of the first altcoins that has been able to stick around, it has virtually no real adoption and it keeps going down. Once it was right under bitcoin and worth 0.04BTC and it is all down the hill from there, today it is 0.002BTC.

It has no innovation either, they introduced it as an alternative to ASIC mining (ie. ASIC resistant). Shortly after ASICs were created for it! They also introduced it as faster than bitcoin, but it turned out to be slower considering you need more confirmation on a LTC tx to have the same security as a confirmed bitcoin tx.


Title: Re: BTC redundant code / latent bug please explain
Post by: tromp on August 17, 2022, 10:19:41 AM
Despite all that, Litecoin did pretty well for itself...
I don't consider anything about Litecoin being "pretty well".

Maintaining a $4+B marketcap and being the 5th most mined coin (4th soon) is certainly doing "pretty well"
for a copy-paste coin with some utterly pointless tweaks.

The only useful innovation came just recently with MWEB, the Mimblewimble implementation inspired by Grin.


Title: Re: BTC redundant code / latent bug please explain
Post by: newbtc101 on August 17, 2022, 02:09:57 PM
Who knows maybe this will work in the future.
We already know that altcoins that create an exact copy of bitcoin with minimal and meaningless changes (such as replacing SHA-256 with SHA3-256) and zero innovations is only going to create a copycatcoin aka a shitcoin not something that "could work in the future".

Maybe you are right but according to BGL thread, it has the following advantages compared to BTC and the BGL team intends to publish an article in tier 1 journal about this project. This is what is going to be discussed in the article:

"1. Safer mining algorithm
2. Halving each year
3. Txs burning mechanism / lower supply in the long term
4. Low cost transfer fees (maybe the table could state the actual/approximate transfer fees in $ at the time of publication)
 5. Low cost mining operations (maybe the table could state the actual/approximate mining fees in $ at the time of publication)
6. Much lower market cap (difference is hundreds of thousands)
7. BGL NFTs
8. BGL - WBGL bridge on both eth and bsc
9. Hash rate (details)
10. More compressed size of the blockchain"

Source:

https://bitcointalk.org/index.php?topic=5238559.980

So it is not just "minimal and meaningless" changes.
 
But I understand that some previous shitty projects like bitcoin diamond and recently BCH really messed up the reputation of BTC forks. And I dont know if BGL will do great in the future. But I find this project interesting and cheap in terms of price. That's all.



 

 


Title: Re: BTC redundant code / latent bug please explain
Post by: newbtc101 on August 18, 2022, 03:11:47 AM
The following packages have unmet dependencies:
 bitgesell : Depends: libc6 (>= 2.27) but 2.23-0ubuntu11.2 is to be installed
E: Unable to correct problems, you have held broken packages.

Should I use a later version of Ubuntu?

Yes. You cannot upgrade the libc version on your system without upgrading the distribution version (i.e. the entire operating system).


Thank you, it worked!


Title: Re: BTC redundant code / latent bug please explain
Post by: pooya87 on August 18, 2022, 04:35:24 AM
it has the following advantages compared to BTC an
Let's look at each point and see if they are really advantages.

Quote
1. Safer mining algorithm
With a quick look at the code the mining algorithm appears to be pretty much copied from bitcoin. The proof of work algorithm is identical, the difficulty adjustment is identical, and the only thing changed is replacing SHA256d with Keccak
This does not make it "safer".

Quote
2. Halving each year
This is not an advantage. This is just a change.

Quote
3. Txs burning mechanism / lower supply in the long term
There is no advantage in burning the supply (10% of the fees) apart from trying to create an illusion that "the price should go up just because they are burning coins".

Quote
4. Low cost transfer fees (maybe the table could state the actual/approximate transfer fees in $ at the time of publication)
First of all the fee mechanism and the minimums are copied from bitcoin so it is identical not lower.
Secondly when an altcoin is worth less in $$ it is obvious that its fee in $$ is also lower, that doesn't mean the transaction fees are actually lower in terms of the coins you spend on fees.
Finally Fee is not something that can be decided by the protocol, it is something that the market decides.

Quote
5. Low cost mining operations (maybe the table could state the actual/approximate mining fees in $ at the time of publication)
9. Hash rate (details)
This is not an advantage that is provided by the protocol or any change they made in the protocol, the only reason why it costs less to mine this altcoin is its lower popularity hence lower hashrate hence its lower difficulty.
Otherwise computational cost of finding a SHA3-256 hash is very close to SHA256 and with equal difficulty this altcoin should have nearly the same cost as bitcoin.

Quote
6. Much lower market cap (difference is hundreds of thousands)
This is also not an advantage, you are just saying that the price and supply of this altcoin is lower than bitcoin!

Quote
7. BGL NFTs
I personally don't consider NFTs or any tokens for that matter an advantage because so far there has not been any actual use case for tokens in real world apart from fund raising and scamming people.

Quote
8. BGL - WBGL bridge on both eth and bsc
I can't comment on this since I don't get it and it looks to be only an idea #31 (https://github.com/BitgesellOfficial/bitgesell/issues/31) not yet available.

Quote
10. More compressed size of the blockchain"
I wish it explained "how" because with a quick look at the primitives (https://github.com/BitgesellOfficial/bitgesell/tree/master/src/primitives) I couldn't see any change in transaction and block structure that would decrease the size of the blockchain!
Everything is identical (block header, txin, txout, hashes are 256 bit, scripts are serialized the same way, there is still sequence/locktime/etc, outputs use the same 64-bit amount,...)

Although based on previous points it may mean that "nobody is using this altcoin so the blocks are empty, hence the blockchain is smaller"!!! That's not an advantage provided by the protocol, that's not even an advantage saying the coin is not used by anyone.


Conclusion:
I stand on what I initially said, the changes are minimal and pointless. There is no innovation in this altcoin.


Title: Re: BTC redundant code / latent bug please explain
Post by: newbtc101 on August 18, 2022, 03:32:27 PM
I am not really in a position to argue about these comments as I am very new to crypto. I actually invested in both BTC and BGL as I like both.

From my own experience, when I sent out BGL, I only paid like around 0.0003 cents and the bridge on both ETH and BSC was an interesting experience as well. It actually felt great to buy quite a bag of BGL paying around $400 (yes, I am a small investor  :D hence no point to argue too!). I invested the same amount in BTC when it was like 20k.

Just curious how BGL and BTC will do in terms of ROI during next several months and during next bullran whenever its going to happen...

Probably will not comment anymore as I got the thing with ubuntu and the code. Thanks again. Good luck to everyone!   


Title: Re: BTC redundant code / latent bug please explain
Post by: pooya87 on August 19, 2022, 02:42:29 AM
Just curious how BGL and BTC will do in terms of ROI during next several months and during next bullran whenever its going to happen...
Just remember that there is a difference between making profit and the coin being actually good to have a long term potential. For example during 2017 there were altcoins that didn't even have a blockchain anymore (were literary dead) and yet they got pumped more than 500%.


Title: Re: BTC redundant code / latent bug please explain
Post by: newbtc101 on August 20, 2022, 03:28:51 AM
Just curious how BGL and BTC will do in terms of ROI during next several months and during next bullran whenever its going to happen...
Just remember that there is a difference between making profit and the coin being actually good to have a long term potential. For example during 2017 there were altcoins that didn't even have a blockchain anymore (were literary dead) and yet they got pumped more than 500%.

I understand your concern and totally agree. There is literally no such thing as "safe" altcoin and Luna is a good example of it.

I dont know if you had a chance to go through bitcointalk thread focused on BGL as well as its github but my personal impression was that its basically a bunch of talented programmers who have been working on a low budget for like 2 years. To me, it a good sign because it shows their dedication to crypto rather than making a quick profit as in most of these garbage meme, defi etc. projects aiming to make quick money and quit. Its giving a bit of hope that they will continue their work through some possible challenging times ahead like this current bearish trend. I am not naive and I understand there is still some risk involved.

The downside of course is that BGL programmers did not care much about marketing and only this year they decided to hire a professional marketing guy and publish an article in tier 1 journal.

I cross my fingers for this project and for bitcoin and hope that more people will understand the true value of blockchain in the future. As someone new to crypto, I keep discovering something new everyday and I am really enjoying it.  
 



Title: Re: BTC redundant code / latent bug please explain
Post by: odolvlobo on August 22, 2022, 09:16:06 PM
Now, assuming that cnt is never less than 0, cnt can never be 0 after incrementing it.

Of course it can. Have you never heard of wrap-around? Try incrementing 2^32-1 or 2^64-1.

Of course, there is wrap around, but the possibility of a number wrapping around is itself also generally an indicator of a bug.


Title: Re: BTC redundant code / latent bug please explain
Post by: tromp on August 23, 2022, 06:03:34 AM
Now, assuming that cnt is never less than 0, cnt can never be 0 after incrementing it.
The result is that the code following the check is never executed.

Of course, there is wrap around,

I wouldn't say "Of course" when you didn't consider it in the first place...


Title: Re: BTC redundant code / latent bug please explain
Post by: newbtc101 on December 21, 2022, 03:12:50 AM
I just wanted to provide an interesting update from Bitgessel (BGL) team on github, maybe it will be of interest to all (including yours truly) BTC holders.

Here is a quote from the original message from bitcointalk:

"The release of 0.1.9 is out on GitHub, you can try and test it!
https://github.com/BitgesellOfficial/bitgesell/releases/tag/0.1.9

Big thanks to our maintainer janus for syncing the code with BTC, this is a huge amount of work done.
The testnet (big thanks to Castor198 and his bglnode.online !) should work out-of-the-box right now, as testnet DNS seed is added."

Would appreciate any comments/feedback

Thanks