Build
ONCHAIN STORAGE
SDK
API
getPrice()

irys.getPrice(numBytes)

Returns the cost to upload the specified number of bytes.

Parameters

Name
Type
Description
numBytes
number
The number of bytes to check the price for.

Returns

Type
Description
BigNumber
Cost to upload numBytes, unit is the token specified when instantiating the Irys object. Return value is in atomic units, to convert to standard units use irys.utils.fromAtomic().

Example

const irys = await getIrys();
 
const numBytes = 1048576; // Number of bytes to check
const priceAtomic = await irys.getPrice(numBytes);
 
// Convert from atomic units to standard units
const priceConverted = irys.utils.fromAtomic(priceAtomic);
 
console.log(`Uploading ${numBytes} bytes costs ${priceConverted}`);