Linked Questions

80 votes
4 answers
66k views

<address>.send vs <address>.transfer best practice usage?

I noticed that address's offer two member functions that perform the transfer of ether to the specified address. send returns false upon failure and transfer raises an exception. In the Solidity ...
Michael's user avatar
  • 1,075
50 votes
3 answers
10k views

What is a recursive calling vulnerability?

What is a recursive calling vulnerability exactly? When creating smart contracts, DAOs or DAPPs, what measures can I take to ensure I am not vulnerable?
user36100's user avatar
  • 603
21 votes
2 answers
10k views

Is transfer() still safe after the Istanbul update?

In other words, is using transfer() safe? function transfer(address contractB) public { contractB.transfer(1000); //balances[msg.sender] -= 1000; } How about using call.gas? function ...
Robert Ggg's user avatar
22 votes
3 answers
4k views

TheDAO hack FAQ: How did the attack happen on 17 June 2016?

Can anyone explain that how the DAO attack happened? Vitalik Buterin explained here that it was performed by splitting a DAO from the main DAO but calling the split function recursively. We know that ...
13 votes
2 answers
2k views

Why does an empty message still invoke the code of the contract?

An empty message still invokes the code of the contract and is the mechanism that allows Solidity to implement a feature of a fallback function per contract. But when msg.data is empty, why does ...
eth's user avatar
  • 86k
4 votes
1 answer
6k views

Can I send ethereum to a contract outside of its constructor?

How do I fund Solidity contracts with Ether? The example in the Solidity FAQ, http://solidity.readthedocs.io/en/develop/frequently-asked-questions.html#store-ether-in-a-contract, funds a contract via ...
glowkeeper's user avatar
8 votes
1 answer
2k views

Callstack attack

If my contract has a payout function like this address bossAddress; address employeeAddress; uint256 bossSalary; uint256 employeeSalary; function payout (){ if (msg.sender==bossAddress){ ...
shiso's user avatar
  • 1,036
6 votes
2 answers
5k views

Understanding nameReg.call("register", "MyName") style call between contracts

Here's an example from solidity docs on Address type methods(call method specifically): address nameReg = 0x72ba7d8e73fe8eb666ea66babc8116a41bfb10e2; nameReg.call("register", "MyName&...
manidos's user avatar
  • 4,298
14 votes
1 answer
2k views

What does `call.value` mean and how did it allow the attack to The DAO?

I'm trying to get some sense from the hysteria around the attack performed to The DAO smart contract. I understand the high level explanations, but I'd like to grasp how this attack was performed. I'...
Henrique Barcelos's user avatar
9 votes
3 answers
1k views

Why is there more than one payable function in a solidity contract?

When someone transfers ether to a contract address the payable callback (without name) function is called automatically. What I don't understand is why are there many examples with multiple payable ...
Dany D's user avatar
  • 145
1 vote
2 answers
2k views

Calling a smart-contract fallback function from another contract

contract A { function one() public { //transfer to B to call its fallback function B(addressB).transfer(value); } contract B { function() external payable { someaddress....
Aleksandr's user avatar
  • 149
5 votes
1 answer
2k views

How do you get a string value from msg.data in the fallback function?

Im trying to do what The DAO did and do something when a sender sent money to my contract address. But im not sure how to. The something I want to do is to just create a new user in a mapping with the ...
vonGohren's user avatar
  • 211
6 votes
1 answer
1k views

Accessing the last function parameter from msg.data

I have a fallback (unnamed) function in my contract and I know that the last parameter (or first, does not matter) passed is always an uint. Is it possible to somehow access it though the msg.data?
md2312's user avatar
  • 193
6 votes
1 answer
662 views

Is address.send() not vulnerable for the recursive call attack?

If my dapp sends ether to another address via the send() method is it not vulnerable for the recursive call attack due to the limited amount of gas of 21000? Or should I still take precautions?
Mick de Graaf's user avatar
3 votes
1 answer
2k views

value transfer did not complete most likely as a result of a revert opcode

When i want to send some eth to an erc20 contract i receive the following error: "value transfer did not complete most likely as a result of a revert opcode". I modified the fallback function in ...
alle.manfredi's user avatar

15 30 50 per page