Integrating with NEAR Protocol

  • Proof of Stake
  • Sharded
  • WASM Smart Contracts
DISCLAIMER: This will not take you more than 30 minutes if you can program in TypeScript.
git clone
We only care about these 2 folders and 1 file
  • storage.getPrimitive — get/set
  • persistentMap — set/get
  • persistentUnorderedMap — set/get/query/length
let balance = myPersistentMap.get("myacc.near", u128.Zero)!
npm install near-cli -g
yarn build
ACC1=$(near dev-deploy out/main.wasm | sed 's/.*id: \(.*\), node.*/\1/' | head -n 1)
near view --accountId $ACC1 $ACC1 getCounter '{}'
View call: dev-1623290109414-64922580028342.getCounter({})
near call --accountId $ACC1 $ACC1 incrementCounter '{"value": 1}'
node << EOF
const fetch = require('node-fetch');
async function go() {
const args_base64 = Buffer.from('{}').toString('base64')
const params = {account_id: "gpux.near", method_name: "mint_status",
request_type: "call_function", finality: "final", "args_base64": args_base64}
const json_args = {jsonrpc: "2.0", id: "1", method: "query", params: params}

const fetch_args = {
method: "POST",
body: JSON.stringify(json_args),
headers: {
"Content-Type": "application/json"
const response = await fetch("", fetch_args);
const {result} = await response.json();

const mint_status = JSON.parse((new TextDecoder()).decode(new Uint8Array(result.result)))
"total_minted": "3120000000000000000000000000",
"level": "0",
"near_price": "3000000000000000000000000",
"gpux_price": "10000000000000000000000"



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store