Simple EOS Dev Environment

This is a beginner’s guide, to setup a simple development environment for the EOSIO blockchain, which will get you up and running in five simple steps from zero to your first smart contract in less than 10 minutes. Afterwards, you will know how to code and test your own smart contracts on an EOS testnet quickly and for free. In this guide we make use of simple tools, which offer a great developer experience, such as the eosio.cdt (Contract Development Toolkit), the Kylin testnet and the eosc command line wallet. We’re using a development machine, running the Ubuntu 18.04 operating system.

So let’s get started!

1. Account, Keys and Tokens

The Kylin Testnet, which is run by several high class block producers, allows easy and fast access to a (non-productive) EOSIO blockchain, using it’s free Account and Faucet services. We’re going to create a new EOS account (12 character name) on the testnet, including @owner and @active keypairs and charge it up with 100 dummy EOS tokens.

Let’s call our new EOS account: dummyaccount

curl http://faucet.cryptokylin.io/create_account?dummyaccount

{
  "msg": "succeeded",
  "keys": {
    "active_key": {
      "public": "EOS7kNBssiunoW7VGcx79BXGUvjbgcaPva4azRwhuTXRfJJ192DJ2",
      "private": "5J1SYvRP1JpWBtk85a4zAbXUmAyBqtr3r58hLuDF5YX6HdcfTYo"
    },
    "owner_key": {
      "public": "EOS6nUXrdodNwRspd7Z42Yp8nRH44wuJNYYoVHSMddr28KKS6Ke4J",
      "private": "5KQzVMR9sZ8sRmRb3NQEzyW43peUow6pYLo831AAXGyEZP7h77z"
    }
  },
  "account": "dummyaccount"
}

curl http://faucet.cryptokylin.io/get_token?dummyaccount

{ "msg": "succeeded" }

Save your @owner and @active keypairs somewhere safe, you’ll need them for the next steps.

2. Wallet and CLI

Next we will download and install the eosc command line wallet, by EOS Canada, in order to interact with the EOS blockchain (currently v1.1.0). This will help us to safely store our private keys and send transactions to the blockchain.

mkdir eosc && cd eosc
curl -LO https://github.com/eoscanada/eosc/releases/download/v1.1.0/eosc_1.1.0_linux_x86_64.tar.gz
tar xzvf ./eosc_1.1.0_linux_x86_64.tar.gz

Now we can use it to import our EOS account via the @active key. This will create a file, named eosc-vault.json, which will contain your encrypted private key.

./eosc vault create --import

- Paste your @active private key from above.
  5J1SYvRP1JpWBtk85a4zAbXUmAyBqtr3r58hLuDF5YX6HdcfTYo
- Hit ENTER.
- Choose a passphrase

3. Account Setup

Here we will issue three ./eosc commands, to setup our account for the deployment of a smart contract. We delegate 20 EOS tokens as blockchain resources (5 EOS staked for NET, 15 EOS staked for CPU) and use some more EOS tokens to buy 500 KiB of RAM as storage for our smart contract. Finally, we check our account with the eosc get account command.

Hint: We need approximately 10x the bytes of RAM as is the filesize of our WASM binary contract, due to the overhead of the virtual machine. So if our compiled contract file (e.g. hello.wasm) has a filesize of 10 KiB, we need approximately 100 KiB in RAM resources on the EOSIO blockchain, to deploy the contract.

./eosc -u https://kylin.eoscanada.com system delegatebw dummyaccount dummyaccount 5 15

./eosc -u https://kylin.eoscanada.com system buyrambytes dummyaccount dummyaccount 512000

./eosc -u https://kylin.eoscanada.com get account dummyaccount
privileged:   false
created at:   2018-11-15 14:45:25 +0000 UTC

permissions:
     "owner" w/1         :  +1 EOS6nUXrdodNwRspd7Z42Yp8nRH44wuJNYYoVHSMddr28KKS6Ke4J
           "active" w/1  :  +1 EOS7kNBssiunoW7VGcx79BXGUvjbgcaPva4azRwhuTXRfJJ192DJ2

