[Ethereum] uint256


With regard to Solidity, What is UINT256?

From the token example at https://ethereum.org/token :

/* This creates an array with all balances */
mapping (address => uint256) public balanceOf;

Beyond being a variable type in general computing, I'd love to gain a better of understanding and context in the Ethereum world. Why not just use an INT? Assuming it's a specific type of Integer, what does the "U" denote?

Best Answer

With regard to Solidity...

This is really more a general computer science question that would best be answered on Stack Overflow.

At the risk of repeating what @Ismael has linked to...

  • U - unsigned (meaning this type can only represent positive integers, not positive and negative integers)
  • INT - integer
  • 256 - 256 bits in size

Context: The EVM (Ethereum Virtual Machine) uses 256 bits as its word size. See: Rationale behind 256-bit words in EVM

Related Topic