Page 4 of 4
Re: Write NiceHash bot, make lots of profit
Posted: Tue Mar 27, 2018 4:44 am
by bitmonkeys
Can someone please provide me with an example on how to subscribe to this WAMP API in C#?
I have a NiceHash bot that i would like to incorporate this API into, however my programming skills are limited, and i'm not sure how i would write this in C#.
Thanks in advance
Re: Write NiceHash bot, make lots of profit
Posted: Tue Mar 27, 2018 1:18 pm
by CSZiggy
Think this was a better idea back when you could change multiple times per minute to always pick the highest payout coin to static mine.
Pick a coin, when its not the highest anymore, swap to the new high coin.
But now that the system only allows you to change every 12 mins? or whatever it is now the bot wouldn't be able to swap but 4 times per hour.
With the time constraints put on the system not even worth modifying the bots we did have to keep running with that much of a time lapse.
Re: Write NiceHash bot, make lots of profit
Posted: Tue Mar 27, 2018 1:47 pm
by Steve Sokolowski
CSZiggy wrote:Think this was a better idea back when you could change multiple times per minute to always pick the highest payout coin to static mine.
Pick a coin, when its not the highest anymore, swap to the new high coin.
But now that the system only allows you to change every 12 mins? or whatever it is now the bot wouldn't be able to swap but 4 times per hour.
With the time constraints put on the system not even worth modifying the bots we did have to keep running with that much of a time lapse.
We decided to relax that constraint for this week to see what happens. We discovered other issues that were affecting profits and this issue probably did not cause much impact on dynamic miners' profitability.
We reserve the right to reenable the restrictions next week, depending on what we find.
Re: Write NiceHash bot, make lots of profit
Posted: Thu Mar 29, 2018 4:08 pm
by d2391
CSZiggy wrote:Think this was a better idea back when you could change multiple times per minute to always pick the highest payout coin to static mine.
Pick a coin, when its not the highest anymore, swap to the new high coin.
So you can make more by targeting the highest payout coin while being in pps mode? Or are you talking about solo mining? I always thought that all shares were equal in pps mode.
Re: Write NiceHash bot, make lots of profit
Posted: Mon Apr 02, 2018 5:05 am
by bitmonkeys
I am trying to connect to the wamp API using WampSharp implementation, but i am getting "AuthenticationException: A call to SSPI failed, see inner exception." on the line
Code: Select all
IDisposable disposable = RunAsync().Result;
this is the code i am using to connect. Is anybody able to help?
Code: Select all
public static void Main(string[] args)
{
IDisposable disposable = RunAsync().Result;
Console.ReadLine();
disposable.Dispose();
}
private static async Task<IDisposable> RunAsync()
{
DefaultWampChannelFactory channelFactory = new DefaultWampChannelFactory();
IWampClientAuthenticator authenticator;
authenticator = new WampCraClientAuthenticator(authenticationId: "web", secret: "web");
const string serverAddress = "wss://live.prohashing.com:443/ws";
IWampChannel channel =
channelFactory.CreateJsonChannel(serverAddress, "mining", authenticator);
channel.RealmProxy.Monitor.ConnectionEstablished +=
(sender, args) =>
{
Console.WriteLine("connected session with ID " + args.SessionId);
dynamic details = args.WelcomeDetails.OriginalValue.Deserialize<dynamic>();
Console.WriteLine("authenticated using method '{0}' and provider '{1}'", details.authmethod,
details.authprovider);
Console.WriteLine("authenticated with authid '{0}' and authrole '{1}'", details.authid,
details.authrole);
};
channel.RealmProxy.Monitor.ConnectionBroken += (sender, args) =>
{
dynamic details = args.Details.OriginalValue.Deserialize<dynamic>();
Console.WriteLine("disconnected " + args.Reason + " " + details.reason + details);
};
IWampRealmProxy realmProxy = channel.RealmProxy;
await channel.Open().ConfigureAwait(false);
IWampSubject topic =
realmProxy.Services.GetSubject("profitability_updates");
IDisposable disposable =
topic.Subscribe(OnTopic2);
return disposable;
}
private static void OnTopic2(IWampSerializedEvent serializedEvent)
{
int[] arguments =
serializedEvent.Arguments.Select(argument => argument.Deserialize<int>())
.ToArray();
string c =
serializedEvent.ArgumentsKeywords["c"].Deserialize<string>();
ComplexContract d =
serializedEvent.ArgumentsKeywords["d"].Deserialize<ComplexContract>();
var deserializedArguments =
new
{
arguments,
argumentsKeywords = new
{
c,
d
}
};
Console.WriteLine("Got event: args: [{0}], kwargs: {{ {1} }}",
string.Join(", ", deserializedArguments.arguments),
deserializedArguments.argumentsKeywords);
}
public class ComplexContract
{
[JsonProperty("counter")]
public int Counter { get; set; }
[JsonProperty("foo")]
public int[] Foo { get; set; }
public override string ToString()
{
return $"counter: {Counter}, foo: [{string.Join(", ", Foo)}]";
}
}
}
}
Re: Write NiceHash bot, make lots of profit
Posted: Mon Apr 02, 2018 8:36 am
by Steve Sokolowski
bitmonkeys wrote:I am trying to connect to the wamp API using WampSharp implementation, but i am getting "AuthenticationException: A call to SSPI failed, see inner exception." on the line
Code: Select all
IDisposable disposable = RunAsync().Result;
this is the code i am using to connect. Is anybody able to help?
Code: Select all
public static void Main(string[] args)
{
IDisposable disposable = RunAsync().Result;
Console.ReadLine();
disposable.Dispose();
}
private static async Task<IDisposable> RunAsync()
{
DefaultWampChannelFactory channelFactory = new DefaultWampChannelFactory();
IWampClientAuthenticator authenticator;
authenticator = new WampCraClientAuthenticator(authenticationId: "web", secret: "web");
const string serverAddress = "wss://live.prohashing.com:443/ws";
IWampChannel channel =
channelFactory.CreateJsonChannel(serverAddress, "mining", authenticator);
channel.RealmProxy.Monitor.ConnectionEstablished +=
(sender, args) =>
{
Console.WriteLine("connected session with ID " + args.SessionId);
dynamic details = args.WelcomeDetails.OriginalValue.Deserialize<dynamic>();
Console.WriteLine("authenticated using method '{0}' and provider '{1}'", details.authmethod,
details.authprovider);
Console.WriteLine("authenticated with authid '{0}' and authrole '{1}'", details.authid,
details.authrole);
};
channel.RealmProxy.Monitor.ConnectionBroken += (sender, args) =>
{
dynamic details = args.Details.OriginalValue.Deserialize<dynamic>();
Console.WriteLine("disconnected " + args.Reason + " " + details.reason + details);
};
IWampRealmProxy realmProxy = channel.RealmProxy;
await channel.Open().ConfigureAwait(false);
IWampSubject topic =
realmProxy.Services.GetSubject("profitability_updates");
IDisposable disposable =
topic.Subscribe(OnTopic2);
return disposable;
}
private static void OnTopic2(IWampSerializedEvent serializedEvent)
{
int[] arguments =
serializedEvent.Arguments.Select(argument => argument.Deserialize<int>())
.ToArray();
string c =
serializedEvent.ArgumentsKeywords["c"].Deserialize<string>();
ComplexContract d =
serializedEvent.ArgumentsKeywords["d"].Deserialize<ComplexContract>();
var deserializedArguments =
new
{
arguments,
argumentsKeywords = new
{
c,
d
}
};
Console.WriteLine("Got event: args: [{0}], kwargs: {{ {1} }}",
string.Join(", ", deserializedArguments.arguments),
deserializedArguments.argumentsKeywords);
}
public class ComplexContract
{
[JsonProperty("counter")]
public int Counter { get; set; }
[JsonProperty("foo")]
public int[] Foo { get; set; }
public override string ToString()
{
return $"counter: {Counter}, foo: [{string.Join(", ", Foo)}]";
}
}
}
}
Look for the "innerException" property of that .NET exception and read its "message" property. That should tell you more about the issue.
Re: Write NiceHash bot, make lots of profit
Posted: Mon Apr 02, 2018 8:45 pm
by bitmonkeys
Hi Steve,
Thanks for the reply, it's saying "the function requested is not supported". Really not too sure where to go from here. I have added the NuGet packages for WAMPsharp, and followed the examples they have to subscribe to a WAMP API.
Re: Write NiceHash bot, make lots of profit
Posted: Wed Apr 25, 2018 6:28 pm
by DuncanBoaz
Was anyone able to get a Connection for this to Function?