Bitcoin Forum
May 22, 2024, 01:38:45 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: how to develop a program to solve bitcoin  (Read 1009 times)
serag (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
March 16, 2017, 04:27:51 PM
 #1

i am kind new in this business and i would like to know what is the inputs the SW take and what it should return as outputs

my conclusion of what i read and might i got some wrong info

inputs is the previous blockchain

then some mathematical formulas

out put a new block

what i need to know what is the right inputs and what is the mathematical formulas

thanks and i really will appreciate your help
Igor Tatarov
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
March 16, 2017, 04:33:05 PM
 #2

Please watch this video:

https://www.youtube.com/watch?v=_160oMzblY8
Quartx
Hero Member
*****
Offline Offline

Activity: 1036
Merit: 504


Becoming legend, but I took merit to the knee :(


View Profile WWW
March 17, 2017, 09:58:52 AM
 #3

It is not hard to find resources on the math behind bitcoin. Do you really know how bitcoin works in general? The cryptography it uses, the pros and the cons on what makes it a good p2p system + currency?

https://bitcoin.org/bitcoin.pdf
http://www.coindesk.com/math-behind-bitcoin/

Benchich
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile
March 17, 2017, 01:29:02 PM
 #4

I can say that the block chain provides Bitcoin’s public ledger, an ordered and timestamped record of transactions. This system is used to protect against double spending and modification of previous transaction records.

Each full node in the Bitcoin network independently stores a block chain containing only blocks validated by that node.
misterbigg
Legendary
*
Offline Offline

Activity: 1064
Merit: 1001



View Profile
March 17, 2017, 03:11:30 PM
 #5

Simple program to "solve" bitcoin:
Code:
extern bool activateSegwit;
extern void runNode();

int main()
{
    activateSegwit = true;
    runNode();
}
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4653



View Profile
March 17, 2017, 04:23:32 PM
 #6

inputs is the previous blockchain

This is incorrect.

The input is the block header of the new block.

You build a block header with the following 80 bytes of information:
  • (4 bytes) version number
  • (32 bytes) Double sha256 hash of the most recent block in your blockchain
  • (32 bytes) Merkle root of transaction list
  • (4 bytes) timestamp
  • (4 bytes) encoded current difficulty
  • (4 bytes) nonce

The Merkle root is calculated by choosing the transactions that you want to include in your block, arranging them in the order you want them and then generating a Merkle tree using the SHA256 hash function.

The nonce is simply incremented after each calculation until one of the following has occurred:
  • You've tried all possible nonce values, and you now need to either update your timestamp or generate a new Merkle Root
  • You've received a valid block from a peer, and you now need to start the process over with a new double sha256 hash of the most recent block in your blockchain
  • You find a valid solution, and you now need to broadcast it to your peers and start the process over with a new double sha256 hash of the most recent block in your blockchain

then some mathematical formulas

Specifically a SHA256 hash of the header, followed by a SHA256 hash of that result (often called a double SHA256 hash).
https://en.wikipedia.org/wiki/SHA-2

out put a new block

Specifically, broadcast the block to all the peer that are connected to you.

serag (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
March 19, 2017, 05:32:28 PM
 #7

thanks a lot every body
thanks DannyHamilton, misterbigg, Benchich, Quartx and Igor Tatarov
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!