This post is just a collection of a couple of links around using Google Authentication and .NET Core Identity.
- Free Code Camp: Step by Step adding Google Auth to .NET Core project.
- By default the SQL Database to support this will be located on your C:\Users\[username] folder. Change the connection string in appsettings.json to create the database in SQL Server.
- Microsoft Documentation: Good overview / walk through about using Google Auth but not enough to get the site to work (need the link above).
- Google Developer Console: This where you need to get your Auth Key.
I have used the Data Repo pattern in .NET Core but wanted to generate the models similar to .NET.
- This stackover flow post is a good reference.
- How to scaffold models
- Scaffold-DbContext "Server=yourserver;Database=yourdatabase;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
- With table params
- Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=DatabaseName;Trusted_Connection=True;"
-OutputDir Models -Context NorthwndContext
-Tables Products,Categories,Suppliers -Force
If you have staked any crypto currencies you know that you have to (with many projects) run what is called “Coin Control” to place all your coins back in one input to get rewards faster. I decided to build out a .NET Core Control Control application that includes a class library that will communicate with any wallet that uses Bitcoin type RPC commands. I am currently using this on a staking wallet for the crypto LINDA Project ($LINDA).
Coin Control Process
The coin control process can be time consuming since you do not know when you will get a reward and you have to continue to check your wallet. Doing this automatically would help get rewards more consistently and without any lags.
Screen shot of the Coin Control App (CC) (Microsoft Windows Example). In this case the CC app will run every 30 minutes checking for a reward. Once a reward is found the CC process runs to send all the coins to the main staking address in the wallet and unlocks the wallet for staking again.
- Wallet Passphrase is encrypted by a feature in the app and cannot be decrypted.
- Email password is encrypted by a feature in the app and cannot be decrypted.
- The app will not send coins to any address if it does not exist in the staking wallet.
Configuration is very flexible you setup your RPC Information, your staking address, and (using a feature of the app) encrypt your wallet passphrase to make it secure.
There are security features in the app that only allows the Coin Control sending of transactions to an address that exists in the wallet. If you change the “WalletStakingAddress” to an address that does not exist. The app will show an error and the process is halted.
Logging and Email
The application logs all processes and errors and sends emails once a Coin Control cycle is complete.
Use with Other Staking Wallets
We are testing and using this currently for LINDA. Any wallet that supports the following RPC commands would work with this process.
This process has worked so well that I moved any LINDA Master Nodes to all staking. This way I do not have to monitor any issues with a master node.
Recently I was looking at couple of products to obfuscate C# code and came across Obfuscar.
You can run Obfuscar via a command line or on the Post Build Events in Visual Studio.
There are a few steps to add this to the post build of any project.
1. Add Obfuscar NuGet Package to your solution.
2. Add obfuscar.xml file to your project and change Copy to Output Directory: Always.
In this config I want to obfuscate a DLL for a blockchain project I am working on.
<Var name="InPath" value="C:...[path to your project output folder]" />
<Var name="OutPath" value="$(InPath)\Obfuscator_Output" />
<Var name="KeepPublicApi" value="false" />
<Var name="HidePrivateApi" value="true" />
<Var name="RenameProperties" value="true" />
<Var name="RenameEvents" value="true" />
<Var name="RenameFields" value="true" />
<Var name="UseUnicodeNames" value="true" />
<Var name="HideStrings" value="true" />
<Var name="OptimizeMethods" value="true" />
<Var name="SuppressIldasm" value="true" />
<Module file="$(InPath)\CoinControl.dll" />
3. In the Visual Studio post build events enter: "$(Obfuscar)" obfuscar.xml
After you run the build (in your debug or release folder) you will have a fully obfuscated binary under a folder named: Obfuscator_Output.