简体   繁体   中英

How to send Ether Using Web3 and Gas Charges are Paid from Another Address?

I know using this for send Ether (web3):

web3.eth.sendTransaction({
    from: 'Address A',
    to: 'Address B',
    value: '1000000000000000'
})
.then(function(receipt){
    ...
});

I'm trying to send ether from address A to address B, then the gas fee is paid by address C for the transaction. Does anyone know about that?

Unlike Bitcoin's raw transaction you create payload with listunspent , you can't do this for ether in Ethereum.

However you can do this for tokens. Ex: ERC20 Token, you can have address A to approve address C to spend his/her ERC20 on their behalf. Once the approve transaction has completed, address C can bear the gas for transferring ERC20 token from address A to address B.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM