Check a Filecoin client's DataCap before reserving pieces

A client's FIL balance does not measure its capacity to authorize verified data onboarding. Query its DataCap on the intended network before allocating a batch of pieces.

Compare with padded bytes

Use the client's address. Convert the returned capacity string to an integer. Two 32 GiB padded pieces require 68719476736 bytes of allocation capacity. Compare the batch's total padded size with the available amount.

{"jsonrpc":"2.0","id":1,"method":"Filecoin.StateVerifiedClientStatus","params":["f01234",[]]}

Treat absence separately from an existing balance

The API can return null when the address has no entry. Preserve that distinction from an explicit zero in diagnostics. An adequate current balance is not an allocation for a specific provider: verify the allocation record after the reservation is executed.

docs.filecoin.io StateVerifiedClientStatus · docs.filecoin.io StateGetAllocation