MetacoSA / NBitcoin

Comprehensive Bitcoin library for the .NET framework.
MIT License
1.88k stars 848 forks source link

Bitcoin Cash transaction gets rejected when trying to broadcast it to a node (mainnet) #962

Open harvey-green opened 3 years ago

harvey-green commented 3 years ago

Thankyou in advance for any help with this, much appreciated!

I'm running a dotnet core project with NBitcoin v5.0.71 and NBitcoin.Altcoins v2.0.26 from nuget

Following through this documented example here on my blog of creating a transaction on the BCH mainnet

https://www.dodgycoder.net/2020/02/programming-bitcoin-cash-bch-with-the-nbitcoin-dotnet-library-csharp.html

The transaction that gets created no longer is accepted by BCH nodes

Message coming out of the node is

network: bch-main message: reject : RejectPayload payload: RejectPayload magic: 3908297187 command: reject

This originally worked fine when I first wrote the blog post back in February last year

Here's an example of the raw transaction that is being rejected

{ "hash": "1d595cfcf3135d20deccf37555fa06bec7c0733e91fc73b64a4ebbde97c28f4a", "ver": 1, "vin_sz": 1, "vout_sz": 2, "lock_time": 0, "size": 271, "in": [ { "prev_out": { "hash": "3ecf0f0dafd26e8d788b59a433bf00e1c3c079e82dada5111e899c87a75dadff", "n": 0 }, "scriptSig": "30440220301ace5f0805c1c510d030f2bca9d10bedf552cf483a6d44b10209b070ab8aaf02205cc86e4d0fc4e620a68bcb486e0bd6e2ad3b4255bf08e3de6e021f9647536f0141 037214fc0ccc75ece857f4f9ccbc13a6cb9359adb8898a78015e44d356afef4bbd" } ], "out": [ { "value": "0.00209100", "scriptPubKey": "OP_DUP OP_HASH160 3b9583729f2ad15cf1617b8e01ddcdf85223f865 OP_EQUALVERIFY OP_CHECKSIG" }, { "value": "0.00000000", "scriptPubKey": "OP_RETURN 5465737420323a207573696e6720746865204e426974636f696e206c69627261727920746f206d6f766520426974636f696e20436173682e2042434820526f636b73203221" } ] }

NicolasDorier commented 3 years ago

@harvey-green I can't help you, I don't know. Afaik, nothing changed with BCH so what was working before should still work now. You should run your own node, debug=1 and read the logs to see the real reason it is rejected (you can also try to broadcast via RPC)

harvey-green commented 3 years ago

Thanks for the suggestion @NicolasDorier. There's been another report of this same thing happening from someone else who tried my blog post. I did try an online BCH transaction broadcaster as well, but that too failed.