Move the cloudto the client.
Scaffold is a protocol that runs in the browser and turns your users into infrastructure. Write your contracts in WebAssembly, and Scaffold manages the rest.
import { Scaffold, makeBrowserConfig } from 'scaffold.io';
// Connect to the Scaffold network.
const scaffold = new Scaffold(makeBrowserConfig());
// Any WASM contract, addressed by its hash.
const contract = '3338be694f50c5f338814986cdf0686453a888b84f424d792af4b9202398f392';
// Contracts natively process byte arrays, but expose serializers to make development easier
const params = await scaffold.serializeParamsObj(contract, { name: 'World' });
// Routed to a peer that has the contract; the peer
// runs it and returns the collateralized result.
await scaffold.fetch({
contract,
params,
onResult: async (result) => {
const { message } = await result.parse();
console.log(message); // → "Hello World!"
},
});Connected peers—
WASM contracts executed—
Blocks received—
Total DAG size—
Scaffold provides four things.
01 · Mesh
A peer-to-peer mesh.
Your users connect directly to one another over WebRTC, forming a network with no server in the middle.
02 · Routing
A request/response protocol.
Every request is answered by the closest, most efficient peers that hold the contract.
03 · Trust
Collateralization & verification.
Peers stake collateral on the answers they return. Incorrect responses are detected and penalized.
04 · Currency
A consensus layer.
A built-in currency focused on high-frequency, low-throughput transactions backs the micropayments that collateral requires.