BlockchainTransactionSign (for Bitcoin)
BlockchainTransactionSign[obj,key]
digitally signs a Bitcoin blockchain transaction using the specified private key.
BlockchainTransactionSign[obj,{key1,key2,…}]
digitally signs a transaction using all the keys keyi.
BlockchainTransactionSign[obj,{assoc1,assoc2,…}]
digitally signs a transaction where associ contains Pay-to-Script-Hash data.
Details
- Digitally signs a Bitcoin blockchain transaction using the specified private key.
- In BlockchainTransactionSign[obj,…], obj is a BlockchainTransaction object.
- The key for BlockchainTransactionSign must be a PrivateKey object or a hex string representing a private key.
- BlockchainTransactionSign returns a blockchain transaction object with True as the value of its property "Signed" and with the added property "RawTransaction".
- For a Bitcoin BlockchainTransaction object, 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.
- If an input of the transaction belongs to a Pay-to-Script-Hash address, the association in the list must have the following elements:
-
"Data" list of elements used during the execution of the script "Script" valid Bitcoin script - "Data" may contain PrivateKey objects, hexadecimal strings or Bitcoin script opcodes according to the script. PrivateKey objects will be used for signing the corresponding input. "Script" is a valid Bitcoin script composed of opcodes and hexadecimal strings.
- If an input of the transaction is related to a multi-signature script, the association in the list must have the following elements:
-
"PrivateKeys" list of PrivateKey objects used for signing "PublicKeys" list of all the PublicKey objects used in the script "RequiredKeys" minimum number of private keys required
Examples
open allclose allBasic Examples (1)
Create a Bitcoin Pay-to-Public-Key-Hash BlockchainTransaction:
Sign the transaction object using a WIF-encoded private key:
Scope (3)
Pay-to-Script-Hash Input (1)
Sign a Bitcoin transaction with an input that belongs to a Pay-to-Script-Hash address:
The association must include the "Data" required to run the "Script" used when creating the Pay-to-Script-Hash address:
The PrivateKey object in "Data" was used to create a signature of the transaction that appears in the final transaction object:
Multi-signature Input (1)
Applications (1)
Create a Bitcoin Pay-to-Public-Key-Hash BlockchainTransaction:
Sign the transaction object using a WIF-encoded private key:
Possible Issues (1)
Incorrect Private Key (1)
Providing an invalid private key will return a $Failed output:
Text
Wolfram Research (2019), BlockchainTransactionSign, Wolfram Language function, https://reference.wolfram.com/language/ref/blockchain/BlockchainTransactionSign-Bitcoin.html.
CMS
Wolfram Language. 2019. "BlockchainTransactionSign." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/blockchain/BlockchainTransactionSign-Bitcoin.html.
APA
Wolfram Language. (2019). BlockchainTransactionSign. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/blockchain/BlockchainTransactionSign-Bitcoin.html