Most Popular

1500 questions
36
votes
2 answers

Can we get all elements stored in a mapping in the contract

Can we get all elements stored in a mapping in the contract using web3.js ?
takampika
  • 385
  • 1
  • 4
  • 6
36
votes
1 answer

What does the keyword `super` in Solidity do?

I came across the super keyword in Solidity in the context of overriding functions. What does it do?
SCBuergel
  • 8,774
  • 7
  • 38
  • 69
36
votes
11 answers

How to get private key from account address and password?

What I have 1. I am able to create new account with personal.newAccount() method of web3 api. 2. I am working on my private blockchain. 3. geth node start with following command:- geth --datadir ~/privateBlockChain1 --networkid 1300 --rpcport…
Imroz
  • 871
  • 2
  • 7
  • 11
36
votes
6 answers

web3: How do I get past events of myContract.myEvent?

I use the following JS code to get notified of Solidity events and it works well for incoming new events: myContract.myEvent().watch((error, result) => { if (error) console.log('Error in myEvent event handler: ' + error); else …
SCBuergel
  • 8,774
  • 7
  • 38
  • 69
35
votes
3 answers

understanding mload assembly function

I am learning the inline assembly in solidity, I have found the function mload(0x40) I am confused with what this function does. Did it reserve 4 Slot/word in memory or did it load the data stored in the address 0X40 or what?
Sig Touri
  • 1,090
  • 2
  • 14
  • 23
35
votes
2 answers

Ethereum smart contract security checklist

Is there a tool, checklist of methodology to help reviewing smart contract security? E.g. for each of function you review Is there re-entry possibility and how it behaves on re-entry How it behaves if loops run out of gas How it behaves if stack…
Mikko Ohtamaa
  • 22,269
  • 6
  • 62
  • 127
35
votes
10 answers

How can I return struct when function is called?

I'd like to return struct type User. However, when I tried the following getUser function, it returns an error. Is there any way that struct data would be returned from a function? Contract struct User{ uint256 user_id; bytes32 name; …
Toshi
  • 2,357
  • 8
  • 23
  • 34
35
votes
3 answers

How do miners profit post-PoS, if at all, how will new miners get their start, and who will execute the EVM byte code (and why)?

I've been following the release of Casper/PoS closely, and I'm curious about a few details. How will miners make money (even if GPUs are less valuable)? Are spare compute resources (say RAM, CPU) still somehow "usable" to create value by securing…
William
  • 511
  • 1
  • 4
  • 4
35
votes
6 answers

Is there a way to find an account's current transaction nonce?

I need to know my transaction nonce because I am doing fancy stuff with contract addresses (which are the keccak hash of my address + my transaction nonce). Is there a way to find this through the JavaScript console?
Broseph
  • 695
  • 1
  • 7
  • 12
35
votes
7 answers

web3.eth.contract is not a function when making contract

Whenever I try and make a contract, I get: web3.eth.contract is not a function I'm using this code: const path = require('path'); const fs = require('fs'); const solc = require('solc'); const Web3 = require('web3'); const web3 = new…
ErwanLent
  • 541
  • 1
  • 4
  • 10
35
votes
2 answers

How does Lisk differ from Ethereum?

Lisk is going to be a full stack DApp development framework for building and distributing decentralized applications. It's currently in the crowdfunding stage but got also added to Microsofts Blockchain-as-a-Service stack. It advertises that you can…
q9f
  • 32,913
  • 47
  • 156
  • 395
35
votes
4 answers

workflow on signing a string with private key, followed by signature verification with public key

I know this question has been asked and answered, but while trying to get everything to work, I've come across some problems. This is what I'm trying to do: 1. take a target string 'Schoolbus' 2. use JSON with geth to eth_sign it 3. obtain v,r,s of…
shiso
  • 1,036
  • 1
  • 10
  • 12
35
votes
1 answer

What are Ethereum transaction receipts and what are they used for?

I've seen mention in a few places that blocks store transaction receipts, but I haven't really seen an explanation of what they are and why they exist.
Raiden Worley
  • 453
  • 1
  • 4
  • 4
35
votes
2 answers

What is the difference between `now` and `block.timestamp`?

My main goal is to obtain time spent between two transaction calls inside my smart-contract. I am not sure, should I depend on now or block.timestamp to obtain the most accurate time difference in between transactions. I have call my contract's…
alper
  • 8,395
  • 11
  • 63
  • 152
35
votes
4 answers

Web3.js Get Contract Abi Knowing Only Contract Address

is there a way with web3.js to get a contract abi json, knowing only the contract address? I cannot find anymore a link in wich they explain how to do this, in this post the guy replied telling that there is a way to do this but it's not so well…
user2548436
  • 495
  • 2
  • 5
  • 9