Linked Questions

1 vote
2 answers

Is there any simple function done in Solidity to check if an address is a contract address or a wallet address? [duplicate]

I'm looking for a function that will tell me if an address is a contract address or an externally owned address / wallet address. I tried with this function, however this only tells me if the address ...
Pro Girl's user avatar
  • 257
0 votes
3 answers

Revert if caller of contract is another contract [duplicate]

I'm trying to limit the access of functions in my contract to only normal user addresses, to prevent the 'revert-and-retry attack' described here. Quick excerpt from that link: victim.tryMyLuck(); ...
Enzo's user avatar
  • 40
0 votes
1 answer

Can I detect from tx metadata if a transaction made with a Metamask account were executed by a script?

I have a Metamask account what I use with web3.js/ any web3 lib to buy and sell tokens. Is it possible to tell if the transaction was done from the Metamask Chrome plugin interface or was ...
rihekopo's user avatar
  • 304
0 votes
2 answers

Prevent Transfer of ERC20 token to contract address?

I want my ERC20 contract to be transferred to EOA addresses only and some specific contract address only. I don't want to lose my tokens by mistakenly transferring to a contract address that cannot ...
MYANZIK shrestha's user avatar
1 vote
1 answer

How do you know if a contract is destroyed?

I'm using to interact with contracts. I was wondering, after calling a function with selfdestruct or suicide(address), how do I find out that the contract is in fact dead?
Huadong Feng's user avatar
5 votes
1 answer

tx.origin alternative

I couldn't find an appropriate, simple fix of the tx.origin vulnerability, without having to use any modifier, any help is very much appreciated, thanks, PS: msg.sender is not what I'm looking for (...
Arsalen's user avatar
  • 65
0 votes
1 answer

Reliable way to identify the caller [duplicate]

Is a reliable way to identify the caller with the following code? bool isContract = msg.sender != tx.origin;
Алекс Кирсанов's user avatar
0 votes
1 answer

How to check if there is no smart-contract deployed on selected address? [duplicate]

For example if I want to warn my user that he make mistake in contract address.
Anton Pegov's user avatar
2 votes
1 answer

Modifier for no-contract calls [duplicate]

The modifier used to check if a contract calls a function in Solidity used the assembly code extsize. I wonder why this is done. Using assembly seems very "hackish" to me (why does solidity not have a ...
JBrouwer's user avatar
  • 1,062
40 votes
5 answers

How to detect if an address is a contract?

I'm interested in knowing whether any particular address is a contract address or a standard address. There have been similar questions on the topic, but I'm not looking to detect whether an address ...
Sandwich's user avatar
  • 513
20 votes
2 answers

isContract function using EVM assembly to get the address' code size

My problem is that I need to make sure my contract processes only the transactions coming from EOA (externally owned accounts). For this I need to determine the type of account I'm dealing with. In ...
manidos's user avatar
  • 4,278
108 votes
2 answers

What's the difference between 'msg.sender' and 'tx.origin'?

If either are used in the body of a Solidity function that may change the state of a contract (write call), what's the primary difference and/or benefit of using one over the other. For example: ...
dbryson's user avatar
  • 6,403