Automating Crypto Transfers Between Two Coinbase Accounts
If anyone has more than one Coinbase (hereby referred to as CB) account you may get annoyed at having to log in & out of one account in order to transfer funds. My situation is I needed to create a second CB account based on my gmail email for some android games that give free crypto. The games unfortunately require a gmail-based CB account. So, I created my second account with my gmail, but I soon found out how much of a nuisance this was. Every time I withdraw funds from the games I had to
- Log out of my main CB account
- Log into my gmail CB account
- Proceed to transfer funds to my main CB account
- Log back out of my gmail CB account
- Log back into my main cb account.
This very tedious process led me to search for ways of automating it. At first I attempted to add the CB's OAuth api to AutoWeb, but since OAuth has forever eluded my understanding I sought alternatives. My python knowledge to the rescue!
TLDR of below:
Pip installed coinbase module, modified one of the core files prior to copying over the modified module into eventghost's python site-packages directory, created a python script action to transfer all funds automatically when triggered by AutoRemote command.
Requirements (Links added for Ease):
- 2 Coinbase Accounts
- Tasker android app
- AutoRemote android app (a plugin for Tasker)
- Eventghost
- Eventghost's AutoRemote Plugin
- (Optional) Google Chromes AutoRemote Plugin
- Python 2.7
- Python's Pip module
- A text editor (notepad++ will do)
- Basic Python scripting knowledge
Steps:
- Create an api key ON THE SENDING ACCOUNT (link to api settings)
- Copy down the api_key & api_secret (we'll need this later)
pip install coinbase
- Navigate to your python installation's site-packages (Mine is C:\Python27\Lib\site-packages)
- From that directory, copy the following folders:
- coinbase
- chardet
- idna
- OpenSSL
- requests
- Paste them into a new folder. I created mine in my Downloads directory (C:\Users\mhill\Downloads\TempArea)
- Once in the Downloads folder, Navigate to the coinbase>wallet folder, right click on the
client.py
file & select Edit with Notepad++ (or whatever text editor you use) - Change the following line in the file
VERIFY_SSL = True
=>VERIFY_SSL = False
- Save Changes to the file.
- Open another File Explorer window, navigate to the EventGhost directory and find the site-packages folder (Mine is C:\Program Files (x86)\EventGhost\lib27\site-packages).
NOTE: Make sure you go into the lib27 folder. - Copy/paste all 5 of the folders you have in your TempArea directory over to the EventGhost directory in the second File Explorer.
- Restart EventGhost if you had it open.
- Create a new macro > Add Event > Enter
AutoRemote.Message.{YourCommandHere}
(I usedAutoRemote.Message.Coinbase
). - Create a Python Script Action with the following code (Replace
{apiKey}
,{apiSecret}
&{YourMainAccountEmail}
)
from coinbase.wallet.client import Client
import json
api_key = '{apiKey}'
api_secret = '{apiSecret}'
client = Client(api_key, api_secret)
accounts = client.get_accounts()['data']
for account in accounts:
sending_currency = account['currency']
if float(account['balance']['amount']) > 0:
#Send to other account
sending_account = client.get_account(account['id'])
sending_amount = account['balance']['amount']
print 'sending %s %s' % (sending_amount, sending_currency)
sending_account.send_money(to='{YourMainAccountEmail}',
amount=sending_amount,
currency=sending_currency)
- Now that EventGhost is all set up, create a New Profile in Tasker using AutoNotification Intercept as the Trigger. Use the following characteristics:
- Event Behaviour: true
- Notification Apps: Gmail
- Notification Text: just sent you .+ (BTC|ETH|BCH|LTC) (regex)
- Add a single AutoRemote Message Action to the profile:
- Recipient: (Your AutoRemote Address for either the Eventghost AutoRemote Plugin OR your Google Chrome AutoRemote Plugin). If you sending to your Google Chrome AutoRemote Plugin make sure that the option "Forward all commands/messages to EventGhost" is checked in the Plugin's Settings.
- Message: Whatever command you put as
{YourCommandHere}
inAutoRemote.Message.{YourCommandHere}
And that's it! Now, whenever you receive crypto on your gmail CB account tasker, AutoRemote & Eventghost will automatically transfer all crypto to your main CB account!
If you found this guide useful, please consider sending a small donation using any of the following addresses.
Paypal: [email protected]
Coinbase: [email protected]
BTC: 1CnucdyKNQptCLnRqXG4ortug8ic6yWTiw
BCH: qrgqy7sxecejv7vmqn8u3j9ypaj036z3kcsj4vqapq
ETH: 0x6841BA94274dd86e6B036c08863d431Cd61Ea989
LTC: LaizWQaZ4fDfWahYZECvaow6SbSruFiATX
Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
https://www.reddit.com/r/tasker/comments/7zfo9i/howto_automate_crypto_transfers_from_one_coinbase/