Linked Questions

9
votes
2answers
378 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 ...
6
votes
1answer
661 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?
0
votes
1answer
328 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 ...
0
votes
1answer
53 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 ...
18
votes
3answers
3k views

What is the default ordering of transactions during mining, in e.g. geth?

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 ...
16
votes
2answers
2k 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_) { ...
4
votes
3answers
931 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 = ...; // ...
3
votes
2answers
477 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 ...
4
votes
1answer
412 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 ...
5
votes
2answers
193 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 ...
1
vote
1answer
35 views

Smart Contract GridLock / Stuck Thread

Since Smart Contracts can call multiple contracts, is there a chance that smart contracts enter a gridlock situation?