Author

Topic: Bitcoin-qt is not opening (Read 947 times)

legendary
Activity: 1512
Merit: 7340
Farewell, Leo
December 30, 2020, 06:03:21 AM
#55
Thank you, one last thing. In order to rename my coin from "bitcoin" to "altcoin", do I have to rename everything like this?:
Code:
find . -type f -print0 | xargs -0 sed -1 's/bitcoin/altcoin/g'
find . -type f -print0 | xargs -0 sed -1 's/Bitcoin/Altcoin/g'
find . -type f -print0 | xargs -0 sed -1 's/BitCoin/AltCoin/g'
etc

I did this, but it seems that I'll also have to rename the filenames too, because of this:
Code:
#include

I hope that by renaming those too, I'm done.
HCP
legendary
Activity: 2086
Merit: 4361
December 29, 2020, 08:19:53 PM
#54
It would depend entirely on your network setup and the way the OSes/firewalls on the PCs are configured...
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
December 29, 2020, 03:41:33 PM
#53
Question, do I need to port forward in order to transfer information without having to be connected on the same local ip address? I remember that I tried doing it, but failed. On original bitcoin core, I don't need. I guess that I shouldn't need on this too.
HCP
legendary
Activity: 2086
Merit: 4361
December 27, 2020, 01:54:28 PM
#52
Yeah... they were the ones I was thinking of... As I recall, they are different for each network type (main, test, regtest etc). I think I set my "mainnet" ones to be the same (or similar) values as the regtest ones and then it starting syncing better.

Glad you managed to get it sorted Wink
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
December 25, 2020, 01:36:59 PM
#51
Do you mean these?

m_assumed_blockchain_size = 350;
m_assumed_chain_state_size = 6;


Should I decrease the blockchain_size?

Edit: 26/12/2020 - 14:37 UTC:
I changed both to 2 and it's working! Thanks!
HCP
legendary
Activity: 2086
Merit: 4361
December 25, 2020, 01:33:46 PM
#50
I vaguely remember tweaking something regarding blockchain and/or chainstate "size" in one of the "chainparams" source code files... I'm not sure if that actually has anything to do with whether or not it requires a certain number of blocks before syncing...

Really beginning to wish I had kept my modifications now Undecided
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
December 25, 2020, 02:52:52 AM
#49
Indeed, it seems to be syncing the block headers at least, so that's a good sign that it is connecting properly... for some reason it seems to think that 6 is only ~22% of the being synced... so you might need to generate "a few" more blocks for it consider the headers synced and to start collecting blocks? Huh
Isn't there a variable in the source code that sets how many blocks are "enough" to start syncing? There must be another way to sync, instead of mine ~30 blocks.
HCP
legendary
Activity: 2086
Merit: 4361
December 24, 2020, 03:37:31 PM
#48
I define PC#1 as the one that mined the 6 blocks. PC#2 is the other one. Note that it took many hours to mine them. I don't like calling it luck, since it's possibilities, but I must have been unlucky.
That's why I spent a bit of time getting cpuminer/bfgminer up and running... it was quite a hassle getting one to work properly, but it definitely had a better hash rate than using generatetoaddress.

It does show something. Here's my debug.log: https://pastebin.com/raw/JYpFCefd
I don't have a bitcoin.conf file on my PC#2. Should I?
Probably not necessary if it is connected and showing as a peer etc...
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
December 23, 2020, 03:42:14 PM
#47
I define PC#1 as the one that mined the 6 blocks. PC#2 is the other one. Note that it took many hours to mine them. I don't like calling it luck, since it's possibilities, but I must have been unlucky.

When a block is mined on PC#1, do you see any of the "UpdateTip" type messages appear in the debug.log on PC#2? Huh
It does show something. Here's my debug.log: https://pastebin.com/raw/JYpFCefd

Also, what are your settings on PC#2? ie. contents of bitcoin.conf etc
I don't have a bitcoin.conf file on my PC#2. Should I?
HCP
legendary
Activity: 2086
Merit: 4361
December 23, 2020, 03:07:58 PM
#46
From memory, it took a few blocks for the 2nd instance (was running in a VM), to decide that that was the longest chain and to start syncing the blocks... like I said, I deleted everything, so I can't test it now Sad

When a block is mined on PC#1, do you see any of the "UpdateTip" type messages appear in the debug.log on PC#2? Huh

Also, what are your settings on PC#2? ie. contents of bitcoin.conf etc
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
December 23, 2020, 02:41:01 PM
#45
So, the 2nd PC is stuck on 'zero' blocks in the "information" screen? Huh
Yes, it's stuck with the genesis block. Any ideas?
HCP
legendary
Activity: 2086
Merit: 4361
December 23, 2020, 02:19:15 PM
#44
possibly... or "transaction" information etc...

So, the 2nd PC is stuck on 'zero' blocks in the "information" screen? Huh
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
December 23, 2020, 07:58:42 AM
#43
I recompiled it and mined 6 blocks. Still the PC doesn't receive any blocks. They do make a connection, but they don't transfer blocks:



