Python for STEEM: How to beem

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@felixxx·
0.000 HBD
Python for STEEM: How to beem
>This is meant as the first part to a series of tutorials.
The goal is to produce a hands-on guide for people who want to jump straight into developing tools for STEEM.

###
In  this part, I will try to guide you through the process of installing beem.
[beem](https://github.com/holgern/beem) is a Python library for STEEM and is based on [steem-python](https://github.com/steemit/steem-python), which is based on [piston-lib](https://github.com/xeroc/piston-lib).
While steem-python is the official lib, I chose beem, because it is updated more frequently. ( At this time, the last update to steem-python is 9 months old)

While it is possible to install Python and beem on Windows, I will start by setting up a virtual machine, which I will install Linux on.
In my opinion, this has multiple benefits, the main one being that it will encapsulate your development environment; Whatever abomination you code up, it will not be able to wreck your main operating system - In the worst case, you can stop the virtual machine and start it again.

I believe this method to be the easiest for most people.
If you want to install beem on a different system, this is not the right guide for you. If you can figure it out on your own, you can jump a chapter ahead.

## VMware 
####
There is a free version of VMware, which is ideal for our purposes:
https://www.vmware.com/products/workstation-player.html
Make sure to download the Workstation **Player**, as only that is free to use.

Install this, make sure to uncheck the regular updates nonsense.

## Ubuntu
####
I will go with Ubuntu 18.04.3 LTS, as that seems to be the most popular choice at the moment.
https://ubuntu.com/download/desktop

Open VMware, create a new virtual machine using a Ubuntu 18.04.3 LTS image.
- 10 GB HDD, 2 GB RAM is enough, perhaps less
- You do not need VMware tools
- Set a password. I bricked my first Linux ever, by trying to set it up with a blank password.
It does not have to be especially secure.

## beem
####
If you are new to Linux - don't panic ! I don't get it either.
Before doing anything, remove Amazon from you 'Favourites' menu.
If your keyboard layout is not English, you need to go to 'Region and Languages' and **add a new** keyboard layout, which makes no sense, and is very confusing.
- ``ctrl``+``alt``+``t `` opens a new terminal.
- ``sudo apt-get update``
Apparently, this will update your system.
It is always recommended. Once you have a running bot for STEEM, this might completely ruin your day, though.
___
_**Note**: 
``ctrl+c``, ``ctrl+v`` do not work like they do in Windows. 
This is just to confuse everybody._
___
- ``sudo apt-get install build-essential libssl-dev python-dev``
- yes
- ``sudo apt install python3-pip``
- yes
- ``sudo pip3 install beem``
- yes

## Test
####
The easiest way to test, if it went right, is to:
``beempy --help``
beempy is a wallet that is built on beem.
If you see a list of help topics, you have successfully set up beem.

To test your first own script, create a new file:
``gedit beemtest.py``
This will open a text editor.
```
from beem.blockchain import Blockchain
blockchain = Blockchain()
print(blockchain.get_current_block_num())
```
paste the above 3 lines of code and save the file.
```python3 beemtest.py```
This will execute your script and should print the current head-block number on your screen.

## Congratulations
####
If it did not work as intended, comment below.

I hope @flipstar gets to test this.
Also mentioning @revisesociology for good measure.

## [-> Part 2](https://steemit.com/busy/@felixxx/pyhton-for-steem-2-json)
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,