bettercallsol icon indicating copy to clipboard operation
bettercallsol copied to clipboard

Share On-Chain Program

Open sohrab- opened this issue 3 years ago • 1 comments

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

sohrab- avatar Aug 25 '22 05:08 sohrab-

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.type can assume to be "type": {"type": "unspecified"}
  • 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

sohrab- avatar Aug 25 '22 05:08 sohrab-