texts: Private network: Using geth to mine for parity nodes

texts:
I want to set up a private Ethereum network using a parity client. Ideally, I want to resemble the "real" Ethereum network as close as possible. Thus, I want to set up a proof of work network. For that, I used the chain configuration below for Parity. I now want to mine on this private chain, but with a cpu miner. I have found only Geth being capable of doing that. However, when I attach to the parity node running the private chain, I can not use the miner.start() command.

How can I use a geth node to mine for a parity node?

Parity node configuration:

{
"name": "CrossClient",
"dataDir": "CrossClient",
"engine": {
    "Ethash": {
        "params": {
            "minimumDifficulty": "0x020000",
            "difficultyBoundDivisor": "0x0800",
            "durationLimit": "0x0d",
            "blockReward": "0x4563918244F40000",
            "homesteadTransition": 0,
            "eip150Transition": 0,
            "eip160Transition": 10,
            "eip161abcTransition": 10,
            "eip161dTransition": 10
        }
    }
},
"params": {
    "gasLimitBoundDivisor": "0x0400",
    "registrar": "0x81a4b044831c4f12ba601adb9274516939e9b8a2",
    "eip155Transition": 10,
    "accountStartNonce": "0x0",
    "maximumExtraDataSize": "0x20",
    "minGasLimit": "0x1388",
    "networkID" : "0x539"
},
"genesis": {
    "seal": {
        "ethereum": {
            "nonce": "0x0000000000000042",
            "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
        }
    },
    "difficulty": "0x10000",
    "author": "0x0000000000000000000000000000000000000000",
    "timestamp": "0x00",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "0x3535353535353535353535353535353535353535353535353535353535353535",
    "gasLimit": "0x1000000"
},
"accounts": {
    "0000000000000000000000000000000000000001": { "balance": "1", "nonce": "0", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
    "0000000000000000000000000000000000000002": { "balance": "1", "nonce": "0", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
    "0000000000000000000000000000000000000003": { "balance": "1", "nonce": "0", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
    "0000000000000000000000000000000000000004": { "balance": "1", "nonce": "0", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } }
}

}


texts: What are Golem, Sonm and iEx.ec? How are they different from each other?

texts:
I have recently discovered some Ethereum blockchain based universal supercomputer (distributed cloud computing) technologies like Golem, Sonm and iEx.ec. It seems like all those projects are still in progress, hence I was not able to experiment on them to run some applications.

Golem:

  Golem Project is a work in progress. Current version is an alpha stage
  of Brass Golem and it's not fully secured. Check this list of issues
  for more details. Please be sure that you understand the risk before
  installing the software.

  Security Issues exist:
  https://github.com/golemfactory/golem/labels/security
  (1) Sign apps macos planned security windows
  (2) Rework Ethereum in-sync check ethereum security
  (3) Check if 'exec' is used safety security
  (4) Design key manager security
  (5) Check if same keypair can be used for data encryption and signing security

Sonm:

  Still in development (Alpa released).

iExec:

Everything seems stil in progress: https://trello.com/b/SBLym0gH/iexec-roadmap

  Crowd-sale completed. Looking for developers, they are doing
  recruiting now.

[Q] What are Golem, Sonm and iExec? How are they different from each other? What are the advantages of each one?

Thank your for your valuable time and help.


texts: How to get the value from the frontend form and save value to the blockchain using +web3 1.0.0-beta.37 + reactjs

texts:
I am writing my first Dapp and want to save the value of the form to the blockchain. I am Using React and web3 js 1.0.0-beta.37 on the frontend. Also I am new to react.

Following is my App.js

import React, { Component } from 'react';
import './App.css';
import FormSubmitContract from './contracts/FormSubmit.json';
import TruffleContract from 'truffle-contract';
import getWeb3 from './utils/getWeb3.js';
import $ from 'jquery';

class App extends Component {
 state = {
   web3:null,
   email:null,
   password:null,
   address1:null,
   address2:null,
   city:null,
   state:null,
   zip:null

 };

 componentDidMount = async () => {
   try{
     const web3 = await getWeb3();
     //console.log(web3);
     const accounts = await web3.eth.getAccounts();
    //console.log(accounts);
    const networkId = await web3.eth.net.getId();
    //console.log(networkId);
    //console.log(FormSubmitContract.networks);
    const deployedAddress =
    FormSubmitContract.networks[networkId].address;
    //console.log(deployedAddress);
    const ContractInstance = new
    web3.eth.Contract(FormSubmitContract.abi, deployedAddress);

    this.setState({web3, accounts, contract:ContractInstance})
   }catch(error){
    console.log(error);
  }
}

onSubmit = async (event) => {
event.preventDefault();

const FormSubmit = TruffleContract(FormSubmitContract);
FormSubmit.setProvider(this.state.web3.currentProvider);
this.state.web3.eth.getAccounts((error,accounts) => {
  FormSubmit.deployed().then((instance) => {
    // Forminstance = instance;
 }).then(result => {
   return FormSubmit.setData($("#inputEmail4").val(),
 $("#inputPassword4").val(), $("#inputAddress1").val(),
    $("#inputAddress2").val(), $("#inputCity").val(),
     $("#inputState").val(), $("#inputZip").val() ,{from:
     accounts[0]});
    }).catch(() => {
   console.log("Error in getting the data is printed");
   })
 })
}

setData function in contract

function setData(string memory _email, string memory _password, string
memory _address1,
string memory _address2, string memory _city, string memory _state,
string memory _zip) public
{
  email = _email;
  password = _password;
  address1 = _address1;
  address2 = _address2;
  city = _city;
  state = _state;
  zip = _zip;
}

I want to store the submitted form on the blockchain but My problem is I am not getting data and  "Error in getting the data" is in the console log.

I think there is a problem in setData as I don't know how to pass the data in the parameter.

If you can share any material regarding the form submission or Initial level Dapp then it will be very helpful.

Thanks.


texts: Payable function 'charges' sender twice value sent in tx after invoking library function

texts:
Facing a nasty bug and could really use a pair of fresh eyes.

I have a payable function that is somehow taking twice the value sent to it by the sender, from the sender.  Specifically, it appears to be a call within the payable function to a library method that is incurring the second "charge", if you will.

Here's an excerpt of the parent contract with the payable function, Remittance.sol:

pragma solidity ^0.4.8;

import "./Owned.sol";
import "./Data.sol";
import "./Util.sol";

contract Remittance is Owned {
    Data.LockBoxes lockBox;
    Data.LockBoxIndex lockBoxIndex;

    modifier stopInEmergency
    {
        if(stopped) throw;
        _;
    }

    function createLockBox(
        address _receiver,
        bytes32 _password1,
        bytes32 _password2)
        stopInEmergency
        payable
        public
        returns (bool)
    {
        uint amount = msg.value - ownerFee;

        // After Data.insert() is invoked, `msg.value` is taken from `msg.sender` again
        if(Data.insert(lockBox, lockBoxIndex, _receiver, msg.sender, amount, _password1, _password2))
        {
            LogLockBoxCreated(_receiver, amount, true);
            deposit(owner, ownerFee);
            return true;
        }
        else
        {
            LogLockBoxCreated(_receiver, amount, false);
            throw;
        }
    }

Here's a portion of the library code, Data.sol:

pragma solidity ^0.4.8;

library Data {

  struct LockBox {
    address creator;
    uint amount;
    bytes32 password1;
    bytes32 password2;
    uint creationTime;
    bool active;
    uint index;
  }

  struct LockBoxes {
      mapping(address => LockBox) boxes;
  }

  struct LockBoxIndex {
      address[] boxIndex;
  }

  function insert(
      LockBoxes storage s1,
      LockBoxIndex storage s2,
      address _receiver,
      address _creator,
      uint _amount,
      bytes32 _password1,
      bytes32 _password2)
      public
      returns (bool)
  {
      if (s1.boxes[_receiver].active)
           return false;
      s1.boxes[_receiver] = LockBox(_creator, _amount, _password1, _password2, now, true, s2.boxIndex.push(_receiver) - 1);
      return true;
  }
}

And then, in a truffle test...

remittance.createLockBox.sendTransaction(beneficiary, p1_hash, p2_hash, { from: creator, value: amount })

If amount in the transaction above is 2 ether, then the contract will be paid 4 ether by the sender creator!

Many thanks in advance.


texts: How to connect to the Ropsten test-net using web3.js

texts:
I want to connect to the Ropsten test-net:

    // Is there is an injected web3 instance?
    if (typeof web3 !== 'undefined') {
      App.web3Provider = web3.currentProvider;
      web3 = new Web3(web3.currentProvider);
    } else {
      // If no injected web3 instance is detected, fallback to the TestRPC.
      App.web3Provider = new web3.providers.HttpProvider('http://localhost:8545');
      web3 = new Web3(App.web3Provider);
    }

I have http://localhost:8545 in this code. How do I connect to Ropsten instead of http://localhost:8545?


texts: Why have most REP token transfers been failing?

texts:
Almost all REP transfer attempts have been failing recently:

https://etherscan.io/address/0x48c80F1f4D53D5951e5D5438B54Cba84f29F32a5

This seems to have started about a month ago. Poloniex, Kraken and a few other have been submitting successful transactions, while others have mostly failed.

Any idea why?


texts: Could one build a "Stack Exchange" like information structure or process over Ethereum? Could the "Stack Exchange" team use Ethereum to build a new and improved information learning structure? As it is people could make multiple accounts(or share one account) to trick the "Stack Exchange" process just as much as they could do the same to trick the Ethereum system. But, using Ethereum fuel could someone make a "Stack Exchange" 'like' Ethereum based program to infuse true value into actions of contributing individuals?


texts: "Glossary of terms" for Ethereum components

texts:
very new to all this I'd think a bit of defining term's and getting started to know how some key components (like Ethereum, Ether, Gas, Token, etc.)
 relate to each like other would help a lot in basic understanding.

So, is there a Glossary of terms or something similar
 available somewhere?


texts:
I understand that Solidity supports contract polymorphism, but what pattern would one use to create abstract data types for use in derived contracts?
Motivating example: Say I have an abstract Storage contract. I want to implement a derived contract OrderStorage that implements a struct Order and a method append(Order[] memory _orders), and another derived contract CustomerStorage that implements struct Customer and append(Customer[] memory _customers).
Is there a way that I can define the append method once in the Storage base contract and then just plug in the right struct in the derived contracts, without redefining the append method in each derived contract?
If what I'm seeking is impossible, are there any viable alternative patterns that would be better than redefining append from scratch on every derived contract?


texts: Any way to have delegatecall change the delegate contract's storage state?

texts:
A delegatecall'ed function executes inside of the delegatecaller contract's own memory & storage context.

But I'm wondering whether the following is in any way possible (i.e. if certain access modifiers are used):

EOA msg.sender calls contractA.method(),
contractA.method() delegatecalls to contractB.(),
contractB.method() runs. (Somehow?) ContractB's 'mapping (address => bool) approve;' is updated to include msg.sender[true].


texts: Question about ETH and contract creation

texts:
I have a noob question about contract creation. I'm following this tutorial: https://www.ethereum.org/dao However there's a step in there that I don't quite understand. After I enter the contract code, fill out my values for how I want the contract to work, at the bottom I see this:

Total: 0.02977296 ETHER

Now at the top of the contract, it says AMOUNT: 0.00 ETHER and gives me an option to send ether to the contract.

Do I have to send the contract ether? And if so, how would I determine how much ether to send it? Do I keep that top box at 0.00 ether and just let the total at the bottom be 0.02977296 ETHER? I'm a little confused.


texts: I sent ETH to ETC from coinbase to Bitsane how do I get my coins back?

texts:
I sent ETH from coinbase and received confirmation that they were sent, but It looks like I sent it to ETC from on Bitsane how do I get my coins back?

I am very new to this process and very frustrated.  Can any help me get my funds back?

Will bitsane see that its the wrong account and refund coins to Coinbase?


texts: Pushing a struct to an array prevents logging

texts:
I'm getting a strange error in Solidity. I have the following public function:

struct Bid {
    address bidder;
    uint amount; /* in wei */
    bool home; /* true=home, false=away */
    int64 line;
}

event BidPlaced(bytes32 indexed game_id, BookType book, address bidder, uint amount, bool home, int64 line);

function test(bytes32 game_id, bool home, int64 line) payable returns (int) {
    Game game = getGameById(game_id);
    Book book = game.books[uint(BookType.Spread)];
    Bid memory bid = Bid(msg.sender, msg.value, home, line);

    // problem is right here
    book.homeBids.push(bid);

    BidPlaced(game_id, BookType.Spread, msg.sender, msg.value, home, line);
    return 0;
}

When I call the function with contract.test.call(...), it returns 0, but when I run contract.test.sendTransaction(...), the BidPlaced event doesn't log.

When I check the receipt for how much gas is being used, it shows the expected amount, so I know an error isn't being thrown.

If I get rid of the book.homeBids.push(bid); line, the event logs properly. What about that line could cause a problem?


texts: Why do I get drastically different hash rates for different currencies

texts: I'm using MinerGate and when I try to mine Ethereum I get around 10KH/s but when I try to hash Monero I get only 200H/s. I know they would be different but 1000 times different? I'm using a CPU for both. Confused. What am I missing?


texts: How to calculate a root node in a Merkle Patricia tree?

texts:
I'm trying to understand a Merkle Patricia tree.
For example there are two accounts:
x00: {balance: 1}
x01: {balance: 2}
I can't understand how to begin building my trie.
RLP and HP encoding are known, but what is the root node?


texts: Bootnode from geth not working with parity

texts:
I am working with Parity private network. I can manually add peers for each node and it works. But the problem is Bootnode executable from geth not working with Parity.

bootnode.exe -nodekey=key.txt -verbosity 9 -addr 127.0.0.1:30308

In parity config.tomal

  bootnodes = ["enode://6d5fe9514018fd79cb4ba13ce1182ebc2e470fc19efd4a06d718c210a82559c88423a4ea841833bb00d1da23bc2b26425c415863b5bd776f8b3eb5dbc81d5bed@127.0.0.1:30308"]

Hit is coming to bootnode but It can't recognize parity nodes.

Output:

TRACE[06-06|20:22:51] << FINDNODE/v4                           addr=127.0.0.1:30307 err="unknown node"
TRACE[06-06|20:22:54] << FINDNODE/v4                           addr=127.0.0.1:30305 err="unknown node"
TRACE[06-06|20:23:00] << FINDNODE/v4                           addr=127.0.0.1:30306 err="unknown node"

I have tried with -v5 also, no success.

What is the problem here?


texts: Compare bytes32 and string using solidity

texts:
I need to compare a bytes32 value with a string. In the below example I need to check if QRVal==QRScanVal.

Eg: bytes32 QRVal="0xc59aa6848d32d073bdcaa041b2735d3e4546d0836498e30de7c4c64c50933a33";

string memory QRScanVal="0xc59aa6848d32d073bdcaa041b2735d3e4546d0836498e30de7c4c64c50933a33";

I'm a newbie with solidity any help would be appreciated.


texts: webpack packing website and upload to ipfs but node_modules not found

texts:
After webpacking the website, I upload the dist folder to ipfs. The ethereum part is working fine, however no js files (except for app.js) and node modules can be found. But as you can see in the pics, they are right there.

When I use "npm run dev" to run the website, everything is working fine.
I'm new to this, can somebody help me T T
I directly use ipfs hash to open the website without any server. Is it the reason cause this situation?

here is my webpack.config.js

const path = require("path");
const webpack = require('webpack');
const CopyWebpackPlugin = require("copy-webpack-plugin");

module.exports = {
  mode: 'development',
  entry: "./src/javascripts/app.js",
  output: {
    filename: "app.js",
    path: path.resolve(__dirname, "dist"),
  },
  plugins: [
    new CopyWebpackPlugin([
      { from: "./src/index.html", to: "index.html" },
      { from: "./src/views/userHomepage.html", to: "userHomepage.html" },
      { from: "./src/views/userInfo.html", to: "userInfo.html" },
      { from: "./src/views/editBlog.html", to: "editBlog.html" },
      { from: "./src/views/newBlog.html", to: "newBlog.html" },
      { from: "./src/views/blog.html", to: "blog.html" },
      { from: "./src/views/tag.html", to: "tag.html" }
    ]),
    new webpack.DefinePlugin({
      ETHEREUM_NODE_URL: JSON.stringify(process.env.ETHEREUM_NODE_URL),
      IPFS_API_HOST: JSON.stringify(process.env.IPFS_API_HOST),
      IPFS_API_PORT: JSON.stringify(process.env.IPFS_API_PORT),
      IPFS_GATEWAY_URL: JSON.stringify(process.env.IPFS_GATEWAY_URL)
    }),
    new webpack.ProvidePlugin({
      $: 'jquery',
      jQuery: 'jquery'
    }),
  ],
  module: {
    rules: [
      {
       test: /\.css$/,
       use: [ 'style-loader', 'css-loader' ]
      },
      { test: /\.(ttf|eot|svg|woff|woff2)$/, use: 'url-loader' }
    ]
  },
  devServer: {
    //contentBase: path.join(__dirname, "dist"), compress: true
    port:8000,
  },
};


texts:
I had created a DAO smart contract where around 20 people vote for proposals. They each make new Tx.

Offline signing is nice to minimize gas cost. Wondering how offline signing works with contract functions, that too with multiple people signing different votes?

I heard that multiple people signs their balance in lighting network channel state.


texts:
I'm not really sure why this web3 method is being called in my code and why it's not a function apparently.

Can anyone help me understand what the issue is here?

  Unhandled Rejection (TypeError): address.replace is not a function

My react code calling my smart contract:

var event = storehash.events.documentAdded()
    await storehash.methods.sendDocument(_ipfsLink, newDate).send({from: _account})
    event.watch(function(error, result) {
            if (!error)
                //this.setState({idForBlockchain: result.args.id})
                console.log(result);
        }
    );


texts:
I am trying multiple avenues to find out why my nodes in a private blockchain are losing connectivity over the course of about 18 hours.

So this question is:

Is there a part of the discovery protocol that prevents nodes from reconnecting for a certain period of time after they lose connection?

And a follow up is if there is a part of the protocol that rotates the connections, or that has a timeout on the length of time that two nodes can stay connected?

I am looking at the Parity and geth codebases for answers, and I did search the yellowpaper for "time" and came up empty.  So it's also worth asking the question here.


texts:
Is it possible to create a smart contract that could initiate functions based on variables set in Google Tag Manager?
For instance, I would like to set up a mechanism in my blog for authors to receive an allocation of coins based on CPM. So, for every 1,000 impressions an article in the blog receives the author is issued with an amount of pre-determined coin as payment.


texts: Passing Web3 & Contracts Between Components - React Redux & MetaMask

texts:
Curious what's the best way to access and pass a web3 contract instance provided by MetaMask between components when using react-redux.

At this point, I'm tempted to do the following for both web3 and the contract:

const mapDispatchToProps = dispatch => ({
    setWeb3: (web3) => {
        dispatch({
            type: 'WEB3',
            value: web3
        })
    },
    setContract: (contractInstance) => {
        dispatch({
            type: 'CONTRACT',
            value: contractInstance
        })
    },
});

With the following initialization in ComponentDidMount

 setInterval(() => {
                web3js.eth.getAccounts((error, accounts) => {
                    if (accounts.length > 0) {
                        this.props.setWeb3(web3js);

                        //Do contract initialization...
                        this.props.setContract(contractInstance);
                 }
                });
            }, 2500);

I know that it's not best practice to be putting non-JSON, non-serializable data into the props.

Suggestions for a best practice? I suppose an alternative would be to create a separate .js file with getter/setters for the instances. Am I overthinking this?

Thanks!


texts:
I am building a DAPP based on drizzle box. I am struggling to find out how can i get the web3 instance without initiating a new one
I want to end up with something like :

this.props.web3.eth

Thanks


texts: I have integrate the getwallet and version 1.6.7 . Now etherscan.io's blocknumber is 4437327 . but my wallet show 4370000 only this blocknumber . it is not increase. still i am waiting for this block count . Please guide me why it is happen? How to solve this problem?


texts: Can I burn tokens held by uniswap/pancake contract?

texts:
I'm trying to implement a function in solidity that burns tokens in liquidity. e.g I add 10k tokens to pancakeswap, after some sales I have 15k tokens in liquidity and I want to burn 5K, so I decided to implement a counter to keep trace of the number of sold tokens and burn them with this snippet.
function burnLiquidity() public onlyOwner returns (bool){
        _burn(_exchangeAddress, _toBurn);
        _toBurn = 0;
    }
function _burn(address account, uint amount) private {
        require(account != address(0), "BEP20: burn from the zero address");
        _totalSupply = _totalSupply .sub(amount);
        _rOwned[account] = _rOwned[account].sub(amount);
        emit Transfer(account, address(0), amount);
    }

The burning goes through but after that it becomes impossible to buy new tokens as the pancake returns K error.


texts:
Should the precompile-addresses (0x1 .. 0xff) be pre-funded with 1 wei? (advisable yes)

What is the purpose of this, what are precompile-addresses?


texts: Accounts are not showing up in Mist 0.8.5 and 0.8.6

texts:
I was Unable to deploy contract on public chain, blockchain syncing was stuck on block 2283415, probably because of DOS attack. I updated my Ethereum-Wallet to latest version 0.8.5 and blockchain sync has crossed 2283415 blockno.
But now, my accounts are not showing up in Wallet. I followed the this ques on stack, but didn't get any help. When I open developers tool of Mist and type web3.eth.accounts , it displays addresses of all my accounts. Also the keystore folder in .ethereum directory hold all accounts.

SO what could be the possible reason? The only possible problem I could think of is currently my Wallet is not in sync, there are still 37,000 blocks left, But If this is a problem, I don't understand why would it not let Mist display my accounts.Is there any issue with latest version of Mist?

Edit:
The console of Ethereum-Wallet shows following error:

failed to load resource: file:///sockjs/info?cb=b9134hztuu

but web3.eth.accounts gives my account addresses.

Edit 2:
I deleted .ethereum folder (after taking solid backup), and then downloaded EthereumWallet 0.8.6, and was asked to enter password for creating an account for first time. Luckily this time I was able to see my this account on Mist, but as soon as I created a new account, again the new account didn't appear, I also imported my previous accounts but none shows up accept the one I created for first time(ethrebase). How can I recover my account, I have real ethers in it.


texts:
I was going through MTP deatils here

Can someone give real scenario example for odd key length?

"When traversing paths in nibbles, we may end up with an odd number of nibbles to traverse, but because all data is stored in bytes format, it is not possible to differentiate between, for instance, the nibble 1, and the nibbles 01 (both must be stored as <01>). To specify odd length, the partial path is prefixed with a flag."


texts:
I read here:
http://solidity.readthedocs.io/en/develop/types.html

that...

  If any of the two is fractional, bit operations are disallowed and exponentiation is disallowed if the exponent is fractional (because that might result in a non-rational number).

Is there a workaround?

I am trying to achieve this:

minerFeeReward += totalSupply**0.5;


texts: Sign Message Using private key instead of kesytore

texts:
I need to sign data using the private key and not keystore file. I can get data using:

var hash = "0x" + ethereumjs.ABI.soliditySHA3(
    ["address", "uint256", "uint256"],
    [web3.eth.defaultAccount, amount, nonce]
  ).toString("hex");

and sign the data using:

web3.personal.sign(hash, web3.eth.defaultAccount, callback);

But I am not sure how can sign this message using private key and without use of unlocking the account.

I am not willing not use personal over RPC calls.


texts:
I am using eth.sign from Ethereum wallet developer terminal and getting following error rejection Error: Returned Error: The method eth_sign does not exist/is not available

Please advise whats the problem. have tried everything (etc. swapping the arguments etc.)


texts: Can a contract hold the leftover gas for later transactions

texts: Is it possible to leave some gas in a contract for future action and / or top up if the contract is stuck. if yes could you please direct me to documentation.


texts: Not able to add peers on geth private testnet

texts:
I have built geth from source code. Everything is fine but, when I am running a different node on same system and try to add a peer to the first one with the admin.addPeer method, the method is returning true but the peercount is 0.

These are the two commands I am using:

build/bin/geth --rpc --rpcaddr "192.168.1.98" --rpcport "8000" --rpccorsdomain "*" --datadir "/opt/EthereumChain1" --port "30303" --maxpeers 2 --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3,solc" --rpcapi "db,eth,net,web3,personal" --networkid 1900 --nat "any" --unlock "0" console init genesis.json

build/bin/geth --rpc --rpcaddr "192.168.1.98" --rpcport "8045" --rpccorsdomain "*" --datadir "/opt/EtherChain2" --port "30302" --maxpeers 2 --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3,solc" --rpcapi "db,eth,net,web3,personal" --networkid 1900 --nat "any" console init genesis.json


texts: Type contract is not implicitly convertible to expected type address

texts:
what is the wrong with this function
i can't get the address of LenderRegistration contract

mapping (address=>address) lendersToContracts;
function lenderRegister(uint256 _rentedStorage) public isNewLender returns (bool) {
    lendersToContracts[msg.sender] = new LenderRegistration(Admin, _rentedStorage, Token, msg.sender);
    lenderIndex++;
    return true;
}

the error after compiling

typeError: Type contract LenderRegistration is not implicitly convertible to expected type address.
        lendersToContracts[msg.sender] = new  LenderRegistration(Admin, _rentedStorage , Token ,msg.sender);


texts: Is there a way to dump Geth metrics in a csv file

texts:
Geth monitor plots metrics exposed by Geth on a terminal but I want to dump Geth metrics (all or some of them) in a file for further programmatical processing.

For example, instead of getting an aggregated output as shown below, I need an timeseries output for each metric.

> debug.metrics(true).eth.db.chaindata.user.reads
{
  AvgRate01Min: 58352658.845165044,
  AvgRate05Min: 42789394.99537952,
  AvgRate15Min: 22764439.80511231,
  MeanRate: 2213178.435842236,
  Overall: 28113856922
}

go-ethereum wiki on github mentions raw metrics value can be retrieved using an optional flag, but the page doesn't mention which flag and how.


texts: transfer function in ERC20 token returning false

texts:
I've created a test ERC20 token like at https://theethereum.wiki/w/index.php/ERC20_Token_Standard. I've sent some test ether to the contract and can verify my account has some of the token, eg with the following command (calling the "balanceOf" function):

contractInstance.balanceOf.call(web3.eth.accounts[0])

returns:

  { [String: '7000000000000000'] s: 1, e: 15, c: [ 70 ] }

After that I want to send some of the token to another account. My transfer function is as follows:

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

(I'm using the SafeMath.sol contract at https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol)

Running the following command to execute the transfer function and send some of the token to my second account:

contractInstance.transfer.call(web3.eth.accounts[1], 0.005)

returns

  false

So the transfer isn't being executed. What might the issue be here?


texts: generate unique mnemonic with password(only)

texts:
I am trying to create an exodus like wallet, where for the first time user just need to enter the password to register on wallet.
The method I thought, running PBKDF2 on the password with empty salt and using that as an entropy for entropyToMnemonic() from bip39, which I found here.
But the problem with this method is when two users will have same password then the mnemonic will be same.
How can I get uniqueness using this method. Something like how metamask manages the wallet.


texts: Protocol for Response to Ethereum Account Hack

texts:
Last week a single Ethereum account in my wallet was hacked. When I send ETH to it, within 2 blocks the hacker-bot uses my private key and sends 0.0009 ETH to another account and then maxes out the gas price to send out the rest. See

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

My other accounts from that seed phrase were untouched. I'm trying to figure out how the hacker got my private key, and have to consider several possibilities: someone logged into my computer, one of my servers where the private key was unencrypted within files, an interaction via MetaMask, etc. Is there a place that outlines the most common ways private keys are stolen, some sort of protocol I can work through?

Note: I discovered that I posted a file on GitHub with the account's address and private key. Anyone reading that could then access the account. Shame on me. At least now I know how someone could have gotten the private key, which is very comforting because not knowing was rather spooky.


texts: Ethereum hd wallets making transactions like bitcoin wallets

texts: I'm working on an exchange where every user has given a unique address, generated via ethereum hd wallets. How can i use a single master private key to transfer available funds from different generated addresses like we do with bitcoin wallets where we can select multiple addresses with different balances in a single transaction?


texts:
I have an error from web3:

Unhandled rejection Error: Given address "0x" is not a valid Ethereum address.

My question is if is there any tool that can fix my address (add checksum).


texts:
I am trying to create a meteor dapp that can sign a piece of data and then recover the address it was signed with. When I run the dapp I get this error in the console:

  Secp256k1 bindings are not compiled. Pure JS implementation will be used

I believe this is causing issues with web3.eth.sign as I cannot recover the address I signed with using ecrecover in either a contract or from ethereumjs-util.

From this answer https://ethereum.stackexchange.com/a/12684 it appears node version 5 or greater is required however meteor only supports node 4.

Is this error a problem or should I ignore it?


texts: Does Chainlink decimal change over time?

texts: I am implementing Chainlink in my contract. Should I request the decimals() function periodically, or decimals are static, so I don't have to worry about any decimals change in a specific contract.


texts: Is it possible that the contract pays to store data coming from an address with no eth?

texts:
So the ideia is like this:

contract MyContract {
    uint mydata;

    function setData1(uint _data) public {
        mydata = _data; //normal way (msg.sender pays to store _data in mydata (msg.sender needs to have eth))
    }

    function setData2(uint _data) public {
        //...
        //here i want that MyContract address ("address(this)") pay and store _data in mydata
        //...
    }

    function setData3(uint _data) public {
        mydata = _data;
        //here i want that MyContract pay the transaction from msg.sender
        //...
    }
}

I know that setData3() is possible with gas stations, meta transactions and other approach but these approaches is other addresses to pay for transaction.

I want that Contract pay the fee. Is it possible?

In setData2() is it possible for the contract to save the variable and pay for it in some way?

In this scenario, I do not need to save the transaction, just to save the variable in some way.


texts: How to deploy smart contract using Remix 0.8.0 and MetaMask?

texts: How do I deploy a contract on a test network using Remix 0.8.0 and MetaMask on a Firefox or Chrome browser?


texts: Ethereum Difficulty History? Percentages not a chart

texts:
Is there any website that shows the Ethereum difficulty with percentage increase instead of just a chart ?

I'm looking for something similar to https://bitcoinwisdom.com/bitcoin/difficulty : in the middle of the page there it has a Difficulty History with date/hashrate/change etc...


texts: If i read a struct(storage) Human storage human = humans[2]; in my modifier is there a possibility that the function that uses this modifier can use the "human"? Otherwise i have to scope the storage again in my function.


texts:
I am a noob.. I am trying to set gasPrice and gasLimit since I am getting a gas estimation error.
I just don't understand where/how to insert it into the transaction.  This is on the BSC network.
Error message:
ERROR:
reason: 'cannot estimate gas; transaction may fail or may require manual gas limit',
    code: 'UNPREDICTABLE_GAS_LIMIT',
    error: Error: gas required exceeds allowance (3807079) or always failing transaction

  const tx = await router.swapExactTokensForTokens(
    amountIn,
    amountOutMin,
    [tokenIn, tokenOut],
    addresses.recipient,
    Date.now() + 1000 * 60 * 3 //3 minutes
  );
  const receipt = await tx.wait();
  console.log('Transaction receipt');
  console.log(receipt);


texts: Why is Access-Control-Allow-Origin not in the response headers?

texts:
I tested with Advanced REST client (chrome extension) and ncat, but no Access-Control-Allow-Origin is present.
I launched first with the command line with various syntaxes and parameters for --rpccorsdomain.
Then I tried within the ipc console things like admin.startRPC("0.0.0.0",  8545, "*") (or other domains).

Anyway, this is my test request :

POST / HTTP/1.1

HOST: rpc.wesen.fr:8545
content-type: application/json
accept-encoding: gzip
content-length: 58

{"jsonrpc":"2.0","method":"eth_mining","params":[],"id":1}

And the response headers :

Content-Type: application/json
Vary: Origin
Date: Sat, 10 Dec 2016 22:23:52 GMT
Content-Length: 39

with the data :

{"jsonrpc":"2.0","id":1,"result":true}

which is correct.

This is my configuration :
(linux is arch)

Geth
Version: 1.5.4-stable
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.7.3
OS: linux
GOPATH=
GOROOT=/usr/lib/go


texts: Where can I find compiler info to verify & publish an ERC-20 token on Etherscan when I didn't write the code?

texts:
I'm a developer working for a small startup with a standard ERC-20 token that we'd like to verify on Etherscan, but I wasn't the person who minted the tokens initially (that developer no longer works for the company).

I'm not familiar with Solidity, and am not sure how to find the information we need to verify and publish according to Etherscan's requirements.

How do I figure out what compiler type and compiler version were used to mint the tokens?

Thanks!


texts: How does the EVM connect to all the blockchain nodes?

texts:
Someone recently told me that Ethereum does not use IP addresses to work out the node connections. I know networkid is used in the connection but how does networkid translate into the EVM finding the relevant nodes?

I assume there must be a broadcast mode for a node and TCP/IP is used somehow to sent messages. But if IP addresses are not used, how does the EVM workout the relevant nodes?


texts: What would be the steps required to entirely derive an address with pen and paper?

texts:
I'd like to see the steps required to derive an address by hand, with pen and paper, along with an estimate of time required.

Is it feasible to derive an address entirely with pen and paper?

What are the steps required to derive an account?

Approximately (order of magnitude) how long would it take to perform each step?

Related questions:

How to generate paper wallet on myetherwallet.com?

How is an Ether paper wallet created?

Is there a way to generate ethereum paper wallets?

Offline Wallet Generation


texts: Ganache Processing becomes very slow (with Automining Option) after consecutive thousands transactions

texts: I am trying to deploy thousands of contracts on Ganache GUI. At first, it process all transactions very fast (deploy contracts and transactions for calling setters functions) . After some transactions, may 500/1000 or more, it become so slow and process a single transaction in 5-8 seconds or sometime even more . Is it normal ? It is because of calculating difficulty level , automatically ?....


texts:
Is there an exploit in the following contract?
https://etherscan.io/address/0x4876bca6feab4243e4370bddc92f5a8364de9df9
https://www.etherchain.org/account/4876bca6feab4243e4370bddc92f5a8364de9df9

It is verified on two different sites so I would assume that they are not compromised. However, the contract is drained from another contract which seems to control it :
https://etherscan.io/address/0x22a19f091a4ea624ecf17d77c9de8e0c6fad82c1#internaltx
There is no code in the source that show such capabilities. So is the code wrong or something else ? There are multiple trap like that on the chain.


texts:
This question will be very similar to this one, but I'm stuck and don't know what to do:

Token contract source code not verified

Anyways, my friend sent me 2 pieces of code, the actual contract code, which can be found here:

https://remix.ethereum.org/#optimize=true&version=soljson-v0.4.25+commit.59dbf8f1.js

And the interface:

https://github.com/ConsenSys/Tokens/blob/master/contracts/eip20/EIP20Interface.sol

Now I'm a coder and I understand that pasting just the first part of the code obviously wont work, so I deleted the import part and pasted in the interface. Then I ran the solidity-flattener over the code, and this is the output:

https://pastebin.com/xvtT3e1Z

However, the code isnt being verified on https://etherscan.io/verifyContract2
I get the following error:

What should I do, what am I doing wrong? The contract address is 0x3C403c5371113a7d3f91d4b9C9A88333Ca567e74, the compiler 0.4.21+commit.dfe3193c and contract name Victory.

Thank you for your help.


texts: When an ERC-20 token is converted into its own mainnet coin/blockchain, why is it still called a "token"?

texts:
ETH, Cardano and Stellar Lumens are not referred to as tokens because they have their own blockchains. They are called coins.
ERC-20 tokens are called tokens because they reside on the Ethereum blockchain.
If an ERC-20 token, like Theta (THETA) launched in 2018, is converted from an ERC-20 token to its own blockchain, is it valid to still call it a token? or should it be called a coin like ETH, Cardano and Stellar Lumens are called coins? Theta is just one example of a token that did just this, yet people still call it a "token".


texts: Retrieve block number from geth and display it on my webpage

texts:
I am running geth using this command:

geth -testnet --syncmode light console

and I am trying to retrieve the block number from geth and display it on my web app. In geth when I type:

eth.blockNumber

I get the block number to display. How can I get my web app to show the block number when the page loads?

I thought it would be something like this but its not working:

   web3.eth.getBlockNumber(function(err, num)
      { if (err === null)  {
           console.log(num);
      }});


texts: How to change Ethereum default directory

texts:
Im trying to run geth attach on my console , i have already started a node , this is the script that i used :

    #!/bin/bash

geth --identity "miner1" --networkid 42 --datadir "~/Desktop/Tutorials/ChainSkills/miner1" --nodiscover --mine --rpc --rpcport "8042" --port "30303" --unlock 0 --password ~/Desktop/Tutorials/ChainSkills/miner1/password.sec --ipcpath "~/Library/Ethereum/geth.ipc" --allow-insecure-unlock

And this is the log that i get :

Now when i run geth attach
i get this error :

  Fatal: Unable to attach to remote geth: dial unix
  /home/louay/.ethereum/geth.ipc: connect: no such file or directory

I think that i should change the Ethereum default location because geth.ipc is in other directory not the one mentioned above.


texts:
The compiler for solidity supports the flag --optimize which performs some set of optimizations to the compiled solidity code, typically resulting in a reduction of gas costs.

How does the optimizer work and what are some examples of the optimizations will it make?


texts:
I have define update status event in my contract which basically print vote casted whenever transaction happen , however I am unable to see my event getting fired neither in my console or in testrpc console. Only thing I am getting is transaction id and timestamp. What's wrong I am doing here?

pragma solidity ^0.4.11;

contract Voting {

mapping (bytes32 => uint8) public votesReceived;

address sender;

bytes32[] public candidateList;
event Updatestatus (string _msg,address sender);
function Voting(bytes32[] candidateNames) {
candidateList = candidateNames;
}

function totalVotesFor(bytes32 candidate) returns (uint8) {
   if (validCandidate(candidate) == false) throw;
return votesReceived[candidate];
}

function voteForCandidate(bytes32 candidate) payable {
   if (validCandidate(candidate) == false)
   throw;
   else{
   Updatestatus("First vote casted by",msg.sender);
   votesReceived[candidate] += 1;

 }
 }

   function validCandidate(bytes32 candidate) returns (bool) {
     for(uint i = 0; i < candidateList.length; i++) {
   if (candidateList[i] == candidate) {
    return true;
    }
   }
   return false;
   }
    }


texts: Suppose you wanted to create a token representing an index fund for various cryptocurrencies and you made sure that you held enough cryptocurrency reserves for each currency represented in the fund. Would it be possible to adjust the circulation of the token or use some other programmatic means to keep the cost of the token pegged to the index?


texts:
I want to hash a given array  of address (using keccak256) into a single variable byte32.

for example:

function hashOfArray( address [] list) public constant returns (byte32) {
      var hash = ...
     return hash;
}


texts:
I'm running Ganache with a fork of mainnet with Remix - when I try and debug a transaction by clicking on the 'debug' button after sending a transaction, it sends me to the debug screen. When I then skip around using the slider, the debug screen completely goes blank.
Am I doing something wrong here? This always happens so I can't actually debug properly.

EDIT: Chrome Dev tools shows the following errors when this happens:


texts:
I'm trying to recreate this site TenThousandSu
 And this is the smart contract I'm trying to call https://rinkeby.etherscan.io/address/0x7e338acfb7a5d7e99f4225cc12dc884f49c00f6a#code
 I'm using "1.0.0-beta.35" version of web3js.

I'm having difficulties connecting to a users wallet and executing a smart contract on their wallet. If you go to tenthousandsu.com and click the Buy button you'll first get a prompt asking you if the smart contract can connect to your wallet. After you accept that, it asks you if you want to let the smart contract execute a transacation. To clarify look at the below pictures.

 I'm neither sure how to make picture 1 or picture 2 happen. I have never been able to do that from my program. I'm just trying to call the function purchase(uint256 _nftId) on line 721 in the smart contract I've made on rinkeby. The code below is what I've tried.

contract.methods.purchase(squareNumber);

The code above in my mind should execute what is displayed on the 2nd picture. But I would prefer if I could do something like this

contract.methods.purchase(squareNumber, (err, res) => {
          console.log([err, res]);
          if (!err) {
            // HANDLE SUCCESS
          } else {
            alert(err);
          }
        });

And for the 1st picture I'm not even sure what to do. I'm not sure how to prompt the user to accept a "Connect Request".


texts: get bytecode in smartcontract ? possible?

texts:
is it possbile to get bytecode   of already deployed contract    on another contract?

example : get bytecode of contract A  using contract B  (using solidity )


texts:
I got this particular Parser error and can you help me how to fix this issue:while using this code

pragma solidity ^0.4.17;

import "../node_modules/zeppelin-solidity/contracts/token/ERC20/StandardToken.sol";

contract MyToken is StandardToken {
string public name = "MyTok";
string public symbol = "MTK";
uint8 public decimals = 2;
uint public INITIAL_SUPPLY = 5000;

function MyToken () public {
    totalSupply__ = INITIAL_SUPPLY;
    balances[msg.sender]= INITIAL_SUPPLY;
    emit Transfer(0x0,msg.sender,totalSupply_);

    }
}

In the line
emit Transfer(0x0,msg.sender,totalSupply_);

localhost/mytoken/contracts/mytoken.sol:14:18: ParserError: Expected token Semicolon got 'LParen'
Thanks


texts: What is the most efficient way to parse a string of integers to an array?

texts:
I perform an Oraclize query on an XML file, and receive this string in return:

["31", "25", "24"]

What would be the most efficient way to parse through this string and store the numbers into a uint8 array using the minimum amount of gas?

Or is there a better way to go about this problem?

If so, please include examples.

Note:

I'm not looking to process millions of numbers this way, just around 100 or so.


texts: Function to mint ERC-token with every nth-number of like

texts:
I need help with a function to reward user with erc777-token as soon as his content (Ipfs-Hash, see the program below) hit n-number of likes (lets say every 100th like), i.e., whenever the 'netLike' counter hits 100, it automatically mints one token to the respective user's address.
And because there's a dislike function as well, the user should not be rewarded the token every time the likeCounter hits 100, (for example - if a user hits 100th like for the first time, its rewarded with one erc token, and once it hits that milestone, in order to earn 2nd token, it must hit the milestone of 200 likes, and likewise every multiple of 100 can only generate one token 'one-time')
I've added nonce for this purpose, but couldn't really figure out the exact logic!! (brainfog )
The logic and the _mint() fn is inside the like function.
Thanks!!
     Content[] public contents;

    // A mapping of Content Hashes to their respective Owners
    mapping(bytes32 => address) public contentHashToAuthor;

    //Contains all the indices of content uploaded by the author
    mapping(address => uint256[]) public authorToContentIndices;

    //A mapping of contentHash to contentIndex
    mapping(bytes32 => uint256) contentIndex;

    //the struct that contains the content-Info
    struct Content{
        bytes32 hash;
        string[] tags;
        address author;
        uint256 likes;
        uint256 dislikes;
        int256 netLikes;
        uint256 nonce;
        uint64 timeStamp;
    }

function addContent(bytes32[] memory _hash, string[][] memory _tags) public {

    for(uint256 i = 0; i < _hash.length; i++ ){

        if(contentHashToAuthor[_hash[i]] == 0) {

            Content memory _content = new Content({
                hash: _hash[i],
                tags: _tags[i][],
                author: msg.sender
                like: 0,
                dislikes: 0,
                netLikes: 0,
                nonce: 0,
                mapping(address => bool) usersLiked;
                mapping(address => bool) usersDisliked;
                timeStamp: uint64(now)
            });

            uint256 contentIndex = contents.push(_content) - 1;
            authorToContentIndices[msg.sender].push(contentIndex);
            contentHashToAuthor[_hash[i]] = msg.sender;
            contentIndices[_hash[i]] = contentIndex;

        } else {
            revert("Content already Exist!")
        }

    }

}

function like(bytes32 _hash) public {
            uint256 cId = contentIndex[_hash];
            Content storage c = contents[cId];
            if(c.usersLiked[msg.sender] != true){
                c.usersLiked[msg.sender] = true;
                if(c.usersDisliked[msg.sender] == true){
                    c.usersDisliked[msg.sender] == false;
                    c.dislikes--;
                }
                c.likes++;
                c.netLikes++;
                //logic for rewarding ERC777 for every 100th netLike.
                //todo
                if(c.netLikes == 100){
                      //mint function to hit with every 100th netLike
                     _mint(c.author, 1, "", "");
                }

            } else {
                revert("Already liked!")
            }

    }

  function dislike(bytes32 _hash) public {
            uint256 cId = contentIndex[_hash];
            Content storage c = contents[cId];
            if(c.usersDisliked[msg.sender] != true){
                c.usersDisliked[msg.sender] = true;
                if(c.usersLiked == true){
                    c.usersLiked == false;
                    c.likes--;
                    c.netLikes--;
                }
                c.dislikes++;
                c.netLikes--;
            } else {
                revert("Already disliked!")
            }

    }


texts: Getting the address returned as undefined

texts:
I am trying to run the unit test below and getting the following error:

  AssertionError [ERR_ASSERTION]: '0x4ede706B3Fa847c1355D88a64b5F5DB8F6Bd9b6a' == undefined

Here is my unit test:

it('rights given to account', async () => {
    await fantasy.methods.giveRightToVote({ from: accounts[0], to: accounts[1] })

    const getRights = await fantasy.methods.getRightsToVote().call({ from : accounts[0] });

    assert.equal(accounts[1], getRights[0]);
    assert.equal(1, getRights.length);

Here is my actual smart contract:

pragma solidity ^0.4.17;

contract FantasyLeague {
    // Define address of commissioner
    address public commissioner;
    // Hold votes
    uint[] public proposals;
    // Hold addresses of league members
    address[] public members;
    // Hold addresses of those given votings rights to compare to those who have voted
    address[] public rightsGiven;

    // Deploy contract
    constructor() public payable {
        commissioner = msg.sender;
    }

    function giveRightToVote(address voter) public {
        require(msg.sender == commissioner);
        // Ensures that the right to vote given matches the actual voted addresses
        rightsGiven.push(voter);
    }

    // Propose new team number
    function vote (uint number) public payable {
        // Require ether to reduce fraud
        require(msg.value > .01 ether);
        proposals.push(number);
        members.push(msg.sender);
    }

    // Retrieve List of current proposals
    function getVotes () public view returns (uint[]) {
        return proposals;
    }

    // Retrieve memebrs that have been given right to vote
    function getRightsToVote () public view returns (address[]) {
        return rightsGiven;
    }

    // This function will track the address for every vote cast.
    //If there are two votes from the same address or a vote from an address not given a right to vote, you know it is invalid
    function getMembers () public view returns (address[]) {
        return members;
    }
}


texts: Why do arrays declared within functions reference storage point 0 by default?

texts:
According to the Solidity Documentation, for the following code,

  ". . . the compiler interprets x as a storage pointer and will make it point to the storage slot 0 by default. This has the effect that someVariable (which resides at storage slot 0) is modified by x.push(2)".

/// THIS CONTRACT CONTAINS AN ERROR
pragma solidity ^0.4.0;

contract C {
    uint someVariable;
    uint[] data;

    function f() public {
        uint[] x;
        x.push(2);
        data = x;
    }
}

In another post, user smarx pointed out that:

  "When you declare a storage variable, it's essentially a reference to some location in storage. Until you assign it to something,
  it points to location 0, which also happens to be the location of the first declared state variable (in this case a). You're basically
  using an uninitialized pointer".

What confuses me, however, is that if "uint [] x" points to 0, where "someVariable" resides, wouldn't "uint[] data" do the same?  Aren't both of these arrays uninitialized?  If "data" occupies slot 1, wouldn't "x" just occupy slot 2?

My guess is that when it is within a function, it starts from 0 again, assuming that everything will be saved to memory, but then I would expect an array declared within a function to reference memory by default.


texts: Is it possible to specify gas cost for a particular function call? E.g. Let's say I want a transfer() function to cost 50000000 gas, would I be able to hardcode this into the function?


texts:
As we know each block contains a state-root. Following image is taken from
https://blog.ethereum.org/2015/11/15/merkling-in-ethereum/.

Ethereum Wiki:

  Constant light client reference: light clients can at any point access
  all data related to an account by scanning down the state tree in a
  specific direction.

I am confused related to storage of the state-tree and its access. As I understand: there is only one state, transaction and receipt tree. Since there is one, the tree should be somehow updated at each epoch.

As I understand global state-tree is updated on each block and all clients have access to a single state-tree where latest key/value information is stored.

[Q1] If the state-trie is updated how can we know each accounts balances on previous blocks? What is the algorithm that updates the state-trie at each block.

On this Q's answer, it confirms that I can retrieve any account's balance based on any given block number. web3.eth.getBalance(address, 100).

[q2] If there is no transaction occur at a block how its state-root is updated on the next block? As I understand state-root is dependent on the key/value that is stores. If there is no update any of them, how state-root is able to change?

Thank you for your valuable time and help.


texts:
We are building a POC with P2P interaction. It’s a prototype were 2 parties agree to exchange assets and the settlement is done.

For above POC is it good to use global agreement contract or have individual deal level contracts.


texts: What is the relationship between Mist and Ethereum Wallet?

texts:
In https://github.com/ethereum/mist/releases 0.3.6 the files are named Mist.  Starting in 0.3.7 the files are named Ethereum-Wallet.

Will files named Mist take over in the future, or will there be 2 separate files Mist and Ethereum-Wallet?


texts: how to watch the eth address with infura

texts:
our project now uses scheduled task to query the eth address with infura API to get its balance every 10 seconds but as the number of addresses keep increasing, the efficiency is very bad.

Is there any way to subscribe to the address so we will get notified whenever there is any change in the balance. Or do we have to set up our own node?


texts: is Test-net in Mist a private chian ? or public?

texts:
just run some contract on MIST , and link to Test-net.
but cannot find my account's any transaction on https://testnet.etherscan.io/

why ? so Test-net is only local testing chain ?
MAIN ACCOUNT(0x5BA6F88841CDe3dF0522de852d7292938Cc1854F) done many transactions~ still cannot find record...

tanks
HIPPO


texts:
Why call.value()() is used in smart contracts instead of send?
Can someone help me to understand importance of call.value()()?


texts:
I would like to deploy a contract using truffle.

My account has 0.02 ether (20000000000000000 wei). I set gas: 4612390 in the truffle.js and don't set anything for gasPrice. eth.gasPrice returns 1000000000 wei. If I multiply the gasPrice with gas I get 4,612,390,000,000,000 which is lower than my 20,000,000,000,000,000. But I got the error insufficient funds for gas * price + value. If I set the gas price to low I got intrinsic gas too low.

Is there a way to find out how much gas do need to deploy my contract? What is the difference between gas and gasPrice?


texts: ERC20 transfer showing as 0 but log shows different

texts:
Checking the transaction https://www.etherchain.org/tx/e12af4940879c634a63d2c9629449695e07650a4e419e5822ddb18d8469e9948 anyone can check there were 3 DigixGold token transfers.

These transfers are valued as 0 in etherchain as well as in amberdata.io: https://amberdata.io/transactions/0xe12af4940879c634a63d2c9629449695e07650a4e419e5822ddb18d8469e9948. In etherscan these transfers aren't even shown: https://etherscan.io/tx/0xe12af4940879c634a63d2c9629449695e07650a4e419e5822ddb18d8469e9948

If we check one of the log entries for this transaction we can spot this log entry related with the transfer function of the ERC20 token contract, and this transfer has a value different from 0 pictured in the last log's topic - source etherchain:

{
    "logindex": 0,
    "address": "0x55b9a11c2e8351b4ffc7b11561148bfac9977855",
    "data": "0x",
    "topics": [
      "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
      "0x000000000000000000000000c5ec6937d3278311e2ace517df214717310c0820",
      "0x0000000000000000000000005d2c24efac49825f682b5d334428f1a5c96acc09",
      "0x0000000000000000000000000000000000000000000000000000000000043c36"
    ]
  }

Considering this log entry is related with one of the transfers and its not 0 valued, why in these browsers they are shown as 0 valued transfers? Is there any piece of information that should be missing in order to read and figure out about these transfers?


texts:
I am running geth with this command : geth --syncmode "fast" --cache 2048 --rpc --datadir /media/username/2TB_HDD and then in new terminal I typed : geth attach ipc://media/username/2TB_HDD/geth.ipc command. After that when I typed eth.isSyncing then i am getting this :
 > eth.isSyncing
   function(callback)

Why I am not getting the blocks data like before like currentBlock, highest block?


texts: Can anybody here help me in understanding how transactions and block is getting verified

texts: Please help me in understanding how transactions are getting verified and also how blocks are getting verified before appending it to the canonical chain.


texts: Can I download the old Olympic testnet blockchain?

texts: A client of me would like to download the old Olympic blockchain for any unknown reason. Does anyone know any source where it could be downloaded from?


texts: Get struct from mapping that include another mapping

texts:
I have an already deployed contract with a mapping that looks this way:
struct Details {
   address a;
   address b;
}

struct Params {
   uint a;
   uint b;
   //.....
   uint n;
   mapping(address => Details) details;
}

mapping(uint => Params) public parameters;

I need to access parameters mapping from another contract. I don't need to return details on mapping in struct, but only Params's a-b variables.
Is it possible to retrieve it?


texts: Read info from block chain from within a contract

texts:
Is it possible to read the block chain from within a contract? Specifically, I want to know if I can see how much ether user A has spent during the last 50 or so blocks.

I didn't find anything in the documentation that could read something from previous mined blocks, so I suppose I'd need something like Oraclize to do this.


texts: Are there any tools that provide security reviews of Solidity code?

texts: Do we have any standardized security scanning tool to go for security code review for solidity language? If not, what all opensource tools are there on which we can relay? Need response urgently.


texts:
How can I enable automine feature of parity? Do I NEED to attach an extra miner?

I want to deploy/test my contracts with truffle (ganache is creating problems :/)


texts: What is this allowance check in ERC20 transferFrom implementation

texts:
There is something i do not understand in this file: https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol
function transferFrom(address from, address to, uint value) external returns (bool) {
    if (allowance[from][msg.sender] != uint(-1)) {
        allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
    }
    _transfer(from, to, value);
    return true;
}

What is the goal of the first condition:
if (allowance[from][msg.sender] != uint(-1))

I did not see this condition in other ERC20 implementations and i want to understand
Thanks a lot


texts: how to change approveAndCall() function for upgraded compiler version of solidity 0.5.1 from 0.4.6?

texts:
Here is the code snipped which is used when I'am working with compiler version 0.4.6 :

function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public returns (bool success) {
        allowed[msg.sender][_spender] = _value;
        emit Approval(msg.sender, _spender, _value);
        if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) {
            throw;
        }
        return true;
    }

Now I'm compiling this code with version 0.5.1, what should I do?
I've already referred Read the Docs content : v0.5.0 Breaking Changes, but really I didn't understand it.


texts: Quorum privateFor not working with truffle-hd-wallet-provider

texts:
I'm trying to deploy a contract private to one node in the Quourm 7-nodes example. The migrate works as expected when deployed normally with truffle, but ignores the privateFor part and deploys a public contract when used with truffle-hdwallet-provider. Are there any changes I can make to make the HDWalletProvider work?

2_deploy_contract.js

var SimpleStorage = artifacts.require("SimpleStorage");
module.exports = function (deployer) {
    // Pass 42 to the contract as the first constructor parameter
    deployer.deploy(SimpleStorage, 42, { privateFor: ['ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc='] })
};

truffle.js

Works:

development: {
  host: "127.0.0.1",
  port: 22000,
  network_id: "*",
  gasPrice: 0,
  gas: 4500000
}

Fails (Deploys a public contract instead of a private one):

quorum: {
  provider: () => new HDWalletProvider(mnemonic, 'http://localhost:22000'),
  network_id: "*",
  gas: 4500000,
  gasPrice: 0
}

The consensus I am using is IBFT, if that is useful.


texts: How to copy/assign an array via for loop

texts:
Here is the following code:

pragma solidity ^0.4.11;
contract TestArray {
    uint[] public newOriginal;

    function TestArray(){
    }

    function copy(){
        for(uint i = 1; i<5; i++){
            newOriginal[i]=2;
        }
    }

}

Why it doesn't work? I was basically tried to copy one array to another and discovered that I can't even assign it via loop.


texts: How cheap will ethereum gas fees become after eth2? I am asking for the technical explanation that would help understand how the fees will go down and to what level they might reach.


texts:
I need a blocksci parser for ethereum.
I am using https://github.com/citp/BlockSci for bitcoin .
Is any similar blocksci parsing tool for ethereum?.


texts: Why I can't deploy a smart contract to a specific public key if i just generated and own this publickey/private key?

texts:
I am writing an explorative article about the actors/assets model for Ethereum 2.0 (https://ethresear.ch/t/ethereum-2-0-data-model-actors-and-assets/4117).

Are there some reasons why is it not possible to deploy a smart contract to a specific public key if i've just generated and own this public key/private key?

Could we add this feature without breaking all the current Ethereum spec?


texts: During which blocks did the DDos attack create millions of empty accounts?

texts:
This post (Why were empty accounts allowed to be on the blockchain?) discusses the Ddos attack from fall 2016. It mentions that nearly 20,000,000 account were created and then immediately deleted causing a huge bloat in the state trie. Does anyone know during which blocks those Ddos attacks were created?

If one were to ever try to create an index of accounts, that index would become unnecassarily bogged down. If one knew during which blocks they were created, one could simply skip these accounts given that they would be deleted soon thereafter by the hard fork.


texts:
I am a newbie at Ethereum, could you clarify one question.

Is it possible to see all variables within Storage of the Contract? If I don't know how many variables it has and want to see the list of all variables.

As I understood, getStorageAt(adr, pos) function requires the exact position (and the number of variables so that).

Thank a lot!


texts:
Is there any way to store the values like we store in Python using a dictionary?
for eg: there are 5 states and a single address. I want to store these states as

my_pair = {'state_one id': 'address ','state_two id': 'address'}

Note: Address remains the same only the state_id is changing.


texts:
Suppose that I've the following contract code:

pragma solidity ^0.4.23;

contract pensCollection{

    struct Pen{
        uint productCode;
        address ownerAddress;
    }

    address public owner;

    // history of a pen.
    mapping(uint => address[]) public __history;

    // One account can hold many pens.
    mapping(address => Pen[]) public __inventary;

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

    function addPen(uint _productCode, address _ownerAddress) public returns (address) {

        Pen memory _pen = Pen({
            productCode : _productCode,
            ownerAddress : _ownerAddress
            });
        __inventary[_ownerAddress].push(_pen);

        // Add history entry for this new pen.
        __history[_productCode].push(_ownerAddress);

        return msg.sender;
    }

    function exchangePen(address _buyer, uint _productCode) public returns (bool) {

       // Search for pen in the inventary.
        for (uint i = 0; i < (__inventary[msg.sender].length); i++) {

            // If I find it then change its owner address.
            if (__inventary[msg.sender][i].productCode == _productCode) {

                Pen memory _pen = Pen(
                    {
                    productCode : _productCode,
                    ownerAddress : _buyer
                    });
                __inventary[_buyer].push(_pen);
                __history[_productCode].push(_buyer);

                delete __inventary[msg.sender][i];
                return true;
            }
        }

        return false;
    }

    function getHistoryForPen(uint _productCode) public view returns (address[]) {
        return __history[_productCode];
    }
}

This contract should allow users to register a series of pens into a smart contract. There is a mapping where for each owner address I've an array of Pen where Pen is a struct. I can add pen to the collection (__inventary variable) by using the method addPen(...). Also I can exchange pens with the function exchangePen(...) where the given pen is trasferred to the buyer address and removed from the old owner.
There is also an array, called __history, where all the movments (sellings/buyings) are registered and the user can get this array by calling the appropriate method.
When I compile this code with remix online I get the warning of the gas usage, because if I'm correct, storing data in the contract state is a bad practise that cost a lot of gas and that can cause runtime exception of running out of gas.

One of my question is: How can I cause this exception? How many pen should I insert before get gasLimit exception?

The other question is: Should I deploy a contract that represent only one pen with the method for trasfering and for history?
I mean is the following contract better then the previuos one?

pragma solidity ^0.4.23;

contract PenContract{

    struct Pen{
        uint productCode;
        address ownerAddress;
    }

    address public owner;
    Pen public _pen;

    // history of a pen.
    address[] public __history;

    constructor (uint _productCode, address _ownerAddress) public{
        owner = msg.sender;
        _pen.productCode = _productCode;
        _pen.ownerAddress = _ownerAddress;

        // Add history entry for this new pen.
        __history.push(_ownerAddress);
    }

    function exchangePen(address _buyer) public returns (bool) {
        _pen.ownerAddress = _buyer;
        __history.push(_buyer);
        return true;
    }

    function getHistoryForPen() public view returns (address[]) {
        return __history;
    }
}

In other words, given the fact that deploying a smart contract cost 32k gas (here) is it better to have one contract that manage all the pens and that let you add others (possibily causing the problem of the gas limit) or it is better to deploy one contract for each pen (can also this cause the problem?) ?

Thanks in advance.


texts: How to receive revert() reason for past transactions?

texts:
I run a geth/parity nodes for broadcasting user's transactions to Ethereum blockchain. Some of contract functions provide reasons for revert (see examble below):

contract Example {
  function test (uint i) {
    require(i == 1, "ERROR_CODE")
  }
}

As I understand it is not possible to get revert reason string with eth_getTransactionReceipt. However I still need to get revert reason for failed transactions.

How to get revert reason ("ERROR_CODE" in example above) for past failed transactions? (at least for transactions in last 20 blocks)


texts: Bad block, gas used error, Synchronisation failed

texts:
I'm new to ETH. Just downloaded Mist 0.8.6 + Geth 1.4.18 and started geth.exe with these parameters:

geth --datadir C:\TMP\data --fast --cache=1024 --jitvm --jitcache 128

In Mist I saw a sync to 100%, but then it went back to 0% (and 1142 blocks remaining) and geth started to download some states.

But now it seems to be stuck in a loop:

  E1024 16:21:03.943468 core/blockchain.go:1170] Bad block #2498274 (0x1601642df91
  4cf016b79b25baee120af9b0163ed62333eee4879439227c91e18)
  E1024 16:21:03.943468 core/blockchain.go:1171]     gas used error (469362 / 4659
  62)
  I1024 16:21:19.055332 eth/downloader/downloader.go:298] Synchronisation failed:
  block download canceled (requested)
  E1024 16:21:26.178740 core/blockchain.go:1170] Bad block #2498274 (0x1601642df91
  4cf016b79b25baee120af9b0163ed62333eee4879439227c91e18)
  E1024 16:21:26.178740 core/blockchain.go:1171]     gas used error (469362 / 4659
  62)

Restarting doesn't help.
The data dir has a size of 11.1GB.

What can I do now?
Thank you!


texts:
The DAO token holders that split away from the main The DAO into a child DAO will have moved the tokens (DAO) and the corresponding ethers (ETH) into the child DAO.

As these DAO token holders have a zero DAO balance in The DAO, the Withdrawal contract cannot be used to convert the DAOs into ETHs.

How do I get a refund for my The DAO tokens that was split into a child DAO?

The DAO Refunds

How do I convert my The DAO tokens into ethers using the withdrawal contract after the hard fork?
How do I get a refund for the amount I paid in excess of 1 ether to 100 The DAO tokens
[THIS] How do I get a refund for my The DAO tokens that was split into a child DAO?
How do I convert my The DAO tokens into ethers on the Ethereum Classic chain?
How to conditionally send ethers to another account post-hard-fork to protect yourself from replay attacks

See also:

Which accounts contributed to The DAO's extraBalance account?
How many ethers have been drained through the recursive call attacks on The DAO?


texts: Parity node0: generate_seal: FAIL: Accounts secret key unavailable

texts:
I've followed the PoA tutorial and the two nodes seem to be communicating but node0 keeps on logging this error message:

2018-04-06 17:22:10  generate_seal: FAIL: Accounts secret key unavailable.
2018-04-06 17:22:15  Imported #11 7a07…ab31 (0 txs, 0.00 Mgas, 0.53 ms, 0.56 KiB)
2018-04-06 17:22:20  generate_seal: FAIL: Accounts secret key unavailable.
2018-04-06 17:22:30  generate_seal: FAIL: Accounts secret key unavailable.
2018-04-06 17:22:39     1/25 peers     16 KiB chain   12 KiB db  0 bytes queue   10 KiB sync  RPC:  1 conn,  2 req/s, 113 µs

node1 isn't logging it.

2018-04-06 17:22:15  Imported #11 7a07…ab31 (0 txs, 0.00 Mgas, 0.90 ms, 0.56 KiB)
2018-04-06 17:22:16     1/25 peers     12 KiB chain   12 KiB db  0 bytes queue   10 KiB sync  RPC:  1 conn,  2 req/s, 142 µs

What could it be?

The config is like in the demo.

node0.toml:

[parity]
chain = "parity-poa.json"
base_path = "/tmp/parity0"
auto_update = "none"
[network]
port = 30303
[rpc]
port = 8545
cors = ["http://localhost/", "https://remix.ethereum.org/"]
apis = ["web3", "eth", "net", "personal", "parity", "parity_set", "traces", "rpc", "parity_accounts"]
[ui]
port = 8180
[websockets]
port = 8645
[account]
password = ["node.pwds"]
[mining]
engine_signer = "0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e"
reseal_on_txs = "none"

node1.toml:

[parity]
chain = "parity-poa.json"
base_path = "/tmp/parity1"
auto_update = "none"
[network]
port = 30304
[rpc]
port = 8546
cors = ["http://localhost/", "https://remix.ethereum.org/"]
apis = ["web3", "eth", "net", "personal", "parity", "parity_set", "traces", "rpc", "parity_accounts"]
[ui]
port = 8181
[websockets]
port = 8646
[ipc]
disable = true
[account]
password = ["node.pwds"]
[mining]
engine_signer = "0x00Aa39d30F0D20FF03a22cCfc30B7EfbFca597C2"
reseal_on_txs = "none"

node.pwds:

node0
node1

Running Parity/v1.9.5/x86_64-windows-msvc/rustc1.24.1 on Windows 10.


texts: advantages and disadvantages of domain registrars on a blockchain

texts:
The idea of having a domain registrar on a blockchain goes back to Aaron Swartz (I think). Lately, there is a tweet by Udi Wertheimer in which he suggests that it might be a bad idea. It makes me wonder: What are the advantages and disadvantages of having a domain registrar on a blockchain?

The search results I get on Google don't seem to be especially critical of the idea.


texts: How do i change Truffle default account after contract deployment to interact with it?

texts:
I work with Truffle and Ganache along side Windows PowerShell. Truffle's default account is account[0]. I deploy my contract with that. After a while, i need to interact with the contract with account[1]. So, i should switch Truffle's default account from account[0] to account[1]. Please guide me to do that .Please note that there is no app.js or Nodejs and i need do that in PowerShell.
Thank you so much.


texts:
In a sample ERC721 contract linked from a loom-network medium post, I saw this code:

bytes4 constant InterfaceSignature_ERC721 =
    bytes4(keccak256('name()')) ^
    bytes4(keccak256('symbol()')) ^
    bytes4(keccak256('totalSupply()')) ^
    bytes4(keccak256('balanceOf(address)')) ^
    bytes4(keccak256('ownerOf(uint256)')) ^
    bytes4(keccak256('approve(address,uint256)')) ^
    bytes4(keccak256('transfer(address,uint256)')) ^
    bytes4(keccak256('transferFrom(address,address,uint256)')) ^
    bytes4(keccak256('tokensOfOwner(address)')) ^
    bytes4(keccak256('tokenMetadata(uint256,string)'));

