Giter VIP home page Giter VIP logo

Comments (6)

reynoldxu avatar reynoldxu commented on June 30, 2024

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.

reynoldxu avatar reynoldxu commented on June 30, 2024

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.

vbuterin avatar vbuterin commented on June 30, 2024

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.

reynoldxu avatar reynoldxu commented on June 30, 2024

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.

vbuterin avatar vbuterin commented on June 30, 2024

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.

reynoldxu avatar reynoldxu commented on June 30, 2024

I understand,thanks .

from pybitcointools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.