Native U256 in Daml: 256-bit integers in contracts and the Ledger API (Dev Fund PR #903)
- marijamijailovicOP
Hi everyone,
Daml can’t hold a 256-bit number today. The widest integer is
Numeric, at 38 digits, so EVM-sized amounts like token balances don’t fit. We’d like to fix that, so we opened a Dev Fund proposal to addU256as a native Daml type, likeIntandNumeric.What’s in the proposal: a contract can hold a
U256field, compute with it, and send it over the gRPC and JSON Ledger APIs. Overflow aborts the transaction instead of wrapping, like Solidity’s checked arithmetic. The first milestone is a design note on daml#22827, agreed with the Daml language team before any code is written.PR Proposal(RFP 16): Proposal: Daml U256 Native Type by marijamijailovic · Pull Request #903 · canton-foundation/canton-dev-fund · GitHub
Issue: support uint256 natively in Daml · Issue #22827 · digital-asset/daml · GitHubWe’d love to hear what you think, especially whether your application would use
U256and for what.A bit about us: we’re the Walnut team. We build debuggers, tracers, simulation tools, and compiler improvements for smart contract developers, and we built
dpm tracefor Canton.Marija,
Senior Software Engineer
Walnut