16
votes
Accepted
Solidity error when encoding arguments to query public mapping
The address needs be surrounded with quotes.
"0xca35b7d915458ef540ade6068dfe2f44e8fa733c" should work.
14
votes
Accepted
How to get metadata from ERC721
The other answer is incorrect.
See the ERC721 Standard for exactly how to do this. If a token contract properly implements the ERC721 Standard and the ERC721Metadata extension, it will always ...
7
votes
Accepted
API to enumerate the blocks from a specific day
There is no Web API, but you can perform this using SQL.
You can do it simply with "Presto Ethereum Connector" (https://github.com/xiaoyao1991/presto-ethereum)
Using Presto Ethereum, you can query ...
4
votes
Index and query blockchain data and levelDB
Geth does three operations on the database that you should consider when trying to find alternatives.
Geth loads the entire database in levelDB (what I believe you want to do).
Geth then deciphers ...
4
votes
Fetching InternalType data from another contract
The "internalType" is the representation used by solidity.
For example the contract
contract B {
struct View {
uint x;
}
function foo(View memory bad) public view {
...
3
votes
Accepted
How to gather historical events emitted by any contract
Did you try using eth_getLogs. This is also exposed via the Ethers provider: https://docs.ethers.io/v5/api/providers/provider/#Provider-getLogs.
The syntax for the parameter is the same as for ...
3
votes
How to get metadata from ERC721
To view ERC721 token content use: https://etherscan.io/
For example get a token address from OpenSea, input into the etherscan.io
query and search. Select 'Tracker' --> 'Inventory' --> token id --> '...
2
votes
Index and query blockchain data and levelDB
There are inherent limitations of this approach:
You can't get the world state from the underlying database since all keys are hashed there. It includes:
accounts and their balances
contract storage
...
2
votes
Solidity error when encoding arguments to query public mapping
The address has to be provided with quotes. Just like huafu said. Must be double qutoes "". It is not going to work with single qutoes. In Javascript it doesn't matter and I was trying to figure out ...
1
vote
Accepted
Is there a way to test whether an external contract implements (or does not implement) a given interface method?
One way is to use try-catch error handling. Here's a minimal code for the same:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
interface IRandomMethod {
function getUint() external view ...
1
vote
Accepted
Querying events using ethersjs provides logs with unrelated contract addresses
The issue seems to stem from the differences between how getLogs() behaves in ethers v5 and ethers v6. This change in behavior isn't well-documented, leading to confusion.
For more precise and ...
1
vote
Accepted
Can you fetch the whole transaction history of specific contracts somewhere?
If you like to fetch specific contracts (or to an extent general account) address history, then you can use service such as Moralis.
They have Transaction API that can help you index transaction data ...
1
vote
Can you fetch the whole transaction history of specific contracts somewhere?
Yes, there are several services that allow you to query all transactions related to a specific smart contract. Etherscan, for example, provides a "View Contract" feature that allows you to ...
1
vote
Searching for Ethereum addresses that match a partial address?
It is generally not possible to search for partial addresses or transaction hashes using publicly available blockchain explorers like Etherscan. Most blockchain explorers only allow users to search ...
1
vote
How can I query the onchain data on the ethereum blockchain without using any APIs?
If you need live onchain data, you have 3 options.
Using an API or providers like Alchemy etc.
If the users connects his wallet you can use the users provider in his wallet (metamask for ex.)
You can ...
1
vote
Is there a multi-call equivalent for calls that aren't made to a smart contract?
You can use ethers.providers.JsonRpcBatchProvider, its JS API is equivalent to the JsonRpcProvider. It simply batches the requests, so that multiple requests are sent together in a single network ...
1
vote
How to query my Polygon NFTs created on Opensea?
To find items on Polygon, make sure to check "Polygon" under the "Chains" section on the left panel.
If you want to access through opensea-js API, unfortunately it is not supported ...
1
vote
Accepted
How to query contract input (address) using Etherscan's API?
You cannot query the method of the smart contract actually. you should query the events/logs of the smart contracts
If you are trying to query the canMint() function executions. you need to query the ...
1
vote
Accepted
Mappings inside functions to filter query
You cannot assign mappings inside a function even if the compiler seems to let you. That will lead to corrupted storage. The storage layout of persistent variables must be global. Temporary mappings ...
1
vote
Accepted
Error: Couldn't decode bytes32 from ABI: 0x The size doesn't match
The answer here is, that the contract was deployed, but empty!
Section 7.1 of the yellow paper it states that "while the initialisation code is executing, the newly created address exists but with no ...
1
vote
Querying the blockchain: Search transaction by data
The answer is no.
The standard ethereum clients (geth and parity) maintain only a limited set of indexes for querying the blockchain. For example, you can look up a transaction by its hash (using ...
1
vote
ETH blockchain reading scalability
As you said, view and pure "reading" functions are free. The reason for this is that they are only executed in your own node and not broadcasted to the blockchain to other nodes. Nobody else really ...
1
vote
Solidity error when encoding arguments to query public mapping
contract MyToken
mapping (address => uint256) public balances;
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
...
}
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
query × 42blockchain × 7
solidity × 4
web3js × 4
transactions × 4
etherscan × 4
nft × 4
mapping × 4
events × 3
polygon × 3
explorers × 3
openethereum × 3
go-ethereum × 2
contract-invocation × 2
private-blockchain × 2
nodejs × 2
uniswap × 2
ethers.js × 2
abi × 2
ethereumj × 2
database × 2
opensea × 2
filters × 2
the-graph × 2
remix × 1