question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Greenfield API: Unhandled error on "preview proposed store on-chain payment method"

See original GitHub issue

Describe the bug On setting the accountKeyPath data of the preview proposed store on-chain payment methods BTCPay Server shows an unhandled Exception error in the logs.

To Reproduce the bug On the mentioned endpoint when you set the derivationScheme with a legacy tpub key and the accountKeyPath to m/84'/0'/0' it throws an internal server error.

Expected behavior Should return other http status code with meaningful error message.

Your BTCPay Environment (please complete the following information):

  • BTCPay Server Version: v1.2.1.0
  • Deployment Method: Docker

Logs (if applicable)

2021-08-19 21:41:08.868 +00:00 [ERR] Connection id "0HMAUJTM9RLGR", Request id "0HMAUJTM9RLGR:00000001": An unhandled exception was thrown by the application.
NBitcoin.JsonConverters.JsonObjectException: Invalid rooted key path
   at NBitcoin.JsonConverters.KeyPathJsonConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Formatters.NewtonsoftJsonInputFormatter.ReadRequestBodyAsync(InputFormatterContext context, Encoding encoding)
   at Microsoft.AspNetCore.Mvc.ModelBinding.Binders.BodyModelBinder.BindModelAsync(ModelBindingContext bindingContext)
   at Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder.BindModelAsync(ActionContext actionContext, IModelBinder modelBinder, IValueProvider valueProvider, ParameterDescriptor parameter, ModelMetadata metadata, Object value)
   at Microsoft.AspNetCore.Mvc.Controllers.ControllerBinderDelegateProvider.<>c__DisplayClass0_0.<<CreateBinderDelegate>g__Bind|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed 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 where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at BTCPayServer.Hosting.BTCPayMiddleware.Invoke(HttpContext httpContext) in /source/BTCPayServer/Hosting/BTCpayMiddleware.cs:line 95
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at BTCPayServer.Hosting.HeadersOverrideMiddleware.Invoke(HttpContext httpContext) in /source/BTCPayServer/Hosting/HeadersOverrideMiddleware.cs:line 30
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

Additional context

In the API docs the accountKeyPath example seems to have a fingerprint prefixed e.g. abcd82a1/84'/0'/0' from what I saw in searching some code it seems to be a fingerprint of the derivationScheme? Not sure how this get computed, any link to read about it + maybe docs need to be more explicit? Nevertheless using the normal account path should also work and if not it should throw a proper error I assume.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
NicolasDoriercommented, Jan 10, 2022

Updated the doc documenting an unused field, and also fixed the underlying issue of not properly reporting when we can’t deserialize a JsonException.

0reactions
NicolasDoriercommented, Jan 10, 2022

Other problem is that this call shouldn’t even have a accountKey parameter, we don’t use it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

BTCPay Greenfield API (v1)
Get a new deposit address for the custodian using the specified payment method (network + crypto code). Authorizations: API_Key ( btcpay.store.
Read more >
Error codes
The latest payment attempt for the PaymentIntent has failed. Check the last_payment_error property on the PaymentIntent for more details, and provide a new...
Read more >
Untitled
Crap operating system, Leertouwer schilders delft, Africana delia lyrics, ... Rhoa new trailer, Tron guy wallpaper, Play store redeem code hack apk, ...
Read more >
6m
Art galleries nyc open late, Chicken royale game, You re the new classic you re the new pyt, ... Auto repair shops with...
Read more >
Untitled
How long does it take to grow facial hair, Fide mexico, Sandman from spiderman movie, Online quick count pilpres 2019, New york yankees...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found