osbc 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.env +1 -0
- data/CHANGELOG.md +8 -3
- data/README.md +24 -10
- data/app/controllers/api/v1/application_controller.rb +67 -0
- data/app/controllers/api/v1/block_confirmations_controller.rb +19 -38
- data/app/controllers/api/v1/ticket_manager_controller.rb +65 -0
- data/app/controllers/contracts_controller.rb +0 -5
- data/app/controllers/pools_controller.rb +0 -52
- data/app/controllers/signatures_controller.rb +0 -5
- data/app/controllers/tickets_controller.rb +0 -27
- data/app/views/transactions/_transaction.html.slim +1 -2
- data/app/views/users/registrations/new.html.erb +1 -1
- data/app/workers/create_ticket_worker.rb +1 -0
- data/config/initializers/sidekiq.rb +1 -0
- data/config/routes/api.rb +1 -1
- data/lib/osbc/osbc.rb +1 -1
- data/lib/tasks/compose.rake +26 -15
- data/lib/tasks/compose_db.rake +27 -17
- data/lib/tasks/compose_logs.rake +25 -15
- data/lib/tasks/compose_test.rake +19 -9
- data/lib/tasks/task_helpers/compose_taskhelper.rb +22 -0
- data/lib/tasks/task_helpers/taskhelper.rb +23 -0
- data/mining_concept.ipynb +2 -2
- metadata +12 -40
- data/coverage/.last_run.json +0 -5
- data/coverage/.resultset.json +0 -1853
- data/coverage/.resultset.json.lock +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc_disabled.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_both.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc_disabled.png +0 -0
- data/coverage/assets/0.12.3/application.css +0 -1
- data/coverage/assets/0.12.3/application.js +0 -7
- data/coverage/assets/0.12.3/colorbox/border.png +0 -0
- data/coverage/assets/0.12.3/colorbox/controls.png +0 -0
- data/coverage/assets/0.12.3/colorbox/loading.gif +0 -0
- data/coverage/assets/0.12.3/colorbox/loading_background.png +0 -0
- data/coverage/assets/0.12.3/favicon_green.png +0 -0
- data/coverage/assets/0.12.3/favicon_red.png +0 -0
- data/coverage/assets/0.12.3/favicon_yellow.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coverage/assets/0.12.3/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_222222_256x240.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_454545_256x240.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_888888_256x240.png +0 -0
- data/coverage/assets/0.12.3/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/coverage/assets/0.12.3/loading.gif +0 -0
- data/coverage/assets/0.12.3/magnify.png +0 -0
- data/coverage/index.html +0 -20731
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34b4e07aede46460687f931e6c170bfa6cd32b96eec1022db4dc0edd20c8b4f4
|
4
|
+
data.tar.gz: e15914a8d36c5c60561109915cc2acdd9fe0517d2f767f02e5a118e7684f0f08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4db75d9e4e3dbc1889e205ffe3e802e7956be058b7f93519d064297ad46d6bc0ab2fad3b27fb95a309bc3e7abd77aa9689f304fd34b6240eca9430ab0dec1568
|
7
|
+
data.tar.gz: b1f5afc4c7016ed067b8520d5e7d81324dc393eda418e3a0fbef8a87257f78ab5883daeb601aed694fe05b414028020cb1c13546da59e962c613670ed2ac63eb
|
data/.env
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
-
## [0.1.
|
4
|
-
|
5
|
-
- Initial
|
3
|
+
## [0.1.5]
|
4
|
+
### Added
|
5
|
+
- Initial Version
|
6
|
+
## [0.1.6]
|
7
|
+
### Added
|
8
|
+
- Docker Compose Installation Recognition
|
9
|
+
- Refactored some tests
|
10
|
+
- Added lib tasks helper to created rake tasks for blockchain
|
data/README.md
CHANGED
@@ -12,6 +12,22 @@
|
|
12
12
|
|
13
13
|
#### Rspec is used to test the blockchain.
|
14
14
|
|
15
|
+
## Build Version: 0.1.7
|
16
|
+
### Last Update:
|
17
|
+
#### Added Open Ticket Api Methods
|
18
|
+
#### Reafactored some methods and tests
|
19
|
+
#### Removed coverage folder github repo
|
20
|
+
##### TODO
|
21
|
+
###### Add more tests
|
22
|
+
###### Add more features
|
23
|
+
###### Include pagination
|
24
|
+
###### Create Queries Folder
|
25
|
+
###### Test in kubernetes
|
26
|
+
###### Add more documentation
|
27
|
+
###### Add NFT Generator
|
28
|
+
###### Increase the environment variables for autoconfig
|
29
|
+
###### Add features to autogeneration of blockchain for better configuration
|
30
|
+
|
15
31
|
## System dependencies
|
16
32
|
1. Docker
|
17
33
|
2. Postgresql
|
@@ -159,18 +175,16 @@ The mine will depend of the contract signatures that will be formed by the serve
|
|
159
175
|
2. The server will send a message to the user to start mining if the POOL is open
|
160
176
|
3. The users will load the RANDOM WORD LIST provided by the server API
|
161
177
|
4. The user have to use 1 common word, 1 symbol sequence and 1 number sequence, randomize the characters
|
162
|
-
5. Transform the chartacters in a SHA256 hash
|
163
|
-
6.
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
8. If the hash is valid, check if the same transactions have the same block state confirmation
|
168
|
-
9. If this transactions was not confirmed at this point at block history the server will add the user signature to the transaction contract
|
178
|
+
5. Transform the shuffled chartacters in a SHA256 hash
|
179
|
+
6. The user will send the hash to the server
|
180
|
+
7. The server will validate the hash and will send a message to the user if the hash is valid
|
181
|
+
8. 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
|
182
|
+
9. 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
|
169
183
|
10. The block only can be hashed when the minimum number of contracts valids with minimum number of signatures is reached
|
170
184
|
11. The server will use the signature timeline to determine what transactions will be added to the block
|
171
185
|
12. The server will calculate the master hash after confirm all valid contracts signatures
|
172
|
-
13.
|
173
|
-
13. The server will start a open/closed pool cycle
|
186
|
+
13. Assignmaster hash to the block, create new block and add to the blockchain with previous block hash
|
187
|
+
13. The server will start a open/closed pool cycle ( pool is open only if has a minimun of transactions to mine )
|
174
188
|
14. The server will send a message to the user to start mining when the POOL is open and user has a ticket
|
175
189
|
<p>
|
176
190
|
The timestamps of the signatures will be usefull to version the block, checking it as a timeline
|
@@ -178,7 +192,7 @@ The timestamps of the signatures will be usefull to version the block, checking
|
|
178
192
|
|
179
193
|
**The miners will be rewarded with the block reward distributed by the number of signatures**
|
180
194
|
## Contributing
|
181
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
195
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/JesusGautamah/outerspace-blockchain
|
182
196
|
|
183
197
|
## License
|
184
198
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Api::V1::ApplicationController < ActionController::API
|
4
|
+
def unauthorized?
|
5
|
+
return unauthorized_response unless find_user_by_header
|
6
|
+
end
|
7
|
+
|
8
|
+
def ticket_founded?
|
9
|
+
@ticket = Ticket.find_by(user_id: @user.id, status: :active)
|
10
|
+
return ticket_not_found_response unless @ticket.present?
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
attr_accessor :user
|
15
|
+
|
16
|
+
def find_user_by_header
|
17
|
+
return unless request.headers["X-API-KEY"].present?
|
18
|
+
api_key = request.headers["X-API-KEY"]
|
19
|
+
@user = User.find_by(api_key: api_key)
|
20
|
+
return unless @user.present?
|
21
|
+
@user.api_secret == request.headers["X-API-SECRET"]
|
22
|
+
end
|
23
|
+
|
24
|
+
def confirmation_hash_founded?
|
25
|
+
return confirmation_hash_not_found_response unless confirmation_hash.present?
|
26
|
+
end
|
27
|
+
|
28
|
+
def confirmation_hash
|
29
|
+
@confirmation_hash ||= block_confirmation_params[:user_confirmation_hash]
|
30
|
+
end
|
31
|
+
|
32
|
+
def confirmation_hash_not_found_response
|
33
|
+
render json: { error: "Confirmation hash not found" }, status: :not_found
|
34
|
+
end
|
35
|
+
|
36
|
+
def ticket_not_found_response
|
37
|
+
render json: { error: "Ticket not found" }, status: :not_found
|
38
|
+
end
|
39
|
+
|
40
|
+
def unauthorized_response
|
41
|
+
render json: { error: "Unauthorized" }, status: :unauthorized
|
42
|
+
end
|
43
|
+
|
44
|
+
def current_block
|
45
|
+
@current_block = Block.find_by(master_hash: nil)
|
46
|
+
end
|
47
|
+
|
48
|
+
def current_pool
|
49
|
+
@current_pool = Pool.find_by(block_id: current_block.id)
|
50
|
+
end
|
51
|
+
|
52
|
+
def ticket
|
53
|
+
@ticket = Ticket.find_by(user_id: user.id, status: :active)
|
54
|
+
end
|
55
|
+
|
56
|
+
def block_transactions
|
57
|
+
@block_transactions = Transaction.where(block_id: current_block.id)
|
58
|
+
end
|
59
|
+
|
60
|
+
def block_transactions_empty?
|
61
|
+
return no_transactions_response unless block_transactions.present?
|
62
|
+
end
|
63
|
+
|
64
|
+
def no_transactions_response
|
65
|
+
render json: { error: "No transactions in the block" }, status: :not_found
|
66
|
+
end
|
67
|
+
end
|
@@ -1,62 +1,43 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Api::V1::BlockConfirmationsController <
|
3
|
+
class Api::V1::BlockConfirmationsController < Api::V1::ApplicationController
|
4
|
+
before_action :unauthorized?
|
5
|
+
before_action :ticket_founded?, only: [:confirm_block]
|
6
|
+
before_action :confirmation_hash_founded?, only: [:confirm_block]
|
7
|
+
|
4
8
|
def confirm_block
|
5
|
-
return
|
6
|
-
@ticket = Ticket.find_by(user_id: @user.id, status: :active)
|
7
|
-
return ticket_not_found_response unless @ticket.present?
|
8
|
-
confirmation_hash = block_confirmation_params[:user_confirmation_hash]
|
9
|
-
return confirmation_hash_not_found_response unless confirmation_hash.present?
|
10
|
-
return not_valid_confirmation_hash_response unless @ticket.user_acceptable_hash == confirmation_hash
|
9
|
+
return not_valid_confirmation_hash_response unless hash_confirmed?
|
11
10
|
assign_contract
|
12
11
|
end
|
13
12
|
|
14
|
-
def transactions_to_mine
|
15
|
-
return unauthorized_response unless find_user_by_header
|
16
|
-
ticket = Ticket.find_by(user_id: @user.id)
|
17
|
-
return ticket_not_found_response unless ticket.present?
|
18
|
-
transactions_ids = ticket.transaction_id_list
|
19
|
-
transactions = Transaction.where(id: transactions_ids)
|
20
|
-
transactions_json = transactions.to_json
|
21
|
-
render json: transactions_json, status: :ok
|
22
|
-
end
|
23
|
-
|
24
13
|
def info_to_mine
|
25
|
-
return unauthorized_response unless find_user_by_header
|
26
|
-
words = @user.acceptable_words
|
27
|
-
number_sequences = @user.acceptable_number_sequences
|
28
|
-
symbol_sequences = @user.acceptable_symbol_sequences
|
29
14
|
render json: { words: words, number_sequences: number_sequences, symbol_sequences: symbol_sequences }, status: :ok
|
30
15
|
end
|
31
16
|
|
32
17
|
private
|
33
|
-
def
|
34
|
-
|
35
|
-
api_key = request.headers["X-Api-Key"]
|
36
|
-
@user = User.find_by(api_key: api_key)
|
37
|
-
return unless @user.present?
|
38
|
-
@user.api_secret == request.headers["X-Api-Secret"]
|
18
|
+
def hash_confirmed?
|
19
|
+
@ticket.user_acceptable_hash == confirmation_hash
|
39
20
|
end
|
40
21
|
|
41
|
-
def
|
42
|
-
|
22
|
+
def assign_contract
|
23
|
+
AssignContractWorker.perform_async(@ticket.id)
|
24
|
+
render json: { message: "Contract assigned" }, status: :ok
|
43
25
|
end
|
44
26
|
|
45
|
-
def
|
46
|
-
render json: { error: "
|
27
|
+
def not_valid_confirmation_hash_response
|
28
|
+
render json: { error: "Not valid confirmation hash" }, status: :not_found
|
47
29
|
end
|
48
30
|
|
49
|
-
def
|
50
|
-
|
31
|
+
def words
|
32
|
+
@words = @user.acceptable_words
|
51
33
|
end
|
52
34
|
|
53
|
-
def
|
54
|
-
|
55
|
-
render json: { message: "Contract assigned" }, status: :ok
|
35
|
+
def number_sequences
|
36
|
+
@number_sequences = @user.acceptable_number_sequences
|
56
37
|
end
|
57
38
|
|
58
|
-
def
|
59
|
-
|
39
|
+
def symbol_sequences
|
40
|
+
@symbol_sequences = @user.acceptable_symbol_sequences
|
60
41
|
end
|
61
42
|
|
62
43
|
def block_confirmation_params
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Api::V1::TicketManagerController < Api::V1::ApplicationController
|
4
|
+
before_action :unauthorized?
|
5
|
+
before_action :block_transactions_empty?, only: [:open_ticket]
|
6
|
+
|
7
|
+
def open_ticket
|
8
|
+
return ticket_already_opened_response unless ticket_nil?
|
9
|
+
return ticket_already_opened_response if ticket_active?
|
10
|
+
return terms_not_confirmed_response unless ticket_params_confirmed?
|
11
|
+
create_ticket if acceptable_create?
|
12
|
+
ticket_opened_response
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
private
|
17
|
+
def ticket_nil?
|
18
|
+
ticket.nil?
|
19
|
+
end
|
20
|
+
|
21
|
+
def ticket_active?
|
22
|
+
return false if ticket_nil?
|
23
|
+
ticket.status == "active"
|
24
|
+
end
|
25
|
+
|
26
|
+
def acceptable_create?
|
27
|
+
ticket_nil? && ticket_params_confirmed? || ticket_params_confirmed? && ticket_active? == false
|
28
|
+
end
|
29
|
+
|
30
|
+
def ticket_params_confirmed?
|
31
|
+
open_ticket_params[:ticket_terms] == "confirmed"
|
32
|
+
end
|
33
|
+
|
34
|
+
def ticket_already_opened_response
|
35
|
+
render json: { error: "Ticket already opened" }, status: :not_found
|
36
|
+
end
|
37
|
+
|
38
|
+
def ticket_opened_response
|
39
|
+
render json: { message: "Ticket opened" }, status: :ok
|
40
|
+
end
|
41
|
+
|
42
|
+
def terms_not_confirmed_response
|
43
|
+
render json: { error: "Ticket terms not confirmed" }, status: :not_found
|
44
|
+
end
|
45
|
+
|
46
|
+
def open_ticket_params
|
47
|
+
params.permit(:ticket_terms)
|
48
|
+
end
|
49
|
+
|
50
|
+
def time_ref
|
51
|
+
@time_ref = block_transactions.first.created_at.to_s
|
52
|
+
end
|
53
|
+
|
54
|
+
def user_id
|
55
|
+
@user_id = user.id.to_s
|
56
|
+
end
|
57
|
+
|
58
|
+
def current_pool_id
|
59
|
+
@current_pool_id = current_pool.id.to_s
|
60
|
+
end
|
61
|
+
|
62
|
+
def create_ticket
|
63
|
+
CreateTicketWorker.perform_async(user_id, current_pool_id, time_ref)
|
64
|
+
end
|
65
|
+
end
|
@@ -17,9 +17,4 @@ class ContractsController < ApplicationController
|
|
17
17
|
def set_contract
|
18
18
|
@contract = Contract.find(params[:id])
|
19
19
|
end
|
20
|
-
|
21
|
-
# Only allow a list of trusted parameters through.
|
22
|
-
def contract_params
|
23
|
-
params.require(:contract).permit(:first_sig, :second_sig, :third_sig, :fourth_sig, :status, :transaction_id)
|
24
|
-
end
|
25
20
|
end
|
@@ -13,61 +13,9 @@ class PoolsController < ApplicationController
|
|
13
13
|
def show
|
14
14
|
end
|
15
15
|
|
16
|
-
# GET /pools/new
|
17
|
-
def new
|
18
|
-
@pool = Pool.new
|
19
|
-
end
|
20
|
-
|
21
|
-
# GET /pools/1/edit
|
22
|
-
def edit
|
23
|
-
end
|
24
|
-
|
25
|
-
# POST /pools or /pools.json
|
26
|
-
def create
|
27
|
-
@pool = Pool.new(pool_params)
|
28
|
-
|
29
|
-
respond_to do |format|
|
30
|
-
if @pool.save
|
31
|
-
format.html { redirect_to pool_url(@pool), notice: "Pool was successfully created." }
|
32
|
-
format.json { render :show, status: :created, location: @pool }
|
33
|
-
else
|
34
|
-
format.html { render :new, status: :unprocessable_entity }
|
35
|
-
format.json { render json: @pool.errors, status: :unprocessable_entity }
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# PATCH/PUT /pools/1 or /pools/1.json
|
41
|
-
def update
|
42
|
-
respond_to do |format|
|
43
|
-
if @pool.update(pool_params)
|
44
|
-
format.html { redirect_to pool_url(@pool), notice: "Pool was successfully updated." }
|
45
|
-
format.json { render :show, status: :ok, location: @pool }
|
46
|
-
else
|
47
|
-
format.html { render :edit, status: :unprocessable_entity }
|
48
|
-
format.json { render json: @pool.errors, status: :unprocessable_entity }
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
# DELETE /pools/1 or /pools/1.json
|
54
|
-
def destroy
|
55
|
-
@pool.destroy
|
56
|
-
|
57
|
-
respond_to do |format|
|
58
|
-
format.html { redirect_to pools_url, notice: "Pool was successfully destroyed." }
|
59
|
-
format.json { head :no_content }
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
16
|
private
|
64
17
|
# Use callbacks to share common setup or constraints between actions.
|
65
18
|
def set_pool
|
66
19
|
@pool = Pool.find(params[:id])
|
67
20
|
end
|
68
|
-
|
69
|
-
# Only allow a list of trusted parameters through.
|
70
|
-
def pool_params
|
71
|
-
params.require(:pool).permit(:block_id, :users_count, :signatures_count, :amount, :stage)
|
72
|
-
end
|
73
21
|
end
|
@@ -17,9 +17,4 @@ class SignaturesController < ApplicationController
|
|
17
17
|
def set_signature
|
18
18
|
@signature = Signature.find(params[:id])
|
19
19
|
end
|
20
|
-
|
21
|
-
# Only allow a list of trusted parameters through.
|
22
|
-
def signature_params
|
23
|
-
params.require(:signature).permit(:signature, :time_ref, :contract_id, :common_word, :symbol_sequence, :number_sequence, :verify_sig, :block_hash, :signature_hash)
|
24
|
-
end
|
25
20
|
end
|
@@ -18,10 +18,6 @@ class TicketsController < ApplicationController
|
|
18
18
|
@ticket = Ticket.new
|
19
19
|
end
|
20
20
|
|
21
|
-
# GET /tickets/1/edit
|
22
|
-
def edit
|
23
|
-
end
|
24
|
-
|
25
21
|
# POST /tickets or /tickets.json
|
26
22
|
def create
|
27
23
|
return no_transactions_response if block_transactions.empty?
|
@@ -29,29 +25,6 @@ class TicketsController < ApplicationController
|
|
29
25
|
redirect_to tickets_path, notice: "Processing ticket, please wait, wait a minute and refresh the page"
|
30
26
|
end
|
31
27
|
|
32
|
-
# PATCH/PUT /tickets/1 or /tickets/1.json
|
33
|
-
def update
|
34
|
-
respond_to do |format|
|
35
|
-
if @ticket.update(ticket_params)
|
36
|
-
format.html { redirect_to ticket_url(@ticket), notice: "Ticket was successfully updated." }
|
37
|
-
format.json { render :show, status: :ok, location: @ticket }
|
38
|
-
else
|
39
|
-
format.html { render :edit, status: :unprocessable_entity }
|
40
|
-
format.json { render json: @ticket.errors, status: :unprocessable_entity }
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
# DELETE /tickets/1 or /tickets/1.json
|
46
|
-
def destroy
|
47
|
-
@ticket.destroy
|
48
|
-
|
49
|
-
respond_to do |format|
|
50
|
-
format.html { redirect_to tickets_url, notice: "Ticket was successfully destroyed." }
|
51
|
-
format.json { head :no_content }
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
28
|
private
|
56
29
|
def create_ticket
|
57
30
|
CreateTicketWorker.perform_async(current_user.id, current_pool.id, time_ref)
|
@@ -3,9 +3,8 @@ div id="#{dom_id transaction}"
|
|
3
3
|
strong Sended by:
|
4
4
|
=< transaction.sender
|
5
5
|
p
|
6
|
-
strong Receiver By:
|
6
|
+
strong Receiver By:
|
7
7
|
=< transaction.receiver
|
8
|
-
/ only show the information below if the Show page is being rendered
|
9
8
|
- if action_name == "show"
|
10
9
|
p
|
11
10
|
strong Amount:
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<%= render "users/shared/error_messages", resource: resource %>
|
6
6
|
<div class="field text-black">
|
7
7
|
<%= f.label :username, class: "text-white" %><br />
|
8
|
-
<em class="text-white">(10 characters minimum)</em
|
8
|
+
<em class="text-white">(10 characters minimum)</em><br />
|
9
9
|
<%= f.text_field :username, autofocus: true, autocomplete: "username",class: "px-4 py-2 rounded text-black border-2 border-purple-300 focus_border-purple-900" %>
|
10
10
|
</div>
|
11
11
|
|
@@ -0,0 +1 @@
|
|
1
|
+
Sidekiq.strict_args!
|
data/config/routes/api.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
namespace :api do
|
4
4
|
namespace :v1 do
|
5
5
|
post "confirm_block", to: "block_confirmations#confirm_block"
|
6
|
-
|
6
|
+
post "open_ticket", to: "ticket_manager#open_ticket"
|
7
7
|
get "info_to_mine", to: "block_confirmations#info_to_mine"
|
8
8
|
end
|
9
9
|
end
|
data/lib/osbc/osbc.rb
CHANGED
data/lib/tasks/compose.rake
CHANGED
@@ -1,19 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "rake"
|
4
|
+
require_relative "task_helpers/compose_taskhelper"
|
5
|
+
|
6
|
+
|
7
|
+
def task_helper
|
8
|
+
@task_helper ||= TaskHelpers::ComposeTaskhelper.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def compose_command
|
12
|
+
@compose_command ||= task_helper.compose_command
|
13
|
+
end
|
4
14
|
|
5
15
|
namespace :compose do
|
6
16
|
task :install do
|
7
17
|
puts "Installing Blockchain and Database Containers"
|
8
|
-
system "sudo
|
18
|
+
system "sudo #{compose_command} build"
|
9
19
|
puts "Creating Database"
|
10
|
-
system "sudo
|
20
|
+
system "sudo #{compose_command} run --rm web rails db:create"
|
11
21
|
puts "Migrating Database"
|
12
|
-
system "sudo
|
22
|
+
system "sudo #{compose_command} run --rm web rails db:migrate"
|
13
23
|
puts "Seeding Database"
|
14
|
-
system "sudo
|
24
|
+
system "sudo #{compose_command} run --rm web rails db:seed"
|
15
25
|
puts "Stopping Containers"
|
16
|
-
system "sudo
|
26
|
+
system "sudo #{compose_command} down"
|
17
27
|
puts "Installing Blockchain and Database Containers... Done!"
|
18
28
|
puts "This already setup your database with some initial values"
|
19
29
|
puts "Start the containers with command: rake compose:up"
|
@@ -32,57 +42,58 @@ namespace :compose do
|
|
32
42
|
|
33
43
|
task :build do
|
34
44
|
puts "Building Compose..."
|
35
|
-
system "sudo
|
45
|
+
system "sudo #{compose_command} build"
|
36
46
|
puts "Building Compose... Done!"
|
37
47
|
end
|
38
48
|
|
39
49
|
task :up do
|
50
|
+
puts compose_command
|
40
51
|
puts "Running Compose..."
|
41
|
-
system "sudo
|
52
|
+
system "sudo #{compose_command} up -d --remove-orphans"
|
42
53
|
puts "Running Compose... Done!"
|
43
54
|
end
|
44
55
|
|
45
56
|
task :down do
|
46
57
|
puts "Stopping Compose..."
|
47
|
-
system "sudo
|
58
|
+
system "sudo #{compose_command} down"
|
48
59
|
puts "Stopping Compose... Done!"
|
49
60
|
end
|
50
61
|
|
51
62
|
task :db_detach do
|
52
63
|
puts "Running Database Detached..."
|
53
|
-
system "sudo
|
64
|
+
system "sudo #{compose_command} up -d db"
|
54
65
|
puts "Running Database Detached... Done!"
|
55
66
|
end
|
56
67
|
|
57
68
|
task :redis_detach do
|
58
69
|
puts "Running Redis Detached..."
|
59
|
-
system "sudo
|
70
|
+
system "sudo #{compose_command} up -d redis"
|
60
71
|
puts "Running Redis Detached... Done!"
|
61
72
|
end
|
62
73
|
|
63
74
|
task :back_detach do
|
64
75
|
puts "Running Backend Detached..."
|
65
|
-
system "sudo
|
76
|
+
system "sudo #{compose_command} up -d --remove-orphans db redis sidekiq"
|
66
77
|
puts "Running Backend Detached... Done!"
|
67
78
|
end
|
68
79
|
|
69
80
|
task :restart do
|
70
81
|
puts "Restarting Compose..."
|
71
82
|
puts "Stopping Compose..."
|
72
|
-
system "sudo
|
83
|
+
system "sudo #{compose_command} down"
|
73
84
|
puts "Stopping Compose... Done!"
|
74
85
|
puts "Running Compose..."
|
75
|
-
system "sudo
|
86
|
+
system "sudo #{compose_command} up -d --remove-orphans"
|
76
87
|
puts "Restarting Compose... Done!"
|
77
88
|
end
|
78
89
|
|
79
90
|
task :clean_all do
|
80
91
|
puts "Cleaning Images..."
|
81
92
|
puts "Stopping Compose..."
|
82
|
-
system "sudo
|
93
|
+
system "sudo #{compose_command} down"
|
83
94
|
puts "Stopping Compose... Done!"
|
84
95
|
puts "Removing Compose..."
|
85
|
-
system "sudo
|
96
|
+
system "sudo #{compose_command} rm -v"
|
86
97
|
puts "Removing Compose... Done!"
|
87
98
|
puts "Removing Containers..."
|
88
99
|
system "sudo docker rm -f $(sudo docker ps -a -q)"
|