Ethscriptions commited on
Commit
978be83
·
1 Parent(s): 8a72757

Add application file

Browse files
.DS_Store CHANGED
Binary files a/.DS_Store and b/.DS_Store differ
 
data/.DS_Store CHANGED
Binary files a/data/.DS_Store and b/data/.DS_Store differ
 
data/eths_data.db DELETED
Binary file (8.19 kB)
 
data/ethscriptions_data.db CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:dc58b825a4f539092a9b7af6f122cd3b1218e07559842b0fde0718a96b5c0287
3
- size 396701696
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b654691f9a36ea3e06aafe269d5b835b0a414f34b9cb70e49f6066f15f2e9e41
3
+ size 398102528
pages/.DS_Store CHANGED
Binary files a/pages/.DS_Store and b/pages/.DS_Store differ
 
pages/2_🆔_ 批量题写域名铭文.py CHANGED
@@ -114,138 +114,139 @@ st.info('''##### 在使用之前,敬请仔细阅读说明,感谢您的配合
114
  - 我们建议您使用备用账号,并避免在账号中存放大额资金。
115
  - 若您对此代码存有疑虑,建议您利用如 [ChetGPT](https://chat.openai.com/)、[Bard](https://bard.google.com/) 或 [Claude](https://claude.ai/) 等知名 AI 平台进行查询,以判断是否含有恶意代码。
116
  ''')
117
-
118
- # 连接的网络 ID。比如说,1 代表主网络,5 代表 Goerli 测试网络,11155111 代表 Sepolia 测试网络,如果你不放心,可以先用测试网试试。
119
- net_options = {
120
- '1': 'Mainnet',
121
- '5': 'Goerli',
122
- '11155111': 'Sepolia'
123
- }
124
- selected_option = st.selectbox(
125
- '**网络 ID**',
126
- list(net_options.keys()),
127
- format_func=lambda x: f"{x} ({net_options[x]})"
128
- )
129
- chain_id = int(selected_option)
130
-
131
- # 这里配置 Ethereum PRC URL,如果你没有,请到 infura.io 或者 alchemy.com 申请一个免费的 API
132
- token_eth_prc_url = st.text_input(
133
- f'**Ethereum PRC 链接**:选填,你可以去 [infura.io](https://app.infura.io/) 或者 [alchemy.com](https://alchemy.com/) 免费申请一个',
134
- f'https://{net_options[str(chain_id)]}.infura.io/v3/eab7f935b9af45e1a54f7d7ed06c5206')
135
- w3 = Web3(Web3.HTTPProvider(f'{token_eth_prc_url}'))
136
- # 初始化当前账户索引为 0
137
- current_account_index = 0
138
- # 收集和显示所有交易的结果
139
- transaction_results = []
140
- # 创建账户列表
141
- accounts = []
142
- # 使用字典来跟踪每个地址的nonce
143
- nonces = {}
144
-
145
- # 启用多账户操作
146
- if st.checkbox(f'启用**多账户**操作'):
147
- # 多账户的文本框
148
- account_list = st.text_area(f'输入多个 **ETH 地址及其对应的私钥**,用英文逗号分隔(,),如下:地址,私钥')
149
- if account_list: # 如果账户列表有内容
150
- for line in account_list.split('\n'): # 根据换行符划分账户
151
- if ',' in line: # 检查是否包含逗号
152
- address, key = line.split(',') # 分开地址和私钥
153
- if is_valid_eth_address(address) and is_valid_eth_private_key(key): # 验证地址和私钥
154
- current_nonce = w3.eth.get_transaction_count(address) # 获取地址的 nonce
155
- nonces[address] = current_nonce # 记录地址的 nonce
156
- accounts.append((address.strip(), key.strip())) # 保存地址和私钥还有 nonce
157
- else:
158
- st.error(f"地址 {address} 或私钥 {key} 无效,请检查!")
159
- st.stop()
160
- else:
161
- st.error(f"输入格式错误,请确保每行包含一个地址和一个私钥,并使用英文逗号分隔(,)。错误行:**{line}**")
162
- st.stop()
163
- else:
164
- account_address = st.text_input('填写你的 **ETH 地址**:')
165
- private_key = st.text_input('填写你的 **ETH 地址对应的私钥**:', type="password")
166
- if account_address and private_key: # 如果地址和私钥有内容
167
- if is_valid_eth_address(account_address) and is_valid_eth_private_key(private_key): # 验证地址和私钥
168
- current_nonce = w3.eth.get_transaction_count(account_address) # 获取地址的 nonce
169
- nonces[account_address] = current_nonce # 记录地址的 nonce
170
- accounts.append((account_address.strip(), private_key.strip())) # 保存地址和私钥还有 nonce
171
- else:
172
- st.error("地址或私钥无效,请检查!")
173
- st.stop()
174
-
175
- # 配置铭文文本
176
- ethscriptions_str = st.text_area(f'输入**多个域名铭文或其他**,可以用空格、换行符、英文逗号(,)分开,不要带 data:, 前缀,不要带域名后缀')
177
- name_options = ["自定义", ".eth", ".eths", ".tree", ".honk", ".etch"]
178
- name_selected_option = st.selectbox(f'选择**域名后缀**', name_options)
179
- if name_selected_option == '自定义':
180
- name_selected_option = st.text_input('输入**自定义的域名**:')
181
- # 以空格、换行符、英文逗号分隔文本并加上后缀
182
- ethscription_list = split_and_append(ethscriptions_str, name_selected_option)
183
-
184
- # 判断铭文文本里是否包含空格、换行符,而且所有的字母都必须为小写。
185
- if not validate_input(''.join(ethscription_list)):
186
- st.warning("**请注意**:通常代币铭文文本里不能包含空格、换行符,而且所有的字母都必须为小写。")
187
-
188
- # 题写铭文之前检查该铭文有没有被题写
189
- if st.checkbox(f'题写铭文之前**检查该铭文有没有被题写**'):
190
- token_check = True
191
- else:
192
- token_check = False
193
-
194
- # 每次交易成功后暂停 3 秒
195
- if st.checkbox(f'每次交易完成后暂停 3 秒'):
196
- sleep_3s = True
197
- else:
198
- sleep_3s = False
199
-
200
- # 点击发送交易开始
201
- if st.button(f'开始**发送交易**'):
202
- if not accounts or not ethscriptions_str or not name_selected_option: # 检查是否留空
203
- st.error(f'请正确谨慎地填写内容,每一项都**不应留空**。')
204
- st.stop()
205
- else:
206
- st.toast('看起来你输���的内容均无没有问题!', icon='🥳')
207
-
208
- st.toast(f'开始任务,需要题写的铭文总量为:{len(ethscription_list)}', icon='😎')
209
-
210
- # 对代币铭文 id 进行循环
211
- for name_str in ethscription_list:
212
- # 使用当前账户发送交易,获取当前账户的 nonce
213
- address, key = accounts[current_account_index]
214
- # 获取 gas
215
- gas_price = w3.eth.gas_price
216
- # 得到完整的铭文文本
217
- if not name_str.startswith('data:,'):
218
- input_data = f'data:,{name_str}'
219
-
220
- # 根据是否检查的开关进行
221
- if token_check:
222
- # 这里是开了检查后请求 Ethscriptions API
223
- if check_content_exists(sha256(input_data)):
224
- # 返回数据为 Ture,说明该铭文已经被题写,打印信息
225
- st.toast(f'{input_data} 已经被题写!', icon='☹️')
226
- else:
227
- # 返回数据为 False,说明该铭文还没被题写,发送交易
228
- # 使用 current_nonce 发送交易
229
- data, tx_hash = send_transaction(w3, address, key, chain_id, gas_price, input_data, nonces[address])
230
- # 记录最后输出的结果
231
- transaction_results.append(f"{address} | {data} | Transaction Hash: {tx_hash}")
232
- # 交易成功后,手动增加 nonce
233
- nonces[address] += 1
234
- else:
235
- # 这里是未开检查后直接发送交易
236
- # 使用 current_nonce 发送交易
237
- data, tx_hash = send_transaction(w3, address, key, chain_id, gas_price, input_data, nonces[address])
238
- # 记录最后输出的结果
239
- transaction_results.append(f"{address} | {data} | Transaction Hash: {tx_hash}")
240
- # 交易成功后,手动增加 nonce
241
- nonces[address] += 1
242
- # 更新当前账户索引,确保索引始终在账户列表的范围内
243
- current_account_index = (current_account_index + 1) % len(accounts)
244
- # 暂停 3
245
- if sleep_3s:
246
- time.sleep(3) # 暂停三秒
247
- st.toast(f'所有任务已经完成。', icon='🎉')
248
- # 庆祝动画
249
- st.balloons()
250
- # 显示所有交易的结果
251
- st.code('\n'.join(transaction_results))
 
 
114
  - 我们建议您使用备用账号,并避免在账号中存放大额资金。
115
  - 若您对此代码存有疑虑,建议您利用如 [ChetGPT](https://chat.openai.com/)、[Bard](https://bard.google.com/) 或 [Claude](https://claude.ai/) 等知名 AI 平台进行查询,以判断是否含有恶意代码。
116
  ''')
117
+ st.error('# 存在争议,暂停开放使用!')
118
+
119
+ # # 连接的网络 ID。比如说,1 代表主网络,5 代表 Goerli 测试网络,11155111 代表 Sepolia 测试网络,如果你不放心,可以先用测试网试试。
120
+ # net_options = {
121
+ # '1': 'Mainnet',
122
+ # '5': 'Goerli',
123
+ # '11155111': 'Sepolia'
124
+ # }
125
+ # selected_option = st.selectbox(
126
+ # '**网络 ID**',
127
+ # list(net_options.keys()),
128
+ # format_func=lambda x: f"{x} ({net_options[x]})"
129
+ # )
130
+ # chain_id = int(selected_option)
131
+ #
132
+ # # 这里配置 Ethereum PRC URL,如果你没有,请到 infura.io 或者 alchemy.com 申请一个免费的 API
133
+ # token_eth_prc_url = st.text_input(
134
+ # f'**Ethereum PRC 链接**:选填,你可以去 [infura.io](https://app.infura.io/) 或者 [alchemy.com](https://alchemy.com/) 免费申请一个',
135
+ # f'https://{net_options[str(chain_id)]}.infura.io/v3/eab7f935b9af45e1a54f7d7ed06c5206')
136
+ # w3 = Web3(Web3.HTTPProvider(f'{token_eth_prc_url}'))
137
+ # # 初始化当前账户索引为 0
138
+ # current_account_index = 0
139
+ # # 收集和显示所有交易的结果
140
+ # transaction_results = []
141
+ # # 创建账户列表
142
+ # accounts = []
143
+ # # 使用字典来跟踪每个地址的nonce
144
+ # nonces = {}
145
+ #
146
+ # # 启用多账户操作
147
+ # if st.checkbox(f'启用**多账户**操作'):
148
+ # # 多账户的文本框
149
+ # account_list = st.text_area(f'输入多个 **ETH 地址及其对应的私钥**,用英文逗号分隔(,),如下:地址,私钥')
150
+ # if account_list: # 如果账户列表有内容
151
+ # for line in account_list.split('\n'): # 根据换行符划分账户
152
+ # if ',' in line: # 检查是否包含逗号
153
+ # address, key = line.split(',') # 分开地址和私钥
154
+ # if is_valid_eth_address(address) and is_valid_eth_private_key(key): # 验证地址和私钥
155
+ # current_nonce = w3.eth.get_transaction_count(address) # 获取地址的 nonce
156
+ # nonces[address] = current_nonce # 记录地址的 nonce
157
+ # accounts.append((address.strip(), key.strip())) # 保存地址和私钥还有 nonce
158
+ # else:
159
+ # st.error(f"地址 {address} 或私钥 {key} 无效,请检查!")
160
+ # st.stop()
161
+ # else:
162
+ # st.error(f"输入格式错误,请确保每行包含一个地址和一个私钥,并使用英文逗号分隔(,)。错误行:**{line}**")
163
+ # st.stop()
164
+ # else:
165
+ # account_address = st.text_input('填写你的 **ETH 地址**:')
166
+ # private_key = st.text_input('填写你的 **ETH 地址对应的私钥**:', type="password")
167
+ # if account_address and private_key: # 如果地址和私钥有内容
168
+ # if is_valid_eth_address(account_address) and is_valid_eth_private_key(private_key): # 验证地址和私钥
169
+ # current_nonce = w3.eth.get_transaction_count(account_address) # 获取地址的 nonce
170
+ # nonces[account_address] = current_nonce # 记录地址的 nonce
171
+ # accounts.append((account_address.strip(), private_key.strip())) # 保存地址和私钥还有 nonce
172
+ # else:
173
+ # st.error("地址或私钥无效,请检查!")
174
+ # st.stop()
175
+ #
176
+ # # 配置铭文文本
177
+ # ethscriptions_str = st.text_area(f'输入**多个域名铭文或其他**,可以用空格、换行符、英文逗号(,)分开,不要带 data:, 前缀,不要带域名后缀')
178
+ # name_options = ["自定义", ".eth", ".eths", ".tree", ".honk", ".etch"]
179
+ # name_selected_option = st.selectbox(f'选择**域名后缀**', name_options)
180
+ # if name_selected_option == '自定义':
181
+ # name_selected_option = st.text_input('输入**自定义的域名**:')
182
+ # # 以空格、换行符、英文逗号分隔文本并加上后缀
183
+ # ethscription_list = split_and_append(ethscriptions_str, name_selected_option)
184
+ #
185
+ # # 判断铭文文本里是否包含空格、换行符,而且所有的字母都必须为小写。
186
+ # if not validate_input(''.join(ethscription_list)):
187
+ # st.warning("**请注意**:通常代币铭文文本里不能包含空格、换行符,而且所有的字母都必须为小写。")
188
+ #
189
+ # # 题写铭文之前检查该铭文有没有被题写
190
+ # if st.checkbox(f'题写铭文之前**检查该铭文有没有被题写**'):
191
+ # token_check = True
192
+ # else:
193
+ # token_check = False
194
+ #
195
+ # # 每次交易成功后暂停 3 秒
196
+ # if st.checkbox(f'每次交易完成后暂停 3 秒'):
197
+ # sleep_3s = True
198
+ # else:
199
+ # sleep_3s = False
200
+ #
201
+ # # 点击发送交易开始
202
+ # if st.button(f'开始**发送交易**'):
203
+ # if not accounts or not ethscriptions_str or not name_selected_option: # 检查是否留空
204
+ # st.error(f'请正确谨慎地填写内容,每一项都**不应留空**。')
205
+ # st.stop()
206
+ # else:
207
+ # st.toast('看起来你输入的内容均无没有问题!', icon='🥳')
208
+ #
209
+ # st.toast(f'开始任务,需要题写的铭文总量为:{len(ethscription_list)}', icon='😎')
210
+ #
211
+ # # 对代币铭文 id 进行循环
212
+ # for name_str in ethscription_list:
213
+ # # 使用当前账户发送交易,获取当前账户的 nonce
214
+ # address, key = accounts[current_account_index]
215
+ # # 获取 gas
216
+ # gas_price = w3.eth.gas_price
217
+ # # 得到完整的铭文文本
218
+ # if not name_str.startswith('data:,'):
219
+ # input_data = f'data:,{name_str}'
220
+ #
221
+ # # 根据是否检查的开关进行
222
+ # if token_check:
223
+ # # 这里是开了检查后请求 Ethscriptions API
224
+ # if check_content_exists(sha256(input_data)):
225
+ # # 返回数据为 Ture,说明该铭文已经被题写,打印信息
226
+ # st.toast(f'{input_data} 已经被题写!', icon='☹️')
227
+ # else:
228
+ # # 返回数据为 False,说明该铭文还没被题写,发送交易
229
+ # # 使用 current_nonce 发送交易
230
+ # data, tx_hash = send_transaction(w3, address, key, chain_id, gas_price, input_data, nonces[address])
231
+ # # 记录最后输出的结果
232
+ # transaction_results.append(f"{address} | {data} | Transaction Hash: {tx_hash}")
233
+ # # 交易成功后,手动增加 nonce 值
234
+ # nonces[address] += 1
235
+ # else:
236
+ # # 这里是未开检查后直接发送交易
237
+ # # 使用 current_nonce 发送交易
238
+ # data, tx_hash = send_transaction(w3, address, key, chain_id, gas_price, input_data, nonces[address])
239
+ # # 记录最后输出的结果
240
+ # transaction_results.append(f"{address} | {data} | Transaction Hash: {tx_hash}")
241
+ # # 交易成功后,手动增加 nonce 值
242
+ # nonces[address] += 1
243
+ # # 更新当前账户索引,确保索引始终在账户列表的范围内
244
+ # current_account_index = (current_account_index + 1) % len(accounts)
245
+ # # 暂停 3 秒
246
+ # if sleep_3s:
247
+ # time.sleep(3) # 暂停三秒
248
+ # st.toast(f'所有任务已经完成。', icon='🎉')
249
+ # # 庆祝动画
250
+ # st.balloons()
251
+ # # 显示所有交易的结果
252
+ # st.code('\n'.join(transaction_results))
pages/3_🪙_ 批量题写代币铭文.py CHANGED
@@ -96,140 +96,141 @@ st.info('''##### 在使用之前,敬请仔细阅读说明,感谢您的配合
96
  - 我们建议您使用备用账号,并避免在账号中存放大额资金。
97
  - 若您对此代码存有疑虑,建议您利用如 [ChetGPT](https://chat.openai.com/)、[Bard](https://bard.google.com/) 或 [Claude](https://claude.ai/) 等知名 AI 平台进行查询,以判断是否含有恶意代码。
98
  ''')
99
-
100
- # 连接的网络 ID。比如说,1 代表 Mainnet,5 代表 Goerli 测试网络,11155111 代表 Sepolia 测试网络,如果你不放心,可以先用测试网试试。
101
- net_options = {
102
- '1': 'Mainnet',
103
- '5': 'Goerli',
104
- '11155111': 'Sepolia'
105
- }
106
- selected_option = st.selectbox(
107
- '**网络 ID**',
108
- list(net_options.keys()),
109
- format_func=lambda x: f"{x} ({net_options[x]})"
110
- )
111
- chain_id = int(selected_option)
112
-
113
- # 这里配置 Ethereum PRC URL,如果你没有,请到 infura.io 或者 alchemy.com 申请一个免费的 API
114
- token_eth_prc_url = st.text_input(
115
- f'**Ethereum PRC 链接**:选填,你可以去 [infura.io](https://app.infura.io/) 或者 [alchemy.com](https://alchemy.com/) 免费申请一个',
116
- f'https://{net_options[str(chain_id)]}.infura.io/v3/eab7f935b9af45e1a54f7d7ed06c5206')
117
- w3 = Web3(Web3.HTTPProvider(f'{token_eth_prc_url}'))
118
-
119
- # 初始化当前账户索引为 0
120
- current_account_index = 0
121
- # 收集和显示所有交易的结果
122
- transaction_results = []
123
- # 创建账户列表
124
- accounts = []
125
- # 使用字典来跟踪每个地址的nonce
126
- nonces = {}
127
-
128
- # 启用多账户操作
129
- if st.checkbox(f'启用**多账户**操作'):
130
- # 多账户的文本框
131
- account_list = st.text_area(f'输入多个 **ETH 地址及其对应的私钥**,用英文逗号分隔(,),如下:地址,私钥')
132
- if account_list: # 如果账户列表有内容
133
- for line in account_list.split('\n'): # 根据换行符划分账户
134
- if ',' in line: # 检查是否包含逗号
135
- address, key = line.split(',') # 分开地址和私钥
136
- if is_valid_eth_address(address) and is_valid_eth_private_key(key): # 验证地址和私钥
137
- current_nonce = w3.eth.get_transaction_count(address) # 获取地址的 nonce
138
- nonces[address] = current_nonce # 记录地址的 nonce
139
- accounts.append((address.strip(), key.strip())) # 保存地址和私钥还有 nonce
140
- else:
141
- st.error(f"地址 {address} 或私钥 {key} 无效,请检查!")
142
- st.stop()
143
- else:
144
- st.error(f"输入格式错误,请确保每行包含一个地址和一个私钥,并使用英文逗号分隔(,)。错误行:**{line}**")
145
- st.stop()
146
- else:
147
- account_address = st.text_input('填写你的 **ETH 地址**:')
148
- private_key = st.text_input('填写你的 **ETH 地址对应的私钥**:', type="password")
149
- if account_address and private_key: # 如果地址和私钥有内容
150
- if is_valid_eth_address(account_address) and is_valid_eth_private_key(private_key): # 验证地址和私钥
151
- current_nonce = w3.eth.get_transaction_count(account_address) # 获取地址的 nonce
152
- nonces[account_address] = current_nonce # 记录地址的 nonce
153
- accounts.append((account_address.strip(), private_key.strip())) # 保存地址和私钥还有 nonce
154
- else:
155
- st.error("地址或私钥无效,请检查!")
156
- st.stop()
157
-
158
- # 配置铭文文本
159
- token_protocol = st.text_input('填写需要题写代币铭文协议 **Protocol(p)**:', 'erc-20')
160
- token_operation = st.text_input('填写需要题写代币铭文操作 **Operation(op)**:', 'mint')
161
- token_ticker = st.text_input('填写需要题写代币铭文简称 **Ticker(tick)**:')
162
- token_min_id = st.number_input('填写需要题写代币铭文范围的**最小 ID(id)**:', min_value=1, value=1, step=1)
163
- token_max_id = st.number_input('填写需要题写代币铭文范围的**最大 ID(id)**:', value=21000, step=1)
164
- token_amount = st.number_input('填写需要题写代币铭文数量 **Amount(amt)**:', min_value=1, value=1000, step=1)
165
- st.markdown('###### 预览你需要题写的代币铭文:')
166
- st.code(
167
- f'data:,{{"p":"{token_protocol}","op":"{token_operation}","tick":"{token_ticker}","id":"{token_min_id}","amt":"{token_amount}"}}',
168
- language="json", line_numbers=False)
169
- # 判断铭文文本里是否包含空格、换行符,而且所有的字母都必须为小写。
170
- if not validate_input(
171
- f'data:,{{"p":"{token_protocol}","op":"{token_operation}","tick":"{token_ticker}","id":"{token_min_id}","amt":"{token_amount}"}}'):
172
- st.warning("**请注意**:通常代币铭文文本里不能包含空格、换行符,而且所有的字母都必须为小写。")
173
-
174
- # 题写铭文之前检查该铭文有没有被题写
175
- if st.checkbox(f'题写铭文之前**检查该铭文有没有被题写**'):
176
- token_check = True
177
- else:
178
- token_check = False
179
-
180
- # 每次交易成功后暂停 3 秒
181
- if st.checkbox(f'每次交易完成后暂停 3 秒'):
182
- sleep_3s = True
183
- else:
184
- sleep_3s = False
185
-
186
- # 点击发送交易开始
187
- if st.button(f'开始**发送交易**'):
188
- if not accounts or not token_protocol or not token_operation or not token_ticker: # 检查是否留空
189
- st.error(f'请正确谨慎地填写内容,每一项都**不应留空**。')
190
- st.stop()
191
- else:
192
- st.toast('看起来你输入的内容均无没有问题!', icon='🥳')
193
-
194
- st.toast(f'开始任务,需要题写的铭文总量为:{token_max_id - token_min_id + 1}', icon='😎')
195
-
196
- # 对代币铭文 id 进行循环
197
- for the_id in range(token_min_id, token_max_id + 1):
198
- # 使用当前账户发送交易,获取当前账户的 nonce
199
- address, key = accounts[current_account_index]
200
- # 得到完整的铭文文本
201
- input_data = f'data:,{{"p":"{token_protocol}","op":"{token_operation}","tick":"{token_ticker}","id":"{the_id}","amt":"{token_amount}"}}'
202
- # 获取 gas
203
- gas_price = w3.eth.gas_price
204
- # 根据是否检查的开关进行
205
- if token_check:
206
- # 这里是开了检查后请求 Ethscriptions API
207
- if check_content_exists(sha256(input_data)):
208
- # 返回数据为 Ture,说明该铭文已经被题写,打印信息
209
- st.toast(f'{input_data} 已经被题写!', icon='☹️')
210
- else:
211
- # 返回数据为 False,说明该铭文还没被题写,发送交易
212
- # 使用 current_nonce 发送交易
213
- data, tx_hash = send_transaction(w3, address, key, chain_id, gas_price, input_data, nonces[address])
214
- # 记录最后输出的结果
215
- transaction_results.append(f"{address} | {data} | Transaction Hash: {tx_hash}")
216
- # 交易成功后,手动增加 nonce
217
- nonces[address] += 1
218
- else:
219
- # 这里是未开检查后直接发送交易
220
- # 使用 current_nonce 发送交易
221
- data, tx_hash = send_transaction(w3, address, key, chain_id, gas_price, input_data, nonces[address])
222
- # 记录最后输出的结果
223
- transaction_results.append(f"{address} | {data} | Transaction Hash: {tx_hash}")
224
- # 交易成功后,手动增加 nonce
225
- nonces[address] += 1
226
- # 更新当前账户索引,确保索引始终在账户列表的范围内
227
- current_account_index = (current_account_index + 1) % len(accounts)
228
- # 暂停 3
229
- if sleep_3s:
230
- time.sleep(3) # 暂停三秒
231
- st.toast(f'所有任务已经完成。', icon='🎉')
232
- # 庆祝动画
233
- st.balloons()
234
- # 显示所有交易的结果
235
- st.code('\n'.join(transaction_results))
 
 
96
  - 我们建议您使用备用账号,并避免在账号中存放大额资金。
97
  - 若您对此代码存有疑虑,建议您利用如 [ChetGPT](https://chat.openai.com/)、[Bard](https://bard.google.com/) 或 [Claude](https://claude.ai/) 等知名 AI 平台进行查询,以判断是否含有恶意代码。
98
  ''')
99
+ st.error('# 存在争议,暂停开放使用!')
100
+
101
+ # # 连接的网络 ID。比如说,1 代表 Mainnet,5 代表 Goerli 测试网络,11155111 代表 Sepolia 测试网络,如果你不放心,可以先用测试网试试。
102
+ # net_options = {
103
+ # '1': 'Mainnet',
104
+ # '5': 'Goerli',
105
+ # '11155111': 'Sepolia'
106
+ # }
107
+ # selected_option = st.selectbox(
108
+ # '**网络 ID**',
109
+ # list(net_options.keys()),
110
+ # format_func=lambda x: f"{x} ({net_options[x]})"
111
+ # )
112
+ # chain_id = int(selected_option)
113
+ #
114
+ # # 这里配置 Ethereum PRC URL,如果你没有,请到 infura.io 或者 alchemy.com 申请一个免费的 API
115
+ # token_eth_prc_url = st.text_input(
116
+ # f'**Ethereum PRC 链接**:选填,你可以去 [infura.io](https://app.infura.io/) 或者 [alchemy.com](https://alchemy.com/) 免费申请一个',
117
+ # f'https://{net_options[str(chain_id)]}.infura.io/v3/eab7f935b9af45e1a54f7d7ed06c5206')
118
+ # w3 = Web3(Web3.HTTPProvider(f'{token_eth_prc_url}'))
119
+ #
120
+ # # 初始化当前账户索引为 0
121
+ # current_account_index = 0
122
+ # # 收集和显示所有交易的结果
123
+ # transaction_results = []
124
+ # # 创建账户列表
125
+ # accounts = []
126
+ # # 使用字典来跟踪每个地址的nonce
127
+ # nonces = {}
128
+ #
129
+ # # 启用多账户操作
130
+ # if st.checkbox(f'启用**多账户**操作'):
131
+ # # 多账户的文本框
132
+ # account_list = st.text_area(f'输入多个 **ETH 地址及其对应的私钥**,用英文逗号分隔(,),如下:地址,私钥')
133
+ # if account_list: # 如果账户列表有内容
134
+ # for line in account_list.split('\n'): # 根据换行符划分账户
135
+ # if ',' in line: # 检查是否包含逗号
136
+ # address, key = line.split(',') # 分开地址和私钥
137
+ # if is_valid_eth_address(address) and is_valid_eth_private_key(key): # 验证地址和私钥
138
+ # current_nonce = w3.eth.get_transaction_count(address) # 获取地址的 nonce
139
+ # nonces[address] = current_nonce # 记录地址的 nonce
140
+ # accounts.append((address.strip(), key.strip())) # 保存地址和私钥还有 nonce
141
+ # else:
142
+ # st.error(f"地址 {address} 或私钥 {key} 无效,请检查!")
143
+ # st.stop()
144
+ # else:
145
+ # st.error(f"输入格式错误,请确保每行包含一个地址和一个私钥,并使用英文逗号分隔(,)。错误行:**{line}**")
146
+ # st.stop()
147
+ # else:
148
+ # account_address = st.text_input('填写你的 **ETH 地址**:')
149
+ # private_key = st.text_input('填写你的 **ETH 地址对应的私钥**:', type="password")
150
+ # if account_address and private_key: # 如果地址和私钥有内容
151
+ # if is_valid_eth_address(account_address) and is_valid_eth_private_key(private_key): # 验证地址和私钥
152
+ # current_nonce = w3.eth.get_transaction_count(account_address) # 获取地址的 nonce
153
+ # nonces[account_address] = current_nonce # 记录地址的 nonce
154
+ # accounts.append((account_address.strip(), private_key.strip())) # 保存地址和私钥还有 nonce
155
+ # else:
156
+ # st.error("地址或私钥无效,请检查!")
157
+ # st.stop()
158
+ #
159
+ # # 配置铭文文本
160
+ # token_protocol = st.text_input('填写需要题写代币铭文协议 **Protocol(p)**:', 'erc-20')
161
+ # token_operation = st.text_input('填写需要题写代币铭文操作 **Operation(op)**:', 'mint')
162
+ # token_ticker = st.text_input('填写需要题写代币铭文简称 **Ticker(tick)**:')
163
+ # token_min_id = st.number_input('填写需要题写代币铭文范围的**最小 ID(id)**:', min_value=1, value=1, step=1)
164
+ # token_max_id = st.number_input('填写需要题写代币铭文范围的**最大 ID(id)**:', value=21000, step=1)
165
+ # token_amount = st.number_input('填写需要题写代币铭文数量 **Amount(amt)**:', min_value=1, value=1000, step=1)
166
+ # st.markdown('###### 预览你需要题写的代币铭文:')
167
+ # st.code(
168
+ # f'data:,{{"p":"{token_protocol}","op":"{token_operation}","tick":"{token_ticker}","id":"{token_min_id}","amt":"{token_amount}"}}',
169
+ # language="json", line_numbers=False)
170
+ # # 判断铭文文本里是否包含空格、换行符,而且所有的字母都必须为小写。
171
+ # if not validate_input(
172
+ # f'data:,{{"p":"{token_protocol}","op":"{token_operation}","tick":"{token_ticker}","id":"{token_min_id}","amt":"{token_amount}"}}'):
173
+ # st.warning("**请注意**:通常代币铭文文本里不能包含空格、换行符,而且所有的字母都必须为小写。")
174
+ #
175
+ # # 题写铭文之前检查该铭文有没有被题写
176
+ # if st.checkbox(f'题写铭文之前**检查该铭文有没有被题写**'):
177
+ # token_check = True
178
+ # else:
179
+ # token_check = False
180
+ #
181
+ # # 每次交易成功后暂停 3 秒
182
+ # if st.checkbox(f'每次交易完成后暂停 3 秒'):
183
+ # sleep_3s = True
184
+ # else:
185
+ # sleep_3s = False
186
+ #
187
+ # # 点击发送交易开始
188
+ # if st.button(f'开始**发送交易**'):
189
+ # if not accounts or not token_protocol or not token_operation or not token_ticker: # 检查是否留空
190
+ # st.error(f'请正确谨慎地填写内容,每一项都**不应留空**。')
191
+ # st.stop()
192
+ # else:
193
+ # st.toast('看起来你输入的内容均无没有问题!', icon='🥳')
194
+ #
195
+ # st.toast(f'开始任务,需要题写的铭文总量为:{token_max_id - token_min_id + 1}', icon='😎')
196
+ #
197
+ # # 对代币铭文 id 进行循环
198
+ # for the_id in range(token_min_id, token_max_id + 1):
199
+ # # 使用当前账户发送交易,获取当前账户的 nonce
200
+ # address, key = accounts[current_account_index]
201
+ # # 得到完整的铭文文本
202
+ # input_data = f'data:,{{"p":"{token_protocol}","op":"{token_operation}","tick":"{token_ticker}","id":"{the_id}","amt":"{token_amount}"}}'
203
+ # # 获取 gas
204
+ # gas_price = w3.eth.gas_price
205
+ # # 根据是否检查的开关进行
206
+ # if token_check:
207
+ # # 这里是开了检查后请求 Ethscriptions API
208
+ # if check_content_exists(sha256(input_data)):
209
+ # # 返回数据为 Ture,说明该铭文已经被题写,打印信息
210
+ # st.toast(f'{input_data} 已经被题写!', icon='☹️')
211
+ # else:
212
+ # # 返回数据为 False,说明该铭文还没被题写,发送交易
213
+ # # 使用 current_nonce 发送交易
214
+ # data, tx_hash = send_transaction(w3, address, key, chain_id, gas_price, input_data, nonces[address])
215
+ # # 记录最后输出的结果
216
+ # transaction_results.append(f"{address} | {data} | Transaction Hash: {tx_hash}")
217
+ # # 交易成功后,手动增加 nonce 值
218
+ # nonces[address] += 1
219
+ # else:
220
+ # # 这里是未开检查后直接发送交易
221
+ # # 使用 current_nonce 发送交易
222
+ # data, tx_hash = send_transaction(w3, address, key, chain_id, gas_price, input_data, nonces[address])
223
+ # # 记录最后输出的结果
224
+ # transaction_results.append(f"{address} | {data} | Transaction Hash: {tx_hash}")
225
+ # # 交易成功后,手动增加 nonce 值
226
+ # nonces[address] += 1
227
+ # # 更新当前账户索引,确保索引始终在账户列表的范围内
228
+ # current_account_index = (current_account_index + 1) % len(accounts)
229
+ # # 暂停 3 秒
230
+ # if sleep_3s:
231
+ # time.sleep(3) # 暂停三秒
232
+ # st.toast(f'所有任务已经完成。', icon='🎉')
233
+ # # 庆祝动画
234
+ # st.balloons()
235
+ # # 显示所有交易的结果
236
+ # st.code('\n'.join(transaction_results))
pages/4_💹️_铭文数据分析.py CHANGED
@@ -140,9 +140,19 @@ def get_ethscriptions_data():
140
  # 获取最新的区块
141
  latest_block_number_thread = w3.eth.block_number
142
 
143
- # 等待1分钟
144
- time.sleep(60)
 
145
 
 
 
 
 
 
 
 
 
 
146
 
147
  # Streamlit app layout
148
  st.set_page_config(page_title="EthPen - 铭文数据分析", page_icon="💹", layout='wide', initial_sidebar_state='auto')
@@ -175,12 +185,15 @@ if eths_data:
175
 
176
  eths_stakers = st.metric(label='ETHS TVL', value=f'${eths_data[0][8]:,.0f}')
177
 
 
 
 
178
  ethscriptions_cur.execute("SELECT block_number FROM process_blocks")
179
- result = ethscriptions_cur.fetchone()
180
- processed_block = result[0]
181
- latest_block_number = w3.eth.block_number
182
- st.markdown(
183
- f'EthPen Ethscriptions Index Status:当前 Ethereum 最高区块:{latest_block_number},已处理区块:{processed_block}')
184
 
185
  download = st.checkbox(" ", value=False)
186
  if download:
@@ -204,13 +217,16 @@ if state_value == "0":
204
  ethscriptions_cur.execute("UPDATE thread_start_state SET state = ?", (new_state,))
205
  ethscriptions_con.commit()
206
  ethscriptions_con.close()
 
207
  eths_thread = threading.Thread(target=get_eths_data)
208
  ethscriptions_thread = threading.Thread(target=get_ethscriptions_data)
209
 
210
  # 启动线程
 
211
  eths_thread.start()
212
  ethscriptions_thread.start()
213
 
214
  # 等待线程结束
215
  eths_thread.join()
216
  ethscriptions_thread.join()
 
 
140
  # 获取最新的区块
141
  latest_block_number_thread = w3.eth.block_number
142
 
143
+ # 等待
144
+ time.sleep(15)
145
+
146
 
147
+ # def get_index_status(index_status):
148
+ # while True:
149
+ # ethscriptions_cur.execute("SELECT block_number FROM process_blocks")
150
+ # result = ethscriptions_cur.fetchone()
151
+ # processed_block = result[0]
152
+ # latest_block_number = w3.eth.block_number
153
+ # with index_status:
154
+ # st.markdown(f'*EthPen Ethscriptions Index Status: {processed_block}/{latest_block_number}*')
155
+ # time.sleep(15)
156
 
157
  # Streamlit app layout
158
  st.set_page_config(page_title="EthPen - 铭文数据分析", page_icon="💹", layout='wide', initial_sidebar_state='auto')
 
185
 
186
  eths_stakers = st.metric(label='ETHS TVL', value=f'${eths_data[0][8]:,.0f}')
187
 
188
+
189
+ # index_status = st.empty()
190
+ # # st.markdown(f'*EthPen Ethscriptions Index Status: {processed_block}/{latest_block_number}*')
191
  ethscriptions_cur.execute("SELECT block_number FROM process_blocks")
192
+ index_result = ethscriptions_cur.fetchone()
193
+ index_processed_block = index_result[0]
194
+ index_latest_block_number = w3.eth.block_number
195
+ st.markdown(f'*EthPen Ethscriptions Index Status: {index_processed_block}/{index_latest_block_number}*')
196
+
197
 
198
  download = st.checkbox(" ", value=False)
199
  if download:
 
217
  ethscriptions_cur.execute("UPDATE thread_start_state SET state = ?", (new_state,))
218
  ethscriptions_con.commit()
219
  ethscriptions_con.close()
220
+ # index_status_thread = threading.Thread(target=get_index_status, args=(index_status,))
221
  eths_thread = threading.Thread(target=get_eths_data)
222
  ethscriptions_thread = threading.Thread(target=get_ethscriptions_data)
223
 
224
  # 启动线程
225
+ # index_status_thread.start()
226
  eths_thread.start()
227
  ethscriptions_thread.start()
228
 
229
  # 等待线程结束
230
  eths_thread.join()
231
  ethscriptions_thread.join()
232
+ # index_status_thread.join()
pages/5_🏫_教程中心.py CHANGED
@@ -3,7 +3,19 @@ import re
3
  import os
4
  import sqlite3
5
  import pandas as pd
6
-
7
 
8
  st.error('开发中,仅供参考...')
9
- st.markdown(f'# 教程中心')
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  import os
4
  import sqlite3
5
  import pandas as pd
6
+ import time
7
 
8
  st.error('开发中,仅供参考...')
9
+ st.markdown(f'# 教程中心')
10
+
11
+ # st.title("定时刷新内容示例")
12
+ #
13
+ # refresh_interval = 5 # 刷新间隔,单位为秒
14
+ #
15
+ # # 创建一个空的占位符
16
+ # placeholder = st.empty()
17
+ #
18
+ # while True:
19
+ # # 更新占位符的内容
20
+ # placeholder.write(f"当前时间:{time.ctime()}")
21
+ # time.sleep(refresh_interval)
🖊️EthPen-以太之笔.py ADDED
@@ -0,0 +1,1514 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import requests
3
+ import re
4
+ import json
5
+ import hashlib
6
+ import pandas as pd
7
+ import base64
8
+ import sqlite3
9
+ import os
10
+
11
+ infura_api_key = "9bbc614b8a1d49d59869e97d0ee3bf61"
12
+
13
+ # Ethscriptions Mainnet API 的基础 URL
14
+ BASE_URL = "https://mainnet-api.ethscriptions.com/api"
15
+
16
+ # 获取当前文件目录
17
+ current_dir = os.path.dirname(os.path.abspath(__file__))
18
+
19
+ # 构造数据库文件路径
20
+ eths_db_file = os.path.join(current_dir, 'data', 'eths_data.db')
21
+
22
+ # Initialize connection to SQLite database
23
+ conn = sqlite3.connect(eths_db_file)
24
+ c = conn.cursor()
25
+
26
+ # Create table to store ETHS data
27
+ c.execute('''
28
+ CREATE TABLE IF NOT EXISTS eths_data
29
+ (date text,
30
+ eth_price real,
31
+ eths_price real,
32
+ eths_market_cap integer,
33
+ eths_owners integer,
34
+ eths_volume24h real,
35
+ eths_totalLocked integer,
36
+ eths_stakers integer,
37
+ eths_tvl real)
38
+ ''')
39
+
40
+ # 查询地址所属代币铭文的 token 列表
41
+ token_list = [{'p': 'erc-20', 'tick': 'eths', 'id': 21000, 'amt': '1000'},
42
+ {'p': 'erc-20', 'tick': 'gwei', 'id': 21000, 'amt': '1000'},
43
+ {'p': 'erc-20', 'tick': 'ercs', 'id': 21000, 'amt': '1000'},
44
+ {'p': 'erc-20', 'tick': 'etch', 'id': 21000, 'amt': '1000'},
45
+ {'p': 'erc-20', 'tick': 'dumb', 'id': 21000, 'amt': '1000'}]
46
+
47
+ ethscrptions_logo = """<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-0.53 -2.18 14.000028839170737 20.067148724063962" style="enable-background:new 0 0 100 16.4081;" xml:space="preserve" width="19" height="25" xmlns:svgjs="http://svgjs.dev/svgjs">
48
+ <g>
49
+ <path d="M11.6219,5.1455c-0.0003-0.0017-0.0012-0.0032-0.0015-0.0048c-0.0033-0.0173-0.0083-0.0343-0.0161-0.0502&#10;&#9;&#9;c-0.0086-0.0175-0.0199-0.034-0.0338-0.0487c-0.0053-0.0055-0.0119-0.0088-0.0176-0.0136&#10;&#9;&#9;c-0.0246-0.0207-0.0525-0.0365-0.0832-0.0431c-0.0378-0.0083-0.078-0.0056-0.1153,0.0093L8.399,6.1767&#10;&#9;&#9;C8.3763,6.1858,8.3568,6.1999,8.3393,6.216C8.3361,6.219,8.3329,6.2215,8.3299,6.2246c-0.0158,0.0166-0.0284,0.0357-0.0376,0.057&#10;&#9;&#9;c-0.0008,0.0018-0.0024,0.003-0.0032,0.0048l-0.5395,1.349L6.4982,1.1993c-0.002-0.0102-0.007-0.0192-0.0104-0.0288L6.3012,0.2141&#10;&#9;&#9;C6.2857,0.1355,6.2244,0.074,6.1459,0.0585C6.0681,0.0434,5.9871,0.0767,5.9433,0.1434l-4.9257,7.487&#10;&#9;&#9;c-0.011,0.0167-0.0187,0.0347-0.0241,0.0533c-0.0002,0.0007-0.0008,0.0012-0.001,0.002c-0.0007,0.0024,0,0.0049-0.0005,0.0072&#10;&#9;&#9;C0.9871,7.713,0.9859,7.7333,0.9875,7.7538c0.0005,0.0061,0.0009,0.0118,0.0019,0.0178c0.0039,0.0229,0.0104,0.0454,0.0224,0.0662&#10;&#9;&#9;L2.046,9.6167L0.3277,8.494C0.2674,8.4544,0.1902,8.4511,0.1269,8.4852c-0.0635,0.0341-0.1033,0.1001-0.104,0.172L0,11.2824&#10;&#9;&#9;c-0.0002,0.0267,0.0066,0.0516,0.0162,0.0753c0.0024,0.0058,0.0048,0.011,0.0077,0.0166c0.0118,0.0227,0.0266,0.0438,0.0464,0.0605&#10;&#9;&#9;c0.0003,0.0002,0.0003,0.0006,0.0007,0.0008l5.9106,4.9268c0.0031,0.0026,0.007,0.0035,0.0102,0.0058&#10;&#9;&#9;C6,16.3744,6.0082,16.3805,6.0173,16.3852c0.0028,0.0014,0.0053,0.003,0.0082,0.0043c0.0027,0.0012,0.0055,0.0016,0.0083,0.0028&#10;&#9;&#9;c0.0047,0.0019,0.0091,0.0037,0.0139,0.0053c0.0066,0.0022,0.0133,0.0039,0.0202,0.0053c0.003,0.0006,0.0055,0.0022,0.0085,0.0027&#10;&#9;&#9;c0.0104,0.0017,0.021,0.0025,0.0313,0.0025c0.0001,0,0.0001,0,0.0002,0c0.0001,0,0.0001-0.0001,0.0002-0.0001&#10;&#9;&#9;c0.0093,0,0.0186-0.0005,0.0279-0.0021c0.002-0.0003,0.0036-0.0017,0.0056-0.002c0.0068-0.0012,0.0137-0.0022,0.0203-0.0041&#10;&#9;&#9;c0.0051-0.0015,0.0098-0.0037,0.0148-0.0056c0.0024-0.0009,0.0049-0.0005,0.0072-0.0014c0.002-0.0008,0.0032-0.0025,0.0051-0.0034&#10;&#9;&#9;c0.0066-0.003,0.0131-0.0062,0.0193-0.01c0.0028-0.0016,0.0053-0.0032,0.0079-0.0049c0.002-0.0013,0.0042-0.0017,0.0061-0.0031&#10;&#9;&#9;c0.0022-0.0015,0.0032-0.0039,0.0053-0.0055c0.0049-0.0037,0.0099-0.0069,0.0144-0.0111c0.0025-0.0024,0.0042-0.0052,0.0066-0.0077&#10;&#9;&#9;c0.0081-0.0084,0.0164-0.0167,0.023-0.0267l0.0014-0.0022c0.0001,0,0.0001,0,0.0001-0.0001l1.1807-1.771l1.5889-2.3833&#10;&#9;&#9;l0.7754-1.1632c0.0443-0.0663,0.0441-0.153-0.0004-0.2191c-0.0446-0.0662-0.1239-0.0981-0.2028-0.0833l-0.5723,0.1161L11.6064,5.26&#10;&#9;&#9;c0.0038-0.0083,0.0048-0.0171,0.0074-0.0256c0.0032-0.0103,0.0076-0.0204,0.0089-0.031c0.0004-0.003-0.0003-0.006-0.0001-0.009&#10;&#9;&#9;C11.6241,5.178,11.6245,5.1616,11.6219,5.1455z M0.4138,9.021l0.2456,0.1605l0.2141,1.193l-0.4754,0.4488L0.4138,9.021z&#10;&#9;&#9; M0.4938,11.2751l0.5787-0.5465l3.2682,3.7531L0.4938,11.2751z M2.8047,10.1374L1.4545,7.8151l1.8657-1.0145l0.268,0.9764&#10;&#9;&#9;l1.9285,7.0254L2.8047,10.1374z M3.299,6.3636L1.7791,7.19l4.2278-6.4264l0.0874,0.4481L3.299,6.3636z M9.2254,11.1793&#10;&#9;&#9;L8.813,11.7979l-0.738-0.3853l0.6649-0.1348c0.0001,0,0.0001,0,0.0003,0L9.2254,11.1793z M7.7577,10.2479L7.8786,8.374&#10;&#9;&#9;l0.6604-1.651l0.5335,0.5794L7.7577,10.2479z M10.7687,6.1234l-0.3365,0.2091L9.3397,7.0111l-0.529-0.5746l2.2278-0.8912&#10;&#9;&#9;L10.7687,6.1234z"/>
50
+ <g>
51
+ <polygon points="14.6965,13.7003 21.6177,13.7003 21.6177,11.5939 17.3105,11.5939 17.3105,9.9388 21.2789,9.9388 21.2789,7.8323 &#10;&#9;&#9;&#9;17.3105,7.8323 17.3105,6.1773 21.636,6.1773 21.636,4.0719 14.6965,4.0719 &#9;&#9;"/>
52
+ <path d="M26.4696,11.8007c-0.1051,0.0194-0.1966,0.0291-0.2748,0.0291c-0.1131,0-0.2058-0.0172-0.2774-0.0495&#10;&#9;&#9;&#9;c-0.0722-0.0334-0.1255-0.083-0.16-0.1509c-0.0345-0.0668-0.0518-0.1509-0.0518-0.251V8.3593h1.2413V6.479h-1.2413V4.7486h-2.5951&#10;&#9;&#9;&#9;V6.479h-0.9218v1.8803h0.9218v3.2637c-0.0065,0.5042,0.0921,0.9244,0.2957,1.2596c0.2037,0.3351,0.508,0.5807,0.9121,0.7359&#10;&#9;&#9;&#9;c0.4046,0.1552,0.9046,0.2166,1.4999,0.1853c0.2947-0.0162,0.5495-0.0485,0.7644-0.0991&#10;&#9;&#9;&#9;c0.2144-0.0496,0.3798-0.0916,0.4957-0.1261l-0.3761-1.8242C26.6522,11.7663,26.5747,11.7824,26.4696,11.8007z"/>
53
+ <path d="M33.9108,6.7322c-0.3777-0.2316-0.8222-0.348-1.3329-0.348c-0.5328,0-0.9891,0.1293-1.3684,0.3879&#10;&#9;&#9;&#9;c-0.3793,0.2586-0.6503,0.6185-0.8135,1.0797h-0.0749V4.0719h-2.5014v9.6284h2.5951V9.6382&#10;&#9;&#9;&#9;c0.0032-0.2382,0.0479-0.4429,0.1342-0.6131c0.0862-0.1713,0.2085-0.3028,0.3669-0.3955c0.1578-0.0927,0.3421-0.139,0.5522-0.139&#10;&#9;&#9;&#9;c0.3325,0,0.5884,0.1024,0.7688,0.306c0.1805,0.2037,0.2688,0.4838,0.2656,0.8415v4.0621h2.5956V9.093&#10;&#9;&#9;&#9;c0.0027-0.5269-0.0996-0.9935-0.3082-1.4007C34.5815,7.2839,34.2884,6.965,33.9108,6.7322z"/>
54
+ <path d="M40.6348,9.3559L39.1678,9.093c-0.2758-0.0506-0.4617-0.1207-0.5571-0.2112c-0.0959-0.0916-0.1423-0.1896-0.139-0.2963&#10;&#9;&#9;&#9;c-0.0033-0.1509,0.0754-0.2672,0.2349-0.348c0.16-0.0819,0.3513-0.1228,0.5738-0.1228c0.1724,0,0.3297,0.0291,0.4725,0.0872&#10;&#9;&#9;&#9;c0.1427,0.0582,0.2602,0.1401,0.3507,0.2468c0.0905,0.1067,0.1422,0.2338,0.1551,0.3815h2.3877&#10;&#9;&#9;&#9;c-0.0312-0.765-0.348-1.3641-0.9514-1.7962c-0.6034-0.4332-1.4277-0.6498-2.4712-0.6498c-0.6864,0-1.2796,0.0927-1.7795,0.2759&#10;&#9;&#9;&#9;c-0.4999,0.1832-0.8841,0.4493-1.1518,0.7995c-0.2678,0.3491-0.4003,0.7747-0.3971,1.2757&#10;&#9;&#9;&#9;c-0.0032,0.5679,0.1783,1.0312,0.5452,1.3921c0.3669,0.3599,0.9186,0.6044,1.655,0.7338l1.279,0.2252&#10;&#9;&#9;&#9;c0.2818,0.0506,0.4898,0.1163,0.6234,0.1972c0.1325,0.0819,0.2004,0.1918,0.2047,0.3297c-0.0043,0.1497-0.083,0.2661-0.2382,0.348&#10;&#9;&#9;&#9;c-0.1551,0.0808-0.3518,0.1218-0.5899,0.1218c-0.2947,0-0.5387-0.0614-0.7311-0.1853c-0.1928-0.1239-0.3065-0.3006-0.341-0.529&#10;&#9;&#9;&#9;h-2.5768c0.0722,0.7391,0.4192,1.335,1.0414,1.7865c0.6222,0.4515,1.4853,0.6767,2.5887,0.6767&#10;&#9;&#9;&#9;c0.6681,0,1.2628-0.1024,1.7844-0.3071c0.5215-0.2058,0.9342-0.4967,1.2369-0.8749c0.3017-0.3782,0.4547-0.8232,0.4579-1.3372&#10;&#9;&#9;&#9;c-0.0032-0.5334-0.1853-0.959-0.5474-1.2769C41.9256,9.718,41.374,9.4906,40.6348,9.3559z"/>
55
+ <path d="M46.4252,8.5166c0.1692-0.1293,0.3664-0.1951,0.5926-0.1951c0.2888,0,0.5237,0.1002,0.7079,0.2985&#10;&#9;&#9;&#9;c0.1832,0.1993,0.292,0.4881,0.3265,0.8674h2.4071c-0.0032-0.626-0.1476-1.1723-0.4321-1.6378&#10;&#9;&#9;&#9;c-0.2855-0.4655-0.6874-0.8264-1.2068-1.0818c-0.5183-0.2554-1.1324-0.3836-1.8403-0.3836c-0.7833,0-1.4546,0.1562-2.0127,0.4687&#10;&#9;&#9;&#9;c-0.5571,0.3114-0.9859,0.7467-1.2833,1.307c-0.2974,0.5592-0.4461,1.2089-0.4461,1.9481c0,0.7402,0.1487,1.39,0.4461,1.9491&#10;&#9;&#9;&#9;c0.2974,0.5592,0.7262,0.9956,1.2833,1.307c0.5581,0.3114,1.2294,0.4676,2.0127,0.4676c0.7144,0,1.3296-0.1283,1.8457-0.3847&#10;&#9;&#9;&#9;c0.5151-0.2575,0.9137-0.6217,1.196-1.0937c0.2824-0.4719,0.4278-1.0257,0.4375-1.6615h-2.4071&#10;&#9;&#9;&#9;c-0.0194,0.25-0.0743,0.4622-0.167,0.6368c-0.0926,0.1735-0.2122,0.3049-0.3599,0.3943&#10;&#9;&#9;&#9;c-0.1476,0.0895-0.3168,0.1347-0.5075,0.1347c-0.2263,0-0.4234-0.0657-0.5926-0.195c-0.1691-0.1304-0.3006-0.3265-0.3943-0.5883&#10;&#9;&#9;&#9;c-0.0948-0.2618-0.1411-0.5894-0.1411-0.9848c0-0.3955,0.0463-0.723,0.1411-0.9849C46.1246,8.8431,46.2561,8.6469,46.4252,8.5166z&#10;&#9;&#9;&#9;"/>
56
+ <path d="M55.4319,6.3842c-0.3857,0-0.7219,0.1186-1.0085,0.3534c-0.2866,0.2349-0.4957,0.6067-0.6271,1.1142h-0.0755V6.479&#10;&#9;&#9;&#9;h-2.5202v7.2213h2.5957V9.9388c0-0.2759,0.0571-0.5161,0.1735-0.7208c0.1164-0.2058,0.2747-0.3653,0.4773-0.4806&#10;&#9;&#9;&#9;c0.2026-0.1142,0.4299-0.1714,0.6842-0.1714c0.1347,0,0.2963,0.0108,0.4838,0.0334c0.1886,0.0215,0.3469,0.055,0.4752,0.0981&#10;&#9;&#9;&#9;V6.4833c-0.1034-0.0313-0.2112-0.056-0.3222-0.0733C55.6571,6.3928,55.5451,6.3842,55.4319,6.3842z"/>
57
+ <path d="M57.908,5.7269c0.3501,0,0.6507-0.1164,0.8997-0.348c0.25-0.2322,0.3739-0.5112,0.3739-0.8372&#10;&#9;&#9;&#9;c0-0.3259-0.1239-0.605-0.3739-0.8367c-0.2489-0.2322-0.5506-0.348-0.9051-0.348c-0.3513,0-0.6519,0.1159-0.903,0.348&#10;&#9;&#9;&#9;c-0.25,0.2317-0.3761,0.5108-0.3761,0.8367c0,0.326,0.1261,0.605,0.3761,0.8372C57.2507,5.6105,57.5535,5.7269,57.908,5.7269z"/>
58
+ <rect x="56.6053" y="6.479" width="2.5957" height="7.2213"/>
59
+ <path d="M66.2111,6.7656c-0.431-0.2543-0.8846-0.3815-1.3609-0.3815c-0.3577,0-0.6713,0.0625-0.9407,0.1865&#10;&#9;&#9;&#9;c-0.2694,0.1239-0.4957,0.2877-0.6767,0.4934c-0.1821,0.2058-0.32,0.4299-0.4138,0.6745h-0.0571V6.479h-2.5762v9.929h2.5956&#10;&#9;&#9;&#9;v-3.8919h0.0377c0.1002,0.2446,0.2435,0.4622,0.4299,0.6551c0.1864,0.1929,0.4116,0.3448,0.6767,0.4569&#10;&#9;&#9;&#9;c0.2651,0.111,0.5667,0.1659,0.9051,0.1659c0.514,0,0.987-0.1346,1.418-0.4041c0.431-0.2693,0.7758-0.6788,1.0344-1.2272&#10;&#9;&#9;&#9;c0.2586-0.5485,0.3879-1.2392,0.3879-2.0731c0-0.8717-0.1358-1.5796-0.4073-2.1248C66.9934,7.4186,66.6421,7.0199,66.2111,6.7656z&#10;&#9;&#9;&#9; M64.8664,11.0088c-0.0895,0.2554-0.2177,0.4514-0.3857,0.5883c-0.1681,0.1358-0.3707,0.2036-0.6088,0.2036&#10;&#9;&#9;&#9;c-0.2382,0-0.4429-0.0689-0.6131-0.209c-0.1714-0.139-0.3028-0.3373-0.3955-0.5926c-0.0927-0.2554-0.139-0.5581-0.139-0.9094&#10;&#9;&#9;&#9;c0-0.3578,0.0463-0.6637,0.139-0.9191c0.0927-0.2554,0.2241-0.4515,0.3955-0.5883c0.1702-0.1358,0.375-0.2037,0.6131-0.2037&#10;&#9;&#9;&#9;c0.2381,0,0.4406,0.0678,0.6088,0.2037c0.1681,0.1368,0.2963,0.3329,0.3857,0.5883C64.9558,9.4259,65,9.7319,65,10.0897&#10;&#9;&#9;&#9;C65,10.4474,64.9558,10.7534,64.8664,11.0088z"/>
60
+ <path d="M72.2601,11.8007c-0.1046,0.0194-0.1972,0.0291-0.2748,0.0291c-0.1131,0-0.2058-0.0172-0.2779-0.0495&#10;&#9;&#9;&#9;c-0.0722-0.0334-0.125-0.083-0.1595-0.1509c-0.0345-0.0668-0.0518-0.1509-0.0518-0.251V8.3593h1.2413V6.479h-1.2413V4.7486&#10;&#9;&#9;&#9;h-2.5956V6.479h-0.9213v1.8803h0.9213v3.2637c-0.0065,0.5042,0.0926,0.9244,0.2963,1.2596&#10;&#9;&#9;&#9;c0.2037,0.3351,0.5075,0.5807,0.9126,0.7359c0.4041,0.1552,0.9041,0.2166,1.4999,0.1853&#10;&#9;&#9;&#9;c0.2941-0.0162,0.5495-0.0485,0.7639-0.0991c0.2144-0.0496,0.3803-0.0916,0.4957-0.1261l-0.3761-1.8242&#10;&#9;&#9;&#9;C72.4433,11.7663,72.3657,11.7824,72.2601,11.8007z"/>
61
+ <path d="M74.762,5.7269c0.3502,0,0.6508-0.1164,0.8997-0.348c0.25-0.2322,0.3738-0.5112,0.3738-0.8372&#10;&#9;&#9;&#9;c0-0.3259-0.1239-0.605-0.3738-0.8367c-0.2489-0.2322-0.5507-0.348-0.9051-0.348c-0.3512,0-0.6519,0.1159-0.903,0.348&#10;&#9;&#9;&#9;c-0.25,0.2317-0.376,0.5108-0.376,0.8367c0,0.326,0.126,0.605,0.376,0.8372C74.1048,5.6105,74.4076,5.7269,74.762,5.7269z"/>
62
+ <rect x="73.4594" y="6.479" width="2.5957" height="7.2213"/>
63
+ <path d="M82.5318,6.8529c-0.5581-0.3125-1.2294-0.4687-2.0127-0.4687c-0.7834,0-1.4546,0.1562-2.0127,0.4687&#10;&#9;&#9;&#9;c-0.5571,0.3114-0.9859,0.7467-1.2833,1.307c-0.2974,0.5592-0.4461,1.2089-0.4461,1.9481c0,0.7402,0.1487,1.39,0.4461,1.9491&#10;&#9;&#9;&#9;c0.2974,0.5592,0.7262,0.9956,1.2833,1.307c0.5581,0.3114,1.2294,0.4676,2.0127,0.4676c0.7833,0,1.4546-0.1562,2.0127-0.4676&#10;&#9;&#9;&#9;c0.5571-0.3114,0.9848-0.7478,1.2833-1.307c0.2974-0.5592,0.4461-1.2089,0.4461-1.9491c0-0.7392-0.1487-1.3889-0.4461-1.9481&#10;&#9;&#9;&#9;C83.5166,7.5996,83.0888,7.1643,82.5318,6.8529z M81.478,11.0627c-0.0873,0.2726-0.2112,0.4827-0.3717,0.6303&#10;&#9;&#9;&#9;c-0.1595,0.1476-0.3491,0.2209-0.5689,0.2209c-0.2317,0-0.431-0.0733-0.597-0.2209c-0.1659-0.1476-0.2931-0.3578-0.3803-0.6303&#10;&#9;&#9;&#9;c-0.0883-0.2726-0.1314-0.597-0.1314-0.973c0-0.3793,0.0431-0.7047,0.1314-0.9751c0.0873-0.2715,0.2144-0.4806,0.3803-0.6282&#10;&#9;&#9;&#9;c0.166-0.1476,0.3653-0.2209,0.597-0.2209c0.2198,0,0.4094,0.0733,0.5689,0.2209c0.1606,0.1476,0.2845,0.3567,0.3717,0.6282&#10;&#9;&#9;&#9;c0.0883,0.2705,0.1314,0.5958,0.1314,0.9751C81.6094,10.4657,81.5663,10.79,81.478,11.0627z"/>
64
+ <path d="M91.0752,6.7355c-0.3782-0.2338-0.8221-0.3513-1.3329-0.3513c-0.5301,0-0.9934,0.1304-1.39,0.3912&#10;&#9;&#9;&#9;c-0.3965,0.2596-0.6723,0.6184-0.8297,1.0764h-0.0754V6.479h-2.4632v7.2213h2.5957V9.6382&#10;&#9;&#9;&#9;c0.0022-0.2382,0.0463-0.4429,0.1314-0.6131c0.0841-0.1713,0.2058-0.3028,0.3642-0.3955c0.1584-0.0927,0.3438-0.139,0.5571-0.139&#10;&#9;&#9;&#9;c0.3265,0,0.5807,0.1024,0.7639,0.306c0.1832,0.2037,0.2737,0.4838,0.2705,0.8415v4.0621h2.5957V9.093&#10;&#9;&#9;&#9;c0.0032-0.5237-0.1002-0.9891-0.3082-1.3965C91.7454,7.2893,91.4534,6.9682,91.0752,6.7355z"/>
65
+ </g>
66
+ <path d="M99.4526,10.0358c-0.362-0.3178-0.9137-0.5452-1.6529-0.6798L96.3322,9.093c-0.2758-0.0506-0.4612-0.1207-0.5571-0.2112&#10;&#9;&#9;c-0.0959-0.0916-0.1411-0.1896-0.1379-0.2963c-0.0032-0.1509,0.0743-0.2672,0.2349-0.348&#10;&#9;&#9;c0.1595-0.0819,0.3502-0.1228,0.5732-0.1228c0.1723,0,0.3297,0.0291,0.473,0.0872c0.1422,0.0582,0.2586,0.1401,0.3501,0.2468&#10;&#9;&#9;c0.0905,0.1067,0.1423,0.2338,0.1552,0.3815h2.3877c-0.0313-0.765-0.348-1.3641-0.9514-1.7962&#10;&#9;&#9;c-0.6034-0.4332-1.4277-0.6498-2.4707-0.6498c-0.6863,0-1.28,0.0927-1.78,0.2759s-0.8836,0.4493-1.1519,0.7995&#10;&#9;&#9;c-0.2683,0.3491-0.4008,0.7747-0.3976,1.2757c-0.0032,0.5679,0.1788,1.0312,0.5452,1.3921&#10;&#9;&#9;c0.3674,0.3599,0.9191,0.6044,1.655,0.7338l1.279,0.2252c0.2823,0.0506,0.4902,0.1163,0.6239,0.1972&#10;&#9;&#9;c0.1325,0.0819,0.2004,0.1918,0.2036,0.3297c-0.0032,0.1497-0.0819,0.2661-0.237,0.348c-0.1551,0.0808-0.3524,0.1218-0.5905,0.1218&#10;&#9;&#9;c-0.2942,0-0.5377-0.0614-0.7305-0.1853c-0.1929-0.1239-0.3071-0.3006-0.3416-0.529h-2.5762&#10;&#9;&#9;c0.0722,0.7391,0.4192,1.335,1.0419,1.7865c0.6217,0.4515,1.4848,0.6767,2.5881,0.6767c0.668,0,1.2628-0.1024,1.7843-0.3071&#10;&#9;&#9;c0.5215-0.2058,0.9342-0.4967,1.237-0.8749c0.3017-0.3782,0.4547-0.8232,0.4579-1.3372&#10;&#9;&#9;C99.9968,10.7793,99.8147,10.3537,99.4526,10.0358z"/>
67
+ </g>
68
+ </svg>
69
+ """
70
+
71
+ python_token_code = r"""
72
+ # ethpen.com
73
+ # 最后更新日期:2023 年 8 月 18 日
74
+
75
+ # 在使用之前,敬请仔细阅读说明,感谢您的配合。
76
+ # 请务必访问 ethpen.com 官方网站。您可以确保这里的代码无恶意,安全地复制。
77
+ # 你只需要掌握一些 python 相关的基础。
78
+ # 在使用过程中,请根据规定准确填写信息,以确保程序顺畅运行。
79
+ # 我们建议您使用备用账号,并避免在账号中存放大额资金。
80
+ # 若您对此代码存有疑虑,建议您利用如 ChetGPT、Bard 或 Claude 等知名 AI 平台进行查询,以判断是否含有恶意代码。
81
+ # 如果你在使用的过程中发现 BUG 或者有什么想法和建议,欢迎与我联系。
82
+
83
+ # 导入运行代码所需要的库
84
+ from web3 import Web3 # 与以太坊交互的库,安装的命令是 pip install web3
85
+ import hashlib # 用于数据哈希,安装的命令是 pip install hashlib
86
+ import requests # 用于发送网络请求,安装的命令是 pip install requests
87
+ import re # 用于正则表达式
88
+ import time # 用于时间相关
89
+
90
+ # ---------- 以下是基础配置 ----------
91
+
92
+ # 填写你的多个 ETH 地址及私钥,建议填写新建的钱包,用英文逗号分隔(,),如下:地址,私钥。
93
+ accounts_str = '''
94
+ 0xa62C8d0bB4F4530b9B68a14DaF8A949Cb01dB986,4de9b2812d51ba0ebbe7c990947b12544f7926a7aa1ebac084d42f6c7c8afbc1
95
+ 0x71D10cc20Abe0af4EC16170C502a4319DE0e40B4,377f4a19719337b63d8280f0a52769a42b534343de1eccab4f6d204d1ca04815
96
+ 0xBe169Ae4AD317B5632DE6Ae0e1EfeF0b22B1f91e,24fdf2ed0b820307582b06e1ed0b2047b4371e9d682e0b32455d310e08baafc5
97
+ '''
98
+
99
+ # 需要题写的代币铭文内容,变动的部分文本如 id 请用 "@#" 代替,例如:'data:,{"p":"erc-20","op":"mint","tick":"eths","id":"@#","amt":"1000"}'
100
+ ethscription = 'data:,{"p":"erc-20","op":"mint","tick":"eths","id":"@#","amt":"1000"}'
101
+
102
+ # 设置代币铭文 id 的起始和结束范围
103
+ min_id = 100 # 开始的整数
104
+ max_id = 888 # 结束的整数
105
+
106
+ # 决定是否在题写铭文之前检查该铭文有没有被题写过,如果需要检查就填写 Ture 如果不需要就填 False
107
+ check = False
108
+
109
+ # 每次交易成功后暂停 N 秒,0 为不暂停
110
+ sleep_sec = 0
111
+
112
+ # 这里配置 Ethereum PRC URL,如果你没有,请到 infura.io 或者 alchemy.com 申请一个免费的 API
113
+ w3 = Web3(Web3.HTTPProvider('https://sepolia.infura.io/v3/eab7f935b9af45e1a54f7d7ed06c5206'))
114
+
115
+ # 连接的网络 ID。比如说,1 代表 Mainnet,5 代表 Goerli 测试网络,11155111 代表 Sepolia 测试网络,如果你不放心,可以先用测试网试试。
116
+ chain_id = 11155111
117
+
118
+ # ---------- 以上是基础配置 ----------
119
+
120
+
121
+ # 检查 ETH 地址是否有效
122
+ def is_valid_eth_address(address):
123
+ if re.match("^0x[0-9a-fA-F]{40}$", address):
124
+ return True
125
+ return False
126
+
127
+
128
+ # 检查 Ethereum 私钥是否有效
129
+ def is_valid_eth_private_key(private_key):
130
+ if re.match("^[0-9a-fA-F]{64}$", private_key):
131
+ return True
132
+ return False
133
+
134
+
135
+ # 验证输入的铭文文本是否含有空格和换行符,而且字母全部为小写
136
+ def validate_input(data_str):
137
+ if re.search(r'[A-Z\s\n]', data_str): # 查找大写字母、空格或换行符
138
+ return False
139
+ return True
140
+
141
+
142
+ # 把文字转换成 16 进制
143
+ def text_to_hex(text):
144
+ return ''.join(format(ord(char), '02x') for char in text)
145
+
146
+
147
+ # 使用sha256算法计算哈希
148
+ def sha256(input_string):
149
+ sha256 = hashlib.sha256()
150
+ sha256.update(input_string.encode('utf-8'))
151
+ return sha256.hexdigest()
152
+
153
+
154
+ # 使用 Ethscriptions API(主网)检查某个铭文是否已题写
155
+ def check_content_exists(sha):
156
+ # 定义请求的网址
157
+ endpoint = f"/ethscriptions/exists/{sha}"
158
+ response = requests.get('https://mainnet-api.ethscriptions.com/api' + endpoint)
159
+ # 如果返回状态码是200,说明请求成功,然后返回结果(Ture or False)
160
+ if response.status_code == 200:
161
+ return response.json()['result']
162
+
163
+
164
+ # 发送自己到自己 0ETH 的交易
165
+ def send_transaction(w3, account_address, private_key, chain_id, gas_price, input_data, current_nonce):
166
+
167
+ # 设置交易的相关信息
168
+ tx = {
169
+ 'chainId': chain_id, # 网络 ID
170
+ 'gas': 25000, # 如果交易 gas 过低,可适当调高
171
+ 'gasPrice': gas_price, # gas 的价格
172
+ 'nonce': current_nonce, # 账户的交易数
173
+ 'to': account_address, # 接收地址为自己
174
+ 'value': 0, # 金额为 0ETH
175
+ 'data': text_to_hex(input_data), # 铭文内容
176
+ }
177
+
178
+ # 用私钥签名这个交易
179
+ signed_tx = w3.eth.account.sign_transaction(tx, private_key)
180
+ # 发送签名后的交易并获取交易哈希
181
+ tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
182
+ # 打印结果信息
183
+ print(f'{account_address} | {input_data} | Transaction Hash: {tx_hash.hex()}')
184
+
185
+
186
+ # 初始化当前账户索引为 0
187
+ current_account_index = 0
188
+ # 创建账户列表
189
+ accounts = []
190
+ # 使用字典来跟踪每个地址��nonce
191
+ nonces = {}
192
+
193
+
194
+ if accounts_str: # 如果账户列表有内容
195
+ for line in accounts_str.strip().split('\n'): # 先去掉首尾的空白,然后根据换行符划分账户
196
+ if ',' in line: # 检查是否包含逗号
197
+ address, key = line.split(',') # 分开地址和私钥
198
+ if is_valid_eth_address(address) and is_valid_eth_private_key(key): # 验证地址和私钥
199
+ current_nonce = w3.eth.get_transaction_count(address) # 获取地址的 nonce
200
+ nonces[address] = current_nonce # 记录地址的 nonce
201
+ accounts.append((address.strip(), key.strip())) # 保存地址和私钥还有 nonce
202
+ else:
203
+ print(f"地址 {address} 或私钥 {key} 无效,请检查!")
204
+ exit()
205
+ else:
206
+ print(f"输入格式错误,请确保每行包含一个地址和一个私钥,并使用英文逗号分隔(,)。错误行:**{line}**")
207
+ exit()
208
+
209
+ # 判断铭文文本里是否包含空格、换行符,而且所有的字母都必须为小写。
210
+ if not validate_input(ethscription):
211
+ print("请注意:通常代币铭文文本里不能包含空格、换行符,而且所有的字母都必须为小写。")
212
+
213
+ # 检查是否留空
214
+ if not accounts or not ethscription:
215
+ print('请正确谨慎地填写内容,每一项都不应留空。')
216
+ exit()
217
+ else:
218
+ print('看起来你输入的内容均无没有问题!')
219
+
220
+ # 认真检查铭文内容,如果发现错误,输入 1 结束
221
+ print(f'铭文文本:\033[44m{ethscription}\033[m,题写 id 范围为:{min_id} - {max_id}。')
222
+ if input('请预览铭文,输入任意内容继续,输入 1 退出程序:') == '1':
223
+ exit()
224
+ print(f'开始任务,需要题写的铭文总量为:{max_id - min_id + 1}')
225
+
226
+ # 对代币铭文 id 进行循环
227
+ for the_id in range(min_id, max_id + 1):
228
+ # 使用当前账户发送交易
229
+ address, key = accounts[current_account_index]
230
+ # 得到完整的铭文文本
231
+ input_data = ethscription.replace('@#', str(the_id))
232
+ # 获取 gas
233
+ gas_price = w3.eth.gas_price
234
+ # 根据是否检查的开关进行
235
+ if check:
236
+ # 这里是开了检查后请求 Ethscriptions API
237
+ if check_content_exists(sha256(input_data)):
238
+ # 返回数据为 Ture,说明该铭文已经被题写,打印信息
239
+ print(f'{input_data} 已经被题写!')
240
+ else:
241
+ # 返回数据为 False,说明该铭文还没被题写,发送交易
242
+ # 使用 current_nonce 发送交易
243
+ send_transaction(w3, address, key, chain_id, gas_price, input_data, nonces[address])
244
+ # 交易成功后,手动增加 nonce 值
245
+ nonces[address] += 1
246
+ else:
247
+ # 这里是未开检查后直接发送交易
248
+ # 使用 current_nonce 发送交易
249
+ send_transaction(w3, address, key, chain_id, gas_price, input_data, nonces[address])
250
+ # 交易成功后,手动增加 nonce 值
251
+ nonces[address] += 1
252
+ # 更新当前账户索引,确保索引始终在账户列表的范围内
253
+ current_account_index = (current_account_index + 1) % len(accounts)
254
+ # 暂停 sleep_sec 秒
255
+ time.sleep(sleep_sec)
256
+
257
+ print(f'所有任务已经完成。')
258
+
259
+ """
260
+
261
+ python_name_code = r"""
262
+ # ethpen.com
263
+ # 最后更新日期:2023 年 8 月 18 日
264
+
265
+ # 在使用之前,敬请仔细阅读说明,感谢您的配合。
266
+ # 请务必访问 ethpen.com 官方网站。您可以确保这里的代码无恶意,安全地复制。
267
+ # 你只需要掌握一些 python 相关的基础。
268
+ # 在使用过程中,请根据规定准确填写信息,以确保程序顺畅运行。
269
+ # 我们建议您使用备用账号,并避免在账号中存放大额资金。
270
+ # 若您对此代码存有疑虑,建议您利用如 ChetGPT、Bard 或 Claude 等知名 AI 平台进行查询,以判断是否含有恶意代码。
271
+ # 如果你在使用的过程中发现 BUG 或者有什么想法和建议,欢迎与我联系。
272
+
273
+ # 导入运行代码所需要的库
274
+ from web3 import Web3 # 与以太坊交互的库,安装的命令是 pip install web3
275
+ import hashlib # 用于数据哈希,安装的命令是 pip install hashlib
276
+ import requests # 用于发送网络请求,安装的命令是 pip install requests
277
+ import re # 用于正则表达式
278
+ import time # 用于时间相关
279
+
280
+ # ---------- 以下是基础配置 ----------
281
+
282
+ # 填写你的多个 ETH 地址及私钥,建议填写新建的钱包,用英文逗号分隔(,),如下:地址,私钥。
283
+ accounts_str = '''
284
+ 0xa62C8d0bB4F4530b9B68a14DaF8A949Cb01dB986,4de9b2812d51ba0ebbe7c990947b12544f7926a7aa1ebac084d42f6c7c8afbc1
285
+ 0x71D10cc20Abe0af4EC16170C502a4319DE0e40B4,377f4a19719337b63d8280f0a52769a42b534343de1eccab4f6d204d1ca04815
286
+ 0xBe169Ae4AD317B5632DE6Ae0e1EfeF0b22B1f91e,24fdf2ed0b820307582b06e1ed0b2047b4371e9d682e0b32455d310e08baafc5
287
+ '''
288
+
289
+ # 需要题写的铭文内容,在三个单引号内输入多个域名铭文,可以用空格、换行符、英文逗号(,)分开��不要带 data:, 开头
290
+ # 不要带 data:, 开头
291
+ # 不要带 data:, 开头
292
+ ethscription = '''
293
+ 123
294
+ 12313131
295
+ 2131 21313
296
+ 12313 32313
297
+ 423213v ethpen.com
298
+ '''
299
+ # 你希望添加的后缀
300
+ suffix = '.eths'
301
+ # 以空格、换行符、英文逗号分隔文本,并加上后缀
302
+ ethscription_list = [item.strip() + suffix for item in re.split(r'[\s,]+', ethscription) if item]
303
+
304
+ # 决定是否在题写铭文之前检查该铭文有没有被题写过,如果需要检查就填写 Ture 如果不需要就填 False
305
+ check = False
306
+
307
+ # 每次交易成功后暂停 N 秒,0 为不暂停
308
+ sleep_sec = 0
309
+
310
+ # 这里配置 Ethereum PRC URL,如果你没有,请到 infura.io 或者 alchemy.com 申请一个免费的 API
311
+ w3 = Web3(Web3.HTTPProvider('https://sepolia.infura.io/v3/eab7f935b9af45e1a54f7d7ed06c5206'))
312
+
313
+ # 连接的网络 ID。比如说,1 代表 Mainnet,5 代表 Goerli 测试网络,11155111 代表 Sepolia 测试网络,如果你不放心,可以先用测试网试试。
314
+ chain_id = 11155111
315
+
316
+ # ---------- 以上是基础配置 ----------
317
+
318
+
319
+ # 检查 ETH 地址是否有效
320
+ def is_valid_eth_address(address):
321
+ if re.match("^0x[0-9a-fA-F]{40}$", address):
322
+ return True
323
+ return False
324
+
325
+
326
+ # 检查 Ethereum 私钥是否有效
327
+ def is_valid_eth_private_key(private_key):
328
+ if re.match("^[0-9a-fA-F]{64}$", private_key):
329
+ return True
330
+ return False
331
+
332
+
333
+ # 验证输入的铭文文本是否含有空格和换行符,而且字母全部为小写
334
+ def validate_input(data_str):
335
+ if re.search(r'[A-Z\s\n]', data_str): # 查找大写字母、空格或换行符
336
+ return False
337
+ return True
338
+
339
+
340
+ # 把文字转换成 16 进制
341
+ def text_to_hex(text):
342
+ return ''.join(format(ord(char), '02x') for char in text)
343
+
344
+
345
+ # 使用sha256算法计算哈希
346
+ def sha256(input_string):
347
+ sha256 = hashlib.sha256()
348
+ sha256.update(input_string.encode('utf-8'))
349
+ return sha256.hexdigest()
350
+
351
+
352
+ # 使用 Ethscriptions API(主网)检查某个铭文是否已存在
353
+ def check_content_exists(sha):
354
+ # 定义请求的网址
355
+ endpoint = f"/ethscriptions/exists/{sha}"
356
+ response = requests.get('https://mainnet-api.ethscriptions.com/api' + endpoint)
357
+ # 如果返回状态码是200,说明请求成功,然后返回结果(Ture or False)
358
+ if response.status_code == 200:
359
+ return response.json()['result']
360
+
361
+
362
+ # 发送自己到自己 0ETH 的交易
363
+ def send_transaction(w3, account_address, private_key, chain_id, gas_price, input_data, current_nonce):
364
+
365
+ # 设置交易的相关信息
366
+ tx = {
367
+ 'chainId': chain_id, # 网络 ID
368
+ 'gas': 25000, # 如果交易 gas 过低,可适当调高
369
+ 'gasPrice': gas_price, # gas 的价格
370
+ 'nonce': current_nonce, # 账户的交易数
371
+ 'to': account_address, # 接收地址为自己
372
+ 'value': 0, # 金额为 0ETH
373
+ 'data': text_to_hex(input_data), # 铭文内容
374
+ }
375
+
376
+ # 用私钥签名这个交易
377
+ signed_tx = w3.eth.account.sign_transaction(tx, private_key)
378
+ # 发送签名后的交易并获取交易哈希
379
+ tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
380
+ # 打印结果信息
381
+ print(f'{account_address} | {input_data} | Transaction Hash: {tx_hash.hex()}')
382
+
383
+
384
+ # 初始化当前账户索引为 0
385
+ current_account_index = 0
386
+ # 创建账户列表
387
+ accounts = []
388
+ # 使用字典来跟踪每个地址的nonce
389
+ nonces = {}
390
+
391
+
392
+ if accounts_str: # 如果账户列表有内容
393
+ for line in accounts_str.strip().split('\n'): # 先去掉首尾的空白,然后根据换行符划分账户
394
+ if ',' in line: # 检查是否包含逗号
395
+ address, key = line.split(',') # 分开地址和私钥
396
+ if is_valid_eth_address(address) and is_valid_eth_private_key(key): # 验证地址和私钥
397
+ current_nonce = w3.eth.get_transaction_count(address) # 获取地址的 nonce
398
+ nonces[address] = current_nonce # 记录地址的 nonce
399
+ accounts.append((address.strip(), key.strip())) # 保存地址和私钥还有 nonce
400
+ else:
401
+ print(f"地址 {address} 或私钥 {key} 无效,请检查!")
402
+ exit()
403
+ else:
404
+ print(f"输入格式错误,请确保每行包含一个地址和一个私钥,并使用英文逗号分隔(,)。错误行:**{line}**")
405
+ exit()
406
+
407
+ # 判断铭文文本里是否包含空格、换行符,而且所有的字母都必须为小写。
408
+ if not validate_input(ethscription):
409
+ print("请注意:通常代币铭文文本里不能包含空格、换行符,而且所有的字母都必须为小写。")
410
+
411
+ # 检查是否留空
412
+ if not accounts or not ethscription:
413
+ print('请正确谨慎地填写内容,每一项都不应留空。')
414
+ exit()
415
+ else:
416
+ print('看起来你输入的内容均无没有问题!')
417
+
418
+ # 认真检查铭文内容,如果发现错误,输入 1 结束
419
+ for i in ethscription_list:
420
+ print(f'\033[44m{i}\033[m')
421
+ if input('请预览铭文,输入任意内容继续��输入 1 退出程序:') == '1':
422
+ exit()
423
+ print(f'开始任务,需要题写的铭文总量为:{len(ethscription_list)}')
424
+
425
+ # 对代币铭文 id 进行循环
426
+ for name_str in ethscription_list:
427
+ # 使用当前账户发送交易
428
+ address, key = accounts[current_account_index]
429
+ # 得到完整的铭文文本
430
+ if not name_str.startswith('data:,'):
431
+ input_data = f'data:,{name_str}'
432
+ else:
433
+ input_data = name_str
434
+ # 获取 gas
435
+ gas_price = w3.eth.gas_price
436
+ # 根据是否检查的开关进行
437
+ if check:
438
+ # 这里是开了检查后请求 Ethscriptions API
439
+ if check_content_exists(sha256(input_data)):
440
+ # 返回数据为 Ture,说明该铭文已经被题写,打印信息
441
+ print(f'{input_data} 已经被题写!')
442
+ else:
443
+ # 返回数据为 False,说明该铭文还没被题写,发送交易
444
+ # 使用 current_nonce 发送交易
445
+ send_transaction(w3, address, key, chain_id, gas_price, input_data, nonces[address])
446
+ # 交易成功后,手动增加 nonce 值
447
+ nonces[address] += 1
448
+ else:
449
+ # 这里是未开检查后直接发送交易
450
+ # 使用 current_nonce 发送交易
451
+ send_transaction(w3, address, key, chain_id, gas_price, input_data, nonces[address])
452
+ # 交易成功后,手动增加 nonce 值
453
+ nonces[address] += 1
454
+ # 更新当前账户索引,确保索引始终在账户列表的范围内
455
+ current_account_index = (current_account_index + 1) % len(accounts)
456
+ # 暂停 sleep_sec 秒
457
+ time.sleep(sleep_sec)
458
+
459
+ print(f'所有任务已经完成。')
460
+
461
+ """
462
+
463
+ hf_token_code = r"""
464
+ # ethpen.com
465
+ # 最后更新日期:2023 年 8 月 18 日
466
+
467
+ # 在使用之前,敬请仔细阅读说明,感谢您的配合。
468
+ # 请务必访问 ethpen.com 官方网站。您可以确保这里的代码无恶意,安全地复制。
469
+ # 你只需要拥有一个 HuggingFace.co 账户。
470
+ # 在使用过程中,请根据规定准确填写信息,以确保程序顺畅运行。
471
+ # 我们建议您使用备用账号,并避免在账号中存放大额资金。
472
+ # 若您对此代码存有疑虑,建议您利用如 ChetGPT、Bard 或 Claude 等知名 AI 平台进行查询,以判断是否含有恶意代码。
473
+ # 请查看我们的例子 https://ethscriptions-name.hf.space。
474
+
475
+ # 导入运行代码所需要的库
476
+ import streamlit as st # streamlit app
477
+ from web3 import Web3 # 与以太坊交互的库
478
+ import hashlib # 用于数据哈希
479
+ import requests # 用于发送网络请求
480
+ import re # 用于正则表达式
481
+ import time # 用于时间相关
482
+
483
+
484
+ # 检查 ETH 地址是否有效
485
+ def is_valid_eth_address(address):
486
+ if re.match("^0x[0-9a-fA-F]{40}$", address):
487
+ return True
488
+ return False
489
+
490
+
491
+ # 检查 Ethereum 私钥是否有效
492
+ def is_valid_eth_private_key(private_key):
493
+ if re.match("^[0-9a-fA-F]{64}$", private_key):
494
+ return True
495
+ return False
496
+
497
+
498
+ # 验证输入的铭文文本是否含有空格和换行符,而且字母全部为小写
499
+ def validate_input(data_str):
500
+ if re.search(r'[A-Z\s\n]', data_str): # 查找大写字母、空格或换行符
501
+ return False
502
+ return True
503
+
504
+
505
+ # 把文字转换成 16 进制
506
+ def text_to_hex(text):
507
+ return ''.join(format(ord(char), '02x') for char in text)
508
+
509
+
510
+ # 使用sha256算法计算哈希
511
+ def sha256(input_string):
512
+ sha256 = hashlib.sha256()
513
+ sha256.update(input_string.encode('utf-8'))
514
+ return sha256.hexdigest()
515
+
516
+
517
+ # 使用 Ethscriptions API(主网)检查某个铭文是否已题写
518
+ def check_content_exists(sha):
519
+ # 定义请求的网址
520
+ endpoint = f"/ethscriptions/exists/{sha}"
521
+ response = requests.get('https://mainnet-api.ethscriptions.com/api' + endpoint)
522
+ # 如果返回状态码是200,说明请求成功,然后返回结果(Ture or False)
523
+ if response.status_code == 200:
524
+ return response.json()['result']
525
+
526
+
527
+ # 发送自己到自己 0ETH 的交易
528
+ def send_transaction(w3, account_address, private_key, chain_id, gas_price, input_data, current_nonce):
529
+
530
+ # 设置交易的相关信息
531
+ tx = {
532
+ 'chainId': chain_id, # 网络 ID
533
+ 'gas': 25000, # 如果交易 gas 过低,可适当调高
534
+ 'gasPrice': gas_price, # gas 的价格
535
+ 'nonce': current_nonce,
536
+ 'to': account_address, # 接收地址为自己
537
+ 'value': 0, # 金额为 0ETH
538
+ 'data': text_to_hex(input_data), # 铭文内容
539
+ }
540
+
541
+ # 用私钥签名这个交易
542
+ signed_tx = w3.eth.account.sign_transaction(tx, private_key)
543
+ # 发送签名后的交易并获取交易哈希
544
+ tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
545
+ # 打印结果信息
546
+ st.toast(f'{input_data}', icon='✅')
547
+ # 返回铭文还有交易哈希
548
+ return input_data, tx_hash.hex()
549
+
550
+ # 网页前端显示
551
+ # 网页标题
552
+ st.markdown('# [ethpen.com](https://ethpen.com) 代币铭文批量题写')
553
+ # 提醒
554
+ st.info('''在使用之前,敬请仔细阅读���明,感谢您的配合。
555
+ - 请务必访问 **[ethpen.com](https://ethpen.com)** 官方网站。您可以确保这里的代码无恶意,安全地复制。
556
+ - 在使用过程中,请根据规定准确填写信息,以确保程序顺畅运行。
557
+ - 我们建议您使用备用账号,并避免在账号中存放大额资金。
558
+ - 若您对此代码存有疑虑,建议您利用如 [ChetGPT](https://chat.openai.com/)、[Bard](https://bard.google.com/) 或 [Claude](https://claude.ai/) 等知名 AI 平台进行查询,以判断是否含有恶意代码。
559
+ ''')
560
+
561
+ # 连接的网络 ID。比如说,1 代表 Mainnet,5 代表 Goerli 测试网络,11155111 代表 Sepolia 测试网络,如果你不放心,可以先用测试网试试。
562
+ net_options = {
563
+ '1': 'Mainnet',
564
+ '5': 'Goerli',
565
+ '11155111': 'Sepolia'
566
+ }
567
+ selected_option = st.selectbox(
568
+ '**网络 ID**',
569
+ list(net_options.keys()),
570
+ format_func=lambda x: f"{x} ({net_options[x]})"
571
+ )
572
+ chain_id = int(selected_option)
573
+
574
+ # 这里配置 Ethereum PRC URL,如果你没有,请到 infura.io 或者 alchemy.com 申请一个免费的 API
575
+ token_eth_prc_url = st.text_input(
576
+ f'**Ethereum PRC 链接**:选填,你可以去 [infura.io](https://app.infura.io/) 或者 [alchemy.com](https://alchemy.com/) 免费申请一个',
577
+ f'https://{net_options[str(chain_id)]}.infura.io/v3/eab7f935b9af45e1a54f7d7ed06c5206')
578
+ w3 = Web3(Web3.HTTPProvider(f'{token_eth_prc_url}'))
579
+
580
+ # 初始化当前账户索引为 0
581
+ current_account_index = 0
582
+ # 收集和显示所有交易的结果
583
+ transaction_results = []
584
+ # 创建账户列表
585
+ accounts = []
586
+ # 使用字典来跟踪每个地址的nonce
587
+ nonces = {}
588
+
589
+ # 启用多账户操作
590
+ if st.checkbox(f'启用**多账户**操作'):
591
+ # 多账户的文本框
592
+ account_list = st.text_area(f'输入多个 **ETH 地址及其对应的私钥**,用英文逗号分隔(,),如下:地址,私钥')
593
+ if account_list: # 如果账户列表有内容
594
+ for line in account_list.split('\n'): # 根据换行符划分账户
595
+ if ',' in line: # 检查是否包含逗号
596
+ address, key = line.split(',') # 分开地址和私钥
597
+ if is_valid_eth_address(address) and is_valid_eth_private_key(key): # 验证地址和私钥
598
+ current_nonce = w3.eth.get_transaction_count(address) # 获取地址的 nonce
599
+ nonces[address] = current_nonce # 记录地址的 nonce
600
+ accounts.append((address.strip(), key.strip())) # 保存地址和私钥还有 nonce
601
+ else:
602
+ st.error(f"地址 {address} 或私钥 {key} 无效,请检查!")
603
+ st.stop()
604
+ else:
605
+ st.error(f"输入格式错误,请确保每行包含一个地址和一个私钥,并使用英文逗号分隔(,)。错误行:**{line}**")
606
+ st.stop()
607
+ else:
608
+ account_address = st.text_input('填写你的 **ETH 地址**:')
609
+ private_key = st.text_input('填写你的 **ETH 地址对应的私钥**:', type="password")
610
+ if account_address and private_key: # 如果地址和私钥有内容
611
+ if is_valid_eth_address(account_address) and is_valid_eth_private_key(private_key): # 验证地址和私钥
612
+ current_nonce = w3.eth.get_transaction_count(account_address) # 获取地址的 nonce
613
+ nonces[account_address] = current_nonce # 记录地址的 nonce
614
+ accounts.append((account_address.strip(), private_key.strip())) # 保存地址和私钥还有 nonce
615
+ else:
616
+ st.error("地址或私钥无效,请检查!")
617
+ st.stop()
618
+
619
+ # 配置铭文文本
620
+ token_protocol = st.text_input('填写需要题写代币铭文协议 **Protocol(p)**:', 'erc-20')
621
+ token_operation = st.text_input('填写需要题写代币铭文操作 **Operation(op)**:', 'mint')
622
+ token_ticker = st.text_input('填写需要题写代币铭文简称 **Ticker(tick)**:')
623
+ token_min_id = st.number_input('填写需要题写代币铭文范围的**最小 ID(id)**:', min_value=1, value=1, step=1)
624
+ token_max_id = st.number_input('填写需要题写代币铭文范围的**最大 ID(id)**:', value=21000, step=1)
625
+ token_amount = st.number_input('填写需要题写代币铭文数量 **Amount(amt)**:', min_value=1, value=1000, step=1)
626
+ st.markdown('###### 预览你需要题写的代币铭文:')
627
+ st.code(
628
+ f'data:,{{"p":"{token_protocol}","op":"{token_operation}","tick":"{token_ticker}","id":"{token_min_id}","amt":"{token_amount}"}}',
629
+ language="json", line_numbers=False)
630
+ # 判断铭文文本里是否包含空格、换行符,而且所有的字母都必须为小写。
631
+ if not validate_input(
632
+ f'data:,{{"p":"{token_protocol}","op":"{token_operation}","tick":"{token_ticker}","id":"{token_min_id}","amt":"{token_amount}"}}'):
633
+ st.warning("**请注意**:通常代币铭文文本里不能包含空格、换行符,而且所有的字母都必须为小写。")
634
+
635
+ # 题写铭文之前检查该铭文有没有被题写
636
+ if st.checkbox(f'题写铭��之前**检查该铭文有没有被题写**'):
637
+ token_check = True
638
+ else:
639
+ token_check = False
640
+
641
+ # 每次交易成功后暂停 3 秒
642
+ if st.checkbox(f'每次交易完成后暂停 3 秒'):
643
+ sleep_3s = True
644
+ else:
645
+ sleep_3s = False
646
+
647
+ # 点击发送交易开始
648
+ if st.button(f'开始**发送交易**'):
649
+ if not accounts or not token_protocol or not token_operation or not token_ticker: # 检查是否留空
650
+ st.error(f'请正确谨慎地填写内容,每一项都**不应留空**。')
651
+ st.stop()
652
+ else:
653
+ st.toast('看起来你输入的内容均无没有问题!', icon='🥳')
654
+
655
+ st.toast(f'开始任务,需要题写的铭文总量为:{token_max_id - token_min_id + 1}', icon='😎')
656
+
657
+ # 对代币铭文 id 进行循环
658
+ for the_id in range(token_min_id, token_max_id + 1):
659
+ # 使用当前账户发送交易,获取当前账户的 nonce
660
+ address, key = accounts[current_account_index]
661
+ # 得到完整的铭文文本
662
+ input_data = f'data:,{{"p":"{token_protocol}","op":"{token_operation}","tick":"{token_ticker}","id":"{the_id}","amt":"{token_amount}"}}'
663
+ # 获取 gas
664
+ gas_price = w3.eth.gas_price
665
+ # 根据是否检查的开关进行
666
+ if token_check:
667
+ # 这里是开了检查后请求 Ethscriptions API
668
+ if check_content_exists(sha256(input_data)):
669
+ # 返回数据为 Ture,说明该铭文已经被题写,打印信息
670
+ st.toast(f'{input_data} 已经被题写!', icon='☹️')
671
+ else:
672
+ # 返回数据为 False,说明该铭文还没被题写,发送交易
673
+ # 使用 current_nonce 发送交易
674
+ data, tx_hash = send_transaction(w3, address, key, chain_id, gas_price, input_data, nonces[address])
675
+ # 记录最后输出的结果
676
+ transaction_results.append(f"{address} | {data} | Transaction Hash: {tx_hash}")
677
+ # 交易成功后,手动增加 nonce 值
678
+ nonces[address] += 1
679
+ else:
680
+ # 这里是未开检查后直接发送交易
681
+ # 使用 current_nonce 发送交易
682
+ data, tx_hash = send_transaction(w3, address, key, chain_id, gas_price, input_data, nonces[address])
683
+ # 记录最后输出的结果
684
+ transaction_results.append(f"{address} | {data} | Transaction Hash: {tx_hash}")
685
+ # 交易成功后,手动增加 nonce 值
686
+ nonces[address] += 1
687
+ # 更新当前账户索引,确保索引始终在账户列表的范围内
688
+ current_account_index = (current_account_index + 1) % len(accounts)
689
+ # 暂停 3 秒
690
+ if sleep_3s:
691
+ time.sleep(3) # 暂停三秒
692
+ st.toast(f'所有任务已经完成。', icon='🎉')
693
+ # 庆祝动画
694
+ st.balloons()
695
+ # 显示所有交易的结果
696
+ st.code('\n'.join(transaction_results))
697
+
698
+ """
699
+
700
+ hf_name_code = r"""
701
+ # ethpen.com
702
+ # 最后更新日期:2023 年 8 月 18 日
703
+
704
+ # 在使用之前,敬请仔细阅读说明,感谢您的配合。
705
+ # 请务必访问 ethpen.com 官方网站。您可以确保这里的代码无恶意,安全地复制。
706
+ # 你只需要拥有一个 HuggingFace.co 账户。
707
+ # 在使用过程中,请根据规定准确填写信息,以确保程序顺畅运行。
708
+ # 我们建议您使用备用账号,并避免在账号中存放大额资金。
709
+ # 若您对此代码存有疑虑,建议您利用如 ChetGPT、Bard 或 Claude 等知名 AI 平台进行查询,以判断是否含有恶意代码。
710
+ # 请查看我们的例子 https://ethscriptions-name.hf.space。
711
+
712
+ # 导入运行代码所需要的库
713
+ import streamlit as st # streamlit app
714
+ from web3 import Web3 # 与以太坊交互的库
715
+ import hashlib # 用于数据哈希
716
+ import requests # 用于发送网络请求
717
+ import re # 用于正则表达式
718
+ import time # 用于时间相关
719
+
720
+
721
+ # 检查 ETH 地址是否有效
722
+ def is_valid_eth_address(address):
723
+ if re.match("^0x[0-9a-fA-F]{40}$", address):
724
+ return True
725
+ return False
726
+
727
+
728
+ # 检查 Ethereum 私钥是否有效
729
+ def is_valid_eth_private_key(private_key):
730
+ if re.match("^[0-9a-fA-F]{64}$", private_key):
731
+ return True
732
+ return False
733
+
734
+
735
+ # 验证输入的铭文文本是否含有空格和换行符,而且字母全部为小写
736
+ def validate_input(data_str):
737
+ if re.search(r'[A-Z\s\n]', data_str): # 查找大写字母、空格或换行符
738
+ return False
739
+ return True
740
+
741
+
742
+ # 分隔文本函数
743
+ def split_and_append(ethscriptions_str, name_selected_option):
744
+ separators = [' ', '\n', ',']
745
+ split_texts = [ethscriptions_str] # 初始时只有一个完整文本
746
+
747
+ for sep in separators:
748
+ pieces = []
749
+ for text in split_texts:
750
+ pieces.extend(text.split(sep))
751
+ split_texts = pieces
752
+
753
+ # 移除空字符串
754
+ split_texts = [text.strip() + name_selected_option for text in split_texts if text.strip() != '']
755
+
756
+ return split_texts
757
+
758
+
759
+ # 把文字转换成 16 ��制
760
+ def text_to_hex(text):
761
+ return ''.join(format(ord(char), '02x') for char in text)
762
+
763
+
764
+ # 使用sha256算法计算哈希
765
+ def sha256(input_string):
766
+ sha256 = hashlib.sha256()
767
+ sha256.update(input_string.encode('utf-8'))
768
+ return sha256.hexdigest()
769
+
770
+
771
+ # 使用 Ethscriptions API(主网)检查某个铭文是否已题写
772
+ def check_content_exists(sha):
773
+ # 定义请求的网址
774
+ endpoint = f"/ethscriptions/exists/{sha}"
775
+ response = requests.get('https://mainnet-api.ethscriptions.com/api' + endpoint)
776
+ # 如果返回状态码是200,说明请求成功,然后返回结果(Ture or False)
777
+ if response.status_code == 200:
778
+ return response.json()['result']
779
+
780
+
781
+ # 发送自己到自己 0ETH 的交易
782
+ def send_transaction(w3, account_address, private_key, chain_id, gas_price, input_data, current_nonce):
783
+
784
+ # 设置交易的相关信息
785
+ tx = {
786
+ 'chainId': chain_id, # 网络 ID
787
+ 'gas': 25000, # 如果交易 gas 过低,可适当调高
788
+ 'gasPrice': gas_price, # gas 的价格
789
+ 'nonce': current_nonce,
790
+ 'to': account_address, # 接收地址为自己
791
+ 'value': 0, # 金额为 0ETH
792
+ 'data': text_to_hex(input_data), # 铭文内容
793
+ }
794
+
795
+ # 用私钥签名这个交易
796
+ signed_tx = w3.eth.account.sign_transaction(tx, private_key)
797
+ # 发送签名后的交易并获取交易哈希
798
+ tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
799
+ # 打印结果信息
800
+ st.toast(f'{input_data}', icon='✅')
801
+ # 返回铭文还有交易哈希
802
+ return input_data, tx_hash.hex()
803
+
804
+ # 网页前端显示
805
+ # 网页标题
806
+ st.markdown('# [ethpen.com](https://ethpen.com) 域名铭文批量题写')
807
+ # 提醒
808
+ st.info('''在使用之前,敬请仔细阅读说明,感谢您的配合。
809
+ - 请务必访问 **[ethpen.com](https://ethpen.com)** 官方网站。您可以确保这里的代码无恶意,安全地复制。
810
+ - 在使用过程中,请根据规定准确填写信息,以确保程序顺畅运行。
811
+ - 我们建议您使用备用账号,并避免在账号中存放大额资金。
812
+ - 若您对此代码存有疑虑,建议您利用如 [ChetGPT](https://chat.openai.com/)、[Bard](https://bard.google.com/) 或 [Claude](https://claude.ai/) 等知名 AI 平台进行查询,以判断是否含有恶意代码。
813
+ ''')
814
+
815
+ # 连接的网络 ID。比如说,1 代表主网络,5 代表 Goerli 测试网络,11155111 代表 Sepolia 测试网络,如果你不放心,可以先用测试网试试。
816
+ net_options = {
817
+ '1': 'Mainnet',
818
+ '5': 'Goerli',
819
+ '11155111': 'Sepolia'
820
+ }
821
+ selected_option = st.selectbox(
822
+ '**网络 ID**',
823
+ list(net_options.keys()),
824
+ format_func=lambda x: f"{x} ({net_options[x]})"
825
+ )
826
+ chain_id = int(selected_option)
827
+
828
+ # 这里配置 Ethereum PRC URL,如果你没有,请到 infura.io 或者 alchemy.com 申请一个免费的 API
829
+ token_eth_prc_url = st.text_input(
830
+ f'**Ethereum PRC 链接**:选填,你可以去 [infura.io](https://app.infura.io/) 或者 [alchemy.com](https://alchemy.com/) 免费申请一个',
831
+ f'https://{net_options[str(chain_id)]}.infura.io/v3/eab7f935b9af45e1a54f7d7ed06c5206')
832
+ w3 = Web3(Web3.HTTPProvider(f'{token_eth_prc_url}'))
833
+ # 初始化当前账户索引为 0
834
+ current_account_index = 0
835
+ # 收集和显示所有交易的结果
836
+ transaction_results = []
837
+ # 创建账户列表
838
+ accounts = []
839
+ # 使用字典来跟踪每个地址的nonce
840
+ nonces = {}
841
+
842
+ # 启用多账户操作
843
+ if st.checkbox(f'启用**多账户**操作'):
844
+ # 多账户的文本框
845
+ account_list = st.text_area(f'输入多个 **ETH 地址及其对应的私钥**,用英文逗号分隔(,),如下:地址,私钥')
846
+ if account_list: # 如果账户列表有内容
847
+ for line in account_list.split('\n'): # 根据换行符划分账户
848
+ if ',' in line: # 检查是否包含逗号
849
+ address, key = line.split(',') # 分开地址和私钥
850
+ if is_valid_eth_address(address) and is_valid_eth_private_key(key): # 验证地址和私钥
851
+ current_nonce = w3.eth.get_transaction_count(address) # 获取地址的 nonce
852
+ nonces[address] = current_nonce # 记录地址的 nonce
853
+ accounts.append((address.strip(), key.strip())) # 保存地址和私钥还有 nonce
854
+ else:
855
+ st.error(f"地址 {address} 或私钥 {key} 无效,请检查!")
856
+ st.stop()
857
+ else:
858
+ st.error(f"输入格式错误,请确保每行包含一个地址和一个私钥,并使用英文逗号分隔(,)。错误行:**{line}**")
859
+ st.stop()
860
+ else:
861
+ account_address = st.text_input('填写你的 **ETH 地址**:')
862
+ private_key = st.text_input('填写你的 **ETH 地址对应的私钥**:', type="password")
863
+ if account_address and private_key: # 如果地址和私钥有内容
864
+ if is_valid_eth_address(account_address) and is_valid_eth_private_key(private_key): # 验证地址和私钥
865
+ current_nonce = w3.eth.get_transaction_count(account_address) # 获取地址的 nonce
866
+ nonces[account_address] = current_nonce # 记录地址的 nonce
867
+ accounts.append((account_address.strip(), private_key.strip())) # 保存地址和私钥还有 nonce
868
+ else:
869
+ st.error("地址或私钥无效,请检查!")
870
+ st.stop()
871
+
872
+ # 配置铭文文本
873
+ ethscriptions_str = st.text_area(f'输入**多个域名铭文或其他**,可以用空格、换行符、英文逗号(,)分开,不要带 data:, 前缀,不要带域名后缀')
874
+ name_options = ["自定义", ".eth", ".eths", ".tree", ".honk", ".etch"]
875
+ name_selected_option = st.selectbox(f'选择**域名后缀**', name_options)
876
+ if name_selected_option == '自定义':
877
+ name_selected_option = st.text_input('输入**自定义的域名**:')
878
+ # 以空格、换行符、英文逗号分隔文本并加上后缀
879
+ ethscription_list = split_and_append(ethscriptions_str, name_selected_option)
880
+
881
+ # 判断铭文文本里是否包含空格、换行符,而且所有的字母都必须为小写。
882
+ if not validate_input(''.join(ethscription_list)):
883
+ st.warning("**请注意**:通常代币铭文文本里不能包含空格、换行符,而且所有的字母都必须为小写。")
884
+
885
+ # 题写铭文之前检查该铭文有没有被题写
886
+ if st.checkbox(f'题写铭文之前**检查该铭文有没有被题写**'):
887
+ token_check = True
888
+ else:
889
+ token_check = False
890
+
891
+ # 每次交易成功后暂停 3 秒
892
+ if st.checkbox(f'每次交易完成后暂停 3 秒'):
893
+ sleep_3s = True
894
+ else:
895
+ sleep_3s = False
896
+
897
+ # 点击发送交易开始
898
+ if st.button(f'开始**发送交易**'):
899
+ if not accounts or not ethscriptions_str or not name_selected_option: # 检查是否留空
900
+ st.error(f'请正确谨慎地填写内容,每一项都**不应留空**。')
901
+ st.stop()
902
+ else:
903
+ st.toast('看起来你输入的内容均无没有问题!', icon='🥳')
904
+
905
+ st.toast(f'开始任务,需要题写的铭文总量为:{len(ethscription_list)}', icon='😎')
906
+
907
+ # 对代币铭文 id 进行循环
908
+ for name_str in ethscription_list:
909
+ # 使用当前账户发送交易,获取当前账户的 nonce
910
+ address, key = accounts[current_account_index]
911
+ # 获取 gas
912
+ gas_price = w3.eth.gas_price
913
+ # 得到完整的铭文文本
914
+ if not name_str.startswith('data:,'):
915
+ input_data = f'data:,{name_str}'
916
+
917
+ # 根据是否检查的开关进行
918
+ if token_check:
919
+ # 这里是开了检查后请求 Ethscriptions API
920
+ if check_content_exists(sha256(input_data)):
921
+ # 返回数据为 Ture,说明该铭文已经被题写,打印信息
922
+ st.toast(f'{input_data} 已经被题写!', icon='☹️')
923
+ else:
924
+ # 返回数据为 False,说明该铭文还没被题写,发送交易
925
+ # 使用 current_nonce 发送交易
926
+ data, tx_hash = send_transaction(w3, address, key, chain_id, gas_price, input_data, nonces[address])
927
+ # 记录最后输出的结果
928
+ transaction_results.append(f"{address} | {data} | Transaction Hash: {tx_hash}")
929
+ # 交易成功后,手动增加 nonce 值
930
+ nonces[address] += 1
931
+ else:
932
+ # 这里是未开检查后直接发送交易
933
+ # 使用 current_nonce 发送交易
934
+ data, tx_hash = send_transaction(w3, address, key, chain_id, gas_price, input_data, nonces[address])
935
+ # 记录最后输出的结果
936
+ transaction_results.append(f"{address} | {data} | Transaction Hash: {tx_hash}")
937
+ # 交易成功后,手动增加 nonce 值
938
+ nonces[address] += 1
939
+ # 更新当前账户索引,确保索引始终在账户列表的范围内
940
+ current_account_index = (current_account_index + 1) % len(accounts)
941
+ # 暂停 3 秒
942
+ if sleep_3s:
943
+ time.sleep(3) # 暂停三秒
944
+ st.toast(f'所有任务已经完成。', icon='🎉')
945
+ # 庆祝动画
946
+ st.balloons()
947
+ # 显示所有交易的结果
948
+ st.code('\n'.join(transaction_results))
949
+
950
+ """
951
+
952
+ my_style = '''
953
+ <style>
954
+ .tag {
955
+ display: inline-block;
956
+ padding: 2px 6px;
957
+ background-color: #f2f2f2; /* 默认的背景颜色 */
958
+ border-radius: 5px; /* 圆角效果 */
959
+ margin: 0 2px;
960
+ transition: background-color 0.3s; /* 平滑的颜色过渡效果 */
961
+ }
962
+
963
+ .tag:hover {
964
+ background-color: #cffd51; /* 鼠标经过时的背景颜色 */
965
+ }
966
+
967
+ .tag:active {
968
+ background-color: #cffd51; /* 鼠标按下时的背景颜色 */
969
+ }
970
+ </style>
971
+ '''
972
+
973
+
974
+ # 图片Base64
975
+ def image_to_base64(img_path):
976
+ with open(img_path, "rb") as image_file:
977
+ return base64.b64encode(image_file.read()).decode()
978
+
979
+
980
+ # 验证代币铭文函数
981
+ def is_valid_eths(data, p, tick, id, amt):
982
+ # 构建匹配1到id-1的正则表达式
983
+ pattern_range = "|".join([str(i) for i in range(1, id)])
984
+ # 使用 f-string 插入参数到正则表达式
985
+ pattern = rf'^data:,{{"p":"{p}","op":"mint","tick":"{tick}","id":"({pattern_range}|{id})","amt":"{amt}"}}$'
986
+ return bool(re.match(pattern, data))
987
+
988
+
989
+ # 文本转换到十六进制
990
+ def text_to_hex(text):
991
+ return ''.join(format(ord(char), '02x') for char in text)
992
+
993
+
994
+ # str SHA256
995
+ def sha256(input_string):
996
+ sha256 = hashlib.sha256()
997
+ sha256.update(input_string.encode('utf-8'))
998
+ return sha256.hexdigest()
999
+
1000
+
1001
+ # 根据 TX 获取 input data
1002
+ def get_input_data(tx_hash):
1003
+ endpoint = f"https://mainnet.infura.io/v3/{infura_api_key}"
1004
+ headers = {
1005
+ "Content-Type": "application/json",
1006
+ }
1007
+ data = {
1008
+ "jsonrpc": "2.0",
1009
+ "id": 1,
1010
+ "method": "eth_getTransactionByHash",
1011
+ "params": [tx_hash]
1012
+ }
1013
+ eth_transaction = requests.post(endpoint, headers=headers, data=json.dumps(data))
1014
+ transaction_data = eth_transaction.json()
1015
+ return transaction_data['result']['input']
1016
+
1017
+
1018
+ # 获取所有的 ethscriptions
1019
+ def get_all_ethscriptions(page=None, per_page=None, sort_order=None):
1020
+ endpoint = "/ethscriptions"
1021
+ params = {
1022
+ "page": page, # 页码
1023
+ "per_page": per_page, # 每页的数量
1024
+ "sort_order": sort_order # 排序顺序
1025
+ }
1026
+ response = requests.get(BASE_URL + endpoint, params=params)
1027
+ return response.json()
1028
+
1029
+
1030
+ # 根据地址获取 ethscriptions
1031
+ def get_ethscriptions_by_address(address):
1032
+ all_ethscriptions = []
1033
+ page = 1
1034
+ per_page = 100
1035
+ while True:
1036
+ endpoint = f"/ethscriptions/owned_by/{address}"
1037
+ params = {
1038
+ "page": page,
1039
+ "per_page": per_page,
1040
+ "sort_order": 'asc'
1041
+ }
1042
+ response = requests.get(BASE_URL + endpoint, params=params)
1043
+ if response.status_code != 200:
1044
+ print(f"Error fetching data: {response.text}")
1045
+ break
1046
+ ethscriptions = response.json()
1047
+ all_ethscriptions.extend(ethscriptions)
1048
+ if len(ethscriptions) < per_page:
1049
+ break
1050
+ page += 1
1051
+ return all_ethscriptions
1052
+
1053
+
1054
+ # 使用ID或数字获取特定的 ethscription
1055
+ def get_specific_ethscription(ethscription_identifier):
1056
+ endpoint = f"/ethscriptions/{ethscription_identifier}"
1057
+ response = requests.get(BASE_URL + endpoint)
1058
+ return response.json()
1059
+
1060
+
1061
+ # 获取特定 ethscription 的数据
1062
+ def get_ethscription_data(ethscription_identifier):
1063
+ endpoint = f"/ethscriptions/{ethscription_identifier}/data"
1064
+ response = requests.get(BASE_URL + endpoint)
1065
+ return response.json()
1066
+
1067
+
1068
+ # 使用 SHA256 值检查内容是否已被 ethscribed
1069
+ def check_content_exists(sha):
1070
+ endpoint = f"/ethscriptions/exists/{sha}"
1071
+ response = requests.get(BASE_URL + endpoint)
1072
+ if response.status_code == 200:
1073
+ return response.json()
1074
+
1075
+
1076
+ # 确定索引器是否落后
1077
+ def get_block_status():
1078
+ endpoint = "/block_status"
1079
+ response = requests.get(BASE_URL + endpoint)
1080
+ return response.json()
1081
+
1082
+
1083
+ # 获取 $eths 价格
1084
+ def get_eths_price():
1085
+ params = {
1086
+ 'category': 'token',
1087
+ 'collectionName': 'erc-20 eths',
1088
+ }
1089
+
1090
+ response = requests.get(
1091
+ 'https://www.etch.market/api/markets/collections/details',
1092
+ params=params
1093
+ )
1094
+ if response.status_code == 200:
1095
+ response = response.json()
1096
+ if response['message'] == 'success':
1097
+ return response['data']
1098
+ return {} # 返回一个空字典作为默认值
1099
+
1100
+
1101
+ # 从 etch.market 那里获取用户地址代币余额
1102
+ def get_etch_token_amt():
1103
+ params = {
1104
+ 'category': 'token',
1105
+ 'tokenQuery': '',
1106
+ }
1107
+
1108
+ response = requests.get(
1109
+ 'https://www.etch.market/api/markets/ethscriptions/collections/0x59724739940777947c56C4f2f2C9211cd5130FEf',
1110
+ params=params
1111
+ )
1112
+ if response.status_code == 200:
1113
+ response = response.json()
1114
+ if response['message'] == 'success':
1115
+ return response['data']
1116
+ return {} # 返回一个空字典作为默认值
1117
+
1118
+
1119
+ # 获取 $eths 质押数据
1120
+ def get_eths_staking():
1121
+ response = requests.get('https://www.etch.market/api/staking/statistics/erc-20%20eths')
1122
+ if response.status_code == 200:
1123
+ response = response.json()
1124
+ if response['message'] == 'success':
1125
+ return response['data']
1126
+ return {} # 返回一个空字典作为默认值
1127
+
1128
+
1129
+ st.set_page_config(page_title="EthPen - 以太之笔", page_icon="🖊", layout='wide', initial_sidebar_state='expanded')
1130
+
1131
+ # 首页
1132
+ st.markdown(
1133
+ f'# <a href="https://ethpen.com" target="_self"><img src="data:image/svg+xml;base64,{image_to_base64(os.path.join("img", "ethpen_logo.svg"))}" alt="Image" width="64px" height="64px" style="border-radius: 8px;"/></a> :rainbow[EthPen - 以太之笔]',
1134
+ unsafe_allow_html=True)
1135
+ st.subheader('', anchor=False, divider='rainbow')
1136
+
1137
+ # 最近新闻
1138
+ st.markdown(f'### 最近新闻')
1139
+ st.markdown(
1140
+ f'<a href="https://twitter.com/dumbnamenumbers/status/1696989307871826137" target="_blank"><img src="data:image/jpeg;base64,{image_to_base64(os.path.join("img", "news.jpeg"))}" alt="Image" style="max-width: 100%; width: 100%; height: auto; border-radius: 10px; display: block;"/></a>',
1141
+ unsafe_allow_html=True)
1142
+ st.markdown(f'> 3 周前,我们提出了 Ethscriptions 虚拟机的构想——一种通过将其解释为计算机指令来显著增强 Ethscriptions 功能的方法。今天,我们宣布了该虚拟机的首个实现。已在 Goerli 网络上线,并已在 GitHub 上完全开源!👆')
1143
+
1144
+ # 广告位图片
1145
+ st.markdown(f'### 广告位')
1146
+ st.markdown(
1147
+ f'<a href="https://twitter.com/EtchMarket/status/1694024108672245953" target="_blank"><img src="data:image/jpeg;base64,{image_to_base64(os.path.join("img", "ad.jpg"))}" alt="Image" style="max-width: 100%; width: 100%; height: auto; border-radius: 10px; display: block;"/></a>',
1148
+ unsafe_allow_html=True)
1149
+ st.markdown(f'> 拆分方案现在面向所有人推出!让我们一起加入权益挖矿的浪潮,并分享50%的月度服务费。')
1150
+ st.markdown("### 功能专区")
1151
+
1152
+
1153
+ # st.expander
1154
+ search_rune_expander = st.expander("查询 Ethscriptions")
1155
+ create_rune_expander = st.expander("题写 Ethscriptions")
1156
+ token_no_code_expander = st.expander("一键式铭文批量题写,无需编码知识!")
1157
+ trend_expander = st.expander("潮流动态")
1158
+ help_expander = st.expander("教程帮助")
1159
+ st.markdown("🎉 更多功能尽在菜单栏,请点击左上角的 >")
1160
+ # 查询铭文页面
1161
+ search_rune_expander.info(
1162
+ f"铭文数据来自 [Ethscriptions](https://ethscriptions.com/) 官方网站,当前索引器状态落后: {get_block_status()['blocks_behind']} 个区块。")
1163
+ search_rune_expander.markdown("##### 查询 ETH 地址所属铭文")
1164
+ user_address = search_rune_expander.text_input('输入 ETH 地址:', '')
1165
+
1166
+ if search_rune_expander.button('🔍 查询', key='查询铭文'):
1167
+ # 检查ETH地址
1168
+ pattern = "^0x[a-fA-F0-9]{40}$"
1169
+ if re.match(pattern, user_address):
1170
+ data = get_ethscriptions_by_address(user_address)
1171
+ if not data:
1172
+ search_rune_expander.info(
1173
+ "该地址没有任何铭文,或许是区块暂时没同步过来,如果你不确定,请前往 Ethscriptions 官网再次查询!")
1174
+ else:
1175
+ token_total = 0
1176
+ for token in token_list:
1177
+ for ethscriptions in data:
1178
+ if is_valid_eths(ethscriptions['content_uri'], token['p'], token['tick'], token['id'],
1179
+ token['amt']):
1180
+ input_data_str = json.loads(ethscriptions['content_uri'][6:])
1181
+ token_total = token_total + int(input_data_str['amt'])
1182
+ search_rune_expander.success(f"${token['tick']} 有效总量为:{token_total}")
1183
+ token_total = 0
1184
+ search_rune_expander.warning(
1185
+ f"只统计 etch.market 流动性较高的资产,etch.market 上架的代币不计算在内,详细更多的信息请点击[这里](https://ethscriptions.com/{user_address})")
1186
+ else:
1187
+ search_rune_expander.error("输入的 ETH 地址不正确!")
1188
+
1189
+ search_rune_expander.markdown("##### 查询铭文的完整信息")
1190
+ ethscriptions_str = search_rune_expander.text_input('输入完整的铭文文本:', '')
1191
+ if search_rune_expander.button('🔍 查询', key='查询信息'):
1192
+ if not ethscriptions_str.startswith('data:,'):
1193
+ ethscriptions_str = f'data:,{ethscriptions_str}'
1194
+ ethscriptions_all_str = sha256(ethscriptions_str)
1195
+ ethscriptions_data = check_content_exists(ethscriptions_all_str)
1196
+ if ethscriptions_data['result']:
1197
+ search_rune_expander.markdown(f'###### :green[{ethscriptions_str}] 相关信息如下:')
1198
+ selected_data = {
1199
+ '当前拥有者': ethscriptions_data["ethscription"]["current_owner"],
1200
+ '题写时间': ethscriptions_data["ethscription"]["creation_timestamp"],
1201
+ '铭文编号': f'#{ethscriptions_data["ethscription"]["ethscription_number"]}',
1202
+ '铭文完整内容': ethscriptions_data["ethscription"]["content_uri"],
1203
+ }
1204
+ search_rune_expander.json(selected_data)
1205
+ else:
1206
+ search_rune_expander.markdown(f'###### :green[{ethscriptions_str}] 铭文还没被题写!复制下方文本前去题写。')
1207
+ search_rune_expander.code(f'{text_to_hex(ethscriptions_str)}', line_numbers=False)
1208
+
1209
+ # 批量查询铭文是否被存在
1210
+ runes = []
1211
+ search_rune_expander.markdown("##### 批量查询铭文是否被题写")
1212
+ search_rune_expander.markdown(r'''
1213
+ 1. **查域名**:可以用空格和换行符还有英文逗号(,)分开,不要带前缀 data:,
1214
+ 2. **查代币**:需要查询的代币铭文内容变动的部分文本如 id 请用 "@#" 代替,例如:`data:,{"p":"erc-20","op":"mint","tick":"eths","id":"@#","amt":"1000"}`
1215
+ 3. **查纯文本**:可任意填写,用空格和换行符还有英文逗号(,)分开''')
1216
+ input_content = search_rune_expander.text_area(f'输入铭文文��:')
1217
+ search_type = search_rune_expander.radio('选择查询类型:', ['查域名', '查代币', '查纯文本'],
1218
+ label_visibility="collapsed", horizontal=True, index=2)
1219
+ if search_type == '查域名':
1220
+ search_dotname = search_rune_expander.text_input('填写域名后缀:')
1221
+ elif search_type == '查代币':
1222
+ search_token_min_id = search_rune_expander.number_input(f'填写代币铭文范围的**最小 ID(id)**:', min_value=1, value=1,
1223
+ step=1)
1224
+ search_token_max_id = search_rune_expander.number_input(f'填写代币铭文范围的**最大 ID(id)**:', value=10, step=1)
1225
+
1226
+ if search_rune_expander.button('🔍 查询', key='批量查询铭文'):
1227
+ runes = re.split(r'[\s,]+', input_content)
1228
+ # 过滤掉空或仅包含空白字符的项
1229
+ runes = [r for r in runes if r.strip() != '']
1230
+ if search_type == '查域名':
1231
+ runes = [r + search_dotname for r in runes]
1232
+ elif search_type == '查代币':
1233
+ token_runes = []
1234
+ if len(runes) != 1 and '@#' in input_content:
1235
+ for the_id in range(search_token_min_id, search_token_max_id + 1):
1236
+ token_runes.append(input_content.replace('@#', str(the_id)))
1237
+ else:
1238
+ st.stop()
1239
+ runes = token_runes
1240
+ # 创建一个空的结果列表
1241
+ results = []
1242
+ # 循环遍历每一个铭文并查询其存在状态
1243
+ for rune in runes:
1244
+ if not rune.startswith('data:,'):
1245
+ rune = f'data:,{rune}'
1246
+ sha_value = sha256(rune)
1247
+ response_data = check_content_exists(sha_value)
1248
+
1249
+ # 根据返回的result,得到真或者假
1250
+ exists = "已题写" if response_data['result'] else "未题写"
1251
+ results.append([rune, exists])
1252
+
1253
+ # 使用 st.table 显示结果
1254
+ table_data = pd.DataFrame(results, columns=['铭文', '状态'])
1255
+
1256
+ # 根据状态生成一个辅助排序列
1257
+ table_data['sort_helper'] = table_data['状态'].apply(lambda x: 0 if x == "未题写" else 1)
1258
+
1259
+ # 使用辅助列进行排序
1260
+ table_data.sort_values(by='sort_helper', ascending=True, inplace=True)
1261
+
1262
+ # 删除辅助排序列
1263
+ table_data.drop(columns=['sort_helper'], inplace=True)
1264
+
1265
+ # 定义样式和生成带有专门类名的HTML表格
1266
+ table_style = """
1267
+ <style>
1268
+ .styled_table {
1269
+ width: 100%;
1270
+ border-collapse: collapse;
1271
+ border-radius: 8px;
1272
+ overflow: hidden; /* Ensures border-radius applies to table */
1273
+ }
1274
+ .styled_table th, .styled_table td {
1275
+ border: 1px solid #ddd;
1276
+ padding: 8px;
1277
+ text-align: left;
1278
+ }
1279
+ .styled_table th {
1280
+ background-color: #f2f2f2;
1281
+ color: black;
1282
+ }
1283
+ .styled_table tr:hover {
1284
+ background-color: #f5f5f5;
1285
+ }
1286
+ .styled_table td[status="已题写"] {
1287
+ background-color: #f2dede; /* Reddish */
1288
+ }
1289
+ .styled_table td[status="未题写"] {
1290
+ background-color: #dff0d8; /* Greenish */
1291
+ }
1292
+ </style>
1293
+ """
1294
+ search_rune_expander.markdown(table_style, unsafe_allow_html=True)
1295
+ table_html = table_data.to_html(index=False, classes='styled_table', border=0, escape=False,
1296
+ formatters=dict(状态=lambda x: f'<td status="{x}">{x}</td>'))
1297
+
1298
+ # 生成HTML表格但不为状态列添加特殊格式
1299
+ table_html = table_data.to_html(index=False, classes='styled_table', border=0, escape=False)
1300
+
1301
+ # 使用字符串替换为状态列添加特定属性
1302
+ table_html = table_html.replace('<td>已题写</td>', '<td status="已题写">已题写</td>')
1303
+ table_html = table_html.replace('<td>未题写</td>', '<td status="未题写">未题写</td>')
1304
+
1305
+ # 使用st.write输出带样式的HTML表格
1306
+ search_rune_expander.write(table_html, unsafe_allow_html=True)
1307
+ search_rune_expander.markdown('')
1308
+
1309
+ # 题写铭文页面
1310
+ create_rune_expander.markdown("##### 文本转换到十六进制")
1311
+ input_ethscriptions_str = create_rune_expander.text_input(
1312
+ '输入需要转换的文本,默认以 "data:," 开头,换行和回车字符不应出现。', '')
1313
+ if create_rune_expander.button('🔁 转换', key='文本转换到十六进制'):
1314
+ if not input_ethscriptions_str.startswith('data:,'):
1315
+ input_ethscriptions_str = f'data:,{input_ethscriptions_str}'
1316
+ input_ethscriptions_hex = text_to_hex(input_ethscriptions_str)
1317
+ create_rune_expander.markdown(f':green[{input_ethscriptions_str}] 转换到十六进制:')
1318
+ create_rune_expander.code(input_ethscriptions_hex, line_numbers=False)
1319
+ input_ethscriptions_sha = sha256(input_ethscriptions_str)
1320
+ ethscriptions_data = check_content_exists(input_ethscriptions_sha)
1321
+ if ethscriptions_data['result']:
1322
+ create_rune_expander.markdown(f'###### :green[{ethscriptions_str}] 相关信息如下:')
1323
+ selected_data = {
1324
+ '当前拥有者': ethscriptions_data["ethscription"]["current_owner"],
1325
+ '题写时间': ethscriptions_data["ethscription"]["creation_timestamp"],
1326
+ '铭文编号': f'#{ethscriptions_data["ethscription"]["ethscription_number"]}',
1327
+ '铭文完整内容': ethscriptions_data["ethscription"]["content_uri"],
1328
+ }
1329
+ create_rune_expander.json(selected_data)
1330
+ else:
1331
+ create_rune_expander.markdown(f'###### :green[{input_ethscriptions_str}] 铭文还没被题写!快前去题写吧。')
1332
+
1333
+ create_rune_expander.markdown("##### 批量自动题写铭文")
1334
+ create_rune_expander.info("""在使用之前,敬请仔细阅读说明,感谢您的配合。
1335
+ 1. 请务必访问 **[ethpen.com](https://ethpen.com)** 官方网站。您可以确保这里的代码无恶意,安全地复制。
1336
+ 2. 你只需要掌握一些 python 相关的基础。
1337
+ 3. 在使用过程中,请根据规定准确填写信息,以确保程序顺畅运行。
1338
+ 4. 我们建议您使用备用账号,并避免在账号中存放大额资金。
1339
+ 5. 若您对此代码存有疑虑,建议您利用如 [ChetGPT](https://chat.openai.com/)、[Bard](https://bard.google.com/) 或 [Claude](https://claude.ai/) 等知名 AI 平台进行查询,以判断是否含有恶意代码。
1340
+ 6. 如果你在使用的过程中发现 BUG 或者有什么想法和建议,欢迎与我联系。
1341
+ """)
1342
+ if create_rune_expander.button('🖨 打印代币代码', key='输出代币铭文 Python 代码'):
1343
+ create_rune_expander.code(python_token_code, 'python', line_numbers=False)
1344
+ if create_rune_expander.button('🖨 打印域名代码', key='输出域名铭文 Python 代码'):
1345
+ create_rune_expander.code(python_name_code, 'python', line_numbers=False)
1346
+
1347
+ # 全新不用懂代码的铭文批量题写页面
1348
+ token_no_code_expander.markdown("##### 安全的简易的批量自动题写铭文")
1349
+ token_no_code_expander.info("""在使用之前,敬请仔细阅读说明,感谢您的配合。
1350
+ 1. 请务必访问 **[ethpen.com](https://ethpen.com)** 官方网站。您可以确保这里的代码无恶意,安全地复制。
1351
+ 2. 你只需要拥有一个 [HuggingFace.co](https://huggingface.co) 账户。
1352
+ 3. 在使用过程中,请根据规定准确填写信息,以确保程序顺畅运行。
1353
+ 4. 我们建议您使用备用账号,并避免在账号中存放大额资金。
1354
+ 5. 若您对此代码存有疑虑,建议您利用如 [ChetGPT](https://chat.openai.com/)、[Bard](https://bard.google.com/) 或 [Claude](https://claude.ai/) 等知名 AI 平台进行查询,以判断是否含有恶意代码。
1355
+ 6. 请查看我们的例子 [token-example](https://huggingface.co/spaces/Ethscriptions/token) / [name-example](https://huggingface.co/spaces/Ethscriptions/name)。
1356
+ """)
1357
+ if token_no_code_expander.button('🖨️ 打印代币代码', key='输出 Token 铭文 Python 代码'):
1358
+ token_no_code_expander.markdown(
1359
+ f'**为 [HuggingFace.co](https://huggingface.co) 平台与 [Streamlit.io](https://streamlit.io/) 框架量身打造的代币铭文专业 Python 代码(app.py):**')
1360
+ token_no_code_expander.code(hf_token_code, 'python', line_numbers=False)
1361
+ token_no_code_expander.markdown(f"**依赖包清单(requirements.txt):**")
1362
+ token_no_code_expander.code('''
1363
+ Requests
1364
+ streamlit
1365
+ web3
1366
+ ''')
1367
+ if token_no_code_expander.button('🖨️ 打印域名代码', key='输出 Name 铭文 Python 代码'):
1368
+ token_no_code_expander.markdown(
1369
+ f'**为 [HuggingFace.co](https://huggingface.co) 平台与 [Streamlit.io](https://streamlit.io/) 框架量身打造的域名铭文专业 Python 代码(app.py):**')
1370
+ token_no_code_expander.code(hf_name_code, 'python', line_numbers=False)
1371
+ token_no_code_expander.markdown(f"**依赖包清单(requirements.txt):**")
1372
+ token_no_code_expander.code('''
1373
+ Requests
1374
+ streamlit
1375
+ web3
1376
+ ''')
1377
+
1378
+ # 潮流动态页面
1379
+ trend_expander.markdown("##### 开发中...")
1380
+
1381
+ # 教程帮助页面
1382
+ help_expander.markdown('##### 我不懂代码,怎么做到批量题写铭文?')
1383
+ # help_expander.markdown('##### 如何用 Metamask 题写 Ethscriptions 铭文?')
1384
+ # help_expander.markdown('##### 如何用 Metamask 在 etch.market 上购买 $eths?')
1385
+ # help_expander.markdown('##### 如何运行批量自动题写铭文 python 代码?')
1386
+ # help_expander.markdown(f'<iframe src="//player.bilibili.com/player.html?aid=787389115&bvid=BV1J14y1i7ap&cid=1237586207&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>', unsafe_allow_html=True)
1387
+
1388
+
1389
+ # 嵌入式SVG文本(以下只是示例,替换为你的SVG文本)
1390
+ twitter_svg = """
1391
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"><path fill="currentColor" d="M8 2H1l8.26 11.014L1.45 22H4.1l6.388-7.349L16 22h7l-8.608-11.478L21.8 2h-2.65l-5.986 6.886L8 2Zm9 18L5 4h2l12 16h-2Z"/></svg>
1392
+ """
1393
+ twitter_encoded_svg = base64.b64encode(twitter_svg.encode('utf-8')).decode('utf-8')
1394
+ telegram_svg = """
1395
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256"><defs><linearGradient id="logosTelegram0" x1="50%" x2="50%" y1="0%" y2="100%"><stop offset="0%" stop-color="#2AABEE"/><stop offset="100%" stop-color="#229ED9"/></linearGradient></defs><path fill="url(#logosTelegram0)" d="M128 0C94.06 0 61.48 13.494 37.5 37.49A128.038 128.038 0 0 0 0 128c0 33.934 13.5 66.514 37.5 90.51C61.48 242.506 94.06 256 128 256s66.52-13.494 90.5-37.49c24-23.996 37.5-56.576 37.5-90.51c0-33.934-13.5-66.514-37.5-90.51C194.52 13.494 161.94 0 128 0Z"/><path fill="#FFF" d="M57.94 126.648c37.32-16.256 62.2-26.974 74.64-32.152c35.56-14.786 42.94-17.354 47.76-17.441c1.06-.017 3.42.245 4.96 1.49c1.28 1.05 1.64 2.47 1.82 3.467c.16.996.38 3.266.2 5.038c-1.92 20.24-10.26 69.356-14.5 92.026c-1.78 9.592-5.32 12.808-8.74 13.122c-7.44.684-13.08-4.912-20.28-9.63c-11.26-7.386-17.62-11.982-28.56-19.188c-12.64-8.328-4.44-12.906 2.76-20.386c1.88-1.958 34.64-31.748 35.26-34.45c.08-.338.16-1.598-.6-2.262c-.74-.666-1.84-.438-2.64-.258c-1.14.256-19.12 12.152-54 35.686c-5.1 3.508-9.72 5.218-13.88 5.128c-4.56-.098-13.36-2.584-19.9-4.708c-8-2.606-14.38-3.984-13.82-8.41c.28-2.304 3.46-4.662 9.52-7.072Z"/></svg>
1396
+ """
1397
+ telegram_encoded_svg = base64.b64encode(telegram_svg.encode('utf-8')).decode('utf-8')
1398
+ discord_svg = """
1399
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 256 256"><g fill="none"><rect width="256" height="256" fill="#5865F2" rx="60"/><g clip-path="url(#skillIconsDiscord0)"><path fill="#fff" d="M197.308 64.797a164.918 164.918 0 0 0-40.709-12.627a.618.618 0 0 0-.654.31c-1.758 3.126-3.706 7.206-5.069 10.412c-15.373-2.302-30.666-2.302-45.723 0c-1.364-3.278-3.382-7.286-5.148-10.412a.643.643 0 0 0-.655-.31a164.472 164.472 0 0 0-40.709 12.627a.583.583 0 0 0-.268.23c-25.928 38.736-33.03 76.52-29.546 113.836a.685.685 0 0 0 .26.468c17.106 12.563 33.677 20.19 49.94 25.245a.648.648 0 0 0 .702-.23c3.847-5.254 7.276-10.793 10.217-16.618a.633.633 0 0 0-.347-.881c-5.44-2.064-10.619-4.579-15.601-7.436a.642.642 0 0 1-.063-1.064a86.364 86.364 0 0 0 3.098-2.428a.618.618 0 0 1 .646-.088c32.732 14.944 68.167 14.944 100.512 0a.617.617 0 0 1 .655.08a79.613 79.613 0 0 0 3.106 2.436a.642.642 0 0 1-.055 1.064a102.622 102.622 0 0 1-15.609 7.428a.638.638 0 0 0-.339.889a133.075 133.075 0 0 0 10.208 16.61a.636.636 0 0 0 .702.238c16.342-5.055 32.913-12.682 50.02-25.245a.646.646 0 0 0 .26-.46c4.17-43.141-6.985-80.616-29.571-113.836a.506.506 0 0 0-.26-.238ZM94.834 156.142c-9.855 0-17.975-9.047-17.975-20.158s7.963-20.158 17.975-20.158c10.09 0 18.131 9.127 17.973 20.158c0 11.111-7.962 20.158-17.974 20.158Zm66.456 0c-9.855 0-17.974-9.047-17.974-20.158s7.962-20.158 17.974-20.158c10.09 0 18.131 9.127 17.974 20.158c0 11.111-7.884 20.158-17.974 20.158Z"/></g><defs><clipPath id="skillIconsDiscord0"><path fill="#fff" d="M28 51h200v154.93H28z"/></clipPath></defs></g></svg>
1400
+ """
1401
+ discord_encoded_svg = base64.b64encode(discord_svg.encode('utf-8')).decode('utf-8')
1402
+
1403
+ # 实际的社交链接
1404
+ twitter_link = "https://twitter.com/pztuya"
1405
+ telegram_link = "https://t.me/NervosCKB"
1406
+ discord_link = "https://discord.gg/ethscriptions"
1407
+
1408
+ # 关于页面
1409
+ eths_price_data = get_eths_price()
1410
+ st.markdown("### 关于")
1411
+ st.markdown(f'##### 什么是 Ethscriptions?', unsafe_allow_html=True)
1412
+ st.markdown(
1413
+ f'{my_style}<span class="tag"><a href="https://ethscriptions.com/" target="_blank" style="text-decoration: none;"><img src="data:image/jpeg;base64,{image_to_base64(os.path.join("img", "ethscriptions_logo_litto.png"))}" alt="Image" width="20px" height="20px" style="border-radius: 3px;"/> Ethscriptions </span></a>是一种新的在以太坊上创建和分享数字资产的方法,它通过使用交易 calldata 存储数据而不是智能合约来实现,这使其比 NFT 更为经济。它们是完全在链上、无需许可、抗审查的,并且其成本只是 NFT 的一小部分。',
1414
+ unsafe_allow_html=True)
1415
+ st.markdown('')
1416
+ st.markdown('##### 谁创造了 Ethscriptions?')
1417
+ st.markdown(
1418
+ f'首个 [Ethscription](https://ethscriptions.com/ethscriptions/0) 是在 2016 年创建的,但正式的协议是由 Tom Lehman,又名 <span class="tag"><a href="https://twitter.com/dumbnamenumbers" target="_blank" style="text-decoration: none;"><img src="data:image/jpeg;base64,{image_to_base64(os.path.join("img", "Middlemarch.jpg"))}" alt="Image" width="20px" height="20px" style="border-radius: 10px;"/> @Middlemarch</span></a> 开发的。除了比特币的铭文,他还受到了来自 Poly Network 黑客的著名的 “原型 - Ethscription” 的启发,你可以在[这笔交易](https://etherscan.io/tx/0x0ae3d3ce3630b5162484db5f3bdfacdfba33724ffb195ea92a6056beaa169490)中看到它。',
1419
+ unsafe_allow_html=True)
1420
+ st.markdown(
1421
+ f'- 快来加入 <span class="tag"><a href="https://discord.gg/ethscriptions" target="_blank" style="text-decoration: none;"><img src="data:image/svg+xml;base64,{discord_encoded_svg}" /> @ethscriptions</span></a>,与 Ethscriptions 一起成长!',
1422
+ unsafe_allow_html=True)
1423
+ st.markdown('##### Ethscriptions 上的龙头代币是?')
1424
+ st.markdown(
1425
+ f'毫无疑问,当自无愧,她必须是 Ethscriptions 上第一个代币 👉 <span class="tag"><a href="https://www.etch.market/market/token?category=token&collectionName=erc-20%20eths" target="_blank" style="text-decoration: none;"><img src="data:image/jpeg;base64,{image_to_base64(os.path.join("img", "eths_logo.png"))}" alt="Image" width="20px" height="20px"/> **eths**</span></a>',
1426
+ unsafe_allow_html=True)
1427
+
1428
+ # 查询eths_data表中所有数据
1429
+ c.execute('SELECT * FROM eths_data')
1430
+ # 获取所有结果
1431
+ eths_data = c.fetchall()
1432
+
1433
+ # 定义卡片样式
1434
+ eths_card_style = """
1435
+ <style>
1436
+ .card {
1437
+ border: 1px solid #e1e4e8;
1438
+ padding: 20px;
1439
+ border-radius: 15px;
1440
+ margin: -20px 0;
1441
+ }
1442
+
1443
+ .card p {
1444
+ margin-top: 7px;
1445
+ margin-bottom: 7px;
1446
+ }
1447
+
1448
+ .card h5 {
1449
+ margin-top: 10px;
1450
+ margin-bottom: -10px;
1451
+ }
1452
+
1453
+ .card a.button {
1454
+ display: inline-block;
1455
+ padding: 10px 15px;
1456
+ border: none;
1457
+ border-radius: 5px;
1458
+ background-color: #5bc43b;
1459
+ color: #fff;
1460
+ text-align: center;
1461
+ text-decoration: none;
1462
+ transition: background-color 0.3s;
1463
+ }
1464
+
1465
+ .card a.button:hover {
1466
+ background-color: #ccfd51;
1467
+ }
1468
+
1469
+ </style>
1470
+ """
1471
+ st.markdown(eths_card_style, unsafe_allow_html=True)
1472
+ # 创建卡片的HTML内容
1473
+ eths_card_content = f"""
1474
+ <div class="card">
1475
+ <img src="data:image/jpeg;base64,{image_to_base64(os.path.join("img", "eths_logo.jpeg"))}" alt="Image" style="max-width: 100%; width: 100%; height: auto; border-radius: 10px; display: block;"/></a>
1476
+ <p></p>
1477
+ <div style="display: flex; align-items: center; gap: 10px;">
1478
+ <img src="data:image/jpeg;base64,{image_to_base64(os.path.join("img", "eths_logo.png"))}" alt="Image" width="40px" height="40px" />
1479
+ <div>
1480
+ <h3 style="margin: 0; margin-bottom: -35px; font-size: 30px;">Ethscriptions eths</h3>
1481
+ <p style="margin: 0; font-size: 40px;"><strong>${eths_data[0][2]:.2f}</strong></p>
1482
+ </div>
1483
+ </div>
1484
+ <p>市值:<span class="tag">${eths_data[0][3]:,.0f}</span></p>
1485
+ <p>总量:<span class="tag">21,000,000</span></p>
1486
+ <p>24h 交易量:<span class="tag">${eths_data[0][5]:,.0f}</span></p>
1487
+ <h5>INFO</h5>
1488
+ <p>官网:None</p>
1489
+ <p>浏览器:<span class="tag"><a href="https://ethscriptions.com/" target="_blank" style="text-decoration: none;"><img src="data:image/jpeg;base64,{image_to_base64(os.path.join("img", "ethscriptions_logo_litto.png"))}" alt="Image" width="20px" height="20px" style="border-radius: 3px;"/> Ethscriptions</a></span></p>
1490
+ <p>Ethscription ID:<span class="tag"><a href="https://ethscriptions.com/ethscriptions/0x4636542d00d8075360d0303eb224c4ffb638169c23d6308aace55249b0bed2e4" target="_blank" style="text-decoration: none;"><img src="data:image/jpeg;base64,{image_to_base64(os.path.join("img", "ethscriptions_logo_litto.png"))}" alt="Image" width="20px" height="20px" style="border-radius: 3px;"/> 0x463654......bed2e4</a></span></p>
1491
+ <p>部署时间:<span class="tag">2023/06/18 05:46:11</span></p>
1492
+ <p>公链:<span class="tag">Ethereum Ethscriptions</span></p>
1493
+ <p>持有人数:<span class="tag">{eths_data[0][4]:,.0f}</span></p>
1494
+ <p>社交:<span class="tag"><a href="https://twitter.com/ethscriptions" target="_blank" style="text-decoration: none;"><img src="data:image/svg+xml;base64,{twitter_encoded_svg}" /> @ethscriptions</a></span><span class="tag"><a href="https://discord.gg/ethscriptions" target="_blank" style="text-decoration: none";><img src="data:image/svg+xml;base64,{discord_encoded_svg}" /> @ethscriptions</a></span></p>
1495
+ <h5>Staking</h5>
1496
+ <p>质押总量:<span class="tag">{eths_data[0][6]:,.0f} $eths</span></p>
1497
+ <p>质押人数:<span class="tag">{eths_data[0][7]:,.0f}</span></p>
1498
+ <p>TVL:<span class="tag">${eths_data[0][8]:,.0f}</span></p>
1499
+ <p><a href="https://www.etch.market/market/token?category=token&collectionName=erc-20%20eths" target="_blank" class="button">立即买入 $eths</a></p>
1500
+ </div>
1501
+ """
1502
+ st.markdown(eths_card_content, unsafe_allow_html=True)
1503
+
1504
+ st.markdown('')
1505
+ st.markdown('##### 关于 ethpen.com')
1506
+ st.markdown(
1507
+ f'欢迎踏足 EthPen - 以太之笔!这里汇聚了一系列关于 Ethscriptions 的精细工具集,无论是单一查询、铭文题写,还是批量检索、编码题写,乃至深入的教程导引,以太之笔都将助您铭文题写如飞。我们立志推广 Ethscriptions 的宏大理念,期望 $eths 翱翔于星空,与月相伴!若您携手建议或创意,我们热切期待您的声音。',
1508
+ unsafe_allow_html=True)
1509
+ st.markdown('对了,我叫 Pztuya,期待你们和我多多交流😊~')
1510
+
1511
+ st.markdown(f'''
1512
+ <span class="tag"><a href="https://twitter.com/pztuya" target="_blank" style="text-decoration: none;"><img src="data:image/svg+xml;base64,{twitter_encoded_svg}" /> @pztuya</a></span>
1513
+ <span class="tag"><a href="https://t.me/NervosCKB" target="_blank" style="text-decoration: none;"><img src="data:image/svg+xml;base64,{telegram_encoded_svg}" /> @NervosCKB</a></span>
1514
+ ''', unsafe_allow_html=True)