Linked Questions
31 questions linked to/from What's the difference between 'msg.sender' and 'tx.origin'?
2
votes
1
answer
7k
views
What does msg.sender == tx.origin actually do? Why? [duplicate]
A lot of contracts use require(msg.sender == tx.origin)
What is the purpose of it?
When should you add this code?
What difference does it make if the msg.sender is not a tx.origin? And in which cases ...
1
vote
0
answers
121
views
What are the differences between msg.sender, tx.origin, and ethereum accounts? [duplicate]
I am trying to solve the problem of contract access and I understand from the very informative documentation that owner should be assigned to msg.sender by a constructor when the contract is created. ...
2
votes
0
answers
73
views
msg.sender and tx.origin - how to use them in practice? [duplicate]
I wrote a contract A that uses msg.sender for authentication: When A creates an item it stores msg.sender in itemsOwners mapping (itemOwners[itemId] = msg.sender;). Later A compares msg.sender to ...
42
votes
7
answers
29k
views
How does a contract find out if another address is a contract?
Is it possible, from within a contract written in Solidity, to check if a contract is placed on a specific address or if this address does not contain any code?
48
votes
1
answer
8k
views
How do I make my DAPP "Serenity-Proof?"
When Serenity comes around, the network will undergo many changes, some of which may have unexpected consequences on existing Smart Contracts. How can I plan so that I am best prepared to take ...
20
votes
2
answers
8k
views
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 ...
11
votes
5
answers
2k
views
What are legitimate uses of tx.origin?
It is known that msg.sender must be used for authentication instead of tx.origin (the difference explained here). Some static analysis tools (e.g., in Remix) detect all usages of tx.origin as ...
11
votes
2
answers
3k
views
Is it possible to call another contract from a contract maintaining the msg.sender of the original caller?
Imagine that Alice calls a contract method C1 and that method calls another method in contract C2.
Regularly msg.sender equals the Alice Account in the C1 method. And msg.sender equals the C1 ...
5
votes
1
answer
640
views
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 (...
4
votes
1
answer
2k
views
Can a contract be the owner of another contract and kill it?
How can contract B (created and owned by contract A) verify that contract A invoked the kill method? (Is msg.sender the same for contract A and B or is msg.sender the address of contract A when A ...
3
votes
2
answers
736
views
Tx.origin and msg.sender when sending signed Raw transaction
A client with address A signs a raw transaction, and leaves it all ready to be sent, gives it to the server with address B, which later will send it with sendSignedTransaction(...).
What will be the ...
2
votes
4
answers
3k
views
How to pass the external account address to the contract function when calling another contract
If we deploy the contract B, and pass the contract B address to the contract A. When call the contract B function from the contract A, inside the contract B function, the msg.sender is the "address ...
0
votes
1
answer
1k
views
Correct way of sending Token via contract
[Sender] -> [My Contract] -> [ERC20 Contract]
The sender invokes my Contract, and my contract in turns will invoke ERC20 contract to Transfer token on behalf of the senders (using his msg....
0
votes
1
answer
2k
views
DeclarationError: Undeclared identifier. But already declared
DeclarationError: Undeclared identifier.on line 8,12,14.
0
votes
1
answer
1k
views
deletegateCall to change contract's ownership
I am currently going deep into some Solidity functionalities and I would like to be able to change a contract's A ownership from a contract B, knowing that the caller of contract B is the owner of ...