Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

iPadProPerson

macrumors newbie
Original poster
Nov 16, 2020
21
1
I am making a bitcoin miner that I will make into an ios app for people to be able to mine. Right now it is in python, why is return not working? Here is the code.
Code:
# proof-of-work test:  hash < target

      if l < target:

        print(time.asctime(), "PROOF-OF-WORK found: %064x" % (l,)

        return (nonce + 1, nonce_bin)

else:

        print time.asctime(), "PROOF-OF-WORK false positive %064x" % (l,)

#       return (nonce + 1, nonce_bin)


It says syntax error with the arrow pointing toward the r in return but I indented right. How can I fix this? Thanks.
 
Last edited by a moderator:

chown33

Moderator
Staff member
Aug 9, 2009
10,991
8,874
A sea of green
I see unbalanced parentheses in this line:
Code:
        print(time.asctime(), "PROOF-OF-WORK found: %064x" % (l,)

It should be plain when you align the print in the if above the print in the else:
Code:
        print(time.asctime(), "PROOF-OF-WORK found: %064x" % (l,)
        print time.asctime(), "PROOF-OF-WORK false positive %064x" % (l,)
 

casperes1996

macrumors 604
Jan 26, 2014
7,593
5,764
Horsens, Denmark
A perfectly sensible practice project, but just keep in mind that bitcoin mining at this stage is only profitable on task-specialized ASICs :)

Don’t know whaat you meant by your last post about the IDE btw. But I assume chown33’s suggestion fixed your issues
 
  • Like
Reactions: iPadProPerson

iPadProPerson

macrumors newbie
Original poster
Nov 16, 2020
21
1
A perfectly sensible practice project, but just keep in mind that bitcoin mining at this stage is only profitable on task-specialized ASICs :)

Don’t know whaat you meant by your last post about the IDE btw. But I assume chown33’s suggestion fixed your issues
Which ones, I might buy one, my range is under 200
 

iPadProPerson

macrumors newbie
Original poster
Nov 16, 2020
21
1
A perfectly sensible practice project, but just keep in mind that bitcoin mining at this stage is only profitable on task-specialized ASICs :)

Don’t know whaat you meant by your last post about the IDE btw. But I assume chown33’s suggestion fixed your issues
An ide is a way to run code online and I forgot about some of the new python updates where I would have to change what I write so I just used an older version of the code. Thanks!
 

casperes1996

macrumors 604
Jan 26, 2014
7,593
5,764
Horsens, Denmark
Which ones, I might buy one, my range is under 200


Example product. Mining on GPUs, let alone CPUs just cannot compete in proof-of-work chains when the difficulty is set high enough, which it will be with things like that in the game; Electricity cost alone will outweigh any potential gains.
An ide is a way to run code online and I forgot about some of the new python updates where I would have to change what I write so I just used an older version of the code. Thanks!

No. An IDE has nothing to do with running code online. An IDE is an integrated development environment, and may just as well be an offline platform; In fact, most often is. Such as for example Jetbrains' excellent IntelliJ or Apple's Xcode.

The IDE should not dictate what version of Python you are working with. If it does and does not allow you to change the backend it is a bad IDE.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.