texts: Is it safe to delete your main account private key file?

texts: I have created backup copies of my main account private key file in a USB and also saved it in other laptops. I want to remove this main account from my Mist Ethereum Wallet. Is it safe to do this? I don't want to loose all my funds. :)


texts: Accessing an enum with Enum() == access by index?

texts:
How can you compare an enum to a uint8?

enum Op { NONE, EQ, NEQ, GT, LT, GTE, LTE, RET, NOT, AND, OR, XOR, IF_ELSE }
struct Param {
    uint8 op;
}

I have a Param param; which has the enum's index saved as uint8 on param.op.
Then I have seen before a comparison like so:

if (Op(param.op) == Op.NONE)

However, I didn't find any documentation about accessing an enum like it's happening here: Op(uint8variable)

If eg. enum Enum { BLA } is accessed through Enum(), what does that do exactly?


texts:
I want to use ethereum php lib and I need to set a node in the script to replace 127.0.0.1 and port 8545.
What kind of node I use min space and min ram so it will save me money to set the node up
Use a geth node or parity node? In light or fast mode? Or I can use some way to min the space and cost.
So I can use eth sign and send transaction


texts:
I wrote this piece of code with the goal to store unique documents hash. Used mapping to accomplished that.
pragma solidity ^0.5.16;

contract DocumentHash{

    string public documentHash;
    mapping (string => string) hashAlreadyRegistered;

    function setDocumentHash(string memory hash) public {
        require(keccak256( abi.encodePacked((""))) != keccak256(abi.encodePacked((hash))), "Empty hash!");
        require(keccak256( abi.encodePacked((hashAlreadyRegistered[documentHash]))) != keccak256(abi.encodePacked((hash))), "Hash already registered");

        documentHash = hash;
        hashAlreadyRegistered[documentHash] = hash;
    }

    function getDocumentHash() public view returns(string memory) {
        return documentHash;
    }
}

When i start a local server (npm start) with geth connection and send a hash to this contract, it works fine. When i try to send same hash, it active the expected behavior (require condition). But if i for example, restart the local server and geth connection, i'm able to store the same hash that i stored already. Wont the hash's be unique? or my code fails somewhere?


texts: Create unit tests to validate the string[] returned from a solidity function

texts:
I have a solidity function like the one below,

pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;

contract Funding {
    function sum(uint input1, uint input2) public returns (uint) {
        return input1 + input2;
    }

    struct patient{
        uint id;
        string fullName;
        mapping(uint => string[]) DoctorAccess;
    }

    function getPatient(uint patientId, uint doctorId) public returns (string[]) {
        patient p;
        p.id = 1;
        p.fullName="Saran";
        p.DoctorAccess[doctorId].push("Doctor1Key");
        return p.DoctorAccess[doctorId];
    }
}

The compilation of the code looks good. Hence, i have created a test case for the above one as given below.

pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;

import "truffle/Assert.sol";
import "../contracts/Funding.sol";

contract FundingTest {

    function testSum() public {
        Funding  f= new Funding();
        Assert.equal(f.sum(1,2),3," two plus one should be three");
    }

    function test_getPatient() public {
        Funding f = new Funding();
        string[] doctorKeys;
        doctorKeys.push("Doctor1Key");
        Assert.equal(f.getPatient(1,1),doctorKeys, "The doctor mapping should be a valid one");
    }
}

When I try to run the test case, i am getting the below error

  ,/H/ethereum/PM/test/FundingTest.sol:18:9: TypeError: Member "equal"
  not found or not visible after argument-dependent lookup in
  type(library Assert) Assert.equal(f.getPatient(1,1),doctorKeys, "The
  doctor mapping should be a valid one");

Is the above test case wrong or is there something that needs to be addressed.


texts: Calling function with one parameter in Solidity

texts:
I am trying to call a function with one parameter
I have used these methods all didn't work: //z=addmul(total); //this.addmul(total);
This is the function created:

function addmul(uint256 a, uint256 b) internal pure returns (uint256 c  ) {

        require(c >= a && c>=b, "SafeMath: overflow encountered");

        return c;

    }

This is how it was called, given unexpected result:

//multiplication operation
    function multiplication(uint256 x, uint y) public  {
    total=x+y;
    total.addmult;  // this one runs, but it does not give desired result
    //z=addmul(total);
    //this.addmul(total);
}

I want the addmull function to effect the computed value of total variable. The main essence of the function is to protect an overflow when x and y are added or multiplied together.


texts: Can NFTs be stolen from a web wallet? Is there cold storage for NFTs?

texts:
Many NFT collectors move their claimed NFTs (NFTs that they won) from their web wallet (e.g. Metamask) to a different wallet that they call a vault wallet.
What is this vault wallet? Is it a hardware wallet? can NFTs even be moved from an NFT platform offline to a hardware wallet? Are there wallets specialized for NFT cold storage for ERC-721 tokens, rather than for coin and ERC-20 token storage?
What if the NFT platform built something into the smart contracts of their NFT token (the format on which all users' NFTs are minted on) that gives them secret access to revoke all NFTs on their network? are NFT platform-minted tokens susceptible to theft in any sort of way that is unique from the theft of coins and ERC-20 fungible tokens?


texts:
I try to check that a total of 4 events have been emitted by  my contract instance. Next code will fail in the assert.equal line since getPastEvents will process the events in a callback and so the assert will be executed before the callback being able to process (and count) the events.

// NOTE: Error control removed for clarity.
it("SHOULD FETCH 4 EVENTS", async () => {
  const EXPECTED_EVENT_COUNT = 4;
  var TOTAL_COUNT = 0;
  myContractInstance.getPastEvents(
      'MyTestedEvent',
      { fromBlock: 0, toBlock: 'latest' },
      function(error, result) {
        TOTAL_COUNT++;
      }
  );
  assert.equal(TOTAL_COUNT, EXPECTED_EVENT_COUNT, "");
})

Is there any trick to make the assert.equal line wait in a loop until a condition is met?


texts: How long does it take to sync Rinkeby network with geth?

texts:
I am syncing the Rinkeby network with geth

geth --rinkeby --rpc --rpcapi="personal,eth,network,web3,net" --ipcpath="~/.ethereum/geth.ipc"

When I run

eth syncing

in geth console, it is showing

{
  currentBlock: 1977672,
  highestBlock: 3290356,
  knownStates: 4267080,
  pulledStates: 4265773,
  startingBlock: 1254995
}

Is there any approximate time to complete syncing?

After syncing the first time, should I go through the same process next time? Or I can sync in less time than the first time?


texts: What is the exact "longest chain" rule implemented in the Ethereum "Homestead" protocol?

texts:
This paper from 2016 claims (in section 3.3.2, speaking about the actual Ethereum implementation as opposed to the specification) that:

  although uncle blocks that are included in a block receive a reward, they do not count towards the total difficulty of a chain, i.e., Ethereum uses a longest chain rule with added rewards for uncle blocks. This clearly contradicts Ethereum’s claim of using a blockchain protocol adapting GHOST

(Emphasis in original).  The only reference offered is to this paper which appears to assert a contrasting claim, that:

  A variant of GHOST has been adopted and implemented by the Ethereum project.

Its only reference is to ethereum.org so that doesn't help either.  I am aware of the extensive documentation which describes Ethereum's rules for rewarding ommer/uncle blocks, frequently saying that they "contribute to security".  However the specific question of whether ommers/uncles are counted in determining the longest chain does not seem to be as clearly documented.

The first paper goes on to claim:

  Ethereum has also recently modified its longest chain algorithm to
  incorporate uniform tie breaking...[which] allows a selfish miner
  to increase its chances of catching up to the honest chain

And in this case links to a specific commit as well as this paper on optimal selfish mining strategies which points out that uniform tie breaking is a specific trade-off, making attacks much harder for highly connected and coordinated attackers while making attacks slightly easier for less connected or coordinated ones.  However, since that paper is a paper about Bitcoin and assumes a non-uncle-counting longest chain rule (nor does it specifically account for the strategic implications of ommer/uncle rewards), assessing the real-world impact of uniform tie breaking in Ethereum still requires knowing whether or not ommer/uncle difficulty is being counted in the first place.

So, what are Ethereum nodes doing in Homestead as far as their actual longest chain rule?

Are they counting uncle difficulty as contributing to the longest chain?  And are they still doing uniform tie breaking?  Have any other changes been made?  For example, SPV mining became prevalent in bitcoin despite not actually being implemented in the official releases.  In theory Ethereum prescribes that blocks in the main chain are fully validated while ommer/uncle blocks only have their headers  validated.  However both block timestamps and transaction inclusion have definitely been tweaked by miners before for strategic reasons.

What I want is just the best answer to this question we can currently get for the nodes actually running on pools, clients, etc.  Note that links to white or yellow papers are insufficient here, since this paper specifically claims that implementation differs from theory and documentation.  Responses need to come from the developers of actual clients such as geth and parity, and/or link directly to repositories showing how the rule is actually implemented.


texts: Where else can I get Rinkeby Ether apart from faucet.rinkeby.io/

texts: I have been trying to get rinkeby ether from faucet.rinkeby.io/ but couldn't. Any alternative?


texts: How can I have two contracts in truffle test

texts:
I'm using a contract to manage my contracts, and am not sure how to write a test.

The problem I'm facing is that I can't see how to get my coolerDb contract address.

This is my test.js

contract('CMC', function(accounts) {
  "use strict";

  it("check deployment", function(done) {
    let cmc = CMC.deployed();
    let coolerDb = CoolerDb.deployed();
    cmc.addContract("coolerDb", coolerDb).then(function(rc) {
      assert.equal(rc.c[0], true, 'Assert fail: not added');
    }).then(done).catch(done);
  });
});

The error is:

  Error: Contract address not set - deployed() relies on the contract class having a static 'address' value; please set that before using deployed().


texts: Are Ether gas fees higher than Cardano fees?

texts:
When trading ETH for altcoins on decentralized exchanges, fees right now can be around $60-150$ per trade.
A tutorial on Cardano (ADA) smart contracts shows that they will have zero fees (for smart contracts). not too sure about Cardano-altcoin trades, but ADA-ETH trades seems to resemble ETH gas fees but I might be wrong.
Is it a truth that Cardano fees are lower than ETH fees?


texts:
I'm trying to pay back about 50 DAI and unlock 0.78 ETH but it keeps defaulting to 4 million gas limit (I usually see that amount as 300,000)...for a total of 0.82 ETH....I get the gas fees are high now but it says 0.82 for gas fee and 0.82 for amount + gas fee. So I have no idea whether this transaction will cost me $1300 to payback my 50 dai or is it including the ETH that I am unlocking?

So this is a 2 part question

What is the difference between Gas Fee and Amount + Gas Fee
Why is it defaulting to such a high gas limit (I tried reducing it and it failed and ran out of gas). Seems ludicrous that I would pay $1300 for a transaction to pay back 50 Dai

Thanks


texts: how can you add support for erc20 tokens on your own exchange, so that users can perform transactions between themselves? There are many services that make it possible to work with BTC and ETH, but there is no information how to work with ERC20 tokens


texts: My computer charging port broke and my computer is dead along with my Keystore file. I have everything written down can anyone tell me how I can access my ETH. Thanks.


texts: I'm mining in ethpool with windows 7 (intel i7 @ 2.80GHz 16GB....but that doesnt really matter, right?) and a Radeon RX 480 8GB card. humming along at a steady 24.75 mh/s. haven't done a thing to the settings. can i get better mh/s out of this setup by tweaking it a little bit? any input appreciated. cheers


texts:
How can an address withdraw a contract's ether?
contract MyContract {
  address payable public withdrawAddress = 0x........;

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

  function totalBalance() external view returns(uint) {
    return address(owner).balance;
  }

  function withdrawFunds() external withdrawAddressOnly() {
    msg.sender.transfer(this.totalBalance());
  }

  modifier withdrawAddressOnly() {
    require(msg.sender == withdrawAddress, 'only withdrawer can call this');
   _;
  }

  ...
}

I'm calling withdrawFunds() from the "withdrawAddress" address, but I'm getting the following error:
transact to MyContract.withdrawFunds errored: VM error: revert. revert The transaction has been reverted to the initial state. Note: The called function should be payable if you send value and the value you send should be less than your current balance. Debug the transaction to get more information.
I'm not setting the withdrawFunds as payable, because I'm not sending that function any funds to handle, the contract already has the funds. My intention is to transfer all the contracts' Ether to an address.
Here is a link to the code
https://github.com/norris-labs/EthText/blob/main/EthText.sol


texts:
I'm new to this and I have a question regarding the following case:

   function transfer(address _from, address _to, uint _amount
 ) internal returns(bool) {
       // Do not allow transfer to 0x0 or the token contract itself
      require((_to != 0) && (_to != address(this)));
 }

Should you also check for _from != _to? To avoid self transfers.
Is that a security risk?


texts: How to find the IPFS address of an NFT on SuperRare?

texts:
The link to an NFT on SuperRare, an Ethereum-based NFT platform, is shown below. How can I find the IPFS address of the .mp4 file and view the video stand-alone?
https://superrare.co/artwork-v2/the-end-23896


texts:
I'm trying to get all events for a contract:

let events = token.allEvents({fromBlock: creationBlock, toBlock: 'latest'}, (err, res) => {
    try {
        let result = events.get();
        console.log(result);
    } catch (error) {
        console.error(error);
    }
});

For some reason, the callback code is called every time an event is found. I could live with that, but if there are no events, the callback is never called. I'm trying to list all events for a contract (not interested in watching for events).

When I try to use it synchronously, events.get() throws an error saying synchronous methods are not supported.


texts: Conceptual Question: What is the point of making an auction decentralized?

texts:
I understand how a blockchain works, I know the pro/cons between a centralized vs decentralized system.
My question is specifically tied to auctions (eg: ascending auctions): what advantages would be gained by making it decentralized via a blockchain?


texts: Call address.transfer() with Gas Limit and Price from another function

texts:
I have a smart contract where user can transfer ETH to an ICO. Like this

function buyICO(paymentAddress, amount) {

// do some other important things

// transfer the amount to the payment address
paymentAddress.transfer(amount);

}

Because some ICOs require a specific gas price and limit, but I can't set these in the transfer function. I can set it when user call buyICO() function but I don't know how do I calculate the gas limit and price for the whole thing.

What's the best practice here?


texts: one wallet address, multiple users, what is the best way to keep the private key secured?

texts:
I would like to develop an application using the web3j. However, it needs to be just one wallet that multiple users will deposit and withdraw from. The allowances are kept in a centralized database. My concern is safety of this approach, since the private key must be kept safe and used only by the wallet application.
I am thinking about creating a separate micro-service and put the read-only restriction to an encrypted file containing the key, while allowing only a certain application to communicate with the wallet.
What do you think would be the best approach ?
Please note that I must use the single wallet and a single secret-key.


texts: Alternative to decentralize exchange on Ethereum?

texts:
Because of the block time lag, The decentralize exchanges built on Ethereum suffers from a Front running problem.

Gnosis works on Dutch exchange concept where orders are executed in Bulk eliminating any party to have advantage over another party in terms of Trade.

My question is, Is there any other strategy better than Dutch Exchange.


texts: Can the blockchain run a billion dollar lottery?

texts:
As many games and other applications, a lottery needs a reliable random number generator. Especially when the prize is high. There are some sophisticated algorithms to achieve this goal, such as Commit-and-Reveal.

These algorithms rely on multiple random sources, which are rewarded for revealing a secret they shared as encrypted in the first place.

As discussed here and here, among other places, these random sources must first commit a certain amount of ether, which they get back in addition to the reward at the end of the process. This deposit serves one major goal: making sure the contributors reveal their secret, as they might refuse to do it to serve their own interest.

To be effective, this deposit must be related with the winning prize of the lottery. For example, if the winning prize is, say, 1 Methers, it does not make any sense for the deposit to be only 1 ether: a contributor would rather lose it if that can help him getting the prize or even a fraction of it.

Unfortunately, this model probably cannot work with very high stake. How could we find random contributors willing and able to block such a high amount of money?

Although economical answers might definitely be interesting, I'm rather looking for technical solutions to reduce the deposit requirement constraint.

PS: I'm not really interested in lottery in particular. Any high stake scenario would be.

PPS: Although this question applies to the blockchain technology in general, one would certainly want to implement such lottery on Ethereum, so posting it here probably makes sense.


texts: Can't start mining on TEST-NET in Ethereum Wallet

texts: Just installed Ethereum Wallet, downloaded blockchain, but can't start mining on TEST-NET. When I click 'Start mining', I get console error. Also I can't start mining from console. See screenshots attachted. How can I start mining?


texts: What are the different space requirements for running an Ethereum node?

texts:
I am trying to run an Ethereum testnet node in the Ropsten testnet and currently trying to figure out, what the requirements are for the disk space needed. While this is (obviously) different for the Ethereum mainnet (and the different testnets), there are also different approaches to run a node with different synchronization methods that will also affect disk usage.
e.g., geth allows different sync-modes, configuring whether the entire chain or only parts of it are to be synchronized (see What is Geth's "light" sync, and why is it so fast?).
Looking through the web, I found several pages with information about required for the main- and testnets, but I cant find any information about how the different sync-modes affect required disk-space. Is there a comprehensive (ideally dynamically updated) list of how much disk space all different networks need - for the individual sync-modes?
Links: Size mainnet https://etherscan.io/chart2/chaindatasizefast


texts: How to access window.BinanceChain object like window.ethereum object on page load

texts:
I am trying to initiate provider from the window.BinanceChain object injected by Binance Wallet chrome extension as I did it with the MetaMask extension before:
let provider = new ethers.providers.Web3Provider(window.ethereum);

But I have noticed that on page load I have initiated window.ethereum object, but undefined window.BinanceChain object:
console.log(window.ethereum)
console.log(window.BinanceChain)

The result is:

What is the proper way to initiate Binance Smart Chain provider on page load?


texts: Does using web3.eth.personal.unlockAccount(..) send the password for the account as plaintext to the provider?

texts:
I have a customchain running on a private server. I am also running a provider using geth, to which I am connecting from the browser using let web3 = new Web3(http://xxxxxx:8545).
My browser client connects to the provider and can issue transactions after they unlock the account using web3.eth.personal.unlockAccount(..., password).
The [web3.js documentation][1] states:

Sending your account password over an unsecured HTTP RPC connection is highly unsecure.

This confused me because I assumed that the browser recieves the keystore json object from the server, does the decryption locally using a password, and uses the unlocked account to sign transactions, which are send to the provider who then in turn would send this transaction to the chain.
The above quote from the documentation makes me think that the password may be sent to the provider and the provider does the signing etc. This obviously is not the case.
So my question is this: "At any point, does the web3.js client send the password to the provider?"
[1]: https://web3js.readthedocs.io/en/v1.2.7/web3-eth-personal.html#unlockaccount


texts: Can I receive ERC20 tokens on my address hosted on Coinbase

texts: I have an account on Coinbase and have an ETH Wallet with them. If someone sends their ERC20 token, will there be any issues receiving it?


texts: How do I find the fees and payout info for mining pools?

texts:
I would like to start mining Etherium. But I just realized that it would probably take me years to find anything with my low hashing power. So I would like to join a pool. Most pools only seem to do payouts when you have more than 0.1 Etherium for example. So basically I would mine for a pool for multiple months until I even know if I can trust it or until I even know that my set up and my wallet works or is configured correctly.
So I would like to get a payout sooner. But I also don't want to pay unreasonably high fees.

So I checked on this website how how much I would mine within 4 days. (around 0.01 ETH)

Then I searched the Internet to find a pool that I'd be comfortable with (payout with ETH >= 0.01 and 1% or less fee), but it is incredibly hard to find the fee and payout info. Either it isn't even mentioned on the pool's homepage (or it's hidden too well?) or it's very unclear/cryptic. E.g. what is that supposed to mean: Autopayouts from 1.01 ETH (from 0.05) six times a day? (from dwarfpool) I don't get it.

So is there an official list of pools and a reliable way to find out what fees they charge and under which circumstances they do a payout?

Am I right that because the blockchain is public, you could look at all the transactions of a pool and thereby calculate this data or at least make educated guesses?

My system

Hashing power: around 18MH/s
Power cost: None. (I pay a flat price for my power so I could probably even get to 20MH/s by overclocking..)
OS: Linux (Ubuntu 16.04)
GPU: GTX 970


texts: How to compile contract when eth.getCompilers() was removed since v.1.6?

texts:
Disclaimer: it is self Q&A post to help others with issue I faced with. Please note this is a possible solution that works for me, there is might be a better way to solve the issue.

The issue:

Can not compile the contract in geth console since 1.6.0
reference to the issue tracker


texts:
I'm running the Mist wallet, and I've deployed this contract to testnet (from https://ethereum.stackexchange.com/a/179/520) :

contract Notary{
    struct Document {
        uint timestamp;
        bytes ipfs_hash;
        address[] signatures;
    }
    mapping(address => bytes[]) public users; //maps addresses to ipfs document hashes
    mapping(bytes32 => Document) public documents; //maps sha3(ipfs) hashes to documents

    function addDocument(bytes ipfs) public {
        users[msg.sender].push(ipfs); //Add document to users's "signed" list
        address[] memory sender;
        sender[0] = msg.sender;
        documents[sha3(ipfs)] = Document(block.timestamp, ipfs, sender);
    }

    function signDocument(bytes ipfs) public {
        users[msg.sender].push(ipfs);
        documents[sha3(ipfs)].signatures.push(msg.sender);
    }

}

When I try to execute the addDocument function though, I get "intrinsic gas too low". What does this mean? Also before confirming execution, it says: "Data can't be executed, so it will use all provided gas."


texts: Call `truffle init` in a not empty folder

texts:
When I am trying to create new truffle project with truffle init in a not empty folder (with IDE folder and .gitignore file) I have received an error:

Error: Something already exists at the destination. Please unbox in an empty folder. Stopping to prevent overwriting data.
    at C:\Users\...\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-box\lib\utils\unbox.js:22:1
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
    at Function.Module.runMain (module.js:686:11)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3

How can I force truffle to create a new project in any case?


texts: Invalid type: sequence, expected a string for key 'rpc.cors'

texts:
Trying to run parity using the configuration file node.toml file

$ parity --config /data/parity/node.toml
Loading config file from /data/parity/node.toml
You might have supplied invalid parameters in config file.
invalid type: sequence, expected a string for key `rpc.cors`


texts:
Can someone help me with a nested struct , i am unable to map the nested struct
my problem statement is i need to get a accept a user details name gender etc and his home address as well in a struct , i tried this didnt get anywhere:-
struct Pdetails {

    string fName;
    string lName
    int256 age;
        enum gender;
    }

struct Addr{

    string line 1;
    string line 2;
    string city;
    string state;
    int256 pincode;
    }


texts: How to pre-compute Gas requirement of a function to avoid metamask error

texts:
How can we pre-compute Gas needed for successful execution of a function inside a smart contract. I got to know about web3.eth.estimateGas but cannot follow it completely from the docs.

My function receives some input parameters, calls Oraclize and then updates data in mappings inside the contract. My understanding is that in order to calculate gas estimate, value of input parameters must be used every time. What is the correct way to calculate gas estimates in this scenario, please help..

   function createProof (string _title, string _ipfshash, string
    _proofremarks, string _prooftags)
    payable public {
    /*** Some Logic ***/
   /// Call Oraclize to get current timestamp
   update();
    }


texts:
I am trying to understand how does https://charts.bogged.finance pull data.
It seems that it fetches historic data from bitquery.io and then somehow pulls transaction data using web3. Can anyone explain how does the latter part work and how I could inspect it?
Specifically, I am curious to understand how I could tap / debug the application.


texts: Unknown account error when running smart contract

texts:
I get the unknown account error when executing smart contract on the main network.
it works well on the local network. On the main network on the other hand when i send funds to the smart contract it goes well but when i call the smart contract i get the "unknown account" error.
Anyone have any ideas why i get that? Thank you


texts: What is the Application Binary Interface (ABI)?

texts:
could someone explain in plain english what Application Binary Interface is used for?
1)What's its purpose and why it should be used in order to make a DApp interface to communicate with the smart contract?Is it like an API that connects the UI with the smart contract?
2)And another question, when the ABI code is generated? Once the smart contract is compiled?


texts: Why does mining continue without pending transactions (e.g. turned on by default with Azure Template)?

texts:
I understand that the miner mines after calling miner.start() until you call miner.stop(). This is already explained here.

However, I want to understand the idea behind this concept of continuous mining even without pending transactions. Why is Ethereum not implemented (or at least configured) to stop mining if there are no pending transactions?
The disadvantage is that "empty blocks" are mined. Besides, an elastic architecture might assign less (cloud resources) if there is no need to mine. This would be interesting especially in cloud infrastructures (e.g. I play around with the Ethereum Azure Consortium Template, which starts mining automatically when you spin up the blockchain infrastructure).

What are the advantages of doing continuous mining? Why did Ethereum implement it this way?

I think especially about private or consortium blockchains and if why it sense here.


texts:
So I'm using truffle and I notice that I seem to be able to deploy a contract's bytecode by calling   deployer.deploy(MyContract);

But I've also seen people run:

myContract = await MyContract.new();

in a unit test without ever calling deployer.deploy().

Is my understanding correct? Do these bits of code do the same thing?

Thanks!


texts: MetaMask returns different error - not longer working

texts:
I am calling the MetaMask promt successfully with this:

ethereum.enable().then(response => {
    console.log("ABC");
}).catch(error => {
    console.log("XYZ")
});

However, when I disagree with the prompt and do not allow the connect request, it returns "ABC" but I should get "XYZ". I also found out, that the code response now is completely different. A few weeks ago my above script worked fine. Only the error does not work. When I accept the connection, everything works fine and it successfully returns "ABC".

I even could get the exact code return, with "error["code"] == "4001"" I made sure that the error was, that the user has cancelled the connect request. Now the error return is no longer the same, for example it was "-32603".

What happened?


texts: Is the burnFrom function in erc20 token contract unsafe?

texts:
We have been issuing a token using a basic erc20 token contract from https://ethereum.org/token
An exchange that we wanted to list our token, asked for a collateral as they see the burnFrom() function could harm token owners.
Why would this function be harmful? You can only use this function when you got allowance from the wallet owner.
Plus, why is this code in the basic erc20 contract on the ethereum.org domain, if it is potentially harmful?

Does anyone has an answer to this question?


texts: What Account is used by Truffle as a Default?

texts:
I have the following outputs -

> eth.getStorageAt(con.address,0)
"0x00000000000000f07044ba718e8eb25850be0e534f9522018784be60043a984d"
> eth.getStorageAt(con.address,1)
"0x00000000000000000000000046fb9a22689c4a4bfb494baeafbb8b2993725305"
> eth.getStorageAt(con.address,2)
"0x0000000000000000000000000000000000000000000000000000000000000000"
> con.buyer()
"0xf07044ba718e8eb25850be0e534f9522018784be"
> eth.coinbase
"0x46fb9a22689c4a4bfb494baeafbb8b2993725305"
> eth.defaultAccount
"0xf07044ba718e8eb25850be0e534f9522018784be"
>

Here is the contract -

pragma solidity ^0.4.18;

contract CollegeAdmin {
uint8 public studentAge=18;
uint16 public studentIncome=15000;
uint8 public studentScore=4;
uint8 public studentAttendance=96;
address public buyer;
address public owner;
event changedAge(uint age);

function CollegeAdmin() public {
owner = msg.sender;
}
function setAge(uint8 age) public {
buyer=msg.sender;
studentAge = age;
changedAge(age);
}

}

I expected the default account to be used and hence owner = defaultAccount which then is shown in slot 1 of the storage. But slot 1 has eth.coinbase. But when I run setAge, I find that the buyer it then set to eth.defaultAccount.

It seems to be truffle deploys under eth.coinbase and then the contract runs under eth.defaultAccount.

I tried changing truffle.js -

module.exports = {
   networks: {
   development: {
   host: "localhost",
   port: 8545,
   network_id: "*",
 gas: 4712388,
 from: "0xf07044ba718e8eb25850be0e534f9522018784be"
 }
}
};

This then gives a network error.

Using network 'development'.

Running migration: 1_initial_migration.js
  Replacing Migrations...
  ... undefined
Error encountered, bailing. Network state unknown. Review successful
transactions manually.

This is I imagine related to eth.coinbase but geth does not let me change that.

Has anyone any ideas?


texts: Problems of connections with we3.providers

texts:
I'm using the web3 API and i'm defining the web3 instance, setting a provider like this:

if (typeof web3 !== 'undefined') {
  web3 = new Web3(web3.currentProvider);
} else {
  // set the provider you want from Web3.providers
  web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
}

But alot of times i have problems with connection, i'm working whit the Ropsten testnet and i'm only using this for test and to learn about Dapps. What is a good alternative for solve this problems of connection? Maybe infura? or exist there some tips to solve it?


texts: Envion token show up as ENV instead of EVN?

texts:
I invested in the Envion ICO today. After the ETH transaction to them was confirmed the tokens showed up in MEW but as "ENV" instead of "EVN". What i found env is something completely different, envions smart contract does state "EVN"

Also, no ENV/EVN show up in ethplorer.io in my wallet (but other tokens do). Is this an issue because the ICO has not ended yet or what can this whole mess be?

Many thanks


texts: How does web3 handle new longest chains?

texts:
I have a Dapp which subscribes to events using web3. I'm wondering how I can detect that the longest chain has changed or rather how I can make sure the events that I've received are canonical. The could should also work correctly for hardforks and with both getPastEvents() and subscribing to new events.

During my research, I've found this question: Is it possible to get duplicates of the log events on Ethereum when we have a fork of the chain?. The answer suggests a status field. There is a status in the receipt but that's only a boolean. Also, there is no status in the results of getPastEvents() - what happens when the fork happens while getPastEvents() receives events?

I'm not sure how web3 makes sure that events are canonical in the current implementation. In tests with Geth, the event became visible in the Dapp after about 10 seconds which suggests that it just takes the latest block into account and doesn't wait for the usual 6 or 12 blocks for the chain to become canonical.


texts:
I have thought of a RPS game using secrether.io:

playerA hashes keccak256(move+11charsRandomData) as hash and sends it to RPS smart contract.
RPS creates a transaction to Secrether Smart Contract - secrether.createSecret(hash,12);
playerA sends the move+11charsRandomData to https://api.secreher.io/secret/create
playerB sends its move to RPS contract.
RPS accepts 2nd move, calls secrether.makePublic(hash), calls provable api to retrieve the data from https://api.secrether.io/secret/getPublic , locates the move at char[0] and acts accordingly to send the eth to the winner.

Is it a secure scheme and do you, guys, have any improvements?
Thanks in advance.


texts: writing tests in solidity for functions returning multiple values

texts:
I have a function that returns multiple values

function getInfo(string id) returns(string x,string y){ bytes32 _id= strToBytes(id);
    return (infostruct[_id].x,infostruct[_id].y) ; }

Now i want to test this function using solidity test in truffle

function testBaseContract(){
 BaseContract basecontract= BaseContract(DeployedAddresses.BaseContract());

        var (x,y) = basecontract.getInfo("1");
        Assert.equal(x,"198/180","this id data is not accessible to you or doesn't exist at all.");
}

i don't know how to access multiple return values in solidity, this was my best guess and I am getting the error

TypeError: Member "equal" is not available in type(library Assert) outside of storage.


texts: Service that can accept an Ethereum private key and then forward funds in the future?

texts:
Is there a smart contract or service that lets me input my Ethereum private key or any crypto private key for that matter and have the smart contract sweep or forward a portion of funds to another address in the future?

Basically its a "Cryptocurrency Smart Forwarding Service" if such a thing even exists.


texts:
I am reading the alarm clock documentation http://docs.ethereum-alarm-clock.com/en/latest/ but there are things I don't understand. I have a dapp where the smart contract has different functions. For example: in the smart contract I have two functions:

booking function
refund function

I want the refund function to be called on a specific date (booking end date) and if there is a refund you have to return the money to the customer, but I don't want the customer to call this function manually at the end of the trip. I add for clarity that my refund function calls a method of another contract. This contract returns the result on a callback on the caller's contract
However, reading the documentation I am having difficulty.

Is TransactionRequest a smart contract that indicates the function I want to call on a specific date (in my case the refund function)? So I have another smart contract?
what is the requestFactory?
is there a scheduling contract?
is the TimeNodes a separate node besides my geth / parity node?

Unfortunately I have no code to show because I am a beginner and I am just trying to build an architecture with all the components, so I want to understand what to insert and if it is possible to execute the refund mechanism with the alarm clock.


texts:
I have a question. My contract structure involves 2 user at address A and B respectively:

First A trigger the logging method from the contract with B's address as parameter. This will record a mapping from B to A's address in the contract state.

Then B trigger the demand method from the contract. This will send a demand to A's address with an amount that B wanted A to pay.
Then A approve or decline the transaction.

I'm having trouble thinking about how to implement this in Solidity.

What data structure should I use to store the mapping from B to A?
Can another pair, C and D, reuse the same contract? If yes, how and will the cost of running the contract increase due to the state mapping?

Also, is there a way to enforce it in the contract such that A must approve and cannot decline the payment?


texts: When creating a new "Coin", which ERCs should one consider checking out?

texts:
When I created a simple coin as a proof concept, I just used ERC20 (Token Standard). Right after creating the contract and showing it to some colleagues, I found out that I should've implemented ERC223 instead, which is a more secure token standard.

What other ERCs should one be aware of when creating new Coins?


texts: Etherscan api: how to get transaction fee?


texts:
Today I got a problem with my 2 cards and I don't know what to do. I have 2 Asus DUAL-RX580-O8G graphic cards. The first one mined ehtereum at 17-18 mh/s, second did it at 16-17 mh/s. I decided to flash bios of these two cards to get to 29 mh/s on both.

I used PolarisBiosEditor and AtiWinFlash. I've done back up of original vbios of only first card because I thought that if both cards were the same model then they should have same bios. Then I patched bios for the first card with bios downloaded from the internet which was already setted for Asus DUAL-RX580-O8G to go on 29 mh/s. But Claymore crashed with this bios so I decided to go back to restore back up I made before. And here thing went quite strange. After I restored old bios for the first card both cards started to mine at 3.5 mh/s. I thought that I did something wrong and decided to restore again. But nothing changed.

Then I thought that probably I made something wrong during back up so I decided to get bios of the second card. But I found out that second card had Hylix as a memory manufacturer and the first one had Samsung. Here I have understood that've done something very wrong. I've tried to mine separately on this cards but they still mined at 3.5 mh/s. I reinstalled driver but it didn't help.

Then I googled for original vbios for Asus DUAL-RX580-O8G and found one for Samsung memory manufacturer. I installed it on both cards (on the second with Hylix memory too) and then they started to mine at 18.5 mh/s each. But this driver is different from that I've back up before all this happend. It has different GPU and Power paramenters.

So can you help me to deal with these questions:
1. Is it OK that I installed bios for Samsung memory on the card that originally had Hylix memory?

Is it normal that two cards of the same model could have different memory manufacturers?
What does GPU table parameters mean? And why such small difference in this table affects so much card performance?
And also why original vbios I made gives such a small hashrate after being reinstalled?

This is the link to all 3 versions of bios I used.

Any help appriciated! Thanks!


texts: Infura Json RPC: how to call a function passing parameters?

texts:
IMPORTANT

My final goal is receive data via api on a php server and use Infura to call my contract to save the data

Test Situation

having this test contract on rinkeby

contract test008 {

    mapping (uint256 => string ) private storedData;

    function set(uint _index, string memory _data_to_store) public {
        storedData[_index] = _data_to_store;
    }

    function get(uint _index) public view returns (string memory) {
        return storedData[_index];
    }
}

What's the right syntax to call

set(100, 'hello world')

??

Using curl, How can I pass the data using the -d option?

curl https://rinkeby.infura.io/v3/<project_id>\
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_call","params": [ { "to":"hex_address_of_my_contact", "data" : " ??????  " }, "latest" ]}

I must specify eth address of contract in the to, right?

I must specify name of function, but how ?

And then I must pass parameters, but ... how ?

From the doc of eth_call function

  data: [optional] Hash of the method signature and encoded parameters. For details see Ethereum Contract ABI

Is this data param the place where specify function name and parameters for the call? If yes.... how ?!

Core question

if all is really about the data param .... ....

Can I generate data hash having function name and parameters? How? Is there any doc about how to do this encoding ?
Better: do you know encoding php library?


texts: In ENS, what does the secret phrase encrypt?

texts: The Ethereum Name Service uses a secret phrase to encrypt the bid. What is encrypted, to later be revealed during the reveal phase?


texts: Contract deployed in private blockchain not returning output

texts:
This is my smart contract:

pragma solidity ^0.4.24;
contract Greet
{
  string message;
  constructor() public{
        message="I'm ready!";
    }
function setgreetings(string _message)public
{
    message=_message;
}
function getgreetings()public view returns(string){
       return message;
 }
}

I deployed my Greetings smart contract to my private network.

  var myABI = [{"...."}]
  var myCont = eth.contract(myABI)
  var myCode = "0x..."
  var txDeploy = {from: 'account_address', data: myCode, gas:210000}

// unlock the account to send the transaction

   var app = myCont.new(txDeploy)

// mined the block
// got the address of the deployed contract
Now using remix to call getgreetings function. It should return "I'm ready".
But it is blank:

Contract works fine when I use JVM.


texts:
Is it possible to replace metamask with a web3.js + geth / parity solution in a dapp? Or do you need the infura service?
What is the difference between using metamask and web3.js + node? Are there any advantages or disadvantages?


texts:
Provider creates a link between me and a node in the mainnet/testnet, right? What will happen if say, one or more nodes of infura for example goes down. My app would still like to use that node but it won't be able to connect, right? Then how does that guarantee high availability which is required in distributed systems, I am still relying on one node that my app connects to using the provider. Or do I understand it completely wrong?

Also in the courses of solidity nobody tells what actually happens when I call web3.eth.contract(....).deploy(...). I mean what does deploy do behind the scenes? It reaches the node then does that node advertise my contract to every miner's mempool? Basically, how do mempools get filled when information is initiated at one place?


texts: Solidity/Web3.js Cannot send value to non-payable constructor

texts:
I have a simple contract that I built a small webapplication with. The contract is as follows:

contract MyContract {
    address public creator;

    function MyContract() {
        creator = msg.sender;
    }

    function reject() {
        selfdestruct(creator);
    }

    function send(address target, uint256 amount) {
        if (!target.send(amount)) throw;
    }
       function destroy(address target) {

        selfdestruct(0x0000000000000000000000000000000000000000);
    }
}

This always worked - I'm using MetaMask to sign the payments and inintiate the contracts. Since a week or something, I'm getting an error in my console from Web3: Cannot send value to non-payable constructor

I then started to Google around, and found out about a function needed to be payable and that there should be a fallback function in my contract. So I customized my contract a bit, this is what I have now:

pragma solidity ^0.4.9;

contract Oursurance {
    address public creator;
    uint x;

    function() payable { x = 1; }

    function Oursurance() payable {
        creator = msg.sender;
    }

    function reject() payable {
        selfdestruct(creator);
    }

    function send(address target, uint256 amount) payable {
        if (!target.send(amount)) throw;
    }

    function destroy(address target) payable {
        selfdestruct(0x0000000000000000000000000000000000000000);
    }
}

I know not every function should be payable, but just to be sure I have added it to everything. Just need it to be working again.

I am still getting this error with the above (edited) contract.


texts: What would be the cost for one to mine one of his own block?

texts:
Smart contract built countermeasures against flash loan attacks. But some of them are just requiring the money to come from an eoa and thus are at risk from peoples who own the funds for themselves.
There are more and more peoples with large amounts of stolen money. I’m meaning peoples ready to steal funds. And indeed, as far I understand (correct me if I’m wrong). Rari Capital was hacked using the stolen money from Value Defi, though it didn’t require what I was thinking.
The result is now many projects are protected from attacks using a large amount of funds within a single transaction but not within a single block.
Of course, there are FlashBot bundles for performing those attacks, but this can’t be considered unsafe because a miner is free to strip transactions from the bundle if is accepting to mine the bundle for free. This means transaction ordering isn’t warranted.
So if an attacker wants to perform an attack using large amounts of funds and several transactions, he has to mine his own blocks.
Currently, we can say that getting the block reward (2 Ethers) through a mining pool roughly costs 2 Ethers of electricity which can be distributed from a share of several blocks.
But being able to select which transactions to include can’t be done through a mining pool. Although this is less requiring than a 50% attack, it requires enough hash power for being able to create a block within the timeframe of a year or even a month.
What would be the cost of mining such blocks in that case? Is it possible to rent such hashpower without proper aml/kyc and if yes, would it be cheaper?


texts: Nonce Too Low, try incrementing nonce | Not able to send TRX

texts:
Can someone tell me how to correct a Nonce Too Low issue?

I'm trying to send an ERC 20 TRX tokens that I have stored on my nano s ETC wallet and I'm not able to due to this low nonce.

FYI I have no idea what this Low Nonce means.  Please help!

Thanks!


texts: Would be possible to hide a function execution with zkSNARKs?

texts:
I read that with an hypothetical integration of zCash/zkSNARK with Ethereum, it would be possible to hide the sender, the receiver and the value of a transaction.

My question is if would also be possible to hide other data sent in a transaction, like the name of the function that you want to execute and the parameters of it. And in that case, how that would affect the state of the contract.


texts: How can I create a solidity function that passes a storage pointer instead of creating a copy?

texts:
The following contract fails (I believe) because when Wordbase.set is called, it creates a new Node in storage, rather than passing the old Node. Thus, the value updates on the copy instead of the original.

How can I get a contract to pass a pointer instead of creating a copy?

contract Wordbase {

  struct Node {
    bytes32 value;
    mapping(bytes32 => Node) nodes;
  }

  mapping(address => Node) realms;

  function getNode(address addr , bytes32[] fields) internal returns (Node) {
    Node node = realms[addr];
    for (uint i = 0; i < fields.length; i ++) {
      node = node.nodes[fields[i]];
    }
    return node;
  }

  function get(address addr, bytes32[] fields) constant returns (bytes32) {
    return getNode(addr, fields).value;
  }

  function get(bytes32[] fields) constant returns (bytes32) {
    return get(msg.sender, fields);
  }

  function set(bytes32[] fields, bytes32 value) {
    getNode(msg.sender, fields).value = value;
  }

}


texts: Multiple receiver addresses for a single private key possible?

texts:
I'm looking at the difference between bitcoin and Ethereum wallets, and I'm confused about this part:
It seems that a bitcoin wallet can have multiple receiver addresses: In my mind this translates to multiple public keys for a single "wallet" private key (which might be an incorrect assumption).
However, in Ethereum it seems there is a strict limit of one address per private key. Since both use secp256k1, I wonder how this different behaviour is implemented.


texts: How to connect to Livepeer to Rinkeby network?

texts:
I want to run livepeer and for that I need it to get connected to an Ethereum network. There are two options as mentioned here:
Hosted API services
Self hosted Ethereum node
If I want to opt for the latter, how would I mention rinkeby?
Because I only want to use it for the test purposes


texts: How does crypto kitties lists their auctions?

texts:
Crypto Kitties offers a marketplace where you can buy kitties. The functionality is handeled by a contract called SaleClockAuction. This contract inherits from ClockAuctionBase where all auctions are stored in a mapping mapping (uint256 => Auction) tokenIdToAuction; The only way to get an auction seems to be the function getAuction(uint256 _tokenId).

If I want a list of all auctions would mean I had to iterate over all kitties and call getAuction(uint256 _tokenId) for each kitty to check if an auction exists.

Question is: Is this really the way to do it or am I missing something here?

https://github.com/dapperlabs/cryptokitties-bounty/tree/master/contracts/Auction


texts:
I have created a smart contract using a factory method pattern as follows:

contract MyContractFactory is Ownable {
    function create(...) onlyOwner public returns (MyContract) {
        return new MyContract(...);
    }
}

However, I have realized that I haven't transfered the ownership of myContract back to the the owner of MyContractFactory. Hence, I currently have no way to call any onlyOwner methods in myContract, even though transitively I'm the owner of myContract. The correct version should have been:

contract MyContractFactory is Ownable {
    function create(...) onlyOwner public returns (MyContract) {
        MyContract myContract = new MyContract(...);
        myContract.transferOwnership(msg.sender);
        return myContract;
    }
}

My question:
Is there a way how can I execute a method that is onlyOwner in an instance of MyContract if I'm the owner only of the MyContractFactory instance (which is the owner of this MyContract instance)? I.e. somehow forward the execution from one smart contract to another?

It probably isn't possibly directly in Solidty, but maybe there is a hope to do it somehow in assembly?


texts:
library ECVerify is deployed on 0x3bbb367afe5075e0461f535d6ed2a640822edb1c on the Ropsten test net.

How do I call function ecverify(bytes32 hash, bytes sig, address signer) returns (bool) {} in that library contract from a contract foo.


texts: Solidity: Is there a good way to initialise a struct in an array?

texts:
I was wondering what is the best practice for initializing a struct which is a member of an Array?

I want to fill my smart contract with some information upon initializing it. That I intend to mainly store in an array, so it is stored in a coherent way when later adding more information.

I am currently doing it in a similar matter as below. It can get a bit messy though and was looking for a better way.

contract ExampleContract {

struct ExampleStruct {
    address owner,
    string text
}

ExampleStruct[] public exampleStructs;

function ExampleContract( address myAddress, string myText ) {
    ExampleStruct memory es;

    es.owner = myAddress;
    es.text = myText;

    exampleStructs.push(es);
}

...

}

Thanks


texts: eth_getLogs Does not not return timestamp

texts:
I want to search all the Transfer Event log, eth_getLogs can do this, But does't return timestamp.
is There a way to get it?


texts: Import dependencies which rely on additional dependencies

texts:
I'm using truffle to create a contract that extends another contract in a GitHub repository e.g.

contract Consumer is Chainlinked {

}

My first problem is that I an unable to import directly from a Github repository as is suggested here https://remix.readthedocs.io/en/latest/tutorial_import.html

import "https://github.com/smartcontractkit/chainlink/solidity/contracts/Chainlink.sol";

results in the error

Error: Could not find https://github.com/smartcontractkit/chainlink/solidity/contracts/Chainlink.sol from any sources; imported from /home/software/ib/oracle/contracts/Consumer.sol

So I've copied the file locally. My second problem is that the imported files import a number of other files such as

import "solidity-cborutils/contracts/CBOR.sol";

These don't resolve locally, so I get an error during compile. Now I could copy all dependencies locally as well, but this seems horribly ineffecient and error prone.

Is there a better way of doing this?


texts:
I am learning solidity NFT, I am trying to generate v, r ,s using python web3
require(owner() == ecrecover(keccak256(abi.encodePacked(this, tokenId)), v, r, s), "owner should sign tokenId");

My python script
from web3.auto import w3
from eth_account.messages import encode_defunct

msg = "contractaddrsstokenid"
private_key = "mywalletprivatekey"
message = encode_defunct(text=msg)
signed_message =  w3.eth.account.sign_message(message, private_key=private_key)
print(signed_message)

it returns v, s, r and signature. But values are supported in contract, it says invalid format. i have changed to base64 and use. It fails with "owner should sign tokenId". How can i create v,s,r using python web3.


texts: Is it possible to return a table of values in solidity?

texts:
I am writing a code to return multiple values from two arrays simultaneously. I understand since I mentioned only one uint and one address as arguments in returns, the for loop is throwing an error. What can I do to be able to return multiple values from both the arrays? Following is my code snippet:
function listBest() public view returns(uint, address){
    for(uint p = 0; p < number; p++) {
        return(listScores, listScoredPeople[p]);
    }
}


texts:
I am trying to log length of an array inside a struct.

struct Student{
    bytes32 PatietRecordHash;
    bool isExists;
    bytes32[] ReportIpfsHash;
}
event LogStudentReportLength(uint noOfReports);
function addStudentReport(bytes32 _StudentId,bytes32 _ReportIpfsHash)public returns(bool){
    require(msg.sender == systemAdmin);

   emit LogStudentReportLength(Students[_StudentId].ReportIpfsHash.push(_ReportIpfsHash));
   uint length= getNoOfLabReports(_StudentId);
   Students[_StudentId].ReportIpfsHash[length-1]=_ReportIpfsHash;
   emit LogNewStudentLabReport(true,_ReportIpfsHash,patients[_patientId].ReportIpfsHash.length);
   return true;
}

I am getting result as following in the browser console.

Object { s: 1, e: 0, c: (1) […] }

However I am expecting a length of array.


texts:
I am getting a wired exception ConectionException on the server my node is connected to.

java.net.ConnectException: Connection refused: /my_local_ip:52062
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:224)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:289)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:528)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:110)
at java.lang.Thread.run(Thread.java:745)

