texts: How to assign ether value at deployment of contract

texts:
I am trying to run this buyer seller contract in truffle using testrpc.
I am unable to assign the address and value for seller at the time of deploying contract. Here is my solidity code and deploy.js code

contract Purchase {
  uint public amount;
  address public seller;
  address public buyer;

  function Purchase(address addr, uint _amount) {
    seller = addr;
    amount = _amount;
  }

  function confirmPurchase(address _buyer, uint val) {
    buyer = _buyer;
    if ( val == amount) {
      buyer.transfer(amount);
      seller.transfer(this.balance);
      seller.balance;
    }
  }

  function getBalance() returns (uint balance) {
    return seller.balance;
  }

  function getAddr() returns (address) {
    return msg.sender;

  }
}

Deploy.js code:

var Purchase = artifacts.require("./Purchase.sol");
module.exports = function(deployer) {
 deployer.deploy(Purchase,"0x13ac3e54b3d46757b6534e8b1c068caadb88da4a", 10);
};


texts:
I am trying to learn from other contracts and have seen an example which I do not understand. In this example a first contract is defined as follows, but it seems that the functions do not actually do anything. (BTW this is the etherdelta smartcontract...)

contract Token {

  //part of the contract functions goes here

  function transfer(address _to, uint256 _value) returns (bool success) {}

  // other part of the contract functions goes here
}

Then, a new contract is defined, which seems to refer to the first contract:

contract StandardToken is Token {

  function transfer(address _to, uint256 _value) returns (bool success) {
    //Default assumes totalSupply can't be over max (2^256 - 1).
    //If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
    //Replace the if with this one instead.
    if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
    //if (balances[msg.sender] >= _value && _value > 0) {
      balances[msg.sender] -= _value;
      balances[_to] += _value;
      Transfer(msg.sender, _to, _value);
      return true;
    } else { return false; }
  }

Can anybody explain me please what this does?


texts: Does create2 increase the nonce of the computed contract’s deployment address?

texts:
Simple question about create2 failure.

Does create2 increase the nonce of the computed contract’s deployment address ? Or does the first nonce increment operation happens after the first call to the deployed address ?


texts: Get ETH and Token Balances of Wallet address

texts:
How do I get a simple and fast balance of ETH and all Token owned/stored within a wallet address?

I have seen similar question and the closer answer was in this demo: http://wbobeirne.com/eth-balance-checker-demo/

but why it returns only a subset of tokens? and does it make sens that it seems to "scan" all smart contracts looking for "holdings?

thank you all


texts:
I instantiate the following contract with _number as 10. When I check the value of number, I get 72370055773322622139731865630429942408293740416025352524660990004945706024960. Is this a problem with my contract, or is this a web3 bug?

contract Thing{
  uint public number;
  function Thing(bytes32 _number){
    number = uint(_number);
  }
}


texts:
I just want know, If I use this command for create public ethereum node,
please tell me if there are any changes to be done this cmd line
use Azure VM,

  geth --identity "Test.Node" --rpc --rpcport 8080 --rpcaddr "127.0.0.1" --rpccorsdomain "*" --datadir test.node --port 30303 --nodiscover --rpcapi db,eth,net,web3,personal,txpool --networkid 1 console


texts:
I'm new to crypto, and when attempting to "swap" tokens in my Meta-mask wallet, I accidentally "sent " them to my Free-wallet. However, as Free-wallet does not support that specific token, the transaction went to their Cold Wallet. Free-wallet cannot do anything until until if/when they ever support the specific token.
Using Ether-scan I can see my transaction sitting there. I also see a tab labeled "Write Contract" which has options such as "Transfer". It also allows me to connect my Meta-mask wallet.
My Metamask address is the obviously identical to the address where the initial transaction originated, and is the same where I want it sent back to if possible.
QUESTION:
Does this mean there is a way I can reverse the transaction or send my tokens back into my Metamask wallet? If so, how??
I've toyed with it, but when prompted, the Metamask pop-up window shows the value of my tokens as being the gas fee...and I was too afraid to do anything more. That would be a gas fee of a few thousand dollars and Zero tokens transferred.
I don't know what to do. PLEASE HELP, if possible.


texts: How to decode input data from a contract transaction without ABI?

texts:
I've found some libraries which decode input from transaction,  but all of them require ABI of contract.

Can I decode input data if I know only txHash, contract address and input data?

How etherscan does it?

Here is an example:
https://etherscan.io/tx/0x42afb58ccd19e5f30c4e41a352cdc99e6e3f5ba05191215123e935dc15f55c93

Input data is decoded, but there is no source code (ABI) for that contract.

P.S. I'm interested more in JS libraries, but programming language is not so important.


texts: Why do dapp websites ask me to connect to them?

texts: I don't understand why we need to run our own nodes to be using a DApp? Can they just run their own nodes instead?


texts:
Can someone suggest me how to use estimateGas for function calls like below:

await (MyContract.methods.addDoc(id,sha256hash).send({from: coinbase[0],gas: 1000000})


texts:
I've been researching this for about a month now (motherboards, GPU, PSU, racks, Watts etc) and ready to pull the plug on the Very Late just-getting-into-it.

I'm simply thinking about a single 6 GPU miner.

Of course, there are people on Amazon and Craigslist, etc selling the complete rigs (Talking ETH here, not ASIC)
From what I can tell, these builders are taking a measly $200-$300 profit.
Anyways, those units somewhat tempt me, as I'm having a hard time finding the hardware required in a short window of time.

Thoughts on 'aftermarket' sales of built rigs?

--edit--
Specifically thinking of security.  Has there been any historical scams with pre-built miners?


texts:
What does it mean by my weight and the network weight in POS ?

-Thanks.


texts: Security Implications of allowing remote RPC connections to Geth Node

texts:
What are the security Implications of allowing remote RPC connections to Geth Node?

If one absolutely needs to allow remote rpc connections for web3 connection, how can one do this while securing the geth node?


texts: Web3 error: "value out of bounds" when passing in value for smart contract call

texts:
When calling a function on a smart contract that takes a tokenID, I pass in the tokenID into web3 - but web3 then parses that string into another value it seems, pads it to the  left with a ton of zeros and then the contract call fails.
tokenID: "5347359381416754638292106073567748474581852345025787828513953871505554409252111"
export async function getTokenURI(address, tokenID) {
  try {
    console.log(address, typeof tokenID);
    return await getterContract(ABI, address, "tokenURI", [tokenID]);
  } catch (err) {
    console.log(err);
    console.log(address, typeof tokenID);
    return "";
  }
}

export const getterContract = async (ABI, address, methodName, params) => {
  try {
    const contractInstance = await getDeployedContract(ABI, address);

    return await contractInstance.methods[methodName](...params)
      .call()
      .then((res) => {
        return res;
      });
  } catch (e) {
    throw e;
  }
};

Calling getTokenURI and passing in the token ID above - the actual value web3 is sending to the contract is:
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005347359381416754638292106073567748474581852345025787828513953871505554409252111
Instead of the correct value of 5347359381416754638292106073567748474581852345025787828513953871505554409252111
When passing in a smaller value such as 123456 it works fine.
Both values are passed into the function as strings - so not sure why the length of the string matters?
It seems to be converted or something since its padded to the left with a ton of zeros.
How to fix this?


texts: I want to write Time based Trigged Method in Solidity

texts:
I want to write Time based Triggered Method in Solidity.  Suppose I want to transfer toke after a certain time interval. It should trigger time once that time occurred.

Is it possible?


texts: how can we get ledger way of Debits/Credits happened on blockchain

texts:
i am using geth and want to have a list of all the transactions (debits/credits) happened on my privatenet. like the way ledger is being used.
is there any way to do this?  and how to get all the transactions of a given address? any other way other than using a contract? could you please help me to solve this.


texts: Transaction having low gasPrice makes all the other transactions hang on the pending state

texts:
I have a small private network that has a proof-of-authority engine created via geth-clique using Geth Version: 1.8.3-unstable, currently there are three signer nodes and two other non-signer nodes (lets call them peer-A and peer-B). peer-A and peer-B are connected to three signer nodes.

First, I sent a transaction with very low gasPrice such as 200, on peer-A as shown below.

eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[1], value: web3.toWei(0,0000, "ether"), gasPrice: 200})

Later when I sent more transactions on peer-A even with greater gasPrice, all of those transactions will remain on the pending state. As I understand submitted transactions work as FIFO queue and my upcoming transactions are stuck
since the first send transaction with very low gasPrice locks others.

Example: (First peer-A and peer-B sent a Tx with low gasPrice and later their other Tx with high gasPrice stuck on their pending state.)

I have fix this situation by cleaning my chaindata on peer-A, which also cleans all pending transactions: rm -rf private/geth, and later I send my transactions with larger gasPrice. I assume this was a very inefficient solution for networks has a large chain.

So all sent transactions are provided as FIFO queue? Why not they selected based on which has the highest gasPrice?

Please note that I have tried:

eth.resend(eth.pendingTransactions[0], web3.toWei(1000, 'gwei'))

but faced with following error:

Error: intrinsic gas too low or Error: replacement transaction underpriced error.

[Q] How could I solve this problem, how could I remove the pending transaction on the system which has a low gasPrice or reject them or update their gasPrice value and resend() them?

Github issue: https://github.com/ethereum/go-ethereum/issues/16284


texts: push to a temporary array within a function

texts:
I come from nodejs and this seems odd to me..
can't seem to push anything to a temporary array.
    function get_unconfirmed() public view returns (address[] memory, uint[] memory, uint[] memory) {

        address     [] memory _address;
        uint        [] memory _wei;
        uint256     [] memory _ssboe;

        for(uint i = 0; i < deposit_request.length; i++){

            if(deposit_request[i]._confirmed){
                _address.push(deposit_request[i]._owner);
                _wei.push(deposit_request[i]._value);
                _ssboe.push(deposit_request[i]._ssboe);
            }

        }

        return (_address, _wei, _ssboe);
    }


texts:
I did ethereum token for test in ropsten network, when i try buy some token, there is error in transaction: https://ropsten.etherscan.io/tx/0x14b75395c6db502172dc7e6fddda0fc4c319e4e9cbdbfa39ae4c16c68c99367f

Contract source is here - https://ropsten.etherscan.io/address/0x944d80528b1669119bfc635aea0f088f1697dc63#code

How fix it?


texts: Etherscan: Verify and Publish Source Code - Error! Library Name and Address was provided but not used in the contract

texts:
Tried to verify my Smart Contract on Etherscan for Ropsten. Smart Contract is a library which actually also imports another library (which is already verified).

Getting following error

Error! The Library Name () and Address () was provided but not used in the contract

When I try using the beta source code verifier

Exception #3 Occured: Error! The Library_1 Name () and Address () was provided but not used in the contract


texts: Thoughts about implementing masternodes in a ERC20 Token

texts:
I am developing a cryptocurrency on top of ethereum blockchain that will have some sort of rewarding features for the large hodlers of the coin.

I know two ways of doing that:

Airdrop - like Pundi X is doing everymonth
Masternodes - like Dash, COLX, etc are doing

But according to my understanding ERC20 tokens can not implement masternodes because it is against consensus mechanism and Tokens are nothing but just another smart contact. So, I think it is 100% impossible to do that.

What do you think about it? Please correct me if I am wrong in here.

And what are the ways I can reward the large amount of hodlers of the token every month like Pundi X?

TL;DR Ways of rewarding large hodlers of a token.


texts: How do I stop and uninstall Geth (deleting everything)?

texts:
I am completely new to Ethereum and Geth. I tried to install Geth, and while it was syncing, I realized mining ethereum on my laptop would not be a good idea, as I don't have a GPU and it would be too slow.

Now I would like to uninstall Geth from my computer. How do I get the syncing to stop? I tried uninstalling the geth app, but it said "Windows cannot find c:\Program Files\Geth\uninstall.exe"

Any help with this would be greatly appreciated - thanks!


texts: Nethereum C# FilterInput.GetAllChanges always empty

texts:
I use Nethereum in my project to get all pending transactions on a specific smartcontract address. To do that based on the existing docs and Nethereum playground I try the following:

private async Task MonitorPendingTransactions()
{
    var web = new Web3Geth("http://***.***.***.***:8545");
    var transferEventHandler = web3.Eth.GetEvent<TransferEventDTO>(contractAddr);
    var filterAllTransferEventsForContract = transferEventHandler.CreateFilterInput();
    var allTransferEventsForContract = await transferEventHandler.GetAllChanges(filterAllTransferEventsForContract);
    Thread.Sleep(10000);
    allTransferEventsForContract = await transferEventHandler.GetAllChanges(filterAllTransferEventsForContract);
}

My TransferEventDTO is the same as in the official docs in the same place:

[Event("Transfer")]
public class TransferEventDTO : IEventDTO
{
    [Parameter("address", "_from", 1, true)]
    public string From { get; set; }

    [Parameter("address", "_to", 2, true)]
    public string To { get; set; }

    [Parameter("uint256", "_value", 3, false)]
    public BigInteger Value { get; set; }
}

So far i have 2 issue:

I cant specify the starting block from which i'd like to get output, like pending instead of latest
GetAllChanges() always returns 0 objects, no matter how long i wait, am I doing something wrong in filter configuration or pending transactions should be queried via some other way?


texts:
As per my understanding transactions are signed before sending to Ethereum. Else, no transfer of Ether will happen. However, messages sent to Smart Contracts (SC) aren't signed (e.g., using methods.myMethod.send). While this is a problem as anyone can call a SC, I understand that we can write SC in such a way that it responds only to a message coming from a given address. This way we can prevent any Ether or Token is not transferred to an attacker.

My question is, can an attacker send messages to a SC while masquerading an address (as there's no signature) that the SC is willing to accept? By doing so, can the attacker burn Ether of that account (as gas is consumed to execute SC)?

If so, any suggestions to prevent this.


texts:
Is there a way to get unconfirmed balance from an address?

I read this question

It uses a method filter, not available on present web3 version. After doing some research I found a method w3.eth.getPastLogs.Which according to documentation it was the method called behind the scenes by a previous method pendingTransactions (not available anymore).

Any ideas if this is possible?


texts: "Callback was already called" during truffle test using a solidity testfile

texts:
I'm creating a contract/token which extends the openzeppelin ERC20.sol and Ownable.sol.

My contract has no own logic yet and looks like this:

pragma solidity ^0.5.2;

import "../node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "../node_modules/openzeppelin-solidity/contracts/ownership/Ownable.sol";

contract OwnToken is Ownable, ERC20 {

    constructor() public {
    }
}

Compiling works as expected but when I try to run truffle test it fails and gives me:

Error: Callback was already called.
    at C:\Users\towo\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-core\~\async\dist\async.js:966:1
    at C:\Users\towo\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-core\~\async\dist\async.js:3885:1

The test I have is only a dummy and looks like this:

pragma solidity ^0.5.2;

import "truffle/Assert.sol";
import "../contracts/MoniToken.sol";
import "truffle/DeployedAddresses.sol";

contract TestOwnToken {

    function testDummy() public {
        OwnToken ownToken = new OwnToken();
        address expected = 0x1C8994b9A1802374579AF9d2312a6C2eF26A24F5;
        Assert.equal(ownToken.owner(), expected, "Error");
    }
}

When I exclude the solidity test and include an Javascript-test, everything works as expected which means, truffle test is running fine. The Javascript test does the same as the solidity version.

Regarding the error and the fact that a Javascript-test is running fine it seems this has something to do with async/await within the truffle-suite itself. Does anyone has any idea on this? Maybe I'm missing something? It looks like an truffle issue at the first glance.

EDIT:
Deleted the code for the Javascript test since it is not relevant to the question as stated by @goodvibration


texts: Im using Oraclize to get a random number but the N of bytes confuses me

texts:
It seems like when I give the Oraclize query a N of 4, it always returns a 19 digit number, this might be a coincidence but I think not. What if I actually want a number between lets say 0 and 10 * 10^18?

Is this possible? This is how how my Oraclize looks now:

    oraclize_setProof(proofType_Ledger); // sets the Ledger authenticity proof
    uint N = 4; // number of random bytes we want the datasource to return
    uint delay = 0; // number of seconds to wait before the execution takes place
    uint callbackGas = 200000; // amount of gas we want Oraclize to set for the callback function
    bytes32 queryId = oraclize_newRandomDSQuery(delay, N, callbackGas);

And in the __callBack

        uint maxRange = totalEth -1; // deduct one so that when one gets added later it cant be bigger than the total eth.
        randomNumber = (uint(sha3(_result)) % maxRange) + 1 // this is an efficient way to get the uint out in the [1, maxRange] range


texts: AlethZero crashes after informing that it "couldn't find requested block"

texts:
I have installed Release 1.2.9 ("The Village Idiot") of cpp-ethereum on a windows 7 machine. It downloaded the chainblock overnight and I experimented with mining this morning. My PC became non responsive and I had to reset my system. After reboot, I tried running AlethZero again but all I got is a console message in the title of this question and a message window informing that AlethZero.exe has crashed (pic below).

Can anyone point me in the right direction for resolving this issue? I would hate having to download a 25GB blockchain again.


texts:
I'm having a hard time exporting the Truffle sample app on Heroku. I'd like to use it with Metamask.
I tried simply pushing the code from my local machine (where the code is working) adding the following Procfile:

web: npm run dev

But to no avail, it's not working on Heroku.
Any advices?
Thanks


texts: How to import an account in parity using CLI?

texts:
Here is what I tried:

 parity account new --chain dev

it creates new account and generates JSON file in
%HOME%\AppData\Roaming\Parity\Ethereum\keys\DevelopmentChain\

So, then I cut the file from there and try to import it:

parity account import UTC--2017-05-14T22-02-46Z--717e724c-5bec-e5bb-1eb9-ab92354084b2 --chain dev

But I receive an error:

Importing accounts failed.

What am I doing wrong?


texts: Deploy Smart Contract to Mainnet using Truffle

texts:
I was able to deploy the contract successfully to Kovan with gas limit 350000.

When i set the gas in truffle.js to 500000 for deployment to Mainnet, i get the below error:
Error: Transaction cost exceeds current gas limit. Limit: 5000, got: 500000. Try decreasing supplied gas.

So i decrease the gas to 5000, i got the error below:
Error: Transaction gas is too low. There is not enough gas to cover minimal cost of the transaction (minimal: 498172, got: 5000).

it just won't deploy the contract, how can the Limit is so much lesser than minimal? how to solve this problem?


texts: Why isn't msg.sender.send getting called?

texts:
Contract code:
function rand( uint256 seedB ) returns (uint256){

    //define seedA variable
    uint256 seedA = 1;

    uint amount = 1 finney;

    if (seedA == seedB) {
        msg.sender.send(amount);
    }

    return seedA + seedB;
}

https://gist.github.com/anonymous/e210a052b6b4c86337c2
Basically, if SeedA (which equals 1) equals SeedB it sends amount to msg.sender.

Why does this not work, when I am calling the function using:
random.rand.sendTransaction(1,
    {from: eth.accounts[0],
    value: web3.toWei(.0001, 'ether'),
    to: '0x4abc14efad9a7a84a0a9ef6e1a782c43a9e3f550',
    gas: 500000,  data: web3.fromAscii('message')})

Here is the contract address:
https://www.etherchain.org/account/0x4abc14efad9a7a84a0a9ef6e1a782c43a9e3f550
Am I invoking the contract improperly in the sendTransaction? I am invoking it from inside my local geth client.
How do I ensure my parameter (1) is passed into the contract function rand via sendTransaction?


texts:
So I created a token using Token Factory.  I hadn't used it before and wanted to test things out, so I did this on the Ropsten Test Net.

I was able to successfully publish the contract, which shows up Meta Mask History.

Now when I go back to Token Factory and reference the address to interact with it, I am told "Total Supply is: . "

What happened to my Token?


texts: 30 second delay after payment submitted to Rinkeby test network before receiving Tx hash?

texts:
When I call the  .send(); from Web3.js based browser Javascript code, there is a 30 second delay right after I submit payment via the Metamask extension before the call returns with the Tx hash.  Note, I am not referring to the time it takes for the block to mine.  I'm saying it takes 30 seconds just to get the Tx hash back from the Rinkeby network, letting me know my transaction is pending in the mining pool.  In other words:

I make the  .send(); call
Metamask extension pops up
I submit my payment
30 seconds passes before the .then() block attached to the .send(); call is triggered.

Is this normal?  If not, what could be causing this problem and how could I fix it?  I have done hundreds of trials with different smart contract methods, and it's always the same.  This doesn't happen when running with Ganache.  I know that's a local network, but the fact it's always a 30 second delay with Rinkeby indicates something suspicious.  I see the same problem on my server side code when signing and sending transactions on the server side using the Infura API.  Does Metamask use the Infura API?


texts: When truffle deploy a contract to multiple network, will this contract have a unique address valid on all of them?

texts:
I think the question say it all.
If I deploy some contracts on multiple network in the same deployment. Will they each have a unique address valid on all network or will they each have different address for each network?


texts:
Need to calculate (at least approximately):
customerBalance * numerator * collateralBalance / denominator / INITIAL_CUSTOMER_BALANCE / numberOfCustomers
without possibility of overflow. How?
Here:
uint constant INITIAL_CUSTOMER_BALANCE = 1000 * 10**18; // an arbitrarily choosen value
customerBalance is uint256 but it can't be greater than INITIAL_CUSTOMER_BALANCE multiplied by the number of customers (which is limited as one Ethereum transaction (or internal transaction) can register at most one customer).
numerator and numberOfCustomers type is determined by me. It could be for example uint256, uint128, or uint64.
collateralBalance is uint256.
denominator type is determined by me. It could be for example uint256, uint128, or uint64.
The best idea I came to is to somehow use ABDKMath for approximate calculations.


texts: Implementing Chainlink Data in Truffle / Hardhat

texts: What is the easiest way to connect with Chainlink so we can test our dApp locally. Do we have to run a local Chainlink node, or is there any workaround for getting the online data?


texts: Local ethereum node contain two different blocks but with same height


texts: I would like to generate an ethereum address for every user on my platform, via a script

texts: I would like to generate 1000's of ethereum addresses. And have access to the private keys. then i can assign each user their own address in my database. How would i go about this? Also is it possible without running my own ethereum node?


texts: How many nodes are supporting Ethereum Classic?

texts:
To avoid high fees, I am considering deployment of Smart Contracts on Ethereum Classic (around 20 fold cheaper than ETH) but a concern is about network soundness and security. So I was wondering how many nodes are operating rigth now the ETC network.

This page:

http://etcstats.net/

says there are only 10 nodes but it also says that it does not represent the entire state of the ethereum classic network.

The equivalent https://ethstats.net/ seems not very reliable about the number of active nodes, declaring 50 of them, while other sources claim ETH has 6,000 or even 20,000.

Any idea how much is this number on a real basis? Or how to find out? Thx!

Refs.:

How many ETH vs ETC full nodes are there?

How many nodes are there on the Ethereum network?


texts:
Is there any reason not to use

uint[2**160-1] addressIndex;

instead of

mapping(address => uint) addressIndex;

?


texts: Problem with passing an argument for a Structure

texts:
I am trying to compile the following program. I have declared a structure and I am passing a variable of it in a function in order to assign it to an array of structure.
pragma solidity ^0.5.1;
contract investorPayment{
   struct st_investors{
      uint invested;
      uint payout;
      address payable Address;
   }
   st_investors[100] investors;

   function pay(uint min_investment, address payable addr, st_investors memory newInvestor) public{
      uint payout;
      for (uint i=0; i < investors.length; i++) {
         investors[i].Address = addr;
         if (investors[i].invested == min_investment) {
            payout = investors[i].payout;
            if (!(investors[i].Address.send(payout)))
               revert();
            investors[i] = newInvestor;
         }
      }
   }
}

I am getting the following error message:'
solc failedsend.sol failedsend.sol:11:60: Error: This type is only supported in the new experimental ABI encoder. Use "pragma experimental ABIEncoderV2;" to enable the feature. function pay(uint min_investment, address payable addr, st_investors memory newInvestor) public
^-----------------------------^
Somebody please guide me.
Zulfi.


texts: Isn't there an unlockAndSendTransaction function in web3 JavaScript API?

texts:
I really believe that I saw a function named unlockAndSendTransaction on a web3 Javascript API reference page somewhere on Friday 12/09/2016 but today (Monday, 12/12/2016), I am unable to find this function either with a Google search or with a search here on Ethereum StackExchange.

Was I mistaken? Is there such a function, or was I dreaming?
:-)

EDIT: I just found a mention of this function on https://github.com/ethereum/EIPs/issues/113  Specifically, web3.eth.unlockAndSendTransaction is mentioned in the Motivation section. It has other names in the Management personal API - signAndSendTransaction and just sendTransaction (with optional password param), pre- and post-1.5, respectively. It is the web3.eth version that would be useful to me. Will check if it is available in the version that I am working with.


texts: How secure is messaging to smart contracts?

texts: If I sent a message via http to a smart contract, how secure is that? If I cannot use TLS, then could someone listen at he port and then intercept the message and then divert the message to an unknown blockchain?


texts: Understanding SimpleStorage example from Solidity documentation

texts:
Just started learning solidity from https://solidity.readthedocs.io.
Here's the code I'm trying to understand:

My questions:

Why does get() function has constant keyword? Is it neccessary to put constant there?
Is it nesessary to put retVal in (uint retVal)? If I call get() function from other contract and want to assign return value to a variable, what should be the name of that variable? Can it be any name or just retVal?

Solidity is confusing, but very cool!


texts: After the gas price, is the transaction hash used to prioritize pending transactions?

texts:
Looking at the Status ICO from the sideline I noticed that once the transactions with more than 50 Gwei as gas price were cleared, the transaction being approved by the contract all had a hash starting by 0x00... and the hex value was slowly increasing.

Here is one example : https://etherscan.io/tx/0x00785cad03de2e353f16f7efcc5a06c356dced3807fa52d293886cba3bc8214f

I also noticed that people are saying they're able to get transactions through by changing price and gas limit to generate a new raw transactions. They are reporting it to be "working" after 10 or 15 attempts. It sounds like that's what it takes to get a zero at the start of the hash.

I wrote a quick python script to confirm my theory, I generated a tx with a hash starting by 0x000 and it was mined in less than a minute with a 50Gwei gas price.

Can someone confirm my theory that the tx hash is the next criteria after the gas price ?


texts: TypeError: Named argument does not match function declaration

texts:
I'm getting the following error while compiling this code:

pragma solidity ^0.4.17;
contract Campaign
{
    struct Request
    {
        string description;
        uint value;
        address recipient;
        bool compelete;
        uint approvalCount;
        mapping(address=>bool) approvals;
    }
    Request[] public requests;
    address public manager;
    uint public minimumContribution;
    mapping (address=> bool) public approvers;

    modifier restricted()
    {
        require(msg.sender==manager);
        _;
    }
    function Campaign(uint minimum) public
    {
        manager = msg.sender;
        minimumContribution = minimum;
    }
    function Contribute() public payable
    {
        require(msg.value >= minimumContribution);
        approvers[msg.sender]=true;

    }
    function createRequest(string description, uint value, address recipient) public restricted
    {
        require(approvers[msg.sender]);
        Request memory newRequest = Request({
            description:description,
            value:value,
            recipient:recipient,
            complete:false,
            approvalCount: 0
            });
        requests.push(newRequest);
    }
    function approveRequest(uint index) public {

        require(approvers[msg.sender]);
        require(!requests[index].approvals[msg.sender]);

        requests[index].approvals[msg.sender]=true;
        requests[index].approvalCount++;
    }
}

`


texts: How could return events of specific args?

texts:
In my solidity contract, I just have one event which is:

transferOwnerShip (uint  id, address indexed newowner);

and I want to filter the events log in order to retrieve only the events that belong to specific **newowner address**

I used this JavaScript code

 var newlog;
         var events = DeviceManagerContractInstance.allEvents(
           {fromBlock: 0, toBlock: 'latest'} ,
           {newowner:"0xe6b56e8f11f2dd687d63c75cda3f261ae1124054"});

         events.get(function(error, log)  {

          if(!error)

           {

             console.log(log);

        for( var property in log) {
        newlog += "Event " + property + ': '+'\n' + JSON.stringify(log[property],null,4)+'\r\n';

            document.getElementById("eventID").innerHTML = newlog;

        }

            }

   });

where DeviceManagerContractInstance is my contract instance

but I received all the events for all addresses. So, What is the best way to retrieve event based on specific data args?

Besides, Is there any way to print specific data from the event instead of the whole object.

Truffle v5.0.27 (core: 5.0.27)
Solidity v0.5.0 (solc-js)
Node v10.15.3
Web3.js v1.0.0-beta.37
geth Version: 1.9.6-stable


texts: How safe to run Lighthouse without --auto-register vs. the effects of registering more than once?

texts:
Running a Lighthouse validator presents a message to strongly consider running --auto-register the first time.

The documentation also states:

  The --auto-register flag registers your signing key with the slashing
  protection database, which keeps track of all the messages your
  validator signs. This flag should be used sparingly, as reusing the
  same key on multiple nodes can lead to your validator getting slashed.
  On subsequent runs you should leave off the --auto-register flag.

Ideally, the flag is run exactly 1 time. But what happens if it's run 0 or 2+ times?

What are the risks by not using --auto-register at all?
Assuming --auto-register was run once already, what bad things will happen if Lighthouse is stopped, and then restarted with --auto-register (accidentally) again? An example of this happening is a Lighthouse crash and then restarting it with an old command history.


texts: How to test a function call that should fail?

texts:
Im using Truffle to test my smart contracts written in Solidity and I would like to mark test as passed if function call/execution fails.

Example:

await instance.cancelOrder({from: accounts[1]});

Normaly this would pass if function executes properly. This one requires certain variable to be true which it isn't and should fail. How do I do something like that?


texts: Basically, want to know if Solidity can be used to access / trade in decentralized exchanges. If so, how to link both.


texts: how to specify a letter at given position in a string

texts: Is there a build-in function in solidity allows to specify a letter in a string at given position like a = string b[i], where i indicates the position of that letter?


texts:
I am trying to design UI for a tokensale smart contract where all participants must be whitelisted before purchasing tokens.

The participants submit their address via the UI form, but only the contract owner can add addresses to whitelist.

Would the way to do this be to create an admin section that requires the admin use the owner's account in metamask and manually view and approve a list of submitted addresses?

Or is there another recommended way to implement a whitelisted tokensale?


texts: When I'm creating structs, and those structs contain various types of variables, uint, string etc. Should i declare the visibility and if constant on those variables like with state variables?


texts:
I am novice in docker technology. I have developed a basic private ethereum blockchain DAPP locally using Truffle and I want to deploy the same on cloud.

1) I need tutorials for how to crate a docker container for ethereum DAPP and how to deploy it on cloud (AWS or Azure).

2) I would also like to explore Azure ethereum blockchain as a service for making DAPP. Any tutorials for the same would be helpful.


texts: Can't enter any commands after starting eth on Windows

texts:
I'm running the eth client (0.9.41) on Windows 10 using the following command:

eth --frontier -b -i

as stated here.

The program hangs and I'm not able to enter any commands. The last produced text starts with:
 "Node ID: enode://e449..., 'setTimeout not available in this environment'".

What am I doing wrong?

I found a similar issue here.

The same situation is on Windows 7.


texts: Besides Solidity and Serpent, what are the other (experimental) contract programming languages?


texts: When the Ethereum system first launched, people had to pay money for ethers in order to request work for a contract. Where did they go to buy ethers and who sold ethers to them? Were those individuals that were selling ethers allowed to create new ethers out of the blue, and are they still able to do so now?


texts: Is there a way to uniquely identify a smart contract other than by its address?

texts: I would like to know if there is a way different than the contract adress to identify a smart contract.


texts: transaction gas limit in Parity genesis file

texts:
Essentially the question is how to set/change the "minimal cost of the transaction" a.k.a. "Gtransaction" value using Parity?

On a private blockchain with a custom chain spec file I have a minGasLimit of 0x9c4.  I used to think this means that the gas has to be at least 2500 (decimal)

But when I try to make a transaction by setting 4000 gas, I get this error:

Transaction gas is too low. There is not enough gas to cover minimal cost of the transaction (minimal: 21000, got: 4000). Try increasing supplied gas.

I searched the chain spec file(s) for "5208" because that is the hex representation of 21000.  But it's not in the file.

As @benjaminion points out, this 21000 is the Gtransaction value in Appendix G of the Yellowpaper (http://yellowpaper.io/).

So I have two specific questions:

Does Parity allow the ability to change the 21000 Gtransaction default?  If so, what value must I edit?
What actually does minGasLimit refer to in the Parity chain spec, since it is obviously not the "Gtransaction" a.k.a. "minimal cost of transaction"?  A Yellowpaper reference would be ideal.

EDIT: I just found this about the geth genesis file, and it seems to say that gasLimit is the correct term for configuring Gtransaction in the gensis file.  But like I say in the beginning, I have edited this value on my Parity chain spec but the 21000 number keeps coming up.  Here is the geth reference:

https://github.com/ethereum/go-ethereum/wiki/Private-network


texts: why ERC20 standard doesn't have any method to remove the spender allowance？

texts:
ERC20 token standard uses approve() and transferFrom() to do the indirect transfer.

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

As shown above, the approve() method uses the variable -  allowance to add the mapping, so the owner can allow multiple spenders at the same time.

But I am just thinking if the approve() is the method to add the allowance why the ERC20 standard doesn't have any method to remove spender when the token owner doesn't want to give allowance. If allowance[msg.sender][spender] =0, why the standard doesn't just delete the allowance[msg.sender][spender.

And given the structure allowance[msg.sender][spender] = uint256, what is the maximum memory this structure will take for the contract?


texts:
When I was started to explore the ethash algorithm then I found this-
FNV was used to provide a data aggregation function which is (i) non-associative, and (ii) easy to compute. A commutative and associative alternative to FNV would be XOR.
What does this means?


texts: Does anyone know what the "difficultyHardforkBoundDivisor" parameter refers to?  I don't find it in any of the glossaries I know.


texts: How does a Truffle migration know the address of a contract before it is created?

texts:
How does the truffle migration of this contract know what the address is of the registry contract, in the constructor:

https://github.com/marbleprotocol/humanity/blob/master/contracts/Humanity.sol

If the registry was deployed to Ethereum after the Token?

Registry creation: https://etherscan.io/tx/0xe8193e2f72d00d086c3876e8ae84f529848e1c730501158f1ff837426d99f4f1

Token creation:  https://etherscan.io/tx/0x0d5d5506aed5a615986dc92f9d982c7e0f19c96e31e8488ea15d4f8046252983

Sorry if I am being silly.


texts: Reset my infura project api key and secret id?

texts:
https://mainnet.infura.io/v3/<api_key>

Can i access my project wallet using a newly generated api key and secret id? Is it possible to reset these credentials in infura?


texts:
So I have this library:
library Hasher {
  function MiMCSponge(uint256 in_xL, uint256 in_xR) public pure returns (uint256 xL, uint256 xR);
}

And I'm trying to deploy it:
const Hasher = await hre.ethers.getContractFactory('Hasher')
const hasher = await Hasher.deploy()

But I get this error:
NomicLabsHardhatPluginError: You are trying to create a contract factory for the contract Hasher, which is abstract and can't be deployed.
If you want to call a contract using Hasher as its interface use the "getContractAt" function instead.


texts: Smart Contract Connection with Front-end via web3

texts:
I've been wondering how to connect browser with a smart contract using web3. I know that I need to instantiate provider as follow,

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

And via provider I'm 'talking' with contract, right?

When comes to deployment phase, do you setup node as a provider or you run some RPC on the server on localhost?

Cheers!


texts: Is it possible to transfer tokens from one Multisig Wallet address to another Multisig Wallet?

texts:
First, the multisign wallet has a number of tokens which I want to transfer to another Multisig wallet.
Is it possible? If yes then how?


texts:
Running migration: 1_initial_migration.js
Deploying Migrations...
... 0x0ed88dd40f380a805ed0ba1b5b0a9d8178321ab6da9e5c0cb247f5700337b173
Migrations: 0xcfc4ba0488f20c7a2bb24e735f43e240bf249bc8
Saving successful migration to network...
  ... 0x471a1036236241c302cfa7b8dfcd011e106e221202b7c8c2586c3bf2d28c5546
Saving artifacts...
Running migration: 2_deploy_contracts.js

/usr/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/errors.js:38
        return new Error(message);
^
Error: Invalid JSON RPC response: undefined
    at Object.InvalidResponse (/usr/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/errors.js:38:1)
    at RequestManager.send (/usr/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:61:1)
    at Eth.get [as accounts] (/usr/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/property.js:107:1)
    at module.exports (/home/josue/Desktop/projectX/ebay-on-ethereum-ipfs-starter-project/migrations/2_deploy_contracts.js:6:44)
    at /usr/lib/node_modules/truffle/build/webpack:/packages/truffle-migrate/index.js:82:1
    at /usr/lib/node_modules/truffle/build/webpack:/packages/truffle-require/require.js:101:1
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)

and this my truffle js

var HDWalletProvider = require("truffle-hdwallet-provider");
var mnemonic = "my seed word";
require('babel-register')

module.exports = {
  networks: {
    development: {
      host: '127.0.0.1',
      port: 8545,
      network_id: '*' // Match any network id
    },
    ropsten: {
      provider: function() {
        return new HDWalletProvider(mnemonic, "https://ropsten.infura.io/v3/<mykey>")
      },
      network_id: 3
    }
  }
}


texts:
The problem involves 3 contracts with an interdependence as follows:
library --> ProductContract --> BillingContract
The contracts are structured as follows: (The DataSet.sol contract below is referenced from a solidity example from: https://github.com/chriseth/solidity-examples/blob/master/iterable_mapping.sol
DataSet.sol:

library DataSet {
  struct IndexValue { uint keyIndex; uint256 value;}
  struct KeyFlag { uint key; bool deleted; }
  struct KeyValue { uint key; uint value; }

  struct Data {
      mapping(uint => IndexValue) data;
      KeyFlag[] keys;
      //KeyValue[] kvpairs;
      uint size;
  }

  function insert(Data storage self, uint key, uint256 value) returns (bool replaced){
    uint keyIndex = self.data[key].keyIndex;
    self.data[key].value = value;
    if (keyIndex > 0)
      return true;
    else
    {
      keyIndex = self.keys.length++;
      self.data[key].keyIndex = keyIndex + 1;
      self.keys[keyIndex].key = key;
      self.size++;
      return false;
    }
  }

  function getCurrent(Data storage self) returns(uint index){
      return self.size - 1;
  }

}

ProductContract.sol:

import "DataSet.sol";
contract ProductContract {
    using DataSet for *;
    DataSet.Data d;
    mapping (uint => uint) IDToVal;
    function register (uint p_id, uint val) returns (bool registered) {
        IDToVal[p_id] = val;
        registered = true;
    }
    function getVal (uint p_id) returns (uint v) {
         return IDToVal[p_id];
    }
}

BillingContract.sol:

import "ProductContract.sol";
contract BillingContract {
    ProductContract pc;
    address PC_Address;
    function BillingContract (address p) {
        PC_Address = pc;
        pc = ProductContract(p);
    function getVal (uint p_id) returns (uint v) {
        return pc.getVal(p_id);
    }
 }

This results in an error on compiling:

Error: Library "DataSet" declared twice (will create ambiguities during linking).
    library DataSet {
    ^
Spanning multiple lines.
The other declaration is here: DataSet.sol:3:1:
    library DataSet {
    ^
Spanning multiple lines.
Compiliation failed. See above.

There is a form of transitive dependence on the above contracts - when I try to use all the contracts in a single '.sol' file, the compilation occurs just fine. Is there a way in which the '.sol' files can be separated and compiled properly? Please advise!


texts:
Is it possible to create ERC1155 without metadata uri?
At the moment I don't need metadata
Thanks


texts: Can I connect a local Parity instance to an instance running on a server?

texts:
Basically, I want to run parity on a server which will keep my blockchain up-to-date at all times.

I also want my employees to be able to run parity (without blockchain) on their local machines with their own accounts, but not have to sync the entire blockchain.

Is there a way to run this heavy-server/light-client configuration of Parity? It is important that each employee maintain their own accounts (Parity instance) but share the blockchain DB.

I would like to avoid having to wait for my local blockchain to update, then wait for someone else to update their blockchain before signing a multisig transaction.


texts: How to get a timestamp of a specified block in solidity?

texts:
"block.timestamp" and "now" are known. I would like to know how to get a timestamp of a specified block.number?

Like: uint blockDoneTime = (block.number - 1000).now; // Or something like this...? :)


texts: Impersonating accounts on a forked Ethereum main net using Hardhat

texts:
I used the example from the Hardhat docs to impersonate an account on a forked network:
await hre.network.provider.request({ method: "hardhat_impersonateAccount", params: ["0x...."]} )

However, I get "Error: Returned error: unknown account". How should this be done correctly? Thanks


texts: Since there is no native support to Certificate Authorities in Ethereum, what are good ways to emulate it in a permission network (we are using Hyperledger Besu)?


texts: Paying the gas cost with the ether stored in the SC

texts:
Let's suppose that an entity deploys an SC and wants to perform an allocation (which computationally speaking has a high gas cost). The participants of this delivery (registered persons) must be the ones who pay the cost of execution, therefore, when registering, they will have to pay a fee. The ether is stored in the SC. My question is: is it possible to pay the execution cost of a SC with the ether stored in the SC itself?
Thanks in advance.


texts:
What happens on hash collisions for, e.g., transactions, blocks, and contracts?

What happens if, say, two transactions hash to the same value? In this case, we say that a hash-collision occured.

I've tried looking at the yellowpaper.io for an explanation, but can't really find the details.

Since the transaction hash serves as the transaction's identity, I don't see how Ethereum should allow multiple transactions with the same hash?


texts:
I am working on idea to mix erc20 token from one account to many account.
i have seen many example but all example has some limitation.
like

you can mix fixed amount.
Sender can mix one deposit at time.
if sender send mix request contract send amount to receiver after
some time. and he can see in transaction list that from where
contract    received fund.

So is it advisable to create some smart contract which take input from sender and rotate token into 10-20 wallets? and then send it to Receiver's wallet?
because in my requirement sender is fix. so only one wallet will deposit mix request and for multiple receiver.


texts: faucet = (new Faucet).value(0.5 ether)(); Doesn't compile

texts:
I am practicing with the code examples from Andreas' Mastering Ethereum book Chapter 7.  I don't understand why this does not compile when I made the Faucet constructor Payable.  See images below.
Thank you.


texts: Getting Metamask Error Message into web3.js DApp after user rejects transaction

texts:
I'm building a simple HTML/JavaScript front-end to interact with a Smart Contract using web3.js and MetaMask.

I have a function to call one of the methods in order to send a contribution to the Smart Contract, as follows:

function sendContribution() {
  let sendAmount = web3.utils.toBN(document.getElementById("contributionAmt").value);
  contractInstance.methods.contribute().send( {
    from: defaultAccount,
    value: sendAmount
  }).then (function (result) {
    console.log(result);
  }).catch (function (error){
    console.error(error);
    showMessage("alert alert-danger", error);
  });

The function works fine - when called it opens the MetaMask ethereum Window to allow me to approve the transaction and it processes the transaction without a problem.

However, if I "reject" the transaction in the MetaMask window I get two error messages in the console log, the first from MetaMask with the reason for the error, and the second from web3 with just a generic "Internal JSON-RPC Error":

As per the code above I am displaying any error message for the user but this is only displaying the generic web3 error and does not display the MetaMask message.

My question is how can I capture the MetaMask message?


texts: How do I construct a call to another contract using inline assembly?

texts:
I would like to call a contract and deal with the return values manually using EVM assembly in Solidity. For example, this should simply add two numbers together.

contract Test1 {
    function add(int a, int b) returns(int){  //Simply add the two arguments and return
        return a+b;
    }
    function() returns (int){  //If the function signature doesn't check out, return -1
        return -1;
    }
}

contract Test2 {
    Test1 test1;

    function Test2(){  //Constructor function
        test1 = new Test1();  //Create new "Test1" function
    }

    function test(int a, int b) constant returns (int c){
        address addr = address(test1);  //Place the test1 address on the stack
         bytes4 sig = bytes4(sha3("add(int256,int256)")); //Function signature

        assembly {
            let x := mload(0x40)   //Find empty storage location using "free memory pointer"
            mstore(x,sig) //Place signature at begining of empty storage
            mstore(add(x,0x04),a) //Place first argument directly next to signature
            mstore(add(x,0x24),b) //Place second argument next to first, padded to 32 bytes

            call(5000, addr, 0, //Issue call, providing 5k gas and 0 value to "addr"
            x, 0x44, add(x,0x80), 0x20) //Inputs start at location "x" and are 68 bytes long, outputs start 128 bytes after x, and are 32 bytes long
            c := mload(add(x,0x80)) //Assign output value to c
            mstore(0x40,add(x,0x100)) // Set storage pointer to empty space
        }
    }

    function test2(int a, int b) constant returns(int c){ //Make sure the Test1 function works properly
        return test1.add(a,b); // (It does)
    }
}

The issue is that this is returning an Out-of-Gas error, originating from the call... line.

How can I fix this issue?


texts:
This is my contract

pragma solidity ^'0.5.2';

contract MyContract {

    address[] public contracts;
    event ContractCreated(address newAddress);

    constructor() public { }

    function createOtherContract() public {
        OtherContract contract = new OtherContract();
        address contractAddress=address(contract);
        contracts.push(contractAddress);
        emit ContractCreated(contractAddress);
    }
    function getDeployedContracts() public view returns (address[] memory) {
        return contracts;
    }
}

if I watch the events using this code

MyContract.methods
        .createOtherContract()
        .send({from: accounts[0]})
        .on('transactionHash', function (hash) {

            MyContract.events.allEvents({
                fromBlock: 4477390,
                toBlock: 'latest'
            }, (error, events) => {
                if (error) { console.log("ERR", error); }
                console.log("Events", JSON.stringify(events));
            });

        });

I get this result

If I use the contract method getDeployedContracts

From the events data, I get a lot more zeros. I think this happens because the first result is a 32-byte HEX and the function results are 20-byte address but the type of the parameter is the same in both functions: address.

What's going on?


texts: Faster send to address than using metamask in BSC

texts:
Is there a way to send faster transaction (some BNB) than with metamask for example using:
Quiknode
Ankr


texts: Is it possible to call a Contracts function from a set setTimer? Web3JS

texts: I want to be able to call a function of a contract every 60-120 seconds, in my JavaScript code I have a set timer that runs for down a timer from 120 seconds down to 0 by subtracting 0.01 every 10 milliseconds, when the timer hits 0 it should be able to call a function from my solidity code then set timer variable to 120 again. Is this possible ? Tried using async await but it seems like it is ignoring that and calling the contract multiple times.


texts: what is a private key in an ethereum wallet like metamask? and how do I find it?

texts: my question is about what a private key is? and where would I find it on an ewallet like metamask?


texts: Is address(this) a valid address in a contract's constructor?

texts:
When does a smart contract's address first become valid? Is the address during the execution of the contract, or only after it's been fully instantiated and initialized?

In other words, is a contract's address valid in its own constructor?


texts: Could you add a contract address in place of a library address when editing the bytecode before deplyment?

texts:
After compiling a contract that uses a library it is necessary to go into the compile contract bytecode and remove a piece that looks something like "_________library__address______" and replace it with the deployed library address.

Tools like Remix automatically add this now for testing.

My question is: Since a library is just a type of contract, could I add a contract address instead of a library address to the bytecode? (and suffer whatever consequences to the functionality of the contract)

I am trying to insert a proxy contract whose fallback function points to the library and I think this is how I would do it.

Thanks for your time.


texts: How many Ethers has the Ethereum Switzerland GmbH?

texts: As I understand, the EthSuisse founded Ethereum in 2014. How many Ether do they have mined for themselves and how many are in the community?


texts:
is there a way using public key cryptography (asymmetric cryptography) in a smart contract. The idea is to:

1) Encrypt some text and publish it on the block chain as a transaction.

function encryptData(string pubKey, string text){
    ...
}

2) And later, have a call (local invocation of a contract function) to decrypt it:

function decryptData(string privKey, string text){
    ...
}

I've found some related topics about signatures using ecrecover , but not about cryptography.


texts: Increase the speed of Smart Contract blockchain updates

texts:
for example

pragma solidity ^0.4.18;

contract charity_tab{

  string [] public charity;
  uint public charitySize=0;

  function addCharity(string a) {
    charity.push(a);
    charitySize++;
  }
}

This contract to add a data time about 30-40 seconds, how to improve efficiency？


texts: Error: cannot find module hdwallet-provider - trying to deploy contract to ropsten using infura key

texts:
I have reviewed the other posts in the last few days following what seem like forever for get to sync to my local machine - so this is my last try to get it to deploy the petshop contract to ropsten via using a key from infura as suggested by someone as the sync in ropsten is taking too long.

I have reconfigured my truffle.js to use an infura key but when

I run the command to deploy I get the cannot find module truffle-hdwallet-provider - (see screenshot below)

Any other suggestions would be greatly appreciated -

Update:
npm uninstall ethereumjs-wallet
npm uninstall truffle-hdwallet-provider
npm install --save ethereumjs-wallet@0.6.0
npm install --save truffle-hdwallet-provider@0.0.3

my truffle script is below - I have grey out the key for obvious reasons :)

var HDWalletProvider = require("truffle-hdwallet-provider");
const MNEMONIC = '*******************************************************';

module.exports = {
  networks: {
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*"
    },
    ropsten: {
      provider: function() {
        return new HDWalletProvider(MNEMONIC, "https://ropsten.infura.io/v3/*****************************")
      },
      network_id: 3,
      gas: 4000000      //make sure this gas allocation isn't over 4M, which is the max
    }
  }
};


texts: Compile Error in Solidity unable to compile in remix

texts:
I am getting the following error. Could you please help me in solving by looking into the code.

/////ParserError: Expected pragma, import directive or contract/interface/library definition.
function unlockMessage(string name) public payable returns (bool) {
^------^  /////
pragma solidity ^0.4.25;

contract TrojanSecret {
// Data Types
uint memberCount;

string public name;
string public symbol;

mapping (string => address) Trojans;
mapping (string => string) secrets;
mapping (string => address[]) access;
mapping (string => uint) balance;
uint amount_for_unlock;

//constructor

constructor() public{
        name   = "Secrets";
        symbol = "S" ;
        amount_for_unlock = 1 ether;

}

function registerTrojan(string name) public returns(bool){
    if( Trojans[name] == address(0))
    {
        memberCount ++;
        Trojans[name] = msg.sender;
        return True;
    } else {
        return false;
    }
}
function unregisterTrojan(string name) public {
    require( Trojans[name] != address(0));
    Trojans[name] = address(0);
    memberCount --;
}
function setSecret(string name,string message) public {
   require (Trojans[name] != address(0)&& Trojans[name] == msg.sender);
   secrets[name] = message;
}
function getSecret(string name) public view returns(string){
    require( Trojans[name] != address(0));
    bool flag = false;

    for(uint i = 0; i < access[name].length;i++)
    {
        if(access[name][i] == msg.sender){
            flag = true;
            break;

        }
    }
     if(flag){
         return secrets[name];
     }
     return "message is locked";
}

}
function unlockMessage(string name) public payable returns (bool) {
    require( Trojans[name] != address(0));
    if(msg.value == amount_for_unlock){

        balance[Trojans[name]] += msg.value;
        Trojans[name].transfer(msg.value);
        access[name].push(msg.sender);

        return true;
    }
    else{
        return false;

    }
}

}


texts: Calling a contract from another contract leave transaction pending forever

texts:
I am developing a DApp on the Kovan Network on Remix and I am having trouble understanding the problem. I am tring to call the Wrapped Ether contract (WETH : https://kovan.etherscan.io/address/0xd0a1e359811322d97991e03f863a0c30c2cf029c) from my own contract (to automaticly wrap / unwrap the ether my users deposit).

When I'm calling the contract from Etherscan through Metamask, I can deposit and withdraw WETH without any problem.

However the problem arise when I try to 'deposit' (with my wrapETH function) then 'withdraw' WETH through my contract. I realised the problem when my Withdraw attempts were always reverted.
I realised that the deposit transaction was always pending on Remix, although the transaction was mined on its etherscan page (for example : https://kovan.etherscan.io/tx/0xe815da928878318b9e8eff18eb8ae353ebc0e8db9cd8fb2b39ca2b55f13d06f9), and that I could see the Event and check my balance on the WETH page.. The transaction itself also didn't appear on the WETH page.
Another strange thing on this pending transaction is the 'input data' which is unreadable comparing with other transactions.

Does someone know what is happening, and why there is a difference between calling the WETH contract from Etherscan (again, where the transaction is mined and recorded directly) and not from my contract?

Here's the functions I'm calling (with only the useful)

WETH9_ WETHContract = WETH9_(0xd0a1e359811322d97991e03f863a0c30c2cf029c);

function depositETH() public payable{

}

function wrapETH(uint256 _amount) public{
     WETHContract.deposit.value(_amount)();
}

function withdrawETH(uint256 _amount) public{
    WETHContract.withdraw(_amount);
}

Thank you


texts: Explanatory: Don't set, get contracts go against immutability of blockchain?

texts:
Let's have a simple contract as given in Solidity documentation.

pragma solidity ^0.4.11;

contract SimpleStorage {
    uint storedData;

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

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

We have a contract at an address where anyone can change value. What I fail to understand here when anyone can come and change the value of such contract, how can we say blockchain is immutable?

Is blockchain immutable with respect to the position of contract itself in the blockchain and its address only? If anyone could wrap my head around this please, it would be helpful.


texts: Is "homestead transition" block needed in chainspec for a private network?

texts:
In the chainspec.json file for a custom chain, there is this value:

  "homesteadTransition": "0x30d40",

Do I need that if I'm running on a private blockchain?


texts: How much computation can be done in a fallback function?

texts:
Simply sending Ether to a contract, will run the contract's code.  In Solidity, this code maps to what it calls the fallback function.

How much work can be done in a fallback function?


texts: What would happen if someone tried to use Ethereum with a modified version of the client?

texts: Let's say that I try to use Ethereum with a modified version of the client which does not follow all the rules of the protocol. What stops my client from being able to damage the Ethereum network?


texts: how to sign transaction during contract deployment

texts:
I am looking at the web3js documentation to deploy a new contract, however, I see no mention of how to sign the transaction that will deploy the contract in the blockchain...document makes no mention of signing with private key...will appreciate any insight into this

here is the example code snippet from the docs (https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#eth-contract)

myContract.deploy({
    data: '0x12345...',
    arguments: [123, 'My String']
})
.send({
    from: '0x1234567890123456789012345678901234567891',
    gas: 1500000,
    gasPrice: '30000000000000'
}, function(error, transactionHash){ ... })
.on('error', function(error){ ... })
.on('transactionHash', function(transactionHash){ ... })
.on('receipt', function(receipt){
   console.log(receipt.contractAddress) // contains the new contract address
})
.on('confirmation', function(confirmationNumber, receipt){ ... })
.then(function(newContractInstance){
    console.log(newContractInstance.options.address) // instance with the new contract address
});


texts: Truffle Contract Factory Testing (Javascript)

texts:
I have a hub contract (1) that uses a contract factory (2) to create a contract (3). I am writing some tests in JavaScript to ensure that contract 3 is created correctly. I can tell events are being emitted correctly, but when I want to check the functions of contract 3 (#tryingtobethorough), it looks like Truffle does not recognize the created contract 3 address as a contract (i.e. TypeError: contract3Address.functionName is not a function). Does Truffle Javascript testing only recognize addresses as contracts if deployed through Truffle migrations? Is there a work around for this in Javascript? Perhaps it is a better test case for Solidity testing?

Below is some simplified versions of what I am working with:

Contract 1: Hub

import "./Contract2Interface.sol";

contract Contract1 {
    Contract2Interface I;
    function Contract1(address Contract2Address){
        I = Contract2Interface(Contract2Address);
    }
    function creation() returns (address newcontract3) {
        address theCreatedContract3 = I.createNewContract3();
        return newcontract3;
    }
}

Contract 2: Contract Factory

import "./Contract3.sol";
import "./Contract2Interface.sol";

contract Contract2 is Contract2Interface {
    event ContractCreation(address _newContract);

    function createNewContract3() public returns(address) {

        Contract3 createdContract3 = new Contract3();
        ContractCreation(createdContract3);
        return createdContract3;

    }
}

Contract 3: Contract to be Created

contract Contract3{
    uint256 public num;
    function storeNum(uint256 newNum) public returns(bool) {
        num = newNum;
    }
}

JavaScript Test
This is simplified, but I think it gives enough of an idea.

beforeEach(async function(){
    contractFactory = await Contract2.new();
    contractHub = await Contract1.new(contractFactory.address);
  });

describe("Creating contract 3", async function(){
    it("Should allow us to create contract 3", async function(){
      let result = await contract1.createNewContract3({from: owner});
      //Event data
      let log = resultTwo.logs[0];
      let contract3Address = log.args._newContract;
      console.log(contract3Address) //I can see this is a valid contract address & event has been emitted properly.
      let newnum = await contract3Address.storeNum(7);
      // At this point I get an error that "storeNum" is not a function of contract3Address from Truffle testing
    })
  })


texts:
My ETH transaction is not yet confirmed and still pending, its been 4hrs ago I am transferring it to Etherdelta. Earlier the estimated transaction time is 4hrs and 6mins and 45seconds but it has been that long but still the estimated transaction time is the same, can you help me with this please? here is my Transaction hash:
https://etherscan.io/tx/0x07e2309bd3d191014ee2b1aa909d9d03e3bfa8f7813fba1a37b5a19cea93ad68
thanks!


texts:
{
"id":"eca798d8-8e68-a096-a35f-174133f86e43",
"version":3,
"crypto":
{
    "cipher":"aes-128-ctr",
    "cipherparams": { "iv":"45092c0a2032250e66a9d0bd2a33acaa" },
    "ciphertext":"0385fd52dfc528713d7b0b72073b992b93aa78f32b0576848a9de69d6e836c3d",
    "kdf":"pbkdf2",
    "kdfparams":
    {
        "c":10240,
        "dklen":32,
        "prf":"hmac-sha256",
        "salt":"e04e80b6174ca47c86e9174fd952949e53c900852d5c3cb62b863c5241e54f    28"
    },
    "mac":"178d2c012e1970b853e1551fa9bb0a51b86955cc4ed8db53a9b60cbbdbca8c7b"
},
"address":"00faf16e4909296f5cca76e1ccd7cd811fba93d0",
"name":"User-007",
"meta":"{}"

}

The Parity software creates an account in the localhost of the user when they install Parity. This means that the account info including password is stored in the owner's computer, right? The example above is what i found from another question but similar to what is found in the parity folders.

So I created an account to test if we can retrieve the password, without using the password recovery. I found that there is this file which i assume that there is the password in it, somewhere in the ciphertext or pbkdf2 encrypted texts. Is there a way to retrieve the password, and where do i start to?

I looked around and found out that the ciphertext contains the private key, but not the password. The pbkdf2 uses the password to hash, does that mean that there is a way of retrieving the password from the pbkdf2 salt / mac?


texts: Why does the compiler keep asking me to declare internal functions?

texts:
I am using this ERC223 compliant code to accept an ERC20 token as payment (provided by @aviral agrawal). Why does the compiler keep asking me to declare the balances function? I thought it was an built-in function? It did this for the balanceOf and safeSub functions as well.

pragma solidity ^0.4.2;

contract getLaundri{

function balanceOf( address who ) constant returns (uint balances) {
  return balances[who];
}

function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {

require(balanceOf(msg.sender) >= _value);
balances[msg.sender] = safeSub(balanceOf(msg.sender), _value);
balances[_to] = safeAdd(balanceOf(_to), _value);
ContractReceiver reciever = ContractReceiver(_to);
reciever.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
StateChanged(true,"Transfer to contract successful");
return true;

}

}

This is the error message:

 Undeclared identifier.
balances[msg.sender] = safeSub(balanceOf(msg.sender), _value);
^------^


texts: Calculating Gas Remaining at Specific Point in Execution of Contract

texts:
This is a doozy :~)

I'm trying to figure out the amount of gas remaining in some contract at some specific step. For example:

function hash(uint num) returns (bytes32) {
        return sha3(num, msg.gas);
}

While this is a silly example, for all intents and purposes, I want to be able to calculate what this function will return before I have to make a call/interact with a node.

I know that the amount of gas at this step is determined by how much gas I initially provide, the data in the actual call (aka, if the num provided has a bunch of zeros), etc.

How can I calculate the hash generated by this tx before interacting with a node in anway? I imagine there is some formula - maybe it relies on me reading the VM code and/or byte code.

Also, I guess, these are sub-questions to this question:

Is gas deducted before an operation is performed?
Is there a generalized way to calculate the gas remaining at a specific point in the execution of a contract?

Any info (or just a point in the right direction) would be greatly appreciated. Thanks!


texts: How blockstack implements identity management?

texts:
Reading https://blockstack.org/posts/blockchain-identity it states Blockstack is the largest, most popular blockchain identity system, with 50,000 registered identities. but reading the available papers https://blockstack.org/papers there is no significant detail on how blockstack implements digital identity ?

This is in contrast to uPort who also implement blockchain identity but have a detailed evolving whitepaper on how this is achieved : https://uport.me/library/pdf/whitepaper.pdf


texts:
What is a good way to solve my deployment issue:
(furtherance of issue: truffle testing problem, migration successful, testing runs out of gas with addition of testing file)

When i add the TestProcessApplicants.sol file i run out of gas.
I suspect this is also true, due to the instantiation of local instances to test some modifiers in the solidity tests.

Modules             Remix TransactionCost
CredentialOrgFactory    2209646
CredentialFactory       1934056
SafeMath32                74748
ApplicantFactory        2432336
ProcessApplicants       1937776
Total                   8588562

I suspect a 3_deploy_contracts.js file will be needed.
I need to be able to set reference addresses like in below deploy, but I need to be able to see previous (2_deploy_contracts.js) instances.  how would i go about doing that?  Or is there a better approach? or am i just 'doing it wrong'.  lol.

here is 2_deploy_contracts.js

var SafeMath32 = artifacts.require("./SafeMath32.sol");
var CredentialOrgFactory = artifacts.require("CredentialOrgFactory");
var CredentialFactory = artifacts.require("CredentialFactory");
var ApplicantFactory = artifacts.require("ApplicantFactory");
var ProcessApplicants = artifacts.require("ProcessApplicants");

module.exports = async function(deployer, accounts) {
    let safeMathInst, aInst, bInst, cInst, dInst;

    await Promise.all([
    deployer.deploy(SafeMath32),
    deployer.deploy(CredentialOrgFactory),
    deployer.deploy(CredentialFactory),
    deployer.deploy(ApplicantFactory),
    deployer.deploy(ProcessApplicants),
    deployer.link(SafeMath32, [CredentialOrgFactory,CredentialFactory,ApplicantFactory])
]);

instances = await Promise.all([
    SafeMath32.deployed(),
    CredentialOrgFactory.deployed(),
    CredentialFactory.deployed(),
    ApplicantFactory.deployed(),
    ProcessApplicants.deployed(),
])

aInst = instances[1];
bInst = instances[2];
cInst = instances[3];
dInst = instances[4];

results = await Promise.all([
    // Set Address of bInst so it can point at aInst
    console.log("setAddress CredentialFactory: for CredentialOrgFactory"),
    bInst.setAddress(aInst.address),
    // Set Address of cInst so it can point at aInst
    cInst.setAddress(aInst.address),
    // Set Address of dInst so it can point at aInst, bInst, and cInst
    dInst.setAddress(aInst.address, bInst.address, cInst.address)
    ]);

};


texts: How to list all recipts in a block using web3js?

texts:
I'm trying to list all transactions and their receipts from given block. Transactions get be included in the result of GetBlockByNumber function but I have found no option to include receipts.

I can ask for each receipt in a block one-by-one but this is terribly inefficient.

Is there another way to get all transactions?


texts: Getting error message from require() using golang, and go-ethereum?

texts: From everything I've been able to find, the only way you can get the error message from require() is by using remix which isn't practical for dealing with production issues. Therefore, I'm wondering how one can retrieve the error message, either using the geth console or go-ethereum library.


texts: How to use web3 function (ecRecover) that shouldn't require a provider?

texts: I want to use web3's ecRecover functionality and nothing else. Unless I misunderstand its requirements -  a signature, the signed data, some cryptomagic and poof you have recovered the signer - why do I need to have a provider for it? What I'm trying to say is that this functionality could be implemented without relying on the RPC connection. So is there a way to do ecRecover in Node.js or even vanilla javascript sans web3?


texts:
I am trying to connect to Geth via Websockets but unfortunately i am given 403 error.
I am using the --ws --wsport XXXX args.

Everything is done in a local instance, so that would be surprising if it has something to do with the port.

Any idea ?

Thank you.


texts: Ethereum transaction wasn't processed in 240 seconds

texts:
I have deployed my private Blockchain via Ethereum Proof of Consortium. I have an intermittent issue on transaction. so far the only remedy is to restart the vm's but this issue happens again.

Transaction 0x6f34f71090b8ab768b53cb519aaaa4b7920f68fd72e466a7d02aaff96998c468 wasn't processed in 240 seconds.

_addTokenCustomized: function (tokenToEthaddress, tokenvalue, emailid) {
console.log(" Unlock Account :", web3.personal.unlockAccount(web3.eth.accounts[0],ethPassword));
    CoffeeCoin.deployed().then(function (contractInstance) {
      contractInstance.transfer(tokenToEthaddress, tokenvalue, { gas: 4500000, from: web3.eth.accounts[0] }).then(function (result) {
        if (result) {
        primus.send('red', "ccccccccc")
          console.log("token transfered")
            contractInstance.balanceOf(tokenToEthaddress).then(function (amount) {
              primus.send('red', "ccccccccc")
            document.getElementById('balance3').innerText = amount;
              var ts = (new Date).getTime();
                $.ajax({
                    url: '/addtoken',
                    type: 'POST',
                    processData: false,
                    contentType: 'application/json',
                    data: JSON.stringify({
                        "SourceEmailID": emailid,
                        "TotalTokens": amount,
                        "TimeStamp": ts,
                    }),
                    dataType: 'json',

                    success: function (res) {
                        console.log(res)
                    },
                    error: function (err) {
                        console.log('Error:', err)
                    }
                })
          });
        }
      }).catch(function (err) {
        // There was an error! Handle it.
        console.log("TransactionError: ", err);
      });
    })
}


texts: How to handle calling instance method in a constructor?

texts:
Is it possible to call (or schedule a call) to class method in constructor?
contract Foo
   constructor() {
      owner = msg.sender;
      this.setUp()
   }
   setUp() {
     // run some setup code
   }

I understand (unlike Javascript) that you can't call instance methods in constructor to initialize the state, or with specific libraries where you can 'hook' into some lifecycle method.
With Solidity, is there a recommended pattern for something like this?


texts: how can I make function of another contract callable?

texts:
Obviously there is a problem with the deploy procedure or the remix IDE, but how can I make the function callable?
pragma solidity> = 0.5.0 <0.6.0;

import'openzeppelin-solidity / contracts / math / SafeMath.sol';

contract TestContract {
    using SafeMath for uint256;
    mapping (address => uint256) private balance;
    mapping (address => bool) private accountBook;

    modifier checkPoint () {
        require (accountBook [msg.sender], "You need to have an account with us");
        _;
    }

    modifier alreadyExists () {
        require (! accountBook [msg.sender], "You are already an account holder");
        _;
    }
    function createAcc () public alreadyExists () {
        accountBook [msg.sender] = true;
    }

    function deposit () public payable checkPoint () {
        require (msg.value> 0, "Please send some funds");
        balance [msg.sender] = balance [msg.sender] .add (msg.value);
    }

    function closeAccount () public checkPoint () {
        require (balance [msg.sender]> 0, "You dont have any balance");
        address (msg.sender) .call.value (balance [msg.sender]) ("");
        accountBook [msg.sender] = false;
        balance [msg.sender] = 0;
    }

}

contract CallFunc {
    TestContract public testcontract;
    address public addr;

    constructor (address _addr) public payable {
        testcontract = TestContract (addr);
        addr = _addr;
    }

    function preset () public {
        testcontract.createAcc ();

    }

By the way, even if the amount of gas was set to 60 gwei, it did not work.
The same behavior occurs with javascriptVM and injected web3.


texts:
I am running geth/mist on windows 10. geth has been started with

  geth -rpc

I've then waited for the sync to complete (some time) and can confirm the sync is finished with a call to eth_syncing which returns:

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

and yet the call to {"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83} always returns

{
"jsonrpc": "2.0",
"id": 83,
"result": "0x0"
}

what is going on? docs say this should return the most recent block (even during syncing it should return non zero)


texts:
If a contract has a list of 100 addresses stored, and the code loops through the list and tries to send each address '0' ether. Does that generate 'gas' for each send call?

The reason I'm asking is because I saw some code that did this (loop through addresses and send '0' ether), and I was wondering if that could get more and more expensive the more addresses get added to the list. Thanks.


texts: Mocha timeout when running truffle test. Works fine on ganache, not on public networks

texts:
This is the error I get when running truffle test --network kovan:

1) "before all" hook: prepare suite

 Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/mcplums/Repos/ConsensysBootcamp/truffle-test-debugging/project-dir/test/simpleStorageTest.js)

The tests work fine if I just do truffle test. Also truffle migrate --network kovan works fine and I am able to interact with the contract via remix. So whatever the problem is, it is not a problem with testing generally, and it is not a problem with migrating to kovan generally.

I managed to recreate my problem using the truffle test tutorial box to make things as simple as possible.

Here is my truffle config:

const path = require("path");
const HDWalletProvider = require('truffle-hdwallet-provider');
const mnemonic = 'XX'; // 12 word mnemonic
const kovanProviderUrl = 'https://kovan.infura.io/v3/XX';

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // to customize your Truffle configuration!
  plugins: [ "truffle-security" ],
  contracts_build_directory: path.join(__dirname, "app/src/contracts"),
  networks: {
    kovan: {
      network_id: 42,
      provider: new HDWalletProvider(mnemonic, kovanProviderUrl, 0),
      gas: 10000000,
      gasPrice: 1000000000, // 1 gwei
      skipDryRun: true,
    },
    development: {
      host: "127.0.0.1",     // Localhost (default: none)
      port: 8545,            // Standard Ethereum port (default: none)
      network_id: "*",       // Any network (default: none)
      gasPrice: 1000000000, // 1 gwei
    },
  },
  mocha: {
    reporter: 'eth-gas-reporter',
    reporterOptions: {
      currency: 'USD',
      gasPrice: 5, //in gwei
    },
  },
};

And here is the js test file:

var SimpleStorage = artifacts.require('SimpleStorage')

contract('SimpleStorage', async (accounts) => {

    it('Calling set(x) should set storedData in storage to x', async() => {
        let newValue = 2;
        let instance = await SimpleStorage.deployed()

        instance.set(newValue, {from: accounts[0]})
        let returnedValue = await instance.storedData.call()

        assert.equal(newValue, returnedValue, "The returned value should equal the new value.")
    })

})

It takes < 2 minutes to deploy the contracts onto kovan so I don't think simply increasing the timeout is the solution.

Happy to put the above onto github to allow testing the exact code I've got if that would help.

Wat do? Thank you in advance kind internet strangers.


texts: Automatically determine the use of call or sendTransaction based on the method type

texts:
In web3.js version 0.x:

The web3 module automatically determines the use of call or sendTransaction based on the method type.

So for example, instead of doing:

myContractInstance.myMethod.call(...)

You can do:

myContractInstance.myMethod(...)

In web3.js version 1.0, this no longer seems possible.

For the example above, you need to do:

myContractInstance.methods.myMethod.call(...)

So every function call becomes "lengthier", and in addition, the code which I have already written is not easily portable.

Is there any available wrapper for web3.js version 1.0, which allows using the same syntax as in web3.js version 0.x?

The relevant documentation for web3 v0.x is here.

The relevant documentation for web3 v1.0 is here.

Thank you!


texts:
I am unable to uninstall truffle using this command

npm uninstall -g truffle

Current ver is 4.1.5 , I want to uninstall and reinstall v4.1.4 as code seems to be breaking while compiling and v4.1.4 may help as per the suggestions in this forum.
While running the above it says "up to date in 0.141s (sec keep changing)".

System is ubuntu 16.04 (32-bit)

Thank you


texts: How to trace the ethereum in a contract if messages are not written in the blockchain

texts: The messages initiated by contracts are not stored in the blockchain, unlike transactions. If that's the case how can do we see where an ethereum in a contract or a wallet came from if it's from a contract?


texts: Do I have to include every method in an interface?

texts: I'm using a 3rd party contract in one of my contracts.  I've created an interface for the 3rd party, do I have to include every external method in the interface, or just the ones that I need to use in my contract?


texts: auto call function after specific time limit

texts:
I want to run a solidity function in my contract to automatically call/execute after 21 days.
How can I do that?
I am not able to find any specific resource to execute this thing.
It would be awesome if someone can help me out in this problem.
I have this code which checks if it's already 21 days or not however it does not automatically execute the function.
deadline = now + (numberOfDays * 21 days);

Thanks!


texts: Downloading full blockchain again after using geth --fast on 0.7.4

texts:
I've downloaded the newest mist browser on a new pc and used geth --fast.

After fully syncing (which was about 1,5 hours) the syncing started from 0 again, but this time slow, downloading the whole chain. Does anybody know what I'm doing wrong? I didn't delete the fast chain or anything.


texts:
Web3.eth.getGasPrice() returns incorrect result (just two results 6 gwei and 10 gwei) at which time gasTracker showed about 58 gwei.
I am confused why just two fixed value (6 and 10) when this happens and want to know in what case the getGasPrice api fail? Thanks for help.


texts: Is it more computationally expensive to call another contract's function than calling that function internally? If so, is it appreciably more expensive or is it fairly negligible?


texts: Is there any benchmark tool to test transaction speed?

texts: I'd like to know how many tx/sec does ethereum clients(like geth) in private network can process. Is there any benchmark software which can send many transactions or messages to ethereum clients?


texts: peers keep connects and disconnects into private Ethereum blockchain

texts:
I have two servers that are connected into local private ethereum blockchain successfully and they do mining as well. After few minutes one of them disconnects and after that it re-connects again and so on. Sometimes both get connected, or both disconnected, or one of the is connected while other one is disconnected. Blockchain is sync for both servers. After the re-connection, they continue to mine.

[Q] What may cause peer disconnections?

Thank you for your valuable time and help.

My client connects into my local private ethereum blockchain successfully. :

> admin.addPeer("enode://<id>@<ip>:3000?discport=0");
true
> net
{
  listening: true,
  peerCount: 1,    ||  0,
  version: "23422",
  getListening: function(callback),
  getPeerCount: function(callback),
  getVersion: function(callback)
}


texts:
in my last smart contract(solidity ^0.4.11) its work correctly, but now (solidity ^0.4.18) I get warnings.

. This declaration shadows an existing declaration.
. Function state mutability can be restricted to view

function freezeAccount(address target, bool freeze) public onlyOwner {
    frozenAccount[target] = freeze;
    FrozenFunds(target, freeze);
}

function frozen(address _target) public returns (bool frozen) {
    return frozenAccount[_target];
}

Cand understand, whats the problem? I have functions like this and no errors.


texts: Killing a smart contract and recovering funds inside

texts:
I’m trying to kill a contract that I set up and own.
I understand (and hope) that killing a contract will send any ETH inside the contract to the owning account.
The method I use are either MEW or MyCrypto — both seem to work similarly.
I’ll describe things using MyCrypto.
I select "contract": and fill in the details:  Contract Address, ABI/Json interface (copied from etherscan.io)
Access the contract is via the dropdown “kill” and filling in the “_to” address.  I also set VALUE to zero.
(Not sure if this is required).
To my surprise the raw transaction is
{
  "value": "0x0",

  "data": "0xcbf0b0c0000000000000000000000000(_to Address)“.

  "to": "0x(Contract Address)”,

...(etc)

}

That is, the "Contract address" and “_to” address are interchanged.    Going to the next step shows the  proposal to transfer ETH from the "_to"  account to the  "Contract address"  rather than vice versa.
Out of caution I then stop.
The same happens with MEW.
I thought it may have had something to do my particular contract.
However etherscan.io reports that there are many identical contracts to mine.    Performing the same steps on one of the similar contract leads to same flipping of the two addresses.
What am I doing wrong or misunderstanding??


texts: what is possible with gasless permit/signature from a wallet giving permission to a pool?

texts:
Hi I wanna implement some gasless functionalities to allow a pool to make some decisions over a wallet by using the permit/signature feature
I have several ideas such as making the pool trade from the wallet (and get back of % of realized gains) as well as allowing the pool to use a collateral from the wallet to borrow or make a swap
are these options feasible? what are the list of operations available once you approve a permit/signature from a wallet?


texts: Transaction logged at geth node, but unable to locate Transaction entry on Ropsten

texts:
When sending new transactions one at a time (meaning separated by 1 or several minutes in time) they are correctly broadcasted and mined. But when sending several of them one after another (spearated by just a few seconds) most of them are lost. Geth node confirms reception of the transaction, but blockchain Ropsten do not show them.

Here it is a set of transactions, most of them not available at Ropsten:

I0421 14:23:57.216680 internal/ethapi/api.go:1107] Tx(d83896adacd210a545d8bc53be2672d2bbb535cd6fd93fc6d74dcafb24c047ea) to: &ce8efd03766a309af57ddeb9c79f3e7cd23da0df
I0421 14:23:41.739022 internal/ethapi/api.go:1107] Tx(c6002dc6a3b28b6caba7ed7cb143d79147dc705437ccf70e267a4b2379f7920d) to: &ce8efd03766a309af57ddeb9c79f3e7cd23da0df
I0421 14:23:08.040512 internal/ethapi/api.go:1107] Tx(dcaa2a36ca4e2c5c3377e6b1f72d127242b4556c001efc3aca38c980c4e4c333) to: &ce8efd03766a309af57ddeb9c79f3e7cd23da0df
I0421 14:23:07.542375 internal/ethapi/api.go:1107] Tx(dcaa2a36ca4e2c5c3377e6b1f72d127242b4556c001efc3aca38c980c4e4c333) to: &ce8efd03766a309af57ddeb9c79f3e7cd23da0df
I0421 14:23:01.623979 internal/ethapi/api.go:1107] Tx(c70976a147e3e268131b0ed2be4555277371f439bbfe641ed1c55acaeec725eb) to: &ce8efd03766a309af57ddeb9c79f3e7cd23da0df
I0421 14:22:54.749671 internal/ethapi/api.go:1107] Tx(c3089a845110a871713bead6b71984ac5053cf4c2a3baa864e7ba0cf4499280b) to: &ce8efd03766a309af57ddeb9c79f3e7cd23da0df
I0421 14:22:49.069954 internal/ethapi/api.go:1107] Tx(fb629dc7f75b9ad486fd48afe3838c093567463d850b19c867c58520420eb9e7) to: &ce8efd03766a309af57ddeb9c79f3e7cd23da0df
I0421 14:22:35.357242 internal/ethapi/api.go:1107] Tx(1cae8925fb57971c126f37d2cef98f71696523cd109b7359f2f5845f1f05ca6a) to: &ce8efd03766a309af57ddeb9c79f3e7cd23da0df
I0421 14:22:24.175374 internal/ethapi/api.go:1107] Tx(9aceebdb23c4542ea5469d4cf05cc3ee7bddc7ea55fdae05ea63c45c9e581a70) to: &ce8efd03766a309af57ddeb9c79f3e7cd23da0df
I0421 14:22:16.787944 internal/ethapi/api.go:1107] Tx(7a2d0660aeec7698328e1e1ee96ecc929f4f6323fd22c5a337c92995bf88b4cf) to: &ce8efd03766a309af57ddeb9c79f3e7cd23da0df
I0421 14:22:08.852178 internal/ethapi/api.go:1107] Tx(73e7586a05ed17f1acb21fae93806349334881393c4493d4c708e3a902cd16c6) to: &ce8efd03766a309af57ddeb9c79f3e7cd23da0df
I0421 14:22:01.956836 internal/ethapi/api.go:1107] Tx(2ded9002531b59dd7c42dcb2a51ab420be555d8c7a26269334c24ce8971e1b6e) to: &ce8efd03766a309af57ddeb9c79f3e7cd23da0df
I0421 14:21:53.184982 internal/ethapi/api.go:1107] Tx(9a9ac63a5d7b061b1597892f63a906c195c258c66b81e8d2f943ca9b5664f314) to: &ce8efd03766a309af57ddeb9c79f3e7cd23da0df

For example,

https://ropsten.etherscan.io/tx/0x2ded9002531b59dd7c42dcb2a51ab420be555d8c7a26269334c24ce8971e1b6e

says "Unable to locate Transaction entry".

Meanwhile others such as:

https://ropsten.etherscan.io/tx/0x9aceebdb23c4542ea5469d4cf05cc3ee7bddc7ea55fdae05ea63c45c9e581a70

have been mined successfully.

How can I find out where and why those transaction became lost? Any idea how to debug the process?

Refs.:

Transaction stuck since yesterday

Transaction mined or not?


texts:
Can a light client solo-mine in theory ?
It could download the DAG and the latest EVM state.
Given these two , it can mine without downloading full blockchain, right?
If this is true, why hasn't this been implemented?


texts: Is it possible to use pyethapp as a python script interpreter so that account management operations and transactions may be automated.


texts: Is it possible to send a standard transaction with a gas limit < 21,000?

texts:
I've noticed that Parity and Geth will return the following error when sending a standard transaction with less than 21,000 gas:

"Transaction gas is too low. There is not enough gas to cover minimal cost of the transaction (minimal: 21000, got: X). Try increasing supplied gas."

Is this enforced at the protocol level? Or is it possible for someone to run a custom node and generate a valid transaction that can be broadcast to the network with less than the minimum gas? (even though I'm assuming if this is possible the transaction will just get included in a block and run out of gas).


texts: Private net Miner/Coinbase account changed

texts:
I set a Private net with Geth.
and use miner.start() to mine blocks.
my default account is 0x59a4155889e72de7846da695672d87f0e6da7332 in the keystore folder.

PROBLEM:
before 3000 blocks, the block's coinbase is 0x59a4155889e72de7846da695672d87f0e6da7332 which is my default account, but when mining for 3000 blocks, the 3001 block's header.coinbase become 0x6ad5c14743b1fb28c012c877824d5b07c0ebc2ed which i have never seen...
so anybody know why?


texts: Might storage be part solution for sustaining ETH PoS sharding?

texts:
My understanding, from an answer to previous post is that it's currently cost prohibitive to exchange datasets of significant size over the ETH network.

Is it possible for the ETH network to evolve into a more data-driven (^ size) than BTC PoW model. Where, this model involves a hybridisation of PoW proportional/dynamically adjusted to the amount of SSD hard disk space a user dedicates to the network.

My thinking, is that we would effectively remove the need for future developers to do Full Syncing. So as this type of data driven sharding proliferates, synchronisation/contract deployment would be much faster because the data is safely distributed/replicated amongst a MIN # of global nodes providing pooled SSD storage. Note I propose for Data Storage mechanisms (e.g..IPFS, Swarm, + this theoretical storage sharding model) that a complete file is Never stored on one node. For future rapid "Confirmations" it must follow recovery and sufficient level of distribution. However, equally rapid re-compiling/assembly of the file with private key access.

just a thought, thanks : )


texts: What is meant in this tutorial when it says that using throw will "consume all provided gas"?

texts:
When reading the solidity documentation (http://solidity.readthedocs.org/en/latest/solidity-by-example.html#voting), I came across this:

function giveRightToVote(address voter)
{
    if (msg.sender != chairperson || voters[voter].voted)
        // `throw` terminates and reverts all changes to
        // the state and to Ether balances. It is often
        // a good idea to use this if functions are
        // called incorrectly. But watch out, this
        // will also consume all provided gas.
        throw;
    voters[voter].weight = 1;
}

In particular, this part:

  But watch out, this will also consume all provided gas.

Does this mean that, if you provide a large amount of excess Ether that it won't be refunded after a throw?


texts: Why do external accounts have storage space?

texts:
The Solidity documentation on accounts states that there are two types:

External accounts, which are owned by humans
Contract accounts, which are controlled by code

The following line in the documentation is confusing for me:

  Every account has a persistent key-value store mapping 256-bit words to    256-bit words called storage.

I understand that contract accounts have storage space and why this is necessary. But why is this also true for external accounts? There are answers available in the context of contract accounts but not in the context of an external account.

Am I missing something here? Any help is highly appreciated.


texts: How does USDC manage to only cost 25k gas instead of 35k++ for transfer?

texts:
I am baffled why Centre's USDC only costs around 25k for token transfer instead of 35k++ like other common ERC20.

For example this is Gemini USD:
https://etherscan.io/tx/0x5006eb71ec62354bf21195bcd88f6ba7401f58e0d0457400abf679de73ba4f23
costs at around 35k

and this is a very simple ERC-20 implementation based on OpenZeppelin library token on rinkeby
https://rinkeby.etherscan.io/tx/0x6ff6547444bc81de31eb3ed3c2cc88b3f341f467ef6d610a1de3999488d00cb5
costs at around 36k

while USDC managed at around 25k
https://etherscan.io/tx/0x4d79588d9a7ebbfdf956c0f2ccdd6d30c533c9a8cf568fe7196907ba76811196
https://etherscan.io/tx/0x4ec2a4760bdf1d49b8256cec5f23378364c21ed8a853858eaafae82d67ff9dd4
https://etherscan.io/tx/0x431873cfb8ad25fbe0d85732f8db47196cf687a307bf4f3262cc876c9c0a998a