我试图用参数验证我的合同,但收到此错误:
Error in plugin @nomiclabs/hardhat-etherscan: The contract verification failed.
Reason: Fail - Unable to verify
我还导入Open Zeppelin合同ERC721Enumerable和Ownable.
这是我的NFTCollectible.sol
pragma solidity 0.8.10;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "hardhat/console.sol";
contract NFTCollectible is ERC721Enumerable, Ownable {
    using Strings for uint256;
    string public baseURI;
    string public baseExtension = ".json";
    uint256 public cost = 0.08 ether;
    uint256 public maxSupply = 5000;
    uint256 public maxMintAmount = 25;
    mapping(address => uint256) public addressMintedBalance;
    constructor(
        string memory _name,
        string memory _symbol, …\n\nindex.js:1 无法获取多重调用块 [{\xe2\x80\xa6}] 1 错误:发送交易需要签名者(操作=“sendTransaction”,代码=UNSUPPORTED_OPERATION,版本=contracts/5.0.2)
\n
多重调用合约地址 - https://etherscan.io/address/0xeefba1e63905ef1d7acba5a8513c70307c1ce441#writeContract
\n在 Uniswap 界面中工作,但在我的代码中抛出错误,我不知道出了什么问题
\n我目前正在构建符合 ERC721 标准的合约,并已在此处发布合约: https: //ropsten.etherscan.io/address/0xa513bc0a0d3af384fefcd8bbc1cc0c9763307c39 - 我现在正在尝试验证并发布合约源代码
我的文件的开头如下所示:
// SPDX-License-Identifier: MIT
// We will be using Solidity version 0.8.4
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract ViperToken is ERC721 {
但是,当尝试使用 Solidity 单个文件进行验证和发布时,出现以下错误:
ParserError: Source "@openzeppelin/contracts/token/ERC721/ERC721.sol" not found: File import callback not supported
 --> myc:6:1:
  |
6 | import "@openzeppelin/contracts/token/ERC721/ERC721.sol"
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
任何人都可以向我指出 1. 解决此问题或 2. 有关如何正确编写导入了可以使用 Etherscan 验证的依赖项的合约的文档。现在这只是一个单文件合同。
我正在使用 Etherscan API 获取交易数据。这是我得到的示例结果:
{
  blockNumber: '7409930',
  timeStamp: '1639151980',
  hash: '...',
  nonce: '4124',
  ...
  input: '0x9d90e4c8000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002000000000000000000000000093238bb66b5d15b4152c5db574e3397ff1b1a450',
  contractAddress: '',
  cumulativeGasUsed: '403775',
  gasUsed: '1162315',
  confirmations: '191308'
}
我现在需要找出该交易的事件类型(合约方法,例如,,...)TransferOwnership。stakeTokens该数据存储在input该对象的属性中。
我设法使用abi-decoder库来完成此任务,但我想使用 ethers 的实用方法(以哪种方式)来完成同样的事情。
我当前的实现:
const abiDecoder = require("abi-decoder");
abiDecoder.addABI(contractAbi);
// "item" is transaction data, input property is encoded stuff from which I want to get the contract method used by this transaction
const decodedInput = abiDecoder.decodeMethod(item.input);
// contract method
console.log(decodedInput.name);
我正在阅读以太坊的文档(https://docs.ethers.io/v5/api/utils/abi/coder/),但我无法弄清楚。
我试图将结构数组的格式作为 etherscan 上智能合约写入函数的参数传递,
这是坚固性示例:
Info[] 公共信息;
struct Info { 
    address userAddress;
    uint256 amount;   
    bool active; 
} 
const data = [{0x0000, 10000000000, false},{0x11111, 20000000000, true}]
任何人都可以将此数据示例转换为 tuple[] 并提供吗?提前致谢
我在这里使用 etherscan-api:(https://sebs.github.io/etherscan-api/#txlist)来获取用户的交易列表(给定公钥),并且我正在获取已清除的列表仅交易,即使在 etherscan.io 上我也可以看到所有待处理的交易,因此信息“在那里”。深入研究源代码https://github.com/sebs/etherscan-api/blob/master/lib/account.js#L122,我发现没有任何迹象表明我可以在哪里找到待处理的交易。代码如下:
const etherscan = require('etherscan-api').init(ETHERSCAN_TOKEN, 'ropsten', '3000');
    etherscan.account
        .txlist(public_key, 1, 'latest', 1, 100, 'asc')
        .then(res => {
            console.log("tx_list: ", res.result)
        })
    // get num of transactions
    etherscan.proxy
        .eth_getTransactionCount(public_key, 'latest')
        .then(res => {
            let count = res.result
            console.log("eth_getTransactionCount: ", parseInt(count))
        })
import {providers} from "ethers";
const provider = new providers.InfuraProvider("homestead")
async function main() {
    provider.on("block", (blockNum)=> {
        console.log(blockNum+ ": " +new Date(Date.now()))
    })
}
main()
从上面的代码输出:
13261128: Mon Sep 20 2021 14:57:42 GMT+0800 
13261129: Mon Sep 20 2021 14:58:14 GMT+0800 
13261130: Mon Sep 20 2021 14:58:42 GMT+0800 
13261131: Mon Sep 20 2021 14:58:58 GMT+0800 
来自 etherscan.io:
Sep-20-2021 06:57:12 AM +UTC (https://etherscan.io/block/13261028)
Sep-20-2021 06:57:23 AM +UTC (https://etherscan.io/block/13261129)
Sep-20-2021 06:58:07 AM +UTC (https://etherscan.io/block/13261130)
Sep-20-2021 06:58:38 AM +UTC (https://etherscan.io/block/13261131)
我的问题
我的电脑的时钟是准确的时间,为什么这两种方式有差异?
我可以从 ethers.js API …
EtherScan 提供了一个用于交易细节的 API,它是 Geth/Parity 代理 API 的一部分,名称为 eth_getTransactionByHash,但我无法获得 ERC20 令牌被转移的信息以及转移了多少。
我正在构建一个网络爬虫,每 30 秒不断刷新一些 etherscan URL,如果发生了任何未考虑到的新传输,它会向我发送一封电子邮件通知和一个指向 etherscan 上相关地址的链接,以便我可以手动检查他们出去。
我想要密切关注的地址之一在这里:
到目前为止我所做的:
from urllib.request import Request, urlopen
url = 'https://etherscan.io/token/0xd6a55c63865affd67e2fb9f284f87b7a9e5ff3bd?a=0x94f52b6520804eced0accad7ccb93c73523af089'
req = Request(url, headers={'User-Agent': 'XYZ/3.0'})   # I got this line from another post since "uClient = uReq(URL)" and "page_html = uClient.read()" would not work (I beleive that etherscan is attemption to block webscraping or something?)
response = urlopen(req, timeout=20).read()
response_close = urlopen(req, timeout=20).close()
page_soup = soup(response, "html.parser")
Transfers_info_table_1 = page_soup.find("div", {"class": "table-responsive"})
print(Transfers_info_table_1)
有趣的是,当我运行它时,我得到以下输出:
<div class="table-responsive" style="visibility:hidden;">
<iframe frameborder="0" id="tokentxnsiframe" scrolling="no" src="" …我打算使用 Etherscan(Ropsten 测试网络)上的 UniswapV2Router02 在 Ropsten 网络上将一些 DAI 兑换为 ETH。
Ropsten 上的 DAI 地址 = 0xad6d458402f60fd3bd25163575031acdce07538d WETH = 0xc778417E063141139Fce010982780140Aa0cD5Ab
我的钱包里有 2000 DAI (Ropsten)
Metamask 显示合约抛出了一个错误。所以我可能错过了一些东西或者我做错了。
请有人帮助并告诉我如何才能在那里成功交易?
我正在尝试使用 Hardhat 验证合同源代码并将其提交到 etherscan,但遇到以下错误,并且我不明白如何解决该错误。我已经通读了代码,但我无法发现我做错了什么。请问有人可以建议吗?
我运行时遇到的错误:
npx hardhat verify --network ropsten 0xA16c8f9A5Ab944454D6404CE626E600AF0054aaa 'MyNFTPrice!
错误信息:
Error in plugin @nomiclabs/hardhat-etherscan: The constructor for contracts/MyNFTPrice.sol:MyNFTPrice has 0 parameters but 1 arguments were provided instead.
我的智能合约源文件(MyNFTPrice.sol):
//Contract based on [https://docs.openzeppelin.com/contracts/3.x/erc721](https://docs.openzeppelin.com/contracts/3.x/erc721)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
contract MyNFTPrice is ERC721URIStorage {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
constructor() public ERC721("MyNFTPrice", "NFTPRICE") {}
// Mint new NFT
function mintNFT(address recipient, string memory tokenURI) public payable  {
    require(msg.value …etherscan ×11
ethereum ×8
javascript ×4
solidity ×4
web3js ×4
ethers.js ×3
hardhat ×2
erc20 ×1
ether ×1
metamask ×1
openzeppelin ×1
php ×1
python-3.x ×1
reactjs ×1
web-crawler ×1
web-scraping ×1