means of acquiring the whitepaper
Closed this issue · 2 comments
Prazer, sou nyx.
Line 331 in 67a22e1
Using bitcoin.org, but it is a central server and even if their copy is taken down?
Consider sourcing from the blockchain,
- specter version as you are using python in this project.
- bitcoin-cli for the Raspiblitz:
sudo -u bitcoin bitcoin-cli getblock 00000000000000ecbbff6bafb7efa2f7df05b227d5c73dca8f2635af32a2e949 0 | tail -c+92167 | for ((o=0;o<946;++o)) ; do read -rN420 x ; echo -n ${x::130}${x:132:130}${x:264:130} ; done | xxd -r -p | tail -c+9 | head -c184292 > bitcoin.pdf
of course user can scp
to another computer if running headless, but a solution to show the text from the terminal is:
pdftotext bitcoin.pdf
less bitcoin.txt
Opa @nyxnor!
Thanks for the input. Will probably head the same way Specter implemented this. Added to next improvement list.
This has been fixed with a new download method using RPC as a primary source and will be deployed in the next version after testing.
The app will try in order:
-
The method below
get_whitepaper()
-
A Linux script as suggested by @nyxnor:
sudo -u bitcoin bitcoin-cli getblock 00000000000000ecbbff6bafb7efa2f7df05b227d5c73dca8f2635af32a2e949 0 | tail -c+92167 | for ((o=0;o<946;++o)) ; do read -rN420 x ; echo -n ${x::130}${x:132:130}${x:264:130} ; done | xxd -r -p | tail -c+9 | head -c184292 > bitcoin.pdf
-
If all fails, will try to download from bitcoin.org.
RPC Method:
def get_whitepaper():
rpc_connection = rpc_connect()
hash = "54e48e5f5c656b26c3bca14a8c95aa583d07ebe84dde3b7dd4a78f4e4186e713"
outputs_prun = []
for i in range(0, 946):
outputs_prun.append(rpc_connection.gettxout(hash, i))
pdf = ""
for output in outputs_prun[:-1]:
cur = 4
pdf += output["result"]["scriptPubKey"]["hex"][cur:cur + 130]
cur += 132
pdf += output["result"]["scriptPubKey"]["hex"][cur:cur + 130]
cur += 132
pdf += output["result"]["scriptPubKey"]["hex"][cur:cur + 130]
pdf += outputs_prun[-1]["result"]["scriptPubKey"]["hex"][4:-4]
from pathlib import Path
filename = Path('bitcoin_whitepaper_from_node.pdf')
with open(filename, "w") as text_file:
text_file.write(pdf)
return (f"Success. File {str(filename)} saved.")