texts: Why is an address changing when I add it to an array?

texts:
I'm encountering a memory / storage issue (I think) w/ an array of addresses where I want to swap out one address with another.

Here's how I've initialized the array:
address[] public maintainers;

Here's the function that performs the replacement:

  function replaceMaintainer(address _maintainer, address _newMaintainer)
    public
  {
    for (uint i = 0; i < maintainers.length; i++) {
      if (1 == 1) {
          maintainers[i] = _newMaintainer;
          break;
      }
    }
  }

When I test in terminal here's what steps I take:

truffle(development)> wallet = MultiSigWallet.at('0x22f79daf3ea53041cbc153e15744b06ee5a12b8a')

truffle(development)> wallet.getMaintainers()
[ '0x65be59ed81a9a5f281e14e1c43d8acbd810aefbf',
  '0x05c390a16112211590f9dafa606612c40aa60bd4',
  '0xe186acfce49f850708a888214345920f32ea0288' ]

I should note, the constructor sets up the initial maintainers.

truffle(development)> wallet.replaceMaintainer(0xe186acfce49f850708a888214345920f32ea0288, 0xee5c3ec339e01de884f65523b8dfe38b35f90d84)

truffle(development)> wallet.getMaintainers()
[ '0xee5c3ec339e021de43c7c49095748ac100000000',
  '0x05c390a16112211590f9dafa606612c40aa60bd4',
  '0xe186acfce49f850708a888214345920f32ea0288' ]

You'll notice the first handful of characters are the same, but the remaining are changed. Any thoughts what's happening here?

This is very much similar to this MultiSig wallet's replaceOwner function. You'll notice I'm using 1 == 1 in the for loop. This is because the _newMaintainer changes once it's passed to the function.


texts: Difference between eth.newAccount and personel.newAccount

texts:
Can anyone explain the difference between

`eth.accounts.create()` and `eth.personal.newAccount()`

and which one we should use and why? As I am new to ethereum so its very confusing for me.
Thanks


texts: How to print value inside solidity function?

texts:
I am new to solidity. I want to print a value of w and h inside rectangle function. how can I do that?

contract ShapeCalculator{
    function rectangle(uint w, uint h) returns (uint s, uint p) {
        //print value of w and h
        s = w * h;
        p = 2 * (w + h);
    }
}


texts: What’s the role of the EVM in a plain ether transfer between Externally Owned Accounts?

texts: In a plain ether transfer from one Externally Owned Account to another, for which the base fee of 21000 gas has been provided, how is the EVM involved if at all? I realize that the signature needs to be verified, and of course the ether balance fields will have to be updated. How is this accomplished?


texts:
In my site I call a contract's method that returns me a value, using web3, and then I show the value on screen.
Obviously, if you go on my site you must have installed an ethereum node or a bridge to a node like MetaMask to access contract's call and see the value.
But it is possible to see it without installing anything, only coding a JavaScript bridge to a node? It is possible? It is secure?

Thank you so much!


texts: how to transfer ether from one account to multiple account

texts:
I have 3 account

1st account 1000 ether
2nd account 20 ether
3rd account 30 ether

now I want to transfer 100 ether from 1st account to both 2nd and 3rd account


texts: What size value does the EVM use for intermediate results of an expression?

texts:
I've found this code in a Solidity contract, and had seen a presentation where this sort of code was used as well. In the work I've done in compilers the intermediate results of expressions are stored in the largest data type available, so this sort of test would fail to reveal overflow; overflow wouldn't happen until the result was stored back into the original variable.

// Making double sure uint doesn't overflow and wrap back
require(totalSupply + _value > totalSupply);

Is this sort of test valid in Solidity? What are the rules for deciding the type to use for intermediate values in expressions?


texts: Can someone help me understand what this address is? It says its private but has a lot of weird transactions. I am trying to track a scammer

texts: I am tracking a scammer and I need to figure something out, just to be sure. For example https://bloxy.info/ is telling me this address 0xc94ebb328ac25b95db0e0aa968371885fa516215 is a a regular address of wallet , there were no smart contract calls from this address but it has Internal txn.It has a lot of transactions. Based on my observation, the scammer circulates around a lot of eth, maybe using bots or is this ETH mixer? I dont know how that works/looks. He sends small transactions, most of the time, and then they go to a few addresses, then come back and in between he send other, usually larger transactions that lead to, in many cases, exchanges. Any advice? Thanks.


texts:
I’m setting up a private blockchain using parity. I need to use PoA consensus with the maximum throughput possible.
What do you recommend to set the stepDuration value to? Can we set it to a very low number to achieve a high transaction throughput or id does have a side effect?


texts: Function doesn't change change variable's value

texts:
I have made a contract with a struct, Stock. I have an array with two such Stocks. They can be initialized fine, but when I try to change the value of a variable nothing happens. Also, the same function cannot change the value of a simple String variable.

Here's the code:

contract Company{

struct Stock{
    address owner;
    string bitcoinAddress;
}

string public companyName;
Stock[2] public owners;
string public test;

function Company(string _companyName, address[2] addresses){
    companyName = _companyName;
    for(uint8 x=0; x<owners.length; x++){
        owners[x] = Stock(addresses[x], "");
    }
 }

function changeStockOwner(uint8 _number, address _newAddress) constant returns(string){
    if(msg.sender == owners[_number].owner){
        owners[_number].owner = _newAddress;
        test = "hello";
        return "well";
    }
}
}

So, when I call company.changeStockOwner(0, personal.listAccounts[1]), it returns "well", so I guess it can get pass the if-statement. But then, nothing changes.

I thought there might be some difficulty changing the value of a struct in an array, so I added test just to see if I could change that, but that won't change either. I've also tried setting web3.eth.defaultAccount to the same same owners[0].owner (just to see if it would work).

I used the online compiler at ethereum.github.io.

I have no idea what I'm doing wrong. It seems just obvious that it should work, but why doesn't it?


texts: Writing GBytes of data to disk, despite no network activity - what, precisely, is geth doing?

texts:
I'm watching geth 1.4.17 on Activity Monitor.

Judging by the Network page, it's not doing anything. Rcvd Bytes is 5.9MBytes, and Sent Bytes is 2.6MBytes, and it's been that way for a while now.

But on the Disk page, Bytes Written is 4.66GBytes, and Bytes Read is 5.17GBytes, and both are increasing at about 4-6MBytes/sec.

What, precisely, is geth doing here?


texts: What does block.coinbase return when contract is being executed in a full node?

texts: So all full nodes execute every smart contract invocation.  block.coinbase is supposed to return the miners address but what does it return when the transaction is not yet in the miners hands but is being executed by a full node in the intermediate chain?


texts: how to send money from ethereum wallet to another

texts:
In a webserver with server-side javascipt language
I would like to insert a script to transfer money from my ethereum wallet managed by eidoo.io, to the address of other ethereum wallets.
I'm documenting about infura and web3js, but I still do not understand if it's possible to do that.


texts: error comparing numbers in smart contract (Big Number)

texts: I am unable to understand when all do we need to convert numbers to bigNumbers for asserting to be equal. In some cases by mistake i missed to convert integer variables to bigNumber and they worked without error. Can somebody throw more light on the same?


texts: Calculate required funds for truffle migrate to live network

texts:
Trying to deploy a dapp to the live network. Got this insufficient funds for gas * price + value:

My wallet currently has 0.05 ether... How do I calculate the required funds?


texts: Why would a transaction be dropped from transaction pool

texts: What could be a reason, reasons why a transaction is dropped from the transaction pool ?


texts: It is very slow to sync by parity in archive mode

texts:
I am syncing by parity in archive mode.

  tracing="on" pruning="archive" fat_db="on"

Currently it is around 4,880,000 blocks but very slow, 0.2~0.8 blk/s.
I am afraid it will take serveral months to the latest block (>8,000,000 blocks).
How can I make it faster?


texts: Is it possible to send tokens so that the receiver pays gas?

texts:
I would like to send some tokens (ERC20) and I was wondering is there some kind of way (command line, programmable way?) so that the receiver of tokens pays the gas in ETH? If not do you think that something like would be possible in the future?

Thanks very, very much.


texts: Someone Please Explain this "The concept of payable and non-payable addresses only exists at compile time not after the contract is compiled"

texts:
Actually I was reading this Answer https://ethereum.stackexchange.com/a/64109/55286 . And this person says The concept of payable and non-payable addresses only exists in the Solidity type system at compile-time. The difference between payable and non-payable addresses is gone in the compiled contract code.

Does this statement means that the address and address payable are only defined at the compile time but after the contract is deployed all the address reaching out the contract are payable as well?? I dunno I'm confused as hell

I tried but didn't understand please help


texts: Is there any public Ethereum communication forums or Slack?

texts: A lot of open source and blockchain projects are using Slack for communication and keeping communities together. Is there any public slack for Ethereum specifically (not DApps)?


texts: why use up all the gasLimit when use assembly and revert together?

texts:
try to call erc20 token's transferFrom() using assembly(to save some gas), code like this:

pragma solidity ^0.4.24;

contract TestAssemblyAndRevert {
    function test(address from, address to, uint256 value) public {
        // a standard erc20 token
        address token = 0xedc2d4aca4f9b6a23904fbb0e513ea0668737643;

        // call transferFrom() of token using assembly
        assembly { // LineA
            // keccak256('transferFrom(address,address,uint256)') & 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000
            mstore(0, 0x23b872dd00000000000000000000000000000000000000000000000000000000)

            // calldatacopy(t, f, s) copy s bytes from calldata at position f to mem at position t
            // copy from, to, value from calldata to memory
            calldatacopy(4, 4, 96)

            // call ERC20 Token contract transferFrom function
            let result := call(gas, token, 0, 0, 100, 0, 32)

            if eq(result, 1) {
                return(0, 0)
            }

            //revert(0, 0); // LineB
        }

        revert("TOKEN_TRANSFER_FROM_ERROR"); // LineC
    }
}

the token is a standard ERC20 token that when some spender trying to call transferFrom() without enough allowance, it will revert, in our case, this line:

let result := call(gas, token, 0, 0, 100, 0, 32)

result will be 0.

The thing surprise me is that when this happens, the transaction will use up all the gasLimit. why is that?

I tried several other cases, none of them will use up the gas:

if I comment out the whole assembly code block, or
if I keep the assembly code block, but comment out: revert("TOKEN_TRANSFER_FROM_ERROR"), LineC
if I comment out LineC, keep the assembly block and uncomment LineB


texts:
I am looking to take in a uint256 (in hex notation) and convert it to bytes32. For some reason I am not getting the same value after converting.

function test(uint256 genes1) public returns (bytes32) {
    bytes32 matron = bytes32(genes1);
    return matron;
}

genes.test.call(0x000063169218f348dc640d171b000208934b5a90189038cb3084624a50f7316c)
Return value ----- 0x000063169218f348dd1c457e09cc8e86bd11d156019d255fbe00000000000000


texts: Does lowering the share difficulty allows me to find more blocks?

texts:
Lets assume that I've a very powerful server with very fast internet connection (32GB RAM, 4GBit/s upload and download) which runs MiningCore and Parity for private mining.