any help


texts: How to define miners ACL on a private chain

texts:
is there a way to manage "allowed" miners in ethereum private chain ?

the idea is to have some sort of access control list of miner addresses which are allowed to seal a block.

in case the above is not possible, maybe there is any way to disable solo mining and allow only pool mining instead ?

how would one approach such scenario ?


texts: Can a contract send back part of the ETH received based on the actual exchange rate USD/ETH at the time of the transaction?

texts: Let's say on a payment I charge a 5% fee to cover the fluctuation of the market. Is it possible to send back the overcharge or part of it if at the time of the execution of the transaction the actual exchange rate ETH/USD was lower and part of that fee or all of it wasn't necessary?


texts: How to get events from transaction receipt in web3JS ( Solidity )

texts:
I have tried using events.eventname.returnValues[index] but I am not getting any response. Below is the smart contract code -

pragma solidity 0.5.12;

contract Dflip{

    uint contractBalance;
    address public owner;

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

    modifier costs (uint cost){
        require(msg.value >= cost,"The minimum value to place bet is 0.01 ether");
        _;
    }

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

    event flipCoinData(uint betValue,bool result);
    event withdrawFundData(uint amount);
    event fundContractData(address funder,uint fundAmount);

function flipCoin() public payable costs(0.1 ether) returns(bool)  {
    require(msg.value <= contractBalance,"The contract doesn't have enough balance");
  bool result;
  uint chance;
  chance = now % 2;
  if (chance == 0){
      contractBalance += msg.value;
    result = false;
  }
  else if ( chance == 1){
      contractBalance -= msg.value;
      msg.sender.transfer(msg.value*2);
    result = true;
  }
  return result;
  emit flipCoinData(msg.value,result);
}

function getContractBalance() public view returns(uint){
    return address(this).balance;
}
function withdrawAll() public onlyOwner {
    emit withdrawFundData(contractBalance);
    msg.sender.transfer(contractBalance);

}
function fundContract() public payable {
    require(msg.value != 0);
    contractBalance += msg.value;
    emit fundContractData(msg.sender,msg.value);
}
}

