Solidity Documentation Introduction
Solidity is an object-oriented, high-level language for implementing smart contracts. Smart contracts are programs which govern the behaviour of accounts within the Ethereum state. Solidity is a curly-bracket language designed to target the Ethereum Virtual Machine (EVM). It is influenced by C++, Python and JavaScript. You can find more details about which languages Solidity has been inspired by in the language influences section. Solidity is statically typed, supports inheritance, libraries ...
如果你想要改变人生,请认真阅读这份指南
不可否认的是,Crypto 的造富效应是其迅速蹿红的关键因素,但如果你的本金有限,真的也能够从中赚得足够可观的回报吗?如果你想要以小博大去获得「赚大钱」的机会,那么这份指南中提到的准则,应该会对你有帮助。 当我在 2017 年开始接触加密货币时,我满脑子就一个念头,就是我要变富。那时候我只是一家杂货店的普通员工,所以我的投资预算非常低,但我非常渴望拥有一个美好的未来。在这个过程中,我总结出了以下关键策略。 如果你是白手起家,这些应该是你要遵循的基本准则:(1)减少不必要的开支;(2)省钱;(3)提高收入,包括从事副业;(4)坚决贯彻决策曲线分析(DCA);(5)构建至少 5 年的长期规划。 当然,我知道你现在最想问的问题是什么,「如果我投资 BTC 或 ETH,怎么能赚大钱?」事实是你没戏。即使比特币涨到 10 万,现在投资 1000 美元也不会让你赚大钱。没错,你会体面地赚到几倍,但这没法改变你的人生。 不要误会我的意思,蓝筹很重要,因为他会在基本面和技术分析之外给我们提供一个更简单的降低投资组合风险的方法。但是,如果你想大幅增加自己的净资产,你就必须投资风险更高的山寨币。 关...
Sybil detection on DeFi protocols
In April, Primitive launched its first product, RMM-01, a decentralized finance (DeFi) protocol that allows users to earn trading fees from automated trading. When the protocol reached nearly 1000 cumulative users, we analyzed the accounts to determine their authenticity. On the RMM-01 protocol, nearly 80% of users were identified as suspects in Sybil attacks. In response, Primitive developed a straightforward method for detecting and filtering these users. While Primitive uses this tool to r...
Solidity Documentation Introduction
Solidity is an object-oriented, high-level language for implementing smart contracts. Smart contracts are programs which govern the behaviour of accounts within the Ethereum state. Solidity is a curly-bracket language designed to target the Ethereum Virtual Machine (EVM). It is influenced by C++, Python and JavaScript. You can find more details about which languages Solidity has been inspired by in the language influences section. Solidity is statically typed, supports inheritance, libraries ...
如果你想要改变人生,请认真阅读这份指南
不可否认的是,Crypto 的造富效应是其迅速蹿红的关键因素,但如果你的本金有限,真的也能够从中赚得足够可观的回报吗?如果你想要以小博大去获得「赚大钱」的机会,那么这份指南中提到的准则,应该会对你有帮助。 当我在 2017 年开始接触加密货币时,我满脑子就一个念头,就是我要变富。那时候我只是一家杂货店的普通员工,所以我的投资预算非常低,但我非常渴望拥有一个美好的未来。在这个过程中,我总结出了以下关键策略。 如果你是白手起家,这些应该是你要遵循的基本准则:(1)减少不必要的开支;(2)省钱;(3)提高收入,包括从事副业;(4)坚决贯彻决策曲线分析(DCA);(5)构建至少 5 年的长期规划。 当然,我知道你现在最想问的问题是什么,「如果我投资 BTC 或 ETH,怎么能赚大钱?」事实是你没戏。即使比特币涨到 10 万,现在投资 1000 美元也不会让你赚大钱。没错,你会体面地赚到几倍,但这没法改变你的人生。 不要误会我的意思,蓝筹很重要,因为他会在基本面和技术分析之外给我们提供一个更简单的降低投资组合风险的方法。但是,如果你想大幅增加自己的净资产,你就必须投资风险更高的山寨币。 关...
Sybil detection on DeFi protocols
In April, Primitive launched its first product, RMM-01, a decentralized finance (DeFi) protocol that allows users to earn trading fees from automated trading. When the protocol reached nearly 1000 cumulative users, we analyzed the accounts to determine their authenticity. On the RMM-01 protocol, nearly 80% of users were identified as suspects in Sybil attacks. In response, Primitive developed a straightforward method for detecting and filtering these users. While Primitive uses this tool to r...
Share Dialog
Share Dialog

Subscribe to pikpika

Subscribe to pikpika
<100 subscribers
<100 subscribers
Python零基础批量mint以太铭文,小白也能快速上手运行属于自己的铭文脚本
从零开始教你如何构建一个属于自己的python环境并进行链上交互,本教程以windows为例
python下载
进入python官网中下载这个安装包然后安装

