Cov txheej txheem:

ESP8266 Bitcoin Miner: 3 Kauj Ruam
ESP8266 Bitcoin Miner: 3 Kauj Ruam

Video: ESP8266 Bitcoin Miner: 3 Kauj Ruam

Video: ESP8266 Bitcoin Miner: 3 Kauj Ruam
Video: This is the largest USB Bitcoin Mining Setup in the world! |#Shorts | How Much? 2024, Hlis ntuj nqeg
Anonim
ESP8266 Bitcoin Miner
ESP8266 Bitcoin Miner

Nrog tus nqi ntawm Bitcoin txuas ntxiv nce thiab nrog ob peb ESP8266 ib txwm txuas rau hauv tab sis tsis tshua ua ntau kuv xav tias vim li cas tsis sim thiab siv Solo Bitcoin Miner. Tom qab me ntsis ntawm kev sim kuv tau txais ESP8266 txog ~ 1200 hashes/sec thiab raws li lub Kaum Ob Hlis 2017 Bitcoin network tau ua tiav ib puag ncig 12, 000, 000 tera hashes ib ob (koj tuaj yeem tshawb xyuas blockchaininfo rau tus lej tshiab kawg).

Yog li los ntawm cov lej peb yuav muaj 1 hauv 1e16 txoj hauv kev kom ua tiav qhov thaiv txhua kaum feeb uas qhov thaiv tam sim no muaj nqis txog $ 212, 000. Tseeb nws zoo li kev yuav daim pib lotto, tsuas yog nrog ntau qhov me me ntawm txoj kev yeej, tab sis koj paub cov lus qub, ib tus neeg yuav tsum yeej nws. Nrog ob lub Rooj Sib Tham Mate thiab Super Squirter ESP8266 cov haujlwm feem ntau lawv tsis ua haujlwm, lawv tsuas yog ntsaws rau hauv thiab tos ntawm kev thov lossis cov tswv yim, yog li vim li cas ho tsis tso lawv rau nws thiab tej zaum yeej qee qhov txiaj ntsig. Thawj kauj ruam yog sim thiab xam tawm yog tias nws tseem tuaj yeem ua ob zaug SHA256 ntawm Blockheader ntawm ESP8266. Hauv ntiaj teb Bitcoin lub 'hash' yog qhov tseeb ob npaug SHA256, tab sis peb tsuas yog hais txog nws li hash. Txawm li cas los xij tom qab me ntsis ntawm googling ncig kuv pom ob nplooj ntawv no uas muab tag nrho cov ntaub ntawv xav tau kom tau txais hashing.

1. Thaiv Hashing Algorithm

2. Bitcoin Mining txoj kev nyuaj: cov txheej txheem, txheej txheem thiab bytes

Nws tsim nyog sau cia tias cov txheej txheem ua haujlwm, raws li cov ncauj lus ntxaws hauv cov kab ntawv saum toj no, tau raug txiav tawm. Nws tau hloov pauv nrog getblocktemplate raws tu qauv uas ua rau nws nyuaj me ntsis los tsim lub block header, tshwj xeeb koj yuav tsum tsim koj tus kheej lub hauv paus merkle. Rau txhua qhov nitty gritty kos tawm getblocktemplate wiki.

Kauj Ruam 1: Algorithm

Lub Algorithm
Lub Algorithm

Cia peb dhia mus rau hauv, tus lej ESP8266 nyob ntawm ESP8266BitcoinMiner GitHub repo. Kuv yuav tsis rov ua dua txhua cov ntaub ntawv los ntawm cov kab ntawv saum toj no tab sis tsuas yog hais txog lub ntsiab lus tseem ceeb.

char header_hex = 0100000081cd02ab7e569e8bcd9317e2fe99f2de44d49ab2b8851ba4a308000000000000e320b6c2fffc8d750423db8b1eb942ae710e951ed797f7affc8892b0f1f7b2b142b7b2b7b2b7b2b7b1b7b2b7b2b7b2b7b2b7b2b7b2b7b2b7b2b7b2b7b2b7b1b2b7b1b2b7b2b7b2b14:

char header_hex yog lub block header thiab tau tsim los ntawm rau lub teb, Version, hashPrevBlock, hashMerkleRoot, Sijhawm, Khoom thiab Nonce txhua qhov sib txuas ua ke raws li qhov muaj nuj nqis me me hauv hex notation. Qhov ntawd tsuas yog theej los ntawm qhov txuas saum toj no tab sis nyob rau hauv qhov tseeb tag nrho cov miner koj yuav tau txais txhua qhov ntawm cov haujlwm hauv json yam khoom thiab tom qab ntawd yuav tsum txheeb xyuas qhov kawg thiab muab tso ua ke ntawm ya txhua 10 feeb.

uint8_t *hex_decode (const char *in, size_t len, uint8_t *tawm) {

unsigned int kuv, mg, ng, rg; rau (mg = 0, i = 0; i '9'? in - 'a' + 10: in - '0'; rg = in [i + 1]> '9'? in [i+1] - 'a'+10: in [i+1] - '0'; out [mg] = (ng << 4) | rg;} rov qab tawm;}

hex_decode siv kab ntawv header_hex, uas muaj cov lej hexadecimal ascii, thiab ua rau cov neeg siv uint8_t hashbytes [80] nrog lawv cov byte qhov tseem ceeb npaj rau SHA256 hasher.

