OutCast3k / coinbin

Javascript Bitcoin Wallet. Supports Multisig, Stealth, HD, SegWit, Bech32, Time Locked Addresses, RBF and more!
https://coinb.in/
MIT License
906 stars 621 forks source link

Segwit transactions created from the wallet feature are not being signed #117

Closed AKJ closed 7 years ago

AKJ commented 7 years ago

Steps to Reproduce

  1. Create a wallet on coinb.in with an email address / password, checking the box to use a segwit address.
  2. Fund the segwit address.
  3. Click the "spend" tab and try to send coins to another address.

Expected Behavior

A TX for your transaction is generated and the coins sent.

Actual Behavior

Coinb.in returns this: Error: 64: scriptsig-not-pushonly.

Further Notes

There also appears to be no method of obtaining the redeem script of a segwit address generated with this feature. Verifying the public or private keys of the segwit address yield a completely different address with a zero balance.

OutCast3k commented 7 years ago

Sorry about this it appears the wrong version went live (very embarrassing). I've added the missing code to complete the signing procedure - everything seems to be working now. Any problems re-open this ticket.

AKJ commented 7 years ago

When trying to send funds, I now get this message: "Tx decode failed."

I also cannot see the redeem script for my segwit address created in the #wallet, and the keys that do show up point to a different btc address when verified. I can create a separate issue for this if it indeed is a bug.

Just also want to say thanks for making this web app. Apart from these few hiccups it's worked like a charm for me!

OutCast3k commented 6 years ago

A few things:

Before we continue, first understand that "addresses" are a hashed public key. Public keys comes from its corresponding private key.

SegWit addresses use the same public/private keys that (compressed) legacy addresses use, there is no difference between them.

The redeemscript maybe missing and I will add it as requested - but its not really needed.


After your initial submission I fixed the missing code and I made two test transactions using https://coinb.in

ca88bf6e1cc4771084f9ffa53b047cb8a594a081de330932938d9b66d64d69ba and 4ec6fe3033102ea031449f07f33d48da561d8163ef721723d380b7b392736948

These transactions have been accepted by the network. Can you please make sure your cache is cleared and try again? With that being said, I've prepared another test case with you suggesting its still not working.

These details have been generated as followed:

Coinbin Login Email: OutCast3k@bitcoin.org Pass : 1234567890 Segwit : True

Address Details Address: 3G1EX3kQQAkhvJ3j7qqeuA6r7Ban86hrEJ Private: KxkKAUv7LxB3qLDSDuz5PnUnEcfGMPS8iPzfKvFivxTSuhquo4sK Public : 03f0273f2d540274eef0c9f543af3435a1cdc461b2e5fc583a560a96e6b7464e79 Input: dac8b911c2ce221c0930b21159a70bbfc6f2d29c2f34a6a55f9bcda6fd3baabd

Transaction Send: 1JMykgvX2bKhpkSUzEHVekxNFtNcqNXb3K Amount: 0.00117977 BTC

Transaction ID: c4b917107c1f9875485600445f6adbcbfd7e950759aaaf29968cedd5c2940913

As you can see the payment has been sent, no changes have be made to the site or git repo (can be confirmed by validating the sha1sum manually)

Can I please ask that you confirm your cache is cleared and that you try again. Should it fail, please provide the "hex encoded" transaction it provides when a transaction fails to broadcast.

Thanks

AKJ commented 6 years ago

Thanks for your patience with my imperfect understanding of Bitcoin. Here is a transaction I just tried sending that yielded the same error.

