Repository navigation
Methodology
The user provides a smart contract artifact (.sol or .wasm) through one of two interfaces:
-
CLI: using
curl -F "file=@contract.wasm" http://localhost:3000/api/validateorcurl -F "file=@ValidContract.sol" http://localhost:3000/api/validate -
Web UI: by navigating to
http://localhost:3001, clicking Validate, and selecting a.solor.wasmfile via the file picker
The Rust backend (running on port 3000) receives a POST /api/validate request with the file as multipart/form-data. The server extracts the binary payload from the multipart stream.
The validation engine applies checks based on the selected contract type:
- Solidity path — Parses and validates Solidity input, and can return ABI/bytecode artifacts for deployment.
-
WASM magic number check — Verifies CosmWasm binaries start with WASM magic bytes
\0asmand valid version. - WASM section parsing — Parses key WASM sections for structural correctness.
- CosmWasm interface/memory checks — Verifies required exports and memory constraints.
- Size validation — Records the binary size in bytes.
The validator returns a structured result to the HTTP handler, which serializes it to JSON:
// Valid contract
{ "valid": true, "message": "WASM contract passed CosmWasm validation", "size_bytes": 134639 }
// Invalid contract
{ "valid": false, "message": "<error description>", "size_bytes": <n> }- CLI users see the raw JSON in the terminal.
- Web UI users see a formatted result card on the page indicating pass/fail, the message, and the contract size.
function validate(wasm_bytes):
if wasm_bytes[0:4] != WASM_MAGIC:
return { valid: false, message: "Not a valid WASM file" }
sections = parse_wasm_sections(wasm_bytes)
if not sections.has_valid_structure():
return { valid: false, message: "Malformed WASM sections" }
exports = sections.get_exports()
required = ["instantiate", "execute", "query"]
for entry_point in required:
if entry_point not in exports:
return { valid: false, message: "Missing required export: " + entry_point }
if sections.memory_pages > MAX_MEMORY_PAGES:
return { valid: false, message: "Memory exceeds CosmWasm limits" }
return { valid: true, message: "WASM contract passed CosmWasm validation", size: len(wasm_bytes) }
[User / curl]
│
│ .wasm binary (multipart POST)
▼
[Rust HTTP Server — /api/validate]
│
│ raw bytes
▼
[WASM Binary Parser]
├── Magic number check ──────────────────────▶ FAIL → return error JSON
├── Section structure check ─────────────────▶ FAIL → return error JSON
├── CosmWasm export interface check ─────────▶ FAIL → return error JSON
└── Memory limits check ─────────────────────▶ FAIL → return error JSON
│
│ all checks pass
▼
[Build success JSON response]
│
▼
[Return to client: { valid, message, size_bytes }]
┌─────────────────────┐
│ User uploads .wasm │
└──────────┬──────────┘
│
┌──────────▼──────────┐
│ POST /api/validate │
└──────────┬──────────┘
│
┌──────────▼──────────┐
│ Valid WASM magic? │──── NO ────▶ { valid: false }
└──────────┬──────────┘
YES
┌──────────▼──────────┐
│ Valid sections? │──── NO ────▶ { valid: false }
└──────────┬──────────┘
YES
┌──────────▼────────────────┐
│ CosmWasm exports present?│── NO ─▶ { valid: false }
└──────────┬────────────────┘
YES
┌──────────▼──────────┐
│ Memory within │
│ limits? │──── NO ────▶ { valid: false }
└──────────┬──────────┘
YES
┌──────────▼──────────┐
│ { valid: true } │
└─────────────────────┘
The platform also supports Solidity contract workflows in addition to CosmWasm validation.
Users can select the Solidity mode from the frontend validator interface and upload .sol files.
The frontend sends the selected file to the backend validation API through the same user flow.
For Solidity responses, the backend can return compiled artifacts such as ABI and bytecode.
This enables a continuous path from validation to deployment readiness inside one interface.
For Solidity and EVM-compatible deployment, wallet integration is handled through MetaMask. The UI provides a wallet connect button that requests account access from the browser wallet provider. Connected account state is retained in frontend context so deploy actions can use the active address. If no wallet is detected, the UI prevents deployment and prompts the user with a clear error. For CosmWasm workflows, Keplr wallet integration is used with explicit testnet chain configuration.
After successful validation, users can trigger deployment from the file result row in the UI.
For Solidity, deployment uses the returned bytecode and sends a transaction via eth_sendTransaction.
The app then polls transaction receipt status until a contract address is available.
When deployment succeeds, the deployed contract address is displayed in the interface.
For CosmWasm, deployment follows upload and instantiate steps through SigningCosmWasmClient.
This design keeps validation, wallet authorization, and deployment in one cohesive experience.
Deployment actions are intentionally available only for contracts that pass validation first. This gating reduces accidental deployment of malformed or unverified contract artifacts. Wallet-related failures are reported to the user to support quick recovery and retries. Using this combined flow improves developer productivity during local testing and demos.