diff --git a/api/org/bitcoins/docs/BuildInfo$.html b/api/org/bitcoins/docs/BuildInfo$.html index 86eca0f987..0c65333fa4 100644 --- a/api/org/bitcoins/docs/BuildInfo$.html +++ b/api/org/bitcoins/docs/BuildInfo$.html @@ -1,2 +1,2 @@

Packages

o

org.bitcoins.docs

BuildInfo

case object BuildInfo extends Product with Serializable

This object was generated by sbt-buildinfo.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BuildInfo
  2. Serializable
  3. Product
  4. Equals
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  9. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. val mdocExtraArguments: Seq[String]

    The value is scala.collection.immutable.Seq("--no-link-hygiene").

  12. val mdocVariables: Map[String, String]

    The value is Map(("STABLE_VERSION" -> "1.9.10"), ("UNSTABLE_VERSION" -> "1.9.10-50-c6d83199-SNAPSHOT")).

  13. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  16. def productElementName(n: Int): String
    Definition Classes
    Product
  17. def productElementNames: Iterator[String]
    Definition Classes
    Product
  18. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  19. val toString: String
    Definition Classes
    BuildInfo → AnyRef → Any
  20. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped

+var toRoot = '../../../';

Packages

o

org.bitcoins.docs

BuildInfo

case object BuildInfo extends Product with Serializable

This object was generated by sbt-buildinfo.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BuildInfo
  2. Serializable
  3. Product
  4. Equals
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  9. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. val mdocExtraArguments: Seq[String]

    The value is scala.collection.immutable.Seq("--no-link-hygiene").

  12. val mdocVariables: Map[String, String]

    The value is Map(("STABLE_VERSION" -> "1.9.10"), ("UNSTABLE_VERSION" -> "1.9.10-51-ed66937d-SNAPSHOT")).

  13. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  16. def productElementName(n: Int): String
    Definition Classes
    Product
  17. def productElementNames: Iterator[String]
    Definition Classes
    Product
  18. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  19. val toString: String
    Definition Classes
    BuildInfo → AnyRef → Any
  20. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped

diff --git a/docs/next/core/addresses.html b/docs/next/core/addresses.html index 079981fe32..4f5c41d167 100644 --- a/docs/next/core/addresses.html +++ b/docs/next/core/addresses.html @@ -80,7 +80,7 @@ reason to keep using legacy transaction formats.

val privkey = ECPrivateKey() // privkey: ECPrivateKey = Masked(ECPrivateKey) val pubkey = privkey.publicKey -// pubkey: org.bitcoins.crypto.ECPublicKey = ECPublicKey(03b55fdeaf9520c9d4e3f264ccdd98e141cff205111688a4f0530ef479b7e6e7dc) +// pubkey: org.bitcoins.crypto.ECPublicKey = ECPublicKey(027170013686225cb4d8dd6578e6c35fea298f32d848f6ba71c12e87f69ee2f6ce) val segwitAddress = { // see https://bitcoin.org/en/glossary/pubkey-script @@ -89,10 +89,10 @@ reason to keep using legacy transaction formats.

val scriptPubKey = P2WPKHWitnessSPKV0(pubkey) Bech32Address(scriptPubKey, TestNet3) } -// segwitAddress: Bech32Address = tb1qpjtrd2e4xtmqfv405jl3luez2czxdpykq9ewpl +// segwitAddress: Bech32Address = tb1qavf0xqah9fw5t3p9fcny6kfxn054epy030kt7e println(segwitAddress.toString) -// tb1qpjtrd2e4xtmqfv405jl3luez2czxdpykq9ewpl +// tb1qavf0xqah9fw5t3p9fcny6kfxn054epy030kt7e

Generating legacy (base58) addresses

If you need to generate legacy addresses for backwards @@ -101,10 +101,10 @@ Take a look:

// 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 = mgfWMNnVPFrSR1NSN15GBmAvDYYSnG7vMD
+// legacyAddress: P2PKHAddress = n2wunkd3K3P5D1fxwM3T4Zf8C9WUCuPD6F
 
 println(legacyAddress.toString)
-// mgfWMNnVPFrSR1NSN15GBmAvDYYSnG7vMD
+// n2wunkd3K3P5D1fxwM3T4Zf8C9WUCuPD6F
 
Core ModuleHD Key Generation
Edit

TxBuilder Example

Bitcoin-S features a transaction building API that allows you to construct and sign Bitcoin transactions. Here's an example of how to use it

implicit val ec: ExecutionContext = ExecutionContext.Implicits.global
-// ec: ExecutionContext = scala.concurrent.impl.ExecutionContextImpl$$anon$3@75b0fdea[Running, parallelism = 4, size = 0, active = 0, running = 0, steals = 0, tasks = 0, submissions = 0]
+// ec: ExecutionContext = scala.concurrent.impl.ExecutionContextImpl$$anon$3@7b590494[Running, parallelism = 4, size = 0, active = 0, running = 0, steals = 0, tasks = 0, submissions = 0]
 
 // Initialize a transaction builder
 val builder = RawTxBuilder()
