Comments (3)
Imagine you have 3 transactions in the variables tx1
, tx2
and tx3
. You want to spend output 0
of tx1
, output 1
of tx2
, output 2
of tx3
. You'll go like this:
# create the transaction
unsigned = MutableTransction(version=1,
ins=[TxIn(txid=tx1.txid,
txout=0,
script_sig=ScriptSig.empty(),
sequence=Sequence.max()),
TxIn(txid=tx2.txid,
txout=1,
script_sig=ScriptSig.empty(),
sequence=Sequence.max()),
TxIn(txid=tx3.txid,
txout=2,
script_sig=ScriptSig.empty(),
sequence=Sequence.max())],
outs=[TxOut(value=100000,
n=0,
script_pubkey=P2pkhScript(pubk))],
locktime=Locktime(0))
# create a solver for each input
solver1, solver2, solver3 = ..., ..., ...
# sign the transaction providing the txouts you want to spend and the solver in the respective order
signed = unsigned.spend([tx1.outs[0], tx2.outs[1], tx3.outs[2]], [solver1, solver2, solver3])
from btcpy.
OK I get it now. It's quite complicated workflow overall though.
from btcpy.
A way to slightly improve it would be having the spend
method take as input a list of couples instead of two lists (this fix has already been in my personal TODO list for a long time). If you have any other suggestion on how to simplify this workflow it would be more than welcome!
from btcpy.
Related Issues (20)
- PrivateKey generation from entropy HOT 4
- Efficient script matching
- Type of multisig is error! HOT 2
- version 0.4, pip HOT 1
- Maybe the default version of segwit addresses should be zero HOT 1
- Pb of syntax with version 0.5 HOT 1
- Different address from which I need HOT 1
- Creating and signing the P2WSH-over-P2SH transaction HOT 11
- Difference between vsize and size property of the Transaction object? HOT 2
- to_json for block.py
- Installation and Build errors HOT 3
- Addresses generation HOT 3
- What's the difference between TimelockSolver and (Absolute)RelativeTimelockSolver?
- ScriptBuilder definition for transaction creation
- Support for taproot and Schnorr? HOT 3
- Add support for regtest bech32 addresses
- Verification of Bitcoin taproot address
- Openssl removed ripemd160
- Crypto is good HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from btcpy.