texts: How to automatically get user's wallet info if they are connected but NOT show the metamask pop up if they are not?

texts:
I don't want metamask to pop up on page load forcing a user to connect, so we only connect via a button - but after a user is connected if they refresh the page - they need to press the button again to connect (although nothing happens in metamask, it just calls ethereum.enable() and closes).
I'd like to be able to do something like:
If user has already connected (after reloading the page or coming back next week), call enable and get their wallet info/address.
If the user has not already connected - do not call the connect function for metamask until the user presses the connect button.
Here is my code for connecting a wallet and I'm unsure how to do the initial check for - "if they have already connected".
export const loadUserWeb3 = async () => {
  try {
    if (window.ethereum) {
      window.web3 = new Web3(window.ethereum);
      await window.ethereum.enable();
      window.ethereum.on("chainChanged", () => {
        document.location.reload();
      });
      return window.web3;
    } else if (window.web3) {
      window.web3 = new Web3(window.web3.currentProvider);
      return window.web3;
    } else {
      window.web3 = new Web3(
        new Web3.providers.HttpProvider(INFURA_ENDPOINT[1])
      );
      return window.web3;
    }
  } catch {
    window.web3 = new Web3(new Web3.providers.HttpProvider(INFURA_ENDPOINT[1]));
    return window.web3;
  }
};

Again the key here is that if they have not already connected then it would not call enable() because that would show the metamask pop up without the user asking for it to be shown.
TL;DR:
How to get the user's wallet info if their wallet is ALREADY connected and they just reload the page - without forcing metamask to ask them to connect if they HAVEN'T connected.


texts: Quorum Consensus - BAR (Byzantine Altruistic Rational) Fault Tolerance / BAR Fault Tolerance / BAR Model

texts:
I refer to http://www.cs.utexas.edu/~dahlin/projects/bft/
http://www.cs.cornell.edu/lorenzo/papers/sosp05.pdf
http://www.cs.northwestern.edu/~fabianb/classes/cs-443-w07/BAR.pdf https://blog.ethereum.org/2014/09/02/software-bounded-rationality/

Does consensus mechanism (e.g., IBFT, Raft or Proof of Work, Proof of Stake, Casper FFG) within Ethereum/Quorum adopt or adhere to the BAR (Byzantine Altruistic Rational) Fault Tolerance / BAR Fault Tolerance / BAR Model?

What is the specified relationship between the consensus algorithms available in Ethereum/Quorum and BAR (Byzantine Altruistic Rational) Fault Tolerance Model?

Thank you.


texts: Transaction null even after getting mined

texts:
I am invoking a smartContract method to issue coin(cryptocurrency example). When I invoke the method the transaction is getting submitted and mined. refer the below transaction logs. But after that when I check the Txreceipt the value is returned as null.

I1129 08:55:48.861202 eth/api.go:1193] Tx(0xb916c58007f51cc7040a3ac52515fb9ae674e533c9093862417a3ae7bffeeff2) to: 0x4745e9013ede7928f7ac2068c396a164e033edf2
== Pending transactions! Mining...
I1129 08:55:49.067910 miner/miner.go:119] Starting mining operation (CPU=1 TOT=2)
I1129 08:55:49.070917 miner/worker.go:573] commit new work on block 139 with 1 txs & 0 uncles. Took 2.0061ms
I1129 08:55:50.988262 miner/worker.go:339] ??  Mined block (#139 / de47fd54). Wait 5 blocks for confirmation
I1129 08:55:50.988262 miner/worker.go:573] commit new work on block 140 with 0 txs & 0 uncles. Took 0
I1129 08:55:50.989263 miner/worker.go:435] ?? ??  Mined 5 blocks back: block #134
I1129 08:55:50.992266 miner/worker.go:573] commit new work on block 140 with 0 txs & 0 uncles. Took 1.0031ms
== No transactions! Mining stopped.


texts: Will a GPU be required to do proof of stake as a full node? Will it help me be more profitable? Will a highly available network connection be worth more than having a beefy GPU? What if I don't stay up for the 4 month period? (What sort of reduction in my money will I see?)


texts: How do I go from truffle testrpc to mainnet?

texts:
I've been teaching myself ethereum via the stack solidity/truffle/truffle-contract/testrpc/metamask. I built a small dApp that runs on testrpc with proper unit tests which work great. I've written a function that I truffle serve that loads my contract named VEX from the local the file f_deployed_contract

$.getJSON(f_deployed_contract, function(data) {
    App.contracts.VEX = TruffleContract(data);
    App.contracts.VEX.setProvider(App.web3Provider);
});

Everything works! I was excited, so I deployed the contract of the working solidity code using a combination of Remix and Ether Wallet to the mainnet. It was mined and now lives here:

https://etherscan.io/tx/0xe5e6c5d463815e339a2aac2e92594de595e2029e6448997799871d8cb2a5728b

Now, how do I adjust my TruffleContract so I can use my dApp with metamask on the mainnet?


texts: Is there a way to simulate running a transaction on a geth instance?

texts:
I want to be able to see the state changes that would result from running a transaction without submitting the transaction to the network.

Is there a straightforward way to do this with geth?


texts: Using web3 can I get logs and the relevant transaction in on request?

texts: I am trying to optimise query usage on infura and it would be a lot easier if I could get all the relevant logs from getLogs() plus there transactions.


texts: What order is code copied for inheritance?

texts:
The Solidity documentation says it supports inheritance by copying code, but is unclear about where the code is copied to.  I am building a genesis block for a Quorum-based chain, starting from the code in davebryson/quorum-genesis.  My chain is preloaded with another contract which uses inheritance, and I would like to preload some state into the parent contract.  The storage key indexes contract variables based on the order they are declared, so I need to know whether the parent contract's variables are copied before or after the child contract's variables.

Does anyone know whether parent code is copied to the top or the bottom of the child code?


texts: Not able to retrieve Solidity event in JavaScript

texts:
I have my sample contract as:-

 pragma solidity ^0.4.24;

contract Storage {
  uint256 storedData;

  event print(uint256 store);

  function set(uint256 data) public {
    emit print(data);
    storedData = data;
  }

  function get() constant returns (uint256) {
    return storedData;
  }
}

After setting the value from geth console and mining it, when I use get function to check the value it returns the correct value which was set earlier.
However when I try to get the event logs with the following code:-

var eve = instance.print({sender:eth.coinbase},{fromBlock: 0, toBlock: "latest"});
var allValues = eve.get();allValues[allValues.length - 1].args;
console.log(allValues[allValues.length - 1].args.store);

Here instance is the contract instance, It shows the error as cannot access member args of undefined.


texts: How to access ethaddress.org funds if the private key is blurred out?

texts:
Tried out the paperwallet and sent 1 ether to the address on the screen as a test.

After that I noticed the private key on it is blurred out. I generated another and found the same thing on the second. How to access my ether if the private key is blurred out?


texts: Trustless Inter-chain transaction with Bitcoin- are there any flaws?

texts:
Let's say that Alice wants to send Bob 1 BTC, and in return Bob will send Alice 1 ETH.

Alice's Bitcoin address is BTC_A, and Alice's Ethereum address is ETH_A. Likewise, Bob owns addresses BTC_B and ETH_B.

BTC_B is a "fresh" address, with no transaction history whatsoever.

Alice creates a single transaction to ETH_A containing slightly over the amount that she will send to Bob and broadcasts it. The transaction hash of this will be called tx1.

Bob waits for that transaction to be confirmed and then creates a smart contract with the following (immutable) parameters:

inputaddr, set to BTC_A

inputtx, set to the tx1_txhash from above

outputaddr, set to BTC_B

minfee, set to a "reasonable" Bitcoin fee/byte, based on current network conditions

waittime, set to the number of seconds after which a transaction with minfee will be confirmed on the BTC blockchain, plus a significant margin for safety

val is set to an amount representing 1 BTC, or however much Alice is sending to Bob

Bob also deposits 1 ETH into the smart contract, and is not allowed to withdraw it

Alice submits a transaction, tx2, to the Bitcoin blockchain with the following properties:

inputtx is its only input
outputaddr is its only output address
fee > minfee
signed by BTC_A

She also submits this whole transaction to the smart contract, which verifies these four properties. If they are all met, note the time as txtime.

Bob will continuously monitor the Bitcoin blockchain, and if Alice tries to double spend the input transaction, he will submit the double spend transaction to the smart contract. The smart contract will verify that this transaction is legitimate, and if it isn't identical to the first transaction that Alice submitted earlier, will refund the ETH back to ETH_B.

Bob will also be able to withdraw the locked ETH if Alice doesn't submit the BTC transaction to the contract in a reasonable amount of time.

If waittime has passed since txtime and Bob hasn't submitted proof of a double spend, Alice can withdraw the locked ETH to ETH_A at her leisure.

This seems like the kind of thing that someone would have already come up with, but I couldn't find any other trustless examples of a BTC-ETH exchange. Is there a fundamental flaw in this system?


texts: Storing private key in javascript variable or local storage

texts:
I am creating my own wallet as hobby project. I want to avoid using metamask, so idea is to store private key encrypted(AES) on my server, where salt will be my password.

When I enter password and log in to my account, server will send encrypted key back to me which will be stored into local storage or cache. To do transaction I will then have to put password each time, which will decrypt private key from local storage, sign transaction and send signature to network via web3.js.

Another option where user doesn't have to put password each time would be, to log in, private key encrypted would be stored in storage or cache and on callback while storing it would decrypt private key and store it into javascript variable (memory). User would then be able to sign transactions without password prompt. It would lose password on page refresh, but that's the cost.

Now I know cold wallet and metamask is way more secure, but I want to avoid both, to make users life easier, but for me this is research project.

I am interested from security perspective in what cases would this be vulnerable? In case server is breached and someone gets password it can decrypt private key. Ok, this is breach server + somehow get your password. Another options?


texts: Error when trying to start Binance Smart Chain Fullnode - flag provided but not found

texts:
I am following the instructions on the Binance documentation for starting a fullnode on BSC: https://docs.binance.org/smart-chain/developer/fullnode.html#fullnode_1
The genesis state seems to print correctly, and I get the expected output. However, on the last step, "Start your fullnode", get this error:
Incorrect Usage. flag provided but not defined: -pprofaddr

Does anyone know what this might mean?
Also important to note is that I have had this error after running "make geth" from step one.
SECURITY ERROR
This download does NOT match an earlier download recorded in go.sum.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

For more information, see 'go help module-auth'.
util.go:45: exit status 1
exit status 1


texts: Where and how can one test plasma or sharding on testnet?

texts: Is there a good tutorial on how to test out plasma or sharding for Ethereum 2.0 on testnet?


texts: Error: The contract code couldn't be stored, please check your gas amount , when creating new contract

texts:
I am trying to create new contract but I get the error:

  Error: The contract code couldn't be stored, please check your gas
  amount.

