Pages:
Author

Topic: Building headless Bitcoin and Bitcoin-qt on Windows - page 42. (Read 419389 times)

olu
newbie
Activity: 10
Merit: 0

...

Where one SHOULD see

if (true && block.GetHash() != hashGenesisBlock)

in src/main.cpp of my new crypto, one sees

uint256 hash = block.GetHash();
        printf("%s\n", hash.ToString().c_str());
        printf("%s\n", hashGenesisBlock.ToString().c_str());

...


The genesis miner is not included in the litecoin sources. You need to add it yourself: http://pastebin.com/aKgggRvZ

Going to check up on this and implement, give me some time.  - Olu

To ensure I'm not derping around:

//// debug print
        uint256 hash = block.GetHash();
        printf("%s\n", hash.ToString().c_str());
        printf("%s\n", hashGenesisBlock.ToString().c_str());
        printf("%s\n", block.hashMerkleRoot.ToString().c_str());
        assert(block.hashMerkleRoot == uint256("0xa73e546160e2999f9f17fcfc76c422a04b00acd5846a90a784593951b0987380"));
       
      // If genesis block hash does not match, then generate new genesis hash
        if (true && block.GetHash() != hashGenesisBlock)
        {
            printf("Searching for genesis block...\n");

            // This will figure out a valid hash and Nonce if you're creating a different genesis block:
            uint256 hashTarget = CBigNum().SetCompact(block.nBits).getuint256();
            uint256 thash;
            char scratchpad[SCRYPT_SCRATCHPAD_SIZE];

            loop
            {
                #if defined(USE_SSE2)
                // Detection would work, but in cases where we KNOW it always has SSE2,
                // it is faster to use directly than to use a function pointer or conditional.
                #if defined(_M_X64) || defined(__x86_64__) || defined(_M_AMD64) || (defined(MAC_OSX) && defined(__i386__))
                // Always SSE2: x86_64 or Intel MacOS X
                scrypt_1024_1_1_256_sp_sse2(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
                #else
                // Detect SSE2: 32bit x86 Linux or Windows
                scrypt_1024_1_1_256_sp(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
                #endif
                #else
                // Generic scrypt
                scrypt_1024_1_1_256_sp_generic(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
                #endif
                if (thash <= hashTarget)
                    break;

                if ((block.nNonce & 0xFFF) == 0)
                    printf("nonce %08X: hash = %s (target = %s)\n", block.nNonce, thash.ToString().c_str(), hashTarget.ToString().c_str());

                ++block.nNonce;

                if (block.nNonce == 0)
                {
                    printf("NONCE WRAPPED, incrementing time\n");
                    ++block.nTime;
                }
            }
            printf("block.nTime = %u \n", block.nTime);
            printf("block.nNonce = %u \n", block.nNonce);
            printf("block.GetHash = %s\n", block.GetHash().ToString().c_str());
        }
      
      block.print();
      assert(block.GetHash() == hashGenesisBlock);

This is what the main.cpp looks like now, but do I have to change the instances of

// Special case for the genesis block, skipping connection of its transactions
    // (its coinbase is unspendable)
    if (GetHash() == hashGenesisBlock) {
        view.SetBestBlock(pindex);
        pindexGenesisBlock = pindex;
        return true;
AND

// Get prev block index
    CBlockIndex* pindexPrev = NULL;
    int nHeight = 0;
    if (hash != hashGenesisBlock) {

?



Nevermind, ignore this mid-level (low-level) silly crypto-currencyphile.  I tried running everything as is and it couldn't build because the word "loop" present within the code you gave me should be replaced with "while (true)".  I forgot that (maybe you did too?) for the most part just "loop" doesn't exist in C++.  Thanks for the link Solcoin Project.
olu
newbie
Activity: 10
Merit: 0

...

Where one SHOULD see

if (true && block.GetHash() != hashGenesisBlock)

in src/main.cpp of my new crypto, one sees

uint256 hash = block.GetHash();
        printf("%s\n", hash.ToString().c_str());
        printf("%s\n", hashGenesisBlock.ToString().c_str());

...


The genesis miner is not included in the litecoin sources. You need to add it yourself: http://pastebin.com/aKgggRvZ

Going to check up on this and implement, give me some time.  - Olu

To ensure I'm not derping around:

//// debug print
        uint256 hash = block.GetHash();
        printf("%s\n", hash.ToString().c_str());
        printf("%s\n", hashGenesisBlock.ToString().c_str());
        printf("%s\n", block.hashMerkleRoot.ToString().c_str());
        assert(block.hashMerkleRoot == uint256("0xa73e546160e2999f9f17fcfc76c422a04b00acd5846a90a784593951b0987380"));
       
      // If genesis block hash does not match, then generate new genesis hash
        if (true && block.GetHash() != hashGenesisBlock)
        {
            printf("Searching for genesis block...\n");

            // This will figure out a valid hash and Nonce if you're creating a different genesis block:
            uint256 hashTarget = CBigNum().SetCompact(block.nBits).getuint256();
            uint256 thash;
            char scratchpad[SCRYPT_SCRATCHPAD_SIZE];

            loop
            {
                #if defined(USE_SSE2)
                // Detection would work, but in cases where we KNOW it always has SSE2,
                // it is faster to use directly than to use a function pointer or conditional.
                #if defined(_M_X64) || defined(__x86_64__) || defined(_M_AMD64) || (defined(MAC_OSX) && defined(__i386__))
                // Always SSE2: x86_64 or Intel MacOS X
                scrypt_1024_1_1_256_sp_sse2(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
                #else
                // Detect SSE2: 32bit x86 Linux or Windows
                scrypt_1024_1_1_256_sp(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
                #endif
                #else
                // Generic scrypt
                scrypt_1024_1_1_256_sp_generic(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
                #endif
                if (thash <= hashTarget)
                    break;

                if ((block.nNonce & 0xFFF) == 0)
                    printf("nonce %08X: hash = %s (target = %s)\n", block.nNonce, thash.ToString().c_str(), hashTarget.ToString().c_str());

                ++block.nNonce;

                if (block.nNonce == 0)
                {
                    printf("NONCE WRAPPED, incrementing time\n");
                    ++block.nTime;
                }
            }
            printf("block.nTime = %u \n", block.nTime);
            printf("block.nNonce = %u \n", block.nNonce);
            printf("block.GetHash = %s\n", block.GetHash().ToString().c_str());
        }
      
      block.print();
      assert(block.GetHash() == hashGenesisBlock);

This is what the main.cpp looks like now, but do I have to change the instances of

// Special case for the genesis block, skipping connection of its transactions
    // (its coinbase is unspendable)
    if (GetHash() == hashGenesisBlock) {
        view.SetBestBlock(pindex);
        pindexGenesisBlock = pindex;
        return true;
AND

// Get prev block index
    CBlockIndex* pindexPrev = NULL;
    int nHeight = 0;
    if (hash != hashGenesisBlock) {

?

olu
newbie
Activity: 10
Merit: 0

...

Where one SHOULD see

if (true && block.GetHash() != hashGenesisBlock)

in src/main.cpp of my new crypto, one sees

uint256 hash = block.GetHash();
        printf("%s\n", hash.ToString().c_str());
        printf("%s\n", hashGenesisBlock.ToString().c_str());

...


The genesis miner is not included in the litecoin sources. You need to add it yourself: http://pastebin.com/aKgggRvZ

Going to check up on this and implement, give me some time.  - Olu
member
Activity: 109
Merit: 10

...

Where one SHOULD see

if (true && block.GetHash() != hashGenesisBlock)

in src/main.cpp of my new crypto, one sees

uint256 hash = block.GetHash();
        printf("%s\n", hash.ToString().c_str());
        printf("%s\n", hashGenesisBlock.ToString().c_str());

...


The genesis miner is not included in the litecoin sources. You need to add it yourself: http://pastebin.com/aKgggRvZ
olu
newbie
Activity: 10
Merit: 0
Trying to establish a genesis based off of litecoin-master-0.8 that I compiled myself, but even after finding and replacing the merkle hash, upon running the daemon from cmd it closes after saying assertion failed (which it should according to: https://bitcointalksearch.org/topic/complete-guide-on-how-to-create-a-new-alt-coin-225690).


Where one SHOULD see

if (true && block.GetHash() != hashGenesisBlock)

in src/main.cpp, one sees

uint256 hash = block.GetHash();
        printf("%s\n", hash.ToString().c_str());
        printf("%s\n", hashGenesisBlock.ToString().c_str());
        printf("%s\n", block.hashMerkleRoot.ToString().c_str());
        assert(block.hashMerkleRoot == uint256("0xa73e546160e2999f9f17fcfc76c422a04b00acd5846a90a784593951b0987380"));
        block.print();
        assert(hash == hashGenesisBlock);

the debug log in AppData/Roaming/njknjk  shows

2014-02-09 03:05:13 dbenv.open LogDir=C:\Users\Oluwamide\AppData\Roaming\njknjk\testnet3\database ErrorFile=C:\Users\Oluwamide\AppData\Roaming\njknjk\testnet3\db.log
2014-02-09 03:05:14 Opened LevelDB successfully
2014-02-09 03:05:14 LoadBlockIndexDB(): last block file = 0
2014-02-09 03:05:14 LoadBlockIndexDB(): transaction index disabled
2014-02-09 03:05:14 Initializing databases...
2014-02-09 03:05:14 87b15726e7233bc939a8c0f72b2396867fc6bbb77eba30aec67869e7ef6c0942
2014-02-09 03:05:14 f5ae71e26c74beacc88382716aced69cddf3dffff24f384e1808905e0188f68f
2014-02-09 03:05:14 a73e546160e2999f9f17fcfc76c422a04b00acd5846a90a784593951b0987380

as the last couple of lines

whereas the debug log in AppData/Roaming/njknjk/testnet3 is COMPLETELY blank....

help?
full member
Activity: 203
Merit: 100
I have managed to compile Litecoin 0.8.6 wallet without errors on closing but it has an awful windows 95 look. Why is that happening?

How? Depending on what versions of gcc, boost, openssl and bdb I use results can be anything from refusing to link, refusing to start up due to "wallet db error", or crashing on exit. Man, I hate Windows...

I use Qt 4.8.5, gcc 4.4.0, boost 1.50, berkeley db 4.80, and openssl 1.0.1c currently, as I know these are used in several other working wallets, including a few Litecoin 0.8.6 forks that run perfectly.
olu
newbie
Activity: 10
Merit: 0
Don't know if Ron and Nitro are still reading this, but thanks for the guide.  I have grown from a complete novice to an intermediate crypto-phile/C++ coder thanks to this guide, and am launching a crypto currency of my own soon (*in Morgan Freeman's voice*: and thus the life-cycle of a crypto-currencyphile is complete).  Anyway, I will look into the moon coin issue.  If anyone wants to help with the new crypto-currency, please contact me at [email protected].  Looking for helpful tips, potential devs, and of course people who want some coin for work (which is part of the coin design, btw; getting paid to crowd-source popularity).  Yes, I won't tell you what the currency is in public (I don't want to get bashed for poor coding skills in public when my skills are decent and you could easily just ask to look at the code in private to help me out).  Anyway, big thanks to everyone here who asked questions because while I never did, I learned more from your questions here (and on other websites I stalked your similar posts to) than I did reading any help guide (nitro's excluded of course).  Thanks again, and email me. I want people I learned from to help out with this new coin: it'll be fun, I promise.

                                                                          -- Olu
full member
Activity: 138
Merit: 100
Getting a clean compile, but an executable that crashes with the following error:

"EXCEPTION: N5boost10filesystem16filesystem_errorE
boost::filesystem::status: The operation completed successfully: "C:
\Users\Deacon\AppData\Roaming\Microsoft\Windows\Start
Menu\Programs\Startup\Mooncoin.lnk"
C:\deps\mooncoin\release\mooncoin-qt.exe in Runaway exception"

Any ideas or suggestions?
member
Activity: 98
Merit: 10
I have managed to compile Litecoin 0.8.6 wallet without errors on closing but it has an awful windows 95 look. Why is that happening?
full member
Activity: 138
Merit: 100
I am so close here, guys...

I can get the non-static (binary download of Qt) to build my wallet, but obviously it doesn't have the QtCore4 and other libraries statically linked.

I downloaded the 4.8.5 source per the first post and configure it. That works great.

mingw32-make ultimately craps out with moc.exe throwing "the procedure entry point __gxx_personality_v0" errors during compile.

This is maddening...
sr. member
Activity: 336
Merit: 250
I have given up with this stuff.
member
Activity: 98
Merit: 10
I have followed your guide and I'm stuck here:


I have been able to compile alt-coins based on Litecoin 0.7 but this one based on latest 0.8.6 is giving me lots of problems.

Someone knows where can be the problem?

I have been reading for the last two days about this error. I have tried changing flag order to see if it was working, compiling my own leveldb, using the ones coming with Litecoin...

Nobody can help me? I'm getting crazy with this!
member
Activity: 98
Merit: 10
UP, still stucked!
member
Activity: 98
Merit: 10
I have followed your guide and I'm stuck here:


I have been able to compile alt-coins based on Litecoin 0.7 but this one based on latest 0.8.6 is giving me lots of problems.

Someone knows where can be the problem?

I have been reading for the last two days about this error. I have tried changing flag order to see if it was working, compiling my own leveldb, using the ones coming with Litecoin...
newbie
Activity: 1
Merit: 0
I faced this problem can anyone help me to solve it.

http://i.imgur.com/ZENAqIl.png

gcc 4.6.2
thread model: win32
full member
Activity: 131
Merit: 108
Boost 1.55 seems to be broken for me.
When I run
Code:
bootstrap.bat mingw
I got some errors like:
"VCVARS32.BAT is not recognized as an internal or external command" like in this thread: http://b1te.de/5N
So I moved to Boost 1.54 and I can run
Code:
bootstrap.bat mingw
now without any problems.

See if this fix helps:
https://groups.google.com/d/msg/boost-developers-archive/hVNKGbZcXs0/fIh-iK-DVOMJ


Actually I got a problem to create the Bitcoin-qt.
I got messages like CC is not found.
Code:
C:\testcoin>mingw32-make -f Makefile.Release
cd C:/testcoin/src/leveldb && CC=gcc CXX=g++ TARGET_OS=OS_WINDOWS_CROSSCOMPIL
E mingw32-make OPT="-pipe -fno-keep-inline-dllexport -D_FORTIFY_SOURCE=2 -O2" li
bleveldb.a libmemenv.a && ranlib C:/testcoin/src/leveldb/libleveldb.a && ranl
ib C:/testcoin/src/leveldb/libmemenv.a
Der Befehl "CC" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
Makefile.Release:317: recipe for target 'C:/testcoin/src/leveldb/libleveldb.a
' failed
mingw32-make: *** [C:/testcoin/src/leveldb/libleveldb.a] Error 1

-> But CC = gcc is specified and it worked to create the headless version.
I use Qt 5.2 maybe I should try it with another version.

Did you remove leveldb build instructions from your .pro file?
sr. member
Activity: 260
Merit: 251
Hello skatola,

Hi and thank you so much for this amazing guide!
like a lot of people i tried to follow your tutorial and like a lot of people i have a problem XD hope u can help me : )
at the step 3.3, after i edited the makefile.mingw i launch mingw32-make -f makefile.mingw and i receive this error:
Here it is running from C:\bitcoin-0.8.6\src
Quote
C:\bitcoin-0.8.6\src>mingw32-make -f makefile.mingw
Now gcc launches to compile alert.cpp into obj/alert.o
Notice that alert.cpp is the first in the list of files to be compiled in makefile.mungw, so none have successfully compiled so far.
Quote
g++ -c -mthreads -O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-par
ameter -g -D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADS
AFE -DUSE_IPV6=1 -IC:/bitcoin-0.8.6/src/leveldb/include -IC:/bitcoin-0.8.6/src/l
eveldb/helpers á-I"C:/bitcoin-0.8.6/src" á-I"c:/deps/boost_1_55_0" á-I"c:/deps/d
b-4.8.30.NC/build_unix" á-I"c:/deps/openssl-1.0.1e/include" -o obj/alert.o alert
.cpp
Now gcc fails saying that the src files that I presume are in C:\bitcoin-0.8.6\src by the above, are now presumed by gcc to be in C:\MinGW\msys\1.0\?  So something did a change directory?  Also note that the include  directories seem also to be changed for gcc by the same change directory.  Also are you doing what this shows:
1. Have a c:\deps directory for all your "dependencies"?
2. Are you compiling bitcoin 0.8.6?
3. Are you using Boost 1.55?
4. Are you using BerkeleyDB 4.8.30?
That is what it is saying, but those seemed pretty "canned".  Maybe you didn't do step 3.2 that says you must edit the make file to match your particular layout.  Unless of course you match the layout exactly, i.e. have things on c:, have a c:\deps, etc. etc.
Quote
g++.exe: error: á-IC;C:\MinGW\msys\1.0\bitcoin-0.8.6\src: Invalid argument
g++.exe: error: á-Ic;C:\MinGW\msys\1.0\deps\boost_1_55_0: Invalid argument
g++.exe: error: á-Ic;C:\MinGW\msys\1.0\deps\db-4.8.30.NC\build_unix: Invalid arg
ument
g++.exe: error: á-Ic;C:\MinGW\msys\1.0\deps\openssl-1.0.1e\include: Invalid argu
ment
Now mingw32-make notices and you stop
Quote
makefile.mingw:124: recipe for target 'obj/alert.o' failed
mingw32-make: *** [obj/alert.o] Error 1


i tried to solve alone but i can't : (
any idea what i did wrong?
thank you for your help!

Ron
newbie
Activity: 31
Merit: 0
Hi and thank you so much for this amazing guide!
like a lot of people i tried to follow your tutorial and like a lot of people i have a problem XD hope u can help me : )
at the step 3.3, after i edited the makefile.mingw i launch mingw32-make -f makefile.mingw and i receive this error:

C:\bitcoin-0.8.6\src>mingw32-make -f makefile.mingw
g++ -c -mthreads -O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-par
ameter -g -D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADS
AFE -DUSE_IPV6=1 -IC:/bitcoin-0.8.6/src/leveldb/include -IC:/bitcoin-0.8.6/src/l
eveldb/helpers á-I"C:/bitcoin-0.8.6/src" á-I"c:/deps/boost_1_55_0" á-I"c:/deps/d
b-4.8.30.NC/build_unix" á-I"c:/deps/openssl-1.0.1e/include" -o obj/alert.o alert
.cpp
g++.exe: error: á-IC;C:\MinGW\msys\1.0\bitcoin-0.8.6\src: Invalid argument
g++.exe: error: á-Ic;C:\MinGW\msys\1.0\deps\boost_1_55_0: Invalid argument
g++.exe: error: á-Ic;C:\MinGW\msys\1.0\deps\db-4.8.30.NC\build_unix: Invalid arg
ument
g++.exe: error: á-Ic;C:\MinGW\msys\1.0\deps\openssl-1.0.1e\include: Invalid argu
ment
makefile.mingw:124: recipe for target 'obj/alert.o' failed
mingw32-make: *** [obj/alert.o] Error 1


i tried to solve alone but i can't : (
any idea what i did wrong?
thank you for your help!
newbie
Activity: 25
Merit: 0
Thanks, Ron, for the serialize.h and addrman.h code changes--they work and I've checked them into my codeplex project.  Now I don't have the weird preprocessor output in the addrman.h code anymore.

Cheers  Smiley
legendary
Activity: 1386
Merit: 1009
So do I still need older mingw32 4.6.2 to compile old altcoins?
Don't quite know what or whom you are addressing?  But I'd say that it depends on the *coin?  Which version of which coin are you referring to?  And if the "makefile" for the old coin has a line such as
BOOST_SUFFIX?=-mgw46-mt-sd-1_52
or
   -lboost_thread-mgw46-mt-sd-1_53 \
then it sure looks like you need gcc 4.6.2 unless you change your makefiles yourself, and test yourself, and build the libraries yourself.

Hope this helps.

Ron
I had problems compiling coins based on 0.7 code with gcc 4.7
Changing makefiles didn't help, as far as I remember it compiled but crashed at startup.
There were some internal changes introduced in gcc 4.7 that caused this behavior. That's why I had to use 4.6.
I mean, are there problems still or things changed?
I plan to try to compile this, can anyone try?
https://github.com/CryptoParts/GlobalCoin
Pages:
Jump to: