Bitcoin Forum

Other => Beginners & Help => Topic started by: serag on March 16, 2017, 04:27:51 PM



Title: how to develop a program to solve bitcoin
Post by: serag on March 16, 2017, 04:27:51 PM
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


Title: Re: how to devolope program to solve bitcoin
Post by: Igor Tatarov on March 16, 2017, 04:33:05 PM
Please watch this video:

https://www.youtube.com/watch?v=_160oMzblY8


Title: Re: how to develop a program to solve bitcoin
Post by: Quartx on March 17, 2017, 09:58:52 AM
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/


Title: Re: how to develop a program to solve bitcoin
Post by: Benchich on March 17, 2017, 01:29:02 PM
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.


Title: Re: how to develop a program to solve bitcoin
Post by: misterbigg on March 17, 2017, 03:11:30 PM
Simple program to "solve" bitcoin:
Code:
extern bool activateSegwit;
extern void runNode();

int main()
{
    activateSegwit = true;
    runNode();
}


Title: Re: how to develop a program to solve bitcoin
Post by: DannyHamilton on March 17, 2017, 04:23:32 PM
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 (https://en.wikipedia.org/wiki/SHA-2) 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.



Title: Re: how to develop a program to solve bitcoin
Post by: serag on March 19, 2017, 05:32:28 PM
thanks a lot every body
thanks DannyHamilton, misterbigg, Benchich, Quartx and Igor Tatarov