In the script, I have:

var balance =  web3.eth.getBalance(accounts[1])
console.log(balance.toNumber());
console.log('balance: ' + web3.fromWei(balance));

var gasPrice = web3.eth.gasPrice;
console.log('gasPrice '+gasPrice.toString(10));

contractData = web3.eth.contract(abi).new.getData({data: compiled});

var gasEstimate = web3.eth.estimateGas({data: contractData});
console.log('gas Estimate '+gasEstimate);
var total = gasEstimate*gasPrice;

console.log('total: ' + web3.fromWei(total));

web3.eth.contract(abi).new({from:accounts[1],data: compiled,gas:gasEstimate+3000}, function (err, contract) { ....

The output is:

  balance: 15.95038514

  gasPrice 20000000000

  gas Estimate 84251

  total: 0.00168502

Any idea what I am doing wrong?

Btw, I am running the Parity client.


texts: How can I implement redactable chain for ETH?

texts: I am trying to research about Redactable blockchain so my question is how can I implement a Redactable chain in Eth if someone has some idea about it I will be thankful


texts:
struct TrackDetails {
    string details;
    bool used;
}
mapping(bytes32 => TrackDetails) track;

function saveDetails(bytes32 index, string _trackDetails) public {
    require(int(index) != 0 && bytes(_trackDetails).length != 0);
    require(track[index].used != true);
    track[index].details = _trackDetails;
    track[index].used = true;
}

Here index is like unique id and given by the person who enters track details. But the problem is, index is accepting white spaces. How to avoid this?


texts: Why are there two functions with the same name in ERC721 OZ contract?

texts:
I'm looking at the OpenZeppelin ERC721 contract, and the function _safeMint is defined twice:
   /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     d*
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {
        _mint(to, tokenId);
        require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

The comments from both didn't help me understand. What I can see is that they receive different number of parameters, but how could the contract know which one I'm calling?
My question is how does this work? Shouldn't it cause a compilation error or at least one overwriting the other? And why use the same name, is this a feature I'm not aware of?


texts: Can I get back tokens that I accidently sent to a contract address?

texts:
I just started using metamask today and accidentally sent 500 dollars worth of crypto to the contract address instead of the ETH address (yes I'm a moron). Is there anyway for me to get my crypto back or is it lost forever? Thanks for your time.
Here is the contract address: 0x2b591e99afE9f32eAA6214f7B7629768c40Eeb39


texts: What is the best way to implement a dividend paying contract?

texts:
Every block x amount of ether is put into the smart contract - Where x is variable.
And a user with a token balance of y is entitled to y / total token supply of the total dividends in the smart contract.
What is the best way to implement such a thing?


texts: ERC223 and ERC827 can receive erc20 tokens and call a function immediately?

texts: As the title says, is that possible? For example on my ico contract, I accept  USDT erc20 token and when I receive each transaction, call a function for that   and send that address my tokens or eth.


texts: what arguments does the sendTransaction function take?

texts:
I have set up my private blockchain using geth and am using web3 to call different methods. I have successfully created new accounts from the web browser and can view all addresses and the balances. Next i am trying to send some ether from one account to the other.

In javascript I have

acc1 = web3.eth.accounts[0];
acc2 = web3.eth.accounts[1];
web3.eth.sendTransaction({from: acc1, to: acc2, Value: 1})

I encounter an error as follows
Error: invalid argument 0: cannot unmarshal non-string as hex data

Has anyone faced this?


texts: Subscribing to multiple Transfer events of various ERC20s

texts: I need to suscribe to Transfer events of couple of different ERC20s in order to catch transfers to my contract. And here is the question: to catch all those events I need to create instance of each contract, can I do this using standard ERC20 abi for each of this contract or it has to be abi dedicated to exact erc20 smart contract?


texts: Very simple Truffle test, but assertion fails (functions seem to work fine in Remix)

texts:
In my QueryResultHandler.sol file, I have three functions: one for storing data (requesting two IDs as integers and two string values) and two for validation (either by providing the integers or the string values). The QueryResultHandler.js:

pragma solidity ^0.4.4;

contract QueryResultHandler {

   struct QueryResultStruct {
       bytes32 finalHash;
       bytes32 queryHash;
       bytes32 resultHash;
       uint256 queryId;
       uint256 resultId;
   }

   QueryResultStruct[] queryResultStructArray;

   function storeQueryResults(uint256 _queryId, uint256 _resultId, string _queryString, string _resultString) external returns (bool success) {
      bytes32 queryHash = keccak256(_queryString);
      bytes32 resultHash = keccak256(_resultString);
      bytes32 hashThem = keccak256(queryHash, resultHash);
      queryResultStructArray.push(QueryResultStruct(hashThem, queryHash, resultHash, _queryId, _resultId));
      return true;
    }

   function validateQueryResultsById(uint256 _queryId, uint256 _resultId) external view returns (bool success) {
      for (uint i = 0; i < queryResultStructArray.length; i++){
          if (queryResultStructArray[i].queryId == _queryId && queryResultStructArray[i].resultId == _resultId) {
              return true;
          }
       }
    return false;
    }

   function validateQueryResultsByString(string _queryString, string _resultString) external view returns (bool success) {
      bytes32 queryHash = keccak256(_queryString);
      bytes32 resultHash = keccak256(_resultString);

      bytes32 hashThem = keccak256(queryHash, resultHash);

      for (uint i = 0; i < queryResultStructArray.length; i++) {
          if (queryResultStructArray[i].finalHash == hashThem) {
              return true;
          }
      }
      return false;
   }
}

I am using Truffle and I wanted to write a very simple unit test, which stores some data and then validates it. The store function returns true, however, the validation fails afterward. Can somebody please help me, what can be the issue?

'use strict';

var QueryResultHandler = artifacts.require("./QueryResultHandler.sol");
contract('QueryResultHandler', function() {

    it("should store 1, 21, a, b and then verify by the ID/string", async () => {
        let query = await QueryResultHandler.deployed();
        query.storeQueryResults.call(1,21,"a","b").then(function(stored){
            console.log(stored);
        });
       query.validateQueryResultsByString.call("a","b").then(function(valid){
           console.log(valid);
       });
    });
});


texts: Withdrawal from Poloniex have not shown in my ether wallet

texts:
I have made a withdrawal from poloniex 2 days ago. withdrawal status shows complete with TX ID but eth never arrive in myetherwallet. i see multiple users have complaint the same thing. i have been doing few withdrawals last week with no problem. is this because of the ICO thing. Any thoughts?

P/S i did open a support ticket 2 days ago.

Thanks guys! really appreciate your help.

UPDATE: GOOD NEWS! I HAVE RECEIVED ALL MY ETH IN MYETHERWALLET.


texts:
I am new to solidity. Maybe I am missing something obvious in the setup. But when I run truffle test, I get nothing, the terminal just stays there forever.

$ truffle test

... and I don't know why, and where to debug. My project looks like this:

ExamRegistry
  build
  contracts
    Exams.sol
    Migrations.sol
  migrations
    1_initial_migration.js
    2_deploy_contracts.js
  test
    TestExams.js

TestExams.js has this code:

const Exam = artifacts.require("Exams");

contract("Exams", accounts => {
   it("should save the exam's hash", () =>
   Exam.deployed()
       .then(instance => instance.getContractOwner.call(accounts[0]))
       .then(address => {
           assert.equal(
                 ...
           );
       })
   );
});


texts: Why are smart contract outputs different from ordinary transactions?

texts:
A Coinbase exchange engineer said:

  "Depositing from smart contracts is hard. Smart contract outputs are
  not like normal ETH transactions and it is non-trivial for us to get
  notified when we receive coins from smart contracts."

Similarly, the Bitfinex exchange says:

  "At this time Bitfinex does not support Ethereum transactions
  generated from smart contracts. To avoid missing deposits or deposit
  delays ETH should only be sent in traditional transactions. If you are
  uncertain that your deposit will not be sent as part of an Ethereum
  contract execution, please find out for sure before sending your
  deposit."

What is the technical difference between transactions generated by smart contracts and transactions generated by humans? Why is it harder to be notified when a coin is received from a smart contract (how would an exchange get notified when they receive coins from a human, and how would they get notified when they receive coins from a smart contract, and why is this different)? What was the motivation for this design choice by the Ethereum designers? Where can I go to read more details?

I skimmed https://github.com/ethereum/go-ethereum/wiki/Contracts-and-Transactions but did not see the answer there.


texts: How to obtain blocknumber when a value is changed?

texts:
I can read a public variable in a smart contract.

But in order for me to be sure that the value is confirmed, I need to check the blocknumber when that value is set against the current block number.

May I know if it is possible for me to do that?

emitting an event or store the latest blocknumber together with the value is out of the question here. Because I am looking for a why that we need consume additional gas.


texts: Why the amount of time between each block creation is not exact?

texts: I have seen that crowdsales are measured in blocks instead of time, but that there is an exact amount of blocks that represent a week or a month. If the time beetween blocks is not always the same, why a crowdsale developer can know kind of exactly how many blocks represent a month?


texts: How does the large-scale crypto trade platform , just like Binance or Bittrex , track ETH and Token transfer in their every account over time?

texts:
I wrote some simple code with web3js to track an address/account's transaction in real-time. It works, but I think it is in poor performance or could consume too much cpu resources.

    sample code

 let filter = web3.eth.filter("latest");
 filter.watch(function(error, result) {
    if (!error) {
      //tracking start in 12 blocks earlier .
      var earlierNumber = web3.eth.getBlock(result).number - 12;
      var confirmedBlock = web3.eth.getBlock(earlierNumber ) ;

      if (confirmedBlock.transactions.length > 0) {
          confirmedBlock.transactions.forEach(function(tx) {
             if ( tx.to == address ) {
                var depositAmount =  web3.fromWei(tx.value.toNumber(),
                "ether" )
                console.log("address: " +address+ " deposit amount:  "+depositAmount+ " ETH." ) ;
              }
          })
       }
     }
  })

How could those large scale trade or exchange platform track huge amount of account' transaction accurately ? I find much good project such as MetaMask-token-tracker ,on Git. How about it? Or any open source to recommend？


texts: How to verify transactions on ethereum blockchain?

texts:
I have a smart contract deployed in which there is a variable A whose value is updated through a public function fun_update(). I want to get all the addresses which updated that variable A through the function fun_update().
How to do it without storing those addresses?


texts: Ether missing after Etherli transaction, Internal Transaction?

texts:
I'm new in this world and already have a problem with my ETH, hope someone can help me..

I used the wallet of ether.li but saw another wallet for my phone. So I did a transaction of 2ETH from Etherli to my new wallet, but they never showed up in my new wallet. I bought 0.03ETH to test my new wallet, and it works. Received it within 10 minutes. So I looked up my transaction on etherscan.io and it seems it was send to a contract? And the contract had to send it to my new wallet? I don't know how this works and if that's the way it supposed to be, but now it's 'stuck' in 'Internal Transaction'.
I also see a transaction on etherscan from my wallet to an adress I don't know of 2.035ETH, it happened 1 minute after I ordered the 0.03ETH.
This transaction didn't show up in my wallet, and I still got the 0.03ETH so i guess this transaction never happened.
Did I lose my 2ETH now, or is it possible to bring it back to one of my wallets?

Gift in ETH for the one who can get me my Ethers back in my wallet :)

My new wallet address is: 0xC7Ee06c302b06a695540403C7c8D5BED51e228Cb. From there you can see the contract in etherscan in 'Internal Transactions'.


texts: Difference between CALL, CALLCODE and DELEGATECALL

texts:
CALL and CALLCODE take the same number of operands (in the execution stack). For the exception flag being pushed on top of the stack: 0 means exception, 1 means successful execution. CALL is easy to understand, but I could not digest the subtle difference between CALL & CALLCODE. It is stated in the yellow paper that for

  CALLCODE: This means that the recipient is
  in fact the same account as at present, simply that the code is
  overwritten.

What does it mean by the code is overwritten? Does that mean I can ask the contract to execute some external code? It would be helpful if anyone can provide me an example to differentiate between the two.

EDIT: DELEGATECALL was added in Homestead what is the difference?


texts: eth_getTransactionReceipt returns null only sometimes and only on my node, tx is successfully mined in

texts:
I'm having this strange problem and it may be related to the way my node is configured.  I'm making calls to both infura and my own nodes like so:

{'id': 123, 'jsonrpc': '2.0', 'method': 'eth_getTransactionReceipt', 'params': ['0x1234...']}

For this one specific txid, when I make this call to my own node it returns a null:

{"jsonrpc":"2.0","result":null,"id":123}

Yet when I make this same exact call to infura it returns me the valid and correct response.  Also, note that I can look this txid up on etherscan and see that it was mined in successfully days ago.  I'm certain that my node is working because I'm making all sorts of other calls to it, eth_call, eth_getBalance, etc.  I seem to only have this problem with eth_getTransactionReceipt.  Also, note that I can plug in other random txids and make this call to my node and it will return me valid data.  This only happens for this one specific txid and a few others.
 There must be some pattern to which txids work and which do not...

So there seems to be something wrong with my node or my node's configuration.  Any ideas what the problem maybe?

I'm launching my parity node like so

parity --jsonrpc-apis web3,eth,pubsub,net,parity,parity_pubsub,traces,rpc,secretstore,shh,shh_pubsub --jsonrpc-interface=<ipaddress> --jsonrpc-hosts=all

My node is synced and when I call eth_blockNumber i'm getting the latest block

Edit:

I'm also seeing this issue when I use python ethereum via this call:

url = 'https://mainnet.infura.io/......'  // This always works for every txhash
url = 'http://urlToMyParityNode:8545'   // This always works for some txhashes and always doesn't work for some txhashes
w3 = Web3(HTTPProvider(url))
tx_receipt = w3.eth.getTransactionReceipt("0xTxId")

But when I use either infura or auto, it works just fine.  There must be something wrong with my node configuration, or I cannot use a light node.  I wonder if auto only detects full nodes and does not consider light nodes.

tx_receipt = w3.eth.getTransactionReceipt("0xTxId")


texts:
So i want to forward erc20 tokens that i receive in different wallets, to a single "parent" wallet so to speak.

by searching around the stackexchange, i found how to forward ethers,

> pragma solidity 0.4.21;
>
> contract Forwarder {
>
>   address public destinationAddress;   event LogForwarded(address
> indexed sender, uint amount);   event LogFlushed(address indexed
> sender, uint amount);
>
>   function Forwarder() public {
>     destinationAddress = msg.sender;   }
>
>   function() payable public {
>     emit LogForwarded(msg.sender, msg.value);
>     destinationAddress.transfer(msg.value);   }
>
>   function flush() public {
>     emit LogFlushed(msg.sender, address(this).balance);
>     destinationAddress.transfer(address(this).balance);   }
>
> }

but i can't seem to figure out how to do it for the erc20 tokens.

any material i can read up on or code snippets to check out would be appreciated.

Thank you very much.


texts:
Problem:
org.web3j.tx.exceptions.ContractCallException: Empty value (0x) returned from contract

The code is as follows....

My java:

String owner = managedWalletLookup.getOwner(contractAddress).send();

This ^ line of code calls this auto-generated Java wrapper:

public RemoteCall<String> getOwner(String wallet) {
    final Function function = new Function(FUNC_GETOWNER,
            Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(wallet)),
            Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}));
    return executeRemoteCallSingleValueReturn(function, String.class);
}

