[Solved] Nodes thread safety

Hello. We are expecting to provide a high load on the network, which means that simultaneous transaction inquiries for a single node can possibly happen.

Is it safe to write maps for a single node key simultaneously? Or should we think about implementing our own synchronization mechanism?

Thank you.

Sorry, I can’t parse the question…

What do you mean by “transaction inquiry”? A chain transaction? They are trivially sequentialized by the miner (and the nonces).

What do you mean by “write map”? And what is a “single node key”?

Hey, thank you for the response. And sorry for complicated language :slight_smile:

By “simultaneous transaction inquiries” I simply meant attempts to create multiple transactions simultaneously.

By “map” I meant key-value data structure. And by “single node key” I simply meant blockchain node which is identified by public key. Just tried to explain it with different words.

So, as I understand from your response, transactions simply getting written in sequence into kind of a “mempool” and then getting mined one by one, so no concurrency issues takes places here. Is that correct?

Transactions are atomic, and isolated. Transactions are put into the mempool, and the miner picks (in whatever way it likes) valid transactions from there.

An aeternity blockchain node is not really identified by a public key and it doesn’t have a key-value data structure. Are you perhaps asking about accounts or smart contracts?

2 Likes

Oh, yes. That’s true, I am speaking about the smart contract. Thank you very much for clarification.

Then, again, the transactions are isolated; only one transaction is “running” at the same time. So, no you don’t need to write any synchronization mechanism.

1 Like