Why is the bitwise XOR (^) operation used to join these values together?

I understand this is a cheap and efficient way to "mix" all of these hashes together, but I'm not sure if this is "safe" in terms of collisions and other weirdness, is this standard practice or just a simple hack to arrive at a probably-safe "unique" signature?

Code source: Line 481 on https://ethfiddle.com/09YbyJRfiI


texts: Can I use a truffle-contract instance in the data field of web3.eth.sendSignedTransaction?

texts:
I use truffle-contract for contract abstraction.

const myContract = TruffleContract(MyContractArtifact);

myContract.setProvider(web3.currentProvider);

I'm using Infura as the web3 provider so need to sign transactions before sending them. If I want to use contract functions in the web3.eth.accounts.signTransaction data field, can this be done with the myContract instance? I understand it can be done with web3.eth.Contract based on this answer, so if it is actually possible, is it more or less the same technique, or what would I need to do?

Edit* I have given up on truffle-contract and using web3.eth.Contract.methods.myMethod.encodeABI()

Edi2* Changed title as I was wrong to say sendTransaction() - the method I require is sendSignedTransaction()


texts: What is the best way to implement the coin contract to get all coin transaction history?

texts:
What is the best way to implement the coin contract code to see all transaction history?

It's easy to get the transaction history of ether, but it's kind of difficult to get all sending and receiving history of coin contract.

Add event log in sending function
Parse all messages to the coin contract

Any other ways?


texts: Can we use graphql with web3 to get the balance of multiple token/contract address?

texts:
I have an array of bsc token balances.   These are from my wallet address.
["0x2a9718deff471f3bb91fa0eceab14154f150a385", "0xad90c05bc51672eedfee36e58b3ff1a78bbc146d", "0x33a3d962955a3862c8093d1273344719f03ca17c", "0x85102c0062aa918cb9e26d94a284aafca602df13"
I'd like to to know if it's possible to use graphql with web3 that would allow me to pass the array of token addresses along with my wallet address to fetch the balance of each token?
Currently looking at doing this through a loop with a standard web3 call but I'm conscious that it would result in multiple calls, whereas a graphql solution could be much quicker and efficient


texts: What are the parameters for the ideal gas limit?

texts:
I am new to writing smart contracts, in recent times I am having trouble in deploying the smart contracts couple of times so I need a solution for that.

  I am using the truffle most of the time so limit of the gas is
   depended on the version of truffle like version 5 needs more gas or
   solidity version?

  Is it depends on the parameter we pass in the
   argument?

  What should be the ideal gas price needs to pass?

Thanks.


texts: What are offchain and onchain Transactions?

texts: What is meant by off-chain and on-chain transactions? I don't get the meaning of off-chain and on-chain in general.


texts: Where can I go if I still have problems with syncing the blockchain?

texts: I've searched online, this Stack Exchange, including synchronization, and am still having problems with syncing Geth.  Where else can I look and try to get help?


texts: It seems like instead of paying to the middle man, blockchain offers to pay the transaction fee to the nodes (it is not clear which one is bigger). Thus, there is not much benefit money-wise. Is the benefit only in security (even if one of the nodes is hacked, the ledger is still secure because it is stored on other nodes)?


texts: How to listen and get events in solidity

texts:
I'm using a smart contract that create posts , and i want to trigger the creation of a post , i want to listen to an event and pass the result to a node js server
This is my event :

event PostCreated(
    uint id,
    string content,
    uint tipAmount,
    address payable author
);

and this is how i emitted it :

function createPost(string memory _content) public  {
        //Require valid content
        require(bytes(_content).length > 0,"Length problem");
        //Increment the post count
        postCount ++;
        //Create the post
        posts[postCount] = Post(postCount,_content,0,msg.sender);
        //Trigger Event
        emit PostCreated(postCount,_content,0,msg.sender);

    }


texts: Geth SendTransaction: Insufficient funds for gas * price + value

texts:
I have looked at this similar question but I think my problem is a little different.

I am using Geth to try and send 0.9 eth from one cli wallet to another, using this command in my bash shell terminal:

sudo geth --exec "eth.sendTransaction({from:eth.coinbase, to:'9866c73a755da3d434cfdc8bca8fed02eebad469', value: web3.toWei(0.9, 'ether')})" attach

I currently have 0.99 Ethereum in my wallet, so I should have enough to do the transfer. I am using the mainnet. I left the gas amount blank so that geth works out how much I need to spend.

What am I doing wrong here?


texts:
Is there something I could add to my contract which allows my application to filter for all the deployed contracts which also included this topic/identifier?

The only other option to manage this I can think of would be to deploy a "manager" contract which stores a list of all other contracts (and every new contract by my application would send their address to it).

What is the proper way to solve this problem?


texts: How do I blacklist an address from buying my token

texts:
Ive been launching degen play contracts and it is being botted by a certain address because he knows that I burn the LP everytime. Is there a way to blacklist this address? Ive seen his wallet and it contains most of the tokens I made. He is also the top holder of almost all of the tokens I made, hence the botting speculation. Keep in mind that he often get 25% of the supply at a low price most of the time.
What should I add in the solidity contract to blacklist this user?


texts:
Having issues with a contract creating another contract using Truffle dev environment. Here are my steps -

truffle console
var node = Node.deployed()
node.then(function(instance){node=instance})
var relay = node.createRelay()

Getting this response after createRelay:

{ tx:
'0x5172bd954f72d31bb73278a10343ddfbd613c4938162b5ae9574b2e173271d03',
  receipt:
   { transactionHash:
'0x5172bd954f72d31bb73278a10343ddfbd613c4938162b5ae9574b2e173271d03',
     transactionIndex: 0,
     blockHash:
'0xcae09bb248baf2bc0cd9065c629958336874c2ae8c5b1e5fbd5f867600d63c56',
     blockNumber: 40,
     gasUsed: 159039,
     cumulativeGasUsed: 159039,
     contractAddress: null,
     logs: [] },
   logs: [] }

As you can see, contractAddress is null.

Here are my contracts:

pragma solidity ^0.4.2;
import "./Relay.sol";

contract Node {

uint public fee;
address public owner;
address[] activeRelays;

  function Node() {
    owner = msg.sender;
    fee = 10;
  }

  function createRelay () returns (address) {
    address relay = new Relay();
    activeRelays.push(relay);
    return relay;
  }
}

Relay:

pragma solidity ^0.4.2;

contract Relay {
address public owner;

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

  function fundRelay() payable returns (bool) {

  }

  function releaseFunds () {

  }
}

Thank you for any help.


texts: How can an Ethereum contract read data from excel

texts: Is there a possibility to read excel from smart contract? If yes how? Do I need some relay or something.


texts:
I have created a Private Ethereum Block chain on AWS with two nodes. One is Primary node and another is Miner. Now I deployed the smart contract on primary node. As its a P2P n/w, same smart contract should be accessible on second node as well, but I am not able to access it from another node.
Also the wallets created in one node are also not accessible in another node. Can any body please enlighten me the process of Syncing the nodes. As I read each node contains the same data of another node.


texts: Infura: certificate has expired error when deploying on Rinkeby

texts:
I was trying to deploy some contracts on Rinkeby using Infura, and got the following error:
Error: certificate has expired\n    at TLSSocket.onConnectSecure (_tls_wrap.js:1088:34)\n    at TLSSocket.emit (events.js:198:13)\n    at TLSSocket._finishInit (_tls_wrap.js:666:8)' }

(The complete stack trace is at the bottom of the question.)
I'm using a deploy script as so:
if (network == 'rinkeby') {
        // Overriding default config for rinkeby test net
        defaultConfigs.chainId = 4;
        // Setting private key for this network
        secret = process.env.DEPLOYER_PRIVATE_KEY_RINKEBY;
        // Setting the RPC
        RPC = `https:/rinkeby.infura.io/v3/${process.env.INFURA_API_KEY_RINKEBY}`;

        console.log("Deploying to Rinkeby network");
}

This script is using Etherlime's tools (elsewhere in the script, I'm not bringing it all since it seems to work, as you'll see in a minute that I could deploy on local RPC using it), and as you can assume dotenv for the environmental variables, which as far as I can tell, are set properly.
In the end I ended up spinning up a local Rinkeby node and deployed using the same script from local - I just changed the RPC variable to hit localhost, and that worked fine. (So no problems with the Etherlime, as far as I can tell.)
What is going wrong here?
Appendix
Here's the whole stack trace, with some details (like the actual Infura API key) edited out:
➜ yarn deploy:rinkeby
yarn run v1.22.5
$ etherlime deploy --network=rinkeby --runs=500
Compilation finished successfully
Deploying to Rinkeby network
Deployer set to deploy from address: 0x...

JSONRPC Deployer Network: https:/rinkeby.infura.io/v3/...

Deploying contract: Library_Token
{ Error: invalid response - 0
    at exports.XMLHttpRequest.request.onreadystatechange (/home/x/code/project/Blockchain/node_modules/etherlime-lib/node_modules/ethers/utils/web.js:84:29)
    at exports.XMLHttpRequest.dispatchEvent (/home/x/code/project/Blockchain/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:25)
    at setState (/home/x/code/project/Blockchain/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:610:14)
    at exports.XMLHttpRequest.handleError (/home/x/code/project/Blockchain/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:532:5)
    at ClientRequest.errorHandler (/home/x/code/project/Blockchain/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:459:14)
    at ClientRequest.emit (events.js:198:13)
    at TLSSocket.socketErrorListener (_http_client.js:401:9)
    at TLSSocket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
  statusCode: 0,
  responseText:
   'Error: certificate has expired\n    at TLSSocket.onConnectSecure (_tls_wrap.js:1088:34)\n    at TLSSocket.emit (events.js:198:13)\n    at TLSSocket._finishInit (_tls_wrap.js:666:8)' }
Your deployment script finished with failure!

Here is your report:

Done in 32.09s.

Thanks for reading, and super thanks if you took the time to write an answer!


texts: Is it possible to send/receive Bitcoin using a smart contract?

texts:
My Question goes in the sense of what's possible in terms of creating a Dapp that allows to send/receive BitCoin just like it would any other given ERC20 Token. Is this possible to achieve for a Smart Contract in the Ethereum network? If not, I would like to know what would be the basic steps in the right direction, I believe there are some Wallets out there that can, right?

Kind Regards.


texts: Multiple Transactions From Same Address With Same Details

texts:
I am running a local Ethereum node which takes a perceivable amount of time to mine blocks.

I am trying to develop a bullet-proof way of dynamically calling transactional methods on an Ethereum smart contract. Our product allows users to integrate with Ethereum smart contracts, and there are no limits on the users of our product when it comes to consuming smart contracts. Mostly my logic works, accept when I post two (2) or more transactions, pretty much at the same time, with the same details. Because neither have been mined, they end up receiving the same nonce by geth (i.e. geth 1.8.2-stable-b8b9f7f4 and web3.js 1.0.0-beta.28 under nodejs 4.2.6), and a "Known Transaction" results.

I have tried multiple strategies to avoid this issue, but none of them works consistently:

set the "nonce" to null in the signTransaction method. For two (2) close transactions, both unmined, results in a 'Known Transaction' error.
set the "nonce" to getTransactionCount() or getTransactionCount("pending"), but for two (2) close transactions, both unmined, results in 'Replacement Transaction Underpriced" error.
construct logic that remembers the "nonce" from the previous transactions and coalesces them with the getTransactionCount("pending") result - still results in 'Replacement Transaction Underpriced" error.

I know this is probably a niche case, but does anyone have any ideas how to best tackle this issue?

Could all my issues be tied to the following open Go-Eth bug #2880?


texts: Why are some drivers better than others?

texts: I noticed that most people prefer NVIDIA 347.52 drivers, and AMD 15.12 drivers. I understand that the hashrate improves, but does anyone know what really changes how good the driver is at hashing?


texts: Can you do a POST to an external webform using a Ethereum smart contract?

texts: Can you do POST or submit a form from an external site using a smart contract? And how can this be done? Are there any examples of live code out there?


texts: How do I make a raspberry pi a node in the testnet blockchain ? Is it possible?

texts:
Me and my friends have decided to do a small project using 3-4 RPIs and making transactions between them using smart contracts.

The smart contracts will trigger events based on weather or any real time data, and will make a transaction to the other RPI's in this small blockchain, which will then trigger a function that will turn on a LED or display something.

First of all, is it feasible ?

Then , would i need to download the whole testnet blockchain on the RPI's or there exists another solution that will need less time or space ?

Finally, what frameworks or packages would i need to do it ?

Thanks


texts: Where does parity look when trying to import geth keystore files

texts:
I'm in the directory for parity keystore files, namely, ~/.local/share/io.parity.ethereum/keys/
and I've run:

  parity --import-geth-keys

But I get an error saying:

  Failed to find geth keys folder

I've placed my Geth keystore file in this folder


texts: How to get the type of transaction (Send/Receive/Approve/Swap) and the ERC20 tokens involved in that transaction?

texts:
I', getting to know the Ethereum technology (so rookie level). By far, with the free APIs (etherscan.io, ethplorer.io, coingecko) I have been able to build a "watch wallet". It looks like this:

But I can't seem to find the API which gives me more detail about all the Transactions in the given wallet. API does give me the hash, block, gas, status, address (from/to), etc... But I don't know the tokens (assets) that were involved in those transactions and I don't know which action took place (Sent/ Received/Swapped/Approved ...)
Here's the raw info I get from the api (image 2), can someone guide me to the next step of how to extract those detail data?

P/s: What I'm trying to achieve looks like this (Image 3: Zerion app)


texts: Recover JavaScript Signed Message in Python Web3

texts:
Running into problems taking a signed message from Web3.js, and recovering the signing address in Web3.py.

Here is my code in JavaScript to create a signed message:

async function sign_message() {
    var message = "hi"
    var message_hash = web3.eth.accounts.hashMessage(message)
    //message_hash == 0x0d52783c4cbad7ebaf7eb943fc648f5282a52070442fc18d8dd16ddb2fcbaf66

    var accounts = await web3.eth.getAccounts()
    var signature = await web3.eth.personal.sign(message, accounts[0])
    //accounts[0] ~ 0x6d31165d5d932d571f3b44695653b46dcc327e84
    console.log(signature)
    //signature == 0x29887fe718fcc6e64b97d681f80e6fd485883a45ec0dbc0e35a3752acf1065655d73c9034cac3df0dc82da015abe42367f5e90fd499d872b19610a3ea9c176921b
}

Then here is trying to recover the address in Python:

>>> message = "hi"
>>> message_hash = defunct_hash_message(text=message)
>>> message_hash
HexBytes('0x0d52783c4cbad7ebaf7eb943fc648f5282a52070442fc18d8dd16ddb2fcbaf66')
>>> signature = '0x29887fe718fcc6e64b97d681f80e6fd485883a45ec0dbc0e35a3752acf1065655d73c9034cac3df0dc82da015abe42367f5e90fd499d872b19610a3ea9c176921b'
>>> w3.eth.account.recoverHash(message_hash, signature=signature)
'0x6F4630e882c48151D9e4E386F95009b6312717f4'

Note that the message_hash in both examples are the same, however recoverHash does not result in the correct Ethereum address.

I have used these two sources to try and help me debug the issue to no success:

How to properly sign a transction to be used by ecrecover?

Verifying personal.sign signature with pyethereum


texts:
I am trying to get from truffle develop console an array of identifiers using a custom get function but the return array is [].
Here is my contract:

pragma solidity ^0.4.18;

contract MyInfo {

  struct Info {
    bytes32 id;
    bytes32 name;
  }
  bytes32[] infoIDs;
  mapping(bytes32 => Info) infos;
  function addInfo(bytes32 _name) public
     returns(bool success) {

     bytes32 ID = keccak256(_name);
     infoIDs.push(ID);
     infos[ID].id = ID;
     infos[ID].name =_name;
     return true;
  }
  function getInfoIDs() public view returns(bytes32[] ids) {
    return infoIDs;
  }
}

And from the truffle console I run:

  MyInfo.deployed().then(inst => { return inst.addInfo("testname", {from: web3.eth.accounts[0]}) })

which returns true.

To get the ids I run:

  MyInfo.deployed().then(inst => { return inst.getInfoIDs.call() })

but I get [].

Any ideas what it might be the problem?

I'm using

  Truffle v4.1.0 (core: 4.1.0)

and

  Solidity v0.4.19 (solc-js)

EDIT: If I put the code in Remix I get the ids correct.

EDIT2: I noticed that the values assigned to other variables inside the addInfo function don't exist afterwards...


texts: Can we issue a token with specific local state?

texts:
Will it be possible to create an ERC20-Token, that will be "minted" with specific local state on a per token-basis while this state can change over time through the execution of a method in the smart contract?

My question is about something like coloured coins or branded Tokens like to issue paper money while we would add a special greeting on some bank notes while other bank notes will get another greeting (or drawing on the bank notes with a pencil as an example).

Lets say we have such a token:

contract ExampleToken is StandardToken, Ownable {
    string public constant name = "Example Token";
    string public constant symbol = "EXP";
    uint8 public constant decimals = 18;
    string public version = "1.0";

}

In the Main Sale Contract we would mint these tokens against Ether, but in a different way:

transaction 1: mint 100 ExampleToken with a specific local state of "A000" > receive ExampleToken with state "A000"

transaction 2: mint another 200 ExampleToken with a specific local state of "B000" > receive ExampleToken with state "B000"

transaction 3: call a specific method on the contract to change the state of the first specific 100 token "A000" into "C000"

Despite the fact of immutability in the blockchain, is such a scenario possible somehow or would the transaction 3 mean to burn the first 100 token from transaction 1 and to mint new tokens?


texts: How can you distribute dividends from a smart contract?

texts:
I'm trying to develop a smart contract where dividends are distributed to all token holders. So if there are 100 tokens Alice has 50, Bob has 30 and the other 20 are owned by maybe even thousand different addresses. And there is 200 ether to be distributed as dividends Alice gets 100, Bob 60 and the remaining goes to all others accordingly.

So far I've come up with a burn scheme where you need to burn your tokens to get your portion of ether in the smart contract. However this requires you to burn your shares and you can no longer get the rewards from future profit.

Looping over all token holders is not an option because you would run into gas issues very soon.

Is there already a known solution for this in solidity? Or might the burning scheme be the best solution as it is a incentive to hold?


texts:
I am receiving the above mentioned error when compling the code. Can you understand what's the issue?
Thanks
pragma solidity 0.6.12;

interface ITRC20 {

  function transfer(address to, uint256 value) external returns (bool);
  function approve(address spender, uint256 value) external returns (bool);
  function transferFrom(address from, address to, uint256 value) external returns (bool);
  function totalSupply() external view returns (uint256);
  function balanceOf(address who) external view returns (uint256);
  function allowance(address owner, address spender) external view returns (uint256);
  event Transfer(address indexed from, address indexed to, uint256 value);
  event Approval(address indexed owner, address indexed spender, uint256 value);

}

contract Testing {
   ITRC20 trc = ITRC20(0xaf9f549774ecEDbD0966C52f250aCc548D3F36E5);
   trc.transfer(address(this), 255);

}