What are they transferring then? What are these kilobytes? Handshakes?
HCP
legendary
Activity: 2086
Merit: 4361
December 21, 2020, 03:13:12 PM
#42
It "might"... it's impossible to tell with these fork coins what is causing issues because of the mods that have been made... I haven't looked at mine in weeks and from memory, I had issues with it if I left it offline for a day or two, it would cause issues with getting it going and mining/syncing again Undecided

I can't even go and try to test my setup, as it appears that due to resource constraints, I deleted all the forkcoin stuff I had in my VMs Shocked
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
December 21, 2020, 01:59:00 PM
#41
In the "blocks" folder... so that blk00000.dat file that is shown in your screenshot will have your block data in it.
Should I move the blk00000.dat to my other laptop to start syncing? I don't get why it ain't syncing.
HCP
legendary
Activity: 2086
Merit: 4361
December 21, 2020, 01:36:35 PM
#40
Where are the blocks located? On my bitcoin core it says that I have mined 6 blocks, just like you did, but I don't see them anywhere:

In the "blocks" folder... so that blk00000.dat file that is shown in your screenshot will have your block data in it.

You can retrieve some block information from the console using:
Code:
getblockhash BLOCKNUMBER

This will return the BLOCK_HASH...

then:
Code:
getblock BLOCK_HASH
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
December 21, 2020, 08:29:25 AM
#39
EDIT: after mining a couple of subsequent blocks, it seems the 2nd node was able to sync up properly... and I'm now able to send transactions between the 2 etc. So maybe mine some more blocks and see if that kicks things into action for you Wink

Where are the blocks located? On my bitcoin core it says that I have mined 6 blocks, just like you did, but I don't see them anywhere:





legendary
Activity: 1512
Merit: 7340
Farewell, Leo
December 21, 2020, 07:06:34 AM
#38
generatetoaddress should have multi-core capability (since Bitcoin-qt also had one for mainnet mining), so i doubt there's significant performance increase.
I have a better GPU than CPU. Is it possible to run bitcoin core with GPU?
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
December 21, 2020, 06:05:59 AM
#37
By using a cpu miner like cpuminer does it go faster? Why is my antivirus going crazy when I try to download it? It doesn't allow me.

Antivirus programs now have filters that flag all miners, malicious or not, as malware. You need not worry about this as long as you downloaded cpuminer from a reputable source and verified its checksum. You should whitelist the file.

legendary
Activity: 1512
Merit: 7340
Farewell, Leo
December 21, 2020, 03:38:14 AM
#36
I like getting back to it once a month. It is a nice habit and practice.  Tongue

I had left it for 6 weeks without mining any blocks. I don't think that this is an issue. At least not at the first 2016 blocks. Today I opened bitcoin-qt on my laptop and pc and started mining using generatetoaddress. I haven't succeeded yet:



By using a cpu miner like cpuminer does it go faster? Why is my antivirus going crazy when I try to download it? It doesn't allow me.



I try to disable it temporally but it says:



Should I worry?
HCP
legendary
Activity: 2086
Merit: 4361
November 08, 2020, 12:53:27 AM
#35
AFAIR, I've read somewhere that it works in mainnet.
It's just that the difficulty is too high that it'll surely fail after the default 'maxtries' (1000000 iterations).
Yep, "no" realistic chance with Bitcoin, but with difficulty set to 1 on these custom coins, it will eventually find a block or 2 Wink


No mining scripts. Just generatetoaddress with 1 billion max tries. (I think)
Ah yes, that and a bit of patience finally resulted in a block being produced... however I'm in the same boat, the 2nd node seems like it has received the "header" at least... but doesn't seem to be retrieving or syncing the generated block...



EDIT: after mining a couple of subsequent blocks, it seems the 2nd node was able to sync up properly... and I'm now able to send transactions between the 2 etc. So maybe mine some more blocks and see if that kicks things into action for you Wink





Note: I also dropped the maturity time to 5 blocks as mining on the VMs is very slow and I couldn't wait for 100 blocks! Wink
legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
November 07, 2020, 10:47:30 PM
#34
Fairly sure that the generatetoaddress command only works in "regtest" mode.
AFAIR, I've read somewhere that it works in mainnet.
It's just that the difficulty is too high that it'll surely fail after the default 'maxtries' (1000000 iterations).

I'll try to find the post (from a Bitcoin Core developer) and update this later.

-edit-

Found it: /index.php?topic=5227792.msg53894613#msg53894613
Thanks google search.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
November 07, 2020, 05:19:51 PM
#33
Out of interest, how did you mine that block? Did you have to setup a standalone "miner" of some description? Or did you just use the generatetoaddress option? Huh
No mining scripts. Just generatetoaddress with 1 billion max tries. (I think)
HCP
legendary
Activity: 2086
Merit: 4361
November 07, 2020, 05:06:17 PM
#32
Out of interest, how did you mine that block? Did you have to setup a standalone "miner" of some description? Or did you just use the generatetoaddress option? Huh
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
November 07, 2020, 07:28:19 AM
#31
I added my local ip and it connected. (192.168.2.3:7333)
So yeah, right now on the network traffic tab I can see that the devices are sharing information.

