如何使用 Web3 发送 Ether 并从另一个地址支付 Gas 费用?

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

我知道用这个发送以太币 (web3):

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

我正在尝试从地址 A 发送以太币到地址 B,然后由地址 C 为交易支付 gas 费。有人知道吗?

与您使用 listunspent 创建有效载荷的比特币原始交易不同,您不能在以太坊中为以太币执行此操作。

但是您可以为令牌执行此操作。例如:ERC20 Token,你可以让地址 A 到 approve 地址 C 代表他们花费 his/her ERC20。一旦approve交易完成,地址C就可以承担将ERC20代币从地址A转移到地址B的gas。