Найти в Дзене

подсказки

geth account new --datadir "C:\Users\McLovin\Desktop\geth"
geth.exe --datadir "C:\Users\McLovin\Desktop\geth" init "genesis.json"
geth.exe --http --http.addr "127.0.0.1" --http.api "personal, eth, miner, net, web3, admin" --networkid 15 --datadir "C:\Users\McLovin\Desktop\geth" --allow-insecure-unlock --http.corsdomain "*" console
web3.personal.unlockAccount( "0xA44363888c43cd0b7fb37452b24f3Bd74a911d32" , "111")
или
web3.personal.unlockAccount(eth.accounts[0], "111", 300)
miner.setEtherbase("0xA44363888c43cd0b7fb37452b24f3Bd74a911d32")
miner.start(1)
web3.personal.unlockAccount("0xa44363888c43cd0b7fb37452b24f3bd74a911d32")
>pyuic5 path\to\untitled.ui -o output\path\to\design.py
cmd cd
import web3
import json
class Run():
def __init__(self):
with open("abi.txt", "r") as f:
abi = json.load(f)
self.w3 = web3.Web3(web3.HTTPProvider('http://127.0.0.1:8545'))
contractAddress = web3.Web3.toChecksumAddress("0x0131e25c099b61da2B157FAa05A6Dd7543D

geth account new --datadir "C:\Users\McLovin\Desktop\geth"

geth.exe --datadir "C:\Users\McLovin\Desktop\geth" init "genesis.json"

geth.exe --http --http.addr "127.0.0.1" --http.api "personal, eth, miner, net, web3, admin" --networkid 15 --datadir "C:\Users\McLovin\Desktop\geth" --allow-insecure-unlock --http.corsdomain "*" console


web3.personal.unlockAccount( "0xA44363888c43cd0b7fb37452b24f3Bd74a911d32" , "111")
или
web3.personal.unlockAccount(eth.accounts[0], "111", 300)

miner.setEtherbase("0xA44363888c43cd0b7fb37452b24f3Bd74a911d32")
miner.start(1)

web3.personal.unlockAccount("0xa44363888c43cd0b7fb37452b24f3bd74a911d32")

>pyuic5 path\to\untitled.ui -o output\path\to\design.py
cmd cd

import web3
import json

class Run():
def __init__(self):
with open("abi.txt", "r") as f:
abi = json.load(f)
self.w3 = web3.Web3(web3.HTTPProvider('http://127.0.0.1:8545'))
contractAddress = web3.Web3.toChecksumAddress("0x0131e25c099b61da2B157FAa05A6Dd7543D8d11a")

self.con = self.w3.eth.contract(
abi=abi,
address=contractAddress
)

r = run()


auto

from uis.auto import Ui_Dialog
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
import lk2
from run import Run


class Account(QtWidgets.QMainWindow):
def __init__(self, parent=None):
QtWidgets.QWidget.__init__(self)
self.ui = Ui_Dialog()
self.ui.setupUi(self)
self.ui.pushButton_2.clicked.connect(self.Reg)
self.ui.pushButton.clicked.connect(self.login)
self.note = QtWidgets.QErrorMessage()
self.r = Run()

def Reg(self):
adr = self.ui.lineEdit_6.text()
fio = self.ui.lineEdit_5.text()
log = self.ui.lineEdit_3.text()
pas = int(self.ui.lineEdit_4.text())
vs = int(self.ui.lineEdit_7.text())
self.r.reg_users(adr, log, fio, vs, pas)
self.note.setWindowTitle("Успех")
self.note.showMessage("Регистрация успешна")

def login(self):
pas = self.ui.lineEdit_2.text()
adr = self.ui.lineEdit.text()
self.open = lk2.Account(adr)
self.open.show()

if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
myapp = Account()
myapp.show()
sys.exit(app.exec())


run


def reg_users(self, adr, fio, vs, pas):
adr = web3.Web3.toChecksumAddress(adr)
tx = self.con.functions.registry(fio, vs).transact({"from": adr})
self.w3.eth.waitForTransactionReceipt(tx)


def get_user(self, adr):
adr = web3.Web3.toChecksumAddress(adr)
users = self.con.functions.get_driver_info().call({"from": adr})
return users


регистрация
# Разблокируем аккаунт
w3.eth.account.unlock(address, password)

# Получаем доступ к аккаунту
account = w3.eth.account.privateKeyToAccount(private_key)



опредиление адреса в remix
msg.sender


отправка
import web3

# Создаем экземпляр провайдера для подключения к ноде Ethereum
provider = web3.providers.HttpProvider("https://mainnet.infura.io/v3/<your-project-id>")
w3 = web3.Web3(provider)

# Указываем адрес отправителя и получателя
sender_address = "0x1234567890123456789012345678901234567890"
recipient_address = "0x0987654321098765432109876543210987654321"

# Получаем количество газа для транзакции
gas = w3.eth.estimateGas({"from": sender_address, "to": recipient_address, "value": w3.toWei(0.001, "ether")})

# Создаем транзакцию
transaction = {
"from": sender_address,
"to": recipient_address,
"value": w3.toWei(0.001, "ether"),
"gas": gas,
"gasPrice": w3.eth.gasPrice,
"nonce": w3.eth.getTransactionCount(sender_address),
}

# Подписываем транзакцию и отправляем ее в сеть
signed_txn = w3.eth.account