How to transfer from The DAO to an exchange with geth

Assumption: You have geth on Linux, some DAO tokens, and access to the account you bought the DAO tokens with.

First, you need The DAO’s contract ABI. This is the interface definition that allows you to interact with The DAO contract in the blockchain. Here it is in a gist. It’s long.

Cut and paste all of that and then type this in geth to set it to a variable:

> var abi = <paste it here, no outer quotes necessary>;

The ABI tells geth how to make sense of the bytecode at an address in the blockchain. With it, you can use the “eth.contract” method of web3 to interact with the DAO contract at its address:

> var daoContract = web3.eth.contract(abi).at(“0xbb9bc244d798123fde783fcc1c72d3bb8c189413″);

Now you can execute all the methods The DAO contract supports. How about checking your balance?

> contract.balanceOf(eth.coinbase);


> contract.balanceOf(“0xabc123…”);

Divide this number by 1 x 10^16 to get the DAO token total in its “natural” denomination. For me:

> contract.balanceOf(eth.accounts[1]);
> contract.balanceOf(eth.accounts[1])/10000000000000000;

At the time of this writing, I have 8000 DAO tokens.

Checking your balance is a “constant” method, (as you can see from the ABI) which means it reads from the blockchain and costs no gas to execute.

Transferring a balance, however, changes the state of the blockchain and requires a small gas payment. BUT FIRST! We need the exchange address to send it to. In Poloniex, it’s under “Balances” and “Deposits and Withdrawals”. Find DAO and get a deposit address.

Now here’s the transfer execution command  (This will transfer 2000 DAO tokens to a polo address from my second ETH account):

contract.transfer(“0xaaaaaaaa-PoloDepositAddress-aaaaaaa”, 20000000000000000000, {from:eth.accounts[1]});

And there you go. Hope this helps.

Ethereum 101 Meetup in NYC 5/4 @ 6 pm


Hey everyone. I’m going to be hosting an Ethereum 101 meetup at Work Market HQ on May 4th at 6pm. Topics:

  • What is Ethereum? What is it good for?
  • How do I buy Ethers? (Using Mist included)
  • How do I mine Ethers?
  • What are smart contracts? What are some examples?
  • How do I get started programming smart contracts?
  • QA
  • Tour of Etheria,

The skinny:

  • Who: Anyone curious about or interested in Ethereum
  • When: May 4th at 6pm
  • Where: Work Market HQ, 240 W 37th St, New York, NY 10018, 9th floor
  • How long: No more than 2 hours

There’s no ticketing system. Just arrive before 6pm and come to the 9th floor.

See you there!


Etheria 1.1 deployed

I’ve copied Etheria’s state (minus blocks) to a new contract and deployed it to address: 0xb21f8684f23dbb1008508b4de91a0aaedebdb7e4


  1. Added bounce-money fallback
  2. Added a withdrawal method for random funds sent to the contract
  3. Changed whathappened code integer to a string. Much better.
  4. Created a way to change only the color of a block without moving it.
  5. Removed the “offer” system in favor of a setOwner() method which can be called by escrow-like trustless contracts outside Etheria.
  6. Cut the number of blocks from 32 down to 18. All block orientations match the 6 edges of the tiles.
  7. Now, when farming, you specify which type you want and get 10 of them. (vs 20 random ones previously)
  8. I did NOT fix the block placement suboptimalness. It’s too computationally intensive. Let’s see who can figure out what it is.

All ownership has been preserved.

Also note, as said previously, as I create superimposing versions of Etheria, my aim is to never dilute current ownership. I believe that if 4x the amount of land is created in a future version, current owners should be granted 4x more land. I don’t want to ever create new, unowned land.

Let me know if you have any questions.

Refunded money to first tile buyers

I refunded 1 ETH each to the following accounts from 0xcf684dfb8304729355b58315e8019b1aa2ad1bac:

13,17 0xa2e85113f9d7f452d7c638475bdf82c58306c26f
15,15 0xc0bd5afc3dbd7affef40a8d6a7921bbefb3bcdb2
17,11 0x0d82cd113dc35ddda93f38166cd5cde8b88e36a1
22,6 0x8f5fc1b505d77a04bd2608fff9884ac3ebd87f20
27,21 0x2c5d052fbca80684539eb58b626f21f633f00117

Some of these bought more than 1 tile, so I just refunded the first.

Note: This is not due to a bug or anything wrong with Etheria. I offered refunds because I wanted folks to try the game. The only reason tiles cost 1 ETH in the first place was to prevent someone from buying them all just to mess with me.

Things I need to implement for Etheria 1.1

Preface: “But wait, how can there be an Etheria 1.1 if Etheria 1 can’t be shut down?”

