Skip to content
New issue

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

pubkey OP_CHECKSIG inputs spending #764

Closed
CryptoManiac opened this issue Jul 21, 2014 · 10 comments
Closed

pubkey OP_CHECKSIG inputs spending #764

CryptoManiac opened this issue Jul 21, 2014 · 10 comments

Comments

@CryptoManiac
Copy link

Hi. It's strange but it seems that transaction signing code doesn't make any difference between pubkey and pubkey_hash type of inputs.

As the result, incorrect signatures are generated for pubkey inputs, and instead of this script

signature pubkey OP_CHECKSIG

we're getting this one

signature pubkey pubkey OP_CHECKSIG

Example is attached below.

Signed by Electrum (invalid signature):

e5739ac6b238662774d628b8f4f18c8c02104bc631c7cd1d487c75f4e88460ba
0f000000
8a
47
30440220431f9e23531c74c357464a446b04b9ec47571e16c2862430dab1c800a74c4c2d0220671fd8949ea6d41cce38f92514404e77c58af1b588025a053275cedbecbe98c301 41043b253cc0b5c8ce26f24b84bb955bec955cbb4643f19ab7ea073884f22874abdafc42040b97efec3c9eeb29ce69022a96cc1772f8bc805f78af0d3dc5c441db5f
ffffffff

Signed by daemon (valid signature):

e5739ac6b238662774d628b8f4f18c8c02104bc631c7cd1d487c75f4e88460ba
0f000000
4a
49
3046022100fc3c3595892fa37fc038d6433fe112e36e7b836367c828ef1f9204fbfc0a428b022100aa8790a15bbe48e367dc1201b0671cc4591ccfdd36eff9e985db6f48a68c9ed701
ffffffff

You can see that electrum treats a pubkey input as pubkey_hash, and adds a public key to the end of scriptSig value.

@dabura667
Copy link
Contributor

What version are you using? 1.9.8? current master HEAD?

@CryptoManiac
Copy link
Author

@dabura667

I've cloned current master HEAD.

@dabura667
Copy link
Contributor

Ok, you should try it with 1.9.8 under the "Releases." tab. It might work for you there if this is something you need urgently.

Currently there is a lot of housekeeping going on in preparation for 2.0 release, so master HEAD is not always stable.

Hopefully this will be addressed before the 2.0 release.

@CryptoManiac
Copy link
Author

I think I found a solution. We need to add output type in the result of tx.get_outputs and return this value from the get_unspent_coins function. This should make tx output type available for transaction serialize() method. Maybe I'll try this a bit later. :)

@CryptoManiac
Copy link
Author

1.9.8 doesn't work too. It's not something like a bug, client simply has no idea how to spend them. So applying dirty hacks to get_outputs/get_unspent_coins/serialize and pay_script is necessary to spend pubkey inputs.

Well, these hacks are working for me. :)

https://explorer.novaco.in/tx/dd6dd2f0d49a5d332c4642b8220b81dfb16697918d4d555215bf396480ca3ecf

@ecdsa
Copy link
Member

ecdsa commented Sep 2, 2014

how did you generate the unsigned transaction? not in electrum I guess?

@CryptoManiac
Copy link
Author

@ecdsa
Hi. Nope, transaction was created in electrum.

@ecdsa
Copy link
Member

ecdsa commented Sep 5, 2014

how did you import the address?

@ecdsa
Copy link
Member

ecdsa commented Sep 8, 2014

electrum addresses are never pay-to-pubkey addresses. so I don't see how the transaction could have been created in electrum, unless you somehow imported the address. please explain.

@ecdsa
Copy link
Member

ecdsa commented Sep 15, 2014

after some googling, the transaction input that the OP is trying to spend is from NovaCoin.
closing this bug, because I do not know how the address was imported

@ecdsa ecdsa closed this as completed Sep 15, 2014
jhoenicke pushed a commit to jhoenicke/electrum that referenced this issue Jun 28, 2018
Modify translatable strings with "Electron Cash"
jhoenicke pushed a commit to jhoenicke/electrum that referenced this issue Jun 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants