How I Built a Counter Program in Anchor and Finally Trusted My Tests (opens in new tab)
The first thing that surprised me about Anchor was how much work happens in the accounts struct. My Initialize struct has three fields, but the real heavy lifting sits on the counter: #[account(init, payer = authority, space = 8 + Counter::INIT_SPACE)] pub counter: Account , init tells Anchor to create a brand new account right in the transaction. payer says who pays the rent. space calculates the exact number of bytes needed. In a traditional backend I would write all that all...
Read the original article