0

The concept of bitcoin mining (hash functions & the goal) are well elaborated on many sites. There are also lots of examples.

However, when going into real production I guess you need data like the latest hash, info about the block and transactions and so forth.

In addition, once you make your guess, you have to submit the work somewhere.

I can however not find any resources that explain where to do this? Is there an API to which you submit your work, to which you attach also your bitcoin address of your wallet, and once you make the right guess the btc is transferred to this account?

What are the bitcoin endpoints in my case?

1 Answer 1

1

when going into real production I guess you need data like the latest hash, info about the block and transactions and so forth.

If you're using a mining pool, you would use Stratum to subscribe to a mining pool's job notifications and their notifications would include this information. If you're using bitcoind to mine on your own, you'd use getblocktemplate. Additionally, you can build the template yourself.

Is there an API to which you submit your work

If you're trying to submit a block to the Bitcoin network itself, there is the submitblock bitcoind RPC call that will allow you to submit a full block. If you're trying to submit shares to a mining pool, you'd probably use the mining.submit Stratum RPC call.

to which you attach also your bitcoin address of your wallet, and once you make the right guess the btc is transferred to this account?

If you're using a mining pool, you specify this information at the mining pool's website. The block work they give you will be paying to their address, so it's irrelevant.

If you're mining yourself, you'd specify this by including a "coinbase" transaction at the beginning of the block that pays an address you specify the appropriate block reward and transaction fees.

4
  • Thank you for the explanation. I still don’t understand to which address I have to connect? What are the configuration details?
    – WJA
    Commented Feb 20, 2021 at 16:46
  • @JohnAndrews If you're mining on a pool, then the pool will provide you with their Stratum URL and allow you to configure your worker credentials. If you're mining directly on the Bitcoin network, you would be running a regular Bitcoin node just like anyone else and broadcasting your blocks that way.
    – ieatpizza
    Commented Feb 21, 2021 at 1:55
  • What I dont like with the pools is that it seems that its not possible to configure your own methodology. Basically what U am looking for is: 1) give me the inputs for guessing, 2. I do my own guessing, 3 I submit the work. But for that I have to run a full node with all the historical transactions downloaded?
    – WJA
    Commented Feb 21, 2021 at 9:23
  • 1
    @JohnAndrews Unless you're doing it only to learn how mining works (and understanding that you will not actually make any money), it's completely pointless to mine on your own because you will literally never earn a single penny. If you want to generate a valid block template (for educational purposes) though, I believe all you need is a reliable source of the latest mined block, the current full UTXO set, and the mempool. You'd need to validate the latest block and include its hash, then you'd need to validate the unconfirmed transactions you're including in your block against the UTXO set.
    – ieatpizza
    Commented Feb 21, 2021 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.