Most Popular
1500 questions
25
votes
1 answer
Is Solidity block.number more secure than timestamp?
In Solidity, some properties such as block.timestamp are attackable by miners and are not (strongly) protected by the protocol. How about block.number, could a miner introduce a randomly high number?
EDIT: I'm thinking of securing a game which…
SCBuergel
- 8,774
- 7
- 38
- 69
25
votes
4 answers
How to convert bignumber to normal number using ethers.js?
I am using ethers.js I can't figure out how do you convert a bignumber like 1252500000000000000 to 125.25
-Mike
LiveWire
- 763
- 2
- 7
- 9
24
votes
1 answer
What is Parity's “warp” sync, and why is it faster than Geth "fast"?
A follow-up of one of the classic questions on this site:
One of the answers to this question suggested using Geth's --fast flag to help quickly synchronise the block data.
Now, parity comes with a --warp flag to enable synchronization in 10…
q9f
- 32,913
- 47
- 156
- 395
24
votes
3 answers
Listening to events using ethers.js on a hardhat test network
I am currently migrating a truffle project to hardhat. I am facing a problem with listening to events. I have a simple ERC20 token and want to listen to the Transfer event. I am running the contract on a hardhat test network. Here is my test code,…
Sebastian Dine
- 779
- 1
- 5
- 13
24
votes
3 answers
How to infer token price from ethereum blockchain UniSwap data?
I would like (if possible) to infer a token price from the blockchain using UniSwap data.
After reading the following article, I understood that it is feasible:
https://blocklytics.org/blog/uniswap-api/
“The price of a given token on a given…
Timothée HENRY
- 467
- 2
- 5
- 11
24
votes
1 answer
Where does the line blur between a task and a script in Hardhat?
This is a question about Hardhat, the task runner that facilitates building on Ethereum.
From Writing scripts with Hardhat:
You can write your custom scripts that can use all of Hardhat's functionality. A classic use case is writing a deployment…
Paul Razvan Berg
- 17,902
- 6
- 73
- 143
24
votes
2 answers
What is the immutable keyword in Solidity?
What is the immutable keyword in Solidity and how do I use it?
Shane Fontaine
- 18,036
- 20
- 54
- 82
24
votes
1 answer
What are *C*, *E* and *S* properties in message call return object?
(JS)
var contract = web3.eth.contract(abiDefinition).at(address);
contract.test(value, gotResult);
function gotResult(error, result) {
if(!error) {
console.log(error);
}
else {
…
manidos
- 4,298
- 3
- 31
- 55
24
votes
7 answers
How do you stop a running geth node?
I can not figure out how to stop a running geth node without killing the process. I tried to lookup geth help but there is no mention of stopping, halting or any shutdown command.
How to shutdown geth cleanly?
Edit:
I'm running it as a daemon,…
q9f
- 32,913
- 47
- 156
- 395
24
votes
1 answer
eth.pendingTransactions vs eth.getBlock('pending').transactions
What is the difference between eth.pendingTransactions and eth.getBlock('pending').transactions?
I have noticed that sometimes eth.pendingTransactions have some transactions that eth.getBlock('pending').transactions does not have.
coeniebeyers
- 539
- 4
- 8
24
votes
1 answer
What would be needed to store the blockchain as a IPFS object?
In Christian Lundkvists blog post about possible uses for IPFS, he suggests that storing the Ethereum blockchain as an IPFS object could potentially decrease the size of the chain:
We see the deduplication we gain when putting the state database…
MrChico
- 1,786
- 14
- 19
24
votes
1 answer
Initialising structs to storage variables
The following code fails to compile with error: Type struct SomeStruct memory is not implicitly convertible to expected type struct SomeStruct storage pointer.
contract StructExample {
struct SomeStruct {
int someNumber;
string…
naddison
- 528
- 1
- 4
- 8
24
votes
5 answers
How to make someone else pay for Gas?
My understanding is that msg.sender pays the gas fee. Can a smart contract be written in such a way that it's always the contract owner who pay the fees?
As an example, in an ERC20 token when someone transfers the tokens, he pays the gas fee but…
eth.block
- 431
- 1
- 4
- 10
24
votes
5 answers
Truffle configuration file name - is it 'truffle.js' or 'truffle-config.js'?
Truffle configuration file is mentioned in several places on the web (GitHub, truffle package on npm, solidity-coverage package on npm, etc.).
Some refer to it as 'truffle.js, others refer to it as truffle-config.js.
When creating a project with…
goodvibration
- 26,003
- 5
- 46
- 86
24
votes
7 answers
Encoding/Decoding contract ABI data
How to encode and decode ABI data?
Can someone show me an example with web3js library?
gkucmierz
- 773
- 2
- 8
- 15