@@ -74,19 +74,19 @@
 val privKey = ECPrivateKey.freshPrivateKey
 // privKey: ECPrivateKey = Masked(ECPrivateKey)
 val pubKey = privKey.publicKey
-// pubKey: ECPublicKey = ECPublicKey(03718fc86b51981341df9d52e378d3c1569f8685b14d2d1ff0971be05275518ec6)
+// pubKey: ECPublicKey = ECPublicKey(039cbb08b80e783529044d50bc6800add8a2df4e9d5987cf7f5bdeda8829fea831)
 
 // this is the script that the TxBuilder is going to create a
 // script signature that validly spends this scriptPubKey
 val creditingSpk = P2PKHScriptPubKey(pubKey = privKey.publicKey)
-// creditingSpk: P2PKHScriptPubKey = pkh(35897edd1dd1dddc254f886bd5ba673958473a2c)
+// creditingSpk: P2PKHScriptPubKey = pkh(543d1e6ac60fe1f71be35f2e41d6dbb96cf774fc)
 val amount = 10000.satoshis
 // amount: Satoshis = 10000 sats
 
 // this is the UTXO we are going to be spending
 val utxo =
   TransactionOutput(value = amount, scriptPubKey = creditingSpk)
-// utxo: TransactionOutput = TransactionOutput(10000 sats,pkh(35897edd1dd1dddc254f886bd5ba673958473a2c))
+// utxo: TransactionOutput = TransactionOutput(10000 sats,pkh(543d1e6ac60fe1f71be35f2e41d6dbb96cf774fc))
 
 // the private key that locks the funds for the script we are spending too
 val destinationPrivKey = ECPrivateKey.freshPrivateKey
@@ -99,7 +99,7 @@
 // the script that corresponds to destination private key, this is what is receiving the money
 val destinationSPK =
   P2PKHScriptPubKey(pubKey = destinationPrivKey.publicKey)
-// destinationSPK: P2PKHScriptPubKey = pkh(d96bea9b9a317419692c2f21d6c7c83c9402fbef)
+// destinationSPK: P2PKHScriptPubKey = pkh(1b8c5ca7b58f891d3b976b7630340de2380783b0)
 
 // this is where we are sending money too
 // we could add more destinations here if we
@@ -110,7 +110,7 @@
 
     Vector(destination0)
 }
-// destinations: Vector[TransactionOutput] = Vector(TransactionOutput(5000 sats,pkh(d96bea9b9a317419692c2f21d6c7c83c9402fbef)))
+// destinations: Vector[TransactionOutput] = Vector(TransactionOutput(5000 sats,pkh(1b8c5ca7b58f891d3b976b7630340de2380783b0)))
 
 // Add the destinations to the tx builder
 builder ++= destinations
@@ -123,17 +123,17 @@ builder ++= destinations
                                   inputs = Vector.empty,
                                   outputs = Vector(utxo),
                                   lockTime = UInt32.zero)
-// creditingTx: BaseTransaction = BaseTransaction(Int32Impl(1),Vector(),Vector(TransactionOutput(10000 sats,pkh(35897edd1dd1dddc254f886bd5ba673958473a2c))),UInt32Impl(0))
+// creditingTx: BaseTransaction = BaseTransaction(Int32Impl(1),Vector(),Vector(TransactionOutput(10000 sats,pkh(543d1e6ac60fe1f71be35f2e41d6dbb96cf774fc))),UInt32Impl(0))
 
 // this is the information we need from the crediting TX
 // to properly "link" it in the transaction we are creating
 val outPoint = TransactionOutPoint(creditingTx.txId, UInt32.zero)
-// outPoint: TransactionOutPoint = TransactionOutPoint(56e80f14f71232f56d33503861ed82f03028e03b9efb0f406902954ea3bd2745:0)
+// outPoint: TransactionOutPoint = TransactionOutPoint(9cdb9e5cca16c65c6d7f372fe79fdb9f86af721319520af02d621c77fbbe0612:0)
 val input = TransactionInput(
     outPoint,
     EmptyScriptSignature,
     sequenceNumber = UInt32.zero)
-// input: TransactionInput = TransactionInputImpl(TransactionOutPoint(56e80f14f71232f56d33503861ed82f03028e03b9efb0f406902954ea3bd2745:0),EmptyScriptSignature,UInt32Impl(0))
+// input: TransactionInput = TransactionInputImpl(TransactionOutPoint(9cdb9e5cca16c65c6d7f372fe79fdb9f86af721319520af02d621c77fbbe0612:0),EmptyScriptSignature,UInt32Impl(0))
 
 // Add a new input to our builder
 builder += input
@@ -141,11 +141,11 @@ builder += input
 
 // We can now generate a RawTxBuilderResult ready to be finalized
 val builderResult = builder.result()
-// builderResult: RawTxBuilderResult = RawTxBuilderResult(Int32Impl(2),Vector(TransactionInputImpl(TransactionOutPoint(56e80f14f71232f56d33503861ed82f03028e03b9efb0f406902954ea3bd2745:0),EmptyScriptSignature,UInt32Impl(0))),Vector(TransactionOutput(5000 sats,pkh(d96bea9b9a317419692c2f21d6c7c83c9402fbef))),UInt32Impl(0))
+// builderResult: RawTxBuilderResult = RawTxBuilderResult(Int32Impl(2),Vector(TransactionInputImpl(TransactionOutPoint(9cdb9e5cca16c65c6d7f372fe79fdb9f86af721319520af02d621c77fbbe0612:0),EmptyScriptSignature,UInt32Impl(0))),Vector(TransactionOutput(5000 sats,pkh(1b8c5ca7b58f891d3b976b7630340de2380783b0))),UInt32Impl(0))
 
 // this contains the information needed to analyze our input during finalization
 val inputInfo = P2PKHInputInfo(outPoint, amount, privKey.publicKey)
-// inputInfo: P2PKHInputInfo = P2PKHInputInfo(TransactionOutPoint(56e80f14f71232f56d33503861ed82f03028e03b9efb0f406902954ea3bd2745:0),10000 sats,ECPublicKey(03718fc86b51981341df9d52e378d3c1569f8685b14d2d1ff0971be05275518ec6))
+// inputInfo: P2PKHInputInfo = P2PKHInputInfo(TransactionOutPoint(9cdb9e5cca16c65c6d7f372fe79fdb9f86af721319520af02d621c77fbbe0612:0),10000 sats,ECPublicKey(039cbb08b80e783529044d50bc6800add8a2df4e9d5987cf7f5bdeda8829fea831))
 
 // this is how much we are going to pay as a fee to the network
 // for this example, we are going to pay 1 satoshi per byte
@@ -155,18 +155,18 @@ builder += input
 val changePrivKey = ECPrivateKey.freshPrivateKey
 // changePrivKey: ECPrivateKey = Masked(ECPrivateKey)
 val changeSPK = P2PKHScriptPubKey(pubKey = changePrivKey.publicKey)
-// changeSPK: P2PKHScriptPubKey = pkh(1f9711d4c6689274b245e2a01baabe6726df41af)
+// changeSPK: P2PKHScriptPubKey = pkh(5dacba7eb3702cfe1e9679c53330f1c8e751a174)
 
 // We chose a finalizer that adds a change output to our tx based on a fee rate
 val finalizer = StandardNonInteractiveFinalizer(
     Vector(inputInfo),
     feeRate,
     changeSPK)
-// finalizer: StandardNonInteractiveFinalizer = StandardNonInteractiveFinalizer(Vector(P2PKHInputInfo(TransactionOutPoint(56e80f14f71232f56d33503861ed82f03028e03b9efb0f406902954ea3bd2745:0),10000 sats,ECPublicKey(03718fc86b51981341df9d52e378d3c1569f8685b14d2d1ff0971be05275518ec6))),1 sats/byte,pkh(1f9711d4c6689274b245e2a01baabe6726df41af))
+// finalizer: StandardNonInteractiveFinalizer = StandardNonInteractiveFinalizer(Vector(P2PKHInputInfo(TransactionOutPoint(9cdb9e5cca16c65c6d7f372fe79fdb9f86af721319520af02d621c77fbbe0612:0),10000 sats,ECPublicKey(039cbb08b80e783529044d50bc6800add8a2df4e9d5987cf7f5bdeda8829fea831))),1 sats/byte,pkh(5dacba7eb3702cfe1e9679c53330f1c8e751a174))
 
 // We can now finalize the tx builder result from earlier with this finalizer
 val unsignedTx: Transaction = finalizer.buildTx(builderResult)
-// unsignedTx: Transaction = BaseTransaction(Int32Impl(2),Vector(TransactionInputImpl(TransactionOutPoint(56e80f14f71232f56d33503861ed82f03028e03b9efb0f406902954ea3bd2745:0),EmptyScriptSignature,UInt32Impl(0))),Vector(TransactionOutput(5000 sats,pkh(d96bea9b9a317419692c2f21d6c7c83c9402fbef)), TransactionOutput(4775 sats,pkh(1f9711d4c6689274b245e2a01baabe6726df41af))),UInt32Impl(0))
+// unsignedTx: Transaction = BaseTransaction(Int32Impl(2),Vector(TransactionInputImpl(TransactionOutPoint(9cdb9e5cca16c65c6d7f372fe79fdb9f86af721319520af02d621c77fbbe0612:0),EmptyScriptSignature,UInt32Impl(0))),Vector(TransactionOutput(5000 sats,pkh(1b8c5ca7b58f891d3b976b7630340de2380783b0)), TransactionOutput(4775 sats,pkh(5dacba7eb3702cfe1e9679c53330f1c8e751a174))),UInt32Impl(0))
 
 // We now turn to signing the unsigned transaction
 // this contains all the information we need to
@@ -176,12 +176,12 @@ builder += input
                                      signers = Vector(privKey),
                                      hashType =
                                          HashType.sigHashAll)
-// utxoInfo: ScriptSignatureParams[P2PKHInputInfo] = ScriptSignatureParams(P2PKHInputInfo(TransactionOutPoint(56e80f14f71232f56d33503861ed82f03028e03b9efb0f406902954ea3bd2745:0),10000 sats,ECPublicKey(03718fc86b51981341df9d52e378d3c1569f8685b14d2d1ff0971be05275518ec6)),BaseTransaction(Int32Impl(1),Vector(),Vector(TransactionOutput(10000 sats,pkh(35897edd1dd1dddc254f886bd5ba673958473a2c))),UInt32Impl(0)),Vector(Masked(ECPrivateKey)),SIGHASH_ALL(1))
+// utxoInfo: ScriptSignatureParams[P2PKHInputInfo] = ScriptSignatureParams(P2PKHInputInfo(TransactionOutPoint(9cdb9e5cca16c65c6d7f372fe79fdb9f86af721319520af02d621c77fbbe0612:0),10000 sats,ECPublicKey(039cbb08b80e783529044d50bc6800add8a2df4e9d5987cf7f5bdeda8829fea831)),BaseTransaction(Int32Impl(1),Vector(),Vector(TransactionOutput(10000 sats,pkh(543d1e6ac60fe1f71be35f2e41d6dbb96cf774fc))),UInt32Impl(0)),Vector(Masked(ECPrivateKey)),SIGHASH_ALL(1))
 
 // all of the UTXO spending information, since we only have
 // one input, this is just one element
 val utxoInfos: Vector[ScriptSignatureParams[InputInfo]] = Vector(utxoInfo)
-// utxoInfos: Vector[ScriptSignatureParams[InputInfo]] = Vector(ScriptSignatureParams(P2PKHInputInfo(TransactionOutPoint(56e80f14f71232f56d33503861ed82f03028e03b9efb0f406902954ea3bd2745:0),10000 sats,ECPublicKey(03718fc86b51981341df9d52e378d3c1569f8685b14d2d1ff0971be05275518ec6)),BaseTransaction(Int32Impl(1),Vector(),Vector(TransactionOutput(10000 sats,pkh(35897edd1dd1dddc254f886bd5ba673958473a2c))),UInt32Impl(0)),Vector(Masked(ECPrivateKey)),SIGHASH_ALL(1)))
+// utxoInfos: Vector[ScriptSignatureParams[InputInfo]] = Vector(ScriptSignatureParams(P2PKHInputInfo(TransactionOutPoint(9cdb9e5cca16c65c6d7f372fe79fdb9f86af721319520af02d621c77fbbe0612:0),10000 sats,ECPublicKey(039cbb08b80e783529044d50bc6800add8a2df4e9d5987cf7f5bdeda8829fea831)),BaseTransaction(Int32Impl(1),Vector(),Vector(TransactionOutput(10000 sats,pkh(543d1e6ac60fe1f71be35f2e41d6dbb96cf774fc))),UInt32Impl(0)),Vector(Masked(ECPrivateKey)),SIGHASH_ALL(1)))
 
 // Yay! Now we use the RawTxSigner object to sign the tx.
 // The 'sign' method is going produce a validly signed transaction
@@ -197,7 +197,7 @@ builder += input
       utxoInfos = utxoInfos,
       expectedFeeRate = feeRate
   )
-// signedTx: Transaction = BaseTransaction(Int32Impl(2),Vector(TransactionInputImpl(TransactionOutPoint(56e80f14f71232f56d33503861ed82f03028e03b9efb0f406902954ea3bd2745:0),P2PKHScriptSignature(ECPublicKeyBytes(ByteVector(33 bytes, 0x03718fc86b51981341df9d52e378d3c1569f8685b14d2d1ff0971be05275518ec6)), ECDigitalSignature(304402200644b52f1a4e1c8168c36dcfe3f48b93b83a54142004ad829fb18992164f441a02201cab7dcff36ef904ff949f3a3b9a82621708ade5e2e46e1d634200aeab78a3ce01)),UInt32Impl(0))),Vector(TransactionOutput(5000 sats,pkh(d96bea9b9a317419692c2f21d6c7c83c9402fbef)), TransactionOutput(4775 sats,pkh(1f9711d4c6689274b245e2a01baabe6726df41af))),UInt32Impl(0))
+// signedTx: Transaction = BaseTransaction(Int32Impl(2),Vector(TransactionInputImpl(TransactionOutPoint(9cdb9e5cca16c65c6d7f372fe79fdb9f86af721319520af02d621c77fbbe0612:0),P2PKHScriptSignature(ECPublicKeyBytes(ByteVector(33 bytes, 0x039cbb08b80e783529044d50bc6800add8a2df4e9d5987cf7f5bdeda8829fea831)), ECDigitalSignature(304402201f6ea4738765bb31c95452b182ba1649da8765e3d3ddf9302d0be2ef80db5aec0220049916654e42977ebbcc53db180e3826eb06cf0049f1138227ccc475b2d068e801)),UInt32Impl(0))),Vector(TransactionOutput(5000 sats,pkh(1b8c5ca7b58f891d3b976b7630340de2380783b0)), TransactionOutput(4775 sats,pkh(5dacba7eb3702cfe1e9679c53330f1c8e751a174))),UInt32Impl(0))
 
