How to perform eth contract transaction in Django using web3.py and Metamask
Trying to build a Dapp using Django, till now completed below steps.
- Deployed a simple lottery contract on test net, contract address is 0xD5d56C139848A0E55DC5C616D04a0CeD98D8BeA3 (can be seen at https://sepolia.etherscan.io/)
- Using web3.py I can connect to this contract and call the functions.
- I have created a simple webapp which ask user to connect to its Metamask wallet.
- I am using JS to load the Metamask wallet in the browser.
- When user click on connect wallet Metamask extension loads in the browser.
- Once user gets connected I can read the address of the connected user.
Next step is user will click on enter lottery button, after that Metamask should popup to sign the transaction.
The Problem is I want to use the web3.py in my Django view to call my contract function which will allow user to enter in to the lottery game, but how can I call Metamask from Django view to ask user to sign transaction as it is browser extension.
but how can I call Metamask from Django
The whole point of the blockchain is that any call from the user goes directly to the blockchain, and there is no backend server that could block or censor what users are doing.