1
0

file reorganization with top-level module

This commit is contained in:
Janus
2018-07-11 17:38:47 +02:00
parent 30a7952cbb
commit 097ac144d9
317 changed files with 438 additions and 470 deletions

35
electrum/scripts/bip70.py Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env python3
# create a BIP70 payment request signed with a certificate
import tlslite
from electrum.transaction import Transaction
from electrum import paymentrequest
from electrum import paymentrequest_pb2 as pb2
chain_file = 'mychain.pem'
cert_file = 'mycert.pem'
amount = 1000000
address = "18U5kpCAU4s8weFF8Ps5n8HAfpdUjDVF64"
memo = "blah"
out_file = "payreq"
with open(chain_file, 'r') as f:
chain = tlslite.X509CertChain()
chain.parsePemList(f.read())
certificates = pb2.X509Certificates()
certificates.certificate.extend(map(lambda x: str(x.bytes), chain.x509List))
with open(cert_file, 'r') as f:
rsakey = tlslite.utils.python_rsakey.Python_RSAKey.parsePEM(f.read())
script = Transaction.pay_script('address', address).decode('hex')
pr_string = paymentrequest.make_payment_request(amount, script, memo, rsakey)
with open(out_file,'wb') as f:
f.write(pr_string)
print("Payment request was written to file '%s'"%out_file)