Question, how difficult is finding a block below the target with difficulty = 1?



Edit: I made it!



The problem I face now is that it hasn't shared to my laptop the information that I mined it... What could be the fault?  Huh
(Once I run getblockcount on laptop I get 0)
HCP
legendary
Activity: 2086
Merit: 4361
November 07, 2020, 07:06:19 AM
#30
The problem is that when I run addnode "xx.xxx.xxx.xxx:7333" "add" it returns me null. I'm sending you a video of it via PM.
That is the correct response... it should return null...

Do you then see the "xx.xxx.xxx.xxx" machine appear in the "peers" tab after you use the addnode command? Huh If you don't then you might need to look into the IP addresses you're using and/or the network settings.

From the video you sent me, it looks like you're using external IP addresses... if they're both on the same network and plugged into the same router, then I'd expect you should be using addresses that start 192.168.x.x or 10.0.x.x etc... they're the most common "private" network type addresses... Also, it's possible that the Windows firewall is just being stupid and blocking things Roll Eyes

I ran my 2 nodes on 2 Linux VMs, connected in a network as 10.0.2.4 and 10.0.2.5... when I used the following from the first VM:
Code:
addnode 10.0.2.5 add

It took only 2 or 3 seconds and the connection was made and I could see it listed in the "Peers" tab.


I still haven't been able to mine a block, despite spending hours trying to get cgminer/bfgminer "solo" CPU mining... neither of them seem to want to connect the node via RPC, despite the fact that bitcoin-cli works fine (even from the 2nd node across the network) Undecided
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
November 07, 2020, 05:27:35 AM
#29
I've done what you said. I don't get any peers now. So it's a new coin right now. I also tried to run bitcoin core on 2 different devices as you said (from 2 different ip addresses).



The problem is that when I run addnode "xx.xxx.xxx.xxx:7333" "add" it returns me null. I'm sending you a video of it via PM.
HCP
legendary
Activity: 2086
Merit: 4361
November 07, 2020, 12:16:40 AM
#28
So now, bitcoin-qt opens without any errors. I've several queries right now, though. First of all, I connect with nodes. That shouldn't happen. I've deleted all “vSeeds.emplace_back” lines. There are no IP addresses on my source code. I've also changed the message signature of mainnet to:
Although, Bitcoin Core sends information somewhere.


Will probably be all the "fixed seeds" in chainparamsseeds.cpp

Shutdown your custom Core app, then delete peers.dat. After that, in chainaparams.cpp, find the "vFixedSeeds" lines... and make sure they're all "vFixedSeeds.clear();"... then recompile and restart Bitcoin-qt.exe... you should see no "peers" on the peers tab in "Windows -> Peers":



Second question. Why am I considered as asynchronized? I haven't changed the satoshi's genesis block and in order to work I've set nMaxTipAge to a large value, so it can mine without thinking that the block is way too old. (bad grammar)

validation.cpp:
Code:
int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE * 10000;
Because there aren't any "blocks" to sync if you just start up with the Genesis block... until a block is mined, there will be nothing to sync


Quote
Third question. Why I can't mine? Difficulty is 1. Does it have to do with the previous question that I'm not "synchronized"?


Fairly sure that the generatetoaddress command only works in "regtest" mode. You'll need to connect a 2nd node, and then setup a solo miner of some description to create a block before you'll see the nodes "sync".


legendary
Activity: 3584
Merit: 5243
https://merel.mobi => buy facemasks with BTC/LTC
November 05, 2020, 07:15:37 AM
#27
--snip--
And I cloned P2Pool and setup my own mining pool..
What's the point of cloning one if it's a small project? People can mine from their pc via Core. It must be hard, but according to your posts, you are an experienced miner so it wouldn't be that bad.

It's the same point as everything else in your thread: a learning experience... The point of setting up a pool for such a cloned coin is exactly the same point as having a block explorer or an spv wallet... After all: you can easily parse those couple of blocks manually instead of using an explorer, and you don't need an SPV wallet if the total size of your blockchain is only a couple Mb...
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
November 05, 2020, 06:28:08 AM
#26
Did you manage to figure out why the Windows version just crashed immediately on startup? Was there anything registered in the Windows Error Log that might indicate why it was crashing? Huh
Yes, I've figured it out what was the fault weeks now. I just didn't reply to your last post. You were right, it was the checkpointData.

Instead of:
Code:
checkpointData = {
            {
               
            }
        };

I should do it:
Code:
checkpointData = {
            {
                { 0, uint256S("0x0")}
            }
        };