And this is the mainJS file to connect with web3JS
var web3 = new Web3(Web3.givenProvider);
var contractInstance;

$(document).ready(function(){
  window.ethereum.enable().then(function(accounts){
    contractInstance = new web3.eth.Contract(abi,"0x28811FA3bC95f2776918871BAb6332662f15cd43",{from:accounts[0]})
    console.log(contractInstance);
  })

  $("#flip_button").click(inputData);
  $("#get_data_button").click(contractBalance);
  $("#fund_contract_button").click(fundContract);
  $("#withdraw_fund_button").click(withdrawFund);

})

// extra function starts here

function withdrawFund(){
  contractInstance.methods.withdrawAll().send();
}

function fundContract(){
  var fundAmount = $("#fund_contract_value").val();
  var config = {
    value: web3.utils.toWei(fundAmount,"ether")
  }
  contractInstance.methods.fundContract().send(config)
  .on("transactionHash", function(hash){
    console.log(hash);
  })
  .on("confirmation", function(confirmationNr){
    console.log(confirmationNr);
  })
  .on("receipt", function(receipt){
    console.log(receipt);
  })
}

function inputData(){
  var betAmount = $("#bet_input").val();
  var config = {
    value: web3.utils.toWei(betAmount,"ether")
  }
  contractInstance.methods.flipCoin().send(config)
  .on("transactionHash", function(hash){
    console.log(hash);
  })
  .on("confirmation", function(confirmationNr){
    console.log(confirmationNr);
  })
  .on("receipt", function(receipt){
    console.log(receipt);
if(receipt.events.flipCoinData.returnValues[1] === false){
alert("You have lost");
}

  })
}

