How to Understand tx.origin and msg.sender in Solidityby@fassko

How to Understand tx.origin and msg.sender in Solidity

tldt arrow
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

In Solidity, `tx.origin` and `msg.sender` are two variables that serve different but crucial purposes. `tx.origin` always refers to the address that initially initiated the transaction and remains constant throughout the transaction chain. On the other hand, `msg.sender` represents the sender of the current message or contract interaction and changes with each call. It is crucial to be cautious when using `msg.sender`, as it may not always represent the initial caller of the transaction.

Company Mentioned

Mention Thumbnail
featured image - How to Understand tx.origin and msg.sender in Solidity
Kristaps Grinbergs HackerNoon profile picture

@fassko

Kristaps Grinbergs

Blockchain, mobile and fullstack developer. Startup founder. Conference speaker.


Receive Stories from @fassko

react to story with heart
Kristaps Grinbergs HackerNoon profile picture
by Kristaps Grinbergs @fassko.Blockchain, mobile and fullstack developer. Startup founder. Conference speaker.
Read my stories

RELATED STORIES

L O A D I N G
. . . comments & more!