Search code examples
nearprotocol

Where/how is the smart contract webassembly binary stored in NEAR protocol?


How can you extract the smart contract WebAssembly binaries by exploring the NEAR protocol blockchain?


Solution

  • Example:

    http --json post https://rpc.mainnet.near.org jsonrpc=2.0 id=dontcare method=query \
    params:='{"request_type":"view_code","finality":"final","account_id":"contract.near"}' \
    | jq -r .result.code_base64 \
    | base64 --decode > contract.wasm