OverflowSolidity 可以处理 256 位数字, 最高为 2^256 - 1, 所以对 (2^256 - 1) 加 1 会导致归 0。同理, 对 unsigned 类型 0 做减 1 运算会得到 (2**256 - 1)pragma solidity 0.4.18; contract OverflowUnderflow { uint public zero = 0; uint public max = 2^256 - 1; // zero will end up at 2^256 - 1 function underflow() public { zero -= 1; } function overflow() public { max += 1; } } Underflow比如, 账号 A 持有 X tokens, 如果他发起一笔 X + 1 tokens 的交易, 如果代码不进行校验, 则账号 A 的余额可能发生 underflow 导致余额变多. 可以引入 SafeMath Library 解决:pragma solidity 0.4.18; library S...