Write NiceHash bot, make lots of profit

News updates about the Prohashing pool
Forum rules
The News forum is only for updates about the Prohashing pool.

Replies to posts in this forum should be related to the news being announced. If you need support on another issue, please post in the forum related to that topic or seek one of the official support options listed in the top right corner of the forums page or on prohashing.com/about.

For the full list of PROHASHING forums rules, please visit https://prohashing.com/help/prohashing- ... rms-forums.
bitmonkeys
Posts: 3
Joined: Tue Mar 27, 2018 4:39 am

Re: Write NiceHash bot, make lots of profit

Post by bitmonkeys » Tue Mar 27, 2018 4:44 am

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
User avatar
CSZiggy
Posts: 662
Joined: Wed Jan 31, 2018 2:44 pm

Re: Write NiceHash bot, make lots of profit

Post by CSZiggy » Tue Mar 27, 2018 1:18 pm

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.
User avatar
Steve Sokolowski
Posts: 4585
Joined: Wed Aug 27, 2014 3:27 pm
Location: State College, PA

Re: Write NiceHash bot, make lots of profit

Post by Steve Sokolowski » Tue Mar 27, 2018 1:47 pm

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.
d2391
Posts: 6
Joined: Sun Jun 11, 2017 8:31 pm

Re: Write NiceHash bot, make lots of profit

Post by d2391 » Thu Mar 29, 2018 4:08 pm

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.
bitmonkeys
Posts: 3
Joined: Tue Mar 27, 2018 4:39 am

Re: Write NiceHash bot, make lots of profit

Post by bitmonkeys » Mon Apr 02, 2018 5:05 am

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)}]";
            }
        }
    }
}
User avatar
Steve Sokolowski
Posts: 4585
Joined: Wed Aug 27, 2014 3:27 pm
Location: State College, PA

Re: Write NiceHash bot, make lots of profit

Post by Steve Sokolowski » Mon Apr 02, 2018 8:36 am

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.
bitmonkeys
Posts: 3
Joined: Tue Mar 27, 2018 4:39 am

Re: Write NiceHash bot, make lots of profit

Post by bitmonkeys » Mon Apr 02, 2018 8:45 pm

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.
DuncanBoaz
Posts: 13
Joined: Sat Sep 16, 2017 1:36 am

Re: Write NiceHash bot, make lots of profit

Post by DuncanBoaz » Wed Apr 25, 2018 6:28 pm

Was anyone able to get a Connection for this to Function?
Locked