Open tzuhanli opened 6 years ago
Please change the following line:
let signedTx: EthereumSignedTransaction = try transaction.sign(with: myPrivateKey)
to something like that:
let signedTx: EthereumSignedTransaction = try transaction.sign(with: myPrivateKey, chainId: 1)
and change the chainId accordingly if you are in a different network than mainnet. See this link for testnet chainIds.
Hello, I have a simple smart contract about read and write some value.
I can read my “owner” value successfully, but can not write value to the “owner”. When I send transaction to contract, it will return “*Error(code: -32000, message: “insufficient funds for gas price + value”)”, but I’m sure my account have enough gas. (2996400390000000001**)
I created a EthereumTransaction, signed it with my privateKey, and use “sendRawTransaction” to send it. Please help me realize my problem, thank you very much!
My Contract:
My Code: