Pages:
Author

Topic: [Announce] bitcoinmonitor.net - Free professional notification/payment service - page 6. (Read 19527 times)

legendary
Activity: 980
Merit: 1020
I think I got an outline of a working system going for my bitcoin widget idea. Tomorrow is testing time and working out the bug. I hope the creator here will answer my question soon!

Or maybe other users can?
legendary
Activity: 980
Merit: 1020
What happened when you input an address that is not valid? Is it possible for me to use the API to validate the bitcoin address somehow? Or is that not possible?
sr. member
Activity: 252
Merit: 250
Inactive
legendary
Activity: 980
Merit: 1020
After having no idea how to do this thing ever, I finally figured out how to get a watcher created. Cheesy
legendary
Activity: 980
Merit: 1020
Hello, I have replicated the python example with ruby code.


Code:
require "json"
require "digest/md5"

data = '{"signed_data": {"userdata": "", "amount": 122678000, "confirmations": 2, "amount_btc": "1.22678000", "address": "12r9JzPNnyWs2j1s9KLW5keqBr4kbJjxz6", "created": "2012-04-06 08:56:00.094725", "txhash": "e0c84120068bfefddab051e751f3df963c4ed29e7b13eadac026e6f17f55fb06", "agent": "callback_test"}, "signature": "17403f7757433850382cc6bd94e09827"}'

data = JSON.parse(data)

tx_hash = data["signed_data"]["txhash"]
address = data["signed_data"]["address"]
created = data["signed_data"]["created"]
confirmations = data["signed_data"]["confirmations"]
userdata = data["signed_data"]["userdata"]
amount = data["signed_data"]["amount"]
agent = data["signed_data"]["agent"]
amount_btc = data["signed_data"]["amount_btc"]
signature = data["signature"]

sigstring = address + agent + amount.to_s + amount_btc.to_s + confirmations.to_s + created + userdata + tx_hash + "437050d0d90c72d3d357b84c098bd61ee1751ec9"

my_signature = Digest::MD5.hexdigest(sigstring)

if my_signature == signature
  puts "BEEP"
end

Now, I  am trying to learn how to use your API so that I can do something interesting with it.
hero member
Activity: 488
Merit: 500
But what is a problem to increse retry time to for example 1 hour and try to deliver it for next 24 hours ? It would reduce a chance of lost money if site is offline.
Well, I think you are right Smiley In the end it is probably better to deliver late notification instead of not at all. I will change the retry policy to retry up to one day, with an increasing time between tries.
Probably it also makes sense to have the maximum retry time a user-defined setting...

Also you should make queue for sending so if you can not deliver 0 conf notification you should not try to deliver 6conf one.
Indeed this would be better. But this will require some refactoring on my side. Might take some more time...
hero member
Activity: 488
Merit: 500
API works wonders - thanks so much! (Just don't change it now without incrementing the API version!)
That's good to hear! And of course the API v1 is now stable and will not change anymore. So you are safe to rely on it  Smiley

Do you think there is anything lacking in the API? (Besides of the need of improved documentation I think...)
donator
Activity: 308
Merit: 250
API works wonders - thanks so much! (Just don't change it now without incrementing the API version!)
hero member
Activity: 488
Merit: 500
API is now officially available!

There were only minor changes from the stuff i posted above:
  • Authentication is now done via an API-key which you can obtain in your dashboard
  • Resource URIs are now consistently in singular (e.g. ".../agent/..." instead of .../agents/...")

See the full documentation at http://www.bitcoinmonitor.net/apidoc/!
hex
newbie
Activity: 45
Merit: 0
But what is a problem to increse retry time to for example 1 hour and try to deliver it for next 24 hours ? It would reduce a chance of lost money if site is offline.

Also you should make queue for sending so if you can not deliver 0 conf notification you should not try to deliver 6conf one.
hero member
Activity: 488
Merit: 500
Any chance for incrising POST retry times ?
Something like at least 24h would be great!
Technically this would be possible. But overall i don't like the idea of storing notifications for such a long time. This whole notification concept is mostly about being quick. IMO it just does not make sense to deliver a notification days after it has happend.

Let's assume the common usecase of notifiying at 0 confirmations (for informing customer) and e.g. 6 confirmations for actually starting delivery of goods.
If the shop system would be offline for several hours there would be two notifications in the queue, each retrying every few minutes. If the shop comes online again it could happen that the notification for 6 confirmations comes in before the confirmation for 0 confirmations. This might not be handled well in the shop system.
On my side each notification is a completely independent event, so i can not define dependencies between different notifications (and i want to keep it that way for maximum modularity/scalability).

If you know your shop was offline for some time you can already now look up all failed notifications in the notification history (reminds me of the missing search/filter options there...).

An additional option would be adding a button to the dashboard to manually retry failed notifications. Maybe this would be a possible compromise?
hex
newbie
Activity: 45
Merit: 0
Any chance for incrising POST retry times ?
Something like at least 24h would be great!
donator
Activity: 308
Merit: 250
  • a specified time without transaction ("time-based expiration")
This is great for merchants who set deliberate time limits on orders because of fluctuations in exchange rate. You have 5 minutes to send the coins to the address, for example, or the order is canceled.

  • a specified amount is received/exceeded ("amount-based expiration")
This is similar to the above in that the merchant is waiting for a set amount of coins before they mark the order as paid for in their system.

What I would really use is a combination, hybrid, if you will, of the above, where I set an amount and expiration time; if the address does not have in pending (unconfirmed) transactions within
hero member
Activity: 488
Merit: 500
Bonus points if you can make it so that addresses not in use for N days are automatically removed.

I am thinking about different possibilities here.

Remove watched address after
  • a specified time without transaction ("time-based expiration")
  • a specified amount is received/exceeded ("amount-based expiration")
  • any transaction is received ("one-shot")

I think the first two variants make sense for different scenarios, while for the one-shot variant I can not think of a good usecase. Opinions?
hero member
Activity: 488
Merit: 500
Finished writing a zillion of unittests for the API and indeed found half a zillion bugs with them Cheesy
=> Production site updated.

The API itself has not changed, so everything should work like before. Still I dont want to make the API "official" until a better authentication mechanism (probably oAuth) is in place.
hero member
Activity: 488
Merit: 500
donator
Activity: 308
Merit: 250
Add a bitcoinaddress to an agent:
You need to provide 1 parameters:
  • address: address to watch
Code:
curl -i -u : -X POST -d "address=
" http://www.bitcoinmonitor.net/api/v1/agent/address/
You missed the ID parameter, this should be:
Add a bitcoinaddress to an agent:
You need to provide 1 parameters:
  • address: address to watch
Code:
curl -i -u : -X POST -d "address=
" http://www.bitcoinmonitor.net/api/v1/agent//address/

(Also sent another bitcoin. I'm good to go now!)
hero member
Activity: 488
Merit: 500
Thanks mcorlett Smiley

3 new methods are now available for adding/listing/removing addresses of an agent. I edited my previous post to include the new methods (at bottom) :-)

Edit: Be prepared that the API will still change. You should not yet include it in production systems!
donator
Activity: 308
Merit: 250
Sent the promised 0.5 BTC.

I will soon add two more convinience methods for directly adding/removing a bitcoin address from an agent. Right now this is not possible. When you change an existing agent you have to provide all addresses that it should watch as the provided addresses will replace the addresses currently configured.
This is what I'm really looking for before I launch this service I'm working on. You've got another bitcoin in your wallet once you implement this!
hero member
Activity: 488
Merit: 500
Although I am not yet fully happy with it the API is now online  Wink. I will certainly add some more stuff (oAuth authentication, better response/error messages, ...) but the general idea will stay like it is now.

The API follows the REST scheme, which means you can create, read, update and delete your agents and notification settings with standard http POST/GET/PUT/DELETE operations.

Currently only basic authentication is in place, so you have to provide user and password with each request, which of course is quite inconvinient... Next thing to add is oAuth token-based authentication.

Note: Be sure to always include the trailing slash in any url!

Get information about all your agents:
Browser: http://www.bitcoinmonitor.net/api/v1/agents/
Commandline using curl:
Code:
curl -i -u : http://www.bitcoinmonitor.net/api/v1/agents/

Create a new agent:
You need to provide only 2 parameters:
  • name: The agents name
  • watch_type: "1" for notification on withdrawal, "2" for notificatoin on deposits, "3" for both notifications
  • addresses: (optional) list of addresses to watch, seperated by comma
Code:
curl -i -u : -X POST -d "name=new_agent&watch_type=2" http://www.bitcoinmonitor.net/api/v1/agents/

Change an existing agent:
You need to know the ID of the agent (get it from the agent list). You can set:
  • name: The agents name
  • watch_type: "1" for notification on withdrawal, "2" for notificatoin on deposits, "3" for both notifications
  • addresses: list of addresses to watch, seperated by comma
Code:
curl -i -u : -X PUT -d "addresses=" http://www.bitcoinmonitor.net/api/v1/agent//

Delete an existing agent:
You need to know the ID of the agent (get it from the agent list).
Code:
curl -i -u : -X DELETE http://www.bitcoinmonitor.net/api/v1/agent//

Get notification settings for an agent:
You need to know the ID of the agent you want to work with (get it from the agent list). You need to provide the notification type you want to access:
  • email
  • url
  • feed
Code:
curl -i -u : http://www.bitcoinmonitor.net/api/v1/agent//notification//

Create new notification setting:
You need to know the ID of the agent you want to work with (get it from the agent list). Required parameters:
  • req_confirmations: Confirmations required, 0 to 10
  • email: email (required for type "email")
Code:
curl -i -u : -X POST -d "req_confirmations=0" http://www.bitcoinmonitor.net/api/v1/agent//notification/feed/
Code:
curl -i -u : -X POST -d "[email protected]" http://www.bitcoinmonitor.net/api/v1/agent//notification/email/
Code:
curl -i -u : -X POST -d "req_confirmations=0&url=http://my.shop.com/payment_confirmation/" http://www.bitcoinmonitor.net/api/v1/agent//notification/url/

List bitcoinaddresses watched by agent:
You need to know the ID of the agent you want to work with (get it from the agent list)
Code:
curl -i -u : http://www.bitcoinmonitor.net/api/v1/agents//address/

Add a bitcoinaddress to an agent:
You need to provide 1 parameters:
  • address: address to watch
Code:
curl -i -u : -X POST -d "address=
" http://www.bitcoinmonitor.net/api/v1/agent//address/

Remove a bitcoinaddress from an agent:
No parameters as address is the ressource and part of url:
Code:
curl -i -u : -X DELETE http://www.bitcoinmonitor.net/api/v1/agent//address/


The agent_ID is guaranteed to never change once an agent is created. So if you have an agent set up it is safe to hardcode its ID in your code.

As all this is still not matured I will not add API documentation to the site itself. As soon as i got some user feedback and added the missing stuff I will also extend the documentation.
Pages:
Jump to: