V
V
Vasily Serpokryl2018-04-02 19:43:47
Redis
Vasily Serpokryl, 2018-04-02 19:43:47

How to organize a queue to a distributed variable?

When signing transactions in the Ethereum network, you need to specify a nonce (the number of user transactions in the network), this number, respectively, is constantly incremented when new transactions are added to the network. There are distributed servers, the task is to line up the queue as follows: if one of the servers started working on a transaction (which may not be executed, and the nonce number will remain the same), then the rest, if they receive transactions, will wait until 1 completes the work to the end. If the transaction successfully enters the network from 1 server, then it increases this nonce and gives the opportunity to continue this stage for the first (next) server in the queue. Who can suggest which way to look? Current stack: NodeJS, Redis, Postgres. In essence, the task comes down to lining up a queue of servers to a distributed variable.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Tikhonov, 2018-04-16
@graf_777_gos

It looks like a lock in a redis https://redis.io/topics/distlock plus an atomic increment of the nonce value after the successful completion of the transaction. Possibly using watch https://redis.io/commands/watch

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question