signedTx.inputs.length
 // res2: Int = 1
@@ -207,7 +207,7 @@ signedTx.outputs.length
 
 //remember, you can call .hex on any bitcoin-s data structure to get the hex representation!
 signedTx.hex
-// res4: String = 02000000014527bda34e950269400ffb9e3be02830f082ed613850336df53212f7140fe856000000006a47304402200644b52f1a4e1c8168c36dcfe3f48b93b83a54142004ad829fb18992164f441a02201cab7dcff36ef904ff949f3a3b9a82621708ade5e2e46e1d634200aeab78a3ce012103718fc86b51981341df9d52e378d3c1569f8685b14d2d1ff0971be05275518ec6000000000288130000000000001976a914d96bea9b9a317419692c2f21d6c7c83c9402fbef88aca7120000000000001976a9141f9711d4c6689274b245e2a01baabe6726df41af88ac00000000
+// res4: String = 02000000011206befb771c622df00a52191372af869fdb9fe72f377f6d5cc616ca5c9edb9c000000006a47304402201f6ea4738765bb31c95452b182ba1649da8765e3d3ddf9302d0be2ef80db5aec0220049916654e42977ebbcc53db180e3826eb06cf0049f1138227ccc475b2d068e80121039cbb08b80e783529044d50bc6800add8a2df4e9d5987cf7f5bdeda8829fea831000000000288130000000000001976a9141b8c5ca7b58f891d3b976b7630340de2380783b088aca7120000000000001976a9145dacba7eb3702cfe1e9679c53330f1c8e751a17488ac00000000
 
Edit

TxBuilder Example

Bitcoin-S features a transaction building API that allows you to construct and sign Bitcoin transactions. Here's an example of how to use it

implicit val ec: ExecutionContext = ExecutionContext.Implicits.global
-// ec: ExecutionContext = scala.concurrent.impl.ExecutionContextImpl$$anon$3@75b0fdea[Running, parallelism = 4, size = 0, active = 0, running = 0, steals = 0, tasks = 0, submissions = 0]
+// ec: ExecutionContext = scala.concurrent.impl.ExecutionContextImpl$$anon$3@7b590494[Running, parallelism = 4, size = 0, active = 0, running = 0, steals = 0, tasks = 0, submissions = 0]
 
 // Initialize a transaction builder
 val builder = RawTxBuilder()
@@ -74,19 +74,19 @@
 val privKey = ECPrivateKey.freshPrivateKey
 // privKey: ECPrivateKey = Masked(ECPrivateKey)
 val pubKey = privKey.publicKey
-// pubKey: ECPublicKey = ECPublicKey(03718fc86b51981341df9d52e378d3c1569f8685b14d2d1ff0971be05275518ec6)
+// pubKey: ECPublicKey = ECPublicKey(039cbb08b80e783529044d50bc6800add8a2df4e9d5987cf7f5bdeda8829fea831)
 
 // this is the script that the TxBuilder is going to create a
 // script signature that validly spends this scriptPubKey
 val creditingSpk = P2PKHScriptPubKey(pubKey = privKey.publicKey)
-// creditingSpk: P2PKHScriptPubKey = pkh(35897edd1dd1dddc254f886bd5ba673958473a2c)
+// creditingSpk: P2PKHScriptPubKey = pkh(543d1e6ac60fe1f71be35f2e41d6dbb96cf774fc)
 val amount = 10000.satoshis
 // amount: Satoshis = 10000 sats
 
 // this is the UTXO we are going to be spending
 val utxo =
   TransactionOutput(value = amount, scriptPubKey = creditingSpk)
-// utxo: TransactionOutput = TransactionOutput(10000 sats,pkh(35897edd1dd1dddc254f886bd5ba673958473a2c))
+// utxo: TransactionOutput = TransactionOutput(10000 sats,pkh(543d1e6ac60fe1f71be35f2e41d6dbb96cf774fc))
 
 // the private key that locks the funds for the script we are spending too
 val destinationPrivKey = ECPrivateKey.freshPrivateKey
@@ -99,7 +99,7 @@
 // the script that corresponds to destination private key, this is what is receiving the money
 val destinationSPK =
   P2PKHScriptPubKey(pubKey = destinationPrivKey.publicKey)
