Bitcoin Forum
July 08, 2024, 10:10:06 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin Core: Scripting queries thread  (Read 67 times)
BlackHatCoiner (OP)
Legendary
*
Offline Offline

Activity: 1568
Merit: 7697


Protocols over bureaucrats


View Profile
October 21, 2020, 08:30:43 PM
Merited by Heisenberg_Hunter (1)
 #1

I'm creating this topic because I would rather gathering my queries at once, instead of multiposting. The purpose of the thread is on making questions (mostly mine) about the way bitcoin core is written. Scripts, variables etc included.

1) On validation.cpp#L144, there is a variable called nMaxTipAge. Why does it exist? As far as I've understood it has to do with the genesis block. If I create an altcoin using satoshi's genesis block, the nMaxTipAge won't be recent enough so it won't let me mine. Am I getting it right?

2) On chainparams.cpp#L102, there is some kind of array (?).
Code:
pchMessageStart[0] = 0xf9;
pchMessageStart[1] = 0xbe;
pchMessageStart[2] = 0xb4;
pchMessageStart[3] = 0xd9;

What is its purpose? Do they have to do with sharing the longest chain of blocks? On this guide of how to create an altcoin it says that I'll have to change them, otherwise I may download the original bitcoin's blocks instead of my altcoin's. How is that possible? They're just 4 hex values.

3) I realized that except MainNet, TestNet3 and RegTest, there is an additional network called Signet. What does it do? According to our wiki, it is a centralized network (?) that helps developers to do their tests. Still don't get why they can't on regtest.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
pooya87
Legendary
*
Offline Offline

Activity: 3500
Merit: 10703



View Profile
October 22, 2020, 05:12:20 AM
Merited by Heisenberg_Hunter (1)
 #2

1) i believe it is used to tell your client that it is out of sync (the tip is 24 hours ahead) so in order to sync it switches to a different method by downloading all the block headers it is missing then downloading each block

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).

3) https://bitcoin.stackexchange.com/questions/89640/what-are-the-key-differences-between-regtest-and-the-proposed-signet

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
Pages: [1]
  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!