Blog

  1. Blog
  2. GRPC contract for Polygon
šŸ—“ March 6, 2023 | šŸ•‘ 3 min

GRPC Contract for Interaction with Polygon

Overview

This GRPC contract enables you to obtain cryptocurrency data from various blockchain networks (etherium, polygon, near, binance smart chain, tron) for use in your web3 applications.

Specifically, you can retrieve balance information and transaction history for ERC20 tokens on the Polygon blockchain.

Table of contents

Latest Version

You can access the latest version of the contract here:

wget https://raw.githubusercontent.com/cryptomation/grpc-contract/main/universal-api.proto
copy

Usage

To use the contract, follow these steps:

  • First you need to create api keys for needed network here: šŸ‘‰ CryptoMation/Console
  • Download proto file from this repository: šŸ‘‰ CryptoMation/grpc-contract
  • Compile proto file with grpc compiler: šŸ‘‰ protoc --go_out=plugins=grpc:. universal-api.proto

Available Methods

  • getBalance - retrieves the balance of an account in the network.
  • getTransactions - retrieves the transaction history (include erc20) of an account in the network.

Example: Retrieving Transaction History on Polygon blockchain

āš  Possible values for network param: near, near-testnet, near-mainnet, polygon, polygon, tron

āš  Note that you must have grpcurl to run this example.

grpcurl -plaintext -d '{"api_key": "insert_you_api_key", "network":"Polygon", "address": "0xdec0de7e6ed3ee7bb3a2c0baae7827d101d1ec20"}' grpc.cryptomation.com com.cryptomation.universal.api.v1.grpc.UniversalCryptoApi/getTransactions
copy

Example: Retrieving Balance Information on Polygon blockchain

āš  Possible values for network param: near, near-testnet, near-mainnet, polygon, polygon, tron

āš  Note that you must have grpcurl to run this example.

grpcurl -plaintext -d '{"api_key": "insert_you_api_key", "network":"polygon", "address": "0xdec0de7e6ed3ee7bb3a2c0baae7827d101d1ec20"}' grpc.cryptomation.com com.cryptomation.universal.api.v1.grpc.UniversalCryptoApi/getBalance
copy

More info?

Much more info about our API method you could found on our docs!


Ready to get started?

Our api help your project gain easy access to a sea of crypto data.

If you want to try our Universal API, please enter your email or login from Google Gmail:

Continue with