In late 2012 I bought 600 BTC. I bought it because I thought in a sense I was donating to a cause, not for an investment. It went to $ 950. At one point my $ 4000 was worth half a million, which was almost 10× my portfolio. I sold 5 Bitcoin and spent a bit for some weed on the silk road (I was 20, please forgive me. Besides, back then, other than an eBay type website that you could buy gift cards from, you couldnt get much with bitcoin. Anybody remember the famous pizza?) Than bitcoin tumbled to $ 300. I invested in Doge with some of it, lost a lot there. I had over 5mil doge coin lost in a reddit tip wallet. I took my family on vacation through expedia after i had each of my kids, now 3. And once with my mom, so she could take the grand kids to disney world (she always wanted to take me and my sisters but single parent life sucks) After all the investments I should not have made, and the fun I do not regret having, I am a proud owner of 1.5 BTC. The reason I made this post is so people can see the ups and downs of Bitcoin. Please understand, everything is about price now, but at one point it wasn't. It was the dread pirate Roberts sticking it to the man, it was people using bitcoin as a way to protest our government bailing out banks and letting us middle class and lower suffer. Trust me when I say a 50% change in bitcoin is not strange. I personally hope it shakes the greedy people off and liberates us like it was designed to do. A world wide currency, untouchable by our greedy governments. If I want to send money to a young man in Taiwan because I believe in his invention, I should be able to. Just as I once sent money to a magic card trading website in exchange for magic internet money because I believed in the cause.
Edit: fat fingers, cell phone post.
Tl;dr: Bitcoin is not just about investing, it is about protesting the monetary system you have been forced to use.
I wanted to convert the following bitcoin mining python code to VB.net (2012) and I tried to convert it’s functionality, but it throws some errors and I’m stuck as I even can’t get the resulting value of
and the final hash result should be
0000000000000000e067a478024addfecdc93628978aa52d91fabd4292982a50, but I’m no where near that.
why this produces errors, converting from hex to byte is not the correct method?
L is used to format it to
long right?, so what does the
<LLL in the python code do? and is this
::-1 used to prevent overflow when reading the hex string?
exp = bits >> 24 what does it do, bitwise operations?
import hashlib, struct ver = 2 prev_block = "000000000000000117c80378b8da0e33559b5997f2ad55e2f7d18ec1975b9717" mrkl_root = "871714dcbae6c8193a2bb9b2a69fe1c0440399f38d94b3a0f1b447275a29978a" time_ = 0x53058b35 # 2014-02-20 04:57:25 bits = 0x19015f53 # https://en.bitcoin.it/wiki/Difficulty exp = bits >> 24 mant = bits & 0xffffff target_hexstr = '%064x' % (mant * (1<<(8*(exp - 3)))) target_str = target_hexstr.decode('hex') nonce = 0 while nonce < 0x100000000: header = ( struct.pack("<L", ver) + prev_block.decode('hex')[::-1] + mrkl_root.decode('hex')[::-1] + struct.pack("<LLL", time_, bits, nonce)) hash = hashlib.sha256(hashlib.sha256(header).digest()).digest() print nonce, hash[::-1].encode('hex') if hash[::-1] < target_str: print 'success' break nonce += 1
The VB.NET code I’ve been coding up until now is,
Public Class Form1 Dim version As Long = 0 Dim time As Integer Dim pblock As Byte Dim mklroot As Byte Dim header As String Dim nonce As Integer = 856192328 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Textbox1.Text = "2" Textbox2.Text = "000000000000000117c80378b8da0e33559b5997f2ad55e2f7d18ec1975b9717" Textbox3.Text = "871714dcbae6c8193a2bb9b2a69fe1c0440399f38d94b3a0f1b447275a29978a" Textbox4.Text = "0x53058b35" '2014-02-20 04:57:25 Textbox5.Text = "0x19015f53" Dim n As Int32 = T2.Text.Length - 1 version = CLng(Textbox1.Text) 'pblock = CByte(Textbox2.Text) pblock = Convert.ToByte(Convert.ToInt32(Textbox2.Text, 16)) mklroot = Convert.ToByte(Convert.ToInt32(Textbox3.Text, 16)) time = CInt(Textbox4.Text) header = version & pblock & mklroot & time & nonce Textbox6.Text = header End Sub End Class