https://www.python.org/downloads/windows/
配置环境变量
打开命令提示框(cmd) **,**在命令提示框(cmd)中输入 :
path=%path%;C:\Python
其中需要注意的是:C:\Python 是上一步中选择python的安装目录,此处是默认安装目录
安装IDE
这里我推荐pycharm,pycharm对于python的支持是最到位的
建议初学者安装pycharm熟悉python后再使用别的解释器
PyCharm 下载地址 :
https://www.jetbrains.com/pycharm/download/?section=windows
下载的话建议选择下面那个社区版本,社区版本的功能完全够用,上面的专业版本需要付费

以上教程节选自,感兴趣的朋友可以继续通过菜鸟教程学习:
https://www.runoob.com/python/python-install.html
创建工作台
打开pycharm后,点击左上角的File后选择New project按钮
按默认选项点击右下角的create按钮,创建全新的工作台

安装web3.py库
创建好工作台之后,点击左下角的terminal按钮或者使用Alt+F12快捷键调出命令行

在命令行中输入命令 pip install web3.py 按回车运行命令,安装web3.py库

至此准备工作就已经完成一大半了!如果你能坚持到这一步的话,距离成功就很近了!
复制脚本代码
将main.py文件中原始的字符全部删除,将下面代码复制进入main.py文件中
from web3 import Web3
import binascii
import hashlib
import requests
import time
# 连接到以太坊节点
w3 = Web3(Web3.HTTPProvider('https://eth-mainnet.g.alchemy.com/v2/iOtHuKsPGcs0Ybp8M7CNnhTijM6qdcjI'))
# API端点URL
api_url = "https://api.ethscriptions.com/api/ethscriptions/exists/"
# 检查是否连接成功
if not w3.is_connected():
print("错误:未能连接到以太坊节点")
exit()
# 设置发送方的地址和私钥
sender_address = "填需要批量铭文的地址"
private_key = "填对应地址的私钥"
# 设置接收方地址
receiver_address = "填需要批量铭文的地址"
def str_to_hex(input_string):
hex_representation = binascii.hexlify(input_string.encode()).decode()
return hex_representation
# 编码你想要传递的语言信息
n = 0
m = 0
nonce1 = w3.eth.get_transaction_count(sender_address)
while n < 200: # 运行次数
num = 15620 + n # 遍历开始铭文编号
language_info = 'data:,{"p":"erc-20","op":"mint","tick":"swap","id":"'+ str(num) +'","amt":"1000"}'
print(language_info)
byte_data = language_info.encode('utf8')
sha256_hash = hashlib.sha256(byte_data).hexdigest()
full_url = api_url + sha256_hash
response = requests.get(full_url)
if response.status_code == 200:
data = response.json()
if data['result']:
print("SHA-256哈希存在 \n")
n = n + 1
else:
hex_string = str_to_hex(language_info)
nonce = nonce1 + m
m = m + 1
# 构建交易
gas_price = w3.to_wei('12.5', 'gwei') # 设置 gas price
gas_limit = 50000 # 固定 gas limit
print("nonce:", nonce)
time.sleep(2)
n = n + 1
transaction = {
'nonce': nonce,
'to': receiver_address,
'value': 0, # 这里是0,因为我们只发送数据而不转账金额
'gas': gas_limit,
'gasPrice': gas_price,
'data': hex_string, # 将编码后的语言信息作为input数据
}
# 签署交易
signed_txn = w3.eth.account.sign_transaction(transaction, private_key)
# 发送交易
tx_hash = w3.eth.send_raw_transaction(signed_txn.rawTransaction)
print(f"交易已发送 \n")
else:
print("请求失败")
break
调整代码细节
这个时候需要调整的地方有大概五处,分别对应的是用什么地址打代币铭文,打多少张代币铭文,代币铭文编号从哪里开始,打哪一种代币铭文,使用多少gas打铭文
用什么地址打代币铭文:

打多少张代币铭文和代币铭文编号从哪里开始:

打哪一种代币铭文:

使用多少gas打铭文:

附以太坊网络gas查询链接:
https://etherscan.io/gastracker
运行代码
当将上述五点全部设置好了就可以运行代码批量打铭文了
点击上方运行按钮运行

程序运行成功如下图所示

错误:未能链接到以太坊节点
解决方案一:关闭VPN后尝试重新运行
解决方案二:尝试更换RPC节点
打开chainlist之后随便选择一个替换掉代码里的RPC节点,一个不行就多换几个,公共的rpc一般都不太好用
代码里的节点是我使用Alchemy自行申请的,但是用的人多的话可能会到达请求上限,感兴趣的小伙伴可以自己申请一个

后续等大家尝试运行之后,反馈相关报错问题之后再更新
Python零基础批量mint以太铭文,小白也能快速上手运行属于自己的铭文脚本
从零开始教你如何构建一个属于自己的python环境并进行链上交互,本教程以windows为例
python下载
进入python官网中下载这个安装包然后安装

https://www.python.org/downloads/windows/
配置环境变量
打开命令提示框(cmd) **,**在命令提示框(cmd)中输入 :
path=%path%;C:\Python
其中需要注意的是:C:\Python 是上一步中选择python的安装目录,此处是默认安装目录
安装IDE
这里我推荐pycharm,pycharm对于python的支持是最到位的
建议初学者安装pycharm熟悉python后再使用别的解释器
PyCharm 下载地址 :
https://www.jetbrains.com/pycharm/download/?section=windows
下载的话建议选择下面那个社区版本,社区版本的功能完全够用,上面的专业版本需要付费

以上教程节选自,感兴趣的朋友可以继续通过菜鸟教程学习:
https://www.runoob.com/python/python-install.html
创建工作台
打开pycharm后,点击左上角的File后选择New project按钮
按默认选项点击右下角的create按钮,创建全新的工作台

安装web3.py库
创建好工作台之后,点击左下角的terminal按钮或者使用Alt+F12快捷键调出命令行

在命令行中输入命令 pip install web3.py 按回车运行命令,安装web3.py库

至此准备工作就已经完成一大半了!如果你能坚持到这一步的话,距离成功就很近了!
复制脚本代码
将main.py文件中原始的字符全部删除,将下面代码复制进入main.py文件中
from web3 import Web3
import binascii
import hashlib
import requests
import time
# 连接到以太坊节点
w3 = Web3(Web3.HTTPProvider('https://eth-mainnet.g.alchemy.com/v2/iOtHuKsPGcs0Ybp8M7CNnhTijM6qdcjI'))
# API端点URL
api_url = "https://api.ethscriptions.com/api/ethscriptions/exists/"
# 检查是否连接成功
if not w3.is_connected():
print("错误:未能连接到以太坊节点")
exit()
# 设置发送方的地址和私钥
sender_address = "填需要批量铭文的地址"
private_key = "填对应地址的私钥"
# 设置接收方地址
receiver_address = "填需要批量铭文的地址"
def str_to_hex(input_string):
hex_representation = binascii.hexlify(input_string.encode()).decode()
return hex_representation
# 编码你想要传递的语言信息
n = 0
m = 0
nonce1 = w3.eth.get_transaction_count(sender_address)
while n < 200: # 运行次数
num = 15620 + n # 遍历开始铭文编号
language_info = 'data:,{"p":"erc-20","op":"mint","tick":"swap","id":"'+ str(num) +'","amt":"1000"}'
print(language_info)
byte_data = language_info.encode('utf8')
sha256_hash = hashlib.sha256(byte_data).hexdigest()
full_url = api_url + sha256_hash
response = requests.get(full_url)
if response.status_code == 200:
data = response.json()
if data['result']:
print("SHA-256哈希存在 \n")
n = n + 1
else:
hex_string = str_to_hex(language_info)
nonce = nonce1 + m
m = m + 1
# 构建交易
gas_price = w3.to_wei('12.5', 'gwei') # 设置 gas price
gas_limit = 50000 # 固定 gas limit
print("nonce:", nonce)
time.sleep(2)
n = n + 1
transaction = {
'nonce': nonce,
'to': receiver_address,
'value': 0, # 这里是0,因为我们只发送数据而不转账金额
'gas': gas_limit,
'gasPrice': gas_price,
'data': hex_string, # 将编码后的语言信息作为input数据
}
# 签署交易
signed_txn = w3.eth.account.sign_transaction(transaction, private_key)
# 发送交易
tx_hash = w3.eth.send_raw_transaction(signed_txn.rawTransaction)
print(f"交易已发送 \n")
else:
print("请求失败")
break
调整代码细节
这个时候需要调整的地方有大概五处,分别对应的是用什么地址打代币铭文,打多少张代币铭文,代币铭文编号从哪里开始,打哪一种代币铭文,使用多少gas打铭文
用什么地址打代币铭文:

打多少张代币铭文和代币铭文编号从哪里开始:

打哪一种代币铭文:

使用多少gas打铭文:

附以太坊网络gas查询链接:
https://etherscan.io/gastracker
运行代码
当将上述五点全部设置好了就可以运行代码批量打铭文了
点击上方运行按钮运行

程序运行成功如下图所示

错误:未能链接到以太坊节点
解决方案一:关闭VPN后尝试重新运行
解决方案二:尝试更换RPC节点
打开chainlist之后随便选择一个替换掉代码里的RPC节点,一个不行就多换几个,公共的rpc一般都不太好用
代码里的节点是我使用Alchemy自行申请的,但是用的人多的话可能会到达请求上限,感兴趣的小伙伴可以自己申请一个

后续等大家尝试运行之后,反馈相关报错问题之后再更新
No activity yet