void hash () {

hex_decode (header_hex, strlen (header_hex), hashbytes); unsigned ntev pib = micros (); hasher.doUpdate (hashbytes, sizeof (hashbytes)); byte hash [SHA256_SIZE]; hasher.doFinal (hash); hashagain.doUpdate (hash, sizeof (hash)); byte hash2 [SHA256_SIZE]; hashagain.doFinal (hash2); unsigned ntev xaus = micros (); unsigned ntev delta = xaus - pib; Serial.println (delta); Serial.print ("Loj Endian:"); rau (byte i = 32; i> 0; i-) {if (hash2 [i-1] <0x10) {Serial.print ('0'); } Serial.print (hash2 [i-1], HEX); } Serial.println (); Serial.print ("Me Endian:"); rau (byte i = 0; i <SHA256_SIZE; i ++) {if (hash2 <0x10) {Serial.print ('0'); } Serial.print (hash2 , HEX); }}

hash yooj yim hashbytes ob zaug (ob npaug SHA256), luam tawm cov kev siv nws tau siv thiab luam tawm qhov tshwm sim hash ua qhov loj kawg thiab qhov kawg me me. Yog tias cov hashes tau zes nyob hauv ib qho SHA256 hasher nws yuav yog qhov nrawm dua me ntsis tab sis txawm li cas los xij nrog cov cai saum toj no nws yuav siv 832 siv lub sijhawm los ua ob qhov hash thiab koj tsis pom los ntawm lub screenshot peb tau txais qhov hash raug.

Kauj Ruam 2: Ntaus Phab Ntsa thiab Thaiv Loj Loj

Ntaus Lub Phab Ntsa thiab Thaiv Loj tiag tiag
Ntaus Lub Phab Ntsa thiab Thaiv Loj tiag tiag

Yog li yog nws siv 832 siv cov sijhawm los ua ib qho hash peb tuaj yeem ua 1 /0.000834 = 1201 hashes /sec.

Tsuas yog kom pom tseeb peb tau txais cov ntaub ntawv los ntawm thaiv #125552 qhov uas peb paub qhov tsis yog, nws twb tau raug rho tawm thiab siv cov ntaub ntawv ntawd los ua rooj plaub sim kom paub tseeb tias peb tuaj yeem tau txais tib lub hash nrog ESP8266. Yog li ib zaug tau txais txiaj ntsig nrog kev ua kom tiav cov miner koj yuav ua qhov kev xam pom ntawm qhov tsis yog, hash lub blockheader nrog nws thiab tom qab ntawd sib piv qhov tshwm sim rau qhov nyuaj rau qhov thaiv. Yog tias qhov hash ua tau raws li qhov nyuaj, tom qab ntawd nws yuav xa mus rau lub network kom paub tseeb.

Ua li ntawd yog qhov zoo peb tuaj yeem ua tus hash, paub tseeb tias tus nqi txaus ntshai tab sis thaum saib nws raws li kev rho npe twv yog qhov twv. Nov yog qhov tab sis, thaum kev tshuaj xyuas ze dua nws yuav sai sai koj yuav tsum tau ua ib lub node kom muaj peev xwm sib txuas lus nrog lub network, yam pom tseeb thaum koj tso tseg thiab xav txog qhov kev khawb av yog dab tsi tiag.

Yog li yog tias koj saib daim duab koj tuaj yeem pom tias bitcoin daemon uas yog ib feem ntawm cov tub ntxhais bitcoin saib xyuas kev sib txuas lus ntawm lub network thiab cov miner. Qhov no txhais tau li cas tiag yog koj yuav tsum tau khiav lub Bitcoin core ntawm tus neeg rau zaub mov kom ESP8266 tuaj yeem tau txais blockheader tshiab txhua 10 feeb thiab tom qab ntawd tuaj yeem xa rov qab mus rau lub network.

Kuv tsis tau sim nws tab sis nws zoo li koj yuav tsum tau ua tiav tag nrho blockchain ntawm ib ncig 130 Gigs ua ntej nws yuav sib txuas lus zoo nrog network, hauv wiki lawv hais txog qee cov kauj ruam yuav tsum ua kom tiav ua ntej txhua qhov ua haujlwm muaj, yog li zoo nkauj yog lawv txhais li cas.

Yog li ntawd rub kuv mus rau ntawd, los ntawm kev tshawb fawb pom nws yog txhua yam nthuav heev thiab nws zoo nkauj heev kom pom me ntsis ESP8266 ua tiav hash qhov teeb meem kev sim tab sis siv tau hais lus Kuv tsis pom ntau tus neeg rub tawm cov tub ntxhais, sib koom ua ke tag nrho blockchain, khaws txhua yam ua ntu zus, khaws cov teeb meem kev nyab xeeb tag nrho rau 1 hauv 1e16 txoj hauv kev yeej qhov thaiv. Tus choj mus deb rau kuv.

Los ntawm kev mus kuv paub tus hash tus nqi yuav txaus ntshai tab sis xav paub tau txais zoo dua ntawm kuv thiab kuv yuav tsum tau muab nws mus. Ntau dua li kev khawb av ib leeg tej zaum yuav muaj pas dej ua ke nyob rau ntawd uas tuaj yeem txuas nrog ncaj qha los ntawm ESP8266 yam tsis muaj kev siv zog loj lossis tej zaum yuav muaj lwm qhov cryptocurrency uas haum dua. Yog tias koj pom ib qho thov qhia rau kuv paub.

Kauj Ruam 3: Cov neeg ua tim khawv

1. ESP8266 Bitcoin Miner GitHub Repository

2. ESP8266 Crypto GitHub Repository

3. Bitcoin mining txoj hauv kev nyuaj: cov txheej txheem, txheej txheem, thiab bytes

4. Thaiv Hashing Algorithm

5. Thaiv 125552

Pom zoo: