Bitcoin Forum
December 14, 2019, 01:53:27 AM *
News: Latest Bitcoin Core release: 0.19.0.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Questions around operation of bitcoin with no blocks and dns disabled..  (Read 171 times)
chameleon123
Jr. Member
*
Offline Offline

Activity: 48
Merit: 16


View Profile
December 14, 2018, 03:04:17 PM
Merited by ETFbitcoin (1)
 #1

While working on my private chain which is based on bitcoin. Several questions came to my mind. They maybe basic questions but so confusing for me.

1. I created two peers on same machine and I want to add them both to the block chain(The first one is already up). Is it enough to add address of first node to the config file of second node or I need to add both address to the each other's config file ?

2. Should all nodes when created, mine blocks till at least their coinbase maturity?With two nodes on same machine I have to at least generate blocks till their coinbase maturity otherwise I can't spend any amount. It didn't make sense to me. Is it true with bitcoin chain itself ? Cause difficulty there is very high!!!

3. First thing I do when a node starts up is that I generate a new address for it by
Code:
getnewaddress
command in console.Before typing this command there should be some automatically generated address assigned to the node or account. How can I get it?

4. After mining enough blocks, I try to send some bitcoins to the other node,
Code:
sendtoaddress <address> <amount>
but the coins wont't transfer and stays in memory pool for forever. Since I increased the target and reduced difficulty, this shouldn't happen. I guess my coins get lost or something....

Does any one knows the answer?

Thank you so much.
1576288407
Hero Member
*
Offline Offline

Posts: 1576288407

View Profile Personal Message (Offline)

Ignore
1576288407
Reply with quote  #2

1576288407
Report to moderator
1576288407
Hero Member
*
Offline Offline

Posts: 1576288407

View Profile Personal Message (Offline)

Ignore
1576288407
Reply with quote  #2

1576288407
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
MagicByt3
Full Member
***
Offline Offline

Activity: 378
Merit: 198


View Profile
December 14, 2018, 03:17:59 PM
Merited by DarkStar_ (4), ranochigo (1), ETFbitcoin (1)
 #2

Did you change the coinbase maturity?

You need to wait For each input to be confirmed,

if the referenced output transaction is coinbase (i.e. only 1 input, with hash=0, n=-1), it must have at least COINBASE_MATURITY (100) confirmations before it can be spent.

If you wanted to change your coinbase maturity period it can be found in main.h

Code:
static const int COINBASE_MATURITY = 100;

<3 Bitcoin
ranochigo
Legendary
*
Offline Offline

Activity: 1862
Merit: 1207

Back online:)


View Profile WWW
December 14, 2018, 03:19:38 PM
Merited by ETFbitcoin (1)
 #3

1. I created two peers on same machine and I want to add them both to the block chain(The first one is already up). Is it enough to add address of first node to the config file of second node or I need to add both address to the each other's config file ?
Just one is enough, node connection are bi-directional and both nodes sends and receive information.
2. Should all nodes when created, mine blocks till at least their coinbase maturity?With two nodes on same machine I have to at least generate blocks till their coinbase maturity otherwise I can't spend any amount. It didn't make sense to me. Is it true with bitcoin chain itself ? Cause difficulty there is very high!!!
It's true with most/all coins. Orphan chains happens pretty often and it doesn't make sense for the coinbase maturity to be zero or small; the coins that would've otherwise been spent several times could turn out to be invalid. It would result in a relatively easy double spend (accidential or not). Bitcoin's coinbase maturity is 100 blocks but most mining pools absorbs the risks and rewards their miners at 6 confirmations as orphans that are greater than that rarely happens, if any at all.
3. First thing I do when a node starts up is that I generate a new address for it by
Code:
getnewaddress
command in console.Before typing this command there should be some automatically generated address assigned to the node or account. How can I get it?
There should be a keypool to your wallet. The getnewaddress doesn't generate addresses on the fly but rather it just reveals an address from the keypool each time you use the commands.
4. After mining enough blocks, I try to send some bitcoins to the other node,
Code:
sendtoaddress <address> <amount>
but the coins wont't transfer and stays in memory pool for forever. Since I increased the target and reduced difficulty, this shouldn't happen. I guess my coins get lost or something....
What client are you using? If you're using the original Bitcoin client (or its fork) to mine, you can manually include transactions into the blocks. Check if the mempool of the mining node lists that specific transaction you're trying to include.

chameleon123
Jr. Member
*
Offline Offline

Activity: 48
Merit: 16


View Profile
December 14, 2018, 03:44:53 PM
 #4

Did you change the coinbase maturity?

Yes, I reduced it to ten blocks for fast mining.I mines them within a second now.
chameleon123
Jr. Member
*
Offline Offline

Activity: 48
Merit: 16


View Profile
December 14, 2018, 03:48:30 PM
 #5

Thank you so much for the reply.

What client are you using?
I'm using the original Bitcoin Client but forked the source code. 

If you're using the original Bitcoin client (or its fork) to mine, you can manually include transactions into the blocks. Check if the mempool of the mining node lists that specific transaction you're trying to include.
It lists that specific transaction and highlights it with red. But how should I add it ?
chameleon123
Jr. Member
*
Offline Offline

Activity: 48
Merit: 16


View Profile
December 14, 2018, 03:57:09 PM
 #6

Just two more questions.

1.What exactly is the use of "IsInitialBloackDownlaod()" in mining.cpp. For my chain which is pretty new, If I want to check the block template, the functions returns true and I get
Code:
error -10 : Bitcoin is downloading blocks.
Is it same for

2. What is nMinimumChainWork and how it is calculated initially ?

3. When Bicoin gui starts up, It says I'm 5 weeks behind.I forked bitcoin completely disabled DNS seeds. There's no reason for it. Why I get the message?
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 1974
Merit: 2951


bc1qshxkrpe4arppq89fpzm6c0tpdvx5cfkve2c8kl


View Profile WWW
December 14, 2018, 05:18:16 PM
Merited by ETFbitcoin (1)
 #7

Just two more questions.

1.What exactly is the use of "IsInitialBloackDownlaod()" in mining.cpp. For my chain which is pretty new, If I want to check the block template, the functions returns true and I get
Code:
error -10 : Bitcoin is downloading blocks.
Is it same for
This is to prevent people from mining when they are out of sync. If you mine when out of sync, then you can cause a chain fork.

2. What is nMinimumChainWork and how it is calculated initially ?
ChainWork is the sum of all of the difficulties of all of the blocks in the blockchain. nMinimumChainWork is the chainwork for a specific block and is used during the initial sync as a safety check.

3. When Bicoin gui starts up, It says I'm 5 weeks behind.I forked bitcoin completely disabled DNS seeds. There's no reason for it. Why I get the message?
DNS is completely unrelated to this whatsoever. DNS seeds are used for finding nodes to connect to. It has nothing to do with you being behind.

The message appears because the software thinks you are out of sync. The most recent block is 5 weeks old and the software is expecting there to be more recent blocks. It has no way of knowing that there are not more recent blocks, but it assumes that there is because in Bitcoin, blocks are still being produced when you are offline.

MagicByt3
Full Member
***
Offline Offline

Activity: 378
Merit: 198


View Profile
December 14, 2018, 11:53:15 PM
 #8

Code:
const int nInitialBlockThreshold = 120; // Regard blocks up until N-threshold as "initial download"

What version are you testing with.

In v0.5.1 there is the above line in main.cpp might be helpful.

<3 Bitcoin
chameleon123
Jr. Member
*
Offline Offline

Activity: 48
Merit: 16


View Profile
December 15, 2018, 02:45:56 PM
 #9


What version are you testing with.

In v0.5.1 there is the above line in main.cpp might be helpful.

I'm using 0.16.2. I reduced coinbase maturity to 10 blocks for testing.
chameleon123
Jr. Member
*
Offline Offline

Activity: 48
Merit: 16


View Profile
December 15, 2018, 02:49:02 PM
 #10

Just two more questions.

1.What exactly is the use of "IsInitialBloackDownlaod()" in mining.cpp. For my chain which is pretty new, If I want to check the block template, the functions returns true and I get
Code:
error -10 : Bitcoin is downloading blocks.
Is it same for
This is to prevent people from mining when they are out of sync. If you mine when out of sync, then you can cause a chain fork.

2. What is nMinimumChainWork and how it is calculated initially ?
ChainWork is the sum of all of the difficulties of all of the blocks in the blockchain. nMinimumChainWork is the chainwork for a specific block and is used during the initial sync as a safety check.

3. When Bicoin gui starts up, It says I'm 5 weeks behind.I forked bitcoin completely disabled DNS seeds. There's no reason for it. Why I get the message?
DNS is completely unrelated to this whatsoever. DNS seeds are used for finding nodes to connect to. It has nothing to do with you being behind.

The message appears because the software thinks you are out of sync. The most recent block is 5 weeks old and the software is expecting there to be more recent blocks. It has no way of knowing that there are not more recent blocks, but it assumes that there is because in Bitcoin, blocks are still being produced when you are offline.

Thanks a lot. It was very helpful. Do you know why transactions between nodes get stuck in memory pool? It's like they are never sent to receiver.
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 1974
Merit: 2951


bc1qshxkrpe4arppq89fpzm6c0tpdvx5cfkve2c8kl


View Profile WWW
December 15, 2018, 04:43:38 PM
 #11

Thanks a lot. It was very helpful. Do you know why transactions between nodes get stuck in memory pool? It's like they are never sent to receiver.
Stuck in what way? Is the transaction in the mempool but not being mined? Or is it in one node's mempool but not the other's?

chameleon123
Jr. Member
*
Offline Offline

Activity: 48
Merit: 16


View Profile
December 17, 2018, 02:29:54 PM
 #12

Stuck in what way? Is the transaction in the mempool but not being mined? Or is it in one node's mempool but not the other's?

I solved it somehow Smiley . The only problem that I have now is that imagine I have only two peers on my machine and I send several bitcoins to the other in two separate transactions. but the I mine them manually. Only the last one gets confirmed and the other one remains in mempool, even If I mine several blocks, It would be still in mempool. Why is that happening ?

Sencondly, fallbackfee  estimation is not working for my chain, I have to set it manually. What could be the reason?

Link to my repository : https://github.com/chameleon1239/bitcoin.git

Thanks a lot
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!