shilling 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 94551689d1b4b2198bf0fcf75211ca6b3b9a5f1b
4
- data.tar.gz: 9f703f85dbc1c8de0b15bc23ed1af4e1a9931c64
3
+ metadata.gz: 3ec576692c34de7444a874bab09bc0e738f75fd6
4
+ data.tar.gz: 1885f770b43715813f7062820c217b5f76ef7e10
5
5
  SHA512:
6
- metadata.gz: f2b04c71d59561d3b14933028c56b54cd4eae4a3f56b3bc17582135bccef6e1b0f08e8f777f5bcb16663c6a8dcd2a8c8be27ac91eef0b54020d9be7df7bde4e1
7
- data.tar.gz: 7bf21a8f145a255dcf85a8f75f1016c60ecedae4910123455c9ddb62847436c8557ea2b9324f527bf5743ccf6a139f3dc782e43ff17ff7593dde851664fed0e2
6
+ metadata.gz: fb9d7fbba7d30f7d179b0e57cd6ca74987bb99a48e6fdc4397e508a1eb1d4b71d62aa991a41eded7faa96de1ed78538ce33f9d04e817e8ffc4eeb84a4ee7ce35
7
+ data.tar.gz: 4d957daa158c18849f024f43abee289234c46b0bacbae50a8984725f3a6e560b16ea47374aea074b17e852559c86c57b73276392dc09529d9083e98cfc4be92f
@@ -9,7 +9,6 @@ lib/shilling/bank.rb
9
9
  lib/shilling/block.rb
10
10
  lib/shilling/blockchain.rb
11
11
  lib/shilling/cache.rb
12
- lib/shilling/ledger.rb
13
12
  lib/shilling/node.rb
14
13
  lib/shilling/pool.rb
15
14
  lib/shilling/service.rb
data/README.md CHANGED
@@ -6,12 +6,13 @@ w/ public distributed (hyper) ledger book on the blockchain peer-to-peer over HT
6
6
 
7
7
 
8
8
 
9
- * home :: [github.com/blockchainaustria/shilling.tools](https://github.com/blockchainaustria/shilling.tools)
10
- * bugs :: [github.com/blockchainaustria/shilling.tools/issues](https://github.com/blockchainaustria/shilling.tools/issues)
9
+ * home :: [github.com/bitshilling/bitshilling.tools](https://github.com/bitshilling/bitshilling.tools)
10
+ * bugs :: [github.com/bitshilling/bitshilling.tools/issues](https://github.com/bitshilling/bitshilling.tools/issues)
11
11
  * gem :: [rubygems.org/gems/shilling](https://rubygems.org/gems/shilling)
12
12
  * rdoc :: [rubydoc.info/gems/shilling](http://rubydoc.info/gems/shilling)
13
13
 
14
14
 
15
+
15
16
  ## Command Line
16
17
 
17
18
  Use the `shilling` command line tool. Try:
@@ -77,6 +78,7 @@ source "https://rubygems.org"
77
78
  gem 'sinatra'
78
79
  gem 'sass'
79
80
  gem 'blockchain-lite'
81
+ gem 'ledger-lite'
80
82
  ```
81
83
 
82
84
  run
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ Hoe.spec 'shilling' do
8
8
  self.summary = 'shilling (or schilling) on the blockchain! rock-solid alpine dollar from austria; print (mine) your own shillings; run your own federated shilling central bank nodes w/ public distributed (hyper) ledger book on the blockchain peer-to-peer over HTTP; revolutionize the world one block at a time with cryptos'
9
9
  self.description = summary
10
10
 
11
- self.urls = ['https://github.com/blockchainaustria/shilling.tools']
11
+ self.urls = ['https://github.com/bitshilling/bitshilling.tools']
12
12
 
13
13
  self.author = 'Gerald Bauer'
14
14
  self.email = 'ruby-talk@ruby-lang.org'
@@ -20,9 +20,11 @@ Hoe.spec 'shilling' do
20
20
  self.extra_deps = [
21
21
  ['sinatra', '>=2.0'],
22
22
  ['sass'], ## used for css style preprocessing (scss)
23
- ['blockchain-lite', '>=1.3.1'],
23
+ ['blockchain-lite', '>=1.4.0'],
24
+ ['ledger-lite', '>=1.1.1' ]
24
25
  ]
25
26
 
27
+
26
28
  self.licenses = ['Public Domain']
27
29
 
28
30
  self.spec_extras = {
@@ -12,8 +12,21 @@ require 'optparse' ## note: used for command line tool (see Tool in tool.rb)
12
12
  ### 3rd party gems
13
13
  require 'sinatra/base' # note: use "modular" sinatra app / service
14
14
 
15
- require 'merkletree'
16
- require 'blockchain-lite/proof_of_work/block' # note: use proof-of-work block only (for now)
15
+
16
+ require 'blockchain-lite/base'
17
+
18
+ ###
19
+ # add convenience top-level shortcut / alias
20
+ # "standard" default block for now block with proof of work
21
+ Block = BlockchainLite::ProofOfWork::Block
22
+
23
+
24
+ require 'ledger-lite/base'
25
+
26
+ ###
27
+ # add convenience top-level shortcut / alias
28
+ Ledger = LedgerLite::Ledger
29
+
17
30
 
18
31
 
19
32
  ### our own code
@@ -24,7 +37,6 @@ require 'shilling/transaction'
24
37
  require 'shilling/blockchain'
25
38
  require 'shilling/pool'
26
39
  require 'shilling/bank'
27
- require 'shilling/ledger'
28
40
  require 'shilling/wallet'
29
41
 
30
42
  require 'shilling/node'
@@ -50,11 +62,15 @@ module Shilling
50
62
  attr_accessor :mining_reward
51
63
 
52
64
  ## note: add a (†) coinbase marker
65
+ ## fix: "sync" with ledger-lite config!!!!
66
+ COINBASE = ['Coinbase†']
67
+ =begin
53
68
  COINBASE = ['Großglockner†', 'Wildspitze†', 'Großvenediger†',
54
69
  'Hochfeiler†', 'Zuckerhütl†', 'Hochalmspitze†',
55
70
  'Gr. Muntanitz†', 'Hoher Riffler†',
56
71
  'Parseierspitze†', 'Hoher Dachstein†'
57
72
  ]
73
+ =end
58
74
 
59
75
 
60
76
  def initialize
@@ -50,7 +50,7 @@ class Bank
50
50
  ## (convenience) delegate for ledger
51
51
  ## todo/check: use address instead of wallet - why? why not?
52
52
  ## for now single address wallet (that is, wallet==address)
53
- @ledger.sufficient_funds?( wallet, amount )
53
+ @ledger.sufficient?( wallet, amount )
54
54
  end
55
55
 
56
56
 
@@ -1,14 +1,9 @@
1
1
 
2
-
3
- Block = BlockchainLite::ProofOfWork::Block
4
-
5
- ## see https://github.com/openblockchains/blockchain.lite.rb/blob/master/lib/blockchain-lite/proof_of_work/block.rb
6
-
7
2
  ######
8
3
  ## add more methods
9
4
 
10
- class Block
11
5
 
6
+ class Block
12
7
 
13
8
  def to_h
14
9
  { index: @index,
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Shilling
4
4
 
5
- VERSION = '0.1.1'
5
+ VERSION = '0.2.0'
6
6
 
7
7
  def self.root
8
8
  "#{File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )}"
@@ -5,7 +5,7 @@
5
5
  <th>Address</th>
6
6
  <th>Balance</th>
7
7
  </tr>
8
- <% @node.bank.ledger.wallets.each do |address, amount| %>
8
+ <% @node.bank.ledger.each do |address, amount| %>
9
9
  <tr>
10
10
  <td><%= address[0..15] %></td>
11
11
  <td>$<%= amount %></td>
@@ -4,7 +4,7 @@
4
4
  <h2>Address</h2>
5
5
  <div><%= @node.wallet.address %></div>
6
6
  <h2>Balance</h2>
7
- <div class="balance">$<%= @node.bank.ledger.wallets[@node.wallet.address] || 0 %></div>
7
+ <div class="balance">$<%= @node.bank.ledger[@node.wallet.address] || 0 %></div>
8
8
  </div>
9
9
  <form action="/send" method="post" class="transaction-form">
10
10
  <label for="to">To</label>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shilling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-26 00:00:00.000000000 Z
11
+ date: 2018-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -44,14 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 1.3.1
47
+ version: 1.4.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 1.3.1
54
+ version: 1.4.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: ledger-lite
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 1.1.1
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 1.1.1
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rdoc
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -105,7 +119,6 @@ files:
105
119
  - lib/shilling/block.rb
106
120
  - lib/shilling/blockchain.rb
107
121
  - lib/shilling/cache.rb
108
- - lib/shilling/ledger.rb
109
122
  - lib/shilling/node.rb
110
123
  - lib/shilling/pool.rb
111
124
  - lib/shilling/service.rb
@@ -120,7 +133,7 @@ files:
120
133
  - lib/shilling/views/index.erb
121
134
  - lib/shilling/views/style.scss
122
135
  - lib/shilling/wallet.rb
123
- homepage: https://github.com/blockchainaustria/shilling.tools
136
+ homepage: https://github.com/bitshilling/bitshilling.tools
124
137
  licenses:
125
138
  - Public Domain
126
139
  metadata: {}
@@ -1,30 +0,0 @@
1
-
2
- class Ledger
3
- attr_reader :wallets ## use addresses - why? why not? for now single address wallet (wallet==address)
4
-
5
- def initialize( chain=[] )
6
- @wallets = {}
7
- chain.each do |block|
8
- apply_transactions( block.transactions )
9
- end
10
- end
11
-
12
- def sufficient_funds?( wallet, amount )
13
- return true if Shilling.config.coinbase?( wallet )
14
- @wallets.has_key?( wallet ) && @wallets[wallet] - amount >= 0
15
- end
16
-
17
-
18
- private
19
-
20
- def apply_transactions( transactions )
21
- transactions.each do |tx|
22
- if sufficient_funds?(tx.from, tx.amount)
23
- @wallets[tx.from] -= tx.amount unless Shilling.config.coinbase?( tx.from )
24
- @wallets[tx.to] ||= 0
25
- @wallets[tx.to] += tx.amount
26
- end
27
- end
28
- end
29
-
30
- end ## class Ledger