Getting Transaction Info of a BitClout User

Getting Transaction Info of a BitClout User

·

2 min read

Sometimes you might want to see history of a BitClout user like history of usernames they had, history of their profile pictures, history of their profile description and other activities they have done so far on BitClout!

That's where one needs to study the blockchain explorer! You might want the fetch the transaction info through few lines of code, right ? Well, that's where we use the transaction-info endpoint! The endpoint returns a GIGANTIC JSON file that contains the history of all transaction for a user. The size of the JSON returned by the endpoints depends upon how many transactions they have done on the platform or in other words the size depends upon how much active a user has been till date on BitClout!

Below is a working code that fetches the transaction info of DevsClout account on BitClout. The endpoint only requires public key.

import json
import requests

def getTransaction(publicKey):
  payload ={"PublicKeyBase58Check":publicKey}
  response = requests.post("https://api.bitclout.com/api/v1/transaction-info", json = payload)
  file = open("TransactionInfo.json", "w")
  json.dump(response.json(), file) #Here we create and dump the JSON returned in the file TransactionInfo.json
  file.close()
  return response

if __name__ == "__main__":
  print(getTransaction("BC1YLg2zWr6UfJ1TerZuvPN3kAZD1B8t5UARLehiEswuW6X1RPmLPTL")) #passing the public key to find the transaction history of that user

If the above code prints <Response 200>, you can see a new file created named TransactionInfo.json that contains all the history of transactions for a user.

NOTE: The endpoint returns GIGANTIC data and it can take some time to fetch the transaction info. For test purpose try fetching transaction info of newly created accounts.

If you like the article don't forget to let us know in the comments or maybe give a shout to DevsClout ? You can also join DevsClout discord server to chat with more devs who are building awesome projects on BitClout! We would love to hear back from you!