This is the original solidity, from which the Java wrapper gets generated:

mapping(address => address) public _managedWallets;

function updateManagedWallets(address wallet, address owner) public isOwner {
    _managedWallets[wallet] = owner;
}

function getOwner(address wallet) public view returns (address owner) {
    owner = _managedWallets[wallet];
    return owner;
}

Every time I call updateManagedWallets, I get a successful TransactionReciept, but the getOwner function always generates an error.

Any thoughts?


texts: What is the deposit amount when creating liquidity pool?

texts: I am trying to create a test liquidity pool using mock token on Uniswap. I've been trying to find out how is this deposit amount calculated and what does it exactly mean? Doesn't matter what is the starting price or price ranges, whatever I do this is always base $15. Can someone could explain this a little to me?


texts: How to remotely import private key to geth with web3?

texts:
I'm running a geth node on a digitalocean droplet with:

geth --light --rpc --rpcaddr "0.0.0.0" --rpcapi personal,web3,net,eth --rpccorsdomain "*" --rpcport "8545" console

I'm trying to import a private key remotely with web3.js. Here's what I have :

var web3= new Web3(new Web3.providers.HttpProvider('http://my.node.ip:8545'));
var personal = new Personal(Personal.providers.HttpProvider('http://my.node.ip:8545'));

web3.eth.personal.importRawKey('0x3f91d8d53d7b25580cbf6b839213e20419cefb52bcdbf74c535d081c7006baba', "AssCheeks").then(console.log);

This returns: "Error: Returned error: invalid hex string"

How do I get this to work and where will it store the private key and address?


texts:
I am syncing my local node with rospten test network with geth sync --fast, but it takes more than 24 hours, though 99% complete, i am not able to communicate with my token contract that was deployed in ropsten.

All the query like account balance,, symbol, totalsupply etc returns either null or zero in js console

Should i stop syncing?


texts: What are the major risks of Ethereum moving to Proof of Stake?

texts: There has been discussion about the motivations and benefits of moving to Proof of Stake.  For a risk-benefit analysis of moving to Proof of Stake, what are the major risks?


texts:
When I use add() function from Solidity SafeMath library, I get infinite gas requirement in remix (and this reflects in transactions that wont go through).

Simplified example:

function someFunction() internal view returns (bool) {
    uint256 a = 23;
    uint256 b = 48;
    return (a.add(1) > b);
}

SafeMath is included.

What is wrong?

Here is paste of SafeMath included:

https://pastebin.com/C4FVyBFa

Version used:

pragma solidity ^0.4.24;


texts: Token contract user balance and wallet user balance are different?

texts:
I created a token/crowdsale contract using the code from the official tutorial and I set the price per token to be 20 finney. Then I sent the contract 1 ether, but what I got instead was 0.000000000000000050 tokens (in my account). However, when I went directly to the token contract and check the balance using the balanceOf function, it shows 50. Is this a display issue or did I do something wrong?

This is my crowdsale contract:

pragma solidity ^0.4.16;

interface token {
    function mintToken(address receiver, uint amount);
}

contract Crowdsale {
    address public beneficiary;
    uint public amountRaised;
    uint public price;
    token public tokenReward;
    mapping(address => uint256) public balanceOf;

    event FundTransfer(address backer, uint amount, bool isContribution);

    function Crowdsale(
        address ifSuccessfulSendTo,
        address addressOfTokenUsedAsReward
    ) {
        beneficiary = ifSuccessfulSendTo;
        price = 20 finney;
        tokenReward = token(addressOfTokenUsedAsReward);
    }

    function () payable {
        uint amount = msg.value;
        balanceOf[msg.sender] += amount;
        amountRaised += amount;
        tokenReward.mintToken(msg.sender, amount / price);
        FundTransfer(msg.sender, amount, true);
    }

    function safeWithdrawal() {
        if (beneficiary == msg.sender) {
            if (beneficiary.send(amountRaised)) {
                FundTransfer(beneficiary, amountRaised, false);
            }
        }
    }
}


texts: How to create contract in geth private blockchain network?

texts:
I am able to publish my contract in testrpc , but when i am trying to publish same contract in geth, i am getting below error:

creation of lease errored: Gas required exceeds limit: 3000000. An important gas estimation might also be the sign of a problem in the contract code. Please check loops and be sure you did not sent value to a non payable function (that's also the reason of strong gas estimation).

Though I have 26000 ether in my account.
Any suggestion what am i doing wrong?


texts:
I am trying to attach geth.ipc by using following command.

geth attach ./.ethereum/geth.ipc

But getting below error.

  Fatal: Unable to attach to remote geth: dial unix
  ./.ethereum/geth.ipc: connect: connection refused

Note : geth.ipc file exists that i checked using sudo find -name *.ipc command and it returns me ./.ethereum/geth.ipc and it was working till yesterday.


texts:
I am trying to find the number of transactions in the Ethereum network using web3. I couldn't find any web3 functions to get the same.

I could see etherchain.org and some other network browsers have implemented the same. I tried to dig into their codes and found nothing useful. Found another thread on the same topic Where can I find transactions per second statistics? saying divide the number of transactions per day and the number of seconds per day, but wondering how to find the number of transactions per day.


texts:
The idea of a stablecoin in Ethereum is to create a token that is pegged to the price of say $1 USD.

What are the main ways of achieving a stable cryptocurrency?  What DApps are implementing them and how are their approaches different?


texts: Mist error: "Could not compile source code"

texts: Image contains the error and code i have written. I have use inheritance in my code.


texts: I was running a node on my vps and my coinbase account was hacked. could anyone tell me what would be the default command to start geth on port 8545. Thank you


texts: In ethereum private blockchain, how to get list of transactions of particular address?

texts:
I build own ethereum private blockchain.Generating address and assign to users.Now how I will get the transaction info If user make payment from any third party api to our generated address then how I will get the detail of transactions.

1) Please confirm me one thing from using any other third party API.User can make payment in our ethereum private blockchain address.

2) How do I get the transaction list of each address.


texts: How to store asynchronous callback values in an variable?

texts:
I am using ReactJS+Metamask for the web UI development. Since Metamask doesn't support synchronous approaches, I need to use callback functions to get my public variables. I found that with in the callback function, both alert() and console.log() can represent the correct variable. However, I want to store the value in an variable and display it in a list. But it seems that I cannot return this value or assign it to an existing variable.

