1.0.0 • Published 4 years ago
firestore-tx-queue v1.0.0
Transaction Queue
This piece of code is used to use firestore as a non concurrent job queue for transactions that have to be submitted to the network.
We simply create a firestore table to store transactions, a transaction can be represented as the following:
{
"type": "payment", // "payment" or "allocation"
"destination": "5...",
"amount_in_pico": "100000000", // Pico units of NODL to send
"proof": "fdde..." // Allocations only, hex encoded proof / hash
}
We also add a field paid
indicating if the transaction need to be executed or not. We also have a retry
field specifying how many times a transaction should be retried. Unpaid transactions with no retries left are kept for analysis purposes.
Limitations
- This is a non concurrent queue: many components can add transactions to the queue but we only support one of them executing and fetching the transactions. In a blockchain context this is good enough as we don't really have concurrent transactions anyways.
1.0.0
4 years ago