Bitcoin Forum
November 09, 2024, 04:30:54 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 3 [4] 5 »  All
  Print  
Author Topic: The biggest secret of bitcoin  (Read 4260 times)
cjmoles
Legendary
*
Offline Offline

Activity: 1176
Merit: 1017


View Profile WWW
October 25, 2015, 09:59:39 AM
 #61

The biggest secret that has remained a secret till date is the original identity of SatoshiNakamoto, the founder of Bitcoin protocol and the reference software. It was the first crypto-concurrency and was P2P. Though several people have been speculated to be associated with this name, nobody knows whether Satoshi Nakamoto is a real name or a pseudonym or whether it refers to a single person or a group of persons.

I have it from a pretty good source that Satoshi Nakamoto was a mathematics professor named John Nash who developed the seed of the idea which was worked out by a secret organization of research students attending Massachusetts Institute of Technology and Princeton University of whom collaborated together to begin its genesis.
bitcrystal (OP)
Sr. Member
****
Offline Offline

Activity: 425
Merit: 252


View Profile
October 25, 2015, 03:21:58 PM
Last edit: October 25, 2015, 03:33:38 PM by bitcrystal
 #62

/** The maximum allowed size for a serialized block, in bytes (network rule) */

FOR A BLOCK NOT FOR ALL BLOCKS

static const unsigned int MAX_BLOCK_SIZE = 1000000;
/** The maximum allowed number of signature check operations
static const CAmount MAX_MONEY = 21000000 * COIN;


bool CheckTransaction(const CTransaction& tx, CValidationState &state)
{
    // Basic checks that don't depend on any context
    if (tx.vin.empty())
        return state.DoS(10, false, REJECT_INVALID, "bad-txns-vin-empty");
    if (tx.vout.empty())
        return state.DoS(10, false, REJECT_INVALID, "bad-txns-vout-empty");
    // Size limits
    if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) > MAX_BLOCK_SIZE)
        return state.DoS(100, false, REJECT_INVALID, "bad-txns-oversize");


    // Check for negative or overflow output values
    CAmount nValueOut = 0;
    BOOST_FOREACH(const CTxOut& txout, tx.vout)
    {
        if (txout.nValue < 0)
            return state.DoS(100, false, REJECT_INVALID, "bad-txns-vout-negative");
       if (txout.nValue > MAX_MONEY)
            return state.DoS(100, false, REJECT_INVALID, "bad-txns-vout-toolarge");

        nValueOut += txout.nValue;
        if (!MoneyRange(nValueOut))
            return state.DoS(100, false, REJECT_INVALID, "bad-txns-txouttotal-toolarge");
    }

THIS LIMITS IS VALID FOR A TRANSACTION NOT FOR ALL TRANSACTIONS. THATS MEANING BITCOIN IS NOT LIMITED ONLY THE BLOCK HAVE LIMITED SIZES NOT THE PROTOCOL.


source
https://github.com/bitcoin/bitcoin/search?utf8=%E2%9C%93&q=MAX_MONEY&type=Code

The biggest secret that has remained a secret till date is the original identity of SatoshiNakamoto, the founder of Bitcoin protocol and the reference software. It was the first crypto-concurrency and was P2P. Though several people have been speculated to be associated with this name, nobody knows whether Satoshi Nakamoto is a real name or a pseudonym or whether it refers to a single person or a group of persons.

I have it from a pretty good source that Satoshi Nakamoto was a mathematics professor named John Nash who developed the seed of the idea which was worked out by a secret organization of research students attending Massachusetts Institute of Technology and Princeton University of whom collaborated together to begin its genesis.

a genius you do not recognize at the conclusion. But on his abilities. And someone who is studying does not mean that he must be a genius.
mezzomix
Legendary
*
Offline Offline

Activity: 2730
Merit: 1263


View Profile
October 25, 2015, 04:13:09 PM
 #63

...
Therefore i want that everybody know that the biggest secret on bitcoin is...

That you can more mine as 21 Millionen coins .

Maybe you should check and understand the GetBlockSubsidy() function...
criptix
Legendary
*
Offline Offline

Activity: 2464
Merit: 1145


View Profile
October 25, 2015, 04:26:45 PM
 #64

i just lost several of my precious braincells reading OP (and his grammar wasn't the only reason)  Roll Eyes

                     █████
                    ██████
                   ██████
                  ██████
                 ██████
                ██████
               ██████
              ██████
             ██████
            ██████
           ██████
          ██████
         ██████
        ██████    ██████████████████▄
       ██████     ███████████████████
      ██████                   █████
     ██████                   █████
    ██████                   █████
   ██████                   █████
  ██████
 ███████████████████████████████████
██████████████████████████████████████
 ████████████████████████████████████

                      █████
                     ██████
                    ██████
                   ██████
                  ██████
                 ████████████████████
                 ▀██████████████████▀
.LATTICE - A New Paradigm of Decentralized Finance.

 

                   ▄▄████
              ▄▄████████▌
         ▄▄█████████▀███
    ▄▄██████████▀▀ ▄███▌
▄████████████▀▀  ▄█████
▀▀▀███████▀   ▄███████▌
      ██    ▄█████████
       █  ▄██████████▌
       █  ███████████
       █ ██▀ ▀██████▌
       ██▀     ▀████
                 ▀█▌
 

             ▄████▄▄   ▄
█▄          ██████████▀▄
███        ███████████▀
▐████▄     ██████████▌
▄▄██████▄▄▄▄█████████▌
▀████████████████████
  ▀█████████████████
  ▄▄███████████████
   ▀█████████████▀
    ▄▄█████████▀
▀▀██████████▀
    ▀▀▀▀▀
OnkelPaul
Legendary
*
Offline Offline

Activity: 1039
Merit: 1005



View Profile
October 25, 2015, 04:45:42 PM
 #65

i just lost several of my precious braincells reading OP (and his grammar wasn't the only reason)  Roll Eyes

But I bet that OP lost a lot more of his brain cells as a side effect of whatever he was drinking/smoking when he had this brilliant idea.

Onkel Paul

Tstar
Legendary
*
Offline Offline

Activity: 1176
Merit: 1005


Decentralized Asset Management Platform


View Profile
October 25, 2015, 05:01:57 PM
 #66

i just lost several of my precious braincells reading OP (and his grammar wasn't the only reason)  Roll Eyes

But I bet that OP lost a lot more of his brain cells as a side effect of whatever he was drinking/smoking when he had this brilliant idea.

Onkel Paul

Quote
Delirium, or acute confusional state, is an organically-caused decline from a previously attained baseline level of cognitive function. It is typified by fluctuating course, attentional deficits and generalized severe disorganization of behavior. It typically involves other cognitive deficits, changes in arousal (hyperactive, hypoactive, or mixed), perceptual deficits, altered sleep-wake cycle, and psychotic features such as hallucinations and delusions.

Full stop  Wink

███████████████████████████
████▄▀▀▀███████████████████
█████▄    ▀▀▀██████████████
██████▄▄       ▀▀▀█████████
███████▀██▄▄        ▀▀█████
████████   ▀▀▀      ▄██████
█████████▄▄       ▄████████
█████████  ▀▀   ▄██████████
██████████    ▄████████████
███████████ ▄██████████████
███████████████▀▀▀▀▀▀▀▀████
████▄▄▄▄▄▄▄▄▄      ▄▄██████
███████████████████████████
.
.COOK.
     Decentralized Asset Management Platform     
│▐ █     WHITEPAPER   │   TWITTER   │   LINKEDIN   │   TELEGRAM     █ ▌│
          ▄▄███████▄▄
 ▄▄▄▄▄▄▄▄██████▀▀█████▄▄
███████████████▄▄█▀██████

█████████████████████████
██▀▀▀▀▀█████████████████
██▀▀▀▀▀▀████████████████
██▄▄▄▄▄▄▄█▀▀███████▀███▄█
█████████████████████▀███▄
██▀▀▀▀▀▀▀▄▄▄▄▀▀▀▀▀▀▀▀▀███▄
▀█████████████▀█████████▀▀▀
       ██ ▀█▀ ▄██
       ▀██▄ ▄███▀
        ▀▀████▀▀
✔  Accessible
✔  Secure
✔  Transparent
bitcrystal (OP)
Sr. Member
****
Offline Offline

Activity: 425
Merit: 252


View Profile
October 25, 2015, 10:42:00 PM
Last edit: October 25, 2015, 11:00:53 PM by bitcrystal
 #67

That you can more mine as 21 Millionen coins .
You can verify it yourself in the source code:

Every block results in 50 new bitcoins. After every 210,000 blocks, this number is halved. So the next 210,000 blocks result in 25 new bitcoins per block, et cetera.
This means if you mine for an infinite amount of time, you will get: 210,000 × (50+25+12.5+6.25+.....) = 21,000,000 bitcoins.

It always wonders me how the F*CK people can still claim there is supposed to be 'secrets' in Bitcoin. Bitcoin is open source, transparent, verifiable, and not depending on trust or good faith or promises or anything.



Do you really think he/she will care about your perfect explanation?
May he/she was just drunk at the time of typing.

Let's not feed the troll.
 Wink

its true that  i have not a good english grammar. But the reason is iam come from germany not from england. And thats not meaning i dont have the knowledge over coins. And iam aware of this formula. But the trueness is bitcoin is unlimited and thats true. It existed not a part of source code that blocks the option that you can mine more as 21 million coins. its a secret because many guys for example the developer of fourtytwocoin uses this detail to make more profit for his coin.  Because many guys have not the knowledge and the experience through tests. I am developing currently on a final version of my decentralized exchange. And in order to create a real decentralized exchange. I have hard works on bitcoin protocol and common on developing and tests. What i want to say is that the formula is still not a provement that the bitcoin have a limit. and i understand the subsidy function and iam not a troll when i say that the process of mining is unlimited. Thats means automatically you can mine infinitely and because the difficulty is not a problem when you use a quantum computer. And i bet that nobody here have the knowledge as bitcoin really works. And the reason why bitcoin is worked is the Hash cash algorithm of Adam Black. my english is not the best but but you can do a favor rather than to deny everything and criticize times think what I really want to say so and why I want to say it. The sources that Mr Satoshi a mathematics Proffessor is oh my god. There are far too many rumors in this world. The Troll feed as funny. I only want a favor because creators lie to you because owners exploited the max coins detail to rise the value of coins. And I know the subsidy function and much more you of which you don't have heard anything in 10 years. My purpose is to you to face honestly. As I soon open a decentralized market its important for me that the users of this forum know that honestly its more important for as money.
onemorexmr
Sr. Member
****
Offline Offline

Activity: 252
Merit: 251



View Profile
October 26, 2015, 01:39:43 AM
 #68

That you can more mine as 21 Millionen coins .
You can verify it yourself in the source code:

Every block results in 50 new bitcoins. After every 210,000 blocks, this number is halved. So the next 210,000 blocks result in 25 new bitcoins per block, et cetera.
This means if you mine for an infinite amount of time, you will get: 210,000 × (50+25+12.5+6.25+.....) = 21,000,000 bitcoins.

It always wonders me how the F*CK people can still claim there is supposed to be 'secrets' in Bitcoin. Bitcoin is open source, transparent, verifiable, and not depending on trust or good faith or promises or anything.



Do you really think he/she will care about your perfect explanation?
May he/she was just drunk at the time of typing.

Let's not feed the troll.
 Wink

its true that  i have not a good english grammar. But the reason is iam come from germany not from england. And thats not meaning i dont have the knowledge over coins. And iam aware of this formula. But the trueness is bitcoin is unlimited and thats true. It existed not a part of source code that blocks the option that you can mine more as 21 million coins. its a secret because many guys for example the developer of fourtytwocoin uses this detail to make more profit for his coin.  Because many guys have not the knowledge and the experience through tests. I am developing currently on a final version of my decentralized exchange. And in order to create a real decentralized exchange. I have hard works on bitcoin protocol and common on developing and tests. What i want to say is that the formula is still not a provement that the bitcoin have a limit. and i understand the subsidy function and iam not a troll when i say that the process of mining is unlimited. Thats means automatically you can mine infinitely and because the difficulty is not a problem when you use a quantum computer. And i bet that nobody here have the knowledge as bitcoin really works. And the reason why bitcoin is worked is the Hash cash algorithm of Adam Black. my english is not the best but but you can do a favor rather than to deny everything and criticize times think what I really want to say so and why I want to say it. The sources that Mr Satoshi a mathematics Proffessor is oh my god. There are far too many rumors in this world. The Troll feed as funny. I only want a favor because creators lie to you because owners exploited the max coins detail to rise the value of coins. And I know the subsidy function and much more you of which you don't have heard anything in 10 years. My purpose is to you to face honestly. As I soon open a decentralized market its important for me that the users of this forum know that honestly its more important for as money.

please stop that bullshit.

there will never be more than 21million coins.
it is possible to mine more than 21million coins (because fees are mined also): but again: THERE WONT EVER BE MORE THAN 21 MILLION COINS IN CIRCULATION (probably way less because of lost privkeys)

btw there are many others (including me) who can read code... and we understand the block subsidy function.

IMHO i dont think you are able to develop a trustable decentralized exchange if you arent even able to understand bitcoin in that regard (thats one of the easy parts).

i am german too: thats no excuse (my english sucks too.. )

XMR || Monero || monerodice.net || xmr.to || mymonero.com || openalias.org || you think bitcoin is fungible? watch this
Amph
Legendary
*
Offline Offline

Activity: 3248
Merit: 1070



View Profile
October 26, 2015, 08:10:18 AM
 #69

i just lost several of my precious braincells reading OP (and his grammar wasn't the only reason)  Roll Eyes

what is worring me, is that he is not trolling, i think he is serious on the matter

it's appear that he have a lot of confusion, due to altcoin and other stuff related to crypto in general
coinpr0n
Hero Member
*****
Offline Offline

Activity: 910
Merit: 1000



View Profile
October 26, 2015, 09:46:17 AM
 #70

OP please stop before you make an even greater fool of yourself. The 21 million BTC is not hardcoded as a number in the source code, it is the (approximate) total amount mineable given by the mining rewards halving (until it is negligible).

dothebeats
Legendary
*
Offline Offline

Activity: 3766
Merit: 1354


View Profile
October 26, 2015, 09:52:45 AM
 #71

OP please stop before you make an even greater fool of yourself. The 21 million BTC is not hardcoded as a number in the source code, it is the (approximate) total amount mineable given by the mining rewards halving (until it is negligible).

Quote from:  Bitcoin Stack Exchange
A pre-defined schedule limits the total number of bitcoins so that they gradually approach a total of 21 million (ignoring those that have been lost through deleted or misplaced wallet files). The limit of 21 million bitcoins is "hard-wired" in to the protocol, and there will never be more bitcoins than this.
-snip-


Source: http://bitcoin.stackexchange.com/questions/161/how-many-bitcoins-will-there-eventually-be

█████████████████████████████████
████████▀▀█▀▀█▀▀█▀▀▀▀▀▀▀▀████████
████████▄▄█▄▄█▄▄██████████▀██████
█████░░█░░█░░█░░████████████▀████
██▀▀█▀▀█▀▀█▀▀█▀▀██████████████▀██
██▄▄█▄▄█▄▄█▄▄█▄▄█▄▄▄▄▄▄██████████
██░░█░░█░░███████████████████████
██▀▀█▀▀█▀▀███████████████████████
██▄▄█▄▄█▄▄███████████████████████
██░░█░░█░░███████████████████████
██▀▀█▀▀█▀▀██████████▄▄▄██████████
██▄▄█▄▄█▄▄███████████████████████
██░░█░░█░░███████████████████████
██████
██
██
██
██
██
██
██
██
██
██
██
██████
████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
 Crypto Marketing Agency
By AB de Royse

████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
██████
██
██
██
██
██
██
██
██
██
██
██
██████
██████
██
██
██
██
██
██
██
██
██
██
██
██████
██████████████████████████████████████████████████████████████████████████████████████████████████
WIN $50 FREE RAFFLE
Community Giveaway

██████████████████████████████████████████████████████████████████████████████████████████████████
██████
██
██
██
██
██
██
██
██
██
██
██
██████
████████████████████████
██
██████████████████████
██████████████████▀▀████
██████████████▀▀░░░░████
██████████▀▀░░░▄▀░░▐████
██████▀▀░░░░▄█▀░░░░█████
████▄▄░░░▄██▀░░░░░▐█████
████████░█▀░░░░░░░██████
████████▌▐░░▄░░░░▐██████
█████████░▄███▄░░███████
████████████████████████
████████████████████████
████████████████████████
OnkelPaul
Legendary
*
Offline Offline

Activity: 1039
Merit: 1005



View Profile
October 26, 2015, 10:29:03 AM
 #72

bitcrystal, das Problem ist nicht die Sprache, sondern deine Argumentation.
- Ob ein Developer irgendeiner Altcoin dort das Mining von mehr als 21 Millionen ermöglicht, hat für das Bitcoin-Mining überhaupt keine Bedeutung. Lass also bitte Altcoins einfach aus der Argumentation raus, sie verwirren nur.
- Die zitierte Codestelle, die den maximalen Umfang einer Transaktion prüft (txout.nValue > MAX_MONEY), ist redundant, weil es sowieso nie Inputs in der Höhe geben kann geben kann. Diese Prüfung ist aber kein Argument dafür, dass es insgesamt mehr Bitcoins geben könnte.
- Auch die Tatsache, dass der Mining-Reward in einem Block nicht nur aus den frischen Bitcoins des Blocks besteht, sondern zusätzlich Transaction-Fees enthält, ändert nichts daran, dass die maximale Summe an Bitcoins, die jemals existieren werden, gleich 20999999.9769 ist. Transaction-Fees erhöhen nicht das Gesamtvolumen von Bitcoins, sondern verteilen nur ein bisschen um. Wenn einmal alle 20999999.9769 Bitcoins erzeugt worden sind, werden natürlich durch die Transaction-Fees keine neuen Bitcoins erzeugt, sondern nur bestehende Bitcoins umverteilt von den Benutzern zu den Minern.

Onkel Paul

AGD
Legendary
*
Offline Offline

Activity: 2070
Merit: 1164


Keeper of the Private Key


View Profile
October 26, 2015, 02:46:22 PM
 #73

bitcrystal, das Problem ist nicht die Sprache, sondern deine Argumentation.
- Ob ein Developer irgendeiner Altcoin dort das Mining von mehr als 21 Millionen ermöglicht, hat für das Bitcoin-Mining überhaupt keine Bedeutung. Lass also bitte Altcoins einfach aus der Argumentation raus, sie verwirren nur.
- Die zitierte Codestelle, die den maximalen Umfang einer Transaktion prüft (txout.nValue > MAX_MONEY), ist redundant, weil es sowieso nie Inputs in der Höhe geben kann geben kann. Diese Prüfung ist aber kein Argument dafür, dass es insgesamt mehr Bitcoins geben könnte.
- Auch die Tatsache, dass der Mining-Reward in einem Block nicht nur aus den frischen Bitcoins des Blocks besteht, sondern zusätzlich Transaction-Fees enthält, ändert nichts daran, dass die maximale Summe an Bitcoins, die jemals existieren werden, gleich 20999999.9769 ist. Transaction-Fees erhöhen nicht das Gesamtvolumen von Bitcoins, sondern verteilen nur ein bisschen um. Wenn einmal alle 20999999.9769 Bitcoins erzeugt worden sind, werden natürlich durch die Transaction-Fees keine neuen Bitcoins erzeugt, sondern nur bestehende Bitcoins umverteilt von den Benutzern zu den Minern.

Onkel Paul

Korrekt!

Bitcoin is not a bubble, it's the pin!
+++ GPG Public key FFBD756C24B54962E6A772EA1C680D74DB714D40 +++ http://pgp.mit.edu/pks/lookup?op=get&search=0x1C680D74DB714D40
bitcrystal (OP)
Sr. Member
****
Offline Offline

Activity: 425
Merit: 252


View Profile
October 26, 2015, 03:31:25 PM
Last edit: October 26, 2015, 04:10:59 PM by bitcrystal
 #74

that here is a old function of the bitcoin src . Is fixxed in the new version


int64 static GetBlockValue(int nHeight, int64 nFees)
{
    int64 nSubsidy = 50 * COIN;

    // Subsidy is cut in half every 210000 blocks, which will occur approximately every 4 years
    nSubsidy >>= (nHeight / 210000);

    return nSubsidy + nFees;
}


what it happen if nheight /210000 = 31  or 63. Right the result is nSubsidy = 1. But if the number is higher then the result is not 0 . Then through the overflow the result is 0xFFFFFFFF . And even on the newest version you can watch this phenomen. Thats meaning if hacker find overflows the limit protection is breaked. And even in parts of source code you can find overflow exploits. And all old bitcoin clients can still produce reward after the limit is reached. Thats meaning that if anybody say bitcoin is safe limit is worked. The have not research the source code of bitcoin.

Even the newest version of bitcoin is not bug free here a test example
i have tested this .

shift: 31
k: 0
shift: 31
pn[i-k]: 01
pn[0-0]: 01
pn[0]: 01
pn[i-k-1]: ffffffff
pn[1-0-1]: ffffffff
pn[0]: ffffffff
pn[i-k]: 01
pn[1-0]: 01
pn[1]: 01
pn[i-k-1]: ffffffff
pn[2-0-1]: ffffffff
pn[1]: ffffffff
pn[i-k]: 01
pn[2-0]: 01
pn[2]: 01
pn[i-k-1]: ffffffff
pn[3-0-1]: ffffffff
pn[2]: ffffffff
pn[i-k]: 01
pn[3-0]: 01
pn[3]: 01
pn[i-k-1]: ffffffff
pn[4-0-1]: ffffffff
pn[3]: ffffffff
pn[i-k]: 01
pn[4-0]: 01
pn[4]: 01
pn[i-k-1]: ffffffff
pn[5-0-1]: ffffffff
pn[4]: ffffffff
pn[i-k]: 01
pn[5-0]: 01
pn[5]: 01
pn[i-k-1]: ffffffff
pn[6-0-1]: ffffffff
pn[5]: ffffffff
pn[i-k]: 01
pn[6-0]: 01
pn[6]: 01
pn[i-k-1]: ffffffff
pn[7-0-1]: ffffffff
pn[6]: ffffffff
pn[i-k]: 01
pn[7-0]: 01
pn[7]: 01

so ok if the shift is 32 then the result is not 01 . the result is momment

shift: 32
k: 1
shift: 0
pn[i-k]: ffffffff
pn[1-1]: ffffffff
pn[0]: ffffffff
pn[i-k]: ffffffff
pn[2-1]: ffffffff
pn[1]: ffffffff
pn[i-k]: ffffffff
pn[3-1]: ffffffff
pn[2]: ffffffff
pn[i-k]: ffffffff
pn[4-1]: ffffffff
pn[3]: ffffffff
pn[i-k]: ffffffff
pn[5-1]: ffffffff
pn[4]: ffffffff
pn[i-k]: ffffffff
pn[6-1]: ffffffff
pn[5]: ffffffff
pn[i-k]: ffffffff
pn[7-1]: ffffffff
pn[6]: ffffffff

Drücken Sie eine beliebige Taste . . .


0xFFFFFFF

here my test source code i have used the overloading operator function of the bitcoin source

#include <iostream>
#include <cstdlib>

using namespace std;

typedef void (*func)();

template<unsigned int BITS>
class base_uint
{
protected:
    enum { WIDTH=BITS/32 };
    unsigned int pn[WIDTH];
public:

    base_uint()
    {
        for (int i = 0; i < WIDTH; i++)
            pn = 0xFFFFFFFF;
        printf("cool\n");
    }
    
    func e(func x)
    {
        return x;
    }
    
     base_uint(base_uint& t)
    {
        for (int i = 0; i < WIDTH; i++)
            pn = t.pn;
        printf("cool\n");
    }
    
    const base_uint operator~() const
    {
        base_uint ret;
        for (int i = 0; i < WIDTH; i++)
            ret.pn = ~pn;
        return ret;
    }
    
    base_uint(const base_uint& b)
    {
        for (int i = 0; i < WIDTH; i++)
            pn = b.pn;
    }
    
    base_uint(unsigned long long b)
    {
        pn[0] = (unsigned int)b;
        pn[1] = (unsigned int)(b >> 32);
        for (int i = 2; i < WIDTH; i++)
            pn = 0;
    }
    
    base_uint& operator>>=(unsigned int shift);
};

template <unsigned int BITS>
base_uint<BITS>& base_uint<BITS>::operator>>=(unsigned int shift)
{
    base_uint<BITS> a(*this);
    for (int i = 0; i < WIDTH; i++)
        pn = 0;
    printf("shift: %d\n",shift);
    int k = shift / 32;
    printf("k: %d\n",k);
    shift = shift % 32;
    printf("shift: %d\n",shift);
    for (int i = 0; i < WIDTH; i++) {
        if (i - k - 1 >= 0 && shift != 0)
        {
            pn[i - k - 1] |= (a.pn << (32 - shift));
            printf("pn[i-k-1]: %02x\n",pn[i-k-1]);
            printf("pn[%d-%d-%d]: %02x\n",i,k,1,pn[i-k-1]);
            printf("pn[%d]: %02x\n",i-k-1,pn[i-k-1]);
        }  
        if (i - k >= 0) {
            pn[i - k] |= (a.pn >> shift);
            printf("pn[i-k]: %02x\n",pn[i-k]);
            printf("pn[%d-%d]: %02x\n",i,k,pn[i-k]);
            printf("pn[%d]: %02x\n",i-k,pn[i-k]);
        }
    }
    return *this;
}

void tx()
{
     printf("alter\n");
}

int main()
{
    unsigned int e = 32;
    base_uint<256> t;
   // unsigned int t = 0xFFFFFFFF;
    t >>= e;
    //t.e(tx)();
    int ef = 999999999;
    ef += 999999999;
    ef += 999999999;
    ef += 999999999;
    ef += 999999999;
    ef += 999999999;
    ef += 999999999;
    ef += 999999999;
    ef += 999999999;
    ef += 999999999;
    ef += 999999999;
    int halvings = ef / 210000;
    printf("%02x\n",halvings);
        system("pause");
    return 0;
}






pn[6-1]: ffffff
pn[5]: ffffff
pn[i-k-1]: ffffffff
pn[7-1-1]: ffffffff
pn[5]: ffffffff
pn[i-k]: ffffff
pn[7-1]: ffffff
pn[6]: ffffff
ffffdcf1
Drücken Sie eine beliebige Taste . . .


    int halvings = nHeight / consensusParams.nSubsidyHalvingInterval;
   // Force block reward to zero when right shift is undefined.
   if (halvings >= 64)

This line fixxed the bugg. But if anybody have older clients as 0.9.2 then the process is repeated and the 21 million limit is breaked. Or if the shift is 32 then is repeated the process. i have tested it.
    CAmount nSubsidy = 50 * COIN;
    // Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years.
    nSubsidy >>= halvings; If halvings is 32 then the shift is undefined and a overflow is created.
    return nSubsidy;
}

Thats meaning if the shift is 32 what is not higher as 64 then the result is 50 coins. If my calculation is not correct please corrigate me.
mezzomix
Legendary
*
Offline Offline

Activity: 2730
Merit: 1263


View Profile
October 26, 2015, 04:58:24 PM
 #75

In the older version of the function there was a bug that results in undefined behaviour when the shift value is larger than 63. The shift expression CAmount is a 64bit integer. There is no problem using a shift value of 32. This change is a hard fork. That means some old clients might split the blockchain in about 200 years from now if they are still in use at that point in time.
OnkelPaul
Legendary
*
Offline Offline

Activity: 1039
Merit: 1005



View Profile
October 26, 2015, 05:00:30 PM
 #76

That means some old clients might split the blockchain in about 200 years from now if they are still in use at that point in time.

Oh, good to know. I'll mark that year on my calendar so that I don't forget to be bothered when it happens.

Onkel Paul

mezzomix
Legendary
*
Offline Offline

Activity: 2730
Merit: 1263


View Profile
October 26, 2015, 05:05:25 PM
 #77

That means some old clients might split the blockchain in about 200 years from now if they are still in use at that point in time.
Oh, good to know. I'll mark that year on my calendar so that I don't forget to be bothered when it happens.
Onkel Paul

At this point in time you maybe need to find a computer which is able to run a more than 200 year old software.  Cool
bitcrystal (OP)
Sr. Member
****
Offline Offline

Activity: 425
Merit: 252


View Profile
October 26, 2015, 05:15:18 PM
Last edit: October 26, 2015, 05:28:47 PM by bitcrystal
 #78

In the older version of the function there was a bug that results in undefined behaviour when the shift value is larger than 63. The shift expression CAmount is a 64bit integer. There is no problem using a shift value of 32. This change is a hard fork. That means some old clients might split the blockchain in about 200 years from now if they are still in use at that point in time.


right but in arith_256.cpp is also this bugg this meaning that all 256 bits version of uint256 have also this bugg. Thats mean if a hacker or anyway can find a exploit to use this problem. Clearly that no software is bugg free and a good tricky hacker/genius find always a bugg to exploit software

i have tested your statement its all right.

But if you use -64 then the bugg is ever worked

and because CAmount is signed thats meaning its possible to make this value to < 0

#include <iostream>
#include <cstdlib>

using namespace std;
typedef signed long long int64_t;
typedef int64_t CAmount;
static const CAmount COIN = 100000000;
static const CAmount CENT = 1000000;

typedef void (*func)();

template<unsigned int BITS>
class base_uint
{
protected:
    enum { WIDTH=BITS/32 };
    unsigned int pn[WIDTH];
public:

    base_uint()
    {
        for (int i = 0; i < WIDTH; i++)
            pn = 0xFFFFFFFF;
        printf("cool\n");
    }
    
    func e(func x)
    {
        return x;
    }
    
     base_uint(base_uint& t)
    {
        for (int i = 0; i < WIDTH; i++)
            pn = t.pn;
        printf("cool\n");
    }
    
    const base_uint operator~() const
    {
        base_uint ret;
        for (int i = 0; i < WIDTH; i++)
            ret.pn = ~pn;
        return ret;
    }
    
    base_uint(const base_uint& b)
    {
        for (int i = 0; i < WIDTH; i++)
            pn = b.pn;
    }
    
    base_uint(unsigned long long b)
    {
        pn[0] = (unsigned int)b;
        pn[1] = (unsigned int)(b >> 32);
        for (int i = 2; i < WIDTH; i++)
            pn = 0;
    }
    
    base_uint& operator>>=(unsigned int shift);
};

template <unsigned int BITS>
base_uint<BITS>& base_uint<BITS>::operator>>=(unsigned int shift)
{
    base_uint<BITS> a(*this);
    for (int i = 0; i < WIDTH; i++)
        pn = 0;
    printf("shift: %d\n",shift);
    int k = shift / 32;
    printf("k: %d\n",k);
    shift = shift % 32;
    printf("shift: %d\n",shift);
    for (int i = 0; i < WIDTH; i++) {
        if (i - k - 1 >= 0 && shift != 0)
        {
            pn[i - k - 1] |= (a.pn << (32 - shift));
            printf("pn[i-k-1]: %02x\n",pn[i-k-1]);
            printf("pn[%d-%d-%d]: %02x\n",i,k,1,pn[i-k-1]);
            printf("pn[%d]: %02x\n",i-k-1,pn[i-k-1]);
        }  
        if (i - k >= 0) {
            pn[i - k] |= (a.pn >> shift);
            printf("pn[i-k]: %02x\n",pn[i-k]);
            printf("pn[%d-%d]: %02x\n",i,k,pn[i-k]);
            printf("pn[%d]: %02x\n",i-k,pn[i-k]);
        }
    }
    return *this;
}

void tx()
{
     printf("alter\n");
}

int main()
{
   /* unsigned int e = 32;
    base_uint<256> t;
   // unsigned int t = 0xFFFFFFFF;
    t >>= e;
    //t.e(tx)();
    int ef = 999999999;
    ef += 999999999;
    ef += 999999999;
    ef += 999999999;
    ef += 999999999;
    ef += 999999999;
    ef += 999999999;
    ef += 999999999;
    ef += 999999999;
    ef += 999999999;
    ef += 999999999;
    int halvings = ef / 210000;
    printf("%02x\n",halvings);*/
    CAmount e = 25*COIN;
    e >>= -64;
    printf("%02x\n",e);
        system("pause");
    return 0;
}


here you can test it. thats meaning if you find a good exploit and have time you need only a option to make the number to < 0 and the bugg is worked again.
mezzomix
Legendary
*
Offline Offline

Activity: 2730
Merit: 1263


View Profile
October 26, 2015, 06:45:40 PM
 #79

I think the problem starts when nHeight rolls over and becomes negative. This leads to a negative value of the int halving variable. A negative halving variable triggers undefined behaviour of the the shift operation. Using the bitcoin constant values and a system with 32bit int values, this bug is triggered in about 40000 years.

Code:
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
{
    int halvings = nHeight / consensusParams.nSubsidyHalvingInterval;
    // Force block reward to zero when right shift is undefined.
    if (halvings >= 64)
        return 0;

    CAmount nSubsidy = 50 * COIN;
    // Subsidy is cut in half every 210,000 blocks which will occur approximatel
    nSubsidy >>= halvings;
    return nSubsidy;
}
BitcoinCounty
Newbie
*
Offline Offline

Activity: 36
Merit: 0


View Profile
October 27, 2015, 09:36:04 AM
 #80

Well found. bitcrystal, did you report your finding to the core developers? We need good bitcoin supporters like you.
Pages: « 1 2 3 [4] 5 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!