forked from petertodd/python-bitcoinlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathssl-rpc-connection.py
executable file
·37 lines (29 loc) · 1.11 KB
/
ssl-rpc-connection.py
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
#!/usr/bin/env python3
# Copyright (C) 2014 The python-bitcoinlib developers
#
# This file is part of python-bitcoinlib.
#
# It is subject to the license terms in the LICENSE file found in the top-level
# directory of this distribution.
#
# No part of python-bitcoinlib, including this file, may be copied, modified,
# propagated, or distributed except according to the terms contained in the
# LICENSE file.
## Instructions
# This sets up SSL on a localhost connection. Not terribly useful but it will be iterated on.
# Linux: cd ~/.bitcoin
# Mac: cd ~/Library/Application\ Support/Bitcoin/
# openssl genrsa -out server.pem 2048
# openssl req -new -x509 -nodes -sha256 -days 3650 -key server.pem > server.cert
# The prompts are optional, you can just hit enter
# Verify that your bitcoin.conf exists in the above directory and contains the following lines:
# server=1
# rpcssl=1
# rpcuser=CHANGETHIS
# rpcpassword=CHANGETHAT
# rpcsslciphers=TLSv1_2
# rpcsslprivatekeyfile=server.pem
# rpcsslcertificatechainfile=server.cert
import bitcoin.rpc
proxy_connection = bitcoin.rpc.Proxy()
print(proxy_connection.getnewaddress())