Posts Tagged ‘ programming ’

Forking heck

Posted on June 21st, 2025 Comments Off on Forking heck

It was close to 10 years ago that I announced that I’d been working on a crypto-based, peer-to-peer poker project named CypherPoker. That initial version was written in a programming language called ActionScript which produced software for the now-defunct Flash platform.

I admit that I still have a soft spot for the language and the platform on which it ran (a.k.a. the runtime).

Not only did Flash allow me to produce code for a broad variety of operating systems and hardware, it was also very creatively expressive. The platform/runtime was originally a way to produce streaming audio and video content for the web which was a groundbreaking advancement for its time. With the addition of a robust programming language, those “movies” could be made to react to user input and that’s when things got really interesting.

A few years later I found myself working for an online casino company and realized that a product like provably fair online poker software that didn’t require a middleman (e.g. PokerStars), was singularly unique. So I set out to write CypherPoker. I learned a lot about cryptography and peer-to-peer networking and pretty soon I knew that the idea was viable.

However, although it solved a lot of the problems associated with such an endeavour, my solution didn’t answer the questions of: who enforces the rules if someone does cheat, and moreover, who holds the money (pot) during the game?

It was suggested that I use Ethereum for the answers. You may have heard of Ethereum due the popular cryptocurrency Ether but this is only one half of this particular blockchain. The other half is a set of fairly open-ended programming instructions (a.k.a. Turing-complete), that run the blockchain. Those instructions can be created using any number of programming languages — in my case one called Solidity — and the resulting programs are called smart contracts.

Because smart contracts are run across the entire Ethereum network, an incentive system was included to ensure that people participate (like all blockchains that I know of, Ethereum uses a cryptographic consensus model), hence the Ether cryptocurrency. If you want to store your code on the blockchain, you pay Ether. If you want to run that code, you pay Ether.

If smart contracts and Ether had hips they would literally be joined at them, so much so that even the most basic transactions on Ethereum (e.g. “send X amount of Ether to recipient Y”), require basic smart contracts to do their thing. It’s also why even these most basic transactions require a fee, payable in Ether.

In the process of developing smart contracts I learned how to create my own Ethereum blockchain, which could have helped to keep transaction costs minimal — at least initially. Due to the intrinsically speculative nature of cryptocurrencies, however, I expected the inevitable eventuality of the same problem that I encountered with the official Ethererum blockchain: playing a hand of poker would eventually become prohibitively expensive. In addition, the consensus model meant I’d need a network of people to help run the blockchain, which I didn’t have.

Nevertheless, I received positive, even enthusiastic comments on the project, and as of the last time I checked it had been starred (the equivalent of “likes“), 70 times on GitHub. Perhaps more importantly, it had been forked 13 times, which means that GitHub users copied the code into their own repositories for their own use, adaptation, etc.

Unfortunately, that rotten piece of shit Steve Jobs (my consistent opinion), bashed Flash and with the help of his drooling and ignorant minions helped to prematurely kill off the technology. I won’t go into the numerous reasons why most of what he’d written was pure crap but it doesn’t change the fact that Flash would ultimately be doomed. Plus, the price of Ether skyrocketed so even without any rake the smart contracts were useful for only very high-stakes games in which expensive blockchain fees would make sense.

So, some years later when browsers began to offer some of the functionality that previously only Flash could offer, I decided to re-write the game for JavaScript. Thankfully, the similarity in names between the two programming languages is more than just coincidence. Not only do they both look and feel similar but they’re functionally related.

In fact, an ActionScript developer would often have to also learn JavaScript since Flash content tended to run within a browser window, and browsers use JavaScript to make web pages functional (i.e. more than just static content). In other words, the ActionScript runtime (Flash) was often embedded in a JavaScript runtime (browser), although this wasn’t always the case.

Sufficed to say, other than having to code everything again, going from one language and runtime to another wasn’t a huge leap. I learned a bunch of lessons in the development of the ActionScript version so its follow-up was produced considerably more quickly and robustly.

Instead of incorporating smart contracts directly, I created a plugin architecture into which they could eventually be slotted and wrote a module using Node.js (another JavaScript runtime), to act as a stand-in. Due to its popularity I added support for Bitcoin which, unlike Ethereum, comes with a highly restrictive set of programming instructions (not even close to Turing-complete), called Script.

With Bitcoin, instead of smart contracts someone would have to assume the role of a “trusted banker and game verifier”. It wasn’t ideal but would allow for completely private games, albeit with someone playing the role of a trusted third party. Besides, I figured, I’d written the smart contracts once and I should be able to dust them off at some point and slot them in.

