远程部署 Steem 机器人, ubuntu 18.04下用Anaconda 安装python 和 beem
前几天,本地开发 steem 机器人,在 MacOS上用 <Anaconda 安装 beem,开发 python版本的 steem 机器人>
今天,购买了远程服务器,安装好ubuntu18.04的环境,再用Anaconda 安装python 和 beem.
Anaconda的好处是,跨平台管理 python开发环境, 不管你是windows开发者,还是linux/mac的开发者,基本操作都差不多.
ubuntu 安装 Anaconda3
beem工具的运行环境要求 Anaconda3 (Python3) ,如果 Anaconda 官方下载太慢,可用清华大学镜像:
$ cd ~
$ sudo apt-get remove python3 python3-dev python3-pip
$ wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2019.07-Linux-x86_64.sh
$ chmod a+x Anaconda3-2019.07-Linux-x86_64.sh
$ sh ./Anaconda3-2019.07-Linux-x86_64.sh
$ source ~/.bashrc
$ conda activate
(base) ~$ python -V
(base) ~$ pip -V
(base) ~$ sudo apt install libffi-dev libssl-dev
退出Anaconda3环境:(base) ~$ conda deactivate
后续操作,基本跟 MacOS 上一致.
Anaconda3 安装 beem
$ cd ~
$ conda activate
(base) ~$ conda config --add channels conda-forge
(base) ~$ conda install beem
(base) ~$ conda install cryptography
使用 beempy
使用最快的节点:$ beempy pingnode --sort
创建本地钱包密码:$ beempy createwallet
查看钱包信息:$ $ beempy walletinfo
+-----------------------+--------------------------------------------+
| Key | Value |
+-----------------------+--------------------------------------------+
| created | True |
| locked | True |
| Number of stored keys | 0 |
| sql-file | /home/xy/.local/share/beem/beem.sqlite |
| password_storage | environment |
| UNLOCK env set | no |
| keyring installed | yes |
+-----------------------+--------------------------------------------+
修改本地钱包密码:$ beempy changewalletpassphrase
添加steem账号:$ beempy addkey
删除steem账号:beempy delkey [OPTIONS] public_key
查看钱包内的steem账号:$ beempy listaccounts
+-----------+---------+-------------------------------------------------------+
| Name | Type | Available Key |
+-----------+---------+-------------------------------------------------------+
| maxxxxnk | active | STMxxxxxx9dvE |
| manbbbbnk | posting | STM87YzixbssssEDKXfU |
+-----------+---------+-------------------------------------------------------+
查询余额:$ beempy balance maxxxxnk manbbbbnk
示范一个当前最新发帖的机器人(demo.py):
from __future__ import print_function
import sys
from datetime import timedelta
import time
import io
from beem.blockchain import Blockchain
from beem.utils import parse_time
if __name__ == "__main__":
blockchain = Blockchain()
for vote in blockchain.stream(opNames=["comment"]):
print(vote)
执行程序:python demo.py
打印出的信息:
{'type': 'comment', 'parent_author': 'munaib', 'parent_permlink': 'poll-many-in-us-support-trump-decision-to-kill-iran-general', 'author': 'steemcleaner', 'permlink': 'steemcleaner-re-munaibpoll-many-in-us-support-trump-decision-to-kill-iran-general', 'title': '', 'body': 'Warning! This user is on our black list, likely as a known plagiarist, spammer or ID thief. Please be cautious with this post!\nIf you believe this is an error, please chat with us in the #appeals channel in [our discord](https://discord.gg/7FkETjJ).', 'json_metadata': '', '_id': '69548f80e7dffd82fc37a861e42169057df0957e', 'timestamp': datetime.datetime(2020, 1, 25, 3, 46, 15, tzinfo=<UTC>), 'block_num': 40226710, 'trx_num': 40, 'trx_id': '33e920525f1bfd984b961b645d9aab7e7748f059'}
Leave 远程部署 Steem 机器人, ubuntu 18.04下用Anaconda 安装python 和 beem to:
Read more #hive-143316 posts
Best Posts From dappcoder
We have not curated any of dappcoder's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.