Skip to content

How do I get a JSON-RPC quantity value? #2726

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

You must be logged in to vote

The hexlify function returns the bytes representation, which means it will be of even length and can be safely used to interchange the two formats without having to understand the padding operation to reverse the process (bytes, which pad the right, vs numeric, which pads the left).

You want to use the utils.hexValue function to compute the “quantity” type, used commonly in the Ethereum JSON-RPC API.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by einaralex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2725 on February 22, 2022 03:20.