ISF Logo   IS Forum
Forum Index Register Members List Events Mark Forums Read Help

Go Back   International Skeptics Forum » General Topics » Computers and the Internet
 


Welcome to the International Skeptics Forum, where we discuss skepticism, critical thinking, the paranormal and science in a friendly but lively way. You are currently viewing the forum as a guest, which means you are missing out on discussing matters that are of interest to you. Please consider registering so you can gain full use of the forum features and interact with other Members. Registration is simple, fast and free! Click here to register today.
Reply
Old 13th April 2018, 10:39 AM   #1
plague311
Great minds think...
 
plague311's Avatar
 
Join Date: Dec 2011
Location: North Dakota
Posts: 4,292
Cryptocurrency (dun dun dun!)

With John Oliver's latest piece on Cryptocurrency, and the rave dying down around it I figured I'd drop in to see how users around here are involved. That is, if they are involved at all.

I do end to end network support including desktop, server, etc. I love technology and utilize it as much as I can, but a programmer I am not. The intricacies of blockchain technology, and the inner workings of the programs aren't my forte. That being said, it's fun to dabble around in the market. I personally hold on to a few hundred XRP (Ripple) coins, same with it's sister coin Stellar Lumens.

Just to save everyone the headache and ********, can we just keep this to people that are interested in it? If you want to **** talk cryptocurrencies, please just start your own thread. I don't want to hear about how it's a passing fad and the like. I'm more curious with what people that are interested and partake in the market have figured out.
__________________
"All acts performed in the world begin in the imagination."--Barbara Grizzuti Harrison

“There are times when the mind is dealt such a blow it hides itself in insanity. While this may not seem beneficial, it is. There are times when reality is nothing but pain, and to escape that pain the mind must leave reality behind.” - Patrick Rothfuss
plague311 is offline   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 13th April 2018, 10:53 AM   #2
theprestige
Penultimate Amazing
 
Join Date: Aug 2007
Posts: 26,627
Blockchain is just a slow distributed database. Not actually that intricate.
theprestige is offline   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 13th April 2018, 04:21 PM   #3
plague311
Great minds think...
 
plague311's Avatar
 
Join Date: Dec 2011
Location: North Dakota
Posts: 4,292
Originally Posted by theprestige View Post
Blockchain is just a slow distributed database. Not actually that intricate.
I've never really dug into it much, but the idea of a possible global transaction system is intriguing.

Sent from my Pixel XL using Tapatalk
__________________
"All acts performed in the world begin in the imagination."--Barbara Grizzuti Harrison

“There are times when the mind is dealt such a blow it hides itself in insanity. While this may not seem beneficial, it is. There are times when reality is nothing but pain, and to escape that pain the mind must leave reality behind.” - Patrick Rothfuss
plague311 is offline   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 13th April 2018, 08:47 PM   #4
psionl0
Skeptical about skeptics
 
psionl0's Avatar
 
Join Date: Sep 2010
Location: 31°57'S 115°57'E
Posts: 12,571
Originally Posted by plague311 View Post
I'm more curious with what people that are interested and partake in the market have figured out.
If you are mainly interest in the market aspects then why post in the computers section?
__________________
"The process by which banks create money is so simple that the mind is repelled. Where something so important is involved, a deeper mystery seems only decent." - Galbraith, 1975
psionl0 is offline   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 13th April 2018, 08:56 PM   #5
psionl0
Skeptical about skeptics
 
psionl0's Avatar
 
Join Date: Sep 2010
Location: 31°57'S 115°57'E
Posts: 12,571
Originally Posted by theprestige View Post
Blockchain is just a slow distributed database. Not actually that intricate.
What do you mean? Getting around the Byzantine Generals* problem seems intricate to me.

* For the interested
The Byzantine Generals problem posits that there are a number of army camps situated in hostile territory with each headed by a general. They can only communicate with each other via messenger.

The problem is that you never know when a message may get lost in transit or compromised (intercepted and altered by an enemy). To make matters worse, some of the generals may be hostile and send falsified messages or send different messages to different generals.

The internet is a good representation of the Byzantine Generals problem - especially if you rely on the co-operation of strangers to validate records.
__________________
"The process by which banks create money is so simple that the mind is repelled. Where something so important is involved, a deeper mystery seems only decent." - Galbraith, 1975

Last edited by psionl0; 13th April 2018 at 08:59 PM.
psionl0 is offline   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 14th April 2018, 11:46 AM   #6
plague311
Great minds think...
 
plague311's Avatar
 
Join Date: Dec 2011
Location: North Dakota
Posts: 4,292
Originally Posted by psionl0 View Post
If you are mainly interest in the market aspects then why post in the computers section?
I guess it was one of those in between choices. It's computer related, so I rolled the dice.

Sent from my Pixel XL using Tapatalk
__________________
"All acts performed in the world begin in the imagination."--Barbara Grizzuti Harrison

“There are times when the mind is dealt such a blow it hides itself in insanity. While this may not seem beneficial, it is. There are times when reality is nothing but pain, and to escape that pain the mind must leave reality behind.” - Patrick Rothfuss
plague311 is offline   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 16th April 2018, 09:30 AM   #7
caveman1917
Philosopher
 
Join Date: Feb 2015
Posts: 5,662
This is specifically a post regarding the programming of miners, but I'll share it since I think there's a good programming lesson to be learned here. Last summer I beat the top public Monero miner by about 15% with a C# miner (ie my miner program ran about 15% faster than the top public one). If you're thinking "How the hell can you beat an optimized C miner with a C# one?" then the answer is a nice example of Knuth's "premature optimization is the root of all evil".

C is what is called a low-productivity high-speed language, C# is a high-productivity low-speed one. Productivity is how quickly/easily you can program something and speed is how fast it runs, so using C# you'd be able to quickly write a functioning program but it would run slow and C would be the opposite.

At first I quickly wrote a fully functional miner from scratch using C#, which took me about a day (C# is really high-productivity) but it was slow at about 50% of the speed of the top public one. I hadn't optimized anything yet at that point, all of the hashing functions were just basic implementations, not even optimized a little. So I ran a profiler and found that almost all the time was spent in the core mining loop.

The core loop uses AES encryption a lot for which a hardware instruction exists (aes-ni). So I programmed that part (about 100 lines of code) in C, to take advantage of the hardware instruction, and called it as a dll from my C# miner. This put me at the same speed as the top miner, even though I'd only written that specific function in C whereas the rest of my code (including the hashing functions Keccak, Blake, Groestl, etc) was still completely unoptimized C#.

I then profiled some more and found that the core loop was still by far the most time-consuming part of the code, so I looked into it some more. The loop can be split into 3 parts: explode_scratchpad, main_loop, implode_scratchpad. The middle one (main_loop) was limited by memory access latency so there was nothing that could be done there. The first and third parts (explode_scratchpad and implode_scratchpad) however weren't so I took a deeper look into them.

The algorithm for both of these constitutes keeping 8 128bit variables around and having 10 128bit keys. Then at each iteration each of the variables is AESed with each key and the result is successively written to or read from memory (a 2mb scratchpad being filled in the case of explode_scratchpad and being read in the case of implode_scratchpad). We have 8 128bit registers available (XMM0-7) and the aes-ni instruction takes a register with a variable, another register with the key, and encrypts the variable with the key.

Since we only have 8 registers the compiler-outputted assembly was constantly switching registers around to fit the keys. As it turns out there is a lesser-known variant of the aes-ni instruction which takes a register with a variable and a stack pointer to the key, apparently the compiler wasn't aware of this variant. So I wrote those 2 functions in assembly so that the 8 variables were kept in the 8 registers and the 10 keys were kept in an array on the stack and then I could iterate though the 10 keys and at each step AES the 8 registers in parallel without ever needing to switch registers. This then put me at about 115% of the speed of the top public miner.

The cool thing here is that this entire thing took me about a day, starting from scratch and ending up with a C# program with about 50 lines of handwritten assembly and about 50 lines of C thrown in as a dll. Everything else (including the Keccak, Blake, etc hashing functions) were still completely unoptimized C#. If you however take a look at the commits to the top public miner you'll see lots of things like "optimized Blake hashing" etc, ie lots of effort being put into optimizing irrelevancies, and they've been at this for years and as far as I can see they still haven't opened the Intel Instruction Set to find that there is an interesting variant of the aes-ni instruction that can be exploited to actually give a significant speed boost.

Anyway, this experience convinced me of my approach to programming, which is to first write a program using a high-productivity language and only then optimize the crucial parts/functions with a low-level programming language. This way you get the best of both worlds, high productivity for almost all of the code and high speed for the small part where it actually matters. It also stops you from putting effort into optimizing irrelevancies. Seeing as I significantly beat the top Monero miner in one day from scratch (and it was even my first time writing assembly or using hardware instruction sets) I'll consider it a vindication of my approach

Originally Posted by Donald Knuth
We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.
__________________
"Ideas are also weapons." - Subcomandante Marcos
"We must devastate the avenues where the wealthy live." - Lucy Parsons
"Let us therefore trust the eternal Spirit which destroys and annihilates only because it is the unfathomable and eternal source of all life. The passion for destruction is a creative passion, too!" - Mikhail Bakunin

Last edited by caveman1917; 16th April 2018 at 09:34 AM.
caveman1917 is offline   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 20th April 2018, 03:53 AM   #8
theprestige
Penultimate Amazing
 
Join Date: Aug 2007
Posts: 26,627
Cool story, bro. Where's your github repo?
theprestige is offline   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 20th April 2018, 10:16 AM   #9
Dancing David
Penultimate Amazing
 
Dancing David's Avatar
 
Join Date: Mar 2003
Posts: 39,074
Our network was invaded by coin miners, what a pain
__________________
I suspect you are a sandwich, metaphorically speaking. -Donn
And a shot rang out. Now Space is doing time... -Ben Burch
You built the toilet - don't complain when people crap in it. _Kid Eager
Never underestimate the power of the Random Number God. More of evolutionary history is His doing than people think. - Dinwar
Dancing David is online now   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Old 20th April 2018, 02:16 PM   #10
caveman1917
Philosopher
 
Join Date: Feb 2015
Posts: 5,662
Originally Posted by theprestige View Post
Cool story, bro. Where's your github repo?
Private. Or rather non-existent in this case. Should be easy enough to verify if you want, just fork a repo of one of the public miners and rewrite the explode_scratchpad and implode_scratchpad loops in assembly as given above.

Originally Posted by Dancing David View Post
Our network was invaded by coin miners, what a pain
Monero mining lends itself perfectly to supercomputers constructed from a large number of consumer-type PC's (aka a botnet). The algorithm is designed to be ASIC-resistant (even using the GPU doesn't bring much improvement over the CPU).
__________________
"Ideas are also weapons." - Subcomandante Marcos
"We must devastate the avenues where the wealthy live." - Lucy Parsons
"Let us therefore trust the eternal Spirit which destroys and annihilates only because it is the unfathomable and eternal source of all life. The passion for destruction is a creative passion, too!" - Mikhail Bakunin
caveman1917 is offline   Quote this post in a PM   Nominate this post for this month's language award Copy a direct link to this post Reply With Quote Back to Top
Reply

International Skeptics Forum » General Topics » Computers and the Internet

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -7. The time now is 01:28 PM.
Powered by vBulletin. Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

This forum began as part of the James Randi Education Foundation (JREF). However, the forum now exists as
an independent entity with no affiliation with or endorsement by the JREF, including the section in reference to "JREF" topics.

Disclaimer: Messages posted in the Forum are solely the opinion of their authors.