Comments (6)
seems that the priv key is not right and cant import into bitcoin-qt
>>> priv = sha256('hello_xmh@shnu')
>>> priv
'1af56f41c4edf512d4b76e2f9be72966fc1c81324adcf6d13036fd0c12f7121a'
>>> pub = privtopub(priv)
>>> pub
'047b06a864fd0fd3f73b5f14cfd0c56f0b5519d05b6cc0b0d3f9dc5bd637001c723548aa4fc5b60c466bb6cd7dd83379ce2d93fbf383b7f8541719aee156d83760'
>>> addr = pubtoaddr(pub)
>>> addr
'1Pih9FmU3HN7JseN3Ca4reuq6ds1qvX6gx'
>>>
failed to import priv key to bitcoin-qt
16:29:57

importprivkey 1af56f41c4edf512d4b76e2f9be72966fc1c81324adcf6d13036fd0c12f7121a
16:29:57

Invalid private key (code -5)
when i use the priv key to send btc ,failed ,the same:
>>> h = history(addr)
>>> h
[{'output': u'914bd4c98c944a280f59d48841797a95cc1f402ef400e7e9d392e67feb67c899:1', 'block_height': 289844, 'value': 100000, 'address': u'1Pih9FmU3HN7JseN3Ca4reuq6ds1qvX6gx'}]
>>> outs = [{'value': 1000, 'address': '1NLndq3B15EfGv8GQthxhDzFNQGPbsWQyg'}]
>>> tx = mktx(h,outs)
>>> tx2 = sign(tx,0,priv)
>>> tx3 = sign(tx2,1,priv)
Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
tx3 = sign(tx2,1,priv)
File "C:\Python27\lib\site-packages\pybitcointools\transaction.py", line 252, in sign
signing_tx = signature_form(tx,i,mk_pubkey_script(address))
File "C:\Python27\lib\site-packages\pybitcointools\transaction.py", line 104, in signature_form
return serialize(signature_form(deserialize(tx),i,script))
File "C:\Python27\lib\site-packages\pybitcointools\transaction.py", line 107, in signature_form
newtx["ins"][i]["script"] = script
IndexError: list index out of range
from pybitcointools.
well,the priv key should be convert to WIF formart than it could be import into bitcoin-qt.
working on the error:
tx3 = sign(tx2,1,priv)
newtx["ins"][i]["script"] = script
IndexError: list index out of range
from pybitcointools.
Can you give me the tx that you're signing? Maybe the transaction doesn't have two inputs (inputs are zero-indexed so the first input is really input 0).
from pybitcointools.
Yes, it has only one inputs(i use a new address for test so ,it has only one input)
Tx bin is
010000000199c867eb7fe692d3e9e700f42e401fcc957a794188d4590f284a948cc9d44b910100000000ffffffff01e8030000000000001976a914ea18a38e2119616d05fbb31a2138f43565608d7c88ac00000000
Tx json is
{'locktime': 0, 'outs': [{'value': 1000, 'script': '76a914ea18a38e2119616d05fbb31a2138f43565608d7c88ac'}], 'version': 1, 'ins': [{'script': '', 'outpoint': {'index': 1, 'hash': '914bd4c98c944a280f59d48841797a95cc1f402ef400e7e9d392e67feb67c899'}, 'sequence': 4294967295L}]}
from pybitcointools.
All done!
vub@shadowcow-200 13:26:50 Bitcoin/bitcoin: ./pybtctool sign 010000000199c867eb7fe692d3e9e700f42e401fcc957a794188d4590f284a948cc9d44b910100000000ffffffff01e8030000000000001976a914ea18a38e2119616d05fbb31a2138f43565608d7c88ac00000000 0 1af56f41c4edf512d4b76e2f9be72966fc1c81324adcf6d13036fd0c12f7121a
010000000199c867eb7fe692d3e9e700f42e401fcc957a794188d4590f284a948cc9d44b91010000008a47304402207a4034f13ba188b35e72e7a2bb5328a5b89ae89f9c5aacd021aeca33a91f25f602207b7ef2142edf506d1331e4627b8eec874faf0bc6fa010c6da47ba951c40a5b320141047b06a864fd0fd3f73b5f14cfd0c56f0b5519d05b6cc0b0d3f9dc5bd637001c723548aa4fc5b60c466bb6cd7dd83379ce2d93fbf383b7f8541719aee156d83760ffffffff01e8030000000000001976a914ea18a38e2119616d05fbb31a2138f43565608d7c88ac00000000
vub@shadowcow-200 13:28:53 Bitcoin/bitcoin: ./pybtctool sign 010000000199c867eb7fe692d3e9e700f42e401fcc957a794188d4590f284a948cc9d44b910100000000ffffffff01e8030000000000001976a914ea18a38e2119616d05fbb31a2138f43565608d7c88ac00000000 0 1af56f41c4edf512d4b76e2f9be72966fc1c81324adcf6d13036fd0c12f7121a | pybtctool -s pushtx
Transaction Submitted
from pybitcointools.
I understand,thanks .
from pybitcointools.
Related Issues (20)
- will there be further development to create segwit transactions ? HOT 1
- Blockr.io will shutdown their servers!
- NameError: name 'basestring' is not defined (Python 3) HOT 1
- when i run 'pybitcointools.pushtx' ,there was a error of "Missing parents for ",please help me
- bad-txns-nonstandard-inputs HOT 1
- ResourceWarning: unclosed file
- pushtx error HOT 1
- cannot use pybtctool with python3 HOT 2
- Name Error-Name not defined
- Recommended fork? HOT 3
- Sign/Verify Litecoin message
- Point with point to concatenate HOT 2
- FileNotFoundError: [Errno 2] No such file or directory: \bitcoin\\english.txt'
- Python
- I run the unspent command it ends up empty
- file deleted
- Not finds module 'libeay32'
- ecdsa_raw_verify() with der_decode_sig() always Error, because of 27 <= None <= 34
- Vitalik is evil HOT 1
- Add bitcoin as a topic to this repository
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 pybitcointools.