Comments (15)
@ofek, @fyookball, @bjarnemagnussen, wanted to let you know about the bounty in case you were interested. Thank you for your help already.
from bitcash.
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.
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.
Library is now based on the original bit. Will work from there.
from bitcash.
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.
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.
i took a look at your transaction.py and it seems to define SIGHASH_FORKID constant and then never uses it ?
from bitcash.
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.
I now have just a CHECK(MULTI)SIG error which I am working through, looking at the spec closely.
from bitcash.
@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.
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.
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.
you could also create the same TX in electron cash and step through to see where your code diverges
from bitcash.
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.
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)
- message option (OP_RETURN) not working HOT 4
- Issue with unspents HOT 6
- send() no longer pulls in unspents HOT 5
- ValueError: "0" is an invalid base58 encoded character. on PrivKeyTestnet HOT 2
- Remove hex_to_wif() from documentation HOT 1
- ConnectionError: All APIs are unreachable HOT 6
- How to sweep all BTC from wallet HOT 1
- ERROR: Could not build wheels for coincurve HOT 1
- Unsupported hash type ripemd160 HOT 9
- Cash Tokens support CHIP-2022-02-CashTokens HOT 1
- wallet balance not accurate HOT 1
- wallet balance not synced (same error as closed ticket) HOT 3
- Difference from `bit` HOT 5
- Cash address contains uppercase and lowercase characters HOT 3
- Unable to send more than one transaction within a block HOT 2
- Upgrade CI workflow actions
- Error while signing transaction: nft_commitment HOT 7
- How can you sign multiple inputs originating from various addresses? HOT 4
- Chain verification missing HOT 2
- Bitcash not creating valid transactions despite returning a TxID HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bitcash.