However, that never happened.

Ether is still way too expensive and I’m no nearer to having enough people to help me create a CypherPoker blockchain so I added support for Bitcoin Cash (a cryptocurrency similar to Bitcoin), tidied up the code, updated the documentation so that anyone else could adapt it, and shelved the project. At this point it has been sitting idle on GitHub for about 6 years.

A couple of days ago I had a look at the repository and was pleasantly surprised to see that it had been starred 106 times and forked 44 times, twice this year and 5 times last year. In addition, 13 people have set a “watch” on the repository so that they can be alerted should it ever be updated.

Between the original CypherPoker and the newer CypherPoker.js, the project has been starred 176 times and forked 127 times with a total of 23 people watching.

Every once in a while I also receive a comment telling me that someone has implemented some changes or done something interesting with CypherPoker.js

As recently as the 6th of this month, for example, someone added a “spectator mode” to the game (not sure if this is a good idea), and someone else claimed that they used the project as a basis for their university thesis (LOL … I’m a Canadian college dropout!)

Altogether, it’s nice to know that the interest is still there.

If you or anyone you know share this interest, drop me a note and maybe we can resuscitate what I still consider to be a unique and very promising project.

Filed under: B Sides, Patrick Bay, Pictures

Made in Toronto: CypherPoker.JS v0.5.0 (Ollie)

Posted on May 31st, 2019 Comments Off on Made in Toronto: CypherPoker.JS v0.5.0 (Ollie)

If ever there was a reason I don’t post to TCL as often as I should this would certainly be it. It’s online Texas Hold’em that uses cryptocurrencies like Bitcoin, and its younger cousin Bitcoin Cash, for betting.

You may recognize the project from the link to the right and I’m sure I’d mentioned it in a previous post or two.

One thing that makes CypherPoker.JS truly unique is that it’s peer-to-peer, meaning that players can play directly against one another without any trusted middleman to “deal” the cards, hold buy-ins, and make sure games are played correctly / fairly.

The challenge in peer-to-peer online poker is a lot like playing the game over the phone against someone you don’t really trust and without relying on some other person to conduct the game — let that problem of how that would work percolate on the old noodle for a bit. Spoiler alert: it’s possible using clever math.

The other thing that makes CypherPoker.JS unique is that it’s a white-label software product which simply means that it’s well-documented and built to be altered, re-branded, and re-packaged: one’s very own, online, public and / or private poker room(s). Because it’s peer-to-peer there’s basically no extra hardware or services to invest in (a website is entirely optional), and because the it’s open-source the software is free. I’m sure that there are people out there who would still find a way to complain about the $0 price tag but in all fairness those people are dumb.

This is the second iteration of the project and it uses JavaScript, the popular programming language of web browsers. There’s a bunch of JavaScript behind the scenes right here at TCL too; it’s what makes websites do stuff instead of just sitting there.

But it doesn’t matter if you know anything about JavaScript because I wrote the thing to be used, not (necessarily) admired for its programming elegance.

You can use CypherPoker.JS right in your web browser or you can download an installer for Windows and play that way. Linux and macOS are also supported but since I don’t have any extra computers lying around that run those operating systems you’d need to build the software by hand using my Do-It-Yourself in 5 easy steps! guide.

No Bitcoin? No problem! Just select the “testnet” version of the cryptocurrency for a 100% free alternative.

I mean, really, at this point you have no excuses to not try it out.


I usually do a lengthier post on Medium detailing each new version and in the most recent one I eulogize a dearly departed friend (hence the bracketed homage).

There’s also a dedicated subreddit where you can ask questions or post comments. I love chatting about the project so I promise that there’s literally no question / comment too basic that you could post and that I wouldn’t happily and courteously answer.

Finally, there’s a GitHub repository where the actual project lives:

https://github.com/monicanagent/cypherpoker.js

It comes with a nifty project board where I visually organize the project’s progress:

https://github.com/monicanagent/cypherpoker.js/projects/1

Everything on this board comes from a master list of bugs / tasks:

https://github.com/monicanagent/cypherpoker.js/issues

… which are organized in dated milestones:

https://github.com/monicanagent/cypherpoker.js/milestones

Once a milestone is complete I update the web demo:

https://monicanagent.github.io/cypherpoker.js/demo/web/

… and I add download links for the desktop version of the software:

https://github.com/monicanagent/cypherpoker.js/releases

So, other than the nice pictures and witty prose, is there any reason why you’re still here?

Filed under: Dispatches, Patrick Bay

Orphans must be killed

Posted on January 27th, 2010 6 Comments