Here is the code where numIssuer is a public variable in my contract. num will represent as undefined if I use console.log(num) after this:

var num = myContract.numIssuer(function(err,res){
    num = res;
});

or

var num;
myContract.numIssuer(function(err,res){
    console.log(res);
});

I am very new for front-end development. Is the problem with React or with web3?


texts: cant transfer ether from account to account in a solidity smart contract

texts:
pragma solidity >=0.4.21 <0.7.0;

contract Insurance {

    address payable public contractOwner;

    struct InsuranceTaker {
        string name;
        string vehicleNo;
        address insuranceTakerAddress;
        bool policyValid;
        uint lastPayment;
    }

    constructor() public {
        //contractOwner will have the address of the account that first deployed the smartContract
        //in our case the appropriate insurance company
        contractOwner = msg.sender;
    }

    mapping(address => InsuranceTaker) public insuranceTakers;

    //can be annual, half-yearly, quaterly or monthly
    uint public policyPeriod = 30;

    function signUp(string memory _name, string memory _vehicleNo) public payable returns(uint) {
        //to check if new insurance taker has enough ether in their account
        require(msg.sender.balance > 10 ether, "Not enough ether!");
        //setting the structure variables
        InsuranceTaker storage customer = insuranceTakers[msg.sender];
        customer.name = _name;
        customer.vehicleNo = _vehicleNo;
        customer.insuranceTakerAddress = msg.sender;
        //first premium to be paid upfront
        //first premium paid to the insurance company
        //require(msg.value == 0.01 ether,"err1");
        contractOwner.transfer(getPremium());
        customer.policyValid = true;
        customer.lastPayment = now;
        return (200);
    }

    //calculates and returns the premium to be paid by the insurance taker
    function getPremium() public payable returns(uint256) {
        //insuranceTaker customer = insuranceTakers[insuranceTaker];
        //premiumAmount = 1 ether;
        return 1 ether;
    }

    //to check if a insurance taker is currently insured
    function isInsured(address insuranceTaker) public view returns(bool) {
        InsuranceTaker storage customer = insuranceTakers[insuranceTaker];
        return (customer.policyValid && (customer.lastPayment + policyPeriod < now));
    }

    //modifier onlyBy(address _account) {
    //    require(msg.sender == _account,"errrr");
    //    _;
    //}
    //calculates the damage amount to be paid to insurance taker in case an accident occours
    //function damageCalculator() public onlyBy(contractOwner) view returns(uint) {
    //    return(1 ether);
    //}

    uint public damageAmount = 2 ether;

    //
    function payPremium(address insuranceTaker) public payable {
        InsuranceTaker storage customer = insuranceTakers[insuranceTaker];
        require(isInsured(insuranceTaker),"err2");
        //premiumAmount = getPremium();
        require(msg.value == getPremium(),"err3");
        contractOwner.transfer(msg.value);
        customer.policyValid = true;
        customer.lastPayment = now;
    }

    //claim function
    function claim() public payable {
        require(isInsured(msg.sender),"sorry signup for the policy first!");
        msg.sender.transfer(damageAmount);
    }
}


texts: clique 2 nodes stuck mining after outage for one of them

texts:
i have setup a network of 3 nodes, with 2 of them being sealers (clique) and a third one acting as a proxy.

I know there should be an odd number of nodes to avoid split brain scenarios, but the goal was to freeze the work if either of them was offline and to provide read only access (Write queued) from the third node meanwhile.

The problem is that after a power outage for one of the nodes - both sealers are saying 'Signed recently, must wait for others' and no blocks are mined further.

How can i overcome the situation and keep the network running?


texts: Metamask error - Denying load of chrome extension

texts:
I receive this error when trying to send ETH to my smart contract for tokens.
I am able to whitelist Account 1 but when trying to buy tokens with my 2nd Account or whitelist the 2nd Account this error shows.
Denying load of chrome extension - Resources must be listed in the web_accessible_resources manifest key in order to be loaded by pages outside the extension.
Error is found in google chrome console
inpage.js:1 Uncaught TypeError: Cannot read property 'subscription' of undefined
    at t.exports.data (index.js:105)
    at u (inpage.js:1)
    at t.exports.a.emit (inpage.js:1)
    at a.<anonymous> (inpage.js:1)
    at u (inpage.js:1)
    at a.emit (inpage.js:1)
    at inpage.js:1
    at l.write [as _write] (inpage.js:1)
    at b (inpage.js:1)
    at inpage.js:1
    at l.v.write (inpage.js:1)
    at a.y (inpage.js:1)
    at h (inpage.js:1)
    at a.s.emit (inpage.js:1)
    at _ (inpage.js:1)
    at w (inpage.js:1)
    at a.b.push (inpage.js:1)
    at t.exports._write (inpage.js:1)
    at b (inpage.js:1)
    at inpage.js:1
    at t.exports.v.write (inpage.js:1)
    at o.y (inpage.js:1)
    at h (inpage.js:1)
    at o.s.emit (inpage.js:1)
    at _ (inpage.js:1)
    at w (inpage.js:1)
    at o.b.push (inpage.js:1)
    at o._onMessage (inpage.js:1)
data @ index.js:105
u @ inpage.js:1
a.emit @ inpage.js:1
(anonymous) @ inpage.js:1
u @ inpage.js:1
a.emit @ inpage.js:1
(anonymous) @ inpage.js:1
write @ inpage.js:1
b @ inpage.js:1
(anonymous) @ inpage.js:1
v.write @ inpage.js:1
y @ inpage.js:1
h @ inpage.js:1
s.emit @ inpage.js:1
_ @ inpage.js:1
w @ inpage.js:1
b.push @ inpage.js:1
_write @ inpage.js:1
b @ inpage.js:1
(anonymous) @ inpage.js:1
v.write @ inpage.js:1
y @ inpage.js:1
h @ inpage.js:1
s.emit @ inpage.js:1
_ @ inpage.js:1
w @ inpage.js:1
b.push @ inpage.js:1
o._onMessage @ inpage.js:1
setTimeout (async)
u @ inpage.js:1
a.emit @ inpage.js:1
(anonymous) @ inpage.js:1
u @ inpage.js:1
a.emit @ inpage.js:1
(anonymous) @ inpage.js:1
write @ inpage.js:1
b @ inpage.js:1
(anonymous) @ inpage.js:1
v.write @ inpage.js:1
y @ inpage.js:1
h @ inpage.js:1
s.emit @ inpage.js:1
_ @ inpage.js:1
w @ inpage.js:1
b.push @ inpage.js:1
_write @ inpage.js:1
b @ inpage.js:1
(anonymous) @ inpage.js:1
v.write @ inpage.js:1
y @ inpage.js:1
h @ inpage.js:1
s.emit @ inpage.js:1
_ @ inpage.js:1
w @ inpage.js:1
b.push @ inpage.js:1
o._onMessage @ inpage.js:1
postMessage (async)
o._write @ contentscript.js:1
b @ contentscript.js:1
(anonymous) @ contentscript.js:1
v.write @ contentscript.js:1
y @ contentscript.js:1
h @ contentscript.js:1
s.emit @ contentscript.js:1
_ @ contentscript.js:1
w @ contentscript.js:1
b.push @ contentscript.js:1
_write @ contentscript.js:1
b @ contentscript.js:1
(anonymous) @ contentscript.js:1
v.write @ contentscript.js:1
y @ contentscript.js:1
h @ contentscript.js:1
s.emit @ contentscript.js:1
_ @ contentscript.js:1
w @ contentscript.js:1
b.push @ contentscript.js:1
_write @ contentscript.js:1
b @ contentscript.js:1
(anonymous) @ contentscript.js:1
v.write @ contentscript.js:1
y @ contentscript.js:1
h @ contentscript.js:1
s.emit @ contentscript.js:1
_ @ contentscript.js:1
w @ contentscript.js:1
b.push @ contentscript.js:1
o._onMessage @ contentscript.js:1
localhost/:1 Denying load of chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/sourcemaps/inpage.js.map. Resources must be listed in the web_accessible_resources manifest key in order to be loaded by pages outside the extension.
index.js:1 GET chrome-extension://invalid/ net::ERR_FAILED


texts: Can someone explain what this line does?

texts:
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)

What is the purpose of this line?

https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/ownership/Ownable.sol


texts: What is the best secured way to let users interact with a tokens minting function?

texts:
I have an ERC20 tokens contract with a function to mint tokens.

This function allows users to mint tokens after performing specific actions or activities on a website.
If a user performs the action successfully, he will be able to send a transaction with the mint function and receive tokens.

My workflow and problems:
In order to prevent users from interacting directly with the contract and mint as many tokens as they want, the contract only allows a certain eth address to call the mint function. That certain address will be set up on a server  and sign the transactions if the actions were performed successfully.
However, that means that this address will also have to pay for the gas.

Currently I am thinking about implementing another contract that will act as the only address that can call the mint function on the ERC20 contract.
This new contract will receive a transaction from the user that incorporates variables, strings and nonce signed and hashed by the server address. The new contract will be able to decipher the data and know that the transaction really was approved by the server, and call the mint function from the tokens contract.
That way users won’t be able to try and mint tokens directly or re-send transactions over and over to get more tokens.

A possible and simple implementation of this I've envisioned as follow:

The server signs three pieces of information: the user's address, amount to be minted and an integer to be incremented with every transaction(aka mintRequestId) - this incrementation can be random.
Those three hashed strings are passed to my user's client side logic and serve as arguments to my contract's method which is prompt to send:

myContract.methods.Mint( signedAddresses , signedMintAmount, signedMintRequestId ).send({from: userWallet})

On my contract I ecrecover the three argument using my server's wallet public key and:
A. compare msg.sender to signedAddresses.
B. Get the amount.
C. Make sure the mintRequestId is greater than the one saved in the contract.
If all requirements are met the contract approves the minting and mintRequestId on contract changes.

Is this approach possible? too simple? where are the weak spots and how will you mend them?
Any help and input on this matter would help!

Thank you.


texts: Understanding the formal description of a transaction and its associated refunds

texts:
Excerpt from page 8 of the yellow paper:

I fully understand that contracts can self-destruct and, when that happens, according to this thread, all the balance is refunded to the address specified as a parameter.

In equation 64, is that what happens? Are all balances of accounts destroyed in a state transition added up? The only prior reference to a function named R is within the context of transaction receipts and I'm skeptical that is what is added up here.

If yes, what is the rationale behind the next equation, no. 65, to set a limit on the refund?

Scenario:

Gas limit is 60,000 and gas price 5 gwei
Transaction uses only 20,000
An account holding 1,000,000 gwei or ㆔0,01 is destroyed in the process
As Tg is 60,000 and g' is 40,000, ((Tg - g') / 2) is 10,000 which, at the rate of 5 gwei, means 50,000 gwei or ㆔0,00005

