New Here? Claim Your 30% Discount on Your First Blockchain Node Access!

banner image

Last updated on January 1, 1970

1 min read

Method query%28view_code%29 undefined ()
connect with JSON-RPC protocol

query%28view_code%29

info-circle-fill

Returns the contract code (Wasm binary) deployed to the account. Pleasenote that the returned code will be encoded in base64.

Parameters

request_type - string

type of request

finality - string

You should pick either that or block_id.

Can be either "optimistic" or "final"

block_id - int or string

You should pick either that or finality.

The block_id param can take either the block number OR the block hash as an argument.

account_id - string

account id

Request

curl --location --request POST 'https://near.getblock.io/mainnet' \ 
--header 'x-api-key: YOUR-API-KEY' \ 
--header 'Content-Type: application/json' \ 
--data-raw '{"jsonrpc": "2.0",
"method": "query",
"params": {"request_type": "view_code", "finality": "final", "account_id": "staked.poolv1.near"},
"id": "getblock.io"}'

Response

{
    "id": "getblock.io",
    "jsonrpc": "2.0",
    "result": {
        "block_hash": "4BsKpcha4YcZCjy7wDs9DPWZ4q9GNe6mKF5KfCRhGfJj",
        "block_height": 61075007,
        "code_base64": "AGFzbQEAAAAB7wNBYAJ/fwF/YAF/AGAAAX9gAn9+AGAFf35+fn4AYAN/fn4BfmABfwF+YAN/fn4AYAZ/fn5+fn4BfmAEf35+fgF+YAR/fn5+AGAKf35+fn5+fn5+fgBgAn9+AX5gCH9+fn5+fn5+AGACf38AYAN/f38Bf2ACfn4AYAF+AX5gAX4AYAABfmADfn5+AGAAAGAIfn5+fn5+fn4BfmAJfn5+fn5+fn5+AX5gAn5+AX5gA35+fgF+YAd+fn5+fn5+AGAEfn5+fgBgCX5+fn5+fn5+fgBgBX5+fn5+AX5gA39/fwBgAX8Bf2ACf3wAYAR/f39+AGAFf39/fn8AYAV/f39/fwBgBH9/f38AYAN/f34AYAV/f39/fwF/YAR/f39/AX9gBn9/f39/fwBgAn9/AX5gBX9/fn9/AGAFf39+fn4AYAR/f35+AGAJf35+fn5+fn5+AX5gCn9+fn5+fn5+fn4BfmAGf39/fn5+AGADf39/AX5gAn5/AX5gA35/fwBgCH5/f39/fn5+AGAEfn5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AAAAAAAd6QEAP+kBAAAAAAAAAAAAHukBAEDpAQAAAAAAAAAAAB/pAQBB6QEAAAAAAAAAAAAg6QEAQukBAAAAAAAAAAAAIekBAEPpAQAAAAAAAAAAAExheW91dEVycnByaXZhdGUAQdifwwALMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
        "hash": "J1arLz48fgXcGyCPVckFwLnewNH6j1uw79thsvwqGYTY"
    }
}
banner icon

Start Building with GetBlock RPCs for Free