Linked Questions

9 votes
2 answers
953 views

Update the same variable in parallel? [duplicate]

I have a global variable foo that I'd like people to be able to increment in a shared fashion. int foo; function addToFoo(int value) public { foo += value } Im concerned that if this function ...
mark's user avatar
  • 95
8 votes
1 answer
1k views

Can you execute a contract twice in one block? [duplicate]

If you call a contract with two different tx from different account, can they be executed and mined in the same block? If yes how do you guarantee order and concurrency integrity like deadlocks?
Roland Kofler's user avatar
0 votes
1 answer
2k views

How do smart contracts handle race conditions? [duplicate]

Let's say I have deployed a smart contract game that rewards the first user that writes to contract after a point in time T. Naturally, every player will try to be that winner, causing many requests ...
brianSan's user avatar
  • 125
0 votes
1 answer
2k views

how blockchain can handle the concurrency? [duplicate]

I read some pages here about concurrency but I didn't give my answer, actually I am new to Bchain, consider this scenario: There is a game contract on the blockchain for 4 Players, so far three ...
Azzurro94's user avatar
  • 123
28 votes
3 answers
13k views

What is the default ordering of transactions during mining?

I know that the yellow paper does not specify how transactions are to be ordered in a block and this is up to the miner to decide. But I am interested in how this is practically handled (I assume not ...
SCBuergel's user avatar
  • 8,784
20 votes
2 answers
4k views

What happens when a smart contract gets several similar calls in the same block?

What happens when a smart contract gets several similar calls in the same block? Consider for instance this greeter: contract greeter { string name; function setName(string name_) { ...
Matias's user avatar
  • 1,109
8 votes
4 answers
3k views

Race conditions when calling remote contracts

Below I extracted the logic which calls a remote contract to calculate the amount of tokens to withdraw funds. contact Example { mapping (address => uint256) balances; ERC20 token = ...; // ...
xpepermint's user avatar
4 votes
1 answer
787 views

getStorageAt: What if two transactions in the same block?

I use web3.getStorageAt to access historical information. I can specify a block to see the content of a variable in a given block. But one block can contain several transactions, each modifying this ...
bortzmeyer's user avatar
5 votes
2 answers
485 views

Is it possible to time a transaction such that it is the last in a block?

Is there some method to create a transaction and make sure that it is the last in that block? If not, how close can you get to being last? The reason I ask is that the following page depends on that ...
zunior's user avatar
  • 1,322
3 votes
2 answers
654 views

Can a miner "cheat" my lottery smart contract?

I developed a smart contract that you: 1) Send 1 ether to an address, the contract saves your address 2) After 5 people have sent one ether, the contract chooses one address at random and sends the ...
Anto's user avatar
  • 311
1 vote
1 answer
96 views

Smart Contract GridLock / Stuck Thread

Since Smart Contracts can call multiple contracts, is there a chance that smart contracts enter a gridlock situation?
Nathan Aw's user avatar
  • 1,954
0 votes
1 answer
65 views

How to be sure registered array/queue are always the same?

I'm trying to a smart-contract where user can register himself (in an sorted array) and when a amount of people is registered (here 2) a Battle is created and firsts registered users battle each other....
Arthur's user avatar
  • 194