{"id":337839,"date":"2022-09-02T15:00:31","date_gmt":"2022-09-02T15:00:31","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=337839"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=337839","title":{"rendered":"<span>Web3.0 \u043d\u0430 Python, \u0447\u0430\u0441\u0442\u044c 1: \u043e\u0441\u043d\u043e\u0432\u044b<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Web3\" rel=\"noopener noreferrer nofollow\">Web3<\/a>, \u0431\u044b\u043b\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430 <a href=\"https:\/\/web3py.readthedocs.io\/en\/stable\/quickstart.html\" rel=\"noopener noreferrer nofollow\">Web3Py<\/a>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0431\u0430\u043b\u0430\u043d\u0441\u0430, \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439, \u043c\u0438\u043d\u0442\u0438\u043d\u0433 NFT, \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430\u043c\u0438 \u0438 \u0442\u0434. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u044e\u0442 > 90% \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0435\u0439 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u044d\u043a\u0435\u043d\u0434\u0430 \u0434\u043b\u044f web3 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u041a\u0441\u0442\u0430\u0442\u0438, \u0432\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b \u0438 \u0434\u043b\u044f <a href=\"https:\/\/web3js.readthedocs.io\/en\/v1.7.4\/\" rel=\"noopener noreferrer nofollow\">Web3.js<\/a> \u0441 \u043f\u043e\u043f\u0440\u0430\u0432\u043a\u043e\u0439 \u043d\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441. <\/p>\n<p>\u0410\u043d\u043e\u043d\u0441 \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u043d\u043e\u0434\u0430\u043c \u0438 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u0447\u0438\u0441\u043b\u0430 \u044d\u0442\u0438\u0445 \u0441\u0430\u043c\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0431\u0443\u0434\u0435\u0442 \u0443 <a href=\"https:\/\/t.me\/shamaevnn\" rel=\"noopener noreferrer nofollow\">\u043c\u0435\u043d\u044f \u0432 \u043a\u0430\u043d\u0430\u043b\u0435<\/a>. <\/p>\n<p>\u0410 \u0437\u0434\u0435\u0441\u044c \u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0442\u0435\u043c\u044b:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#connect\" rel=\"noopener noreferrer nofollow\">\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0443<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#balance\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0431\u0430\u043b\u0430\u043d\u0441\u0430 \u0434\u043b\u044f \u0430\u0434\u0440\u0435\u0441\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#txns_with_native\" rel=\"noopener noreferrer nofollow\">\u0422\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0441 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0432\u0430\u043b\u044e\u0442\u043e\u0439 \u0441\u0435\u0442\u0438<\/a><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#txns_with_native\" rel=\"noopener noreferrer nofollow\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#txn_status\" rel=\"noopener noreferrer nofollow\">\u0421\u0442\u0430\u0442\u0443\u0441 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438<\/a><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#contracts\" rel=\"noopener noreferrer nofollow\">\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430\u043c\u0438<\/a><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#contracts_erc20\" rel=\"noopener noreferrer nofollow\">ERC20 \u0442\u043e\u043a\u0435\u043d\u044b<\/a><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#contract_read_operations\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0431\u0430\u043b\u0430\u043d\u0441\u0430, allowance, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u043a\u0435\u043d\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#contract_write_operations\" rel=\"noopener noreferrer nofollow\">\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0442\u043e\u043a\u0435\u043d\u0430, \u0432\u044b\u0434\u0430\u0447\u0430 allowance<\/a><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#NFT\" rel=\"noopener noreferrer nofollow\">NFT<\/a><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#nft_price\" rel=\"noopener noreferrer nofollow\">\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0446\u0435\u043d\u044b \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f NFT<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#nft_minting\" rel=\"noopener noreferrer nofollow\">Minting\/\u043f\u043e\u043a\u0443\u043f\u043a\u0430\/\u0432\u044b\u043f\u0443\u0441\u043a NFT<\/a><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u0412\u0441\u0435 \u044d\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0443\u0434\u043e\u0431\u043d\u043e \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0432 jupyter-notebook. \u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c <a href=\"https:\/\/web3py.readthedocs.io\/en\/stable\/quickstart.html#installation\" rel=\"noopener noreferrer nofollow\">Web3Py<\/a> \u0438 \u0437\u0430\u0432\u0435\u0441\u0442\u0438 \u0441\u0435\u0431\u0435 \u043a\u043e\u0448\u0435\u043b\u0451\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/metamask.io\/\" rel=\"noopener noreferrer nofollow\">MetaMask<\/a>, \u0447\u0442\u043e\u0431 \u0443 \u0432\u0430\u0441 \u0431\u044b\u043b \u0432\u0430\u0448 \u0430\u0434\u0440\u0435\u0441. <\/p>\n<p><a class=\"anchor\" name=\"connect\" id=\"connect\"><\/a><\/p>\n<h2>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0443 \u26d3\ufe0f<\/h2>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0443 \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0432\u044b\u043a\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u0435 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043d\u0435\u0433\u043e, \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0435\u0433\u043e \u043d\u043e\u0434 (\u043a\u043e\u043f\u0438\u0439). \u041c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e 3 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e URL \u043a \u043d\u043e\u0434\u0435:<\/p>\n<ul>\n<li>\n<p>HTTP<\/p>\n<\/li>\n<li>\n<p>WebSocket<\/p>\n<\/li>\n<li>\n<p>RPC<\/p>\n<\/li>\n<\/ul>\n<details class=\"spoiler\">\n<summary>\u0413\u0434\u0435 \u0432\u0437\u044f\u0442\u044c URL? <\/summary>\n<div class=\"spoiler__content\">\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0431\u0440\u0430\u043b \u0432\u0441\u0435 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0435 \u043d\u043e\u0434\u044b \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u2014 <a href=\"https:\/\/chainlist.org\/\" rel=\"noopener noreferrer nofollow\">chainlink<\/a>.  \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0439 \u043c\u0438\u043d\u0443\u0441 \u044d\u0442\u0438\u0445 \u043d\u043e\u0434, \u0447\u0442\u043e \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0432\u0441\u0435 \u043a\u043e\u043c\u0443 \u043d\u0435 \u043b\u0435\u043d\u044c. \u0418\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u043e\u043d\u0438 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u044b\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0438 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0434\u043e\u043b\u044c\u0448\u0435 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0438\u043b\u0438 \u043d\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0432\u043e\u0432\u0441\u0435.  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u0432\u043e\u044e \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u0443\u044e \u043d\u043e\u0434\u0443 \u0437\u0430 $, \u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u044b <a href=\"https:\/\/infura.io\/product\/ethereum\" rel=\"noopener noreferrer nofollow\">Infura<\/a> \u0438 <a href=\"https:\/\/www.ankr.com\/\" rel=\"noopener noreferrer nofollow\">Ankr<\/a>, \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0435\u0442\u0435\u0439. <\/p>\n<\/div>\n<\/details>\n<p>\u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u044b\u0442\u044b\u0432\u0430\u0442\u044c Web3 \u043d\u0430 \u0441\u0435\u0442\u0438 <em>Testnet Binance Smart Chain<\/em> (BSC).<\/p>\n<pre><code class=\"python\">from web3 import Web3  binance_testnet_rpc_url = \"https:\/\/data-seed-prebsc-1-s1.binance.org:8545\/\" web3 = Web3(Web3.HTTPProvider(binance_testnet_rpc_url)) print(f\"Is connected: {web3.isConnected()}\")  # Is connected: True # \u0421 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0430\u0441 ?<\/code><\/pre>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0432\u0448\u0438\u0441\u044c \u043a \u043d\u043e\u0434\u0435, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/learn.bybit.com\/ru\/crypto\/what-is-eth-gas\/\" rel=\"noopener noreferrer nofollow\">\u0426\u0435\u043d\u0430 \u0433\u0430\u0437\u0430 \u0432 \u0441\u0435\u0442\u0438<\/a><\/p>\n<\/li>\n<li>\n<p>\u041d\u043e\u043c\u0435\u0440 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0431\u043b\u043e\u043a\u0430<\/p>\n<\/li>\n<li>\n<p>\u041d\u043e\u043c\u0435\u0440 \u0441\u0435\u0442\u0438 (<code>chain_id<\/code>)<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\">print(f\"gas price: {web3.eth.gas_price} BNB\")  # \u043a\u043e\u043b-\u0432\u043e Wei \u0437\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u0433\u0430\u0437\u0430 print(f\"current block number: {web3.eth.block_number}\") print(f\"number of current chain is {web3.eth.chain_id}\")  # 97<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u0446\u0438\u0444\u0440 \u0432 \u0446\u0435\u043d\u0435 \u0433\u0430\u0437\u0430 \u0438\u043b\u0438 \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Wei?<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0412 Web3 \u0432\u0441\u0435 \u0447\u0438\u0441\u043b\u0430 \u0438\u0437\u043c\u0435\u0440\u044f\u044e\u0442\u0441\u044f \u0432 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0439 \u0435\u0434\u0438\u043d\u0438\u0446\u0435 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f, \u0442.\u0435. Wei. \u042d\u0442\u043e \u043a\u0430\u043a \u0435\u0441\u043b\u0438 \u0431\u044b \u0443 \u043d\u0430\u0441 \u0432\u0441\u0435 \u0438\u0437\u043c\u0435\u0440\u044f\u043b\u043e\u0441\u044c \u043d\u0435 \u0432 \u0440\u0443\u0431\u043b\u044f\u0445, \u0430 \u0432 \u043a\u043e\u043f\u0435\u0439\u043a\u0430\u0445, \u0442.\u0435, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"Ether = 10^{18} Wei\" alt=\"Ether = 10^{18} Wei\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/08f\/056\/6f0\/08f0566f06117ac7cd2e06954c5dc7be.svg\" width=\"149\" height=\"21\"\/>. \u0422\u0430\u043a\u0436\u0435 \u0435\u0449\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f Gwei, <img loading=\"lazy\" decoding=\"async\" class=\"formula inline\" source=\"Ether = 10^{10} Gwei\" alt=\"Ether = 10^{10} Gwei\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c90\/13e\/d03\/c9013ed037bc71f67457512acd507851.svg\" width=\"158\" height=\"21\"\/>. \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u0438\u0433\u0440\u0430\u0442\u044c\u0441\u044f <a href=\"https:\/\/etherscan.io\/unitconverter\" rel=\"noopener noreferrer nofollow\">\u0432\u043e\u0442 \u0442\u0443\u0442<\/a>. <\/p>\n<\/div>\n<\/details>\n<p><a class=\"anchor\" name=\"balance\" id=\"balance\"><\/a><\/p>\n<h2>\u0421\u043c\u043e\u0442\u0440\u0438\u043c \u0431\u0430\u043b\u0430\u043d\u0441 \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0430 ?<\/h2>\n<pre><code class=\"python\">wallet_address = \"0x2a647559a6c5dcb76ce1751101449ebbc039b157\"  # \u0432\u0430\u0448 \u0430\u0434\u0440\u0435\u0441 balance = web3.eth.get_balance(wallet_address) print(f\"balance of {wallet_address}={balance}\") # InvalidAddress: Web3.py only accepts checksum addresses<\/code><\/pre>\n<p>\u041a\u043e\u0434 \u0432\u044b\u0448\u0435 \u0432\u044b\u0431\u0440\u043e\u0441\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0443, \u0442.\u043a. \u0430\u0434\u0440\u0435\u0441 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>checksum<\/code> \u0430\u0434\u0440\u0435\u0441\u043e\u043c. <\/p>\n<details class=\"spoiler\">\n<summary>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Checksum Address?<\/summary>\n<div class=\"spoiler__content\">\n<p>Checksum \u0430\u0434\u0440\u0435\u0441 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043d\u0435 checksum \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043c, \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u043a\u0432\u044b \u0432 \u0430\u0434\u0440\u0435\u0441\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435. Checksum address \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0430\u0434\u0440\u0435\u0441 \u0432\u0430\u043b\u0438\u0434\u0435\u043d \u0438 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u043f\u0435\u0447\u0430\u0442\u043e\u043a. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 Web3Py \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0433\u043e. <\/p>\n<\/div>\n<\/details>\n<p>\u0410 \u0432\u043e\u0442 \u0443\u0436\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0431\u0430\u043b\u0430\u043d\u0441. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>Web3.toChecksumAddress<\/code> \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0430\u0434\u0440\u0435\u0441\u0430 \u0432 <code>checksum<\/code> \u0430\u0434\u0440\u0435\u0441.  <\/p>\n<pre><code class=\"python\">wallet_address = \"0x2a647559a6c5dcb76ce1751101449ebbc039b157\"  # \u0432\u0430\u0448 \u0430\u0434\u0440\u0435\u0441 checksum_address = Web3.toChecksumAddress(wallet_address) balance = web3.eth.get_balance(checksum_address) print(f\"balance of {wallet_address}={balance} Wei\")<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u041a\u0430\u043a \u043f\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0431\u0430\u043b\u0430\u043d\u0441 \u0432 Testnet \u0441\u0435\u0442\u044f\u0445?<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0435\u0442\u0438 \u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 <strong>faucet<\/strong> (\u043a\u0440\u0430\u043d), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043b\u0438\u043c\u0438\u0442\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432\u0430\u0448 \u0431\u0430\u043b\u0430\u043d\u0441. \u0412\u043e\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f Testnet BSC <a href=\"https:\/\/testnet.binance.org\/faucet-smart\" rel=\"noopener noreferrer nofollow\">https:\/\/testnet.binance.org\/faucet-smart<\/a><\/p>\n<\/div>\n<\/details>\n<p>\u0411\u0430\u043b\u0430\u043d\u0441\u044b \u0442\u0430\u043a\u0436\u0435 \u043e\u0442\u0434\u0430\u044e\u0442\u0441\u044f \u0432 <code>Wei<\/code>. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u043c \u043d\u0430\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435 (<code>ether<\/code>), \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0432 <code>Web3Py<\/code> \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0432 \u0434\u0440\u0443\u0433\u0443\u044e. <\/p>\n<pre><code class=\"python\">balance = 1000000000000000000  # 18 \u043d\u0443\u043b\u0435\u0439, 1 BNB  ether_balance = Web3.fromWei(balance, 'ether')  # Decimal('1') gwei_balance = Web3.fromWei(balance, 'gwei')  # Decimal('1000000000') wei_balance = Web3.toWei(ether_balance, 'ether')  # 1000000000000000000<\/code><\/pre>\n<p>\u0412\u0442\u043e\u0440\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>Web3.fromWei<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439, <strong>\u0432 \u043a\u0430\u043a\u0443\u044e \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438. <\/strong>\u041d\u0435 \u043f\u0443\u0433\u0430\u0439\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043e\u043d\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>ether<\/code> \u0432 \u0441\u0435\u0442\u0438 BSC, \u044d\u0442\u043e \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435, \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0435\u0435 \u043e\u0442 \u0441\u0435\u0442\u0438. <br \/>\u0410 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>Web3.toWei<\/code> \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u2014 \u044d\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439, <strong>\u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c.<\/strong><\/p>\n<p><a class=\"anchor\" name=\"txns_with_native\" id=\"txns_with_native\"><\/a><\/p>\n<h2>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0432\u0430\u043b\u044e\u0442\u044b ?<\/h2>\n<p>\u0418\u0441\u043f\u043e\u043b\u043d\u0438\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u0432\u0430\u043b\u044e\u0442\u0443 \u0441\u0435\u0442\u0438 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 BNB) \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u0430\u0434\u0440\u0435\u0441. \u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 3 \u0448\u0430\u0433\u043e\u0432:<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 (build) \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u043f\u0438\u0441\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430.<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">from typing import Optional from hexbytes import HexBytes  # \u043d\u0435 \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0430\u0434\u0440\u0435\u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 my_address = '0x2A647559a6c5dcB76ce1751101449ebbC039b157'  # checksum someone_address = '0x2A647559a6c5dcB76ce1751101449ebbC039b157'  # checksum  # \u044d\u0442\u0438 2 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u043d\u0443\u0436\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u0438\u043a\u0430 \u0438\u0437 \u043c\u043d\u0435\u043c\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0444\u0440\u0430\u0437\u044b # \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430 # \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0439\u0442\u0435 \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Web3 web3.middleware_onion.inject(geth_poa_middleware, layer=0) web3.eth.account.enable_unaudited_hdwallet_features()  # \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437 MetaMask. KEEP IN SECRET MNEMONIC = 'eight adult sketch quit divide ...' # \u041d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0442\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u0438\u043a\u0430 \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435 account = web3.eth.account.from_mnemonic(MNEMONIC) private_key = account.privateKey  # hex \u0430\u0434\u0440\u0435\u0441   # 1. \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f build'a \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 def build_txn(   *,   web3: Web3,   from_address: str,  # checksum \u0430\u0434\u0440\u0435\u0441   to_address: str,  # checksum \u0430\u0434\u0440\u0435\u0441   amount: float,  # \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 0.1 BNB ) -> dict[str, int | str]:   # \u0446\u0435\u043d\u0430 \u0433\u0430\u0437\u0430     gas_price = web3.eth.gas_price          # \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u0430\u0437\u0430     gas = 2_000_000  # \u0441\u0442\u0430\u0432\u0438\u043c \u043f\u043e\u0431\u043e\u043b\u044c\u0448\u0435      # \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u043d\u044b\u0445 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044f     nonce = web3.eth.getTransactionCount(from_address)      txn = {       'chainId': web3.eth.chain_id,       'from': from_address,       'to': to_address,       'value': int(Web3.toWei(amount, 'ether')),       'nonce': nonce,        'gasPrice': gas_price,       'gas': gas,     }     return txn   transaction = build_txn(   web3=web3,   from_address=my_address,   to_address=to_address,   amount=0.1, )   # 2. \u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e \u0441 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c signed_txn = web3.eth.account.sign_transaction(transaction, private_key)   # 3. \u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 txn_hash = web3.eth.sendRawTransaction(signed_txn.rawTransaction)  # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0445\u044d\u0448 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 # \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441 \u0442\u0443\u0442 https:\/\/testnet.bscscan.com\/ print(txn_hash.hex())<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u0432\u0430\u0436\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>gas<\/code>. \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 <code>gas<\/code>, \u0442\u043e \u0434\u043b\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0435\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u0442\u044c, \u0438 \u043e\u043d\u0430 \u0441\u0444\u0435\u0439\u043b\u0438\u0442\u044c\u0441\u044f. \u0412 \u0434\u0440\u0443\u0433\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043c\u043e\u0436\u043d\u043e \u043e\u0448\u0438\u0431\u0430\u0442\u044c\u0441\u044f, \u0442.\u043a. \u043b\u0438\u0448\u043d\u0438\u0439 \u0433\u0430\u0437, \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0432 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0442\u0440\u0430\u0447\u0435\u043d. <\/p>\n<p>\u0410 \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u0439\u043c\u0451\u043c, \u043a\u0430\u043a \u0436\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u043d\u0430\u043c\u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438. <\/p>\n<p><a class=\"anchor\" name=\"txn_status\" id=\"txn_status\"><\/a><\/p>\n<p>\u0412 <code>Web3Py<\/code> \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e \u043f\u043e <code>txn_hash<\/code>, \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438:<\/p>\n<ol>\n<li>\n<p><a href=\"https:\/\/web3py.readthedocs.io\/en\/stable\/web3.eth.html?highlight=get_transaction#web3.eth.Eth.get_transaction\" rel=\"noopener noreferrer nofollow\">get_transaction<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/web3py.readthedocs.io\/en\/stable\/web3.eth.html?highlight=get_transaction#web3.eth.Eth.wait_for_transaction_receipt\" rel=\"noopener noreferrer nofollow\">get_transaction_receipt<\/a><\/p>\n<\/li>\n<\/ol>\n<ol>\n<li>\n<p>get_transaction<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">txn_hash = '0x2c1c5e4bfa407bec664d944a11282cc19c3ca58ddc2a256861eefa4ca7667f6d' txn = web3.eth.get_transaction(txn_hash) # AttributeDict({'blockHash': HexBytes('0x63f7206918f35a1d4bb17f48f0e71a1bfbe0995057af879b74be5f1b13e0efad'), #  'blockNumber': 20683950, #  'from': '0x2A647559a6c5dcB76ce1751101449ebbC039b157', #  'gas': 2000000, #  'gasPrice': 10000000000, #  'hash': HexBytes('0x2c1c5e4bfa407bec664d944a11282cc19c3ca58ddc2a256861eefa4ca7667f6d'), #  'input': '0x', #  'nonce': 54, #  'to': '0x2A647559a6c5dcB76ce1751101449ebbC039b157', #  'transactionIndex': 2, #  'value': 100000000000000000, #  'type': '0x0', #  'v': 229, #  'r': HexBytes('0x5ec0dda4490a67289f52b22879ea93de0aa8bcc00002342e0d42262c147b11b1'), #  's': HexBytes('0x0944b0ebef4a2624e5e961b30cbe0118833b745e88ac10bb0e33f248bb23da35')})<\/code><\/pre>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432: \u0432 \u043a\u0430\u043a\u043e\u0439 \u0431\u043b\u043e\u043a \u043f\u043e\u043f\u0430\u043b\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f (<code>blockNumber<\/code>), \u043e\u0442\u043a\u0443\u0434\u0430 \u0438 \u043a\u043e\u043c\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0438, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0438, <strong>\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0430\u0437\u0430 \u0431\u044b\u043b\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438<\/strong>. <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e \u0432 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u0430 \u0435\u0449\u0435 \u043d\u0435 \u0441\u043c\u0430\u0439\u043d\u0438\u043b\u0430\u0441\u044c, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043e\u0448\u0438\u0431\u043a\u0443 <code>web3.exceptions.TransactionNotFound<\/code>. <\/p>\n<ol start=\"2\">\n<li>\n<p>get_transaction_receipt<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">txn_hash = '0x2c1c5e4bfa407bec664d944a11282cc19c3ca58ddc2a256861eefa4ca7667f6d' txn_receipt = web3.eth.get_transaction_receipt(txn_hash) # AttributeDict({'blockHash': HexBytes('0x63f7206918f35a1d4bb17f48f0e71a1bfbe0995057af879b74be5f1b13e0efad'), #  'blockNumber': 20683950, #  'contractAddress': None, #  'cumulativeGasUsed': 79047, #  'from': '0x2A647559a6c5dcB76ce1751101449ebbC039b157', #  'gasUsed': 21000, #  'logs': [], #  'logsBloom': HexBytes('0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'), #  'status': 1, #  'to': '0x2A647559a6c5dcB76ce1751101449ebbC039b157', #  'transactionHash': HexBytes('0x2c1c5e4bfa407bec664d944a11282cc19c3ca58ddc2a256861eefa4ca7667f6d'), #  'transactionIndex': 2, #  'type': '0x0'})<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u043c\u043d\u043e\u0433\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0442\u0441\u044f, \u043d\u043e \u0435\u0441\u0442\u044c \u0438 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u0442 \u043f\u0443\u043d\u043a\u0442\u0430 1. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>gasUsed<\/code> \u2014 <strong>\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0430\u0437\u0430 \u0431\u044b\u043b\u043e \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e \u0432 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438. <\/strong><code>Status<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c. \u0415\u0441\u043b\u0438 \u0443 \u043d\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>1<\/code>, \u0442\u043e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0448\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e. \u0415\u0441\u043b\u0438 <code>0<\/code>, \u0442\u043e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u0431\u044b\u043b\u0430 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0430 EVM.  <\/p>\n<p><a class=\"anchor\" name=\"contracts\" id=\"contracts\"><\/a><\/p>\n<h2>\u0421\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b ?<\/h2>\n<p>\u041c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u043a\u0430\u043a \u043d\u0435\u043a\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0435\u0441\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0430 \u0438 \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0441 \u043d\u0438\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c. \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>ABI<\/code> \u2014  \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u043a\u0430\u0436\u0434\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430. \u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 2 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438:<\/p>\n<ol>\n<li>\n<p>Read operations<\/p>\n<\/li>\n<li>\n<p>Write operations<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0430 \u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u043d\u0430\u0441. \u041c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0438\u0445 \u043a\u0430\u043a GET \u0437\u0430\u043f\u0440\u043e\u0441\u044b. <br \/>\u0412\u0442\u043e\u0440\u0430\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0430 \u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 \u0441 \u0437\u0430\u0442\u0440\u0430\u0442\u0430\u043c\u0438 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0432\u0430\u043b\u044e\u0442\u044b \u043d\u0430 \u0433\u0430\u0437. \u041f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u044d\u0442\u043e POST \u0437\u0430\u043f\u0440\u043e\u0441\u044b. <\/p>\n<p><a class=\"anchor\" name=\"contracts_erc20\" id=\"contracts_erc20\"><\/a><\/p>\n<h2>ERC20 \u0442\u043e\u043a\u0435\u043d\u044b ?<\/h2>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0447\u0435\u043c\u0443 ERC20 \u0442\u043e\u043a\u0435\u043d\u044b \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a?<\/summary>\n<div class=\"spoiler__content\">\n<p>&#171;ERC&#187; \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u201cEthereum Request for Comments\u201d, \u0442.\u0435. \u043f\u043e \u0444\u0430\u043a\u0442\u0443 \u043f\u0443\u043b\u043b \u0440\u0435\u043a\u0432\u0435\u0441\u0442 \u0434\u043b\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0441\u0435\u0442\u0438 Ethereum. \u0410 &#171;20&#187; \u2014 \u043f\u0440\u043e\u0441\u0442\u043e id \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u043a\u0432\u0435\u0441\u0442\u0430. <\/p>\n<\/div>\n<\/details>\n<p>ERC20 \u0442\u043e\u043a\u0435\u043d\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, USDT, USDC, BUSD \u0438 \u0442\u0434 \u0442\u043e\u0436\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430\u043c\u0438. \u0412\u0441\u0435 \u044d\u0442\u0438 \u0442\u043e\u043a\u0435\u043d\u044b \u0438\u043c\u0435\u044e\u0442 \u0435\u0434\u0438\u043d\u044b\u0439 <code>ABI<\/code>. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 <strong>\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430<\/strong>. <\/p>\n<pre><code class=\"python\">import json  # \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 ERC20 \u0442\u043e\u043a\u0435\u043d\u043e\u0432 ERC20_ABI = json.loads('''[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"_initialSupply\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"subtractedValue\",\"type\":\"uint256\"}],\"name\":\"decreaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"addedValue\",\"type\":\"uint256\"}],\"name\":\"increaseAllowance\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"}],\"name\":\"setupDecimals\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]''')  # USDT \u0442\u043e\u043a\u0435\u043d usdt_contract_address = '0xA11c8D9DC9b66E209Ef60F0C8D969D3CD988782c'  # \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f USDT \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 usdt_contract = web3.eth.contract(usdt_contract_address, abi=ERC20_ABI)  # \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 all_functions = usdt_contract.all_functions() print(f\"\u0412\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 ERC20 \u0442\u043e\u043a\u0435\u043d\u0430:\\n{all_functions}\")<\/code><\/pre>\n<p>\u0412\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438 \u0432 <a href=\"https:\/\/testnet.bscscan.com\/address\/0xA11c8D9DC9b66E209Ef60F0C8D969D3CD988782c#code\" rel=\"noopener noreferrer nofollow\">\u0441\u043a\u0430\u043d\u0435\u0440\u0435<\/a>.  <\/p>\n<p><a class=\"anchor\" name=\"contract_read_operations\" id=\"contract_read_operations\"><\/a><\/p>\n<p>\u0410 \u043d\u0438\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0432\u044b\u0437\u043e\u0432\u0430 <strong>Read operations<\/strong> (\u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439) \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430.  \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439: <\/p>\n<p><code>contract.functions.&lt;function_name>(*params).call()<\/code><\/p>\n<pre><code class=\"python\">user_address = '0x2A647559a6c5dcB76ce1751101449ebbC039b157' some_contract_address = '0x64544969ed7EBf5f083679233325356EbE738930'  token_name = usdt_contract.functions.name().call()  balance_of_token = usdt_contract.functions.balanceOf(   user_address).call()  # in Wei  token_symbol = usdt_contract.functions.symbol().call()  token_decimals = usdt_contract.functions.decimals().call()  allowance = usdt_contract.functions.allowance(   some_contract_address, user_address).call()  ether_balance = balance_of_token\/ 10 ** token_decimals print(f\"Balance of {token_name}({token_symbol}) is {ether_balance}\") print(f\"Allowance for {some_contract_address} is {allowance}\")  # Balance of USDT(USDT) is 196.0 # Allowance for 0x64544969ed7EBf5f083679233325356EbE738930 is 0<\/code><\/pre>\n<p>\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u0442\u0443\u0442 \u043d\u0430 \u0434\u0432\u0443\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u0445. <\/p>\n<p><em>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445,<\/em> \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0432\u0430\u043b\u044e\u0442\u044b (BNB  \u0432 BSC, ETH  \u0432 Ethereum, MATIC \u0432 Polygon), \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 <code>decimals=18<\/code>, \u0442\u043e\u043a\u0435\u043d\u044b \u043c\u043e\u0433\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>decimals<\/code>. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0443 <code>USDT<\/code> \u044d\u0442\u043e 6. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, <code>decimals<\/code> \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0435\u0442\u044f\u0445 \u0443 \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0442\u043e\u0433\u043e \u0436\u0435 \u0442\u043e\u043a\u0435\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>USDC<\/code> \u0432 <a href=\"https:\/\/bscscan.com\/token\/0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d\" rel=\"noopener noreferrer nofollow\">BSC<\/a> \u0438\u043c\u0435\u0435\u0442 <code>decimals=18<\/code>, \u0430 \u0432 <a href=\"https:\/\/etherscan.io\/token\/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\" rel=\"noopener noreferrer nofollow\">Ethereum<\/a> <code>decimals=6<\/code>.<\/p>\n<p><em>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445<\/em>, \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u043e <code>allowance<\/code>. <code>Allowance<\/code> \u2014 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 (<code>some_contract_address<\/code>) \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0430\u0448\u0438\u0445 (<code>user_address<\/code>) <code>USDT<\/code>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u043e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0431\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0432\u043e\u0438 \u0442\u043e\u043a\u0435\u043d\u044b \u043d\u0430 \u043e\u0431\u043c\u0435\u043d\u043d\u0438\u043a\u0435. \u041a\u043e\u043d\u0442\u0440\u0430\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0432\u0435\u0440\u0448\u0430\u0442\u044c \u043e\u0431\u043c\u0435\u043d, \u043a\u0430\u043a \u0440\u0430\u0437 \u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442 \u0443 \u0432\u0430\u0441 <code>approve<\/code> (\u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435), \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0430\u0448\u0438 \u0442\u043e\u043a\u0435\u043d\u044b. \u041f\u0440\u043e\u0441\u044f\u0442 <code>approve<\/code> \u043b\u0438\u0431\u043e \u043d\u0430 \u0442\u043e\u0447\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u043c\u0435\u043d\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0432\u0430\u043c\u0438 \u0442\u043e\u043a\u0435\u043d\u043e\u0432, \u043b\u0438\u0431\u043e \u043d\u0430 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 <code>allowance<\/code>, \u0442.\u0435. <strong>2^256 &#8212; 1 <\/strong>\u0442\u043e\u043a\u0435\u043d\u043e\u0432. <\/p>\n<p><a class=\"anchor\" name=\"contract_write_operations\" id=\"contract_write_operations\"><\/a><\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0436\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0432\u043e\u0438 \u0442\u043e\u043a\u0435\u043d\u044b \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u0430\u0434\u0440\u0435\u0441 \u0438 \u043a\u0430\u043a \u0434\u0430\u0432\u0430\u0442\u044c <code>allowance<\/code> \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0443, \u0442.\u0435. \u0441\u0434\u0435\u043b\u0430\u0435\u043c <strong>Write operations.<\/strong><\/p>\n<ol>\n<li>\n<p>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 1 <code>USDT<\/code><\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\"># \u043d\u0435 \u043f\u0443\u0433\u0430\u0439\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043e\u043d\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 # \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043c \u0441\u0430\u043c\u0438 \u0441\u0435\u0431\u0435 ? user_address = '0x2A647559a6c5dcB76ce1751101449ebbC039b157' someone_address = '0x2A647559a6c5dcB76ce1751101449ebbC039b157'  dict_transaction = {   'chainId': web3.eth.chain_id,   'from': user_address,   'gasPrice': web3.eth.gas_price,   'nonce': web3.eth.getTransactionCount(user_address), } usdt_decimals = usdt_contract.functions.decimals().call() one_usdt = 1 * 10 ** usdt_decimals  # \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c 1 USDT  # \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e transaction = usdt_contract.functions.transfer(     someone_address, one_usdt ).buildTransaction(dict_transaction)  # \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c signed_txn = web3.eth.account.sign_transaction(transaction, private_key)  # \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c, \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0443\u0442 https:\/\/testnet.bscscan.com\/ txn_hash = web3.eth.sendRawTransaction(signed_txn.rawTransaction) print(txn_hash.hex())<\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u0414\u0430\u0451\u043c <code>approve<\/code> \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0443 \u043d\u0430 &#171;\u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439&#187; <code>allowance<\/code>. \u041a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u0441 \u0430\u0434\u0440\u0435\u0441\u043e\u043c <code>some_contract_address<\/code> \u0441\u043c\u043e\u0436\u0435\u0442 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0433\u043e\u0434\u043d\u043e (\u043f\u043e\u0447\u0442\u0438) \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0430\u0448\u0438\u0445 <code>USDT<\/code>. \u0417\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e, \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u043b \u0447\u0443\u0442\u044c \u0432\u044b\u0448\u0435. <\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">user_address = '0x2A647559a6c5dcB76ce1751101449ebbC039b157' some_contract_address = '0x64544969ed7EBf5f083679233325356EbE738930'  dict_transaction = {     'chainId': web3.eth.chain_id,      'gas': 210000,      'gasPrice': web3.eth.gas_price,     'nonce': web3.eth.getTransactionCount(user_address), }  approve_amount = 2 ** 256 - 1  # \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e transaction = usdt_contract.functions.approve(     some_contract_address, approve_amount ).buildTransaction(dict_transaction)  # \u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c signed_txn = web3.eth.account.signTransaction(transaction, private_key)  # \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c, \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0443\u0442 https:\/\/testnet.bscscan.com\/ txn_hash = web3.eth.sendRawTransaction(signed_txn.rawTransaction) print(txn_hash.hex())<\/code><\/pre>\n<p><a class=\"anchor\" name=\"NFT\" id=\"NFT\"><\/a><\/p>\n<h2>NFT ?<\/h2>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u0434\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0434\u043e \u0442\u0435\u043c\u044b NFT. <br \/>\u042f \u0432\u0430\u0441 \u043e\u0431\u0440\u0430\u0434\u0443\u044e: \u0432\u044b \u0443\u0436\u0435 \u0443\u043c\u0435\u0435\u0442\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 NFT, \u0435\u0441\u043b\u0438 \u043e\u0441\u0432\u043e\u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0434\u0432\u0430 \u043f\u0443\u043d\u043a\u0442\u0430 \u0441 <strong>read operations<\/strong> \u0438 <strong>write operations <\/strong>\u0434\u043b\u044f \u0442\u043e\u043a\u0435\u043d\u043e\u0432. \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e NFT \u044d\u0442\u043e \u0442\u0435 \u0436\u0435 \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 &#171;\u043d\u043e&#187; \u2014 \u0434\u043b\u044f NFT \u043d\u0435\u0442 \u0435\u0434\u0438\u043d\u043e\u0433\u043e <code>ABI<\/code> \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 \u0432\u0440\u043e\u0434\u0435 <code>ERC20_ABI<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443 \u043a\u0430\u0436\u0434\u043e\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. <\/p>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0441 NFT \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u043c\u0441\u044f \u043d\u0430 \u0441\u0435\u0442\u044c Testnet Polygon \u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c <a href=\"https:\/\/mumbai.polygonscan.com\/address\/0x1640B6BF576Ece2e7467C009bd1705408766D976\" rel=\"noopener noreferrer nofollow\"><u>Battle Shroom NFT<\/u><\/a><u>.<\/u>  <code>ABI<\/code> \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/mumbai.polygonscan.com\/address\/0x1640B6BF576Ece2e7467C009bd1705408766D976#code\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>, \u0432\u043d\u0438\u0437\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b.  <\/p>\n<pre><code class=\"python\">import json from web3 import Web3  polygon_testnet_rpc_url = \"https:\/\/matic-mumbai.chainstacklabs.com\" web3 = Web3(Web3.HTTPProvider(polygon_testnet_rpc_url)) print(f\"Is connected: {web3.isConnected()}\")  NFT_ABI = json.loads(\"\"\"[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"_botHolders\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"_presalePaused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"_whiteListed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newHolder\",\"type\":\"address\"}],\"name\":\"addBotHolder\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_newBotHolders\",\"type\":\"address[]\"}],\"name\":\"addBotHolderMany\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_wl\",\"type\":\"address\"}],\"name\":\"addWL\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_wls\",\"type\":\"address[]\"}],\"name\":\"addWLMany\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDiscount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"giveAway\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"addresses\",\"type\":\"address[]\"}],\"name\":\"giveAwayMany\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"addresses\",\"type\":\"address[]\"}],\"name\":\"migrateMany\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"migrateOne\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"mintPresaleShroom\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"num\",\"type\":\"uint256\"}],\"name\":\"mintShroom\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"oldWalletOfOwner\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"val\",\"type\":\"bool\"}],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"val\",\"type\":\"bool\"}],\"name\":\"presalePause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_wl\",\"type\":\"address\"}],\"name\":\"removeWL\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_wls\",\"type\":\"address[]\"}],\"name\":\"removeWLMany\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"baseURI\",\"type\":\"string\"}],\"name\":\"setBaseURI\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newDiscount\",\"type\":\"uint256\"}],\"name\":\"setDiscount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newReserved\",\"type\":\"uint256\"}],\"name\":\"setGiftReserved\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newMaxPerTx\",\"type\":\"uint256\"}],\"name\":\"setMaxPerTx\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newMax\",\"type\":\"uint256\"}],\"name\":\"setMaxSupply\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newReserved\",\"type\":\"uint256\"}],\"name\":\"setPresaleReserved\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newPrice\",\"type\":\"uint256\"}],\"name\":\"setPrice\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenByIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenOfOwnerByIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"walletOfOwner\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawAll\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}]\"\"\")  nft_address = '0x1640B6BF576Ece2e7467C009bd1705408766D976' nft_contract = web3.eth.contract(nft_address, abi=NFT_ABI)<\/code><\/pre>\n<p><a class=\"anchor\" name=\"nft_price\" id=\"nft_price\"><\/a><\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 NFT \u0438\u0437 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0438 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0436\u0435 \u043e\u043d\u0430 \u0441\u0442\u043e\u0438\u0442. <\/p>\n<pre><code class=\"python\"># \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0446\u0435\u043d\u044b, \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u043d\u0430\u0447\u0435 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 NFT wei_price = nft_contract.functions.getPrice().call()  matic_price = float(Web3.fromWei(wei_price, 'ether')) nft_name = nft_contract.functions.name().call()  print(f\"Price of {nft_name} is {matic_price} MATIC\") # Price of Battle Shrooms Gen One is 0.1 MATIC<\/code><\/pre>\n<p><a class=\"anchor\" name=\"nft_minting\" id=\"nft_minting\"><\/a><\/p>\n<p>\u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u0441\u043c\u0438\u043d\u0442\u0438\u043c\/\u043a\u0443\u043f\u0438\u043c\/\u0432\u044b\u043f\u0443\u0441\u0442\u0438\u043c \u0441\u0435\u0431\u0435 NFT. <\/p>\n<pre><code class=\"python\">user_address = '0x2A647559a6c5dcB76ce1751101449ebbC039b157'  # \u043e\u0442\u0441\u043b\u044b\u0430\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0443 NFT \u0440\u043e\u0432\u043d\u043e \u0441\u0442\u043e\u043b\u044c\u043a\u043e, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u043e\u0438\u0442 NFT wei_nft_price = nft_contract.functions.getPrice().call()  dict_transaction = {   'chainId': web3.eth.chain_id,   'from': user_address,   'value': wei_nft_price,    'gasPrice': web3.eth.gas_price,   'nonce': web3.eth.getTransactionCount(user_address), }  number_of_nfts_to_mint = 1 transaction = nft_contract.functions.mintShroom(     number_of_nfts_to_mint ).buildTransaction(dict_transaction)  # \u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c signed_txn = web3.eth.account.sign_transaction(transaction, private_key)  # \u041c\u0438\u043d\u0442\u0438\u043c, \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0443\u0442 https:\/\/mumbai.polygonscan.com\/ txn_hash = web3.eth.sendRawTransaction(signed_txn.rawTransaction) print(txn_hash.hex())<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0432\u0430\u0448 \u0430\u0434\u0440\u0435\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432 <a href=\"https:\/\/mumbai.polygonscan.com\/token\/0x1640b6bf576ece2e7467c009bd1705408766d976#balances\" rel=\"noopener noreferrer nofollow\">\u0441\u043f\u0438\u0441\u043a\u0435 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0435\u0432<\/a>. <\/p>\n<h2>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0451!<\/h2>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u044d\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u044b \u043d\u043e\u0432\u0438\u0447\u043a\u0430\u043c \u0432 web3, \u0430 \u0442\u0435\u043c, \u043a\u0442\u043e \u0443\u0436\u0435 \u043a\u0440\u0443\u0442\u0438\u0442\u0441\u044f \u0432 \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435, \u043f\u043e\u0441\u043b\u0443\u0436\u0438\u0442 \u0448\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u043e\u0439 \u0434\u043b\u044f copy\/paste. \u0411\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0441\u0442\u043e\u0432 <a href=\"https:\/\/t.me\/shamaevnn\" rel=\"noopener noreferrer nofollow\">\u0438\u0449\u0438\u0442\u0435 \u0442\u0443\u0442<\/a>. <\/p>\n<p>\u0410 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435, \u0447\u0442\u043e \u044f \u0443\u043f\u0443\u0441\u0442\u0438\u043b \u0438 \u0447\u0442\u043e \u0441\u0442\u043e\u0438\u043b\u043e \u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0447\u0442\u043e-\u0442\u043e \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u0439\u0434\u0435\u0442 \u0432\u043e \u0432\u0442\u043e\u0440\u0443\u044e \u0447\u0430\u0441\u0442\u044c ?<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/674204\/\"> https:\/\/habr.com\/ru\/post\/674204\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Web3\" rel=\"noopener noreferrer nofollow\">Web3<\/a>, \u0431\u044b\u043b\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430 <a href=\"https:\/\/web3py.readthedocs.io\/en\/stable\/quickstart.html\" rel=\"noopener noreferrer nofollow\">Web3Py<\/a>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0431\u0430\u043b\u0430\u043d\u0441\u0430, \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439, \u043c\u0438\u043d\u0442\u0438\u043d\u0433 NFT, \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430\u043c\u0438 \u0438 \u0442\u0434. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u044e\u0442 > 90% \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0435\u0439 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u044d\u043a\u0435\u043d\u0434\u0430 \u0434\u043b\u044f web3 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u041a\u0441\u0442\u0430\u0442\u0438, \u0432\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u044b \u0438 \u0434\u043b\u044f <a href=\"https:\/\/web3js.readthedocs.io\/en\/v1.7.4\/\" rel=\"noopener noreferrer nofollow\">Web3.js<\/a> \u0441 \u043f\u043e\u043f\u0440\u0430\u0432\u043a\u043e\u0439 \u043d\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441. <\/p>\n<p>\u0410\u043d\u043e\u043d\u0441 \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u043d\u043e\u0434\u0430\u043c \u0438 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u0447\u0438\u0441\u043b\u0430 \u044d\u0442\u0438\u0445 \u0441\u0430\u043c\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u0431\u0443\u0434\u0435\u0442 \u0443 <a href=\"https:\/\/t.me\/shamaevnn\" rel=\"noopener noreferrer nofollow\">\u043c\u0435\u043d\u044f \u0432 \u043a\u0430\u043d\u0430\u043b\u0435<\/a>. <\/p>\n<p>\u0410 \u0437\u0434\u0435\u0441\u044c \u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0442\u0435\u043c\u044b:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#connect\" rel=\"noopener noreferrer nofollow\">\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0443<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#balance\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0431\u0430\u043b\u0430\u043d\u0441\u0430 \u0434\u043b\u044f \u0430\u0434\u0440\u0435\u0441\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#txns_with_native\" rel=\"noopener noreferrer nofollow\">\u0422\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0441 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0432\u0430\u043b\u044e\u0442\u043e\u0439 \u0441\u0435\u0442\u0438<\/a><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#txns_with_native\" rel=\"noopener noreferrer nofollow\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#txn_status\" rel=\"noopener noreferrer nofollow\">\u0421\u0442\u0430\u0442\u0443\u0441 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438<\/a><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#contracts\" rel=\"noopener noreferrer nofollow\">\u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430\u043c\u0438<\/a><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#contracts_erc20\" rel=\"noopener noreferrer nofollow\">ERC20 \u0442\u043e\u043a\u0435\u043d\u044b<\/a><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#contract_read_operations\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0431\u0430\u043b\u0430\u043d\u0441\u0430, allowance, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u043a\u0435\u043d\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#contract_write_operations\" rel=\"noopener noreferrer nofollow\">\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0442\u043e\u043a\u0435\u043d\u0430, \u0432\u044b\u0434\u0430\u0447\u0430 allowance<\/a><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#NFT\" rel=\"noopener noreferrer nofollow\">NFT<\/a><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#nft_price\" rel=\"noopener noreferrer nofollow\">\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0446\u0435\u043d\u044b \u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f NFT<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674204\/#nft_minting\" rel=\"noopener noreferrer nofollow\">Minting\/\u043f\u043e\u043a\u0443\u043f\u043a\u0430\/\u0432\u044b\u043f\u0443\u0441\u043a NFT<\/a><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u0412\u0441\u0435 \u044d\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0443\u0434\u043e\u0431\u043d\u043e \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0432 jupyter-notebook. \u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c <a href=\"https:\/\/web3py.readthedocs.io\/en\/stable\/quickstart.html#installation\" rel=\"noopener noreferrer nofollow\">Web3Py<\/a> \u0438 \u0437\u0430\u0432\u0435\u0441\u0442\u0438 \u0441\u0435\u0431\u0435 \u043a\u043e\u0448\u0435\u043b\u0451\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/metamask.io\/\" rel=\"noopener noreferrer nofollow\">MetaMask<\/a>, \u0447\u0442\u043e\u0431 \u0443 \u0432\u0430\u0441 \u0431\u044b\u043b \u0432\u0430\u0448 \u0430\u0434\u0440\u0435\u0441. <\/p>\n<p><a class=\"anchor\" name=\"connect\" id=\"connect\"><\/a><\/p>\n<h2>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0443 \u26d3\ufe0f<\/h2>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0443 \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0432\u044b\u043a\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u0435 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043d\u0435\u0433\u043e, \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0435\u0433\u043e \u043d\u043e\u0434 (\u043a\u043e\u043f\u0438\u0439). \u041c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e 3 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e URL \u043a \u043d\u043e\u0434\u0435:<\/p>\n<ul>\n<li>\n<p>HTTP<\/p>\n<\/li>\n<li>\n<p>WebSocket<\/p>\n<\/li>\n<li>\n<p>RPC<\/p>\n<\/li>\n<\/ul>\n<details class=\"spoiler\">\n<summary>\u0413\u0434\u0435 \u0432\u0437\u044f\u0442\u044c URL? <\/summary>\n<div class=\"spoiler__content\">\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0431\u0440\u0430\u043b \u0432\u0441\u0435 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0435 \u043d\u043e\u0434\u044b \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u2014 <a href=\"https:\/\/chainlist.org\/\" rel=\"noopener noreferrer nofollow\">chainlink<\/a>.  \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0439 \u043c\u0438\u043d\u0443\u0441 \u044d\u0442\u0438\u0445 \u043d\u043e\u0434, \u0447\u0442\u043e \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0432\u0441\u0435 \u043a\u043e\u043c\u0443 \u043d\u0435 \u043b\u0435\u043d\u044c. \u0418\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u043e\u043d\u0438 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u044b\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0438 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0434\u043e\u043b\u044c\u0448\u0435 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0438\u043b\u0438 \u043d\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0432\u043e\u0432\u0441\u0435.  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u0432\u043e\u044e \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u0443\u044e \u043d\u043e\u0434\u0443 \u0437\u0430 $, \u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u044b <a href=\"https:\/\/infura.io\/product\/ethereum\" rel=\"noopener noreferrer nofollow\">Infura<\/a> \u0438 <a href=\"https:\/\/www.ankr.com\/\" rel=\"noopener noreferrer nofollow\">Ankr<\/a>, \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0435\u0442\u0435\u0439. <\/p>\n<\/div>\n<\/details>\n<p>\u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u044b\u0442\u044b\u0432\u0430\u0442\u044c Web3 \u043d\u0430 \u0441\u0435\u0442\u0438 <em>Testnet Binance Smart Chain<\/em> (BSC).<\/p>\n<pre><code class=\"python\">from web3 import Web3  binance_testnet_rpc_url = \"https:\/\/data-seed-prebsc-1-s1.binance.org:8545\/\" web3 = Web3(Web3.HTTPProvider(binance_testnet_rpc_url)) print(f\"Is connected: {web3.isConnected()}\")  # Is connected: True # \u0421 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0430\u0441 ?<\/code><\/pre>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0432\u0448\u0438\u0441\u044c \u043a \u043d\u043e\u0434\u0435, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/learn.bybit.com\/ru\/crypto\/what-is-eth-gas\/\" rel=\"noopener noreferrer nofollow\">\u0426\u0435\u043d\u0430 \u0433\u0430\u0437\u0430 \u0432 \u0441\u0435\u0442\u0438<\/a><\/p>\n<\/li>\n<li>\n<p>\u041d\u043e\u043c\u0435\u0440 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0431\u043b\u043e\u043a\u0430<\/p>\n<\/li>\n<li>\n<p>\u041d\u043e\u043c\u0435\u0440 \u0441\u0435\u0442\u0438 (<code>chain_id<\/code>)<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\">print(f\"gas price: {web3.eth.gas_price} BNB\")  # \u043a\u043e\u043b-\u0432\u043e Wei \u0437\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u0433\u0430\u0437\u0430 print(f\"current block number: {web3.eth.block_number}\") print(f\"number of current chain is {web3.eth.chain_id}\")  # 97<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u0446\u0438\u0444\u0440 \u0432 \u0446\u0435\u043d\u0435 \u0433\u0430\u0437\u0430 \u0438\u043b\u0438 \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Wei?<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0412 Web3 \u0432\u0441\u0435 \u0447\u0438\u0441\u043b\u0430 \u0438\u0437\u043c\u0435\u0440\u044f\u044e\u0442\u0441\u044f \u0432 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0439 \u0435\u0434\u0438\u043d\u0438\u0446\u0435 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f, \u0442.\u0435. Wei. \u042d\u0442\u043e \u043a\u0430\u043a \u0435\u0441\u043b\u0438 \u0431\u044b \u0443 \u043d\u0430\u0441 \u0432\u0441\u0435 \u0438\u0437\u043c\u0435\u0440\u044f\u043b\u043e\u0441\u044c \u043d\u0435 \u0432 \u0440\u0443\u0431\u043b\u044f\u0445, \u0430 \u0432 \u043a\u043e\u043f\u0435\u0439\u043a\u0430\u0445, \u0442.\u0435, . \u0422\u0430\u043a\u0436\u0435 \u0435\u0449\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f Gwei, . \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u0438\u0433\u0440\u0430\u0442\u044c\u0441\u044f <a href=\"https:\/\/etherscan.io\/unitconverter\" rel=\"noopener noreferrer nofollow\">\u0432\u043e\u0442 \u0442\u0443\u0442<\/a>. <\/p>\n<\/div>\n<\/details>\n<p><a class=\"anchor\" name=\"balance\" id=\"balance\"><\/a><\/p>\n<h2>\u0421\u043c\u043e\u0442\u0440\u0438\u043c \u0431\u0430\u043b\u0430\u043d\u0441 \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0430 ?<\/h2>\n<pre><code class=\"python\">wallet_address = \"0x2a647559a6c5dcb76ce1751101449ebbc039b157\"  # \u0432\u0430\u0448 \u0430\u0434\u0440\u0435\u0441 balance = web3.eth.get_balance(wallet_address) print(f\"balance of {wallet_address}={balance}\") # InvalidAddress: Web3.py only accepts checksum addresses<\/code><\/pre>\n<p>\u041a\u043e\u0434 \u0432\u044b\u0448\u0435 \u0432\u044b\u0431\u0440\u043e\u0441\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0443, \u0442.\u043a. \u0430\u0434\u0440\u0435\u0441 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>checksum<\/code> \u0430\u0434\u0440\u0435\u0441\u043e\u043c. <\/p>\n<details class=\"spoiler\">\n<summary>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Checksum Address?<\/summary>\n<div class=\"spoiler__content\">\n<p>Checksum \u0430\u0434\u0440\u0435\u0441 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043d\u0435 checksum \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043c, \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u043a\u0432\u044b \u0432 \u0430\u0434\u0440\u0435\u0441\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435. Checksum address \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0430\u0434\u0440\u0435\u0441 \u0432\u0430\u043b\u0438\u0434\u0435\u043d \u0438 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u043f\u0435\u0447\u0430\u0442\u043e\u043a. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 Web3Py \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0433\u043e. <\/p>\n<\/div>\n<\/details>\n<p>\u0410 \u0432\u043e\u0442 \u0443\u0436\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0431\u0430\u043b\u0430\u043d\u0441. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>Web3.toChecksumAddress<\/code> \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0430\u0434\u0440\u0435\u0441\u0430 \u0432 <code>checksum<\/code> \u0430\u0434\u0440\u0435\u0441.  <\/p>\n<pre><code class=\"python\">wallet_address = \"0x2a647559a6c5dcb76ce1751101449ebbc039b157\"  # \u0432\u0430\u0448 \u0430\u0434\u0440\u0435\u0441 checksum_address = Web3.toChecksumAddress(wallet_address) balance = web3.eth.get_balance(checksum_address) print(f\"balance of {wallet_address}={balance} Wei\")<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u041a\u0430\u043a \u043f\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0431\u0430\u043b\u0430\u043d\u0441 \u0432 Testnet \u0441\u0435\u0442\u044f\u0445?<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0435\u0442\u0438 \u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 <strong>faucet<\/strong> (\u043a\u0440\u0430\u043d), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043b\u0438\u043c\u0438\u0442\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432\u0430\u0448 \u0431\u0430\u043b\u0430\u043d\u0441. \u0412\u043e\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f Testnet BSC <a href=\"https:\/\/testnet.binance.org\/faucet-smart\" rel=\"noopener noreferrer nofollow\">https:\/\/testnet.binance.org\/faucet-smart<\/a><\/p>\n<\/div>\n<\/details>\n<p>\u0411\u0430\u043b\u0430\u043d\u0441\u044b \u0442\u0430\u043a\u0436\u0435 \u043e\u0442\u0434\u0430\u044e\u0442\u0441\u044f \u0432 <code>Wei<\/code>. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u043c \u043d\u0430\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435 (<code>ether<\/code>), \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0432 <code>Web3Py<\/code> \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0432 \u0434\u0440\u0443\u0433\u0443\u044e. <\/p>\n<pre><code class=\"python\">balance = 1000000000000000000  # 18 \u043d\u0443\u043b\u0435\u0439, 1 BNB  ether_balance = Web3.fromWei(balance, 'ether')  # Decimal('1') gwei_balance = Web3.fromWei(balance, 'gwei')  # Decimal('1000000000') wei_balance = Web3.toWei(ether_balance, 'ether')  # 1000000000000000000<\/code><\/pre>\n<p>\u0412\u0442\u043e\u0440\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>Web3.fromWei<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439, <strong>\u0432 \u043a\u0430\u043a\u0443\u044e \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438. <\/strong>\u041d\u0435 \u043f\u0443\u0433\u0430\u0439\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043e\u043d\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>ether<\/code> \u0432 \u0441\u0435\u0442\u0438 BSC, \u044d\u0442\u043e \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435, \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0435\u0435 \u043e\u0442 \u0441\u0435\u0442\u0438. <br \/>\u0410 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>Web3.toWei<\/code> \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u2014 \u044d\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439, <strong>\u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c.<\/strong><\/p>\n<p><a class=\"anchor\" name=\"txns_with_native\" id=\"txns_with_native\"><\/a><\/p>\n<h2>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0432\u0430\u043b\u044e\u0442\u044b ?<\/h2>\n<p>\u0418\u0441\u043f\u043e\u043b\u043d\u0438\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u0432\u0430\u043b\u044e\u0442\u0443 \u0441\u0435\u0442\u0438 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 BNB) \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u0430\u0434\u0440\u0435\u0441. \u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 3 \u0448\u0430\u0433\u043e\u0432:<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 (build) \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u043f\u0438\u0441\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430.<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">from typing import Optional from hexbytes import HexBytes  # \u043d\u0435 \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0430\u0434\u0440\u0435\u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 my_address = '0x2A647559a6c5dcB76ce1751101449ebbC039b157'  # checksum someone_address = '0x2A647559a6c5dcB76ce1751101449ebbC039b157'  # checksum  # \u044d\u0442\u0438 2 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u043d\u0443\u0436\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u0438\u043a\u0430 \u0438\u0437 \u043c\u043d\u0435\u043c\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0444\u0440\u0430\u0437\u044b # \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430 # \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0439\u0442\u0435 \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Web3 web3.middleware_onion.inject(geth_poa_middleware, layer=0) web3.eth.account.enable_unaudited_hdwallet_features()  # \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437 MetaMask. KEEP IN SECRET MNEMONIC = 'eight adult sketch quit divide ...' # \u041d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0442\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u0438\u043a\u0430 \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435 account = web3.eth.account.from_mnemonic(MNEMONIC) private_key = account.privateKey  # hex \u0430\u0434\u0440\u0435\u0441   # 1. \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f build'a \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 def build_txn(   *,   web3: Web3,   from_address: str,  # checksum \u0430\u0434\u0440\u0435\u0441   to_address: str,  # checksum \u0430\u0434\u0440\u0435\u0441   amount: float,  # \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, 0.1 BNB ) -> dict[str, int | str]:   # \u0446\u0435\u043d\u0430 \u0433\u0430\u0437\u0430     gas_price = web3.eth.gas_price          # \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u0430\u0437\u0430     gas = 2_000_000  # \u0441\u0442\u0430\u0432\u0438\u043c \u043f\u043e\u0431\u043e\u043b\u044c\u0448\u0435      # \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u043d\u044b\u0445 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044f     nonce = web3.eth.getTransactionCount(from_address)      txn = {       'chainId': web3.eth.chain_id,       'from': from_address,       'to': to_address,       'value': int(Web3.toWei(amount, 'ether')),       'nonce': nonce,        'gasPrice': gas_price,       'gas': gas,     }     return txn   transaction = build_txn(   web3=web3,   from_address=my_address,   to_address=to_address,   amount=0.1, )   # 2. \u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e \u0441 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c signed_txn = web3.eth.account.sign_transaction(transaction, private_key)   # 3. \u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 txn_hash = web3.eth.sendRawTransaction(signed_txn.rawTransaction)  # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0445\u044d\u0448 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 # \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441 \u0442\u0443\u0442 https:\/\/testnet.bscscan.com\/ print(txn_hash.hex())<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u0432\u0430\u0436\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>gas<\/code>. \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 <code>gas<\/code>, \u0442\u043e \u0434\u043b\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0435\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u0442\u044c, \u0438 \u043e\u043d\u0430 \u0441\u0444\u0435\u0439\u043b\u0438\u0442\u044c\u0441\u044f. \u0412 \u0434\u0440\u0443\u0433\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043c\u043e\u0436\u043d\u043e \u043e\u0448\u0438\u0431\u0430\u0442\u044c\u0441\u044f, \u0442.\u043a. \u043b\u0438\u0448\u043d\u0438\u0439 \u0433\u0430\u0437, \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0432 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0442\u0440\u0430\u0447\u0435\u043d. <\/p>\n<p>\u0410 \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u0439\u043c\u0451\u043c, \u043a\u0430\u043a \u0436\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u043d\u0430\u043c\u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438. <\/p>\n<p><a class=\"anchor\" name=\"txn_status\" id=\"txn_status\"><\/a><\/p>\n<p>\u0412 <code>Web3Py<\/code> \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e \u043f\u043e <code>txn_hash<\/code>, \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438:<\/p>\n<ol>\n<li>\n<p><a href=\"https:\/\/web3py.readthedocs.io\/en\/stable\/web3.eth.html?highlight=get_transaction#web3.eth.Eth.get_transaction\" rel=\"noopener noreferrer nofollow\">get_transaction<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/web3py.readthedocs.io\/en\/stable\/web3.eth.html?highlight=get_transaction#web3.eth.Eth.wait_for_transaction_receipt\" rel=\"noopener noreferrer nofollow\">get_transaction_receipt<\/a><\/p>\n<\/li>\n<\/ol>\n<ol>\n<li>\n<p>get_transaction<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">txn_hash = '0x2c1c5e4bfa407bec664d944a11282cc19c3ca58ddc2a256861eefa4ca7667f6d' txn = web3.eth.get_transaction(txn_hash) # AttributeDict({'blockHash': HexBytes('0x63f7206918f35a1d4bb17f48f0e71a1bfbe0995057af879b74be5f1b13e0efad'), #  'blockNumber': 20683950, #  'from': '0x2A647559a6c5dcB76ce1751101449ebbC039b157', #  'gas': 2000000, #  'gasPrice': 10000000000, #  'hash': HexBytes('0x2c1c5e4bfa407bec664d944a11282cc19c3ca58ddc2a256861eefa4ca7667f6d'), #  'input': '0x', #  'nonce': 54, #  'to': '0x2A647559a6c5dcB76ce1751101449ebbC039b157', #  'transactionIndex': 2, #  'value': 100000000000000000, #  'type': '0x0', #  'v': 229, #  'r': HexBytes('0x5ec0dda4490a67289f52b22879ea93de0aa8bcc00002342e0d42262c147b11b1'), #  's': HexBytes('0x0944b0ebef4a2624e5e961b30cbe0118833b745e88ac10bb0e33f248bb23da35')})<\/code><\/pre>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432: \u0432 \u043a\u0430\u043a\u043e\u0439 \u0431\u043b\u043e\u043a \u043f\u043e\u043f\u0430\u043b\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f (<code>blockNumber<\/code>), \u043e\u0442\u043a\u0443\u0434\u0430 \u0438 \u043a\u043e\u043c\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0438, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0438, <strong>\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0430\u0437\u0430 \u0431\u044b\u043b\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438<\/strong>. <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e \u0432 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u0430 \u0435\u0449\u0435 \u043d\u0435 \u0441\u043c\u0430\u0439\u043d\u0438\u043b\u0430\u0441\u044c, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043e\u0448\u0438\u0431\u043a\u0443 <code>web3.exceptions.TransactionNotFound<\/code>. <\/p>\n<ol start=\"2\">\n<li>\n<p>get_transaction_receipt<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">txn_hash = '0x2c1c5e4bfa407bec664d944a11282cc19c3ca58ddc2a256861eefa4ca7667f6d' txn_receipt = web3.eth.get_transaction_receipt(txn_hash) # AttributeDict({'blockHash': HexBytes('0x63f7206918f35a1d4bb17f48f0e71a1bfbe0995057af879b74be5f1b13e0efad'), #  'blockNumber': 20683950, #  'contractAddress': None, #  'cumulativeGasUsed': 79047, #  'from': '0x2A647559a6c5dcB76ce1751101449ebbC039b157', #  'gasUsed': 21000, #  'logs': [], #  'logsBloom': HexBytes('0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'), #  'status': 1, #  'to': '0x2A647559a6c5dcB76ce1751101449ebbC039b157', #  'transactionHash': HexBytes('0x2c1c5e4bfa407bec664d944a11282cc19c3ca58ddc2a256861eefa4ca7667f6d'), #  'transactionIndex': 2, #  'type': '0x0'})<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u043c\u043d\u043e\u0433\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0442\u0441\u044f, \u043d\u043e \u0435\u0441\u0442\u044c \u0438 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u0442 \u043f\u0443\u043d\u043a\u0442\u0430 1. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>gasUsed<\/code> \u2014 <strong>\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u0430\u0437\u0430 \u0431\u044b\u043b\u043e \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e \u0432 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438. <\/strong><code>Status<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c. \u0415\u0441\u043b\u0438 \u0443 \u043d\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>1<\/code>, \u0442\u043e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0448\u043b\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e. \u0415\u0441\u043b\u0438 <code>0<\/code>, \u0442\u043e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u0431\u044b\u043b\u0430 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0430 EVM.  <\/p>\n<p><a class=\"anchor\" name=\"contracts\" id=\"contracts\"><\/a><\/p>\n<h2>\u0421\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b ?<\/h2>\n<p>\u041c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u043a\u0430\u043a \u043d\u0435\u043a\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0435\u0441\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-337839","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/337839","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=337839"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/337839\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=337839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=337839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=337839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}