API – How do I know which user has made which BTC transaction?

I am making an application and I want my users to deposit BTC coins at my address which is an exchange address (I do not have private keys).

How do I know which user has made which transaction?

I have a way, which is to add the digital user ID to the amount, for example if a user wants to deposit a 100.00 BTC coin, and the ID is 158769, I can add the ID in the amount like this: 100.000015158769 and do it as a QR code so that the user deposits the exact amount so that I know that he has made this transaction, but does it exist there any other way to do it, any idea?

Thanks in advance

rest – Implementation of the RESTful API in front of event-based microservices

I am working on a system that implements several microservices that communicate via a RabbitMQ messaging bus.

  • These microservices are created using python with the pika library (to publish messages as well as consume a RabbitMQ queue)
  • One of these microservices (let's call it "commands") has a connected database to store the data

Until now, the application components are asynchronous, relying entirely on RabbitMQ exchanges / queues for communication and, if necessary, implementing queues waiting for a reminder when a microservice needs to request data from another.

Now that I have talking backend microservices, I would like to implement a RESTful API for this “ commands '' microservice. so that customers (e.g. web browsers, external applications) can receive and send data.

I can think of two ways to do this:

  1. Create another microservice (let's call it "orders-api") in something like a vial and connect it to the underlying database behind the "orders" microservice. This seems like a bad idea because it breaks the microservice model to have only one database connected to a single microservice (I don't want two microserices to have to know the same data model)

  2. Create an "api-gateway" microservice that exposes a RESTful API and, upon receipt of a request, requests information from the "orders" microservice via the messaging bus. Similar to the way RabbitMQ documents remote procedure calls here: https://www.rabbitmq.com/tutorials/tutorial-six-python.html. This would mean that the "api-gateway" would be synchronous, and therefore, would hang while waiting for a response on the messaging bus.

I don't know if there are other ways to achieve this that I don't know about. Any suggestion on how to integrate a RESTful API in this environment would be appreciated!

multitenancy – How to add personalization of business customers in our API and

There is no quick fix in this scenario, but you need to assess a solution for each aspect of customization that you face in time, trying to separate the main API from the custom services.

If customers simply need to extend the information associated with certain resources (company, user, active), the most flexible solution is the introduction of properties as key / value pairs directly supplied by the customer . Properties may have a client-defined schema, but this makes the user / developer experience more complicated as it has to declare keys and types in advance


PUT /users/:userId/props/mykey
  type: "string",
  value: "foo"

PATCH /users/:userId/props/mykey
  value: "bar" (if it was a number, i'd have a 400 error)

GET /users/:userId/props
  mykey: { 
    type: "string"
  mynumber: {
    value: 3,
    type: number

When customizations have an impact on the domain model, it would be reasonable to develop a dedicated backend that acts as a proxy for the main APIs, there would be an endpoint like api.mycompany.com/rich-customer-api/v1 … or a backend-for-frontend if you provide access via a mobile / web application

Finally, if customizations have little impact on the evolution of the platform or seem reasonable and useful for other customers, why not consider them as new features for the main APIs?

magento2 – Magento 2.3.0: How can I add a custom payment API in the CREATE ORDER REST API?

I have a scenario in which, after adding items to the cart and getting the estimated shipping costs and payment information, I have to use a custom payment API which deducts the total amount right after creation of the order and order ID, and adds custom payment API responses to a custom table.

API takes a while to respond until payment is confirmed, then API responses are saved in a custom table (currently on the web)

Please tell me how to reproduce this.

Exchange rate – Get multiple OHLCV candles with API with one request

You can do this with ClueDex. By default, all Bittrex markets are returned in a single request. You can specify the number of candle data you want to obtain with the "periodqty" parameter. In your case, you make periodqty equal to 1 for the last period.

In addition, you can create your own period, you are not limited to standard periods. For example, if you wanted periods of 30 seconds, you simply specify the parameter "period" as 30S.

If you needed to go back in time, Cluedex also has the ability to do it.

The only downside is that, even if it is, it is not a free API, it is premium. However, the prices are reasonable and the data is not cached.

views – Search in the API file Search for filter operators

D8 Webist

There's probably something obvious missing here but …

I am trying to create a view that can search an index generated by the search API. I want to include files in the search. Ideally with an exposed filter.

The indexed MIME field type is returned as "MIME type / type". So, for example, PDF files come back as "application / pdf".

I can expose a filter to allow users to say what type of file they want but it seems to me that I only have access to the "IS" operators. for example: "IS EQUAL TO".

This means that the exposed filter needs the exact type: application/pdf entered rather than just pdf.

In the integrated file search view, I notice that the operator "Contains any word" is available.

How can I access it?

I can see from this question from 3 years ago that before someone solved this using a hook. Is there another way to access "Contains a word", is this still the only solution?

In continuation of the above problem. I would only like to provide a handful of MIME types to display for users. Am I better off trying to limit this in the view or index that provides the data to the view?

api design – Rest API best alternative to polling for long asynchronous tasks

I created a flas restplus API that accepts the input xlsx file and returns an XML. It would be consumed internally by our different APIs

The current flow:

  1. Users POST an xlsx file by calling / downloading the endpoint.

  2. The API accepts the file, stores it, and returns a file identifier.

  3. User sends another request to / executes providing file ID for processing

  4. The API places the request in the rabbitMQ queue and returns 202 with a location URL to query the status.

  5. a celery worker collects the request and begins processing it. It takes a while.

  6. Meanwhile, the user can query the status

  7. When finished, the API sends 303, along with another location URL to download the file.

  8. The user hits the new URL to download the file.

However, our team of architects is not in favor of giving the client a questioning mechanism and asking us to take another approach, maybe a callback URL.
They have a say – "wait with sleep to check if the task is finished, is not good programming practice."

I would like to know if there is a different approach that the client can take without having to query the status. The booster is the one I know of, but it's not in place yet.

c # – Accurately measure the execution times of ASP.NET Core 3.x actions (Web API project)?

I want to be able to record the time spent by a certain web API action in an ASP.NET Core 3.x application.

This is a very old question from ASP.NET which relies on global action filters, but in ASP.NET Core, I think middleware is more appropriate.

From a customer's point of view, I want to measure as accurately as possible the following time:

Time to first byte - Time spent to send the request

So, using a slightly modified code from c-sharpcorner, I implemented the following:

/// tries to measure request processing time
public class ResponseTimeMiddleware
    // Name of the Response Header, Custom Headers starts with "X-"  
    private const string ResponseHeaderResponseTime = "X-Response-Time-ms";

    // Handle to the next Middleware in the pipeline  
    private readonly RequestDelegate _next;

    public ResponseTimeMiddleware(RequestDelegate next)
        _next = next;

    public Task InvokeAsync(HttpContext context)
        // skipping measurement of non-actual work like OPTIONS
        if (context.Request.Method == "OPTIONS")
            return _next(context);

        // Start the Timer using Stopwatch  
        var watch = new Stopwatch();

        context.Response.OnStarting(() => {
            // Stop the timer information and calculate the time   
            var responseTimeForCompleteRequest = watch.ElapsedMilliseconds;
            // Add the Response time information in the Response headers.   
            context.Response.Headers(ResponseHeaderResponseTime) = responseTimeForCompleteRequest.ToString();

            var logger = context.RequestServices.GetService();
            string fullUrl = $"{context.Request.Scheme}://{context.Request.Host}{context.Request.Path}{context.Request.QueryString}";
            logger?.LogDebug($"(Performance) Request to {fullUrl} took {responseTimeForCompleteRequest} ms");

            return Task.CompletedTask;

        // Call the next delegate/middleware in the pipeline   
        return _next(context);

Startup.cs (plug in middleware)

public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory,
    ILoggingService logger, IHostApplicationLifetime lifetime, IServiceProvider serviceProvider)


    // ...

Is this a good approach? I'm mostly interested in accuracy and don't waste server resources.

java – Creation of bottom-up vs top-down objects in the API

I am trying to identify the advantages and disadvantages of two approaches to create an object to return from my generic API. I think that the first approach that I sketch has the advantage of being easier to understand by offshore developers, while the second approach lends itself better to competition or to a more complicated logic. customer.

Example of an object model:

class TopLevelResponse {
    String field1;
    String field2;
    MidLevelResponse field3;
    ResponseMisc() field4;

class MidLevelResponse {
    String field1;
    BottomLevelResponse field2;

class BottomLevelResponse {
    String field1;
    String() field2;

class ResponseMisc {
    String field1;
    String field2;

First case from top to bottom where each branching object is created each time a child field is initialized:

class MyResponseInitializer {
    TopLevelResponse rsp;
    TopLevelResponse getTopLevelResponse() {
        if (Objects.isNull(rsp)) rsp = new TopLevelResponse();
        return rsp;
    MidLevelResponse getMidLevelResponse() {
       if (Objects.isNull(getTopLevelResponse().getMidLevelResponse())
           getTopLevelResponse().setMidLevelResponse(new MidLevelResponse());
       return getTopLevelResponse().getMidLevelResponse();
    void setField1(String val) {
    void setField2(String val) ...
    void setMidLevelField1(String val) ...

And on the client side:

MyResponseInitializer rspInit = new MyResponseInitializer();
TopLevelResponse rsp = rspInit.getTopLevelResponse();

Compare with a bottom-up approach like this, where initialization is done by a series of manufacturers:

static class BottomLevelResponseBuilder(){
     BottomLevelResponse build()...
static class MidLevelResponseBuilder()
static class TopLevelResponseBuilder()

Which on the client side looks like this:

TopLevelResponse rsp = TopLevelResponseBuilder.newInstance()

What are the pros and cons of one or the other approach here? Am I right in thinking that the first approach is better from a defensive programming point of view, as it reduces the risk of fraudulent implementations by offshore developers? Or that using competition to create each branch on a separate thread may pay off, especially with more nesting involved in the data model if I use the 2 approach?

bitcoin core – How to create a transaction using the BlockCypher API

I am completely new to this. I created 2 accounts on test3 and used a tap to get some balance. I want to send bitcoins from the "alex" account to the "bob" account. There are all the cURL commands that I used to create the accounts:

$ curl -X POST https://api.blockcypher.com/v1/btc/test3/addrs
  "private": "b917690a81ef3eb62107c291e8075fb80864d05aa29c8b8d5aeda10788fa989c",
  "public": "024467c0902a94cfa1521d23d76cf69cf87fb667d72c88698e1e2d156f31c48aa8",
  "address": "mx9igZmS9eT7v8Dd85GGWx15iTbrHTSsHr",
  "wif": "cTnVgC9xvW6k5ymC2SwankPnD4uWw2yhnw9PbcRhabPELduDnt7K"

$ curl -d '{"name": "alex","addresses"["mx9igZmS9eT7v8Dd85GGWx15iTbrHTSsHr"]}' https://api.blockcypher.com/v1/btc/test3/wallets?token=c9634215180846f6bac20cc352c7af07
  "token": "c9634215180846f6bac20cc352c7af07",
  "name": "alex",
  "addresses": [

It was the first portfolio created. I used the first endpoint to generate a wallet address, then I used it below.

$ curl -X POST https://api.blockcypher.com/v1/btc/test3/addrs
  "private": "9982db61106404edcbcccf0eec65206d03360e793c180bdee159e75d38334263",
  "public": "03eda7178f4fc85c634714f8c8b93b13fd4d8f1fc8a2a2488acde477cc747bd7dc",
  "address": "mtqiEViiuzEhykZsCKFaRM4tm8SZTEZKkX",
  "wif": "cSj7B8NrD5Ds6t4NnpTqBsDytd8Dsi9TyJaBr4GXHJH4yQgAdhtZ"

$ curl -d '{"name": "bob","addresses": ["mtqiEViiuzEhykZsCKFaRM4tm8SZTEZKkX"]}' https://api.blockcypher.com/v1/btc/test3/wallets?token=c9634215180846f6bac20cc352c7af07
  "token": "c9634215180846f6bac20cc352c7af07",
  "name": "bob",
  "addresses": [

Likewise, I created another wallet for bob. I used the tap, so Alex currently has a balance on the test3 network.

$ curl https://api.blockcypher.com/v1/btc/test3/addrs/mx9igZmS9eT7v8Dd85GGWx15iTbrHTSsHr/balance
  "address": "mx9igZmS9eT7v8Dd85GGWx15iTbrHTSsHr",
  "total_received": 0,
  "total_sent": 0,
  "balance": 0,
  "unconfirmed_balance": 2022000,
  "final_balance": 2022000,
  "n_tx": 0,
  "unconfirmed_n_tx": 3,
  "final_n_tx": 3

Now, I don't really know how to send the transaction between the two wallets. My blockcypher token is: c9634215180846f6bac20cc352c7af07 if someone could help me create a cURL or javascript command. That would be great.