From 3fbab46ef774dce7c272b823a03b1a7211a9392c Mon Sep 17 00:00:00 2001 From: Efe Date: Mon, 16 Dec 2019 17:20:49 +0300 Subject: [PATCH] Added general notes --- .DS_Store | Bin 0 -> 6148 bytes notes.py | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 .DS_Store create mode 100644 notes.py diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0testnet rather than >bitcoin-cli. +/ +>testnet help +>mainnet help +Prints all the commands to use in testnet or mainnet +/ +>testnet help getblockchaininfo +Gets the help for the related command +/ +>testnet getblockchaininfo +Makes the query with the method for the testnet. mainnet for the actual chain +/ +>mainnet getmininginfo +Gives the mining info +/ +Check how the nodes talk with each other from https://bitcoin.org/en/developer-reference#protocol-versions +This changes from version to version. ipv4 / ipv6 / onion +/ +>testnet getwalletinfo +Gives the wallet info +/ +>testnet listtransactions +The transactions related to wallet +/ +Code to connect to node +If you don't have bitcoinrpc install it with pip: +pip install python-bitcoinrpc +/ +Code: +from bitcoinrpc.authproxy import AuthServiceProxy + +N = 115792089237316195423570985008687907852837564279074904382605163141518161494337 +big_number = 105936749493397165751943248390023977685888340619776708311600296471039819517671 + +class RPC: + + def __init__(self, uri): + self.rpc = AuthServiceProxy(uri) + + def __getattr__(self, name): + """Hack to establish a new AuthServiceProxy every time this is called""" + return getattr(self.rpc, name) + +rpc_template = "http://%s:%s@%s:%s" +mainnet = RPC(rpc_template % + ('bitcoin', 'python', '68.183.110.103', 8332)) +testnet = RPC(rpc_template % + ('bitcoin', 'python', 'localhost', 18332)) +/ +pprint : A package to print objects pretty.Especially JSON objects. +from helpers import testnet +from pprint import pprint + +pprint(testnet.getblockchaininfo()) + + +''' \ No newline at end of file