Welcome to the Dash Forum!

Please sign up to discuss the most innovative cryptocurrency!

Guide to Receive a Text Message and MORE Whenever DRK received!!!

Discussion in 'Miscellaneous Dash Guides' started by Ryan Taylor, Aug 16, 2014.

  1. Ryan Taylor

    Ryan Taylor Well-known Member
    Dash Core Team Foundation Member

    Joined:
    Jul 3, 2014
    Messages:
    535
    Likes Received:
    1,630
    Trophy Points:
    263
    EDIT: I finally figured out what I was doing wrong with Windows so instructions included for that and the guide now shows users how to create multiple commands.

    Wouldn't it be nice to receive a text message every time your wallet receives a payment? What about an email? Perhaps you'd like to update your Facebook status or Twitter to let everyone know that you just got a MN payment? As you'll see, the possibilities are pretty wide on what you could do. I figured out a pretty simple way to send myself a text every time my wallet receives a payment, whether from my MN, or if I mine a block, or if someone just sends me some DRK. Any wallet transactions will generate a text. AND it would be really easy to develop other services for yourself using IMAP, FTP, POP3, HTTP, Telnet, and many other URL syntaxes. I've just scratched the surface with my text message guide below and I'd be interested to see what others in the forum can dream up. Here's how I set up my text messaging service.

    Step 1: Make sure you have cURL loaded on the machine you want to monitor

    cURL is a useful command line utility used for sending http requests, among many other potential commands. By using curl, you will be able to send a request to a website that will generate the text message. Most installs of OSX or Linux already have native support for cURL on the command line. However, if you are using Windows, or your OS doesn't have cURL pre-installed, you will first need to install cURL.

    If you are using OSX, you can test whether cURL is installed by opening your terminal and entering "curl" into the command line. If it returns "curl: try 'curl --help' or 'curl --manual' for more information", or something similar, cURL is already installed and you may skip ahead to step 2. If you are using Linux, it's the same procedure. Simply enter "curl" on the command line from any directory and it will tell you if it's installed. If it is NOT installed, you will likely get a message such as "The program 'curl' is currently not installed. You can install it by typing: sudo apt-get install curl".

    So, skip ahead if you already have cURL. For everyone else, go to http://curl.haxx.se/download.html to install the appropriate version or follow the instructions that popped up in linux. You can install the SSL versions if you want to (it involves a couple of extra steps), but is not necessary or even useful for the text message service we are setting up. There are many decent guides on how to install cURL on various operating systems either with or without SSL. Since Windows users will definitely need to install it, here is a good example of a guide for Windows 7... other versions of Windows will be very similar. http://support.gnip.com/articles/curl-on-win7.html

    Make sure to install cURL in your Darkcoin folder where darkcoin-qt is running, so that the next step will work for you exactly as written. Also, test typing "curl" into the command line to make sure cURL is working.

    Step 2: Edit your configuration file

    I used the walletnotify command line argument in the .conf file to trigger curl with an action to send a text whenever there is a received payment.

    Add the following line to your .conf file
    Code:
    walletnotify=curl http://textbelt.com/text -d number=2125551234 -d "message=<put your message here>"
    If your mobile number is located within the US, simply enter your 10-digit phone number without the "1" country code. If you live outside the US, or you have an obscure mobile network operator, you should go to textbelt.com to see if your carrier is supported and if so how to enter the number based on your country.


    I got this working on my OSX wallet very easily. However, I had trouble with Windows 7 and discovered that curl.exe had to be in the darkcoin wallet to be initiated with walletnotify. While entering "C:\Windows\System32\curl.exe http://textbelt.com/text -d number=1234567890 -d "message=my message" directly into the command line worked when I had cURL installed in that folder, and an incoming transaction definitely triggered cmd.exe to pop up very briefly (so I knew walletnotify triggered the command), for some reason it wasn't working.

    Step 2a: If you want to add sound or other additional commands, you can create a Windows batch file or OSX/Linux script

    In Windows, you can install a command line sound application like Sounder (just google search for sounder.exe) to play a wav file or mp3. Save Sounder to your Darkcoin folder. Then simply use Notepad to create a file in your Darkcoin folder called notify.bat and put the following in it (and add whatever other commands you want).

    Code:
    curl http://textbelt.com/text -d number=2125551234 -d "message=yourmessage"
    sounder <sounder commands>
    Then you can change the walletnotify command in your .conf file to read as follows
    Code:
    walletnotify=C:\Darkcoin\notify.bat <or whatever the path is to your batch file>
    Windows will run through all your commands you saved in the batch file, so the possibilities are pretty endless.


    In OSX or Linux, the process for creating a file to run multiple commands is similar as described above, except you will create a script. In OSX, use Terminal to access the folder you want to create the script in (/Library/Application\ Support/Darkcoin/). In Linux it is usually /Darkcoin. Once you are in your Darkcoin folder, you can create the script by typing:

    Code:
    nano notify.sh
    This will allow you to enter as many commands as you wish... they will be executed in the order you enter them. Just remember to change your walletnotify command to run the notify.sh script in your conf file

    Code:
    walletnotify=./notify.sh
    Step 3: Wait for a payment / mined block / MN payment...

    ...Or you could just become impatient like I did and send yourself some DRK. It all happens so fast that I get the text on my phone before the wallet even shows an incoming payment. By the way, you also could test your setup by replacing "walletnotify" with "blocknotify" temporarily (which will notify you of ANY block and allow you to test) just until you are sure that your commands are working and then switch back to "walletnotify" when done testing. You could also just run your script or batch file manually. WARNING: if your wallet has been closed for a long time, if you set "blocknotify", then when you reopen the qt you will get many many many notifications as the wallet downloads all new blocks in the blockchain. Also, keep in mind that if you have autodenominate on, you will also get many notifications when new balances are deposited into your account as the wallet anonymizes the balance. Each change will generate a text. So I'm only using this on my MN wallets.

    A few things to note about this approach:
    1) You can receive up to two notifications for each transaction - once when it hits the network and again when it confirms
    2) It does the same thing when you send DRK from your wallet, which could be a good way of getting notified if someone is messing with your DRK balance, but it is a pain to get a text every time you SEND too.
    3) You can add the transaction ID to any command by adding "%s" to your walletnotify command line... it will get substituted with the Tx ID
    4) You can issue more commands just by adding them to your script or batch files.


    What else could you do?
    Walletnotify could be used to trigger any command line task
    - Play an mp3 of Pink Floyd's "Money"
    - Post an update to a DB
    - Trigger darkcoind commands such as forwarding a payment to another address

    cURL could do all kinds of things in a script
    - Send emails, text messages
    - Update your Facebook status (there's a cURL script you can google that does this)
    - Send a tweet
    - notify multiple partial owners of a MN that the MN received a payment


    I think it would be cool to document a few creative / cool ideas... especially anything you could only do with DRK. Like perhaps unlocking the wallet automatically for anonymization whenever a payment is received, so you don't need to be at your computer to anonymize your deposits? Anyway, post any ideas or implementations that you've gotten working. I'd love to do more than simply the text message and sound notifications.
     
    #1 Ryan Taylor, Aug 16, 2014
    Last edited by a moderator: Aug 17, 2014
    • Like Like x 5
    • Informative Informative x 1
  2. Rux

    Rux Member

    Joined:
    Mar 9, 2014
    Messages:
    68
    Likes Received:
    32
    Trophy Points:
    58
    Man this is perfect :)

    are you still developing things like this?
     
    • Like Like x 1
  3. Dunedoo

    Dunedoo Well-known Member
    Foundation Member

    Joined:
    Feb 25, 2015
    Messages:
    568
    Likes Received:
    600
    Trophy Points:
    263
    Dash Address:
    XyoSz4xviVGfks1pLhaXw2Baqmhfw5k7MG
    Please, please please build this into future wallets. What a fantastic feature!
     
    • Like Like x 1
  4. thefrog

    thefrog Member

    Joined:
    May 25, 2014
    Messages:
    57
    Likes Received:
    26
    Trophy Points:
    58
    I am using pushover services for this
    It has one time fee you pay, and then notifications are send to the client.
    Worth every penny.
    https://pushover.net/

    curl -s \
    --form-string "token=abc123" \
    --form-string "user=user123" \
    --form-string "message=hello world" \
    https://api.pushover.net/1/messages.json
     
    • Like Like x 1