Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- import json
- def main():
- # default RPC port for XBY
- rpc_port = 34001
- # RPC credentials, as specified in xtrabytes.conf
- rpc_user = "testuser"
- rpc_password = "testpassword"
- # Generating the url from the specified credentials
- url = "http://" + rpc_user + ":" + rpc_password + "@localhost:" + str(rpc_port)
- # Setting the header
- headers = {'content-type': 'application/json'}
- # Specifying the recipients wallets. Although it might be easier to read from file/DB
- recipients = ['address1', 'address2', 'address3']
- # Set amount
- amount_to_send = 1000
- # Loop over the receiving addresses
- for recipient in recipients:
- # Example of sending the money transfer command
- payload = {
- "method": "sendtoaddress",
- "params": [recipient, amount_to_send],
- "jsonrpc": "2.0",
- "id": 0,
- }
- # Send the RPC request
- response = requests.post(
- url, data=json.dumps(payload), headers=headers).json()
- # Print the Response
- print(response.json()['result'])
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement