StaticappendAppend an item to an array field (JSON encoding only)
Creates a payload for the APPEND_ITEM operation. The field must exist and be an array, or the operation will create a new array with the item as its first element.
The storage program address
The array field name
The value to append
StorageProgramPayload for transaction creation
StaticblacklistACLCreate an ACL with a blacklist
Base mode ('public' or 'restricted')
Addresses to block
Optionalallowed: string[]Optional allowed addresses (for restricted mode)
StorageProgramACL with blacklist configured
StaticcalculateCalculate storage fee based on data size
Pricing: 1 DEM per 10KB (minimum 1 DEM)
Data to calculate fee for (JSON object or base64 string)
Encoding type ("json" or "binary")
Fee in DEM (bigint)
StaticcheckCheck if an address has permission for an operation
ACL Resolution Priority:
Access control configuration
Owner address of the storage program
Address requesting permission
Permission type to check
true if permission is granted
StaticcreateCreate a new Storage Program
Address creating the storage program (becomes owner)
Unique name for the program
Initial data (JSON object or base64 binary string)
"json" or "binary" (default: "json")
Optionalacl: Partial<StorageProgramACL>Access control configuration (default: owner-only)
Optionaloptions: { Options including nonce (required), salt, metadata, storageLocation
Optionalmetadata?: Record<string, unknown>Optionalsalt?: stringOptionalstorageStorageProgramPayload for transaction creation
// JSON storage with public read access
const payload = StorageProgram.createStorageProgram(
'demos1abc...',
'appConfig',
{ version: '1.0', features: ['auth', 'storage'] },
'json',
{ mode: 'public' },
{ nonce: 42 } // Required: sender's current nonce
)
// Binary storage with group access
const payload = StorageProgram.createStorageProgram(
'demos1abc...',
'teamDocument',
base64EncodedPdf,
'binary',
{
mode: 'restricted',
groups: {
editors: { members: ['demos1a...', 'demos1b...'], permissions: ['read', 'write'] },
viewers: { members: ['demos1c...'], permissions: ['read'] }
}
},
{ nonce: 43, metadata: { filename: 'report.pdf', mimeType: 'application/pdf' } }
)
StaticcreateOptionalsalt: stringOptionalallowedAddresses: string[]StaticdeleteDelete a field from a storage program (JSON encoding only)
Creates a payload for the DELETE_FIELD operation. Completely removes the field from the stored data.
The storage program address
The field name to delete
StorageProgramPayload for transaction creation
StaticdeleteDelete an item from an array field by index (JSON encoding only)
Creates a payload for the DELETE_ITEM operation. Supports negative indexing (-1 = last item). The array will be compacted after deletion.
The storage program address
The array field name
The array index to delete (0-based, supports negative)
StorageProgramPayload for transaction creation
StaticdeleteDelete a Storage Program (owner/ACL-permissioned only)
WARNING: This operation is irreversible and will delete all stored data.
The storage program address to delete
StorageProgramPayload for transaction creation
StaticderiveDerive a deterministic storage program address
Address of the program deployer (will be owner)
Name of the storage program
Sender's nonce for uniqueness (ensures unique address per transaction)
Optional random salt for additional uniqueness (default: empty string)
Storage address in format: stor-{first 40 chars of sha256}
StaticgetGet all data from a storage program (alias for getByAddress with full data)
The RPC endpoint URL
The storage program address
Optionalidentity: stringOptional requester identity for ACL-protected programs
Full storage program data or null if not found
StaticgetGet a storage program by address
The RPC endpoint URL (e.g., "https://node.demos.sh")
The storage program address (stor-{hash})
Optionalidentity: stringOptional requester identity for ACL-protected programs
Storage program data or null if not found
StaticgetGet all storage programs owned by an address
The RPC endpoint URL
The owner's address
Optionalidentity: stringOptional requester identity for ACL filtering
Array of storage program list items
StaticgetGet data size in bytes
Data to measure (JSON object or base64 string)
Encoding type ("json" or "binary")
Size in bytes
StaticgetGet all field names from a storage program (JSON encoding only)
The RPC endpoint URL
The storage program address
Optionalidentity: stringOptional requester identity for ACL-protected programs
Object with field names array and count
StaticgetGet the type of a field in a storage program (JSON encoding only)
The RPC endpoint URL
The storage program address
The field name
Optionalidentity: stringOptional requester identity for ACL-protected programs
Object with field name and type
StaticgetGet an item from an array field by index (JSON encoding only)
The RPC endpoint URL
The storage program address
The array field name
The array index (0-based, supports negative indexing)
Optionalidentity: stringOptional requester identity for ACL-protected programs
Object with field name, index, value, and array length
StaticgetGet a specific field value from a storage program (JSON encoding only)
The RPC endpoint URL
The storage program address
The field name to retrieve
Optionalidentity: stringOptional requester identity for ACL-protected programs
Object with field name, value, and type
StaticgroupACLCreate a group-based ACL
Named groups with members and permissions
StorageProgramACL configured for group-based access
StatichasCheck if a field exists in a storage program (JSON encoding only)
The RPC endpoint URL
The storage program address
The field name to check
Optionalidentity: stringOptional requester identity for ACL-protected programs
Object with field name and exists boolean
StaticprivateACLCreate a private/owner-only ACL
StorageProgramACL configured for owner-only access
StaticpublicACLCreate a public ACL (anyone can read, owner writes)
StorageProgramACL configured for public read access
StaticreadRead data from a Storage Program (creates payload for RPC)
Note: This creates a payload for validation purposes. Actual reads should use RPC endpoints like GET /storage-program/:address
The storage program address to read from
StorageProgramPayload for validation
StaticrestrictedACLCreate a restricted ACL with allowed addresses
List of addresses allowed to access
StorageProgramACL configured for restricted access
StaticsearchSearch storage programs by name (supports partial matching)
The RPC endpoint URL
The name or partial name to search for
Optionaloptions: { Search options (exactMatch, limit, offset, identity)
OptionalexactOptionalidentity?: stringOptionallimit?: numberOptionaloffset?: numberArray of storage program list items
// Partial match search
const results = await StorageProgram.searchByName(
'https://node.demos.sh',
'config' // matches "appConfig", "myConfig", etc.
)
// Exact match search
const exact = await StorageProgram.searchByName(
'https://node.demos.sh',
'myConfig',
{ exactMatch: true }
)
// Paginated search
const page2 = await StorageProgram.searchByName(
'https://node.demos.sh',
'config',
{ limit: 10, offset: 10 }
)
StaticsetSet a specific field value in a storage program (JSON encoding only)
Creates a payload for the SET_FIELD operation. Use this with transaction submission flow.
The storage program address
The field name to set
The value to set (any JSON-serializable value)
StorageProgramPayload for transaction creation
StaticsetSet an item at a specific index in an array field (JSON encoding only)
Creates a payload for the SET_ITEM operation. Supports negative indexing (-1 = last item).
The storage program address
The array field name
The array index (0-based, supports negative)
The value to set at the index
StorageProgramPayload for transaction creation
StaticupdateUpdate access control settings for a Storage Program (owner only)
The storage program address
New access control configuration
StorageProgramPayload for transaction creation
// Change to public access
const payload = StorageProgram.updateAccessControl(
'stor-7a8b9c...',
{ mode: 'public' }
)
// Add users to blacklist
const payload = StorageProgram.updateAccessControl(
'stor-7a8b9c...',
{
mode: 'public',
blacklisted: ['demos1bad...', 'demos1spam...']
}
)
// Set up group-based access
const payload = StorageProgram.updateAccessControl(
'stor-7a8b9c...',
{
mode: 'restricted',
groups: {
admins: { members: ['demos1admin...'], permissions: ['read', 'write', 'delete'] },
users: { members: ['demos1user1...', 'demos1user2...'], permissions: ['read'] }
}
}
)
StaticupdateOptionalallowedAddresses: string[]StaticvalidateValidate JSON nesting depth (max 64 levels)
Only applicable for JSON encoding.
The data object to validate
Maximum allowed nesting depth (default: 64)
true if nesting depth is within limit
StaticvalidateValidate data size against 1MB limit
Data to validate (JSON object or base64 string)
Encoding type ("json" or "binary")
true if size is within 1MB limit, false otherwise
StaticwriteWrite/update data in a Storage Program
The storage program address (stor-{hash})
Data to write (JSON object or base64 binary string)
"json" or "binary" (default: "json")
StorageProgramPayload for transaction creation
StorageProgram - Unified storage solution for Demos Network
Supports both JSON (structured) and Binary (raw) data storage with robust access control and size-based pricing.
Features:
Example