NEWTON
Asked
2 months ago
47
views
0
This question has a bounty of $0.00 in testnet ETH. Answers to this question are eligible to win that bounty.
These are testnet contracts. Not real ETH.
$0.00
What is the maximum value a uint can store?
I need to understand a couple of things:
a felt and uint can store?This question is participating in Newton Bounties | Incentivized Test Program Every verified valid question gets $10 USDC (mainnet)
Newton
asked
2 months ago
0
Accepted answer
Hi,
I'm not sure to what uint is referring to. If you're referring to uint256, the "base" type of Solidity, then no, felt and uint256 are not equivalent.
A felt corresponds to the size of the field on StarkNet, which is 2^251 + 17 * 2^192 + 1. You need to subtract 1 to this number to get biggest number that fits in a felt (since you need to account for the 0 number).
A uint256 is 256 bits, i.e the biggest number that will fit in it will be 2^256 - 1 (again, subtracting 1 because of 0).
So to answer:
uint256_max > felt_max0x5EF2...46c5dd
answered
1 month ago
How do you optimize gas in Cairo with Uint256/felt?
How to use Kakarot for my Solidity Contracts?
Cairo error "Expected expression of type 'starkware.cairo.common.uint256.Uint256' to have an address."
Cairo Error: 'range_check_ptr' cannot be used as an implicit return value. Consider using a 'with' statement.
Cairo: How to reassign Uint256 in a conditional
Is uint256 math operators like uint256_le safe? Why do I need to use uint256_check?
Fixed Point pow operation error
Cairo: When do you use tempvar and when do you use local
How to write a struct in storage?
Why abi of warp compiled contract does not match original solidity abi?
How to calculate the sum of the digits of a felt in Cairo?
How to get the contract ABI using Starknet.Py?
Did not have to pay gas fee when calling same function multiple times in Starknet?
How to use Pedersen Hash in StarkNet / Cairo Language?