Documentation Index
Fetch the complete documentation index at: https://voltaire.tevm.sh/llms.txt
Use this file to discover all available pages before exploring further.
Try it Live
Run Blob examples in the interactive playground
Blobs created with fromData() use this format:
┌─────────────────┬──────────────┬─────────────┐
│ Length (8 B) │ Data (N B) │ Padding │
├─────────────────┼──────────────┼─────────────┤
│ Little-endian │ Original │ Zero bytes │
│ uint64 │ data │ │
└─────────────────┴──────────────┴─────────────┘
Bytes 0-7 Bytes 8-N Bytes N+1-131071
Total: 131,072 bytes (Blob.SIZE)
Example: Manual Decoding
import { Blob } from 'tevm';
const blob = Blob.fromData(new TextEncoder().encode("test"));
// Manual extraction (equivalent to toData())
const view = new DataView(blob.buffer, blob.byteOffset);
const length = Number(view.getBigUint64(0, true)); // Little-endian
const data = blob.slice(8, 8 + length);
console.log(length); // 4
console.log(new TextDecoder().decode(data)); // "test"
See Also
- fromData - Encode data into blob
- from - Universal constructor
- joinData - Join data from multiple blobs