Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

custodial-wallet

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

custodial-wallet

This Node.js application tracks native cryptocurrency balances (such as ETH, BNB, MATIC, TRX) and specific token balances (ERC-20, BEP-20, TRC-20) for given wallet addresses on Ethereum, Binance Smart Chain (BSC), Polygon, and Tron networks.

  • 1.0.1
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by25%
Maintainers
0
Weekly downloads
 
Created
Source

Create EVM & Tron Wallet and Track Balance

This Node.js application tracks native cryptocurrency balances (such as ETH, BNB, MATIC, TRX) and specific token balances (ERC-20, BEP-20, TRC-20) for given wallet addresses on Ethereum, Binance Smart Chain (BSC), Polygon, and Tron networks.

Features

  • Wallet Creation: Generate new wallet addresses for Ethereum-compatible (BSC, Polygon) and Tron networks.
  • Native Balance Tracking: Track the native cryptocurrency balances (ETH, BNB, MATIC, TRX) of specific wallet addresses.
  • Token Balance Tracking: Track balances of specific tokens (ERC-20, BEP-20, TRC-20) for specified wallet addresses.
  • Automatic Payment Tracking: Automatically track incoming payments and token balances.

Technologies Used

  • Node.js: Backend framework for running the server.
  • Express.js: Web framework for handling HTTP requests.
  • ethers.js: Library for interacting with Ethereum-compatible blockchains (BSC, Polygon).
  • TronWeb: Library for interacting with the Tron blockchain.

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/blockchain-balance-tracker.git
    cd blockchain-balance-tracker
    
  2. Install dependencies:

    npm install
    
  3. Start the server:

    node index.js
    

    The server will start running on http://localhost:3000.

API Endpoints

1. Create Wallet

  • URL: /create-wallet
  • Method: GET
  • Description: Generates new wallet addresses for Ethereum-compatible networks (BSC, Polygon) and Tron network.

Example Response:

{
    "bsc": {
        "address": "0xYourBscOrPolygonAddress",
        "privateKey": "YourPrivateKey"
    },
    "polygon": {
        "address": "0xYourPolygonAddress",
        "privateKey": "YourPrivateKey"
    },
    "tron": {
        "address": "TYourTronAddress",
        "privateKey": "YourPrivateKey"
    }
}
  1. Start Tracking

    URL: /start-tracking

    Method: GET

    Query Parameters: address: The Ethereum/BSC/Polygon wallet address. tronAddress: The Tron wallet address. tokenAddress: The smart contract address of the token you want to track. tokenType: The type of token (ERC20, BEP20, TRC20).

    Description: Starts tracking native and token balances for the specified wallet addresses.

Example Request:

sql

GET /start-tracking?address=0xYourBscOrPolygonAddress&tronAddress=YourTronAddress&tokenAddress=0xYourTokenAddress&tokenType=ERC20

Example Response:

json

{ "message": "Started tracking payments and token balance for address 0xYourBscOrPolygonAddress", "balances": { "bsc": "0.1234", "polygon": "0.5678", "tron": "9.8765", "token": "1000.00" } }

  1. Check All Balances

    URL: /check-all-balances

    Method: GET

    Query Parameters: address: The Ethereum/BSC/Polygon wallet address. tronAddress: The Tron wallet address. tokenAddress: The smart contract address of the token you want to track. tokenType: The type of token (ERC20, BEP20, TRC20).

    Description: Manually checks and returns the current balances for native currencies and specified tokens.

Example Request:

sql

GET /check-all-balances?address=0xYourBscOrPolygonAddress&tronAddress=YourTronAddress&tokenAddress=0xYourTokenAddress&tokenType=ERC20

Example Response:

json

{ "message": "Balances for address 0xYourBscOrPolygonAddress", "balances": { "bsc": "0.1234", "polygon": "0.5678", "tron": "9.8765", "token": "1000.00" } }

  1. Tracking Payments

The server will automatically track and log new payments and token balance changes every minute.

Polling Interval: Every 60 seconds.

How It Works

Create Wallets: You can generate new wallet addresses for BSC, Polygon, and Tron using the /create-wallet endpoint.
Start Tracking: Start tracking a wallet's native and token balances using the /start-tracking endpoint.
Check Balances: Manually check all balances using the /check-all-balances endpoint.
Automatic Tracking: The server checks for new payments and token balance changes every minute and logs any changes.

Limitations

The application currently tracks only one token at a time per request.
For tracking multiple tokens automatically, integration with an external service like Etherscan or BscScan would be required to fetch all tokens associated with a wallet.

Future Enhancements

Automatic tracking of all tokens held by a wallet address.
Integration with external APIs to fetch and display all tokens associated with a wallet.
Enhanced error handling and logging.

Contributing

Contributions are welcome! Please open an issue or submit a pull request to contribute to this project. License

This project is licensed under the MIT License.

css

This README.md file provides a clear and concise overview of how your application works, how to use it, and what features it provides. You can customize it further based on your specific requirements and add any additional sections that are relevant to your project.

FAQs

Package last updated on 10 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc