Bitcoin Forum
April 24, 2024, 04:29:39 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Accepting Bitcoin using ASP.NET ?  (Read 2938 times)
OmegaStarScream (OP)
Staff
Legendary
*
Offline Offline

Activity: 3458
Merit: 6099



View Profile
December 20, 2015, 02:27:26 PM
 #1

I'm running a website on ASP.NET C# and it's connected to a MSSQL Database . What I want to do is when people send BTC to an address (I don't really care if the care is the same or keep generating new one each time) , so once they send BTC .. I want to execute a MSSQL Query into my database to give them some sort of points etc ... ? Who think he can help on this task pls

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
The Bitcoin network protocol was designed to be extremely flexible. It can be used to create timed transactions, escrow transactions, multi-signature transactions, etc. The current features of the client only hint at what will be possible in the future.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713932979
Hero Member
*
Offline Offline

Posts: 1713932979

View Profile Personal Message (Offline)

Ignore
1713932979
Reply with quote  #2

1713932979
Report to moderator
1713932979
Hero Member
*
Offline Offline

Posts: 1713932979

View Profile Personal Message (Offline)

Ignore
1713932979
Reply with quote  #2

1713932979
Report to moderator
1713932979
Hero Member
*
Offline Offline

Posts: 1713932979

View Profile Personal Message (Offline)

Ignore
1713932979
Reply with quote  #2

1713932979
Report to moderator
tyz
Legendary
*
Offline Offline

Activity: 3360
Merit: 1530



View Profile
December 20, 2015, 09:48:25 PM
 #2

Do you want to use the Bitcoin core or an api like the one from Coinbase.com?
When the last is the case then it is not a big deal to implement what you require. The api is documented very well.
doof
Hero Member
*****
Offline Offline

Activity: 765
Merit: 503


View Profile WWW
December 20, 2015, 11:01:35 PM
 #3

I'm running a website on ASP.NET C# and it's connected to a MSSQL Database . What I want to do is when people send BTC to an address (I don't really care if the care is the same or keep generating new one each time) , so once they send BTC .. I want to execute a MSSQL Query into my database to give them some sort of points etc ... ? Who think he can help on this task pls

3 ways, in order of ease:

You will have to write a service, worker processor etc to poll the address looking for new transactions.

1.  Use Blockchain.info.  They have a nugget package and good enough for small transactions, but you're trusting them to report correct:
Code:
        public ActionResult Wallet()
        {
            ViewBag.Address = System.Configuration.ConfigurationManager.AppSettings["WalletAddress"];

            Info.Blockchain.API.BlockExplorer.BlockExplorer ex = new Info.Blockchain.API.BlockExplorer.BlockExplorer();
            var address = ex.GetAddress(System.Configuration.ConfigurationManager.AppSettings["WalletAddress"]);

            Decimal amount = Convert.ToDecimal(address.FinalBalance / 100000000.0M);
            String balance = String.Format("{0:0.######}", amount);
            ViewBag.Balance = balance;

            return View();
        }

2.  Same approach, but poll your own bitcoind instance.  There are a few .net wrappers for bitcoind. 
  • Have a server running bitcoind in server mode
  • Set the credentials and configs and firewalls up
  • Use JSON RPC calls (web client will do) to query an address that bitcoind hosts

3.  Roll your own blockchain passer and keep updating it.  There are a few .net ones out there, but too much over kill for a few tx a day.

Hope this helps.
OmegaStarScream (OP)
Staff
Legendary
*
Offline Offline

Activity: 3458
Merit: 6099



View Profile
December 21, 2015, 05:18:11 AM
 #4

Do you want to use the Bitcoin core or an api like the one from Coinbase.com?
When the last is the case then it is not a big deal to implement what you require. The api is documented very well.

I'm not even sure what's the difference between running Bitcoin Core itself and running Coinbase.com API or BlockTrail/Blockchain etc ... ?


I'm running a website on ASP.NET C# and it's connected to a MSSQL Database . What I want to do is when people send BTC to an address (I don't really care if the care is the same or keep generating new one each time) , so once they send BTC .. I want to execute a MSSQL Query into my database to give them some sort of points etc ... ? Who think he can help on this task pls

3 ways, in order of ease:

You will have to write a service, worker processor etc to poll the address looking for new transactions.

1.  Use Blockchain.info.  They have a nugget package and good enough for small transactions, but you're trusting them to report correct:
Code:

        public ActionResult Wallet()
        {
            ViewBag.Address = System.Configuration.ConfigurationManager.AppSettings["WalletAddress"];

            Info.Blockchain.API.BlockExplorer.BlockExplorer ex = new Info.Blockchain.API.BlockExplorer.BlockExplorer();
            var address = ex.GetAddress(System.Configuration.ConfigurationManager.AppSettings["WalletAddress"]);

            Decimal amount = Convert.ToDecimal(address.FinalBalance / 100000000.0M);
            String balance = String.Format("{0:0.######}", amount);
            ViewBag.Balance = balance;

            return View();
        }

2.  Same approach, but poll your own bitcoind instance.  There are a few .net wrappers for bitcoind. 
  • Have a server running bitcoind in server mode
  • Set the credentials and configs and firewalls up
  • Use JSON RPC calls (web client will do) to query an address that bitcoind hosts

3.  Roll your own blockchain passer and keep updating it.  There are a few .net ones out there, but too much over kill for a few tx a day.

Hope this helps.

Very curious what do you mean by "trust them to report correct" ? can they report that I received X on the transaction while I received Y ?

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
doof
Hero Member
*****
Offline Offline

Activity: 765
Merit: 503


View Profile WWW
December 21, 2015, 06:58:44 AM
 #5

Quote
I'm not even sure what's the difference between running Bitcoin Core itself and running Coinbase.com API or BlockTrail/Blockchain etc ... ?

The difference is they do it vs you do it.  They could have a website / API that returns anything.  Its not in their best interest to do so, but they could get hacked, a software bug etc.

If you stand up you're own infrastructure and report on your own daemon, then you only have to trust yourself, and the build of bitcoin core.

Quote
Very curious what do you mean by "trust them to report correct" ? can they report that I received X on the transaction while I received Y ?

They could do what ever they like.  How are you to know that query on address a will give a correct result?  If you believe they're reputable and their systems are working correctly, then fine.

Maybe think about it like this.  You need to report on the weather in your favourite city.  You could call an API like weather.com for the information.  Or you could setup your own monitoring system and report on that.
OmegaStarScream (OP)
Staff
Legendary
*
Offline Offline

Activity: 3458
Merit: 6099



View Profile
December 21, 2015, 12:34:24 PM
 #6

Quote
I'm not even sure what's the difference between running Bitcoin Core itself and running Coinbase.com API or BlockTrail/Blockchain etc ... ?

The difference is they do it vs you do it.  They could have a website / API that returns anything.  Its not in their best interest to do so, but they could get hacked, a software bug etc.

If you stand up you're own infrastructure and report on your own daemon, then you only have to trust yourself, and the build of bitcoin core.

Quote
Very curious what do you mean by "trust them to report correct" ? can they report that I received X on the transaction while I received Y ?

They could do what ever they like.  How are you to know that query on address a will give a correct result?  If you believe they're reputable and their systems are working correctly, then fine.

Maybe think about it like this.  You need to report on the weather in your favourite city.  You could call an API like weather.com for the information.  Or you could setup your own monitoring system and report on that.

Make sense , and on the same time It's scary little bit and will make me think more then once before using an API of any website . Well .. thanks for your explanation mate , I hope I will successfully setup everything up .

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
ftdgoodluck
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
December 21, 2015, 02:21:55 PM
 #7

You can scan the blockchain manually, using NBitcoin library (https://github.com/MetacoSA/NBitcoin). You'll need a bitcoind running on your server.
Or you can simply trust some of the "big players", that are providing statistics information (as mentioned above).

Ease or reliability - that is the question, that you should ask as a developer.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!