Files
sonr/docs/reference/messages/dwn-write-record.mdx
T

49 lines
1.4 KiB
Plaintext

---
title: Write Data Record to DWN
description: Store structured data in your personal data vault with encryption and access control
seo:
title: "DWN Record Storage"
---
:::info
Records are the fundamental unit of data storage in DWN, supporting any data type with optional encryption.
:::
## Key Features
### Data Organization
- **Hierarchical Structure**: Use `parentId` to create nested record relationships
- **Protocol Compliance**: Conform to defined data structures via `protocol` and `protocolPath`
- **Schema Validation**: Enforce data integrity with JSON Schema URIs
### Privacy & Security
- **Encryption**: Client-side encryption before storage
- **Published Flag**: Control public accessibility
- **Attestations**: Cryptographic proofs of data integrity
### Common Use Cases
- **Personal Documents**: Store encrypted files and documents
- **Application Data**: Persist app-specific user data
- **Social Content**: Share public posts or media
- **Health Records**: Store sensitive medical data with encryption
:::tip
Use protocol definitions to ensure data interoperability across applications.
:::
## Example Record Types
```json
{
"protocol": "https://protocols.sonr.io/social/v1",
"protocolPath": "/posts/2024",
"schema": "https://schema.org/BlogPosting",
"published": true,
"data": "base64_encoded_content"
}
```
:::warning
Records exceeding `maxRecordSize` will be rejected. Large files should be stored in IPFS with only metadata on-chain.
:::