Does decreasing the Share Difficulty, allows me to find more blocks? If I decrease it, I know that way more shares will be submitted and my server can process them.
Storing the DagFile in SSD makes any difference OR it affects processing shares?
Storing the Blockchain data in SSD makes any difference OR it affects processing shares?


texts: geth version does not change after upgraded (apt-get)

texts:
I want to upgrade my geth node from 1.6.7 to 1.7.2. However it did not work. How can I solve it?

$ sudo apt-get install ethereum
Unpacking ethereum (1.7.2+build11187+xenial) over (1.6.7+build10273+xenial) ...
Setting up ethereum (1.7.2+build11187+xenial) ...

$ geth version
Geth
Version: 1.6.7-stable
$ which geth
/usr/bin/geth <-- geth is not changed


texts: What is the maximal network delay for a node to sync with the main chain?

texts:
Lets say a node has a very high delay (ping/pong) between its own network and the network on which most of the other nodes are, say about 13 minutes, will it be able to be part of the main blockchain (and will it be able do act as any other nodes, not just reading the chain state but also commit transactions) or will it have to connect on a blockchain with pairs that are close to him (a few hundred milliseconds) and have a bridge between its chain and the far far away one ?

Thanks.


texts: How to access to functions of another Contract and change it's variables

texts:
I have to Contracts habibconcert and changer  , there is a method for changing the tickets_number in "habib concert" , it works fine when working just with the contract itself but i want to access to to it in another Contract "changer" so I made an object of the "habibconcert" in Changer Class and try to use it
in

   function changeTickets(uint new_tickets) returns(uint) {

      firstObject.tickets = new_tickets;

      uint updateTickets =  firstObject.tickets  = firstObject.tickets + new_tickets;
      return ( updateTickets);

        }

but   i receive the  these errors

          browser/habibconcert.sol:12:11: TypeError: Expression has to be an lvalue.
      firstObject.tickets = new_tickets;
      ^-----------------^

            browser/habibconcert.sol:12:33: TypeError: Type uint256 is not implicitly convertible to expected type function () view external returns (uint256).
      firstObject.tickets = new_tickets;
                            ^---------^

                       browser/habibconcert.sol:14:33: TypeError: Expression has to be an lvalue.
      uint updateTickets =  firstObject.tickets  = firstObject.tickets + new_tickets;
                            ^-----------------^

                                       browser/habibconcert.sol:14:56: TypeError: Operator + not compatible with types function () view external returns (uint256) and uint256
      uint updateTickets =  firstObject.tickets  = firstObject.tickets + new_tickets;
                                                   ^-------------------------------^

                           browser/habibconcert.sol:14:11: TypeError: Type function () view external returns (uint256) is not implicitly convertible to expected type uint256.
      uint updateTickets =  firstObject.tickets  = firstObject.tickets + new_tickets;
      ^----------------------------------------------------------------------------^

Thanks in advance
 my two Contracts here below
 as following

pragma solidity ^0.4.0;

contract changer{

   habibconcert firstObject =    habibconcert(0xdc544654fefd1a458eb24064a6c958b14e579154);

  function changeTickets(uint new_tickets) returns(uint) {

      firstObject.tickets = new_tickets;

      uint updateTickets =  firstObject.tickets  = firstObject.tickets + new_tickets;
      return ( updateTickets);

        }

}

contract habibconcert{

  uint  public tickets = 6;

  address owner_of_tickets;

  uint constant price = 1 ether;

   mapping(address=>uint) public purchasers;

  function habibconcert()payable{

        owner_of_tickets =  msg.sender;
  }

function  displayTickets_numbers()constant returns(uint){

    return tickets;

}

    modifier ownLycreature(){

        require(msg.sender ==  owner_of_tickets) ;

        //   && tickets == 0
        _;

        }

               function changeTickets_number (uint newtickets) ownLycreature{

                     tickets +=newtickets;

               }

function buytickets(uint amount)payable{

      if(msg.value!=(amount*price) || amount>tickets){

          throw;
      }

      purchasers[msg.sender] +=amount;

      tickets -=amount;

    // if(tickets == 0){

    //     //selfdestruct(owner_of_tickets);

    // }

}

}


texts:
modifier require(bool condition) {
    if (! condition) revert();
    _;
}

When I try to truffle compile my contract I get an error here: "Warning: This declaration shadows a builtin symbol."


texts: Why doesn't the shift operation revert on overflow in Solidity ^0.8.0?

texts:
Take the following function:
solidity ^0.8.0;

function foo(uint256 x) external pure returns (uint256) {
    uint256 y = x << 255;
    return y;
}

If you set x = 2, the result is 2**256, which is above the maximum value allowed by uint256. Yet the contract call doesn't revert. Why?
As per the documentation:

For positive and negative x values, x << y is equivalent to x * 2**y

If I rewrite the function above as y = x * 2*255, the contract call does revert.


texts: SLOAD costs 800 gas - how is it possible?

texts:
I've got a very simple contract. It narrows down and measures cost of loading a storage variable:
pragma solidity ^0.7.6;
contract Bench {

    uint256 public data;

    function increment() public {
        uint256 gasUsed = gasleft();
        uint256 dataLocal = data;
        gasUsed -= gasleft();
        dataLocal += gasUsed;
        data = dataLocal;
    }

}

It generates an unsurprising assembly:
(...)
      GAS           gasleft()
      PUSH 0            uint256 dataLocal
      SLOAD             data
      SWAP1             uint256 gasUsed = gasleft()
      SWAP2             uint256 gasUsed = gasleft()
      POP
      GAS           gasleft()
(...)

The measured gas usage according to the yellow paper should be 213:
PUSH    - 3
SLOAD   - 200
SWAP1   - 3
SWAP2   - 3
POP     - 2
GAS     - 2

A simple Remix test shows the measured gas:
    function checkFailure() public {
        Bench bench = new Bench();
        bench.increment();
        Assert.equal(bench.data(), 0, "GAS USED");
    }

The printed result is 813, exactly 600 more than expected. Why? How to reduce that?


texts: Is there a way to send ether from several input addresses in one transaction WITHOUT the use of smart contracts? I wish that different transactions could not be linked to each other. A similar question has already been asked here, but perhaps something has changed since then.


texts: Why doesn't the Ethereum protocol have an indicator for a transaction that failed?

texts:
Why doesn't the Ethereum protocol have a clear indicator for a transaction that is reverted?

There's a heuristic here as well as a workaround using Geth.  But there are probably ways that the protocol could provide a clear indicator.  For example, could a transaction receipt have a boolean property for outofgas?

What could the protocol do to provide an Out of Gas indicator, and why were none implemented?


texts: Another 'Stack too deep, try removing local variables' issue

texts:
Quite a few questions in SE regarding this, but my contract doesn't seem to be quite the same as those.  I understand that variables defined inside the function (I have none), input parameters (I have 10), and output variables (also have 10) count in the 'must be less than 12' rule.  But even that makes no sense.  I mean... can you have a different number of input parameters than output variables?  I would think you would get an error that they don't match if you did.  In which case, 6 would be the maximum number of variables, not 12.  Anyway, I'm looking for a solution to this.  Is the only solution left, to split it into multiple functions?  I'm getting the error only on the 'getSample' function, not the 'setSample' one.

pragma solidity ^0.4.24;

contract StackSample {
    struct Sample {
        uint var1;
        uint var2;
        uint var3;
        uint var4;
        uint var5;
        uint var6;
        uint var7;
        uint var8;
        uint var9;
        uint var10;
    }

    mapping(uint => Sample) samples;

    function setSample(uint _stackID, uint _var1, uint _var2, uint _var3, uint _var4, uint _var5, uint _var6, uint _var7, uint _var8, uint _var9, uint _var10) public {
        var sample = samples[_stackID];

        sample.var1 = _var1;
        sample.var2 = _var2;
        sample.var3 = _var3;
        sample.var4 = _var4;
        sample.var5 = _var5;
        sample.var6 = _var6;
        sample.var7 = _var7;
        sample.var8 = _var8;
        sample.var9 = _var9;
        sample.var10 = _var10;
    }

    function getSample(uint _stackID) view public returns (uint, uint, uint, uint, uint, uint, uint, uint, uint, uint) {
        return (samples[_stackID].var1, samples[_stackID].var2, samples[_stackID].var3, samples[_stackID].var4, samples[_stackID].var5, samples[_stackID].var6, samples[_stackID].var7, samples[_stackID].var8, samples[_stackID].var9, samples[_stackID].var10);
    }
}


texts: Cannot read property 'sendEth' of undefined, 'sendEth' is function in smart contract

texts:
Hi I'm trying to interact with an Ethereum smart contract but it is always showing "TypeError : Cannot read property 'sendEth' of undefined" where 'sendEth' is a function in my smart contract

Here is code snippet:

function sendEth() {
            var transferEthAddress = "0x0152E36df4fB7587b035fbF5c02A059A0B3b9c38";
            var transferEth = new window.web3.eth.contract(transferEthABI, transferEthAddress);
            transferEth.methods.sendEth().send({from: web3.eth.accounts[0], value: web3js.utils.toWei("0.001","ether")});
        }
        window.addEventListener('load', async () => {
            if (window.ethereum) { // Modern dapp browsers...
                window.web3 = new Web3(ethereum);
                try {
                    await ethereum.enable(); // Request account access if needed
                }
                catch (error) {
                    console.log('User denied permission to use their Ethereum account.');
                }
            }
            else if (window.web3) { // Legacy dapp browsers...
                window.web3 = new Web3(web3.currentProvider);
            }
            else { // Non-dapp browsers...
                console.log('Non-Ethereum browser detected. You should consider trying MetaMask!');
            }
        });

Web3 is getting successfully connected to my smart contract as I can see transaction in Metamask but I am unable to access the function, please help!

Here is my contract code:

pragma solidity ^0.4.25;
import "./Ownable.sol";
contract demo is Ownable
{
    function sendEth() external payable
    {
        //_owner will have the address of the deployer of contract.
        address _owner = owner();
        _owner.transfer(msg.value);
    }
}


texts: Sealing a Smart Contract / Selfdestruct Remainings

texts:
Let's say there is a Smart Contract and different participants of the network interact with it. Under certain conditions (e.g. a certain method has been executed) there shall be no way to further interact with the Smart Contract anymore but the Smart Contract itself shall still exist ("sealing").

I could define a global variable like "_complete" and set it to true, but I literally want to avoid the ability to interact with it except for retrieving the actual code.

Question 1: is there a way to achieve that?

Question 2: if I use selfdestruct -> what actually remains of the Smart Contract and the interactions respectively the data (like variable values)? Does the address still exist and are there any references left in terms of the Smart Contract?

Thanks


texts: Convert contract arguments from JSON to ABI-encoded format

texts:
I want to verify a contract code on Etherscan, but don't know how to get the arguments in ABI-encoded format. I have the source code and the interface in JSON. Is there some tool I can use, or some easy way of getting the JSON to the ABI format?

Note: I used just the "Deploy Contract" from Ethereum Wallet (Mist), no fancy compiler or anything.

The source code: https://gist.github.com/crutor0x/45cd845349345190458df7f7412654e8

JSON ABI: https://gist.github.com/crutor0x/dd97e9593ffb696bfb583481dccb86d9

Contract address: 0x3c75226555fc496168d48b88df83b95f16771f37


texts: How to return an array of structs (or an array of destructured structs) in Solidity

texts:
I added comments to detail the question in hand and my attempts to solve it.

pragma solidity ^0.4.19;

contract Users {
    // a user with some metadata
    struct User {
        bytes32 name;
        bytes32 email;
    }

    // users are aggregated (notice the array) by a unique key
    mapping(uint => User[]) internal users;

    // and of course we keep track of these unique keys
    // because we can't loop through a mapping
    uint[] internal keys;

    function signUp(bytes32 name, bytes32 email) public {
        // our unique key, users are aggregated by day
        uint key = now / 1 days;

        // if this is the first user within a key, we keep track of that key
        if (users[key].length == 0) keys.push(key);

        // we push the new user to the key's array of users
        users[key].push(User(name, email));
    }

    // so far so good, now we move on to retrieving the data

    // this answers the question of: in what keys there are users?
    // one call, we get all the keys, efficient
    function getKeys() public view returns (uint[]) {
        return keys;
    }

    // now we need to answer the question of: who are the users of the key x?

    // throws, Error: Unsupported or invalid type: tuple
    function getUsers(uint key) public view returns(User[]) {
        return users[key];
    }

    // the following approach works
    // but requires users[key].length calls to the network, not efficient

    // first, we need the number of indices within a key
    function getUsersCount(uint key) public view returns (uint) {
        return users[key].length;
    }

    // then, we need to loop getUsersCount(key) times
    // to retrieve the metadata for each user

    // throws, Error: Unsupported or invalid type: tuple
    function getUser(uint key, uint index) public view returns(User) {
        return users[key][index];
    }

    // same error from before, let's try this
    function getUserModified(uint key, uint index) public view returns(bytes32, bytes32) {
        User memory user = users[key][index];
        return (user.name, user.email);
    }

    // works ..
    // aha! so returns(User) is not supported, we have to destruct
    // or is this limitation of Remix only?

    // the question now is ..
    // how can we return an array of (user.name, user.email)?
    // that is, modifying faulty getUsers(), to avoid multiple getUserModified() calls
}


texts: Using ethereumj to evaluate contracts off chain

texts:
Is it possible to take a contract from the main ethereum blockchain and used that on my private ethereum network with ethereumj?

What I want to do is, run a contract with some input without changing the blockchain and spending gas.

Any clues?


texts:
I launched a private RPC Blockchain network and connected through another computer to this network. The connection is successful. How can I get a private key(through Python) if the file is on another computer on this private network? I can get private key on my computer through this code: P.S. But I can't use it to get private key from another computer in my private network.

from web3 import Web3
web = "My IP and Port"
web3 = Web3(Web3.HTTPProvider(web))
import binascii
import glob

account_1 = "0xAC89Ec2301A5760985c9953ae4f81E607Fe8Ba8d"
passw = input()
account_2 = "0x2a2034F5a872341e66ba44e8a884e89acA023130"

addr = "".join(glob.glob('C:/ether/keystore/*'+account_1.replace('0x', '')))
with open(addr) as keyfile:
    encrypted_key = keyfile.read()
    private_key1 = web3.eth.account.decrypt(encrypted_key, passw)

private_key = ''.join((str(binascii.b2a_hex(private_key1)).replace("b'",'')).replace("'", ''))

print(private_key)


texts: MetaMask Web3 object does not support synchronous methods without a callback parameter

texts:
I'm new around here and would appreciate some intuitive help.

I wrote a contract and made a UI for it, and it's all working fine with ganache-cli. However, now that I've launched it on Ropsten and on an actual website, the code is not working with MetaMask. I've done my research and realize that MetaMask needs callback parameters, but after trying different ways, I still haven't managed to get it right.

My code is:

   $("#button1").click(function(resolve, reject) {
       address =  account.toString();
       MyContract.function1({from: address, value: '1000000000000000000'});
    })

    $("#button2").click(function(web3) {
       address =  account.toString();
       var spender = $("#useraddress")[0].value;
       MyContract.function2(spender, "1", {from: address});
    })

    $("#button3").click(function (web3) {
       address =  account.toString();
       var tokenreceiver = $("#newowner")[0].value;
       MyContract.function3(tokenreceiver, "1", {from: address});
    })

    $("#button4").click(function(web3) {
       address =  account.toString();
       MyContract.function4({from: address, value: '0', gas: >'3000000'});
    })

The error I'm getting is:

  Uncaught Error: The MetaMask Web3 object does not support synchronous methods like eth_sendTransaction without a callback parameter.

How should I set my callback parameters for the functions above?

P.S. I'm new to programming so please excuse possible mistakes with the code.

Thanks in advance.


texts: __callback was called after the specified delay

texts:
My smart contract should return the ETH rate from Coinbase api .. So i'm using Provable engine and i'm testing my smart contract locally using ganache and ethereum-bridge .
It's expected that result should be returned using an event that will be fired whenever the provable call the __callback function of my contract.
To test my contract i'm using mocha-js , but the problem is that my test always finish before the __callback function is called .
In my test i tried to use callback function(done()), promises and async / await but no one of them solved the problem .

this is my contract code :

pragma solidity ^0.5.0;

import "./provableAPI_0.5.sol";

contract eth_rate is usingProvable {
  string public ETHUSD;
   event LogConstructorInitiated(string nextStep);
   event LogPriceUpdated(string price);
   event LogNewProvableQuery(string description);

   constructor() public {
       emit LogConstructorInitiated("Constructor was initiated. Call 'updatePrice()' to send the Provable Query.");
   }

   function __callback(bytes32  myid, string memory result) public {
       if (msg.sender != provable_cbAddress()) revert();
        ETHUSD = result;
        emit LogPriceUpdated(result);
   }

   function updatePrice()public  payable {
       if (provable_getPrice("URL") > msg.sender.balance) {
           emit LogNewProvableQuery("Provable query was NOT sent, please add some ETH to cover for the query fee");
       } else {
           emit LogNewProvableQuery("Provable query was sent, standing by for the answer..");
           provable_query("URL", "json(https://api.pro.coinbase.com/products/ETH-USD/ticker).price");
       }
   }
}

and this is my test code:

const eth_rate = artifacts.require("eth_rate");
const truffleAssert = require('truffle-assertions');
require('truffle-test-utils').init();

contract('eth_rate',  (accounts) => {
    let instance;

     beforeEach('should setup the contract instance', async () => {
         instance = await eth_rate.deployed();
    });

   it("should return the list of accounts", async ()=> {
    console.log(accounts);
  });

 it('ETH rate ', async function() {
  const result = await instance.updatePrice();
  truffleAssert.eventEmitted(result, 'LogPriceUpdated');

  })

});


texts: How require() and assert() work in solidity?

texts:
I'm trying to validate a condition using require(). If the condition is false for the first time, the contract is stopped and reverted to its initial state. On the other hand, if the condition is true for the first time and false second time onwards the contract continues to execute in spite of the false condition in require.

Similar behavior is observed in case of assert and revert. I'm testing everything in remix with JavaScript VM.

Can somebody help me to understand why this is happening?

In below example of SimpleDAO, we are changing the flag value when withdraw function is called and using this flag value we are checking if withdraw is called for more than one time. But the require is not working as expected and also the if condition which is placed after require is not evaluated except for the first call of withdraw.

pragma solidity >=0.4.0 <0.7.0;

contract SimpleDAO {
    mapping (address => uint256) public credit;
    bool flag = true;

    constructor() payable public {
        donate();
    }

    function donate() payable public{
        credit[msg.sender] += msg.value;
    }

    function withdraw(uint256 amount) public{
        require(flag, "Only one time call is allowed.");
        flag = false;
        if (credit[msg.sender]>= amount) {
            msg.sender.call.value(amount)("");
            credit[msg.sender]-=amount;
        }
    }

    function queryCredit(address to) public view returns (uint256) {
        return credit[to];
    }
}

contract Mallory2 {
  SimpleDAO public dao;
  address payable owner;

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

  function attack() public payable{
    dao.donate.value(1)();
    dao.withdraw(1);
  }

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

  function() external payable{
       dao.withdraw(1);
  }
}


texts: Storing string containing delimiters in contracts - Error: invalid argument 0

texts:
I have created an array in contract where I'm pushing a string(concatt = IN23450.001 by concatenating 'IN2345' and '0.001').

Contract

contract BDetails {

struct Details {

    bytes32[] DetailsArray;

}
mapping(string => Details) DetailStructs;

 function appendDetails(string id, bytes32 concatt) payable returns(bool success) {

    DetailStructs[id].DetailsArray.push(concatt);

}

}

While deploying contract I'm getting an error.

  Error: invalid argument 0: json: cannot unmarshal invalid hex string into Go struct field SendTxArgs.data of type hexutil.Bytes

I tried storing string IN23450001 and worked perfectly.

Is it because of the decimal point I'm getting this error?Is there any way to store this string?


texts: A tool that does abi.encodePacked to fill data field in eth_call?


texts:
Is it possible to transfer ether to contract A if both my constructor and fallback functions are not of payable type ?

Also, I can't introduce any new functions.

Contract A {
    A () {
     // some operations
    }

    function () {
        // some operations
    }
}


texts: How to determine the Gas limits using local Simulators ? I am trying to execute my contract but it showed me a Gas limit hence unable to deploy it to the blockchain


texts: How can i add smart contract to metamask?

texts:
I have a smart Contract that i need to hook up with metamask and my ui.

https://ropsten.etherscan.io/address/0xe462cbee0cd420f6c199b0194b1d8d93fb5e7720#writeContract

I have an exchange.js file

const Web3 = require('web3');
const web3 = new Web3('https://ropsten.infura.io/v3/apikey');

const abi = abiegoeshere;

const contractAddress = '0xE462CbEE0cd420f6c199B0194B1D8D93Fb5e7720';
const contract = new web3.eth.Contract(abi, contractAddress);

web3.eth.getBalance(contract.address, function (e, r) {
   $('#contractBalanceAgi').text(convertCogToAgi(r).toFixed(4))
 })

I want to get the contract balance use buy sell withdraw and reinvest function as well as get account balance and all of this should also work with metamask.

but when i try to get balance i already get an error

These are the errors I get

web3.min.js:1 Uncaught ReferenceError: require is not defined
    at web3.min.js:1
(anonymous) @ web3.min.js:1
exchange.js:14 Uncaught TypeError: web3.eth.Contract is not a constructor
    at exchange.js:14

Uncaught TypeError: this.provider.sendAsync is not a function
    at s.sendAsync (web3.js:1)
    at r.e [as getAccounts] (web3.js:1)
    at localhost/:72

In my index file i have following script

and a link to

So Im not sure what of this i need and what not since i cant find any turoials on doing this?

I know that to interact with the contract i need abi and contract address but i have no ideaon how this works with meatamsk


texts: Gnosis.js will not perform createEvent request when initialized using Metamask's web3

texts:
I'm trying to create an event on the Morden testnet via the gnosis api but gnosis.createEvent will not make the necessary request.

I am able to load metamask's web3 into the config object I use to initialize the gnosis config.

config.web3 = customWeb3

I see that config.account is set to my correct metamask wallet address and I'm able to call getEvents and updateEventDescriptions successfully.

However, when I call getEvent(description, config.account, config), no request is made.

When I do not set  metamask's web3 in the config

config.web3 = customWeb3

I can make the request, but receive an 'Invalid Signature' error from the api endpoint. I presume this is because in this case the default config.account loaded by gnosis does not belong to me.

I see that metamask's web3 version is 17.0 and the web3 provided without explicitly setting

config.web3 = customWeb3

is  15.3.

Why no request when I explicitly set config.web3 as above?


texts: does revert()/require() revert changes made to other contracts?

texts:
Let's say I call functions from several external contracts in a function and check for their return values (given the fact they return a bool) either with require() or revert()

Pseudocode:

function storeDataInDifferentContracts() {
    require(address(firstContract).store(data));
    require(address(secondContract).store(otherData));
}

lets say the first contract call returns true and everything was stored as planned but the second contract call throws an exception. Does the data in the first called contract get reverted through the require()/revert() opcode as well?


texts: How can I execute transferFrom function in node js

texts:
There is solidity erc865 code

function transferFromPreSigned(
    bytes _signature,
    address _from,
    address _to,
    uint256 _value,
    uint256 _fee,
    uint256 _nonce
)
    public
    returns (bool)
{
    require(_to != address(0));
    require(signatures[_signature] == false);
     bytes32 hashedTx = transferFromPreSignedHashing(address(this), _from, _to, _value, _fee, _nonce);
     address spender = recover(hashedTx, _signature);
    require(spender != address(0));
     balances[_from] = balances[_from].sub(_value);
    balances[_to] = balances[_to].add(_value);
    allowed[_from][spender] = allowed[_from][spender].sub(_value);
     balances[spender] = balances[spender].sub(_fee);
    balances[msg.sender] = balances[msg.sender].add(_fee);
    signatures[_signature] = true;
     Transfer(_from, _to, _value);
    Transfer(spender, msg.sender, _fee);
    return true;
}

function transferFromPreSignedHashing(
    address _token,
    address _from,
    address _to,
    uint256 _value,
    uint256 _fee,
    uint256 _nonce
)
    public
    pure
    returns (bytes32)
{
    /* "b7656dc5": transferFromPreSignedHashing(address,address,address,uint256,uint256,uint256) */
    return keccak256(bytes4(0xb7656dc5), _token, _from, _to, _value, _fee, _nonce);
}

I am executing smart contract code from script like that

// First Generate Sign

generateFromSign: function () {
const self = this
const from = "0xf731eC19279849312A163793d4E4a58878A21558";
const receiver = document.getElementById('receiver').value.toString()
const amount = parseInt(document.getElementById('amount').value)
const fee = parseInt(document.getElementById('fee').value)
const nonce = parseInt("12345")

let erc865
erc865Token.deployed().then(function (instance) {
erc865 = instance
console.log(erc865);
const token = erc865.address.toString()
return erc865.transferFromPreSignedHashing(token,from, receiver,    amount, fee, nonce)
}).then(function (hash) {
web3.eth.sign(account, hash, function(error, signature) {
            if (!error) {
              console.log("Hash:"+hash);
              console.log("Signature:"+signature);
      self.setSign(signature)
            } else {
              console.log(error);
            }
          });
})
}

// Click the button to transfer "from" -> "receiver". Transaction must be executed by "account"

delegatedFromTransfer: function () {
const self = this

const from = "0xf731eC19279849312A163793d4E4a58878A21558";
const receiver = document.getElementById('receiver').value.toString()
const amount = parseInt(document.getElementById('amount').value)
const fee = parseInt(document.getElementById('fee').value)
const nonce = parseInt("12345")
const signature = document.getElementById('signature').value.toString()

this.setStatus('Initiating transaction... (please wait)')

let erc865
erc865Token.deployed().then(function (instance) {
  erc865 = instance
  console.log(erc865);
  return erc865.transferFromPreSigned(signature,from,  receiver,amount,fee,nonce, { from: account })
}).then(function () {
  self.setStatus('Transaction complete!')
  self.refreshBalance()
self.refreshEther()
}).catch(function (e) {
  console.log(e)
  self.setStatus('Error sending coin; see log.')
})
}

  When call "delegatedFromTransfer" function from front end I am getting
  error from MetaMask. Error message : "ALERT: Transaction Error.
  Exception thrown in contract code."


texts:
Let's say I have any function in my smart contract and for a small period of time I want that function to not be PUBLIC but PRIVATE.
Is it possible in Solidity?
If not, could this be solved with a modifier?


texts: How do I see the value of a string stored in a private variable?

texts: I have read many times that sensitive data should never be stored in a transaction, but, specifically, how would the value of a state variable be read if marked private?


texts:
I have read several documentations about brownie.
I have find 2 ways to install a package like openzeppelin-contracts:
$ brownie pm install OpenZeppelin/openzeppelin-contracts@3.0.0

and
$ brownie ethpm install <package>

I do not understand the difference between this 2 commands. What's the difference between pm and ethpm ?
Thanks


texts: How do I connect to Remix in Mist or MetaMask?

texts:
If I use either Mist or MetaMask, I get the error message:

  Unable to connect to http://localhost:8545. Invalid JSON RPC response: ""

How can I connect to the Remix localhost?


texts: Is there any way to get pending transaction for specified address?

texts:
is there any way to get pending transaction for a specified address? I can filter them
on bscscan here, but I can't do the same in my web3py code. I can get all pending transaction for current pending block but I can't filter them.
I can do:
txHashPending = w3.eth.filter('latest').get_all_entries()

and I get transactionHashes for pending transactions. I tried doing:
txHashPending = w3.eth.filter({'fromBlock':'pending','toBlock':'pending','from':'0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56'}).get_all_entries()

but it returned already validated/mined transactions.


texts: How to properly write inputs under the multiple transfer (multiTransfer) on the online etherscan form?

texts:
Problem:
I would like to make a multiple transfer of a token using the web-page:
https://etherscan.io/dapp/0x1C95b093d6C236d3EF7c796fE33f9CC6b8606714#

To reproduce the issue, click on the "Write Contract" tab then in the fields under multi-transfer type under text-fields:

[0x123123....,0x4321....]
[600,66]

What I get is

  new BigNumber() not a number:
  0x123123....,0x4321....

Source Code:

  // ------------------------------------------------------------------------
  // Transfers to multiple accounts
  // ------------------------------------------------------------------------
    function multiTransfer(address[] memory receivers, uint256[] memory amounts) public {
        for (uint256 i = 0; i < receivers.length; i++) {
          transfer(receivers[i], amounts[i]);
        }
    }

However, if I use the single-value arrays, it works.

How should I write/delimit the inputs ?


texts: If crypto deposit and withdrawal limits are unknown, will excess ETH deposit be lost?

texts:
Binance, a centralized exchange, doesn't publish its daily crypto deposit and withdrawal limits for unverified accounts in its FAQ. If I deposit a large amount of ETH to my Binance account's Ether wallet, will I lose the money that is in excess of the exchange's crypto deposit limit?
(The waiting list for Binance help is currently queued at 70, and the support e-mail function requires a bunch of irrelevant fields like "Transaction ID")


texts: I have token in eth I'd 0x5ae3876e3f26b6c99895b1ff9e094e6e6992b88b

texts:
Please help how can I transfer my tokens from 0x5ae3876e3f26b6c99895b1ff9e094e6e6992b88b to my another eth wallet account at 0xfdC1049162dd014AF7Fb11099DAe8F2A09f330e2.(both are my wallet ids).

But provider of 0x5ae3876e3f26b6c99895b1ff9e094e6e6992b88b does not support to transfer. Please guide.


texts: Where do I verify whether a contract has been created with CREATE or CREATE2, would I have to disassemble the contract and look for a CREATE2 opcode in the contract creation code?


texts: Can I mine ethereum with a gtx 1060 3GB?

texts:
When I'm launching ethminer it return the following lines

and exit after m 01:48:55 main     Speed 0,00 Mh/s gpu0 0,00 [A0] Time: 00:00

Has my GPU enough memory?


texts: Which TCP and UDP ports are required to run an Ethereum client?

texts:
The geth CLI options suggest that per default the client listens on TCP port 30303. This page, additionally suggests that UDP port 30301 is used for node discovery.
Is this all that is required or are there any additional ports in use?


texts: Is there a way to "clean up" the ethminer installation (ethminer after crashes)?

texts:
I'm NOT running Geth or any other wallet on the miners. I have dedicated systems for mining running Ubuntu 15.04, 64 bit desktop with ethminer compiled from cpp-ethereum. Motherboards/Processors range from Dual-core 2.5 to 3.4Ghz, to 3.6Ghz dual Xeon's, each has 8GB ram although a couple have 4GB ram. Each motherboard is running 2 GPUs. The GPUs include various quantities of R9 270X, R9 290, R9 290x, R9 295x2, R9 390, R9 390X and RX 480 gpus

The hard drives are small. I'm using 40GB and 80GB SATA hard drives on each system just because I have a ton of them and it seems a waste to use anything larger

While tweaking all the nifty dohickies within ethminer and the GPU settings to maximize output, I have crashed the systems more than a few times looking for the maximum hash output. What I have found is that when the systems crash data is left behind on the hard drive which will eventually fill up the hard drive and give me the "There is no more space available on the hard drive" error.

I did manage to delete some (whatever they are) files in the .ethash folder within the HOME holder. I'm assuming these are DAG files that were not removed when shutting down correctly due to crashing. When I would empty that .ethash folder, Ethminer would run again and wind up loading a new DAG.

HOWEVER, the hard drive still seems abnormally full, so I'm assuming there is other data being stored elsewhere that is getting abandoned due to the previous crashes.

QUESTION #1
Is there a way to clean up the abandoned / orphaned files from ethminer when the system would crash and leave it behind?

QUESTION #2
I've been using ctrl-c to end the ethminer program. Is that the approprite way to shut down ethminer, or is there a specific command to properly shut down ethminer?

QUESTION #3
When I would crash the systems, the video output freezes. Since I cannot see what I'm doing anymore, I have to use the power button or the reset button to reboot. Is there anything I can do to try to get that video back so I can properly shutdown and reboot?

Thank you


texts:
I am repeatedly facing this issue with structuring contracts' code:

contract Allower {
    Allowed allowed;

    function doSth() onlyallowed;

    modifier onlyallowed {
        if (msg.sender != address(allowed))
            throw;
        _
    }
}

contract Allowed {
    Allower allower;

    function doSthOnAllower() {
        allower.doSth();
    }
}

In order to enforce that only a particular instance of Allowed executes Allower.doSth, we need the contracts to keep mutual references (assuming we like the 1-1 relationship, but still want to keep these contracts separate). Now, to deploy both contracts and have them work, we need to add, more or less:

contract Allower {
    // snip...
    function Allower(Allowed _allowed) {
        allowed = _allowed;
        allowed.setAllower(this);
    }
}

contract Allowed {
    // snip...
    function setAllower(Allower _allower) allowernotset {
        allower = _allower;
    }
}

Is there any pattern which would allow to by-pass the necesity of setAllower? It just seems like an anti-pattern to have such "set" methods propagate.


texts: If one starts the miner on geth when running in dev mode Ether is credited to the designated address (coinbase per default) but what work is done to merit the reward? I did not post any transactions.


texts: How can I return multiple strings from a contract function?

texts: In solidity it's obvious how to get a single string returned from a function. But, I'd like to have the smart contract return multiple string values. Is there a way to do this?


texts:
My genesis.json

{
"config": {
"chainId": 9731,
"homesteadBlock": 0,
"eip150Block": 0,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"Ethash": {
  "period": 15,
  "epoch": 30000
}
},
"nonce": "0x0",
"timestamp": "0x5d5769ad",
"gasLimit": "0x7FFFFFFFFFFFF",
"difficulty": "0x1",
"alloc": {
"0x02404f2fd8fb1323efe14603968ffc9ee21c4f4f": {
  "balance": "0x200000000000000000000000000000000000000000000000000000000000000"
}
},
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}

After upping the geth I am getting below message

config="{ChainID: 9731 Homestead: 0 DAO: <nil> DAOSupport: false EIP150: 0 EIP155: 0 EIP158: 0 Byzantium: 0 Constantinople: <nil> Petersburg: <nil> Istanbul: <nil> Engine: ethash}"

It is showing DAO nil and DAOsupport false (is it a problem to call the smart contract). How to make DAOsupport as true.

2.after deployment the smart contract the functionalities are not working


texts: How to add Truffle signing keys to MacOS keychain

texts:
Debated what Stack Exchange to go to for this, but I thought I'd start here since it's related to setting up a local Ethereum dev environment. I downloaded and have been using the Ganache command-line interface to create a local blockchain to develop smart contracts on, but also wouldn't mind having a sweet GUI to look at.

I downloaded the MacOS Ganache desktop app, and after installing it from the .dmg, tried opening it up, getting this error.

“Ganache” can’t be opened because it is from an unidentified developer.

I checked the Truffle Suite's Github page for Ganache installation, and they mention before building Ganache from a .dmg, to

Make sure you have Truffle's signing keys added to your keychain

Is this for a particular Truffle product, and where do I find the signing keys to add to my MacOS keychain?


texts: calling individual values without storing them

texts:
I'm trying to call individual values from another function, without storing those values to the contract. Here is my complete code:

pragma solidity ^0.4.23;

contract Test {

    function setThreeValues() public view returns(int, uint, uint) {
        int x = 5;
        uint y = 7;
        uint z = 0;

        x += 5;
        y += 13;
        z = uint(x) + y;

        return (x, y, z);

    }

    function callThreeValues() public view returns(int, uint, uint) {
        return setThreeValues();
    }

    // function callX() public view returns(int) {
    //     return setThreeValues(int);
    // }

    // function callY() public view returns(uint) {
    //     return setThreeValues(uint);
    // }

    // function callZ() public view returns(uint) {
    //     return setThreeValues(uint);
    // }

}

when I run my function callThreeValues, I get all three values I'm expecting, which is 10, 20, 30.

However with my three further functions (callX, callY, callZ), I can't seem to get them to work....

with callX I'm trying to call the first value (10)

with callY I'm expecting to call the second value (20)

with callZ I'm expecting to call the third value (30)

I've obviously got the syntax wrong in my code, but I can't figure out how to get these functions working.

Sorry it's such a noob question!

Any help would be much appreciated :-)


texts: Solcjs doesn't use the last version of compiler

texts:
I am compiling a contract using the npm package solcjs.
The package is at version 0.4.21 (npm view solc).
However compilation fails because my pragma is set to ^0.4.21 while solcjs states current compiler is 0.4.19.

Please do you have any idea why solcjs doesn't use the latest version of the compiler? Is solcjs the right tool to compile and deploy manually contracts using web3.js? Thanks!

Contracts are being compiled as follows:

var compiledContract = solc.compile(source,1);
var abi = compiledContract.contracts[':Book'].interface;
var abiArray = JSON.parse(abi);
var bytecode = compiledContract.contracts[':Book'].bytecode;


texts: How to prevent frontrunning: someone running a transaction before me?

texts:
Let's say I have the following in my smart contract:

string passwordHash;
uint money;
function checkPassword(string cleanPassword, string newPasswordHash)[...]

When running the function checkPassword, I run it with the clean password. The clean password is then checked as sha256 with the passwordHash and if it's correct, the sender (normally me) gets the funds. But now following problem:

What if someone spectates my address, runs a transaction with more gas and gets "selected" before me: Is there a way to prevent someone "stealing the password from my transaction"? Is the only way to me run with more than enough gas?


texts: What is the neatest way to get hold of max uint256 in assembly?

texts:
Since Solidity v0.6.8, the neatest way to get hold of max uint256 in Solidity is this:
uint256 foo = type(uint256).max;

Is there something like that for Yul? I couldn't find anything in the docs.
I know about not(0) but I don't like it much.


texts: Should I store private data in a blockchain

texts: I saw some linked questions about this subject that it is possible to store private data;  in a blockchain. But the question here is: should I do that? Cause the data is there forever. And encryptions we cannot hack today are possibly easy to hack in about twenty years.. So what to do with private data?


texts:
I am new for ethereum and I have a few knowledge in ethereum token. I
already created my own custom cryptocurrency using ethereum wallet app.

Now I want to integrate it with my app for transaction and all. And
also want a user interface to manage wallet money/token for sending,
receiving, balance for all users.


texts: Web3 transaction execution is slow (5 secs)

texts:
I am trying to send a transaction to a contract through web3, with the following code:
const c = new web3.eth.Contract(contractData.abi, address)
console.log(new Date())
const x = await c.methods.drain().send(
      {'from': '0xxxxx', 'gasPrice': 5000000000}
)

Right before I send the transaction, I log in my console the current timestamp. When I check the transaction's timestamp through Etherscan, I usually get 5 secs more, meaning that the transaction takes 5 seconds to send.
How can I increase the execution speed? Will sending the request through RPC instead of Web3 help? Does it have to do with my node (unlikely, as I have 300 peers on a 32gb ram 16 core 720nvme server)? Will sending the transaction to multiple nodes help in increasing the speed at which the transaction is spread through nodes? Thanks for the help!


texts: How to specify node as a mining node or non mining node in geth

texts: As in private network of ethereum there can be nodes who only do mining and the nodes who didn't do mining.so In geth when we create nodes,How to specify nodes that they are mining node or an non mining node?How to set permission for node or specify a node to do  mining?


texts: If new smart contract is created with same symbol or name, is there any way owner/creator can access new contract?

texts:
I know of a situation where this was done, and somehow the creator /owner of last contract was able to transfer funds in new contract to several wallets. Was it because same symbol was used? Is there a function to RECALL transferred funds?

Thanks


texts: Issue with Ganche and Truffle with Metamask. Can't load token balance

texts:
I'm testing to create a token in Truffle; it compiles fine, but it won't load the balance of the token in to Metamask. I've set the connection correct: it does load the ETH balances of the Ganache chain correctly.

I'm not sure as to what is going on. This is the contract:

pragma solidity ^0.5.0;

contract TestToken{
    // Track how many tokens are owned by each address.
    mapping (address => uint256) public balanceOf;

    string public name = "TestToken1";
    string public symbol = "TTO";
    uint8 public decimals = 18;

    uint256 public totalSupply = 1000000 * (uint256(10) ** decimals);

    event Transfer(address indexed from, address indexed to, uint256 value);

    constructor() public {

        balanceOf[msg.sender] = totalSupply;

    }

    function isContract(address _addr) private view returns (bool is_contract) {
        uint length;
        assembly {
            //retrieve the size of the code on target address, this needs assembly
            length := extcodesize(_addr)
        }
        return length > 0;
    }

    function transfer(address to, uint256 value) public returns (bool success) {
        bytes memory empty;
        return transfer(to, value, empty);
    }

    function transfer(address to, uint256 value, bytes memory data) public returns (bool) {
        require(balanceOf[msg.sender] >= value);

        balanceOf[msg.sender] -= value;
        balanceOf[to] += value;
        emit Transfer(msg.sender, to, value);

       // if (isContract(to)) {
       //     ITokenReceiver(to).tokenFallback(msg.sender, value, data);
       // }
        return true;
    }

    event Approval(address indexed owner, address indexed spender, uint256 value);

    mapping(address => mapping(address => uint256)) public allowance;

    function approve(address spender, uint256 value)
        public
        returns (bool success)
    {
        allowance[msg.sender][spender] = value;
        emit Approval(msg.sender, spender, value);
        return true;
    }

    function transferFrom(address from, address to, uint256 value)
        public
        returns (bool success)
    {
        require(value <= balanceOf[from]);
        require(value <= allowance[from][msg.sender]);

        balanceOf[from] -= value;
        balanceOf[to] += value;
        allowance[from][msg.sender] -= value;
        emit Transfer(from, to, value);
        return true;
    }
}

As you can see its as basic as it gets. But in the Metamask console I see this:

  ui.js:1 failed to load balance for token at 0xaec97fa2a3bd75ac77a431e06e5fa0aeb7e3083e
  (anonymous) @........

  token updating failed Error: [ethjs-query] while formatting outputs from RPC '{"value":{"code":-32603,"message":"Internal JSON-RPC error.","data":{"originalError":{}},"stack":"Error: \"message\" must be a nonempty string.\n    at new......

What is causing that RPC error?  Is it me that made a mistake or some type of issue between ganache and Metamask?


texts: Trying to work with ganche-cli, truffle and infura

texts:
When trying to migrate a truffle-config.js file following error appears.
TypeError: Cannot read property 'fromMasterSeed' of undefined
any help would be much appreciated.
const HDWalletProvider = require('@truffle/hdwallet-provider');
 const mnemonic = '...(mnemonic from ganache-cli)';

module.exports = {

  networks: {

    development: {
      host: "127.0.0.1",     // Localhost (default: none)
      port: 8545,            // Standard Ethereum port (default: none)
      network_id: "*",       // Any network (default: none)
     },

     ropsten: {
     provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/24d0d20d8912488eaeb85f0e671caf3d`),
     network_id: 3,       // Ropsten's id

  },

  compilers: {
    solc: {
       version: "^0.4.1",

    }
  }
};

node v15.4.0
npm v7.0.15
web3@1.2.1
Truffle v5.1.58
Ganache CLI v6.12.1


texts:
I am trying to compile the example contract in https://ethereum.org/token and following along with the instructions.

The Ethereum wallet cannot compile it though. I get the following error message

 Expected ',' but got identifier
interface tokenRecipient { function receiveApproval(address _from,
uint256 _value, address _token, bytes calldata _extraData) external; }

^--------^

First time trying to do a contract in Ethereum, and figured that the example code from the official Ethereum website should work. Can anyone tell me what is wrong?


texts: Does Parity sync in the background task or does browser have to be open?

texts:
Does the Parity Wallet sync when background task is running, or do you have to keep the browser window open?  I'm a couple of 100K behind, and I thought I had the background task running continuously.

Can you do a transfer without being fully synced?
Also will the EOS "Claim" Function appear without being fully synced?


texts: Is it possible to interact with a contract deployed within another contract via web3js?

texts:
Be very helpful to know if the scenario below is possible

contract A {
import "./B.sol";

...
address c = new B();
b = B (c)

}

//somewhere in JS
instance_of_B = web3.eth.contract(B.abi).at(c);


texts: Compare structs and arrays with keccak256 in order to save gas

texts:
Just working on a solidity code last day, I figured out that apart of comparing bytes, strings etc...

The Keccak256 will be the perfect solution for comparing large arrays or big structs. Because as the Hash functions properties say:

  Given x and y with the assumption (x != y) => We can assume that H(x) != H(y)

So comparing it's hashes will make us spend a lot less Gas than iterating the array, and demonstrate us that they are or no equal (doesn't matter on which index).

So with an example:

Let's supose that we have 2 large arrays of the same type. Will it be possible to do something as:

Assert.equal(keccak256(array1)), keccak256(array2));

That is what you do in order to compare strings for example. (That if I'm not wrong, are interpreted as arrays at the end).

In order to don't do something like:

Assert.equal(array1[i], array2[i]);
//Implemented on a for loop from i=0 to i=minlength(arr1,arr2)

Obviously, other implementations as adding mappings or stuff like that can solve quite well the problem, but I'm interested on knowing if there's any trick that allows you to compare this types of stuctures with the keccak256().

Thanks.


texts: How to setup ethereum to work on gpus for complex smart contract execution?

texts: Basically the question is to apply some gpu intensive tasks like machine learning algorithms etc using smart contracts, is this possible using any of the available ethereum clients like geth or parity which may use any of the GPU-accelerated library like cuDNN by nvidia for a parallelly processed gpu powered workflow?


texts: Is there a way to retrieve private key of ganache account with web3?

texts:
web3.eth.getAccounts() returns list of accounts.
Is there a way around to get the private key of one of the account from the list returned from the above code?


texts:
Hi!
I have some data, like this ( 827ab7 ), encoding RLP.
How I can to know, what is it (string, list or int)?


texts: Why isn't Casper POS Dynasty set randomized?

texts: This may be premature to ask this question as POS for ethereum is still undergoing a lot of design changes, but it seems like from all the stuff I've come across that the validator set (eg. dynasty) is told ahead of time the epoch which they are going to be preparing / committing to.  Why isn't a validator given a epoch at random because it seems that there could be a attack vector where a attacker is able to coordinator with other ones to join a specific epoch to compromise?


texts: Exceeds block gas limit error to call view functions

texts:
With solidity view function, you can specific the amount of gas to use.
My understand is since it is not a state changing transaction, all the gas cost is not charged for, and the client should be able to allow the call function to run with a gas limit larger than the block limit.

According to
Can Solidity constant functions be arbitrarily complex?
I should be able to pass any amount of gas as a parameter.

However, my truffle & Ganache set up doesn't allow me to do so.

Example: instance.Mymethod.call({gas:900000000})

error: Exceeds block gas limit

Mymethod is a view function.

Can anyone tell me if this is a problem with the Ganache client or is it a legit constraint that read only (view, pure, constant) function should not consume more gas than the block limit?

Thank you,
Tao


texts: Calling payable state changing function on client side with metamask in ethereum infura testnet

texts:
I can't seem to find an answer for my problem, or it's either impossible and I'm missing something, or it's trivial and I'm missing something.

I have this function on client side:

const bet = web3.utils.toWei(bet.toString(), 'ether')
let gasEstimated = 135335 //default

Contract.methods.joinGame(id).estimateGas({ from: account, value: bet }).then(function (gasAmount) {
    gasEstimated = gasAmount
})

Contract.methods.joinGame(id).send({ from: account, gas: gasEstimated, value: bet }).then((result, error) => {
    if (error) return console.log('ERROR_PAYING', error)
})

It gives me an eth_sendTrasaction does not exist error.
My final objective would be for the client to pay with metamask once the joingame function is called.

Disclaimer: I also tried with web3.eth.sendTransaction

It works with ganache-cli


texts: Ethash vs Equihash in terms of memory hardness?

texts:
Ethereum's Ethash was designed to be memory hard with the intention of making the mining process ASIC-resistant. Zcash's Equihash algorithm also promises the same. How do these two PoW systems compare to each other?

Note: I'm not looking for a detailed explanation or differences in implementations etc. I just want to know how these algorithms effect miners and end-users. For example, in some video, I remember Vitalik saying that Ethash is 200 times more memory hard that Scrypt (used by Litecoin). I'm looking for similar comparisons between Ethash and Equihash.


texts: Can I use etherscan with my local development blockchain?

texts:
I would like to run my local private blockchain for development purpose, but without a good visualization tool, it is tedious to use.
I know Etherscan.io which is a great blockchain visualization tool. Can I connect Etherscan to a local blockchain? If not, would downloading the whole website and changing the address of the node to connect to make it possible?


texts:
in the network of the ether , i sent eth 2.62 but on the network ropsten eth
 of0xe2fcd50EfdD674C26f894aB5ad71fEcB14b7cDA4 = Ropsten wallet. money did not come, but they can be seen in the same wallet, but on the network of the ether, i can go into the wallet / but  can not send it back, an error is written in the network. how to send money? Can I send money after Constantinople?


texts: Does Ethereum have a list of developer "approved" unofficial wallets with their pros and cons?

texts:
Bitcoin offers a list of wallets here which is helpful for beginners in deciding what will work best for them (cold storage, web wallet, full node, SPV wallet, etc)
https://bitcoin.org/en/choose-your-wallet

Does Ethereum have something similar to help new users decide (preferably written by someone on the development team) which ETH wallet to use?


texts:
I would like to find a tool similar to https://bitref.com/ or https://blockchain.info/, that show how much ETH has been received by an address, in total. I've checked most of the Ethereum blockchain explorers, such as https://etherscan.io/ or https://www.etherchain.org/ but none of them seem to provide such information.

Is there any way to get it without having to run a full node and analyse the whole blockchain each time I want to get that info from one address?

To be clear, I'd like something like this:

Thanks!


texts: how to call java method via solidity contract

texts:
I have my solidity contract

//solidity contract

pragma solidity ^0.4.7;

   contract SimpleStorage {

    uint public storedData;

      function SimpleStorage(uint initialValue) {
        storedData = initialValue;
       }

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

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

    }

And I have JAVA program like this ,

   public class mySpecialClass{

      public int mySpecialfun(int a ,int b){
          int c;
            // c =my special treatment of a and b
               return c ;
                           }
                    }

I want to call  mySpecialfun() in my contract

eg:

      set(mySpecialfun(5,6) /* 5 and 6 just example   */)

my problem is to call java program in my contract
thank you for your help


texts:
I read in the literature that the limit for a Solidity transfer function is 2,300 gas units, because it prevents possible threats like reentrancy, etc.

However, I cannot understand why exactly 2,300 gas units are used. In my understanding, the dangerous instructions are SSTORE(that costs 20000 or 5000 gas units), SELFDESTRUCT (5000) and the different CALLS instructions (e.g., the CALL instruction requires 700 gas units + cost for each provided argument).

I did not find a (mathematical) justification for this imposed limit.


texts: I am wondering is it possible for me to read the event log of any contract in the blockchain? if yes how to do it? using web3js is there any snippet code to perform such task?


texts: Is there any easy way to mock test solidity on JavaScript?

texts:
The simplest way I'm aware of involves opening Test-RPC, making a Web3 instance, a contract, and then using it. That looks more complex than it should. Ideally, we should be able to do something like:

sm = require("solc-mock");

var contract = sm.mock(`
  pragma solidity ^0.4.11;
  contract Test {
    function add(uint x, uint y) constant returns (uint) {
      return x + y;
    }
  }
`);

console.log(contract.add("0x1", "0x2")); // output: 0x3
// also contract.add.send for txs

Is there any lib that would allow for some mocking as simple as this?


texts: Is "type" a reserved keyword in Solidity?

texts:
If I define the following struct like this:

struct MyStruct {
  uint256 type;
}

The Solidity compiler throws an error:

  Expected identifier but got 'type'

I checked to have no mistake in my code and, when changing "type" with anything else, the error goes away.

Is "type" reserved in Solidity?


texts:
I'm not able to watch and log event sent by smart contract using the Ropsten test network.
The same code works on local test network.

Contract Event code:

event CreateOptionEvent(address indexed _who, uint256 indexed _date, uint256 indexed _id);

function createOption( ...PARAMS HERE... ){

    [...]

    emit CreateOptionEvent(msg.sender, now, optionId);
}

Web app event code:

createEvent = myContractInstance.CreateOptionEvent({ fromBlock: 0, toBlock: 'latest' })
createEvent.watch((err, result) => {
    if (err) {
        console.log(err)
        return;
    }
    console.log(result.args._id)
})

After I correctly create an option (transaction success on metamask) nothing is logged.

What should I try to do?

-> % truffle version
Truffle v4.1.11 (core: 4.1.11)
Solidity v0.4.24 (solc-js)


texts: Why is Geth importing the same block multiple times?

texts:
I have this geth node that run in testnet and a program(worker) that will read the block every second. I notice sometimes, the geth imported segment chain with same block number but different hash, txs and other data.

If happen that the worker reads the block number(4926211) at first attempt, go through the transactions, and proceed to read the next attempt (repeat block 4926211), will it miss the other transactions? or will it effect the transactions that happen in that block?


texts: What is the best way to store and access large volume of data in blockchain?

texts:
I was creating a Dapp which will get KYC information from the user, I want to store this data in the blockchain. This data will be accessible through API and it will be used to do KYC process.

In private ethereum, if I try to store the data in smart contracts will it be effective. For each user, I need to store 20 types of data such as name, country, address, social media link, etc.


texts: see Ethereum USD value at time of transaction?

texts:
on Blockchain.info, when you hover over the value of a transaction, it will actually tell you the value of Bitcoin in USD at the time of that transaction (as well as how much that is worth now)

is there any platform or website for this in Ethereum?

thanks


texts: Using Ganache with an existing MetaMask account

texts:
I am attempting the Truffle "Ethereum pet-shop tutorial":

http://truffleframework.com/tutorials/pet-shop

I am in the stage where I am attempting to implement the smart contract on the local Ganache block chain, where I have to use the Ganache seed phrase to import the applicable Ganache den. However, I have an existing MetaMask den with some tokens and real ETH in it.

My question is: How can I import the Ganache den for local testing?

I have tried disabling and re-enabling the extension, but upon entering my password, it takes me to my existing den with the multiple tokens and ETH in it.

Help will be greatly appreciated.


texts: How do I approve a smart contract to spend my ERC20 tokens?

texts:
My first time here, please forgive me for any mistakes.
I made a custom ERC20 token using Openzeppelin ERC20PresetFixedSupply.
I want to use that in my contract.
I was using this code to test how IERC20 approve and allowance work.
    constructor(IERC20 token) {
        _token = token;
    }

    IERC20 private _token;

    function ERC20Balance() external view returns (uint256) {
        return _token.balanceOf(msg.sender);
    }

    function ERC20TotalSupply() external view returns (uint256) {
        return _token.totalSupply();
    }

    function ERC20Allowance() external view returns (uint256) {
        return _token.allowance(msg.sender, address(this));
    }

    function ERC20Approve() external returns (bool) {
        return _token.approve(address(this), _token.balanceOf(msg.sender));
    }

This is the output I got after execution. I approved balanceOf(msg.sender) for the contract to spend but it shows contract has 0 allowance.

What am I doing wrong here?
Thanks.


texts: How to unlock account to deploy contract without using personal.unlockAccount()?

texts:
When I have account keystore file on geth node http://192.168.43.201:8545  , I can deploy a contract like below:

const web3 = new Web3('http://192.168.43.201:8545');
...
const contract = new web3.eth.Contract(abi);
...
await web3.eth.personal.unlockAccount(myAddress, "abcdef");
contract.deploy({
        data: bytecode,
        arguments: ['Test', 'Test', 12, 123]
    })
    .send({
       from: myAddress,
       gas: estimatedGas
    })

However, If have no keystore file, can not use web3.eth.personal.unlockAccount() to unlock.
Is there a method to use private key directly?


texts: will sendTransaction check function before broadcast to the network?

texts: If I have a function with precondition check at the beginning that uses only SLOAD, and I perform a sendTransaction on this function. Assuming the precondition check immediately failed and exit. Will the geth detect this and stop the broadcast? Or regardless it will broadcast to the network and cost me gas.


texts: How privacy can be ensured in smart-contracts?

texts:
When a smart-contract is created following an agreement between two entities, how the state of that contract (data) can be kept secret to only the two contractors?

I heard about Quorum, but how privacy can be ensured while the contract will be executed by the network validators?

Is Quorum the best choice and can handle privacy for any use cases? or is designed for specific cases only?

Thanks.


texts:
I found that on the web of quiknode it says quiknode do not support eth sign and maybe infura does not also
What should I do ? I want to use ethereum.php so I need to create eth sign and send transaction by php if the api do not support eth sign. Whether this means I need to use some other way to do it such as nodejs


texts: Why is the value of variable in solidity state empty?

texts:
I have the following code

contract User {
    using strings for *;
     address public DB;
    function User(address _DB) {
        if(_DB == 0x0) throw;
        DB = _DB;
    }
    function setUser(string name, string email) public {
        UserLibrary.setUser(DB, msg.sender, name, email);
    }

After the deploy of the contract, on remix when i try to fetch the value of DB from the contract, It says call to EthMeetUser.DB and nothing else.
During the debug of setUser in remix, DB in the solidity state is 0x0X

UPDATE:

I used to use Ganache and it will run on the port 7545 by default and I set the environment in remix as web3 provider and the above mentioned problem appears,
Similarly if I set the environment to Javascript VM the problem doesn't appear.

Not sure what I have been doing wrong. Someone please point me right?


texts:
I have this contract

pragma solidity ^0.4.20;

contract cntrct {
    uint public testVal;

    function runF() payable public
    {
        testVal += msg.value;
    }

    function reader() public view returns(uint)
    {
        return testVal;
    }
}

I know this contract doesn't make much sense but it is for testing purposes. So first I execute my javascript.

//SETUP
const fromAddr = '0x1...';
const toAddr = '0x2...'; //Contract
const contractName = ':cntrct';
const Web3 = require('web3');
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
const solc = require('solc');
const input = fs.readFileSync('Token.sol');
const output = solc.compile(input.toString(), 1);
const bytecode = output.contracts[contractName].bytecode;
const abi = JSON.parse(output.contracts[contractName].interface);
var contract = new web3.eth.Contract(abi, toAddr);
contract.options.address = toAddr;

//DEPLOY
var deployed = contract
    .deploy({
      data: bytecode,
      arguments: [[]]})
    .send({
      from: toAddr, //From the contract to the contract
      gas: 4700000,
      gasPrice: '30000000000'},
    function(error, transactionHash) {console.log(error)});

Untill this point I assume everything went ok. The transaction showed up in the testRPC

Transaction: 0xa7ce099a9dd373e92d98ee34770f7db82329b25fd4a901c3fb90fd4f53221dd0
Contract created: 0x1df090c0785d203ad0f080a6f642eb3b8c0a7758
Gas usage: 118306
Block Number: 7
Block Time: Sun Mar 11 2018 09:41:39 GMT+0100 (Romance Standard Time)

So now I want to send my first transaction and execute runF() with it.

//Create data to be send with the first transaction,
// this step is crucial for my situation.
var data = web3.utils.sha3("runF()").substring(0, 10);

//Send the transaction
web3.eth.sendTransaction({
    to: toAddr,
    from:fromAddr,
    gasPrice: '30000000000',
    gas: '50000',
    data: data,
    value: "1000000000000000000"}); //1 ether

The transaction shows up in the testRPC

Transaction: 0x939776bfedd6da6c9b2cb54b8149bdc2e0a70d331b3109331a26ee31937235de
Gas usage: 21272
Block Number: 8
Block Time: Sun Mar 11 2018 09:41:46 GMT+0100 (Romance Standard Time)

And in remix I get these transaction details

from  0x1...
to    0x2...
gas   50000 gas
hash  0x939776bfedd6da6c9b2cb54b8149bdc2e0a70d331b3109331a26ee31937235de
input 0x9b4f5e44
value 1000000000000000000 wei

My final step is to call the reader() function.

contract.methods.reader().call().then(function(i){console.log(i)})

And this will output

Promise {
_bitField: 0,
_fulfillmentHandler0: undefined,
_rejectionHandler0: undefined,
_promise0: undefined,
_receiver0: undefined }
> 0

When I click on the reader button in remix it states 0 as well. So my question is, why is my output still 0? I'm expecting it to be 1 ether because I have sent 1 ether and my contract should update the testVal to the sent value.

What I want to accomplish by doing it this way is that I want to publish the transaction data so anybody can execute my contract's function by sending ether + data from their own wallet, so without any UI that corresponds with the contract.


texts:
Is the address under the Ethbase account in mist a public address?

If so, how do I find the related private key?


texts: Could there be multiple asset pools In a DAMM liquidity pool?

texts:
In a DAMM (dynamic automated market making) DEX (decentralized exchange) the ration between two assets, e.g. DAI/ETH does not have to be 50/50 anymore, like it used to be in a AMM, (automated market making). Because of dynamic price change by an oracle. So the ratio could be 90/10 as well, or anything.
Also, one could just provide liquidity to ETH for instance, and would still get LP tokens and fees.
Could there be liquidity pools of multiple assets? Sucha as DAI/ETH/LINK, where the ratio dynamically change based on providers and price changes.
And if yes, could there be a pool, where not just 3, but 100s of cryptos would be present?


texts: Identify and list all ERC-721 and ERC-1155 token using a node

texts:
I want to get a list of all ERC-721 and ERC-1155 based contracts. How can I do this using an Ethereum node? Do I need a full node to achieve this?
Google BigQuery only supports ERC-721 tokens right now.


texts:
Hi i write simple contract to test.
Does he have any known mistakes or bugs?
What would you change in it for the better?
Thanks for answer.

pragma solidity ^0.4.21;

contract Lock {
    uint256 public value;
    address public owner;
    uint256 public lockedUntil;

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

    function construct() public payable  {
        value = msg.value;
        owner = msg.sender;
        lockedUntil = now + 5 days;
    }

    function withdraw() public onlyOwner {
        require(block.timestamp > lockedUntil);
        msg.sender.transfer(value);
    }
}


texts:
I'm mining on nanopool with Claymore's miner.
This is the batch file:

setx GPU_FORCE_64BIT_PTR 0
setx GPU_MAX_HEAP_SIZE 100
setx GPU_USE_SYNC_OBJECTS 1
setx GPU_MAX_ALLOC_PERCENT 100
setx GPU_SINGLE_ALLOC_PERCENT 100

  EthDcrMiner64.exe -epool eth-eu1.nanopool.org:9999 -ewal      0x2Da97a1Ad55e270Ae53441fF4f70b501F58b8cbe/rx470/xxx@yyy.de

I don't need geth since I'm mining on a pool right? When I check MyEtherWallet it still prints 0 after 9h of mining with 25 MH/s. Nanopool pays out 4 times a day minimum 0.1 ETH. I already had this problem with ethpool after mining a whole evening and night.

Edit:
I created an account at MyEtherWallet and check my balance by private key. The address in the script matches my wallet - double checked.


texts: How to validate a transaction from any block in Blockchain

texts:
Given that we have a Blockchain with smart contracts. We have end users operating the platform for some time. Now one user wants to verify the claim of a transaction.
Example, I have to prove that last month I have transferred some amount from my account to another user account.
I know that the blocks are mined and synced with all nodes in the blockchain. In order for me to prove the above transaction, hope do I prove.
Should I write a separate smart contract to validate our how can we get this proved. I have searched the internet and found ways of generating the blocks, but not on validation.


texts: ParserError: Function, variable, struct or modifier declaration expected. ^

texts:
pragma solidity >=0.5.0 <0.6.0;

import 'openzeppelin-solidity/contracts/token/ERC20/ERC20.sol';

 contract NautCoin is ERC20 {

  // string public constant name = 'NautCoin';
  // string public constant symbol = '0x0';
  // uint public constant decimals = 18;
  uint public timeLock = now + 1 days;
  uint256 public INITIAL_SUPPLY;
  address public player;

  constructor(address _player)
  public {
    player = _player;
    INITIAL_SUPPLY = 10000 * (uint256(decimals()));
    // _totalSupply = INITIAL_SUPPLY;
    // _balances[player] = INITIAL_SUPPLY;
    _mint(player, INITIAL_SUPPLY);
    emit Transfer(address(0), player, INITIAL_SUPPLY);
  }

  function transfer(address _to, uint256 _value) public returns(bool) {
    super.transfer(_to, _value);
  }

　function approve(address _spender, uint256 _value) public returns(bool) {
　  super.approve(_spender, _value);
　}

  // Prevent the initial owner from transferring tokens until the timelock has passed
  modifier lockTokens() {
    if (msg.sender == player) {
      require(now > timeLock);
      _;
    } else {
     _;
    }
  }
}

How do you resolve this error?


texts:
I've seen Blockchain use case in healthcare but it doesn't quite answer my question.

I would like to know if there is a real use case for blockchain in healthcare or if it is just a buzzword that they are trying to incorporate to impress people who don't know better.

The general problem in healthcare appears to be that data is stored in various siloed locations and has multiple formats. The other key concern is patient anonymity but at the same time, if the data is fully anonymized and aggregated, researchers would like to use it for their work.

I have seen some proposals to use blockchains to solve these issues but I can't yet clearly see how or why it has to be blockchains. Does anyone see why traditional distributed databases with standardized data formats are insufficient for the things I've mentioned?

TL;DR How can one really use blockchains in healthcare applications, if at all?


texts: Storing results on web3 call in JavaScript Object

texts:
Disclaimer: Terrible at Javascript

I am trying to loop through events and store the block number, to and from accounts in a Javascript object. I am not sure what I am doing wrong, but it isnt working as planned. I would appreciate any pointers on this.

const Web3 = require('web3')
const web3 = new Web3(new Web3(`https://mainnet.infura.io/v3/{SOME_PROJECT_ID}}`));

var contract = new web3.eth.Contract(contractAbi, contractAddress);
var accounts = {};

// Crawl the Chain from the Contract Deployment Date till the latest block
contract.getPastEvents(
    'Transfer',
    {
      fromBlock: 8437000,
      toBlock: 'latest'
    },(error, events) => {

    if (!error){
      var obj=JSON.parse(JSON.stringify(events));
      var array = Object.keys(obj)

    //   Looping through returned array and adding to the account{} JavaScript Object
      for (var i = 0; i < array.length; i++) {
        accounts[obj[array[i].blockNumber]] = obj[array[i]].blockNumber;
        accounts[obj[array[i]._from]] = obj[array[i]].returnValues._from;
        accounts[obj[array[i]._to]] = obj[array[i]].returnValues._to;
    }
    }
    else {
      console.log(error)
}

// This prints nothing
for (var i = 0; i < accounts.length; i++) {
    console.log(accounts[i].blockNumber);
}
// The result of this is `[ [ 'undefined', '0x811573775614C5290690E9788c373111c1543D7A' ] ]` which is just one item.
console.log(Object.entries(accounts));
})


texts: How can I display amount ETH funded and ICO-token received on a webpage

texts:
How can I display amount ETH funded and ICO Tokens received on a webpage in a crowdsale ICO campaign?

The webpage is the personalised customer page after login.

I will display the ethereum adress. When transaction is completed, I want that the customer can see the amount he funded and the amount of the new tokens he received.

I understand, that I can use APIs on etherscan.io, for exemple to get balance of an address. But how do I provide the adress on first login and how can the address stay the same and be displayed for acounts on every login?

Is there a tutorial or template for this?


texts: Where are precise details of the Kademlia spec for RLPx?

texts:
I need a precise spec for the RLPx p2p algorithms. Right now the wiki says "kademlia like" and that is not sufficient. The original paper from Maymounkov and Mazieres is confusing, widely misunderstood, and Kademlia implementations vary.
Is there an agreed interpretation of Kademlia documented?


texts: Is there any way to find all of the Sep/Oct 2016 DDos accounts?

texts:
This EIP allowed for the cleaning up of the nearly 20 million DDos accounts created during the September/October 2016 DDos attack. The solution had two parts: (1) the node code had to be changed to delete 'dead' accounts, but only if those accounts were subsequently 'touched', and (2) someone (the Etereum foundation) had to generate transactions that 'touched' those accounts (which were dead) so they would get deleted.

My understanding is that Vitalik ran some sort of off-chain script that sent zero ether to all 20 million accounts (and that by doing this, the accounts got deleted), but I'm not sure if that's correct.

Is there any way to get a listing of all 20 million accounts that were 'touched'?


texts: Parity node is slow in syncing ethereum Ropsten net

texts:
I'm using a parity node for the purpose of checking transactions, address balances and generate new addresses via the RPC interface.

I noticed lately that the balance of the addresses are not updated in my tests.

Looking at the parity logs, it seems that the node is very slow in syncing, the blocks that is imported are way behind the last blocks generated.

For example, now I see

Feb 12 08:02:04 myserver parity[19772]: 2019-02-12 08:02:04 UTC Imported #4997995 0xb508…a0e7 (6 txs, 0.34 Mgas, 42 ms, 2.11 KiB)
Feb 12 08:02:08 myserver parity[19772]: 2019-02-12 08:02:08 UTC   21/25 peers      6 MiB chain   69 MiB db  0 bytes queue  236 KiB sync  RPC:  0 conn,    0 req/s, 1893 µs
Feb 12 08:02:16 myserver parity[19772]: 2019-02-12 08:02:16 UTC Imported #4997996 0x22cc…1e70 (7 txs, 4.42 Mgas, 42 ms, 16.53 KiB)
Feb 12 08:02:38 myserver parity[19772]: 2019-02-12 08:02:38 UTC   21/25 peers      5 MiB chain   69 MiB db  0 bytes queue  236 KiB sync  RPC:  0 conn,    0 req/s, 1893 µs
Feb 12 08:03:08 myserver parity[19772]: 2019-02-12 08:03:08 UTC   21/25 peers      5 MiB chain   69 MiB db  0 bytes queue  236 KiB sync  RPC:  0 conn,    0 req/s, 1893 µs
Feb 12 08:03:13 myserver parity[19772]: 2019-02-12 08:03:13 UTC Imported #4997997 0x5a93…bba8 (20 txs, 5.11 Mgas, 81 ms, 19.17 KiB)
Feb 12 08:03:28 myserver parity[19772]: 2019-02-12 08:03:28 UTC Imported #4997998 0xd8ff…abee (3 txs, 0.10 Mgas, 13 ms, 0.94 KiB)
Feb 12 08:03:37 myserver parity[19772]: 2019-02-12 08:03:37 UTC Imported #4997999 0xca51…abb7 (3 txs, 0.09 Mgas, 6 ms, 1.13 KiB)
Feb 12 08:03:38 myserver parity[19772]: 2019-02-12 08:03:38 UTC   21/25 peers      6 MiB chain   69 MiB db  0 bytes queue  236 KiB sync  RPC:  0 conn,    0 req/s, 1893 µs
Feb 12 08:03:48 myserver parity[19772]: 2019-02-12 08:03:48 UTC Imported #4998000 0x2ec3…9551 (4 txs, 4.38 Mgas, 12 ms, 16.35 KiB)

And the last block seems to be 5003302

So it seems to me it cannot catch up and that is why I cannot see the last transactions, more specifically the balances of the addresses that received eth lately.

Can you tell from this output if the node's network is very slow? How can I debug/solve this?

It used to work fine until a few days ago.


texts: Testing Gas Token on testnet failing transaction

texts:
I am trying to test my contract with gas token but I am getting fail txs which doesn't tell much the cause. This contract works properly if I do not  include the parts related to gas token so i am unable to specifically identify the cause of issue. Here is the snippet of my contract.
interface IFreeFromUpTo {
    function freeFromUpTo(address from, uint256 value) external returns (uint256 freed);
}
contract MyContract {
  address payable manager;
  address internal constant UNISWAP_ROUTER_ADDRESS = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
  address internal constant WETH_ADDRESS = 0xd0A1E359811322d97991E03f863a0C30C2cF029C;
  address internal CHI_ADDRESS = 0x447287b508b58513DE6Cd20D9d787CF7e411b5aE;
  WETH9_ internal WETH;
  IUniswapV2Router02 internal uniswapRouter;
  IFreeFromUpTo internal chi;

  constructor() public {
    uniswapRouter = IUniswapV2Router02(UNISWAP_ROUTER_ADDRESS);
    WETH = WETH9_(WETH_ADDRESS);
    manager = msg.sender;
  }
  modifier restricted() {
      require(msg.sender == manager, "manager allowed only");
      _;
  }
  modifier discountCHI() {
    uint gasStart = gasleft();
    _;
    uint gasSpent = 21000 + gasStart - gasleft() + 16 * msg.data.length;
    chi.freeFromUpTo(msg.sender, (gasSpent + 14154) / 41947);
  }
  function Buy(uint amountOut, uint amountInMax, uint deadline, address tokenAddress) external payable restricted discountCHI {
    uniswapRouter.swapTokensForExactTokens(amountOut, amountInMax, getPathForETHtoToken(tokenAddress), address(this), deadline);
  }
  function Sell(uint amountIn, uint amountOutMin, uint deadline, address tokenAddress) external payable restricted discountCHI {
    uniswapRouter.swapExactTokensForTokens(amountIn, amountOutMin, getPathForTokentoETH(tokenAddress), address(this), deadline);
  }
  // important to receive ETH
  receive() payable external {}
}

Here is a tx that gets fail https://kovan.etherscan.io/tx/0x4759e8dda276470489648e23530c3502a97794db89ed14e9ee93c48b607c31f7


texts: Truffle test fails while checking if the contract instance has the owner address

texts:
As I was going through the truffle test for the smart contract below to check if it has the owner address:

pragma solidity >=0.4.21 <0.7.0;

contract Owner {
    address public owner;
    address public nextOwner;
    constructor () public {
        owner = msg.sender;
    }
}

it fails with the message below:
after running the truffle test.

Using network 'development'.

Compiling your contracts...
===========================
> Compiling ./contracts/Owner.sol
> Artifacts written to /tmp/test-2020319-8538-1ih1ur3.6ijj
> Compiled successfully using:
   - solc: 0.5.16+commit.9c3226ce.Emscripten.clang

  Contract: Owner
    The attributes
0x7C94D330943a4a6CC1c25eF043446dA1898F4688
      ✓ has the address
      1) has the owner
    > No events were emitted

  1 passing (406ms)
  1 failing

  1) Contract: Owner
       The attributes
         has the owner:

      has owner address
      + expected - actual

      -0x0000000000000000000000000000000000000000
      +0xBcB8563A1f9707BDa6bb020222b664Ddc100e5a4

      at Context.it (test/DIce.js:21:20)
      at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:189:7)

It is clear that the actual and the expected was not equal.

The test script I was using is below:

const Owner = artifacts.require('./Owner.sol');

contract('Owner', accounts => {
    const owner = accounts[0];
    const nextOwner = accounts[1];

      describe('The attributes', () => {
        let ownerInstance;
        beforeEach(async () => {
            ownerInstance = await Owner.new();
        });

        it('has the address', () => {
            const address = ownerInstance.address;
            assert.notEqual(address, '0x0', 'has contract address');
            console.log(address);
        });

        it('has the owner', async () => {
            const address = await ownerInstance.nextOwner();
            assert.equal(address, owner, 'has owner address');
        });

});

});

Could you please advice?
I would appreciate discussions over this.
Thanks.


texts: Using a high level delegate call in upgradable contracts since Byzantium

texts:
Since Byzantium we can implement upgradable proxy contracts much easier with the use of returndatacopy and returndatasize assembly instructions. This means we no longer have to register return types and sizes like when using the EtherRouter.

The most reliable way we know how to structure a proxy contract is like the Zeppelin Proxy where the delegatecall is made in assembly. However, it also seems to work when doing the delegatecall as a high level Solidity call where the proxy contract fallback function looks like this instead:

function () public {

    bool callSuccess = upgradableContractAddress.delegatecall(msg.data);

    if (callSuccess) {
        assembly {
            returndatacopy(0x0, 0x0, returndatasize)
            return(0x0, returndatasize)
        }
    } else {
        revert();
    }
}

This approach (see the whole proxy here) is a bit more succinct and requires less knowledge of assembly to understand. My minimal tests for this approach seem to work.

So in what situations will this high level approach not work?

And if there aren't any, how likely is it that the compiled bytecode for the high-level delegatecall will change between versions of Solidity, breaking this approach for those versions?


texts: Why do proof of stake protocols use quorums of 2/3 instead of 51%?

texts:
I've noticed many protocols using validators like Casper, Tendermint, EOS require 2/3 of nodes (weighted) as the quorum requirement.

What's the reasoning for using this seemingly arbitrary number? Why not 51%?