-// destinationSPK: P2PKHScriptPubKey = pkh(d96bea9b9a317419692c2f21d6c7c83c9402fbef)
+// destinationSPK: P2PKHScriptPubKey = pkh(1b8c5ca7b58f891d3b976b7630340de2380783b0)
 
 // this is where we are sending money too
 // we could add more destinations here if we
@@ -110,7 +110,7 @@
 
     Vector(destination0)
 }
-// destinations: Vector[TransactionOutput] = Vector(TransactionOutput(5000 sats,pkh(d96bea9b9a317419692c2f21d6c7c83c9402fbef)))
+// destinations: Vector[TransactionOutput] = Vector(TransactionOutput(5000 sats,pkh(1b8c5ca7b58f891d3b976b7630340de2380783b0)))
 
 // Add the destinations to the tx builder
 builder ++= destinations
@@ -123,17 +123,17 @@ builder ++= destinations
                                   inputs = Vector.empty,
                                   outputs = Vector(utxo),
                                   lockTime = UInt32.zero)
-// creditingTx: BaseTransaction = BaseTransaction(Int32Impl(1),Vector(),Vector(TransactionOutput(10000 sats,pkh(35897edd1dd1dddc254f886bd5ba673958473a2c))),UInt32Impl(0))
+// creditingTx: BaseTransaction = BaseTransaction(Int32Impl(1),Vector(),Vector(TransactionOutput(10000 sats,pkh(543d1e6ac60fe1f71be35f2e41d6dbb96cf774fc))),UInt32Impl(0))
 
 // this is the information we need from the crediting TX
 // to properly "link" it in the transaction we are creating
 val outPoint = TransactionOutPoint(creditingTx.txId, UInt32.zero)
-// outPoint: TransactionOutPoint = TransactionOutPoint(56e80f14f71232f56d33503861ed82f03028e03b9efb0f406902954ea3bd2745:0)
+// outPoint: TransactionOutPoint = TransactionOutPoint(9cdb9e5cca16c65c6d7f372fe79fdb9f86af721319520af02d621c77fbbe0612:0)
 val input = TransactionInput(
     outPoint,
     EmptyScriptSignature,
     sequenceNumber = UInt32.zero)
-// input: TransactionInput = TransactionInputImpl(TransactionOutPoint(56e80f14f71232f56d33503861ed82f03028e03b9efb0f406902954ea3bd2745:0),EmptyScriptSignature,UInt32Impl(0))
+// input: TransactionInput = TransactionInputImpl(TransactionOutPoint(9cdb9e5cca16c65c6d7f372fe79fdb9f86af721319520af02d621c77fbbe0612:0),EmptyScriptSignature,UInt32Impl(0))
 
 // Add a new input to our builder
 builder += input
@@ -141,11 +141,11 @@ builder += input
 
 // We can now generate a RawTxBuilderResult ready to be finalized
 val builderResult = builder.result()
-// builderResult: RawTxBuilderResult = RawTxBuilderResult(Int32Impl(2),Vector(TransactionInputImpl(TransactionOutPoint(56e80f14f71232f56d33503861ed82f03028e03b9efb0f406902954ea3bd2745:0),EmptyScriptSignature,UInt32Impl(0))),Vector(TransactionOutput(5000 sats,pkh(d96bea9b9a317419692c2f21d6c7c83c9402fbef))),UInt32Impl(0))
+// builderResult: RawTxBuilderResult = RawTxBuilderResult(Int32Impl(2),Vector(TransactionInputImpl(TransactionOutPoint(9cdb9e5cca16c65c6d7f372fe79fdb9f86af721319520af02d621c77fbbe0612:0),EmptyScriptSignature,UInt32Impl(0))),Vector(TransactionOutput(5000 sats,pkh(1b8c5ca7b58f891d3b976b7630340de2380783b0))),UInt32Impl(0))
 
 // this contains the information needed to analyze our input during finalization
 val inputInfo = P2PKHInputInfo(outPoint, amount, privKey.publicKey)
-// inputInfo: P2PKHInputInfo = P2PKHInputInfo(TransactionOutPoint(56e80f14f71232f56d33503861ed82f03028e03b9efb0f406902954ea3bd2745:0),10000 sats,ECPublicKey(03718fc86b51981341df9d52e378d3c1569f8685b14d2d1ff0971be05275518ec6))
+// inputInfo: P2PKHInputInfo = P2PKHInputInfo(TransactionOutPoint(9cdb9e5cca16c65c6d7f372fe79fdb9f86af721319520af02d621c77fbbe0612:0),10000 sats,ECPublicKey(039cbb08b80e783529044d50bc6800add8a2df4e9d5987cf7f5bdeda8829fea831))
 
 // this is how much we are going to pay as a fee to the network
 // for this example, we are going to pay 1 satoshi per byte
@@ -155,18 +155,18 @@ builder += input
 val changePrivKey = ECPrivateKey.freshPrivateKey
 // changePrivKey: ECPrivateKey = Masked(ECPrivateKey)
 val changeSPK = P2PKHScriptPubKey(pubKey = changePrivKey.publicKey)
-// changeSPK: P2PKHScriptPubKey = pkh(1f9711d4c6689274b245e2a01baabe6726df41af)
+// changeSPK: P2PKHScriptPubKey = pkh(5dacba7eb3702cfe1e9679c53330f1c8e751a174)
 
 // We chose a finalizer that adds a change output to our tx based on a fee rate
 val finalizer = StandardNonInteractiveFinalizer(
     Vector(inputInfo),
     feeRate,
     changeSPK)
-// finalizer: StandardNonInteractiveFinalizer = StandardNonInteractiveFinalizer(Vector(P2PKHInputInfo(TransactionOutPoint(56e80f14f71232f56d33503861ed82f03028e03b9efb0f406902954ea3bd2745:0),10000 sats,ECPublicKey(03718fc86b51981341df9d52e378d3c1569f8685b14d2d1ff0971be05275518ec6))),1 sats/byte,pkh(1f9711d4c6689274b245e2a01baabe6726df41af))
+// finalizer: StandardNonInteractiveFinalizer = StandardNonInteractiveFinalizer(Vector(P2PKHInputInfo(TransactionOutPoint(9cdb9e5cca16c65c6d7f372fe79fdb9f86af721319520af02d621c77fbbe0612:0),10000 sats,ECPublicKey(039cbb08b80e783529044d50bc6800add8a2df4e9d5987cf7f5bdeda8829fea831))),1 sats/byte,pkh(5dacba7eb3702cfe1e9679c53330f1c8e751a174))
 
 // We can now finalize the tx builder result from earlier with this finalizer
 val unsignedTx: Transaction = finalizer.buildTx(builderResult)
-// unsignedTx: Transaction = BaseTransaction(Int32Impl(2),Vector(TransactionInputImpl(TransactionOutPoint(56e80f14f71232f56d33503861ed82f03028e03b9efb0f406902954ea3bd2745:0),EmptyScriptSignature,UInt32Impl(0))),Vector(TransactionOutput(5000 sats,pkh(d96bea9b9a317419692c2f21d6c7c83c9402fbef)), TransactionOutput(4775 sats,pkh(1f9711d4c6689274b245e2a01baabe6726df41af))),UInt32Impl(0))
+// unsignedTx: Transaction = BaseTransaction(Int32Impl(2),Vector(TransactionInputImpl(TransactionOutPoint(9cdb9e5cca16c65c6d7f372fe79fdb9f86af721319520af02d621c77fbbe0612:0),EmptyScriptSignature,UInt32Impl(0))),Vector(TransactionOutput(5000 sats,pkh(1b8c5ca7b58f891d3b976b7630340de2380783b0)), TransactionOutput(4775 sats,pkh(5dacba7eb3702cfe1e9679c53330f1c8e751a174))),UInt32Impl(0))
 
 // We now turn to signing the unsigned transaction
 // this contains all the information we need to
@@ -176,12 +176,12 @@ builder += input
                                      signers = Vector(privKey),
                                      hashType =
                                          HashType.sigHashAll)
-// utxoInfo: ScriptSignatureParams[P2PKHInputInfo] = ScriptSignatureParams(P2PKHInputInfo(TransactionOutPoint(56e80f14f71232f56d33503861ed82f03028e03b9efb0f406902954ea3bd2745:0),10000 sats,ECPublicKey(03718fc86b51981341df9d52e378d3c1569f8685b14d2d1ff0971be05275518ec6)),BaseTransaction(Int32Impl(1),Vector(),Vector(TransactionOutput(10000 sats,pkh(35897edd1dd1dddc254f886bd5ba673958473a2c))),UInt32Impl(0)),Vector(Masked(ECPrivateKey)),SIGHASH_ALL(1))
+// utxoInfo: ScriptSignatureParams[P2PKHInputInfo] = ScriptSignatureParams(P2PKHInputInfo(TransactionOutPoint(9cdb9e5cca16c65c6d7f372fe79fdb9f86af721319520af02d621c77fbbe0612:0),10000 sats,ECPublicKey(039cbb08b80e783529044d50bc6800add8a2df4e9d5987cf7f5bdeda8829fea831)),BaseTransaction(Int32Impl(1),Vector(),Vector(TransactionOutput(10000 sats,pkh(543d1e6ac60fe1f71be35f2e41d6dbb96cf774fc))),UInt32Impl(0)),Vector(Masked(ECPrivateKey)),SIGHASH_ALL(1))
 
 // all of the UTXO spending information, since we only have
 // one input, this is just one element
 val utxoInfos: Vector[ScriptSignatureParams[InputInfo]] = Vector(utxoInfo)
