# `Cartouche.Solana.SystemProgram`
[🔗](https://github.com/zenhive/cartouche/blob/main/lib/cartouche/solana/system_program.ex#L1)

Instructions for the Solana System Program.

The System Program (address: `11111111111111111111111111111111`, 32 zero bytes)
handles basic operations like SOL transfers and account creation.

## API Functions
| Function | Arity | Description | Param Kinds |
| --- | --- | --- | --- |
| `create_account` | 5 | Build a Solana System Program create-account instruction. | `from: value`, `new_account: value`, `lamports: value`, `space: value`, `owner: value` |
| `transfer` | 3 | Build a Solana System Program SOL transfer instruction. | `from: value`, `to: value`, `lamports: value` |
| `program_id` | 0 | Return the Solana System Program public key. | - |

# `create_account`

```elixir
@spec create_account(
  &lt;&lt;_::256&gt;&gt;,
  &lt;&lt;_::256&gt;&gt;,
  non_neg_integer(),
  non_neg_integer(),
  &lt;&lt;_::256&gt;&gt;
) ::
  Cartouche.Solana.Transaction.Instruction.t()
```

Build a create_account instruction.

System Program instruction index 0.

## Examples

    iex> ix = Cartouche.Solana.SystemProgram.create_account(<<1::256>>, <<2::256>>, 1_000_000, 165, <<3::256>>)
    iex> ix.program_id
    <<0::256>>
    iex> byte_size(ix.data)
    52

# `program_id`

```elixir
@spec program_id() :: &lt;&lt;_::256&gt;&gt;
```

Returns the System Program pubkey (32 zero bytes).

Delegates to `Cartouche.Solana.Programs.system_program/0`.

# `transfer`

```elixir
@spec transfer(&lt;&lt;_::256&gt;&gt;, &lt;&lt;_::256&gt;&gt;, non_neg_integer()) ::
  Cartouche.Solana.Transaction.Instruction.t()
```

Build a transfer instruction (SOL transfer).

System Program instruction index 2.

## Examples

    iex> ix = Cartouche.Solana.SystemProgram.transfer(<<1::256>>, <<2::256>>, 1_000_000_000)
    iex> ix.program_id
    <<0::256>>
    iex> byte_size(ix.data)
    12

---

*Consult [api-reference.md](api-reference.md) for complete listing*
