GithubHelp home page GithubHelp logo

Comments (15)

 avatar commented on May 20, 2024

@ofek, @fyookball, @bjarnemagnussen, wanted to let you know about the bounty in case you were interested. Thank you for your help already.

from bitcash.

bjarnemagnussen avatar bjarnemagnussen commented on May 20, 2024

Since the segwit branch contains a lot of segwit soecific code I think that the cleanest way would be to start with ofek's bit branch and then change the signature generation algorithm found inside create_p2pkh_transaction with the bip-143 part of my segwit branch. BTW, ofek's original bit branch does not yet support multisig/p2sh.

from bitcash.

 avatar commented on May 20, 2024

Ah, heh. I guess that makes more sense then.

For me, I'm not worried about script hash, multisig, or anything like that.

I appreciate your feedback. If no one jumps on this today I'll probably try that tomorrow.

Thank you!

from bitcash.

 avatar commented on May 20, 2024

Library is now based on the original bit. Will work from there.

from bitcash.

 avatar commented on May 20, 2024

I tried to broadcast a transaction with electron-cash and it said FORKID had to be used. Understandable. I added that in and it says the same thing. Also with blockdozer it says I must use the FORKID. I am not sure if they are throwing a generic error message or if it's not working how I expect it to.

Judging by some older testing, it seems like multiple error types are possible: https://bitcoin.stackexchange.com/questions/63340/cannot-make-valid-bitcoin-cash-transaction/63345

I know I need to make it BIP-143, I am first wondering how I can inspect the signature and whether these error codes are generic or specific and something else is wrong.

from bitcash.

 avatar commented on May 20, 2024

I believe I've implemented in the logic. I am hardcoding sequence numbers as I don't know their purpose and everywhere I've seen has them set at 2^32.

In e126766 I am able to generate transactions again. blockdozer says the SIGHASH_FORKID is bad, electron-cash says it's missing inputs.

Deserializing in electron-cash looks just fine. I don't know if any good utilities to inspect signatures with.

Would appreciate any help you can give.

from bitcash.

fyookball avatar fyookball commented on May 20, 2024

i took a look at your transaction.py and it seems to define SIGHASH_FORKID constant and then never uses it ?

from bitcash.

 avatar commented on May 20, 2024

Thanks for taking a look. Yes, I have it defined as a stub. I will use it in the future but Python 3 doesn't have bitwise operations on bytes objects. Instead, I am setting 0x41 instead of 0x01 as the hash type.

from bitcash.

 avatar commented on May 20, 2024

I now have just a CHECK(MULTI)SIG error which I am working through, looking at the spec closely.

from bitcash.

 avatar commented on May 20, 2024

@bjarnemagnussen is this correct? https://github.com/bjarnemagnussen/bit/blob/segwit/bit/transaction.py#L444

I can see that you have scriptCode_len before scriptCode. That does not line up with the specification from what I can tell: https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki

Not sure if there's a bug or if I am missing something.

from bitcash.

 avatar commented on May 20, 2024

Pushed a couple small tweaks and am stopping for the night. No luck so far. Signature is still bad.

I found the "official" Bitcoin Cash signature doc which looks identical to BIP-143 from what I can tell.

https://github.com/Bitcoin-UAHF/spec/blob/master/replay-protected-sighash.md

from bitcash.

bjarnemagnussen avatar bjarnemagnussen commented on May 20, 2024

Hey @teran-mckinney. Regarding the scriptCode_len apperaing before scriptCode: The reason is that scriptCode is used in the way that P2SH redeemscript are used in scriptSigs. The redeemscript is provided as a single element in a script with a simple push of 25 bytes. You can see that the scriptCode you reference to in the link under point 5 starts with the script push opcode of 25 bytes (0x19 in hex) and is part of the sciptCode. The scriptCode_len contains exactly this value 0x19. I hope that makes sense?

//Edit2: Actually also using P2PKH I think you need the scriptCode_len. See this step-by-step but using the old signature scheme: https://bitcoin.stackexchange.com/questions/32628/redeeming-a-raw-transaction-step-by-step-example-required

from bitcash.

fyookball avatar fyookball commented on May 20, 2024

you could also create the same TX in electron cash and step through to see where your code diverges

from bitcash.

 avatar commented on May 20, 2024

Thank you, to both of you. I'm narrowing down the only difference to the hashOuputs. The source is the same, the hash is different. I think there's some slight nuance I'm missing.

from bitcash.

 avatar commented on May 20, 2024

It works!!!

Thank you all for your help. You can see the stupid bug that was there.

Real pain to debug. Took me a few days. I'm glad to have this working so I can start using Bitcoin Cash now.

from bitcash.

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.