# Create a small file (won't match - < 1KB)
echo "Small file" > test-small.txt
# Create a medium file (won't match - < 1MB)
# Create a 500KB file
dd if=/dev/zero of=test-medium.bin bs=1024 count=512 2>/dev/null || echo "Creating test file..."
# Create a large file (will match - > 1MB)
# Create a 2MB file
dd if=/dev/zero of=test-large.bin bs=1024 count=2048 2>/dev/null || echo "Creating test file..."Windows PowerShell:
# Small file
"Small file" | Out-File -FilePath test-small.txt
# Medium file (500KB)
$bytes = New-Object byte[] 512KB
[System.IO.File]::WriteAllBytes("test-medium.bin", $bytes)
# Large file (2MB)
$bytes = New-Object byte[] 2MB
[System.IO.File]::WriteAllBytes("test-large.bin", $bytes)The file test-arweave-rules.json is already created with:
[
{
"minSizeBytes": 1024,
"provider": "arweave",
"mimeTypes": ["image/*", "video/*"]
},
{
"minSizeBytes": 1048576,
"provider": "arweave",
"mimeTypes": ["*"]
}
]What this does:
- Rule 1: Images/videos > 1KB → Arweave
- Rule 2: Any file > 1MB → Arweave
npx hardhat site:manifest \
--source . \
--externalrules ./test-arweave-rules.jsonOpen wttp.manifest.json and look for:
Files that match (will use Arweave):
{
"path": "./test-large.bin",
"type": "application/octet-stream",
"size": 2097152,
"externalStorage": "arweave",
"status": "pending",
"redirect": {
"code": 301,
"location": "ar://[pending]"
},
"chunks": []
}Note: Arweave uses ar:// protocol (not arweave://)
Files that don't match (will use blockchain):
{
"path": "./test-small.txt",
"type": "text/plain",
"size": 10,
"status": "pending",
"chunks": [
{
"address": "0x..."
}
]
}[
{
"provider": "arweave",
"mimeTypes": ["image/*"],
"extensions": [".png", ".jpg", ".jpeg", ".gif"]
}
][
{
"minSizeBytes": 10485760,
"provider": "arweave",
"mimeTypes": ["*"]
}
][
{
"minSizeBytes": 1048576,
"provider": "arweave",
"mimeTypes": ["image/*", "video/*"]
}
][
{
"provider": "arweave",
"extensions": [".mp4", ".mov", ".zip", ".pdf"]
}
][
{
"minSizeBytes": 1024,
"provider": "arweave",
"mimeTypes": ["*"]
}
]Create files:
tiny.txt(100 bytes) → ❌ Won't matchsmall.bin(2KB) → ✅ Will matchlarge.bin(5MB) → ✅ Will match
[
{
"provider": "arweave",
"mimeTypes": ["image/*", "video/*"]
}
]Files:
photo.png→ ✅ Will match (image/*)video.mp4→ ✅ Will match (video/*)document.pdf→ ❌ Won't matchscript.js→ ❌ Won't match
[
{
"minSizeBytes": 1048576,
"provider": "arweave",
"mimeTypes": ["image/*"],
"extensions": [".png", ".jpg"]
}
]Files:
small.png(500KB) → ❌ Too smalllarge.png(2MB) → ✅ Matches all criterialarge.gif(2MB) → ❌ Extension not in listlarge.jpg(2MB) → ✅ Matches all criteria
# Linux/Mac
ls -lh test-files/
# Windows PowerShell
Get-ChildItem | Select-Object Name, @{Name="Size(KB)";Expression={[math]::Round($_.Length/1KB,2)}}The manifest will show detected MIME types:
{
"type": "image/png", // ← This is what gets matched
"size": 2097152
}After generating manifest, search for:
# Find files using Arweave
grep -A 5 "externalStorage" wttp.manifest.json
# Or in PowerShell
Select-String -Path wttp.manifest.json -Pattern "externalStorage" -Context 0,5[{"minSizeBytes": 10485760, "provider": "arweave", "mimeTypes": ["*"]}][{"provider": "arweave", "mimeTypes": ["image/*", "video/*", "audio/*"]}][{"minSizeBytes": 1048576, "provider": "arweave", "mimeTypes": ["image/*", "video/*"]}][
{"minSizeBytes": 1048576, "provider": "arweave", "mimeTypes": ["*"]},
{"provider": "arweave", "mimeTypes": ["image/*", "video/*"]}
]How it works: Rules use OR logic - if ANY rule matches, file uses Arweave.
- ✅ File > 1MB → Matches first rule
- ✅ Image/video (any size) → Matches second rule
- ❌ Small text file → No match
[{"provider": "arweave", "extensions": [".mp4", ".mov", ".zip"]}]- ✅ Test with your own files
- ✅ Adjust rules to match your needs
- ✅ Generate manifest
- ⏭️ Implement Arweave upload (separate step)
- ⏭️ Update manifest with Arweave transaction IDs
- ⏭️ Upload redirects to WTTP site