function contractBalance(){

  contractInstance.methods.getContractBalance().call().then(function(res){
    $("#jackpot_output").text(web3.utils.fromWei(res) + " Ether");
  })
}


texts:
I'm trying to store the following string in a contract

5030480389847504049639477069961901518251822532055915812015454717740961852942027334498786032153069913846973579859702642411497486328669598344496363306620763652362226170692287240855050713537819594000868803228735504934019483458523068727831434237837325563417285328158635879852481735301070609988900677951635437637299660610442447448957534545817

Its size is 337 bytes.

The relevant contract code is

contract User {
    bytes32 publicKey;

    function setPublicKey(bytes32 _publicKey)
        onlyOwner
    {
        publicKey = _publicKey;
    }

    function getPublicKey() returns (bytes32 _publicKey) {
        return publicKey;
    }

}

When I call getPublicKey() after setting it already, using (again only showing the relevant part)

contract.getPublicKey.call((err, res) => {
        if (err) {
            console.log(err);
        } else {
            const k = web3.toAscii(res);
            console.log(k);
        }
    })
}

I just get back 50304803898475040496394770699619, which is the beginning of the string/key. I figure this to be related to exceeding the bytes32 size, but what's the recommended way to get around this?

Also, I should mention I don't want to store this offchain. And also, I'm aware that gas costs to store large data in the blockchain are high but (1) I figure this would still be within an acceptable size and (2) it's a private chain for testing so I am not too concerned with that, for now.


