0

I am asked to build a small EVM with few instructions using Golang. What I am confused about is how to represent the uint256 data type? Because Golang supports at most uint64 for integer type. What I thought at first was to store the hex value as string, but I am not sure about how to do math operations on that string, and even if its an acceptable solution. How can I represent the uint256 with Golang?

Or even going further, how will I represent the memory in that case? Because it can grow much much bigger than 32 bytes as well.

2 Answers 2

0

You can take a look at this on how to represent uint256 data type using Golang:

How generate number type uint256 in Go

1
  • I found that as well but it is outdated :( Commented Nov 17, 2022 at 23:55
0

It seems that the currently used package is the following uint256 package: https://pkg.go.dev/github.com/holiman/uint256#section-readme

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.