Skip to content

Commit 832927e

Browse files
author
Pierre Rochard
committed
First iteration of instructions on how to set up an HTTPS JSON-RPC connection
1 parent 6ab33df commit 832927e

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

examples/ssl-rpc-connection.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env python3
2+
3+
# Copyright (C) 2014 The python-bitcoinlib developers
4+
#
5+
# This file is part of python-bitcoinlib.
6+
#
7+
# It is subject to the license terms in the LICENSE file found in the top-level
8+
# directory of this distribution.
9+
#
10+
# No part of python-bitcoinlib, including this file, may be copied, modified,
11+
# propagated, or distributed except according to the terms contained in the
12+
# LICENSE file.
13+
14+
15+
## Instructions
16+
17+
# This sets up SSL on a localhost connection. Not terribly useful but it will be iterated on.
18+
19+
# Linux: cd ~/.bitcoin
20+
# Mac: cd ~/Library/Application\ Support/Bitcoin/
21+
# openssl genrsa -out server.pem 2048
22+
# openssl req -new -x509 -nodes -sha256 -days 3650 -key server.pem > server.cert
23+
# The prompts are optional, you can just hit enter
24+
25+
# Verify that your bitcoin.conf exists in the above directory and contains the following lines:
26+
# server=1
27+
# rpcssl=1
28+
# rpcuser=CHANGETHIS
29+
# rpcpassword=CHANGETHAT
30+
# rpcsslciphers=TLSv1_2
31+
# rpcsslprivatekeyfile=server.pem
32+
# rpcsslcertificatechainfile=server.cert
33+
34+
import bitcoin.rpc
35+
36+
proxy_connection = bitcoin.rpc.Proxy()
37+
print(proxy_connection.getnewaddress())

0 commit comments

Comments
 (0)