Would the caller be refunded only g' + ㆔0,00005 instead of g' + ㆔0,01?


texts:
I am using geth --dev --ipcpath ~/.ethereum/geth.ipc --minerthreads=5 console to run privatenet. So i use Etherium wallet to interact with it.

The problem is that i need to do some transfer transactions to confirm other transaction (deploy contract, etc.) bcs mining going on only after some action from Eth. Wallet, is it possible to do it without dealing a lot of transfers? So i need something like:

deploy contract transaction
wait a moment
see 12/12 confirmations of transaction


texts: send ether from one contract to another automatically

texts:
I want to transfer ether from Child Contract to Parent Contract automatically whenever someone send ether to child.

In fallback function i tried to run the function and it is giving error:
VM error: revert.
revert  The transaction has been reverted to the initial state.
Note: The constructor should be payable if you send value.  Debug the transaction to get more information.

Please tell me where i am doing wrong, i tried to run it by allocating more gas too, no luck.

Here is the code.

pragma solidity ^0.4.18;

contract ParentCompany{
    address public parentAddress;

    function ParentCompany() public{
        parentAddress = msg.sender;
    }
    function getB() public view returns(uint){
        return this.balance;
    }

    function() payable {
    }
}

// Subsidiary will automatically transfer received ether to Parent.
contract Subsidiary{

    address public subsidiaryAddress;
    address parentCompany;
    function Subsidiary(address _parentCompany) public payable{
        subsidiaryAddress = msg.sender;
        parentCompany = _parentCompany;
    }

    function sendToParent() public {
        parentCompany.transfer(this.balance);
    }
    function() payable{

        sendToParent();
    }
}

// when Fallback function is empty it works fine.

// client will send money to Subsidiary Company
contract Client{
    address clientAddress;

    function Client() public payable{
        clientAddress = msg.sender;
    }
    function payment(address _subCompany, uint _amount) public{
        uint amount = _amount *(10**18);
        _subCompany.transfer(amount);
    }

}


texts: ERC-20 token address on Rinkeby for testing

texts:
I am looking for addresses of ERC-20 tokens on Rinkeby in order to test my smart contract. I know that I can find a lot of them at https://rinkeby.etherscan.io/.
However, it would be nicer if there are some that works as kind of reference for testing purposes, with lots of operations etc. Does anyone know?


texts:
Just like question Connecting to blockchain on azure using web3.js and websocket, I need to use websockets to capture events.

I have gotten my http and websocket endpoints from the deployment outputs page.

The http endpoint accepts a connection, the web socket endpoint does not.

The following code works 100% on ganache but says that the http connection is good and the ws connection is bad on Azure.

const Web3 = require('web3');

async function wtf() {

    let web3http = new Web3(config.addrCurr);

    let accounthttp = web3http.eth.accounts.privateKeyToAccount('0x' + config.privateKey);

    try { await web3http.eth.getTransactionCount(accounthttp.address); console.log("http good"); } catch (e) { console.log("http error: " + e); };

    let web3ws = new Web3(config.wsCurr);

    let accountws = web3ws.eth.accounts.privateKeyToAccount('0x' + config.privateKey);

    try { await web3ws.eth.getTransactionCount(accounthttp.address); console.log("ws good"); } catch (e) { console.log("ws error: " + e); };

}

wtf();


texts: Ethereum Remix : Console trow an error: 'unexpected token: identifier'

texts:
I'm follow this tutorial to learn about smart contract on Ethereum.This is the pieces of code I already made.

pragma solidity ^0.4.24;

// Naming the contract
 contract MyContract {
   string value;

   constructor() public{
     value = 'myValue';
   }

   function get() public view returns(string){
    return value;
   }

   function set(string _value) public {
    value = _value;
  }
 }

But when I try to run it... Console throw an error --> 'unexpected token: identifier'


texts:
since I just upgraded my rig I got my old GPU laying around doing nothing, so I thought I might start to mine with it.

Its an XFX HD 6950 with 2GB of RAM.

Im running the following config:

Biostar A68N-2100 (had that thing laying around)
AMD Fusion APU E1-2100 Dual-Core Processor
8 GB DDR3 RAM
Windows 7 64bit
Virtual Memory set to 16 GB

Im getting DAG allocation errors though...

I tested the following graphics drivers;
- 14.1 beta
- 14.4
- 15.12

Using those variables in my .bat file:

setx GPU_FORCE_64BIT_PTR 0
setx GPU_MAX_HEAP_SIZE 100
setx GPU_USE_SYNC_OBJECTS 1
setx GPU_MAX_ALLOC_PERCENT 100
setx GPU_SINGLE_ALLOC_PERCENT 100

geth is properly synced & I'm using ethminer-0.9.41-genoil-1.1.7.

Can anyone help me with my issue?

EDIT:
Would it be possible to run it in my main rig (RX 580) as a secondary card?

(I know this rig (cpu & gpu) is not powerfull but I wanted to try it anyways and I could swap the mb & cpu out for a better one)


texts:
On Remix, when implementing the contract suggested here - https://www.youtube.com/watch?v=JHrQ3l2tT78 - I'm getting the error "This contract does not implement all functions and thus cannot be published."

I've seen other posts saying that the constructor function needs to list parameters, but I've tried adding parameters to "NewToken" without success.  Perhaps I'm adding these wrong, but given that the tut doesn't have any, I figure I might be doing something else wrong.

Appreciate any help.

pragma solidity ^0.4.11;

import './IERC20.sol';

/**
 * @title Standard ERC20 token
 */
contract NewToken is IERC20 {

    uint public constant _totalSupply = 1000000;
    uint8 public constant _decimals = 3;
    string public constant _symbol = 'NTK';
    string public constant _name = 'NewToken';

    mapping(address => uint256) balances;
    mapping(address => mapping(address => uint256)) approved;

    function NewToken() public {
        balances[msg.sender] = _totalSupply;
    }

    function decimals() public constant returns (uint8 decimals) {
        return _decimals;
    }

    function totalSupply() public constant returns (uint256 totalSupply) {
        return _totalSupply;
    }

    function balanceOf(address _owner) public constant returns (uint256 balance) {
        return balances[_owner];
    }

    function transfer(address _to, uint256 _value) public returns (bool success) {
        require(
            balances[msg.sender] >= _value && _value > 0
        );
        balances[msg.sender] -= _value;
        balances[_to] += _value;
        Transfer(msg.sender, _to, _value);
        return true;
    }

    function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
        require(
            approved[_from][msg.sender] >= _value && balances[_from] >= _value && _value > 0
        );
        balances[_from] -= _value;
        balances[_to] += _value;
        approved[_from][msg.sender] -= _value;
        Transfer(_from, _to, _value);
        return true;
    }

    function approve(address _spender, uint256 _value) public returns (bool success) {
        approved[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
        return true;
    }

    function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
        return approved[_owner][_spender];
    }

    event Transfer(address indexed _from, address indexed _to, uint256 _value);

    event Approval(address indexed _owner, address indexed _spender, uint256 _value);

}

IERC20.sol

pragma solidity ^0.4.11;

interface IERC20 {
    function decimals() public constant returns (uint8 decimals);
    function totalSupply() public constant returns (uint256 totalSupply);
    function balanceOf(address _owner) public constant returns (uint256 balance);
    function transfer(address _to, uint256 _value) public returns (bool success);
    function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
    function approve(address _spender, uint256 _value) public returns (bool success);
    function allowance(address _owner, address _spender) public constant returns (uint256 remaining);
    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}


texts: Balance of the account doesn't change after executing payable method

texts:
I have a problem when invoking a payable method. The funds are being transferred to a contract (the balance of the contract changes). However, the balance of the account who is sending a transaction is still the same. I am using solidity 0.4.18 and testrpc. Here is the code that I am using:

event NewHighestBid(address bidder, uint amount, bytes32 auctionName, bool test);
function bid(bytes32 _auctionName) payable {
NewHighestBid(msg.sender, msg.value, _auctionName, true);
}

I followed the documentation, but the the balance of the account is not changing for some reason.


texts: I wanted to know if a Private Protected Network be cloned/replicated to have a backup of the network, which would be helpful in times of network failure.


texts:
I'm using this code to send transactions in test network(Morden):

var transactionObject = {
    to: '**addresses are below**',
    gasPrice: 22000000000,
    gas: 42000,
    value: 1
}
var callback = function(error, result) {
    if (!error) {
        console.log(result);
    }
    else {
        console.log(error);
    }
}
web3.eth.sendTransaction(transactionObject, callback)

Address: 0x0000000000000000000000000000000000000001
Gas used: 24000
Txhash: 0x18e5810b87b2fc22f1e2493643d13c94510938a6c4f4b857fad8072e374ac63c
Additional: Consumed more than usual gas. This is not a contract address.

Address: 0x0000000000000000000000000000000000000002
Gas used: 21060
Txhash: 0xde9cc279c1a5e03915f202ddf3f1893d2f8ea9cd4c1baadf214ee4aaedb81390
Additional: Consumed more than usual gas. This is not a contract address.

Address: 0x0000000000000000000000000000000000000003
Gas used: 21600
Txhash: 0x6669cf3f54f727ca1485e104b691760e985e57cc2dc511218d124f3edf9f158a
Additional: etherscan.io shows that this address received only one transaction(my transaction with value 1 wei), but the the balance of this address is 8 wei. How is that possible?

Address: 0x4fdd50D0FFd2D430b0181a9c2882FEbc87b79F40
Gas used: 21000
Txhash: 0x8aee5c80edbc5fe8bbfef13a0693d6a4752a44443131597d960e95673b2e19cf
Additional: Transaction to a normal looking address consumed a normal amount of gas.

Why do transactions to certain addresses(not contract addresses) consume more gas? I have a hunch that these addresses are used for something special. If so, where can I get the list of this special addresses?


texts: Truffle Test: How to Run n times the same function

texts: Since I have to study the variation of the gasUsed of a function, using Truffle Test is it possible to do a test that runs n times the same function without going out of gas or exceding the block gas limit?


texts: Need help identifying where coin transfer is and how to get it back

texts: I Transferred some ENJ coins from my DeFI wallet to what I thought was my Trading account wallet. Long story short the address it I was sent too was off by one number. About 3/4 of the way into the address it’s a 3 and was supposed to be a 2. Everything else is exactly the same address wise. The ENJ is sitting in the address it was sent too but no body owns the address and I’m not sure if it’s a wallet or not. The address never existed besides when I transferred over to it. So literally it never ceased to exist until I sent. No prior history of transaction, no movement of the coins. No one owns it. I’ve tried to see if it’s an ETH wallet address and have gotten different answers from different sights. Please any information is helpful trying to be pointed in the right direction. Yes I’ve already contacted my wallet provider, the trading platform, ENJ support, and I’ve tried to get in contact with ETH support but have not heard from them in 2.5 weeks.


texts:
I have previously mined on a Sapphire Radeon Nitro R7 370: the hash rate was roughly 13Mh/s.

I decided to upgrade and bought a Sapphire Radeon Nitro R9 390. Knowing of a bottleneck, I have overclocked the first GPU to parameters of the second (which is the primary video card).

First of all, I find it surprising that the total hash rate is barely 33Mh/s.

Secondly, when I run ethminer, both GPU's work at 100% but there are barely any solutions being found (I'm mining in a pool). The power unit is large enough to accommodate both GPU's, I've tried removing the old GPU but it did not help at all. Reinstalled windows but still no luck. I've also overclocked the PCI-e speed to 150Mhz. No luck. I do understand that its not a pool issue, but rather hardware related.

Latest drivers installed, tested the videocards by playing different games, but it worked fine. Any suggestions to possible solutions?


texts: What are some guideline specifications for running a full Ethereum node using Geth 1.8?

texts: I'm keen to run a full Ethereum node to support the network. What are the guideline hardware requirements for this?


texts: ICO - question regarding private network

texts:
my team and I have been working on developing an application, based on a private ethereum network, due to the high gas cost of our contracts on the main chain.

Now we would like to proceed to the next stage and start an ICO and our idea was to use the main network during the crowd sale to generate our tokens. And then move these to the private network. What would be the best possible way/pattern to do so in a safe, transparent manner?


texts: Any way to do compile-time computation using rational_const and a constant value?

texts:
Of the following three declarations

ufixed constant TEST1 = 256;
uint constant TEST2 = 256;
uint[] testTable1 = [uint(0.001 * TEST1), uint(0.01 * TEST1), uint(1.1 * TEST1)];
uint[] testTable2 = [uint(0.001 * TEST2), uint(0.01 * TEST2), uint(1.1 * TEST2)];
uint[] testTable3 = [uint(0.001 * 256), uint(0.01 * 256), uint(1.1 * 256)];

only testTable3 works.

testTable1 gives the error

UnimplementedFeatureError: Not yet implemented - FixedPointType.

and testTable2 gives one error for each element of type

 TypeError: Operator * not compatible with types rational_const 1 / 1000 and uint256

Is there a way I can define such an array without having to specify the multiplication factor in each element?

solidity ^0.4.24;


texts: Can't Verify Contract on etherscan.io or etherchain.org

texts:
I've deployed a contract, which I generated using Mist but I can't seem to get it to verify.

At etherscan.io I keep getting the error:

    Error! Invalid constructor arguements provided. Please verify that they are correctly ABI-encoded

[I'm really growing to hate that 'arguements' typo!]

even though I'm copying the ABI directly from Mist [and
I've checked I'm using the correct compiler version].

I've also tried verifying on etherchain.org but that does bugger all. I just get the text on the submit button changing to Verifying... but nothing happens.

None of the above is helped by the fact that I'm not entirely sure, when either of these sites asks me to paste in the 'contract code', whether they're looking for the original Javascript version or the complied bytecode version. although I've tried pretty much every combo I can think of.

Anyone got either of these sites to verify a contract?... and, if so, could you provide an idiot's guide to how you did it?

[I didn't think I was an idiot 'til I tried expanding my cryptocurrency interests into Ethereum but it's been like pulling teeth getting any of the software to work properly!]


texts: Can I recover the ETH wallet I created using Geth after reinstalling Windows?

texts:
I installed Geth and ran some mining activities, using the nanopool network.
When I built the wallet I mined with, I followed the directions here: https://geth.ethereum.org/docs/interface/managing-your-accounts
The blockchain caused a major hard drive failure, and I had to reinstall windows.
Did I lose my wallet?


texts: About transaction higher nonce than current nonce

texts:
I'm trying to build an Ethereum exchange service, so concurrent schedule is needed and nonce management is the most problem (another topic discussed about it). At specificed moment, I have large request of transactions (txs), so I'm using redis and physical database to storage current nonce and update it +1 while ending (often get nonce from redis, if redis is dead, switch to physical db).
When testing, nonce from redis occasionally is higher than current valid nonce (getTransactionCount), it will be marked as successful transaction (tx) with a valid hash is returned:

Example current nonce is 50, create list txs with higher nonce such as 51, 52,... is all valid and return valid hashes.

The problem at there is if nonce 50 is not filled by a specificed tx, list txs with higher nonce than 50 will wait for a period time and I don't know when it will be expired. I've test a half day to full day but they're not expired. When I create a tx with nonce 50, after a short time, list txs higher none +50 will be broadcasted automatically and become successfull too. I know that I can cancel these txs by creating a self transaction with higher gas but it's not the problem I'm facing.

So, I have 2 question, where can I find list txs higher nonce than current valid nonce eg etherscan.io or my node though I've storaged them on physical DB. And 2nd question is if I don't fill a missing nonce to chain, will list txs be expired for a period time (how long) or they're storaged forever, if I wanna cancel them I must create self transaction with higher gas? Thanks for hearing me so much and have a nice day.

//I'm creating a schedule, which check nonce from node and redis if they're diffrent, create a self transaction with nonce from node but I think this is not a good resolve...


texts:
at the moment I am learning to do my test ICO on rinkeby test net. i am doing all the coding on my windows computer, but my node is running on a Linux server. My goal is to do a fully functional ICO on rinkeby testnet that my friend would be able to participate in.

At this point in time by watching tutorials online I have managed to deploy the coin to the rinkeby network and it’s address is 0x1a41Ec0118aA521d01Ca881B91C751a4e14ba447 But what follows next? How do I make an actual coin offering? Do i need to deploy new smart contract at the same address? Do i need to modify the existing contract and deploy it again? What are my next steps? P.S. I need to finish the ICO without using the Remix IDE

Code of my contract:

pragma solidity ^0.4.18;

import ‘zeppelin-solidity/contracts/token/ERC20/StandardToken.sol’;
import ‘zeppelin-solidity/contracts/ownership/Ownable.sol’;

contract TestToken is StandardToken, Ownable {

  string public name;
  string public symbol;
  uint public decimals;

  function TestToken() public{
    name = “Test Token”;
    symbol = “TST”;
    decimals = 18;
    totalSupply_ = 1000000 * 10 * uint(decimals);
    balances[msg.sender] = totalSupply_;
  }
}


texts:
I'd love to switch from JS to Go on our back-end, but the constant development of web3 is such a boon. I can see some web3 wrappers for Gopherjs, and of course it's easy to do direct RPC calls with Go, but is there another way?

EDIT: Here's how.

You want to use the Go-Ethereum client directly at http://github.com/ethereum/go-ethereum , and instantiate their Ethclient struct. It has RPC methods written for you. Here's an example:

    client, err := ethclient.Dial("https://ipaddress-to-infura-or-something") // instantiate a new RPC connection
    var parsedTx types.Transaction // types.Transaction is also from the go-ethereum library
    err = json.Unmarshal([]byte(tx.SignedTransaction.String), &parsedTx) // this part is more specific to my use case, but I basically have a signed transaction in RLP encoded form that Im sending in as data for my RPC call.
    if err != nil {
        return err
    }
    err = client.SendTransaction(context.TODO(), &parsedTx) // here I actually call the SendTransaction function, which is like eth_sendRawTransaction RPC opcode.
    if err != nil {
        return err
    }

More info on whats available here: https://github.com/ethereum/wiki/wiki/JSON-RPC

Here is the Ethclient code itself: https://github.com/ethereum/go-ethereum/blob/master/ethclient/ethclient.go


texts: Trying to get a refund from my DAO results in "out of gas"

texts:
I'm trying to get the ETH refund from my DAO, following the instructions here (but with Parity 1.4.4).

The approve transaction is here.

But I already tried to send the withdraw transaction twice, in both cases it's out of gas, why? The attempts:

1st
2nd

Thanks in advance.


texts: How to use geth monitor to view txpool metrics?

texts:
I would like to view Ethereum txpool. From geth command line page it seems like I can use geth monitor to get a view of the txpool metic. But there aren't many document on how to use the tool.

Does anyone know a good example of using geth monitor?


texts: Too many request to node to get gas limit

texts: When I need get gaslimit I call to node by web3j(java) by function ethEstimateGas to get gas amount used and I have cronjob to get ```gasPrice```` from etherscan. Follow by number of request can handle by ETH node so I possibly cannot contact with ETH node. How can I "smarter"  to solve this problem?


texts:
While creating solidity contract on Browser solidity I am facing this error?

callback contain no result Error: Invalid JSON RPC response: ""

Can someone please help me resolve it?

pragma solidity ^0.4.2;

contract SimpleStorage{

    uint storedData;

    function set(uint x){
        storedData=x;
    }

    function get() constant returns(uint retVal) {
        return storedData;
    }

}


texts: Quorum: Generating Public Key for a Given Address

texts:
I stood up the 7nodes example. There is a public key:

ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc=

provided for the privateFor field in order to change a contract value while keeping it private.

How was this value derived? Can it be done for other accounts?


texts: get the return value of payable function?

texts:
Let's say there's a payable Solidity function

function doSomething()
  payable
  returns(uint)
{
  require(msg.value == 1 ether);
  return 1;
}

And you call this function

instance.doSomething({
      from:_account,
      value:1 ether
    }).then(function(value) {
    }).catch(function(err) {
    });

This will send ether to the function, make transaction and will return the transaction result. Cool.

But how can I get the return value of that Solidity function? Transaction record does not have anything about it.

'instance.doSomething.sendTransaction()' also the same situation.

Because the function is payable, it should receive ethereum.

Many thanks,
coindevbw


texts: Calling a contract function in Geth console after mining the contract

texts:
I got the message :
Contract mined! address: 0x72b878799d98131bca157ccaccfcd386023147e9 transactionHash: 0x66b9436240103e79c07492fe2479d97eeaa6c45779d00e1fc126285072eba327

for example, and there is a function named test() in the contract named foocontract.
how to call test() according to the contract address in geth console?


texts: Upgradable contract proxy pattern: Get the invoked method name in the fallback function

texts:
I have a proxy smart contract and I would like to get the name of the called method in the fallback function. Is there a way?

For example, if I call the function getName() (stored in the logic contract), then in the fallback function (of the proxy contract) I would like to get the invoked function name, in this case getName.

contract Proxy {
  function () payable external {
    /* I would like to get here the name of the invoked function */
    _fallback();
  }

  function _fallback() internal {
    _willFallback();
    _delegate(_implementation());
  }

  function _implementation() internal view returns (address);

  function _delegate(address implementation) internal { ... }

  function _willFallback() internal { }
}

Please, check here the full code of the proxy smart contract


texts: Cryptographic limit to total accounts on Ethereum

texts: Factoring in birth day attacks and all that, with 256-bit elliptic curve cryptography, what is the maximum number of accounts that are secure? It isn't 2^256 since then any time you generate a random number you find a used account. Birth day paradox and all that, what is the upper limit of how many accounts Ethereum actually supports? (Not at all factoring in transactions per second limits, just asking from a cryptography PoV. )


texts:
When users withdraw ETH from our website then users must pay fee the transaction. So what should be the Fix fee for each withdrawal?

For example

User want to withdraw 0000001233489520 wei from our website

then how much wei i should decrease from the deposit amount to charge user for the fee?


texts:
can you help me to solve the problem when i deploy this code? i try to deploy with ropsten but false Transaction mined but execution failed
this is my transaction hash : 0xf4c734c039a776bc36053168648317eb4c24b71784545ab3101af35d06dc86cf
this is the code : https://pastebin.com/AX09jcxk


texts: I try to create a mineable token .Can anyone help me to add a "proof_work" method to implement a block generate rate : 30 second?

texts:
/* DeomToken Contract */
contract DemoToken {
/* Public variables of the token */
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;

/* This generates a public event on the blockchain that will notify clients */
event Transfer(address indexed from, address indexed to, uint256 value);

/* Initializes contract with initial supply tokens to the creator of the contract */
function DemoToken(
    uint256 initialSupply,
    string tokenName,
    uint8 decimalUnits,
    string tokenSymbol
    ) {
    balanceOf[msg.sender] = initialSupply;              // Give the creator all initial tokens
    totalSupply = initialSupply;                        // Update total supply
    name = tokenName;                                   // Set the name for display purposes
    symbol = tokenSymbol;                               // Set the symbol for display purposes
    decimals = decimalUnits;                            // Amount of decimals for display purposes
}

/* Send coins */
function transfer(address _to, uint256 _value) {
    require (balanceOf[msg.sender] >= _value) ;          // Check if the sender has enough
    require (balanceOf[_to] + _value >= balanceOf[_to]); // Check for overflows
    balanceOf[msg.sender] -= _value;                     // Subtract from the sender
    balanceOf[_to] += _value;                            // Add the same to the recipient
    Transfer(msg.sender, _to, _value);                   // Notify anyone listening that this transfer took place
}

// todo check balance

function getBalance(address addr) returns(uint) {
    return balanceOf[addr];
}

function proofOfwork(){
//help me to fill it ! Thanks

}

}


texts: Connecting to ethereum network using web3 fails

texts:
I'm trying to connect to rinkeby using the following code:

const HDWalletProvider = require('truffle-hdwallet-provider')
const Web3 = require('web3')
const secrets = require("./secret.json");

const provider = new HDWalletProvider(
  secrets.mnemonic,
  'https://rinkeby.infura.io/' + secrets.infura
);
web3 = new Web3(provider);
(async () => {
  console.log(await web3.eth.getAccounts()); //returns undefined
})()

Note its very similar to the github examples but it fails with the following error

/node_modules/web3/lib/web3/property.js:119
            callback(err, property.formatOutput(result));
            ^
TypeError: callback is not a function

I've also tried to use ganache but i get a very similar error when i call web3.eth.getAccounts();

const ganache = require('ganache-cli')
const web3 = new Web3(ganache.provider());

Error:

callback is not a function
    at /projects/campaignM/node_modules/web3/lib/web3/property.js:119:13


texts: Are events in a contract triggered after that particular transaction is mined?

texts:
Let's say I have an event notify() in a function called buy().

event notify();
   buy(){
   //...
   notify();
}

Problem here is that my the notify watch handle is triggered only after that transaction is mined. Is this how events work? If so, is there alternative to know the transactions happening in my contract instantly?
var filter = contractObject.notify();

filter.watch(function (error, log, data)
 {  console.log(data);  });


texts: I'm new to this Ethereum community and I've been reading about signatures processes in Ethereum and smart contracts processes and always end up finding a general use-case where someone signs a "hello world" message with a private key and someone can verify who did it using its public key. However, I'm having trouble finding a proper real case scenario for this signatures process. Is there anyone who can enlighten me and show me a real use case where I can make use of these signatures?


texts:
I having the ethereum wallet, how can i generate the public key on that.
Any one have idea about that please share it to me

EDITED VERSION:
I have a local Ethereum wallet, in some form. Given that I know the symmetric key to decrypt the private key, how can I get a plaintext, hexadecimal encoded version of the ECDSA public key?


texts:
How does "Gas Price Oracle" work?

"Gas Price Oracle" is explained here in go-ethereum wiki, but it doesn't explain how it works. Where does it get the data from? How does it do its calculations?


texts:
In Remix, I have a Depository smart contract that is supposed to escrow user funds. My first step is to call token.approve with the address of the deployed Depository and amount, but I'm not getting the expected behavior.

pragma solidity ^0.5.11;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.0/contracts/token/ERC20/ERC20.sol";

contract Token is ERC20 {}

contract Depository {
    function transferFrom(uint amount) external {
        Token token = Token(0xFab46E002BbF0b4509813474841E0716E6730136);
        token.transferFrom(msg.sender, address(this), amount);
    }
}

contract Owner {
    function transfer(uint amount) external {
        Token token = Token(0xFab46E002BbF0b4509813474841E0716E6730136);
        // 0xF5c73... is the address of the deployed Depository contract
        token.approve(0xF5c7313cB994A0F8cEee341dC61C15753F775Fcf, amount);

        // Now that Depository is approved to spend amount tokens, instruct it to transferFrom
        Depository depository = Depository(0xF5c7313cB994A0F8cEee341dC61C15753F775Fcf);
        depository.transferFrom(amount);

    }
}

Owner.transfer's token.approve doesn't seem to behave. I'm calling it from an address with 10000 ERC20 tokens and passing 50 as the amount argument. When I invoke transfer, two things happen:

I get the alert: Gas estimated failed. Gas estimated errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? The execution failed due to an exception. Reverted
After clicking Send Transaction anyway, I'm presented with the following Metamask window, which isn't the expected approve transaction.

I'm new to Solidity, and pretty darn stumped. Where am I going wrong?


texts: Automatic buying and selling of created tokens not working. What am I missing?

texts:
Created token using example code from etherum.org for automatic buying and selling but can't buy or sell from another account. What am I missing?

https://ethereum.org/token#automatic-selling-and-buying

Update:

I have transferred tokens to the contract from the owner wallet. This works.
I have set buy and sell prices.

How does any customer buy tokens from me using their Ether? The contract as it is won't allow ether to be sent to it.

If I need a to add a "fallback function" to the contract how is this done? Such a function is not in the example code so have ethereum.org stuffed up?

Why does this part of the contract not function as a fallback? Is it as simple as sending text with the ether transaction?

/// @notice Buy tokens from contract by sending ether
    function buy() payable public {
        uint amount = msg.value / buyPrice;        // calculates the amount
        _transfer(this, msg.sender, amount);       // makes the transfers
    }


texts: How do we compile a contract with pragma solidity 0.5.7 to work with hardfork `istanbul`?

texts:
I am using Truffle to compile the contracts and by default it compiles the contracts with pragma solidity 0.5.7 to evm version petersburg. Is it possible to compile the same contract for evm version istanbul?

A second question is when we compile a contract with older evm version say byzantium and them deploy to mainnet which is running istanbul hardfork then is it true that the istanbul hardfork is running the bytecode compiled by byzantium evm verion? If not, then how exactly does it work?

Thanks


texts:
I have followed the truffle petshop tutorial and it runs in my local machine, I have a shared hosting account and i would like to upload and test this Dapp on my server to start to modify it. The problem is that I don´t have idea how or what files upload to my server to run.

I have cpanel, shh access, node. In the run server do I have to change something?

Thanks a lot


texts: How many full time developers are working on Proof of Stake research?

texts: How many full time Ethereum developers (or full time equivalents) are currently working on PoS research?


texts: Difference between Dapps, digital wallets and smart contracts

texts:
What is the difference between Dapps, digital wallets and smart contracts?

I have just started learning ethereum. So there is much of confusion for me.

From my understanding:

Dapp is an application built using ethereum network.
Digital wallet is personal wallet for my coin when I send coin it goes to ethereum
network.
Smart Contracts are like standard contracts running ethereum network built in Solidity.


texts: Send a transaction with Meteor in the JS file without click "submit" in metamask

texts:
I'm deploying a dapp with Meteor and Metamask.

I would like to send a transaction to the blockchain that is scheduled everyday and sends ETHER to a contract. This function works but when I use web3.eth.sendTransaction to call the function it opens the metamask notification menu and I must click submit.

Is there a way to do this "click" automatically and send the transaction directly from the Javascript file of Meteor?


texts: Parity 1.7 [-32601] Method not found CLOSE

texts:
I just upgraded Parity to 1.7.
The syncing with the Foundation chain has not completed.
I decided to create a new Account while the syncing was happening.
I am using the browser interface.

Everything went until it asked for the owner recovery phrase. I carefully entered this phrase. Clicked the create button. Received this error:

  [-32601] Method not found CLOSE

I tried re-entering the owner recovery phrase. It still doesn't work. Any thoughts on how to resolve this?

Update:
Cross posted on github.


texts: What happens when a suicide operation transfer remaining funds to it’s own contract address?

texts:
equivalent solidity code :

suicide(this);

Does the operation succeeds at not transferring the balances while still erasing the code ?
Or is contract’s code destroyed only after sending balances which means a recursion infinite loop can occur if the contract’s does no stop if called through this way ?


texts: Passing '-1' to a solidity function which takes a 'uint256' argument as input

texts:
Suppose I have:

function func(uint256 x) external {
    ...
}

I would like to test this function via web3.js, with the maximum possible value of x.

In a Truffle test, I have noticed that I can simply call func(-1).

My Truffle version is 4.1.15, which relies on Web3 v0.20.6.

I'm not sure who's in charge of this conversion (whether it's Truffle or Web3), but I would like to know if this a guaranteed behavior as far as web3.js states.

In the documentation of web3.js v1.x there is web3.utils.toTwosComplement(number), which implies to me that such conversion is not guaranteed (but must be performed explicitly using this function).

However, my Truffle version relies on the previous Web3 version, so I am unable to know for sure.

Any idea?

Side note: I know I can use web3.toBigNumber(2).pow(256).minus(1), but I'd rather use the -1 option, which is cleaner IMO.


texts: How do I transfer Ether from multiple account to one account?

texts: I have a vast amount of Ethereum wallets, all packed with Ether. I need to transfer all the Ether to a single account. I don't want to do it manually. Is there a way to script it or use a smart contract or anything else?


texts: I want connect ethereum live network, Is this right?

texts:
I write "eth" in the terminal , then run it . Then I write in my django code.

web3 = Web3(HTTPProvider('http://localhost:8545'))
web3 = Web3(IPCProvider())

web3.eth.getBalance('0x923eb8ac53073E9Eee5376290c2dF47451828F61')//valid address

But it returns 0 . But this address have balance 0.001 . Now what am I doing wrong here? Why is it not connected to the live server ?


texts: How to vote more times in an elections smart contract?

texts:
I have a simple copied smart contract for elections, where a voter votes only one time for one candidate, and then is denied to vote more times.

But would it be possible to allow the voter to vote up to 3 times and sending a vote to a different candidate each time? Meaning when you send more than one vote to one candidate, you would be denied. How would it be done?

The code

contract Election {

struct Candidate {
    string name;
    uint voteCount;
}
struct Voter {
    uint voteIndex;
    bool voted;
    uint weight;
}

address public owner;
string public name;
mapping(address => Voter) public voters;
Candidate[] public candidates;
uint public auctionEnd;

event ElectionResult(string name, uint voteCount);

function Election(string _name, uint durationMinutes, string candidate1, string candidate2, string candidate3, string candidate4, string candidate5) public{
    owner = msg.sender;
    name = _name;
    auctionEnd = now + (durationMinutes * 1 minutes);

    candidates.push(Candidate(candidate1, 0));
    candidates.push(Candidate(candidate2, 0));
    candidates.push(Candidate(candidate3, 0));
    candidates.push(Candidate(candidate4, 0));
    candidates.push(Candidate(candidate5, 0));
}

function authorize(address voter) public {
    require(msg.sender == owner);
    require(!voters[voter].voted);

    voters[voter].weight = 1;

}

function vote(uint voteIndex) public {
    require(now < auctionEnd);
    require(!voters[msg.sender].voted);

    voters[msg.sender].voted = true;
    voters[msg.sender].voteIndex = voteIndex;

    candidates[voteIndex].voteCount += voters[msg.sender].weight;
}

function end() public {
    require(msg.sender == owner);
    require(now >= auctionEnd);

    for(uint i=0; i < candidates.length; i++) {
        ElectionResult(candidates[i].name, candidates[i].voteCount);
    }
}
}


texts: Question regarding Testrpc evm_increaseTime and oraclise

texts:
After creating my contract at t1, which is supposed to be called back from oraclise using Ethereum-bridge at t2. I did a time jump to t2 on testrpc using evm_increaseTime and evm_mine. Yet the callback transition was not considered. How can'I proceed please?knowing that I'm using truffle environment, testrpc, Ethereum-bridge and oraclizeAPI.

This is my constructor :

This is the callBack function :


texts:
When I connect to geth with

geth console

it automatically connects to Main Network. I would like to connect TEST-NET. How I could connect to TEST-NET with geth?

thanks.


texts: function with msg.sender does not return address

texts:
Function returns null address in any case.

pragma solidity ^0.4.9;

contract Test {

    address da;
    function getSender () constant returns (address){
        da=msg.sender;
        return da;
    }
}

Tried through myetherwallet and parity, network is not synchronized.


texts:
I'm using truffle unbox react to bootstrap my dapp. Whenever I run the client end of the application with npm run start, I see that React fails to compile with the following error:

Module not found: Can't resolve 'bignumber.js' in '/node_modules/truffle-contract/lib'

It would be great if someone could advise what to do.


texts: Ask for explanation of some notations in Ethereum opcodes

texts:
I am going to implement EVM for my own project, while reading yellow paper, I can not understand some notations, can anybody help me to clarify them:

what is µ_i in the picture above


texts:
I know that web3 exposes a function to estimate gas limit, but is it accurate when sending to a contract?

AFAIK the amount of gas I'm gonna need if sending to a contract depends on the contract code, so in general case can be anything.

Is there a way to reliably figure out the gas limit for a transaction if it's to a contract before sending it?


texts: Can't unlock account with geth attached to parity on classic chain

texts:
I run parity 2.7.2 on Ubuntu with --jsonrpc-apis=all on the classic chain:
#> parity --chain classic --light --jsonrpc-apis=all
2020-08-05 15:20:15  Starting Parity-Ethereum/v2.7.2-stable-2662d19-20200206/x86_64-unknown-linux-gnu/rustc1.41.0
2020-08-05 15:20:15  Keys path /home/me/snap/parity/16707/.local/share/io.parity.ethereum/keys/classic
2020-08-05 15:20:15  DB path /home/me/snap/parity/16707/.local/share/io.parity.ethereum/chains_light/classic/db/906a34e69aec8c0d
2020-08-05 15:20:15  Running in experimental Light Client mode.
2020-08-05 15:20:16  Debug API is not available in light client mode.
2020-08-05 15:20:16  Debug API is not available in light client mode.
2020-08-05 15:20:16  NAT mapped to external address 92.232.130.197:51585
2020-08-05 15:20:16  Public node URL: enode://97f0db37c1e5ae13d33cab8cec91209fff523b01ebd6aaac52e8b564ab9d63e6a774671954f0b086797a0201cd2230687336343d5422d8e3c5d91704f6f06ece@92.232.130.197:51585+41883
2020-08-05 15:20:21  Syncing #10259391 0xae37…b8ab  1002.6 hdr/s   1870+    0 Qed   9/50 peers   3 MiB cache 1 MiB queue  RPC:  0 conn,    0 req/s,    0 µs
2020-08-05 15:20:26  Syncing #10262810 0x8fef…2693   683.8 hdr/s   7945+    0 Qed  20/50 peers   5 MiB cache 6 MiB queue  RPC:  0 conn,    0 req/s,   19 µs
2020-08-05 15:20:31  Syncing #10270762 0xcb3a…25a5  1590.4 hdr/s      0+    0 Qed  12/50 peers   10 MiB cache 0 bytes queue  RPC:  0 conn,    0 req/s,   19 µs
2020-08-05 15:20:36  Syncing #10278539 0x7275…bee1  1555.4 hdr/s  25751+    0 Qed  15/50 peers   10 MiB cache 19 MiB queue  RPC:  0 conn,    0 req/s,   19 µs

I then attach geth 1.9.18 to this via rpc
geth attach  /home/me/snap/parity/16707/.local/share/io.parity.ethereum/jsonrpc.ipc

But in the console
personal.unlockAccount("...")
Passphrase:
GoError: Error: Method not found at web3.js:6347:37(47)
        at native
        at <eval>:1:24(3)

What am I missing?


texts:
I have a dapp that allows you to upload pictures into blockchain using IPFS and I would like to implement a buy/sell smart contract that will allow users to buy the pictures or to setup terms to sell them.

What is the easiest way to start implementing this? I have looked over tutorials and examples, but I didn't find a good example of a buy smart contract, for example. Do you have any suggestions on what is the best approach or source to start?

Thanks.


texts:
I notice that when I leave my computer off for a couple hours or something and then restart and have to resync the chain that it always slows down considerably near around 200 blocks behind the "highest known block".

Does this last, most recent syncing of blocks take longer because the full state is being downloaded, while previous blocks' states are not fully downloaded?


texts: Does Chainlink store Oracle response for a transaction somewhere on blockchain?

texts:
Lets consider an example of transaction lifecycle where a smart contract uses Oracle to get external data ETH/USD price feed that is changed in real-time.
Transaction is executed during mining, so it creates request to Chainlink oracles that return Price1. Is Price1 stored/cached somewhere on the blockchain?
Once block is mined, mining node sends it to other Ethereum nodes to validate.
Validating nodes also execute that smart contract. What will happen to subsequent calls to the Oracle to get the ETH/USD price? Would Oracle return "cached" response Price1 during block validation or we would get Price2. Does it mean if we get Price2 then block validation fails?


texts: Does the approve function on an ERC20 token need to be run once or before every relevant transaction?

texts: I understand that an ERC20's approve() function has to be run before the token can be sent to another contract. But is this a one-time approval for msg.sender to be granted an approval status or does it need to be executed before each relevant transaction?


texts: Is the cost of pushing proportional to the array's size?

texts: Like above, I've been wondering how array pushes scale.


texts: Is it possible to set up a token with a fixed amount available, where all coins can be redistributed among token holders?

texts:
I'm new to this so i apologise in advance for my lack of technical knowledge.

What I'm trying to is distribute an investment among people ( a closed group) using tokens, allowing people to buy and sell their stake as they choose.

so basically i want to create a coin with a fixed amount distributed amongst all users. The price of the coin is calculated by putting total coins equal to the portfolio growth €G in real time. When someone wants to invest say €K they buy €K worth of coins. The amount €K would then be added to the €G and the coin value would increase proportionally.

My questions: Would it be possible to have an algorithm that would redistribute all coins proportionally among every coin holder so that they have less coins but their total value remains the same. I know this can be done mathematically quite easily but is their a way to redistribute coins on Ethereum in such a way?

for example

10,000 C coins distributed
G is worth €1,000
so each coin is worth C = 1,000/10,000 = €0.1
Person 1 and 2 have 5,000 C worth €500 each

Person 3 wants to buy 100 worth of coins.
G is now worth €1,100
C = 1,100/10,000 = €0.11
Coins are redistributed in following manner
 1 and 2 have (500/1,100)*10,000 = 4,545.45 C each
 3 has (100/1,100)*10,000 = 909.09 C

The reason I want to keep a limited amount of tokens rather than distribute more is that the value of the coin will be pegged to the growth of the groups' investment and so the increase in coin value will be a direct indicator of the portfolio growth.

If anyone could just tell me whether this is possible or not before I invest too much time on it id appreciate it. And again, sorry for the lack of technical know-how !

Thanks !


texts:
I am trying to understand why Merkle Distributor AKA merkle airdrop is used. I understand how it works, but what I don't understand is why it's a better option.
People use it when there's ICO and they want to distribute tokens, my problem is that I don't see a lot of advantage of it. Let's say we use a traditional distribution.

we write ERC20 token contract. (contract1)
we write another contract which creates lots of tokens and sends it to this contract. (contract2) . So contract2 has let's say 1000000000000 tokens.
other users call the function buyTokens on contract2 and in that function, we check how much ethers they pay and according to it, we calculate how many tokens to give to the users. Then, we call address(ERC20).transfer(to, amount) . This seems to work fine. **It's the user that pays the transaction fee`.

Could you explain why Merkle Distributor makes sense here and what advantage it has ? I know what it is and how it exactly works, so no need to explain it too much.


texts:
I am trying to take in a 512 character long string and extract the first 312 characters from the string. This is my test on a small scale, tryign to extract 12 characters out from a 30 character long string. But is showing me the error "VM error: invalid opcode. invalid opcode The execution might have thrown.". Any ideas on what is wrong? Thanks in advance.
pragma solidity 0.6.6;

contract StringTest{

    string public test_string = "012345678901234567890123456789"; //30 charater long string

    function getSlice(uint256 begin, uint256 end, string memory text) public pure returns (string memory) {
        string memory ret_string;
        bytes memory a = new bytes(end - begin +1);
        for(uint i = 0; i <= end - begin; i++){
            a[i] = bytes(text)[i + begin - 1];
        }
        ret_string = string(a);
        return ret_string;
    }