memory:
      quota:           506.8  KB   used:           3.490  KB

net bandwidth:
      staked:              5.0000  EOS    (total stake delegated from account to self)
      delegated:           1.0000  EOS    (total stake delegated to account from others)
      used:                   257  bytes
      available:            11.18  MB
      limit:                11.18  MB

cpu bandwidth:
      staked:             15.0000  EOS  (total stake delegated from account to self)
      delegated:           1.0000  EOS  (total stake delegated to account from others)
      used:                 1.129  ms
      available:            807.2  ms
      limit:                808.3  ms

EOS balances:
      liquid:             67.8553  EOS
      staked:             20.0000  EOS
      unstaking:           0.0000  EOS
      total:              87.8553  EOS

voted for:
      

voter info:
      proxy:                
      is proxy:             false
      staked:               200000
      vote weight:          0.000000
      proxied vote weight:  0.000000

4. Contract Development Toolkit

Download and install the latest version of eosio.cdt (currently v1.4.1). This will give you access to the smart contract WASM and ABI compilers/generators, as well as to the eosio C/C++ libraries and header files. Get it at: https://github.com/EOSIO/eosio.cdt/releases

curl -LO https://github.com/EOSIO/eosio.cdt/releases/download/v1.4.1/eosio.cdt-1.4.1.x86_64.deb
sudo dpkg -i ./eosio.cdt-1.4.1.x86_64.deb

5. Compile and Deploy a Smart Contract

Let’s create a simple “Hello World” smart contract, by creating a file with the following contents, named hello.cpp:

#include <eosiolib/eosio.hpp>
#include <eosiolib/print.hpp>

using namespace eosio;

CONTRACT hello : public contract {
  public:
      using contract::contract;

      ACTION hi( name user ) {
         print( "Hello, ", name{user});
      }

      ACTION yo( name user ) {
         print( "Yo, ", name{user});
      }
};
EOSIO_DISPATCH( hello, (hi)(yo) )

This C++ file can now be compiled and deployed to the EOS blockchain, using the eosio.cdt Contract Development Toolkit. After compilation we will get a binary WASM file hello.wasm of about 2.3 KiB (needs ~23 KiB of eosio RAM) and a file named hello.abi, which describes the interface of our code’s actions.

eosio-cpp -o hello.wasm hello.cpp --abigen

./eosc -u https://kylin.eoscanada.com system setcontract dummyaccount ./hello.wasm ./hello.abi

./eosc -u https://kylin.eoscanada.com tx create dummyaccount yo '{"user":"bob"}' -p dummyaccount

Congratulations!

After finishing the five simple steps above, you can now officially call yourself a “Blockchain Expert”. 😉

Feel free to experiment with the above mentioned tools, keep on improving your EOSIO knowledge with help of the hyperlinks I put into the article and continue to develop you very own EOS smart contracts!

If you liked this tutorial, please consider a donation to my EOS account: teammaerdian

Freifunk mit Ubiquiti UniFi AP

Freifunk.net

Inhalt

Was ist Freifunk.net?

Die Initiative Freifunk.net ist ein nicht-komerzielles, gemeinschaftliches Projekt vieler Freiwilliger, die sich zum Ziel gesetzt haben ein unabhĂ€ngiges und dezentrales WLAN-Netzwerk aufzubauen, welches von Jederman frei zugĂ€nglich, unzensiert und anonym verwendet werden kann und außerdem die NetzneutralitĂ€t wahrt. Die Initiative ist dabei in lokalen Freifunk-Communities organisiert, welche in jeder grĂ¶ĂŸeren und kleineren Stadt anzutreffen sind.

Das Freifunk-Netz erstreckt sich bereits ĂŒber ganz Deutschland und wĂ€chst mit jedem UnterstĂŒtzer ein StĂŒckchen weiter. Ob auch in deiner NĂ€he schon ein Freifunk-Zugangspunkt ist, ĂŒber den du ohne Anmeldung einen freien Internet-Zugang bekommen kannst, erfĂ€hrst du auf der Freifunk-Karte!

