Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On-chain state advanced #854

Open
Pfed-prog opened this issue Feb 16, 2024 · 2 comments
Open

On-chain state advanced #854

Pfed-prog opened this issue Feb 16, 2024 · 2 comments

Comments

@Pfed-prog
Copy link

Pfed-prog commented Feb 16, 2024

Diving into a smart contract details further.

In On-chain state Section of a smart contract
https://docs.minaprotocol.com/zkapps/o1js/smart-contracts#on-chain-state

image

It says that the state can consist of at most 8 fields of 32 bytes each.

But there are no details further. For example, I have used a simple trial and error method to see how this works in practice. For me 9 states worked as well.

image

Also, when I switched PublicKey instead of a Field the test script failed. Hence, PublicKey seems to take more space than a Field.

image

Removing one additional Field worked just fine.

image

I have tested my finding further -- and found out that 2 Fields is equivalent to 1 PublicKey

@Pfed-prog Pfed-prog changed the title on-chain state On-chain state advanced Feb 19, 2024
@Pfed-prog
Copy link
Author

It would be amazing to come back to some resource that contains more information on state optimization.

For example, @IamZKdevETH probably his github -> @iam-dev shared with me the following repository that aims to pack data

https://github.com/45930/o1js-pack

@Pfed-prog
Copy link
Author

Pfed-prog commented Mar 5, 2024

I am not sure if this is the right place to just post walls of texts, excuse me.

In ERC-20 some tokens implement states that contain strings, I think from projects implemented during hackathons this is the main thing that stands out to me.

I have posted some thoughts on how to use available URI for this purpose
https://forums.minaprotocol.com/t/mina-smart-contract-uri/6232/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant