dgarage / NBXplorer

NBitcoin Explorer
MIT License
320 stars 210 forks source link

Error on broadcasting transaction via API in testnet/regtest #467

Open ziprotak opened 3 months ago

ziprotak commented 3 months ago

I'm trying to broadcast raw tx with /v1/cryptos/BTC/transactions endpoint but I'm getting the errors in the app log (see below). I've tried to broadcast in Regtest mode using my own node and now faced it in Testnet with my own node.

The raw tx I'm trying to broadcast is sucesfully decoded with any external tool like blockcypher decodetx service

Any ideas?

fail: Microsoft.AspNetCore.Server.Kestrel: Connection id "0HN3TMBKG8RED", Request id "0HN3TMBKG8RED:00000001": An unhandled exception was thrown by the application. System.IO.EndOfStreamException: No more byte to read at NBitcoin.BitcoinStream.ReadWriteBytes(Span1 data) at NBitcoin.uint256.MutableUint256.ReadWrite(BitcoinStream stream) at NBitcoin.BitcoinStream.ReadWrite(uint256& value) at NBitcoin.OutPoint.ReadWrite(BitcoinStream stream) at NBitcoin.TxIn.ReadWrite(BitcoinStream stream) at NBitcoin.BitcoinStream.ReadWrite(TxInList& list) at NBitcoin.Transaction.ReadWrite(BitcoinStream stream) at NBitcoin.Transaction.FromBytes(Byte[] bytes, Nullable1 version) at NBitcoin.Transaction.FromBytes(Byte[] bytes) at NBXplorer.Controllers.MainController.Broadcast(TrackedSourceContext trackedSourceContext, Boolean testMempoolAccept) in /home/NBXplorer/NBXplorer/Controllers/MainController.cs:line 748 at lambda_method28(Closure, Object) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.gAwaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.gAwaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

Screenshot 2024-05-26 at 9 45 56 PM

notraiday commented 2 months ago

Same in both ltc and btc mainnets when using http api. Docs are poor for transaction broadcast