texts: Contract - Demo - Identifier - Only 3 Lines for my contract to work - ¿does somebody know how to fix this?

texts:
pragma solidity ^0.4.23;

contract Owned {

    address owner;

    function owned() public {
        owner = msg.sender;
    }

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

}

contract Edureka is Owned {

    struct Instructor {

        uint age;
        bytes name;
        bytes subject;

    }

    mapping (address => Instructor) instructors;
    address[] public instructorAccts;

    event instructorInfo (

        bytes name,
        bytes subject,
        uint age

        );

    function setInstructor(address _address, uint _age, bytes _subject, bytes _name) {

        **var instructor =instructors[_address];**

        instructor.subject = _subject;
        instructor.name = _name;
        instructor.age = _age;
    }

    function getInstructor()view public returns(address[]){

        return instructorAccts;
    }

    function getInstructor(address _address)view public returns(uint, bytes, bytes) {

        **return(instructors[_address].subject, instructors[_address].name, instructors[_address].age)**

    ;
    }

    function countInstructurs() view public returns(uint){

        **return instructors.length;**
    }

}


texts: How State variable are stored and updated?

texts:
The Smart contract and the state variables are stored in the blockchain, let us say  during deployment of a smart contract the state variable and smart contracts are stored in the block 1, and in future the state variables are changed by a some transaction, will the variable in the block 1 gets changed ? (If so it will disapprove immutability of the blockchain), or will it create a new block with new state variables and code, then it will be a kind of versioning of smart contracts but it is obvious it is not true.

How does the variable is stored in the blockchain?
What happens when a state variable is changed ?, is changes made to the block where the smart contract is first deployed or new block is created with a smart contract with new value  ? or new block is created which just has the transaction history(ie. Value of A changed to 10), if then can I get an Transaction History?
What information is present in the transaction, when an request to change the variable state is place ( only the variable change or the whole smart contract with new values)


texts: Pending transactions Geth private Blockchain

texts:
I have an ethereum consortium blockchain based on Azure (Geth 1.7.3). I've been experimenting with an application which has a very simple smart contract.
The contracts itself, stores data that comes from the Javascript console (it's basically a mapping that maps to a structure of several strings).

I launch the ContractInstance.function.sendTransaction (x,y,z, {from: eth.accounts[0], gas:2000000, gasPrice: web3.toWei(1140, "gwei")});) but when I check the txpool I see some other transactions there that are not associated with these contracts. These ones are not red marked.

Does anyone else knows why this happens? I can only fix the problem cleaning the transactions.rlp file and launch the transactions again. But after some transactions I get the same problem.

Is this related to Geth version? I increased the gas Price tremendously but even with this stay the same problem.

Hope someone can help.
Thanks


texts: How to connect Mist to a remote private network?

texts:
I have seen option to connect Mist to a privatenet here like this

geth --networkid 1234 --ipcpath /Users/you/Library/Ethereum/geth.ipc

Looks like the path is hardcoded somewhere in the code.

How can I connect Mist to a private network which is remote?


texts: How to get quantity of token that an ERC20 Token has raised?

texts:
I'm looking to get the value raised by different ERC20 tokens (https://icodrops.com/) this site shows the amount raised. How can I get this data through an API?

I tried using Etherscan.io and Ethplorer.io but it seems to provide no data like this specifically and I can get logs data which will have to be summed up. Is there any other way?


texts: Why is Smart Contract call() method returning NULL in Ethereum Private Blockchain

texts:
This is where I am calling the contract

function certify_find (hash, callback) {
   contract.methods.findDocHash(hash).call( function (error, result) {
   if (error) {
    console.log("Returned ERROR from findDocHash");
    callback(error, null);
  }else {
    let resultObj = {
      mineTime:  new Date(result[0] * 1000),
      blockNumber: result[1],
      instituteName: result[2],
      recipientName: result[3],
      courseName: result[4],
      marks: result[5],
      dateOfCompletion: result[6]
    }
    callback(null, resultObj);
   }
 });
};

Publishing into the blockchain is working perfectly. Only this is not working. This is my genesis.json file

{
    "config": {
      "chainId": 143,
      "homesteadBlock": 0,
      "eip150Block": 0,
      "eip155Block": 0,
      "eip158Block": 0
    },
    "alloc": {},
    "difficulty" : "0x20000",
    "gasLimit"   : "0x8880000"
}

Please help me!!


texts: Browser tab keeps on reloading on account change

texts:
My browser tab keeps on reloading on account change from metamask for at least 15-20 times.
async connectWallet() {
      const { ethereum } = window
      if (!ethereum) {
        this.ui.showError = true
      } else {
        this.ui.showError = false
        try {
          const address = await ethereum.request({
            method: 'eth_requestAccounts',
          })
          this.$store.commit('SET_ADDRESS', address[0])
        } catch (error) {
          console.log(error)
        }
      }
    },

Can we stop metamask's default behaviour of reloading the browser tab when an account is changed?


texts: Cannot compare 2 addresses in solidity code

texts:
Why do the results differ in the following:

truffle(development)> l.ownerOf(t) == l.ownerOf(t)
false
truffle(development)> l.ownerOf(t) != l.ownerOf(t)
true

Another version:

truffle(development)> var l1 = l.ownerOf(t)
undefined
truffle(development)> l1
'0xf17f52151ebef6c7334fad080c5704d77216b732'
truffle(development)> l1==l1
true
truffle(development)> var l2 = l.ownerOf(t)
undefined
truffle(development)> l1==l2
false
truffle(development)> l2
'0xf17f52151ebef6c7334fad080c5704d77216b732'

I can't seem to compare two identical addresses from a view function with the same parameters.


texts: Why aren't Solidity sha3 hashes not matching what other sha3 libraries produce?

texts: Solidity has a function named sha3 and I tested it with an empty string input.  It is not matching what other sha3 libraries produce.  I see  contracts written by others using the same sha3 function in Solidity, and their hashes also do not match.  The same goes for Javascript web3.sha3 hashes.  Why?


texts: I bought ether in the presale. Is there a time limit to claim that ether?

texts: There is no mention in the documentation about whether I have to claim ether before a particular date. Is there a time-limit on claiming ether? I've also heard that the mining algorithm will change at some point. Are my ether safe in the presale wallet, or do they have to be moved?


texts:
I am trying to load web3 library after installing it via command prompt. However, looks like it is not loading properly as it is not showing all the details for Ethereum ecosystem (ex. unitmap of various ether units).

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

C:\WINDOWS\system32>node -v
v10.6.0

C:\WINDOWS\system32>npm -v
6.1.0

C:\WINDOWS\system32>node

  var Web3 = require('web3');
  undefined

  Web3
  { [Function: Web3]
    providers:
     { HttpProvider: [Function: HttpProvider],
       IpcProvider: [Function: IpcProvider] } }

  var url = "https://mainnet.infura.io/pK8qXfQRfbImxGXdDPfC"
  undefined

  var web3 = new Web3(url)
  undefined

  var address = '0x281055Afc982d96fAB65b3a49cAc8b878184Cb16'
  undefined

  web3.eth.getBalance(address, (err, bal) => {balance = bal})

  TypeError: this.provider.sendAsync is not a function
      at RequestManager.sendAsync (C:\WINDOWS\system32\node_modules\web3\lib\web3\requestmanager.js:80:19)
      at Eth.send [as getBalance] (C:\WINDOWS\system32\node_modules\web3\lib\web3\method.js:141:42)

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

First, I downloaded web3 via following command, after that I tried to load the library:

============================================================================
C:\WINDOWS\system32> npm install ethereum/web3.js --save
npm WARN system32@1.0.0 No description

npm WARN system32@1.0.0 No repository field.

Is it happening because I haven't specified a repository while doing "npm init" command?

If it is helpful, I have provided the response as well for "npm init" command.

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

C:\WINDOWS\system32>npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (system32)
version: (1.0.0)
description:
git repository:
keywords:
author:
license: (ISC)
About to write to C:\WINDOWS\system32\package.json:

{
  "name": "system32",
  "version": "1.0.0",
  "main": "index.js",
  "dependencies": {
    "ganache-cli": "^6.1.5",
    "web3": "github:ethereum/web3.js"
  },
  "devDependencies": {
    "mocha": "^5.2.0"
  },
  "scripts": {
    "test": "mocha"
  },
  "author": "",
  "license": "ISC",
  "description": ""
}

Is this OK? (yes) yes

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

Any advice would be appreciated. Thanks in advance.


texts: Why did Ethereum not start with Proof of Stake?

texts:
I had been reading up on Proof of Stake and the advantages and disadvantages. As if I am correctly informed, it is planned to change from PoW to PoS in the near future, using Casper. I had also been reading on why they would do so Why Does ethereum plan to move to proof of stake

I am actually wondering, why they did not created Ethereum right away on proof of stake, as nextcoin. Anyone any ideas?


texts: Metamask mapping calls receive inconsistent return

texts:
Below is my js function that takes an array of orderId and call them one by one - to get the creator address and go on.

It is chained in a series of promises with similar Ethereum smart contract mapping/event calls and they are working fine on Ropsten testnet.
However, when we finally moved to Mainnet and test, the return of this specific function is unstable, as return of some orderIds are 0x while others are fine. Same thing happened to calls with creation times, which gave me 0x for epoch time.

    const getCreators = function() {
      const promises = [0, 1, 2, 3, 4]
        .map(orderId => new Promise(function(resolve, reject) {
          instance.getCreatorAddressById(
            creatorId, function(err, info) {
              if (err) {
                console.error('get creator err', err)
                reject(err)
              }
              resolve(info)

            }
          )
        }))
      Promise.all(promises)
        .then(
          function(promiseResults) {
            console.log(promiseResults)
            // Prints:
            // 0x45f117954adab4528b385625c72a5e558e2f78c3
            // 0x
            // 0x
            // 0x29d7d1dd5b6f9c864d9db560d72a247c178ae86b
            // 0x6ac54dd5c03519cfb943c4a6e2b1cbfc65465236
          })
    }