I’ve given this quite a bit of thought, and I think I’ll just announce a state snapshot time, tell everyone when it’s coming, then migrate that state to the new Etheria. Etheria 1 will continue to live on and although owners will own identical tiles in both worlds at first, they’ll be forever distinct moving forward. That is, I could sell my tile (15,9) in Etheria 1, but keep it in Etheria 1.1. If people want to disregard my upgrades and continue to play in the previous Etheria, that’s up to them. (Note, this also means that the original Etheria map will continue to live on through versions, even if new land is created.)

Also, I guess it should be stated now that I consider participation in Etheria 1 a purchase of “stock” in all versions of Etheria moving forward. And not only should ownership transfer forward, no “extra” ownership will ever be created. So let’s say a future Etheria is 4x bigger in land mass. I believe current owners of Etheria should be granted 3x more (in addition to their 1x current) tiles.

In other words, I’ll never create new “unowned” land or dilute current owners. The owners who own a % of Etheria should count on that % staying static through Etheria upgrades/versions.

Things I need to implement for Etheria 1.1

ONE – A “withdraw” method for the creator.

In the interest of true decentralization — and to stress that I didn’t build Etheria for profit — I did not include a “withdraw” method. ATM, there are 2 Ether (UPD: now 4) sitting on the contract and I don’t know where they came from. Did someone enter a method name incorrectly? Is there a bug?

Either way, I’d like to be able to offer a refund. But I can’t, because that money is gone forever.

TWO – A fallback method

Every contract needs to have a fallback bounce-their-money method just in case someone sends ether to the contract and without a clearly-defined way to use it.

THREE – Better error messages

etheria.getWhatHappened() is really useful, but it could be better. Maybe return a string? Or make it unique to each tile? Or both?

FOUR – A dedicated “changeColor()” method

In order to change the color of a block now, you have to “editBlock” it. The problem is that editBlock has to check for placement conflicts and the cheapest way to do that (gas-wise) is to leave the block where it is when checking for conflicts. That is, if you change the color of a block in place, it’ll count as a conflict. You have to move it out of the way, then change the color as you’re moving it back. Kinda sucks. It should be really easy to implement a change color method if the x/y/z are the same as before. And less gas-intensive.

FIVE – Only good blocks

Curved arches suck. SUCK SUCK SUCK. Arches, in general, suck since you can easily make an arch with normal columns and beams. The point is, when you farm a tile, you should only get stuff you want to use. Maybe the user could even specify which blocks they want? The problem with random block assignment is waste. I have 280 blocks on my tile and use like 25% of them.

SIX – 4 orientations only

This is a bit like the previous, but edges in Etheria have only 4 orientations: horizontal, vertical and both diagonals (the “snake” blocks run in those directions). The block definitions contain beams that aren’t any of these and while not completely useless, they’re somewhat “in the way” when you’d prefer better blocks.

SEVEN – Fix the block placement bug

There is a block placement bug. Nothing major and it won’t break the “game”, but it bothers me. I’m not going to tell what it is here because I don’t want people to do it. But I’d like to fix it.

(EIGHT – Tile editor

This is in parentheses because it’s not part of the Etheria contract itself. But building stuff is very painstaking right now. It would be great for a user to be able to drag, drop and color all their tiles the way they want them in a 3D editor, then get a printout of all the commands they need to execute to make it happen.)

Ethereum’s open source + open execution = big deal

A couple of years ago, I built a Chrome extension called Words For Chrome.


It was a commenting application that would keep independent comment threads across the web based on URLs. It was supposed to be a single commenting ecosystem which required only 1 login, maintained web-wide reputation, and was impervious to censorship, hopefully leading to a better commenting experience for everyone.

You can probably already guess where this went wrong.

First off, the web is very big. Even with hundreds of users commenting like mad, 99.9999999% of sites would have no comments. There was a big initial ghost-town-effect hurdle to cross.

Second, and the point of this post, is that asking users to install an application that reads their real-time browsing habits is a very big, creepy ask requiring a big, probably stupid leap-of-faith on their parts. Heck, I was creeped out myself, and I wrote it!

To get around this fear, I opened up not only the frontend code (all Chrome extension code is viewable in the working directory anyway) but the backend code as well. I pointed to it and said “Hey, look. Yes the backend does accept your URLs but it’s all over HTTPS and they’re discarded immediately.”

The problem with this is that it was impossible for me to prove to users that the backend code I open-sourced was ALSO the code actually running on the server.

This is where Ethereum could be a game-changer. With an Ethereum Dapp, the publisher can prove that not only is the source code open, but because the execution environment is also open, can prove that the running app actually matches the source code.

Let that sink in for a second. Revolutionary stuff.

