bettercallsol
bettercallsol copied to clipboard
Share On-Chain Program
One option to share transactions with other users, as part of the documentation, etc. is to store our external representation on-chain. This will likely require a program.
Requirements:
- Store provided data in a data account
- Should be able to append data, in scenarios where data is too big for a single transaction and is broken across many
- The user (wallet) should be able to modify the content at a later time
- We should be able to fetch a list of "shared transactions" for a given wallet
- Allow users to define how much space they are willing to pay rent for
- Since this is a free service, besides the cost of program deployment, the rest of the costs should be covered by the users
We will tackle the client-side of this later but here are some considerations:
- Make fields in external representation optional, where it makes sense, and remove them prior to serialisation
- E.g. lack of
IAccountExt.typecan assume to be"type": {"type": "unspecified"}
- E.g. lack of
- Use a binary JSON representation, such as Amazon Ion
- Use a compression algorithm, such as brotli
- Calculate the size and cost of the account for the user prior to export
- Allow the user to pick the size of the account, minimum capped at export size, max, ~ 10MB account limit
- Break the data into multiple transactions if larger than the transaction limit
- Give the option to store in different networks, e.g. devnet, mainnet-beta, etc.
- After we see the typical sizes, if feasible we should look into storing a collection of transactions in the same account