Any help would really appreciated and I will keep updating it if any progress made.


texts:
How to deploy a smart contract on my own blokchain network?
I have created using python and running on postman client server interface.
I have already tested on ganache , solidity IDE and ethfiddle.


texts: Why does the Rinkeby testnet stats page show hashpower when it uses PoA?

texts: The Rinkeby testnet reportedly runs on the Clique Proof of Authority consensus engine, yet https://www.rinkeby.io/#stats is reporting a hashrate and difficulty. What is the meaning of this?


texts: Measuring the efficiency/performance of a smart contract presented as an algorithm

texts:
I am trying to theoretically analyze the expected performance of a smart contract presented in the form of an algorithm which consists of multiple functions.

What is the best way to measure the performance of the functions within?

Some suggest that measuring the amount of Gas is the best solution. However, measuring the gas cost is dependent on the code and would require the actual implementation of the smart contract. Some developer may implement the contract in ways better than others. Therefore, this may not be too accurate.

On the other hand, others suggest presenting the computational complexity in terms of the Big O notation. However, Big O notation is usually used for complex programs that might require a lot of time

What would be the better method and why?


texts: How to run geth for ropsten and mainnet in a same server?

texts:
Is it possible to run geth for ropsten and mainnet in a same server if I changed all the port for Ropsten node trying not to conflict the ports used in mainnet?
For example, geth --rpcport 8546 --port 30301 --testnet (for Ropsten) and geth (for mainnet)?
Thank you.


texts:
I want to just simply kill this contract what code do i type into the get console to kill this contract so that the funds are returned to the owner which is me. Please let me know how you did it so I can apply the geth command code to kill my other contracts as well.

contract address: 0x999d5f024439A0EcfD554753e9E4A9eDa9261B73

JSON:

  [ { "constant": false, "inputs": [], "name": "checkGoalReached",
  "outputs": [], "payable": false, "type": "function" }, { "constant":
  true, "inputs": [], "name": "deadline", "outputs": [ { "name": "",
  "type": "uint256", "value": "1496312040" } ], "payable": false,
  "type": "function" }, { "constant": true, "inputs": [], "name":
  "beneficiary", "outputs": [ { "name": "", "type": "address", "value":
  "0x64c0118a896bb075448a7f0cd6e760a41cff800c" } ], "payable": false,
  "type": "function" }, { "constant": true, "inputs": [], "name":
  "tokenReward", "outputs": [ { "name": "", "type": "address", "value":
  "0x64c0118a896bb075448a7f0cd6e760a41cff800c" } ], "payable": false,
  "type": "function" }, { "constant": true, "inputs": [ { "name": "",
  "type": "address" } ], "name": "balanceOf", "outputs": [ { "name": "",
  "type": "uint256", "value": "0" } ], "payable": false, "type":
  "function" }, { "constant": true, "inputs": [], "name": "fundingGoal",
  "outputs": [ { "name": "", "type": "uint256", "value": "1e+22" } ],
  "payable": false, "type": "function" }, { "constant": true, "inputs":
  [], "name": "amountRaised", "outputs": [ { "name": "", "type":
  "uint256", "value": "200000000000000000" } ], "payable": false,
  "type": "function" }, { "constant": true, "inputs": [], "name":
  "price", "outputs": [ { "name": "", "type": "uint256", "value":
  "1e+21" } ], "payable": false, "type": "function" }, { "constant":
  false, "inputs": [], "name": "safeWithdrawal", "outputs": [],
  "payable": false, "type": "function" }, { "inputs": [ { "name":
  "ifSuccessfulSendTo", "type": "address", "index": 0, "typeShort":
  "address", "bits": "", "displayName": "if Successful Send To",
  "template": "elements_input_address" }, { "name":
  "fundingGoalInEthers", "type": "uint256", "index": 1, "typeShort":
  "uint", "bits": "256", "displayName": "funding Goal In Ethers",
  "template": "elements_input_uint" }, { "name": "durationInMinutes",
  "type": "uint256", "index": 2, "typeShort": "uint", "bits": "256",
  "displayName": "duration In Minutes", "template":
  "elements_input_uint" }, { "name": "etherCostOfEachToken", "type":
  "uint256", "index": 3, "typeShort": "uint", "bits": "256",
  "displayName": "ether Cost Of Each Token", "template":
  "elements_input_uint" }, { "name": "addressOfTokenUsedAsReward",
  "type": "address", "index": 4, "typeShort": "address", "bits": "",
  "displayName": "address Of Token Used As Reward", "template":
  "elements_input_address" } ], "payable": false, "type": "constructor"
  }, { "payable": true, "type": "fallback" }, { "anonymous": false,
  "inputs": [ { "indexed": false, "name": "beneficiary", "type":
  "address" }, { "indexed": false, "name": "amountRaised", "type":
  "uint256" } ], "name": "GoalReached", "type": "event" }, {
  "anonymous": false, "inputs": [ { "indexed": false, "name": "backer",
  "type": "address" }, { "indexed": false, "name": "amount", "type":
  "uint256" }, { "indexed": false, "name": "isContribution", "type":
  "bool" } ], "name": "FundTransfer", "type": "event" } ]


texts:
i am trying to set up a local PoA network following this tutorial:

https://hackernoon.com/setup-your-own-private-proof-of-authority-ethereum-network-with-geth-9a0a3750cda8

I am using Windows 10. The issue is that i dont get back an enode address using the following commands:

bootnode -genkey boot.key

bootnode -nodekey boot.key -verbosity 9 -addr :30310
INFO [11-20|18:06:05.376] New local node record   seq=1 id=14a0c68dfe9d6ca2 ip=<nil> udp=0 tcp=0

Any hints?


texts: Cannot access geth and the browser returns {"jsonrpc":"2.0","error":{"code":-32600,"message":"EOF"}}

texts:
When I try to start my geth node, I use the command as below:

geth --identity "MyEtherum" --rpc --rpccorsdomain "*" --datadir "D:\Geth\chain" --port "30303" --rpcapi "db,eth,net,web3" -- networkid 95518 console --dev

Then it stopped at this place

I checked localhost:8545, it returns as below:

{"jsonrpc":"2.0","error":{"code":-32600,"message":"EOF"}}


texts: how long does a transfer from gdax to etherdelta take?

texts: My question is about how long do I have to wait to get my transfer of ether from gdax to my ether-delta wallet?


texts: About a concept about blockchain during learning

texts:
Like a example blockchain has one core block in its Ledger/chain. Every time who used (new or old user) blockchain from his node that will clone all chain/all blocks , means one core block (because there will be decentralised storage instead of centralised storage) .But if  a block contain 1 mb storage info then it will be consumed 1 core mb storage in Laptop or PC ( node).

My Question is what will be for Laptop storage?


texts: Struct is not saved in mapping for some unknown reason

texts:
I don't understand why my struct is not saved in mapping. I've tried diffrerent methods of initializing struct I found all over the web and it didn't work on development network (ganache + truffle). What do I wrong?
Original source of the whole project available here: https://github.com/panwaclaw/bxftoken.
Here I leave only part of code with AccountData struct and createAccount() method.
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.5;

import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";

contract AccountStorage is AccessControl {

    using EnumerableSet for EnumerableSet.AddressSet;
    using SafeMath for uint256;

    struct AccountData {
        address sponsor;
        uint256 balance;
        uint256 selfBuy;
        uint rank;
        uint256 turnover;
        uint256 maxChildTurnover;
        uint256 directBonus;
        uint256 indirectBonus;
        uint256 founderBonus;
        uint256 cryptoRewardBonus;
        uint256 reinvestedAmount;
        uint256 withdrawnAmount;
        int256 distributionBonus;
    }

    EnumerableSet.AddressSet private _accounts;
    mapping (address => AccountData) private _accountsData;

    event AccountCreation(address indexed account, address indexed sponsor);

    constructor() {
        address contractAddress = address(this);
        _accountsData[contractAddress].sponsor = address(0);
        _accountsData[contractAddress].balance = 0;
        _accountsData[contractAddress].rank = 0;
        _accountsData[contractAddress].selfBuy = 0;
        _accountsData[contractAddress].turnover = 0;
        _accountsData[contractAddress].maxChildTurnover = 0;
        _accountsData[contractAddress].directBonus = 0;
        _accountsData[contractAddress].indirectBonus = 0;
        _accountsData[contractAddress].founderBonus = 0;
        _accountsData[contractAddress].cryptoRewardBonus = 0;
        _accountsData[contractAddress].distributionBonus = 0;
        _accountsData[contractAddress].reinvestedAmount = 0;
        _accountsData[contractAddress].withdrawnAmount = 0;
    }

    function createAccount(address sponsor) public returns(bool) {
        address account = msg.sender;

        if (sponsor == address(0)) {
            sponsor = address(this);
        }
        if (sponsor != address(this)) {
            require(_accounts.contains(sponsor), "AccountStorage: there's no such sponsor, consider joining with existing sponsor account or contract itself");
        }
        if (!hasAccount(account)) {
            _accountsData[account].sponsor = sponsor;
            _accountsData[account].balance = 0;
            _accountsData[account].rank = 0;
            _accountsData[account].selfBuy = 0;
            _accountsData[account].turnover = 0;
            _accountsData[account].maxChildTurnover = 0;
            _accountsData[account].directBonus = 0;
            _accountsData[account].indirectBonus = 0;
            _accountsData[account].founderBonus = 0;
            _accountsData[account].cryptoRewardBonus = 0;
            _accountsData[account].distributionBonus = 0;
            _accountsData[account].reinvestedAmount = 0;
            _accountsData[account].withdrawnAmount = 0;

            _accounts.add(account);

            emit AccountCreation(account, sponsor);
            return true;
        }
        return false;
    }

    function hasAccount(address account) public view returns(bool) {
        return _accounts.contains(account);
    }

}


texts:
I have an auction contract, where bidders bid with Ether then me (owner) select which offer is most suitable and thus this bidder is contract winner.

Once the winner is selected, I send him data as a reward. This data is sent off-chain.

Trying to think of a way to add privacy to my system, in terms of keeping bidders identity anonymous or the identity of the winner?

Is it possible that once contract is closed, when bidders withdraw their funds that amount is not kept public as well?


texts: Get transaction id after contract function call

texts:
I'm using truffle.

How can I get transaction id before it is mined? For example:

contract.purchase(price).then(function(tx) {
    console.log("Success");

}).catch(function(e){
    console.log(e);
});

In that case I only get the tx after the transaction is mined. But I want to have the ability to print the transaction id as soon as it has been created.

I tried using callback function, like:

contract.purchase(price, function(error, tx) {
if(error != null)
    return;
console.log(tx);
})

but I get error "invalid address"

I have tried using web3.eth.filter('pending') and web3.eth.filter('latest') but I only get the id after it is mined. I'm testing it in TestRpc.


texts: Geth vs Parity Transaction propagation (1 / sqrt(n))

texts: Is there a reason that geth propagates new txs to all peers but parity only propagates txs to 1/sqrt(n) (on average) peers? I see a comment in geth to the effect of //FIXME include this again: peers = peers[:int(math.Sqrt(float64(len(peers))))] (https://github.com/ethereum/go-ethereum/commit/8fe01b4bfa28ad5a1fdde7f9837e8f982843389a) but it seems that that was put in 3 years ago


texts: Geth Version: 1.9.12-stable keeps getting killed...Out of memory: Kill process (geth) score 901 or sacrifice child

texts:
I am experiencing issues with my Geth (Version: 1.9.12-stable) nodes. Very often Geth exhausts all memory, which causes a sudden drop in blocks, resulting in the node falling behind. I am running Ubuntu 16.04.6 LTS with CPU-Optimized / 16 GB RAM / 8 vCPUs

The behavior I'm seeing is that Geth starts eating up all the RAM, gets killed off, and is automatically restarted as per my systemd flags. During this process, a bunch of the blocks that were previously in memory get trashed, resulting in my node falling behind.

error message:

[1134203.601725] Out of memory: Kill process 8605 (geth) score 901 or sacrifice child
[1134203.603676] Killed process 8605 (geth) total-vm:10724244kB, anon-rss:7352756kB, file-rss:0kB

/etc/systemd/system/geth.service:

[Unit]
Description=geth

[Service]

ExecStart=/usr/bin/geth --rpcapi eth,web3,debug,txpool,net,shh,db,admin,debug --rpc --ws --wsapi eth,web3,debug,txpool,net,shh,db,admin,debug  --wsorigins localhost --gcmode full --rpcport=8547 --maxpeers 250

User=geth
Restart=always
LimitNOFILE=1048576

[Install]
WantedBy=multi-user.target

Would tweaking the --cache flag help with this issue? In the meanwhile, I have a simple bash script in place which checks for current memory usage and restarts Geth via systemd if the memory usage exceeds 80%. That seems to help.

Thanks in advance!


texts: what is the percent of smart contract usage?

texts:
Does anyone has statistics of how much transactions are doing pure Ether transfer, versus the transactions that execute some contract?

The idea is to find out how much smart contract transactions are executed in reality. To answer a question of this nature: Is Ether is used more as a currency or is it mostly used by smart contracts?

Also , what is the current ratio of external accounts (human) vs internal(contract)?


texts: geth attach issue between mac and windows

texts:
I am running geth on windows machine and try for geth attach in mac. I give
below error:

Fatal: Failed to start the JavaScript console: api modules: Post http://192.168.0.107:8545: context deadline exceeded

Both machine in local network i.e sharing same network.

But when i running geth on mac and try for geth attach in windows it works.
Please give your input regards this issue.


texts: How do I monitor 50k addresses for incoming ERC20 transactions?

texts:
I have a list of 50.000 Ethereum addresses which at any time may receive ERC20 transfers.

I know I can create filters but I don't think it scales to send 50.000 RPC calls to an Ethereum node every 20 seconds. Is the solution to ask the Ethereum node for all Transfer events and then filter the events in RAM?

I am using Parity and NEthereum (a C# library).


texts: I need to create a sample DApp from scratch within a private blockchain using Geth. Can anyone post links of sample apps which have been made in such a way for reference.


texts: Ethereum Wallet is "looking for peers" with geth --light

texts:
It should be possible to combine Ethereum Wallet and/or Mist Browser together with geth --light

Unfortunately Ethereum Wallet is "looking for peers" for eternity then, even if the log shows no problem:

What is wrong?

$ ./Ethereum\ Wallet
[2016-11-25 13:23:23.730] [INFO] main - Running in production mode: true
Secp256k1 bindings are not compiled. Pure JS implementation will be used.
[2016-11-25 13:23:24.044] [INFO] main - Starting in Wallet mode
[2016-11-25 13:23:24.190] [INFO] Db - Loading db: /home/roland/.config/Ethereum Wallet/mist.lokidb
[2016-11-25 13:23:24.213] [INFO] Windows - Creating commonly-used windows
[2016-11-25 13:23:24.216] [INFO] Windows - Create secondary window: loading, owner: notset
[2016-11-25 13:23:24.272] [INFO] updateChecker - Check for update...
[2016-11-25 13:23:28.168] [INFO] Windows - Create primary window: main, owner: notset
[2016-11-25 13:23:28.197] [INFO] Windows - Create primary window: splash, owner: notset
[2016-11-25 13:23:29.159] [INFO] ipcCommunicator - Backend language set to:  en-US
[2016-11-25 13:23:31.442] [INFO] (ui: splash) - Web3 already initialized, re-using provider.
[2016-11-25 13:23:31.918] [INFO] ClientBinaryManager - Initializing...
[2016-11-25 13:23:31.919] [INFO] ClientBinaryManager - Resolving path to Eth client binary ...
[2016-11-25 13:23:31.922] [INFO] ClientBinaryManager - Eth client binary path: /home/roland/programs/mist/nodes/eth/linux-x64/eth
[2016-11-25 13:23:32.085] [INFO] updateChecker - App is up-to-date.
[2016-11-25 13:23:32.467] [INFO] ClientBinaryManager - Initializing...
[2016-11-25 13:23:32.467] [INFO] ClientBinaryManager - Resolving platform...
[2016-11-25 13:23:32.470] [INFO] ClientBinaryManager - Calculating possible clients...
[2016-11-25 13:23:32.478] [INFO] ClientBinaryManager - 1 possible clients.
[2016-11-25 13:23:32.480] [INFO] ClientBinaryManager - Verifying status of all 1 possible clients...
[2016-11-25 13:23:32.488] [INFO] ClientBinaryManager - Verify Geth status ...
[2016-11-25 13:23:32.524] [INFO] ClientBinaryManager - Checking for Geth sanity check ...
[2016-11-25 13:23:32.526] [INFO] ClientBinaryManager - Checking sanity for Geth ...
[2016-11-25 13:23:32.830] [INFO] Sockets/node-ipc - Connect to {"path":"/home/roland/.ethereum/geth.ipc"}
[2016-11-25 13:23:32.838] [INFO] Sockets/node-ipc - Connected!
[2016-11-25 13:23:32.840] [INFO] NodeSync - Ethereum node connected, re-start sync
[2016-11-25 13:23:32.844] [INFO] NodeSync - Starting sync loop
[2016-11-25 13:23:32.847] [INFO] Sockets/7 - Connect to {"path":"/home/roland/.ethereum/geth.ipc"}
[2016-11-25 13:23:32.849] [INFO] main - Connected via IPC to node.
[2016-11-25 13:23:32.918] [INFO] Sockets/7 - Connected!
[2016-11-25 13:23:32.969] [INFO] (ui: splash) - network is mainnet


texts: How to save the contract instance on a mapping in solidity?

texts:
I have created an EnergyExchange contract in my React app.js that it is deployed in the network.
Inside the EnergyExchange contract there is a function to create Agent contracts.
What I am trying to do is store the instance of the Agent contract somewhere in the EnergyExchange contract so whenever I want I can retrieve its instance and interact with him within my React web.
I was thinking on doing something like this:
pragma solidity ^0.4.24;

import "./Ownable.sol";
import "./Agent.sol";

contract EnergyExchange is Ownable{

     struct Info {
        Agent ainstance;
    }
    mapping (address => Info) public contractInstance;

   function addAgentContractInstance(Agent _contractInstance) public{
        contractInstance[msg.sender].ainstance = _contractInstance;

    }

    function getAgentContractInstance() public view returns (Agent){
        //return contractInstance[msg.sender];
        return contractInstance[msg.sender].ainstance;
    }

}

But i am getting the following error when calling the functionlike this in React:
let agentInstance = await AgentContract(this.web3.currentProvider,this.exchange.address,this.state.account);

await this.exchange.addAgentContractInstance(agentInstance,{from:this.state.account});

Error:
Uncaught (in promise) Error: Invalid number of arguments to Solidity function

The instance object is causing this error can be seen next:

Any ideas of what I am doing wrong?


texts: Gas estimation: inconcistency between Python Web3 and NodeJS Web3

texts:
Python Web3 and NodeJS Web3 are giving me completely different gas estimations (with NodeJS Web3 estimation being approximately 3 times larger than Python Web3 estimation).

My Python Web3 version is 3.16.4.

My NodeJS Web3 version (extracted from the tons of information given by npm list -g is):

web3@1.0.0-beta.29
web3-eth-abi@1.0.0-beta.30

Has anyone ever encountered this discrepancy between the two platforms?

Thank you.


texts: Is every trade in a decentralised exchange a smart contract?

texts: Is every trade in a decentralised exchange a new smart contract? How does exchanging work in decentralised exchanges?


texts: Have to stop operation taking place after sync

texts:
Hey everyone its me again, so i need to know if i stop this operation(i don't know the name too because i'm a noob:D)that takes place after the sync due to construction to the house. If that is a problem or not? can i start back where i left off? here is a picture of where i'm at in this whole setup Geth process...

Your answers are most appreciated.


texts: How to determine the return address when we use CALL opcode?

texts:
I'm try to understand each opcode defined in Ethereum Virtual Machine. As for the opcode 'CALL' I find that it needs 7 arguments from the stack: gas, addr, value, argument addr, argument offset, return addr and return offset.
My question is that, how the evm determine the return addr and offset for a CALL opcode. When I try my own contract on Remix, I found that the return address is always the same as the argument address before a CALL opcode. Is that always true? Or this is just some kind of coincidence？
// this is my contract code:
contract Demo1{
    uint public goal = 2000;
    function getGoal() public returns(uint){
        return goal;
    }
}
contract Demo2{
    function test2(Demo1 demo1, uint b) public returns (uint){
        uint goal_ = demo1.getGoal();
        if(b < goal_){
            b += goal_;
        }
        return b;
    }
}

And when I use Reimx to debug the function test2, I stop before the CALL opcode and the stack loos like this:
0: 0x00000000000000000000000000000000000000000000000000000000002d6963
1: 0x0000000000000000000000000de37dce8154ce54d895bd16942c86d568ddb5fc
2: 0x0000000000000000000000000000000000000000000000000000000000000000
3: 0x0000000000000000000000000000000000000000000000000000000000000080
4: 0x0000000000000000000000000000000000000000000000000000000000000004
5: 0x0000000000000000000000000000000000000000000000000000000000000080
6: 0x0000000000000000000000000000000000000000000000000000000000000020
...