File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ from bitcoinrpc .authproxy import AuthServiceProxy
2+
3+ #################################################
4+ # Sending a transation to the network with RPC #
5+ #################################################
6+
7+ # ---------------------------------------------------------------------------------------------------------------------
8+ # The following piece of code serves as an example of how to send a transaction created with any of the pieces of
9+ # code of the other examples to the P2P network. The code assumes you have access to a Bitcoin node with RPC
10+ # enabled. RPC authentication details have to be provided in the proper variables.
11+ #
12+ # Alternatively, you can also push the transaction to the network with a 3rd party service.
13+ #
14+ # Note that this code has an additional dependency: bitcoinrpc
15+ # This dependency is not required by bitcoin_tools, since it is only used in this example, and most users
16+ # will not need to use it.
17+ # ---------------------------------------------------------------------------------------------------------------------
18+
19+
20+ # Set RPC configuration
21+ rpc_user = "" # set roc user
22+ rpc_password = "" # set rpc password
23+ rpc_server = "" # set rpc server
24+ rpc_port = 18332
25+
26+ # Test connection
27+ rpc_connection = AuthServiceProxy ("http://%s:%s@%s:%s" % (rpc_user , rpc_password , rpc_server , rpc_port ))
28+ get_info = rpc_connection .getinfo ()
29+ print get_info
30+
31+ # Send transaction
32+ # raw_transaction = ...
33+ # rpc_connection.sendrawtransaction(raw_transaction)
You can’t perform that action at this time.
0 commit comments