Skip to content

Instantly share code, notes, and snippets.

View torkelrogstad's full-sized avatar

Torkel Rogstad torkelrogstad

View GitHub Profile
import scala.concurrent._
import akka.actor.ActorSystem
import org.bitcoins.{rpc, core}
import core.currency.Bitcoins
import rpc.client.common._
implicit val system = ActorSystem.create()
implicit val ec: ExecutionContext = system.dispatcher
import scala.concurrent._
import scala.concurrent.duration._
import org.bitcoins.core._
import number._
import config._
import currency._
import crypto._
import script.crypto._
import protocol.transaction._
import scala.util.Success
import org.bitcoins.core.protocol.script._
import org.bitcoins.core.protocol.Bech32Address
import org.bitcoins.core.config.TestNet3
// first account -------┐
// bitcoin ----------┐ |
// segwit --------┐ | |
val accountPath = BIP32Path.fromString("m/84'/0'/0'")
// accountPath: BIP32Path = m/84'/0'/0'
import scodec.bits._
import org.bitcoins.core.crypto._
import org.bitcoins.core.hd._
// the length of the entropy bit vector determine
// how long our phrase ends up being
// 256 bits of entropy results in 24 words
val entropy: BitVector = MnemonicCode.getEntropy256Bits
// entropy: BitVector = BitVector(256 bits, 0xdf78bf273bc6fa221e1d807e389818b9e9a5f19d20328bef2bf35db8714cffe6)
// pay-to-pubkey-hash address
import org.bitcoins.core.protocol.P2PKHAddress
// we're reusing the same private/public key pair
// from before. don't do this in an actual application!
val legacyAddress = P2PKHAddress(pubkey, TestNet3)
// legacyAddress: P2PKHAddress = mhc1Sh6HKsLkybe5TVG3mJKw6FEpjC4LT2
import org.bitcoins.core.{crypto, protocol, config}
// if you want to get addresses for mainnet, just import
// config.MainNet here instead
import config.TestNet3
import crypto.ECPrivateKey
// this gets all addresses into scope
import protocol._
// this gets all scriptPubKeys into scope
FROM alpine
RUN apk add bash \
bsd-compat-headers \
build-base \
linux-headers \
ncurses-dev \
readline-dev \
sqlite-dev \
zlib-dev \

Keybase proof

I hereby claim:

  • I am torkelrogstad on github.
  • I am torkelrogstad (https://keybase.io/torkelrogstad) on keybase.
  • I have a public key ASBN5JJBUwdewFDttuK2x4paDy45SyECqEhwDD-urK0A-Qo

To claim this, I am signing this object: