user129156: So, first of all i will be creating these wallet addresses on my end using below code:
 const diviMainnet = {
                    messagePrefix: '\x19Divi Signed Message:\n',
                    bech32: 'divi',
                    bip32: {
                      public: 0x22d2533,
                      private: 0x221312b
                    },
                    pubKeyHash: 0x1e,
                    scriptHash: 0xd,
                    wif: 0xd4
                  }
                  const keyPair = ECPair.ECPair.makeRandom();
                  const { address } = bitcoin.payments.p2pkh({ pubkey: keyPair.publicKey, network: diviMainnet });

I am storing the WIF as below
     myWallet =     {
                    "pubKey": address,
                    "wif": keyPair.toWIF()
                  }
//save to db

now how do i check the balance of the above wallet at any point later?
I am using bitcoinjs library on nodejs.

user93595: To get a balance of the address you need a view of the blockchain's current utxo set. This is typically done by syncing a node. I don't believe bitcoinjs has the capability to be a node (nor it is recomended to use it as one if it does).
Using bitcoin core you could add it to the wallet and do a rescan.
Alternatively you can use something that requires more trust and ping a block explorer. Bitcoinjs has an example on how to do this here https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/addresses.spec.ts#L10

129156: <p>So, first of all i will be creating these wallet addresses on my end using below code:</p>
<pre><code> const diviMainnet = {
                    messagePrefix: '\x19Divi Signed Message:\n',
                    bech32: 'divi',
                    bip32: {
                      public: 0x22d2533,
                      private: 0x221312b
                    },
                    pubKeyHash: 0x1e,
                    scriptHash: 0xd,
                    wif: 0xd4
                  }
                  const keyPair = ECPair.ECPair.makeRandom();
                  const { address } = bitcoin.payments.p2pkh({ pubkey: keyPair.publicKey, network: diviMainnet });
</code></pre>
<p>I am storing the WIF as below</p>
<pre><code>     myWallet =     {
                    &quot;pubKey&quot;: address,
                    &quot;wif&quot;: keyPair.toWIF()
                  }
//save to db
</code></pre>
<p>now how do i check the balance of the above wallet at any point later?</p>
<p>I am using bitcoinjs library on nodejs.</p>
 93595: <p>To get a balance of the address you need a view of the blockchain's current utxo set. This is typically done by syncing a node. I don't believe bitcoinjs has the capability to be a node (nor it is recomended to use it as one if it does).</p>
<p>Using bitcoin core you could add it to the wallet and do a rescan.</p>
<p>Alternatively you can use something that requires more trust and ping a block explorer. Bitcoinjs has an example on how to do this here <a href="https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/addresses.spec.ts#L10" rel="nofollow noreferrer">https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/addresses.spec.ts#L10</a></p>
