Bitcoin Forum
December 12, 2024, 05:24:42 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How are bitcoin blocks verified?  (Read 198 times)
Anonymous Kid (OP)
Member
**
Offline Offline

Activity: 183
Merit: 25


View Profile
October 28, 2018, 06:10:10 PM
 #1

I see in the bitcoin wiki there is something called "script" which compiles down to some bytecode to be run by a very very basic virtual machine.
Does this mean that each block is actually just a string/array of bytes when it comes in and is processed by a node?
so a block in its "true" format would look something like [0x01, 0x04, 0x0f, 0xa1.... etc. ?

and then the node that recieves the block just puts the bytes into the interpreter to be run by the bitcoin VM?
or is there some plaintext involved in the block as well? so it looks something like JSON;
{
   blockhash: 12983092....,
   transactions: [ {8123098...}, {12381923...}],
   timestamp: "08:00:23 12/09/2017"
}

which is correct? a block is pure bytecode or JSON? what would a bitcoincore node understand when receiving a new block?
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3570
Merit: 6927


Just writing some code


View Profile WWW
October 29, 2018, 04:01:13 AM
Merited by ABCbits (1), Anonymous Kid (1)
 #2

By definition, everything in a computer is a string of bytes, even text  Grin



All kidding aside, a block has a serialized byte format. It is not transmitted over the network in JSON. The JSON output that you get from Bitcoin Core is merely something that is human readable. That is not actually how blocks are transmitted over the network.

The block format is just bytes with bytes at certain positions having specific meanings, as defined by the format. You can see the hexadecimal representation of these bytes if you call getblock with verbosity level 0 (i.e. getblock <hash> 0).

A block is not a script. Scripts are part of transactions and are in a specific field for scripts only.

pebwindkraft
Sr. Member
****
Offline Offline

Activity: 257
Merit: 343


View Profile
October 29, 2018, 08:21:15 AM
 #3

Same request and further details here:

https://bitcoin.stackexchange.com/questions/80487/how-are-blocks-verified
Anonymous Kid (OP)
Member
**
Offline Offline

Activity: 183
Merit: 25


View Profile
October 29, 2018, 09:45:06 AM
 #4

Thanks for asking the question there haha. i probably should have gone there first.
Achow explained pretty much what is was looking for anyway Smiley
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!