-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathppi.py
More file actions
1600 lines (1467 loc) · 63.6 KB
/
ppi.py
File metadata and controls
1600 lines (1467 loc) · 63.6 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#Developer: Curly60e
#PyBLOCK its a clock of the Bitcoin blockchain.
#Version: 0.6.0b
import base64, codecs, json, requests
import pickle
import os
import os.path
import qrcode
import lnpay_py
import requests
import xmltodict
import simplejson as json
import time as t
from art import *
from nodeconnection import *
from pblogo import *
from logos import *
from lnpay_py.wallet import LNPayWallet
def clear(): # clear the screen
os.system('cls' if os.name=='nt' else 'clear')
def closed():
print("<<< Back Control + C.\n\n")
def gameroom():
try:
clear()
blogo()
print("""
--------------------------------------
INITIATE ARCADE?
--------------------------------------
""".format(closed()))
input("\a\nContinue...")
conn = "ssh gameroom@bitreich.org"
os.system(conn).read()
except:
pass
#----------------------------------------------------------------------
def trustednode():
try:
clear()
blogo()
closed()
addv = """
---------------------------------------------------------------
REMEMBER TO INITIALIZE \033[1;35;40mTOR\033[0;37;40m ON THE SHELL
$ source torsocks on
---------------------------------------------------------------
"""
print(addv)
input("\a\nContinue...")
conn = "telnet cut45oarvxfvfydrjery6slyeca4zpal7tljygdt5bji7l3jsrrgwkad.onion 6023"
os.system(conn)
except:
pass
#-----------------------------END GAMES--------------------------------
#-----------------------------bwt.dev--------------------------------
def bwtConn():
try:
clear()
blogo()
closed()
conn = "curl -s https://bwt.dev/banner.txt"
a = os.popen(conn).read()
clear()
blogo()
closed()
print(a)
input("\a\nContinue...")
except:
pass
#-----------------------------END bwt.dev--------------------------------
#-----------------------------wttr.in--------------------------------
def wttrDataV1():
try:
clear()
blogo()
weatherList = """
------------------------------------------------------------------------------------
\033[1;31;40m*\033[0;37;40m uruguay # city name
\033[1;31;40m*\033[0;37;40m ~Giza+pyramid # any location (+ for spaces)
\033[1;31;40m*\033[0;37;40m Москва # Unicode name of any location in any language
\033[1;31;40m*\033[0;37;40m muc # airport code (3 letters)
\033[1;31;40m*\033[0;37;40m @lightninghood.com # domain name
\033[1;31;40m*\033[0;37;40m 94107 # area codes
\033[1;31;40m*\033[0;37;40m -78.46,106.79 # GPS coordinates
\033[1;31;40m*\033[0;37;40m moon # Moon phase (add ,+US or ,+France for these cities)
\033[1;31;40m*\033[0;37;40m moon@2009-01-03 # Moon phase for the date (@2016-10-25)
PRESS \033[1;32;40mM\033[0;37;40m TO INSERT MORE DATA
------------------------------------------------------------------------------------
"""
print(weatherList)
selectData = input("Insert your data \033[1;31;40m*\033[0;37;40m : ")
if selectData in ['M', 'm']:
moreData = """
------------------------------------------------------------------------------------
Supported languages
ar af be ca da de el es et fr fa hi hu ia id it nb nl
oc pl pt-br ro ru tr th uk vi zh-cn zh-tw (supported)
------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
Units
m # metric (SI) (used by default everywhere except US)
u # USCS (used by default in US)
M # show wind speed in m/s
------------------------------------------------------------------------------------
"""
print(moreData)
selectData2 = input("Insert your data \033[1;31;40m*\033[0;37;40m : ")
lang = input("Insert your language: ")
unit = input("Insert your metric units: ")
list = "curl '" + lang + ".wttr.in/" + selectData2 + "?F&" + unit + "'"
else:
list = "curl wttr.in/" + selectData + "?F"
a = os.popen(list).read()
clear()
blogo()
print(a)
input("Continue...")
except:
pass
def wttrDataV2():
try:
clear()
blogo()
weatherList = """
------------------------------------------------------------------------------------
\033[1;31;40m*\033[0;37;40m uruguay # city name
\033[1;31;40m*\033[0;37;40m ~Giza+pyramid # any location (+ for spaces)
\033[1;31;40m*\033[0;37;40m Москва # Unicode name of any location in any language
\033[1;31;40m*\033[0;37;40m muc # airport code (3 letters)
\033[1;31;40m*\033[0;37;40m @lightninghood.com # domain name
\033[1;31;40m*\033[0;37;40m 94107 # area codes
\033[1;31;40m*\033[0;37;40m -78.46,106.79 # GPS coordinates
PRESS \033[1;32;40mM\033[0;37;40m TO INSERT MORE DATA
------------------------------------------------------------------------------------
"""
print(weatherList)
selectData = input("Insert your data \033[1;31;40m*\033[0;37;40m : ")
if selectData in ['M', 'm']:
moreData = """
------------------------------------------------------------------------------------
Supported languages
ar af be ca da de el es et fr fa hi hu ia id it nb nl
oc pl pt-br ro ru tr th uk vi zh-cn zh-tw (supported)
------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
Units
m # metric (SI) (used by default everywhere except US)
u # USCS (used by default in US)
M # show wind speed in m/s
------------------------------------------------------------------------------------
"""
print(moreData)
selectData2 = input("Insert your data \033[1;31;40m*\033[0;37;40m : ")
lang = input("Insert your language: ")
unit = input("Insert your metric units: ")
list = "curl 'v2.wttr.in/" + selectData2 + "?" + unit + "&F&lang=" + lang + "'"
else:
list = "curl v2.wttr.in/" + selectData + "?F"
a = os.popen(list).read()
clear()
blogo()
print(a)
input("Continue...")
except:
pass
#-----------------------------END wttr.in--------------------------------
#-----------------------------RATE.SX--------------------------------
def rateSXList():
clear()
blogo()
fiat = """
-------------------------------------------
AUD Australian dollar
BRL Brazilian real
CAD Canadian dollar
CHF Swiss franc
CLP Chilean peso
CNY Chinese yuan
CZK Czech koruna
DKK Danish krone
EUR Euro
GBP Pound sterling
HKD Hong Kong dollar
HUF Hungarian forint
IDR Indonesian rupiah
ILS Israeli shekel
INR Indian rupee
JPY Japanese yen
KRW South Korean won
MXN Mexican peso
MYR Malaysian ringgit
NOK Norwegian krone
NZD New Zealand dollar
PHP Philippine peso
PKR Pakistani rupee
PLN Polish zloty
RUB Russian ruble
SEK Swedish krona
SGD Singapore dollar
THB Thai baht
TRY Turkish lira
TWD New Taiwan dollar
-------------------------------------------
"""
print(fiat)
selectFiat = input("Insert a Fiat currency: ")
while True:
try:
list = "curl '" + selectFiat + ".rate.sx/?F&n=1'"
a = os.popen(list).read()
clear()
blogo()
closed()
print(a)
t.sleep(20)
except:
break
def rateSXGraph():
clear()
blogo()
fiat = """
-------------------------------------------
AUD Australian dollar
BRL Brazilian real
CAD Canadian dollar
CHF Swiss franc
CLP Chilean peso
CNY Chinese yuan
CZK Czech koruna
DKK Danish krone
EUR Euro
GBP Pound sterling
HKD Hong Kong dollar
HUF Hungarian forint
IDR Indonesian rupiah
ILS Israeli shekel
INR Indian rupee
JPY Japanese yen
KRW South Korean won
MXN Mexican peso
MYR Malaysian ringgit
NOK Norwegian krone
NZD New Zealand dollar
PHP Philippine peso
PKR Pakistani rupee
PLN Polish zloty
RUB Russian ruble
SEK Swedish krona
SGD Singapore dollar
THB Thai baht
TRY Turkish lira
TWD New Taiwan dollar
-------------------------------------------
"""
print(fiat)
selectFiat = input("Insert a Fiat currency: ")
while True:
try:
list = "curl " + selectFiat + ".rate.sx/btc"
a = os.popen(list).read()
clear()
blogo()
closed()
print(a)
t.sleep(20)
except:
break
#-----------------------------END RATE.SX--------------------------------
#-----------------------------COINGECKO--------------------------------
def CoingeckoPP():
btcInfo = CoinGeckoAPI()
n = btcInfo.get_price(ids='bitcoin', vs_currencies='usd,eur,gbp,jpy,aud')
q = n['bitcoin']
usd = q['usd']
eur = q['eur']
gbp = q['gbp']
jpy = q['jpy']
aud = q['aud']
print("""
--------------------COINGECKO BITCOIN PRICE-----------------------
1 BTC = {} USD
1 BTC = {} EUR
1 BTC = {} GBP
1 BTC = {} JPY
1 BTC = {} AUD
------------------------------------------------------------------
...BUT...
1 BTC = 1 BTC
------------------------------------------------------------------
""".format(usd,eur,gbp,jpy,aud))
input("Continue...")
#-----------------------------END COINGECKO--------------------------------
#-----------------------------LNBITS--------------------------------
def loadFileConnLNBits(lnbitLoad):
lnbitLoad = {"wallet_name":"", "wallet_id":"", "admin_key":"", "invoice_read_key":""}
if os.path.isfile('lnbit.conf'): # Check if the file 'bclock.conf' is in the same folder
lnbitData= pickle.load(open("lnbit.conf", "rb")) # Load the file 'bclock.conf'
lnbitLoad = lnbitData # Copy the variable pathv to 'path'
else:
clear()
blogo()
print("""\n\t \033[1;33;40mATENTION\033[0;37;40m: YOU ARE GOING TO CREATE A FILE WITH YOUR INFORMATION OF CONNECTION TO LNBITS.COM.
WE WILL NEED SOME INFORMATION FROM YOUR ACCOUNT THAT THE ONLY ONE THAT WILL HAVE ACCESS IS YOU.
IF YOU DELETE THIS FILE YOU WILL NEED TO PAY AGAIN TO GET ACCESS FROM PyBLOCK.
SAVE THE FILE '\033[1;33;40mlnbitSN.conf\033[0;37;40m' IN A SAFE PLACE.\n
""")
lnbitLoad["wallet_name"] = input("Wallet name: ") # path to the bitcoin-cli
lnbitLoad["wallet_id"] = input("Wallet ID: ")
lnbitLoad["admin_key"] = input("Admin key: ")
lnbitLoad["invoice_read_key"] = input("Invoice/read key: ")
pickle.dump(lnbitLoad, open("lnbit.conf", "wb"))
return lnbitLoad
def createFileConnLNBits():
lnbitLoad = {"wallet_name":"", "wallet_id":"", "admin_key":"", "invoice_read_key":""}
clear()
blogo()
print("""\n\t \033[1;33;40mATENTION\033[0;37;40m: YOU ARE GOING TO CREATE A FILE WITH YOUR INFORMATION OF CONNECTION TO LNBITS.COM.
WE WILL NEED SOME INFORMATION FROM YOUR ACCOUNT THAT THE ONLY ONE THAT WILL HAVE ACCESS IS YOU.
IF YOU DELETE THIS FILE YOU WILL NEED TO PAY AGAIN TO GET ACCESS FROM PyBLOCK.
SAVE THE FILE '\033[1;33;40mlnbitSN.conf\033[0;37;40m' IN A SAFE PLACE.\n
""")
lnbitLoad["wallet_name"] = input("Wallet name: ") # path to the bitcoin-cli
lnbitLoad["wallet_id"] = input("Wallet ID: ")
lnbitLoad["admin_key"] = input("Admin key: ")
lnbitLoad["invoice_read_key"] = input("Invoice/read key: ")
pickle.dump(lnbitLoad, open("lnbit.conf", "wb"))
def lnbitCreateNewInvoice():
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=4,
)
try:
print("\n\tLNBITS CREATE INVOICE\n")
amt = input("Amount: ")
memo = input("Memo: ")
a = loadFileConnLNBits(['invoice_read_key'])
b = str(a['invoice_read_key'])
curl = 'curl -X POST https://lnbits.com/api/v1/payments -d ' + "'{" + """"out": false, "amount": {}, "memo": "{} -PyBLOCK" """.format(amt,memo) + "}'" + """ -H "X-Api-Key: {} " -H "Content-type: application/json" """.format(b)
sh = os.popen(curl).read()
clear()
blogo()
n = str(sh)
d = json.loads(n)
q = d['payment_request']
c = q.lower()
node_not = input("Do you want to pay this tip with your node? Y/n: ")
while True:
if node_not in ["Y", "y"]:
lndconnectload = {"ip_port":"", "tls":"", "macaroon":"", "ln":""}
lndconnectData = pickle.load(open("blndconnect.conf", "rb")) # Load the file 'bclock.conf'
lndconnectload = lndconnectData # Copy the variable pathv to 'path'
if lndconnectload['ip_port']:
print("\nInvoice: " + c + "\n")
payinvoice()
elif lndconnectload['ln']:
print("\nInvoice: " + c + "\n")
localpayinvoice()
elif node_not in ["N", "n"]:
print("\033[1;30;47m")
qr.add_data(c)
qr.print_ascii()
print("\033[0;37;40m")
qr.clear()
print("Lightning Invoice: " + c)
t.sleep(10)
dn = str(d['checking_id'])
checkcurl = 'curl -X GET https://lnbits.com/api/v1/payments/' + dn + """ -H "X-Api-Key: {}" -H "Content-type: application/json" """.format(b)
rsh = os.popen(checkcurl).read()
clear()
blogo()
nn = str(rsh)
dd = json.loads(nn)
db = dd['paid']
if db == True:
clear()
blogo()
tick()
t.sleep(2)
break
else:
continue
except:
pass
def lnbitPayInvoice():
bolt = input("Invoice: ")
a = loadFileConnLNBits(['admin_key'])
b = str(a['admin_key'])
curl = 'curl -X POST https://lnbits.com/api/v1/payments -d ' + "'{" + """"out": true, "bolt11": "{}" """.format(bolt) + "}'" + """ -H "X-Api-Key: {}" -H "Content-type: application/json" """.format(b)
try:
sh = os.popen(curl).read()
n = str(sh)
d = json.loads(n)
dn = str(d['checking_id'])
a = loadFileConnLNBits(['invoice_read_key'])
b = str(a['invoice_read_key'])
while True:
checkcurl = 'curl -X GET https://lnbits.com/api/v1/payments/' + dn + """ -H "X-Api-Key: {}" -H "Content-type: application/json" """.format(b)
rsh = os.popen(checkcurl).read()
clear()
blogo()
nn = str(rsh)
dd = json.loads(nn)
db = dd['paid']
if db == True:
tick()
t.sleep(2)
break
else:
continue
except:
pass
def lnbitCreatePayWall():
while True:
try:
url = input("Url: ")
memo = input("Memo: ")
desc = input("Description: ")
amt = input("Amount in sats: ")
remb = input("Remembers Y/n: ")
a = loadFileConnLNBits(['admin_key'])
b = str(a['admin_key'])
if remb in ["Y", "y"]:
remember = "true"
elif remb in ["N", "n"]:
remember = "false"
curl = 'curl -X POST https://lnbits.com/paywall/api/v1/paywalls -d ' + "'{" + """"url": "{}", "memo": "{}", "description": "{}", "amount": {}, "remembers": {} """.format(url,memo,desc,amt,remember) + "}'" + """ -H "Content-type: application/json" -H "X-Api-Key: {}" """.format(b)
sh = os.popen(curl).read()
clear()
blogo()
n = str(sh)
d = json.loads(n)
print("\n\tPAYWALL CREATED SUCCESSFULLY\n")
t.sleep(2)
clear()
aa = loadFileConnLNBits(['invoice_read_key'])
bb = str(a['invoice_read_key'])
checkcurl = 'curl -X GET https://lnbits.com/paywall/api/v1/paywalls -H' + """ "X-Api-Key: {}" """.format(bb)
sh = os.popen(checkcurl).read()
clear()
blogo()
n = str(sh)
d = json.loads(n)
while True:
print("\n\tLNBITS PAYWALL LIST\n")
for item_ in d:
s = item_
print("ID: " + s['id'])
nd = input("\nSelect ID: ")
for item in d:
s = item
nn = s['id']
if nd == nn:
print("\n----------------------------------------------------------------------------------------------------------------")
print("""
\tLNBITS PAYWALL DECODED
ID: {}
Amount: {} sats
Description: {}
Memo: {}
Extras: {}
Remembers: {}
URL: {}
Wallet: {}
""".format(s['id'], s['amount'], s['description'], s['memo'], s['extras'], s['remembers'], s['url'], s['wallet']))
print("----------------------------------------------------------------------------------------------------------------\n")
input("Continue...")
clear()
blogo()
except:
break
def lnbitListPawWall():
a = loadFileConnLNBits(['invoice_read_key'])
b = str(a['invoice_read_key'])
checkcurl = 'curl -X GET https://lnbits.com/paywall/api/v1/paywalls -H' + """ "X-Api-Key: {}" """.format(b)
sh = os.popen(checkcurl).read()
clear()
blogo()
n = str(sh)
d = json.loads(n)
while True:
print("\n\tLNBITS PAYWALL LIST\n")
try:
for item_ in d:
s = item_
print("ID: " + s['id'])
nd = input("\nSelect ID: ")
for item in d:
s = item
nn = s['id']
if nd == nn:
print("\n----------------------------------------------------------------------------------------------------------------")
print("""
\tLNBITS PAYWALL DECODED
ID: {}
Amount: {} sats
Description: {}
Memo: {}
Extras: {}
Remembers: {}
URL: {}
Wallet: {}
""".format(s['id'], s['amount'], s['description'], s['memo'], s['extras'], s['remembers'], s['url'], s['wallet']))
print("----------------------------------------------------------------------------------------------------------------\n")
except:
break
input("Continue...")
clear()
blogo()
def lnbitDeletePayWall():
while True:
try:
a = loadFileConnLNBits(['invoice_read_key'])
b = str(a['invoice_read_key'])
checkcurl = 'curl -X GET https://lnbits.com/paywall/api/v1/paywalls -H' + """ "X-Api-Key: {}" """.format(b)
sh = os.popen(checkcurl).read()
clear()
blogo()
n = str(sh)
d = json.loads(n)
while True:
print("\n\tLNBITS PAYWALL LIST\n")
try:
for item_ in d:
s = item_
print("ID: " + s['id'])
nd = input("\nSelect ID: ")
for item in d:
s = item
nn = s['id']
if nd == nn:
print("\n----------------------------------------------------------------------------------------------------------------")
print("""
\tLNBITS PAYWALL DECODED
ID: {}
Amount: {} sats
Description: {}
Memo: {}
Extras: {}
Remembers: {}
URL: {}
Wallet: {}
""".format(s['id'], s['amount'], s['description'], s['memo'], s['extras'], s['remembers'], s['url'], s['wallet']))
print("----------------------------------------------------------------------------------------------------------------\n")
except:
break
input("Continue...")
break
print("\n\tDELETE PAYWALL\n")
a = loadFileConnLNBits(['admin_key'])
b = str(a['admin_key'])
id = input("Insert PayWall ID: ")
curl = "curl -X DELETE https://lnbits.com/paywall/api/v1/paywalls/{}".format(id) + """ -H "X-Api-Key: {}" """.format(b)
sh = os.popen(curl).read()
clear()
blogo()
print("\n\tPAYWALL DELETED SUCCESSFULLY\n")
t.sleep(2)
clear()
except:
break
#-----------------------------END LNBITS--------------------------------
#-----------------------------LNPAY--------------------------------
def loadFileConnLNPay(lnpayLoad):
lnpayLoad = {"key":""}
if os.path.isfile('lnpay.conf'): # Check if the file 'bclock.conf' is in the same folder
lnpayData= pickle.load(open("lnpay.conf", "rb")) # Load the file 'bclock.conf'
lnpayLoad = lnpayData # Copy the variable pathv to 'path'
else:
clear()
blogo()
print("""\n\t \033[1;33;40mATENTION\033[0;37;40m: YOU ARE GOING TO CREATE A FILE WITH YOUR INFORMATION OF CONNECTION TO LNPAY.CO.
WE WILL NEED SOME INFORMATION FROM YOUR ACCOUNT THAT THE ONLY ONE THAT WILL HAVE ACCESS IS YOU.
IF YOU DELETE THIS FILE YOU WILL NEED TO PAY AGAIN TO GET ACCESS FROM PyBLOCK.
SAVE THE FILE '\033[1;33;40mlnpaySN.conf\033[0;37;40m' IN A SAFE PLACE.\n
""")
lnpayLoad["key"] = input("API Key: ")
print("\n\tWALLET ACCESS KEYS\n")
lnpayLoad["wallet_key_id"] = input("Wallet Admin: ")
pickle.dump(lnpayLoad, open("lnpay.conf", "wb"))
clear()
blogo()
return lnpayLoad
def createFileConnLNPay():
clear()
blogo()
print("""\n\t \033[1;33;40mATENTION\033[0;37;40m: YOU ARE GOING TO CREATE A FILE WITH YOUR INFORMATION OF CONNECTION TO LNPAY.CO.
WE WILL NEED SOME INFORMATION FROM YOUR ACCOUNT THAT THE ONLY ONE THAT WILL HAVE ACCESS IS YOU.
IF YOU DELETE THIS FILE YOU WILL NEED TO PAY AGAIN TO GET ACCESS FROM PyBLOCK.
SAVE THE FILE '\033[1;33;40mlnpaySN.conf\033[0;37;40m' IN A SAFE PLACE.\n
""")
lnpayLoad["key"] = input("API Key: ")
print("\n\tWALLET ACCESS KEYS\n")
lnpayLoad["wallet_key_id"] = input("Wallet Admin: ")
pickle.dump(lnpayLoad, open("lnpay.conf", "wb"))
def lnpayGetBalance():
a = loadFileConnLNPay(['key'])
b = str(a['key'])
n = loadFileConnLNPay(['wallet_key_id'])
q = str(n['wallet_key_id'])
lnpay_py.initialize(b)
clear()
blogo()
my_wallet = LNPayWallet(q)
info = my_wallet.get_info()
print("\n---------------------------------------------------------------------------------------------------")
print("""
\tLNPAY WALLET BALANCE
Wallet ID: {}
Wallet Name: {}
Balance: {} sats
""".format(info['id'], info['user_label'], info['balance']))
print("---------------------------------------------------------------------------------------------------\n")
input("\nContinue... ")
def lnpayCreateInvoice():
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=4,
)
a = loadFileConnLNPay(['key'])
b = str(a['key'])
n = loadFileConnLNPay(['wallet_key_id'])
q = str(n['wallet_key_id'])
lnpay_py.initialize(b)
clear()
blogo()
my_wallet = LNPayWallet(q)
amt = input("\nAmount in Sats: ")
memo = input("Memo: ")
invoice_params = {
'num_satoshis': amt,
'memo': memo + ' -PyBLOCK'
}
try:
invoice = my_wallet.create_invoice(invoice_params)
clear()
blogo()
node_not = input("Do you want to pay this tip with your node? Y/n: ")
while True:
if node_not in ["Y", "y"]:
lndconnectload = {"ip_port":"", "tls":"", "macaroon":"", "ln":""}
lndconnectData = pickle.load(open("blndconnect.conf", "rb")) # Load the file 'bclock.conf'
lndconnectload = lndconnectData # Copy the variable pathv to 'path'
if lndconnectload['ip_port']:
print("\nInvoice: " + invoice['payment_request'] + "\n")
payinvoice()
elif lndconnectload['ln']:
print("\nInvoice: " + invoice['payment_request'] + "\n")
localpayinvoice()
elif node_not in ["N", "n"]:
print("\033[1;30;47m")
qr.add_data(invoice['payment_request'])
qr.print_ascii()
print("\033[0;37;40m")
qr.clear()
print("Lightning Invoice: " + invoice['payment_request'])
t.sleep(10)
curl = 'curl -u ' + b + ': https://lnpay.co/v1/lntx/' + invoice['id'] + '?fields=settled,num_satoshis'
rsh = os.popen(curl).read()
clear()
blogo()
nn = str(rsh)
dd = json.loads(nn)
db = dd['settled']
if db == 1:
clear()
blogo()
tick()
t.sleep(2)
break
else:
continue
except:
pass
def lnpayGetTransactions():
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=4,
)
a = loadFileConnLNPay(['key'])
b = str(a['key'])
n = loadFileConnLNPay(['wallet_key_id'])
q = str(n['wallet_key_id'])
lnpay_py.initialize(b)
clear()
blogo()
my_wallet = LNPayWallet(q)
transactions = my_wallet.get_transactions()
while True:
try:
print("\n\tLNPAY LIST PAYMENTS\n")
for transaction_ in transactions:
s = transaction_
q = s['lnTx']
print("ID: " + s['id'])
nd = input("\nSelect ID: ")
for transaction in transactions:
s = transaction
nn = s['id']
nnn = s['lnTx']
if nd == nn:
print("\n----------------------------------------------------------------------------------------------------")
print("""
\tLNPAY LIST PAYMENT DECODED
ID: {}
Amount: {} sats
Memo: {}
Invoice: {}
RHash: {}
""".format(nnn['id'], nnn['num_satoshis'], nnn['memo'], nnn['payment_request'], nnn['r_hash_decoded']))
print("----------------------------------------------------------------------------------------------------\n")
print("\033[1;30;47m")
qr.add_data(nnn['payment_request'])
qr.print_ascii()
print("\033[0;37;40m")
qr.clear()
input("Continue...")
clear()
blogo()
except:
break
clear()
blogo()
def lnpayPayInvoice():
a = loadFileConnLNPay(['key'])
b = str(a['key'])
n = loadFileConnLNPay(['wallet_key_id'])
q = str(n['wallet_key_id'])
lnpay_py.initialize(b)
clear()
blogo()
my_wallet = LNPayWallet(q)
try:
print("\n\tLNPAY PAY INVOICE\n")
inv = input("\nInvoice: ")
curl = 'curl -u' + b +': https://lnpay.co/v1/node/default/payments/decodeinvoice?payment_request=' + inv
clear()
rsh = os.popen(curl).read()
nn = str(rsh)
dd = json.loads(nn)
clear()
blogo()
print("\n----------------------------------------------------------------------------------------------------")
print("""
\tLNPAY INVOICE DECODED
Destination: {}
Amount: {} sats
Memo: {}
Invoice: {}
""".format(dd['destination'], dd['num_satoshis'], dd['description'], inv))
print("----------------------------------------------------------------------------------------------------\n")
print("<<< Cancel Control + C")
input("\nEnter to Continue... ")
invoice_params = {
'payment_request': inv
}
pay_result = my_wallet.pay_invoice(invoice_params)
except:
pass
def lnpayTransBWallets():
a = loadFileConnLNPay(['key'])
b = str(a['key'])
n = loadFileConnLNPay(['wallet_key_id'])
q = str(n['wallet_key_id'])
lnpay_py.initialize(b)
clear()
blogo()
print("""\n\tLNPAY TRANSFER BETWEEN WALLETS
\nCaution: If you Transfer to another of your LNPay wallets
you will only access to your funds via Web.\n""")
try:
wall = input("Wallet destination ID: ")
amt = input("Amount in Sats: ")
memo = input("Memo: ")
my_wallet = LNPayWallet(q)
transfer_params = {
'dest_wallet_id': wall,
'num_satoshis': amt,
'memo': memo
}
transfer_result = my_wallet.internal_transfer(transfer_params)
p = transfer_result['wtx_transfer_in']
e = transfer_result['wtx_transfer_out']
f = e['wal']
v = p['wal']
print("\n----------------------------------------------------------------------------------------------------")
print("""
\tLNPAY TRANSFER BETEWWN WALLETS INFORMATION
ID: {}
Amount: {} sats
Memo: {}
To Wallet: {}
From Wallet: {}
""".format(p['id'], p['num_satoshis'], p['user_label'], v['user_label'], f['user_label']))
print("----------------------------------------------------------------------------------------------------\n")
input("Continue...")
except:
pass
#-----------------------------END LNPAY--------------------------------
#-----------------------------OPENNODE--------------------------------
def loadFileConnOpenNode(opennodeLoad):
opennodeLoad = {"key":"","wdr":"","inv":""}
if os.path.isfile('opennode.conf'): # Check if the file 'bclock.conf' is in the same folder
opennodeData= pickle.load(open("opennode.conf", "rb")) # Load the file 'bclock.conf'
opennodeLoad = opennodeData # Copy the variable pathv to 'path'
else:
clear()
blogo()
print("""\n\t \033[1;33;40mATENTION\033[0;37;40m: YOU ARE GOING TO CREATE A FILE WITH YOUR INFORMATION OF CONNECTION TO OPENNODE.COM.
WE WILL NEED SOME INFORMATION FROM YOUR ACCOUNT THAT THE ONLY ONE THAT WILL HAVE ACCESS IS YOU.
IF YOU DELETE THIS FILE YOU WILL NEED TO PAY AGAIN TO GET ACCESS FROM PyBLOCK.
SAVE THE FILE '\033[1;33;40mopennodeSN.conf\033[0;37;40m' IN A SAFE PLACE.\n
""")
opennodeLoad["key"] = input("API Read Only Key: ")
opennodeLoad["wdr"] = input("API Withdrawall Key: ")
opennodeLoad["inv"] = input("API Invoices Key: ")
pickle.dump(opennodeLoad, open("opennode.conf", "wb"))
clear()
blogo()
return opennodeLoad
def createFileConnOpenNode():
opennodeLoad = {"key":"","wdr":"","inv":""}
clear()
blogo()
print("""\n\t \033[1;33;40mATENTION\033[0;37;40m: YOU ARE GOING TO CREATE A FILE WITH YOUR INFORMATION OF CONNECTION TO OPENNODE.COM.
WE WILL NEED SOME INFORMATION FROM YOUR ACCOUNT THAT THE ONLY ONE THAT WILL HAVE ACCESS IS YOU.
IF YOU DELETE THIS FILE YOU WILL NEED TO PAY AGAIN TO GET ACCESS FROM PyBLOCK.
SAVE THE FILE '\033[1;33;40mopennodeSN.conf\033[0;37;40m' IN A SAFE PLACE.\n
""")
opennodeLoad["key"] = input("API Read Only Key: ")
opennodeLoad["wdr"] = input("API Withdrawall Key: ")
opennodeLoad["inv"] = input("API Invoices Key: ")
pickle.dump(opennodeLoad, open("opennode.conf", "wb"))
def OpenNodelistfunds():
a = loadFileConnOpenNode(['wdr'])
b = str(a['wdr'])
curl = "curl https://api.opennode.co/v1/account/balance -H "+ '"Content-Type: application/json" -H "Authorization: {}"'.format(b)
sh = os.popen(curl).read()
clear()
blogo()
n = str(sh)
d = json.loads(n)
r = d['data']
p = r['balance']
print("\n----------------------------------------------------------------------------------------------------")
print("""
OPENNODE BALANCE
Amount: {} sats
""".format(p['BTC']))
print("----------------------------------------------------------------------------------------------------\n")
input("Continue...")
def OpenNodeCheckStatus():
curl = "curl -X GET https://status.opennode.com/history.rss"
sh = os.popen(curl).read()
clear()
blogo()
my_dict=xmltodict.parse(sh)
n=json.dumps(my_dict)
nn = str(n)
qq = json.loads(n)
a = qq['rss']
b = a['channel']
c = b['title']
d = b['item']
dd = d[0]
e = dd['title']
print("""
\n----------------------------------------------------------------------------------------------------
\n\t{}
{}\n
{}
\n----------------------------------------------------------------------------------------------------
""".format(c.upper(),e,b['pubDate']))
input("Enter to Continue...")
def OpenNodecreatecharge():
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=4,
)
a = loadFileConnOpenNode(['key'])
b = str(a['key'])
fiat = input("Are you going to pay in FIAT? Y/n:")
if fiat in ["Y", "y"]:
print("\n----------------------------------------------------------------------------------------------------")
print("""
\tFIAT supported on OpenNode:
AED,AFN,ALL,AMD,ANG,AOA,ARS,AUD,AWG,AZN,BAM,BBD,BDT,BGN,BHD,BIF,BMD,BND,BOB,BRL,BSD,BTN,BWP,
BYN,BZD,CAD,CDF,CHF,CLF,CLP,CNH,CNY,COP,CRC,CUC,CUP,CVE,CZK,DJF,DKK,DOP,DZD,EGP,ERN,ETB,EUR,
FJD,FKP,GBP,GEL,GGP,GHS,GIP,GMD,GNF,GTQ,GYD,HKD,HNL,HRK,HTG,HUF,IDR,ILS,IMP,INR,IQD,IRR,ISK,
JEP,JMD,JOD,JPY,KES,KGS,KHR,KMF,KPW,KRW,KWD,KYD,KZT,LAK,LBP,LKR,LRD,LSL,LYD,MAD,MDL,MGA,MKD,
MMK,MNT,MOP,MRO,MUR,MVR,MWK,MXN,MYR,MZN,NAD,NGN,NIO,NOK,NPR,NZD,OMR,PAB,PEN,PGK,PHP,PKR,PLN,
PYG,QAR,RON,RSD,RUB,RWF,SAR,SBD,SCR,SDG,SEK,SGD,SHP,SLL,SOS,SRD,SSP,STD,SVC,SYP,SZL,THB,TJS,