It’s done, dear reader!

I’ve signed on the dotted line and am now the proud new Senior Flash Developer at Henderson Bas, a downtown ad agency with a bunch of famous clients and awards coming out the wazoo. I normally wouldn’t mention their name but, being so out there, I don’t think they’re averse to being discussed. I’ll just have to refrain from talking too much smack.

The contract was a gargantuan tome, one of the largest volumes I’d ever encountered. A whole adult tree made up just the non-disclosure agreement alone, the rest had to be delivered by freight train. So it’s pretty thorough. I’m fairly certain I’ll have to relinquish my spleen upon termination, but that’s a pretty standard clause. Otherwise, I’ll be slapping stuff together for HB come Monday; incidentally also my birthday (I know, right?)

In the same way that I won’t talk smack about HB, I’m not going to go into the gruesome details of why I left my current position. Let’s just say that there were some … issues.

… Continue Reading

Filed under: B Sides, Pictures

Son of yesterday

Posted on December 19th, 2009 6 Comments

At the company party last week, a fairly new employee (a superfluous fourth nipple of a teenager, the son of the third nipple, my supervisor), asked me, “Why would anyone want to learn to program Flash?”,  or something to that effect. The “why would anyone” part stuck with me as a particularly brazen thing to say coming from a kid who doesn’t know an object from a pointer. That’s programmer lingo for he’s wet behind the ears, the little shit.

And as I told him, I grew tired of all the low-level nonsense that his pop still likes to muck around in. It’s unseemly. I mean, I’ve done it too – every good programmer should rip apart their computer in every which way. But I put aside childish things when I decided to actually get some work done. Seriously, it’s like going back to the frickin’ Stone Age.

I like Flash because there’s a big creative aspect to it – half of the software is geared specifically for drawing and animation. Programming is fun, don’t get me wrong, but staring at computer instructions all day kinda sucks. It’s nice to work in a  piece of software where I can also draw a doodle of the CTO, animate it in some obscene way, add programming to it for interactive fun, and email it to friendly coworkers. And it all looks like legitimate work.

But the reason I brought all of this up wasn’t to go over my portfolio. This situation jumped to mind while I was strolling home and listening to Spark, a CBC Radio podcast about technology. That Zune that you see in the TCL header has a number of ultra-geeked-out podcasts on regular rotation but Spark stands out from the crowd; it looks at the human implications of gadgets and websites rather than the gadgets and websites themselves.

The episode I was listening to, for example, was going into detail about how to operate the iPhone (curse Apple!), with gloved hands. The touch-screen requires human flesh (not my word), to maintain a certain level of conductivity – to operate the phone, in other words. Gloves act as insulators, so the iPhone’s a brick with winter gear on (Ha! I can operate my Windows Mobile phone with mitts and a toque!) In the episode they came up with the solution of sewing some conductive thread through the tips of the glove; not that it’ll affect me directly but it’s neat to see someone thinking about this. After all, in Canada it’s a genuine problem for half the year, and I don’t see Apple using their “genius” to solve the problem. I don’t like Apple.

Nora Young, Spark’s host, has that perfect mix of nerdy affinity and enthusiasm for what technology could be. In fact, all of the podcasts I listen to are done by folks why have genuine interest and enthusiasm in the subject matter, and the fact that some of them are learning as they go along makes the shows accessible. Plus, the topics are approached from an angle that most in the industry wouldn’t think to consider. The third and fourth nipples sure wouldn’t.

Obviously, creativity counts for a lot with me. So when I found the advertisement for Wind Mobile on King Street, I was impressed:

wind mobile, statue, advertisement, king street west, construction, bell lightbox building, toronto, city, life

Yes, the ad is the statue. Already intriguing, no? I stooped over to read the plaque, took a few pictures, even had a brief conversation with a passing girl who happened to be editing a video for some Wind Mobile spot – talk about effective advertising! The thing that really struck me was that this particular campaign doesn’t rely on flashing lights and loud noises, it just stands politely to the side and invites your attention. Well.

Unfortunately, Wind needs a new copywriter – the statue idea is absolutely brilliant but the plaque makes an unkind insinuation:

wind mobile, statue, advertisement, king street west, construction, bell lightbox building, toronto, city, life

It reads:

The statue commemorates Flippy, Mr Ideas, FlowerGal and the thousands of other Canadians who rose up against an unresponsive mobile industry. It was upon the immortal thoughts of this community – who made proclamations like, “No contracts… do this and I will be your customer forever,” and, “it would be nice to NOT have limits” – that a movement was born. Their brave ideas gave rise to the dialogue which gave rise to Wind Mobile – the first wireless company to be led by the people and a testament to the truth that conversations always make things better. WINDMobile.ca

