-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathltc_sub1k_query.rb
62 lines (36 loc) · 1.28 KB
/
ltc_sub1k_query.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#####
# query ordsub1k.ltc.db (sqlite database with first thousand ordinal litecoin inscriptions)
$LOAD_PATH.unshift( "../ordlite/lib" )
require 'ordlite'
OrdDb.open( './ordsub1k.ltc.db' )
puts
puts " #{Inscribe.count} inscribe(s)"
puts " #{Blob.count} blob(s)"
#=> 1000 inscribe(s)
#=> 1000 blob(s)
######
## query for ten biggest (by bytes) inscriptions
Inscribe.biggest.limit(10).each do |rec|
print "#{number_to_human_size(rec.bytes)} (#{rec.bytes} bytes) - "
print "Inscribe №#{rec.num} (#{rec.content_type}) - "
print "#{rec.date} - #{rec.fee} fee in litoshis"
print "\n"
end
puts
pp Inscribe.date_counts ## count_by_date/day
######
## query for all content types and group by count (descending)
puts
pp Inscribe.content_type_counts ## count_by_content_type
inscribes = Inscribe.text
puts " #{inscribes.size} text inscribe(s)"
#=> 16 text inscribe(s)
inscribes.each_with_index do |rec, i|
puts "==> [#{i+1}/#{inscribes.size}] text inscribe №#{rec.num} (#{rec.content_type} - #{rec.bytes} bytes):"
puts rec.text
puts
end
## get mimble wimble whitpaper (no. 0) pdf document
inscribe = Inscribe.find_by( num: 0 )
write_blob( "./tmp/mimblewimble.pdf", inscribe.content )
puts "bye"