Email/SMS notification of wallet activity?


#1

I was wanting to know when I received a payment from a pool.
Is there already a way to do that?

I’m working on some Powershell code in the meanwhile, anyone interested in it?

Thanks,
Paul


#2

I think some people would find that useful. I do remember BN releasing something like this. Here is the github for it.

I have my miner wallet open next to me most of the time, but something that could send emails/sms for people that usually have their phones on them…or a program that just pushed the data to an android app (or just an android app that monitors and notifies (cg android wallet has a feature that just “watches”… just tossing out things here…

Good luck!


#3

Yeah I got it working. Only 75 lines of code. It talks to the local wallet to get the last few transactions and then notify if there is a new one. The hardest part for someone else to use it, would be setting up an SMTP server to send emails. Gmail was tricky, but doable once I figured it out.
Bonus, it includes the USD value for the coins in the transaction. :slight_smile:

Right now I am watching my wallet and 3 other friends, and sending a text message with any new transactions.

I looked at your link and it looks really cool, not sure why it couldn’t be added to the Qbundle as an feature.

Paul


#4

I would be more than interested in the code you came up with. would be easy for me to throw up an smtp server or re-write stuff to work with gmail, etc.


#5

Here it is working but not supported. Do with it as you wish.

$emailusername = "xxxxxxxxxx@gmail.com" 
$emailpass = "xxxxxxxxxxxxxxx" 
$emailhost = "smtp.gmail.com"
$emailport = "587"

function sendMsg($email,$message){
    $smtp = new-object Net.Mail.SmtpClient($emailhost, $emailport) 
    $smtp.EnableSsl = $true 
    $smtp.Credentials = New-Object System.Net.NetworkCredential($emailusername, $emailpass); 
    $smtp.Send($emailusername,$email,"Burst",$message)
}

function getBurst{
    $url = "https://api.coinmarketcap.com/v1/ticker/burst/"
    $output = "burst.out"
    (New-Object System.Net.WebClient).DownloadFile($url, $output)
    $burst = Get-Content $output | Out-string | ConvertFrom-Json 
    return $burst
}

function downloadRecentTransactions($walletid){
    $url = "http://localhost:8125/burst?requestType=getAccountTransactions&account="+$walletid+"&lastIndex=3"
    $output = "E:\scripts\burst\"+$wallet.walletid+".out"
    (New-Object System.Net.WebClient).DownloadFile($url, $output)
    $recenttransactions = Get-Content $output | Out-string | ConvertFrom-Json 
    return $recenttransactions
}

function main{
  $wallets = Import-Csv "E:\scripts\burst\wallets.csv"

  foreach ($wallet in $wallets){
    "`t{0}" -f $wallet.walletid
    $newlastblock = $wallet.lastblock
    $recenttransactions = downloadRecentTransactions($wallet.walletid)
    $message = ""
    foreach ($transaction in @($recenttransactions.transactions)){
      "`t`tProcessing {0}" -f $transaction.ecBlockHeight
      if ($transaction.ecBlockHeight -gt $wallet.lastblock){
        if ($transaction.type -eq 0){
            if ($transaction.subtype -eq 0){
                $amount = $transaction.amountNQT/100000000
                $burst = getBurst
                $value = $amount*$burst.price_usd
                if ($transaction.recipientRS -eq $wallet.walletid) {
                    $message = "You received {0:n0} coins worth {1:c}" -f $amount,$value
                } else {
                    $message = "You paid {0:n0} coins worth {1:c}" -f $amount,$value
                }
            } elseif ($transaction.subtype -eq 5){
                $message = "Wallet Name Change"
            } else {
                $message = "Unknown Type 0"
            }
        } elseif ($transaction.type -eq 20){
            $message = "Recipient Address Change"
        } else {
            $message = "Unknown Type"
        }
        $message = "{0} {1}" -f $wallet.name, $message
        sendMsg $wallet.smsaddress $message
        "`t`t`t{0} sent" -f $message
        if ([int]$wallet.lastblock -lt [int]$transaction.ecBlockHeight){
            $wallet.lastblock = $transaction.ecBlockHeight
        }
      }
    }
  }
  $wallets | Export-Csv "E:\scripts\burst\wallets.csv" -NoTypeInformation
}

while (1){
  "Running $(Get-Date)"
  main
  sleep 360
}

I also have a little csv file that looks like this:

"name","walletid","lastblock","smsaddress"
"MasterMC","BURST-HU8Y-Y23E-287Z-7D4F3","465085","phone_number@txt.att.net"
"friend1","BURST-xxxx-xxxx-UUC3-EFXEA","464991","phone_number@txt.att.net"
"friend2","BURST-xxxx-xxxx-KBL3-3KUGN","462438","phone_number@txt.att.net"
"friend3","BURST-xxxx-xxxx-ZANN-5CMEZ","465023","phone_number@txt.att.net"

Good luck with it.
Paul