i am kinda new to golang and i would appreciate any help.

My main purpose is offline signing EIP1559 transactions based on a json using go-ethereum. I have managed to sign legacy transactions following docs and got success on eth transfers but my erc20 transactions were reverted. I have used types.NewTransaction() method and saw that it was deprecated.

I have been digging around the web to find some examples of the new EIP1559 transaction creation using types.NewTx() but i have been unsuccessful.

1 Answer 1


I have managed to create and sign transactions:

tx := types.NewTx(&types.DynamicFeeTx{
    ChainID: chainID,
    Nonce: nonce,
    GasFeeCap: feeCap,
    GasTipCap: tip,
    Gas: gas,
    To: &toAddress,
    Value: value,
    Data: txData,
  • 1
    Can you please post how you calculated feeCap and gas. This would really help me! Been struggling past two days.
    – Maddy
    Commented Nov 4, 2021 at 6:06
  • @Maddy here are some complete examples stackoverflow.com/questions/45558034/…
    – redCuckoo
    Commented Jun 5, 2022 at 9:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.