Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sendRawTransaction Send a transaction error #146

Open
July-Only opened this issue Nov 5, 2022 · 2 comments
Open

sendRawTransaction Send a transaction error #146

July-Only opened this issue Nov 5, 2022 · 2 comments

Comments

@July-Only
Copy link

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

@koraykoska
Copy link
Member

@dengbangquan Please provide an example to reproduce the issue. I heard about this issue multiple times but couldn't reproduce it.

@urica12
Copy link

urica12 commented Nov 22, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants