Most Popular

1500 questions
10
votes
5 answers

How can I get my address via web3?

I'm using web3, truffle and testrpc. In my smart contract, some of the functions can only be called by the owner (or creator) of the contract (i.e. onlyOwner functions). So, I've defined some modifier for that. Also, in the smart contract, I have…
Aydin
  • 2,117
  • 6
  • 25
  • 41
10
votes
2 answers

Is there a way to mine Ether on a Mac?

All I see is Windows and Linux support only, why is there no guide for mining ether on a Mac? Is there a way to mine on a Mac?
Clovis
  • 881
  • 4
  • 12
  • 20
10
votes
2 answers

How can I trigger a PHP script when a transaction is received?

My goal is to have a PHP script be invoked whenever a transaction is received by a given address. I know Javascript but this is my first sally into Node.js. I think the right approach is to run a node.js webserver in parallel to Apache, and for that…
spraff
  • 645
  • 1
  • 10
  • 22
10
votes
1 answer

Why (conceptually) can't mappings be local variables?

My understanding is that the mapping type cannot be used as a local variable, and must be a member (i.e., state) variable. Is there a conceptual reason for this to be the case? I can't imagine this couldn't be implemented as a memory variable?
pfrank
  • 696
  • 1
  • 6
  • 13
10
votes
6 answers

Where can I find test-ether for the Kovan Test Network?

I have tried getting some using my github account but my account got flagged immediately and the program wasn't recognizing my account (Since it wasn't public due to being flagged). Are there any alternatives? Thanks in advance!
Alex Papageorgiou
  • 670
  • 1
  • 5
  • 14
10
votes
3 answers

How can I create complex array relationships in solidity?

Hello I'm trying to work out how to create complex relationships in Solidity. In this example a customer will place an order using a function with arguments, however it cannot be for any combination of shops, types, and products, the relationship…
T9b
  • 1,185
  • 8
  • 21
10
votes
4 answers

Ropsten faucet not working for me

I tried to send test ethers to the main account address created on Ethereum wallet by using the Ropsten faucet (http://faucet.ropsten.be:3001/) but did not receive any . My wallet is synced with Ropsten test network. Any suggestions on how I can get…
Webdev
  • 406
  • 1
  • 6
  • 17
10
votes
2 answers

Fallback function in web3

I find answer how to make upgradable contract here How to call function from currentVersion with fallback function on web3? contract Relay { address public currentVersion; address public owner; function Relay(address initAddr){ …
Agniezhk
  • 321
  • 1
  • 3
  • 7
10
votes
2 answers

What address(0) stands for?

In the contract for EOS crowdsale: https://etherscan.io/address/0xd0a6e6c54dbc68db5db3a091b171a77407ff7ccf#code line 469: assert(address(EOS) == address(0)); "assert" will test if both sides of the expression are equals, but: 1) address(EOS) is…
jfjobidon
  • 763
  • 2
  • 11
  • 25
10
votes
2 answers

How to get a contract verified on etherscan?

I'm having a hard time getting a contract verified on Etherscan. I deployed the contract using Ethereum Wallet, I can effectively find it on Etherscan but when I copy-paste the exact same code to the verification, I get the error: Sorry! The…
Donavan Theodor
  • 1,943
  • 3
  • 20
  • 28
10
votes
4 answers

How to transfer ERC20 tokens using web3js

I've read some docs, run parity in docker container, and being able to connect and get token balance of an account const Web3 = require('web3'), const web3 = new Web3(new Web3.providers.HttpProvider('http://127.0.0.1:8545')); const contract = new…
user16150
  • 101
  • 1
  • 1
  • 3
10
votes
1 answer

What is meant in this tutorial when it says that using throw will "consume all provided gas"?

When reading the solidity documentation (http://solidity.readthedocs.org/en/latest/solidity-by-example.html#voting), I came across this: function giveRightToVote(address voter) { if (msg.sender != chairperson || voters[voter].voted) //…
Peter Hall
  • 625
  • 5
  • 13
10
votes
1 answer

Dividing Ether Past Smallest Unit Possible?

I've read that ether is divisible to 1018. Say you're writing a simple contract which takes deposits sent to it divides the deposit in 2 and sends it to 2 separate addresses. What happens if someone doesn't take into account the smallest possible…
Philip Kirkbride
  • 608
  • 4
  • 12
10
votes
2 answers

Correct syntax for estimating gas cost of a function in Web3?

Suppose I have the following function: function SetMessage (bytes32 _message) returns (bool success) { message = _message; return true; } Which might be called in Web3 as follows, for example: MyContract.deployed().then(function…
ZhouW
  • 1,348
  • 2
  • 18
  • 35
10
votes
2 answers

truffle + testrpc time manipulation

I use truffle + testrpc for testing my contracts and I need to test some time-dependant code (I guess that situation is quite common). I set some objects, check some conditions, then I need to simulate time forwarding to check conditions…