({{, (RefLink[BlockchainTransactionSign, paclet:ref/BlockchainTransactionSign])[obj,key]
digitally signs a blockchain transaction using the specified private key.}, {, (RefLink[BlockchainTransactionSign, paclet:ref/BlockchainTransactionSign])[obj,{(Subscript[key, 1]),(Subscript[key, 2]),…}]
digitally signs a transaction using all the keys (Subscript[key, i]).}})

OpenersNotesSection(Spacer1)Details

In (RefLink[BlockchainTransactionSign, paclet:ref/BlockchainTransactionSign])[obj,…], obj is a (RefLink[BlockchainTransaction, paclet:ref/BlockchainTransaction]) object.

The key for (RefLink[BlockchainTransactionSign, paclet:ref/BlockchainTransactionSign]) must be a (RefLink[PrivateKey, paclet:ref/PrivateKey]) object or a hex string representing a private key.

The type of private key must be appropriate for the blockchain being used.

(RefLink[BlockchainTransactionSign, paclet:ref/BlockchainTransactionSign]) returns a blockchain transaction object with (RefLink[True, paclet:ref/True]) as the value of its property "Signed".

For an Ethereum (RefLink[BlockchainTransaction, paclet:ref/BlockchainTransaction]) object, (RefLink[BlockchainTransactionSign, paclet:ref/BlockchainTransactionSign]) will return an object with the added property "RawTransaction".

For a Bitcoin (RefLink[BlockchainTransaction, paclet:ref/BlockchainTransaction]) object, (RefLink[BlockchainTransactionSign, paclet:ref/BlockchainTransactionSign]) will use the value of the property "SignatureHash" provided with each input to determine the appropriate digital signature method.

Multiple private keys can be given in any order.

OpenersPrimaryExamplesSection(Spacer1)Examples  (3)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Create a Bitcoin Pay-to-Public-Key-Hash (RefLink[BlockchainTransaction, paclet:ref/BlockchainTransaction]):

btcTX=BlockchainTransaction[<|"Inputs"->{<|"TransactionID"->"9bef194418607318673caaf8f45d52fb60e8c8586e6ce8414c377a279ca14399","Index"->0|>},"Outputs"->{<|"Amount"->(QuantityPrefix[0.0002`, "฿" , bitcoins, "Bitcoins"]),"Address"->"munDTMqa9V9Uhi3P21FpkY8UfYzvQqpmoQ"|>,<|"Amount"->(QuantityPrefix[0.16223`, "฿" , bitcoins, "Bitcoins"]),"Address"->"mo9QWLSJ1g1ENrTkhK9SSyw7cYJfJLU8QH"|>},"BlockchainBase"->{"Bitcoin","Testnet"}|>]

Sign the transaction object using a WIF-encoded private key:

BlockchainTransactionSign[btcTX,"6a25394168f52156c58bbf4924e8c82da0d8bcb581f8baac6d67a5d3556a5e76"]

Create an Ethereum (RefLink[BlockchainTransaction, paclet:ref/BlockchainTransaction]):

ethTX=BlockchainTransaction[<|"BlockchainBase"->{"Ethereum","Testnet"},"TransactionCount"->58,
"GasPrice"->Quantity[1,"GWei"],
"Address"->"3535353535353535353535353535353535353535",
"Amount"->Quantity[0.0002,"Ethers"]|>]

Sign the transaction object:

BlockchainTransactionSign[ethTX, "CAAB89C53A5C8344E7AD79C4EE99B764DDA09F7B1083779470F6C14CA919757D"]

OpenersExampleSection1(Spacer1)Scope  (1)

OpenersExampleSubsection0(Spacer1)Multiple Key Signatures  (1)

Sign a Bitcoin transaction with multiple keys:

btcTX=BlockchainTransaction[\[LeftAssociation]"BlockchainBase"->{"Bitcoin","Testnet"},
"Inputs"->{
\[LeftAssociation]"TransactionID"->"a6736e807fa84219b6b41e250faf6393a76f055feeba95014458a583463143e4","Index"->1\[RightAssociation],
\[LeftAssociation]"TransactionID"->"a6736e807fa84219b6b41e250faf6393a76f055feeba95014458a583463143e4","Index"->0\[RightAssociation]
},"Outputs"->{
\[LeftAssociation]"Amount"->0.0023,"Address"->"mkHGstoUaDWzGxag29MEnp8WJPpfA45omK"\[RightAssociation],
\[LeftAssociation]"Amount"->0.0015,"Address"->"mgPhDaCzXcm4gmkxfz9sZKvpabmNGdLj52"\[RightAssociation]
}\[RightAssociation]]

BlockchainTransactionSign[btcTX,{"cVN2fsWXoxMkPGx5EL7X6grykQ3VSDfHPUg3CJhD8AC9pJ5y8Nhi","cSdsGz3xhvFZAXW9U3cpMKCnGW5DV3Frfp921wnFk5nvWttByMT1"}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[BlockchainTransactionSubmit, paclet:ref/BlockchainTransactionSubmit])  ▪  (RefLink[BlockchainTransaction, paclet:ref/BlockchainTransaction])  ▪  (RefLink[GenerateAsymmetricKeyPair, paclet:ref/GenerateAsymmetricKeyPair])  ▪  (RefLink[BlockchainKeyEncode, paclet:ref/BlockchainKeyEncode])  ▪  (RefLink[GenerateDigitalSignature, paclet:ref/GenerateDigitalSignature])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Working with Blockchains, paclet:guide/Blockchain])}})}})