Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

web3.js no way to sign a transaction offline #7427

Open

Description

@bithalo

Expected behavior

web3.eth.accounts.signTransaction(transaction, privateKey);
does not let you sign a transaction when chainId, nonce and gasLimit and gasPrice are supplied when offline

Actual behavior

It just throws an error about whatever you did to initialize the web3 instance (which cannot be blank) for example if one connects to ankr essentially it's saying it would not connect to them and fails.
This is unacceptable for a half trillion dollar project... offline signing is the only safe way to sign and should be the industry
standard. But yet it is so desperate to perform some online checks in the wrong function that it throws an error.

Trying to hold back some intense frustration. How many thousands of contributors, will they recommend "oh use a different library for that"... ridiculous.

Steps to reproduce the behavior

  1. Turn off your wifi
  2. Sign some TX object
  3. FAIL

It should work out of the box and I read through all documentation and spent a few hours googling which is more and more thin with results day by day. Running out of options here don't tell me I have to digest everything manually?!

Recommendation... don't throw an error, try to actually sign the object, don't attempt to pull or check for information that is already in your TX object or to validate or allow a flag for offline signing.

Environment

web3 version 0.5.7... assuming it's the same in all versions correct me if this isn't the case
Vanilla JS

Activity

  1. razhzq commented on Dec 28, 2024

    @razhzq

    i can see that the function account.signTransaction requires network access to get the account nonce and chainId. Can i pick this up

  2. jdevcs commented on Jan 21, 2025

    @jdevcs
    Contributor

    Thank you for creating this issue. We appreciate your contributions to the Web3.js library.
    As you may be aware, we are in the process of sunsetting Web3.js, Our focus during this transition will be on addressing critical issues to ensure a smooth migration for our users.
    For further details regarding the sunsetting of Web3.js, please refer to the official announcement here: Web3.js Sunset Announcement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions