Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
layout corrections, incomplete things, readme updat commiting just to…
Browse files Browse the repository at this point in the history
… save
  • Loading branch information
JesusGautamah committed Jan 26, 2023
1 parent 5e7da12 commit e37887e
Show file tree
Hide file tree
Showing 12 changed files with 120 additions and 229 deletions.
68 changes: 50 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
# <img src="https://osbc-blockchain.herokuapp.com/assets/logo-70825bc795d25668cf4f11b06b990ed0d1c2cae887acce0625e5059226a7946a.png" width="25" height="25"> Outerspace Blockchain
<!-- Outerspace Logo -->
## 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 instable and under development.
### This application is unstable and under development.
### Please, use it with caution and at your own risk.
### A Ruby implementation of web blockchain framework.
### Demo version:
https://osbc.outerspacecoding.com

### Demo staging version:
https://blockchain-staging.outerspacecoding.com

#### Developed using TDD (Test Driven Development).
#### Github Actions CI/CD pipeline.
#### Firestore is used to store the blockchain.
#### Firestore will be used to store the blockchain data.

#### Simplecov is used to test code coverage.

Expand All @@ -15,14 +32,20 @@

#### Rspec is used to test the blockchain.

## Build Version: 0.2.0
## Build Version: 0.2.1

## Todo
* [ ] Firebase integration (this will be use instead of Redis management)
## In Progress
* [ ] Add and correct tests
* [ ] Add and correct documentation
* [ ] Better layout for the blockchain web interface
* [ ] Add and correct documentation, create api documentation page
## Todo
* [ ] 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
* [ ] Better mobile layout
* [ ] 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
Expand All @@ -31,23 +54,23 @@
* [ ] Add nft's modularization class
* [ ] Add nft's generator class
* [ ] Benchmark blockchain and mining
* [ ] Create a blockchain explorer
* [ ] 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

Kubernets integration will be worked on in the future.

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.0.3
* Ruby 3.2
* Compose Version 3.3
* Docker Image: ruby:3.0.3
* Docker Image: ruby:3.2

* [Installation](#installation)
- [Docker](#docker) https://docs.docker.com/engine/install/
Expand All @@ -56,7 +79,7 @@ Kubernets integration will be worked on in the future.
- [Postgres](#postgres) https://www.postgresql.org/download/
- [Rails](#rails) https://guides.rubyonrails.org/getting_started.html

### Install it from RubyGems (Ruby 3.0.3)
### Install it from RubyGems (Ruby 3.2)
```bash
gem install osbc
```
Expand Down Expand Up @@ -95,9 +118,9 @@ Use the gem with the following command:
```bash
osbc PATH_TO_GENERATE_BLOCKCHAIN
```
## RVM Commands to install Ruby 3.0.3 and Compile the Gem
* `rvm install 3.0.3`
* `rvm use 3.0.3`
## 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`
Expand Down Expand Up @@ -213,6 +236,15 @@ The timestamps of the signatures will be usefull to version the block, checking
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/JesusGautamah/outerspace-blockchain

## [![Repography logo](https://images.repography.com/logo.svg)](https://repography.com) Recent activity
[![Time period](https://images.repography.com/33522702/JesusGautamah/outerspace-blockchain/recent-activity/0yzGOYYHXYK_C0-EPT33h2yxMGPjAfT8cxuHq8Ukjrg/Zuq9y_QVJvoZeqCjzE6_J-roxfVO_FF0P0SDhZ9Yo6Y_badge.svg)](https://repography.com)

[![Timeline graph](https://images.repography.com/33522702/JesusGautamah/outerspace-blockchain/recent-activity/0yzGOYYHXYK_C0-EPT33h2yxMGPjAfT8cxuHq8Ukjrg/Zuq9y_QVJvoZeqCjzE6_J-roxfVO_FF0P0SDhZ9Yo6Y_timeline.svg)](https://github.com/JesusGautamah/outerspace-blockchain/commits)
[![Issue status graph](https://images.repography.com/33522702/JesusGautamah/outerspace-blockchain/recent-activity/0yzGOYYHXYK_C0-EPT33h2yxMGPjAfT8cxuHq8Ukjrg/Zuq9y_QVJvoZeqCjzE6_J-roxfVO_FF0P0SDhZ9Yo6Y_issues.svg)](https://github.com/JesusGautamah/outerspace-blockchain/issues)

[![Pull request status graph](https://images.repography.com/33522702/JesusGautamah/outerspace-blockchain/recent-activity/0yzGOYYHXYK_C0-EPT33h2yxMGPjAfT8cxuHq8Ukjrg/Zuq9y_QVJvoZeqCjzE6_J-roxfVO_FF0P0SDhZ9Yo6Y_prs.svg)](https://github.com/JesusGautamah/outerspace-blockchain/pulls)
[![Top contributors](https://images.repography.com/33522702/JesusGautamah/outerspace-blockchain/recent-activity/0yzGOYYHXYK_C0-EPT33h2yxMGPjAfT8cxuHq8Ukjrg/Zuq9y_QVJvoZeqCjzE6_J-roxfVO_FF0P0SDhZ9Yo6Y_users.svg)](https://github.com/JesusGautamah/outerspace-blockchain/graphs/contributors)

## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
* [LICENSE](LICENSE) - MIT License
* [LICENSE](LICENSE) - MIT License
68 changes: 0 additions & 68 deletions app/controllers/chains_controller.rb
Original file line number Diff line number Diff line change
@@ -1,72 +1,4 @@
# frozen_string_literal: true

class ChainsController < ApplicationController
before_action :set_chain, only: %i[ show edit update destroy ]

# GET /chains or /chains.json
def index
@chains = Chain.all
end

# GET /chains/1 or /chains/1.json
def show
end

# GET /chains/new
def new
@chain = Chain.new
end

# GET /chains/1/edit
def edit
end

# POST /chains or /chains.json
def create
@chain = Chain.new(chain_params)

respond_to do |format|
if @chain.save
format.html { redirect_to chain_url(@chain), notice: "Chain was successfully created." }
format.json { render :show, status: :created, location: @chain }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @chain.errors, status: :unprocessable_entity }
end
end
end

# PATCH/PUT /chains/1 or /chains/1.json
def update
respond_to do |format|
if @chain.update(chain_params)
format.html { redirect_to chain_url(@chain), notice: "Chain was successfully updated." }
format.json { render :show, status: :ok, location: @chain }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @chain.errors, status: :unprocessable_entity }
end
end
end

# DELETE /chains/1 or /chains/1.json
def destroy
@chain.destroy

respond_to do |format|
format.html { redirect_to chains_url, notice: "Chain was successfully destroyed." }
format.json { head :no_content }
end
end

private
# Use callbacks to share common setup or constraints between actions.
def set_chain
@chain = Chain.find(params[:id])
end

# Only allow a list of trusted parameters through.
def chain_params
params.require(:chain).permit(:name, :blocks_count, :maintainer, :chain_version, :description)
end
end
1 change: 1 addition & 0 deletions app/javascript/controllers/hello_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
connect() {
this.element.textContent = "Hello World!"
console.log("Hello World!")
}
}
50 changes: 44 additions & 6 deletions app/views/application/_featured_board.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -40,34 +40,72 @@
<div class="w-1/2 px-1 text-center">
<a href="blocks" class="block mb-2 p-5 rounded overflow-hidden transform transition-all duration-300 scale-100 hover_scale-95" style="background: url(<%= asset_path "space.jpg" %>) center; background-size: cover;">
<div class="h-24"></div>
<div class="text-lg font-bold text-black leading-tight glitch" data-glitch="Blockchain">Blockchain</div>
<div class="text-lg font-bold text-white leading-tight" data-glitch="Blockchain">Blockchain</div>
</a>
<a href="transactions" class="block mb-2 p-5 rounded overflow-hidden transform transition-all duration-300 scale-100 hover_scale-95" style="background: url(<%= asset_path "space_two.jpg" %>) center; background-size: cover;">
<div class="h-32"></div>
<div class="text-lg font-bold text-white leading-tight glitch" data-glitch="Transactions">Transactions</div>
<div class="text-lg font-bold text-white leading-tight" data-glitch="Transactions">Transactions</div>
</a>
</div>

<% if user_signed_in? %>
<div class="w-1/2 px-1 text-center">
<a href="wallets" class="block mb-2 p-5 rounded overflow-hidden transform transition-all duration-300 scale-100 hover_scale-95" style="background: url(<%= asset_path "space_th.jpg" %>) center; background-size: cover;">
<div class="h-32"></div>
<h3 class="text-lg font-bold text-white leading-tight glitch" data-glitch="Wallet">Wallet</h3>
<h3 class="text-lg font-bold text-white leading-tight" data-glitch="Wallet">Wallet</h3>
</a>
<a href="mining_profile" class="block mb-2 p-5 rounded overflow-hidden text-center transform transition-all duration-300 scale-100 hover_scale-95" style="background: url(<%= asset_path "space_four.jpg" %>) center; background-size: cover;">
<div class="h-24"></div>
<div class="text-lg font-bold text-white leading-tight glitch" data-glitch="Mining Profile">Mining Profile</div>
<div class="text-lg font-bold text-white leading-tight" data-glitch="Mining Profile">Mining Profile</div>
</a>
</div>
<% else %>
<div class="w-1/2 px-1 text-center">
<a href="/users/sign_in" class="block mb-2 p-5 rounded overflow-hidden transform transition-all duration-300 scale-100 hover_scale-95" style="background: url(<%= asset_path "space_th.jpg" %>) center; background-size: cover;">
<div class="h-32"></div>
<h3 class="text-lg font-bold text-white leading-tight glitch" data-glitch="Login">Login</h3>
<h3 class="text-lg font-bold text-white leading-tight" data-glitch="Login">Login</h3>
</a>
<a href="/users/sign_up" class="block mb-2 p-5 rounded overflow-hidden transform transition-all duration-300 scale-100 hover_scale-95" style="background: url(<%= asset_path "space_four.jpg" %>) center; background-size: cover;">
<div class="h-24"></div>
<h3 class="text-lg font-bold text-white leading-tight glitch" data-glitch="Sign Up">Sign Up</h3>
<h3 class="text-lg font-bold text-white leading-tight" data-glitch="Sign Up">Sign Up</h3>
</a>
</div>
<% end %>
</div>

<div class="flex -mx-1 mb-5 sm_hidden">

<div class="w-1/2 px-1 text-center">
<a href="/" class="block mb-2 p-5 rounded overflow-hidden transform transition-all duration-300 scale-100 hover_scale-95" style="background: url(<%= asset_path "space.jpg" %>) center; background-size: cover;">
<div class="h-24"></div>
<div class="text-lg font-bold text-white leading-tight" data-glitch="Blockchain">Home</div>
</a>
<a href="contracts" class="block mb-2 p-5 rounded overflow-hidden transform transition-all duration-300 scale-100 hover_scale-95" style="background: url(<%= asset_path "space_two.jpg" %>) center; background-size: cover;">
<div class="h-32"></div>
<div class="text-lg font-bold text-white leading-tight" data-glitch="Transactions">Contracts</div>
</a>
</div>

<% if user_signed_in? %>
<div class="w-1/2 px-1 text-center">
<a href="wallets" class="block mb-2 p-5 rounded overflow-hidden transform transition-all duration-300 scale-100 hover_scale-95" style="background: url(<%= asset_path "space_th.jpg" %>) center; background-size: cover;">
<div class="h-32"></div>
<h3 class="text-lg font-bold text-white leading-tight" data-glitch="Wallet">Wallet</h3>
</a>
<a href="mining_profile" class="block mb-2 p-5 rounded overflow-hidden text-center transform transition-all duration-300 scale-100 hover_scale-95" style="background: url(<%= asset_path "space_four.jpg" %>) center; background-size: cover;">
<div class="h-24"></div>
<div class="text-lg font-bold text-white leading-tight" data-glitch="Mining Profile">Mining Profile</div>
</a>
</div>
<% else %>
<div class="w-1/2 px-1 text-center">
<a href="/users/sign_in" class="block mb-2 p-5 rounded overflow-hidden transform transition-all duration-300 scale-100 hover_scale-95" style="background: url(<%= asset_path "space_th.jpg" %>) center; background-size: cover;">
<div class="h-32"></div>
<h3 class="text-lg font-bold text-white leading-tight" data-glitch="Login">Login</h3>
</a>
<a href="/users/sign_up" class="block mb-2 p-5 rounded overflow-hidden transform transition-all duration-300 scale-100 hover_scale-95" style="background: url(<%= asset_path "space_four.jpg" %>) center; background-size: cover;">
<div class="h-24"></div>
<h3 class="text-lg font-bold text-white leading-tight" data-glitch="Sign Up">Sign Up</h3>
</a>
</div>
<% end %>
Expand Down
20 changes: 13 additions & 7 deletions app/views/application/mining_profile.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
h1 Mining profile
br
.flex
.w-1/2.text-center.mr-4.mt-4.border-2.border-purple-500.rounded.p-4.bg-purple-500
/ prevent text to get out of the box
.w-1/2.text-center.mr-4.mt-4.border-2.border-purple-500.rounded.p-4.bg-purple-500.overflow-hidden
p[style="font-size: 20px; font-weight: 550;"]
strong Wallet
p[style="font-size: 16px;"]
Expand All @@ -16,15 +17,20 @@
p[style="font-size: 16px;"]
strong
= "Address: #{current_user.wallet.pr_key}"
.w-1/2.text-center.mr-4.mt-4.border-2.border-purple-500.rounded.p-4.bg-purple-500
.w-1/2.text-center.mr-4.mt-4.border-2.border-purple-500.rounded.p-4.bg-purple-500.overflow-hidden
p[style="font-size: 20px;font-weight: 550;"]
strong API
p[style="font-size: 16px;"]
strong Key:
= current_user.api_key
#api_key = current_user.api_key
p[style="font-size: 16px;"]
strong Secret:
= current_user.api_secret
#api_secret = current_user.api_secret
button[style="font-size: 16px;" class="px-4 py-2 rounded bg-gray-800 hover_bg-black text-white", onclick="copyKey()"]
strong Copy key
button[style="font-size: 16px;" class="px-4 py-2 rounded bg-gray-800 hover_bg-black text-white", onclick="copySecret()"]
strong Copy secret

p[style="font-size: 16px;"]
strong
= "Has a ticket? #{@ticket.present?}"
Expand All @@ -34,21 +40,21 @@
br
br
.flex
.w-1/3.text-center.mr-4.mt-4.border-2.border-purple-500.rounded.p-4.bg-purple-500
.w-1/3.text-center.mr-4.mt-4.border-2.border-purple-500.rounded.p-4.bg-purple-500.overflow-hidden
p[style="font-size: 20px;font-weight: 550;"]
strong Acceptable Words
- @words.each do |word|
p[style="font-size: 16px;"]
strong
= word
.w-1/3.text-center.mr-4.mt-4.border-2.border-purple-500.rounded.p-4.bg-purple-500
.w-1/3.text-center.mr-4.mt-4.border-2.border-purple-500.rounded.p-4.bg-purple-500.overflow-hidden
p[style="font-size: 20px;font-weight: 550;"]
strong Acceptable Number Sequences
- @numbers.each do |sequence|
p[style="font-size: 16px;"]
strong
= sequence
.w-1/3.text-center.mr-4.mt-4.border-2.border-purple-500.rounded.p-4.bg-purple-500
.w-1/3.text-center.mr-4.mt-4.border-2.border-purple-500.rounded.p-4.bg-purple-500.overflow-hidden
p[style="font-size: 20px;font-weight: 550;"]
strong Acceptable Symbol Sequences
- @symbols.each do |sequence|
Expand Down
4 changes: 3 additions & 1 deletion app/views/blocks/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

#blocks
- @blocks.each do |block|
== render block
p[style="font-size: 20px; font-weight: 550;"]
strong
= "Block #{block.id}"
br
p
= link_to "Show this block", block, class: "px-4 py-2 rounded bg-purple-500 hover_bg-purple-700 text-white"
Expand Down
4 changes: 3 additions & 1 deletion app/views/blocks/show.html.slim
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.text-center.text-white

p[style="font-size: 20px; font-weight: 550;"]
strong
= "Block #{@block.id}"

== render @block
br
Expand Down
4 changes: 0 additions & 4 deletions app/views/layouts/_navbar.html.slim
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
nav.bg-black
.max-w-7xl.mx-auto.px-2.sm_px-6.lg_px-8
.relative.flex.items-center.justify-between.h-16
.absolute.inset-y-0.left-0.flex.items-center.sm_hidden
button#mobile-menu-button class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover_text-white hover_bg-gray-700 focus_outline-none focus_bg-gray-700 focus_text-white transition duration-150 ease-in-out" aria-label="Main menu" aria-expanded="false"
svg.h-6.w-6[stroke="currentColor" fill="none" viewBox="0 0 24 24"]
path[stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"]
.flex-1.flex.items-center.justify-center.sm_items-stretch.sm_justify-start
.flex-shrink-0
a href="/" class="text-white"
Expand Down
6 changes: 5 additions & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# frozen_string_literal: true



# Seed functions
def seed_exec
create_first_chain
create_acceptable_word_lists
Expand Down Expand Up @@ -134,8 +137,9 @@ def create_first_user
end
end

# Execute seed function based on environment
if Rails.env.development?
dev_seed_exec
else
seed_exec
end
end
Loading

0 comments on commit e37887e

Please sign in to comment.