I think a code and program would be nicer if some functions, such as transferring fund, are done automatically.

However, there are some examples that try to explain it is not a good idea.

For instance, it's said:

"Because of the maximal stack depth of 1024 the new bidder can always increase 
the stack size to 1023 and then call bid() which will cause the 
send(highestBid) call to silently fail "

Question 1 : How is it possible t increase stack size and carry out the attack?

Question 2: Is it really a bad idea to transfer money automatically in a smart contractor? can we do it if we take some care?


Q1: Basically you create a recursive function that calls itself in a contract A before calling contract B. Q2: Yes and Yes. You should make sure that the callee contract is known and safe, so no recursive calls are done.

Anyway, the stack depth attack is no longer a problem since a few months ago.

  • Thanks for the answer. But if this recursive calling is a problem then we can use "send" or "transfer" functions whose gas is limited. Also, I'm not convinced by your answer to the 2nd question and it contradicts with the last line. Thanks again! – user153465 Nov 5 '17 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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