In other words, if Words for Chrome had been a Dapp, I could have proved that no URLs were ever being recorded.

I guess this has been said before in different ways. When someone creates a gambling contract and says “it’s provably fair”, this is exactly what they mean. You can see the code, but you can also be sure it’s the same code being executed. I just thought it was worth providing another example of how provable execution might be applied in the real world.

I hooked up a Raspberry Pi + camera to capture birds at my birdfeeders

I ordered a Raspberry Pi kit a couple of weeks ago for a work project, then realized after it arrived that it wasn’t going to be feasible. Yesterday, I looked over at it, sitting unused on a desk and thought, “Well that was a waste of $70. What else could I do with it?”

So I decided to rig it up outside next to my birdfeeders and try to capture some cool pictures. Here were my specifications:

  • Close enough to get good shots.
  • Within extension-cord range.
  • Within WiFi range.
  • Rain & dew proof.
  • No additional cost beyond the kit.
  • Able to retrieve shots from smartphone (i.e. the shots must be made public (to the local network) and served somehow).
  • One shot every X seconds where X is fast enough to capture almost all visiting birds but slow enough not to fill the micro SD card too fast.

The lay of the land. The white tomato pole was at the perfect distance to both feeders. The angle wasn’t bad either as they did not form a perfectly straight line, as it may look from this picture.IMG_20150824_084559

Closeup of the tomato pole (or stake or whatever. I’m not a farmer.) IMG_20150824_084553

Pole with Pi and camera attached. I’m glad I bought the Lego-compatible camera housing. Also, this is the first appearance of duct tape and there will be much more to come. Yes, I did feel like a redneck while using it, thank you very much.IMG_20150824_084420

Camera duct-taped into place. Getting the angle right (towards the feeders) was actually easier than I thought it would be. I tore a hole in the tape for the camera lens.IMG_20150824_084332

Closeup of the wifi dongle.IMG_20150824_084326

Power attached.IMG_20150824_084232


Power adapter and extension cord taped up higher so they’d fit under the rain hood.IMG_20150824_084139


Rain/dew hood installed. I found a big plastic burgoo (look it up) container in the garage, cut the top off and made a window.IMG_20150824_084006

Rear view of the rain/dew hood. I took a garden wire marker (the type with the yellow/orange flags) and bent it in half, poked it through the container, then taped it to the pole.IMG_20150824_083953

Reverse of The Shot.


And now for the big letdown. The camera I bought is the NoIR filter type. This means that while it captures some IR wavelengths, it causes normal color pictures to be washed out. Womp womp. I should have thought of/tested that earlier.  I used the “raspistill” program with default options to capture this.hello

Even though the images were crappy, I went ahead and set up the software part, too.

  1. Installed Apache on the Pi.
  2. Created a bash script to capture images with timestamp.
  3. Edited crontab to take 1 picture every 10 seconds.

Bash script (“raspistillplusdate”):


DATE=$(date +”%Y-%m-%d_%H%M%S”)

raspistill -w 1296 -h 972 -o /var/www/$DATE.jpg


* * * * * sudo /home/pi/raspistillplusdate
* * * * * (sleep 10 ; sudo /home/pi/raspistillplusdate)
* * * * * (sleep 20 ; sudo /home/pi/raspistillplusdate)
* * * * * (sleep 30 ; sudo /home/pi/raspistillplusdate)
* * * * * (sleep 40 ; sudo /home/pi/raspistillplusdate)
* * * * * (sleep 50 ; sudo /home/pi/raspistillplusdate)

Then, to view the images, all I had to do was visit from my phone which provided a directory listing of all the images in /var/www. In order to make the most recent appear at the top, I had to include the directive “IndexOrderDefault Descending Date” in my Apache config.

The whole project took me about an hour and I’m under no illusion that any great engineering skill was required. I just thought it might be interesting to share anyway. It’s pretty amazing how easy and inexpensive it is to do this kind of stuff with the Raspberry Pi platform.

Sorry I didn’t include any bird pictures. I captured some, but deleted them (because they sucked, see above) before deciding to tear it all down and create this post.

I hope you enjoyed it even though it was a big fail.

I’m a web developer, sales engineer, entrepreneur and general tinkerer looking for something interesting/rewarding to do full-time, especially in NYC. Drop me a line at c@mailcyr at the United States TLD. 

PSA: Your deleted Hacker News comments are readable

I built a Chrome extension for Hacker News called Hackbook. One of its features is that it displays all deleted comments by default.


The ability to record all incoming comments and store them before deletion is a consequence of the new(-ish) Hacker News API and is easily accomplished by any application listening to the API’s Firebase endpoint. Heck, I even wrote instructions about how to set  up such a listener.

I just thought folks might want to know.

How to setup a GoDaddy SSL-enabled Tomcat server on Ubuntu 14.04

Ok, so the title mentions some specific services and technologies, namely GoDaddy, Tomcat and Ubuntu 14.04. That’s what I used, so that’s how I’ll describe it here. If you’re using something slightly different, maybe you can still glean some useful information from this.

First, purchase the SSL certificate from GoDaddy.

Next, log in to the server you want to run Tomcat on and create a key pair (public/private keys aka private key + certificate) using keytool. This key pair will be used to generate a certificate signing request that we’ll give to GoDaddy to make our certificate. keytool is a tool for creating keys (duh) but it also acts like a keyring to store several keys in one “keystore” file. In this instance, you’ll want to make sure you create your keystore file in PKCS12 format so we can export the private key. You might be able to export the private key using other formats, but I didn’t explore that, so just follow these instructions. The following command will ask for a password, so remember it. Also, as of this writing, for some strange reason, you need to enter the desired hostname “” when prompted for First Name and Last Name. No, this does not make any fucking sense. Don’t ask me to explain.

keytool -keysize 2048 -genkey -alias tomcat -keyalg RSA -keystore
tomcat.keystore -storetype PKCS12

The above command says, “Create a key pair of string 2048 with the alias ‘tomcat’ using the algorithm RSA and put it in the keyring ‘tomcat.keystore’ (in this directory) with the PKCS12 format.”

To export the private key in unencrypted format:

openssl pkcs12 -in tomcat.keystore -nodes -nocerts -out

Note that this file has a built-in password (the same you used for the keystore file) and for some systems (e.g. Amazon AWS), need you to remove the password before upload. To get the same private key without a password attached do this:

openssl rsa -in private-key_withpass.pem -out private-key_nopass.pem

Now we’re ready to create the CSR for GoDaddy:

keytool -certreq -keyalg RSA -alias tomcat -file csr.csr -keystore

Paste the CSR data (from csr.csr) into the GoDaddy certificate creation text input. (Other services should provide something similar.) Once the certificate is ready, download the zip file and unpack it on your instance. It contains your certificate (<serialnumber>.crt) and some GoDaddy root certs (gd_bundle-g2-g1.crt and gdig2.crt).

AWS side note (why not?): To use your certificate with AWS (assuming you’re doing this on an AWS instance), you have to use their “iam-servercertupload” command (which comes with any Amazon Linux instance). Here’s how you’d upload the certificate you created:

iam-servercertupload -b serialnumbered.crt -c gd_bundle-g2-g1.crt -k
private-key_nopass.pem -s whateveryouwanttonameit --aws-credential-file

See elsewhere for the format of the AWS credential file.

Back to Tomcat: It appears that Tomcat has issues with the PKCS12-formatted keystore and, instead, wants the JKS type. To convert the keystore you’ve created, do this:

keytool -importkeystore -srcstoretype PKCS12 -srckeystore
tomcat.keystore -destkeystore tomcat.keystore.jks -deststoretype JKS

Once that’s complete, add both the GoDaddy chain cert and the serialnumbered.crt to the new keystore like so:

keytool -import -alias rootbundle -keystore tomcat.keystore.jks
-trustcacerts -file gd_bundle-g2-g1.crt
keytool -import -alias tomcat -keystore tomcat.keystore.jks
-trustcacerts -file serialnumbered.crt

Now it’s time to edit your Tomcat server.xml. If you are running Tomcat as a standalone (without apache2/httpd) and want it to run on ports 80 (nonsecure) and 443 (secure) (where apache2/httpd usually runs), rather than the default 8080/8443, change your connector values to use 80 and 443.

<Connector port=”80″ protocol=”HTTP/1.1″
redirectPort=”443″ />


port=”443″ maxThreads=”200″
SSLEnabled=”true” scheme=”https” secure=”true”
keystoreFile=”/pathtoyourkeystorefile/tomcat.keystore.jks” keystorePass=”whateverpasswordyoucreated”
clientAuth=”false” sslProtocol=”TLS” />

And that should be it. Here’s a trick you can use to test your SSL cert on Tomcat if it’s currently deployed elsewhere. Let’s say you’ve already got a certificate already deployed elsewhere and you’ve just created this new cert for deployment to this Tomcat server. If you visit the new server at https://999.999.999.999, you’re going to get a certificate error.

To trick your local computer into thinking 999.999.999.999 is actually, edit your /etc/hosts file and add a line that says: “999.999.999.999”.

Now when you visit, you’ll be hitting the new server at 999.999.999.999 and should not get any certificate errors if everything is correct.

Enjoy! I hope this helps!