Linked Questions

1
vote
0answers
101 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. ...
1
vote
0answers
38 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 ...
20
votes
4answers
5k 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?
35
votes
1answer
3k 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 ...
14
votes
2answers
3k 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 ...
8
votes
5answers
955 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 ...
8
votes
2answers
1k 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 ...
4
votes
1answer
925 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 ...
0
votes
1answer
1k views

DeclarationError: Undeclared identifier. But already declared

DeclarationError: Undeclared identifier.on line 8,12,14.
2
votes
1answer
819 views

What is the format for sending erc20 token to multiple address?

Code contract ERC20 { function transfer(address _recipient, uint256 _value) public returns (bool success); } contract Airdrop { function drop(ERC20 token, address[] recipients, uint256[...
2
votes
2answers
290 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 ...
1
vote
1answer
741 views

Unable to find outgoing transactions transactions on Etherscan? [duplicate]

I am creating an application which aims to visualize ethereum transactions, so far getting data from geth I have noticed that there are never outgoing transactions from a contract account, and ...
0
votes
1answer
531 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
3answers
739 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 ...
3
votes
1answer
444 views

Retrieving tx.origin and msg.sender from blockchain data

In Solidity, origin and sender can be easily differentiated through tx.origin and msg.sender, respectively. Is it also possible to obtain both sender and origin of a specific transaction from the ...

15 30 50 per page