Mitmachen darf jeder! Zum UnterstĂŒtzen der Idee tritt man am besten mit seiner lokalen Freifunk-Community in Kontakt. Dort kann man sich informieren und austauschen und im Regelfall auch einen eigenen, vorkonfigurierten Freifunk-Router ab 20€ beziehen. Schau also einfach vorbei, z.B. bei Freifunk-MĂŒnchen!

Freifunk verbindet!

Freifunk Technik

Freifunk ist als Mesh-Netzwerk konzipiert. Das bedeutet, dass sich benachbarte Freifunk-Router (Knoten) automatisch miteinander verbinden. Netzwerk-Pakete werden dann auf ihrem Weg vom Benutzer (z.B. Smartphone) von Knoten zu Knoten weitergeleitet bis sie ihr Ziel (z.B. Wikipedia) erreichen. Um auch in Situationen in denen keine benachbarten Freifunk-Knoten in Reichweite sind einen Zugang zum Freifunk-Netz zu bekommen, betreiben die Freifunk Communities VPN-Gateways. Isolierte Knoten können so ĂŒber den privaten Internetzugang des Knoten-Betreibers eine verschlĂŒsselte VPN-Verbindung zum restlichen Freifunk-Netz herstellen. Vom VPN-Gateway aus kann – ĂŒber eine Verbindung ins Ausland – auch das Internet erreicht werden. Auf diese Weise wird geschickt das rechtliche Problem der deutschen Störerhaftung umgangen.

Auf Freifunk-Routern lĂ€uft eine speziell angepasste Version der freien OpenWrt Firmware, namens Gluon. Gluon stellt dabei eine stark vereinfachte Web-OberflĂ€che bereit, welche zum Einrichten und Konfigurieren eines Freifunk-Knotens verwendet werden kann. Außerdem enthĂ€lt Gluon einen Autoupdater, welcher den eigenen Freifunk-Knoten immer automatisch auf den aktuellen Softwarestand updatet. FĂŒr erfahrene Benutzer gibt es zusĂ€tzlich die Möglichkeit sich per SSH auf dem Router einzuloggen, um den vollen Funktionsumfang von OpenWrt auszunutzen.

UnterstĂŒtzte Hardware

Durch die OpenWrt Basis der Freifunk Firmware “Gluon” gibt es eine breite Auswahl an unterstĂŒtzen Routern. Zu den gelĂ€ufigsten Modellen zĂ€hlen Router der Firmen TP-Link und Ubiquiti Networks. Welche Router im einzelnen unterstĂŒtzt werden erfĂ€hrt man auf der Website der lokalen Freifunk-Community. Wegen eines sehr guten Preis-Leistungs-VerhĂ€ltnisses (Preis < 20€) erfreut sich der Router “TP-Link TL-WR841N” zur Zeit sehr großer Beliebtheit.

Ubnt UniFi APIch habe mich fĂŒr meinen ersten Freifunk-Knoten fĂŒr das Modell “Ubiquiti UniFi AP Long Range” (Ubnt UAP-LR) entschieden. Dieser bietet eine sehr gute Reichweite von bis zu 180m, eine leichte Verkabelung dank Stromversorgung ĂŒber das Netzwerkkabel und wird offiziell von meiner Freifunk-Community (Freifunk-MĂŒnchen) unterstĂŒtzt. Die Freifunk Installation und Konfiguration dieses Routers möchte ich im folgenden exemplarisch fĂŒr “Freifunk-MĂŒnchen” erlĂ€utern.

UniFi Router flashen

Nach dem Auspacken und Anschließen des UniFi AP ans lokale Heim-Netzwerk bekommt dieser per DHCP automatisch eine IP-Adresse zugewiesen (<UAP-IP>), welche in der Web-OberflĂ€che des privaten Internet-Routers (z.B. FritzBox) nachgeschaut werden kann. Mit einem Linux-Computer erfolgt die Installation der Freifunk Firmware (Gluon) auf dem UniFi AP danach in 3 einfachen Schritten:

  1. Via SSH in die original Software des UAP einloggen:
    ssh ubnt@<UAP-IP> #(Passwort: ubnt)
  2. UniFi Factory-Firmware der lokalen Freifunk-Community ins /tmp Verzeichnis des Routers downloaden, z.B.:
    cd /tmp
    wget http://firmware.ffmuc.net/stable/factory/gluon-ffmuc-v2015.2-ubiquiti-unifi.bin
  3. Freifunk-Firmware auf den Router flashen:
    fwupdate.real -m gluon-ffmuc-v2015.2-ubiquiti-unifi.bin -d

