What's the maximum amount of cycles that can be safely custodied in a cycles wallet?

I just want to be sure of the bounds before I start sending stupidly large amounts to it. Don’t want to end up losing those precious cycles :blush:

To provide more context, the interface spec here has 2 methods for cycle balances, a 64 bit API and a 128 bit API.

If I consider that the cycles wallet is older and uses the i64 data type, its max bound as defined here is 9_223_372_036_854_775_807

This is approx 9_223_372T cycles which is a lot. I will probably be storing around the 30-50 thousand trillion range, but I just want to make sure

AFAIK anywhere cycles are handled they are of type u128, so you should be safe with any value you can afford (assuming you don’t have more than 10^26 USD to spare :wink:)

@Severin Added some more context :slight_smile:

1 Like

Right, thanks for digging up the history. In this case, you’ll have to make some assumptions. If you know you’ll only interface with newer wallets (u128 support was rolled out May 4, 2022), then you can use the u128 bound.
If this is not certain, then you should go with the lower bound from the i64. But even if you sent too many cycles to an old wallet, in the worst case the wallet could render the cycles inaccessible until you upgrade the wallet wasm. The cycles could not get lost (unless you find a bug in the replica).

1 Like

Thank you. Just wanted to confirm. So, if the cycles wallet supports the i128 API, it’s all good. I just created a wallet with dfx v0.12.1 so I assume it will use the latest WASM, so I should be covered.

Yes, then you’re good to go. u128 support was introduced with dfx 0.10.0, and any wallet deployed (or upgraded) with that or a later version will support u128

1 Like