So now, bitcoin-qt opens without any errors. I've several queries right now, though. First of all, I connect with nodes. That shouldn't happen. I've deleted all “vSeeds.emplace_back” lines. There are no IP addresses on my source code. I've also changed the message signature of mainnet to:
Code:
pchMessageStart[0] = 0xf0;
pchMessageStart[1] = 0xb0;
pchMessageStart[2] = 0xb0;
pchMessageStart[3] = 0xd0;

Although, Bitcoin Core sends information somewhere.



Second question. Why am I considered as asynchronized? I haven't changed the satoshi's genesis block and in order to work I've set nMaxTipAge to a large value, so it can mine without thinking that the block is way too old. (bad grammar)

validation.cpp:
Code:
int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE * 10000;

Third question. Why I can't mine? Difficulty is 1. Does it have to do with the previous question that I'm not "synchronized"?



And I cloned P2Pool and setup my own mining pool..
What's the point of cloning one if it's a small project? People can mine from their pc via Core. It must be hard, but according to your posts, you are an experienced miner so it wouldn't be that bad.
legendary
Activity: 3584
Merit: 5243
https://merel.mobi => buy facemasks with BTC/LTC
November 05, 2020, 05:15:52 AM
#25
--snip--
  • Create an altcoin core with bitcoin core source code.
  • Create an altcoin wallet using electrum source code.
  • Create a block explorer for the altcoin.
--snip--

A long time ago, i have created my own (private) coins for learning purposes... So it's defenately possible.
I stared with litecoin's codebase since at that time it still had the code for a cpu miner, so that made things easyer to find the first couple of blocks. I had that network running between a couple of home computers for weeks...

I also setup a block explorer... Can't remember which one tough... And I cloned P2Pool and setup my own mining pool..

IIRC, the whole thing took me about a week... Including adapting litecoin's codebase for my own "coin", compiling linux and windows binaries, setting up an explorer and a pool... But since it was a private project I never applied any updates or improvements.

Later on, i got fed up by the sheer amount of low-effort worthless altcoins flooding the market, so i made a proof-of-concept to prove anybody with some basic skills could push an altcoin to the market in a couple of hours, so i created mocacoin in a timespan of 3 or 4 hours (IIRC): https://www.mocacinno.com/mocacoin
It's based on monero's coinbase (or was it based on a clone of a clone of XMR... Don't remember)

So, if that's TL;DR; : sure, it's possible to create your own altcoin, as long as it's for learning purposes... an explorer: sure... a pool: sure.... electrum: sure (i haven't done this personally, but i don't see why not)...
HCP
legendary
Activity: 2086
Merit: 4361
November 04, 2020, 05:41:08 PM
#24
I admire your tenacity... you have a goal, and you're determined to reach it. So, kudos for that! Smiley

I guess the main problem you're likely to face is that, it's not just a quick "chain params" edit... as you have already discovered there are other factors at play like the ports used, version numbers etc. Obviously, with the proliferation of altcoins that have been spawned back in 2016-2017 etc, it clearly isn't a "mission impossible"... it'll just need a bit of work.

Did you manage to figure out why the Windows version just crashed immediately on startup? Was there anything registered in the Windows Error Log that might indicate why it was crashing? Huh
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
November 04, 2020, 04:52:22 PM
#23
otherwise it's like walking in the dark without a flashlight; you bump into things and it takes you longer to get to your destination.
You described it nice. Okay, I get that it needs time, effort and knowledge. As a beginner (about everything), I see the whole thing in a simple way, which is probably not. Changing few lines on chainparams.cpp and waiting that it's finished, could work in theory, but in action it is far from that. But how bitcoin's blockchain is the one that all nodes follow? Is it because of the pchMessageStart? If this change then am I a different node? A different "follower"?

"Anyone" is probably a bit of a stretch. Although given enough time and effort, most competent devs should be able to figure it out. It just probably won't happen "overnight".
I wrote a falsely phrase, you're right. What I wanted to say is that anyone is free to create a cryptocurrency. He can make it if he wants it! He doesn't have to spend money or take permission from a third party. Because, after all, bitcoin is just a bunch of code. Nothing special for the computer, but a huge step for mankind.

[1] yes, this is a terrible term... but it's early and I haven't had any coffee and my brain is still waking up Tongue
Good morning from Greece! Here it's 23:51. Going to sleep now.  Tongue
HCP
legendary
Activity: 2086
Merit: 4361
November 04, 2020, 04:32:45 PM
#22
There is no definite answer to your question, as a lot of it depends on things like:
- Your familiarity with cryptocurrency in general
- Your familiarity with C++
- Your familiarity with C++ software development methodologies and tools
- Your familiarity with the Bitcoin Core codebase
- Your familiarity with Linux
- Your familiarity with the various compilation tools and methods
- Your familiarity with cross-compiling Windows binaries on Linux

I'm sure that it would be relatively simple for one of the Bitcoin Core "main"[1] devs to rework the code to do exactly what it is you're trying to do. Someone with a "reasonable" level of C++ and the tools, but no experience with BTC or cryptocurrency in general, would probably be able to do it, but would most likely need a bit of time and research to figure out how to do it. You have admitted that your experience level in a number of the areas I've listed above is "low".

I just want to prove that anyone can create a cryptocurrency.
"Anyone" is probably a bit of a stretch. Although given enough time and effort, most competent devs should be able to figure it out. It just probably won't happen "overnight".



[1] yes, this is a terrible term... but it's early and I haven't had any coffee and my brain is still waking up Tongue
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
November 04, 2020, 04:22:24 PM
#21
There isn't even a complete list of consensus rules for Bitcoin (https://en.bitcoin.it/wiki/Protocol_rules comes close). Just figuring out the consensus rules and listing them all in one place is a full-time job for multiple people, and this applies to all altcoin projects, the serious ones of course.
That would be true if I wanted to create something completely different than bitcoin. I want to create a coin, following all the bitcoin rules but on a different chain. On a few words I want to remake bitcoin from block 1. I guess that since Bitcoin core or electrum are written in a way to follow the bitcoin's consensus rules, they can follow my coin's too.

I think that a "project" like that sounds simple enough. But is it? I thought that building bitcoin core (that reads a new blockchain), would be that easy but it seemed it wasn't.

Even if you're working on something where you don't have to worry about consensus rules, if you want to something like this to be accomplished quickly, and not slowly, you need to have:

- A couple hours you can spare each day for working on the project
- A fast workstation that doesn't make you wait so long for compilation to finish
- Lots of experience in C++ (or whatever language it's in), as in you need to have already written projects in it. There is no time to spend browsing language documentation.

And if you're modifying an existing project you also need to have studied the behavior of all the program variables at runtime, via debugging or some other means. I think you only read the source code about the chainparams.cpp file without attaching a debugger to a normal bitcoin-qt to see how the variables in that file are used in calculations which affect other variables. So before modifying a program you need to know how its internals work while it runs, at least for the section you are working on, otherwise it's like walking in the dark without a flashlight; you bump into things and it takes you longer to get to your destination.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
November 04, 2020, 04:06:02 PM
#20
There isn't even a complete list of consensus rules for Bitcoin (https://en.bitcoin.it/wiki/Protocol_rules comes close). Just figuring out the consensus rules and listing them all in one place is a full-time job for multiple people, and this applies to all altcoin projects, the serious ones of course.
That would be true if I wanted to create something completely different than bitcoin. I want to create a coin, following all the bitcoin rules but on a different chain. On a few words I want to remake bitcoin from block 1. I guess that since Bitcoin core or electrum are written in a way to follow the bitcoin's consensus rules, they can follow my coin's too.

I think that a "project" like that sounds simple enough. But is it? I thought that building bitcoin core (that reads a new blockchain), would be that easy but it seemed it wasn't.
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
November 04, 2020, 03:54:43 PM
#19
Even if I've failed on creating my altcoin which would be exactly like bitcoin, I don't want to give up. I feel that I have to make it work! Probably, the above bitcoin experts that helped me on this thread must have made something similar in the past. So I would like to ask even if I get off-topic, do you consider difficult to do the following?

  • Create an altcoin core with bitcoin core source code.
  • Create an altcoin wallet using electrum source code.
  • Create a block explorer for the altcoin.

Should I keep trying succeeding on my "goal" or I'll get lost? There's nothing suspicious on why I want to do this. I just want to prove that anyone can create a cryptocurrency.

You are attempting to create two wallet softwares and a block explorer, that is definitely too much work to finish by yourself.

Software development bigger than simple programs is not a one-man job, it takes several people coordinating with each other to work on different parts of the program and continuously create updates for it when some of the developers are not available. Cryptocurrency software is no exception to the rule. In fact, there is more work involved in making a cryptocurrency than merely creating an open-source project because you need to decide on the consensus rules. Consensus rules are not clearly indicated in the codebase and are scattered all over the code. And if you don't make sure that your code follows your own consensus rules then you have a different altcoin from what you created, and it's difficult to diagnose the problem with a debugger.

There isn't even a complete list of consensus rules for Bitcoin (https://en.bitcoin.it/wiki/Protocol_rules comes close). Just figuring out the consensus rules and listing them all in one place is a full-time job for multiple people, and this applies to all altcoin projects, the serious ones of course.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
November 04, 2020, 03:35:07 PM
#18
Even if I've failed on creating my altcoin which would be exactly like bitcoin, I don't want to give up. I feel that I have to make it work! Probably, the above bitcoin experts that helped me on this thread must have made something similar in the past. So I would like to ask even if I get off-topic, do you consider difficult to do the following?

  • Create an altcoin core with bitcoin core source code.
  • Create an altcoin wallet using electrum source code.
  • Create a block explorer for the altcoin.

Should I keep trying succeeding on my "goal" or I'll get lost? There's nothing suspicious on why I want to do this. I just want to prove that anyone can create a cryptocurrency.
HCP
legendary
Activity: 2086
Merit: 4361
October 24, 2020, 03:13:30 AM
#17
My guess (without looking at the code) is that there is code that is attempting to reference something like checkpointData[0] or checkpointData[1] etc... and you've effectively set it as a null array... so any references to an index in the array will likely be generating an "array out of bounds" type error... EDIT: or maybe not... now that I think about it, C/C++ may not do array bounds checking? Huh I don't really remember, as I never did a lot of C/C++...


Did you check the Windows error log? Huh
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
October 24, 2020, 03:05:13 AM
#16
Update:

I forgot to mention some things that I change on chainparams.cpp. I changed only those little things and Bitcoin Core didn't start. Once I build it without making those changes it started successfully.

I set
Code:
checkpointData = { };
(on every checkpointData on chainparams.cpp)

I set
Code:
consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000000000000100010001");

In removed lines start with “vSeeds.emplace_back”.

Any ideas what's the fault?
HCP
legendary
Activity: 2086
Merit: 4361
October 23, 2020, 03:03:32 PM
#15
Code:
Changing the ports won't stop you from interacting with the "original blockchain" (I believe you mean Bitcoin Mainnet). It's entirely possible to run Bitcoin Core using whatever port number you like.

There is even a runtime argument that allows you to change it
[code]
-port=  Listen for connections on (default: 8333, testnet: 18333, regtest: 18444)


While I understand that compilation can take a long time, have you tried making one code modification at a time to figure out which modification is actually breaking your build? Huh If you're not able to use the "Debug" option provided by that error dialog, have you checked the windows error log (after clicking "close program") to see if there is an error output there that gives any more details about the reason for the error? Huh


Also, with regards to your compilations taking a long time, are you using "make clean" every time you build or something? Huh Seems odd that making a change to one particular component should require a full rebuild. Huh

Note, after making a code change, the only build commands you should need from the "Building for Windows" docs are:
Code:
sudo bash -c "echo 0 > /proc/sys/fs/binfmt_misc/status" # Disable WSL support for Win32 applications.
make
sudo bash -c "echo 1 > /proc/sys/fs/binfmt_misc/status" # Enable WSL support for Win32 applications.

You should not need to do all the other config every time you need to compile.


EDIT: just did a test... after the initial compile (which admittedly took quite a long time, but less than an hour)... I edited chainparams.cpp (changed the genesis block string):
Quote
user@pc:~/bitcoin$ date
Sat Oct 24 02:07:00 UTC 2020
user@pc:~/bitcoin$ make
Making all in src
make[1]: Entering directory '/home/user/bitcoin/src'
make[2]: Entering directory '/home/user/bitcoin/src'
make[3]: Entering directory '/home/user/bitcoin'
make[3]: Leaving directory '/home/user/bitcoin'
  CXX      libbitcoin_common_a-chainparams.o
  AR       libbitcoin_common.a
  CXX      libbitcoin_util_a-clientversion.o
  AR       libbitcoin_util.a
  CXXLD    bitcoind.exe
  CXXLD    bitcoin-cli.exe
  CXXLD    bitcoin-tx.exe
  CXXLD    bitcoin-wallet.exe
  CXXLD    test/test_bitcoin.exe
  CXXLD    bench/bench_bitcoin.exe
  CXXLD    qt/bitcoin-qt.exe
  CXXLD    qt/test/test_bitcoin-qt.exe
make[2]: Leaving directory '/home/user/bitcoin/src'
make[1]: Leaving directory '/home/user/bitcoin/src'
Making all in doc/man
make[1]: Entering directory '/home/user/bitcoin/doc/man'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/user/bitcoin/doc/man'
make[1]: Entering directory '/home/user/bitcoin'
make[1]: Nothing to be done for 'all-am'.
make[1]: Leaving directory '/home/user/bitcoin'
user@pc:~/bitcoin$ date
Sat Oct 24 02:08:02 UTC 2020
user@pc:~/bitcoin$

So, only about a minute to recompile a modification... my advice is that you don't blindly use build commands without understanding what it is that you're doing... if you run that entire section of build commands every single time you make a change, you're redoing a lot of unnecessary stuff which would probably explain your long "build" times.[/code]
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
October 23, 2020, 01:54:10 PM
#14
I changed the message because I'm creating an altcoin. Should I leave it as it is? Won't it have any interactions with the original blockchain?

I doubt since I've changed the ports.
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
October 23, 2020, 01:42:22 PM
#13
On chainparams.cpp I change the exact things:

nDefaultPort: Same procedure, wherever it has "8", I set it to "7".
pchMessageStart: I just change the message, nothing important. For example, for the mainnet I set it to:
Code:
pchMessageStart[0] = 0xf4;
pchMessageStart[1] = 0xb5;
pchMessageStart[2] = 0xb6;
pchMessageStart[3] = 0xd7;

I think it this has to do with downloading the original blockchain.


Sounds like this is what's making your build crash, the magic value is supposed to be the same for all nodes, or else other bitcoin nodes will discard as invalid your messages that have different headers, and all kinds of bugs can happen after unexpected message rejection.

In fact pooya87 told you about the magic constant in your other thread:

2) this 4 byte value is the fixed "magic" that is used at the beginning of every P2P message that is sent between the nodes as a simply indication of the network the nodes are on and to help the nodes find the beginning of the message inside the stream of bytes they receive over TCP.
MainNet, TestNet and RegTest use different "magic" values to make them distinct and help nodes disconnect immediately from another node that sends them messages from a different network (or by extension from a different copycat altcoin).
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
October 23, 2020, 07:02:10 AM
#12
Okay, I agree with you, I will post my changes. First of all I want to say that these are the commands I insert on Ubuntu 18.04 LTS to build the source code:
Code:
PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g') # strip out problematic Windows %PATH% imported var
sudo bash -c "echo 0 > /proc/sys/fs/binfmt_misc/status" # Disable WSL support for Win32 applications.
cd depends
make HOST=x86_64-w64-mingw32
cd ..
./autogen.sh # not required when building from tarball
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/
make

Let's go to the changes now. On chainparamsbase.cpp I change the ports. Wherever it has "8" I set it to "7". (e.g 8332 -> 7332).
On chainparams.cpp I change the exact things:

nDefaultPort: Same procedure, wherever it has "8", I set it to "7".
pchMessageStart: I just change the message, nothing important. For example, for the mainnet I set it to:
Code:
pchMessageStart[0] = 0xf4;
pchMessageStart[1] = 0xb5;
pchMessageStart[2] = 0xb6;
pchMessageStart[3] = 0xd7;

I think it this has to do with downloading the original blockchain.

On validation.cpp I change nMaxTipAge to be equal with DEFAULT_MAX_TIP_AGE * 4000. I do this to avoid changing the genesis block of my coin.

In consensus/consensus.h I change COINBASE_MATURITY = 10;

Then I save all 4 files with my notepad++, but because it changes permissions to the mentioned files I do sudo chmod 640 to pass this problem. I have made a thread about this issue.
legendary
Activity: 3584
Merit: 5243
https://merel.mobi => buy facemasks with BTC/LTC
October 23, 2020, 12:54:57 AM
#11
@mocacinno, it is now confirmed that there is some kind of mess during the code changes. I built Bitcoin Core (without any change) and it is normally opening. Once I make few changes on chainparams.cpp, chainparamsbase.cpp, consensus.h and validation.cpp I build it and the bitcoin-qt isn't opening. Do you propose me to do the same procedure on a virtual machine?

P.S: Is it normal or am I the only one that takes too long to compile the source code? Since I read your last post I started building the original source code. Then once I confirmed that it opens I tried with the changes and when it ended I started writing this post. One compilation takes about 2-3 hours.

I agree with NotATether, but wanted to give specific answers to these questions:

1) if you compiled the unmodified sourcecode and it works, but your modified sourcecode doesn't, it won't matter if you do a gitian build or build with visual studio...

