Browse Source

dev-donation notes

pull/123/head
notgiven688 3 years ago
parent
commit
ebc459be6f
4 changed files with 56 additions and 22 deletions
  1. +2
    -1
      README.md
  2. +45
    -0
      server/Server/DevDonation.cs
  3. +8
    -21
      server/Server/Program.cs
  4. +1
    -0
      server/Server/Server.csproj

+ 2
- 1
README.md View File

@ -7,7 +7,8 @@
#### [Aeon example](https://webminerpool.com/aeon)
###
_The server_ is written in **C#**, **optionally calling C**-routines to check hashes calculated by the clients. It acts as a proxy server for common pools.
_The server_ is written in **C#**, **optionally calling C**-routines to check hashes calculated by the clients. It acts as a proxy server for common pools. By default the server has a configured dev-donation of 3%.
_The client_ runs in the browser using javascript and webassembly.
**websockets** are used for the connection between the client and the server, **webassembly** to perform hash calculations, **web workers** for threads.

+ 45
- 0
server/Server/DevDonation.cs View File

@ -0,0 +1,45 @@
// The MIT License (MIT)
// Copyright (c) 2018 - the webminerpool developer
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
namespace Server {
public static class DevDonation {
// by default a 3% dev fee is submitted to the following address.
// thank you for leaving this in.
public const double DonationLevel = 0.03;
#if (AEON)
public const string DevAddress = "WmtUFkPrboCKzL5iZhia4iNHKw9UmUXzGgbm5Uo3HPYwWcsY1JTyJ2n335gYiejNysLEs1G2JZxEm3uXUX93ArrV1yrXDyfPH";
public const string DevPoolUrl = "pool.aeon.hashvault.pro";
public const string DevPoolPwd = "x";
public const int DevPoolPort = 3333;
#else
public const string DevAddress = "49kkH7rdoKyFsb1kYPKjCYiR2xy1XdnJNAY1e7XerwQFb57XQaRP7Npfk5xm1MezGn2yRBz6FWtGCFVKnzNTwSGJ3ZrLtHU";
public const string DevPoolUrl = "de.moneroocean.stream";
public const string DevPoolPwd = "x"; // if you want you can change this to something funny
public const int DevPoolPort = 10064;
#endif
}
}

+ 8
- 21
server/Server/Program.cs View File

@ -35,6 +35,7 @@ using JsonData = System.Collections.Generic.Dictionary;
namespace Server {
public class Client {
public PoolConnection PoolConnection;
@ -49,7 +50,7 @@ namespace Server {
public string LastTarget = string.Empty;
public string UserId;
public int NumChecked = 0;
public double Fee = 0.03;
public double Fee = DevDonation.DonationLevel;
public int Version = 1;
}
@ -77,7 +78,7 @@ namespace Server {
class MainClass {
[DllImport ("libhash.so", CallingConvention = CallingConvention.StdCall)]
[DllImport ("libhash.so", CallingConvention = CallingConvention.StdCall)]
static extern IntPtr hash_cn (string hex, int light);
[DllImport ("libhash.so", CallingConvention = CallingConvention.StdCall)]
@ -92,21 +93,6 @@ namespace Server {
private static bool libHashAvailable = false;
#if (AEON)
private const string DevAddress = "WmtUFkPrboCKzL5iZhia4iNHKw9UmUXzGgbm5Uo3HPYwWcsY1JTyJ2n335gYiejNysLEs1G2JZxEm3uXUX93ArrV1yrXDyfPH";
private const string DevPoolUrl = "pool.aeon.hashvault.pro";
private const string DevPoolPwd = "x";
private const int DevPoolPort = 3333;
#else
// by default a 3% dev fee is submitted to the following address.
// thank you for leaving this in.
private const string DevAddress = "49kkH7rdoKyFsb1kYPKjCYiR2xy1XdnJNAY1e7XerwQFb57XQaRP7Npfk5xm1MezGn2yRBz6FWtGCFVKnzNTwSGJ3ZrLtHU";
private const string DevPoolUrl = "de.moneroocean.stream";
private const string DevPoolPwd = "x"; // if you want you can change this to something funny
private const int DevPoolPort = 10064;
#endif
private struct PoolInfo {
public int Port;
public string Url;
@ -468,15 +454,16 @@ namespace Server {
private static void CreateOurself () {
ourself = new Client ();
ourself.Login = DevAddress;
ourself.Pool = DevPoolUrl;
ourself.Login = DevDonation.DevAddress;
ourself.Pool = DevDonation.DevPoolUrl;
ourself.Created = ourself.LastPoolJobTime = DateTime.Now;
ourself.Password = DevPoolPwd;
ourself.Password = DevDonation.DevPoolPwd;
ourself.WebSocket = new EmptyWebsocket ();
clients.TryAdd (Guid.Empty, ourself);
ourself.PoolConnection = PoolConnectionFactory.CreatePoolConnection (ourself, DevPoolUrl, DevPoolPort, DevAddress, DevPoolPwd);
ourself.PoolConnection = PoolConnectionFactory.CreatePoolConnection (ourself,
DevDonation.DevPoolUrl, DevDonation.DevPoolPort, DevDonation.DevAddress, DevDonation.DevPoolPwd);
}
private static bool CheckLibHash (out Exception ex) {

+ 1
- 0
server/Server/Server.csproj View File

@ -57,6 +57,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="JSONParser.cs" />
<Compile Include="Extensions.cs" />
<Compile Include="DevDonation.cs" />
<Compile Include="PoolConnection.cs" />
<Compile Include="DataStructures.cs" />
<Compile Include="Fleck\BufferPool.cs" />

Loading…
Cancel
Save