Skip to content

BigNumber.toHexString() has a 0 prefix, padding to even length #2468

Answered by ricmoo
HikariShine asked this question in Q&A
Discussion options

You must be logged in to vote

The .toHexString returns a bytes representation, which is always even lengthed, and is by design, as it simplifies most interaction with other components which require a valid BytesLike.

The JSON-RPC protocols use "quantity" values, which is what the utils.hexValue function does; when talking to any protocol which requires a quantity value that method should be used.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ricmoo
Comment options

@HikariShine
Comment options

Answer selected by ricmoo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
discussion Questions, feedback and general information.
2 participants
Converted from issue

This discussion was converted from issue #2467 on December 29, 2021 05:08.