texts:
Studying about the Ethereum blockchain I realized that it is ideal for my project. I intend to develop a blockchain to exchange electric energy between consumers on a smart grid. The mining nodes of my network would be the smart meters that exist in every house connected to blockchain, but the smart meters do not have storage modules. Because of the knowledge I have about blockchains, they must be decentralized, that is, they must be stored in the mining nodes of the network. Based on this scenario described, my doubts are:

In an application for IoT scenarios, where there are no storage modules, the blokchain should be stored in which location?
Could I use a database to store the blockchain, and use the smart meters for the mining process? But that would make the blockchain centralized, something that escapes the main idea of blockchain, correct?


texts: How can I tell if a node I am using is a full archive node?

texts:
What is the best way to tell if the node I am is using a full archive node?

One way I know if is to call a contract from the context of an old block, but this requires an RPC call and is not explicit (the call may fail for other reasons). Additionally, different clients (geth, party, etc.) return error messages, so this is not reliable. Is there a way to do this explicitly?


texts:
I want to Interact with my Smart Contract via Web3 and React. But I get a error message with the following code.

    import React, { Component } from 'react';
    import Web3 from 'web3';

    let web3;
    if (typeof window !== 'undefined' && typeof window.web3 !== 'undefined') {
    // We are in the browser and metamask is running.

    web3 = new Web3(window.web3.currentProvider);
    console.log('ok');
    } else {

       // We are on the server Or the user is not running metamask
        //  Not relavant yet
        console.log('Problem?');

    }
 console.log(web3);

const abi = [ { "constant": true, "inputs": [ { "name": "", "type": "uint256" } ], "name": "deployedCampaigns", "outputs": [ { "name": "", "type": "address", "value": "0x561C3ec9fb72C0010dc6206546578C7dD8D9B0dA" } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x339d50a5" }, { "constant": false, "inputs": [ { "name": "minimum", "type": "uint256" } ], "name": "createCampagn", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function", "signature": "0x3bcf3e08" }, { "constant": true, "inputs": [], "name": "getDeployedCampaigns", "outputs": [ { "name": "", "type": "address[]", "value": [ "0x561C3ec9fb72C0010dc6206546578C7dD8D9B0dA" ] } ], "payable": false, "stateMutability": "view", "type": "function", "signature": "0x4acb9d4f" } ];
const instance = new web3.eth.Contract(
    abi,
    '0x230e5d3b76EE412579BfD0e656a2158EC09edaB0'
);

console.log(instance);

class CampaignIndex extends Component {

    async  componentDidMount(){

        const campaigns = instance.methods.getDeployedCampaigns().call();
        console.log(campaigns);

    }

    render( ) {
        return (

Campaigns Index

        );
    }
}

export default CampaignIndex;

The error message is the following:

It seems the code line

 new web3.eth.Contract

throws the error message. But when I look into the console log(instance) I get the Web3 instance. So I have no idea what the problem could be.

This are my Package Configurations:

 {
  "name": "kickstarter2",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "dev": "next dev"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "fs-extra": "^7.0.0",
    "ganache-cli": "^6.1.8",
    "mocha": "^5.2.0",
    "next": "^4.2.3",
    "react": "^16.6.0",
    "react-dom": "^16.6.0",
    "solc": "^0.4.25",
    "web3": "^1.0.0-beta.35"
  }
}

Does anyone have the solution to this problem?


texts: How to delete an element of array in efficient manner?

texts:
pragma solidity ^0.4.24;
contract test{
    uint[] public array = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
    function removewithgap(uint index)  returns(uint[]) {
        if (index >= array.length) return;
        delete array[index];
        return array;
    }
    function removewithoutgap(uint index)  returns(uint[]) {
        if (index >= array.length) return;

        for (uint i = index; i<array.length-1; i++){
            array[i] = array[i+1];
        }
        delete array[array.length-1];
        array.length--;
        return array;
    }
}

When I am using removewithgap function my transaction cost is kind os normal.
But when I use removewithoutgap function my transaction cost increases exponentially as the length of my array grows. Is there any efficent way to remove the element without gap?


texts: How to invoke multiple oracaliszed queries from a single contract

texts:
I want to invoke 2 different orcalized queries from the same contract. I saw a few posts but none of the answer works. Is there any way we can do that? Here is my contract. I was expecting this contract to log both 11111111 and 222222222222222 but it prints error VM Exception: invalid opcode I am using http://dapps.oraclize.it/ . When I call single query it works but not 2 queries.

    pragma solidity ^0.4.0;
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
import "github.com/Arachnid/solidity-stringutils/strings.sol";

contract verifySettlement is usingOraclize {

    uint public price;
    string public landingtime;
    string public expectedtime;`
    string public tempvalue;
    mapping(bytes32 => uint) queries;

    event Log(string text);

    function verifySettlement() payable {
        Log("Contract created.");
        getActualFlightDetails();
        getExpectedFlightDetails();
    }

    function getActualLandingHour() constant returns (string) {
       return landingtime;
    }

    function getExpectedLandingHour() constant returns (string) {
       return expectedtime;
    }

    function __callback(bytes32 _myid, string _result) {
        require (msg.sender == oraclize_cbAddress());
        if(queries[_myid] == 1)
        {
            Log("1111111111111111111111111");
        }
        if(queries[_myid] == 2)
        {
            Log("2222222222222222222222222222222");
        }
        //Log(_result);
        //tempvalue = _result;
    }

    function getActualFlightDetails() payable {
        Log("Oraclize query was sent, waiting for the answer for getting actual flight details..");
        queries[oraclize_query("URL","http://169.53.241.139:5000/actual/flight/1")]=1;
        //queries[oraclize_query("URL","http://169.53.241.139:5000/expected/flight/1")]=2;
    }

    function getExpectedFlightDetails() payable {
        Log("Oraclize query was sent, waiting for the answer for getting actual flight details..");
        //queries[oraclize_query("URL","http://169.53.241.139:5000/expected/flight/1")]=1;
        queries[oraclize_query("URL","http://169.53.241.139:5000/expected/flight/1")]=2;
    }

}


texts: mining transaction in private blockchain

texts:
I am new to the blockchain issue, and I have read about it, but I had these questions.
When I actually implement a private Blockchain  on every transaction it costs a certain gas. Who pays for this gas ???
Likewise, in Private Blockchain, as I understood, we can determine who will pay miners who will pay miners for verification of the correctness of the transactions ???


texts: How estimate smart contract deployment and transactions price?

texts:
I can deploy the same smart contract and invoking four transactions on it on Ropsten network.

How can I estimate the price of the exactly same operations but on the Mainnet network?


texts: Error: invalid merkle root | Error in XDPoS Consensus | fork of go-ethereum

texts:
Block Synchronisation failed in code :- https://github.com/XinFinOrg/XDPoS-TestNet-Apothem

ERROR[03-23|19:47:12]

#### BAD BLOCK

Chain config: {ChainID: 1151 Homestead: 1 DAO:  DAOSupport: false EIP150: 2 EIP155: 3 EIP158: 3 Byzantium: 4 Constantinople:  Engine: XDPoS}

Number: 2700
Hash: 0x9693b2cfa2f4a4b9ebb7368b4629e75d5fd286040c806f03446c811555f3b931

Error: invalid merkle root (remote: 7f6ce3e89e5c8441a51920db3b9952b0fc3fd50b6193b8f664693fdcc77ea53e local: 49e1c55746d5936711d5cb9039131f060221698c88aac79b5b759ad2940b3f10)

#

WARN [03-23|19:47:12] Synchronisation failed, dropping peer    peer=b7f2b3742ffc19db err="retrieved hash chain is invalid"


texts: ETH: How many transactions are added to the mining pool per time period

texts: Every ETH transaction which is created is first added to a pool of pending transactions, from which then the miners pick them. I wonder whether there is any source (research paper / ETH stats website / etc.) or a way to figure out how many ETH transactions are added to the pool per time period (either day/minute/second)?


texts: How can I import geth accounts into eth?

texts:
I had two accounts under ~/.ethereum/keystore when I used geth a while ago.

I got a new PC, recompiled only the C++ version and I can't see my two accounts in eth.

web3.admin.eth.allAccounts() returns only an account that seems stored under ~/.web3/keys if I'm not mistaken.

Is it possible that I somewhat import my geth accounts in eth?


texts: How to make Ethereum mining difficulty static for a private chain?

texts: I have implemented private chain in ethereum but its difficulty level increases by time as a result the mining process slows down. Is it possible to make the difficulty static or disable it in testnet.


texts: Is it possible to send ETH to a wallet that doesn't exist?

texts: If so what happens? Is it permanently lost?


texts: query about function call in ethereum vyper

texts: How the function will be called in vyper while compiling?, how the variables will be declared and how the data will be mapped to that variables?


texts:
I recently had most ERC20 tokens moved from a MEW wallet through the individual ERC20 contracts.  Does anyone know how this may have happened?  I am sending pertinent info from one on etherscan.io

1) overview of transaction link for just one of many

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

2) Copy of event logs from above link for just that one of many

[3]    Address      0x80bc5512561c7f85a3a9508c7df7901b370fa1df
   Topics   [0] 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
[1] 0x000000000000000000000000ae2995da17b61a605851e4f317216d68e1015c3e
[2] 0x00000000000000000000000059b8f95b66382d88500ceb238d4c4cdd4582049e
   Data
 0000000000000000000000000000000000000000000000878a552480b3c6e93c

3) The Public ether address above smartcontarct move was made from

0xAe2995da17B61A605851e4F317216D68e1015c3E

4) Public address where tokens were sent to through each individual contract

0x59B8f95B66382d88500ceB238d4C4CdD4582049e

5) Could some one help me understand what happened here.  One morning, I woke up to emails indicating all of these transactions occured.  I am not a coder or anything but I was very deligent about not using Prvt key or Keystore file associated with this wallet.  Could some one have hacked me? Then wrote some type of script that would initiate sending of each individual token at a specific time? Could someone help me understand how transactions move through smart contracts.  And if I was attacked by hacker, What should I do to my computer to remove any possible future access?

I know it is alot to ask but any help would be much appreciated as I feel that if I better understand the flow I may be able to better protect in the future.


texts: Testing contract function after transaction with Truffle

texts:
I try to test this contract with Truffle but the test of checkGoalReached function Fail and I do not understand why.

The code to reproduce this problem is available here
With Remix Solidity IDE, the behavior of the contract is ok
TestRPC v3.0.5
Truffle v3.2.4

The contract

pragma solidity ^0.4.10;

contract CrowdFunding {
    // Defines a new type with two fields.
    struct Funder {
        address addr;
        uint amount;
    }

    struct Campaign {
        address beneficiary;
        uint fundingGoal;
        uint numFunders;
        uint amount;
        mapping (uint => Funder) funders;
    }

    uint numCampaigns;
    mapping (uint => Campaign) campaigns;

    function newCampaign(address beneficiary, uint goal) returns (uint campaignID) {
        campaignID = numCampaigns++; // campaignID is return variable
        // Creates new struct and saves in storage. We leave out the mapping type.
        campaigns[campaignID] = Campaign(beneficiary, goal, 0, 0);
    }

    function contribute(uint campaignID) payable {
        Campaign c = campaigns[campaignID];
        // Creates a new temporary memory struct, initialised with the given values
        // and copies it over to storage.
        // Note that you can also use Funder(msg.sender, msg.value) to initialise.
        c.funders[c.numFunders++] = Funder(msg.sender, msg.value);
        c.amount += msg.value;
    }

    function checkGoalReached(uint campaignID) returns (bool reached) {
        Campaign c = campaigns[campaignID];
        if (c.amount < c.fundingGoal)
            return false;
        uint amount = c.amount;
        c.amount = 0;
        c.beneficiary.transfer(amount);
        return true;
    }
}

Javascript Tests

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

contract('CrowdFunding', function(accounts) {

      var account_one = accounts[0];
      var account_two = accounts[2];
      var campaign;
      var id;

        it("should create a new campaign", function() {
          return CrowdFunding.deployed().then(function(instance) {
            campaign = instance;
            return campaign.newCampaign.call(account_two, 2)
            .then(function (campaignID) {
              id = campaignID;
              return campaign.contribute(campaignID, {from: account_one, value: 1});
            })
            .then(function() {
              assert.equal(web3.eth.getBalance(campaign.address).toNumber(), 1, "Balance isn't 1 after one contribution of 1");
              return campaign.checkGoalReached.call(id);
            })
            .then(function(reached) {
                assert.equal(reached, false, "Campaign with goal 2 is reached with balance 1");
            });
        });
      });
    });

Truffle test Result


texts: multi-step game, would the contract stop for a while for another transaction to come

texts: To make my question specific, what I want to develop is a multi-step game. And the thing I want to realize is, let's say now we have the game taking players A & B included, and both A & B have the freedom to send transactions to the game contract. In some certain round A may send a valid transaction to the contract can make him win, but is there some method we can develop to hold the contract for a while not yielding the final result (A wins) to see whether or not there is another valid transaction coming from another player (B)?


texts: Change value if function parameter is not zero

texts:
I have this function.

How do I change only the parameters that aren't zero when calling the function? This is what I did

function changeParameters(uint newAnte, uint8 newNumberOfPlayers, uint newWinnerPart) {
    if (msg.sender == owner) {
         if (newAnte != 0) {
            ante = newAnte;
         }
         if (newNumberOfPlayers != 0) {
            required_number_players = newNumberOfPlayers;
         }
         if (newWinnerPart != 0) {
            winner_part = newWinnerPart;
        }
        }
}

I'm certain there has to be a more efficient way

Thanks


texts: Correct way to concatenate hashes for merkle tree

texts:
I'm using Richard Moore's ethers.js to create hashes of documents that will eventually be stored on the EVM. To create a merkle tree with many documents I'll need to hash together hashes. What's the correct/conical way to concatenate these before I apply the hashing function?

var left = 0xbe5b5152fcd01b6bf53f149bfd1493a49ec5e8ae94cc4c29a81563eea0e347f4;
var right = 0xe97032473c4f6788bf3f197518c925b296172520eae8df21f8ce2c6a1df54146;

// Is this the best way to concat?
var joined = left.toString(16) + right.toString(16);
var newHash = ethers.utils.keccak256( ethers.utils.toUtf8Bytes(joined) );


texts: Old version of Parity stopped working and I'm unable to install new stable version

texts:
I have parity 1.6.8 installed on OSX 10.13.6

Parity used to work by running to .app file and then accessing http://127.0.0.1:8180/#/home on a web browser.

Now it tells me, "Unable to make a connection to the Parity Secure API. To update your secure token or to generate a new one, run (parity signer new-token) and paste the generated token into the space below."

I open Terminal and type in parity signer new-token  but returns

-bash: parity: command not found

I go to https://www.parity.io/ethereum/#download to download the stable version of Parity but when I double click on it opens up my text editor with a bunch of code in it without installing the app.

How can I get Parity going again? I'd also like to be able to prevent Parity from downloading the blockchain when I start it.

My objective is to check to see if a wallet I created on parity a while ago has any funds in it.


texts: How to maintain history of changes in mapping?

texts: I have a mapping variable in my solidity code which maps address to name. I want to maintain the history/log of every change that happens in this mapping. What is the best possible solution to it?


texts: For example Did bitcoin have to register "BTC" as their ticker if thats what they call it,the three letter symbol


texts:
Every time I upgrade parity on docker by pulling and creating a new container I lose all sync data.

The Dockerfile doesn't seem to expose a volume I could mount with -v

Is there a trick to it or should I ignore it now that Parity can auto-update (since 1.5)?


texts: Solidity: ParserError: Expected pragma, import directive or contract/interface/library definition. uint private age; ^

texts:
I am using Atom together with etheratom and I don't get why this simple code won't run:

pragma solidity ^0.4.19

contract MyFirstContract {
    string private name;
    uint private age;

    function setName(string newName) {
        name = newName;
    }

    function getName() returns (string) {
        return name;
    }
}

It shows me the following error:

:5:5: ParserError: Expected pragma, import directive or contract/interface/library definition. uint private age; ^

Anybody an idea whats wrong?


texts: How to unlockAccount account using private key instead of password

texts:
I am working with https://github.com/ethereum/wiki/wiki/JSON-RPC api + curl .

And implementing custom api using this php library:
https://github.com/Achse/geth-jsonrpc-php-client

below method is working fine for me for unlock before transaction:

$ curl -X POST --data '{"jsonrpc":"2.0","method":"personal_unlockAccount","params":["0x7642b...", "password", 3600],"id":67}' http://localhost:8545

But I want to unlock account using private key not by password. So is there any way to unlock account and do transaction using private key.


texts: What are the differences between callback and OAR address

texts:
I am using Oraclize with testrpc and truffle and I have confused in some points

Now when I choose an address account when run the bridge, why and what is the purpose of the choice.

node bridge -a 1

here the account 1 from testrpc accounts has been chosen but I don't exactly how it will be used.

If the result will be sent back to the address who ask this data ( let's say I send query from account 2), the address suppose be my address( account 2) when I send the query, please correct my understanding if I understand wrongly.

Another point, does the sender address of the query result will be OAR ?? I mean the sender of the query result will be the OAR ??

Thanks


texts: What is the difference between an internal/external and public/private function in solidity?

texts:
Currently reading solidity documentation: https://solidity.readthedocs.io/en/develop/types.html#function-types

  By default, function types are internal, so the internal keyword can
  be omitted. In contrast, contract functions themselves are public by
  default, only when used as the name of a type, the default is
  internal.

This does not make sense to me. How can a function be internal and public at the same time?

What does this part mean?

  only when used as the name of a type

I know internal means functions can only be called within the contract and external can be called outside of the contract. So to me, internal is private and external is public but the documentation makes it sound like it can be public and internal at the same time?

So what is the difference, if any, between internal/external and public/private in regards to functions and how can the default be both internal and public at the same time?


texts: Problem when accessing variables in Storage geth

texts:
I found some contract that looks like this:
// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;
contract IceCream {
    address a;
    address b;
    bool public c = false;
    uint256 public d;

constructor(...){...}
}

I would now expect to get the following values when calling the following on my geth console:
await web3.eth.getStorageAt(address, 0) --> a
await web3.eth.getStorageAt(address, 1) --> b
await web3.eth.getStorageAt(address, 2) --> c
await web3.eth.getStorageAt(address, 3) --> d

Position 0: I find a (Which I also suspect to be there).
Position 1: I find b (Which I also suspect to be there).
Position 2: I find some value 0x0000000000000000000000000000000000000000000000000000000000000a36 which i suppose is the value of the uint256 d. WHY?
Position 3: I find:
0x0000000000000000000000000000000000000000000000000000000000000000. WHY?
I thought the variables in storage are stored in order.
What am I missing here?
Probably it is something really easy and stupid but I just can`t make any sense of this.


texts: Putting a variable in the event log string

texts:
I have the following code in the Solidity contract:

event Log(string text);

uint256 public number;

I need to put the variable within the Log text, just like when we use backticks in Javascript:

`This log outputs the ${number}`

Is there a way to do this in Solidity?


texts:
My solidity contract compiles in Remix, but when I try to deploy it it fails and throws

Error: This contract may be abstract, not implement an abstract parent's methods completely or not invoke an inherited contract's constructor correctly.

Here is the contract code

pragma solidity ^0.6.0;

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

/**
 * @title DetailedERC20 token
 * @dev The decimals are only for visualization purposes.
 * All the operations are done using the smallest and indivisible token unit,
 * just as on Ethereum all the operations are done in wei.
 */
abstract contract ExampleToken is ERC20Detailed {

  //We inherited the DetailedERC20
  constructor(string memory _name, string memory _symbol, uint8 _decimals)
  ERC20Detailed(_name, _symbol, _decimals)
  public {
  }

}

For constructor parameters I used Mooncoin, MNC, 6


texts: Can I set the gas price to whatever I want?

texts:
The default gas price is 0.02e12 Wei. But while creating transactions on the command line or Geth's Javascript console you can define your own gasPrice:

web3.eth.sendTransaction({/* ... */, gasPrice: 123456789});

In Mist browser based Ethereum Wallet, there is a slider to set the gas price from "low" (slower) to "high" (faster). What are these limits actually? What are realistic gas prices, and what happens if it is chosen too low or "too high"?


texts:
I have been encountering the word 'state' in a lot of research papers, and I was wondering what they exactly mean by the state of the smart contract. I am aware of the following answer; however, it only describes the meaning of state change.

What does it store, and where is it stored?


texts: Is it possible to recreate the deploy bytecode of a contract in solidity?

texts:
So I'd need something like the GetCode.at(address) function presented in the official doc: https://solidity.readthedocs.io/en/v0.5.0/assembly.html#example
but which allows me to deploy that contract in a new address.
Is it possible to get the deploy bytecode or rebuild it from the runtime one with solidity?


texts: I am a baby to ethereum blockchain. Is it possible to interact with the  local ethereum network that resides on my laptop from my raspberry pi? I need to connect with the smart contract that is deployed in my laptop from my raspberry pi.


texts:
Calling web3.currentProvider.sendAsync raise an exception:

  Uncaught TypeError: web3.currentProvider.sendAsync is not a function

Note: I faced this error when using https://www.npmjs.com/package/@digix/tempo. However, sendAsync is not a function inside web3.currentProvider when trying to check this with Web3 v1.0


texts: How to call solidity function which has array of address as an argument using web3

texts:
Say i have a contract as follows:

contract A {
  function passAddress(address[] _addr) {
    // do something
  }
}

How do i call this function in my frontend application using web3.
I tried using javascript array but it throws revert exception.

Any ideas ?


texts: Could Insufficient Funds error mean the signature is incorrect? - using golang and raw transactions

texts:
I want to sign a transaction "offline" without using crypto.sign.
The code looks like the following:
unsignedTx := types.NewTransaction(nonce, to, amount, gasLimit, gasPrice, nil)

networkID := big.NewInt(3) //Ropsten
signer := types.NewEIP155Signer(networkID)

unsignedTxJSON, err := unsignedTx.MarshalJSON()

unsignedTxBin, err := unsignedTx.MarshalBinary()
ethMessage := fmt.Sprintf("\x19Ethereum Signed Message:\n%d%s", len(unsignedTxBin), unsignedTxBin)

hashedEthMessage := crypto.Keccak256([]byte(ethMessage))

hsmSignedResult, err := signFromHsm(p, session, privateKeyHandle, hashedEthMessage)

   ... some conversion from point to big ints later ...

if hsmBigIntS.Cmp(secp256k1halfN) < 0 && hsmBigIntR.Cmp(secp256k1N) < 0 {
// (s) is LESS than curve.n/2+1 and (r) less than curve.n so v=0 + y%2

x := new(big.Int)
two := big.NewInt(2)
vInt64 := int64(0) + x.Mod(pubKey.Y, two).Int64()

newSignature := append(hsmSignedResult, byte(vInt64))

attemptedRecoveredPub, err := crypto.Ecrecover(hashedEthMessage, []byte(newSignature))
        if err != nil {
            panic(err)
        }

fmt.Printf("\The public key was recovered from signature so we can now proceed to send the tx\n")

signedTx, err := unsignedTx.WithSignature(signer, newSignature)
signedTxJSON, err := signedTx.MarshalJSON()

fmt.Printf("\nSignedTx: %s\n", signedTxJSON)

//standard call using client.SendTransaction(ctx, tx) that always fails with
// panic: insufficient funds for gas * price + value
sendRawTx(signedTx)

}

I doubt it's related to the gas, but these are the values:
Gas limit: 100000
Gas price: 1708100000
ETH Amount: 0.1 ETH
An example of a transaction generated is:
SignedTx:
{"type":"0x0","nonce":"0x1","gasPrice":"0x65cf89a0","gas":"0x186a0","value":"0x2386f26fc10000","input":"0x","v":"0x2a","r":"0xcb80f65ff3a7298470de46d36995418517efbf2590b246c59c0300a21188196b","s":"0x3a75a0ef6b3a694f80529d719380c12d169612b6b0c04e0f13f1b6c8e40747fc","to":"0x3e363a6ab5336a41121629b38a6d3b0ee7384a6e","hash":"0xd8b62a843ab8f1df6d3f3aef3c223740a5ce546d1a21a428efc651c5b1742013"}

I'm wondering if there's something I'm missing? Could it be related to the way I generated V?
Any indication would be appreciated


texts: Understanding BSC, BEP-20 and ERC-20 tokens

texts:
I would like to ask a few questions.

If we have an ERC-20 smart contract deployed on Ethereum and if we want to move it to binance smart chain because of high transaction fee, what is the best move moving the smart contract or simply creating a new BEP-20 smart contract? And why?
What are the disadvantages of moving the erc-20 contract to bsc since there are very few differences between the two standards?


texts: Web3 sendSignedTransaction Transaction cost

texts:
I'm new to Ethereum world. I've just manage to create an example that calculates transaction fee and sends a signed transaction without a contract using Web3js library.

My issue is that my test account is running out of balance pretty quickly. I must be doing something wrong. I did this transaction:
    https://kovan.etherscan.io/tx/0x5cb10c454d8d331e35ba3812522ea9cd5b82fdb7ecde75c5b48ec1550d99cc98

If you see the details:

Value: 0.000106 Ether ($0.00)
Gas Limit: 21000
Gas Used By Txn: 21000
Gas Price: 0.000106 Ether (106,000 Gwei)
Actual Tx Cost/Fee: 2.226 Ether ($0.000000)

I see the actual transaction fee is 2.226 Ether!

I'm calculating the transaction fee as follows:

var transactionObject = {
  from: sender,
  value: amount
}
w3.eth.estimateGas(transactionObject, function(error, gas) {
  w3.eth.getGasPrice(function (error, gasPrice) {
    var gasPrice = Number(gasPrice);
    var transactionFee = gasPrice * gas;
    console.log(transactionFee);
 })
});

Then this transaction fee, I am using it on my transaction:

w3.eth.getBalance(sender, function(error, balance) {
  if (balance < (transactionFee + transactionValue)) {
    reject("You don't have enough balance to cover this transaction");
  } else {
    w3.eth.getTransactionCount(sender).then(function(count) {
      var transactionObject = {
        nonce: w3.utils.toHex(count),
        from: sender,
        to: receiver,
        gasPrice: w3.utils.toHex(transactionFee),
        value: w3.utils.toHex(transactionValue),
        data: ''
      }
      w3.eth.estimateGas(transactionObject, function (error, gas) {
        transactionObject.gasLimit = gas;
        var tx = new Tx(transactionObject);
        tx.sign(privateKey);
        var serializedTx = tx.serialize();
        w3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex'), function (error, result) {
          if(!error) {
            resolve(result);
          } else {
            reject(error)
          }
        })
      });
    }).catch(function(error) {
      reject(error);
    });
  }
})

Am I assigning incorrectly a value or missing some conversion?


texts: Generating lots of private key means I can hack someone's ether?

texts:
If I generates lots of private keys, I can get someone's address and its digital signature, right?
I know that there's 2^256 possible private keys, but what if I use brute-force attack? Is it theoretically possible to hack someone's ether?


texts:
I noticed some smart contracts have the wallet address of the creator in the smart contract to send the tokens to the wallet like example #1:

Example #1:

constructor() public {
        symbol = "0PUCKS";
        name = "0 Pucks Token";
        decimals = 18;
        _totalSupply = 100000000000000000000000000;
        balances[0x5A86f0cafD4ef3ba4f0344C138afcC84bd1ED222] = _totalSupply;
        emit Transfer(address(0), 0x5A86f0cafD4ef3ba4f0344C138afcC84bd1ED222, _totalSupply);

But below example #2 there is is no visble wallet address for the creator within the smart contract code:

Example: #2

contract BTClite is StandardToken, Ownable {

      string public constant name = "BTC LITE";
      string public constant symbol = "BTCL";
      uint8 public constant decimals = 8;

      uint256 public constant SUPPLY_CAP = 21000000 * (10 ** uint256(decimals));

      address NULL_ADDRESS = address(0);

When the smart contract for example #2 was created/ deployed, did they just send the tokens to the wallet that deployed and verified the contract?  Or did they set it up another way?


texts: UPDATED : How to determine "payer address" in "address.transfer(amount)"?

texts:
Consider we a function as follows :

address public recipient;

function settlement(uint256 amount) public {

        recipient = msg.sender;
        recipient.transfer(amount);

    }

Then the recipient by invoking this function as follows (using web3.js), tries to receive the amount :

contractInstance.methods.settlement(10).send({ from: '0xca35b7d915458ef540ade6068dfe2f44e8fa733c' }, function(error, result) {
    console.log(error);
    console.log(result)
});

So, the address 0xca35b7d915458ef540ade6068dfe2f44e8fa733c must receive 10 wei, but from which address ? Who is the payer ? and this 10 wei has been reduced from which account address ?

Meanwhile, since we did not use payable for the settlement function, this ether transfer will be done correctly ?

UPDATE : In case we mark payable in the constructor of the contract, then does we need to mark the settlement function ? And the recipient will be sent the amount from the balance of the contract ?


texts:
I'm one of the many that tries to join the Status Network ICO using Parity. When I check "txqueue viewer" on top of the queue I see my transaction. As you can see below, it's there for a long time while other transactions in the queue have way less "First propagation" minutes and seem to go through. Even when they have the same GAS price / GAS values. Changing the GAS price doesn't work, as I don't have sufficient funds.
Under "Signer" I have the option to edit the transaction, but there's a warning that it may not succeed. What is best to do now? Just wait till it goes through, or do you have other suggestions?


texts: How to point a domain registered with ENS to swarm content?

texts:
I'm hosting my web site on swarm now. And I registered a .test FIFS domain to point to it: 5.test

I can verify that I am the owner of that domain with the ensutils.js:

> ens.owner(namehash('5.test'));
"0xdcf407eae88d480e280db2d0deaa3a11c82eaa9b"

I use the public resolver:

> ens.setResolver(namehash('5.test'), publicResolver.address, {from: eth.accounts[0]});
"0x2800127128657a5f9483fe4062364456fddbee5ba98b4cd3071c60fb466bb267"

And finally, I tell it there is swarm content at the hash location:

> publicResolver.setContent(namehash('5.test'), 'f1a669a425b378bd8034fe0df7fea098c8b932a6037b688764afda1e92a8db1e', {from: eth.accounts[0], gas: 100000})
"0x957ae9864fc56505f3e19af3b3d85c7c1317ad53628533170599423501c07d8f"

As far as I can tell, all the transactions executed correctly. However, navigating to bzz:/5.test/index.htm does give me:

Manifest not Found

Any idea? How to correctly use the ENS registered domains with swarm hosted content?


texts: How can I query an API to get my erc20 token balance of an address in JSON format?

texts: Is there an api where I can query if an address contains an erc20 token? I need it returned in JSON format.


texts: How to fix? Tx nonce go out of sync when using multiple unit tests on the same contract under Ganache+Truffle

texts:
Here is my example contract (ignore the fact this could be pure, this is a simplified example and my real example is not a pure function, it changes state, but I can reproduce the bug with this simple example):

    pragma solidity ^0.5.0;
    contract Hello {
        function hello() external {
        }
    }

and unit test:

    const Hello = artifacts.require("./Hello.sol");
    contract("Hello", accounts => {
        it("should hello", async () => {
            const hello = await Hello.deployed();
            await hello.hello({from : accounts[0]});
        });
    });

the above works fine on truffle develop or on truffle migrate + Ganache (GUI or CLI).

Now if I want to have two unit tests (for simplicity I've done the same one twice, in reality I would use different unit tests)

    const Hello = artifacts.require("./Hello.sol");
    contract("Hello", accounts => {
        it("should hello", async () => {
            const hello = await Hello.deployed();
            await hello.hello({from : accounts[0]});
        });
        it("should hello", async () => {
            const hello = await Hello.deployed();
            await hello.hello({from : accounts[0]});
        });
    });

Again this works fine on truffle develop or on truffle migrate + Ganache (GUI or CLI).

Now if I want to reset the state of the contract between each unit test (imagine hello() changes the state and I want to revert back to the way it was for the next unit test), the way I've been doing it is like this

    const Hello = artifacts.require("./Hello.sol");
    contract("Hello", accounts => {
        it("should hello", async () => {
            const hello = await Hello.deployed();
            await hello.hello({from : accounts[0]});
        });
    });
    contract("Hello", accounts => {
        it("should hello", async () => {
            const hello = await Hello.deployed();
            await hello.hello({from : accounts[0]});
        });
    });

this works fine if I just do this under truffle develop. But if I try to use truffle migrate + Ganache (GUI or CLI) I get an error like this:

Error: the tx doesn't have the correct nonce. account has nonce of: 162 tx has nonce of: 163

the numbers don't have to be exactly 162 and 163, I've just been running the example a lot, it could be 1 and 2. But they are always out of sync by one if I call contract twice in the unit test but not when I call it twice within one call to contract.


texts: What is the best practice between setting a variable public or using getters in Solidity?

texts:
From the solidity.readthedocs, a variable declared as public does not need a getter since an automatic accessor function is generated e.g:

pragma solidity ^0.4.2;

contract C {
    uint public data;
}

The variable data, can also be reached using some getters:

pragma solidity ^0.4.2;
    contract C {
          uint data;

      function getData() constant returns (uint retData) {
        return data;
      }
}

My question is simple: What is the best practice?


texts:
I am using Parity and testing a mining pool.  In order for the pool to work, I need to specify the --author address on the node running the pool software.

I also need to have the payee accounts for the individual miner unlocked from the command line on another node.

How do I prevent my ETH from being stolen from the unlocked accounts?


texts: Is it possible to have multiple private keys for a single public address?


texts: How to increment a solidity variable using a function

texts:
i want to count every time that i call the function , i tried to increase the number by every time that I called but it doesn't work , it always gives  1 .

function getdeployedcontracts () public returns (string, uint,uint,uint,uint,uint,address,address) {

     Request storage request= contracts [index];

    return (request.d,
            request.valuev,
            request.r,
            request.t,
            request.n,
            request.r,
            request.recipient);
     index+= 1;

 }


texts: print the smart contract balance using web3

texts:
I am trying to print the balance of the smart contracts using web3 but it doesn't show any error but on the client-side application it appears as follows:

  Your Balance: [object Promise]

/contracts/mycontract.sol:

function () external payable {
        // payable fallback to receive and store ETH
        if(msg.value < 10 ether){
        revert();
        }
        balanceOf[msg.sender] += msg.value;
    }

    function getBalance() external view returns (uint) {
        return address(this).balance;   //this keyword refers to the smart contract address
    }

/src/js/app.js:

 App.contracts.kyc.deployed().then(function(instance) {
          kycInstance = instance;
    var bal=kycInstance.getBalance();
              $("#SmartBalance").html("Your Balance: " + bal);
        // #smartbalance is an id for the HTML file
});


texts:
I want to implement a system that users can sign and send transactions (from their Ethereum account, which -for now- I assume exists) with just a GUI, and maybe asking them to enter their address and password (if necessary, the private key too).

Thanks to @TjadenHess, I found myetherwallet which does what I want to achieve. The GUI involves copy/pasting the generated code, but it's still easier than running geth (or another software that can connect to Ethereum) and typing the commands manually.

How can I implement such a system? Should I (my application) be running the software on a remote server and let people use it for a while, or should I ask/help them to install the necessary software (as part of my application, like Ethereum Wallet does with geth) on their devices and generate and execute the commands for them?

Is any of these options possible? If so, I would much appreciate any directions on how / where to implement such a system.

Thanks,


texts: How is the contract initialized in truffle tests in solidity?

texts:
pragma solidity ^0.4.17;

import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/Adoption.sol";
contract TestAdoption {

    **Adoption adoption = Adoption(DeployedAddresses.Adoption());**

    function testGetAdoptorAddressByPetId() public{
        address expected = this;
        address[16] memory adoptors = adoption.getAdoptors();
        Assert.equal(adoptors[8], expected, "Owner of pet Id 8 should be recorded");
    }

}

Can any one explain how the contract instance is created from the address in truffle framework?
Adoption adoption = Adoption(DeployedAddresses.Adoption());


texts: How can I transfer ETH from one Poloniex account to another?

texts: I apologize for the newbie question, but I want to send ETH from my Poloniex account to someone else's. Is it possible to do this directly from my Poloniex account?


texts: How to reference the contract definition within the contract itself?

texts:
I'm working on the problem of smart contract upgradability and in that, I'm calling kill function of the contract with newly deployed contract's address as an argument. So that kill function can link the dataStore of my old contract to the new contract and then do the transfer of ownerships.

However, in order to link old data store to the new contract, I need to reference the definition of my contract itself and call a function called setDataStore. I'm doing it in following way -

    pragma solidity ^0.4.8;

    import "./DataStore.sol";
    import "./SecurityLibrary.sol";
    import "./DataVerifiable.sol";

    contract Parent is DataVerifiable {

        address public orgStore;

        using SecurityLibrary for address;

        function Parent() payable {
            setDataStore(0x0);
        }

        function setDataStore(address _orgStore) {
            if (_orgStore == 0x0) {
                orgStore = new DataStore();
            } else {
                orgStore = _orgStore;
            }
            if (!orgStore.isSuperAdmin(msg.sender)) {
                orgStore.makeSuperAdmin(msg.sender);
            }
            DataVerifiable.orgStore = orgStore;
        }

         function kill(address upgradedParent) superAdminOrOwner {
            if (upgradedParent == 0x0) {
            throw;
            }
          // At this line I'm trying to reference the definition of
          // my contract itself and calling a function of new Parent
          // which is already deployed.

           Parent(upgradedParent).setDataStore(orgStore);
           DataStore(orgStore).transferOwnership(upgradedParent);
           selfdestruct(upgradedParent);
         }
}

Is this a correct way to reference the contract definition within the contract, if not then can someone advise what could be an alternative approach here?

Updating the question with more details -

Test case -

it('should let SuperAdminOrOwner kill parent', async function() {
    let newParent = await Parent.new();
    // I have instantiated the old parent in before each block
    orgStore = await parent.orgStore();
    await parent.kill(newParent.address);
    assert.equal(orgStore, await newParent.orgStore());
});

I'm running this testcase using testRPC and it gives following error -

  Error: VM Exception while processing transaction: invalid opcode

When if I explicitly call the setDataStore function on newParent from my test case and remove that call from kill function then it works fine.

it('should let SuperAdminOrOwner kill parent', async function() {
    let newParent = await Parent.new();
    orgStore = await parent.orgStore();
    await newParent.setDataStore(orgStore);
    await parent.kill(newParent.address);
    assert.equal(orgStore, await newParent.orgStore());
});


texts: How to add additional parameters to Ethereum Wallet?

texts:
I wish to add a few more fields to the wallet file & save it in the keystore so that I can manage them better. For instance, consider the following:

{
    "address": "f028b78f23b5aa70f820dfe4fd0ab9cc48a7e823",
    "crypto": {
        "cipher": "aes-128-ctr",
        "cipherparams": {
            "iv": "50e5a41470ca12e4af407bdbfd6a8ac3"
        },
        "ciphertext": "995965d208a1513da4f89bc7326de3f089af137f48b1253eac29edbdce11f438",
        "kdf": "scrypt",
        "kdfparams": {
            "dklen": 32,
            "n": 262144,
            "p": 1,
            "r": 8,
            "salt": "facb3bc59bd6a983a9aed2da7cab1c5073e92dbf79992567525c6cc959d6fe9c"
        },
        "mac": "a28b2fa30f760d46170a893ae0c9e54d92f680f8e9c0eb4000877f76befc8667"
    },
    "id": "36ecb1c2-86df-4bea-9be4-08c2cb5742ae",
    "version": 3
}

I wish to add the fields: owner, type, label & passwordHint into this as follows:

{
    "address": "f028b78f28b5aa70f820dfe4fd0ab9cc48a7e8c5",
    "crypto": {
        "cipher": "aes-128-ctr",
        "cipherparams": {
            "iv": "50e5a41470ca12e4af407bdbfd6a8ac3"
        },
        "ciphertext": "995965d208a1513da4f89bc7326de3f089af137f48b1253eac29edbdce11f438",
        "kdf": "scrypt",
        "kdfparams": {
            "dklen": 32,
            "n": 262144,
            "p": 1,
            "r": 8,
            "salt": "facb3bc59bd6a983a9aed2da7cab1c5073e92dbf79992567525c6cc959d6fe9c"
        },
        "mac": "a28b2fa30f760d46170a893ae0c9e54d92f680f8e9c0eb4000877f76befc8667"
    },
    "id": "36ecb1c2-86df-4bea-9be4-08c2cb5742ae",
    "version": 3,
    "ownder": 'Liam Nelson',
    "label": 'Test Account',
    "type": 'Ethereum Classic',
    "passwordHint": 'Test Password'
}

How can I read a file from geth console; I tried using loadScript, it fails. Tried require(fileName), it reads but parsing fails!! Think it works depending on the file format!

I tried to require fs for file read/write. But seems the library doesn't exist.

Isn't geth console based on node console? Why are the fundamental libraries missing?


texts: Ether received via faucet is not visible in geth console

texts:
I have ropsten network running in localhost using command :

geth --testnet --syncmode "fast" --rpc --rpcapi db,eth,net,web3,personal --cache=1024  --rpcport 8545 --rpcaddr 127.0.0.1 --rpccorsdomain "*" --bootnodes "enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303,enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303,enode://94c15d1b9e2fe7ce56e458b9a3b672ef11894ddedd0c6f247e0f1d3487f52b66208fb4aeb8179fce6e3a749ea93ed147c37976d67af557508d199d9594c35f09@192.81.208.223:30303" --verbosity=6

I can see its getting synced.But when I opened geth console:

 instance: Geth/v1.7.3-stable-4bb3c89d/linux-amd64/go1.9
 at block: 0 (Thu, 01 Jan 1970 05:30:00 IST)
 modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

at block is not updated. By passing command eth.syncing

 {
  currentBlock: 2864241,
  highestBlock: 2864363,
  knownStates: 9349,
  pulledStates: 688,
 startingBlock: 2864149
}

currentblock was incrementing then it got stuck,then after running the first command again currentblock in geth console increments and stucks. But in geth testnet terminal syncing is continued just its not updated in geth console.


texts:
How to write a classical hello world code in solidity?    please ignore the below code

contract SimpleStorage {
    uint storedData;
    uint x=4;
    console.log("Your debug message");
}


texts: How can I interact with my deployed contract?

texts:
What is the simplest way of interacting with a Deployed contract, considering that I am the owner of the contract (Token Contract).

I use Truffle/Solidity0.5.0/Open-Zeppelin/node10.15.0 nothing extra nothing else (web3 was installed during the deployment but no idea of how to use it)

https://ropsten.etherscan.io/token/0x975FB1824F82E446DD3F5c4cb04474468ED7d878

I mostly need to call functions mint() and burn().

Would appreciate if you can suggest me simplest ways of doing so.


texts: Read message of require / revert statement in app.js

texts: In my App.js I have  called the smart contract function and the require statement in the function is not satisfied, so how do I get the message of that require statement in my App.js?


texts: How can I get the records of invalid blocks once have been mined?

texts: As we all know, an invalid block will be ignored and won't be propagated when a verifier finds its invalidity. However, if there is a need to get the records of all invalid blocks once have been mined for the purpose of statistics, how can we do that?


texts: Would it make sense to use a SQL database to store the data of a Dapp?

texts:
Let's say that I want to develop a Dapp and I need to store different information about the users. This information must not be public as not all the users are allowed to see all the information stored. Is using a centralized database a bad solution? Should the Dapp owner run the servers with the DB to make sure no one can have access to all the data stored?

What are some completely decentralized ways to solve this problem?


texts:
Do I have to pay a gas price if I send ether from account a to account b in Ethereum MainNet?? Or the transaction is free of cost?'

And if I buy ether from Changelly the destination address have to pay something extra?? Or I get the "clean" quantity of the value that I buy in the addres. For example , If I buy 50€ in ether are going to receive 0.26670439eth??

Thx


texts:
I have a following interface function:

pragma solidity ^0.4.24;

interface myInterface {

function registerUser(string memory email) public
      return (bool success);
}

contract myContract is myInterface {
    function registerUser(string memory email) public
      return (bool success){
         //some code ...
      }
    }
}

When I compile the smart contract using solc, I get following warning message:

Warning: Functions in interfaces should be declared external.
    function registerUser(string memory email,
    ^ (Relevant source part starts here and spans across multiple lines).

Later, based on following link's recommendation, I have replaces public keyword with external and obtained following error message:

Error: Location has to be calldata for external functions (remove the "memory" or "storage" keyword).
    function registerUser(string memory email,

After I have replaced public keyword with external keyword, I have obtained
following error message.

Error: Function overload clash during conversion to external types for arguments.
    function registerUser(string email,
    ^ (Relevant source part starts here and spans across multiple lines).

[Q] How could I fix this warning message?


texts: How to use Ethereum as a database for an order book?

texts:
I hope this question is not too general. I would like to have a few opinions.

What is the best way to work with data in Ethereum? Lets say we build a decentralized exchange on a small scale. How would you show the order book on the front end?

Via events logs
Other kind of data types e.g. structs, mappings etc.
Using self made data types e.g. linked lists


texts: Possibility of creating two interacting tokens

texts:
Consider two tokens A and B. A has fixed supply, say, 1000 units, while B initially has zero supply. B is created, along with a brand new public-private key-pair, when A is burned, where A = B. So, there will be 1000 tokens in total be it A or B. B again can be created by burning A.

Some guideline to create such a contract, if possible at all, on testnet would be much appreciated.


texts: How to delete an element from a mapping?

texts:
I have a mapping like this:

struct data {
   string name;
   string nickname;
}

mapping(address => data) public user;

What is the correct way to delete one element from the variable user? Do I only have to call delete(user[address])

or

do I also have to delete user[address].name and user[address].nickname?


texts: Ethereum Foundation position on the use of the Ethereum trademark

texts:
Has the Ethereum Foundation]1 made any public comments regarding appropriate use of the Ethereum trademark?

If such comments have been made what were they?

Have there been any public comments from the Foundation specifically regarding the use of "Ethereum" in the Ethereum Investment Trust (for Ethereum Classic) that was announced last month?


texts: How to provide data for sendTransaction using web3.js 1.0

texts:
I'm using web3.js 1.0. I want to use sendTransaction method to call a contract method, but I don't know how to provide data parameter for it.
For example suppose we have a contract named myContract and the method setValue in it, then we want to call the method with two parameters: 123 as uint and 'ABC' as string. so we have:

nodeUrl='...';
abi=...;
contractAddress='0x...';
web3 = new Web3(new Web3.providers.HttpProvider(nodeUrl));
myContract = new web3.eth.Contract(abi,contractAddress);
web3.eth.sendTransaction({
    from: '0x...',
    data: data
}, function(error, hash){
    ...
});

And we want to use the method as follows:

setValue(123,'ABC');

How can we set the data value for sendTransaction method?

P.S: I don't want to use Metamask. I am using my account directly in my javascript code.


texts: Whether erc20 usdt can be sent to a smart contract so the owner will be a contract address, I mean balanceOf[] will use contract address or the contract owner address? If I send the erc20 again from the contract, I can just call the usdt contract function transfer within my contract? Thanks


texts: Error: Cross origin null forbidden : ---Problem in downloading Open source contracts from Etherscan.io

texts:
UPDATED:
I am trying to download source code of open source verified contract from Etherscan.io. Here is my procedure as directed by Ann.
1. Download CSV file of captioned contracts.
2. Write following program to print source code of contract

const fs = require('fs-extra');
const csv = require('fast-csv')
const jsdom = require("jsdom");
const { window } = new jsdom.JSDOM(`...`);
var $ = require("jquery")(window);

var addresses = [];

fs.createReadStream('./osContracts/list.csv')
.pipe(csv.parse({ headers: true }))
.on('data', (data) => addresses.push(data))
.on('end', () => {
  console.log("There are address: ", addresses.length)
  for(i=0; i<addresses.length; i++){
    $.getJSON('https://api.etherscan.io/api?module=contract&action=getsourcecode&address='+addresses[i]+'&apikey=454BC5UXKPI2.............', function (adData) {
      console.log(adData)
  });
  }
});

Here is my output

Error: Cross origin null forbidden
    at dispatchError (C:\Users\aa\Desktop\temp\node_modules\jsdom\lib\jsdom\living\xhr-utils.js:54:19)
    at Object.validCORSHeaders (C:\Users\aa\Desktop\temp\node_modules\jsdom\lib\jsdom\living\xhr-utils.js:66:5)
    at receiveResponse (C:\Users\aa\Desktop\temp\node_modules\jsdom\lib\jsdom\living\xmlhttprequest.js:843:21)
    at Request.<anonymous> (C:\Users\aa\Desktop\temp\node_modules\jsdom\lib\jsdom\living\xmlhttprequest.js:678:38)
    at Request.emit (events.js:210:5)
    at Request.onRequestResponse (C:\Users\aa\Desktop\temp\node_modules\request\request.js:1066:10)
    at ClientRequest.emit (events.js:210:5)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:583:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:115:17)
    at TLSSocket.socketOnData (_http_client.js:456:22)
    at TLSSocket.emit (events.js:210:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at TLSSocket.Readable.push (_stream_readable.js:224:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:182:23) undefined
Error: Cross origin null forbidden
    at dispatchError (C:\Users\aa\Desktop\temp\node_modules\jsdom\lib\jsdom\living\xhr-utils.js:54:19)
    at ...........................................

UPDATE:
also when i setTimout then following errors are also showing alongwith the previous ones...

{ status: '0', message: 'NOTOK', result: 'Invalid Address format' }


texts: what is the hardware requirement for miners in windows?

texts:
Are there any hardware requirements for using miners in windows?

if yes, what are the requirements?


texts: How does the named return variables in solidity work

texts:
I have below solidity contract from Truffle quick start guide.

    pragma solidity >=0.4.0 <0.6.0;

    contract TaskMaster {

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

        constructor () public {
            owner = msg.sender;
            balances[owner] = 10000;
        }

        function reward(address doer, uint rewardAmount)
        public isOwner() hasSufficientFunds(rewardAmount)
        returns (bool sufficientFunds) {
            balances[msg.sender] -= rewardAmount;
            balances[doer] += rewardAmount;
            return sufficientFunds;
        }

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

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

        modifier hasSufficientFunds(uint rewardAmount) {
            require(balances[msg.sender] >= rewardAmount);
            _;
        }
    }

I have a question on the function reward the way it is going to work.
To me it looks like it is always going to return false because named return type sufficientFunds is not altered.

If not, could anyone explain how does that works?


texts: How to configure parameter reexec of debug_traceTransaction?

texts:
I am trying to use debug_traceTransaction to scan the internal transactions of smart contracts, so I need set the value of reexec, what value should I use? It seems that reexec is the number of blocks the EVM need to re-execute to generate the desired state.

    web3.currentProvider.sendAsync({
      method: "debug_traceTransaction",
      params: [txHash, {tracer: "callTracer", reexec: **??** }],
      jsonrpc: "2.0",
      id: "2"
    }


texts: How do I export ethereum blocks with quickblocks to a JSON file?

texts:
I am looking for how to export or save data from ethereum blocks in a json file
 using quickblocks.


texts: Destroy smart contract and collect its funds

texts:
I'm quite new at smart contracts/Solidity, which I'm learning for a postgraduate course.

In one of the assignments, we have to implement a short example of dutch auction (wiki link). Now my question is that in one of methods, specifically finalize(), the owner of contract must destroy it and collect its funds. And here is my code:

    function finalize() public creatorOnly biddingClosedOnly {
      selfdestruct(_creator);
      if(finalPrice > 0) {
        _creator.transfer(finalPrice);
      }
    }

The rest of contract's methods are running well in Remix but when I call finalize method, the smart contract is not destroyed and still exists so that anyone can call the other functions as before. What am I doing wrong ?


texts: Can you recommend some php script to sign transaction.Thanks.I want to find some php script to sign transaction and without using web3.


texts: any website that show decoded mainnet transaction trace?

texts:
I remember I saw such site when I first start learning about smart contracts last month. It is better than etherscan.io's parity trace, called function name and input are also decoded.
anyone know such site? I remember the one I opened was in black theme.


texts:
I want to make a contract, from a factory contract, that can't be replicated by contracts deployed by other addresses. The factory contract will be called by different addresses so signing a piece of data is not an option. Are there any other methods for making a contract unreproducible?

I am aware that it is possible to find the deployer of the contract but I would prefer if the contract itself could be made unique


texts: How to program ethereum's infrastructure?

texts:
I would like to create an ethereum network with some changes in the infrastructure, for example - adding some encryption, change the proof of work function and more.
Do you know some environments which enable to do such kinds of staff?

I know Microsoft's product called Azure, but pretty sure that it does noe enable the infrastructure programming.


texts: getting the latest holders address:balance for a smart contract

texts:
I managed to get all the transfer events from any given smart contract, but now I need to reduce that to current holder any idea how I would do this?

Here is my code so far:

import ERC20ABI from './blockchain/ERC20ABI.js';
import ethweb3 from './blockchain/ethweb3.js';
import _ from 'lodash';

var addresses = [];
var choppedAdrresses =[];
export function parseAddress(_smartcontract){

     var contractObj = new ethweb3.eth.Contract(ERC20ABI,_smartcontract);
       contractObj.getPastEvents(
           'Transfer' || 'allEvents',
           {
               fromBlock: 0,
               toBlock: 'latest'
           },
           function(err,res){
               console.log(err,res.length);

               for(var i = 0; i < res.length; i++) {
                 addresses.push([res[i].returnValues.from,res[i].returnValues.value]);
               }

               choppedAdrresses=_.chunk(addresses, 100);
               //just to shw how to access data
               console.log(choppedAdrresses);
               console.log(addresses.length)
               console.log(addresses[0])

           }
         );
         return
   }
export default choppedAdrresses;


texts: addPeer() to Ethereum system with different IP address (connect with Google cloud)

texts:
I try to make now a private Ethereum system but can not add peers to it. I tried with static-node.json and with Javascript console (admin.addPeer).

The problem is that I installed miners on google cloud and try now to use it public IP. And my nodes works locally.

How I try:
admin.addPeer("enode://237860fd43f04d9409aa75acf465afba17952add2242f3f1399e2114521d82ed8ef1f52d5396dff72cd6db8442bb87584c4f0fc7f645bc6a71c3a1a8fb55beec@192.168.0.222:30305");

addPeer("enode://2gf52074d040624359e45a7476ba7b7bd2668606768d0f2c3c8872fdc9b6fc3554700c0e3321788218796835867ae059a12edaf3fd22aefd862ebf4848a79bff@35.240.196.190:30303")

192.168.0.222 -> my home IP
35.240.196.190 -> IP of computer engine on google cloud.

I reinstalled the genesis file for both nodes. And tried also with static-node.json. If I addPeers  only on Google Cloud or only locally, it works.

Could you suggest where can be a problem?


texts: Web3ProviderEngine does not support synchronous requests while : Running migration: 2_deploy_contracts.js

texts:
I am new to all this, spent over 15hrs in the past 24 hrs to deploy based on directions here : https://blog.zeppelin.solutions/how-to-create-token-and-initial-coin-offering-contracts-using-truffle-openzeppelin-1b7a5dae99b6

I made simple changes changes because I want to deploy to ropsten and then mainnet.  Initial migration works, but get an error at 2_deploy_contracts. I tried the fix the author mentioned in comments, it wont change anything.

I've googled and looked everything, BUT still get the same error for both networks.
Error:

  Error: Web3ProviderEngine does not support synchronous requests.  at
  ProviderError.ExtendableError
  (C:\Users\g\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:9401:17)
  at new ProviderError
  (C:\Users\g\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:325054:24)
  at
  C:\Users\g\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:325137:17
  at HDWalletProvider.send
  (C:\Users\g\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:325175:22)
  at Object.send
  (C:\Users\g\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:176170:31)
  at RequestManager.send
  (C:\Users\g\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:329502:32)
  at Eth.get [as blockNumber]
  (C:\Users\g\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:41602:62)
  at module.exports
  (C:\Users\g\Documents\bootstrap-3.3.7\bootstrap-3.3.7\docs\examples\carousel\my-ico\migrations\2_deploy_contracts.js:3:48)
  at
  C:\Users\g\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:176043:7
  at
  C:\Users\g\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:203731:7
  at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)

Here is my 2_deploy_contracts:

  const MyCoinCrowdsale = artifacts.require("MyCoinCrowdsale")
  module.exports = function(deployer, network, accounts) {
  web3.eth.getBlock(web3.eth.blockNumber, (e, block) => {
      if(!e) {
        const startTime = block.timestamp + 1 //one second in the future
        const endTime = startTime + (86400 * 20) // 20 days
        const rate = new web3.BigNumber(1000)
        const wallet = accounts[0]
        deployer.deploy(MyCoinCrowdsale, startTime, endTime, rate, wallet)
      }   }) };


texts: invalid tuple value (coderType="tuple", value=1) error while calling a contract function

texts:
My contract code is as follows:

    pragma solidity >= 0.5.0 < 0.7.0;

     contract StoreData  {

      address public owner;

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

      modifier onlyOwner() {
      require(msg.sender == owner,"This function can be called only by the owner of the
       contract.");
       _;
      }

      struct ProductInfo {
      uint256 productId;// Product Id.
      string  productName;// Product name.
      uint256  price;//Product price.
      string  manufacturerName;//Manufacturer name.
      }

      // mapping to store productId.
      mapping (uint => bool) public productIds;

      // mapping to store productInfo with productId as a key.
      mapping (uint256 => ProductInfo) public products;

      //Event generated upon storing data.
      event DataStored(uint256 productId);

      //Function to store data. OnlyOwner of the contract can store data.
      function store(uint256 _productId, string memory _productName, uint256 _price, string memory _manufacturerName) public onlyOwner {
        require(!productIds[_productId],"Product Id already exists.");
        ProductInfo memory newProduct = ProductInfo({
        productId : _productId,
        productName : _productName,
        price : _price,
        manufacturerName : _manufacturerName
        });
       products[_productId] = newProduct;
       productIds[_productId] = true;
       emit DataStored(_productId);
     }

     //Function to retrieve data.
     function getData(uint256 _productId) public onlyOwner view returns(uint256,string
     memory,uint256,string memory)  {
        require(productIds[_productId],"Product Id does not exist");
        return (
            products[_productId].productId,
            products[_productId].productName,
            products[_productId].price,
            products[_productId].manufacturerName
            );
       }

     }

================================================================================================

I am calling these functions from a React application using web3.js as follows:

     import React , { Component }from 'react';
     import web3 from './getWeb3';

     class DataRetrieveForm extends Component {

    state = {
        productId : "",
        product: [],
        errorMessage: "",
        loading: false
    }

    onSubmit = async (event) => {

        try {

             const accounts = await web3.eth.getAccounts();

             const storedata = new web3.eth.Contract(storedataabi,storedataaddress)

             const prod = await storedata.methods.getData(parseInt(this.state.productId))
                                            .call({'from': accounts[0]});
                                //storedataabi-contract abi,storedataaddress-contract address

        console.log(prod);

        } catch (err) {
            this.setState({ errorMessage: err.message});
            console.log("errorMessage: " + this.state.errorMessage);
        }
    }

    render () { jsx code }

Upon calling the getData() function  with the input parameter as 1 in the web application, I'm getting the following error:

errorMessage: invalid tuple value (coderType="tuple", value=1)

I've tried various ways of passing the parameters to the function

await storedata.methods.getData(parseInt(this.state.productId),{'from': accounts[0]});

but same error.

Same thing happens when i call store() function as well like so

await storedata.methods.store(parseInt(this.state.productId),this.state.productName,parseInt(this.state.price),this.state.manufacturerName).send({ from: accounts[0]});

I have been stuck with this for a long time, not sure what to do. Please help and let me know where am i going wrong.


texts: Are function modifiers added to the stack in solidity?

texts:
I've got a function with a decent number of modifiers and I hit the CompilerError: Stack too deep, try removing local variables error. If I remove one of the modifiers though, everything's all right.

It seems that modifiers get bundled into the same stack region as the function, thus increasing the size and throwing the error above. Is that a true statement? If yes, what are the best practices for handling large modifiers? That is, I don't want to create a function as a replacement, because I want to use require.

The full contract can be found here, but here's a snippet with the tricky function:

function update(
  uint256 _streamId,
  uint256 _stopBlock,
  uint256 _payment,
  uint256 _interval
)
  public
  payable
  streamExists(_streamId)
  onlyInvolvedParties(_streamId)
  onlyNewTerms(_streamId, _stopBlock, _payment, _interval)
  validTerms(block.number, _stopBlock, _payment, _interval)
{
  shallowStackUpdate(_streamId, _stopBlock, _payment, _interval);
}

function shallowStackUpdate(
  uint256 _streamId,
  uint256 _stopBlock,
  uint256 _payment,
  uint256 _interval
)
  private
{
  Stream memory stream = streams[_streamId];
  stop(_streamId);
  create(stream.sender, stream.recipient, block.number, _stopBlock, _payment, _interval);
  emit LogUpdate(streamNonce, stream.sender, stream.recipient, block.number, _stopBlock, _payment, _interval);
}

I had to write the shallowStackUpdate function to successfully compile the contract. Ideally, the two would merge into only one function.

Note: I searched SE and my situation is NOT the same with the one in the How to Fix “Stack Too Deep” Error? thread.


texts: How does myContract.events.MyEvent ([options] [, callback]) work?

texts:
I'm trying to understand how events work. My contract emits an event which is captured by the node (I'm using web3js). I need to extract the submitted parameters (msg.sender, id_, location_). I need these variables to perform other steps.For example I have to make a request to an external data source to know the temperature in that location_. How can I extract them?
Contract
emit RequestWeather(msg.sender, id_, location_) ;

Web3.js
myContract.events.RequestWeather({}, function(error, event){ console.log(event); })
.on('data', function(event){
console.log(event); // same results as the optional callback above})
.on('changed', function(event){
// remove event from local database})
.on('error', console.error);


texts: Re-create raw transaction hash from transaction object

texts:
Is there a way to re-create the signed transaction hash from tx object. I found the How to construct a raw Ethereum transaction from transaction data answer helpful, but when I try to re-create the code in python using rlp.encode() I get a different value. For example using rawTransaction.hex() for unsigned transaction I get: f85b8530783165378c3078326539306564643030308730783330643430aa307862643036343932386364643466643637666239393931376338383065363536303937386437636131913078646530623662336137363430303030823078
instead of
ec8201e7852e90edd00083030d4094bd064928cdd4fd67fb99917c880e6560978d7ca1880de0b6b3a764000080


texts: Best way to check balance? msg.sender.balance vs balances[msg.sender]

texts:
If I want to check if the payer has enough funds, should I use...
 msg.sender.balance

or
balances[msg.sender]

?
I also see that people usually check balance in the following way:
require((balances[msg.sender] + msg.value) >= balances[msg.sender]);

I think I missing something, because for me the most logical way would be this:
require(msg.sender.balance >= msg.value );

Thanks in advance!


texts: Why are gas fees taken for failed smart contract interactions?

texts:
When claiming an NFT (smart contract interaction), the gas fees would have been $50-$80, so I went to Advanced options in MetaMask, and turned down my willingness to pay for gas to around 25,000 units for a much lower gas fee of $6.
The transaction failed however (I guess because $6 gas fee is too low?), and my ETH  wallet balance is now lower, meaning that the gas fee was taken even though the transaction failed.
Why are gas fees taken for (both?) failed transactions/contract interactions?


texts: Warning! Error encountered during contract execution [Reverted]

texts:
i have contract which looks like following

pragma solidity ^0.4.8;

contract Rental {
    struct PaidRent {
        uint id;
        uint value;
    }
    PaidRent[] public paidrents;
    event RentPaid(bool Status);
    function payRent() public payable returns(bool status) {

        if(owner.send(msg.value)) {
          RentPaid(true);
          return true;
        } else {
          RentPaid(false);
          return false;
        }

    }
}

i am calling this function from my service using web3 in following way

paymyRent(contractInstance, rent) {
    console.log('in paymyrent');
    let eventlistenenr = contractInstance.RentPaid();
    eventlistenenr.watch(function (error, result) {
      if (!error) {
        console.log(result.args);
      } else {
        console.log(error);
      }
    });

    contractInstance.payRent({from: this.web3.eth.accounts[0],
      gas:4665270, value: this.web3.toWei(rent, "ether")});
}

but upon sybmitting my transaction from metamask transaction is being failed. here is the screenshot of a transaction detail

any help is really appreciated :)


texts: How to combine multiple inputs addresses using contract?

texts:
By reading through posts and questions/answers here and there, I realized that there're no multiple inputs and outputs on one transaction in Ethereum, which is different from Bitcoin.

I also learned that by using contract, you can send to multiple addresses with just one transaction to that contract, like this.

function sendToMany(address[] recipients) {
    for(uint i = 0; i< recipients.length; i++){
         i.send(msg.value/recipients.length);
     }
}

So I'm wondering how I can combine multiple input addresses using contract. Any suggestion or skeleteon solidity code for this?


texts: Do ETH and ETH-based utility tokens face a velocity problem for investors?

texts:
This question specifically is about Ethereum and other cryptocurrency coins, but should be applicable to any asset as far as I understand.
I was a reading a valuation paper by Grayscale Research and they were talking about how one criticism of Ethereum and coins that exist on the Ethereum network was that it would potentially suffer from an infinite velocity problem where no one actually wanted to hold the coins but just use them as an intermediate ramp between fiat currencies and goods and services/asset purchases.

Similarly, some have argued that Ether suffers from a working capital or infinite velocity problem — as simply a medium of exchange asset, investors may look to minimize their holdings to only what is necessary to pay for a service, i.e., Ether would be treated as working capital. Because investors might look to minimize their working capital, the velocity of Ether would increase and its value according to the equation of exchange, M=PQ/V, would decrease. In other words, constant selling would drive down the price of the Ether.

Their source is taken from this article titled Understanding Token Velocity.
However, I don't fully understand the argument or know if it is valid. It seems to be at least partially wrong to me.
I thought about it and wouldn't people just hold onto Ethereum or other coins they thought were valuable if they knew they were going to need to use them later as long as they suspected the coins would be in more demand, even if there was no use-case for a store of value?
For example, if I owned a restaurant and I created a coin and I mandated all customers pay by using this coin, many customers would indeed just convert fiat into the coin and then just purchase the goods and services. However, I would imagine that many customers would buy more coins than they need if they anticipated demand rising and/or liked to buy at the restaurant anyways?
The author of the article states that Consumers want to pay for tickets denominated in dollars. They may purchase <token name> tokens as part of the ticket acquisition process, but they won’t hold the tokens for more than a few minutes at a time. There’s simply no incentive to hold them and incur price risk relative to the dollar.
Or is the author of the article right and this is where EIP-1559/token burning and also staking will become relevant? Or they are wrong but EIP-1559/token burning and also staking will just further increase the value proposition of ETH/ETH-based coins to investors?


texts: How does geth communicate with other nodes to sync ?

texts: Evening if all ports are closed geth can still sync with other nodes, what channels exactly are used for that ?


texts: How to sign ERC20 transaction with trezor connect

texts:
I sent some ERC20 token to an ethereum address in my trezor and I can successfully see it using MEW. I wish to use this as an air-gapped wallet but with frequent use (i.e, not cold wallet).

Suppose I create a raw transaction, how do I call trezorconnect to sign it?

[Edit: The method might be to call signtx in trezor and have crypto elements v,r,s returned and then somehow convert to format ready for broadcast. If correct, code please?]


texts: How to import the Contract type from the web3.js library?

texts:
Here's how I can do that in ethers@4.0.47:

import { Contract, ethers } from "ethers";

const contractInstance: Contract = new ethers.Contract(address, abi);

But in web3.js@1.2.8 none of the following works:

import Web3 from "web3";
import { Contract } from "web3"; // option 1
import { Contract } from "web3/types"; // option 2


texts: How to get my ERC20 token listed on Metamask

texts: I would like to add my ERC20 token to Metamask, so that when users type its name into the search bar, it shows up along with its logo. Currently users can add their tokens manually. But, I'm wondering how can I add my token to the list.


texts: how to get list of transactions history about specific contract address using web3?

texts:
I really don't know how to get a list of transactions history about specific contract address using web3.py
and I use Infura HTTPProvider
I just have only one 'contract address'.
Can i get information about this contract address using web3.py?


texts: Is there a way to set specific account when using truffle console rinkeby?

texts: When I tested on ganache-cli at local, I could test on 'truffle console development' with some accounts which ganache-cli gave. But at rinkeby, I can't use function_name(argumets, {from: specific rinkeby account}) form. Is it possible to set the specific account on 'truffle console rinkeby(and mainnet also)'? (Something like using web3.eth. thing) If it is, how can I set that?


texts: "missing trie node" when requesting balance

texts:
I've been getting the "missing trie node" error in the majority of my eth_getBalance requests if I use anything other than the "latest" block or very recent blocks. For example, the request:

"eth_getBalance", ['0x1cbff6551b8713296b0604705b1a3b76d238ae14', '0xf4251']

on the rinkeby network will return the error as 0xf4251 (1000017) is an old block (current is around 1.7M)

Other answers to this question suggets that I cant get the value because the state tree has been pruned so Im wondering if there is a way of getting the full tree?  Someone suggested using --synmode=full when starting get, but that didnt work.

Any thoughts?
Thanks


texts: What happens to wallets during a hard fork?

texts:
What happened to "Ethereum" wallet balances when Ethereum was forked from Ethereum classic?

For example if someone had a wallet prior to the fork, would that wallet then be compatible in both Ethereum Classic and Ethereum?

That is, if someone had 2 Eth in their wallet prior to the fork, would they have 2 Eth in Ethereum classic and 2 Eth in Ethereum after the fork?


texts: As mentioned in this link How do I parse the transaction receipt log with web3.js? it works fine for web3 js but how do i parse in ethereumJ. Event tracking and decoding from ethereumj I believe it explains about topic and its encoding/decoding details but what I wanted is not about topic but about data variable which comes as one of the parameter in result of filter which holds non indexed values in event.


texts:
I have an Android device running Cyanogen Mod without Google services, but it seems all Android applications for Ethereum ship via Google Play only.

I kindly requested the Jaxx developers multiple times to provide alternate downloads, e.g. signed APKs or the F-Droid appstore, but they refuse to take a look into that issue.

Is there any way to install an Ethereum wallet on a Non-Google Android device?


texts: Can consecutive transactions be mined on same block?

texts:
Can consecutive transactions of same EOA (Externally Owned Account) be mined at same block as below?

TX1: nonce=0, Number_confrimed_Block=100
TX2: nonce=1, Number_confrimed_Block=100
TX3: nonce=2, Number_confrimed_Block=100

Thank you for your help:)


texts:
storage error is showing in line number 6 for string title,
If I add the storage keyword in between, how does it affect my contract?
Does it affect my byte code or gas consumption in later use.

The code goes by:

pragma solidity ^0.4.8;
contract token{
    struct video { address vidAddress; string title; uint initialSupply; }
    mapping(address=>video)videos;
    function add(address vidAddress,string title,uint initialSupply){
    video memory v;
    v.vidAddress=vidAddress;
    v.title=title;
    v.initialSupply=initialSupply;
    videos[vidAddress]=v;
    }
}

In particular, this snippet of code:

pragma solidity ^0.4.8;
contract token{
    struct video { string title;  }
    function add(){
    }
}

produces this compiler warning on line 3:

 Warning: Variable is declared as a storage pointer. Use an explicit "storage" keyword to silence this warning.
    struct video { string title;  }
                   ^----------^

in version 0.4.13 on remix


texts:
I'm a bit new to ethereum and I'm finding it a bit difficult to understand how gas and Ether relate.

So every call we do to a smart contract costs gas. Where does the gas that the user pay goes to? Does it evaporate, or is it credited to some other account?


texts: Any good smartcontract for "business calendar" oracles?

texts:
is anybody aware of some smart-contract that can be used as external "trustable" oracle for no-so-simple scenarios, like for example calculating the number of non-festive days passed since a given date or time-windows.

I'm thinking of some external (trusted) entity that is allowed to fill such calendar and sign when a new day has passed, ...

I'm thinking about use-cases like:
- Some smart-contract internal state change or some payment must be allowed just after 10 working days, excluding weekends.


texts: How this snippet is linking contracts? How each contract finds the other

texts:
I'm trying to understand how can two contracts be deployed and interact with each other, given that I don't have their addresses before deployment. I ended in this question and I don't understand the answer.
contract InterfaceOfA {
        function f(uint) returns (uint);
}

contract InterfaceOfB {
        function g(bool) returns (bool);
}

contract A is InterfaceOfA {
        InterfaceOfB b;
        function f(uint _input) returns (uint) {
                b.g(true);
                return 3;
        }
}

contract B is InterfaceOfB {
        InterfaceOfA a;
        function g(bool _input) returns (bool) {
                a.f(0);
                return false;
        }
}

I tried to execute this in remix to gather a better understanding, but it raised a bunch of errors I didn't knew how to fix. So I would like to understand how can contract A find contract B to call the g method if the address of contract B isn't stored? Same with contract B finding A to call method f.


texts: What improvements will the upcoming Byzantium fork bring to Smart Contract development?

texts:
The Ethereum Team announced recently that the Byzantium fork will happen on October 16. This will be the first phase of the Metropolis upgrade.

What improvements will the Byzantium bring to Smart Contract development?

Anything special that we should be aware of?


texts:
How can I make a JS webpage which automatically opens a MetaMask payment prompt?

Hello,

I am coding some web3 enabled webpages.

I want to make a webpage which does the following in JavaScript:

a) Loads the web3 resource
b) Automatically opens a prefilled payment request prompt in MetaMask of say 0.001 ETH to address XYZ. This should happen as soon as the webpage is loaded.

Anyone knows how to do this as simply as possible?

Vesa


texts: Chainlink node error: BumpGasUntilSafe FindTxBy Attempt: record not found

texts:
I am currently testing sending requests to my Chainlink node on Ropsten. I am following the documentation for running a Chainlink node and all went well until.

40 BumpGasUntilSafe FindTxByAttempt: record not found.

What is usually the cause of this error?


texts: What is the purpose of multiple addresses in a wallet?

texts:
In eth-lightwallet from consensys there is a function generateNewAddress.

What is the purpose of having multiple addresses for the same account?

I can think of a few usages:

accounting solution: 1 address per general ledger entry
as a convenience to split funds by purpose
to easily cap spending for something:

use an address to participate in a contract and there is an automatic upper limit to spending

is this the thought behind addresses or am I missing something?


texts: I'm having trouble testing the permit() functionality from the DAI contract. I've read the documentation and a couple of other resources, although, I got the contract code and deployed myself a copy of it on a local machine testnet and got no success trying to make use of it. I'm very confident I'm not using the signature right. What v,r,s values am I supposed to provide to my function? Because, to my understanding, I need already a Tx or a Message+Signature to get my v,r,s values. The lack of resources or practical examples is difficulting my progress because I'm not being able to figure out how exactly I should do it. Thus, I would really appreciate some help here.


texts: What is IBAN/BBAN address and what is the purpose of web3.eth.Iban?

texts:
I do not find too much information about the use cases of Iban, in web3.eth.Iban object.
Could anyone tell me what is exactly an IBAN address in web3, and when to use it?
https://web3js.readthedocs.io/en/v1.2.3/web3-eth-iban.html#eth-iban
Is it related with International Bank Account Number ? If so, how is it related with Ethereum?
I don't see the point in how IBAN (banking environment) and Ethereum (Blockchain environment) addresses are related (and why) trough web3 library.
Could anyone show and use case of IBAN object in web3?


texts:
this command works but yields a warning of future removal so I'd like to use new option init :

➜  ~ go-ethereum/build/bin/geth --datadir="~/testgeth/" --genesis ~/testgeth/customgenesis.json --port "30304" --networkid 6776 --rpc --rpccorsdomain="http://localhost:63342" --rpcport="8546" --minerthreads="1" --nodiscover --maxpeers=0 console

####################################################################
#                                                                  #
# --genesis is deprecated. Switch to use 'geth init /path/to/file' #
#                                                                  #
####################################################################

unfortunately the help isn't very verbose :

➜  ~ go-ethereum/build/bin/geth init --help
init [arguments...]

The init command initialises a new genesis block and definition for the network.
This is a destructive action and changes the network in which you will be
participating.

I tried that but it yields an error :

➜  ~ go-ethereum/build/bin/geth init testgeth/customgenesis.json --datadir="~/testgeth/" --port "30304" --networkid 6776 --rpc --rpccorsdomain="http://localhost:63342" --rpcport="8546" --minerthreads="1" --nodiscover --maxpeers=0 console
Incorrect Usage.

init [arguments...]

The init command initialises a new genesis block and definition for the network.
This is a destructive action and changes the network in which you will be
participating.

flag provided but not defined: -datadir


texts: Any email signIn based blockchain wallet APIs for integrating into web dapps & native dapps (Android, iOS)?

texts: I'm looking for an email SignUp / SignIn based blockchain wallet which provides API for integration into web dapps and native mobile dapps (Android & iOS). During payment routine in dapps, this API should be able to initiate an OAuth2 / OAuth style Email Authentication routine. Once logged in to wallet, the wallet API should provide option to transact the smart contract functions like metamask. Bonus points for other functionalities like SignUp (register) new users and add cryptos in the API interface itself.


texts: How to determine if ISP is blocking Ethereum traffic

texts:
My "Ethereum Wallet" from ethereum.org used to connect to several peers.  A while ago I noticed it was taking longer and longer to sync and the number of peers dropped.   It got worse, and seldom connected to more than 1 peer.  Now, it connects to none.

Is it possible that ISPs are blocking Ethereum traffic?
How can I determine if my ISP is blocking Ethereum traffic?
If ISPs do block the Ethereum network, how do we use Ethereum?


texts: I want to write tests for my simple solidity contract and one of the tests I have is to pass an address dynamically from remix or ganache-cli. Is there a way to access all other addresses from remix in a contract function?


texts:
After deploying ERC20 contract (MyToken), I transferred all tokens to MyToken contract.

Then I deployed a service contract that has one method called claimWining() which is supposed to transfer tokens to a caller account from MyToken contract.

pragma solidity ^0.5.0;

contract MyToken is Context, ERC20, ERC20Detailed {

    constructor () public ERC20Detailed("DEST", "DST", 18) {
        _mint(_msgSender(), 1000000000 * (10 ** uint256(decimals())));
    }
}

contract Claim {

    MyToken public token;
    address myToken;

    constructor(address _tokenAddress) public {
        token = MyToken(_tokenAddress);
        myToken= _tokenAddress;
    }

    function claimWinning() public {
        // doesn't work
        token.transferFrom(myToken, msg.sender, 100000);
    }
}

Here I used transferFrom(), but it was not working because I was unable to execute approve() initially.

function approve(address spender, uint256 amount) public returns (bool) {
    _approve(_msgSender(), spender, amount);
    return true;
}

I found that MyToken contract itself should call approve() as msg.sender, but I'm not sure how to do it.

Basically, what I want is platform user calls claimWinning() to get rewarded with ERC20 token.
How can users receive tokens from MyToken contract?


texts:
https://github.com/optionality/clone-factory/blob/master/contracts/CloneFactory.sol#L32 contains a code to deploy a basic proxy.
This code misses a way to pass data to the proxied contract to init it.
Initialization could be accomplished an init method but that's legible to attack of running a wrong init() call before the user by passing high gas price. This makes the hacker able to make a legit user either not to be able to deploy at all or to pay high gas because he would need to deploy multiple times to reach the right init() arguments.
I see no reason for anyone playing this game with my users, but allowing to circumvent legit users for anyone who wants to play with his extra gas is nevertheless a bad thing.
Could you give me a code for deploying an efficient proxy that does not suffer from this vulnerability?


texts: Can a contract access another contract's storage?

texts:
I have a contract with numerous complex structs. Is it possible for a second contract to iterate over this data directly?

I can't really use public accessor/getter methods as it's not possible to use structs externally, so I would have to flatten the data structure (probably make expensive copies of it too).


texts:
anyone else who tries to read smart contract data through Infura and process it on front-end but gets 'CORS' error?
My DAPP works fine in Google Chrome and has no issue in fetching the smart contract data. Same on Internet Explorer. The problem is when I use Microsoft Edge that I'm getting this:

My web3 implementation is correct:

import Web3 from 'web3';

let web3;
if (typeof window !== 'undefined' && typeof window.web3 !== 'undefined') {
  // metamask is running
  web3 = new Web3(window.web3.currentProvider);
} else {
  // set up provider through infura
  const provider = new Web3.providers.HttpProvider(
    // pass url of remote node
    'https://rinkeby.infura.io/v3/censored');
  web3 = new Web3(provider);

}

export default web3;


texts: Limit of address creation using single mnemonic

texts: How many Ethereum address can be created using a single mnemonic for Ethereum using derivation path?


texts:
I tried code from web3js docs , but it didnt woork for me. I dont get any logs. Any idea why?

code i used:

    var subscription = web3.eth.subscribe('syncing', function(error, sync){
    if (!error)
        console.log(sync);
})
    .on("data", function(sync){
        console.log(sync);
    })
    .on("changed", function(isSyncing){
        if(isSyncing) {
            console.log("changed");
        } else {
            console.log("changed to false");
        }
    });

geth:

geth  --testnet --rpcapi "eth,web3, personal, accounts, miner, admin" --rpccorsdomain='*' --rpc --rpcaddr="0.0.0.0" --rpcport "8545" --ws --wsorigins="*" --wsaddr 0.0.0.0 --fast

web3:

let web3 =  new Web3(new Web3.providers.HttpProvider("ws://geth:8546"));

web3 version:

"web3": "^1.0.0-beta.30"

Blochchain is fully sinced.


texts: Truffle TypeError: Member "error" not found or not visible after argument-dependent lookup in type(library Assert)

texts:
Trying to test my Solidity contract for errors using Truffle test.

TestSafeMath.sol

  function test_add_10_and_max_should_return_err() {
    uint256 max = 2**256 - 1;
    Assert.error(SafeMathExt.add(10, max), "Addition of 10 and max should return error?");
  }

Assert.sol

function error(uint16 errorCode, string message) constant returns (bool result) {
    result = (errorCode != 0);
    if (result)
        _report(result, message);
    else
        _report(result, _appendTagged(_tag(uint(errorCode), "Tested"), message));
}

Error Message:

TestSafeMathExt.sol:24:5: TypeError: Member "error" not found or not visible after argument-dependent lookup in type(library Assert)
Assert.error(SafeMathExt.sub(0, 10), "Subscraction of 0 and 10 should return error?");
^----------^

Note: Other tests are working as expected


texts:
I'm about to start syncing node on the server, do you know if there are any requirements to the server, like CPU or GPU and most of all, free disk space.

Any tips about syncing on server?

Cheers!

EDIT: NOT TO MINING PURPOSES.


texts: How to whitelist up to 50k addresses in a single contract?

texts:
What is the best practice in whitelisting a large amount of addresses in a contract. For example, if I wanted to include 50k addresses into a mapping that will reflect true for only the 50k addresses, would this be the optimal way? How much would this cost, per address?

mapping (address => bool) userAddr;

function whitelistAddress (address user) onlyOwner { userAddr[user] = true; }

Including 50k addresses hardcoded into the contract would hit the block gas limit, no doubt. How do I calculate exactly how much this would cost