Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Altoidnerd on January 24, 2014, 12:51:12 AM



Title: Mathematica Base58encode function
Post by: Altoidnerd on January 24, 2014, 12:51:12 AM
I want wolfram to start including packaged functions for bitcoin.  Here is one that tries to take a large int as an argument and encodes the bitcoin base58 symbol chart, but I'd like someone to check this works

Code:
base58encode[v_] := 
 StringJoin[
  IntegerDigits[v, 58] /. ((*the rest encodes the symbol chart*)
    Table[i -> ToString[i + 1], {i, 0, 8}]~Join~
     Table[i ->
       DeleteCases[CharacterRange["A", "Z"],
         x_ /; x == "I" || x == "O"][[i - 8]], {i, 9, 32}]~Join~
     Table[i ->
       DeleteCases[CharacterRange["a", "z"], "l"][[i - 32]], {i, 33,
       57}])]

Here is an example of the function executing

Code:
In[11]:= base58encode[2^210-8676823059+9832745091327059]

Out[11]= YMeFyt4YTd4bsX4GLEupDjyGbF2oLbW1LCGw

Sanity check: does it work?  What else can we make so that raspberry pi + wolfram people can use bitcoin?

If this works properly, I'll write tools to go from the keys to addresses, etc.


Title: Re: Mathematica Base58encode function
Post by: Altoidnerd on January 24, 2014, 03:22:01 AM
Its based on this https://en.bitcoin.it/wiki/Base58Check_encoding#Base58_symbol_chart


Title: Re: Mathematica Base58encode function
Post by: Altoidnerd on January 24, 2014, 02:08:16 PM
Wolfram, the maniacal thing he is..he's pushing his language relentlessly. It's on r pi prepackaged.  It's not too bad an idea to get a library going.  

I just hope I understand the Base58check correctly...then I won't be so durn shy 'bout it.