Created
May 15, 2023 13:27
-
-
Save Aviksaikat/41c058e47fa3f78124ba82daf6f70c65 to your computer and use it in GitHub Desktop.
convert an integer to bytes32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from brownie import web3 | |
value = 1 | |
# * convert it to bytes32 | |
value = value.to_bytes(32, byteorder="big") | |
>>> value | |
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' | |
>>> value.hex() | |
'0000000000000000000000000000000000000000000000000000000000000001' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment