scribelite 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/Manifest.txt +2 -2
- data/README.md +78 -0
- data/Rakefile +2 -1
- data/lib/scribelite/models/forward.rb +2 -2
- data/lib/scribelite/models/{inscribe.rb → scribe.rb} +3 -3
- data/lib/scribelite/models/{calldata.rb → tx.rb} +3 -4
- data/lib/scribelite/schema.rb +19 -20
- data/lib/scribelite/version.rb +1 -1
- data/lib/scribelite.rb +7 -6
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0608ffa940a6f65b4432a6e8e494ec2213e20a6fb661e15eafb9f0408f1175be'
|
4
|
+
data.tar.gz: 5b019fbe73890c1b20a5c4106a617e2c573431e805b47825fb056f7bd50449aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a363643f683a32c1ccbd04448d790b6582f5ccc7d8d3176ab65506ff92d826a5b54e37b41add46bb8c8b577a8f76aa9d8ee7800a7d946aa7cf5ce9802fb283b
|
7
|
+
data.tar.gz: 491db0258ff4a4dc27974f9e3e8e8147a9437690dfdd2c30bf8d81b8710aee0f7ee4a119cd3657b6d48f1cc3399570e4787ef9fbdc87d17ec4f4115acb79d1e7
|
data/CHANGELOG.md
CHANGED
data/Manifest.txt
CHANGED
@@ -3,8 +3,8 @@ Manifest.txt
|
|
3
3
|
README.md
|
4
4
|
Rakefile
|
5
5
|
lib/scribelite.rb
|
6
|
-
lib/scribelite/models/calldata.rb
|
7
6
|
lib/scribelite/models/forward.rb
|
8
|
-
lib/scribelite/models/
|
7
|
+
lib/scribelite/models/scribe.rb
|
8
|
+
lib/scribelite/models/tx.rb
|
9
9
|
lib/scribelite/schema.rb
|
10
10
|
lib/scribelite/version.rb
|
data/README.md
CHANGED
@@ -19,11 +19,89 @@ See [Introducing Ethscriptions - A new way of creating and sharing digital artif
|
|
19
19
|
|
20
20
|
## Usage
|
21
21
|
|
22
|
+
The work-in-progess database schema looks like:
|
23
|
+
|
24
|
+
``` ruby
|
25
|
+
ActiveRecord::Schema.define do
|
26
|
+
|
27
|
+
create_table :scribes, :id => :string do |t|
|
28
|
+
t.integer :num, null: false, index: { unique: true, name: 'scribe_nums' }
|
29
|
+
t.integer :bytes
|
30
|
+
t.string :content_type
|
31
|
+
## add allow duplicate opt-in protocol flag e.g. esip6
|
32
|
+
t.boolean :duplicate ## allows duplicates flag
|
33
|
+
t.boolean :flagged, null: false, default: false ## censored flag / removed on request
|
34
|
+
## move sha to tx - why? why not?
|
35
|
+
t.string :sha, null: false ## sha hash as hexstring (but no leading 0)
|
36
|
+
end
|
37
|
+
|
38
|
+
create_table :txs, :id => :string do |t|
|
39
|
+
t.binary :data # , null: false
|
40
|
+
t.datetime :date, null: false
|
41
|
+
t.integer :block, null: false
|
42
|
+
t.integer :idx, null: false ## transaction index (number)
|
43
|
+
|
44
|
+
t.string :from, null: false
|
45
|
+
t.string :to, null: false
|
46
|
+
|
47
|
+
t.integer :fee
|
48
|
+
t.integer :value
|
49
|
+
end
|
50
|
+
end
|
51
|
+
```
|
52
|
+
|
53
|
+
|
54
|
+
and to setup use it like:
|
55
|
+
|
56
|
+
``` ruby
|
57
|
+
require 'scribelite'
|
58
|
+
|
59
|
+
ScribeDb.connect( adapter: 'sqlite3',
|
60
|
+
database: './scribe.db' )
|
61
|
+
|
62
|
+
ScribeDb.create_all ## build schema
|
63
|
+
```
|
64
|
+
|
65
|
+
|
66
|
+
and to query use it like:
|
67
|
+
|
68
|
+
``` ruby
|
69
|
+
require 'scribelite'
|
70
|
+
|
71
|
+
ScribeDb.open( './scribe.db' )
|
72
|
+
|
73
|
+
puts
|
74
|
+
puts " #{Scribe.count} scribe(s)"
|
75
|
+
puts " #{Tx.count} tx(s)"
|
76
|
+
|
77
|
+
|
78
|
+
## how many flagged in top 100?
|
79
|
+
limit = 100
|
80
|
+
|
81
|
+
flagged_count = Scribe.order( :num ).limit(limit).where( flagged: true ).count
|
82
|
+
pp flagged_count #=> 75 !!!!!!!!!
|
83
|
+
unflagged_count = Scribe.order( :num).limit(limit).where( flagged: false ).count
|
84
|
+
pp unflagged_count #=> 25
|
85
|
+
|
86
|
+
|
87
|
+
Scribe.order( :num ).limit(limit).each do |scribe|
|
88
|
+
if scribe.flagged?
|
89
|
+
print " xx "
|
90
|
+
else
|
91
|
+
print "==> "
|
92
|
+
end
|
93
|
+
print "#{scribe.num} / #{scribe.content_type} - #{scribe.tx.date} @ #{scribe.tx.block}"
|
94
|
+
print "\n"
|
95
|
+
end
|
96
|
+
```
|
97
|
+
|
98
|
+
|
22
99
|
To be continued...
|
23
100
|
|
24
101
|
|
25
102
|
|
26
103
|
|
104
|
+
|
27
105
|
## Bonus - More Blockchain (Crypto) Tools, Libraries & Scripts In Ruby
|
28
106
|
|
29
107
|
See [**/blockchain**](https://github.com/rubycocos/blockchain)
|
data/Rakefile
CHANGED
@@ -18,7 +18,8 @@ Hoe.spec 'scribelite' do
|
|
18
18
|
self.history_file = 'CHANGELOG.md'
|
19
19
|
|
20
20
|
self.extra_deps = [
|
21
|
-
['ethscribe'],
|
21
|
+
['ethscribe'],
|
22
|
+
['calldata'], ## todo - check if included via ethscribe in the future?
|
22
23
|
['activerecord'],
|
23
24
|
['activerecord-utils'],
|
24
25
|
['logutils'],
|
@@ -2,8 +2,8 @@
|
|
2
2
|
module ScribeDb
|
3
3
|
module Model
|
4
4
|
|
5
|
-
class
|
6
|
-
has_one :
|
5
|
+
class Scribe < ActiveRecord::Base
|
6
|
+
has_one :tx, foreign_key: 'id'
|
7
7
|
|
8
8
|
## convernience helper
|
9
9
|
## forward to blob.content
|
@@ -182,7 +182,7 @@ def export( path=export_path )
|
|
182
182
|
end
|
183
183
|
=end
|
184
184
|
|
185
|
-
end # class
|
185
|
+
end # class Scribe
|
186
186
|
|
187
187
|
end # module Model
|
188
188
|
end # module ScribeDb
|
@@ -2,17 +2,16 @@
|
|
2
2
|
module ScribeDb
|
3
3
|
module Model
|
4
4
|
|
5
|
-
class
|
6
|
-
self.table_name = '
|
5
|
+
class Tx < ActiveRecord::Base
|
6
|
+
self.table_name = 'txs' ## note auto-infers txes change to txs
|
7
7
|
|
8
8
|
belongs_to :inscribe, foreign_key: 'id'
|
9
|
-
|
10
9
|
=begin
|
11
10
|
def text
|
12
11
|
content.force_encoding(Encoding::UTF_8)
|
13
12
|
end
|
14
13
|
=end
|
15
|
-
end # class
|
14
|
+
end # class Tx
|
16
15
|
|
17
16
|
end # module Model
|
18
17
|
end # module ScribeDb
|
data/lib/scribelite/schema.rb
CHANGED
@@ -8,15 +8,15 @@ def up
|
|
8
8
|
|
9
9
|
ActiveRecord::Schema.define do
|
10
10
|
|
11
|
-
create_table :
|
11
|
+
create_table :scribes, :id => :string do |t|
|
12
12
|
## "id": "0a3a4dbf6630338bc4df8e36bd081f8f7d2dee9441131cb03a18d43eb4882d5ci0",
|
13
13
|
## note: change to uuid (universally unique id) - why? why not?
|
14
14
|
## id gets used by row_id (internal orm db machinery) and is int
|
15
|
-
## t.string :uuid, null: false, index: { unique: true, name: '
|
15
|
+
## t.string :uuid, null: false, index: { unique: true, name: 'scribe_uuids' }
|
16
16
|
|
17
17
|
## "title": "Inscription 10371414",
|
18
18
|
## note: use num/no. from title only - why? why not?
|
19
|
-
t.integer :num, null: false, index: { unique: true, name: '
|
19
|
+
t.integer :num, null: false, index: { unique: true, name: 'scribe_nums' }
|
20
20
|
|
21
21
|
## "content length": "85 bytes",
|
22
22
|
## note: extract bytes as integer!!!
|
@@ -25,11 +25,14 @@ create_table :inscribes, :id => :string do |t|
|
|
25
25
|
## "content type": "text/plain;charset=utf-8",
|
26
26
|
## note: make sure always lower/down case!!!
|
27
27
|
t.string :content_type
|
28
|
-
|
29
|
-
|
28
|
+
|
30
29
|
## add allow duplicate opt-in protocol flag e.g. esip6
|
31
|
-
|
32
|
-
|
30
|
+
t.boolean :duplicate ## allows duplicates flag - make duplicate the default - why? why not?
|
31
|
+
t.boolean :flagged, null: false, default: false ## censored flag / removed on request
|
32
|
+
|
33
|
+
## move sha to tx - why? why not?
|
34
|
+
t.string :sha # , null: false ## sha hash as hexstring
|
35
|
+
|
33
36
|
## timestamp last
|
34
37
|
t.timestamps
|
35
38
|
end
|
@@ -37,14 +40,13 @@ end
|
|
37
40
|
|
38
41
|
## change to tx/txs or txn/txns - why? why not?
|
39
42
|
|
40
|
-
create_table :
|
43
|
+
create_table :txs, :id => :string do |t|
|
41
44
|
## "id": "0a3a4dbf6630338bc4df8e36bd081f8f7d2dee9441131cb03a18d43eb4882d5ci0",
|
42
45
|
## note: change to uuid (universally unique id) - why? why not?
|
43
46
|
## id gets used by row_id (internal orm db machinery) and is int
|
44
47
|
## t.string :id, null: false, index: { unique: true, name: 'blob_uuids' }
|
45
48
|
|
46
|
-
t.binary :data
|
47
|
-
t.string :sha # , null: false ## sha hash as hexstring
|
49
|
+
t.binary :data # , null: false
|
48
50
|
|
49
51
|
## "timestamp": "2023-06-01 05:00:57 UTC"
|
50
52
|
## or use date_utc ???
|
@@ -52,19 +54,16 @@ create_table :calldatas, :id => :string do |t|
|
|
52
54
|
t.datetime :date, null: false
|
53
55
|
|
54
56
|
t.integer :block, null: false
|
55
|
-
t.integer :
|
56
|
-
t.integer :value
|
57
|
+
t.integer :idx, null: false ## transaction index (number)
|
57
58
|
|
58
|
-
###
|
59
|
-
## "address": "bc1p3h4eecuxjj2g72sq38gyva732866u5w29lhxgeqfe6c0sg8xmagsuau63k",
|
60
|
-
## is this minter/inscriber addr???
|
61
|
-
## change to minter?? or such - why? why not?
|
62
|
-
## creator
|
63
59
|
t.string :from, null: false
|
60
|
+
t.string :to, null: false
|
64
61
|
|
65
|
-
|
66
|
-
t.
|
67
|
-
|
62
|
+
t.integer :fee
|
63
|
+
t.integer :value
|
64
|
+
|
65
|
+
|
66
|
+
## timestamp last
|
68
67
|
t.timestamps
|
69
68
|
end
|
70
69
|
|
data/lib/scribelite/version.rb
CHANGED
data/lib/scribelite.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
|
2
2
|
# core and stlibs
|
3
3
|
require 'ethscribe' ## will pull-in cocos & friends
|
4
|
-
|
4
|
+
require 'calldata'
|
5
5
|
|
6
6
|
|
7
7
|
require 'logger' # Note: use for ActiveRecord::Base.logger -- remove/replace later w/ LogUtils::Logger ???
|
8
|
+
require 'date' ## check if date & datetime required ??
|
8
9
|
|
9
10
|
|
10
11
|
# 3rd party gems / libs
|
@@ -27,8 +28,8 @@ require_relative 'scribelite/version' # always goes first
|
|
27
28
|
|
28
29
|
require_relative 'scribelite/models/forward'
|
29
30
|
|
30
|
-
require_relative 'scribelite/models/
|
31
|
-
require_relative 'scribelite/models/
|
31
|
+
require_relative 'scribelite/models/scribe'
|
32
|
+
require_relative 'scribelite/models/tx'
|
32
33
|
|
33
34
|
|
34
35
|
require_relative 'scribelite/schema'
|
@@ -66,7 +67,7 @@ module ScribeDb
|
|
66
67
|
ConfDb.create # add props table
|
67
68
|
end
|
68
69
|
|
69
|
-
unless ScribeDb::Model::
|
70
|
+
unless ScribeDb::Model::Scribe.table_exists?
|
70
71
|
ScribeDb.create
|
71
72
|
end
|
72
73
|
end # method auto_migrate!
|
@@ -136,8 +137,8 @@ end # module ScribeDb
|
|
136
137
|
|
137
138
|
|
138
139
|
## add convenience helpers
|
139
|
-
|
140
|
-
|
140
|
+
Scribe = ScribeDb::Model::Scribe
|
141
|
+
Tx = ScribeDb::Model::Tx
|
141
142
|
|
142
143
|
|
143
144
|
# say hello
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scribelite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
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: 2023-11-
|
11
|
+
date: 2023-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ethscribe
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: calldata
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: activerecord
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,9 +185,9 @@ files:
|
|
171
185
|
- README.md
|
172
186
|
- Rakefile
|
173
187
|
- lib/scribelite.rb
|
174
|
-
- lib/scribelite/models/calldata.rb
|
175
188
|
- lib/scribelite/models/forward.rb
|
176
|
-
- lib/scribelite/models/
|
189
|
+
- lib/scribelite/models/scribe.rb
|
190
|
+
- lib/scribelite/models/tx.rb
|
177
191
|
- lib/scribelite/schema.rb
|
178
192
|
- lib/scribelite/version.rb
|
179
193
|
homepage: https://github.com/s6ruby/rubidity
|