Bobine Contract Caller
Default entrypoint: scripts/call_bobine.mjs.
Upstream references
- Concept overview: https://www.bobine.tech/
- Bobine project: https://github.com/hazae41/bobine
- Standard libraries for Bobine WebAssembly VM: https://github.com/hazae41/stdbob
Scope
- Calling a Bobine module through
/api/execute - Preparing typed Bobine params for contract methods
- Generating Ed25519 keys for Bobine auth sessions
- Performing an authenticated
ed25519call with nonce handling and signature
Runtime requirements
- Node.js 20+
- Network access to a Bobine server
Load on demand
- Read
references/params.mdonly when params use packed arrays or quotedtext:payloads - Read
references/runtime.mdonly when spark handling, outputs, or failure modes are unclear - Use
scripts/keygen.mjsonly when the call needsed25519auth - Use
scripts/call_bobine.mjsfor all unsigned and signed calls
Quick workflow
-
Use
scripts/call_bobine.mjsas the default entrypoint for Bobine interactions. -
Read
references/params.mdonly if params are nested, packed, or need quotedtext:. -
Generate keys if the call needs
ed25519auth:node ./scripts/keygen.mjs -
Call the target contract with explicit arguments:
node ./scripts/call_bobine.mjs \ --server http://localhost:8080 \ --module <target-module> \ --method <target-method> \ --param text:Alice
Inputs
call_bobine.mjs--server: Bobine server base URL--module: target module address--method: target method name--param: repeat once per typed param--auth-module: optional deployeded25519auth module address--sigkey: required when--auth-moduleis provided--pubkey: required when--auth-moduleis provided--spark-hex: optional one-off spark value for this exact call--spark-effort: optional inline spark generation target
Param rules
- Scalars:
nullblob:<hex>bigint:<value>number:<value>text:<value>
- Arrays:
pack:[...]array:[...]
- Nesting is allowed
- Quote the whole shell argument when it contains brackets, commas, or spaces
- Quote the
text:payload itself when it contains,or], for exampletext:"a,b]"
Gotchas
--paramis one top-level Bobine param per flag; nested arrays stay inside a single typed param stringtext:values containing,or]must quote the payload itself, for exampletext:"a,b]"- Signed calls require all of
--auth-module,--sigkey, and--pubkey --spark-hexis a one-off override for a specific call; prefer--spark-effortwhen you want a fresh sparkkeygen.mjsprints secret material, so do not paste its output back to the user unless they explicitly ask for it
Signed call behavior
- Read
--server, target module, target method, and typed params - Build the Bobine session payload
[auth_module, pubkey] - Derive the session address from
sha256(pack(session)) - Query
<auth_module>.get_nonce(session_address) - Sign
[domain, module, method, params, nonce] - Call
<auth_module>.call(module, method, params, pubkey, signature) - Print a JSON object with logs, returned value, spark hex, and reported sparks
Output contract
- Scripts print a single JSON object on stdout on success
- Usage and failure diagnostics go to stderr
- Returned Bobine values are normalized into tagged JSON:
{ "type": "text", "value": "hello" }{ "type": "bigint", "value": "42" }{ "type": "array", "value": [...] }
keygen.mjsprints{ "sigkey": "...", "pubkey": "..." }
Safety
- Do not echo private keys back to the user unless they explicitly ask for them
- Treat
sigkeyas sensitive - Prefer a fresh inline spark by default; use
--spark-hexonly when you deliberately want to supply a one-off spark - Surface server errors and decoded logs instead of retrying blindly
Troubleshooting
Missing required call arguments: re-run with--server,--module,--method, and any required auth flagsUnknown value type: readreferences/params.mdFailed Bobine execute request: report the HTTP status and response bodyInvalid sessionorUnauthorized: the auth module, nonce, keys, or target contract assumptions are wrong