Commit fd568d9a authored by Clint Mourlevat's avatar Clint Mourlevat

Implementing vanity process

parent 80bf3d50
...@@ -66,6 +66,7 @@ namespace Stratis.Guru.Controllers ...@@ -66,6 +66,7 @@ namespace Stratis.Guru.Controllers
[Route("vanity")] [Route("vanity")]
public IActionResult Vanity(Vanity vanity) public IActionResult Vanity(Vanity vanity)
{ {
ViewBag.Succeed = true;
return View(); return View();
} }
......
using System.ComponentModel.DataAnnotations;
namespace Stratis.Guru.Models namespace Stratis.Guru.Models
{ {
public class Vanity public class Vanity
{ {
[Required(ErrorMessage = "The prefix is required.")]
[StringLength(4, MinimumLength = 1, ErrorMessage = "You connat overflow the size.")]
public string Prefix { get; set; } public string Prefix { get; set; }
[Required(ErrorMessage = "The email address is required.")]
[EmailAddress]
public string Email { get; set; } public string Email { get; set; }
} }
} }
\ No newline at end of file
using System; using System;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using NBitcoin;
using Stratis.Guru.Modules;
namespace Stratis.Guru.Services namespace Stratis.Guru.Services
{ {
public class VanityService : IHostedService, IDisposable public class VanityService : IHostedService, IDisposable
{ {
private IMemoryCache _memoryCache;
private IAsk _ask;
public VanityService(IMemoryCache memoryCache, IAsk ask)
{
_memoryCache = memoryCache;
_ask = ask;
}
public Task StartAsync(CancellationToken cancellationToken) public Task StartAsync(CancellationToken cancellationToken)
{ {
/*while (true)
{
var stratisKey = new Key();
var stratisAddress = stratisKey.GetWif(Network.StratisMain).PubKey.GetAddress(Network.StratisMain).ToString();
if (stratisAddress.ToLower().StartsWith("stra"))
{
Console.WriteLine(stratisAddress);
}
//Thread.Sleep((int) TimeSpan.FromSeconds(10).TotalMilliseconds);
}*/
return Task.CompletedTask; return Task.CompletedTask;
} }
......
...@@ -10,12 +10,20 @@ ...@@ -10,12 +10,20 @@
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 align-self-center text-center"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 align-self-center text-center">
<h1><strong>Vanity </strong>Address Generator</h1> <h1><strong>Vanity </strong>Address Generator</h1>
<p>Generate a vanity address with a prefix that you define, by example <span class="text-warning">STRAT</span>nhRnMqJNoeDiCFUnaug7TKHJocwDd</p> <p>Generate a vanity address with a prefix that you define, by example <span class="text-warning">STRAT</span>nhRnMqJNoeDiCFUnaug7TKHJocwDd</p>
@if (ViewBag.Succeed == null)
{
<div class="row"> <div class="row">
<div class="col-md-8 offset-2"> <div class="col-md-8 offset-2">
<div class="input-group mb-3 input-group-lg mt-4 pl-5 pr-5"> <div class="form-group mt-4">
<input type="text" class="form-control bg-dark" asp-for="Prefix" placeholder="Enter prefix"> <label class="text-left extra small text-white">The actual process is unthreaded and will be update in some days.</label>
<div class="input-group mb-3 input-group-lg pl-5 pr-5">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text bg-dark text-white" id="basic-addon1">SR2ZXnhRnMqJNoeDiCFUnaug7TKHJocwDd</span> <span class="input-group-text bg-info text-white">Prefix</span>
</div>
<div class="input-group-prepend">
<span class="input-group-text bg-dark text-white">S</span>
</div>
<input type="text" class="form-control bg-dark" asp-for="Prefix" placeholder="Enter the first letters, without the begning 'S'" maxlength="4">
</div> </div>
</div> </div>
</div> </div>
...@@ -23,12 +31,24 @@ ...@@ -23,12 +31,24 @@
<div class="row"> <div class="row">
<div class="col-md-8 offset-2"> <div class="col-md-8 offset-2">
<div class="form-group mb-3 mt-4 pl-5 pr-5"> <div class="form-group mb-3 mt-4 pl-5 pr-5">
<label class="text-left text-white">You will receive the private key by email.</label> <label class="text-left extra small text-white">You will receive the private key by email.</label>
<input type="text" class="form-control bg-dark" asp-for="Email" placeholder="Enter your email address"/> <div class="input-group input-group-lg">
<div class="input-group-prepend">
<span class="input-group-text bg-info text-white">Recipient</span>
</div>
<input type="text" class="form-control bg-dark" asp-for="Email" placeholder="Enter your email address to receive the key"/>
</div>
</div> </div>
</div> </div>
</div> </div>
<button type="submit" href="https://github.com/clintnetwork/stratis-guru-v2" target="_blank" class="btn-secondary-box mt-4"><i class="fa fa-github"></i> Browse Source on Github</button> <button type="submit" href="https://github.com/clintnetwork/stratis-guru-v2" target="_blank" class="btn-secondary-box mt-4"><i class="fa fa-play-circle"></i> Start Vanity Process</button>
}
else
{
<i class="fa fa-check text-success fa-5x"></i>
<h1>Process Started</h1>
<p>The process has been taken in hand by our vanity service !</p>
}
</div> </div>
</div> </div>
</div> </div>
......
...@@ -3191,6 +3191,16 @@ h2 ...@@ -3191,6 +3191,16 @@ h2
border-color: #1ae4ff; border-color: #1ae4ff;
} }
.text-success
{
color: #1ae4ff !important;
}
.input-group-text
{
border-color: transparent !important;
}
.input-group-text.bg-dark .input-group-text.bg-dark
{ {
background-color: #555555 !important; background-color: #555555 !important;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment