texts: Who is "from" in case of inheritance in solidity?

texts:
I have the following code:

// Test.sol
pragma solidity ^0.5.2;

import "./TestBase.sol";

contract Test is TestBase{
    string[] name ;

    constructor() public payable {
      name.push("sheep");
      name.push("fox");
      name.push("whale");
    }

    function getNames() public returns(string[] memory){
        emit Log("Test",address(this),msg.sender,tx.origin);
        display();
        return name;
    }
}

// TestBase.sol
pragma solidity ^0.5.2;

contract TestBase2 {
    event Log(string context,address,address,address);

    function display2() public returns(address){
        emit Log("TestBase2",address(this),msg.sender,tx.origin);
        return msg.sender;
    }

}

contract TestBase is TestBase2{

    function display() public returns(address){
        emit Log("TestBase",address(this),msg.sender,tx.origin);
        display2();
        TestBase3 t = new TestBase3();
        t.display();
        return msg.sender;
    }
}

contract TestBase3 {
    event Log(string context,address,address,address);

    function display() public returns(address){
        emit Log("TestBase3",address(this),msg.sender,tx.origin);

        return msg.sender;
    }
}

/// Remix output

Remix account(as seen in right side column of web page):0xca35b7d915458ef540ade6068dfe2f44e8fa733c

from    0xca35b7d915458ef540ade6068dfe2f44e8fa733c
 to     Test.getNames() 0x0dcd2f752394c41875e259e00bb44fd505297caf
  decoded output    {
    "0": "string[]: sheep,fox,whale"
}
 logs   [
    {
        "from": "0x0dcd2f752394c41875e259e00bb44fd505297caf",
        "topic": "0x93667a083beb23e2ac43ce23abd64b5a09999b532c00513483ed11dc07061e32",
        "event": "Log",
        "args": {
            "0": "Test",
            "1": "0x0DCd2F752394c41875e259e00bb44fd505297caF",
            "2": "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c",
            "3": "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c",
            "context": "Test",
            "length": 4
        }
    },
    {
        "from": "0x0dcd2f752394c41875e259e00bb44fd505297caf",
        "topic": "0x93667a083beb23e2ac43ce23abd64b5a09999b532c00513483ed11dc07061e32",
        "event": "Log",
        "args": {
            "0": "TestBase",
            "1": "0x0DCd2F752394c41875e259e00bb44fd505297caF",
            "2": "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c",
            "3": "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c",
            "context": "TestBase",
            "length": 4
        }
    },
    {
        "from": "0x0dcd2f752394c41875e259e00bb44fd505297caf",
        "topic": "0x93667a083beb23e2ac43ce23abd64b5a09999b532c00513483ed11dc07061e32",
        "event": "Log",
        "args": {
            "0": "TestBase2",
            "1": "0x0DCd2F752394c41875e259e00bb44fd505297caF",
            "2": "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c",
            "3": "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c",
            "context": "TestBase2",
            "length": 4
        }
    },
    {
        "from": "0x28dd7d6f41331e5013ee6c802641cc63b06c238a",
        "topic": "0x93667a083beb23e2ac43ce23abd64b5a09999b532c00513483ed11dc07061e32",
        "event": "Log",
        "args": {
            "0": "TestBase3",
            "1": "0x28Dd7d6f41331e5013eE6c802641cC63B06C238a",
            "2": "0x0DCd2F752394c41875e259e00bb44fd505297caF",
            "3": "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c",
            "context": "TestBase3",
            "length": 4
        }
    }
]

Can you please define the terms: from, to (is it user, account or wallet address), topic.
To my knowledge address(this) refers current contract's address. As Test inherits TestBase which inherits TestBase2, address(this) points to same address. I would like to know whose address is this i.e., is it Test, TestBase or TestBase2.


texts: How to automatically deliver the tokens in a PostDeliveryCrowdsale

texts:
My goal is to deliver the tokens only at the end of the crowd sale. I have seen the below code which can deliver the tokens in a batch.

Questions

Will this work even when there is a million _to address ?
Apart from the below snippet, Is there any better way to do this ?

/**
 * @dev Function to batch mint tokens
 * @param _to An array of addresses that will receive the minted tokens.
 * @param _amount An array with the amounts of tokens each address will get     minted.
 * @return A boolean that indicates whether the operation was successful.
 */
function batchMint(address[] _to, uint256[] _amount) external
canMint
returns (bool) {
    require(_to.length == _amount.length);
    for (uint i = 0; i < _to.length; i++) {
        require(_to[i] != address(0));
        require(mint(_to[i], _amount[i]));
    }
    return true;
}


texts: I am finding online tutorials for Remix/Solidity but issue is that Remix is totally changed and I am clueless how to even run a simple contract. Is there any latest updated tutorial or documents? Below is screenshot of my simple contract and I have no idea how to Run it.


texts: Where can you download SOLC ( solidity compiler) from?

texts:
I am looking for the SOLC solidity compiler that works with JSON-RPC.

The only one I find is the one at
https://www.npmjs.com/package/solc

However its says
 "this commandline interface is not compatible with solc provided by the Solidity compiler package and thus cannot be used in combination with an Ethereum client via the eth.compile.solidity() RPC method. Please refer to the Solidity compiler documentation for instructions to install solc."

ON the Ethereum site, I cannot find a simple download page for it...

Any ideas?


texts: Bitcoin has a mempool? Does ethereum has a mempool?

texts:
Wondering if you know that. I checked
https://jochen-hoenicke.de/queue/#1,24h
and it gives interesting stats for pending transactions and fees. But I have never heard of mempool in ethereum ecosystem.


texts: Interaction between two smart contracts - 'call' function fails. Why?

texts:
I have read a number of posts about making calls between contracts, but I can't get this simple example to work that involves two contracts that are already deployed on my private Ethereum blockchain.

The pattern I'm trying to create is:
i- 'Caller' receives call to 'proxyRequest' function
ii- Caller uses the the _target parameter and calls the 'registrationRequest' function at the supplied address.
iii- 'UserRegistered' event in 'CallMe' should fire.

But the problem is that the 'call' function in 'Caller' always returns false. Any pointers would be appreciated.

If I use Web3 and create a transaction that calls the 'registrationRequest' function directly in 'CallMe', then it works fine.

contract Caller
{
    event SendingTransaction(address indexed _requestor, uint8 indexed action);

    address public minter;
    bytes public email;      // hash of the email address

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

    function() {
        throw;
    }

    function Caller(bytes _email) {

        // constructor
        minter= msg.sender;
        email= _email;
    }

    function proxyRequest(address _target, string _payload) onlyOwner public {

        SendingTransaction(_target, 1);
        // Event fires OK when I subscribe to it via Web3 code.

        if (!_target.call("registrationRequest",_target, _payload))
        {
            SendingTransaction(_target, 2);
            // Event fires OK when I subscribe to it via Web3 code.
        }
        else
        {
            SendingTransaction(_target, 3);
            // Event NEVER fires
        }

    }

}

Second contract.

pragma solidity ^0.4.7;

contract CallMe
{
    event UserRegistered(address indexed _from, string _attr);

    address public minter;     // keep track of the entity that created the contract

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

    function CallMe() {
        minter = msg.sender;
    }

    function() {
        throw;
    }

    function registrationRequest(address _toAdd, string _code) {

        // this event fires ok if I invoke it via web3
        // this event DOES NOT fire ok if function invoked by 'Caller'
        UserRegistered(_toAdd, _code);
    }

    function getMinter() constant returns (address) {
        return minter;
    }
}


texts: Gas limit errors when deploying Greeter example contract on Remix

texts:
First time newbie eth contract question.   I'm using remix to compile the ethereum.com greeter example.  I'm having problems with the gas when I deploy the contract.

if I specify :

gas: eth.getBlock(eth.defaultBlock).gasLimit -1

I get

Error: insufficient funds for gas * price + value

But if I bump it up to

gas: eth.getBlock(eth.defaultBlock).gasLimit +1

ask expected, I get

Error: exceeds block gas limit

my test balance is 22905390000000000, way over the gas limit.  I'm clearly not understanding something here.

I've gutted my code, this is the contract in its entirety:

pragma solidity ^0.4.11;
contract greeter {
    /* main function */
    function greet() constant returns (string) {
        return "greeting" ;
    }
}

When I submit this contract I get the error "Error: The contract code couldn't be stored, please check your gas amount"

Update:  I printed out my eth.getBalance() before and after sending the contract.   I still get the error "couldn't be stored" but I notice that my balance is going down by my gas*gasPrice.


texts: Understanding nameReg.call("register", "MyName") style call between contracts

texts:
Here's an example from solidity docs on Address type methods(call method specifically):

address nameReg = 0x72ba7d8e73fe8eb666ea66babc8116a41bfb10e2;
nameReg.call("register", "MyName");
nameReg.call(bytes4(sha3("fun(uint256)")), a);

I can't understand what the second line does. Does it call the fallback function with these two arguments? Or does it pass string MyName to function register on nameReg contract?


texts: Are Uniswap liquidity provider's fees timeweighted?

texts:
The common conception is that Uniswap LPs get more fees as they stay longer in the pool. I have been searching everywhere for a clear explanation of how fees work, and could not find information to confirm this conception is correct.
Take this example:
Alice owns 100% of a new pool that progressively generates 10k in swap fees. Bob hops in and takes 90% of the pool, then exits right away. He'd take 9k in fees, and just 1k remaining for Alice?
But if Alice had exited before Bob enters in the pool, she'd get 10k in fees.
If this is correct, providing liquidity for a shorter period would entitle the LP to more fees.
Can someone clear this out?


texts: Cannot call contract's function in Remix

texts:
I have successfully deployed the following contract on ropsten (in order to understand reverts better):

```
 contract Test {

bool test1;
bool test2;

function Test() public {
    test1 = false;
    test2 = false;
}

function test() public {
    test1 = true;
    _test2();
}

function _test2() internal {
    test2 = true;
    revert();
}

function getTest1() public view returns (bool) {
    return test1;
}

function getTest2() public view returns (bool) {
    return test2;
}

}

```

Calling getTest1() or getTest2() works fine. However, calling test() is not working, because Remix complains about GasLimit (although I have set it to: 4440000):

Gas required exceeds limit: 4440000.  An important gas estimation might also be the sign of a problem in the contract code. Please check loops and be sure you did not sent value to a non payable function (that's also the reason of strong gas estimation).

What is wrong here?


texts:
I created a Ether.li wallet but missed to press the finish button on the page where you note your keys.

Then i transferred money to the wallet which was not saved. After i got on the Ether.li hompage again to access the wallet it created a new wallet :(

I have all the Keys of the old wallet but cant recreate it.

I treid the following: https://www.masonborda.com/etherli-wallet-recoveries/
But there is nothing where i can past the ABI?!


texts: Why does Ethereum Wallet download new binary for Geth (I'm already running Geth)?

texts:
I have geth running already on my computer with datadir and ipcpath flags. I then run Ethereum Wallet with corresponding flags to link the two. But as EW is starting up it still downloads geth again (then a moment later connects to the node I am already running).

And even if I didn't already have geth running... I thought EW had a geth binary already packaged in with it?

[2017-06-14 09:16:54.423] [INFO] ClientBinaryManager - Calculating possible clients...
[2017-06-14 09:16:54.425] [INFO] ClientBinaryManager - 1 possible clients.
[2017-06-14 09:16:54.425] [INFO] ClientBinaryManager - Verifying status of all 1 possible clients...
[2017-06-14 09:16:54.426] [INFO] ClientBinaryManager - Verify Geth status ...
[2017-06-14 09:16:54.507] [ERROR] ClientBinaryManager - Unable to resolve Geth executable: geth
[2017-06-14 09:16:54.510] [INFO] ClientBinaryManager - Download binary for Geth ...
[2017-06-14 09:16:54.512] [INFO] ClientBinaryManager - Downloading package from https://gethstore.blob.core.windows.net/builds/geth-darwin-amd64-1.6.5-cf87713d.tar.gz to /Users/studio3/Library/Application Support/Ethereum Wallet/binaries/Geth/archive.tar ...
[2017-06-14 09:17:07.228] [ERROR] ClientBinaryManager - md5
[2017-06-14 09:17:07.229] [ERROR] ClientBinaryManager - 57b04bd0d24b41534f97861250af165b
[2017-06-14 09:17:07.229] [ERROR] ClientBinaryManager - 57b04bd0d24b41534f97861250af165b
[2017-06-14 09:17:07.592] [INFO] ClientBinaryManager - Verify Geth status ...
[2017-06-14 09:17:07.607] [INFO] ClientBinaryManager - Checking for Geth sanity check ...
[2017-06-14 09:17:07.607] [INFO] ClientBinaryManager - Checking sanity for Geth ...
[2017-06-14 09:17:07.713] [INFO] Sockets/node-ipc - Connect to {"path":"/Users/ETHUSER/Library/Ethereum/geth.ipc"}
[2017-06-14 09:17:07.717] [INFO] Sockets/node-ipc - Connected!
[2017-06-14 09:17:07.718] [INFO] NodeSync - Ethereum node connected, re-start sync


texts:
Etherum vs IPFS for Long Terms Storage of Critical document files?

Storing high priority files on the blockchain. I am also writing a smart contract for the files on Etherum. I have concerns about IPFS garbage collection vs storing the files directly on Ethereum. Thoughts?

IPFS for the storage and storing only the hash on ethereum. This is correct right? Ethereum doesn't store the entire files/folders?

Here are my concerns (am I thinking this through correctly?)

IPFS could delete the files via Garbage collection.
Ethereum only stores the hash, not the full files?
For important files I am I better off storing them directly on Ethereum blockchain?

Other thoughts:
I could use a redundancy system:

Have IPFS node have the files stored on an external hard drive.
    Con: Leaves the hard drive being vulnerable to getting lost

Have one files on BOTH Ethereum and IPFS (with backup too).
    Con: Expensive and bloats Ethereum blockchain.

Thank you for your time and help!


texts: Cannot Find Module Error for Truffle-contract

texts:
Error:-

Uncaught Error: Cannot find module './truffle-contract.min.js'
    at c (web3.min.js:1)
    at c (web3.min.js:1)
    at index.html:27

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script type="text/javascript" src="./web3.min.js"></script>
    <script type="text/javascript" src="./truffle-contract.min.js"></script>
    <title>Test For blockchain</title>
</head>
<body>
    <script>
        var Web3 = require("web3");
        if (typeof web3 !== 'undefined')
        {
            web3 = new Web3(web3.currentProvider);
        }
        else
        {
            web3 = new Web3(new Web3.providers.HttpProvider("https://shivansh.blockchain.azure.com:3200/######"));
        }
        //wb = new Web3(web3);
        //var HelloBlockchain = artifacts.require("HelloBlockchain");
        console.log("test");

        let contract = require('./truffle-contract.min.js')
        let HelloWorld = contract(require('./build/contracts/HelloBlockchain.json'))

        HelloWorld.setProvider(web3);
        HelloWorld.deployed().then(contract => {
        return contract.getMessage()
        }).then(response => {
        console.log(response)
        })
    </script>
</body>
</html>


texts: How to use miner.start(2) from javascript

texts:
Refering to "Common useful JavaScript snippets for geth"

Got Following example to run miner from javascript:

  Mine only when there are transactions!

var mining_threads = 1

function checkWork() {
    if (eth.getBlock("pending").transactions.length > 0) {
        if (eth.mining) return;
        console.log("== Pending transactions! Mining...");
        miner.start(mining_threads);
    } else {
        miner.stop(0);  // This param means nothing
        console.log("== No transactions! Mining stopped.");
    }
}

eth.filter("latest", function(err, block) { checkWork(); });
eth.filter("pending", function(err, block) { checkWork(); });

checkWork();

I am not able to use miner.start(mining_threads). Currently, I am using the following libraries:

jquery-1.12.0.min.js
bignumber.min.js
web3-light.js
web3Init.js

It would be really great if someone could help me out here.


texts: Is it possible to hide the state of a contract and information from transactions calling its methods?

texts:
I am interested what is the best way to hide contract function calls and contract state details from everyone except certain parties (if that is possible at all).

Encryption sounds like a possible solution so at least the state of the contract can be kept in a secure way, but from what I understand it would be very inefficient and it also doesn't solve the problem of the contract method calls being visible. Also how would you provide in a secure way the private key to a contract in order to decrypt the storage data?

Are there any other solutions?


texts: Web3js send ERC20 token with my own mining machine

texts:
Is it possible to send custom ERC20 token using my own mining machine?

We have a big website where we are going to use our own Custom token but the problem is when we send tokens to the user we need to pay some gas fee and we want to avoid this fee so idea is to use our own mining machine.

Please suggest us best advice if you can.

If it is possible then how?


texts: How to create Solidity smart contract that can accept exactly 5 Ether from any sender?

texts: If amount is not exactly 5 Ether it has to be refunded back to the sender.


texts: What exactly does fakepow option do in geth?

texts:
If you use '--fakepow option' in geth, what exactly happens?

The documentation in Geth says:

  --fakepow Disables proof-of-work verification

Does it create a block without PoW? or does it skip the block verification?

And what is this option for?


texts: Is it possible to create one-time addresses, like in monero?

texts:
In http://src.getmonero.org/library/Zero-to-Monero-1-0-0.pdf, chapter "5.2 One-time addresses", there is description of how to create them.

The problem is that Monero uses Ed25519 and Ethereum secp256k1.

Is it possible to apply the same mathematical operations to a different curve?


texts: Solidity. How to add an address to a mapping

texts:
I have this:

contract Diary {
    string[] private facts;
    mapping (address => bool) approvedAddresses;
    address owner;

    constructor() public {
        owner = msg.sender;
        approvedAddresses[0xca35b7d915458ef540ade6068dfe2f44e8fa733c] = true;
    }

I get this error:

  SyntaxError: This looks like an address but has an invalid checksum.
  Correct checksummed address:
  "0xCA35b7d915458EF540aDe6068dFe2F44E8fa733c". If this is not used as
  an address..

Which is the correct way to do this? I'm new to solidity..


texts: Migrating a smart contract to the kovan test network using the truffle framework just hangs

texts:
I am trying to deploy a smart contract to the Kovan test network with the truffle framework. When I run truffle migrate --network kovan it just hangs for ages at the following place:

Running migration: 1_initial_migration.js
  Deploying Migrations...

My truffle.js file is as follows:

// Allows us to use ES6 in our migrations and tests.
require('babel-register');

var bip39 = require("bip39");
var hdkey = require('ethereumjs-wallet/hdkey');
var ProviderEngine = require("web3-provider-engine");
var WalletSubprovider = require('web3-provider-engine/subproviders/wallet.js');
var Web3Subprovider = require("web3-provider-engine/subproviders/web3.js");
var Web3 = require("web3");

// Get our mnemonic and create an hdwallet
var mnemonic = "some words that are in the mnemonic that i use";
var hdwallet = hdkey.fromMasterSeed(bip39.mnemonicToSeed(mnemonic));

// Get the first account using the standard hd path.
var wallet_hdpath = "m/44'/60'/0'/0/";
var wallet = hdwallet.derivePath(wallet_hdpath + "0").getWallet();
var address = "0x" + wallet.getAddress().toString("hex");

var providerUrl = "https://kovan.infura.io/MYACCESSCODE";
var engine = new ProviderEngine();
engine.addProvider(new WalletSubprovider(wallet, {}));
engine.addProvider(new Web3Subprovider(new Web3.providers.HttpProvider(providerUrl)));
engine.start(); // Required by the provider engine.

module.exports = {
  networks: {
    kovan: {
      network_id: 42,    // Official kovan network id
      provider: engine, // Use our custom provider
      from: address,     // Use the address we derived
      gas: 3000000
    }
  },
  rpc: {
    // Use the default host and port when not using ropsten
    host: "localhost",
    port: 8545
  }
};

I can see that a transaction has been created at: [https://kovan.etherscan.io/txs?ca=0x8ade41c465fa645d84df4e319524e1f9fa366325], but when I try to connect with my dApp I get the Error Error: MyContract has not been deployed to detected network (network/artifact mismatch)

Would anyone have any suggestions?

Any help would be greatly appreciated.

Thanks!


texts: How to import data from MySQL database to swarm

texts:
In an application which is all ready developed and deployed data is stored in MySQL database. I want to import that data into swarm.

Reasons to import data in swarm -

1) All the data shall not be stored in blockchain because of transaction(gas) cost.

2) Decentralised storage has more advantages like fault tolerance over centralised storage.

From whatever I read and experimented I am able to store unstructured data in swarm.

My question is -
1) How shall I store structured data in ethereum swarm?
2) How shall I query structured data stored in ethereum swarm.

Link of any tutorials , blogs related to same would be helpful for me.


texts:
I'm trying to understand how exactly the pre-ICO/ICO should be structured in terms of technical aspect. What are there trustworthy things that every ICO developer should think about.

I'm interested in token based approach based on ethereum using ERC20 standard.
I have seen a couple of projects:

https://github.com/TokenMarketNet/ico

https://github.com/airalab/

Please let me know if you can provide a very detailed answer on best practices.


texts:
i want to connect two different machines in a ethereum private network!

I did it before with a normal PoW-Consesus but with PoA created by puppeth i cant see some Peers when i try:

admin.peers

Things i have done:

Initalize ethereum accounts on both machines with:

geth --datadir data/node1 account new
geth --datadir data/node2 account new

Then i created a genesis file with puppeth and copied it to the other machine that they are similiar!

The file looks like this:

  {
    "config": {
      "chainId": 1001,
      "homesteadBlock": 1,
      "eip150Block": 2,
      "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
      "eip155Block": 3,
      "eip158Block": 3,
      "byzantiumBlock": 4,
      "constantinopleBlock": 5,
      "clique": {
        "period": 0,
        "epoch": 30000
      }
    },
    "nonce": "0x0",
    "timestamp": "0x5c3894dc",
    "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000d460f5cc1dd0efec245ca8a87afd5c1ba1456f7e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "gasLimit": "0x47b760",
    "difficulty": "0x1",
    "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "coinbase": "0x0000000000000000000000000000000000000000",
    "alloc": {
      "d460f5cc1dd0efec245ca8a87afd5c1ba1456f7e": {
        "balance": "0x200000000000000000000000000000000000000000000000000000000000000"
      }
    },
    "number": "0x0",
    "gasUsed": "0x0",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"

Then i initialized the genesis files with this commands:

geth --datadir data/node1/ init genesis.json
geth --datadir data/node2/ init genesis.json

After that i started both nodes with this commands:

geth --datadir="data/node1" --networkid "1001" --nodiscover console --unlock "d460f5cc1dd0efec245ca8a87afd5c1ba1456f7e" --rpc --rpcport "8000" --rpcaddr "0.0.0.0" --rpccorsdomain "*" --rpcapi "eth,net,web3,miner,debug,personal,rpc" --syncmode "full"

geth --datadir="data/node2" --networkid "1001" --nodiscover console --unlock "1200f5a866b0889a816d808a82b4f3be30ba6ba2" --rpc --rpcport "8000" --rpcaddr "0.0.0.0" --rpccorsdomain "*" --rpcapi "eth,net,web3,miner,debug,personal,rpc" --syncmode "full"

To find out the enode i wrote on the machine without prebalance:

admin.nodeInfo.enode

gives me this output:

  "enode://2c98ce532ae14020437889ecc9af8f15fd3463ccb6262c9eec124073ab6ee8999ebe2ff97bf8559e3b5b7c85157251129127600c955c1d1a3b3e9fb54330f120@127.0.0.1:30303?discport=0"

And executed this command on the main machine after copying the enode:

admin.addPeer("enode://2c98ce532ae14020437889ecc9af8f15fd3463ccb6262c9eec124073ab6ee8999ebe2ff97bf8559e3b5b7c85157251129127600c955c1d1a3b3e9fb54330f120@127.0.0.1:30303?discport=0")

i also tried this command:

admin.addPeer("enode://2c98ce532ae14020437889ecc9af8f15fd3463ccb6262c9eec124073ab6ee8999ebe2ff97bf8559e3b5b7c85157251129127600c955c1d1a3b3e9fb54330f120@127.0.0.1:30303")

Can u help me please to connect the peers of different machines that i can run a private PoA Ethereum!

Thanks anyways :)


texts:
EOS is a ERC20 token which is currently sold for ETH. 2 million EOS are sold every 23 hours for about 20K ETH as seen on https://eos.io/distribution/

However, what puzzle me is that when I do a transaction scan on etherscan using (http://api.etherscan.io/api?module=account&action=txlist&address=0xd0a6E6C54DbC68Db5db3A091B171A77407Ff7ccf&startblock=0&endblock=99999999&sort=asc&apikey=***) I find that there were no spend transaction because the address only appear in the "to" field and never in the "from" field.

So, I am assuming all the ETH should still be in the same wallet. Their website report there should be at least 3.3M ETH (excluding the first token sale), however https://etherscan.io/address/0xd0a6e6c54dbc68db5db3a091b171a77407ff7ccf shows there are only 31K ETH.

QUESTION: What happened to the other 3.2M ETH tokens? Is there another way to spend/hide/move ETH in a wallet so that it won't register as a public spend transaction?

(DISCLAIMER: I am not trying to cause FUD or promote token sales. I am only trying to understand how the ETH technology work and use the EOS distribution as a real world example.)


texts:
I have been testing the code and for some reason I am having a block. The error is described as "the constructor should be payable if you send value".  The debugger points to "   uint256 weiAmount = msg.value; ".  I've tried putting constructor info in the function, I've tried to change the validation, etc.  Is there something stupid I am missing.  Thank you,  Pete

function buyTokens(address beneficiary) public payable {

  //tokens not to be sent to 0x0
  require(beneficiary != 0x0);

  if(hasEnded() && !isHardCapReached)
  {
      if (!isSoftCapReached)
        refundToBuyers = true;
      burnRemainingTokens();
      beneficiary.transfer(msg.value);
  }
  else
  {
    //the purchase should be within duration and non zero
    require(validPurchase());

    // amount sent by the user
   uint256 weiAmount = msg.value;

    // calculate token amount to be sold
    uint256 tokens = weiAmount.mul(rate);

    require (tokens>=500 * 10 ** 18);

    //Determine bonus
    uint bonus = determineBonus(tokens);
    tokens = tokens.add(bonus);

    //can't sale tokens more than 200000000 tokens
    require(tokens_sold + tokens <= maxTokensForSale * 10 ** 18);

    //30% of the tokens being sold are being accumulated for the Cloudexchange team
    updateTokensForCloudexchangeTeam(tokens);

    weiRaised = weiRaised.add(weiAmount);

    if (weiRaised >= softCap * 10 ** 18 && !isSoftCapReached)
    {
      isSoftCapReached = true;
    }

    if (weiRaised >= hardCap * 10 ** 18 && !isHardCapReached)
      isHardCapReached = true;

    token.mint(wallet, beneficiary, tokens);

    uint olderAmount = usersThatBoughtCXT[beneficiary];
    usersThatBoughtCXT[beneficiary] = weiAmount + olderAmount;

    emit TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);

    tokens_sold = tokens_sold.add(tokens);
    forwardFunds();
  }
 }

  // send ether to the fund collection wallet
  function forwardFunds() internal {
    wallet.transfer(msg.value);
  }

  // @return true if the transaction can buy tokens
  function validPurchase() internal constant returns (bool) {
    bool withinPeriod = now >= startTime && now <= endTime;
    bool nonZeroPurchase = msg.value != 0;
    return withinPeriod && nonZeroPurchase;
  }

  // @return true if crowdsale event has ended
  function hasEnded() public constant returns (bool) {
    return now > endTime;
  }


texts:
i've seen that mining is getting more popular and i thought that i maybe should jump onto the train. So i've already got a 550W power supply from an older build, i can get a Asus P7P550 PRO motherboard and an i5 760 both used for around 100$ and i'm gonna build the case myself. So first question: Do you have any ideas for a better build for ethereum mining? And second question: Which RX gpu is best with the build and for ethereum mining? I'm able to get a RX 470, RX 480, RX 570 and RX 580 all both 4GB and 8GB. But also which BRAND do you suggest would be best for the mining because i've head that the sapphire RX 470 reference design is the best but that's pretty much the only card that's sold out where i live. Is it even worth it mining with one gpu only? And for the last question: Do you think a 14 year old who only have build a gamer rig could be able to build a miner rig like this?

So thanks and have a nice day ;)

EDIT: I also wanna know which gpu uses least electricity because it's quite expensive where i live


texts: Why JUMP opcode costs more than the rest

texts: Looking here, most of the basic opcodes are 3 while JUMP is 8. Wondering why this is, why the 3x multiplier on this instruction.


texts: How does a contract's constructor work and load input values?

texts:
I set up the following contract:

pragma solidity ^0.4.25;

contract Simplest {
    uint x;

    constructor(bool _lucky) public {
        if (_lucky == true) {
            x = 7;
        } else {
            x = 13;
        }
    }

    function view_x() public view returns (uint) {
        return x;
    }
}

with the expectation that the contract would have two different paths depending on what value the user provides in lucky_.

When I compile the contract (using Remix) to the following:

608060405234801561001057600080fd5b506040516020806101068339810180604052810190808051906020019092919050505060011515811515141561004d576007600081905550610056565b600d6000819055505b5060a1806100656000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063a0be66d7146044575b600080fd5b348015604f57600080fd5b506056606c565b6040518082815260200191505060405180910390f35b600080549050905600a165627a7a723058206ff308044f195baf90e204067f39262c537f89c97f293ce31132bfb1d17655c20029

or

PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH1 0x20 DUP1 PUSH2 0x106 DUP4 CODECOPY DUP2 ADD DUP1 PUSH1 0x40 MSTORE DUP2 ADD SWAP1 DUP1 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP PUSH1 0x1 ISZERO ISZERO DUP2 ISZERO ISZERO EQ ISZERO PUSH2 0x4D JUMPI PUSH1 0x7 PUSH1 0x0 DUP2 SWAP1 SSTORE POP PUSH2 0x56 JUMP JUMPDEST PUSH1 0xD PUSH1 0x0 DUP2 SWAP1 SSTORE POP JUMPDEST POP PUSH1 0xA1 DUP1 PUSH2 0x65 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH1 0x3F JUMPI PUSH1 0x0 CALLDATALOAD PUSH29 0x100000000000000000000000000000000000000000000000000000000 SWAP1 DIV PUSH4 0xFFFFFFFF AND DUP1 PUSH4 0xA0BE66D7 EQ PUSH1 0x44 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x4F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x56 PUSH1 0x6C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 DUP1 SLOAD SWAP1 POP SWAP1 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 PUSH16 0xF308044F195BAF90E204067F39262C53 PUSH32 0x89C97F293CE31132BFB1D17655C2002900000000000000000000000000000000

Observation. As you see there is no CALLDATA related op-code in the first part of this contract.

Question. How is the contract able to load the input value for _lucky without looking at CALLDATA? Is the way constructors receive input values different from the way that normal contract functions receive input values?


texts: Calling precompiled contracts from a pure function

texts:
I'm trying to call some of the new precompiled contract (ecmul) from a pure function but it fails with:

browser/ballot.sol:11:23: TypeError: Function declared as pure, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
            if iszero(call(not(0), 0x07, 0, input, 0x60, p, 0x40)) {
                      ^--^

This is the sample contract (requires solc 0.4.19):

pragma solidity ^0.4.19;

contract Ballot {
    function ecmul(uint256 x, uint256 y, uint256 scalar) public pure returns (uint256[2] p) {
        // With a public key (x, y), this computes p = scalar * (x, y).
        uint256[3] memory input;
        input[0] = x;
        input[1] = y;
        input[2] = scalar;
        assembly {
            // call ecmul precompile
            if iszero(call(not(0), 0x07, 0, input, 0x60, p, 0x40)) {
                revert(0, 0)
            }
        }
    }
}

Taken from the article precompiles & solidity.

If I declare the function as view it will work but seems as unnecessary since it is a precompiled contract it should not modify the storage of any contract.


texts: Why I got "execution reverted: Uni::_transferTokens: transfer amount exceeds balance""?

texts:
I tried to make a flashswap on uniswap, below is my code:
contract Flash_swap_arb is Ownable,IUniswapV2Callee{
    using SafeMath for uint256;

    address public my_to_address = 0x194A025C90D384539D05094eC73F21EC5b81b277;
    address public factory;
    address payable public uni_router_add = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
    IUniswapV2Router02 public uni_router;
    //bytes public data;
    address public lastTokenBorrow;
    uint public lastAmount;
    IUniswapV2Router02 public sushiRouter;

    constructor() public{
        factory = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;
        uni_router = IUniswapV2Router02(uni_router_add);
        sushiRouter = IUniswapV2Router02(0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506);
    }

    function flashswap(uint amount0,uint amount1) public  {
        address token0 = 0xc778417E063141139Fce010982780140Aa0cD5Ab;//weth address on Rinkeby
        address token1 = 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984;//uni address on Rinkeby
       // address token1 = 0xc7AD46e0b8a400Bb3C915120d284AafbA8fc4735;//dai
        address pairAddress = IUniswapV2Factory(factory).getPair(token0,token1);
        require(pairAddress != address(0),'There is no such pool');

        IUniswapV2Pair(pairAddress).swap(
            amount0,amount1,address(this),
            bytes('not empty')
            );
    }

    function uniswapV2Call(address sender,uint amount0,uint amount1, bytes calldata _data)external override{
        address[] memory path = new address[](2);
        uint amountToken = amount0 == 0? amount1:amount0;

        address token0 = IUniswapV2Pair(msg.sender).token0();
        address token1 = IUniswapV2Pair(msg.sender).token1();
        address pairAddress = IUniswapV2Factory(factory).getPair(token0,token1);
         require(msg.sender == UniswapV2Library.pairFor(factory,token0,token1),'Unauthorized');
        // require(sender == address(this),'only this contract can arb');
        path[0] = amount0 == 0? token1:token0;
        path[1] = amount0 == 0? token0:token1;
        IERC20 token = IERC20(amount0 == 0 ? token1 : token0);

        token.approve(address(sushiRouter), amountToken);
        lastTokenBorrow = token0;
        lastAmount = amount0;
        uint deadline = block.timestamp + 300;
        uint amountRequired = UniswapV2Library.getAmountsIn(factory,amount1,path)[0];
        uint amountReceived = sushiRouter.swapExactTokensForTokens(
      amountToken,
      amountRequired/10,
      path,
      msg.sender,
      deadline
        )[1];
    require(amountReceived > amountRequired,'No profit to earn');
        IERC20(token0).transfer(pairAddress,amountRequired);
        IERC20(token0).transfer(tx.origin, amountReceived - amountRequired);
       // IERC20(token1).transfer(pairAddress,amountToken);
    }

Now I call the flashswap function along with amont0 = 0 and amount1 = 100000000000000000;
then I got this error:
Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
execution reverted: Uni::_transferTokens: transfer amount exceeds balance { "originalError": { "code": 3, "data": "0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000035556e693a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e63650000000000000000000000", "message": "execution reverted: Uni::_transferTokens: transfer amount exceeds balance" } }" } }

Why is that? What did I do wrong?


texts: How to setup clef signer with clef --stdio-ui

texts:
I have geth running on rinkeby network and successfully used clef as a signer using command.

clef --keystore ~/.ethereum/rinkeby/keystore --chainid 4 --stdio-ui

Also started geth with clef as signer using :

geth --rinkeby --rpc --syncmode "light" --rpcport 8543 --rpcaddr 192.168.0.120 --rpccorsdomain "*" --port "35555" --rpcapi "eth,net,web3,personal,miner,admin" --signer=/home/ayanworks/.clef/clef.ipc

Then I connected geth with rpc using

geth attach rpc:http://192.168.0.120:8543 and hit eth.accounts

After that, on clef terminal, I get the following output.

In this scenario, I am not getting prompt to approve request for y/n on clef terminal.

Please update if I am following the wrong setup steps


texts:
I'm using Truffle and I want to increase the blocktime to mimic that of the mainnet when i run my tests.

As i understand it, Truffle has already instantiated a web3 instance that's ready to use so i tried to modify it with the following in my test file:

const ganache = require('ganache-core')
web3.setProvider(ganache.provider({ blockTime: 15 }))

However each test finishes in less than 200ms.

How would i go about changing the blocktime?


texts:
Cointelegraph has recently written about 'EOA' in relation with contracts and accounts.

  As an EOA, the state simply stores the account's balance in ether and a sequence number is used to prevent transaction replay attacks. On the other hand, it stores the contract's code and its storage in a key-value database.

What is an 'EOA'?


texts: Transaction receipt has contractAddress as null


texts:
I downloaded the 2.2.7 stable binary for Ubuntu from the Parity website. I set it up as a service, using the standard files. I changed nothing. However when I did;

sudo systemctl start parity

It did not start and so I did;

sudo systemctl status parity
● parity.service - Parity Ethereum Daemon
   Loaded: loaded (/etc/systemd/system/parity.service; enabled; vendor preset: enabled)
   Active: failed (Result: start-limit-hit) since Tue 2019-01-29 19:46:01 UTC; 3min 22s ago
  Process: 30492 ExecStart=/usr/bin/parity --config /etc/parity/config.toml (code=exited, status=203/EXEC)
 Main PID: 30492 (code=exited, status=203/EXEC)

Jan 29 19:46:01 ip-172-31-19-123 systemd[1]: parity.service: Service hold-off time over, scheduling restart.
Jan 29 19:46:01 ip-172-31-19-123 systemd[1]: Stopped Parity Ethereum Daemon.
Jan 29 19:46:01 ip-172-31-19-123 systemd[1]: parity.service: Start request repeated too quickly.
Jan 29 19:46:01 ip-172-31-19-123 systemd[1]: Failed to start Parity Ethereum Daemon.
Jan 29 19:46:01 ip-172-31-19-123 systemd[1]: parity.service: Unit entered failed state.
Jan 29 19:46:01 ip-172-31-19-123 systemd[1]: parity.service: Failed with result 'start-limit-hit'.

I thought perhaps it was already running, but that was not the case;

ubuntu@ip-172-31-19-123:~/Parity$ ps auxww | grep -i parity
ubuntu   30506  0.0  0.1  12944  1028 pts/0    S+   19:50   0:00 grep --color=auto -i parity

What does start-limit-hit mean?

I then ran it like this which worked fine. Probably I will just run it like this, and add the line to rc.local which is executed on startup - but I would like to know why the service did not work.

nohup ./parity --light >> parity.log &


texts: Difference between the Gnosis multisig and Gnosis safe?

texts:
What differentiate them? I am looing for a confirmation that the Gnosis safe is the latest and recommended wallet from Gnosis for multisignature.
Web version for both:

Multisig: https://wallet.gnosis.pm/#/wallets
Safe: https://gnosis-safe.io/


texts:
New to solidity programming and I discovered this today at this site:

var contract = new web3.eth.Contract(abi, address);
var batch = new web3.BatchRequest();
batch.add(web3.eth.getBalance.request('0x0000000000000000000000000000000000000000', 'latest', callback));
batch.execute();

Which is great because I have been cutting and pasting a slew of web3 commands in the web3 console.

But I'm not sure how to actually execute a web3.js file containing the batch commands in the web3 console.

Would I say something like ./web3.js?

Not quite sure how to actually run the file containing the batch commands.

Thanks


texts: web3.eth.sendSignedTransaction executed successfully but never any ETH transferred actually

texts:
as you see in below, i the raw transaction has been set by the gas simplify value, the returned value is an implemented transaction hashcode, but never assumed result by this transaction figure out

function sendTransaction(_privateKey,_from,_to,_value)
{
    return new Promise(function(resolve,reject){
    try {
        web3.eth.getBlock("latest", false, (error, result) => {
            var _gasLimit = result.gasLimit;

            web3.eth.getGasPrice(function(error,result){
                var _gasPrice = result;

                const Tx = require('ethereumjs-tx');
                const privateKey = Buffer.from(_privateKey, 'hex')

                var _hex_gasLimit = web3.utils.toHex(_gasLimit.toString());
                var _hex_gasPrice = web3.utils.toHex(_gasPrice.toString());
                var _hex_value = web3.utils.toHex(web3.utils.toWei(_value,'ether'));
                var _trx_count = web3.eth.getTransactionCount(_from);
                var _hex_Gas = web3.utils.toHex('50000');
                const rawTx = {
                    nonce: web3.utils.toHex(web3.eth.getTransactionCount(_from)),
                    to: _to,
                    from:_from,
                    gasLimit:_hex_gasLimit,
                    gas:50000,
                    gasPrice:_hex_gasPrice,

                    value: _hex_value,
                    data: '0x00'
                }

                const tx = new Tx(rawTx);
                tx.sign(privateKey);

                var serializedTx = '0x'+tx.serialize().toString('hex');
                web3.eth.sendSignedTransaction(serializedTx.toString('hex'),function(err,hash){
                    if(err)
                    {
                        resolve(err);
                    }
                    else
                    {
                        resolve('Txn Sent and hash is '+hash);

                    }
                });
            });
        });
    } catch (error) {
        resolve(error);
    }
})}

here is a returned transaction hash code

  0xa1338065afcfa20e4062a25892d79ad7137af2b631fc15c4a37977938562396c


texts:
I want to add a thing to my contract where every 10minutes all the ETH from a contract is sent to my wallet.
I don't know how to do it. Any help appreciated


texts: Solidity how to check if user is already used another contract?

texts:
I am trying to figure out how to set up a simple communication between contracts.

For example, we have a contract Passport, in which the user writes his data. After that, through the Election contract, the user votes. The contract Election should check if the user has a passport and only then allow him to vote.

Here is how I am trying to do it:

Passport contract

contract Passport
{
    struct      Person
    {
        string  name;
        string  surname;
        uint8   age;
        uint256 id;
        bool    registered;
    }

    address payable public              owner;
    mapping(address => Person) public   people;
    uint256                             idCount;

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

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

    function registerID(string memory _name, string memory _surname, uint8 _age) public
    {
        require(!people[msg.sender].registered);

        people[msg.sender].name = _name;
        people[msg.sender].surname = _surname;
        people[msg.sender].age = _age;
        people[msg.sender].id = idCount;

        people[msg.sender].registered = true;

        idCount += 1;
    }

    // I use this function to check is the user have passport
    function isRegistered(address _address) public view returns (bool)
    {
        return people[_address].registered;
    }

    function end() ownerOnly public
    {
        selfdestruct(owner);
    }
}

Election contract

contract Election
{
    struct      Candidate
    {
        string  name;
        uint    voteCount;
    }

    struct      Voter
    {
        bool    authorized;
        bool    voted;
        uint    voteTarget;
    }
    address payable  public             owner;
    string public                       electionName;
    mapping(address => Voter) public    voters;
    Candidate[] public                  candidates;
    uint public                         totalVotes;
    Passport                            pass;

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

    constructor(string memory _electionName) public
    {
        owner = msg.sender;
        electionName = _electionName;
    }

    function addCandidate(string memory _candidateName) ownerOnly public
    {
        candidates.push(Candidate(_candidateName, 0));
    }

    function getNumCandidate() public view returns(uint)
    {
        return candidates.length;
    }

    function authorize(address _person) public
    {
        voters[_person].authorized = true;
    }

    function vote(uint _voteIndex) public
    {
        // Here I register pasport with current user address
        pass = Pasport(msg.sender);

        // Here I check if the user already have pasport
        require(pass.isRegistered(msg.sender));

        require(!voters[msg.sender].voted);
        require(voters[msg.sender].authorized);

        voters[msg.sender].voteTarget = _voteIndex;
        voters[msg.sender].voted = true;

        candidates[_voteIndex].voteCount += 1;
        totalVotes += 1;
    }

    function end() ownerOnly public
    {
        selfdestruct(owner);
    }
}

What is the correct way to check if a user is already used another contract? Because mine always gives false. And I can't find the way to do it properly.


texts: Every time I enter truffle migrate command in the terminal it doesn't do anything but takes some time and nothing happens after that. I am using Truffle version 5.0.4


texts:
I was testing on (Ropsten) Myetherwallet, everything was fine yesterday morning, then that evening, my balances (Ropsten Ether and Tokens) would not show.  I was getting
"(error_21) Not a valid ERC-20 token" for the tokens.

I checked my balances and transactions on etherscan and they were all there.

So I read the FAQ for Myetherwallet and it said to try swapping to another node, so I tried other nodes infura(Ropsten)  and the balances showed again.

My question is why are they not showing in (Ropsten)Myetherwallet node but showing under the infura node even though it was setup under the (Ropsten)Myetherwallet node?

Anybody else seen this problem? Or can explain?   Do people have this problem with the Trust and Coinbase ECR-20 wallets?


texts:
When executing this function, I get an error gas required exceeds allowance (8000029) or always failing transaction i know that this error have when use transferFrom function. Where i wrong? help me please. thanks.

edit: walletOfGoods[msg.sender][_nameOfgood].price  it is element of struct, type uint.
walletOfGoods it is struct where i save amount of goods. Struct contain is uint amounOfgood and uint price.
i use ropsten test

contract TRC20{
     event Approval(address indexed _owner, address indexed _spender, uint256 value);

     function approve(address _sender, address _spender, uint256 _value) public returns (bool success){
         allowance[_sender][_spender] = _value;
         emit Approval(_sender, _spender, _value);
         return true;

     }
     function transferFrom(address _from, address _to, uint256 _value) public returns(bool success){

         require(_value<= allowance[_from][msg.sender]);
         _transfer(_from, _to, _value);
         return true;
 }
    function _transfer(address _from, address _to, uint _value) internal{

       //require(_to!=0x0);
       require(balanceOf[_from]>=_value);
       require(balanceOf[_to] + _value>=balanceOf[_to]);
       uint previousBalances = balanceOf[_from] + balanceOf[_to];

       balanceOf[_from] -= _value;
       balanceOf[_to] +=_value;
       emit Transfer(_from, _to, _value);
       assert(balanceOf[_from]+balanceOf[_to]==previousBalances);

}

function saleOfGoods(string memory _nameOfgood, uint _amountOfgood) public{

   trc20 = TRC20(address(0x235F857D7947b9bC5Dc73f489B70Ef870e6263ed));

   walletOfGoods[msg.sender][_nameOfgood].amountOfgood = walletOfGoods[msg.sender][_nameOfgood].amountOfgood.sub(_amountOfgood);

   trc20.approve(address(0xeBa84a3f7d8d70955bEFF633098D8d6A3a6c18e5), msg.sender, walletOfGoods[msg.sender][_nameOfgood].price);

   // Move to tokens to contract address
   trc20.transferFrom(address(0xeBa84a3f7d8d70955bEFF633098D8d6A3a6c18e5), msg.sender, walletOfGoods[msg.sender][_nameOfgood].price);

   }


texts: What units of ether does ethereumjs-tx use

texts: Trying to follow this example 100 wei seems very low for the gas price. Is it using a different unit? I'm also slightly unsure if the value should be hex or decimal, or if it accepts both


texts: Can't set gas limit for oraclize callback function higher than the default 200000

texts:
Could you please help me with the following.
I am using OraclizeIt (https://github.com/oraclize/ethereum-api) to retrieve a JSON  from some other service via REST. Basically the smart contract method in question is simply

function update(uint24 id) {
        oraclize_query("URL", "json(bla-bla-bla).0.parameters", 200000);
}

Third parameter (here 200000) is a gas limit for oraclize callback function. And i can't seem to set it higher than 200000 which is its default value. If i attempt to set it to a higher value lets say 250000 i inevitably get an error in the transaction which says "Warning! Error encountered during contract execution [Bad instruction] "  and nothing else to go on even though i don't really have my own instructions only what Oraclize implements in their contract.I can't use default 200000 either because it's not enough for my callback i need to set the gas limit higher. I used ethereum-bridge(https://github.com/oraclize/ethereum-bridge) at first and testRPC then i moved to ropsten. The error persists. Maybe somebody could point me where to look and what might cause this.


texts: Error: `Invalid JSON RPC response` when running estimateGas on Infura

texts:
Why am I getting an error when doing a gas estimation on infura. I am using web3 v1.0 and here is my code:

let Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider('http://ropsten.infura.io/key'));

const account = '0x5561E1e11199317E2186.....';
const contractAddress = '0x72A0411ee2f3.....';

var tokenizeContract = new web3.eth.Contract( [ ...abi... ], '0x72A0411ee2f328E34AB8DE74e51820bC257ccDE5' );

const contractFunction = tokenizeContract.methods.setOrder(web3.utils.toHex('location'), web3.utils.toHex('productName'), web3.utils.toHex('customer'), 3000, 2, 6000, web3.utils.toHex('timestamp'));

contractFunction.estimateGas(function(error, gasAmount) {
    if(!error) {
        console.log(gasAmount);
    }
    else {
        console.log(error);
    }
});

This is the error:

Error: Invalid JSON RPC response: ""
    at Object.InvalidResponse (/home/user/code/project_poc/node_modules/web3-core-helpers/src/errors.js:42:16)
    at XMLHttpRequest.request.onreadystatechange (/home/user/code/project_poc/node_modules/web3-providers-http/src/index.js:73:32)
    at XMLHttpRequestEventTarget.dispatchEvent (/home/user/code/project_poc/node_modules/xhr2/lib/xhr2.js:64:18)
    at XMLHttpRequest._setReadyState (/home/user/code/project_poc/node_modules/xhr2/lib/xhr2.js:354:12)
    at XMLHttpRequest._onHttpRequestError (/home/user/code/project_poc/node_modules/xhr2/lib/xhr2.js:544:12)
    at ClientRequest.<anonymous> (/home/user/code/project_poc/node_modules/xhr2/lib/xhr2.js:414:24)
    at ClientRequest.emit (events.js:180:13)
    at Socket.socketErrorListener (_http_client.js:395:9)
    at Socket.emit (events.js:180:13)
    at emitErrorNT (internal/streams/destroy.js:64:8)
    at process._tickCallback (internal/process/next_tick.js:178:19)


texts: Why is my balance not equal to the sum of inbound, minus the sum of outbound and fees?

texts:
I expect to be able to calculate the balance of an account in this way: add up the value on all the incoming transactions, and subtract the value on all the outgoing transactions, then subtract all the fees paid.

When I use this method, though, I get a different balance from several other sources, like: eth.getBalance(account) and Etherscan. Why?

An Example

I picked a random account that has this "issue."

All account transactions:

Let's rewrite these transaction values...

in python code:

inbound = ['10']
outbound = ['9', '0.92']
paid_fees = ['0.00045932', '0.010846898028', '0.00084084']

Account Balance:

So when we calculate the sum, I expect to get the same as the balance that Etherscan shows:

Instead, I get Decimal('0.067852941972') from the following calculation:

from web3 import Web3

total = sum(Web3.toWei(income, 'ether') for income in inbound)
for ether_spent in outbound + paid_fees:
    total -= Web3.toWei(ether_spent, 'ether')

total_ether = Web3.fromWei(total, 'ether')
print(total_ether)

What is this dark magic?

Did this account generate Ether out of thin air?


texts: Why is mining not working/very slow in my testnet?

texts:
I created a testnet to allow faster smart contract testing (I don't want to use Truffle for now). My genesis file is

{
    "config": {
        "chainId": 15,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },
    "difficulty": "200000000",
    "gasLimit": "2100000",
    "alloc": {
        "7ca3a0da3345506f15c603eba011c8f354155ee9": { "balance": "400000000000000000000000000" }
    }
}

It is based on this tutorial. I am starting geth with

geth --identity "test" --rpc --rpcport "8545" --rpccorsdomain "*" --datadir ~/Desktop/private/datadir --port "30303" --nodiscover --rpcapi "db,eth,net,web3,personal" --networkid 1999 --mine --minerthreads=1 --etherbase=0x7ca3a0da3345506f15c603eba011c8f354155ee9 --unlock="0x7ca3a0da3345506f15c603eba011c8f354155ee9" console

I then created a new account and sent 1 ETH from 0x7ca3a0da3345506f15c603eba011c8f354155ee9 to my new account getting the following message as confirmation.

> INFO [07-31|22:46:56] New wallet appeared                      url=keystore:///Users/mcansado… status=Locked
INFO [07-31|22:46:56] Submitted transaction                    fullhash=0x46b9c5c2a739a0e314d74b53158475b1686a196670d58a948332d3cdacf92d4b recipient=0x1918ced27804f6b83acf0587a81e9f56020620d1
INFO [07-31|22:47:29] Successfully sealed new block            number=2 hash=698a9b…8acfe8
INFO [07-31|22:47:29]  mined potential block                  number=2 hash=698a9b…8acfe8
INFO [07-31|22:47:30] Commit new mining work                   number=3 txs=1 uncles=0 elapsed=47.741ms

But the balance in the new account does not change. What am I doing wrong?


texts: amount of gas used in receive and fallback functions in truffle tests

texts:
I have a contract that is written in solidity ^0.6.4 and has a simple implementation of reverting funds when someone directly transfers some eth or calls an unhandled function. Now it appears to be working but I wanted to test it by checking the balance of the account that calls it my truffle tests. I know that there are some amount of gas being used when calling these methods but how can I get the exact amount of gas being used in a reverted call?
The way I am trying to test it is by assuming that the current balance of the caller should be its balance before the call deducted by the amount of gas used(I have written a function that would multiply gasUsed by gasPrice).
contract code :
receive() external payable {
        require(false , "Direct fund transfer must be reverted.");
    }

    fallback() external {} //not payable so that unhandled function calls will revert.

Unit test :
    describe('receive and fallback',async () => {
        before(async () => {
            this.originalBidder1Balance = await balance.current(bidder1);
        })

        it('any empty calldata with value > 0 should be reverted', async () => {

            let marketplaceAddress = this.marketplace.address
            await expectRevert(
                this.marketplace.sendTransaction({from : bidder1, value : this.platformReserveInWei}),
                "Direct fund transfer to token must be reverted."
            );

        })

        it('funds must be reverted too', async () => {

            const tx = await this.marketplace.sendTransaction(
                 {from : bidder1, value : this.platformReserveInWei}
            ); // will revert here

            this.bidder1GasCosts = await getGasCosts(tx);
            let bidder1Balance = await balance.current(bidder1);

            expect(bidder1Balance).to.be.bignumber.equal(this.originalBidder1Balance.sub(this.bidder1GasCosts));
        })

    })

    async function getGasCosts(receipt) {
        const tx = await web3.eth.getTransaction(receipt.tx);
        const gasPrice = new BN(tx.gasPrice);
        return gasPrice.mul(new BN(receipt.receipt.gasUsed));
    }

I am using openzeppelin's test helpers. By the way is this a good practice that I used in receive() ? reverting everything I mean.
Thanks a lot.


texts: Transaction confirmation time with proof of stake

texts:
With proof of work and the associated mining process, transactions must wait till the block verifying the said transaction reaches enough depth within the blockchain to avoid relying blocks generated by an attacker who may have succeeded in creating a temporary fork in the blockchain.

This typically means waiting for several minutes to gain enough confidence that a transaction was genuine.

Is a similar confirmation time required in when consensus is reached using proof of stake rather than proof of work?


texts: Default Value for gas in sendTransaction

texts:
What is the default value for gas in sendTransaction api? Suppose I don't specify gas parameter in the sendTransaction api, what will be used?

Also, will this vary if it is a contract transaction instead of normal ether send transaction?


texts: The gas-cost of a static-call of a pure function

texts:
A pure function doesn't cost anything when called from an off-chain script (or from some other constant function).
But it does cost when called from a transaction (i.e., from a non-constant function).
I would like to measure this gas-cost, specifically for a pure function which does nothing but returning true.
Here is my Solidity code:
pragma solidity 0.4.26;

contract Tested {
    function func() public pure returns (bool) {
        return true;
    }
}

contract Tester {
    bytes4 private constant FUNC_SELECTOR = bytes4(keccak256("func()"));

    function test(uint256 _gas, address _tested) public view returns (bool) {
        bool success;
        uint256[1] memory ret;
        bytes memory data = abi.encodeWithSelector(FUNC_SELECTOR);

        assembly {
            success := staticcall(
                _gas,          // gas
                _tested,       // destination address
                add(data, 32), // input buffer (starts after the first 32 bytes in the `data` array)
                mload(data),   // input length (loaded from the first 32 bytes in the `data` array)
                ret,           // output buffer
                32             // output length
            )
        }

        return success && ret[0] != 0;
    }
}

And here is my Truffle test:
contract('Test', () => {
    it('test', async () => {
        const tester = await artifacts.require('Tester').new();
        const tested = await artifacts.require('Tested').new();
        console.log();
        console.log(await tester.test(189, tested.address)); // prints 'false'
        console.log(await tester.test(190, tested.address)); // prints 'true'
    });
});

As you can see, this test shows that the gas-cost is 190.
Of course, in the real contract, I hard-code this value, and I would like to keep it as low as possible in order to avoid spending all the gas when staticcall fails.
For example:
contract Tested1 {
    function func() public pure returns (bool) {
        return true;
    }
}

contract Tested2 {
    function() external payable {
        assert(false); // will consume the remaining gas
    }
}

Let's add a gas-measurement function in contract Tester:
    uint256 public gasUsed;

    function measureGas(uint256 _gas, address _tested) public returns (bool) {
        uint256 gasLeft = gasleft();
        bool result = test(_gas, _tested);
        gasUsed = gasLeft - gasleft();
        return result;
    }

And let's measure the gas-cost of each case:
contract('Test', () => {
    it('test', async () => {
        const tester = await artifacts.require('Tester').new();
        const tested1 = await artifacts.require('Tested1').new();
        const tested2 = await artifacts.require('Tested2').new();
        const gasUsed1 = await gasUsed(tester, 100000, tested1);
        const gasUsed2 = await gasUsed(tester, 100000, tested2);
        console.log();
        console.log('gasUsed1 =', gasUsed1.toString());
        console.log('gasUsed2 =', gasUsed2.toString());
    });
});

async function gasUsed(tester, gas, tested) {
    await tester.measureGas(gas, tested.address);
    return await tester.gasUsed();
}

The results on ganache-cli are:

gasUsed1 = 1299
gasUsed2 = 101095

For the first case, I assume that 1299 is the sum of:

190 for the pure function
700 for staticcall itself (see this EIP)
A few minor things before and after calling gasleft

As you can see, the second case has depleted the entire amount of gas passed to staticcall.
Therefore, I would like to keep this amount to the minimum required for the pure function to complete successfully.
Do I have anything to worry about in setting it to 190? Is there any chance that this will be different depending on the contract deployment address, its bytecode (i.e., the existence of other functions in it), or even future forks in the network?
Thank you!


texts: What is the best way for my Dapp users to not pay gas fees?

texts:
I'm building a React/NodeJS Dapp for people who just have an email address and nothing more (no Ethereum address (and so no gas), no MetaMask, no Eth Wallets, etc..)

An address is created during the registration step, but gas is needed for that x)

I'm thinking about those two options:

The user could set the gasPrice to 0.
Although this transaction would most likely not be picked up by the miners, the Dapp provider could mine all transaction going to his address.
Stringify and store transactions data got with web3 getData() method and run them later with the Admin Eth Wallet address.

I can't see other ways.

If you guys have ideas, please share.


texts:
My question is mainly to know if what I want to achieve is possible or not, unfortunately I cannot find (understand?) my answer elsewhere.
I have no experience with Solidity, and very little with Ethereum, I just managed to call a function from a smart contract in a transaction with an ETH client (go-ethereum). I have not deployed the contract, it is a public DeFi smart contract.
So far, I've successfully called a function from the smart contract with its parameters and get its response.
The goal is to call several functions, simultaneously but in a defined order, each with its own parameters, from the same smart contract, and ideally in the same transaction.

Is it possible to call multiple functions (with parameters) and get all responses within one single Ethereum transaction ?

If not, is it possible to do it by another way, like deploy my own smart contract to do the job ?

Is there a way to guarantee the order in which these functions will be executed by the smart contract (I mean the final target smart contract, not mine if I ever need to deploy one) ?

To reach this goal, is there a directly related question or potential solution that I would not have thought of ?


texts:
Yesterday my metamask wallet disappeared and was no longer connected to exchanges it was connected to. I've tried everything I could google or youtube to recover my wallet..nothing has worked. PLEASE HELP
I use chrome browser I uninstalled then installed metamask. it asked if i wanted a new wallet I declined and elected to put in my 12 word seed phrase (skipping a space between words)it told me seed phrase was invalid so i tried without skipping a space then put in a new password and checked the "agree to terms box. However, the blue Import button didn't light up. I tried this several times with no success. In desperation I have created another Metamask wallet on Chrome to see if I could recover my old wallet. This didn't help and now i feel as though I mat have made matters worse? I contacted via email Metamask support but have not heard back. Could anyone give me some advice please and thank you!


texts: Please help. I accidentally sent ETH to the GTH contract address

texts:
Last night I accidentally sent ETH to the GNT contract address (owing to the fact that the address was on my  clipboard last and my old android phone that I have one of my wallets on did not copy the wallet address correctly), yet received this message in response from the Golem Team when I inquired about a potential solution: "Dear Benjamin, I am sorry, but there is no way we could help you. The GNT contract (which had been deployed on Ethereum blockchain before the crowdfunding) does not give use any technical possibilities to send GNT from the contract address." When I then replied that this could not be, I then received this second email: "Dear Benjamin, unfortunately, we are not able to access the tokens you sent as well. This is how the smart contract is structured. Technically no way to send tokens from this address."

Is this true? Are they telling the truth or just don't want to help?

Thank you all in advance!


texts: How to find the Bytecode of Ethereum Smart Contract by just it's address using JSON RPC

texts:
I am wondering that is there any way to find the byte-code of the Smart Contract which is published on a blockchain just by having only idea about it's contract address using JSON RPC running at 8545 port?

I was thinking to use eth_getStorageAt and bruteforce the value of the block. But, it is not working well.

Is there any other way to do it?


texts: How do I bind geth to a specific network interface?

texts: Currently geth listens on all interfaces (0.0.0.0:30303). I need to bind the main port 30303 to only a specific network interface in the device, which would normally be accomplished by specifying a local source IP address to bind to. Can this be accomplished?


texts:
My dapp which is currently testing on ropsten works perfectly when i run the frontend from local but dosent return addresses when i run on a digital ocean server. it is successfully connected to ropsten which i determined using a console log but it dosent return any  of the addresses so im guessing there is some issue with metamask or web3 with digital ocean.
Has anyone else come across the same?


texts:
I am trying to run "truffle init" in the empty directory, facing the following error.

/usr/local/lib/node_modules/truffle/build/cli.bundled.js:26041
  return new Promise((resolve, reject) => {
                                        ^
SyntaxError: Unexpected token >
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

Can someone please help? thanks in advance!

[EDIT]
After running "npm install -g truffle@latest" , got the following error:

/usr/local/lib/node_modules/npm/bin/npm-cli.js:79
  let notifier = require('update-notifier')({pkg})
      ^^^^^^^^
SyntaxError: Unexpected identifier
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3


texts:
I am trying to use truffle.js and the testnet. I want to test using Kovan an Ropsten. Here is the doc from truffle -

networks: {
  "live": {
network_id: 1, // Ethereum public network
// optional config values
// host - defaults to "localhost"
// port - defaults to 8545
// gas
// gasPrice
// from - default address to use for any transaction Truffle makes   during migrations
  },
  "morden": {
   network_id: 2,        // Official Ethereum test network
host: "178.25.19.88", // Random IP for example purposes (do not use)
port: 80
 },
  "staging": {
network_id: 1337 // custom private network
// use default rpc settings
  },
  "development": {
    network_id: "default"
 }

}

But it does not state about Kovan or what should be used for the host IP address. Does anyone have any details about this?

I am trying to use -

truffle migrate --network kovan

I have ubuntu 14.04 and the latest truffle (3.x) and the latest geth.

Any help is appreciated.


texts: How to do the Smart Contract Storage Migration using Quorum?

texts: I wrote one smart contract without upgradable logic, now I want to update the same smart contract with some changes. Is it possible to copy the data from old contract storage to a new one?


texts: How does bitrex transfer ethereum coins to ETC and viceversa

texts:
I am not sure if this is the right SE site to ask this question. If it is not please suggest a forum.

If I have go ethereum and ethereum classic nodes & their respective wallets running on my server, is it possible for me to transfer/ convert one cryptocurrency to another?
How does exchanges like Bittrex allow sell and buy different coins?


texts: Which is the best Ethereum solution for small day today transaction? Like a asset exchange for $1-2

texts:
Building a portal where customer can rent out asset for the cost of $1-2.
Is there any platform with low transaction cost but still make all the entries in the ledger?


texts:
I am implementing a simple smart contract in Solidity 0.5.9. One of the functions is called getSummary() which basically returns a summarized version of a vote:

function getSummary() public view returns (uint, uint, uint, address, bool) {
    return (
        reward,
        choices.length,
        votersCount,
        manager,
        pollActive
    );
}

I test this in Remix and get the results as I expect:

0: uint256: 9000000000000000
1: uint256: 2
2: uint256: 0
3: address: 0x1d174c79A9Fc825F2d625adEAa7035381D3a413e
4: bool: true

So far so good.

Now, I am working on a simple JavaScript frontend to display these results to the user, using web3-1.0.0, however I get the results in a weird format:

0: {…}

_ethersType: "BigNumber"

_hex: "0x1ff973cafa8000"

<prototype>: Object { fromTwos: fromTwos(), toTwos: toTwos(), abs: abs()
, … }

1: {…}

_ethersType: "BigNumber"

_hex: "0x02"

<prototype>: Object { fromTwos: fromTwos(), toTwos: toTwos(), abs: abs()
, … }

2: {…}

_ethersType: "BigNumber"

_hex: "0x00"

<prototype>: Object { fromTwos: fromTwos(), toTwos: toTwos(), abs: abs()
, … }

3: "0x1d174c79A9Fc825F2d625adEAa7035381D3a413e"

4: true

It looks like the Boolean and the Address are being returned in the correct format, whereas the integers are being returned as objects with the _hex property. I am pretty sure that I am seeing this for the first time and if I recall correctly, I haven't encountered such issue with previous smart contracts.

What am I doing wrong? Is this the expected behaviour? If yes, how can I correctly cast uint values from Solidity to display correctly on the frontend.

PS: I tried using web3.utils.toAscii(val) but values were transformed into funny characters, not to mention that this seems like a poor hack to do on every value I return.


texts:
I have this solidity event :

 event ValidateData(
       address professorAddr,
       address studentAddr,
       bytes32 data
    );

in Javascript I want watch the event only when the professorAddr belongs to me.
so I did:

    const skillsEvent = Coursetro.ValidateData({professorAddr: "0xad170bb838d6bb3cc35bc3e278f3d44852f3470a"});
  skillsEvent.watch(function(error, result){
        if (!error)
        {
            console.log(result.args);
        } else {

            console.log(error);
        }
    });

but I receive all events even the professorAddr is different to the parameter


texts:
I want to uninstall my geth, but I can't. How could I do it

Also, if I'd like to update my geth version, how could I do it?

Edit (added info according to the comment of @Ismael)
I'm using Ubuntu 16. I installed it from PPA, executing these commands:

sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum


texts: Blind Auction: Reveal>>>How to successfully fill data fields

texts:
http://solidity.readthedocs.org/en/latest/solidity-by-example.html#id2

Not confident in how to "blind" a secret and reveal it.

Using http://emn178.github.io/online-tools/keccak_256.html for the hash.

I'm putting '1', 'false' and random 32 bytes '11010011 00100010 00100000 11000000 11101010 00011111 01010010 00010101 00011100 11010110 10001010 00010011 01110110 00001101 01101110 00101100 10010101 11101110 10111100 01101100 00000111 11110011 00110000 11010000 00110011 10101001 01001000 10001110 00010110 00111100 00100110 01101001' in the hash function. Do I separate them with a comma?

No comma: 33b89b39e82f5e40c4fae965c0cefb1d205a86d5ef3136c9b591bbc6815b647c

Comma separation: 33b89b39e82f5e40c4fae965c0cefb1d205a86d5ef3136c9b591bbc6815b647c

/// Place a blinded bid with `_blindedBid` = sha3(value,
/// fake, secret).
/// The sent ether is only refunded if the bid is correctly
/// revealed in the revealing phase. The bid is valid if the
/// ether sent together with the bid is at least "value" and
/// "fake" is not true. Setting "fake" to true and sending
/// not the exact amount are ways to hide the real bid but
/// still make the required deposit. The same address can
/// place multiple bids.

function bid(bytes32 _blindedBid)

Now when I try to reveal I enter:

values - uint256[]: 1

 fake - bool[]: false

secret - bytes32[]: 11010011 00100010 00100000 11000000 11101010 00011111 01010010 00010101 00011100 11010110 10001010 00010011 01110110 00001101 01101110 00101100 10010101 11101110 10111100 01101100 00000111 11110011 00110000 11010000 00110011 10101001 01001000 10001110 00010110 00111100 00100110 01101001
send ETHER: 1

/// Reveal your blinded bids. You will get a refund for all
/// correctly blinded invalid bids and for all bids except for
/// the totally highest.

function reveal(uint[] _values, bool[] _fake, bytes32[] _secret)

But I am getting: "Data can't be executed, so it will use all provided gas" error.

Any thoughts?

Edit: Ok since the entry fields are arrays I needed [] around the entries.  Still now bytes32 isn't working.  I changed it to uint and it seems to work so I guess I'm still not understanding the nature of the data?


texts: I have a method that can return data from a struct that might contain a 0 address 0x0000000000000000000000000000000000000000. Is there a way to check for this address using web 3? I know there is web3.isAddress but I would think this would return true for a valid address.


texts: Assert.equals() weird behavior does not recognize (apparently) equal strings

texts:
I'm facing problems related to string comparison using Assert.equals() provided by remix_tests.sol.

I made a toy contract and a related test to show what the problem is:

https://gist.github.com/brunoarruda/0cf813ee5aefe60427b5788e0489782e

When I run that test on Remix IDE with Solidity v0.5.1+commit.c8a2cb62, the last Assert comparing a string and another one built from its bytes32 counterpart does not pass. I put both strings inside assert message to see what was compared and the output is:

browser/test1_test.sol
1 failing

test_1 - Test user adding
Alice and Alice are not the same.

So, someone knows what is happening and how to make the string comparison work??

I tried to look for remix_tests.sol source code to study what was going on but I couldn't find it anywhere.


texts:
I am using ethLogFlowable to subscribe to an event and read the args of the event, in my case an address and a uint256 value.

I have followed this answer stackExchangeLink, but I am always getting only one element from topics which is the my-event-hash.

Here is my code:

        filter.addSingleTopic(my_event_hash);
        MainActivity.web3j.ethLogFlowable(filter).subscribe(log -> {
                System.out.println("Event equal "+log);
             Address arg1 = (Address) FunctionReturnDecoder.decodeIndexedValue(log.getTopics().get(1), new TypeReference<Address>() {});
            System.out.println("----ARG1: "+arg1);

        });

The application crash as log.getTopics contains only one element hash_event

Any idea? please.


texts: How do you handle a non-deterministic change during smart contract execution?

texts:
I read the following E-SO post and also several threads on Ethereum/Solidity forums regarding smart contracts and external servers (anything involving a socket):

Why can't contracts make API calls?

I understand that the idea is to maintain deterministic code and accessing an external server breaks that covenant.  I also understand that it creates a security or logistics problem when it comes to smart contract code making socket calls.

Can someone tell me then how you would handle a scenario like the following?

Suppose a smart contract is involved with the transfer of an asset like a real estate deed or title, held in escrow until the conditions of the smart contract are fulfilled.

Suppose midway through the contract, it is discovered that the land deed is fraudulent.  What I can't fathom is how to write a smart contract that doesn't interact with an external server, that can check for that invalidation condition mid-execution before fulfilling the contract?

I've heard people mention Oracles but I still haven't seen a document that describes a concrete way to handle the very real life circumstance I just described.  Said more abstractly, any real life circumstance that occurs during the execution of a smart contract that essentially invalidates the transaction.  Techniques anyone?


texts: How to make a multiplication and division without overflow and any loss of precision in Vyper

texts:
How can I calculate X * Y / Z in vyper uint256 without overflow and any loss of precision?
I want to build Vyper FullMath library functions similar to the Uniswap V3 FullMath library written in Solidity.
X * Y is definitely bigger than 2 ** 256 but the result will be in uint256 range.


texts: ERROR: Provided address "6.963865902119903e+47" is invalid

texts:
Full error log:

formatters.js:471 Uncaught Error: Provided address "6.963865902119903e+47" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.
at Object.inputAddressFormatter (formatters.js:471)
at Object.set [as address] (index.js:92)
at Contract (index.js:296)
at new Contract (index.js:273)
at index.html:23

I get this error when I try to run index.html in my Chrome browser. I expect it has something to do with the fact that this code is copied from this tutorial which is about 1.5 years old.

Here is my directory


texts:
I'm trying to understand how mappings work. I've never seen anything like it before, but I'm sure many languages use something similar.
Anyway, here's my code:

What am I doing wrong here?
Thank you!


texts: Can I use EthereumJS testrpc with ethjsonrpc (python) to test my contract localy?

texts:
As far as I understand EthereumJS can simulate a client on a simulated blockchain and provide RPC interface (hope I'm  using the right words). Does it mean I can interact with this client (and with my contract in simulated blockchain) with ethjsonrpc?

Related:

How to unit test smart contracts
A 101 Noob Intro to Programming Smart Contracts


texts: Creating a contract at address in web3 pre-beta?

texts:
I know the web3 beta version way to create a contract is

var myContract = new web3.eth.Contract([abi], 'createAtAddress'});

However, I want to use a stable version of web3 and I've been using

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

var myContract = web3.eth.contract([abi])
var contractInstance = myContract.at('0x486351a2b3f3f63c04aeec19281cc7293cab8337');

However with this, I can only interact with a preexisting contract. How can I create a new contract at a certain address?

The docs say

var contractInstance = MyContract.new({from: 'createAtAddress, gas: 1000000});

but for some reason that doesn't work.


texts: Problem getting 'Normal' Transaction records from Etherscan.io API

texts:
I am using the "Get a list of 'Normal' Transactions By Address" method from the Etherscan.io API. The problem is that the results from the API are different than from results from the 'Download CSV export' you get on the this page.
https://etherscan.io/address/0xCeB4d0CA821420Cf2553b9e244F6B52364613F94
Link to the API:
https://etherscan.io/apis#accounts
For this address:
0xCeB4d0CA821420Cf2553b9e244F6B52364613F94
The API Get request:
https://api.etherscan.io/api?module=account&action=txlist&address=https://etherscan.io/address/0xCeB4d0CA821420Cf2553b9e244F6B52364613F94&startblock=0&endblock=99999999&sort=asc&apikey=YourApiKeyToken
The problem is that the 'value' does not match the 'Value_IN(ETH)' when downloading the data as a .csv file.
In the .csv file the results look like:
Txhash: 0x1f55419fa826e9d9b5487ce745f22c0d6066cf8da8e02bb84a105f6fcf34f8e2
Value_IN(ETH) : 0.0500459770509325
The .csv file is correct. That is what happened with that wallet there.
However in the .json object returned from the API call I get these results:
hash : '0x1f55419fa826e9d9b5487ce745f22c0d6066cf8da8e02bb84a105f6fcf34f8e2'
value : '50045977050932511'
I don't understand why these values are different. Is it something in the encoding that I am missing?


texts: WINDOWS - Geth rinkeby account balance 0 when the balance has 9+ Ether

texts:
So I've been using geth on windows in order to deploy my truffle project on the rinkeby testnet using an account where I have 9+ ether.

To get in sync with the chain I used (I previously added my account by using ./geth --rinkeby import account /pathoffile.txt):

./geth --rinkeby --rpc --rpcapi="db,eth,net,web3,personal" --unlock="0x940c04c8d13b7abfd4704fe8a55794f0d5d48827"

So geth got in sync with the chain and I unlocked my rinkeby account that has the current balance (FYI that contract deployement was through remix nothing to do with the rest):
Metamask balance

But when I use the console to check the balance with :

./geth --rinkeby attach ipc:\\.\pipe\geth.ipc

and later using

eth.getBalance(eth.accounts[0])

I get a balance of 0 ...

I initially checked this because when I tried deploying my contract from truffle it said the gas limit has been exceeded but then I saw that the account that it was referencing had a balance of 0 so It could be because of that.

I could really need some help please, did I do somthing wrong ?


texts: What is the meaning of this error: You are not connected to any peers. There is most likely some network issue. Fix connectivity

texts: I am getting following error in parity ui. how to fix it.


texts: Best tutorial for developing Daaps that work with Metamask?

texts: I have my smart contract deployed and all I need to do now is build a convenient UI that works with Chrome and Metamask. My benchmark Dapp is Etherdeta which was build using nothing but jquery. What is a good tutorial that walks me through the basics?


texts:
It is a well known fact that in optimizing mode compilers usually have more bugs than in non-optimizing mode.

As such, do you recommend to use the Solidity compiler with or without optimization? My contract is not particularly computationally expensive.

Also, Ethereum Wallet does not have "optimization" checkbox. Does it call the compiler in optimizing or non-optimizing mode?


texts: I am having problems getting Mist to sync, so would like to run geth --fast.  I can not find the folder to run geth from?  Do I need to install it separately, I thought it was bundled with Mist?  I am new to terminal so some basic instructions would be appreciated. Any help would be appreciated.  I am running OS X 10.11.4 and Ethereum-Wallet-macosx-0-7-2.


texts:
Please stop me if I am wrong.
When we call any "state-changing" function of smart contract, this function will be run by all the miners of the mainnet. As a caller, I need to pay this using the ether and whenever I use the metamask, it estimates how much it will cost.
Here is what I am not sure
How to even estimate the number of miners? we don't know how many miners are there or how many of them will run my function? If I paid X amount and there are more miners than I paid, it won't be runnable by other miners.
How is this handled? Am I missing something?


texts: Gas cost when calling Ethereum view functions on remote or local node

texts:
There are dozen of sources on the internet that state the view functions, which are called externally (i.e. from oustide of contract), that do not call other contracts' functions and do not change the state of the contract - consume no GAS. As long as the call is done on a local node.

I would like to hear some clarifications about what exactly considered to be a local node and what is a remote node. And how exactly does it work with web3.js library.

Is the node only considered local when is run on local machine resources? i.e. addressed by web3.js by the domain name localhost.
Is the node still considered local, if I host it on Azure services? i.e. it's my own local node, which is publicly available in order to use it in the front-end. I no longer use the "localhost" domain to access it. But I want to use it in order to avoid paying GAS for view functions.
If I use a remote node such as infura - then do view functions start costing GAS?
(in in case answer to previous question is yes) Is this possible to publish my own local node (essentially making it a remote node), so the client would still be able to call it and spend no-gas on view function?
In cases when functions (otherwise-free when called locally) start costing GAS - is the cost taken from the contract?
In cases when functions (otherwise-free when called locally) start costing GAS - does the call become a transaction to cover the cost? (connected to previous question)
Is it so that when web3.js is used on the front-end then node is always remote. And when web3.js is used on the back-end, then the node is always local (unless local is not available, of course)?
How do you use web3.js on the front-end, to allow users querying non-state-changing contract functions without a cost? I guess this is my main question which kind of summarizes why I have so much confusion about local/remote node. :)
(optional - dApp architecture advice). Could you tell if there is a flaw or a global misconception in my understanding?
If we always use the remote nodes on the front-end then there is no "free" transactions/calls by definition. It looks like there should always be an interface on top of the backend that accepts the "calls" from the front-end, essentially making them GAS-free. So there are always 2 instances of web3.js running. 1st - is the one that client uses to create paid transactions, 2nd - is running on the backend to make GAS-free calls that do not change state. Unless it is possible to make front-end web3.js to tell the node to use local resources for free.

Backstory: I am working on my first contract and I am new in the world of blockchain. I want to expose my contract on the internet so the user would be able to "work" with it. I don't want the user (or the contract itself) to pay for the view (non-state-changing) functions. Sorry if some questions are stupid. I don't own a node or a website (yet) :)

Please do not mark the topic as duplicate unless all questions are answered in the linked topic. Thank you.


texts:
I get an error when trying to push the newRound struct to storage. How can it be fixed?

Error:

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

pragma solidity >=0.4.25 <0.6.0;

contract Lottery {
    struct Round {
        uint deployBlock;
        uint endBlock;
        uint drawBlock;
        Ticket[] tickets;
        uint checkpot;
        address winner;
    }

    struct Ticket{
        address owner;
        uint luckyNumber;
    }

    Round[] rounds;
    uint public roundIndex;

    function drawWinner() public returns (address _winner){

        Ticket[] memory newTickets;

        // How to push this new struct to storage?
        Round memory newRound = Round({
                deployBlock: block.number,
                endBlock: block.number + ROUND_DURATION,
                drawBlock: block.number + ROUND_DURATION + 5,
                tickets: newTickets,
                checkpot: 0,
                winner:address(0)
            });

        rounds.push(newRound);

        roundIndex++;
        return rounds[roundIndex].tickets[0].owner;
    }
}


texts: Corruption on data-block while synchronising

texts:
My home server's been down for a couple of days while I do some upgrades.

I'd had Geth running in one of the terminal windows, but shut it down gracefully using exit before taking the server offline.

On trying to restart it, I'm seeing the below error:

I0208 14:31:27.219469   26346 downloader.go:267] Synchronisation
failed: leveldb/table: corruption on data-block (pos=650747): checksum
mismatch, want=0x2dd4b443 got=0x9fb5cf2f [file=286265.ldb]

How do I go about investigating and fixing this problem? Is there a way to remove the offending part of the data and force it to resync that particular part? I clearly don't want to have to re-sync everything from scratch...

(Note: I've run fsck on the (unmounted) disk without finding any problems. The upgrades didn't touch the disks. Everything was shut down gracefully.)


texts: Multiple callbacks with provable random oracle

texts:
I'm making a simple lottery game where there are hourly, daily and weekly prizes. My contract has functions to pick winners for each of these game types. Each game types will have different number of entries and I need to generate a random number based on the number of entries to pick the winner.

e.g.

function chooseHourly() public {
   address HourlyWinner = pickWinner(hourlyParticipants);
..
}

function chooseDaily() public {
   address dailyWinner = pickWinner(dailyParticipants);
...
}

function chooseWeekly() public {
   address weeklyWinner = pickWinner(weeklyParticipants);
...
}

 function __callback(
        bytes32 _queryId,
        string memory _result,
        bytes memory _proof
    )
        public
    {
        require(msg.sender == provable_cbAddress());

        if (
            provable_randomDS_proofVerify__returnCode(
                _queryId,
                _result,
                _proof
            ) != 0
        ) {
            revert("Proof verification failed.");
        } else {
            randomNumber = uint256(keccak256(abi.encodePacked(_result)));
            emit generatedRandomNumber(randomNumber);
        }
    }

function pickWinner(Entry[] memory entries) internal returns(address) {

uint256 QUERY_EXECUTION_DELAY = 0;
        uint256 GAS_FOR_CALLBACK = 200000;
        provable_newRandomDSQuery(
            QUERY_EXECUTION_DELAY,
            entries.length,
            GAS_FOR_CALLBACK
        );
    //Need to return a winner somehow. If I pick winner here, it would probably use the previously generated number, not the one just requested.
}

However I would need to wait for the callback function to select the winning address in pickWinner and the callback function has no knowledge of which game it will be. I'm not sure of the best way to structure this. I don't really want to create separate contracts for each game type, but is it possible to have more than one different oracle call per contract or is there another way to go about this?


texts: Difference of behavior between Metamask and direct connection to testrpc

texts:
I’m guessing there is an obvious answer to this question but I’m just completely missing the point. I have a very simple contract with 2 functions: a setter that changes a bunch of fields, and a constant getter that returns those fields. And I have a javascript application that interacts with that contract using truffle-contract. Behind the scenes, my contract is deployed to testrpc. When I submit a form, I’m calling my setter and in the then block, I’m calling my getter to update the page. I’m assuming that, as said in the doc, the then block is only executed once the transaction has been mined. Now when I run my app in a browser with Metamask disabled, connecting directly to my node with web3, everything works smoothly, no need to refresh the page to see the result once the transaction has been sent. But with Metamask, once I click submit, the call to the getter retrieves nothing, and I have to reload the page and trigger the getter again to get data. Is that because of a problem in the behavior of testrpc? Does that ring a bell to anybody?

Here is the contract:

pragma solidity ^0.4.11;

contract ChainList {
    // State variables
    address seller;
    string name;
    string description;
    uint256 price;

    // sell an article
    function sellArticle(string _name, string _description, uint256 _price) public {
        seller = msg.sender;
        name = _name;
        description = _description;
        price = _price;
    }

    // get the article
    function getArticle() public constant returns (
        address _seller,
        string _name,
        string _description,
        uint256 _price) {
        return(seller, name, description, price);
    }
}

And here is the JS code that calls it:

App.contracts.ChainList.deployed().then(function(instance) {
      return instance.sellArticle(_article_name, _description, _price, {
        from: App.account,
        gas: 500000
      });
    }).then(function(result) {
      console.log("reloading articles");
      console.log("result:", result);
      App.reloadArticles();
    }).catch(function(err) {
      console.error(err);
    });


texts: How to synchronise Ganache-CLI accounts with Ganache-UI?

texts:
When I launch ganache-cli for Port 7545, it will create 10 accounts by default.

ganache-cli -p 7545

However, when I then open the Ganache-Desktop-App, it will show different accounts and the accounts from the CLI can't be found.

This appears in the terminal from ganache-cli:

This is shown in Ganache Desktop-App:

Why aren't both in sync?


texts: What are ethereum miners really solving?

texts: As with mining, what are the ethereum miners really solving? I read they are solving hashes, but what does that really mean. Can we see what they are solving? Can someone give an example of what a ethereum mining machine sees to solve?Thx.


texts: Blockchain sync on geth stalls at block 1.1 million

texts:
I saw the responses on a few issues regarding ethereum and blockchain sync on this site, and was wondering if anyone could help me with a problem I'm facing.

I've been trying to sync the blockchain with Geth for the past week now and have only managed to get to block 1.1 million. Though initially I enjoyed download speeds of a few second per 256 blocks, speeds have dropped to more than two min per 256 blocks over the last two days. The download keeps breaking off every 15 min with error - not enough peers.

I have tried everything from syncing system clock with time.nist.gov, enabled port forwarding to 30303, turned antivirus and firewall off etc.. but all in vain.

Is there a way to use the admin.addPeer command and connect to active nodes ? Where could i find a list of fully synced active node? Or is there any other way I could try and speed the blockchain sync up?

Any constructive advise would be much appreciated.