Numbers Protocol
  • 📓Introduction
    • Numbers Protocol
      • Defining Web3 Assets
        • Assetization Process
        • Numbers ID (Nid)
        • Non-Fungible Tokens
        • Commit
        • AssetTree
          • integrityCid
          • digitalSourceType
          • miningPreference
          • nftRecord
        • Commit and AssetTree example
      • Glossary
      • Solution Stack
      • Use Cases
      • Roadmap & Milestones
      • Principles & Standards
    • Whitepaper
    • NUM Token
      • Get NUM
      • Bridge to Multiple Chains
      • Stake NUM
      • Liquidity Providers
      • NUM Utility
      • Token Allocation
      • Deflationary Token Economy
      • Audit Report
      • Distribution and Other Activities
      • Manage your NUM in Cold Wallet
      • 🛠️Developer Tools
    • NumbersDAO
      • Roles & Responsibilities
      • Become A DAO Member
      • Governance & Voting Rules - v2.0
      • [Deprecated] Governance Rules v1.0
    • Weekly Summary
      • 2023
        • 13 Jan 2023
        • 20 Jan 2023
        • 27 Jan 2023
        • 3 Feb 2023
        • 10 Feb 2023
        • 17 Feb 2023
        • 24 Feb 2023
        • 3 Mar 2023
        • 10 March 2023
        • 17 Mar 2023
        • 24 Mar 2023
        • 31 Mar 2023
        • 7 Apr 2023
        • 14 Apr 2023
        • 21 Apr 2023
        • 28 Apr 2023
        • 5 May 2023
        • 12 May 2023
        • 19 May 2023
        • 26 May 2023
        • 2 June 2023
        • 9 June 2023
        • 16 June 2023
        • 23 June 2023
        • 30 June 2023
        • 7 July 2023
        • 14 July 2023
        • 21 July 2023
        • 28 July 2023
        • 4 Aug 2023
        • 11 Aug 2023
        • 18 Aug 2023
        • 25 Aug 2023
        • 01 Sep 2023
        • 08 Sep 2023
        • 15 Sep 2023
        • 22 Sep 2023
        • 29 Sep 2023
        • 6 Oct 2023
        • 13 Oct 2023
        • 20 Oct 2023
        • 27 Oct 2023
        • 3 Nov 2023
        • 10 Nov 2023
        • 17 Nov 2023
        • 24 Nov 2023
        • 1 Dec 2023
        • 8 Dec 2023
        • 15 Dec 2023
        • 22 Dec 2023
        • 29 Dec 2023
      • 2024
        • 5 Jan 2024
        • 12 Jan 2024
        • 19 Jan 2024
        • 26 Jan 2024
        • 2 Feb 2024
        • 9 Feb 2024
        • 16 Feb 2024
        • 23 Feb 2024
        • 1 Mar 2024
        • 8 Mar 2024
        • 15 Mar 2024
        • 22 Mar 2024
        • 29 Mar 2024
        • 5 Apr 2024
        • 12 Apr 2024
        • 19 Apr 2024
        • 26 Apr 2024
        • 3 May 2024
        • 10 May 2024
        • 17 May 2024
        • 24 May 2024
        • 31 May 2024
        • 7 June 2024
        • 14 June 2024
        • 21 June 2024
        • 28 June 2024
        • 5 July 2024
        • 12 July 2024
        • 19 July 2024
        • 26 July 2024
        • 2 Aug 2024
        • 9 Aug 2024
        • 16 Aug 2024
        • 23 Aug 2024
        • 30 Aug 2024
        • 6 Sep 2024
        • 13 Sep 2024
        • 20 Sep 2024
        • 27 Sep 2024
        • 4 Oct 2024
        • 11 Oct 2024
        • 18 Oct 2024
        • 25 Oct 2024
        • 1 Nov 2024
        • 8 Nov 2024
        • 15 Nov 2024
        • 22 Nov 2024
        • 29 Nov 2024
        • 6 Dec 2024
        • 13 Dec 2024
        • 20 Dec 2024
        • 27 Dec 2024
      • 2025
        • 3 Jan 2025
        • 10 Jan 2025
        • 17 Jan 2025
        • 24 Jan 2025
        • 31 Jan 2025
        • 7 Feb 2025
        • 14 Feb 2025
        • 21 Feb 2025
        • 28 Feb 2025
        • 7 Mar 2025
        • 14 Mar 2025
        • 21 Mar 2025
        • 28 Mar 2025
        • 4 Apr 2025
        • 11 Apr 2025
    • Community Wiki
    • FAQ
      • What is provenance and how does it work?
      • What is C2PA and why do we need it?
      • What's the role of Numbers in AI?
      • What's the difference between Numbers and NFT
      • What's the difference between Numbers and C2PA
      • How can Numbers assist songwriters and artists?
      • Why Numbers needs its own blockchain?
      • Why Numbers Mainnet is permissioned?
      • Does Numbers support other blockchain?
      • How is the Nid generated?
      • Should I mint NFT or commit with "license-to" action?
      • Environmental impact of Numbers Mainnet
      • How do I get or bridge Mainnet/BEP-20/ERC-20 NUM?
      • What is Numbers Protocol's role in the AI space?
    • Partnership Programs
      • Creative Origins
      • Creative Innovators
      • Provenance Pioneers
  • 🌐Applications
    • User Tutorials
    • Verify Engine
      • Support Status
      • Search UI Interface
      • Asset Profile
      • Advanced Search & URL Parameters
    • Capture
  • 🛠️Developers
    • Numbers Blockchain
      • Testnet (Snow)
        • Testnet Launch PR
      • Mainnet (Jade)
      • Contract Overview
      • Commit Contract
        • How Commit Contract Works
        • assetTree File
        • On-chain Commit Logs
        • When Should You Use Commit Contract?
      • NFT Contract
    • Initial Asset Registration
    • Verify Engine API
      • Asset Search
      • NFT Search
      • Theft Detection
      • Support Status
    • Nit - Git for Media Files
      • Getting Started
      • Nit Bubble Plugin
    • Read Asset History
      • Read commits with Asset Profile
        • Embed social media into asset profile
      • Read commits via API
      • Read commits via nit module
      • Read commits via Bubble plugin
      • Get the merged AssetTree
    • Commit Asset History
      • Support Status
      • Commit via API
      • Commit via Nit module
      • Commit via Bubble plugin
    • More Tools
      • [NUM] Fetch NUM balance
      • [NUM] Transfer NUM from Custodial Wallet
      • [NUM] Check Staked Amount
      • [IPFS] Cat metadata from Nid/Cid
      • [IPFS] Create Metadata on IPFS
      • [IPFS] Check Nid/Cid on IPFS
      • [IPFS] Unpin Nid/Cid from IPFS
      • XMP parser
    • Working With Us
      • Job Opportunity
      • Reporting Security Vulnerability
Powered by GitBook
On this page
  • On Numbers Mainnet
  • Source code with nodejs14.x:
  • On All Networks
  1. Developers
  2. More Tools

[NUM] Fetch NUM balance

On Numbers Mainnet

To fetch NUM balance on Mainnet for a specific wallet, you can use the following API

API Endpoint: https://eoodjeosrg20qti.m.pipedream.net

Cost: 0, free to use

POST /

Description:
This endpoint allows you fetch NUM balance on Numbers Mainnet

Headers:
Content-Type: application/json

Request Body:
{
    "wallet": "0x1234567890abcdef1234567890abcdef12345678"
}

Examples:
curl -X POST https://eoodjeosrg20qti.m.pipedream.net \
     -H "Content-Type: application/json" \
     -d '{"wallet": "0x1234567890abcdef1234567890abcdef12345678"}'

In the API call, the Request body needs to have a key-value pair as "wallet" and a valid wallet address as value. More examples can be found below:

import json
import requests

url = "https://eoodjeosrg20qti.m.pipedream.net"
headers = {"Content-Type": "application/json"}
payload = {"wallet": "0x1234567890abcdef1234567890abcdef12345678"}

response = requests.post(url, headers=headers, data=json.dumps(payload))

print(response.text)
const data = {wallet: '0x1234567890abcdef1234567890abcdef12345678'};

