Skip to main content

Questions tagged [space]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
11 views

How can we write to ledger space?

According to this question there is two ways to write data to ledger space: Call data (and accounts) in transactions Logging inside programs Is there any other ways?
Jon C Fan's user avatar
  • 5,219
1 vote
1 answer
18 views

Trait bound EnumStatus: anchor_lang::Space is not satisfied for Enum

Trait anchor_lang::Space is not implemented for EnumStatus #[derive(AnchorSerialize, AnchorDeserialize, Clone, Copy, Debug, Eq, PartialEq)] pub enum EnumStatus { Active, Paused, Closed, } #[...
Russo's user avatar
  • 277
1 vote
1 answer
82 views

How to calculate size of Option<String> for Anchor accounts

I saw on the docs that the size for Option<T> is 1 + space(T), but considering that T is a String, how can I know the size when initializing an account? #[account] pub struct UserAccount { ...
Matheus Baptistella's user avatar
0 votes
1 answer
65 views

How to have PDA space size depending on instruction argument

I'm using anchor, so I define the space attribute in the Accounts struct, is there a way to make it depend on the instruction arg ? It's for a PDA storing a string, and I don't know string length ...
FluffyMuffin47's user avatar
0 votes
0 answers
84 views

How can I dynamically increase storage space for a program deployed on Solana using Solang?

I have a program that utilizes arrays and mappings, potentially requiring significant storage space. Is there a mechanism to dynamically augment the storage space of the account that deployed the ...
Tiago Soriano's user avatar
1 vote
1 answer
122 views

How to calculate space for an account dynamically using remaining_accounts

Is it possible to allocate space to an account based on account provided in remaining_accounts? I want to allocate enough space to store public key of the accounts provided in remaining_accounts in a ...
onurhb's user avatar
  • 113
4 votes
1 answer
124 views

How to allot 1 bit space for boolean in Anchor program?

Anchor requires the allotment of 1 byte of space for a boolean value even though only 1 bit is required. Is there a way to use only 1 bit for booleans while still using Anchor for the serialization/...
CryptoSar's user avatar
  • 399
2 votes
1 answer
143 views

Managing Space in the Zero Account

I am looking to use zero account (Anchor) for the first time in my program. I have read the example and from the look of it, it doesn't require the space constraint like init does. I wanted to use a ...
0xShuk's user avatar
  • 1,981
3 votes
1 answer
2k views

How can I determine a current size of Solana blockchain

I've seen a few discussions pointing out that in a year Solana's ledger grows up by ~2Tb. However, Solana produces ~2 blocks per second with an average size of 1.5Mb (taken from getBlock RPC request), ...
RowanStone's user avatar
3 votes
1 answer
138 views

What is the recommended way to calculate a account size, using sizeof or manually calculating it

As the title states, which method is recommended to calculate the size assuming types are non -zero copy hence alignment calculation is not needed or is the type aligned per say in this situation ...
Nabeel Naveed's user avatar
7 votes
1 answer
510 views

Is there a way to resize an account's data field?

I am pretty sure I remember reading somewhere that once the space is allocated for an account, it cannot be changed. Is this true? If so, can you delete the account and re-initialize it with a ...
TovarishFin's user avatar
9 votes
1 answer
589 views

How can I increase an existing account size?

ie. Initialize account with 255 byte space. Pay to double the space through anchor.
user2892730's user avatar