We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First, generate a P2SH multisig address including some custom content.
script := txscript.NewScriptBuilder() // custom content
script.AddOp(txscript.OP_HASH160) script.AddData(Hash_Preimage_R) script.AddOp(txscript.OP_EQUALVERIFY)
// standard content
script.AddOp(txscript.OP_2) script.AddData(aPubKey) script.AddData(bPubKey) script.AddOp(txscript.OP_2) script.AddOp(txscript.OP_CHECKMULTISIG) return script.Script()
Then got an address like 2Mv12R1VNdiSzeFiDxs2WVxeBZzTScrs8Q6
2Mv12R1VNdiSzeFiDxs2WVxeBZzTScrs8Q6
4. How to write the unlocking script? Currently, I'm using txscript.SignTxOutput reference from https://sourcegraph.com/github.com/btcsuite/btcd/-/blob/txscript/sign_test.go#L344
txscript.SignTxOutput
// signature ... sigScript, err := txscript.SignTxOutput(&chaincfg.TestNet3Params, tx, 0, scriptPkScript, txscript.SigHashAll, mkGetKey(map[string]addressToKey{ address1.EncodeAddress(): {key1.PrivKey, true}, address2.EncodeAddress(): {key2.PrivKey, true}, }), mkGetScript(map[string][]byte{ scriptAddr.EncodeAddress(): custom_pkScript, }), nil) if err != nil { fmt.Println("Sign has wrong : ", err) return } tx.TxIn[0].SignatureScript = sigScript
Anybody have some idea? Thank you very much!
The text was updated successfully, but these errors were encountered:
read https://developer.bitcoin.org/devguide/transactions.html#p2pkh-script-validation to get the idea behind bitcoin script language, you should provide some op-codes result in true on stack after completely be doen.
Sorry, something went wrong.
import( "github.com/btcsuite/btcd/txscript" "github.com/btcsuite/btcd/wire" ) tx := wire.NewMsgTx(2) tx.AddTxOut(wire.NewTxOut(int64(*outputvalueFlag*1e8), script())) func script() ([]byte) { script := txscript.NewScriptBuilder() script.AddInt64(1) script.AddData(bytes[0:65]) script.AddInt64(1) script.AddOp(txscript.OP_CHECKMULTISIG) return script.Script() }
No branches or pull requests
First, generate a P2SH multisig address including some custom content.
script.AddOp(txscript.OP_HASH160)
script.AddData(Hash_Preimage_R)
script.AddOp(txscript.OP_EQUALVERIFY)
script.AddOp(txscript.OP_2)
script.AddData(aPubKey)
script.AddData(bPubKey)
script.AddOp(txscript.OP_2)
script.AddOp(txscript.OP_CHECKMULTISIG)
return script.Script()
Then got an address like
2Mv12R1VNdiSzeFiDxs2WVxeBZzTScrs8Q6
4. How to write the unlocking script?
Currently, I'm using
txscript.SignTxOutput
reference from https://sourcegraph.com/github.com/btcsuite/btcd/-/blob/txscript/sign_test.go#L344Anybody have some idea? Thank you very much!
The text was updated successfully, but these errors were encountered: