I want to understand if there is a difference between byte data-type and uint8 in solidity ?
Thanks
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityRuntime-wise, they are identical.
Compilation-wise, they are different:
byte
operandsbyte
variablesFor example, instead of doing this:
uint8 x = 1;
uint8 y = 2;
uint8 z = x + y;
You need to do this:
byte x = byte(uint8(1));
byte y = byte(uint8(2));
byte z = byte(uint8(x) + uint8(y));