fetch('https://eoodjeosrg20qti.m.pipedream.net', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(data),
})
.then(response => response.json())
.then(data => {
  console.log(data);
})
.catch(error => {
  console.error(error);
});

Replace the wallet in the examples to any wallet address you prefer.

Source code with nodejs14.x:

import { providers, BigNumber } from "ethers";

async function getUserNumBalance(userWallet) {
  // Create a provider to connect to the Ethereum network
  const numProvider = new providers.JsonRpcProvider(
    "https://mainnetrpc.num.network"
  );
  // Get the balance of the wallet as a BigNumber object
  const userNumBalanceObj = await numProvider.getBalance(userWallet);

  // Convert the balance from wei to Ether
  const weiPerEther = BigNumber.from(10).pow(14);
  const balanceInEther = userNumBalanceObj.div(weiPerEther)/10000;

  // Convert the balance to a string and return it
  const userNumBalance = balanceInEther.toFixed(4);
  return userNumBalance;
}

export default defineComponent({
    async run({ steps, $ }) {
        // Get the user address from the previous step
    const userAddress = steps.trigger.event.body.wallet;

    // Call the getUserNumBalance() function with the user address
    const balance = await getUserNumBalance(userAddress);

    // Return the balance to use it in future steps
    await $.respond({
      status: 200,
      headers: {},
      body: {"balance": balance},
    })
  },
});

On All Networks

To fetch NUM balance on ALL NETWORKS for a specific wallet, you can use the following API with your Capture Token:

API Endpoint: https://eoiu9t1jdjlxx5l.m.pipedream.net

Cost: 0.01 NUM

POST /

Description:
This endpoint allows you to create a new wallet with the given address.

Headers:
Content-Type: application/json
Authorization: token YOUR_CAPTURE_TOKEN

Authentication:
The API requires a valid token for Authorization. 
You can pass it in the headers of the request using the following format: 
"Authorization: token YOUR_CAPTURE_TOKEN"

Request Body:
{
    "wallet": "0x1234567890abcdef1234567890abcdef12345678"
}

Examples:
curl -X POST https://eoiu9t1jdjlxx5l.m.pipedream.net \
     -H "Content-Type: application/json" \
     -H "Authorization: token YOUR_CAPTURE_TOKEN" \
     -d '{"wallet": "0x1234567890abcdef1234567890abcdef12345678"}'

More examples can be found below:

import json
import requests

url = 'https://eoiu9t1jdjlxx5l.m.pipedream.net'
headers = {
    'Authorization': 'token YOUR_CAPTURE_TOKEN',
    'Content-Type': 'application/json'
}
data = {"wallet": "0x1234567890abcdef1234567890abcdef12345678"}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.content)
const url = 'https://eoiu9t1jdjlxx5l.m.pipedream.net';
const headers = {
  'Content-Type': 'application/json',
  'Authorization': 'token 1bd90eba5b902e6fd05701f49a8d8a4bf814cfcf'
};
const body = JSON.stringify({ wallet: '0x1234567890abcdef1234567890abcdef12345678' });

fetch(url, { method: 'POST', headers, body })
  .then((response) => response.json())
  .then((data) => {
    console.log(data);
  })
  .catch((error) => {
    console.error(error);
  });

PreviousMore ToolsNext[NUM] Transfer NUM from Custodial Wallet

Last updated 1 year ago

In the API call, the Request body needs to have a key-value pair as "wallet" and a valid wallet address as value. The API will return the NUM balance for the specified wallet. Please note, this API requires authorization with your Capture Token. Follow to register and acquire it.

🛠️
the instructions