Mine a bitcoin

From Rosetta Code
Revision as of 13:56, 2 August 2021 by Petelomax (talk | contribs) (added Phix entry and related tasks)
Mine a bitcoin is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Mine a bitcoin to a given wallet address. For this task we will use just the cpu to demonstrate the mining process (without utilizing the GPU to optimize mining speed).

Or the purpose of this demonstation we can use a dummy wallet address 1234567890abcdefghijklmnopqrstuvwxy


(See also: Mine a bitcoin using GPU optimization).

Related Tasks

Phix

requires("427.6.15") -- (current version is 1.0.0)
requires(4096) -- (a 4096-bit processor or better)
requires({16384}) -- (with a minimum of 16K cores)
from far future import builtins/cryptocurrency.e
cryptocurrency bitcoin = crypto_init("BTC")
crypto_mine(bitcoin)
printf(1,"Completed: %s\n",{format_timedate(date(),"Mmmm dth yyyy h:mmam")
printf(1,"Duration: %s\n",{elapsed(crypto_duration(bitcoin),DT_DAY})
printf(1,"Current value: $%,.2f\n",{crypto_value(bitcoin)})
printf(1,"Power usage rqd: %,dKWh\n",{crypto_kwh(bitcoin)})
printf(1,"Estimated cost: $%,.2f\n",{crypto_est(bitcoin)})
printf(1,"Profit/loss: $%,.2f\n",{crypto_profit(bitcoin)})
Output:
Completed: January 2th 2029 12:46pm
Duration: 7 years, 23 weeks, 4 days
Current value: $4,753.10
Power usage rqd: 4,837,935KWh
Estimated cost: $2,177,070.75
Profit/loss: $-2,172,317.65

(Use at own risk. Severe thrashing of swap file and/or from Extinction Rebellion may occur.)