Automating Crypto Transfers Between Two Coinbase Accounts

in #automation7 years ago (edited)

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

  1. Log out of my main CB account
  2. Log into my gmail CB account
  3. Proceed to transfer funds to my main CB account
  4. Log back out of my gmail CB account
  5. 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):

Steps:

  1. Create an api key ON THE SENDING ACCOUNT (link to api settings)
  2. Copy down the api_key & api_secret (we'll need this later)
  3. pip install coinbase
  4. Navigate to your python installation's site-packages (Mine is C:\Python27\Lib\site-packages)
  5. From that directory, copy the following folders:
  • coinbase
  • chardet
  • idna
  • OpenSSL
  • requests
  1. Paste them into a new folder. I created mine in my Downloads directory (C:\Users\mhill\Downloads\TempArea)
  2. 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)
  3. Change the following line in the file
    VERIFY_SSL = True => VERIFY_SSL = False
  4. Save Changes to the file.
  5. 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.
  6. Copy/paste all 5 of the folders you have in your TempArea directory over to the EventGhost directory in the second File Explorer.
  7. Restart EventGhost if you had it open.
  8. Create a new macro > Add Event > Enter AutoRemote.Message.{YourCommandHere} (I used AutoRemote.Message.Coinbase).
  9. 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)
  1. 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)
  1. 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} in AutoRemote.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

Sort:  

Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in: