4

I am learning to build Dapps using Python. I am using Flask for the web scripting part and Ganache as a local blockchain.

Currently, I am using this method to fetch account in Python.

ganacheURL = "HTTP://127.0.0.1:7545"
web3 = Web3(Web3.HTTPProvider(ganacheURL))
web3.eth.defaultAccount = web3.eth.accounts[0]   #First account in Ganache

I am using a Custom RPC in Metamask which is connected to Ganache. I want to know if it is possible to fetch the current account address from Metamask using Python-Flask. If possible, please tell.

Something like:

currentAccountAddresss = getCurrentMetamaskAccount()  #Fetches Current Metamask account

This address should change whenever I choose another account in metamask. Any kind of help would be appreciated.

Gaurav
  • 333
  • 1
  • 16

0 Answers0