WIND
the power of conversation

The insinuation is that I will be Wind’s bitch if only they would do away with contracts. Not likely. Plus, if I don’t like contracts, I’m probably not going to commit to “forever”. But their putting statues on street corners (there’s another at University and Richmond), if nothing else, indicates a level of creativity that’s lacking in the older carriers. Here’s how Rogers tries to snag my business:

rogers, advertisement, pamphlet, toronto, city, life

Granted this is for the cable TV and internet packages that Rogers offers, but it’s still pretty pathetic. A sad kid and a teddy bear — “We miss you”; I can’t imagine giving less of a toss. And while it’s rare that I buy something without going deep into technical specs, I consider a company’s advertising campaign to be a part of that specification. It doesn’t necessarily mean that the company or its products are currently any good, but at least they’re thinking (or at least willing to think), differently. Many companies claim to do this but few actually do.

Asking why anyone would want to learn to program in Flash is basically the same as asking why anyone would want to broaden their horizons. It’s kinda sad to hear a student ask that question, and especially in a mocking way. He’ll end up at the Rogers of the world, hopelessly out-of-date  before he even graduates, and the real world doesn’t take kindly to inflexible youngsters. I know I won’t, the little shit.

Filed under: B Sides, Pictures

Good names

Posted on May 8th, 2009 Comments Off on Good names

Folks, I’m gonna geek out on you today. I’m gonna geek out on you long and hard. Grab onto the headboard ‘cuz here it is:

scrum

Got that in the mail yesterday.

Despite the fact that  I know what it is, I still wouldn’t enter that room without some Scrum repellent. It sounds absolutely ghastly, doesn’t it?

Couple that with a master — don’t even separate the m‘s so that you force the speaker to chew that mouldy cud in the middle of the word: ScrummmmmmmmmMaster.

Blech.

Maybe I should explain why I’m holding that letter up.

Used to be that software was a product. You’d be given a specification, the client would agree to it, and you’d build it. Anything outside of spec would be in the next release. “Sorry, Larry, that dildo Easter egg is gonna have to wait ’till version 1.1.”

Now the spec has been replaced with a scope document. It outlines in general, vague terms what the software application should “feel” like and how hard the user’s erection should be when using it. That is, if your company actually cares enough to make one.

Usually it’s just a two line paragraph describing how nice it would be to now have credit card processing as part of the software. Security – you know, like keeping your credit card details safe via encryption and such – didn’t make it to the document. Seems like that would’ve been a good area to explore.

We’re given two weeks and…WE’RE OFF!

This is where experience walks through the door, pats me on the back, and says, “Easy, buddy. Not like this has ever happened before, is it?”

“That’s right”, I answer, “my anus has almost healed too. Thanks for reminding me.”

That’s right. And Agile techniques like Scrum (but not Scrum because that’s nasty), saved my ass from further devastation. Agile sounds fancy but it’s nothing more than a way to plan work so that stuff can easily be moved around, added, or removed. How to plan for a moving target, in other words.

Could be useful in all sorts of industries, I bet.

God, if only it didn’t have such an awful, awful name because I’m sure it could be a saving grace for so many out there who are suffering.

You see, I too have been blessed by the touch of Agile development. My software is built using building blocks not unlike Lego. You can pull pieces off and reattach them elsewhere and have the whole thing pretty much stay intact. All part of the plan.

With standard development, the program is like some horrible, angular mass of flesh, teeth, and hair; a single horrible eyeball jutting out of the slimy folds as a gurgling scream emanates from somewhere inside. And it’s Satanic.

I trust I’ve illustrated that well.

And speaking of ugly, how about that Scrummmmmaster? That pile of terrifying anthropomorphic goo is what I envisage when I hear that word. And you know what? Your own deformed, horrid vision of what a Scrum is, is perfectly valid. I mean it; it’s all things nasty and your nasty is just as valid as mine.

It’s just gross.

I may be a programmer, but there is no way I’m learning how to certifiably master Scrum of any kind. Seriously, the developer community needs a marketing make-over. Maybe some of the stuff developers have been doing could help others, but only if the concept doesn’t make them retch first.

Let’s start with good names for things.

Like byte. Good word.

With half a byte, you only have a nybble. And, when you split a nybble into four, all you really have are just four little bits.

You can use that one around the water cooler next week.

Okay, geek done.

Ummm, I gotta be up early tomorrow so…yeah…I’ll call ya later.

Filed under: B Sides, Pictures