# Understanding the architecture

<figure><img src="/files/XWkJbJ0wPVHaYZ03GBnm" alt=""><figcaption><p>Overall architecture of a Substrate blockchain</p></figcaption></figure>

We will use the Partiy minimal template for a Substrate blockchain to guide you through the concepts: [https://github.com/paritytech/polkadot-sdk/tree/master/templates/minimal/](https://github.com/paritytech/polkadot-sdk/tree/master/templates/minimal/pallets)

Alternative repository that you can consider reference from: <https://github.com/paritytech/polkadot-sdk-solochain-template>

1. **Runtime**&#x20;

In Substrate, the terms "runtime" and "state transition function" are analogous. Both terms refer to the core logic of the blockchain that is responsible for validating blocks and executing the state changes they define. The Substrate project in this repository uses [FRAME](https://docs.substrate.io/learn/runtime-development/#frame) to construct a blockchain runtime. FRAME allows runtime developers to declare domain-specific logic in modules called "pallets". At the heart of FRAME is a helpful [macro language](https://docs.substrate.io/reference/frame-macros/) that makes it easy to create pallets and flexibly compose them to create blockchains that can address [a variety of needs](https://substrate.io/ecosystem/projects/).

Review the [FRAME runtime implementation](https://github.com/paritytech/polkadot-sdk-solochain-template/blob/master/runtime/src/lib.rs) included in this template and note the following:

* This file configures several pallets to include in the runtime. Each pallet configuration is defined by a code block that begins with `impl $PALLET_NAME::Config for Runtime`.
* The pallets are composed into a single runtime by way of the [`construct_runtime!`](https://paritytech.github.io/substrate/master/frame_support/macro.construct_runtime.html) macro, which is part of the [core FRAME pallet library](https://docs.substrate.io/reference/frame-pallets/#system-pallets).

2. **Node**&#x20;

{% content-ref url="/pages/Ccn8Z3WhlT0GIhx04EXm" %}
[Break down the node architecture](/building-a-blockchain-with-polkadot-sdk/polkadot-sdk/substrate/create-a-new-blockchain/break-down-the-node-architecture.md)
{% endcontent-ref %}

2. **Pallets**

<figure><img src="/files/nc5PXPg2X2lh2sr0U9A9" alt=""><figcaption><p>Adding a new logic to the new blockchain is like playing with LEGO blocks</p></figcaption></figure>

The runtime in this project is constructed using many FRAME pallets that ship with [the Substrate repository](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame) and a template pallet that is [defined in the `pallets`](https://github.com/paritytech/polkadot-sdk-solochain-template/blob/master/pallets/template/src/lib.rs) directory.

A FRAME pallet is comprised of a number of blockchain primitives, including:

* Storage: FRAME defines a rich set of powerful [storage abstractions](https://docs.substrate.io/build/runtime-storage/) that makes it easy to use Substrate's efficient key-value database to manage the evolving state of a blockchain.
* Dispatchables: FRAME pallets define special types of functions that can be invoked (dispatched) from outside of the runtime in order to update its state.
* Events: Substrate uses [events](https://docs.substrate.io/build/events-and-errors/) to notify users of significant state changes.
* Errors: When a dispatchable fails, it returns an error.

Each pallet has its own `Config` trait which serves as a configuration interface to generically define the types and parameters it depends on.

### Code walkthrough

* Node: <https://github.com/paritytech/polkadot-sdk/tree/master/templates/minimal/node>
* Pallet registry: <https://github.com/paritytech/polkadot-sdk/blob/fa52407856c11ee138a32f2ba744f774fac984d5/templates/minimal/runtime/src/lib.rs#L127C1-L128C14>
* Pallet configuration: <https://github.com/paritytech/polkadot-sdk/blob/master/templates/minimal/runtime/src/lib.rs#L184>
* Specifying Runtime version: <https://github.com/paritytech/polkadot-sdk/blob/master/templates/minimal/runtime/src/lib.rs#L88>
* Transaction signed extension: <https://github.com/paritytech/polkadot-sdk/blob/master/templates/minimal/runtime/src/lib.rs#L106>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bootcamp.openguild.wtf/building-a-blockchain-with-polkadot-sdk/polkadot-sdk/substrate/create-a-new-blockchain/understanding-the-architecture.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
