Skip to main content

Merkel ist doch eine prima Königin. Hält die Klappe, trägt huldvoll scheussliche Klamotten und mischt sich nicht in die Politik ein.
https://twitter.com/Goldspielzeug/status/594786796808044544

Leute, jetzt bloß nicht zulassen, dass das jetzt alles am de hängen bleibt und wieder im Hintergrund bleibt! o_0

On use of cars: "I think we will look back on this time and say, ‘Wasn’t it odd that we drove ourselves around?’"
http://gu.com/p/47m7d/sbl

Wenn ich ansehe habe ich Angst vor der alternativen Realität, in der noch Nachrichten macht o_0
http://ur1.ca/k907x

Programmer: "We can safely assume that interest rates are always a positive number."
Along comes Europe: http://www.wsj.com/articles/as-interest-benchmarks-go-negative-banks-may-have-to-pay-borrowers-1428939338
:D

Awwww.... A good reason to earn the right to upvote comments:
http://unix.stackexchange.com/questions/12107#comment16365_12146

My new baseline for connection quality: Does it let me ssh+screen+vim?
Suffice to say mine doesn't meet this criterion :(

AAAAAAAARRRGH!!!!1!
WHO THE FUCK PUBLISHES A DATASET WITH '(', ')' and '#' in the filenames!?!
Faith in humanity lost... :(

"Capitalize all words in titles of publications and documents, except a, an, the, at, by, for, in, of, on, to, up, and, as, but, it, or, and nor."
Well, that's a handy rule :)
https://www.youtube.com/watch?v=ab8GtuPdrUQ

Biking madness in Grenoble

Biking madness in Grenoble

Just found three or four places like this one while going to Grenoble Gare. You follow the bicycle lane, and suddenly you are in a one way street. And no, not one that's marked bidirectional for bikes... o0

Via fefe: Eine Erinnerung, warum wir in Deutschland auch weiterhin einen Widerstandsparagrafen brauchen.
http://blog.fefe.de/?ts=aa115e55

A Quick Note on Twister's Blocks

6 min read

This is just a quick note about what the blockchain does and does not store.

Disclaimer

I didn't write this software, and I am mostly trying to make sense of it myself at the moment. So if you find things that are unclear, incomplete or plain wrong, please tell me!

The "what is not in the blockchain?" part is easy: anything that does not relate to user names, public keys, the spam messages or the blockchain itself lives outside the blockchain. Profiles and twists are stored in a Distributed Hash Table (DHT) and the twists also in a torrent swarm. This is because storing all twists in the chain, although possible, would not scale. A block chain is relatively slow, and more importantly, all nodes of the network would have to download and store all twists ever made.

So what does the chain store, concretely? You can find out by running some simple commands for your local twister daemon:

Let's get a random block from the chain:

$ ./twisterd getblockhash  71772
70b7f1bb37eb72d587f45457c5c0c0bdadd206f0115f66787d8565761688bd1d

$ ./twisterd getblock  70b7f1bb37eb72d587f45457c5c0c0bdadd206f0115f66787d8565761688bd1d
{
    "hash" : "70b7f1bb37eb72d587f45457c5c0c0bdadd206f0115f66787d8565761688bd1d",
    "confirmations" : 38,
    "size" : 361,
    "height" : 71772,
    "version" : 2,
    "merkleroot" : "ba8dd4de438b296fe16f619f16a988700f1161fbba3fefadef7df14964823c7b",
    "tx" : [
        "1cd83cd3c6d4bc41099cc57bf592f2ce91470d09f364b5dda49c828474e2bcb9",
        "0000001ba539c9045a906a8efe4b1fdbe916b925098cc58be422060e987df636"
    ],
    "spamMessage" : "Promoted posts are needed to run the network infrastructure. If you want to help, start generating blocks and advertise. [en]",
    "spamUser" : "brunus",
    "userhashes" : [
        "6756f780590a51b6857104268c58c331b432b3d17290dbabd496c7f95c1033b0"
    ],
    "usernames" : [
        "kwofu"
    ],
    "time" : 1422554853,
    "nonce" : 4700834,
    "bits" : "1d429ed8",
    "difficulty" : 0.01501017,
    "previousblockhash" : "6d36ace676ce6a8e600f31fa743eef7e96110c3713d9736f138cd864a9fa7c88",
    "nextblockhash" : "8da5a51cf66ee39e0fb98dd5b137a19ec143d80e085083317c96e4ff36e8d149"
}

This is a human-readable representation of a block as it is stored in the blockchain. The non-readable version is this:

$ ./twisterd getblock  70b7f1bb37eb72d587f45457c5c0c0bdadd206f0115f66787d8565761688bd1d false

020000005c180100887cfaa964d88c136f73d913370c11967eef3e74fa310f608e6ace76e6ac366d7b3c826449f17defadef3fbafb61110f7088a9169f616fe16f298b43ded48dbae576ca54d89e421da2ba470002010000007f4c7d50726f6d6f74656420706f73747320617265206e656564656420746f2072756e20746865206e6574776f726b20696e6672617374727563747572652e20496620796f752077616e7420746f2068656c702c2073746172742067656e65726174696e6720626c6f636b7320616e64206164766572746973652e205b656e5d4e066272756e7573411fe3902beb204364ffc5d89c6fec2bed2a13c6debeec22893fb088431dc426c8e164f42035c93c6de03b20f96cf86dfb0676e8c50b8cc83b94479e98a9685f2b7504997271c3090102062f503253482f00000000010000000006056b776f6675222103fccd1d6050f2abb9b8ece690672720600afccd553dfeb0dd23587d02601928a417033e00

Let's stick with the readable version... :)

Most of what you see here are things that take care of the blockchain itself. For example:

  • blockhash identifies this block
  • previousblockhash links it to its predecessor (hence the name "blockchain"
  • difficulty controls how many values for nonce need to be tried to generate a block. It gets adjusted automatically as a function of the timestamps in the chain.

While this is all very fascinating, it is nothing specific to the Twister blockchain. In fact, the only thing in which Twister significantly differs from the bitcoin chain is what the transactions (or short: tx) contain and what the miner gets for the mining.

Now, the transactions in Twister don't say "Alice just sent Bob 0.001 BTC" as they do for Bitcoin. Rather they tell the Twister daemon who registered and what public key they are using. So in block 71772 the user kwofu registered and that got recorded in the blockchain.

$ ./twisterd getrawtransaction kwofu 1

{
    "hex" : "010000000006056b776f6675222103fccd1d6050f2abb9b8ece690672720600afccd553dfeb0dd23587d02601928a417033e00",
    "txid" : "6756f780590a51b6857104268c58c331b432b3d17290dbabd496c7f95c1033b0",
    "version" : 1,
    "mess   age" : "",
    "username" : "kwofu",
    "pubKey" : [
        "03fccd1d6050f2abb9b8ece690672720600afccd553dfeb0dd23587d02601928a4"
    ],
    "nonce" : 4064023,
    "blockhash" : "70b7f1bb37eb72d587f45457c5c0c0bdadd206f0115f66787d8565761688bd1d",
    "height" : 71772,
    "confirmations" : 44,
    "time" : 1422554853,
    "blocktime" : 1422554853
}

The hex field contains all the information we see here, just more in a more compact encoding. The txid uniquely identifies this particular transaction. height tells us which block this transaction is a part of. username and pubkey are the part that we are actually interested in. Having the username and public key linked together by putting them into one transaction allows us to check if a particular twist from kwofu is actually signed with kwofu's key. This is how Twister checks that nobody can pose as another user.

The mining part is fairly simple: a Bitcoin miner will get 1 BTC for successfully mining a block. A Twister miner gets to put their name and message into the block itself. Since these messages get stored on every daemon, they can be shown as advertisement to every user. The idea is that every server and every client application will at least show some of them so that mining will actually be an attractive advertising option. Or maybe some other solution will be found to the question of "Who keeps the Twister network running?" Who knows. Anyway, spam messages can either be posted by @nobody in which case the spam message will just be entered into the block by the miner and that's it. Or it can be posted in the name of an existing account. For the above block, that was @brunus.

{
    "txid" : "0000000000000000000000000000000000000000000000000000000000000000",
    "version" : 1,
    "message" : "Promoted posts are needed to run the network infrastructure. If you want to help, start generating blocks and advertise. [en]",
    "username" : "brunus",
    "pubKey" : [
        "02",
        "2f503253482f"
    ],
    "nonce" : 0,
    "blockhash" : "70b7f1bb37eb72d587f45457c5c0c0bdadd206f0115f66787d8565761688bd1d",
    "height" : 71772,
    "confirmations" : 54,
    "time" : 1422554853,
    "blocktime" : 1422554853
}

Although I am not quite sure why that txid is always 0 for the spam transactions...

Anyway, hope this was interesting to someone else than me :P