How to check Bitcoin address balance from my application? - bitcoin

How do I check a balance of a Bitcoin address (any, not necessarily mine), let's say in a Java application (or any other language)?
I need a functionality like the one on blockchain.info or biteasy.com but I don't want to use their API. Bitcoin is open source, so I thought maybe it won't be so difficult to get the data myself?

For now there is no simple way to get balance of a address that not in the wallet with bitcoin core. Maybe this function is under developing.
To get a address's balance, you need to compute the utxos on the address from the whole block chain. (I guess fornow there maybe no record of balance on each address, so you've to calculate it form the whole block chain)
You said in your question, you didn't want to use third site's API
(For example https://api.blockcypher.com/v1/btc/main/addrs/38DGj87axzmQiZeAd1w1y5FEmuu5a7pfBa).
You can run a bitcoin browser in you device, for example bitcoin explorer

Use blockexplorer.com model and piggy back off their server or run your own using open source version at github.com/lirazsiri/blockexplorer

It is not necessary to use web wallets to create addresses. You can install your own bitcoin server/daemon and act like your own bank.
This is the place to start if you want to know how to do it (https://en.bitcoin.it/wiki/Main_Page).
Bitcoin can be queried using JSON RPC methods. So if you are running a bitcoin daemon locally you can just query them. The documentation for the same is located at
Running Bitcoin - https://en.bitcoin.it/wiki/Running_Bitcoin
API Reference - https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)
API Call List - https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list
Hope this helps.

You can use JSON-RPC method. bitcoind widely supports JSON-RPC calls. So just go to the official website of bitcoin and find all of the methods.
Here is an example in PHP. Just include the jsonClient.php file
<\?php
require_once jsonRPCClient.php'; <br />
$bitcoin = 'https://' . $rpcusername . ':' . $rpcpassword .
'#' . $rpcip . ':' . $rpcport . '/'; <br />
print_r($bitcoin->getnewaddress());
?>

Related

How to store custom user data on Netlify Identity?

I've been using Netlify for storing 100% of my app (both frontend and backend) for the last three months. So far, so good.
The only problem now is that I need to store a custom property for each user (say, the phone number), and apparently Netlify Identity doesn't support this (only email, name and roles https://www.netlify.com/docs/identity/).
I don't want to change the whole app to migrate to another hosting provider just for this detail (actually, I can't, it's for a client and I just don't have time), because it works great, but at the same time I need it.
Can you think of any workaround to this? The less "hackish", the better, but I understand that I'm going beyond the intended use of Netlify Identity.
So it actually does look like Netlify's GoTrue API has a specific endpoint for updating custom user data. After a user is created, you can update metadata by including it as "data" within an authenticated PUT request to /user.
PUT /user
{
"data" {
"custom_key": "value",
}
}
See https://github.com/netlify/gotrue for more info.
There are dozens of ways to do this, so I'll talk about two generally applicable ways now:
the most "generally capable" one is probably using lambda functions: https://www.netlify.com/docs/functions . This lets you run dynamic code, such as "store to database hosted elsewhere" or "email to our office manager to update a spreadsheet" or even "commit to our closed git repo so it's available in-code" (last one is probably a worst practice, but is possible). You can similarly use a function to read that data back out without exposing API tokens (code example: https://github.com/netlify/code-examples/tree/master/function_examples/token-hider)
you could have the data gathered via a form submission (https://www.netlify.com/docs/form-handling). I'd probably use zapier.com to receive a notification of the form submission (https://www.netlify.com/docs/form-handling/#notifications). Zapier can of course connect to just about anything on the planet :) . Getting the data back out if you want to show it in your UI is a bit more of a challenge, but you could use the above mentioned functions if you need to connect to some private data store to pull it out. Or for an MVP, just not show it, only let people enter/update it ;)

access idx-analytics-data-api through a browser

I am trying to access the Open edX data Analytics API v0 alpha as I would like to download the problem grades data.
In the documentation on setting up the API it mentioned Test the Data Analytics API by "In a browser, go to: http://<server-name>:<port>/docs/#!/api/
Enter a valid key and click Explore."
May I know what is the server-name and port number here refers to?
Also what is the Docs/#! refers to here.
I tried to look for API url online, but could not find it either.
Also I am assuming I need to get authorization through Oauth2 as well.
As this is the first time I am trying to access API to download data, i would really appreciate your help with the questions above
in this
http://<server-name>:<port>/docs/#!/api/
<server-name>
refers to the ip address of the server where you are running the edx-analytics
<port>
refers to port
sample url could be http://192.168.10.110:8085/docs/#!/api/

Are there any API services that allow me to send a Bitcoin transaction with OP_RETURN?

I want to be able to send the minimum amount of Bitcoin required in order to write a 40 byte (roughly 80 character) message via ideally a REST API allowing me to specify a bitcoin wallet private key, the recipient bitcoin address, the fee and the message to attach to the OP_RETURN.
Thank you!
--
I wish Bitcoin allowed you to send coins without having to have an API or daemon - through http somehow would be cool. How would I create a raw transaction with a OP_RETURN in it to push to an API /tx/push using php and curl?
There are more options as the OP_RETURN protocol is so simple but here are the ones I recommend:
1. Blockcypher
Blockcypher API has a Data endpoint to write op return transaction but you need to register an API token with them so it's not completely under your control (they can ban your token), it supports only 40 bytes not 80 (well 75 in reality) but it's free, which is awesome!
Check it out (mainchain):
https://www.blockcypher.com/dev/bitcoin/#data-endpoint
Example from their doc (curl):
# Embedding String Data
curl -d '{"data":"I am the walrus", "encoding":"string"}' https://api.blockcypher.com/v1/btc/main/txs/data?token=YOURTOKEN
{
"data": "I am the walrus",
"encoding": "string",
"token": "YOURTOKEN",
"hash": "cb6974e0fd57c91b70403e85ef48c840eecdca4804dfc4897b1321d5328e4f18"
}
2. BlockchainPen
If you're searching for an APP (maybe to test quickly) or to get some open source code and modify it to your needs there's BlockchainPen:
http://blockchainpen.com
This is not an API service but more a webapp. It has a client-side browser wallet where you can load some funds (1mbtc?) and write op-return messages.
Click on the address to get a QR for loading funds quickly from a mobile wallet - The UI is very basic, you need to refresh the page to see the updated balance - The funds are yours, you can export your private key at any time (check the link at the bottom of the page).
The code is open source so you could import and use the Pen class (coffeescript or js version) in your programs to write transaction via nodejs: https://github.com/makevoid/blockchain-pen/blob/master/pen.coffee
Or with something like phantomJS, selenium/webdriver or some other browser automation tool you could use the deployed version but I think it will not be clean.
There are two currently open source implementation of blockchain-pen:
1: https://github.com/makevoid/blockchain-pen (latest)
2: https://github.com/makevoid/blockchain_pen (old repo - js / ruby opal)
You can also change the fee depending on your needs, the default one is 0.1mbtc, on http://prio.blockchainpen.com (priority) is 0.3mbtc.
(p.s. disclamer: I'm the developer behind this, feel free to fork/improve the project, a new and simpler version will be released in 2017)
You can use http://www.stamping.io you can anchored a transaction in Bitcoin & Ethereum in the same time. Try it!

goshippo create order via api

I'm trying to figure out a way to create orders via API (the ones that show up under https://app.goshippo.com/orders/), but seems like api docs dont really explain how to do so, and the only thing thats available is to create shipping labels. The libraries dont have any functions that will point me to this direction either. Is it even possible to make a call to the api for orders ?
Also, if this is not possible, how can I make goShippo send me a request for lets say a CSV, to sync all orders ?
PS: this is a custom build
Thanks
Feel free to use our order endpoint /v1/orders, but it is currently in beta version. The behavior of this endpoint may change (fields, error messages). We will update the following gist according to any modification that we make.
You can find more details about the endpoint at https://goshippo.com/docs/orders
The following Gist shows you how to POST on the Order endpoint.
https://gist.github.com/mnowik/59d2d550107b77cb31bf79b6b75d6e27
Fields with * are not active yet.

EdX API to get a Course List

It seems to be possible for anyone to get a list from all edx courses. unfortunately the available documents are looking incomplete.
Is there any way to obtain a course list?
Are you talking about the list of courses running on edx.org? For that, you would need an OAuth key to access that API endpoint, and I don't believe that edx.org currently gives out OAuth keys. That API endpoint is currently intended for internal use only.
If you want to run your own Open edX installation, then you'll be able to access this API endpoint from your own instance, and it will return information about the courses you have running on your own installation.
But you do have an other option, you can use RSS feed from www.edx.org
https://www.edx.org/api/v2/report/course-feed/rss
i found this here
i hope this helps !
The docs do not give the root URI to run your api queries against. Anyone can host an instance of the edX platform, hence the root URI can change. Here is a fully qualified URL for the edX course API:
https://courses.edx.org/api/courses/v1/courses/
Visiting this URL will show the results that an anonymous user would see.
After some soulfull searching i found one of the most pretty API docs i have ever seen. all that you need to know about pulling course content.
https://media.readthedocs.org/pdf/course-catalog-api-guide/latest/course-catalog-api-guide.pdf
Looks like they have one now!
I too was looking for an EdX api that would hopefully include access to a current courses catalogue and also include all course descriptions.
Not sure when it was released but this looks like a good direction for me - http://edx.readthedocs.io/projects/edx-platform-api/en/latest/courses/overview.html
Hope this is helpful.