I have a question about concurrency in smart contracts. For instance, I have array of structs and each struct should have a "unqiue" ID. For my needs, it is enough to have ID equal to position in array (later it can be changed, so ID must be stored in structure instance).

Is it safe to get array length to use it as ID or many transaction could be handled in the same time and get the same array length?

1 Answer 1


No, there is no concurrency in smart contracts. You don't need to worry about race conditions, since transactions are processed in blocks sequentially with no concurrency.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.