Web3.swift
Web3.swift copied to clipboard
sendRawTransaction Send a transaction error
couldn't retrieve sender address ('') from the ethereum transaction: invalid chain id for signer: tx intended signer does not match the given signer: tx intended signer does not match the given signer
@dengbangquan Please provide an example to reproduce the issue. I heard about this issue multiple times but couldn't reproduce it.
For example: let web3 = Web3.init(rpcURL: "https://rpctest.ic-plaza.org",rpcId: 9000) let from = try! EthereumAddress.init(hex: "0x93B491B844d9e473Fc320F2d9430901F8b35f46B", eip55: false) let to = try! EthereumAddress.init(hex: "0x0ec48ce4af97fd6bb1d0d99d8957bf76fb651dc6", eip55: false) web3.eth.getTransactionCount(address: myPrivateKey.address, block: .latest) { resp in let noce = resp.result let tx = EthereumTransaction( nonce: noce, gasPrice: 21000, gas: 80000, from: from, to: to, value: EthereumQuantity(quantity: 1.eth) ) let signt = try! tx.sign(with: myPrivateKey,chainId: 9000) web3.eth.sendRawTransaction(transaction: signt, response: { resp in
print("sendRawTransaction === \(resp)") }) }
Okay