How to use Bitcoin Core’s submitblock method

I’m trying to understand how mining works. For learning purpose I’m using Bitcoin Core as solo mining pool. Getblocktemplate will return data that is enough to start mining witch is simple founding correct nonce. But what is next step?

I found in bitcoin core method submitblock that have one argument / block data. I didn’t found any example how that data should be build. Please give me some advice.

How to check Bitcoin wallet balance without any API

I am building an application and that will involve large set of bitcoin wallets and need to keep on checking for balance. I don’t want to use any third party APIs as they all have hourly/secondly limits.

Is there any way I can check bitcoin wallets balance without any API? I am not sure is Bitcoin Demon and Bitcoin Core is for this purpose. Can anyone please suggest me the best way to verify bitcoin balances and transactions without any limits.

Generating Bitcoin Public and Private Keys

I managed to write the below code which will create public and private keys

Private Key

$input = "satoshinakamoto";
$sha256 = hash("sha256", ($input));
echo "<strong>Private Key: </strong>".$sha256."<br/>";

Public Key

    $step1 = hexStringToByteString("0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6");
    echo "<p><strong>Step 1:</strong> ".$step1."</p>";
    $step2 = hash("sha256", $step1);
    echo "<p><strong>Step 2: </strong>".$step2."</p>";
    $step3 = hash('ripemd160', hexStringToByteString($step2));
    echo "<p><strong>Step 3: </strong>".$step3."</p>";
    $step4 = '00'.$step3;
    echo "<p><strong>Step 4: </strong>".$step4."</p>";
    $step5 = hash("sha256", hexStringToByteString($step4));
    echo "<p><strong>Step 5: </strong>".$step5."</p>";
    $step6 = hash("sha256",hexStringToByteString($step5));
    echo "<p><strong>Step 6: </strong>".$step6."</p>";
    $step7 = substr($step6,0,8);
    echo "<p><strong>Step 7: </strong>".$step7."</p>";
    $step8 = $step4.$step7;
    echo "<p><strong>Step 8: </strong>".$step8."</p>";
    $step9 = bc_hexdec($step8);
    echo "<p><strong>Step 9: </strong>".$step9."</p>";
    $step10 = bc_base58_encode($step9);
    echo "<p><strong>Step 10: </strong>1".$step10."</p>";
    return $step10;

To generate public key I took reference from https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses

In that link they provided Step by Step process and I followed the same and if
I input from Step 1 in the link then I am able to convert the code to public key but I am not sure how to convert Step 0 to Step 1

i.e.

From:

18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725

To

0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6

Document says

Take the corresponding public key generated with it (65 bytes, 1 byte 0x04, 32 bytes corresponding to X coordinate, 32 bytes corresponding to Y coordinate)

What does that mean? How can I generate this value from Private Key.

Edit 1

This question says https://stackoverflow.com/questions/17672696/generating-bitcoin-address-from-ecdsa-public-key

Joining the Elliptic Public Key and I still don’t understand what are they.

Why does the “global lottery” prove the validity of the blockchain?

As far as I understand it currently, when winning the “lottery” (mining) you can add a block, sum of transactions, to the blockchain. This block is in the first instance verified by all network users.

BUT can`t a lottery winner also add a fraudulent block to the chain?

What does this lottery contribute to the validity of the chain?

Or in other words: How are miners approving a bitcoin transaction, besides adding it to the blockchain when they win? Potentially, they could also add a lot of “sh**” to the blockchain.

Has the bitcoin network ever been “down”?

I’d be interested to know if the bitcoin network has ever been down. By “down” I mean that a client would not be able to synchronize with the network to obtain data like the txs in the mempool or recently mined blocks.

My guess would be that this would be extremely rare due to the decentralized architecture, but it’d be great to know for sure. If there have been downtimes, I’d be interested to know how frequent these have been and how long they have persisted.

Why do nodes trust other nodes to approve their transactions?

I know that the blockchain technology works so well, because everybody has basically a copy of the last ledger.

Therefore, if a transaction happens, everybody inside the network has to "approve" the transaction to do it.

These other participants are then seen as trusted sources.

However, what makes them into trusted sources? Let’s say there are only three participants, two make a transaction and one has to decide if the transaction is acceptable or not (does the clearing). What makes him a trusted source?

Are these thoughts right or where am I wrong?

I appreciate your replies!

did Satoshi anticipate large pools?

Is there any statement about the design of Bitcoin alluding to dealing with large pools controlling a good part of the network? while it is true that pools can compete and people can “vote” by switching pools, the statements handed down regarding major decisions affecting the Bitcoin system seem eerily central and authoritative. was this kind of power considered initially and is thus balanced now, or was Bitcoin intended to be strictly p2p initially?

Blockchain Receive API – custom Parameters

I am trying to get variables back from the callback URL, but I can’t figure out how to add custom parameters correctly. This is how I have them written right now:

$newAddy = json_decode(file_get_contents("https://blockchain.info/merchant/$ID/new_address?password=$PW&funding_id=$funding_id"),true);
$parseAddy = $newAddy[address];

$funding_id is the extra one that I want to add. Any suggestions?

How does one checks which customer made a payment?

One question I’m not able to properly answer when asked is

How exactly the blockchain can verify the identity of the user without a centralized trusted party such as VeriSign?

I know this is done in a decentralized way and the ECDSA algorithm should do the trick, but other applications still need a centralized trusted party in order to verify if the user is really who he says he is even when they’re using ECDSA as well.

But how exactly can I guarantee that nobody can pretend to be someone else and spend their bitcoin instead?

Yes, I know the basic of how public-key cryptography works, but Information Security is not strong with me.


Edit: let me explore the question further.

Suppose I own a coffee house with intense flow of customers. How can I be sure about costumers that had already paid and others how didn’t pay?

Let’s say that Bob and Anna are my customers. Bob orders a Macchiato, Anna orders a Capuccino. Both coffees have the same prize. How can I know which payment came from each one of them?