Onchain JS

JavaScript bridge for Ethereum — run npm packages on the BEAM via QuickBEAM. No Node.js required. Built on onchain.

Package Family

PackagePurposeNative Deps
onchainCore Ethereum primitives, RPC, ABI, signingNone (pure Elixir)
onchain_aaveAave V3 protocol wrappersNone (pure Elixir)
onchain_evmRust NIFs: revm simulation, Solidity parsing, codegenRustler
onchain_js (this)JS bridge: npm packages on the BEAMQuickBEAM (Zig NIF)

Pick what you need — consumers who only need eth_call never compile Zig or Rust.

Installation

def deps do
[
{:onchain_js, "~> 0.3"}
]
end

Use Cases

How It Works

QuickBEAM embeds QuickJS-NG as a Zig NIF. Each runtime is a GenServer with a persistent JavaScript context. npm_ex manages package installation without Node.js.

Discovery

The API describes itself, so an agent can learn how to call it without reading the source:

OnchainJs.describe() # modules and namespaces
OnchainJs.describe(:runtime) # function list with specs
OnchainJs.describe(:runtime, :eval) # params, kinds, defaults, return shape

Parameters are tagged by kind: :value is something you supply, :exchange_data is something you must obtain first (the runtime handle names start_link/1 as its source). Descripex.Manifest.build/1 renders the whole surface as JSON and Descripex.MCP.tools/1 renders it as MCP tool definitions.

Testing

mix test.json --quiet # Unit tests
mix test.json --quiet --include integration # Integration tests (requires QuickBEAM)

License

MIT