Skip to content

Commit

Permalink
📝 First version
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielePicco committed Oct 27, 2023
0 parents commit d2bb18f
Show file tree
Hide file tree
Showing 14 changed files with 194 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Magicblock Labs Pte. Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
36 changes: 36 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Deploy

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install mdbook
run: |
mkdir mdbook
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.15/mdbook-v0.4.15-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH
- name: Deploy GitHub Pages
run: |
# This assumes your book is in the root of your repository.
# Just add a `cd` here if you need to change to another directory.
mdbook build
git worktree add gh-pages gh-pages
git config user.name "Deploy from CI"
git config user.email ""
cd gh-pages
# Delete the ref to avoid keeping history.
git update-ref -d refs/heads/gh-pages
rm -rf *
mv ../book/* .
cp ../CNAME .
git add .
git commit -m "Deploy $GITHUB_SHA to gh-pages"
git push --force
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
book
.DS_STORE
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
book.boltengine.gg
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# ⚡ The Bolt Book

Bolt is a high-performance, scalable SVM-based framework designed for Fully On Chain (FOC) Games and Autonomous Worlds.

## 🤝 Contributing

Feel free to file an issue or submit a pull request.

## 💻 Run The Bolt Book Locally

To run on a Mac, install [Homebrew](https://brew.sh/) if you don't already have
it.

Then, run the following commands:

```sh
brew upgrade
brew install mdbook
```

Next, clone this repo and serve the book:

```sh
git clone https://github.com/magicblock-labs/bolt-book.git
cd bolt-book
mdbook serve
```
The book will be available at `http://localhost:3000` in your browser.

### Run an older version

If you want to know how something worked in previous versions of bolt, you can check out
a branch e.g. branch `v0.1.0` is the branch with all commits of the book that were made before bolt `v0.1.0` was released.

## License

The Bolt Book is licensed under [MIT](./LICENSE).

Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in Bolt by you, as defined in the MIT license, shall be
licensed as above, without any additional terms or conditions.
6 changes: 6 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[book]
title = "The Bolt Book v0.1"
authors = []
language = "en"
multilingual = false
src = "src"
8 changes: 8 additions & 0 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Summary

- [Introduction](./introduction/introduction.md)
- [What is Bolt](./introduction/what_is_bolt.md)
- [Entity, Component and Systems (ECS)](./introduction/ecs.md)
- [Ephemeral Rollups](./introduction/ephemeral-rollups.md)
- [Prerequisites](./prerequisites/prerequisites.md)
- [Useful Resources](./prerequisites/useful_resources.md)
Binary file added src/images/bolt-arch.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions src/introduction/ecs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Entity, Component and Systems (ECS)

The framework includes a standardized way to model the game logic, using the ECS (Entity, Components and Systems), which is commonly used in the gaming industry and also adopted in most on-chain engines.

This pattern decouples logic from state, enabling optimizations in terms of performance and scalability. Additionally, its modular nature facilitates code reusability and extensibility, which are two essential properties for fully on-chain games and autonomous worlds.

The Solana Virtual Machine makes use of a paradigm similar to an ECS. The state (the accounts) and the logic (the programs) are natively separated.

When drawing a comparison with Solana's architecture, we can see how the ECS easily implementable:

- Entity: An entity is a general-purpose object typically represented by a unique identifier.
It doesn't directly contain any data or behaviour but serves as an identifier for a collection of components. Entities can be registered in a world instance account on Solana and could themselves be accounts.
- Components: Raw data structure that represents some aspect or attribute of an entity. For instance, a PositionComponent might just contain x, y, and z coordinates. This is concept is essentially equivalent to accounts on Solana.
- Systems: Performs the game logic or behaviour by acting upon entities that have specific components. Systems are essentialy programs on Solana, which only specify the logic and the accounts they operate on.

Solana's Program Derived Addresses (PDAs) facilitate the efficient storage and retrieval of entities, components and system mimicking a hash table-like structure.
25 changes: 25 additions & 0 deletions src/introduction/ephemeral-rollups.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Ephemeral Rollups

The core intuition is that by harnessing the SVM's account structure and its capacity for parallelization, we can split the app/game state into clusters. Users can lock one or multiple accounts to temporarily transfer the state to an auxiliary layer, which we define as the "ephemeral rollup", a configurable dedicated runtime.

This process temporarily entrusts the sequencer to modify the accounts in the ephemeral rollup, where the state can be forcefully reverted and unlocked on the L1 if constraints are not satisfied (read the [whitepaper]() for more details). Despite this delegation, operations and transactions can still use the delegate accounts as readable on the base layer. Non-delegated accounts remain unaffected and modifiable.

The ephemeral rollup operates as a specialized SVM runtime to facilitate transaction processing at an elevated throughput. Additionally, this specialized runtime can be customized to include configurations like gasless transactions, quicker block-time, and the inclusion of a ticking mechanism (i.e., an integrated transaction scheduling system like [clockwork](https://github.com/clockwork-xyz/clockwork)) operated without fees). The entire process is transparent to the end user - a specialized RPC provider can route the transactions to the base layer and the ephemeral rollup(s) in parallel during the game session.

## White Paper

![Ephemeral Rollups](../images/bolt-arch.jpg)

Bolt white paper describes in details the architecture and the scalability solution. We recommend reading the basic concepts of ephemeral rollups in section 2.2 of the [Bolt Whitepaper]()

## Avoiding Fragmentation and Benefits

The benefit of ER is that programs and assets reside directly on the base layer. Transactions can be accelerated through ERs, which are fully compatible with the Solana Virtual Machine (SVM) down to the bytecode level. Any improvements or advancements at the base layer are immediately available, without the need to modify or re-deploy programs.

Ephemeral Rollups has the following benefits:

- Developers **deploy programs to the base layer** (e.g., Solana), rather than on a separate chain as it would normally happen with rollups. Programs live on the base layer and can interact with any existing protocol and assets. ERs don't fragment the existing ecosystem and allow the speed-up of targeted operations without creating an isolated environment.

- Users, developers and programs using ERs can take advantage of **Solana's infrastructure**. This includes programming languages, code libraries, testing tools, client software, deployment infrastructure etc.
- The **specialized runtime** can accommodate game-specific customizations (e.g., ticking or passive events, typical in games, as opposed to the event-driven runtime of blockchains) without the need to pay gas for fees on those specific accounts.
- This approach enables a **highly scalable system** capable of launching rollups on-demand, **auto-scaling** horizontally to accommodate users performing millions of transactions without the tradeoffs of traditional L2s.
9 changes: 9 additions & 0 deletions src/introduction/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Introduction

Welcome to The Bolt Book! ⚡

> Bolt is an open-source project, currently in its early development phase, and warmly welcomes contributors. For additional resources, join the community on [Discord](https://discord.com/invite/MBkdC3gxcv).
This chapter covers what bolt is, how its documentation is structured, and what you should know to have a good time with this guide.

If you find errors or something doesn't work, please report it [here](https://github.com/magicblock-labs/bolt-book/issues).
9 changes: 9 additions & 0 deletions src/introduction/what_is_bolt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# What is Bolt

Bolt is a high-performance, scalable SVM-based framework designed for Fully On Chain (FOC) Games and Autonomous Worlds.

With Bolt, you can create games that live forever on the blockchain. These games are platform-centric by default, empowering users to extend and modify both game content and logic. Bolt facilitates multiplayer gaming experiences with performance on par with traditional multiplayer servers.

Furthermore, the framework incorporates an Entity Component System (ECS) architecture, streamlining the game structuring and assembly process and providing ready-to-use components. Developers can reuse and contribute modules and logic deployed on the blockchain.

All these features collectively reduce the intricacy of crafting fully on-chain games, enabling developers to focus more on the game's essence.
3 changes: 3 additions & 0 deletions src/prerequisites/prerequisites.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Prerequisites

This chapter provides you with the necessary background knowledge to get started with anchor.
17 changes: 17 additions & 0 deletions src/prerequisites/useful_resources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Useful Resources

## Rust

This guide assumes that you already have some knowledge of basic Rust. We recommend reading chapters 1-9 of the [Rust book](https://doc.rust-lang.org/book/title-page.html) which cover the basics of using Rust (Most of the time you don't need advanced Rust to write anchor programs).

## Solana

This guide assumes that you already have some knowledge of basic Rust. We recommend reading the basic concepts from the [Anchor book](https://book.anchor-lang.com/prerequisites/intro_to_solana.html)

## Anchor

Bolt is built on top of Anchor, therefore having a general knowledge of Anchor will give you the necessary tool to build the game logic. We recommend reading chapters 1-4 of the [Anchor book](https://book.anchor-lang.com/)

## Bolt White Paper

Bolt white paper describes in details the architecture and the scalability solution. We recommend reading the basic concepts of ephemeral rollups in section 2.2 of the [Bolt Whitepaper]()

0 comments on commit d2bb18f

Please sign in to comment.