Nachdem das Kommando ‘fwupdate.real’ erfolgreich ausgefĂŒhrt wurde, gibt es das Wort “Done” aus und der Router kann vom Strom-/Netzwerkkabel und vom Heim-Netzwerk (am PoE-Adapter) getrennt werden. (Quelle)

UniFi Router konfigurieren

Anstelle vom Heim-Netzwerk (z.B. FritzBox) sollte der Router jetzt direkt mit dem eigenen Computer verbunden werden. Nachdem das Strom-/Netzwerkkabel wieder angesteckt wurde startet der UniFi AP die neu installierte Freifunk-Firmware im Setup/Config-Mode. Alternativ erreicht man den Config-Mode durch drĂŒcken der Reset-Taste fĂŒr ca. 3 Sekunden. Den Config-Mode kann man daran erkennen, dass die grĂŒne LED des Routers blinkt (ca. 1x pro Sekunde).

Gluon Web UIIm Config-Mode hat der UAP die IP-Adresse 192.168.1.1 und betreibt einen DHCP-Server, so dass der eigene Computer automatisch eine IP-Adresse aus dem Bereich 192.168.1.x/24 zugewiesen bekommen sollte. Alternativ kann dem eigenen Computer auch manuell eine IP-Adresse aus diesem Bereich gegeben werden (z.B. 192.168.1.100). Steht die Verbindung zwischen Computer und Router, kann die Gluon Web-OberflÀche auf http://192.168.1.1 erreicht werden.

Die Gluon Web-OberflĂ€che stellt verschiedene Felder zum Konfigurieren des Knoten bereit (Name, Kontakt, Geo-Koordinaten, Bandbreitenlimitierung, …) und ist weitgehend selbsterklĂ€rend. Nach abschließen der Konfiguration muss der Router nochmals neu gestartet werden. Auch kann er nun wieder mit dem lokalen Heim-Netzwerk verbunden werden, so dass er ggf. ĂŒbers Internet eine Verbindung zum Freifunk-VPN-Gateway herstellen kann. Der Router startet nun in den Normal-Mode: Die grĂŒne LED leuchtet dauerhaft.

FĂŒr erfahrene Benutzer gibt es zusĂ€tzlich zum Normal-Mode und Config-Mode auch noch den Failsafe-Mode. Dieser kann erreicht werden wenn im Bootvorgang des Routers mehrfach die Reset-Taste gedrĂŒckt wird. Im Failsafe-Mode blinkt die grĂŒne LED sehr schnell (schneller als 1x pro Sekunde). In diesem Modus sind alle Services deaktiviert und der Router ist nur per Telnet/SSH auf 192.168.1.1 zu erreichen.
(Quelle 1, Quelle 2, Quelle 3)

Viel Spaß mit eurem eigenen Freifunk-Knoten!

What’s New in the Linux Network Stack?

Recently, I attented a seminar at university and created a paper named “What’s New in the Linux Network Stack?”. As the content of my paper might be of interest to some people in the community, I decided to publish it here.

Abstract
In this paper, interesting features of the Linux kernel’s network stack are analyzed, which were introduced during the development cycles from Linux v3.7 to Linux v3.16. Special attention is given to the low-latency device polling, introduced in Linux v3.11, the netfilter’s SYNPROXY target, introduced in Linux v3.12 and the new Nftables framework, introduced in Linux v3.13. At the end a trend is presented, which shows the direction in which the Linux network stack is evolving.

What's New in the Linux Network Stack

Download

Feel free to study, improve and build upon my work as desired! Feedback is welcome.

Update: This paper is now formally released in the “Proceedings of the Seminars Future Internet (FI) and Innovative Internet Technologies and Mobile Communications (IITM)”, which can be found here: DOI: 10.2313/NET-2015-03-1

Introducing OpenPhoenux Neo900

openphoenux-logoThe latest device in the OpenPhoenux open hardware familiy is the Neo900, the first true successor to the Nokia N900. The Neo900 is a joint project of the Openmoko veteran Jörg Reisenweber and the creators of the GTA04/Letux2804 open hardware smartphone at Golden Delicious Computers. Furthermore, it is supported by the N900 Maemo5/Fremantle community, the Openmoko community and the OpenPhoenux community, who are working together to get closer to their common goal of providing an open hardware smartphone, which is able to run 100% free and open source software, while being independent of any big hardware manufacturer.

OpenPhoenux Neo900
OpenPhoenux Neo900

With the big ecosystem of free and open Maemo5/Fermantle applications, the hacker friendly N900, which provides an excelent hardware keyboard, the variety of free operating systems of the Openmoko community (SHR, QtMoko, Replicant, …) and the experience in designing and producing open hardware devices of the OpenPhoenux community (e.g. GTA04), they want to bring the best of all worlds together in one single device, the Neo900.

The Neo900 is meant to be an upgraded N900, with a newly designed and more powerfull motherboard, which is based upon the existing and tested OpenPhoenux GTA04 design. Together with the nice housing of the N900 (e.g. slider, hardware keyboard, big screen, …), this is trying to get “the hackers most beloved device”. In the same spirit of the OpenPhoenux community, which created unique cases for their GTA04 devices out of aluminium, wood or 3D printing, there is also an effort to build an aluminium housing for the N900, which might lead to personalized and self-produced cases for the Neo900 in the future and thus the independence of spare parts of N900 smartphones.

n900-cover1 n900-cover2

Due to the fact that the Neo900’s new motherboard is very similar to the GTA04, it is possible to reuse most of the low level software stack like development tools, the Bootloader and the Linux Kernel from the GTA04 project, with just minor modifications applied. This will speed up the software development process of this new open hardware platform a lot!

To fund the development and prototyping of this new open hardware device, which is made in Germany, a crowdfunding campain has been started a few days ago, in order to collect 25.000€ (which is by now already halfway reached!). Depending on the outcome of this fundraising the project might be able to provide better hardware specs than the following minimum keyfeature set:

  • TI DM3730 CPU (OMAP3 ARM Cortex A8) with 1+ GHz
  • 1GB RAM, 512MB NAND flash, 32+ GB eMMC, Micro-SD-Reader
  • 3.75G module for UMTS/CDMA; 4G (LTE) optional
  • USB 2.0 OTG High Speed
  • GPS+GLONASS, WLAN, Bluetooth
  • Accelerometer, barometric Altimeter, Magnetometer, Gyroscope
  • VGA (front) + 5MP (rear) camera

DSC01773 DSC01774

If you want to see the N900 to live on, help the independet open hardware community to succeed, or are looking for a new, hacker friendly smartphone, you should consider to support the fundraising with a donation. If you donate 100€ or more, your donation will also serve as a rebate for a finished device, once they are ready.

[Update 2013-11-04] The goal of 25.000€ is now reached, less than a week after the fundraiser started! Thanks to everybody who donated and spread the word and thus helped to make that happen. If you want to qualify for the rebate on the finished device, it is still possible to donate.

Let the OpenPhoenux fly on!

Youtube

Determining Interaction Geometry with Ultrasound Sensors

Just recently I finalized my Bachelor’s Thesis in Computer Science at the Technical University of Munich. The thesis is licensed under the Creative Commons CC-BY-SA 3.0 Unported license and is now available for download.

Abstract
In this thesis I present an ultrasound tracking system, which works infrastructure less and is based on mobile phones. I present the software and hardware, which is needed for this system to work. Then I describe the experiment I conducted to collect data of the system’s performance. Afterwards, this data gets evaluated in a way that it is compared to a high precision reference data set, which was already used to determine interaction geometry. Next, I discuss the system’s and experiment’s limitations and suggest some concrete improvements. Finally I conclude on the possibilities to determine interaction geometry, using the data my ultrasonic tracking system is able to collect and propose some future work in this area.

determining-interaction-geometry-with-ultrasound-sensors

Download

The corresponding software is licensed under the MIT license and is available for download as well: software.tar.bz2

Feel free to study, improve and build upon my work as desired! Feedback is welcome.

Categories Me

OpenPhoenux LinuxTag 2013 Impressions

LinuxTag-Logo
The LinuxTag 2013 is over, and I want to share some brief impressions I got during our stay in Berlin.

The LinuxTag is a nice and well organized FOSS exhibition in Germany, attracting more than 10.000 visitors during 4 days.

We gave a talk about the OpenPhoenux project at the 2nd evening and had about 60 listeners. Some of them got very interested and followed us to the booth afterwards. For everyone who couldn’t participate, the slides are available online: Slides.pdf

We shared a booth with some other “Linux & Embedded” projects, namely: OpenEmbedded, Ethernut, Nut/OS, Oswald/Metawatch. Our Booth was professionally looking and I think we got quite some people interested in the project. Basically we had a constant flow of people at the booth during our 3 days stay and the overall feedback was rather positive!

OpenPhoenux LinuxTag 2013 (1) OpenPhoenux LinuxTag 2013 (2) OpenPhoenux LinuxTag 2013 (3)

We got interviewed by the “GNU funzt!” team, as well. The (german) video is now available on Youtube (OpenPhoenux interview is starting at 5:00):


All in all it was a very nice stay in Berlin. I especially enjoyed meeting and chatting with guys who already owned a GTA04. It looks like the community is growing again!

Links:

OpenPhoenux FOSDEM Impressions

CIMG0210FOSDEM 2013 is over and I had a really nice time again at Brussels, together with the OpenPhoenux/GTA04 team. It was especially nice to meet some people from our community in person and discuss interesting ideas with them.

Furthermore, it was great to meet people, who didn’t know about neither OpenPhoenux nor Openmoko, having cool ideas, which the OpenPhoenux GTA04 open hardware plattform would enable them to do.

We even got interviewed by Sam – a moviemaker, ceating a movie called “Year of Open Source” about living in a free software/hardware world for (at least) one year.

As stated, I had a nice time and I’m looking forward to meeting with the OpenPhoenux community soon again. Now, as a picture says more than 1000 words, here are some photographs from our FOSDEM booth:

Update: Now there is a video available as well.

OpenPhoenux at FOSDEM 2013

openphoenux-logo
The team of OpenPhoenux presented the development process of the open hardware and free software powered mobile plattform “GTA04” at FOSDEM 2011 and 2012, including working prototypes and preview-boards for developers.

OpenPhoenux-3704Now, that the OpenPhoenux has taken off to reach a broader audience, we’ll show off all the open hardware (prototypes of new products and finished devices) at FOSDEM 2013. We hope you’re already eager to have your hands on the latest and greatest open mobile handhelds, which will be presented at our booth!

All of those are based on the GTA04 open mobile plattform, whose latest revision GTA04-A5 is ready and waiting for pre-orders to finance the next production run.

In addition, there are still a few complete GTA04 (revision A4) smartphone units on stock at the Openmoko reseller Pulster.eu. Contact him for further information.

Those are all great hardware projects for Linux/FOSS enthusiasts and freedom lovers! But the World of OpenPhoenux is not limited to hardware gadgets, but is connected to several other open mobile and communication projects, as well:

SHR    

So, if you’re visiting FOSDEM this year and are interested in open mobile communications it is a must to drop by the “World of OpenPhoenux”-booth (No. 3) in building AW, right next to Jolla/Sailfish, Hackable Devices/MakerBot, Enlightenment and more!

We’re looking forward to meet you there, answer your questions and demo the devices to you!

AW_stands

Reconsider ancient wisdom…

“If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas.”

— George Bernard Shaw