What is Outerspace Blockchain?
A Ruby implementation of web blockchain framework.
Outerspace Blockchain is a blockchain framework that allows you to create your own blockchain in a few minutes with this backend server. This application has the intention to be a blockchain framework that can be used to create a blockchain with a web interface and a mobile wallet. Utility Tokens and NFT's will be supported native in this blockchain framework. This blockchain framework will be used to create a blockchain for the Outerspace Coding projects in the future.
This blockchain works with a different approach than the other blockchains. Use it to work with less complexity and more flexibility. Perfect for small/medium projects that need a blockchain and can't use Ethereum Network or other blockchains.
Remember always to verify your enviroment variables and do security modifications like changing the default passwords, increasing the security of the database, etc.
This application is unstable and under development.
Please, use it with caution and at your own risk.
Demo version: (temporary down)
https://osbc.outerspacecoding.com
Developed using TDD (Test Driven Development).
Github Actions CI/CD pipeline.
Firestore will be used to store the blockchain data.
Simplecov is used to test code coverage.
Rails Engine is used to create the blockchain.
Tailwind CSS is used to style the blockchain web interface.
Rspec is used to test the blockchain.
Build Version: 0.2.1
In Progress
- Add and correct tests
- Better layout for the blockchain web interface
- Add and correct documentation, create api documentation page
Todo
- Better Rack Cors Config
- Add Rack Attack and Rack Attack Throttle
- Simplify SMTP configuration
- Create a template for the user registration email
- Create blockchain report mailer to admin
- Create blockchain monitor board to admin
- Firestore integration (this will be used instead of Redis management)
- Add user verification methods
- Increase environment variables for easily setup custom information for the blockchain
- Create the price visualization and the price history api
- Add more blockchain features
- Add more blockchain tests
- Add more blockchain documentation
- Add nft's classification class
- Add nft's modularization class
- Add nft's generator class
- Benchmark blockchain and mining
- Create a blockchain dinamic explorer
- Create a default blockchain wallet android app generator with flutter
- Create generators that will work with rails and flutter at the same time
- Create the user marketplace
- Integrate Blockchain Api in other projects
Kubernetes integration will be worked on in the future. Appwrite integration will be worked on in the future.
System dependencies
1. Docker
2. Postgresql
3. Ruby
4. Redis
-
Ruby 3.2
-
Compose Version 3.3
-
Docker Image: ruby:3.2
-
Installation
Install it from RubyGems (Ruby 3.2)
gem install osbc
Run to generate new project
osbc PATH
Compile OSBC from source
========================
Compile the gem from source with the following commands:
git clone
cd outerspace-blockchain
bundle install
Run OSBC
========================
Run the gem with the following command:
bin/osbc
Installation
========================
Build and install the gem with the following commands:
gem build osbc.gemspec
gem install osbc-GENERATED_VERSION.gem
Use the gem with the following command:
osbc PATH_TO_GENERATE_BLOCKCHAIN
RVM Commands to install Ruby 3.2
rvm install 3.2
rvm use 3.2
rvm gemset create outerspace
rvm gemset use outerspace
gem install bundler
bundle install
Environment Variables
The application has a .env file in root folder with the following environment variables:
FIRST_CHAIN_NAME=YOUR_CHAIN_NAME
FIRST_CHAIN_MAINTAINER=YOUR_NAME
CONTRACTS_LIMIT=100
SIGNATURES_LIMIT=5
Configuration
Lucy Dockerunner gem
This application has rake tasks to help you with the development process with docker imported from the Lucy Dockerunner gem. Example of the rake tasks:
Docker actions
-
rake compose:install
- build docker compose and migrate the database -
rake compose:build
- build docker compose services -
rake compose:up
- start the docker compose services -
rake compose:down
- stop the docker compose services -
rake compose:db_detach
- detach the database from the docker compose services -
rake compose:restart
- restart the docker compose services -
rake compose:clean_all
- clean all docker compose services -
rake compose:clean_volumes
- clean docker compose volumes
... more commands in the Github: Lucy Dockerunner gem
Database actions
-
rake compose_db:migrate
- migrate the database -
rake compose_db:reset
- reset the database -
rake compose_db:drop
- drop the database -
rake compose_db:create
- create the database
... more commands in the Github: Lucy Dockerunner gem
Tests actions
-
rake compose_test:all
- run all tests -
rake compose_test:clean_all
- run all tests after cleaning docker compose services -
rake compose_test:controllers
- run controllers tests -
rake compose_test:models
- run models tests -
rake compose_test:requests
- run requests tests
... more commands in the Github: Lucy Dockerunner gem
LOGS actions
-
rake compose_logs:web
- show web logs -
rake compose_logs:db
- show db logs -
rake compose_logs:redis
- show redis logs -
rake compose_logs:sidekiq
- show sidekiq logs -
rake compose_logs:all
- show all logs -
rake compose_logs:tail_web
- tail web logs -
rake compose_logs:tail_db
- tail db logs
... more commands in the Github: Lucy Dockerunner gem
Start the blockchain
$ rake compose:up
Access the blockchain web interface
Mining Concept
- Every user will have a randomized acceptable word list
- This word list will have three classes of words
- Common words
- Symbol Sequence
- Number Sequence
When a user want to mine a block, the user will open a ticket in the server and after the ticket is open, the user will start to mine the block
The mine will depend of the contract signatures that will be formed by the server using the word list of the user
Steps to mine a block:
- The user will open a TICKET in the server
- The server will send a message to the user to start mining if the POOL is open
- The users will load the RANDOM WORD LIST provided by the server API
- The user have to use 1 common word, 1 symbol sequence and 1 number sequence, randomize the characters
- Transform the shuffled chartacters in a SHA256 hash
- The user will send the hash to the server
- The server will validate the hash and will send a message to the user if the hash is valid
- If the hash is valid, check if the same transactions have the same block state confirmation, if yes, the user will have to mine again in a new state of the transactions timeline
- If this transactions was not confirmed at this point at block history the server will add the user signature to the transactions contracts included in the users ticket timeline range
- The block only can be hashed when the minimum number of contracts valids with minimum number of signatures is reached
- The server will use the signature timeline to determine what transactions will be added to the block
- The server will calculate the master hash after confirm all valid contracts signatures
- Assignmaster hash to the block, create new block and add to the blockchain with previous block hash
- The server will start a open/closed pool cycle ( pool is open only if has a minimun of transactions to mine )
- The server will send a message to the user to start mining when the POOL is open and user has a ticket
The timestamps of the signatures will be usefull to version the block, checking it as a timeline
The miners will be rewarded with the block reward distributed by the number of signatures
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/JesusGautamah/outerspace-blockchain
License
The gem is available as open source under the terms of the MIT License.
- LICENSE - MIT License