After the contract is deployed, how to automatically deduct the fee when web3 calls the contract method instead of calling metaMask

in ethernet, write the contract yourself. The front end uses vue+truffle.js, and then deploys it to the virtual node created by the local Ganache, and uses one of the account wallets as the source of deducting gas. However, when testing the contract, you need to call the payment confirmation box of metaMask every time to confirm whether the payment gas, can be used in actual use. I do not want users to see this, but to create a wallet for each account. And after initiating a virtual eth, use the virtual eth directly to automatically deduct the related fees.

how can I do that?

Oct.12,2021

1. Do not quite understand your needs, first of all, when deploying the contract to consume gas, your contract user does not need to deploy the contract, he saw that it is to call your contract, call the contract to see the consumption of gas, consumption is the user's own gas
2. Ethernet Square does not seem to have a withholding mechanism. If you do not want to consume a user's gas, you can return it to him
3 later. The function of secretly transferring money can not be realized, so the security of users' funds cannot be guaranteed. No matter who's gas, is withheld, they all need to sign

.
Menu