2) i haven't done a gitian build in ages, nor do i usually build the qt gui (just the daemon). I haven't timed the time it needs to compile either, but 2-3 hours does sound like a long time... I guess my builds usually take less than 30 minutes (building linux binaries on linux, no gui).
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
October 22, 2020, 05:40:16 PM
#10
Whenever you get a Stop Working error in a Windows program, it means a C++ exception was thrown and nothing caught it so it broke up through the call stack and out of main(). So whatever change you made in the files broke Bitcoin Core and caused bitcoind to make an unknown exception, and bitcoin-qt probably caught the error and exited with a non-zero exit code which is why the window never opened.

If it didn't reach the statement/function that creates the Bitcoin folder in AppData, then the exception is thrown somewhere earlier than that statement.

You need to post the changes you made to each file so that we have a chance of knowing what is stopping the program from working.

Did you press debug to see if it came up with anything (though I don't think it normally does). You could try checking the event manage to see if there's anything in there.
I did. It showed me to debug it with visual studio 2017. Should it work if I do it?

Debug mode doesn't magically make programs work, it's supposed to be used by developers to trace control flow of the program and inspect variables.

If it turns out something went wrong during compilation, you could always try to follow above steps... Just run a local vm with the correct version of debian and follow all steps... I haven't executed a gitian build in a long, long time... But i guess it should still worked as described.
Ahh here we go again with the virtual machines... And I loved the Ubuntu 18.04 LTS on my Win10  Cheesy
I wish that it will work without installing any VMs.

Compiling bitcoin core on native Windows is possible if you have Visual Studio 2017 or 2019, and there are instructions at https://github.com/bitcoin/bitcoin/blob/master/build_msvc/README.md

P.S: Is it normal or am I the only one that takes too long to compile the source code? Since I read your last post I started building the original source code. Then once I confirmed that it opens I tried with the changes and when it ended I started writing this post. One compilation takes about 2-3 hours.

I haven't personally compiled Bitcoin core but if it usually takes this long to compile, then messing with a few constants and functions does not change the compilation time at all. So chances are that's a completely normal time.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
October 22, 2020, 01:17:09 PM
#9
@mocacinno, it is now confirmed that there is some kind of mess during the code changes. I built Bitcoin Core (without any change) and it is normally opening. Once I make few changes on chainparams.cpp, chainparamsbase.cpp, consensus.h and validation.cpp I build it and the bitcoin-qt isn't opening. Do you propose me to do the same procedure on a virtual machine?

P.S: Is it normal or am I the only one that takes too long to compile the source code? Since I read your last post I started building the original source code. Then once I confirmed that it opens I tried with the changes and when it ended I started writing this post. One compilation takes about 2-3 hours.
legendary
Activity: 3584
Merit: 5243
https://merel.mobi => buy facemasks with BTC/LTC
October 22, 2020, 07:38:24 AM
#8
--snip--
Ahh here we go again with the virtual machines... And I loved the Ubuntu 18.04 LTS on my Win10  Cheesy
I wish that it will work without installing any VMs.

It might work... But in your case you're not 100% certain why your current build doesn't work... Personally, i wouldn't add to many unknown factors to the mix. If you follow their walktrough to the letter, you *should* end up with working binaries (at least, this was the case the last time i tried a gitian build).
If you start messing with linux natively under windows, and your build doesn't work, you'll never know if it is because you didn't follow the walktrough, or because you messed up the codechanges Smiley
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
October 22, 2020, 07:32:06 AM
#7
Did you try to compile before you started messing with the code? If not, i'd probably start there: see if you can clone the git repo and build core without any code changes... If it works: you messed up when changing the sourcecode; if it doesn't work: you have to find out what went wrong during the compilation.
Here it worked like a charm. I haven't changed anything important since then. I'm going to compile the bitcoin core without any changes and if there are no errors I'll try building with my configuration again. I hope I'll find errors with the original building, because if I don't it means that my changes mess the compilation.

chkdsk is the windows utility to check your hdd.
I have ssd, not hdd so I guess that's not the fault.

If it turns out something went wrong during compilation, you could always try to follow above steps... Just run a local vm with the correct version of debian and follow all steps... I haven't executed a gitian build in a long, long time... But i guess it should still worked as described.
Ahh here we go again with the virtual machines... And I loved the Ubuntu 18.04 LTS on my Win10  Cheesy
I wish that it will work without installing any VMs.
legendary
Activity: 3584
Merit: 5243
https://merel.mobi => buy facemasks with BTC/LTC
October 22, 2020, 07:16:45 AM
#6
chkdsk is the windows utility to check your hdd.

Did you try to compile before you started messing with the code? If not, i'd probably start there: see if you can clone the git repo and build core without any code changes... If it works: you messed up when changing the sourcecode; if it doesn't work: you have to find out what went wrong during the compilation.

Personally, i've crosscompiled core a couple of times in the past (eventough i now stopped running core on my work laptop, so i don't need the windows binary anymore). I usually did a gitian build: straightforeward and worked allmost always...

