A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Hot answers tagged

6

It sounds like you are being front run. This means that a bot is watching you send a transaction, reading the input (specifically, _answer), and submitting a transaction with the correct answer but a higher gasPrice. A miner will accept their transaction before yours, causing theirs to succeed and yours to fail. You can see that this is, in fact, what is ...


2

No. Your Mutex (locked) will prevent reentrance but reentrance is not the only vulnerability. A DoS is possible and it might not be intentional. This line, after payment 2: require(success, "Transfer failed."); Have you considered that payment 1 will not happen if the transaction aborts at this stage? That means player1 doesn't get paid unless ...


1

Overall fee you pay for a transaction, counted in fiat currency (EUR, USD, etc), depends on the following things: Ether to fiat exchange rate (may change over time, out of your control) Gas price (set by you, but miners may reject mining your transaction if gas price is too low) Actual gas used, this depends on what smart contract actually do and how ...


1

The gas limit can change overtime based on the targetgaslimit set by miners (this is geth terminology). The gas limit is capped with an upper and lower bound and can only be changed so much with each new block. So the gas limit can be dynamic, but generally there really is only gas limit at any point in time. Often times blocks do not use all of the gas ...


1

They are approximately the same. Your fixed-size array lays out a very large address space where every possible address equivalent has a slot. That's logically equivalent to what mapping does, although laid out differently (See Ismael's comment below) and slight different in gas cost as a result. I would incline to the mapping for readability. Solidity ...


1

UPDATE: The answer below refers to the difference between: a mapping(address => uint) an array of struct {address key; uint value;} elements Which is not what's being asked here. I'm leaving it here because I feel that it still contributes something in the context of this question... I hope that this table answers your question: |----------------|---...


Only top voted, non community-wiki answers of a minimum length are eligible