Ref - https://www.anchor-lang.com/docs/basics/program-structure

The declare_id macro specifies the on-chain address of the program, known as the program ID.
use anchor_lang::prelude::*;
declare_id!("11111111111111111111111111111111");
The #[program] attribute annotates the module containing all the instruction handlers for your program. Each public function within this module corresponds to an instruction that can be invoked.

This makes our solana contract closer to a solidity contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Calculator {
uint64 data;
function initialize(uint64 _data) public {
data: _data
}
}
The #[derive(Accounts)] macro is applied to a struct to specify the accounts that must be provided when an instruction is invoked. This macro implements the Accounts trait, which simplifies account validation and serialization and deserialization of account data.


When an instruction in an Anchor program is invoked, the program first validates the accounts provided before executing the instruction's logic. After validation, these accounts can be accessed within the instruction using the ctx.accounts syntax.
The #[account] attribute is applied to structs that define the structure of the data stored in custom accounts created by your program.
#[account]
pub struct NewAccount {
data: u64,
}