-// utxoInfos: Vector[ScriptSignatureParams[InputInfo]] = Vector(ScriptSignatureParams(P2PKHInputInfo(TransactionOutPoint(56e80f14f71232f56d33503861ed82f03028e03b9efb0f406902954ea3bd2745:0),10000 sats,ECPublicKey(03718fc86b51981341df9d52e378d3c1569f8685b14d2d1ff0971be05275518ec6)),BaseTransaction(Int32Impl(1),Vector(),Vector(TransactionOutput(10000 sats,pkh(35897edd1dd1dddc254f886bd5ba673958473a2c))),UInt32Impl(0)),Vector(Masked(ECPrivateKey)),SIGHASH_ALL(1)))
+// utxoInfos: Vector[ScriptSignatureParams[InputInfo]] = Vector(ScriptSignatureParams(P2PKHInputInfo(TransactionOutPoint(9cdb9e5cca16c65c6d7f372fe79fdb9f86af721319520af02d621c77fbbe0612:0),10000 sats,ECPublicKey(039cbb08b80e783529044d50bc6800add8a2df4e9d5987cf7f5bdeda8829fea831)),BaseTransaction(Int32Impl(1),Vector(),Vector(TransactionOutput(10000 sats,pkh(543d1e6ac60fe1f71be35f2e41d6dbb96cf774fc))),UInt32Impl(0)),Vector(Masked(ECPrivateKey)),SIGHASH_ALL(1)))
 
 // Yay! Now we use the RawTxSigner object to sign the tx.
 // The 'sign' method is going produce a validly signed transaction
@@ -197,7 +197,7 @@ builder += input
       utxoInfos = utxoInfos,
       expectedFeeRate = feeRate
   )
-// signedTx: Transaction = BaseTransaction(Int32Impl(2),Vector(TransactionInputImpl(TransactionOutPoint(56e80f14f71232f56d33503861ed82f03028e03b9efb0f406902954ea3bd2745:0),P2PKHScriptSignature(ECPublicKeyBytes(ByteVector(33 bytes, 0x03718fc86b51981341df9d52e378d3c1569f8685b14d2d1ff0971be05275518ec6)), ECDigitalSignature(304402200644b52f1a4e1c8168c36dcfe3f48b93b83a54142004ad829fb18992164f441a02201cab7dcff36ef904ff949f3a3b9a82621708ade5e2e46e1d634200aeab78a3ce01)),UInt32Impl(0))),Vector(TransactionOutput(5000 sats,pkh(d96bea9b9a317419692c2f21d6c7c83c9402fbef)), TransactionOutput(4775 sats,pkh(1f9711d4c6689274b245e2a01baabe6726df41af))),UInt32Impl(0))
+// signedTx: Transaction = BaseTransaction(Int32Impl(2),Vector(TransactionInputImpl(TransactionOutPoint(9cdb9e5cca16c65c6d7f372fe79fdb9f86af721319520af02d621c77fbbe0612:0),P2PKHScriptSignature(ECPublicKeyBytes(ByteVector(33 bytes, 0x039cbb08b80e783529044d50bc6800add8a2df4e9d5987cf7f5bdeda8829fea831)), ECDigitalSignature(304402201f6ea4738765bb31c95452b182ba1649da8765e3d3ddf9302d0be2ef80db5aec0220049916654e42977ebbcc53db180e3826eb06cf0049f1138227ccc475b2d068e801)),UInt32Impl(0))),Vector(TransactionOutput(5000 sats,pkh(1b8c5ca7b58f891d3b976b7630340de2380783b0)), TransactionOutput(4775 sats,pkh(5dacba7eb3702cfe1e9679c53330f1c8e751a174))),UInt32Impl(0))
 
signedTx.inputs.length
 // res2: Int = 1
@@ -207,7 +207,7 @@ signedTx.outputs.length
 
 //remember, you can call .hex on any bitcoin-s data structure to get the hex representation!
 signedTx.hex
-// res4: String = 02000000014527bda34e950269400ffb9e3be02830f082ed613850336df53212f7140fe856000000006a47304402200644b52f1a4e1c8168c36dcfe3f48b93b83a54142004ad829fb18992164f441a02201cab7dcff36ef904ff949f3a3b9a82621708ade5e2e46e1d634200aeab78a3ce012103718fc86b51981341df9d52e378d3c1569f8685b14d2d1ff0971be05275518ec6000000000288130000000000001976a914d96bea9b9a317419692c2f21d6c7c83c9402fbef88aca7120000000000001976a9141f9711d4c6689274b245e2a01baabe6726df41af88ac00000000
+// res4: String = 02000000011206befb771c622df00a52191372af869fdb9fe72f377f6d5cc616ca5c9edb9c000000006a47304402201f6ea4738765bb31c95452b182ba1649da8765e3d3ddf9302d0be2ef80db5aec0220049916654e42977ebbcc53db180e3826eb06cf0049f1138227ccc475b2d068e80121039cbb08b80e783529044d50bc6800add8a2df4e9d5987cf7f5bdeda8829fea831000000000288130000000000001976a9141b8c5ca7b58f891d3b976b7630340de2380783b088aca7120000000000001976a9145dacba7eb3702cfe1e9679c53330f1c8e751a17488ac00000000