texts: add miner module to geth javascript console

texts:
I started the geth console with geth.exe attach http://IP:8545 and tried to set the etherbase with miner.setEtherbase(eth.accounts[0]) and then start the miner with miner.start(). I got the exception:

ReferenceError: 'miner' is not defined

Right now I only have this modules:

How can I add the miner module to to my standard connection command shown above?


texts: Trying to connect Ethereum Wallet with ganache-cli on Windows

texts:
I am trying to connect Ethereum Wallet with Ganache-Cli but it starts looking for geth note instead of ganache-cli. Can someone please tell me the correct way of doing it. Or is there any specific version of Ethereum Wallet support with gangache-cli? Below you can see my ganache-cli is listenting on localhost:8545

But still when execute EthereumWallet.exe --rpc http://localhost:8545 it gives me error given below.


texts: Will a transfer go through on a testnet transaction on meta mask to luno

texts:
What if you sent your ETH on the Ropsten testnet via Metamask to an ETH platform gateway like Luno (https://www.luno.com) ? Will you receive your Ether and will it reflect on that account?

I've done that and I'm still waiting for it to reflect on my account...


texts: Smart Contract - Storing 113+ byte buffer in solidity

texts:
So I am using the module (eth-ecies) in npm to perform encryption of a message offchain using the public key of my reciever, and in turn I get a 113+ byte buffer after the encryption is done. Now i want to store this encrypted message in my smart contract, but I can't figure out which dataType I should use to do the storage. I tried using bytes and string but I get errors. This is what happens when I use string:

And this is what happens when I use bytes:

The encrypted data is of the form "UjPuhBwP5fPDtuQrV3Oq6ASZwfQj8sO/jHwOxqj8BXEWvitUYjjhkNWckWQxxtdX9KrFbIYKoiFYb2dZq+QYjk6m+XsmTHRfhrS9AtLWmnyFJtj34pvMTuDTT9ur6ssxIwJSMJkShb1nmk7cfKQOr61+Zxh0UHlRmyFTrEz1fS9nnwDTMcpoPN5vSj7M6hvPKQ==" and is encoded in base64.

I use this code for encryption:

function encrypt(publicKey, data) {
let userPublicKey = new Buffer(publicKey, 'hex');
let bufferData = new Buffer(data);

let encryptedData = ecies.encrypt(userPublicKey, bufferData);

return encryptedData.toString('base64');

}

And this code to send the encrypted data to blockchain:

const sendDetails = contractInstance.methods.sendEncryptedDetails(enc).encodeABI();

const sendDetailsTx = {
    from:creatorIdentity.address,
    to:contractAddress,
    nonce:1,
    gasLimit:5000000,
    gasPrice:500000000,
    data:sendDetails,
}

const receipt5 = await web3.eth.sendSignedTransaction(sendDetailsTx);

This might be a very silly issue but I can't figure it out. Thanks in advance!


texts: How do I transfer an arbitrary erc 721 asset from a smart contract?

texts:
I'm trying to work with ERC 721 tokens in such a way that my contract freezes and unfreezes them (based on some conditions) but I'm having trouble wrapping function calls to the ERC 721 token contract address while preserving permissioning from msg.sender - any help much appreciated!

contract 721TokenFreezer{

  function freezeToken(address _tokenToFreezeAddress, uint256 _tokenToFreezeId) {
    // I want to transfer ownership of the 721 token from msg.sender to this smart contract
  }

  function unfreezeToken(address _tokenToFreezeAddress, uint256 _tokenToFreezeId, address _to){
    //I want to send the 721 token to the _to address
  }


texts: What kind of hardware is required to mine on Ethereum?

texts: The Ethereum frontier network has a customised proof of work algorithm called Ethash.  What kind of computer hardware is required to mine with this proof of work algorithm?


texts: How to verify a contract with libraries deployed from Remix

texts:
I successfully deployed a contract with remix here on Ropsten Testnet:
https://ropsten.etherscan.io/address/0x10273a926517b417015748da21e1287bab2da8f7

The Source Code is very simple but I'm using my own SafeMath library:

    pragma solidity ^0.4.24;

    library SafeMath {
      function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
        if (a == 0) {
          return 0;
        }
        c = a * b;
        assert(c / a == b);
        return c;
      }
    }

    contract ExampleSend {
        using SafeMath for uint256;
        function sendEther(uint256 amount, address[] targets) public returns (bool){
            uint256 countTargets = targets.length;

            require( address(this).balance > amount.mul(countTargets));

            for(uint256 i = 0; i < countTargets; i++){
                targets[i].transfer(amount);
            }
        }
    }

When I wanted to verify my code on etherscan, it asked my to put my libraries and the corresponding address. But I can't find where my library was deployed to on my console nor in my account history.
I've tried leaving the library options blank and putting my own contract address in the filed but neither of them worked.

When I provided contract library address with the address of the contract, I got the following error message:
Error! The Library Name (SafeMath) and Address (10273a926517b417015748da21e1287bab2da8f7) was provided but not used in the contract)

Can someone tell me how to get my library address?


texts: Ethereum's benefits: why should I be interested in Ethereum?

texts:
Is there a list of features and benefits to using Ethereum?

As a developer, why should I spend time looking into Ethereum?

What engineering benefits does Ethereum offer over existing technologies?


texts:
I am writing code in Java and trying to calculated potential gas units, for a function call on my methods.
I am trying to do so by using infura as a provider for my web3 Instance,
and then created a transaction and using the ethEstimateGas() function, but when I do so The response returned is {"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"execution reverted"}}
Which is not really descriptive, I would like to know what am I doing wrong or is there any other way to do so:
Code For Reference:

        Type address = new Address({My address here});
        inputParams.add(address);

        Type value = new Uint(new BigInteger("1000"));
        inputParams.add(value);

        Function function = new Function(
                "withdraw",
                inputParams,
                Collections.<TypeReference<?>>emptyList());

        String functionEncoderString = FunctionEncoder.encode(function);
        ////
        Web3j web3j = Web3j.build(new HttpService("https://ropsten.infura.io/v3/{my_API_KWY}"));

        BigInteger gasPrice = web3j.ethGasPrice().send().getGasPrice();
        Transaction t = new Transaction({fromAddress}, null, gasPrice, null, "0x3DDbe06F45B98a8613C95319Af8CA37BCC5d5c92", null, functionEncoderString);
        EthEstimateGas amount = web3j.ethEstimateGas(t).send();```


texts:
hello guys,

i have created a private Ethereum blockchain network on Microsoft azure which has one transaction node and two mining nodes with configuration-For transaction node the ram is 8gb and one of the mining node has 8gb and the other has 7gb of ram. The issue happening is, One of the mining node is going down frequently such that even if the other mining node exist for working it returns error i.e the transaction doesn't get committed. I tried restarting the node several times, But after sometime it again fails. Im new this Blockchain concepts- any help would be really appreciated


texts: How to make my contract balance as private in Ethereum?

texts: Suppose there are two contracts, A and B. Obviously, balance of A is public and B can read it with address_of_A.balance. Is there a way to make balance of A as a private data and B can't read it with the mentioned command?


texts:
So everything worked fine in truffle 4.1.14, but when I upgraded to 5.0.0 I got this error:

TypeError: source.setEngine is not a function
  at Web3ProviderEngine.addProvider (node_modules/web3-provider-engine/index.js:71:10

I'm using this require:

const ProviderEngine = require('web3-provider-engine')

And this is the code that is cusing the error:

var engine = new ProviderEngine()

 engine.addProvider(web3.currentProvider)

Is it a bug with web3 provider engine?
Any help would be great thanks!


texts: Swap transactions not fully registered by etherscan API?

texts:
I'm working on getting an address balance across all tokens by using Etherscan. I'm using this endpoint (from their API examples page):
https://api.etherscan.io/api?module=account&action=tokentx&address=0x4e83362442b8d1bec281594cea3050c8eb01311c&startblock=0&endblock=999999999&sort=asc&apikey=YourApiKeyToken

For the most part this works perfectly. But it looks like Uniswap transactions have only partial data - only the transaction going to uniswap is recorded, but the return transaction does not.
Here's an example transaction:
https://etherscan.io/tx/0xdfb3c19145477a1a599422dcba2c2cdf32eeaed2af51c47740cd2a865b040158

Has anyone run into this problem? What am I missing?


texts: Constant function returns empty array + web3js

texts:
I have a simple solidity script where I tested in remix (injected Web3 using geth local environment) and worked fine returning an array of data from a constant method.

pragma solidity ^0.4.11;

contract TestBetting {

  struct BettingInfo {
      uint256 matchId;
      uint homeTeamScore;
      uint awayTeamScore;
      uint bettingPrice;
  }

  address public owner;
  mapping(address => BettingInfo[]) public bettingInfo;

 // constructor
  function MyBetting() {
    owner = msg.sender;
  }

  // Fall back
  function () payable {}

  event LogDeposit(address sender, uint amount);

  // Place a bet
  function placeBet(uint256 _matchId,
                    uint _homeTeamScore,
                    uint _awayTeamScore,
                    uint _bettingPrice) payable returns (bool) {

    bettingInfo[msg.sender].push(
      BettingInfo(_matchId, _homeTeamScore, _awayTeamScore, _bettingPrice));

    require(_bettingPrice == msg.value);
    this.transfer(msg.value);

    LogDeposit(msg.sender, msg.value);

    return true;
  }

  function getBettingInfo(address _better) public constant returns (uint256[], uint[], uint[], uint[]) {
    uint length = bettingInfo[_better].length;
    uint256[] memory matchId = new uint256[](length);
    uint[] memory homeTeamScore = new uint[](length);
    uint[] memory awayTeamScore = new uint[](length);
    uint[] memory bettingPrice = new uint[](length);

    for (uint i = 0; i < length; i++) {
      matchId[i] = bettingInfo[_better][i].matchId;
      homeTeamScore[i] = bettingInfo[_better][i].homeTeamScore;
      awayTeamScore[i] = bettingInfo[_better][i].awayTeamScore;
      bettingPrice[i] = bettingInfo[_better][i].bettingPrice;
    }

    return (matchId, homeTeamScore, awayTeamScore, bettingPrice);
  }
}

When I do this in angular 5 with Geth local environment, first I need to submit transaction through placeBet method.

submit(form: NgForm): void {
    this.bettingPrice = 20;
    this.bettingPrice = this.web3.toWei(this.bettingPrice, "ether");

    this.TestBetting.deployed().then((instance) => {
        return instance.placeBet(this.matchId,
                                 this.homeTeamScore,
                                 this.awayTeamScore,
                                 this.bettingPrice, {
            from: this.account,
            value: this.bettingPrice,
            gas: 50000
        });
      })
      .then((value) => {
        console.log(value);
      })
      .catch((e) => {
        console.log(e);
      });
  }

It will open up metamask and it looks like it went through.

Now, I want to call getBettingInfo to see the data I submitted into network.

  loadGetBettingInfo() {
    this.TestBetting.deployed().then((instance) => {
        return instance.getBettingInfo.call(this.betterAddress, {
            from: this.betterAddress,
            gas: 50000
        });
      })
      .then((value) => {
        console.log(value);
      })
      .catch((e) => {
        console.log(e);
      });
    }

But this returns an empty array in the console.

Can anyone see what I'm doing wrong here?


texts:
It seems that specifying something less than uint256 counterintuitively increases gas costs (or at best makes them equal to uint256 with optimization).

And since the minimum write to storage is 32 bytes (256 bits), it doesn't seem like specifying uint8 would necessarily save you gas either.

In what cases could one use uint<256 to save on gas?

One possible example: in a struct, if you group/list 8 uint32 variables together, would writing to those 256 bits (which presumably are stored consecutively in one word) be the same storage / gas cost as a single uint256 in the struct?


texts: What are definite future benefits of buying and holding small amounts of Ether today?

texts:
A short while ago I was reading about a lot of new companies initiating ICOs.   If I understood correctly, investors that owned Ether would exchange Ether for tokens that company created.   Later, if the company is successful that investor might exchange those tokens for more Ether than they previously had, and then exchange the Ether for USDs or other fiat currency.  So, one incentive for buying Ether is to be able to use it to invest in tokens created by companies trying to raise money.

I also understand that developers can leverage the Ethereum blockchain, use Smart Contracts, and create Dapps.  So, that's is cool and a reason for developers to invest, to bootstrap their new service or app, learn the tech, etc.

However, I've read about a number of large companies investing in the underlying technology, but not Ethereum or the Ethereum network itself.  If I understand, they can setup their own blockchains, nodes, clients, smart contracts, whatever.

Why should developers or casual investors, or anyone invest in Ether vs. similar technology?  What are definite future benefits to accruing Ether?

Update:
For example, here is an example of a large company recognizing the benefits of the technology, but seemingly not contributing to the growth and value of Ethereum itself.  http://fortune.com/2017/11/10/blockchain-hpe/. This doesn't seem to help Ethereum or small stake holders at all.


texts:
I'm quite new at smart contracts/Solidity, which I'm learning for a postgraduate course.
In one of the assignments, we have to implement a little competitive game (something like the game of Seven Kingdoms). The main goal of puzzle is to be king and not be overthrow.
The contract of the SevenKingdoms
pragma solidity 0.5.0;

 contract SevenKingdoms {

  address payable public owner;
  address payable public king;
  uint public price;

  constructor(string memory _token) public payable {
    owner = msg.sender;
    king = msg.sender;
    price = msg.value;
  }

  function() external payable {
    require(msg.value > price);
    king.transfer(msg.value);
    king = msg.sender;
    price = msg.value;
  }
 }

From articles like this, I understood that may be an issue when a contract is receiving money and doesn't implement receive method.
I decided to take advantage of this issue in order to be the king (address) of seven kingdoms, so I created the following contract.
King contact:
pragma solidity 0.6.1;

contract King {

    address payable public owner;
    uint public _price;

    modifier onlyOwner {
        require(msg.sender == owner);
        _;
    }

    constructor () payable public {
        owner = msg.sender;
        _price = msg.value;
    }

    function triggerAddress(address payable _addr, uint256 valueInWei) public payable {
    _addr.transfer(valueInWei);
   }

    receive() external payable {
        require(msg.sender == owner, "Sorry I cannot receive money");
    }
}

Now when I am deploying the contracts in Remix and trying to transfer money(in Wei) from King to SevenKingdoms via its address (address contract for example 0x515df7f7cF195BFAA0f59bdD30B30f48B785aaFf) I am getting the following error message.
Note: The called function should be payable if you send value and the value you send should be less than your current balance.

What I am doing wrong? Is there problem in the way how I use transfer method between contracts? How I can send money between contracts leveraging cotract's address ?
Thank you in advance.


texts:
Anyone please help me to understand what is exactly Truffle & Ganache ?
How to install & use Truffle ?
Please reply who are know this.


texts: I've created a private blockchain with geth and curious if this ether is real and spendable?

texts: I have a small private network which generates roughly 20,000 ether daily.. I read of this private network configuration often and it seams like people are actually using this Ether as real ether that is tradable for Bitcoin.. Although I'm successfully creating and sending translations which I've tested sending to my coinable.com account and my MyEtherWallet.com account.. neither seem to receive my private network generated ether.. Am I chasing a dream? Or doing something wrong.. Please help I've either wisely invested months of research or wasted a LOT of time and ruined my relationship with my wife in the process... Thanks.


texts:
I am new to solidity. I was trying to compile the following code in chrome browser with Remix. I am getting the following error "Data location can only be specified for array, struct or mapping types, but "memory" was given"

Can anyone tell me what am I doing wrong and how can I fix that problem?

pragma solidity ^0.5.1;

contract ContractExp1{
    string public value;
    uint256 public count=0;

mapping(uint256 => Person) public people;

struct Person{
    string name;
    uint256 balance;
}

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

function setPeople (string memory _name, uint256 memory _val) public {
    count=count+1;
    people[count]=Person(_name,_val);
    }
}


texts: How to extract private key for Ethereum Ledger Account using Recovery Phrase BIP39 tool?

texts:
Can someone please tell me how to find my public key address in a "sea" of Derived Addresses when using the BIP39 (44 for Ethereum) tool?
I've isolated a laptop with this loaded in a browser, put in my Ledger 24 word recovery phrase, selected coin "Ethereum" which set to m/44'/60'/0'/0.
I'm then presented with 20 derived addresses at a time, none of which are display my public key that I'm looking for.
Is there anything I can do to better isolate my search results so I can find the address I'm looking for?
My goal is to recover ERC20 THETA that is locked on my Ledger Ethereum wallet.  If I can get the private key, I can enter this into THETA's site and recover the transferred THETA & TFuel as it was taken in a snapshot long since passed.
MANY THANKS IN ADVANCE!


texts: Where to find contract ABI in new version of online remix solidity compiler?

texts:
After the online remix solidity compiler recently changed design, I can't figure out where I can find the contract's ABI? Does anyone know where it can be found in the new version? Or any other way where I can get it?

https://remix.ethereum.org


texts: Which one is a better option - web3js or golang apis?

texts:
I want to build an application where I can call methods from smart contracts. I can do so by using either web3js or golang apis.

Query:
Which one is a better option when interacting with smart contracts and why?


texts: can etherscan.io show local ganache transaction details?

texts:
I am purchasing tokens on my sample Dapp with ganache-cli account using metamask.

Metamask shows the confirm message and deduct the ether from total balance but in token section it still not update and still zero in tokens.

Following is the screenshot

on etherscan.io no transaction
https://etherscan.io/tx/0x4e1ea5da31ba7d5bca6c8b45a3d705df3151f067adfc07b7502e04bec6a84733

Please help.


texts: Need help to figure out HD paths , append byte and the network params for these coins:

texts:
I am making an HD wallet on Android. I plan to support all major tokens/coins out there. I have setup the base of HD wallets and am getting pub/priv xpub/xpriv keys at HD path.

Imagine a function like:

/*
     * M/44'/0'/0'/0/0 : BITCOIN  MAIN NET
     *
     * Any address has:
     * m: private key
     * M: public key
     * 44' : BIP44 (read : https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)
     * 0' : coin bitcoin
     * 0' : account
     * 0 : External address (1 is for Internal or return address)
     * 0 : node end
     *
     * 0th Node of 1st external address of  1st account of bitcoin
     * */
    public List<ChildNumber> getBitcoinPath() {
        List<ChildNumber> childNumbers = new ArrayList<>();
        ChildNumber child44Hardened = new ChildNumber(44, true);
        ChildNumber child0Hardened = new ChildNumber(0,true);
        ChildNumber child1Hardened = new ChildNumber(1,true);
        ChildNumber child0 = ChildNumber.ZERO;

        childNumbers.add(child44Hardened);
        if(Environment.DEBUG) {
            childNumbers.add(child1Hardened);//testnet
        }
        else {
            childNumbers.add(child0Hardened); //mainnet
        }
        childNumbers.add(child0Hardened);
        childNumbers.add(child0);
        childNumbers.add(child0);
        return childNumbers;
    }

So for Bitcoin Path is :

  M/44'/0'/0'/0/0

Similarly Bitcoin test net 3:

  M/44'/1'/0'/0/0

For Ethereum though there are many 'official path' but i am going with most used:

  m/44'/60'/0'/0

I need help with the following:

1) the HD paths for list of these coins:

Litecoin
Dash
Bitcoin Gold
DigiByte
DogeCoin

2) The magicbyte/appendbyte for these coins.
Append byte is used to derive address from pubkey. Example bitcoin is 0x00

3) Network params for these coins. (i could probably pull this off from their source code, but if someone have them handy please do share)

In return for your help i will compile a medium post with all of this data for the future developers. Any help would be really great.


texts:
I would like yo know what kind of format is returned by the function now.

I am calling this function in a contract and sending the result like an event to my .js file. The structure that I see is like this:

I would like to compare this time with the obtained with new Date().getTime(); in javascript, but I dont know the meaning of "c,e,s" and I am not sure if it is the same kind of format (the length of the result number is different) or I should manage it first. I that case, how could I modify it?


texts: Passing structures between contracts with ABIEncoderV2

texts:
Hello I am having problems passing accessing the structure Rental in my secound contract can some one help?
contract RentalCompleting{

struct Rental {
    uint256 stratingDate;
    uint256 endingDate;
    uint256 maxRentalDuration;
    uint256 drivingLicenseExpirationDay;
    uint256 depositAmount;
    string car;
    uint256 invoiceAmount;
    }

Rental public rental;

constructor() public{
    initiator = 0xf1055613923229f387780bC5bC92CEB8DbCEFE07; //rentACar
    executor = msg.sender; //client

    rental.maxRentalDuration = 10000000;
    rental.depositAmount=0;
    rental.invoiceAmount=0;
}

DepositPaying public depositPaying;

function returnsRental(address _address) public view returns (Rental memory){
    return Rental(rental.stratingDate,
           rental.endingDate,
           rental.maxRentalDuration,
           rental.drivingLicenseExpirationDay,
           rental.depositAmount,
           rental.car,
           rental.invoiceAmount);
}

function requestRentalCompleting(uint256 _startingDate, uint256 _endingDate, uint256 _drivingLicenseExpirationDay) public{

             require(_endingDate >= _startingDate);
             require((_endingDate - _startingDate) <= rental.maxRentalDuration);
             require(_drivingLicenseExpirationDay >= _endingDate);
             rental.stratingDate = _startingDate;
             rental.endingDate = _endingDate;
             rental.drivingLicenseExpirationDay = _drivingLicenseExpirationDay;
        }

function promiseRentalCompleting() public
         returns (address){

             depositPaying = new DepositPaying(address(this));
             return address(depositPaying);
         }

contract DepositPaying{

RentalCompleting public rentalCompleting;

constructor(address _rentalCompleting) public{

    rentalCompleting = RentalCompleting(_rentalCompleting);

    initiator = rentalCompleting.executor(); //client
    executor = rentalCompleting.initiator(); //rentACar
}

function getRental() view public returns (RentalCompleting.Rental memory){
    return rentalCompleting.returnsRental(address(this));
}

uint256 r = getRental().depositAmount;
function requestDepositPaying(uint256 _rq_depositAmount) public
        {
             require(_rq_depositAmount == r);
             c_fact = C_facts.Requested;
         }


texts:
I'm trying to write a test suite in Solidity for a few contracts contained in a single script. I can't alter the code in the contracts - they're not written by me, and I don't have the rights. I would like to be able to simulate a transaction between two contracts, but I can't figure out if there's a way for me to fund a contract from thin air (for testing) using Solidity. I'm assuming it would look something like:

contract testUser {
  constructor () {
    address(this).balance = 1 ether;
    }

Right now this is giving me an error in Remix (Expression has to be an lvalue), which I think is because this needs to be a storage thing, and this is trying to write it in memory, but adding storage to the line where I'm trying to fund the contract yields a syntax error. Is there a way to do this?


texts:
I'm trying to make a test coverage for MetaCoin.
This is my package.json, truffle-config.js and
.solcover.js:

module.exports = {
    port: 8555,
    norpc: true,
    compileCommand: '../node_modules/.bin/truffle compile',
    testCommand: '../node_modules/.bin/truffle test --network coverage'
};

I run the commands ./node_modules/.bin/ganache-cli --port 8555 --gasLimit 0xfffffffffff and ./node_modules/.bin/solidity-coverage and  the result is an empty test coverage:

Generating coverage environment
Running: node --max-old-space-size=4096 ../node_modules/.bin/truffle compile --network coverage
(this can take a few seconds)...
Compiling ./contracts/ConvertLib.sol...
Compiling ./contracts/MetaCoin.sol...
Compiling ./contracts/Migrations.sol...
Writing artifacts to ./build/contracts

Instrumenting  ./coverageEnv/contracts/ConvertLib.sol
Instrumenting  ./coverageEnv/contracts/MetaCoin.sol
Skipping instrumentation of  ./coverageEnv/contracts/Migrations.sol
Running: node --max-old-space-size=4096 ../node_modules/.bin/truffle compile --network coverage
(this can take a few seconds)...
Compiling ./contracts/ConvertLib.sol...
Compiling ./contracts/MetaCoin.sol...
Compiling ./contracts/Migrations.sol...
Writing artifacts to ./build/contracts

Running: node --max-old-space-size=4096 ../node_modules/.bin/truffle test --network coverage
(this can take a few seconds)...
Using network 'coverage'.

Compiling ./test/TestMetacoin.sol...

  TestMetacoin
    ✓ testInitialBalanceUsingDeployedContract (89ms)
    ✓ testInitialBalanceWithNewMetaCoin (85ms)

  Contract: MetaCoin
    ✓ should put 10000 MetaCoin in the first account
    ✓ should call a function that depends on a linked library (54ms)
    ✓ should send coin correctly (128ms)

  5 passing (8s)

-----------------|----------|----------|----------|----------|----------------|
File             |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
-----------------|----------|----------|----------|----------|----------------|
 contracts/      |        0 |        0 |        0 |        0 |                |
  ConvertLib.sol |        0 |      100 |        0 |        0 |              6 |
  MetaCoin.sol   |        0 |        0 |        0 |        0 |... 23,24,28,32 |
-----------------|----------|----------|----------|----------|----------------|
All files        |        0 |        0 |        0 |        0 |                |
-----------------|----------|----------|----------|----------|----------------|

Istanbul coverage reports generated
Cleaning up...
Done.

I get the same result if I check without tests .

Maybe I'm doing something wrong. Please help me.


texts: Set up Mist browser for a private go-ethereum docker cluster

texts: Consider a base set up consisting of 'n' docker containers (within a VM running on OSX), each running a geth instance. Thanks to the guidance from @BokkyPooBah, in a different thread, I have been able to set up a cluster of 4 containers all added as peers on the network each having an account. Now, I am trying to have the Mist browser interface on the host OSX to interface with the containers to be able to navigate across accounts. Typical instructions and help around using the browser suggest how the browser can be connected to a single geth instance. Is there a way to have the browser, interface across multiple nodes(containers)?


texts: Solidity keyword require (false) will run out of my gas, why?

texts:
I meet a strange problem when I test my contract in Remix-ide + geth

1、I run a private chain in geth
2、I connect to the node with web3provider in Remix-ide
3、I deploy the contract like this

:

pragma solidity ^0.4.22;

contract aPlusb{
    function aPlusb(){}
    uint a=1;
    event happen(uint input,uint output);
    function plus(uint a,uint b) returns (uint){
        require(a==2);
        happen(a,a+1);
        return a+1;
    }
}

  When I test this in Remix-id Java EVM, it show this:

  But when I deploy the contract to the private chain with the
  web3provder, and exec the func plus(), it will run out of gas like
  this:


texts: Why HD wallet instance returns two xpub-xpriv key pairs inside Root and HDKey?

texts:
I have implemented address generation using HDWallet as shown in the snippet below:

let Seed = generateMnemonic();
const wallet = EthHdWallet.fromMnemonic(Seed);
console.log("Wallet" + JSON.stringify(wallet));
console.log(typeof wallet);
let address = wallet.generateAddresses(3);
console.log("Wallet after address generation: " + JSON.stringify(wallet));
console.log("Address generated: " + address);

Wallet gives one object which contains:

_hdKey (Has parameter _hdKey which further have two parameter xpriv & xpub )
_root (Also Has parameter _hdKey which further have two parameter xpriv & xpub different from hd key's parameter value)
_children (Generated addresses with its own private and public key pairs)

Difficulty about:

What does that two key pairs indicates? which we get it under the _hdKey and _root?
How to recover my address only using privateKey?


texts: Read access control solidity smart contract

texts:
Let's say that we have a contract that not anyone can access to view function :

contract AccessControl {
    mapping (address => bool) authorized;

    function getSomething () public view returns (string) {
        // control if the caller is authorized
        return "hello";
    }
}

I tried this but it works only on javascript-vm (remix)

contract AccessControl {
    mapping (address => bool) authorized;

    function getSomething () public view returns (string) {
        require(authorized[msg.sender]);
        return "hello";
    }
}

Is there another solution?


texts: Not able to start miner on Ethereum POA - Block sealing failed

texts:
We are using stable version of geth v1.3. The nodes are on docker containers. Have configured two nodes, signer and sealer accounts using clique POA and used puppet for creating genesis file. Have unlocked the account and started the miner process. Getting following in logs and blocks are not getting mined

When the miner is started getting following in the Logs
WARN [01-22|19:07:12] Block sealing failed                     err="authentication needed: password or unlock"


texts: What fixed or float point math libraries are available in solidity?

texts: Solidity doesn't have float or double variables. What solutions are there to handle the cases where we really have to represent numbers as percentages or fractions?


texts: personal_signAndSendTransaction json: cannot unmarshal string into Go value of type eth.SendTxArgs

texts:
Hoping you guys can help as I'm dead ended trying to SEND ether via rpc.
Before I jump off a tall building I will try stack exchange for the first time.

Error I get is:

PHP Fatal error:  Uncaught RPCException:  json: cannot unmarshal string into Go value of type eth.SendTxArgs

The Actual echoed json for SendTxARgs:

{"from":"0x549b968b43d503544854675387c5897a8a1c4f38","to":"0x7c9943A3C97099dBD6b1D6040d19D1Df4aB91de4","value":"0x58d15e17628000"}

which matches the args via api and docs as:

SendTxArgs struct {
    From     common.Address  `json:"from"`
    To       *common.Address `json:"to"`
    Gas      *rpc.HexNumber  `json:"gas"`
    GasPrice *rpc.HexNumber  `json:"gasPrice"`
    Value    *rpc.HexNumber  `json:"value"`
    Data     string          `json:"data"`
    Nonce    *rpc.HexNumber  `json:"nonce"`
}

actual code calling the send:

$jsontx = json_encode($tx);
echo $jsontx.PHP_EOL;
echo 'sending '.$ethereum->personal_signAndSendTransaction($jsontx,$pw).PHP_EOL;

Relying on function:

function personal_signAndSendTransaction($tx, $pw) {
    return $this->ether_request(__FUNCTION__, array($tx, $pw));
}

Relying on a script that works for all other calls so far.. https://github.com/btelle/ethereum-php

Any gurus out there ?? help a brother out?


texts: Truffle contract deployment either exceeds block gas limit or out of gas

texts:
I've been having the same issue when I was trying to deploy a contract using truffle develop console. The contract is not extremely big but does initiate two other contracts when called a certain function. (since it's not open to the public so apologies i can't post the contract here)

I came across the error "out of gas" when I didn't specify the gas used in my 2_deploy_contract.js file, but when I gradually increased the the gas at some point I got the error "Exceeds block gas limit".

I then tried to specify the "gas" parameter in truffle.js config file. The problem is no matter how high I set it (e.g. 10000000000000) it still gave me the same error: "Exceeds block gas limit".

 networks: {
  development: {
   host: "127.0.0.1",
   from: "0x627306090abab3a6e1400e9345bc60c78a8bef57",
   port: 9545,
   network_id: "*", // Match any network id
   gas: 18900000000000000000000000000
}

}

And the most interesting part of it is that  it worked perfectly fine on Remix but not truffle develop console.


texts: How do I get the deployed contract's address from a ContractContainer object in Brownie?

texts:
I want to chain contract deployment, where the second contract gets as a parameter the address of the first. I'm using Brownie :
from brownie import ContractA, ContractB , accounts

def main():
    acct = accounts[0]
    ContractA.deploy({'from': acct})
    ContractB.deploy(ContractA.address, {'from': acct})

With web3 and Truffle, the deployed contract instance can be imported and we get its address with .address. However, brownie CountractContainer are function objects and I can't understand how to get the deployed address.


texts: Accept popular ERC20 tokens and auto-convert them to ETH in a smart contract

texts:
As an intermediate in smart contract development, I'm now facing the challenge where I would like to unify payment on the Ethereum ecosystem in a way that holders of popular ERC20 tokens can pay my smart contract (which is a sort of payment gateway) without converting their tokens first.
Specifically, I'm intending to implement such a feature for providing more convenience when paying with the MetaMask browser wallet so that it's really just one or two buttons that's required to perform a transaction to my smart contract in whatever token they have.
I, however, need to convert these received tokens back to ETH on my end since I don't want to rely on the faith in the ERC20 token's price stability.
Therefore I'm asking for specific code examples which point me in a direction of how to initiate a payment with an ERC20 token of the user's choice to my smart contract with MetaMask. What Solidity code could I use to eventually convert the received tokens to ETH on my end? Would Uniswap be such an option? What would the code look like to detect the ERC20 token and auto-convert it?
Thank you in advance.

Note: I'm not building an exchange. The ERC20-ETH conversion is set to take place on my end and to stay there. My goal is to have users pay in what currency they want and then to finally have plain ETH in my contract.


texts:
I'm running a private network with two nodes (geth 1.8.3-stable on macOS 10.13.3). Node 1 mined 422 blocks:

Node 1:

> eth.blockNumber
422

Node 2 is a peer of Node 1 but Node 2 only has the first 384 blocks:

Node 2:

> eth.blockNumber
384
> eth.syncing
{
  currentBlock: 384,
  highestBlock: 422,
  knownStates: 2,
  pulledStates: 2,
  startingBlock: 384
}

So Node 2 is missing 38 blocks. I've tried restarting both nodes several times to no avail.

Initially, I made the nodes peers manually (via admin.addPeer()) but after reading the private network documentation I tried using the --bootnodes argument instead: same result.

Node 1 startup:

$ geth --datadir /Users/x/ethereum/first/ console --networkid 1234 --nodiscover

Node 2 startup:

$ geth --datadir /Users/x/ethereum/first-1a/ console --networkid 1234 --nodiscover --port 30304

or

$ geth --datadir /Users/x/ethereum/first-1a/ console --networkid 1234 --nodiscover --bootnodes "enode://a94...2c3@[::]:30303?discport=0" --port 30304


texts: Calling mapping (uint ==> bytes32)return 0x0000000

texts:
contract test{

  mapping(uint8 => bytes32) public check;
  uint8 [] public array;

  function Adddata(string document, uint8 number)  returns (bytes32) {
    check[number] = sha256(document);
    array.push(number);
    return check[number];

  }

  function Getdata(uint8 number) returns(bytes32){
    return check[number];
  }
}

so this is a simple test contract, I suppose to call Adddata to with a number a string, it maps an uint8 to bytes32(sha256 would convert string to bytes)

So if I call Adddata function, it will return me the sha256 of the stirng, but when I call Getdata afterwards, it returns me 0x000000000 whatever what input I gave...

Anyone know what happened?


texts: How wide is wallet support for a data field in a URL?

texts:
I'd like to be able to share a URL (or a QR code thereof) prompting the user's wallet to open to call a function, and pass in some parameters.

There are a couple of EIPs - EIP67 and EIP681 - with detailed proposals for URLs that include data fields, but neither seems to be finalized, and some people are opposed to doing this for fear that users will be tricked into calling functions they do not intend.

However, according to this answer, at least MyEthereumWallet already support data in the URL:
Can any information beside the address be encoded into QR code?

How widely do wallets other than MyEthereumWallet currently support data URLs? Relatedly, will wallets that don't support data tell the user that they don't support the URL they've received, or will they just silently ignore the data parameter and prompt the user to send a transaction without it?


texts:
Questions.
How to install Metamask on Chrome in Android?
or
How to use Metamask in Android?

Description:

I followed the link metamask.io
I tried Get Chrome Extension.
The site redirected me to -  https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en
I clicked Install.
Result: the Metamask browser is installed.

Used by:
Android
Model - Mi PAD 3
Android Version - 7.0 NRD90M
MIUI Version - MIUI 8.3 by xiaomi.eu 7.5.25
Browser - Chrome

Metamask browser


texts:
I tried to send a tx via geth json rpc using the following code. But the geth rpc server response with "Invalid sender".
I also tried HomesteadSigner. In that case there is no error received, but I cannot find the receipt for the transaction, no matter how long I wait.
Is there anything wrong? thx for any recommendation

KeystoreDir := "D:\\work\\src\\b710cd2a24e0a6dfdc078df50ea42fc2b8d67fcf"

keyjson, err := ioutil.ReadFile(KeystoreDir)
if err != nil {
    log.Fatal(err)
}
password := "test"
key, err := accounts.DecryptKey(keyjson, password)
if err != nil {
    log.Fatal("Json key decrypted with bad password")
}

tx := types.NewTransaction(5, addrReceiver, amount, gasLimit, gasPrice, nil)
tx, err = tx.SignECDSA(types.NewEIP155Signer(big.NewInt(1)), key.PrivateKey) //types.HomesteadSigner{}
if err != nil {
    return err
}
_, err = types.Sender(types.NewEIP155Signer(big.NewInt(1)), tx)
if err != nil {
    log.Fatal("Network ID fault")
}

err = client.SendTransaction(ctx, tx)
if err != nil {
    log.Fatalf("Tx Error: %s %x %x %d\n", err, addrSender, addrReceiver, balance.Div(balance, common.Finney))
}


texts: Stuck ERC-20 Transaction - reversal did not work

texts:
I tried two days ago to send some BAT and ETH to my Coinbase account from my Klever Wallet (which, after this, I will never use again - they seem to be living in 2015 with the gwei fees they charged).
Here is the Tx for the BAT: https://etherscan.io/tx/0x90de87670ac8e608e8c5f9e9d2efd5452768070748af56cdccd646df7c3eed32
Here is the Tx for the ETH: https://etherscan.io/tx/0x406dcf1de6886bacf0b2a851e2eddaa2bcb179b4ba6720a076b2823b720ce59d
With this said, I realised my issue was my wallet set a fee of 57GWEI, which is low as hell on today’s standards. I decided to jump onto MEW, and send myself 0ETH for 200GWEI and same nonce as the BAT transaction as this was done first.
Here is the 0ETH Tx: https://etherscan.io/tx/0x4e1dace2046dd65f4700a1a74b33f9615d12590414ad878820bd4ce3a87d7e22
This last one got confirmed, yet none of the other two got cancelled!! What do I do now?


texts: How to fix price sensitive transaction fee?

texts:
I am developing a Ethereum dAapp where deploying small certificates on the blockchain is required, multiple times. But Ethereum price fluctuations that can make you happy as an investor, can make you sad as a dApp user, because a transaction might be simply too expensive in terms of fiat. So I would like to know:

why Ethereum does not have a dynamic gas limit bottom or something like that, to solve this problem?
do any projects on top of ethereum solve, at least partially, this problem?
alternately, do any other platforms allow you to keep a stable fee in terms of fiat?


texts: Is calling another contract via its address risky?

texts:
The below screenshot is from Andreas' book.  I don't understand why this programming technique is so risky. See the text in the red block in the image.

We have the .sol file, and the Bytecode on the Blockchain at the contract address is immutable.  Can't we verify that the Contract Bytecode matches the Bytecode generated by the provided .sol file, hence, this would eliminate any risk?
Thank you


texts: Gas estimation errored using ERC20 in REMIX

texts:
I'm trying to test making some smart-contract that uses DAI ERC20 tokens on Kovan testnet (DAI contract on kovan is 0xc4375b7de8af5a38a93548eb8453a498222c4ff2). I developed this very simple contract that is meant to just:

getContractBalance() - Contract balance of DAI
getSenderBalance () -    Sender balance of DAI
tranferTokenstoContract( uint _amount ) - transfer    _amount DAI tokens from Sender to Contract

here is my code :

pragma solidity ^0.5.3;

    // Import OpenZeppelin's ERC20 interface defenition
    import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";
    import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";

    contract Example {
        IERC20 public associatedToken;

    // @param _token is the address of DAI in Kovan -> 0xc4375b7de8af5a38a93548eb8453a498222c4ff2
        constructor(IERC20 _token) public {
            associatedToken = _token;
        }

        function tranferTokenstoContract( uint256 _ammount) public returns (bool) {
            return associatedToken.transfer(address(this), _ammount);
        }

          function getContractBalance() public view returns (uint256) {
            return associatedToken.balanceOf(address(this));
        }

        function getSenderBalance() public view returns (uint256) {
            return associatedToken.balanceOf(address(msg.sender));
        }

    }

I'm using injected Web3 with metamask and I have 82 DAI tokens in it (Kovan testnet). Whenever I call getSenderBalance(), it works fine and returns 82000000000000000000 as expected. Although when I call tranferTokenstoContract() and try to send some tokens to the contract, I get a "Gas estimation errored" warning and my transaction always fails. I'm using Remix, but I also tried it on MyEtherWallet. Both unsuccessful. Also I tried moving around with the gas but I was not successful either.

Am I doing this right? Feel free to try it yourself. Just pass in 0xc4375b7de8af5a38a93548eb8453a498222c4ff2  to the constructor, which is the DAI contract on the Kovan network

I would appreciate any help.


texts: What happens when a new instance of a contract is created?

texts: I was wondering what happens when a user wants to create a new instance of a contract. Is a copy of the contract created from the contract that was first created on the blockchain, but given a different address and is stored as a new contract on the blockchain? Does something change with the initial contract deployed on the blockchain?


texts: How to assign to negative numbers in yul?

texts:
Take this code snippet:
function powOfTen(uint256 x) internal pure returns (int256 result) {
    assembly {
        switch x
        case 1 { result := -18 }
    }
}

Which doesn't compile:
ParserError: Literal or identifier expected.
   --> contracts/PRBMath.sol:352:32:
    |
352 |             case 1 { result := -18 }
    |

How can I assign to a negative number in yul?


texts:
What is the difference between online and offline validators? How to distinguish them?

It says online validators get penalized less than offline validators when the block didnt get finalized.


texts: How can I get the latest block, coinbase and other information using Nethereum?


texts: Looking at the newer smart contract I rarely see "indexed" on events. Sometimes even event emiting is scarce, I would assume its to save gas on contract execution. So question is when would be good example (or a must) to add indexed attribute to event emission?


texts: Using inherited constructor in Solidity >=0.5.0

texts:
I want to use a contract inherit from another contract and use the parent constructor after using another commands in inherited constructor. So I wrote:
pragma solidity ^0.5.10;

contract A {
    constructor(uint x) public {
        //some commands
    }
}
contract B is A {
    contructor(uint x) public {
        //another commands that must be executed first

        //calling A constructor with x parameter:
        A(x);
        //or:
        super.constructor(x); //has error
        //or ???
    }
}

If I use the first solution it assumes that it should cast x variable as A contract. another solutions result error.
If we use A(x) as the B constructor modifier there is no way to run the parent commands after the inherited commands.
    ...
    contructor(uint x) public A(x) {
        //another commands that must be executed first
    }
    ...

finally I was forced to use a secondary function as follows:
pragma solidity ^0.5.10;

contract A {
    constructor(uint x) public {
        p(x);
    }
    function p(uint x) internal {
        //some commands
    }
}
contract B is A {
    contructor(uint x) public {
        //another commands that must be executed first

        //calling A constructor with x parameter:
        A.p(x);
        //or:
        super.p(x);
    }
}

Is there any straight solution, so we don't need to use the secondary function?


texts: How do I get the Merkle Patricia tries of a block from a client? Do clients implement a standard call to retrieve it?


texts:
A issue in the this.web3 = new Web3(window.web3.currentProvider);the web3.js has output and I type to the code of console.log(window.web3.currentProvider)that window.web3.currentProvider is defined. But the terminal occurs issue like as fellow:

ERROR in src/app/app.service.ts(36,20): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.

I import the web3.js like that :enter preformatted text here


texts: Contract public variables stay undefined. Why?

texts:
I have a contract that looks like this:

contract MainContract is usingOraclize {
    ...

    address minter;
    uint public returnRate;

    ...

    function MainContract(uint _returnRate) {
        minter = msg.sender;
        returnRate = returnRate;
        oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
    }

    modifier onlyMinter {
        if (msg.sender != minter) throw;
        _;
    }

     function updateReturnRate(uint newReturnRate) onlyMinter {
        returnRate = newReturnRate;
     }

     ...

}

I have deployed it on the testnet: https://testnet.etherscan.io/address/0x5cad3cbdbf64b65174b36269f5201d3265569f2b

However, when I try and get the value of the 'returnRate' variable, I get that it is undefined even though it should have been set upon contract creation. So I then tried to update it through the updateReturnRate function and it is still undefined. And I can't explain why...

Do I have to specify the function as being public? Even so why didn't the value get set upon contract creation?

I am using the browser solidity compiler for testing.


texts:
My Dapp was working fine, but after I upgraded web3.min.js to the most recent version, I am getting these errors.

Uncaught TypeError: (intermediate value).toBigNumber is not a function
Uncaught ReferenceError: TruffleContract is not defined

initContract: function() {
    $.getJSON('Pets.json', function(data) {
      App.contracts.RealEstate = TruffleContract(data);
      App.contracts.RealEstate.setProvider(App.web3Provider);
    });
},

Seems like the new web3 doesn't recognize some parts in truffle-contract.js or the other way around. Any fix for this?


texts: Create crowdsale contract with newer version solidity of token contract

texts:
I have created token contract with solidity ver. ^0.8.0 and now I want create crowdsale contract.

Is there a way to combine crowdsale contract (solidity version 0.8.0) with token contract crowdsale (pragma 0.5.0) ?

When compiling using pragma as below

pragma solidity >=0.5.0 <=0.8.0;

getting error from older contract cuz for newer compiler some functions are wrote in wrong way.

I was thinking to write crowdsale contract with solidity ver. 0.8.0 because openzeppelin doesn't offer in newest version of their contracts. It's just I'm worrying about security. I was also considering to write token contract with older solidity version (same as crowdsale contract which is 0.5.0 version), just don't know what's option is better? (for security reason) Any of you guys tried to write crowdsale contract with newer version of solidity than 0.5.0 ?


texts: Is data stored in string form in smart contracts publicly readable?

texts:
As a beginner, I wrote the contract below for learning purposes, aiming to create a "Safe Messaging System":

pragma solidity ^0.4.24;

contract SafeMessage {

string message;
string password;
string enterPassword;

function sendMessage(string _message, string _password) public {
       require (bytes(_message).length > 0 && bytes(_password).length > 0 );
       message = _message;
       password = _password;
}

function readMessage (string _enterPassword) view public returns (string) {
   require (stringsEqual(password, _enterPassword) == true);
   return (message);
}

function stringsEqual(string storage _a, string memory _b) internal pure returns(bool) {
    bytes storage a = bytes(_a);
    bytes memory b = bytes(_b);

    if (keccak256(a) != keccak256(b)) {
        return false;
    }
    return true;
}
}

So, with the code above, I can set a message, and calling "readMessage" will only return the message with the right password. The problem is, from what I understand, the data stored in string form (message & password) can be read by somebody else. Is that true? And how does that work?

Also, for the password, I could just take its hash instead of storing it directly as string, but that wouldn't solve the problem if the message can be read otherwise anyway. If what was mentioned in the previous paragraph is true, how could one actually create a "Safe Messaging System" with a smart contract?


texts: How to get balance a wallet has in a Uniswap pair

texts:
I'm trying to get the balance of my wallet in a Uniswap pair.
I have found how to get the initial balance when I first added liquidity using
https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2
and adding this json in the body of the post request
{"operationName":"events","variables":{"user":"0x00e9114dbfeb686eb736f78aa481ed0528e200a8","pair":"0x64cac8fa24f437ceca90e20a7a24a609f162b0d1"},"query":"query events($user: Bytes!, $pair: Bytes!) {\n  mints(where: {to: $user, pair: $pair}) {\n    amountUSD\n    amount0\n    amount1\n    timestamp\n    pair {\n      token0 {\n        id\n        __typename\n      }\n      token1 {\n        id\n        __typename\n      }\n      __typename\n    }\n    __typename\n  }\n  burns(where: {sender: $user, pair: $pair}) {\n    amountUSD\n    amount0\n    amount1\n    timestamp\n    pair {\n      token0 {\n        id\n        __typename\n      }\n      token1 {\n        id\n        __typename\n      }\n      __typename\n    }\n    __typename\n  }\n}\n"}

How do I get the current balance of my wallet?


texts: I want to write a smart contract using pure Yul but I have no idea how I'm meant to configure / run solcjs to compile my yul code down to bytecode. Any pointers would be much appreciated.


texts: How to detect if an address is a contract?

texts:
I'm interested in knowing whether any particular address is a contract address or a standard address. There have been similar questions on the topic, but I'm not looking to detect whether an address is valid as this is child's play.

I assume detecting a contract can be done, Etherscan does a good job at detecting addresses vs contracts.

Any ideas?
Can this be done with web3?


texts: How exactly are Ethereum transaction fees and block rewards sent to the miner?

texts: I know that when a miner mines an Ethereum block, they receive both the block reward and the transaction fees from all the transactions included in that block, but how exactly are all of these transaction fees sent to the miner who mines the block?


texts: Is there a way to look at the assembly code equivalent of a specific solidity function the compiler creates? What's the easiest way to do so during development?


texts:
Well I tried to setup my first ethereum mining rig.

I bought 6 second hands rx480 8GB (some on eBay, some elsewhere..)
And these new parts:

  -Z170 gaming K3

  -Powered pci risers

  -8GB DDR4 Crucial

  -2x RMi750W PSU

  -Add2psu adapter

  -60GB SSD corsair

Well, I made the set up (cards, risers powered by sata/molex), I put 3 cards by PSU, installed win 10 and started mining on claymore.

I get a 1200W power consumption, and a 145mh/s speed which is good for me.
Well, it mined for 40min and I got a blue screen "thread stuck in device driver"
..

Well I said to myself, it perhaps about windows so I installed Ubuntu and amdgpu-pro..
Well, same thing, 6 cards detected but I get a watchdog error "GPU2 Hangs in OpenCL call" or "GPU4 Hangs in OpenCL call" the miner try to reload but I get a frozen screen again..

Today I tried some switch between risers and PCIE slots I got the same error on same card (I identified the card with a 100% fanspeed settings on claymore)..

I tried to remove completely the GPU2 so 5 gpu mining but i get the "GPU4 Hangs
in OpenCL call" error when I try this.

It work good with 4 cards only (even if the gpu4 is one of the 4 cards used).
So I don't understand.. Could it be a PSU problem ? Not enough power ? It was a little bit more stable on windows I think.

I must specify -> I didn't overclocked the cards.
Any help appreciated :)


texts: Can we stop and resume a private blockchain while keeping the recorded data intact?

texts:
I use the following two lines to initiate and run a private blockchain. Assume I have sent some transactions to it and now for some reasons (e.g. server is malfunctioning) I need to restart the chain. My chain is run on only one node/server (so there is no network and everything is running on one server)

   geth --identity "MyNodeName" --rpc --rpcport "8545" --rpccorsdomain
   "*" --datadir Users/TestChain1 --port "30303" --rpcaddr "127.0.0.1"
   --nodiscover --rpcapi "db,eth,net,web3,personal" --networkid 123
   init /Users/CustomGenesis.json

 geth --identity "MyNodeName" --rpc --rpcport "8545" --rpccorsdomain
 "*"  --datadir Users/TestChain1 --port "30303" --nodiscover --rpcapi
 "db,eth,net,web3,personal" --networkid 123 console

Question: Can I stop the blockchain and then re-run the blockchain without losing any data stored in it?


texts: approveAndCall () from ERC20 token contract on MainNet and on TestNet Ropsten

texts:
How can it be possible:
the same function in the same code, on MainNet can be called, and on TestNet when trying to launch through the same Ethereum Wallet, I get the message:

  It seems this transaction will fail. If you submit it, it may consume
  all the gas you provide.  Estimated fee consumption: The contract will
  not allow this transaction to be executed

And Ethereum Wallet shows the gas price on the Ropsten  5.271 ether per million gas:

Contract on TestNet https://ropsten.etherscan.io/address/0x47d55ec9E1d5DEb893D3943e6d84011E488b1A37#code, on MainNet https://etherscan.io/address/0x684282178b1d61164febcf9609ca195bef9a33b5#code
The approveAndCall() function called was based on model from https://ethereum.org/token (in old version)
And it seems to be no difference which address will be put to function as an argument.

I think the problem can be with the third argument of this function: 'bytes _extraData', as discussed on https://ethereum.stackexchange.com/a/11771/1964 and Remix in 'Analysis' also thinks it's not good:

  Gas requirement of function
  Corporation.approveAndCall(address,uint256,bytes) unknown or not
  constant.

If the gas requirement of a function is higher than the block gas limit, it cannot be executed. Please avoid loops in your functions or actions that modify large areas of storage (this includes clearing or copying arrays in storage)"

Where can be a problem? How to make code working on MainNet work on Ropsten TestNet too? I would like to make possible for users to test contract on TestNet before starting to work on MainNet.


texts: using events in private blockchain raises leveldb not found error

texts:
i'm getting { [Error: Node error: {"code":-32000,"message":"leveldb: not found"}] when trying to use events on a private eth blockhain.

What might be the problem? (I've installed Leveldb with brew)

Thanks

myContract_ws.events.ContractCreated({
    fromBlock: 0,
}, function(error, event){ console.log("EVENTS log: ",event); })
.on('data', function(event){
    console.log("EVENTS ONDATA",event); // same results as the optional callback above
})
.on('changed', function(event){
    console.log("ContractCreated / CHANGED",event);
})
.on('error',function(err){
  console.log("ERROR HERE");
  console.log(err);
  console.error;

});

geth: 1.8.21-stable
web3: 1.0.0-beta.41
macOsX 10.13.6


texts: Invalid opcode on mulitplication then division

texts:
I am trying to calculate a percentage of a certain number, to do so I pass to my contract the numerator and denominator and do the following math:

amountToAdvance = (_amount * _numeratorPercentageAdvanced) / _denumeratorPercentageAdvanced;

I unfortunately keep getting and invalid opcode error on this specific line.
The numbers I am trying to pass are all uint.

_amount = 10000
_numeratorPercentageAdvanced = 8
_denumeratorPercentageAdvanced = 10

UPDATED

Here is the function where the operation is located:

function loan(uint _amount, uint _fee, uint _numeratorPercentageAdvanced, uint _denumeratorPercentageAdvanced) public {
        loanData.amountETH = _amount;
        loanData.fee = _fee;

        loanState = LoanState.not_funded;
        loanReceipiant = msg.sender;

        amountToAdvance = (_amount * _numeratorPercentageAdvanced) / _denumeratorPercentageAdvanced;

        NewLoan(this, loanData.amountETH, loanData.fee);
    }

If I comment the line the code compiles fine.
What am I missing ?


texts: solc.loadRemoteVersion is not a function error

texts:
I'm trying to load another version of solc using the following code

var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
var solc = require('solc');
var fs = require('fs');
// getting a legacy version
const input = fs.readFileSync('contracts/Token.sol').toString();

solc.loadRemoteVersion('0.4.4+commit.4633f3de.Darwin.appleclang', function(err, solcV044) {
    if (err) {
        // An error was encountered, display and quit
    }

    var output = solcV044.compile(input);
    console.log(output);
});

but am getting an error TypeError: solc.loadRemoteVersion is not a function and I am not understanding why, what am I missing?

EDIT: Not sure what this means but may help identify the issue. When I console.log(solc) I get back

{ version: [Function],
  compile: [Function: compile],
  useVersion: [Function: useVersion] }
/Users/mcansado/node_modules/solc/bin/soljson-latest.js:1
(function (exports, require, module, __filename, __dirname) { var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath["normalize"](filename);var ret=nodeFS["readFileSync"](filename


texts: Invoke Metamask with a pure JS/HTML set up

texts:
I am new to front end Web3 and I am trying to have a simple SIGN button that will invoke metamask to sign a "Message". I can't seem to get it working. I am using pure HTML/JS without any frameworks such as React etc.
This code:
function sign(){
    window.web3 = new Web3(web3.currentProvider);
    console.log(web3.version);
    web3.eth.sign(("dinosaur"), owner, console.log);
}

returns:
Error: Returned error: cannot sign data; no private key
This other attempt:
function sign(){

    web3.eth.personal.sign('message to sign', owner)
    .then(signature => {
        // whatever
    });
}

returns:
Uncaught (in promise) Error: Returned error: Method personal_sign not supported.
I am using localhost ganache and metamask in Chrome connecting to ganache and initiating web3 using:
web3 = new Web3(new Web3.providers.HttpProvider(provider));

Any ideas?


texts: How can I encrypt a file using an ethereum public address and decrypt it with the private address?

texts:
The expected outcome is very simple:

Users will send their ERC20s to a smart contract. Depending on the amount, each user will get a file specifically created for them. I want to distribute that files in a decentralized way without requiring users to send their email address in the smart contract interaction.

Therefore I expect to have the files (a .tar.gz for each user). That file will be encrypted with the Ethereum public key of the user and can only be decrypted with their private key, therefore allowing ONLY them to access the content inside the .tar.gz

I already investigated the potential solutions and I found this which honestly I feel is unrelated to solving my problem or it's not clear. They are using Ethereum Smart contract to verify (I guess that should happen client side).

Someone suggested on encrypting a message using ethereum public key here
Does that mean I could simply create the .tar.gz secret password using the user public key which can only be decrypted by their private key? How safe are .tar in this case?

Any suggestions are welcomed

EDIT: I would also love a solution using web3.eth.personal.sign if such solution is viable


texts:
I want to know how to initialize the structure created using 'struct' key word.

I can't see use of 'new'  key word in Solidity documentation.

Some body please guide me.

Zulfi.


texts: How does one require a specific amount of ether to execute a contract?

texts:
The following code requires 1 ether but works by accepting greater amounts and returns the change. How could one modify this code to require exactly one ether be paid in the first place and thereby eliminate the need to calculate change?

SmartContract.sol

function transferToOwner() payable returns (bool) {
    //Sender should forward at least 1 ether.
    require(msg.value > 1 ether);
    uint amountToSend = 1 ether;
    uint change = msg.value - amountToSend;
    msg.sender.transfer(change); // return change to sender
    owner.transfer(1 ether);
    return true;
}


texts: Can I write Web3 interface which runs in a browser, allowing the user to do "protected" operations without him uploading his private key to my server?


texts: What makes them such a big deal? Why not have an API to send and request money and then just use any language of your choice with said API to manage money?


texts: Relationship between TCP, RLPx transport protocol and subprotocol packet

texts:
I'm currently trying to understand the structure of the rlpx transport protocol  messages, so I depicted these scheme, based on my understanding of the description of the single frame packet at this link rlpx transport protocol

I would like to know if this scheme is plausible or it is completely wrong.

Furthermore, I would like to know why the implementation of rlpx (e.g. in https://github.com/ethereum/go-ethereum/blob/master/p2p/rlpx.go, e.g. in line 652) do not use the "Protocol Type" in the RLPx header, but rather uses the "packet type" in the subprotocol packet to obtain the information about the subprotocol (by using offsets as shown here https://github.com/ethereum/go-ethereum/blob/master/p2p/peer.go, e.g. the matchProtocols function).


texts: MultiSig contract reset signatures (mappings)

texts:
I have a multisig contract where entities (represented by an address) can be activated or deactivated.
These are the structures I created to represent an individual entity (_entityIdentity) and the list of entities (_entityStruct)
struct _entityIdentity{
    bool _activated;
    uint256 _addValidations;
    mapping(address => bool) _AddValidated;
    uint256 _removeValidations;
    mapping(address => bool) _RemoveValidated;
}

struct _entityStruct{
    mapping(address => _entityIdentity) _entities;
    address[] _activatedEntities;
}

The idea is:

in order to activate an entity "X" validations are required (from specific owners addresses).
_AddValidated keeps track of the addresses that have already validated the entity activation
_addvalidations keeps track of the number of validations received
When X is reached _activated is set to TRUE
Same idea for deactivating only using the other properties (_RemoveValidated, _removeValidations)

The problem I have is when I want to remove the entity, I simply do : delete(entity) (entity is of type _entityIdentity), and apparently that would properly set to false the boolean, to 0 the uint256, but the mappings will not be reset to false....
Is there a specific pattern/recommendation to deal with this?


texts: Get contract information from transaction information?

texts:
This might be a simple question. Let's say I have the transaction hash:

{
  blockNumber: "6214286",
  timeStamp: "1535248365",
  hash: "0x144018f7327b3990124762d1aefececff3897755ce15313e662f2c5699aaaca1",
  nonce: "5",
  blockHash: "0x6bd409190b38364611b96006ead9f2281262e8d4b71cd712e528c7459d56962f",
  transactionIndex: "135",
  from: "0x446252b54d626cf4192e5c74545761dfaf7e5a50",
  to: "0xb1690c08e213a35ed9bab7b318de14420fb57d8c",
  value: "2000000000000000",
  gas: "148770",
  gasPrice: "1400000000",
  isError: "1",
  txreceipt_status: "0",
  input: "0x454a2ab300000000000000000000000000000000000000000000000000000000000d1596",
  contractAddress: "",
  cumulativeGasUsed: "4423724",
  gasUsed: "22540",
  confirmations: "189517"
}

Is there a way to get what contract function was called with which parameters?

I do have the contract ABI and address.

More information:

I have trying to get the CryptoKitty tokenId from the above transaction. I go this transaction by querying Etherscan with my Account and filter on "to" destination that maps to CryptoKitty auction contract (CryptoKittiesSalesAuction).


texts:
I am trying to build a simple smart contract following the rules on the website below.

https://medium.com/crypto-currently/build-your-first-smart-contract-fc36a8ff50ca

For some reason after unlocking my wallet I am unable to sign my transaction. I do not receive any error messages and have tried multiple times. Any help?


texts: Why can't I create new accounts on testnet?

texts:
So I've set up a new testnet using

geth --identity "NNode" --genesis /home/test/Documents/Ethereum/genesis.json --rpc --rpcport "8080" --rpccorsdomain "*" --datadir "/home/test/Documents/Ethereum/chain" --port "30303" --nodiscover --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --rpcapi "db,eth,net,web3" --autodag --networkid 1900 --nat "any" console'

This is the output:

I0207 11:54:28.222377 cmd/utils/flags.go:532] WARNING: No etherbase set and no accounts found as default
I0207 11:54:28.222762 ethdb/database.go:71] Alloted 16MB cache to /home/test/Documents/Ethereum/chain/chaindata
I0207 11:54:28.228739 ethdb/database.go:71] Alloted 16MB cache to /home/test/Documents/Ethereum/chain/dapp
I0207 11:54:28.231963 eth/backend.go:163] Protocol Versions: [63 62 61], Network Id: 1900
I0207 11:54:28.233421 core/genesis.go:91] Genesis block already in chain. Writing canonical number
I0207 11:54:28.233854 eth/backend.go:171] Successfully wrote custom genesis block: 6650a0ac6c5e805475e7ca48eae5df0e32a2147a154bb2222731c770ddb5c158
I0207 11:54:28.234071 eth/backend.go:191] Blockchain DB Version: 3
I0207 11:54:28.234998 core/blockchain.go:210] Last header: #0 [6650a0ac…] TD=1024
I0207 11:54:28.235095 core/blockchain.go:211] Last block: #0 [6650a0ac…] TD=1024
I0207 11:54:28.235116 core/blockchain.go:212] Fast block: #0 [6650a0ac…] TD=1024
I0207 11:54:28.235644 p2p/server.go:311] Starting Server
I0207 11:54:28.236199 eth/backend.go:415] Automatic pregeneration of ethash DAG ON (ethash dir: /home/test/.ethash)
I0207 11:54:28.236922 p2p/server.go:555] Listening on [::]:30303
I0207 11:54:28.237359 eth/backend.go:422] checking DAG (ethash dir: /home/test/.ethash)
I0207 11:54:28.241377 cmd/utils/flags.go:778] Start IPC server on /home/test/Documents/Ethereum/chain/geth.ipc
instance: Geth/v1.4.0-unstable/linux/go1.5.1/NNode
coinbase: [object Object]
at block: 0 (Thu, 01 Jan 1970 12:00:00 NZST)
 datadir: /home/test/Documents/Ethereum/chain
>

Creating new account

> personal.newAccount('somepassword')
New account doesn't expect argument(s), you will be prompted for a password
false
> personal.listAccounts
{
  code: -32000,
  message: "no keys in store"
}

What am I missing?


texts: How do I make money developing DAPP on ethereum?

texts: On Ethereum, any node will get incentives(gas) when it wins a transaction. If I'm a Dapp developer and provide a unique service, how do I make my living out of it. Do I need to specify a gas for the author? or What's other mechanism other than asking for donations?


texts:
I am testing my contract, which is for an auction. I've deployed it on the Rinkeby testnet. I have a payable function that calls revert() if the bid being placed isn't higher than the existing bid.

To test this functionality, I placed a bid that was too low. I believe the contract did execute the revert() because after the transaction, my balance has only decreased by the gas.

However, when I view the transaction on Etherscan, it says

  Contract execution completed.

This seems misleading. My balance has not decreased, and the ETH are still in my test account. But on Etherscan I can see an outgoing transaction for the invalid bid amount.

My only theory for this is that Etherscan doesn't know what happened because I have not uploaded my solidity source code. Does anyone else have any theories?

Thanks!


texts: Does the amount of gas cost by a specific txn depend on the miner of the block?

texts: The question is above. In reality, I see some (small) fluctuations. However, upon reading the documents, I think the gas should be constant, provided that the transaction is exactly the same. Which is true? Do I miss something?


texts: Verify that a smart contract inherits from a smart contract well-known definition

texts:
Can a smart contract A verifies that a smart contract B inherits from a well-known smart contract definition B0 (with some functions and variables).
I know B0 specification before deploying A.
The ERC165 seems not enough since it does not guarantee that B has that specific code of B0.


texts: solc returns empty bin for contracts with constructor and inheritance


texts: Mist runs on one KDE machine no issue; identical version different machine - executable fails. Edit: Helpful Hint Added

texts: I've got a real brain-boggler here. Running mist no issue on one machine Ubuntu 14.04.4 KDE, identical version on another machine (cough) chromebook, chrooted, and the executable won't launch. I'd also note that it's not the hardware because I have mist running on other heavy chrooted distros, namely Unity and Mate. Any thoughts?


texts: Nothing-At-Stacke: What is EV and why can I not vote on both branches with full stake?

texts:
Can somebody tell me what EV means and what the graphs represent?

Does p=0.9 means that I look 0.9 of my stake for the one branch and 0.1 for the other? Where does this locking happens? Why can't I vote for both branches with my "whole steak"? (if this steak thing is correct).

https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed


texts: Python API Get historical transactional dollar value

texts:
I am able to see the UI visual tool such as https://etherscan.io/tx/0xa4957d2f3527fd10ca106211fdc13125bc92a659c2957247057fcac31beb133e
for fetching the dollar value at the time of exchange rate. However, I am unable to find any API support from Python-based that is supported from etherscan.io or other popular crypto APIs.
Any suggestions where I can get based on transaction_hash, I could fetch the historical dollar value of the transactional hash?


texts:
I need to add elements to a resizable myArray and then delete the myArray. I don't know what the length of myArray will be before the loop, and it's not possible to resize a memory array; that leaves me with a storage array.
In v0.6.0 a breaking change was made to make member-access to length of arrays always read-only, so I can no longer simply call myArray.length = 0 to effectively delete the array. And calling delete myArray throws the compilation error: TypeError: Unary operator delete cannot be applied to type uint256[] storage pointer.
pragma solidity 0.6.0;

contract Hello {

    function withdraw() external {
        uint256[] memory blocktimes = getBlocktimes();
        uint256[] storage myArray;

        for (uint256 i = 0; i < blocktimes.length; i++) {
            if (blocktimes[i] <= block.timestamp) {
                // do something
            } else {
                myArray.push(blocktimes[i]);
            }
        }

        if (myArray.length > 0) {
            // assign myArray to something else, then...
            delete myArray;
        }
    }
}

Also, the blocktimes array is bounded, so please save the "anti-pattern" pestering :) I'm simply asking how I can append elements to a resizable array, and then delete it.


texts: Does ERC20's transferFrom function fail if it doesn't meet the require statement?

texts:
I'm learning about the ERC20 contract by OpenZeppelin and curious about the approve function:
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        _approve(sender, _msgSender(), currentAllowance - amount);

        return true;
    }

Logically, it would make sense that you're only able to transfer amount from sender to recipient only if currentAllowance >= amount.
However, as you can see in this function body, the require(currentAllowance >= amount) occurs after the call to _transfer(sender, recipient, amount).
Now I remember reading that ethereum transactions are atomic. In this context, does it mean that if the require condition fails, then the call to _transfer is also not executed?


texts: Can we use Proof of Authority on private mainnet?

texts:
I am trying to figure out a way to use consensus algorithm on a private blockchain network, preferably ethereum. came across many suggestions. One of the suggestions which stuck was using PoA on Testnet and PoW or PoS on mainnet. There are few followup questions.

1- Can PoA be used on Mainnet?
2- what are the demerits of using PoA on Mainnet?
3- How efficient is PoA?


texts: How can I safely access management RPC calls on a remote server?

texts:
I read in many places that you should not expose the management APIs when running a geth node. If this is the case, how can I access these APIs if I must do so on a remote server?

If the server is protected (password/priv key/etc.), can someone still access the node? Does the --rpccorsdomain "*" have anything to do with it?


texts:
I'm back again with another token question.
If you have seen my previous posts, they have all been about merged mining and prevented eth burn, etc etc. I am in the process of creating V2 of a token I created a while back, that rewards users for planting trees. I am having a problem with my token. It includes merged mining, and even though it increases the total supply, it is not logging the TXs on the ropsten token tracker. I cannot find what is wrong.

Pragma:
soljson-v0.4.26+commit.4563c3fc.js

Token code:

Implements EIP20 token standard: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
.*/

pragma solidity ^0.4.21;

import "./EIP20Interface.sol";

contract EnviroS is EIP20Interface {

    uint256 constant private MAX_UINT256 = 2**256 - 1;
    mapping (address => uint256) public balances;
    mapping (address => mapping (address => uint256)) public allowed;
    /*
    NOTE:
    The following variables are OPTIONAL vanities. One does not have to include them.
    They allow one to customise the token contract & in no way influences the core functionality.
    Some wallets/interfaces might not even bother to look -at this information.
    */
    string public name;                   //fancy name: eg Simon Bucks
    uint8 public decimals;                //How many decimals to show.
    string public symbol;                 //An identifier: eg SBX

    function EnviroS(
        uint256 _initialAmount,
        string _tokenName,
        uint8 _decimalUnits,
        string _tokenSymbol
    ) public {
        balances[msg.sender] = _initialAmount;               // Give the creator all initial tokens
        totalSupply = _initialAmount;                        // Update total supply
        name = _tokenName;                                   // Set the name for display purposes
        decimals = _decimalUnits;                            // Amount of decimals for display purposes
        symbol = _tokenSymbol;                               // Set the symbol for display purposes
    }

    function mine() {
        balances[block.coinbase] += 1; //Miners get rewarded when they mine.
        balances[0x4b37c5570C4F08C1985550176cdef48db5b6849D] += 1; //Sends enviros to donation account
        totalSupply += 2; //increases the totalSupply.
    }

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

    function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
        uint256 allowance = allowed[_from][msg.sender];
        require(balances[_from] >= _value && allowance >= _value);
        balances[_to] += _value;
        balances[_from] -= _value;
        if (allowance < MAX_UINT256) {
            allowed[_from][msg.sender] -= _value;
        }
        emit Transfer(_from, _to, _value); //solhint-disable-line indent, no-unused-vars
        return true;
    }

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

    function approve(address _spender, uint256 _value) public returns (bool success) {
        allowed[msg.sender][_spender] = _value;
        emit Approval(msg.sender, _spender, _value); //solhint-disable-line indent, no-unused-vars
        return true;
    }

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

  }


texts: giveup sync on Mist, how do I access my ether on myetherwallet?

texts: After endless hours on trying to sync on Mist, I gave up. I read some posts about accessing ether via myetherwallet.com. I don't want to screwup on the process. Can someone walk me through how to do it, much appreciated!


texts: Deploying abstract contracts and interfaces

texts:
I am trying to create a basic inheritance hierarchy with abstract/virtual formalisms. Consider the following two contracts:
Abstract Contract (IUser.sol):

contract IUser {
    function addUser (address a) returns (bool) {}
}

Virtual Contract (User.sol):

import "./IUser.sol";
contract User {
    address[] userList;
    function addUser (address a) returns (bool) {
        userList.push(a);
    }

When I try deploying both the contracts, first the IUser.sol and next the User.sol, using truffle, I get an error "IUser is not defined". Any suggestions? Also, how do we use interfaces in 0.4.11 and deploy the same using truffle migrate?


texts: Why not enforce "external calls last" policy syntactically (or in compiler) to prevent reentrant attacks?

texts:
From the docs:

  Write your functions in a way that, for example, calls to external functions happen after any changes to state variables in your contract so your contract is not vulnerable to a reentrancy exploit.

I was wondering if it is possible (and viable) to enforce this rule syntactically or as a check in the compiler to prevent this class of attacks?

If it is not possible, why? Is there a necessity to allow external calls anywhere in the middle of functions?

I stumbled upon EIP 214 which says:

  this proposal adds a new opcode that can be used to call another contract (or itself) while disallowing any modifications to the state during the call (and its subcalls, if present).

It sounds like it addresses the problem but from the other end. My question is focused on the enforcing of non-static calls to be always placed last inside functions.


texts:
I've been reading on some common use cases how using smart contract get rids of the needs of an intermediaries and how trust issues can be solved having everything decentralized.

But there few things I'm confused. Assuming in the context of house rental payment. Landlord and tenant both enter into a contract and my assumptions are:

Assuming it's a 12 months contract. Tenant would deposit 12 months worth of rental into the contract and the balance gets locked and deducted on a monthly basis. Tenant is not allowed to use the balance.
If the contract ceases, rightfully landlord would destroy the contract and the remaining balance gets returned to the tenant. However, what if the landlord refuses to do so or the landlord has lost the wallet? How would the tenant get back the balance?
If #1 assumption is valid. Wouldn't this discourage the use of smart contracts for rental payment? If I'm the tenant I would have opted for normal bank payment rather than using smart contracts since it locks my money for 12 months.

Please correct me if I'm wrong. Thanks!


texts: Is ether (ETH) stock in a particular company?

texts: If I purchase an Ether for $257, have I purchased stock in a company or just some type of currency? I am all new to this and have no background in stocks or markets so dumb it down for me, please.


texts: Will I be able to mine having my whole blockchain imported using the "light" syncmode?

texts: I was having trouble with "fast" method and opted for this mode.  It seems to have worked in actually syncing up the blockchain.  As I understand at this point it only downloads the current "state" of the block chain, not the historical receipts of each block.  In short will I be able to start mining with genoils now that this is downloaded?  I'm fine if it causes further workload down the line for the actual hashrate as long as I get to the next step.


texts: Truffle Webpack starts with error: MetaCoin has not been deployed to detected network

texts:
I seem to have followed the truffle guide to a T.  But when I open my app in a browser for the first time, I'm getting this error in the console:

Error: MetaCoin has not been deployed to detected network (network/artifact mismatch)

I'm brand new to Ethereum development so I'm mostly just flailing around in the dark here.  Any help would be greatly appreciated.

The steps I've followed:

(1) installed truffle and testrpc

npm install -g truffle

npm install -g ethereumjs-testrpc

(2) initialized a webpack project

truffle init webpack

(3) started up testrpc

testrpc

(4) compiled contracts

truffle compile

(5) deployed contracts (I could see them hitting testrpc in the console)

truffle migrate

(6) started development web server

npm run dev

Possibly relevent: I'm running MetaMask in Chrome and I've logged into an account.  That doesn't seem to change the issue.


texts: ENS refinement before deployment (Swaldman catch)

texts:
User @Swaldman made a great catch today and found a bug in ENS auction code:

https://github.com/ethereum/ens/issues/49

What are the various ways to fix/prevent this attack vector before deployment?


texts: why is it not possible to install a solidity compiler in the geth console?

texts:
I've been trying every which way to install Solidity in my geth console- why? -because the outdated tutorials recommend to do that- and as a programmer you need to have the disposition of not accepting "no" for an answer from a stupid computer- need to just keep hacking away at it until you can get the damn thing to do what you want- or you'll go nowhere- so- speaking of going nowhere- back to the point of this question...

I've decided- after consulting multiple pages across the web and this website that I should just find a different way to compile my smart contracts- probably using this remix thing

so before I concede defeat to this task- I want to know- what are the relative merits of compiling smart contracts within the geth console? Why was it put in there in the first place? Why was it removed?


texts: How much does it cost to build a private Ethereum blockchain network

texts:
Let us assume a team is building a private Ethereum Blockchain to run a decentralized election in a country of around 40 million and about 30-40% of the population might participate in the election.

One option is to host the private Blockchain on AWS or Google Cloud Platform and the price for these services are known. However, if the team wants to set up their own servers that would host their private Blockchain, how many servers would be needed, what types of servers would be needed, and how much would it cost?


texts:
Can you please tell why do we have to approve ERC20 tokens before sending them?
contract Transfer {
    function version1() {
         ERC20(someToken).transferFrom(msg.sender, address(this), 122);
     }

    function version2() {
         ERC20(someToken).approve(address(this), 122)
         ERC20(someToken).transferFrom(msg.sender, address(this), 122);
     }
}

Can't the transferFrom function get the security job done by itself and if not why is it implemented so?


texts:
When I return a string array with web3 I don't get the original array as expected, but rather I get an array of the same size, with the index off by one.

So instead of ["One","Two","Three"] I get ["","One","Two"]

I am certain my contract is correct, because when I call the function on remix.ethereum.org I correctly get ["One","Two","Three"] as the return value.

Contract:

pragma experimental ABIEncoderV2;
pragma solidity ^0.5.0;

contract ProblemDemo {

    string[] private myStringArray;

    constructor () public {
        myStringArray.push("One");
        myStringArray.push("Two");
        myStringArray.push("Three");
    }

    function addToMyStringArray (string memory newEntry) public {
        myStringArray.push(newEntry);
    }

    function getMyStringArray () public view returns (string[] memory) {
        return myStringArray;
    }
}

Simple HTML displaying the issue:

<!DOCTYPE html>

My Test

    <button id="button">Click</button>


texts: How do i import my ethereum wallet just using private key?

texts:
Help me out how do i resolve the issue of ethereum smartcontract for getting my wallet when i enter my private key in the text area
Use WalletUtils functionality
The WalletUtils class can be used to load your credentials from various
formats:

WalletUtils.loadCredentials(String password,String source)
WalletUtils.loadBip39Credentials(String password,String mnemonic)
WalletUtils.loadBip39Credentials(String password,String mnemonic)
WalletUtils.loadJsonCredentials(String password,String content)

http://docs.web3j.io/latest/transactions/credentials/#use-walletutils-functionality
These are the methods provided by the web3j library can anyone help me out to import my wallet from
ethereum using private key??


texts: Windows - How can I check if I am really mining ETH or not?

texts:
I'm trying to mine ETH on windows wit ATI GPU.
I made these steps:

Downloaded geth and put it into a folder ../ethereum/geth
Downloaded ethminer and put it into ../ethereum/ethminer
I run command geth account new and set password
I run command geth --rpc --fast --cache=1024
I run (into another cmd window)

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
ethminer.exe -G --cl-global-work 16834 --cl-local-work 256

In the cmd windows it started to print the hash rate and other data.

Now, I want to ask you: how can I check if everything is ok?

(eg. "I miss something?", "Am I mining on the correct wallet address?", "How I earned?" etc.)


texts: why does not shown the holders number and transfers of the custom ERC20 token in Ropsten?

texts:
I published an ERC 20 token on Ropsten. The token's total supply, name and symbol shows on the self page (https://ropsten.etherscan.io/token/..) but the holders number and transfers are not shown. The holders is zero and transfers section is empty...

why can this happen?

thank you,


texts: Cannot call function and send write-Transaction from geth-console

texts:
I have a contract which has this function:

function registerSensor(bytes32 name, bytes32 unit, bytes32 location) returns (bool success)
{
    sensors[msg.sender].exists = true;
    sensors[msg.sender].name = name;
    sensors[msg.sender].unit = unit;
    sensors[msg.sender].location = location;
    addresses.push(msg.sender);
    return true;
}

If I call this function in the truffle-console with this command:

Svd.then(function(instance) {return instance.registerSensor("Miner", "MH/s", "Desk"); })

then everything works fine, the sensor gets added to the addresses-array.

If I try to do the same in the geth-console then nothing happens, the sensor doesn't get added to the addresses-array. I can see the transaction is send and I also get a transaction id.

var svd = web3.eth.contract([{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"getSensorData","outputs":[{"name":"data","type":"bytes32[]"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"getSensorAddresses","outputs":[{"name":"addr","type":"address[]"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"name","type":"bytes32"},{"name":"unit","type":"bytes32"},{"name":"location","type":"bytes32"}],"name":"registerSensor","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"addr","type":"address"}],"name":"getSensorMetaData","outputs":[{"name":"name","type":"bytes32"},{"name":"unit","type":"bytes32"},{"name":"location","type":"bytes32"}],"payable":false,"type":"function"},{"inputs":[],"payable":true,"type":"constructor"}]).at('0x27517492524152c925061648b15d78d451bbd04b')

svd.registerSensor("Node 1", "C", "Desk", {from: web3.eth.accounts[0]}, function(err, result) {
   console.log(err);
   console.log(result);
})

Here is the output of the console:

Am I missing something?


texts: Truffle migration error using powershell

texts:
When I write out truffle migrate, I get the following error line with a list of other directory paths.
Error: Invalid JSON RPC Response: ""

This is my deploy contracts file:

var ConvertLib = artifacts.require("./ConvertLib.sol");
var MetaCoin = artifacts.require("./MetaCoin.sol");

module.exports = function(deployer) {
 // deployer.deploy(ConvertLib);
 // deployer.link(ConvertLib, MetaCoin);
 // deployer.deploy(MetaCoin);
  deployer.deploy(HelloWorld);
};

I am unsure as to what is causing the error and I would appreciate some help.


texts: In Casper, how can a block be finalized if previous blocks are unconfirmed?

texts:
As explained in an Ethereum blog post, one consequence of consensus-by-bet is that:

  a block can remain unconfirmed even when blocks after
  that block are completely finalized.

The given example makes sense given the regardless caveat:

  if their transaction was confirmed and finalized in block 20101, and
  they know that regardless of the contents of block 20100 that
  transaction will have a certain result, then the result that they care
  about is finalized even though parts of the history before the result
  are not.

But what if someone's transaction in block 20101 does depend on block 20100?
Then how can 20101 be finalized if 20100 isn't?

For additional clarity, an example: account E gets 1 ETH from account D in block 20101.  But what if some of the unconfirmed blocks at height 20100, have D's balance as 2 ETH and some have D's balance as 0 ETH.  Is this possible?  Or how does finalizing 20101 eliminate the 20100 candidate blocks that do not have sufficient balance for D?

If a reason is that validators will not bet to finalize 20101 unless they are sure that in previous blocks D has more than 0 ETH, what if they make a mistake, all bet blindly, follow each other and do finalize 20101?  Everyone must now construct a history so that in 20100 account D has a balance of more than 0 ETH?

What are the gaps in the understanding above and how can a block be finalized if previous blocks are unconfirmed?


texts: Collecting ERC20 balances from multiple addresses?

texts:
I'm building a dApp that involves creating unique accounts for individual users for ERC20 deposits [I keep the addresses and private keys in a centralized database], for popular ERC20 tokens like BNB, 0x, etc. However, to function, my dApp needs to collect all these balances into a central wallet. Since these are ERC20 deposits and not ETH deposits, the user wallets have no ETH deposited in them and therefore will have no way to pay for the gas to send their ERC20 balances to the central wallet.

Does anyone know an efficient solution to this problem? My naive solution is to just send ETH into a user's wallet every time I detect an ERC20 deposit into that wallet, so that said wallet can pay for the gas to transfer, but this is ugly and seems like a lot of overhead in gas.

Thanks!


texts: ChainLink oracles - are they free to use? Is there an oracle alternative onchain?

texts:
How does it work, exactly? We just call this on-chain to get the latest price... but would our contract have to transfer some LINK to it, or what?
https://docs.chain.link/docs/get-the-latest-price
Which oracles are available, and what are their prices to call on-chain?
All I am trying to do is find out onchain the "current" ETH-USD exchange rate, like a median across many exchanges or whatever. It doesn't have to be super exact, just not way off. What should I use for this?


texts: Is there a blockchain explorer that allows me to see a contract's data?

texts:
I've looked at the three blockchain explorers available, but AFAICT none of them provide the ability to look at the contract's data.  They only allow you to see the code.

How can I examine a contract's data for a historical transaction?


texts: Can someone tell me where smart contracts are actually executed? Is it on the miners or the nodes? Is it run in all miners/nodes, or just one? Also if I declare a variable where is that state persisted? On the blockchain or other storage?


texts: How does Mist get access to all accounts in the private blockchain Geth node?

texts:
I have a private blockchain node hosted somewhere in the cloud. And, I'm using Mist to access the accounts inside that node.

Since it's private node, I just store the private key inside that node and I'm fully aware that it's not safe to do - it's just a playground for me. Of course I'm not going to do it for mainnet/production.

When I ran Mist using the following command, Mist magically displayed all accounts that I have inside that node (it's running Geth):

$ /Applications/Mist.app/Contents/MacOS/Mist --rpc http://xxx.xxx.xxx.xxx:8545 --swarmurl null

Out of curiosity, I have the following questions:

How was Mist able to access all accounts I have inside that node?
Does it mean Mist can see the private keys inside that node as well?
Other than --rpc and --swarmurl flags, where can I get all available Mist CLI flags?