Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Cryptocurency miner in Unity

Discussion in 'Scripting' started by greaneagle, Jun 14, 2017.

Thread Status:
Not open for further replies.
  1. greaneagle

    greaneagle

    Joined:
    Nov 11, 2013
    Posts:
    18
    Hi there everyone,

    I have a question for you everyone interesed in cryptocurency.
    Would it be possible to make a Scrypt algorythm miner in Unity?
    I am planing in making my own CryptoCoin in the next few days, because I would like to learn a bit more about blockchain. And it isn't an impossible task to fork litecoin and create your own.
    So then I was thinking. If I have my own coin, could I make a miner in C# using Unity? Would the getwork from C# work normaly in Unity?

    I know there was a project for a Bitcoin mining plugin a few years back, but I don't think anything came of it.

    So what do you think?
    Impossible?
    Doable?
     
  2. FMark92

    FMark92

    Joined:
    May 18, 2017
    Posts:
    1,243
    Assuming it's possible and doable, is it efficient?
    Won't Unity engine overhead slow everything down?
    Wouldn't making a C# console application handle the task more efficiently?
     
  3. greaneagle

    greaneagle

    Joined:
    Nov 11, 2013
    Posts:
    18
    Is it efficient?
    Hell no, if you plan on mining bitcoins or whatever for personal gain, this thread isn't worth even thinking about.

    But I was thinking what the unity overhead offers and could be usefull.
    Technicaly what I was thinkin is minig in one Unity scene, and having your own wallet in another.

    But again, useless for mining bitcoins or profit, but could it be done?
     
  4. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,568
    You can basically do anything. If you do something silly, that's your choice.
     
    lordofduct likes this.
  5. greaneagle

    greaneagle

    Joined:
    Nov 11, 2013
    Posts:
    18
    Ok, so I found this simple C# bitcoin miner.
    https://github.com/lithander/Minimal-Bitcoin-Miner/tree/master/MiniMiner

    Is enyone here willing to help me to port it to Unity?

    The code seems simple enough for reading, so it should be doable.

    I am not exactly a coder myslef, but I figure the clases will have to be broken up, and the Console.WriteLine (or all console uses actualy) will have to be changed to Debug.Log

    A few more things will probably have to be done, but it seems like a nice project to start learning about crypot mining.


    Anyone interested in helping out?

    P.S. I am willing to do all I can but I will need soem guiding and help!

    Cheers!
     
  6. FMark92

    FMark92

    Joined:
    May 18, 2017
    Posts:
    1,243
    u wot.
    You need help with copy-paste now? :D
     
  7. greaneagle

    greaneagle

    Joined:
    Nov 11, 2013
    Posts:
    18
    I tried copy paste... didn't end up so well. xD

    I have a project open and am working on it right now, but I'm not sure I am doing it correctly...


    Wanna check where I messed up?
     
  8. FMark92

    FMark92

    Joined:
    May 18, 2017
    Posts:
    1,243
    I'm leaving forum in 10 minutes. I'll be back monday morning :(

    Feel free to spot it here, though. The code seems workable. You'll need to replace some system methods with Unity engine natives. (net stuff, for example)
     
  9. greaneagle

    greaneagle

    Joined:
    Nov 11, 2013
    Posts:
    18
    I'm not sure which things I'll have to replace, but I'll do my best and post my project here :)
    Feel free to check it out!

    And if anyonone else has any suggestions or things that should be changed, just weigh in :)
     
    Last edited: Jun 16, 2017
  10. greaneagle

    greaneagle

    Joined:
    Nov 11, 2013
    Posts:
    18
    So I decided to take a step back first... And see if this little miner works at all.

    I was unable to connect to a pool with it though.

    upload_2017-6-16_16-15-47.png

    If anybody makes it, let me know :)
     
  11. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,561
    But why in unity? Unity isn't offering anything to cryptocurrency mining that can't be done elsewhere.

    Unity does tap into your graphics card to do graphics processing... and the same fpu's found on your graphics card could be used to speed up crypto-currency mining. But you don't need unity to gain access to that (actually it'd probably make it more annoying to tap into).

    Furthermore, from the looks of what you've accomplished thus far, you're rather novice at programming. This is not a knock, everyone must start somewhere... but implementing a complicated feature like crypto-currency mining on its own is a non-trivial accomplishment... doing that in a foreign setting like Unity is going to be even more complex.

    So again... what benefits are you hoping to leverage in unity?

    Why bother?

    Do you want to have cute 3d graphics of dwarfs mining bitcoins to animate along with your mining? Is there some interactive/graphical experience you hope to attach to the process? Because otherwise.... I see no point in doing it in Unity.

    ...

    I suggest, since you seem to be novice, is that you use that C# project you found as a way to learn. Dig into it, see what's keeping it from connecting, try to get it running. THAT will be a good learning experience, and you may take the knowledge gain and apply it to a future project.
     
    TaleOf4Gamers likes this.
  12. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    My guess is so he can create and give away a free game that surreptitiously mines for coins for the developer.
     
    tjmckinney and lordofduct like this.
  13. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,561
    I mean... I wasn't going to go there. But heh.
     
Thread Status:
Not open for further replies.