nspcc-dev / neo-go

Go Node and SDK for the Neo blockchain
MIT License
123 stars 79 forks source link

Provide library functions to convert numbers into BE-ordered byte strings #3606

Open roman-khimov opened 1 month ago

roman-khimov commented 1 month ago

Is your feature request related to a problem? Please describe.

I'm always frustrated when contracts have to write code to deal with simple problems. BE-serialized integers are useful because of their ordering characteristics, but default int->bytes conversion is LE in the VM.

Describe the solution you'd like

Provide methods to obtain fixed-width byte string from integer in BE format.

Additional context

https://github.com/nspcc-dev/neofs-contract/pull/438