https://github.com/bitcoin-core/docs/blob/master/gitian-building.md

If it turns out something went wrong during compilation, you could always try to follow above steps... Just run a local vm with the correct version of debian and follow all steps... I haven't executed a gitian build in a long, long time... But i guess it should still worked as described.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
October 22, 2020, 07:07:40 AM
#5
Did you press debug to see if it came up with anything (though I don't think it normally does). You could try checking the event manage to see if there's anything in there.
I did. It showed me to debug it with visual studio 2017. Should it work if I do it?

Have you run chkdsk recently or had any other apps not work?
What is chkdsk? No I don't think so. Is there any way to find out?
copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
October 22, 2020, 06:25:35 AM
#4
Bitcoind is the command line version of bitcoin core. They're essentially the same thing but one's a gui to help people understand how to use it.

Did you press debug to see if it came up with anything (though I don't think it normally does). You could try checking the event manage to see if there's anything in there.

Have you run chkdsk recently or had any other apps not work?
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
October 22, 2020, 06:20:42 AM
#3
You're probably going to have to just reinstall it.

Can you launch it from the command line or try running it as an administrator (right click and run as admin)?


If that again doesn't work, you could try running the daemon (bitcoind) from the command line and also try "bitcoind - help" to see if the help screen loads.

The problem is that I've already reinstalled it. I have tried both command line and run as administrator. Once I open bitcoind.exe it stops working:



What is bitcoind used for?
copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
October 22, 2020, 06:09:51 AM
#2
You're probably going to have to just reinstall it.

Can you launch it from the command line or try running it as an administrator (right click and run as admin)?


If that again doesn't work, you could try running the daemon (bitcoind) from the command line and also try "bitcoind - help" to see if the help screen loads.
legendary
Activity: 1512
Merit: 7340
Farewell, Leo
October 22, 2020, 06:06:24 AM
#1
So I've build bitcoin core (with a few changes on chainparams.cpp etc) but it seems that it doesn't work. Here's a video: https://youtu.be/6eSQM5AeyBc

No "Bitcoin" folder has been created on AppData.
Jump to: