texts:
I created an ICO using ropsten (because I did not have an ETH) and when I search for my ICO on https://etherscan.io, I cannot find it.

I can only find it here: https://ropsten.etherscan.io.

Is it normal, because the ICO that I created is not a test. It is the ICO that I will launch.

Thank you for your answers.

Please excuse my English.


texts: How to transfer ether from Metamask to Myetherwallet

texts:
I have some Eth on Metamask. How Can i safely transfer it to myetherwallet?

I have created a 'wallet' on myetherwallet, And I can clearly see an 'account address' on the right. Is this where I send it to?

Is it that simple ? Or do i need to export the private key of my metamask wallet on myetherwallet.com first? Then make the transfer on myetherwallet.com itself

I'm guessing yes?
Because i thought there was gas and fees, but metamask doesn't ask me about that when i click the 'SEND' button. The only box it has for anything else is - Transaction data.

Or can i send directly from Metamask browser wallet address -> Myetherwallet address

Thanks for the help


texts: No luck recovering public key after EIP 155


texts: DeclarationError: Identifier not found or not unique. Two contracts in the same file

texts:
This is the Contract that I want to use a function of:
contract Origin{
    uint transfer_amount = 0.1 ether;
    address payable owner = xxx;
    function invest() external payable {
        owner.transfer(msg.value);
    }
    address payable[] recipients;
}

This is the Contract that I want to connect to the Origin-Contract:
contract Layer2{
    address addressOrigin;
    function setAddressOrigin(address _addressOrigin) external {
        addressOrigin = _addressOrigin;
    }
    function callinvest() external payable{
        Origin origin = Origin(addressOrigin);
        origin.invest();

    }
}

I have both Contracts in the same file. Both do compile, and I can deploy both to Ropsten. I cannot verify the code on ropsten.etherscan. It returns: DeclarationError: Identifier not found or not unique.
The Error points to 'Origin' in Origin origin = Origin(addressOrigin)
Extra node: I struggle to understand what the line actually does.
Also it confused me why the original function 'invest' doesn't need parameters in the code, but on ropsten.etherscan I can type in an amount of Eth to invest.
The goal is of course to use the invest function from the Layer2 Contract.


texts: Trying to understand token creation in Ethereum

texts:
I am looking at Tenx token on the ethereum platform:
https://etherscan.io/token/TenXPay

Here's what I understand, total supply - 205,218,255.9485

Now when I go to: coinmarketcap.com/assets/tenx/

It tells me 104,661,31 in circulation.

So my questions are:

Any ideas on why the total supply is not rounded up? Something to do with the code?
How do I find total token sold during the ICO? I see the balance by going to:

etherscan.io/token/tokenholderchart/0xB97048628DB6B661D4C2aA833e95Dbe1A905B280

and it shows 49% supply held by a single account.
So should I assume only that the 51% supply has been sold and rest is still held in the account?
Will it be true for other tokens too? Because QTUM shows me:

etherscan.io/token/tokenholderchart/0x9a642d6b3368ddc662CA244bAdf32cDA716005BC

How do I find the token creator address? Will it be same as the highest token holder?
Any ideas on how do I pull this info for NXT and OMNI platforms?


texts: Why I am in the top 4 positions of the Parity txqueue? (not local)

texts:
I've been wondering why none of my transactions have been going through. Now, I understand the network has been overloaded from the status.im ICO but it seems odd that I would show up in the top 4 of (global?) Parity transactions waiting. Curious.

I actually made more transactions that this but somehow they disappeared. (about 5) I've tried with various gas prices, but don't want they all to go through at the same time (as some are duplicates)

using Parity//v1.6.8-beta-c396229-20170608/x86_64-windows-msvc/rustc1.17.0

Block count is #3,907,434, which is current

peers: 0/11/25

Any ideas?


texts: How do I deploy a contract complied with solc?

texts:
I am trying to deploy a contract that I have compiled with solc using solc --bin mycontract.sol.

I used to be able to paste the result into Ethereum-Wallet and deploy the contract this way. However, this does not work for this contract (I expect the binary code is to large).

I have tried for a few hours now but I simply can not find a guide showing how to deploy a contract in any other way. But I am guessing I should be able to do it somehow using the geth commandline tool.

I could potentially just paste the solidity code into Ethereum-Wallet and let it compile the code. However, the contract uses imports which I am not sure how to get into Ethereum-Wallet.


texts: How can I push address to dynamic array without duplication?

texts:
I'm developing a web application using Ethereum SmartContract.
And I have a question.

I want to add a address to array of addresses without duplication.
But I can't do without duplication.
It adds all address evenif array contains same value.
Below is code.

function addTokenHolder(address _tokenHolder) returns (bool success) {
  uint len = tokenHolders.length;
  for(uint i = 0; i > len; i++) {
    if (tokenHolders[i] == _tokenHolder) return false;
  }
  tokenHolders.push(_tokenHolder);
  return true;
}

Please advise.


texts: What happens if a dapp website goes down?

texts: Is it possible for a dapp like AAVE to remain up and running on the blockchain, but the website to fail?  If that happened, how would people access their balances?


texts: How can i send ether to multiple address in one transaction by paying one transaction fee?

texts: How can i send ether to multiple address in one transaction by paying one transaction fee. Like i want to publish multiple transaction at one go so i can incur only one transaction fee.


texts: How GPUs could be utilized after network switch to Casper?

texts: Now Ethereum hashrate is ~550 Gh/s. That is approximately 22 thousand very powerful Radeon 290x GPUs. After network switch to PoS this hashpower could be used to mine science through Gridcoin. Or probably more interesting applications will emerge. It seems that there is huge demand for GPU computation from emerging VR industry. Do you have ideas how that opportunity could be used and what implementation already exist today?


texts: Why cant I transfer my Ethereum to my Metamask, each time I try it tells me I have insufficient balance for transaction.  I put in the exact balance to transfer?  Thanks.


texts:
In an oop language, I could do the following:

I can define an interface Foo with a function F(). I then define two classes Bar1 and Bar2 implementing this interface. I can then create an array of Foo called say fooArray. I can then call F in any element without knowing if it is Bar1 or Bar2.

I want to do the same in solidity (within a different contract FooBar), or something similar. Is that possible? Would I then create an array of interfaces and fill it with different contracts? Would that mean every contract will get its own address? That seems a bit unnecessary since I only need to access the contracts via the array, not via their addresses, ie I want the array to behave as much as possible like an array of instances of classes in oop.


texts: How to change the account that is interacting with the deployed smart contract on Ganache?

texts:
When I enter truffle console and start interacting with the deployed contract truffle uses the first address, how to change the address for testing ?

user@user:~/workspace/smart-contract$ truffle console

truffle(ganache)> setAddress("0x0000000....); // how to set the addres ?


texts: Where is the barrier between using uint256 and bytes32?

texts: Since both uint256 and bytes32 space are 2^256, what are the general practices for prioritizing using one over the other? why is bytes32 more expensive to execute gaswise than uint256?


texts: How to add multi sign master wallet to a smart contract

texts: How can I add a Multi Sign Master wallet features to a Smart Contract


texts: If I have several wallets with the same address, how to deal with nonces?

texts:
I access Ethereum from several wallets. Some of the addresses are present in several wallets at once.
I discovered that nonces should always increase. (Right?)
Then if I send transactions from several wallets, the nonces would be incorrect... (so?)
Now I have some pending transactions started from command line (Buidler deployer). Every time I try to deploy the contract, the transaction is stuck. I guessed the deployment stucked once, it causes it to stuck again and again.
How to unstuck it? How to find the pending transactions from my account? (I removed the deployments/ folder in Buidler, so I can't look there.) How to know nonces of pending transactins? (EtherScan does not show nonce for a pending transaction.)


texts: connect ethereum wallet(or mist) to to ethereum local private network

texts:
I would like to create a private network for test. And I would like to connect to this private network from commandline client or Ethereum wallet/mint.

I have created a private network as below.

geth --datadir=./chaindata init genesis.json

The content of genesis.json is genesis.json

Afterwards, I have started private network with following commands. (I have tried both of these commands seperately)

geth --datadir=./chaindata
geth --datadir=./chaindata --networkid 15

Afterwards, I have opened another terminal and try to connect running private network. But it does not connect.

geth attach

I have realised it is trying to connect default geth.ipc which is not running and I have send the running private network's geth.ipc as parameter and I is solved.

geth attach ~/chaindata/geth.ipc

But, I could not change the default geth.ipc for Mist or Ethereum Wallet. How can I connect Ethereum Wallet/Mist to private network?

Ethereum Wallet/Mist error message during startup

Couldn't connect to node? See the logs for more:
...
...
INFO [07-16|15:47:51] Starting P2P networking
Fatal: Error starting protocol stack: listen udp :30303: bind:   address already in use


texts: What is the difference between testrpc and EtherSim?

texts:
These are both "faux-blockchains" for development purposes. Both are recommended from various people as a good tool when developing in truffle. And I even think both are being developed by the same people.

But I'm really having trouble finding which one to use. This tutorial claims that EtherSim will replace testrpc, but the repository being referenced links back to testrpc. There's also another EtherSim repository. All of these seem to be updated in the past week.

Frontier indeed :)

EDIT: Don't have enough reputation to post the relevant links… Two of them will have to suffice. Google EtherSim 0.3.0 to find the second EtherSim repository I mentioned.


texts: How to vaildate the structure of a smart contract?

texts:
I want to automatically verify the structure of a published smart contract.
A smart contract should be valid if the smart contract matches a template. Only the storage can diverge between the template and the smart contract. All functions, etc. should be matching.

Is this possible to test automatically? If so, how?


texts: Which Ethereum library is the one to use nowadays? Contract events on mobile must work

texts:
I used drizzle in our dApp and contract events work fine on Desktop browsers with MetaMask. However, on mobile (tested with Rinkeby deployment on MetaMask and Status on Android) the contract events don't get through. I made a minimal setup to test different libraries: dev-dApp.
Turns out I receive contract events on mobile only when using ethers.js, not via drizzle, web3.js and @truffle/contract. Is this actually the case or do I have errors in my setup? Is ether.js nowadays the way to go? Then I would go ahead and rewrite my dApp.


texts:
I'm having an issue where Solidity Locals doesn't show all the local variables of the function I'm debugging.

In the real code represented by the test code below only _theirId, _myId and myScore show in the locals panel.

In fact whatever I try in terms of variable declaration order only 3 local variables ever show up.

Anyone else having similar issues?

function test(uint _theirId, uint _myId ) external onlyOwnerOf(_testId) {

int myScore;

int theirScore;

TestStruct storage myStruct = tests[_myId];

TestStruct storage theirStruct = tests[_theirId];


texts: Iterating through the ethereum blockchain using Java

texts:
I am trying to iterate through the LevelDB in ethereum to see what data is stored in the blockchain. I have loaded the database and created in itr using Dain's LevelDB api, but I am having trouble pulling any keys from the blockchain. Does anyone have any suggestions?

I also made a post earlier about this toic.


texts: Set rate for crowdsale after it has ended

texts:
The problem I am trying to solve is how to properly price an ICO.

One idea would be to have 10 tokens available.  Do the ICO and collect all the ETH. Then after the ICO has ended, divvy up the tokens according to how much each person paid.

Example 1: There are a 10 tokens.  10 people give 1 ETH each. The sale ends after a day. Each person gets 1 token.

Example 2: There are a 10 tokens.  5 people give 1 ETH each. The sale ends after a day. Each person gets 2 tokens.

I'm trying to minimize the amount of solidity programming.
Is there a way to do this in openzeppelin?


texts:
When compiling a .sol file that contains multiple contracts you get multiple binaries.

How do I know which one belongs to the root contract?

For example looking at etherdelta contract code I can see a few contracts but the binary presented eventually by etherscan is the one of contract EtherDelta, which is the root contract.

So I'm asking - when compiling a .sol file with multiple contracts how do I know which contract is the root contract, or in other words, how does etherscan knows that?


texts: Can you (as a node) manually choose what block to bet on in Casper?

texts:
Ethereum plans to move to the Casper proof of stake algorithm in a future version of the network. However, as nodes are betting on which block will be produced next, does that mean (as a node) you can manually choose to bet on which block is produced next.

If true, someone with large amounts of ether could theoretically choose a block which hasn't been bet on, and bet more than what is betted on the block the majority consensus is betting on. This way, the person with large amounts of ether could manipulate the network to work for him/her self.


texts: What does ERC20Interface do in smart contracts?

texts:
I found this fantastic code used to generate a smart contract which allows you to send your ERC20 tokens to another address.

A simple overview / explanation of how that works is as following:

We initiate a mapping of all the erc20 coins that the smart contract accepts. Let's say you want to accept only BNB, your contract can do that as there is also a function, allowing the smart contract owner to establish which ERC20 to be accepted. Part of the code:

    /**
     * @dev list of all supported tokens for transfer
     * @param string token symbol
     * @param address contract address of token
     */
    mapping(bytes32 => address) public tokens;

    /**
     * @dev add address of token to list of supported tokens using
     * token symbol as identifier in mapping
     */
    function addNewToken(bytes32 symbol_, address address_) public onlyOwner returns (bool) {
        tokens[symbol_] = address_;

        return true;
    }

    /**
     * @dev remove address of token we no more support
     */
    function removeToken(bytes32 symbol_) public onlyOwner returns (bool) {
        require(tokens[symbol_] != 0x0);

        delete(tokens[symbol_]);

        return true;
    }

There are two parts of this smart contract that I don't get. First, what does this code on line 43 do?

ERC20 public ERC20Interface;

From what I found, ERC20 is declared in the openzepelin project which is imported at the beggining. I thought that contracts can be used only with the word 'is' such as (Contract myContract is ERC20).

Assuming that in this circumstance ERC20 comes from the openzepelin project, what does public EERC20Interface do?

I found ERC20 Interface here but I thought that all smart contracts would have this standard 'interface', so why specifically declaring it?

Second part that I don't get is more complex so I will add /** comments

function transferTokens(bytes32 symbol_, address to_, uint256 amount_) public whenNotPaused {
    require(tokens[symbol_] != 0x0);
    require(amount_ > 0);

    address contract_ = tokens[symbol_];
    address from_ = msg.sender;

    ERC20Interface = ERC20(contract_); /** what does this line do? Is it initiating a new instance of ERC20? **/

    uint256 transactionId = transactions.push(
        Transfer({
            contract_:  contract_,
            to_: to_,
            amount_: amount_,
            failed_: true
        })
    );

    transactionIndexesToSender[from_].push(transactionId - 1);

    if(amount_ > ERC20Interface.allowance(from_, address(this))) {
        /** what does ERC20Interface.allowance indicate here? is this line checking that the ERC20 sender has enough balance? **/
        emit TransferFailed(from_, to_, amount_);
        revert();
    }

    ERC20Interface.transferFrom(from_, to_, amount_);

    transactions[transactionId - 1].failed_ = false;

    emit TransferSuccessful(from_, to_, amount_);
}


texts: Migrating ETH 2.0 staking stack from one machine to another on the go

texts:
I was reading through the eth docs but could not see any info about following:

What can be the possible problems of migrating my ETH2.0 staking stack infrastructure from one machine to another.

I was thinking to start on machine X (my own hw or VPS) and then switch to machine Y that can be somewhere else physically and again be:

or dedicated cloud server
or my own machine

In order to do that, I would simply try to migrate the blockchain data, nodes & wallets 1:1 from one machine to another then stop one and let the other catch up (possibly eat some penalties for some short downtime).
Are there some other things that can go wrong - for example:

would not moving the staking machine from Europe to US cause problems?
something I miss completely?

Thanks


texts: How to pass fractional value in buyPrice?

texts:
I am deploying an erc-20 token with 18 decimal places. And I want that if someone calls the buy function with 1 ETH, the contract should return 1500 tokens to msg.sender. The buy function is implemented as:

function buy() public payable returns (uint){
       require(msg.sender != address(0));
       require(msg.value >= 0);
       uint amount = msg.value.div(buyPrice);
       require(balances[this] >= amount);
       uint oldBalance = balances[this].add(balances[msg.sender]);
       balances[this] = balances[this].sub(amount);
       balances[msg.sender] = balances[msg.sender].add(amount);
       uint newBalance = balances[this].add(balances[msg.sender]);
       assert(newBalance == oldBalance);
       Transfer(this, msg.sender, amount);
       return amount;
  }

As per the implementation of this method, the buyPrice should be 1/1500. But since buyPrice is uint, I can not pass decimal values to this variable.

Is there any workaround? Do I need to change the standard buy function to suit my case?


texts: How to get transaction status (programatically, not etherscan)?

texts:
I have a problem when I interact with an Smart Contract, from a javascript webapp. I can execute the transaction correctly when the status is confirmed, but I cannot get any error response when it fails.

myfunction.myTrans.sendTransaction(
    { from: web3.eth.accounts[0], gas: gas, gasPrice:gasPrice, to:contractaddress, value:web3.toWei(document.getElementById("price").value, "ether") },
    function (error, result) {

      if (!error) {
        console.log(result);

      } else {
        console.log("transaction error");
        console.log(error);
      }

    })

When I get an error on Metamask, and I can see it in EtherScan, I don't get any error response in the code. I only get a result when everything goes Ok (transaction confirmed).

Any idea on how to manage transaction errors?

Thanks in advance!


texts: Oraclize __callback function not triggered in Remix Injected Web3 Environment on Ropsten

texts:
I execute below code and everything works fine until the point in which oraclize has to call __callback function. It doesn't get triggered. I check the status var to understand if it is triggered but without success. Is there something wrong with the code or usage of oraclize?

Thanks.

pragma solidity ^0.4.20;
import "./oraclize.sol";

contract Casino is usingOraclize {
   address owner;
   uint public betAmount = 30 finney; //Equal to 0.01 Ether
   uint public totalBets; //Amount of Ether bet for current game
   uint public numberOfBets; //Total number of current bets
   //uint public maxAmountOfBets = 1 //Maximum amount of bets can be made for each game by each user
   uint public limitAmountOfBets = 3; //Maximum amount of bets for each game
   uint public numberWinner; //Number that won last game
   bool public gameStatus;
   uint public stage = 0;
   mapping(uint => address[]) numberBetPlayers; //Who bet for which number
   mapping(address => uint) playerBetsNumber; //Number bet by each player

   modifier onEndGame() {
       if(numberOfBets >= limitAmountOfBets) _;
   }

   //constructor - set bet amount and max bets in each game
   function Casino(uint _betAmount, uint _limitAmountOfBets) {
       owner = msg.sender; //set creator of contract to owner

       if(_betAmount > 0) betAmount = _betAmount;
       if(_limitAmountOfBets > 0) limitAmountOfBets = _limitAmountOfBets;

       oraclize_setProof(proofType_Ledger); //arge
   }

   //check if player exists in current game
   function checkPlayerExists(address player) constant public returns(bool) {
       if(playerBetsNumber[player] > 0) return true;
       else return false;
   }

   //bet function
   function bet(uint numberToBet) payable {
       require(numberOfBets <= limitAmountOfBets); //check if limit has been reached
       require(!checkPlayerExists(msg.sender)); //check that player hasn't bet before
       require(numberToBet >=1 && numberToBet <= 10); //check that the bet is between 1 and 10
       require(msg.value == betAmount); //check that ether send by sender is equal to bet amount
       gameStatus = true;

       playerBetsNumber[msg.sender] = numberToBet;
       numberBetPlayers[numberToBet].push(msg.sender);

       numberOfBets += 1;
       totalBets += msg.value;

       if(numberOfBets >= limitAmountOfBets) generateNumberWinner();
   }

   //generate random numbers using oraclize_newRandomDSQuery function
   function generateNumberWinner() payable onEndGame {
       gameStatus = false;
       stage = 1;
       uint numberRandomBytes = 7;
       uint delay = 0;
       uint callbackGas = 200000;

       oraclize_newRandomDSQuery(delay, numberRandomBytes, callbackGas);
   }

   function __callback(bytes32 _queryId, string _result, bytes _proof) {
       stage = 2;
       require(msg.sender == oraclize_cbAddress());
       if(oraclize_randomDS_proofVerify__returnCode(_queryId, _result, _proof) != 0) { throw; }
       else {
           numberWinner = (uint(keccak256(_result))%10+1);
           distributePrizes();
       }
   }

   function distributePrizes() internal onEndGame {
       stage = 3;
       uint winnerEtherAmount = totalBets / numberBetPlayers[numberWinner].length; //how much each winner will get

       for(uint i = 0; i < numberBetPlayers[numberWinner].length; i++) { //sent ether to addresses
           numberBetPlayers[numberWinner][i].transfer(winnerEtherAmount);
       }

       for(uint j = 1; j <= 10; j++) {
           numberBetPlayers[j].length = 0;
       }

       totalBets = 0;
       numberOfBets = 0;
   }
}


texts: How to write smart contract sending any ethers received back to sender?

texts:
The following Smart Contract is supposed to simply send any ethers received back to the sender:

pragma solidity ^0.4.0;

contract ExampleSmartContract {

  function() payable {

      msg.sender.transfer(msg.value);

  }

}

I published the contract to the Rinkeby Test Network.
When I tried to send 1 Ether from my Account to the address of the Smart Contract, I expected to get 1 Ether back.

However, when trying to send one ether to the smart contract, I get the following error message in MetaMask:

Does anybody know how to write the contract in such a way that it sends any ethers received back to the sender?


texts: Geth account list is blank and also ethereum keystore value is blank

texts:
I am new to ethereum block-chain. I created a smart contract. I want to deploy it on test network(Rinkeby) with ethereum node(geth).I install geth on system.And connect with Rinkeby test network. Ethereum node(geth) connect successfully with Rinkeby.  One place I got stuck. When I attach  geth on second pane on terminal window with command geth attach.

In console I check my account list with geth.accounts so it is blank list.One thing I also mention I check in .ethereum directory in this keyStore directory also empty.

Why eth account list is blank??Where I am doing mistake.If is it possible I am doing mistake in ethereum geth installation??


texts: Is there any way to see all the incoming transactions to a wallet address?

texts: I want to show block confirmations of the user's ether transaction to my account. How do I put watch on the incoming transactions?? I would need the transaction Id to know calculate block confirmations. But I can't view the incoming ether transaction for my account. Any way out?? Thanks.


texts: ERC20 example contract: Is _amount > 0 check necessary?

texts:
Ethereum wiki shows this example function:

14     // Transfer the balance from owner's account to another account
15     function transfer(address _to, uint256 _amount) returns (bool success) {
16         if (balances[msg.sender] >= _amount
17             && _amount > 0
18             && balances[_to] + _amount > balances[_to]) {
19             balances[msg.sender] -= _amount;
20             balances[_to] += _amount;
21             return true;
22         } else {
23             return false;
24         }
25     }

Notice that there are two checks here: _amount > 0 and balances[_to] + _amount > balances[_to]. I understand these two are for preventing the integer overflow attack.

But isn't the balances[_to] + _amount > balances[_to] check enough? Can we remove the _amount > 0 check?


texts: Contract with function payable to receive ERC20 token in one shot?

texts:
I am trying to write a smart contract with a function that receives an ERC20 token (i.e.: DAI), but the transaction to call this function is always failing.
Let's assume I first record the ERC20 Contract address in a mapping where I can handle several tokens, but for this example, I just have 'DAI' as tokenName and assign its DAI contract address in Ropsten:
contractAddressERC20[tokenName] = 0xaD6D458402F60fD3Bd25163575031ACDce07538D;

I am also using an ERC20 interface from OpenZeppelin:
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

Then, I have this function to receive ERC20 tokens. For the example, I would be passing 'DAI' as tokenName and 1 DAI (1000000000000000000)
function depositERC20Token(string memory tokenName, uint256 amount) public {
    IERC20(contractAddressERC20[tokenName]).approve(address(this), amount);
    IERC20(contractAddressERC20[tokenName]).transferFrom(_msgSender(), address(this), amount);
    emit DepositERC20Token(tokenName, _msgSender(), amount);
}

However, calling this function is always failing. Not sure if the 'approve' function should be called directly from the DAI contract by the User, and then call the 'depositERC20Token' from my contract only with the 'transferFrom'. Isn't it possible to do the 'approve' and 'transferFrom' from my contract? If not, the User should execute 2 transactions, which is not that good from a UX perspective.
Is there a way to do the approve & transferFrom in one shot when calling this contract? I've heard of ERC777, but would prefer to keep ERC20 standard if possible.
*_msgSender() is equivalent to msg.sender, as defined in Context.sol from OpenZeppelin


texts: Is Ethereum Virtual Machine suitable to run a blockchain in it?

texts: Is it wise (or is it recommended?) to create a blockchain inside Ethereum's Virtual Machine? Or would it be a waste of resources? I mean, what are the capabilities of Ethereum to run a blockchain inside it? And how big it could be? Would it be very costly. Because to create my own blockchain I can get Ethereum's sources , learn Go, and after some time create my own blockchain from it. But I also can create blockhchain with smart contract, but how limited would it be? This is what my question is about.


texts: Use Values Returned from One Function in Another

texts:
need a little help if you can spare the time.

Making a little card game where people can collect "warrior" cards.

We'll have an initial 12 master "cards" that supply the initial traits for the warriors. I have a struct "Card" for those and they're in an array "cards".

The idea is that someone who wants to collect a particular card will click on it in our dapp, the id of that card will be passed to a function "addWarrior". That function will first call "getCard" that will retrieve the specifics of that card and then call "createWarrior" to use those details to make a copy of the card. That copy is a Struct called "Warrior" and goes into an array called "warriors".

I'm pretty close to getting it working in Remix. I'm getting an "Invalid implicit conversion" type error when I try to compile the contract.

  browser/warriors.sol:61:23: TypeError: Invalid type for argument in function call. Invalid implicit conversion from type(string storage pointer) to string memory requested.
          createWarrior(string, uint16, uint16, uint16, uint16, uint16, uint16, uint16, uint16);
                        ^----^"

Here's my contract code:

pragma solidity ^0.5.0;

contract WarriorFactory {

struct Card {
    string cardName;
    uint16 cardLevel;
    uint16 cardAttack;
    uint16 cardDefend;
    uint16 cardStrategy;
    uint16 cardIssued;
    uint16 maxCards;
}
Card[] public cards;

struct Warrior {
    string warName;
    uint16 level;
    uint16 attack;
    uint16 defend;
    uint16 strategy;
    uint16 winCount;
    uint16 lossCount;
    uint16 warNumber;
    uint16 maxWarriors;
}

Warrior[] public warriors;

function createCard(string memory _cardName, uint16 _cardLevel, uint16 _cardAttack, uint16 _cardDefend, uint16 _cardStrategy, uint16 _cardIssued, uint16 _maxCards) public {
    cards.push(Card(_cardName, _cardLevel, _cardAttack, _cardDefend, _cardStrategy, _cardIssued, _maxCards));
}

function getCard(uint256 id) public view returns (
    string memory _warName,
    uint16 _level,
    uint16 _attack,
    uint16 _defend,
    uint16 _strategy,
    uint16 _warNumber,
    uint16 _maxWarriors) {
        Card storage Crd = cards[id];
        _warName = string(Crd.cardName);
        _level = uint16(Crd.cardLevel);
        _attack = uint16(Crd.cardAttack);
        _defend = uint16(Crd.cardDefend);
        _strategy = uint16(Crd.cardStrategy);
        _warNumber = uint16(Crd.cardIssued);
        _maxWarriors = uint16(Crd.maxCards);

    }

function createWarrior(string memory _warName, uint16 _level, uint16 _attack, uint16 _defend, uint16 _strategy, uint16 _winCount, uint16 _lossCount, uint16 _warNumber, uint16 _maxWarriors) public {
    _winCount = 0;
    _lossCount = 0;
    warriors.push(Warrior(_warName, _level, _attack, _defend, _strategy, _winCount, _lossCount, _warNumber, _maxWarriors));
}

function addWarrior(uint256 id) public {
    getCard(id);
    createWarrior(string, uint16, uint16, uint16, uint16, uint16, uint16, uint16, uint16);
}

}

Any ideas on how to clear that up? Or should I be structuring this differently?

I've currently got all the functions set to "public" just to keep initial testing easy, I expect to change those so the "helper functions" will only be called internally before going live.

Thanks a bunch in advance for any advice you can give.
Kevin


texts: How does one query the Ethereum ENS name service via an API endpoint with a JSON response?

texts: Using the https://ens.domains/ is there a way to query the ENS name service using an API endpoint and get a JSON response? I want to be able to integrate these eth addresses into my application.


texts:
My application runs a while loop to check the balance amount of a token using the standard balanceOf function call. Nevertheless, it takes a couple of seconds for it to fetch an updated balance, how could I fetch balance in real time?
def check_liquidity(self, token_address, check):
   if check == 1:
       self.token_contract = self.fetch_token_contract(token_address)
   token_balance = self.token_contract.functions.balanceOf(Web3.toChecksumAddress(token_address)).call()

   return token_balance

check = 1

while True:
   liq_check = time.time()
   liquidity = self.check_liquidity(contract_inputs["path"][1], check)
   liq_check_time = time.time() - liq_check
   liq_check_time = round(liq_check_time, 4)
   print(liquidity, liq_check_time)
   check += 1

So every iteration of the loop checks for the token balance, but it takes around 20 to 30 checks (Around 3/4 seconds) to update the balance of the token. I'm using QuickNode.


texts:
How I can get ABI in multiple contract code? if the code is here:

Token address is: 0x4960a0Db832c3Bb503F3Da59a274D9385e0Ade5A

Crowdsale contract: 0x7a76d1A86a8b801865eC9134552904366b327A45

I tried to generate with values inside here: function MainCrowdsale(uint256 _saleLengthInMinutes, uint256 _rate, uint256 _goal, uint256 _cap, address _wallet)

Values should be: 33120; 1200; 50; 5000; 0x4960a0Db832c3Bb503F3Da59a274D9385e0Ade5A Am I correct?

Do I need to create more values or is there problem because there's mintable token and token value can't be set until crowdsale ends?


texts: Confused about execution of smart contract and being mined

texts: As I understand, if you call a smart contract function, a miner will pick it up, include it on a block, and execute it. However, assuming you have sufficient gas, what if the computation time to execute the smart contract function takes more time than one block? I feel like I may be misunderstanding something about what it means to be “included on the block.”


texts: How to deploy smart contract to main ethereum network

texts:
I am tring to deploy our ERC20 token in main net it gives an error Error: exceeds block gas limit.
First I download or sync whole blockchain using geth command ( geth --syncmode "fast" --rpc --rpcapi db,eth,net,web3,personal --cache=1024 --rpcport 8546 --rpcaddr 127.0.0.1 --rpccorsdomain "*" )

Then I create a new account using web3.personal.newAccount('password')

Then I am send 0.01 ether this account but when Y trying get balance using web3.eth.getBalance('address') it shows 0 ether I trying this also web3.fromWei(web3.eth.getBalance('0x537eda319150390c2daf11d09d5840cf3bf06344'), 'ether').toNumber(10)

Then I trying to deploy using truffle migrate --reset --network live it gives an Error: exceeds block gas limit.


texts: Drizzle problem: how to connect to infura direct when user has Metamask, but isn't connected?

texts:
I understand how to connect direct to infura if the user has no wallet at all (for displaying blockchain data when users don't have a wallet) the problem is that I don’t know how to connect to infura when users have Metamask installed, but not logged in or connected.

Drizzle is default to MM (if installed) and requires them to connect.

I want to use infura as default for everyone, UNLESS they press the connect button -> then I want to switch to MM.

I’ve tried to change the web3 provider on the fly in window.web3 - didn’t work

I’ve tried to put infura in drizzleOptions as a custom provider - didn’t work

I’ve tried to use different drizzleOptions files for each case - didn’t work

What am I missing?


texts: I would like to do a fast bootstrap of the Ethereum blockchain with minimal disk space usage. Can geth do a pruned fast sync?


texts: What is the max size of transactions can clients like geth keep in txpool?

texts:
What is the limit of transactions Ethereum clients can keep in transaction pool?

Geth can keep 64 transactions per address according to this answer, but what is the max size of total transactions in txpool?


texts: What is the code to allow a contract to automatically sell specific quantities of tokens at different prices?

texts:
I would use the below code to sell my tokens at a specific price (manually set by me). But, how can you allow a contract to automatically sell the first 10 tokens at 0.1 ETH, the next 20 at 0.15 ETH and the rest of 30 at 0.2 ETH per token? How would you code that?

function setPrices(uint256 newSellPrice) onlyOwner {
    sellPrice = newSellPrice;
}

function sell(uint256 amount) {
    if (balanceOf[msg.sender] < amount )
        throw;
    balanceOf[this] += amount;
    balanceOf[msg.sender] -= amount;
    msg.sender.send(amount * sellPrice);
    Transfer(msg.sender, this, amount);
}


texts: Websocket provider reconnects every 1 minute

texts:
I'm developing an application on a private Ethereum chain and trying to listen to some events. I wrote a basic indexer script for listening to events and writing them in a database.

To listen to the events I am connecting to the provider via Web3.providers.WebsocketsProvider. I realized it keeps losing the connection every minute. And actually it does not disconnect, instead, it creates a new connection every minute as I don't catch any logs from error or end events.

As a workaround, I added reconnect options introduced in web3.js v1.2.7. That's how I noticed the regular dropping each minute.

Here's the code:

const Web3 = require('web3');
const TruffleContract = require('@truffle/contract');
const ReviewStorageArtifact = require('./contracts/ReviewStorage.json');
const { logAddedReview } = require('./reviewLogger'); // external module where I write to database.

const providerLink = 'wss://providerLink.org';

// Enable auto reconnection
const options = {
  reconnect: {
    auto: true,
    delay: 1000, // ms
    maxAttempts: 5,
    onTimeout: false
  }
};

// Connect
let provider, web3;
provider = new Web3.providers.WebsocketProvider(providerLink, options);
web3 = new Web3(provider);

provider.on('connect', init);
provider.on('error', e => console.log('WS Error', e));
provider.on('end', e => {
  console.log(e);
  console.log('WS closed');
});

// Connect to instance and listen event
function init() {
  const ReviewStorage = TruffleContract(ReviewStorageArtifact);
  ReviewStorage.setProvider(web3.currentProvider);
  console.log('Trying to conntect weeb3');
  ReviewStorage.deployed()
    .then(instance => {
      console.log('Found instance');
      instance.ReviewAdded() // Listen to ReviewAdded events.
        .on('data', (event) => logAddedReview(event, instance))
        .on('error', console.error);
    })
    .catch(console.error);
}

Here's the output how I noticed the regular reconnections. Notice there are no outputs from .on('error') or .on('end'):

Why could this be happening? Might it be something on the provider side? When I connect to Infura Rinkeby, for example, there are no reconnections taking place. Thanks.


texts: How to understand the last argument of the solidity assembly call(g,a,v,in,insize,out,outsize) outsize

texts:
openzeppelin-labs proxy contract
assembly {
  let ptr := mload(0x40)
  calldatacopy(ptr, 0, calldatasize)
  let result := delegatecall(gas, _impl, ptr, calldatasize, 0, 0)
  let size := returndatasize
  returndatacopy(ptr, 0, size)

  switch result
  case 0 { revert(ptr, size) }
  default { return(ptr, size) }
}

In the official documentation, I got this description.

call(g, a, v, in, insize, out, outsize), call contract at address a with input mem[in…(in+insize)) providing g gas and v wei and output area mem[out…(out+outsize)) returning 0 on error (eg. out of gas) and 1 on success

According to my understanding, the output content will be stored in the memory [out, out + outsize).
I am confused, if the last parameter is set to 0, when the method has a return value, whether it will work well.


texts: Pushing process to background causes high kswapd0

texts:
I have a cpu-intensive process running on a raspberry pi that's executed by running a nodejs file. Running the first command (below) and then running the file on another tab works just fine. However when I run the process via a bash shell script, the process stalls.

Looking at the processes using top I see that kswapd0 and kworker/2:1+ takes over most of the cpu. What could be causing this?

FYI, the first command begins the Ethereum discovery protocol via HTTP and IPC

geth --datadir $NODE --syncmode 'full' --port 8080 --rpc --rpcaddr 'localhost' --rpcport 30310 --rpcapi 'personal,eth,net,web3,miner,txpool,admin,debug' --networkid 777 --allow-insecure-unlock --unlock "$HOME_ADDRESS" --password ./password.txt --mine --maxpeers 100 2> results/log.txt &

sleep 10

# create storage contract and output result
node performanceContract.js


texts: how does the js command run in source codes?

texts:
I just want to be clear how dose the js command run. I trace the code when I type admin.peers in geth console. Then I found that it runs in jsre.go:

// Evaluate executes code and pretty prints the result to the specified output
// stream.
func (self *JSRE) Evaluate(code string, w io.Writer) error {
    var fail error

    self.Do(func(vm *otto.Otto) {
        val, err := vm.Run(code)
        if err != nil {
            prettyError(vm, err, w)
        } else {
            prettyPrint(vm, val, w)
        }
        fmt.Fprintln(w)
    })
    return fail
}

may be val, err := vm.Run(code) could get the result of the command. But how does the otto JavaScript parser and interpreter connect the exact ethereum code ? how does the vm.Run(code) get the result? thank you.


texts:
The scenario is:
I am executing my contract from remix which is connected to my blockchain and I am able to execute functions from both geth console (by creating a contract instance using abi and address) as well as from the remix UI.

Now I try to do the same using a javascript file so that I can have a UI for it. So I create a js file, include web3 library to it and connect it to my blockchain. Till here, I am able to work successfully. On executing document.write(web3.eth.getBalance(web3.eth.accounts[0]) I get the correct balance. But when I try to execute contractInstance.deposit(web3.eth.accounts[0], 10000) (deposit is a method in my contract which takes two parameters, account address and amount) it throws an invalid address error. However, I am able to execute the same line of code from the geth console.

I guess I am making some silly mistake.

PS: I've tried contractInstance.deposit(web3.eth.accounts[0], 10000).call() and contractInstance.deposit(web3.eth.accounts[0], 10000).call but still it throws the same error.

This is the contract.

This is the JS file. (apart from get() method, rest everything is working fine).

Output from the browser (note that the js file is able to print address and balance to the browser's console).


texts: Truffle - how to share variables and functions between test files?

texts:
I have files in Test directory, each one performs different test but all of them contain at least exactly the same functions "register" and "vote", also few arrays like votings = [], groups = [] and variables. I would like to organize it and somehow build a "prototype" with basic stuff with these variables, arrays and functions, and include them to each Test file.

Is this possible?


texts: Unable to transfer ether to a contract from a account in truffle. Getting Exception VM Exception while processing transaction: invalid opcode

texts:
I am trying to simulate send ether fail in KingOfEther contract: The contract is specified below.

contract KingOfEther {
    address public king;
    uint public claimPrice = 20;
    address owner;

    function KingOfEther() {
        owner = msg.sender;
        king = msg.sender;
    }
    function ()
    {

    }
    function claimthrone(uint amount)  {
        if (amount < claimPrice) throw;
        uint value_paid=amount;
        uint compensation =value_paid-claimPrice;
        if(!king.send(compensation))
          throw;
        king = msg.sender;
        claimPrice = value_paid;
    }
    /* other functions below */
    /*function calculateCompensation() returns (uint){
        return 0;
    }
    function calculateNewPrice() returns (uint){
        return 0;
    }*/
}

In test folder of truffle i have added the following test, not complete but just trying to interact with testrpc:

var KingOfEther = artifacts.require("./KingOfEther.sol");

contract("KingOfEtherContract",function(accounts){
   it("first test", function(){
      return KingOfEther.deployed().then(function(instance){
      var koet=instance;
      var account_two=accounts[1];
      var account_one=accounts[0];
      //console.log(KingOfEther.deployed());
      return koet.king.call().then(function(val) {
        console.log(val);
        console.log(account_one);
        console.log(web3.fromWei(web3.eth.getBalance(account_one).toNumber()));
        console.log(web3.fromWei(web3.eth.getBalance(account_two).toNumber()));
          console.log(web3.fromWei(web3.eth.getBalance(val).toNumber()));

        return koet.claimthrone(22,{from:account_two});
      }).then(function(x){
        return koet.king.call().then(function(val) {

          console.log(web3.fromWei(web3.eth.getBalance(val).toNumber()));
          console.log(web3.fromWei(web3.eth.getBalance(account_one).toNumber()));
          console.log(web3.fromWei(web3.eth.getBalance(account_two).toNumber()));
        });
      });

    });});});

On executing i am getting exception on send call.

Contract: KingOfEtherContract first test:
     Error: VM Exception while processing transaction: invalid opcode
      at Object.InvalidResponse (/home/utkarash/.nvm/versions/node/v8.2.1/lib/node_modules/truffle/build/cli.bundled.js:37295:16)
      at /home/utkarash/.nvm/versions/node/v8.2.1/lib/node_modules/truffle/build/cli.bundled.js:224765:36
      at /home/utkarash/.nvm/versions/node/v8.2.1/lib/node_modules/truffle/build/cli.bundled.js:208348:9
      at XMLHttpRequest.request.onreadystatechange (/home/utkarash/.nvm/versions/node/v8.2.1/lib/node_modules/truffle/build/cli.bundled.js:209773:13)
      at XMLHttpRequestEventTarget.dispatchEvent (/home/utkarash/.nvm/versions/node/v8.2.1/lib/node_modules/truffle/build/cli.bundled.js:67130:18)
      at XMLHttpRequest._setReadyState (/home/utkarash/.nvm/versions/node/v8.2.1/lib/node_modules/truffle/build/cli.bundled.js:67420:12)
      at XMLHttpRequest._onHttpResponseEnd (/home/utkarash/.nvm/versions/node/v8.2.1/lib/node_modules/truffle/build/cli.bundled.js:67575:12)
      at IncomingMessage.<anonymous> (/home/utkarash/.nvm/versions/node/v8.2.1/lib/node_modules/truffle/build/cli.bundled.js:67535:24)

Can anyone please help where i am doing wrong? Thanks in advance


texts:
Parity offers four different pruning methods: archive, basic, fast and light:

  --pruning METHOD         Configure pruning of the state/storage trie. METHOD
                           may be one of auto, archive, basic, fast, light:
                           archive - keep all state trie data. No pruning.
                           basic - reference count in disk DB. Slow but light.
                           fast - maintain journal overlay. Fast but 50MB used.
                           light - early merges with partial tracking. Fast
                           and light. Experimental!
                           auto - use the method most recently synced or
                           default to archive if none synced [default: auto].

I just tried out archive because I have enough space and time to do a full sync. It compares to a geth chain size like the following:

 ~ $ du -hs .parity/
17G .parity/
 ~ $ du -hs .ethereum/
15G .ethereum/

Now, I see archive will be pretty much like the default sync'ing in eth or geth. But what is basic, what is light? And is fast the same level as geth --fast?

What is the parity light pruning mode? Is this already to be considered as a light client?


texts: ERC20 token withdrawal from smart contract

texts:
Lets assume situation is this. I have a contract where there are some ERC20 tokens are stored. And there are some whitelisted addresses. I want those addresses to be able to withdraw tokens to their addresses.

example code:

     pragma solidity ^0.4.0;
            contract TokenInterface {
                function transfer(address _from, address _to, uint _value) returns (bool success);
            }

        contract Example contract {

            ...

            TokenInterface private _instance;
            function claimTokens () public onlyWhitelisted returns (bool){
                require(!_investors[msg.sender].claimed);
                uint tokensToBeClaimed =  _investors[msg.sender].invested * ratio;
                if(_instance.transfer(contractAddress, msg.sender, tokensToBeClaimed)){
                     _investors[msg.sender].claimed = true;
                      return true;
                } else {
                    _investors[msg.sender].claimed = false;
                     return false;
                }
            }
            ....
        }

Its not full code, but main thing is here.
I am sure this is not the way to do it, and maybe someone will help me?

EDIT.

I've found this line of code.

contract TokenInterface {
    function transferFrom(address from, address to, uint tokens) public returns (bool success);
    function approve(address spender, uint tokens) public returns (bool success);
}

and then in claimTokens function:

_instance.approve(msg.sender, tokensToBeClaimed);
 _instance.transferFrom(contractAddress, msg.sender, tokensToBeClaimed)

can someone approve?


texts: Block number as part of header rationale

texts: It seems to me that block number is something that can be derived correctly by a node locally (from the parent block relationship). What was the purpose of including it in block header -> making it a part of the hash?


texts: PoA (like rinkeby) safer to generate random number (RNG) this function than POW/POS?

texts:
How can I securely generate a random number in my smart contract?

I heard that a block of random function results can be dropped by a malicious miner. Can POA prevent this?


texts: What happens if I set low Gwei while sending ether

texts:
I was trying to participate in an ico. They recommended we set Gwei at 99 and gas limit at 200000. Well my client has the default set to Wei so I made the mistake of setting 99 Wei instead of 99 Gwei. My transaction on etherscan states estimated confirmation time is a very long time. ICO is already closed so that doesn't matter. My question is will this transaction ever clear or fail and probably have my ether reverted back or that ether is gone?

Tx Hash 0x5391c7e07256e62d4ef861bc8156a7d0b7f7c0e4dac02beee441275809cf2672


texts: Sending tokens out on coinpayments success payment using Web3py

texts:
I'm writing Django app and want to send out tokens using Web3 once Coinpayments sends me callback about successfull payment. The problem is that Coinpayments sends multiple callbacks at once and just in one case tokens are sending, other callbacks get replacement transaction underpriced error. I've already tried to use solutions like add +1 to nonce or remove this parameter, but that doesn't help me because transactions are still building with the same nonce. How can that be fixed or what am I doing wrong?

class CoinpaymentsIPNPaymentView(BaseCoinpaymentsIPNView):
    def post(self, request, order_id, *args, **kwargs):
        status = int(request.POST.get('status'))
        order = Order.objects.get(id=order_id)
        order.status = request.POST.get("status_text")
        if not status >= 100:
            order.save()
            return JsonResponse({"status": status})
        amount = Decimal(request.POST.get('amount1'))
        record = Record.objects.create(
            user=order.user,
            type='i',
            amount=amount,
        )
        order.record = record
        order.save()

        gold_record = GoldRecord.objects.get(from_record=record)

        contract = w3.eth.contract(address=CONTRACT_ADDRESS, abi=ABI_JSON)
        transaction = contract.functions.transfer(order.user.wallet.address, int(gold_record.amount * 10 ** 18)).buildTransaction({
            'chainId': 1,
            'gas': 70000,
            'nonce': w3.eth.getTransactionCount(WALLET_ADDRESS)                      # address where all tokens are stored
        })
        signed_tx = w3.eth.account.signTransaction(transaction, WALLET_PRIVATE_KEY)  # signing with wallet's above private key
        tx_hash = w3.eth.sendRawTransaction(signed_tx.rawTransaction)
        print(tx_hash.hex())
        tx_receipt = w3.eth.waitForTransactionReceipt(tx_hash)

        return JsonResponse({"status": status})


texts:
Hey guys i almost sent ethereum to a scam address luckily it got rejected cause i didnt use enough gas. this is the ethersacan transaction https://etherscan.io/tx/0xd766aa25906b7ea2db40bbe5ef3559bad3e7ec355c9649f042c57d64bfa26719
How can i get the ethereum back now? I already tried to send a different transaction to overwrite it but its still not back.....

Please help...


texts: Faster deployment of contracts using geth

texts:
I'm working with a fairly large contract (~12 KB) on a private test net and deployment times are quite large (not mining the contract, but copying the interface and creating the deployment transaction (especially copying the EVM byte code to the geth console)).

Is there a way to deploy large contracts more quickly in geth?


texts:
I am unable to use evm tool, e.g. leads to a crash:

$./evm --code 60ff60ff --debug run
panic: runtime error: invalid memory address or nil pointer dereference

Is this tool still supported ?


texts: When I use remix,there is a issue "Gas estimation failed,VM Exception while processing transaction: invalid opcode"

texts:
When I use function setDailyAssessmentInfo, error is raised:

  Gas estimation errored with the following message (see below). The
  transaction execution will likely fail. Do you want to force sending?
  VM Exception while processing transaction: invalid opcode

Here is my code:

pragma solidity ^0.4.21;

contract DailyAssessmentScoreContract {

   struct dailyAssessment{
        string dailyAssessmentId;
        string[] period;
        uint[] score;
    }
    dailyAssessment[] daily_assessment;

   function stringsEqual(string storage _a, string memory _b) internal returns (bool) {
        bytes storage a = bytes(_a);
        bytes memory b = bytes(_b);
        if (a.length != b.length)
            return false;
        // @todo unroll this loop
        for (uint i = 0; i < a.length; i ++)
            if (a[i] != b[i])
                return false;
        return true;
    }
    function stringToUint(string s) constant returns (uint result) {
        bytes memory b = bytes(s);
        uint i;
        result = 0;
        for (i = 0; i < b.length; i++) {
            uint c = uint(b[i]);
            if (c >= 48 && c <= 57) {
                result = result * 10 + (c - 48);
            }
        }
    }

   function setDailyAssessmentInfo(string _dailyAssessmentId, string _period, string _score) public {
       bool write = false;
       uint score = stringToUint(_score);
       for(uint i=0; i<=daily_assessment.length; i++)
       {
           if(stringsEqual(daily_assessment[i].dailyAssessmentId, _dailyAssessmentId))
           {
               daily_assessment[i].period.push(_period);
               daily_assessment[i].score.push(score);
               write = true;
           }
       }
       if(write==false)
        {
            daily_assessment[i].dailyAssessmentId=_dailyAssessmentId;
            daily_assessment[i].period.push(_period);
            daily_assessment[i].score.push(score);
        }
   }

   function getDailyAssessmentInfo(string _dailyAssessmentId) public constant returns (uint) {
       uint score;
       for(uint i=0;i<=daily_assessment.length;i++)
       {
           if(stringsEqual(daily_assessment[i].dailyAssessmentId, _dailyAssessmentId))
           {
               uint sum = 0;
               uint scoreLength = daily_assessment[i].score.length;
               for(uint j=0;j<=scoreLength;j++)
               {
                    sum = sum + daily_assessment[i].score[j];
               }
                score = sum / scoreLength;
           }
       }

       return (score);
   }
}


texts: Does contract size affect execution costs?

texts:
Strangely, the execution cost of a function x() seems to sometimes increase with contract size (ie adding code to unrelated parts of the contract). To be clear, when adding the extra code to the contract, it does not affect the x() function. Is this supposed to happen? Why does it happen?

Unfortunately, I noticed this some time ago and don't have an example. I've seen others ask about it too.


texts:
Coming from here: How do I specify a different Solidity version in a Truffle contract?
I still have the same issue, except that even after trying all of the suggested solutions, and even having the truffle-config.js working before by specifying the right version there, my new project doesn't seem to take the version entered in consideration.
I'm working with:

Truffle v5.1.15 (core: 5.1.15)
Solidity - 0.6.4 (solc-js)
Node v12.16.1
Web3.js v1.2.1

And this is my compiler code:

compilers: {
    solc: {
        version: "0.6.4"
    },
}

Whenever I start a new .sol file with pragma solidity ^0.6.4, pragma is highlighted with the following error:

SyntaxError: Source file requires different compiler version (current compiler is 0.4.17+commit.bdeb9e52.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.6.4;
^---------------------^

So my IDE still believes my compiler is going to be 0.4.17...
If I keep writing, I keep getting errors due to deprecated error highlighting (constructor and emit events not working, now is okay...).

Does anyone know what I might have missed?


texts: Why do we write ABI before some functions

texts:
Why do we write "abi" before abi.encode()? I understand that ABI is a like a JSON file used to help interaction of different applications because the solidity code is stored as bytecode, but I don't understand why we write "abi" before some "specific" functions in solidity.
I also know that abi.decode is a specific decoding function but why do we add "abi" before it. What is its usecase?
https://solidity.readthedocs.io/en/v0.5.3/units-and-global-variables.html#abi-encoding-and-decoding-functions


texts:
What are the changes to EVM from Constantinople fork and later forks?
Could you tell me which commit in git?
Or Could you provide a list?
Thank you!


texts: Iterating over all public values of a mapping in web3

texts:
Let's assume we have the standard token contract with balances:

 mapping (address => uint256) public balanceOf;

If I want to know balances of all addresses (who have ever transacted with the contract) in web3, can I somehow construct this state? I.e. I don't know the addresses themselves to call balanceOf(address) to start iterating?


texts:
synching is on and off, it says geth 1.4.10 and not 1.4.12, cant find the 1.4.10 in MACOS to delete so download run synched and yes i've tried the cd's in the console ELI5, or better yet how do I run parity on this El Capitan?

BP gave instructions earlier today explaining that I needed to:

cd "/Applications/Ethereum Wallet.app/Contents/nodes/geth/mac-x64"
./geth attach

// Paste your admin.addPeer(...)

umm clear as mud

Can we please get a lite client that/or wallet that ignores previously installed geth and runs 1.4.12 for macos or tell me how to delete the previous version so on startup it runs the update...

just trying to get a node up for others.

signed lost in missouri


texts: I would like to start mining Ether, but my GPU isn't the greatest and I don't really want to spend the money on a dedicated rig. Is mining from my CPU (in a Linux environment) still worth the Ether? Or will I not be able to keep up?


texts: Problem with understanding Buyer address

texts:
My account address on Remix IDE is 0xCA3…a733c and wallet address is 0x147…C160C. Following is my code obtained from Solidity Tutorial. In this code, buyer address is passed as an argument. I have got 3 addresses in the image, which one is the buyer address? Also in the log file I have “to” and “from” addresses, please tell me which one is the buyer address?

pragma solidity 0.5.4;
contract MyContractEtherEvents {
    mapping(address => uint256) public balances;
    address payable wallet;
    event Purchase(
        address indexed _buyer,
        uint256 _amount
    );

    constructor(address payable _wallet) public {
        wallet = _wallet;
    }

    function() external payable {
        buyToken();
    }

    function buyToken() public payable {
        balances[msg.sender] += 1;
        wallet.transfer(msg.value);
        emit Purchase(msg.sender, 1);
    }
}

The log file is given below:

  transaction hash
    0xa4484b15bd6e83c5377bbc4e21f69e8c208a02c3ea0187ffa77cb29c9352df6e
  from  0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c  to
    MyContractEtherEvents.balances(address)
  0x692a70D2e424a56D2C6C27aA97D1a86395877b3A  transaction cost  23832
  gas (Cost only applies when called by a contract)  execution cost
    1152 gas (Cost only applies when called by a contract)  hash
    0xa4484b15bd6e83c5377bbc4e21f69e8c208a02c3ea0187ffa77cb29c9352df6e
  input     0x27e...a733c  decoded input    {   "address ":
  "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c" }  decoded output    {
    "0": "uint256: 4

The image of the project is:

Somebody please guide me.

Zulfi.


texts: Delay between IPC transaction call and submitting to mempool

texts:
I encountered a problem, where a web3j transaction was successfully submitted via IPC call and yet, it was not submitted to mempool for another 40 minutes. Etherscan did not show the TX as pending and I am positive that it was not queued in mempool (as in txpool.status).
Is there any known buffer in either web3j, or geth that will queue transactions before sending them to the network?
I am using web3j 5.0.0 and Geth 1.10.3.


texts: How to use solidity extension for visual studio code?

texts:
I am new to Ethereum and I am using visual studio code as an editor for solidity.

I wrote a simple program and save it with .sol extension.

pragma solidity ^0.4.0;

contract SimpleStorage {
   uint storedData;

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

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

On Compilation of the current contract (Press F1, Solidity: Compile Current Solidity Contract)

A bin folder with above files is generated after compiling.

Open 'SimpleStorage.json' after compilation from the bin folder. Press F1 and press Solidity: Code generate from compilation output.

A new file with .cs extension a generated as shown above.

I had done up to these steps, What will I have to do for deploying the contract? (Running the solidity contract).

Is there a tutorial for visual studio code solidity extension?


texts: How do I compile interdependent contracts separately in Mist?

texts:
I am working with this Solidity example, using geth console and/or Mist's compiler:

contract InfoFeed {
    function info() payable returns (uint ret) { return 42; }
}

contract Consumer {
  InfoFeed feed;
  function setFeed(address addr) { feed = InfoFeed(addr); }
  function callFeed() { attribut = feed.info.value(10).gas(800); }
}

If, in the Mist compiler, I only include:

contract Consumer {
  InfoFeed feed;
  function setFeed(address addr) { feed = InfoFeed(addr); }
  function callFeed() { attribut = feed.info.value(10).gas(800); }
}

which would make sense if e.g., I were to rely on someone else to (have) provide(d) the code for InfoFeed, I get the following compilation error msg:

 Identifier not found or not unique.
  InfoFeed feed;
  ^------^

How to compile Consumer in isolation please? The tutorials I looked at contains code bits of interdependent contracts, but don't tell me how to go about compiling them.


texts:
I am integrating IPFS into a ReactJS frontend to store text in IPFS (then the address to be stored on the blockchain). I have an import error which is outside my experience and I hope someone can help.

Error -

IpfsAPI
VM153:1 Uncaught ReferenceError: IpfsAPI is not defined
at eval (eval at evaluate (:85:21), <anonymous>:1:1)
at Object.<anonymous> (http://jenbil.com:3000/static/js/bundle.js:32851:24)
at Object.<anonymous> (http://jenbil.com:3000/static/js/bundle.js:33301:31)
at __webpack_require__ (http://jenbil.com:3000/static/js/bundle.js:556:30)
at fn (http://jenbil.com:3000/static/js/bundle.js:87:20)
at Object.<anonymous> (http://jenbil.com:3000/static/js/bundle.js:10871:13)
at __webpack_require__ (http://jenbil.com:3000/static/js/bundle.js:556:30)
at fn (http://jenbil.com:3000/static/js/bundle.js:87:20)
at Object.<anonymous> (http://jenbil.com:3000/static/js/bundle.js:591:19)
at __webpack_require__ (http://jenbil.com:3000/static/js/bundle.js:556:30)

The imports are generally working as others appear, eg

Web3
function Web3(provider) {
    this._requestManager = new RequestManager(provider);
    this.currentProvider = provider;
    this.eth = new Eth(this);
    this.db = new DB(this);
    this.shh = ne…

I have this code -

import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import Web3 from 'web3'
import _ from 'lodash'
import { Navbar, Jumbotron, Button } from 'react-bootstrap';
import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';
import IpfsAPI from 'ipfs-api'

I have ipfs in my node modules -

root@ubuntu-512mb-nyc3-01:/usr/share/nginx/html/ipfs/node_modules# ls ipfs*
ipfs-api:
CHANGELOG.md  CONTRIBUTING.md  examples     LICENSE       package.json  src
circle.yml    dist             gulpfile.js  node_modules  README.md

ipfs-block:
circle.yml  dist  LICENSE  package.json  README.md  src

ipfs-unixfs:
circle.yml  dist  LICENSE  package.json  README.md  src  test

Here is my package.json

root@ubuntu-512mb-nyc3-01:/usr/share/nginx/html/ipfs# more package.json
{
  "name": "zillerium",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
  "bootstrap": "^3.3.7",
    "lodash": "^4.17.4",
    "react": "^15.4.2",
    "react-bootstrap": "^0.30.8",
    "react-bootstrap-dropdown": "^0.3.0",
    "react-bootstrap-table": "^3.2.1",
    "react-dom": "^15.4.2",
    "web3": "^0.18.4"
  },
  "devDependencies": {
    "react-scripts": "0.9.5"
  },
  "dependencies": {
    "ipfs-api": "^14.0.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

And my index.js -

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import './index.css';
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap/dist/css/bootstrap-theme.css';
import 'react-bootstrap-table/dist/react-bootstrap-table-all.min.css';
import IpfsAPI from 'ipfs-api'

ReactDOM.render(
  <App />,
  document.getElementById('root')
);


texts:
The rinkeby faucet only seems to have an option for ether. I'd like some weth so I can test Uniswap v2. Anyone know where I can get some?
Thanks!


texts: Ethereum node stuck can't sync on Win. 8.1

texts: I've downloaded the latest version but can't make the Ethereum node sync. It just states:  Ethereum node needs to sync.. Please wait . I've also turned my firewall off but still not working. Plus I also deleted the /chaindata folder in windows explorer and still not working! Can anyone help? I'm not a techie guy. Thanks.


texts: What's the best way to test the time based aspects of your smart contracts?

texts: I have some functions in my contracts that activate x days after the contract starts, or x days after the contract enters a given state. Are there any best practices (or just practices :P) to test this? I'm using truffle as my framework.


texts:
is there a working block of code that goes from ethereum DAG, hash  and nonce to the mixhash?   I look around it seems to me codes are buried deep in pyethereum and go version of it.  I coded with python codes from ethash wiki and doesn't seem working.  it is very likely that it has something to do with endian.  I need a simple set of code so that I can see the intermediate test result.
Thanks!


texts: How do I remove account(s) from the mist?

texts:
Running 0.7.5 Version on Mac.

Don't see any possibility to remove accounts.
They are test ones, with zero balance.


texts: transactions are not getting mined on rinkeby testnet and last block time is almost 2 hours ago. How did such things happen in a decentralised network?


texts: Using the ethers.js library, how can I determine the gas limit when sending a transaction to a contract or deploying a new contract?


texts: where does faile event go in eth contract?

texts:
If a function has multi events , the first successed but second faile. Can I get all of them in block?

solidity code like this

emit event1
throw
emit event2


texts:
Is it possible the view the list of all contracts an Ethereum address is bound to?
scenarios:

John deposited funds in many DEXs but can't remember which ones. John would like to see if his wallet has funds laying around
Billy interacted with EtherDelta/ForkDelta years ago, but Billy can't remember which coins he transferred


texts: If i am writing two contracts A,B and extending one with other then can i use methods from contract A in contract B when i am deploying?

texts: If i am having two contracts extending one with other then can i use methods available in one contract in another when i have deployed.We have to take them in one file or have to deploy differently and getting them by addresses.


texts:
I am following the link https://docs.goquorum.consensys.net/en/latest/Tutorials/Creating-A-Network-From-Scratch/ and getting stuck after I clone the istanbul-tool and hit make, it is giving me a make error:
Makefile:14: recipe for target Istanbul failed
make: *** [Istanbul] Error 1


texts: What's involved in making a private chain become a sidechain of Ethereum?

texts:
"A private Ethereum-based network that had a linkage allowing ether to be securely moved from the public Ethereum main chain onto it and back would be considered to be a sidechain of the public network"

What are the main steps for the "linkage" and how secure would it be?  For example, are there any concerns about the sidechain being attacked (like there would be if it involved merge mining)?


texts: Solutions for orphan rate in Casper PoS?

texts: What are some possible solutions to deal with the increased orphan rate when Ethereum shifts to its Proof-of-Stake system, Casper?


texts: Can't understand the problem with the code

texts:
I am reading the following tutorial.
Tutorial
What is the problem with the following code:
function withdraw(uint amount) public {
     require(balances[msg.sender] >= amount);
     balances[msg.sender] -=amount;
     payable(msg.sender).transfer(amount);
     transactions++;

}

How is this code causing reentrancy attack?


texts: Smart Contract Execution Rights - Can everyone who knows the public address of a smart contract call the smart contract?

texts:
Say I have a contract with the address and method below.

myContract.at("0x9f8cedf1f93e46fac74cb9415db8bbec85f239b4").greet();

Can everyone who knows this address call this smart contract method? Any permissions restrictions?


texts: Can I hardcode an enode hex-section in a local network?

texts: I have multiple devices with unique IP's. Is there a way to attribute the same enode hex to all of them (while still having unique IP's contained in the enode).


texts: Is there any way to debug a smart contract bytecode by Remix?

texts:
I'm looking for a way to avoid using 3-rd party tools to debug smartcontract without source code. Can I do it by Remix?

I think this way: we need some tool to convert a bytecode or assembly of contract functions to inline assembly (function-style would be ideally) that supported by solc and then I can just copy-paste it to Remix.

Also this question is relevant, but still without an answer.


texts: How to experiment with Ethereum without downloading the entire blockchain?

texts:
I want to experiment with Ethereum without having to download the entire blockchain. My ISP limits my bandwidth to 50GB and downloading the ETH chain would consume a lot of that, not to mention the time. Is there any SPV like implementation of Ethereum? With Bitcoin, I could simply download bitcoinj and start coding.

I have also considered Blockchain as a Service by Azure. Are there any alternatives? (because they need my credit card number.)

What I want to do:

Experiment with simple transactions (sending Ether)
Create contracts
Store arbitrary data on blockchain.

Ideally I would prefer something that runs on JVM but that is not a hard constraint.

One method I have in mind is to run a private blockchain using Ethereum code but with my own genesis block. Will this approach work with other 3rd party Ethereum frameworks (such as Truffle)?


texts: Account Private Keys not Logging with Web3.js with Pure Javascript and HTML on browser

texts:
Here is the code below, I want to create accounts using web3 js and logged the private keys. But am having an error Reference Error and keys not logging. I followed the docs at https://web3js.readthedocs.io/en/v1.2.6/web3-eth-accounts.html# , I want to do it from client side, no node JS needed

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script type="text/javascript" src="web3.min.js"></script>
</head>
<body>

<script>

var Accounts = require('web3-eth-accounts');

// Passing in the eth or web3 package is necessary to allow retrieving chainId, gasPrice and nonce automatically
// for accounts.signTransaction().
var accounts = new Accounts('ws://localhost:8546');

console.log(web3.eth.accounts.create());

    </script>
</body>
</html>


texts: Truffle Migrations missing ConvertLib.sol, etc

texts:
Using testrpc v3.0.3 and solidity
Getting the above error while deploying this contract in testrpc private net

pragma solidity ^0.4.4;
import "./ConvertLib.sol";
import "./Agreement.sol";

contract SmartAgreement {

    address owner;
    mapping (address => uint) balances;

    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    mapping(address => address) agreementsWith;
    mapping(address => uint) priceUpto1Ks;
    mapping(address => uint) priceUpto10Ks;
    mapping(address => uint) priceUpto100Ks;

    function SmartAgreement(){
        balances[tx.origin] = 10000000;
        owner = msg.sender;
    }

   function addAgrement(address from,address to,uint priceUpto1K ,uint priceUpto10K ,uint priceUpto100K) {
        agreementsWith[from] = to;
        priceUpto1Ks[from] = priceUpto1K;
        priceUpto10Ks[from] = priceUpto10K;
        priceUpto100Ks[from] = priceUpto100K;
    }

     function getAgreement(address from) constant returns(address,uint,uint,uint){

       return (agreementsWith[from],
               priceUpto1Ks[from],
               priceUpto10Ks[from],
               priceUpto100Ks[from]);

    }

   function sendCoin(address receiver, uint amount) returns(bool sufficient) {
        if (balances[msg.sender] < amount) return false;
        balances[msg.sender] -= amount;
        balances[receiver] += amount;
        Transfer(msg.sender, receiver, amount);
        return true;
    }

    function getBalanceInEth(address addr) returns(uint){
        return ConvertLib.convert(getBalance(addr),2);
    }

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

    /* Function to recover the funds on the contract */
    function kill() { if (msg.sender == owner) selfdestruct(owner); }
}


texts:
What is the significant of multiple account in an ethereum Wallet?
 I have found same question in the below URL
What is the purpose of multiple addresses in a wallet?

From the answer it is clear that multiple account is there in ethereum for maintainability purposes. I am wondering is there any other advantages of having multiple account within the same wallet.


texts: Is there a log of Ethereum Trading Volume for a given currency over time?

texts: I know CoinMarketCap lists daily trading volumes for multiple currencies, but how do we access a log of these volumes for a given currency over time?


texts:
how do I know if the msg.sender is the owner (the person that deployed) of the contract or a random address that interacted with the contract?
in this case for example:
    address payable owner  =  msg.sender;

    modifier onlyOwner(){
        require(msg.sender == owner);
        _;
    }
    function close() public onlyOwner {
    selfdestruct(owner);
}

why isn't the msg.sender reset at each interaction?


texts:
I want to know the cost of the deployment transaction of my contract. I read the documentation, and there says that I have to use tx.gasprice. I made some test in Remix, in order to prove this method, but it always returns a value of "1" and I don't think this value is gonna be the same every time.

Am I wrong? There is another way to know this value inside the contract?


texts: How to pass parameters to a function that is invoked from inside of Oraclize Callback function

texts:
In the design of my dapp I am using Oraclize to get current time.
Now from its __Callback function I want to call another function to which I need to pass other parameters as well along with current time returned.

How should I pass these additional parameters so that they reach the function inside the __callback function.
One approach that I followed was to pass them first to function executing oraclize_query expecting they will reach the callback function (if I declare those parameters while its invocation) but that didn't work.

I started getting 'InternalCompilerError: Requested type not present' when I passed parameters to function executing oraclize_query.

Please help to guide what is the correct approach to implement such kind of logic. Will appreciate if sample code or references could be provided that attempted same logic

Thanks in advance


texts:
What are the specs for running an ethereum full node in Jan 2019? No fast flags as eth.blocknumber and some other methods needed. PLEASE NEED OFFICIAL ANSWER Thank you!

I have a very powerful machine but its still having problems. 6 cpus, 18gb mem
SSD: 450 GB (42%used) but the node syncs once and then starts lagging behind...


texts: How can I decode the output off geth --trace?

texts:
I've already gotten pretty acquainted with using the geth RPC commands to do block traces.

However, I am looking for a way to do this more directly. Hopefully without directly from geth, so I don't have to rely on scaling the RPC service.

I noticed that get has a debug option --trace value where value is a file. I was able to run this just fine. But here is where I need help. The file appears to be full of hex values, but I could only decode the first line. Here are the first 10 lines:

676f 2031 2e39 2074 7261 6365 0000 0000
4100 8bc3 b988 834b 4500 078e ff2f 1401
6169 e0f0 c601 613b a0ad c701 5c24 1054
b606 1106 ad05 45f4 b001 078e ab32 1501
0f13 065e 45b6 a602 03dd 0409 0502 0066
0b05 5c96 011a 1e4f 0605 45b0 0207 063f
459a 8202 07dd 0916 0504 9991 c088 834b
660a 055c 201a 1e2a 0606 4577 038e 8331
1601 6131 b099 ce01 612c f0ae ce01 61f0
0590 d8ce 015c 3020 5ce9 0120 6192 01d0

How is this log file encoded and what do I need to do to make use of the output here?


texts: Fallback function fails when ethers sent from metamask

texts:
This is my code snippet for fallback function, If I use it by explicity using "fallback" function on Remix, then equivalent no of tokens do come in my wallet but if I send ethers via metamask directly to contract address then it fails always. See transaction hash: https://ropsten.etherscan.io/tx/0x0324500811aa9ee4b6fe0293458eab7b13c10e0cc4bc45b8c892bc6b318730f4

/**
 * Fallback function when sending ether to the contract
 * Gas use:
*/
function () external payable {
    uint256 amount = msg.value;                                                     // amount that was sent
    require(amount > 0);                                                            // need to send some ETH
    balances[msg.sender] = balances[msg.sender].add(amount.mul(1000));              // mint new tokens
    _totalSupply = _totalSupply.add(amount.mul(1000));                              // track the supply
    depositor[msg.sender].time = now;
    depositor[msg.sender].amount = msg.value;
    emit Transfer(address(0), msg.sender, amount.mul(1000));                        // notify of the transfer event
    emit Deposited(msg.sender, amount);                                             // notify deposit event
}


texts: Run multiple nodes on same Ganache blockchain

texts: I am trying to run two nodes on the same ganache blockchain. I tried using the localhost link in the other node which was connected to the same network but it sort of had a mirroring effect. Any idea as to why this is happening and how can I run the same contract on two nodes?


texts: Accept ERC20 tokens back to smart contract

texts:
I have created a smart contract (smart contract per invoice) now the contract is between seller and buyer but the money is provided to the smart contract is from the financier.
Financier pays the money(eth) to the smart contract and gets the token (ERC20 XXXTokens) from a smart contract as a check.

Now the question is when the financier wants a money-back he has to return the tokens(ERC20 XXXTokens) so, how should I check in a smart contract that the user returning the token is the same token that this smart contract generated?

Or any matter of fact how do we check the tokens are from a specific smart contract?


texts: Interaction smart contract and third-party app : How to make sure the request comes from the original contract?

texts:
I'm working on a blockchain project where I need to access data stored outside the smart contract.

The smart contract own a RSA keypair (one public and one private key).
We want the private key to be stored by the community, to do that we use shamir secret sharing. So each member will have a part of the private key.

To do some operations the smart contract need to collect the pieces of keys. He need to ask the community to give their key pieces.

We want the process to be totally secured, and for this, each member of the community need to determine is the request to get the piece of key come from the original deployed smart contract or not.

Do you know how to do that ?


texts: ESOCKETTIMEDOUT ERROR while trying to deploy to Rinkeby

texts: Unable to deploy a simple smart contract to Rinkeby


texts: Parity proof of authority aura, how to detect misbehaviour?

texts:
I'm having trouble finding the answer looking at the Parity POA aura examples, the documentation on Parity Validator Sets, plus the Kovan validator set contract solidity source code.

I see that you can call reportBenign for example and report the validator address and block number for the validator that missed a block.

What I'm confused about is how do you detect when this happens?  Is there a way to know when a block is assigned to a validator originally and they miss it -- the block is then mined by some other node/signer.

My thinking is when this occurs, you should report them to the validator set contract, which can then be handled however necessary, eg. remove that validator from the set when they miss too many blocks.

What am I missing?  Thanks


texts:
So I made database and app logic smart contracts. App logic smart contracts will call functions in database smart contract. One of the functions acts as a way to check the data that has been put in the mapping data. but I received this error

TypeError: Member "checkAirlineRegistered" not found or not visible after argument-dependent lookup in type(contract FlightSuretyData)
... FlightSuretyData.checkAirlineRegistered ...

the error showed to be on my modifier. Here is the code for my App logic smart contract
    pragma solidity ^0.4.25;
    import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";
    import "./FlightSuretyData.sol";

    contract FlightSuretyApp {
        using SafeMath for uint256;

modifier requireRegisteredAirlines()
    {
        require(FlightSuretyData.checkAirlineRegistered(msg.sender) == true, "Caller is not registered Airline");                                       //calling the registered airline from data contract
        _;
    }

here is the database smart contracts
pragma solidity ^0.4.25;

import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";

contract FlightSuretyData {
    using SafeMath for uint256;

    address private contractOwner;                                      // Account used to deploy contract
    bool private operational = true;                                    // Blocks all state changes throughout the contract if false
    uint256 private airlineFunds = 0 ether;                             // balance for funds from airlines registration
    uint256 private insuranceFunds = 0 ether;                           // balance for insurance

struct Airline {
        address airline;
        bool isRegistered;
        uint256 feePaid;
        uint256 regIndex;
        bool isFunded;
        //mapping(address => bool) isVoted;
        uint numVotes;
    }

mapping(address => Airline) public _registeredAirlines;

modifier requireIsOperational()
    {
        require(operational, "Contract is currently not operational");
        _;  // All modifiers require an "_" which indicates where the function body will be added
    }

function checkAirlineRegistered(address checkAirline) external requireIsOperational returns (bool success) {
        return _registeredAirlines[checkAirline].isRegistered;
    }

Hope this snippets are enough for you to understand.


texts: Can GETH or similar nodes download just the most recent blocks ethereum (without having synced anything prior to those blocks)?

texts: A node that has not synced with the Ethereum block-chain, could they begin to just sync new blocks?


texts:
Below is my solidity function.  This function is payable.  I am extracting the value from the msg object and transferring.

    function getStudent(string _searchHash) payable public {
      var searchHash = _searchHash;
      university.transfer(msg.value);
      for(uint i=0; i<students.length; i++)
      {
          if (keccak256(students[i].hash) == keccak256(searchHash))
          {
              emit foundStudentInfo(students[i].fname, students[i].year, university.balance);
          }
      }
      emit foundStudentInfo("Failed","Failed",university.balance);
  }
}

Hopping that the account balance of the university variable is increasing every time i call the above function.

Below is my code from JS.  This code opens the metamask but i do not see the Amount column.  I only can enter the gas value.  So not sure if Amout should come in metamask somewhere as it comes while doing the transactions or it will be part of gas value.  After transaction,  my university account balance remains same it does not change.

function temp (){
     var etherAmount = web3.toBigNumber(0.1);
     var weiValue = web3.toWei(etherAmount,'ether');
     console.log('weiValue ->  '+weiValue);
     Student.getStudent(hashCode,{from:web3.eth.accounts[0],gas:'195253', value:weiValue}, function(error, result){
        if(!error)
        {
            console.log('result in callback  -> ' + result);
        }
        else
        console.error(error);
    });
}

   temp();


texts: Changing the contract state while waiting for the Oraclize __callback()

texts:
I have a contract that uses Oraclize to query some data. When the query is sent, a global variable address is set to the msg.sender. This is to be able to interact with the query sender in the __callback() function.

However, I have a doubt that, while waiting for the __callback() to be executed, another address may initiate the query, and the global state variable address will be set to that new address, and when the __callback() of the first will be executed, it will interact with a wrong address.

Is this a possible scenario? And, if so, how to prevent it? Maybe by linking the __callback() to the query?


texts: Re-entry attack using the transfer function

texts: Is it possible to re-attack if you use the sending of ethers via the transfer function? Do I need to add some defensive logic to my contract in this case?


texts: Cannot import 'VRFConsumer', 'PriceFeed', 'APIConsumer', and 'interface'

texts:
I'm new to brownie ( but not new to python) and am trying to get a basic project running to make sure everything works. I've been going off the Patrick Collins tutorial where uses the chainlink mix. So far I've installed the latest version of brownie and ganache. Everything seemed good there so I ran the bake command for the chainlink mix which also worked fine. The problem that I'm running into is some import errors. Specifically, I'm running into import errors when I try to import: 'VRFConsumer', 'PriceFeed', 'APIConsumer', and 'interface'. These imports are called in the chainlink mix boilerplate code. The errors occur if I try to import them directly or use the wildcard operator. I was tracking the traceback and there seemed to be a connection to the module not being able to find an _sqlite3 dll so I added that folder as a path variable but didnt have success there. I'm currently using anaconda venv with python 3.8.
Thanks in advance!


texts: Factory contract that can verify its children?

texts:
It's possible to create a Factory-type Contract that can spit out other contracts:

contract Greeter {
  string greeting;
  address public creator;

  function Greeter(string _greeting) {
    creator = msg.sender;
    greeting = _greeting;
  }

  function greet() constant returns (string) {
    return greeting;
  }
}

contract GreeterFactory {
    function makeGreeter(string greeting) returns (address) {
        return new Greeter(greeting);
    }

    function verify(address child) returns (bool) {
      Greeter child = Greeter(child);
      // Do something amazing here...
    }
}

But how to verify that a Greeter at a given address is one that came from a trusted GreeterFactory? In other words, how to complete that verify() function on the parent Factory?

Eve could create a contract with a static creator property that imitates a known GreeterFactory fairly easily:

contract BadGreeter {
  address public creator;

  function BadGreeter() {
    creator = 0x1010101010; // Address of a known GreeterFactory contract
  }

  function greet() constant returns (string) {
    return "Trust me...";
  }
}

A user could easily look at the blockchain to grab the bytecode for a contract and see the difference between BadGreeter and Greeter. But how could we build it so a separate contract could do it (via a call to a verify(address) method of some sort that's trustless)?


texts: How can I dislodge ETH suck in contract during a Bitstamp -> Bitfinex transfer?

texts:
Question:
Can anyone help me?
TX Hash: 0x852be4473b53c8426962c25eb45dd19a7a35418e7b258108c5c57993a11184b6

Nutshell:
Asked Bitfinex for an ETH deposit address and received one, 0xD7f4864f0883E3521b5A888e57DAc133431b7160.

Asked Bitstamp to send the ~32 ETH to that address, they did, transaction "completed".

Turns-out the ETH was processed by a smart contract that was instructed to transfer the ETH to my deposit address but has not.

Bitstamp says that the transaction completed on their end.
Bitfinex won't respond to my customer support tickets.

Any direction would be greatly appreciated(!).

--jtcrew


texts: Set a gas limit when sending a transaction in a truffle test scenario

texts:
I am writing truffle tests for a smartcontract.
I have create a truffle project with this command:
truffle unbox react

I have kept SimpleStorage.sol sample smartcontract. I have add some tests in tests/simplestorage.js file.
What i want to do is to test the set's Simplestorage smartcontract function with a gas limit. I want to test what happens if gas limit is to low for this function.
Here is what i've tried:
await simpleStorageInstance.set(89, { from: accounts[0], gasLimit: 100 });
await simpleStorageInstance.set(89, { from: accounts[0], gas_limit: 100 });
await simpleStorageInstance.set(89, { from: accounts[0], limit_gas: 100 });

But it has no effect.
Any idea ?
Thanks


texts: Drizzle cacheCall is not updating data correctly

texts:
I have a react component which is interacting with a solidity contract via drizzle. I store a cacheCall index in the constructor:

this.opcTokenCacheCallIndex = context.drizzle.contracts.OPCToken.methods.balanceOf.cacheCall(this.props.accounts[0], {from: this.props.accounts[0]});

Then, whenever the component updates, I use this index to check the drizzle store

const opcBalance = await this.opcTokenCacheCallIndex.call(this.props.accounts[0], {from: this.props.accounts[0]});

Now when I log out opcBalance I see the balance associated with accounts[0]. I then call another method on my app which I know causes the balance of accounts[0] to increase, but I do not see this reflected in opcBalance - which stays the same. I know that the balance has definitely increased because:

1) When I refresh the page and log out opcBalance again - I now see that it has increased

2) I have thoroughly tested the method I am calling which I expect to increase the balance

Given this, I am sure the transaction I am calling is successfully increasing the token balance, but truffle is not reflecting this updated information, even though I am using cacheCall. Am I misunderstanding the use case of cacheCall? And if so, how can I continuously poll the blockchain for fresh data?


texts: Importing .sol files from an node_modules folder

texts:
Did i miss something in configuration, or will this be fixed in an future version?

Best regards

# ls -al
Makefile
README.md
build
cmd
contracts
node_modules
package.json

# ls -al ./contracts
Wallet.sol

cat  ./contracts/Wallet.sol
pragma solidity ^0.5.0;

import "openzeppelin-eth/contracts/token/ERC20/IERC20.sol";
import "openzeppelin-eth/contracts/token/ERC20/StandaloneERC20.sol";
import "openzeppelin-eth/contracts/ownership/Ownable.sol";
import "zos-lib/contracts/Initializable.sol";

contract Wallet is Ownable {
    function transferERC20(IERC20 token, address to, uint256 amount) public onlyOwner returns (bool) {
        require(token.transfer(to, amount));
    }
}

# solc --abi --bin ./contracts/Wallet.sol -o ./build
./contracts/Wallet.sol:3:1: Error: Source "openzeppelin-eth/contracts/token/ERC20/IERC20.sol" not found: File outside of allowed directories.
import "openzeppelin-eth/contracts/token/ERC20/IERC20.sol";
^---------------------------------------------------------^
./contracts/Wallet.sol:4:1: Error: Source "openzeppelin-eth/contracts/token/ERC20/StandaloneERC20.sol" not found: File outside of allowed directories.
import "openzeppelin-eth/contracts/token/ERC20/StandaloneERC20.sol";
^------------------------------------------------------------------^
./contracts/Wallet.sol:5:1: Error: Source "openzeppelin-eth/contracts/ownership/Ownable.sol" not found: File outside of allowed directories.
import "openzeppelin-eth/contracts/ownership/Ownable.sol";
^--------------------------------------------------------^
./contracts/Wallet.sol:6:1: Error: Source "zos-lib/contracts/Initializable.sol" not found: File outside of allowed directories.
import "zos-lib/contracts/Initializable.sol";


texts: Deploying a contract gives the error : Unable to connect to socket: timeout

texts:
I pasted this example contract : https://www.ethereum.org/token#full-coin-code
in Mist (ubuntu 16)

And I got the not so helpful error messages :

Could not compile source code
Error: Unable to connect to socket: timeout"

I have connected to the TEST-NET


texts: Sending Ether from private Geth node to Mist Account

texts:
I have Sended Ether from my private geth node to an another account  created by metamask.

I have choosed custum RPC to metamsk, with the valide IP and Port, Also i have activated rpc in my geth node.

But i can't see the balance in my metamsk wallet ?


texts: Ethereum JSON keystore file leaked - security?

texts:
If the JSON keystore file has been leaked but the password has not, can the attacker with the keystore file do anything?

Assume the password is 20 or more characters long and not used in any other place.


texts: How do you access return statements in the Mist UI

texts: If I have a contract and its interface added to Mist and I call a function, how do I access its return statement?


texts:
Context: Ethereum based voting system

Let's say a user a user can cast a vote. The user has to choose 1 item out of 10. I believe it is possible to create a smart contract supporting such an election.

However: The participants should not be able to determine the winning item during the voting round, because this can influence the result. I am aware that using encryption on-chain is not possible.

I believe a possible solution is to create a voting system consisting of 2 rounds:

In the first round, the voters commit a hash of their preferred option. Their a part of their private key is used as 'salt', because otherwise people can still figure out what has been voted. Note: This hash is calculated off-chain!
In the second round, the voters commit their preferred choice, including the salt used in the first round. The smart contract only accepts the vote if the hash of these items matches the hash in the first round.

My question is: Would this work? Or are there better solutions?


texts:
If I create a new app that will work on Ethereum network, it takes few seconds for a transaction to be confirmed at least once (creating a sub contract for example), so I can keep using other functions.

It all seems smooth and nice, but.. what happens if my app reaches thousands of users who wants to simultaneously access and execute transactions? Is there a cap I should be worried about?


texts: how many in-use accounts does Ethereum have?

texts: How many accounts does Ethereum have right now with any activity? And how many of those belong to contracts and how many to humans? Is there any statistics I can check in real time? Or at least some recent report on this data?