Uint128, Uint256, Uint1024. Ok I get it... We can do big integers.
But why not going smaller, what about uint8, uint16, ...
The idea of this library is to be able to store multiple smaller felts into one bigger felt. As an example it is possible to store 62 felt of size 8 bits (0-255) into one unique felt.
Another use case could be to manipulate "strings" (understand a chain of character of length < 31 encoded on a single felt).
To show that this is working, I made an application that exists here with a contract deployed on testnet and a webiste deployed on IPFS.
The technical explanation is available here
Please refer to this file
If you want to know more about the performance of this library click here
Prerequisite - Have a working cairo environment.
To run the test suite, copy this repository and put yourself at the root.
Compile the contracts using make build
or nile compile
.
Run the tests using make test
or, for more details, pytest -v
.
For more details check the Actions tab of this GitHub repository.
starknet-felt-packing is released under the MIT.