EOS记录

一、    搭建环境    

github安装教程:https://github.com/EOSIO/eos/wiki/

1.    git clone https://github.com/eosio/eos --recursive 

2.    cd eos

3.    ./eosio_build.sh                        #编译

 可能遇到问题,删除以前编译产生的文件和mongo文件

sudo rm -rf /tmp/mongo*
cd /path/to/eos
rm -rf build/
git pull
git submodule update --init --recursive
./eosio_build.sh

如果出现下面的问题

 Failed to find Gettext libintl (missing: Intl_INCLUDE_DIR)
执行下面的命令即可
brew unlink gettext && brew link --force gettext

引用:https://blog.csdn.net/itleaks/article/details/80367131

编译的时候电脑配置有所要求,内存必须大于8G,解决办法:

如果你想绕开这个限制,可以修改相应的脚本文件
VirtualBox:~/projects/eos$ grep "Your system must have" . -rn
./scripts/eosio_build_ubuntu.sh:28:        printf "\\tYour system must have 7 or more Gigabytes of physical memory installed.\\n"
./scripts/eosio_build_darwin.sh:29:        echo "Your system must have 7 or more Gigabytes of physical memory installed."
./scripts/eosio_build_fedora.sh:25:        printf "\\tYour system must have 7 or more Gigabytes of physical memory installed.\\n"
./scripts/eosio_build_amazon.sh:21:        printf "\\tYour system must have 7 or more Gigabytes of physical memory installed.\\n"
./scripts/eosio_build_centos.sh:26:        printf "\\n\\tYour system must have 7 or more Gigabytes of physical memory installed.\\n"

比如ubuntu平台就修改./scripts/eosio_build_ubuntu.sh文件,将下面的7000修改即可


4.    编译可执行文件 (cleos,eosiocpp,nodeos等工具都在此步骤产生

cd build
make test
make install    #root权限

5.    成功显示如下


6.    启动

cd build/programs/nodeos
./nodeos -e -p eosio --plugin eosio::wallet_api_plugin --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin 

需要修改如下红色框的内容


重启nodeos

参考:https://blog.csdn.net/itleaks/article/details/80367131

踩坑参考:https://www.jianshu.com/p/13c7bddacfd9

二、    钱包操作

命令行界面钱包程序为 keosd,位于 eos/build/programs/keosd 路径下,用于存储交易签名的私钥。keosd在本地节点上运行,并将私钥保存在本地节点上。

注册EOS账号:

$cleos -u http://mainnet.genereos.io get info

确保输出的chain_id是 aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906

参考:https://www.jianshu.com/p/cdc681aefaea

1.    keosd

默认情况下,keosd会在目录 ~/eosio-wallet 中生成一个基础的配置文件 config.in。在运行命令行钱包时,通过配置命令行参数 --config-dir指定config.ini配置文件的目录。该配置文件中保存用于接入http链接的服务器配置http-server-address参数,以及其他用于资源共享的配置参数。

默认情况下,keosd将钱包文件保存在 ~/eosio-wallet 目录下,钱包文件名为:<wallet-name>.wallet。例如,默认钱包文件名为 default.wallet。当建立了其他钱包后,在该目录下会分别建立每个钱包文件,例如当建立了一个名称为"foo"的钱包,会生成一个钱包文件foo.wallet。钱包文件可以通过命令行参数--data-dir存放在指定的目录中。

命令参考

与keosd交互使用的工具是cleos,该命令在目录eos/build/programs/cleos 目录下。 该工具提供了与keosd交互的各种命令。

2.    cleos wallet create ${参数}            #新建钱包

参数说明: -n, --name 文本,钱包名称 如果不提供钱包名称,则会创建一个默认钱包(default.wallet)

3.    cleos wallet open ${参数}              #打开钱包

参数说明: -n, --name 文本,钱包名称

4.    cloes wallet lock ${参数}                #锁定钱包

参数说明: -n, --name 文本,钱包名称 当节点nodeos被关闭或者钱包服务keosd被关闭,钱包会被锁定。当重启钱包服务后,需要解锁unlock钱包。

5.    cloes wallet import ${参数}            #解锁钱包

参数说明: -n, --name 文本,钱包名称 --password 钱包密钥,如果不使用此参数,则会提示输入密钥

6.    cleos wallet list                              #钱包列表

7.    cleos wllet keys                              #显示私钥

8.    cleos wallet import ${参数}            #导入私钥到钱包

参数说明: -n, --name 文本,钱包名称

9.    删除钱包,删除钱包数据目录即可删除钱包,~/eosio-wallet/xxx

EOS各种问题汇总,EOS入门必读:https://blog.csdn.net/itleaks/article/details/80484164


三、helloworld编写


参考:

https://mp.weixin.qq.com/s?__biz=MzU1OTQ3MTI3Ng==&mid=2247483790&idx=1&sn=3697b2d073254ec786af99af10453251&chksm=fc178e4dcb60075b

https://mp.weixin.qq.com/s/12XEklwlGV39pLyOF7uswQ

https://segmentfault.com/q/1010000010378545

https://www.jianshu.com/p/5ef57c654758

https://blog.csdn.net/itleaks/article/details/80461917

https://blog.csdn.net/grimraider/article/details/80737961

https://blog.csdn.net/itleaks/article/details/80367131

https://blog.csdn.net/zhuxiangzhidi/article/details/79766663

https://blog.csdn.net/itleaks/article/details/80367131

http://www.eosdata.io/

https://www.jianshu.com/p/cdc681aefaea

http://www.blockchainbrother.com/article/1931

https://blog.csdn.net/itleaks/article/details/80484164

https://eosfans.io/wiki/cli-wallet

https://github.com/EOSIO/eos/wiki/Local-Environment



### 回答1: 在 Python 中可以使用 os 模块的 walk() 函数来遍历文件夹下的所有文件,并筛选出以 .txt 结尾的文件。 示例代码如下: ``` import os folder_path = '/path/to/folder' for root, dirs, files in os.walk(folder_path): for file in files: if file.endswith('.txt'): file_path = os.path.join(root, file) print(file_path) ``` 该程序将遍历文件夹路径为 `/path/to/folder` 下的所有文件和子文件夹,并打印出以 .txt 结尾的文件的路径。 ### 回答2: 要打开一个文件夹下以txt结尾的文件,首先需要使用Python内置的os模块。以下是一个简单的示例代码: ```python import os # 定义文件夹路径 folder_path = '文件夹路径' # 获取文件夹中所有的文件名 file_list = os.listdir(folder_path) # 遍历文件列表 for file_name in file_list: # 判断文件是否以txt结尾 if file_name.endswith('.txt'): # 拼接文件路径 file_path = os.path.join(folder_path, file_name) # 打开文件 with open(file_path, 'r') as file: # 在这里对文件进行读取或处理操作 # 例如:打印文件内容 print(file.read()) ``` 上述代码首先使用`os.listdir()`函数获取文件夹中所有的文件名,然后遍历文件列表。对于每个文件名,使用`endswith('.txt')`判断其是否以txt结尾。若是,则使用`os.path.join()`函数拼接文件路径,再使用`open()`函数打开文件。在`open()`函数中,使用'r'模式表示读取文件。你也可以根据需要更改模式,例如'w'表示写入模式,'a'表示追加模式等。 最后,你可以在`with open`的代码块中对文件内容进行读取或处理。上述代码仅仅是一个示例,你可以根据实际需求进行修改和扩展。 ### 回答3: 在Python中,您可以使用`os`模块和字符串的方法来打开一个文件夹下以`.txt`结尾的文件。 首先,您需要导入`os`模块: ```python import os ``` 然后,您可以使用`os.listdir()`函数列出文件夹中的所有文件和文件夹: ```python folder_path = '文件夹路径' # 替换为您的文件夹路径 files = os.listdir(folder_path) ``` 接下来,使用`for`循环遍历所有的文件和文件夹,通过判断文件的扩展名是否为`.txt`来筛选出以`.txt`结尾的文件: ```python for file in files: if file.endswith('.txt'): file_path = os.path.join(folder_path, file) # 获取文件的完整路径 with open(file_path, 'r') as f: # 在这里可以编写处理文件的逻辑,例如读取内容或进行其他操作 ``` 在以上代码中,`os.path.join()`函数用于将文件夹路径和文件名合并成文件的完整路径。 您可以将处理文件的逻辑放在`with open(file_path, 'r') as f:`代码块中,通过`f`来访问文件的内容或进行其他操作。 请注意,`with open()`语句中的模式参数为`'r'`,表示以只读方式打开文件。如果您需要使用其他操作模式(例如写入或追加),可以相应地修改模式参数。 以上就是使用Python打开一个文件夹下以`.txt`结尾的文件的方法。根据您的需求,您可以在`with open()`代码块中编写各种处理文件的逻辑。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值