010000000001024b85a8e6d9eb70bb0b1167bb4bba79fe86d439052af9ede1c9a394bdd341d9dd00000000171600148c41b982d56d98a4017199edc8e684eeacf2e4edffffffff269e44d4098d64345b79a34241492ad5485035948804eaaf011f1c66e2ad5ce800000000171600148c41b982d56d98a4017199edc8e684eeacf2e4edffffffff03e0930400000000001976a9147e333b15ef3f5ce73837b5e68e7d3b94d5f2b07188acde872b00000000001976a9148b0a0895cedb9fdd47ce09c778413f56228aecc588ac010000000000000017a914bed9ab01d1a0256fab5a0326951fbd9fdc6b79478702483045022100e33f1a642fa40d39f90d5c05f83266df0b9ae3b2fff0a2553c2aa4099b960af3022026f028c6b03121b9c9a0c727cc93b9ca800b175eef04c5b6d656ff087d2b3a19012102de3d0b2c166f43281f8900b6f28ec81d93d96f374e1a6a191c6b82fe1769c4bd02483045022100e33f1a642fa40d39f90d5c05f83266df0b9ae3b2fff0a2553c2aa4099b960af3022026f028c6b03121b9c9a0c727cc93b9ca800b175eef04c5b6d656ff087d2b3a19012102de3d0b2c166f43281f8900b6f28ec81d93d96f374e1a6a191c6b82fe1769c4bd0247304402203861647dd16a0d793bf8f62318fa65be22ad3237f44af5c423a39fb62b3f48a302202652449b1cfb6b21734d4fdede8462aa818bcf4018bf6041d64a83e8629c0bd5012102de3d0b2c166f43281f8900b6f28ec81d93d96f374e1a6a191c6b82fe1769c4bd02483045022100e33f1a642fa40d39f90d5c05f83266df0b9ae3b2fff0a2553c2aa4099b960af3022026f028c6b03121b9c9a0c727cc93b9ca800b175eef04c5b6d656ff087d2b3a19012102de3d0b2c166f43281f8900b6f28ec81d93d96f374e1a6a191c6b82fe1769c4bd02483045022100e33f1a642fa40d39f90d5c05f83266df0b9ae3b2fff0a2553c2aa4099b960af3022026f028c6b03121b9c9a0c727cc93b9ca800b175eef04c5b6d656ff087d2b3a19012102de3d0b2c166f43281f8900b6f28ec81d93d96f374e1a6a191c6b82fe1769c4bd0247304402203861647dd16a0d793bf8f62318fa65be22ad3237f44af5c423a39fb62b3f48a302202652449b1cfb6b21734d4fdede8462aa818bcf4018bf6041d64a83e8629c0bd5012102de3d0b2c166f43281f8900b6f28ec81d93d96f374e1a6a191c6b82fe1769c4bd00000000

On Thu, Sep 21, 2017 at 4:05 AM, OutCast3k notifications@github.com wrote:

A few things:

Before we continue, first understand that "addresses" are a hashed public key. Public keys comes from its corresponding private key.

SegWit addresses use the same public/private keys that (compressed) legacy addresses use, there is no difference between them.

The redeemscript maybe missing and I will add it as requested - but its not really needed.

After your initial submission I fixed the missing code and I made two test transactions using https://coinb.in

ca88bf6e1cc4771084f9ffa53b047cb8a594a081de330932938d9b66d64d69ba and 4ec6fe3033102ea031449f07f33d48da561d8163ef721723d380b7b392736948

These transactions was accepted by the network. Can you please make sure your cache is cleared and try again? With that being said, I've prepared another test case with you suggesting its still not working.

These details have been generated as followed:

=== Coinbin Login === Email: OutCast3k@bitcoin.org Pass : 1234567890

=== Address Details === Segwit : True Address: 3G1EX3kQQAkhvJ3j7qqeuA6r7Ban86hrEJ Private: KxkKAUv7LxB3qLDSDuz5PnUnEcfGMPS8iPzfKvFivxTSuhquo4sK Public : 03f0273f2d540274eef0c9f543af3435a1cdc461b2e5fc583a560a96e6b7 464e79

=== Transaction === Send: 1JMykgvX2bKhpkSUzEHVekxNFtNcqNXb3K Amount: 0.00117977 Transaction ID: c4b917107c1f9875485600445f6adb cbfd7e950759aaaf29968cedd5c2940913

As you can see the payment has been sent, no changes have be made to the site or git repo (can be confirmed by validating the sha1sum manually)

Can I please ask that you confirm your cache is cleared and that you try again. Should it fail, please provide the "hex encoded" transaction it provides when a transaction fails to broadcast.

Thanks

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OutCast3k/coinbin/issues/117#issuecomment-331083546, or mute the thread https://github.com/notifications/unsubscribe-auth/ADc54_Qjzs1oU3qveevYDnf1H51QHjErks5skhjdgaJpZM4PcziS .

OutCast3k commented 6 years ago

This should be working now, it'd be awesome if you could give it a test.

Please remember to clear your cache before testing :)

AKJ commented 6 years ago

Yes, it now works as expected. Thanks again!

On Thu, Sep 21, 2017 at 10:07 AM, OutCast3k notifications@github.com wrote:

This should be working now, i'd be awesome if you could give it a test.

Please remember to clear your cache before testing :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OutCast3k/coinbin/issues/117#issuecomment-331166845, or mute the thread https://github.com/notifications/unsubscribe-auth/ADc54-0OjNk86YZmNRpY2TgSgL9WdDJSks5skm0zgaJpZM4PcziS .