...
Can it be done?
Definitely
What API do I have to use in this case to fund Addresses.. thats where I got stuck, I'm doing this in Pascal, kindly help.
Looking around at Blockchain.info's API, most of the functions look easy to do without a whole lot of reading. As far as funding, are you talking about making an initial deposit using native money? That is probably best handled by an exchange service. To fund your wallet with BTC, I don't see a direct method, but
probably you would use the "Making Outgoing Payments" method, but sending from the other account to the new account instead. In other words, make a payment from another wallet to your blockchain.info wallet.
If you haven't started already, you'll need to get familiar with making POST and GET requests to the Bitcoin.info site with FreePascal/Lazarus. I've heard you can use http client functions from Synapse or Indy, but I've had good success using
FPHttpClient from the standard FCL-Web package. See the examples in your FPC installation:
[your fpc source directory]/packages/fcl-web/examples/httpclient/httpclient.pas.
A few practical caveats:
1- Looks like all the examples at the blockchain.info site use the OpenSSL protocol (https://)
Read about using HTTPS at the FreePascal Wiki, or try Synapse or Indy, which both have methods for using SSL.
2- Looks like they want the POST to be URL-encoded as well. See the example of a URL encoding function here:
https://github.com/nandod/kitto/blob/master/Source/ThirdParty/ExtPascal/ExtPascalUtils.pasand here:
http://castlesand.googlecode.com/svn/trunk/Common/URLUtils.pasSearch for "function URLEncode".
The Delphi 'CharInSet' function call can either be emulated (as in the castlesand example), or just change
if CharInSet(Decoded[I], Allowed) then
to
if Decoded[i] in Allowed then
to work with FPC.
I'm not too familiar with Bitcoin, but I have wrangled with web requests using FPHttpClient, so hopefully this helps.