Skip to content

Instantly share code, notes, and snippets.

@jprupp
Created January 8, 2021 17:44
Show Gist options
  • Save jprupp/09b7a125af17d658bab6b36a4792b6d1 to your computer and use it in GitHub Desktop.
Save jprupp/09b7a125af17d658bab6b36a4792b6d1 to your computer and use it in GitHub Desktop.
Minikey to WIF converter
#!/usr/bin/env stack
{- stack
--resolver lts-16.28
--nix
--nix-packages "secp256k1 pkg-config zlib"
script
--package haskoin-core
--package bytestring
--package text
--extra-dep haskoin-core-0.18.0
--extra-dep secp256k1-haskell-0.5.0
-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE LambdaCase #-}
import Haskoin
import qualified Data.ByteString as B
import qualified Data.ByteString.Char8 as B8
import qualified Data.Text.IO as T
import Data.Maybe
main :: IO ()
main = do
chars <- B.getLine
let Just key = fromMiniKey chars
T.putStrLn (toWif btc key)
T.putStrLn (fromJust (addrToText btc (pubKeyAddr (derivePubKeyI key))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment