GithubHelp home page GithubHelp logo

Comments (8)

mccwdev avatar mccwdev commented on August 22, 2024 1

ah sorry you have bad luck I guess, this issue is fixed in commit abadf5e
So the latest master branch shouldn't have this problem. A new version will be released in a couple of days.

from bitcoinlib.

arezasl avatar arezasl commented on August 22, 2024

tx2.raw_hex() is:

01000000019e0515496f6f23c20943e3139be841cd8d60f565d29e07b05a7158f6873bb32c010000006a47304402206784e3a2b1fd27267e5d95b181d30725aa2a186bfb259771d0f57977a5e669f90220290382c3c79e62b8c78095442b7e6d140cef76209c806a8fddce4ed3992e873401210342f8a3207d65106533fdb9f949f9de8ecb94c9e1bb2d7e6bcc399e9f8f8cf29affffffff028cc17600000000001976a914c4adc1634ddeb6cd1626257ab940d6cdfa2c70e188ac4a360d00000000001976a9144d7f5d53b87046df315c70214aeeb11ae008da4a88ac00000000

from bitcoinlib.

mccwdev avatar mccwdev commented on August 22, 2024

If I deserialize the transaction, the script type of the input is sig_pubkey so not multisignature:

Transaction ece19cff8580b948aab07bc727d9757b9f624f163d049a3e772b7cfa5e47c87f
Date: None
Network: testnet
Version: 1
Witness type: legacy
Status: new
Verified: False
Inputs

  • muSFsHPKzWzaza2nD2j3XWY7HCJUKbamq3 0 2cb33b87f658715ab0079ed265f5608dcd41e89b13e34309c2236f6f4915059e 1
    Script type: sig_pubkey (legacy), signatures: 1 (1-of-1), not validated
    Outputs
  • mySttPdyiLvSRkp7xNt7nRoWudAkQppRup 7782796
  • mnaiuGbLZEcZAuv31WgXgKrLEpuzLX7GSc 865866
    Size: 225
    Vsize: 225
    Fee: None
    Confirmations: None

Are you sure you created 2 identical multisignature wallets? Not sure why the transaction would verify though. Could you send some example code if you keep getting this error?

from bitcoinlib.

arezasl avatar arezasl commented on August 22, 2024

When i decode the raw transaction in
BlockCypher it gives me this:

{
"addresses": [
"2NCN34Q1KGxx3iG42joU3zhC2yFxqdfqat8",
"mySttPdyiLvSRkp7xNt7nRoWudAkQppRup",
"mnaiuGbLZEcZAuv31WgXgKrLEpuzLX7GSc"
],
"block_height": -1,
"block_index": -1,
"confirmations": 0,
"double_spend": false,
"fees": 10000,
"hash": "ece19cff8580b948aab07bc727d9757b9f624f163d049a3e772b7cfa5e47c87f",
"inputs": [
{
"addresses": [
"2NCN34Q1KGxx3iG42joU3zhC2yFxqdfqat8"
],
"age": 1446415,
"output_index": 1,
"output_value": 8658662,
"prev_hash": "2cb33b87f658715ab0079ed265f5608dcd41e89b13e34309c2236f6f4915059e",
"script": "47304402206784e3a2b1fd27267e5d95b181d30725aa2a186bfb259771d0f57977a5e669f90220290382c3c79e62b8c78095442b7e6d140cef76209c806a8fddce4ed3992e873401210342f8a3207d65106533fdb9f949f9de8ecb94c9e1bb2d7e6bcc399e9f8f8cf29a",
"script_type": "pay-to-script-hash",
"sequence": 4294967295
}
],
"outputs": [
{
"addresses": [
"mySttPdyiLvSRkp7xNt7nRoWudAkQppRup"
],
"script": "76a914c4adc1634ddeb6cd1626257ab940d6cdfa2c70e188ac",
"script_type": "pay-to-pubkey-hash",
"value": 7782796
},
{
"addresses": [
"mnaiuGbLZEcZAuv31WgXgKrLEpuzLX7GSc"
],
"script": "76a9144d7f5d53b87046df315c70214aeeb11ae008da4a88ac",
"script_type": "pay-to-pubkey-hash",
"value": 865866
}
],
"preference": "medium",
"received": "2018-12-04T21:11:04.602281723Z",
"relayed_by": "54.234.87.96",
"size": 225,
"total": 8648662,
"ver": 1,
"vin_sz": 1,
"vout_sz": 2
}


and its correct, input, outputs and amounts.i'm not sure why you get this sig_pubkey address

Scenario:
`
#generate 3 private keys [pk1, pk2, pk3]
k1 = HDKey(network=NETWORK)
#create multisig wallet for each key and import cosigners #pk.account_multisig_key().wif_public()
w1 = HDWallet.create_multisig('2of3_cosigner%s'%pk1.public_hex[3:13] ,
sigs_required=2, key_list=klist,
network=NETWORK)
#so on for w2 and w3
nk1 = self.w1.new_key()
nk2= self.w2.new_key()
nk3= self.w3.new_key()
assert nk1.wif == nk2.wif == nk3.wif is True

#sent some amount to nk3.address
w1.utxos_update()
utxos = w1.utxos()[0]
input_arr = [(utxo['tx_hash'], utxo['output_n'], utxo['key_id'], utxo['value'])]
estimated_fee = 10000
output_arr = [(address1, utxo['value'] - estimated_fee),(address2, amount)]
t = w1.transaction_create(output_arr, input_arr,fee=estimated_fee)
t.sign() #True
w2.utxos_update()
t2 = w2.transaction_import_raw(t.raw())
t2.sign() #True
t2.verify() #True
t2.send() #False
"16: mandatory-script-verify-flag-failed (Script evaluated without error but finished with a false/empty top stack element). Code:-26"

from bitcoinlib.

mccwdev avatar mccwdev commented on August 22, 2024

You seem to use an old version of BitcoinLib, which had a key ordering problem if I remember correctly. So adding a sort_keys=True might help, but it's better to use version 4.2 of the library.

In the new version you need to add a cosigner ID so a correct BIP45 path can be created. With the code below I was able to create a transaction, see https://chain.so/address/BTCTEST/2N3q97e2VEt4txibcTp1PmdEDLp1hAk8bTW

NETWORK = 'testnet'
pk1 = HDKey(
'tprv8ZgxMBicQKsPdkUuai97Zd6QudwqAfsr6GhkVSFdGkvE2m1sRZmUbQx9tXYUZCB2HPDBUKBZmzTNjihUmAKtmoxiTZwAoewU7sUSA6SFNAf')
pk2 = HDKey(
'tprv8ZgxMBicQKsPdbxk7JdmFjxf2fRJd7z4heZcv7ocMoWpo68tkwEujkdNYsUt1BJUxUe3sL8LXXyZDtNyqbzSK1ufi9b1gqH9YKW5EZvNYd7')
pk3 = HDKey(
'tprv8ZgxMBicQKsPd4G4s5cWt3KBqUjGg1cj6XXhABpvYqz7dHnZ1M9sFf2hPvxYN7bvemTV23ht6V8bTFfPZrc75V1kavPCnS9JvnbVrZBWjMR')

w1 = HDWallet.create_multisig('2of3_cosigner%s' % pk1.public_hex[3:13], sigs_required=2,
                              keys=[pk1, pk2.account_multisig_key().wif_public(),
                                    pk3.account_multisig_key().wif_public()],
                              network=NETWORK, databasefile=test_database)
w2 = HDWallet.create_multisig('2of3_cosigner%s' % pk2.public_hex[3:13], sigs_required=2,
                              keys=[pk1.account_multisig_key().wif_public(), pk2,
                                    pk3.account_multisig_key().wif_public()],
                              network=NETWORK, databasefile=test_database)
w3 = HDWallet.create_multisig('2of3_cosigner%s' % pk3.public_hex[3:13], sigs_required=2,
                              keys=[pk1.account_multisig_key().wif_public(), pk2.account_multisig_key().wif_public(),
                                    pk3],
                              network=NETWORK, databasefile=test_database)
nk1 = w1.new_key(cosigner_id=0)
nk2 = w2.new_key(cosigner_id=0)
nk3 = w3.new_key(cosigner_id=0)
assert nk1.wif == nk2.wif == nk3.wif

w1.utxos_update()
utxo = w1.utxos()[0]
input_arr = [(utxo['tx_hash'], utxo['output_n'], utxo['key_id'], utxo['value'])]
estimated_fee = 10000
output_arr = [(w1.get_key(cosigner_id=0).address, utxo['value'] - estimated_fee)]
t = w1.transaction_create(output_arr, input_arr, fee=estimated_fee)
t.sign()
w2.utxos_update()
t2 = w2.transaction_import_raw(t.raw())
t2.sign()
t2.verify()
t2.send()
t2.info()

from bitcoinlib.

arezasl avatar arezasl commented on August 22, 2024

i was using version 4.1.0 and upgraded to 4.2.0 as you suggested,
but i could'nt test your solution,
now the problem is utxos_update(), it returns:

File "/usr/local/lib/python2.7/site-packages/bitcoinlib/wallets.py", line 2429, in utxos_update
transaction_record.confirmations = utxo['confirmations']
AttributeError: 'NoneType' object has no attribute 'confirmations'

from bitcoinlib.

arezasl avatar arezasl commented on August 22, 2024

Thanks for responding so quickly
Yes ,i noticed that in my wallet.py, i'll wait for the next version i guess.

from bitcoinlib.

mccwdev avatar mccwdev commented on August 22, 2024

Fixed in latest release, please let me know when you still encounter problems

from bitcoinlib.

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.