texts: MetaMask Web3 Error: no synchronous methods without callback parameter

texts:
I try to load the Metamask Web3 object into my nuxt.js frontend. On page load i encounter the following error:

Error: The MetaMask Web3 object does not support synchronous methods like eth_mining without a callback parameter. See https://github.com/MetaMask/faq/blob/master/DEVELOPERS.md#dizzy-all-async---think-of-metamask-as-a-light-client for details.
    at MetamaskInpageProvider.send (inpage.js:1)
    at RequestManager.webpackJsonp../node_modules/web3/lib/web3/requestmanager.js.RequestManager.send (requestmanager.js:58)
    at Eth.get [as mining] (property.js:107)
    at e (backend.js:1)
    at e (backend.js:1)
    at backend.js:1
    at Object.t.b (backend.js:1)
    at stringify (backend.js:1)
    at Object.e.on.e (backend.js:1)
    at Object.emit (<anonymous>:1:532)

Here is the relevant code:

export const state = () => ({
  contractInstance: null
})

export const mutations = {
  registerContractInstance (state, payload) {
    console.log('contract instance: ', payload)
    state.contractInstance = () => payload
  }
}

export const actions = {
  getContractInstance ({commit}) {
    getContract.then(result => {
      commit('registerContractInstance', result)
    }).catch(err => {
      console.log(err);
      ====================error catch in here(contract.js:27 )
    });
  }
}

getContract code:

let getContract = new Promise(function (resolve, reject) {
  if (typeof web3 !== 'undefined') {
    // Use MetaMask's provider
    web3 = new Web3(web3.currentProvider)
  } else {
    web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"))
  }
  let contract = web3.eth.contract(abi)
  let contractInstance = contract.at(address)
  resolve(contractInstance)
})

export default getContract

my environment : "web3 ^0.20.0"


texts: Can ethereum logs be present while transaction is being mined, then disappear later?

texts:
Question about the ethereum blockchain:

If I walk the blockchain like so:

for block in blockchain:
    for transaction in block:
        receipt = getTransactionReceipt(transaction)
        for log in receipt:
            doSomethingWithLog(log)

Is it conceivable that I could pull down a transaction mined by miner "A" with receipt that appears successful, and has logs, only to have a subsequent miner "B" mine the same transaction and see it fail, and then this second miner's version (failing, no longs) later becomes the accepted confirmed block, so that miner "A"s version is orphaned and removed from the blockchain?

If this is conceivable, then any consequences of "doSomethingWithLog" would have to be un-done when the later version of the transaction (with its failing state and lack of logs) is encountered.

Is it possible for events (logs) to be detectable on a blockchain node at a given point in time, only to be later "revoked" in a later, blockchain-accepted version of the same transaction, if that later version results in failure?

Any input would be greatly appreciated!


texts:
I'm trying to simulate the DAO attack for a research project I'm working on. I have truffle and testrpc setup on my machine. I use the sample code given in this tutorial.
I try calling the BankAttack and Bank contracts like this in my test:

Bank b = new Bank();
BankAttacker ba = new BankAttacker(b, true);
ba.deposit();

This results in the following error:

 Error: VM Exception while processing transaction: invalid JUMP at a83375170c16ea0d52be723b5199aa8f0586bf83a8a5b199e86f1b3f0f2af1a6/f61c4b7d1e355565abdfd25e23438aa8d48c93e2:276
  at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/node_modules/truffle-contract/node_modules/web3/lib/web3/errors.js:38:16)
  at /usr/local/lib/node_modules/truffle/node_modules/truffle-contract/node_modules/web3/lib/web3/requestmanager.js:86:36
  at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:118:13)
  at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:64:18)
  at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:354:12)
  at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:509:12)
  at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:469:24)
  at endReadableNT (_stream_readable.js:1054:12)

I've already spent hours trying to debug this. Any help would be appreciated.


texts: why does new emit event syntax give compiler error

texts:
This example returns syntax errors when the emit keyword is used.

emit AuctionEnded(highestBidder, highestBid);

This is the doc where the example code is.

http://solidity.readthedocs.io/en/develop/solidity-by-example.html#simple-open-auction

Why are there syntax errors? How do you really call an event in pragma solidity ^0.4.21;


texts: How accurate are Etherscan's internal tx's on Rinkeby for Oraclize calls?

texts:
I'm trying to optimize my smart contract and am breaking down where the gas is being spent.

Each execution for one function costs me about $5 in gas. I looked at Etherscan and in the internal tx's it shows a value of $5 sent to Oraclize address for my Oraclize call (just a URL call).

Am i really sending that much gas to Oraclize or is Etherscan's value calculator for internal tx's including storage costs in the function that places the Oraclize call? My oraclize call I put 800000 for gas in the custom parameter.

Thanks for any clarification.


texts: Should the smart contract be deployed at the same time as its own token?

texts: I have written a token and deployed it on the ethereum network. After 6 months I want to use that token I have deployed, in a new smart contract and make in-app payments with that token. Is it possible?


texts: Does the rinkeby test network have swarm?

texts: Does the rinkeby test network have Swarm ? If so, how do I synchronise with it using Geth and Swarm binaries ?


texts: Execute smart contract only if the wallet contains some tokens

texts:
i created an erc20 token and i'm trying to create a smart contract that stores some informations in a blockchain just if the wallet contain my tokens.

How can i do this?
Have i to work on the token creation contract or on the other smart contract that stores information?


texts: In a private chain, is it possible to pre-mine a certain amount of ethers at a certain difficulty and then increase the difficulty level ?

texts:
I want to run a private ethereum blockchain.

What I want is I want to distribute certain number of premined ethers (say 20 million) among some accounts.
If I initially keep the difficulty high, It will take too long to mine the blocks and get the required rewards.

Is it possible to premine certain number of blocks and then increase the difficulty level?
Will I have to stop the geth instance to adjust the difficulty level?
and If I stop the geth instance in between, How can I continue mining over the previous blockchain with a different genesis blocK?


texts: Reasons why simple Token should be upgradeable

texts:
The question is that the simple organization token is built with basic Open Zeppelin libraries.
It doesn’t have a custom implementation. It’s not a whatever protocol.
Any reasons to make it upgradeable?


texts:
I set up a private network on my computer and was running some codes written in Python using web3.py, until I faced ImportError:

  ImportError: The 'pyparsing' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.

This didn't happen in the beginning. I was running my codes and everything was running good, but today while playing around with eth_tester I faced this error, which looks more like common Python error. And from the time I first saw this error message I was unnable to run any of my codes, which were running normally before.

The error is invoked by this line:

import web3

I have these versions of modules in my PyCharm:

Pyparsing 2.2.0

Web3 3.11.1

pip 9.0.1

I am using WIN7SP1
Codes are being launched from the Command-line interface
I tried to reinstall web3.py, pyparsing and eth_tester in case problem was in module, but it didn't help

When I try import pyparsing it says:

  AttributeError: module 'copy' has no attribute 'copy'

Yes, I was thinking to ask this question on StackOverflow, because I still think that this is more of Python problem, but this error happens only when I use web3.py and not any other module. So the problem might be in web3.

I appreciate any suggestions and comments on how to solve this problem.


texts: How can I use solc solidity compiler on truffle webpack?

texts:
When I try to import solc, it raises an error which says:

ERROR in ./~/require-from-string/index.js
Module not found: Error: Can't resolve 'module' in 'C:\users\bisrat\Desktop\webpacksample\node_modules\require-from-stri
ng'
 @ ./~/require-from-string/index.js 3:13-30
 @ ./~/solc/wrapper.js
 @ ./~/solc/index.js
 @ ./app/javascripts/app.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 ./app/javascripts/app.js


texts:
I write this contracts.
RegProvider creates Registrator and Counter, and Client connect to it.
But when I do any action from Client, there are not any Events in RegProvider.

Where is my error? Any ideas...

pragma solidity ^0.4.8;

contract RegProvider {
address[] public registrators_contracts;
address[] public counters_contracts;

// EVENTS
event EventReg(address useraddr);
event EventTick(address useraddr, uint chislo);
event EventRemove(address useraddr);

function getRegistratorsContractCount()
public
returns(uint contractCount)
{
return registrators_contracts.length;
}

function getCountersContractCount()
public
returns(uint contractCount)
{
return counters_contracts.length;
}

function NotifyRegister(address client)
public
{
EventReg(client);
}

function NotifyGetTick(address client, uint chislo)
public
{
EventTick(client, chislo);
}

function NotifyRemove(address client)
public
{
EventRemove(client);
}

function newRegistratorCounterPair()
public
{
Registrator reg = new Registrator();
registrators_contracts.push(reg);
Counter cnt = new Counter();
counters_contracts.push(cnt);
reg.set_counter_addr(cnt);
reg.set_provider_addr(this);
cnt.set_registrator_addr(reg);
cnt.set_provider_addr(this);
}
}

contract Registrator {
address counter_addr;
address provider_addr;

function set_counter_addr(address myaddr)
public
{
counter_addr = myaddr;
}

function set_provider_addr(address myaddr)
public
{
provider_addr = myaddr;
}

function Register(address useraddr)
public
{
var rez = provider_addr.call(bytes4(sha3("NotifyRegister(address client)")), useraddr);
uint random_number = uint(block.blockhash(block.number-1))%10 + 1;
var rez2 = counter_addr.call(bytes4(sha3("SetInitNumber(address user_addr, uint init_number)")), useraddr, random_number);
}

function Remove(address useraddr)
public
{
var rez = provider_addr.call(bytes4(sha3("NotifyRemove(address client)")), useraddr);
uint random_number = uint(block.blockhash(block.number-1))%10 + 1;
var rez2 = counter_addr.call(bytes4(sha3("RemoveUser(address user_addr)")), useraddr);
}

}

contract Counter {
mapping (address => uint) usersInfo;
mapping (address => bool) isAdmin;
address registrator_addr;
address provider_addr;

function set_registrator_addr(address myaddr)
public
{
registrator_addr = myaddr;
isAdmin[registrator_addr] = true;
}

function set_provider_addr(address myaddr)
public
{
provider_addr = myaddr;
}

function SetInitNumber(address user_addr, uint init_number)
public
{
//if (!isAdmin[msg.sender]) throw;
usersInfo[user_addr] = init_number;
}

function TickNumber(address user_addr)
public
returns (uint curval)
{
uint currentvalue = usersInfo[user_addr];
var rez = provider_addr.call(bytes4(sha3("NotifyGetTick(address client, uint chislo)")), user_addr, currentvalue);
usersInfo[user_addr] = usersInfo[user_addr]+1;
return currentvalue;
}

function RemoveUser(address user_addr)
public
{
//if (!isAdmin[msg.sender]) throw;
delete usersInfo[user_addr];
}
}

And second...

pragma solidity ^0.4.8;

contract Client {
address public registrator_contract;
address public counter_contract;

function Client(address reg_addr, address cnt_addr)
{
registrator_contract = reg_addr;
counter_contract = cnt_addr;
}

function Register()
public
{
var rez = registrator_contract.call(bytes4(sha3("Register(address useraddr)")), msg.sender);
}

function GetTick()
public
{
var rez = counter_contract.call(bytes4(sha3("TickNumber(address user_addr)")), msg.sender);
}

function Remove()
public
{
var rez = registrator_contract.call(bytes4(sha3("Remove(address user_addr)")), msg.sender);
}
}


texts:
I'm brand new to Ethereum, and come from the Bitcoin world.

I installed geth and Mist today (0.8.5, 64-bit builds for Windows), and successfully sent some Ethereum to my Etherbase account from an exchange.  It's there in Mist.

But I'm having trouble sending Ethereum back out from my account using Mist.

e.g. I tried sending 1 ETH to an address, and choose the highest fee available in the client (~0.004 ETH).  It showed my transaction as "sent" but it sat there for several minutes with 0 confirmations, until it finally complained that the transaction "couldn't be successfully executed" and rolled it back.

Is my fee too low, and is there a way to increase it beyond the maximum available in the client?  Is there a log or some way to see exactly why my transaction failed?

In case it's relevant, I did move my data directory to another drive and am starting up the client via:

start "geth" "C:\Users\blah\AppData\Local\Mist\app-0.8.5\nodes\geth\win-x64\geth.exe" --datadir X:\EthereumData
start "Mist" "C:\Users\blah\AppData\Local\Mist\app-0.8.5\Mist.exe" --datadir X:\EthereumData

I saw some stuff about an ipc parameter and am not sure if I'm missing it above.  I figured since everything else seemed to be working between geth and Mist I'm ok on that front.


texts: Ether.li recovery algorithm does not work for me, how to overcome this?

texts:
Unfortunately, I have used Ether.li to store some Ether. Now I want to recover my Ether Classic (not supported by Ether.li) by setting up the contract manually on the Classic blockchain. That is so far impossible because I cannot derive the needed private key from the printed "Encrypted private key". The problem is that the printout does not distinguish between 'l' (small L) and 'I' (big i).

I have tried all possible variants of the above letters at https://www.ether.li/recovery but always a message pops up "Please ensure that you have properly entered you encrypted private key and/or password".

I see no way to obtain the private key from the printout. (Added: see also my comments below.)

The encrypted key should also be stored somewhere in a browser database. I tried to find it there with the resource tab of the Chrome debugging console but could not find it. Does someone know where to look?

Maybe the developers could add a function to display the (encrypted) private key when I'm logged into the account? That could even be somewhat hidden, e.g. over a non-linked to subfolder like for example ether.li/private_key. I would really appreciate that!


texts:
I run a couple eth2 stakers. Lately I'm getting a slightly higher number of missed attestations, that brought my rating down from 100% to 99%. Not a critical problem, but man is it annoying not knowing what is causing this. And I know I'm not alone.
I have looked at the system and service logs before, trying to troubleshoot. I have asked in the Discord server. Each time I come away with nothing particularly useful -- I dunno, don't worry about it, you'll make it back the next attestation.
I mean, I get it, it's not a big deal... but that answer is just not satisfying. I mean, what if it does become a bigger problem? Then I would like to be ready to figure it out.
I'm not using any of the recommended monitoring software... maybe that would help give me some understanding of why I missed an attestation. What do you do to troubleshoot missed attestations?


texts: Carry out function for either x state or y state

texts:
I've created my own struct:

 enum TestState {noWager, wagerMade, wagerAccepted}

And my modifier:

modifier onlyState(GameState expectedState){
    if(expectedState == currentState){ _;}
    else{throw;}}

I'm wanting to allow a function to be carried out if it is either noWager or wagerMade state.

 function testWager() onlyState(GameState.noWager || GameState.wagerMade) payable returns(bool){....}

I am getting the error:

 || not compatible with types enum GameState and enum GameState


texts: The DAO: Stalker Attack - Attacker split from childDAO?

texts:
I had a question about the argument in this article Why The Stalker Attack is a Non Issue.

In the scenario the article describes, there is a "Victim" and an "Attacker". The Victim tries to split from The DAO to convert his TDT to ETH. The Attacker wants to prevent the Victim from doing so (& potentially excise a ransom). To split, the Victim creates a Split proposal and the Attacker votes Yes. Assume in the child-DAO, the Attacker has more TDT than the Victim.

The article suggests that this is a "high-risk" endeavor for the Attacker - why? Couldn't the Attacker simply create a new Split proposal from the victim's childDAO at any point & mark himself as curator of the new childDAO?


texts: how do I loop through a mapping of address to struct

texts:
I have a mapping where the key is the artist name, the value is msg.sender address. In a function, I want to check if the parameter username has already existed in the mapping keys, if yes, i will throw

How do I loop through a mapping of value keys to check and compare with input parameter?

mapping(bytes32 => address) public reserved_names;

function create_artist(bytes32 username, string ipfs) {

   //todo throw exception if artists username already exists

   reserved_names[username] = msg.sender;


texts: How to use mnemonic to recovery my ethereum wallet

texts:
I use web3j to create my ethereum wallet.the Code just like down
import org.web3j.crypto.Bip39Wallet;
import org.web3j.crypto.Credentials;
import org.web3j.crypto.ECKeyPair;
import org.web3j.crypto.WalletUtils;

wallet = WalletUtils.generateBip39Wallet(password, new File(keystorePath));
// keystore's file name
String keystoreFileName = wallet.getFilename();
// my mnemonic
String mnemonic = wallet.getMnemonic();

I can use this code get my address
Credentials credentials = WalletUtils.loadBip39Credentials(password, mnemonic);
String address = credentials.getAddress();

I can import my wallet by this:
Credentials credentials = WalletUtils.loadBip39Credentials(password, mnemonic);

but in this way I need password & mnemonic,How I import or recovery my wallet by mnemonic without password,because some wallet app just like metamask or imtoken , they don't need the old password that I create my wallet and the can reset a new password.
In other words,recovery or import the wallet just need mnemonic,how I do it by web3j

Is ereryone can tell me how to do it by web3j.thank u very much.


texts: What would be the cost of this transaction to end user?

texts:
A simple question on gas spent on a transaction here.

I'm experimenting with testnet transaction on a simple contract that stores a value, trying to figure out how much a client would pay. What would be exact cost of gas in ETH of this transaction?

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

Would it be 0.0024565 testnet Ethers, i.e. 0.0024565*336$ (price of 1 ETH when I write this) = 0.82 dollars in real network?

So the fee for 33 cents transaction would be 82 cents if it were on the production blockchain, is this so?

Thanks.


texts: what is 'UnimplementedFeatureError: Not yet implemented - FixedPointType' error?

texts:
what is 'UnimplementedFeatureError: Not yet implemented - FixedPointType' error in solidity while compiling through truffle ?

How to fix it ?

Using solidity compiler version - 0.5.9


texts: How is data from Arrays and sutch, in contracts actually stored in the blockchain?

texts:
How is data from instance variables in contracts actually stored in the blockchain? Say I have a simple contract like the example Token contract:

contract MyToken {
    /* This creates an array with all balances */
    mapping (address => uint256) public balanceOf;

    /* Initializes contract with initial supply tokens to the creator of the contract */
    function MyToken(
        uint256 initialSupply
        ) {
        balanceOf[msg.sender] = initialSupply;              // Give the creator all initial tokens
    }

    /* Send coins */
    function transfer(address _to, uint256 _value) {
        if (balanceOf[msg.sender] < _value) throw;           // Check if the sender has enough
        if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows
        balanceOf[msg.sender] -= _value;                     // Subtract from the sender
        balanceOf[_to] += _value;                            // Add the same to the recipient
    }
}

Where is the data in balanceOf stored? How might I be able to get this information without adding a function to the Contract just to return say the balance for an address?


texts: Parity private chain: Contract deployment transaction not getting mined

texts:
I have some simple Solidity code to test contract deployment and invocation. It has methods to write a value to storage, and a method to read it. This worked perfectly well with a private chain with a geth client.

After switching over to Parity client and a Proof-of-Authority chain, the contract is not getting deployed because the transaction to deploy it does not get mined. I have tried increasing the gas to 600 mil and gasPrice offered to 10 Gwei. Simple transfers of Ether do go through. Also, the Solidity code compiled successfully. Tried with sending account unlocked, and also by entering account password in confirmation window in browser UI.

Contract code:

pragma solidity ^0.4.7;

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

contract mortal is owned {
  function kill() {
    if (msg.sender == owner) selfdestruct(owner);
  }
}

contract IdMgmt is mortal {

  struct acl {
    string dataType;
    string permissions;
  }

  mapping (address => acl) public aclOf;

  function IdMgmt() { }

  function createId(address _user, string _dataType, string _permissions) {
    aclOf[_user].dataType = _dataType;
    aclOf[_user].permissions = _permissions;
  }

  function getPermissions(address _user, string _dataType) constant
    returns (string userPermissions) {

    if (stringsEqual(aclOf[_user].dataType, _dataType)) {
      userPermissions = aclOf[_user].permissions;
    }
    else {
      userPermissions = "NO DATA";
    }
  }

  function stringsEqual(string _a, string _b) internal returns (bool) {
    bytes memory a = bytes(_a);
    bytes memory b = bytes(_b);
    if (a.length != b.length) {
      return false;
    }
    for (uint i = 0; i < a.length; i ++) {
      if (a[i] != b[i]) return false;
    }
    return true;
  }
}

What other information would help in getting to the root cause?


texts: How can I make a Solidity contract closed source?

texts:
My question seems simple to answer, but I could not find an answer to this yet.

I assume that I have to compile the contract to byte code and deploy the byte code to the blockchain directly?

Before the Crypto Kitties hype I did not even know that deploying anything 'soopersecret' would be even possible.


texts: how to let the user use Ethereum DApp Without having wallet

texts:
I have a question regarding Ethereum and DAPP ..

I have a smart contract that basically store a document and I integrated it with a user interface that let the user go to the website and search for that document .. very simple idea.

the problem is and correct me if i'm wrong .. the process of storing the document to the Ethereum blockchain require a gas but the process of getting that document is gasless ..

and I think that the user need to have a wallet to use the website and search for the document .. even if the process does not require any gas

Am I right? because that what I understand

and if I am right .. is there a way where the user can enter and use the website without having to install a wallet or doing anything beside searching for the document that he need?

I'm using web3.js

and i tried this code:

var contract
var addresse = //my contract addresse;
var api = // api ;

contract = new web3.eth.Contract(api, addresse);

but i got :

  "Uncaught TypeError: web3.eth.Contract is not a constructor"


texts: how to create a nested for loop that stores the hashed value for each

texts:
I have two arrays:

address[ ] addresses
uint [ ] numbers

I want to create a function that creates another array that stores the hashed value of both.

bytes32[ ] addressNumbers

for instance, if I have two addresses stored and two uints:

address[address1, address2] addresses,
uint [1, 2] numbers.

I want to hash them with keccak256(address, uint) such that i get an array:

bytes 32[ address1,1 ,address1,2 , address2,1 , address2,2 ]
addressNumbers

I assume I need to use a nested for loop, but i am having trouble figuring out how. can any of you help me put?


texts: IERC1155Views - whether and how to use it?

texts:
Do I need to have IERC1155Views interface in my ERC-1155 contract to determine the number of decimals after the dot for the exchanges? If I don't specify IERC1155Views, what number of decimals will the exchanges choose?

IERC1155Views requires to specify name() and symbol(). I don't have this information for my tokens. Should I return the same name and symbol for each token my token set? Isn't it better to omit IERC1155Views altogether not to confuse the users into that they are the same token as they would have the same symbol and name?


texts: Transaction Failed but showing as Pending on Etherscan

texts:
So I just started using ether after the same was legalized in my country (India). I use Coinbase Wallet for my Storage of ether. I decided to shift to Metamask from Coinbase Wallet and as such initiated a transfer of my Ether, I selected Max Option for the same and then initiated the transfer. The transaction has been pending for hours now. I checked with Coinbase Wallet and on the app it shows as Transaction Failed. But on etherscan it shows as Pending.
So, the transaction happened at transaction hash : https://etherscan.io/tx/0x689281c886374982946117efa52e43835b9b8d3e0915ec3d8871b4a37b894ca3

I got scared of the same (understandably so!). So, I used my metamask to send some ether to the Coin Base Wallet in case of gas issues but it seems that is not happening as well. Those transactions are also stuck as pending. So, all of my ether is currently stuck as pending. Please advice on what I can do! Thanks in advance.

Edit: So, it seems by the time I posted this my transaction was "Dropped". Not sure what that means though. Currently, I have 2 more pending transactions for deposits in the coinbase wallet that I did which still show up as pending. Not sure if they are going to be dropped as well.

Conclusion: Don't use Max Feature as it may cause some ether whether it's just 0.0001 ETH short it will cause you a lot of confusion till the time the transaction drops or fails (not sure if they are the same thing!!)


texts: If I have an encrypted file in IPFS with a symmetric key that I share, can I after that decrypt and re-encrypt that file with a different key in order to revoke access?


texts:
I tried replicating the instructions in this article to implement EIP712 signing, however, it doesn't appear to work for web3 1.0 versions.

https://medium.com/metamask/eip712-is-coming-what-to-expect-and-how-to-use-it-bb92fd1a7a26

Here's the working signing example from the above article:

https://weijiekoh.github.io/eip712-signing-demo/index.html

And here's the code from the example that works on earlier web3 versions:

const domain = [
  { name: "name", type: "string" },
  { name: "version", type: "string" },
  { name: "chainId", type: "uint256" },
  { name: "verifyingContract", type: "address" },
  { name: "salt", type: "bytes32" },
];

const bid = [
  { name: "amount", type: "uint256" },
  { name: "bidder", type: "Identity" },
];

const identity = [
  { name: "userId", type: "uint256" },
  { name: "wallet", type: "address" },
];

const chainId = parseInt(web3.version.network, 10);

const domainData = {
  name: "My amazing dApp",
  version: "2",
  chainId: chainId,
  verifyingContract: "0x1C56346CD2A2Bf3202F771f50d3D14a367B48070",
  salt: "0xf2d857f4a3edcb9b78b4d503bfe733db1e3f6cdc2b7971ee739626c97e86a558"
};

var message = {
  amount: 100,
  bidder: {
    userId: 323,
    wallet: "0x3333333333333333333333333333333333333333"
  }
};

const data = JSON.stringify({
  types: {
    EIP712Domain: domain,
    Bid: bid,
    Identity: identity,
  },
  domain: domainData,
  primaryType: "Bid",
  message: message
});

const signer = web3.toChecksumAddress(web3.eth.accounts[0]);

web3.currentProvider.sendAsync(
  {
    method: "eth_signTypedData_v3",
    params: [signer, data],
    from: signer
  },
  function(err, result) {
    if (err || result.error) {
      return console.error(result);
    }

    const signature = parseSignature(result.result.substring(2));

    res.style.display = "block";
    res.value = genSolidityVerifier(signature, signer, chainId);
  }
);

This works with maybe a few minor modifications, except for the last section, which I'm not sure how to update. If I simply update the sendAsync section to the below, I get a stringified version of the data to sign to show up in MetaMask, however, it's not very readable and the better solution would be to get the proper object format like the example.

web3.eth.personal.sign(data, props.address ,'');

Any ideas are appreciated.


texts: Decoding function from transaction input

texts:
I am looking at tracking ERC-20 token swaps. For example, this transaction hash "0xbcc5eeae8313f2c958b858f7ad6998935f1e74362289571110dc0930779effea" is swapping DAI for ether.
I can see using Etherscan that it is using the function swapExactTokensForETH(). How would I determine this using web3? I can return the transaction input, but I don't know how to parse it. I tried the following based on the fields shown in Etherscan:
web3.eth.abi.decodeParameters([{
    type: 'uint256',
    name: 'amountIn'
},{
    type: 'uint256',
    name: 'amountOutMin'
},{
    type: 'address[]',
    name: 'path'
},{
    type: 'address',
    name: 'to'
},{
    type: 'uint256',
    name: 'deadline'
}],input));

But I get the following type of error:
Error: overflow (fault="overflow", operation="toNumber" ...

How can I programmatically parse the input value of a transaction?


texts: how to create an address or wallet in several tokens

texts: Hello community I am using nodejs and web3, I would like to know if it is possible to create an address in each token and then bring the corresponding balance of each token


texts:
From what I understand, non-validators will feel benefits from the change to casper. However, is it only validators that can actually participate in Casper? Is it correct that if you have etehreum in your wallet, it does not increase because of age or something else?

That the only ones participating in the Proof of stake system is only the validators?


texts: I build solc from source v0.4.18 but can't not use it to compile solidity. How can I solve this problem?

texts:
$ solc  --bin -o ./contracts SimpleStore.sol

Warning: This is a pre-release compiler version, please do not use it in product                                                                                ion.
SimpleStore.sol:1:1: Error: Source file requires different compiler version (cur                                                                                rent compiler is 0.4.18-develop.2018.12.6+commit.9cf6e910.Linux.g++ - note that                                                                                nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.18;


texts:
The Yellow paper talks about "scalar values" in section 4.4 to describe block header fields. E.g.

  difficulty: A scalar value corresponding to the dif-
  ficulty level of this block. This can be calculated
  from the previous block’s difficulty level and the
  timestamp; formally Hd.

How large (in bits) are scalar values? Are they fixed size, or variable size?


texts: Solidty - Return an array of UINTS from a struct

texts:
I have a mapping that is storing bytes32=>uint. I want to write a function that loops through this mapping and only returns a list of the uints.

I know you cannot have a dynamic array in the function as it has to be in memory. But I need to store them in an array to be able to return the array in the function.

I just want all the ints to be returned in an array so I can access it on my frontend via JS.

This is what I have so far (that doesn't work):

function getAllVotes () returns (uint[]) {
    bytes32[] returnVotes;

    for(uint i = 0; i < candidateList.length; i++) {
      returnVotes[i] = bytes32(votesReceived[candidateList[i]]);
    }

    return returnVotes;

  }


texts:
Can you please recommend the best way to organize pre-ICO and ICO using Etherium smart contracts.

I have found two options:

1) To make 2 different contracts and after ICO merge them (pre-ICO with ICO contract)

2) To make 2 different crowdsale contracts with different hard cap and different time but with the same token name


texts: Call function by using bytesData. (call.value()())

texts:
Assume I have two contracts:

contract A {
    function test1() public view returns(bool) {
        return false;
    }
}
contract B {
    function testCall(address addr, data) public view returns(bool) {
        return addr.call.value(0)(data);
    }
}

Then I call testCall in javascript:

const a = await A.new()
const b = await B.new()

const aWeb3 = web3.eth.contract(a.abi)
const aInstance = aWeb3.at(a.address)

const testData = aInstance.test1.getData()

const ans = await bInstance.testCall(aInstance.address, testData)

console.log(ans)

In this case, ans should be false, but it returns true


texts: Proper way for contract to payout ether to addresses if conditions are met

texts: I've got a contract that I'm building in ethereum-studio. I've sent some eth to the contract. And I want addresses to be able to query a function on the contract to see if they meet conditions in order to pull eth out of the contract. What is the proper way to do this in solidity?


texts:
It seems that truffle cannot deploy to a --light node.

I run a laptop where disk space is really tight.

Are there any publicly available testnet and mainnet nodes that I can interract with via RPC?


texts: I am getting a error when trying to set up a local raft network

texts:
When I try to run the command
geth attach $nodeName/geth.ipc
It shows the following error
'Incorrect Usage. flag provided but not defined: -raft'

I am not able to understand what went wrong exactly, because I have followed every step          properly and have checked it as well.
need help thank you....


texts:
After I updated my Ganache the account addresses and the Mnemonic change everytime I start Ganache.
The option "Autogenerate HD Mnemonic" is disabled.
Do you know a way to keep the same account addresses and the same Mnemonic?
Thank you for your help.
Take care
Pierre


texts: ETH lost on buggy Uniswap using connected Coinbase Wallet. Multiple transactions failed while one being displayed as successful

texts:
I used Uniswap for the first time, because a desired token was available through Uniswap.
Everything seemed fine.
I connected my Coinbase wallet to easily transfer the needed Ethereum funds and started the swap.
After initiating the swap, I needed to approve the transfer in the Coinbase Wallet, which seemed to work pretty seamless.
But this transaction failed, so I tried again with a lower amount. This second transfer was displayed as successful in the Coinbase wallet, so I tried to swap my remaining ETH, but it failed again and again.
So I rechecked my wallet this morning to realize all of the transactions failed, leaving me with nothing but lost Ethereum.
The address:
https://etherscan.io/address/0xa95bd728281bdc2e8b276c5b30e21dced30ed688
I bet there is no way to get my coins back?
I'm really frustrated and annoyed by this. I mean, transaction costs are off-the-charts and I still wasn't able to swap.
I now read something about slippage?, but you expect a service like Uniswap to take this into account??
Not looking forward to ever use Uniswap again


texts: AWS full node requirements and querying transactions

texts:
I would like to work with the Ethereum blockchain and be able to get transactions associated with an address. I believe I cannot use the fast sync mode and need to have a fully valditating node?

Do you have advices for the AWS specs?

Do I have to maintain an index to get list of transactions like
https://etherscan.io/address/0x281055afc982d96fab65b3a49cac8b878184cb16

or it possible to access it directly?


texts:
var Web3 = require('web3');
var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider("http://blahblah.com:8545"));
var token = web3.eth.contract(ABI).at("x0x_contract_address")

How would this be done in PHP?

For example with the ethereum.php library I use I can do things like this:

$data = new Ethereum_Transaction($users_eth_address, "x0_eth_address, $gas, $gasPrice, $hex_balance);
$result = $ethereum->eth_sendTransaction($data);


texts: Can we deploy old deployed NFT contract to Ethereum 2.0?

texts: I have already deployed contract on Ethereum. Now I want to deploy it on Ethereum 2.0, is it possible? According to some resources Ethereum 2.0 does not support for smart contract deployment. Thank you in advance!


texts:
Geth v1.8.0 supports new way of fetching transactions via IPC or WebSockets (debug_subscribe). There is an example in release notes which works almost perfectly:

$ nc -U /work/temp/rinkeby/geth.ipc
{"id": 1, "method": "debug_subscribe", "params": ["traceChain", "0x0", "0xfff", {"tracer": "callTracer"}]}

Response:

{"jsonrpc":"2.0","id":1,"result":"0xe1deecc4b399e5fd2b2a8abbbc4624e2"}
{"jsonrpc":"2.0","method":"debug_subscription","params": {"subscription":"0xe1deecc4b399e5fd2b2a8abbbc4624e2","result":{"block":"0x37","hash":"0xdb16f0d4465f2fd79f10ba539b169404a3e026db1be082e7fd6071b4c5f37db7","traces":[{"from":"0x31b98d14007bdee637298086988a0bbd31184523","gas":"0x0","gasUsed":"0x0","input":"0x","output":"0x","time":"1.077µs","to":"0x2ed530faddb7349c1efdbf4410db2de835a004e4","type":"CALL","value":"0xde0b6b3a7640000"}]}}}
{"jsonrpc":"2.0","method":"debug_subscription","params": {"subscription":"0xe1deecc4b399e5fd2b2a8abbbc4624e2","result":{"block":"0xf43","hash":"0xacb74aa08838896ad60319bce6e07c92edb2f5253080eb3883549ed8f57ea679","traces":[{"from":"0x31b98d14007bdee637298086988a0bbd31184523","gas":"0x0","gasUsed":"0x0","input":"0x","output":"0x","time":"1.568µs","to":"0xbedcf417ff2752d996d2ade98b97a6f0bef4beb9","type":"CALL","value":"0xde0b6b3a7640000"}]}}}
...

However even though block hashes are included, the transaction hashes are not.

I wanted to adapt the sources as the release notes suggest, but I don't know how I can use them... Do I need to recompile geth or is there a way I can install my tracer via JS interface?


texts: What is the best option to return the eth to the sender?

texts:
I want to switch function according to "result" value.

Here is my solidity code.

function rockPaperScissors(uint _userHand) public affordPay() payable {
  uint randHand = random();
  uint result = rpsResult(_userHand, randHand);
  address toAccount = 0x*************************;
  if (result == 1) {
    // LOSE
    toAccount.transfer(msg.value / 2);
    msg.sender.transfer(msg.value / 2);
  } else if (result == 2) {
    // WIN
    toAccount.transfer(msg.value);
  } else {
    // DRAW
    msg.sender.transfer(msg.value);
  }
  return result;
}

In fact, I want to send half amount of msg.value in case "result" is 1, send full amount of msg.value in case "result" is 2, and send nothing in case other "result".

Additionaly, I want to send back remaining eth to msg.sender.

I use msg.sender.transfer(msg.value); when send back, but I read the docs, which says revert() will not consume any gas.

Is this means it is suitable to use revert() when you want to send back all eth you send to the contract ?

I'm a newbie in solidity develpment, so if there are any other good solutions, please teach me.

Thanks in advance!


texts: Will mining Ethereum be profitable after Proof of Stake/ Proof of Authority?

texts:
What will actually happen when they move to Proof of Stake ? If I want to start mining with 8-10 rigs now would it be profitable if they move to Proof of State or POA ? In short...will I make money after that or should I move to other crypto currency ? Thanks

I am providing a link to another user who started a similar question:
Are miners eliminated in Proof of Authority?


texts: Is there any way to hide or encryt input data that sent to smartcontract?

texts:
After a While working with ethereum, I felt ethereum is not only public and also naked because whatever input data that we sent to contract function, it is visible to everyone when looked into the transaction hash details on sites like etherscan. I think it is main security hole of Ethereum.  No one wants to be wondering on roads naked right! So, Is there any way to hide or encrypt input data that sent to contract for not to show up on etherscan??
have a look at picture


texts: Verifying ETH Deposit Contract signatures using Chainsafe BLS library

texts:
I am attempting to verify BLS signatures using the Chainsafe BLS library. I am attempting to independently verify signatures associated with deposits to the ETH Deposit Contract. In order to test that I am using the library correctly, I used the verify function on the following deposit.
When I attempted to verify the deposit, the function returned false.
I made a couple of assumptions which may have led to this error.

I inputed all arguments as strings.
For the message parameter, I inserted the users withdrawal credentials

This is what my function looked like:
bls.verify('8B0F65FDDD2F4A5228114BCFB7594806BD7B1A0D08C6EC4D4E050EBEE56B9EAD36A65B8581D23EE142E81499A0CE2193',
'00A96066AC9AB401F87AD05E2ED4E6DF5AE2658E532BF2753DB8A0907EFF72A8',
'92507CDF84A2EFDF41202492A227684DB679CE8F811C313747CD3B25CB6701D50E2A32327CF374DB82862EC482BDA7D30CF8C0823617C2252E6CB8C771EF358FDF092B30CBE2249B8D752F9521BA7653FB198C8B692734C331E21887977186F0')

How did I do?


texts: how can show block create information. when i make a contract creation

texts:
How can show below information at windows command console? When i use web3 to make contract creation. i browse some website. Some website tell me to use sendRawTransaction. But the sendRawTransaction is no in web3.js version 1.3.3. Can you tell me to display below information?
Transaction: 0x62c146c42c17ec030b5dc9befa5058dd4b3e86765a92ed1cd3f6436872a1a76a
Contract created: 0xb11a375fc9ffc6681f5ac1efb06e2f64dc7711e7
Gas usage: 99213
Block Number: 11  Block Time: Fri Feb 05 2021 11:15:48 GMT+0800 (CST)
Thank you very much.


texts: How do I asynchronously wait for Contract.events.MyEvent data to be returned in Web3 1.0?

texts:
The documentation is sparse, and the examples all mix async, arrow callbacks, and promises. One problem I've run into is while subscribing to an event, I can't seem use asynchronous syntax within or outside the method. There is also odd behavior in the way it returns data that could be affecting this. The method not only is used to lookup events, but also to listen to them in the future.

The documented way to subscribe to an event in Web3 1.0 (https://web3js.readthedocs.io/en/v1.2.0/web3-eth-contract.html#events):

myContract.events.MyEvent({
    filter: {myIndexedParam: [20,23], myOtherIndexedParam: '0x123456789...'}, // Using an array means OR: e.g. 20 or 23
    fromBlock: 0
}, function(error, event){ console.log(event); })
.on('data', function(event){
    console.log(event); // same results as the optional callback above
})
.on('changed', function(event){
    // remove event from local database
})
.on('error', console.error);

It works, but for production most people will probably want to do other things first. I need to listen to the current block to pass it into the event subscription so I can get the last ten blocks. After the data for the initial event query comes back, I need to fetch the current nonce of my wallet, and then iterate over the returned addresses to then sign them. After that, it becomes a passive listener, and so I set scriptHasBeenLoaded to true so that new events coming in take a different logical path.

Here is my current code:

getBlockNumber()

function getBlockNumber() {
    web3.eth.getBlockNumber().then((result) => {
        startingBlock = result
        console.log('*** Starting Block is', startingBlock, '***')
        startListening()
    })
}

function startListening() {
contract.events.Approval({
            fromBlock: startingBlock - 10,
            toBlock: 'latest'
        },
        (error, events) => {
            if (error) { console.log("*** Error Retrieving Addresses ***") }
            subscriberAddresses.push(events.returnValues.src)
            if (scriptHasBeenLoaded === true) {
                retrieveApprovals()
            }
        })
        getNonce()
}

function getNonce() {
    web3.eth.getTransactionCount(account, 'pending').then((result) => {
        console.log('*** Initial Nonce is', result, '***')
        nonceCounter = result
        console.log('*** Listening for Approvals ***')
        ...theBusinessEndFunctions()
    })
}

How can I wait for the events to come back, and then fire getNonce()?

Everything I do seems to bork the script. Currently, getNonce() is just in line. The only work around I have is setTimeout, which works, but it is the anti-solution. :-(

Edit: getPastEvents is not a solution or workaround after further testing.


texts: Payable constructor gives revert message

texts:
I am trying to execute the following contract on remixe IDE:

pragma solidity ^0.5.4;
contract GuessTheNumberChallenge {
    constructor() public payable {
        require(msg.value == 1 ether);
    }

}

I am getting the following message and I am showing the Debug message also:

  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. creation of
  GuessTheNumberChallenge pending...
  [vm]from:0xca3...a733cto:GuessTheNumberChallenge.(constructor)value:0
  weidata:0x608...00032logs:0hash:0x3c2...162d0  status     0x0 Transaction
  mined but execution failed  transaction hash
    0x3c204d4cdd45c410f8ab98cf5db12ea1b31fbde7c35296f6820e2554b4f162d0
  contract address  0x08970fed061e7747cd9a38d680a601510cb659fb  from
    0xca35b7d915458ef540ade6068dfe2f44e8fa733c  to
    GuessTheNumberChallenge.(constructor) (Contract Creation - Step 0)
  gas   3000000 gas   transaction cost  59197 gas   execution cost  45
  gas   hash
    0x3c204d4cdd45c410f8ab98cf5db12ea1b31fbde7c35296f6820e2554b4f162d0
  input     0x608...00032  decoded input    {}  decoded output   -   logs   []
  value     0 wei

Somebody please guide me.

I am adding the image for execution:

Zulfi.


texts: Filters object not working for web3.eth.contract getPastEvents() method

texts:
I have referred, Web3 Events, but filters object is not working for me, I've got the same result for events before and after applying filter object.

Here's the code:

 instance.getPastEvents(
    "Transfer",
    {filter: {value: [117,50]}},
    { fromBlock: 0 , toBlock: "latest" },
    (errors, events) => {
         if (!errors) {
            console.log(events);
         }
     }
);

What does that filter object really means, According to documentations and references it is custom fields but it must be object parameters.

Suggestion needed to correct the filters use.


texts:
How an Ethereum client stores the blockchain data in the disk?

I know two of the major Ethereum clients is go-ethereum and parity, so I'm also asking if they store data in a different way or if there are some common threads?


texts: How to install mist (browser) and wallet on Linux Ubuntu?

texts: I am somewhat new to Linux and have been having difficulty installing Mist. I tried using this script https://gist.github.com/tgerring/d4ab3f1672ed91a53c6c to no avail. It usually goes wrong around line 11. I am trying to download Mist 8.10 on Ubuntu.


texts: Validating for non-zero Fields in Solidity for Contracts

texts:
In the sample code below, I wanted to check the input data (non-empty) using require/assert and create the contract if it passes the two test.

The code is not working.   It still creates an instance of a Contract ABC, if I provide just the _name value as input, without the _number.

How do you make the function "create" exit if the require conditions are not met.  How would I tweak this code to achieve the above?  Do I have to wrap the require condition with an if-then-else to return false if tests fail?  Thanks.

pragma solidity ^0.4.15;
contract ABC {

    bytes32 public name;
    uint public number;
    event Log(string _myString);

    function ABC (bytes32 _name, uint _number) public {
        Log("object created");
        name = _name;
        number = _number;

    }
}

contract XYZ {

    ABC myABC;

    event Log(string _myString);

    function create(bytes32 _name, uint _number) public returns (bool isSuccess) {

        Log("checking name");
        require(_name != 0);

        Log("name valid, now checking number");
        require(_number != 0);

        Log("name and number non-empty, creating a new contract");
        myABC = new ABC(_name,_number);

        Log("new contract created");

        return true;

    }

}


texts: "Push" is not available in bytes32[], memory out of storage

texts:
Here is the function of my code where error comes

```

function getPeople() constant returns(bytes32[], bytes32[], uint[] ) {

uint length = people.length;

bytes32[] memory firstNames = new bytes32[](length);
bytes32[] memory lastNames = new bytes32[](length);
uint[] memory ages = new uint[](length);

for(uint i=0; i<people.length; i++) {
  Person memory currentPerson;
  currentPerson = people[i];

  firstNames.push(currentPerson.firstName);
  lastNames.push(currentPerson.lastName);
  ages.push(currentPerson.age);

}

```

Error is Member "push" is not available in bytes32[] memory outside of storage.
      firstNames.push(currentPerson.firstName);


texts: I have some trouble with my code, basically I want to call the payable function in my Smart Contract through Web3.js, here is my code, I'm sure I did something wrong but I can't figure out where.


texts: What is the ethereum equivalent of Bitcoin's Qt wallet? Just bought some off of an exchange and want to store it elsewhere.


texts: Passive DAO participation vs. Active DAO Participation

texts: If being part of "The DAO" is similar to being a shareholder in a company, how is the passive DAO Token holder affected by decisions made by the active participants.  If for example, the Slock.it project is somehow supported by The DAO, but the passive token holder didn't vote on the project, will the passive token holder still reap any benefit from the project which was part of an overall DAO initiative?


texts:
In order to have a list of the instances of the same contracts created, one method used is to emit an event for each instance created.

To query the events(or called logs), we can use web3.eth.getPastLogs, but the dilemma here is that what values to use for its parameter fromBlock and toBlock.

Hence the question: is it scalable to use fromBlock: 0, toBlock: latest?

Also noted that, we could also simply store instances of the same contracts in a array, which would cost more storage space and don't work well with deletions of instances.


texts: Does it make sense to require token value to be anything but negative to prevent hack (more details below...)?

texts:
I was asked to validate a smart contract for a token and a function that puzzled me looks like that:

     function transferFrom(address _from, address _to, uint tokens)

        {
            require(balanceOf[_from] >= tokens);

            if (_from != msg.sender && allowance[_from][msg.sender] != uint(-8523)) {
                require(allowance[_from][msg.sender] >= tokens);
                allowance[_from][msg.sender] -= tokens;
            }

        _transfer(_from, _to, tokens);

}

So the logic is:
If and only if both the sender is different than _from and the approval is for anything other than -8523 then make sure _from has approved message sender to transfer the specified amount of tokens and also subtract them from the allowance.

Which of course leads to the question: is it technically possible for uint to be negative and can someone specify allowance for negative uint which is namely -8523? What if uint is send in hexadecimal or so? Thanx!


texts: When will Ethereum switch to Proof of Stake?

texts:
What is the latest estimation of when will the switch to PoS happen?

Last time the question was asked about 6 months ago, the answer was mid-2016, which is just around the corner. https://stackoverflow.com/questions/33802343/when-will-ethereum-switch-to-proof-of-stake.


texts: Can a transaction that only sends Ether (no contract interactions) generate logs?

texts:
Are there any circumstances in which a simple transactions, sending a value in Ether and nothing else, could generate logs?

What types of possible errors can this type of transaction throw?


texts:
For some reason all my functions are able to return my calls except this one particular function. I call it using Truffle.

async function asdf() {
let contractInstance = await MyContract.at('0x...')
let currentSupply = await contractInstance.getCurrentSupply()
console.log(`Current Supply: ${currentSupply}`);
}

When I return it, it doesn't show up as 0. I put return 1 just to see if it would even return anything, but it's still returning 0

function getCurrentSupply() constant returns (uint256) {
    return 1;
}


texts: Not able to use the web3 deploy code generated by remix

texts:
I am doing a helloworld contract and trying to deploy it using console. i have copied the web3 deploy code generated by remix. i Get error

" Cannot read property 'new' of undefined", new is not a function.

The following is the code

var deployed = helloworldContract.new(
   {
     from: web3.eth.accounts[0],
     data: compiled.contracts[':HelloWorld'].bytecode,
     gas: '4700000'
   }, function (e, contract){
    console.log(e, contract);
    if (typeof contract.address !== 'undefined') {
         console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
    }
 })

The code iam trying to follow is here
https://gist.github.com/NathanMaton/c4b435d1381f196ed4d89a7240874b9a


texts: Do I need a compiled contract just to get the ABI definition?

texts:
Why do I need a compiled version of the contract just to get the ABI definition? Seems like the contract address should be enough.

Im very confused because I am simply trying to run a contract assuming it was made on another computer. It looks like first I need the entire code used to create the contract, which I don't think I would have hypothetically. (I'm literally just following along with the 'greeter' example)


texts: Is there a way to set up an Ethereum wallet without downloading the whole blockchain?

texts: (noobie question) I've tried using Mist and/or Ethereum-Wallet, but the tried to node downloaded > 30GB of blockchain data. Thanks!


texts: Is it normal pending transaction are removed after restart of geth?

texts:
I enter a transaction in the account of my main node to transfer 100 to the account of another node. As I am not mining a pending transactions is created, which I see in my overview including a transaction id/hash. When I stop the geth the process for my main node and restart the geth process the pending transactions has dissapeared and is not in my list anymore. When I start mining nothing is processed, so the 100 is never transferred. Is this correct behavior?

ps. if I do not restart my mainnode and start mining the pending transactions are correctly processed, so the processing of pending transactions itself is not the issue


texts: Are both the eth_newFilter from/to fields inclusive?

texts: Does anyone know if the fields are inclusive? The documentation doesn't specify, and I would assume that they are probably inclusive fields unless otherwise stated, but it would be nice to confirm this.


texts:
I was trying to validate a transaction with some conditions on contract level and was wondering if it was possible in any way to give user feedback in the frontend if a require() fails - aka if it returns false.

Example

In contract:

function validate(x){
    require(x < y) --> outcome = false
}

In frontend: (fictional code)

try
    contract.validate(1);
catch RequireFailed
    //provide user feedback that the require failed.

So my question, is there any way to catch if a require fails, and if so.. How to catch it :)

Thanks in advance!


texts: Question about require keyword in solidity

texts:
Question 1) Let's imagine I have this code

require(userVotes[msg.sender] == 0);
presidents[_id-1].voteCount++;
userVotes[msg.sender] = _id;

so If I make a call to this function, and it doesn't pass the require, what really happens is in metamask it says : contract threw exception. then It still lets me to click on submit button. I'm curious is it still gonna take gas from my account?

Question 2) If the answer from the previous question is yes, then how much? the gas that it took require(userVotes[msg.sender] == 0); doing this command? I am still curious even though there was an exception in require , it still got included in a block and status was fail. What exactly got in block? nothing has changed.

Question 3) I tried to write something like require(userVotes[msg.sender] == 0,"error go away"); I want to catch this in front-end. What i did is after sending the transaction, I used event

.on('error', function(error){
console.log(error);
}

but it was not those words That I wrote in a solidity like a "error go away".

Thank you so much


texts:
contract Sample{

    event Data(uint test) ;

    function test2() {
        Data(msg.gas) ;
    }
}

contract Sample2{
    function try(address addr){
       Sample(addr).test2() ;
       addr.call(bytes4(keccak256("test2()"))) ;
    }
}

How does the method call send gas?
If all of remaining gas was sent to the target, when I use call or just Sample(address).test2()?


texts: Show Pending Transactions when I use metamask or any other platform

texts:
When I try to sendTransaction using mainnet then it always show a pending status. How can I solve this?
I am using web3js and nodejs to send a transaction.


texts: Need help filling in GASPRICE and STARTGAS fields

texts:
I want to create my first transaction. There are several fields I need to fill in.
From ethdocs.org:

Transactions contain:

...

STARTGAS value, representing the maximum number of computational steps the transaction execution is allowed to take

GASPRICE value, representing the fee the sender is willing to pay for gas. One unit of gas corresponds to the execution of one atomic instruction, i.e., a computational step.

STARTGAS:

What value should I put in, if all I want is to send some ether from one EOA(externally owned account) to another? What's the minimum value of STARTGAS field? In other words, how many computational steps does one simple transaction, that is, without triggering a contract, require?
What value should I put in, If I want to trigger a contract? Is it a common practice for a contract creator to provide information on how many computational steps their contract execution requires?
Wouldn't it be less confusing if this field was called MAXSTEPS?

GASPRICE

Does GASPRICE represent a price for one computational step or an overall price for all steps that the transaction may incur?


texts:
I'm experimenting a little bit with the blockchain, I'm currently trying to send from an oracle an address to store on the blockchain through a smart contract. The code (very simple and without checks) is the following:

function addNewContract(address _newAddress) public {
    emit LoggingStrings("New address added!");
    //require(msg.sender == oracleAddress); --> commented because I don't need this at the moment, just playing
    contractAddressArray.push(_newAddress);
    contractNumber++;
    emit NewAddressAdded(_newAddress);
}

I correctly log the _newAddress received in the Node.js console of my DAPP, but this happens only once. I have a routine that every 10 seconds repeats the same code to store a contract on the blockchain:

export const addNewContract = (contractAddress) => {
 return new Promise((resolve, reject) => {
  account().then(account => {
    console.log("Adding new contract: " + contractAddress);
    contract.addNewContract(contractAddress, {from: account}, (err, res) => {
      console.log("New contract added from frontend: " + contractAddress + "  " + err);
      if(err === null){
        resolve(res);
      } else {
        reject(err);
      }
    });
  });
 });
};

I see the console.log prints, but I don't see the events emitted anymore. Is that because that's how it is supposed to work, or am I doing something wrong?

Thanks!

EDIT: Here is the code of the logging

export const update = (callback) => {
  contract.LoggingString((error, result) => callback(error, result));
}

const consume = () => {
  console.log("consumer started");
  update((error, result) => {
    console.log("NEW EVENT");
    console.log("DATA: ");
    console.log(result.args);
    console.log("\n");
  });
};


texts:
I understand the Ethereum is decentralized. But shouldn't there be some primary nodes that host it? Kind of like the internet has primary nodes that originated in universities?

I mean the blockchain. where is it..


texts: How does the delegatecall method work to call to another contract's method?

texts:
I'm trying to figure out how to use the delegatecall method on a contract address in a contract to call a function in a separate contract.

I know Libraries are the higher level interface to use but I want to understand the lower level actions and behaviors.

If someone could provide some good examples of a contract using delegatecall to another contract's functions, that would be greatly appreciated.


texts: how a contract with only interface (no implementation) being called by another contract?

texts:
I have seen several examples, in the example they defined a contract shown below

contract ForeignToken {
    function balanceOf(address _owner) constant returns (uint256);
    function transfer(address _to, uint256 _value) returns (bool);
}

And in another contract, they used the previous defined ForeignToken.

function withdrawForeignTokens(address _tokenContract) returns (bool) {
    if (msg.sender != owner) { throw; }

    ForeignToken token = ForeignToken(_tokenContract);

    uint256 amount = token.balanceOf(address(this));
    return token.transfer(owner, amount);
}

I can't understand how the second contract could use the balanceOf and transfer function, since I assume the ForeignToken doesn't see implement any interface or has its own implementations.

the code example is seen in both

https://github.com/jkeesh/dogetoken/blob/master/contracts/contract.sol

and

https://etherscan.io/address/0xe531642e9bb5d027e9c20e03284287b97919a9a5#code


texts:
I'm creating a dapp. and I need my users on my website to provide public keys. As I am lazy to write a script which generates public/private keys automatically, I want to suggest an idea that they use a public key from metamask. I go to metamask and All i can see is the address and private key. There's no public key at all. Please don't tell me that address and public key are both the same. THat's not true. Address is the 160 hash of public key.

So my question is how do I get the public key from metamask?


texts: vyper no mappings allowed when adding a function to initialize a struct that has a map inside

texts:
Version Information

vyper Version (output of vyper --version): 0.1.0b17+commit.eaa6754
OS: Debian GNU/Linux 10 (buster)
Python Version - 3.6.2
Environment (output of pip freeze):

asttokens==2.0.3
pkg-resources==0.0.0
pycryptodome==3.9.7
six==1.14.0
vyper==0.1.0b17

What's your issue about?

Can't populate a single struct without adding an inside mapping when using a struct declaration variable inside a function

struct Teddy:
    id: uint256
    year: uint256
    component: map(uint256, uint256)

teddies: map(uint256, Teddy)

@public
def __init__():
    self.teddies[0].id = 0
    self.teddies[0].year = 2019

@public
def create_teddy(teddy_name: string[20]):
  teddy: Teddy = Teddy({
        id: 3,
        year: 1922
      })

output:

vyper.exceptions.InvalidType: line 4:15 No mappings allowed for in-memory types, only fixed-size arrays
     3     year: uint256
---> 4     component: map(uint256, uint256)
----------------------^

How can it be fixed?

tip: strange, cleaning the function 'create_teddy' you just compile it... the context is affecting how the compiler 'understand' the struct declaration. I also tried to:

 self.teddies[0] = Teddy({
        id: 3,
        year: 1922
      })

but got a

vyper.exceptions.TypeMismatch: line 15:2 Keys don't match for structs, missing component


texts: Can I start downloading the blockchain, power off the computer, and restart later?

texts:
I have an RPi 3b, the OS is set up and internet works.
I'm a programmer, know how to use basic linux (but I'm not great at being a linux admin), but I'm new to RPi and setting up a cryptocurrency node.
I plan to use geth to set up a ETH node. I'm not mining yet. An RPi does not seem to be great for mining.
I also have a 32GB SDCard and 1TB USB external drive. I have yet to set up the drive for RPi.
Internet speed will be at least 35mbps over wifi for the RPi 3b. Thank goodness for 4 USB ports on that thing!

I'll be changing my ISP on Saturday. Can I start downloading the blockchain today (Wed), power off the RPi, and continue downloading the blockchain after I get my new ISP and modem/router?

Thank you! I appreciate your help.


texts: Solidity Documentation vs Grammar, which one is the most correct?

texts:
I was using the solidity grammar specification https://github.com/ethereum/solidity/blob/develop/docs/grammar.txt to write a parser in Smalltalk. After coding a first version of the parser, I started to test examples from the solidity documentation https://media.readthedocs.org/pdf/solidity/develop/solidity.pdf. I was surprised that many examples did not work, mostly because the documentation is not consistent with the grammar specification.

I am just going to show one simple example of these inconsistencies. In the grammar, string literals are written by double quotes only (line 125). On the other hand, the documentation specifies that string literals are written with either double or single quotes (page 41). This is just one of many inconsistencies I found by a quick look at the documentation.

So, my question is which one is the most correct? The grammar or the documentation? I need to know which one I must take into account to write a parser that can handle solidity.

Edit: Here is the current Pharo/Smalltalk Solidity Parser, in case anyone wants to see. https://github.com/hscrocha/SmaCC-Solidity

Edit 2: I saw that a few days ago the Solidity grammar was updated on github. This update did not fix the inconsistencies I found between the grammar and documentation.

Thanks and best regards,

Henrique


texts:
My blockchain development background is in Bitcoin, but it now seems to me that the most dynamic and interesting blockchain platform is Ethereum.

In my quest to grok the Ethereum protocol I'm searching for "hooks" to Bitcoin to ground my understanding. What I mean by that is, I'm trying to find analogous concepts that I can use to anchor my understanding.

The most fundamental element of the Bitcoin blockchain is the UTXO set, this is also (according to my understanding) one of the most salient differences between Bitcoin and Ethereum, that is- the fact that Ethereum operates on a model of Externally Owned Accounts (EOAs) and Contract Accounts as opposed to transactions.

What I'd like to do is locate where this information lives on the geth client and just check it out, examine how it interoperates with the rest of the codebase- this would go a long way toward the furtherance of my comprehension of Ethereum.

I'm open to any pointers, tips, if you feel this question or any of the points I've expressed is/are fundamentally misguided I'd like to hear about it.


texts: How to migrate parity from one system to another

texts:
I have parity installed and running in computer1.
Suppose I need to access my wallet from computer2, what should be done?


texts:
I'm experimenting on an automatic ethereum wallet. But I have some problems. The first process is successful but it's error message the second process: Known transaction
how do I solve this problem?
Edit = Solved


texts: Need to create WS Infura connection with JWT

texts: Im developing a web app in which I connect the client with infura using ws and the project id, but I also need to use JWT in order to add an extra layer of security. There are explanations in infura documentation about how to include JWT when making https calls, but none when using ws. Which is the proper way to secure using a jwt?


texts:
I spun up a few node ~30 minutes ago and I'm not able to make a curl request, not sure if this is normal behaviour during initial sync or if something is somehow misconfigured.

Request:

curl -X POST --header 'Content-type: application/json' --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' localhost:8545

Response:

curl: (56) Recv failure: Connection reset by peer


texts: Contract is being mined but not successfully

texts:
struct list{
       string typo;  // name of dataset
       address head;
   }

  mapping (string => list) _list;

 struct node{
     address add;
     address next;
 }

 mapping (string =>mapping(address=>node)) _node;

 function add(string _typo1,address _addr){
        addToList(_typo1);
        addToNodes(_typo1 , _addr);

}

function addToList(string _typo){
    _list[_typo].typo = _typo;
}

function addToNodes(string _typo,address _addr){

    _node[_typo][_addr].next = _addr;
    _node[_typo][_addr].add =_addr;

}

Above is the code snippet of the contract I have been trying to make work but somehow I am not getting anywhere. If I call only on function either addToList() or addToNodes() then it works fine but if I call both the same time it won't work.

PS: I am using private testnet here.

gas limitation is not an issue here I tried to provide maximum gas but it won't work.


texts: By what mechanism are ASIC-based miners made less favourable?

texts:
Bitcoin mining is dominated by miners that use ASIC-based mining equipment, thereby skewing the mining rewards in favour of those able to afford large numbers of ASIC mining rigs.

Ethereum prevents this, meaning miners can still expect rewards even if they're using CPU- and GPU-based equipment.

How does Ethereum make ASIC mining less favourable?


texts:
I am able to test with truffle and successfully assert that the values of my deployed contract are correct, but in both testrpc and a private geth the actual values in my contract are empty.

I initialize my contract early on

this.contract = this.web3.eth.contract(this.abi);

then later via the GUI is create a new Contract:

this.deployedContract = this.contract.new(name, {from: contractAddress, gas: 3000000, data: this.byteCode}, (contractError, contractResult) => {
    if (!contractError && contractResult) {
        console.log('contract address: ' + contractResult.address);
        console.log('contractResult: ' + contractResult);
    }else if(contractError){
        console.log("contractError: " + contractError);
    }
});

The contract is mined and I receive an address that I lookup. In both the geth console and via the JavaScript API I see the result of name = 0x0000000000000000000000000000000000000000000000000000000000000000

name is bytes32

In the geth console I lookup the transaction and see that cumulativeGasUsed: 1109932 which is less that the 3000000 I declared upfront.

I also notice that the gas was not taken off my account.


texts: Getting return data from a transaction hash using Nethereum

texts:
I'm using Nethereum to call a non-view/non-constant function of a smart contract that modifies the state of the smart contract and returns a boolean value.

The result of submitting this transaction is a transaction hash.

Is there a way in Nethereum to then use the returned transaction hash to get the boolean value returned by the smart contract method? I have found ways to do this for view functions, but can't find anything on non-view functions.


texts: Rinkeby does not generate the same outputs as Remix JVM

texts:
I am getting different results when I run my Test case on JVM and Rinkeby. Surprisingly, Rinkeby is the network not acting as expected. The focus is on delegateCall and changing ownership of a contract via a fallback function. (It's exercise 6 on the Ethernaut challenge Ethernaut)

Update:  When I modified the Ethernaut code to work with 0.7.4 Rinkeby
behaved as expected.  This implies that the current Version of Rinkeby
will not run code compiled with ^0.5.0 correctly and old contracts
will stop functioning as expected?  Is my reasoning correct?  Thank you

When I call the Delegation Contract's fallback function with call(abi.encodeWithSignature("pwn()")); In JVM it changes the Delegation Contract's Owner but it does nothing when run on Rinkeby. In Rinkeby, the Owner remains unchanged.
I uploaded a video on YouTube: JVM vs Rinkeby to show the different behavior.  Based on my understanding JVM is behaving correctly but Rinkeby is not.
Thank you for an explanation of why the behavior is different.
Code from Ethernaut Exercise 6:  Delegation
pragma solidity ^0.5.0;

contract Delegate {

  address public owner;

  constructor(address _owner) public {
    owner = _owner;
  }

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

contract Delegation {

  address public owner;
  Delegate delegate;

  constructor(address _delegateAddress) public {
    delegate = Delegate(_delegateAddress);
    owner = msg.sender;
  }

  function() external {
    (bool result, bytes memory data) = address(delegate).delegatecall(msg.data);
    if (result) {
      this;
    }
  }
}

My code that calls Delegation's fallback function
// SPDX-License-Identifier: MIT

pragma solidity 0.7.4;

contract MyDelegateCall {

    address public contractAddress;

    // Assign the address of the Contract
    constructor(address _contractAddress) payable {
        contractAddress = _contractAddress;
    }

    function changeOwner() external {

        (bool success,) = contractAddress.call(abi.encodeWithSignature("pwn()"));
        require(success);

    }

}


texts: How to connect these **Remix - kovan - parity**?

texts:
I have been trying to connect deploy a smart contract from remix onto kovan chain via parity but kept on showing even after trying with all the rpc flags.
if possible please throughly explain the procedure and theory behind it.


texts: Why my node running testnet has blocknumber greater than the blocknumber in https://ropsten.etherscan.io/

texts:
Why my node running --testnet has blocknumber greater than the blocknumber in https://ropsten.etherscan.io/

my node has above 4000000 blocks but ropsten.ethersca.io showing 3000000 something blocks

  I used command geth --rpcapi personal,db,eth,net,web3 --rpc —testnet


texts: Fetch data from blockchain public network

texts:
I have gone through the docs of ethereum and truffle as well. I had created a contract for more understanding related to contracts and its compilation and deployment on local network.

But I have specific requirement that I want to fetch some sort of data from blockchain public network and want to display it on website and generate reports based on that data.

How can I get the use data from 3rd party contract. Please refer below example to understand the scenario.

So, how this can be done w/o creating a contract ?

Eg. I want to get latest NASDAQ share price ups and downs of the current day and want to generate a chart dynamically on website.


texts: Transfer operation,why the gaslimit is not the same

texts: Everything else is the same, the address is different, why the gaslimit is not the same?


texts: What is the order and concurrency behavior of multiple calls to a contract in a single transaction?

texts:
Suppose a contract has three call APIs that have side effects.

What's the behavior if I try to:

Call all three APIs from one address (i.e. issue three transactions if from nodejs).  Are all three mined simultaneously?  In what order?
Same question, but three APIs are called from three different addresses?


texts: How to decode data parameter under logs in transaction receipt?

texts:
I went through many questions but I couldn't get my answer.

web3 version -- 0.20.6

According to documentation event's parameters which are not indexed store in data parameter under logs. I want to iterate over blocks and store data from events.
How can I decode the "data" parameter?

I went through this link https://codeburst.io/deep-dive-into-ethereum-logs-a8d2047c7371 but unable to understand how he decoded that data.

event Record(string location, uint256 temperature);

function recordData(string location, uint256 temperature) public {
    emit Record(location, temperature);
}

Input given: London, 25

data: "0x0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000064c6f6e646f6e0000000000000000000000000000000000000000000000000000"

topic:"0xaa39dce7cd051e04c98757533bc6e3eb213cccafa31717ca09ef4dde19f123f5"

I ran the same parameter transaction in remix and logs don't have any data parameter. In receipt there is input parameter. The input parameter must be the parameter which I passed, am i correct?

input: "0xbc820aa40000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000001d00000000000000000000000000000000000000000000000000000000000000064c6f6e646f6e0000000000000000000000000000000000000000000000000000"

Thanks for the help in advance!


texts: When we create an account in the Ethereum main network, how does the protocol guarantee the unique address of an account? Since even if we are not connected to the network we can create an account, is there a possibility of two accounts getting the same address? Is the account information kept in the blockchain ?


texts: Getting Error:VM Exception while processing transaction: revert', 'code': -32000. when deploying to Ganache using Web3.py


texts: what does external means ? how can i call the test2() inside my class

texts:
pragma solidity ^0.5.7;

    contract Test {
        function test() public view  returns (uint){
             return 10*10;
        }

        function test2() external view  returns (uint){
             return 10*2;
        }
    }

1) according to my knowledge external means we cannot call the function inside class but how i am able to call it ?

Can any one please explain? This is my output which i can see in remix console.

 status     0x1 Transaction mined and execution succeed
 transaction hash   0x0e3c9b7c67387cdcf3a4d2001323e83b20f64dbe12abb6e81700ccc6cc844454
 from   0xca35b7d915458ef540ade6068dfe2f44e8fa733c
 to     Test.test2() 0x0dcd2f752394c41875e259e00bb44fd505297caf
 gas    3000000 gas

 transaction cost   21463 gas
 execution cost     191 gas
 hash   0x0e3c9b7c67387cdcf3a4d2001323e83b20f64dbe12abb6e81700ccc6cc844454
 input  0x66e...41cb7
 decoded input  {}
 decoded output     {
    "0": "uint256: 20"
}
 logs   []
 value

0 wei


texts: Is it possible to use a specific version of web3 with Metamask?

texts:
I'm testing out Metamask under Chrome. I see that current Metamask (version 4.5.3) injects web3 version 0.20.3. Since web3 has a long history of volatile API, I would prefer to always stick to a specific version (possibly 1.0), independently of the one provided by Metamask.

In my understanding of how Metamask works, this should not be possible and, indeed, I've found nothing googling out this issue. Anyway, I wanted to ask the community, maybe I'm overlooking something.

Thanks.


texts: how can I return a hash value using keccak256?

texts:
I have this solidity function below. It is supposed to return the hash of a given data, but instead I get this: 0x

 function hashData (bytes32 data) public constant returns (bytes32) {
      var hash =  keccak256(data);
      return hash;
  }


texts:
I am syncing the blockchain with geth and I type "eth.syncing" to check the progress.  I notice that "highestBlock" does not change.  It's the same as it was when I started syncing a few days ago.

I assume it refers to the highest block at the time I started.  So my question is what significance that has.  Will the RPC start to work when I catch up to "highestBlock" or only when I catch up to the actual, current highest block?


texts: Sending extra data beside or inside a new smart contract

texts:
I'm doing a research about Ethereum smart contracts security and I need to send some extra data (for example some json data) beside or inside a new smart contract when I'm deploying that contract on the network.
Is it possible and how can I do it?


texts: What is the different between P2P server and Node?

texts:
I checked go-ethereum code and I see 2 files:

/go-ethereum/p2p/server.go:

type Server struct {
    // Config fields may not be modified while the server is running.
    Config

    // Hooks for testing. These are useful because we can inhibit
    // the whole protocol stack.
    newTransport func(net.Conn) transport
    newPeerHook  func(*Peer)

    lock    sync.Mutex // protects running
    running bool

    nodedb       *enode.DB
    localnode    *enode.LocalNode
    ntab         discoverTable
    listener     net.Listener
    ourHandshake *protoHandshake
    lastLookup   time.Time
    DiscV5       *discv5.Network

    // These are for Peers, PeerCount (and nothing else).
    peerOp     chan peerOpFunc
    peerOpDone chan struct{}

    quit          chan struct{}
    addstatic     chan *enode.Node
    removestatic  chan *enode.Node
    addtrusted    chan *enode.Node
    removetrusted chan *enode.Node
    posthandshake chan *conn
    addpeer       chan *conn
    delpeer       chan peerDrop
    loopWG        sync.WaitGroup // loop, listenLoop
    peerFeed      event.Feed
    log           log.Logger
}

AND

/go-ethereum/node/node.go

type Node struct {
    eventmux *event.TypeMux // Event multiplexer used between the services of a stack
    config   *Config
    accman   *accounts.Manager

    ephemeralKeystore string         // if non-empty, the key directory that will be removed by Stop
    instanceDirLock   flock.Releaser // prevents concurrent use of instance directory

    serverConfig p2p.Config
    server       *p2p.Server // Currently running P2P networking layer

    serviceFuncs []ServiceConstructor     // Service constructors (in dependency order)
    services     map[reflect.Type]Service // Currently running services

    rpcAPIs       []rpc.API   // List of APIs currently provided by the node
    inprocHandler *rpc.Server // In-process RPC request handler to process the API requests

    ipcEndpoint string       // IPC endpoint to listen at (empty = IPC disabled)
    ipcListener net.Listener // IPC RPC listener socket to serve API requests
    ipcHandler  *rpc.Server  // IPC RPC request handler to process the API requests

    httpEndpoint  string       // HTTP endpoint (interface + port) to listen at (empty = HTTP disabled)
    httpWhitelist []string     // HTTP RPC modules to allow through this endpoint
    httpListener  net.Listener // HTTP RPC listener socket to server API requests
    httpHandler   *rpc.Server  // HTTP RPC request handler to process the API requests

    wsEndpoint string       // Websocket endpoint (interface + port) to listen at (empty = websocket disabled)
    wsListener net.Listener // Websocket RPC listener socket to server API requests
    wsHandler  *rpc.Server  // Websocket RPC request handler to process the API requests

    stop chan struct{} // Channel to wait for termination notifications
    lock sync.RWMutex

    log log.Logger
}

What are the differences in purpose between these two?

Thank you.


texts: populus OSError: [Errno 2] No such file or directory

texts:
When trying:

$populus compile

Get:

OSError: [Errno 2] No such file or directory

Tried:

Tried to install missing dependencies as described here and installed solidity compiler as well - same result. And same result under sudo or virtualenv. populus init works as expected.

Related issue at GitHub.

Full console output:

============ Compiling ==============
> Loading contracts from: /home/petr/Projects/populus-tests/contracts
Traceback (most recent call last):
  File "/usr/local/bin/populus", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/populus/cli/compile_cmd.py", line 46, in compile_contracts
    result = compile_and_write_contracts(project_dir, *filters, optimize=optimize)
  File "/usr/local/lib/python2.7/dist-packages/populus/compilation.py", line 161, in compile_and_write_contracts
    **compiler_kwargs
  File "/usr/local/lib/python2.7/dist-packages/populus/compilation.py", line 94, in compile_project_contracts
    **compiler_kwargs
  File "/usr/local/lib/python2.7/dist-packages/populus/compilation.py", line 81, in compile_source_file
    **compiler_kwargs
  File "/usr/local/lib/python2.7/dist-packages/populus/solidity.py", line 52, in solc
    stderr=subprocess.PIPE)
  File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory


texts: how to deploy a smartcontract on the mainnet

texts:
I used truffle to create a smartcontract, and then deployed it on Rinkeby (using a local geth node) with this command. It works well.
truffle migrate --network rinkeby
The smartcontract is an updated version of this sample:
https://medium.com/cryptronics/ethereum-development-guide-part-1-ad0c77c3683f
Now I'd like to deploy the smartcontract on the mainnet:
$ geth --syncmode light --rpc --datadir=$HOME/mainnet --nousb --allow-insecure-unlock
$ geth --nousb account new --datadir="$HOME/mainnet/" --password ./account-password.txt
$ truffle migrate --network mainnet

"Migrations" exceeded the block limit (with a gas value you set).
   * Block limit:  5000 (0x1388) * Gas sent:     4000000 (0x3d0900)  * Try: + Sending less gas.

I changed truffle-config.js to use a bas of 10000. By the way, how much ETH does it costs currently to deploy a simple contract, more or less? what gas should I define?
$ truffle migrate --network mainnet
"Migrations" -- Returned error: getDeleteStateObject (1422d7ccc0d1b857e00bef1c265b8907071434d9) error: no suitable peers available.

It seems that's not trivial to set-up a geth node. So I tried using a free development node from quiknode.io. But they do not support deploying a contract using truffle from the command line (only from its front end client Drizzle).
How can I deploy the smartcontract to mainnet?
I prefer command line tools, rather than graphical interfaces. However, both solutions are appreciated.


texts: Trying to deploy a contract on Kovan testnet with Parity and it's waiting forever for a confirmation

texts:
It says it's waiting for a contract deployment transaction receipt and it just sits there and waits. It never moves to the completed stage.

It was working fine for me a week ago. What's going on?


texts: geth --ethash.dagsondisk 1 - option ignored?

texts:
I have configured a private network in which I can assign different roles to different nodes (machines).

Before starting the test I generate the DAG for the block number 0 with the command:

 geth makedag 0 myethashdir

And so I generate the dag for the epoch 0 (i.e. from block 0 to block 30000). My problem is that whenever I start the miner(s), they try to generate the DAG for epoch 1.
I read in the geth help message that there is the additional option --ethash.dagsondisk which's default value is 2. Therefore I pass to geth the option --ethash.dagsondisk 1, but geth tries to generate the new DAG.

Since I run my test on cheap HW (and do not want to use PoA, I need to work with PoW for a University project). I wonder if there is the possibility to prevent geth to generate the second DAG which is a time consuming task.

A possible workaround, that I want to possibly avoid is to generate two DAGs with the geth makedag command.

I'm using geth v1.8.11-stable

UPDATE

According to this Ethereum wiki entry "Dagger Hashimoto" the dag for this epoch and for the next one should be generated to avoid slowdowns when we are switching to a new epoch:

  In a full client, a double buffer of 2 DAGs produced by the above formula is used. The idea is that DAGs are produced every epochtime number of blocks according to the params above. The client does not use the latest DAG produced, but the previous one. The benefit of this is that it allows the DAGs to be replaced over time without needing to incorporate a step where miners must suddenly recompute all of the data. Otherwise, there is the potential for an abrupt temporary slowdown in chain processing at regular intervals and dramatically increasing centralization and thus 51% attack risks within those few minutes before all data is recomputed.


texts:
I've been trying to start mining on an Ubuntu 14.04 machine for two days now but I just can't make it work; there are no error messages or anything but the behaviour is very weird:

I've tried mining with geth via miner.start(). This is what happens:

> miner.start()
true
> miner.hashrate
undefined
> miner
{
  makeDAG: function(),
  setEtherbase: function(),
  setExtra: function(),
  setGasPrice: function(),
  start: function(),
  startAutoDAG: function(),
  stop: function(),
  stopAutoDAG: function()
}

Why is miner.hashrate undefined? Also, if I use ethminer like this:
geth --rpc --rpccorsdomain localhost 2>> geth.log and then start ethminer in another terminal. This is the output of ethminer:

miner  19:35:55.415|ethminer  Getting work package...
JSON-RPC problem. Probably couldn't connect. Retrying in 1...
miner  19:35:57.421|ethminer  Getting work package...
miner  19:35:57.424|ethminer  Grabbing DAG for #f6a1824c…
miner  19:36:06.043|ethminer  Got work package:
miner  19:36:06.043|ethminer    Header-hash: cf2be73851ae76910bc50b75fa3c2766c4c4e528b8fbc23a9a26c68cc3dbb566
  ℹ  19:36:06.043|ethminer  Loading full DAG of seedhash: #0823bb39…
miner  19:36:06.043|ethminer    Seedhash: f6a1824c2bc745217912823098bb6f07de2b0295d30355934a247b1e87931763
miner  19:36:06.043|ethminer    Target: 000000000006f5ba22dcdac38f1d36394c6ffcb84826f3da17af548ce69ad50c
miner  19:36:06.546|ethminer  Mining on PoWhash #cf2be738… : 0 H/s = 0 hashes / 0.5 s
  ℹ  19:36:14.783|ethminer  Full DAG loaded
miner  19:36:15.283|ethminer  Mining on PoWhash #cf2be738… : 0 H/s = 0 hashes / 8.736 s
miner  19:36:15.785|ethminer  Mining on PoWhash #cf2be738… : 0 H/s = 0 hashes / 0.502 s
miner  19:36:16.287|ethminer  Mining on PoWhash #cf2be738… : 0 H/s = 0 hashes / 0.501 s
miner  19:36:16.790|ethminer  Mining on PoWhash #cf2be738… : 0 H/s = 0 hashes / 0.503 s
miner  19:36:17.293|ethminer  Mining on PoWhash #cf2be738… : 0 H/s = 0 hashes / 0.503 s
miner  19:36:17.796|ethminer  Mining on PoWhash #cf2be738… : 0 H/s = 0 hashes / 0.502 s
miner  19:36:18.298|ethminer  Mining on PoWhash #cf2be738… : 0 H/s = 0 hashes / 0.501 s
miner  19:36:18.800|ethminer  Mining on PoWhash #cf2be738… : 0 H/s = 0 hashes / 0.502 s
miner  19:36:19.302|ethminer  Mining on PoWhash #cf2be738… : 0 H/s = 0 hashes / 0.502 s
miner  19:36:19.806|ethminer  Mining on PoWhash #cf2be738… : 0 H/s = 0 hashes / 0.503 s

If I run it in one line like this: geth --rpc --rpccorsdomain localhost 2>> geth.log & ethminer The result is:

miner  19:37:31.513|ethminer  Getting work package...
  ✘  19:37:31.515|ethminer  Failed to submit hashrate.
  ✘  19:37:31.515|ethminer  Dynamic exception type: jsonrpc::JsonRpcException
std::exception::what: Exception -32003 : Client connector error: libcurl error: 7 -> Could not connect to http://127.0.0.1:8545

JSON-RPC problem. Probably couldn't connect. Retrying in 1...
miner  19:37:33.515|ethminer  Getting work package...
  ✘  19:37:33.516|ethminer  Failed to submit hashrate.
  ✘  19:37:33.516|ethminer  Dynamic exception type: jsonrpc::JsonRpcException
std::exception::what: Exception -32003 : Client connector error: libcurl error: 7 -> Could not connect to http://127.0.0.1:8545

JSON-RPC problem. Probably couldn't connect. Retrying in 1...
miner  19:37:35.517|ethminer  Getting work package...
  ✘  19:37:35.518|ethminer  Failed to submit hashrate.
  ✘  19:37:35.518|ethminer  Dynamic exception type: jsonrpc::JsonRpcException
std::exception::what: Exception -32003 : Client connector error: libcurl error: 7 -> Could not connect to http://127.0.0.1:8545

Can anyone explain to me what is going on here and how to fix this?

PS: These are the versions:
geth: 1.4.5-stable
ethminer version 1.2.5, Build: Linux/g++/Interpreter/RelWithDebInfo


texts: How do I get the latest block using etherscan api?

texts:
I'm trying to get the latest block (it's height) using Ethereum Developer APIs of etherscan.

For example, I can get it from blockcypher using the following URL:
https://api.blockcypher.com/v1/eth/main

(see the field "height")

Couldn't find a way to get this data from etherscan, is there and I'm missing it?


texts: How to retrieve the logs of transactions on one contract and multiple addresses

texts:
I have an application which should work as an exchange. Customers have their own Ethereum addresses on my Geth server, and they might receive ERC20 Tokens on them. I need to fetch the incoming transaction data for multiple accounts.
I've used eth_getLogs() like this:

eth_getLogs(
   '0x9589a2',
   'latest',
   '0xdac17f958d2ee523a2206206994597c13d831ec7',
   [null, null, '0x000000000000000000000000825F80D4c229f56bf1275C9592223a9d921329E2']
);

Now, I have some questions:

What are the 1st and 2nd parameters in array for? I found this sample code and used it, but unfortunately I couldn't find the appropriate document for it.
I added some 0000... before address regarding to the example I found. It works now, but what is the exact value here and what is its correct format?
And the main question: How can I do searches at once on multiple accounts for each ERC20 Token?


texts: Cannot connect to Ethereum client using truffle/ganache

texts:
I first started ganache and see in the log that "Ganache started successfully" with the RPC Server set as:  HTTP://127.0.0.1:7545
While running truffle migrate command, I've received the following message:
Could not connect to your Ethereum client with the following parameters:
    - host       > 127.0.0.1
    - port       > 7545
    - network_id > *
Please check that your Ethereum client:
    - is running
    - is accepting RPC connections (i.e., "--rpc" option is used in geth)
    - is accessible over the network
    - is properly configured in your Truffle configuration file (truffle-config.js)

Here is my truffle-config.js file:
require('babel-register');
require('babel-polyfill');
require('dotenv').config();

module.exports = {
  networks: {
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*" // Match any network id
    },
  },
  contracts_directory: './src/contracts/',
  contracts_build_directory: './src/abis/',
  compilers: {
    solc: {
      optimizer: {
        enabled: true,
        runs: 200
      }
    }
  }
}

I'm wondering if there's any way to check if the issue is the client can't accept RPC connections or if it's not accessible over the network as I don't think it's suggestions 1 and 4.


texts: ethers.js pass address as parameter. How to encode?

texts:
My question is pretty simple
I'm trying to call a function in my smart contract from ethers.js
I just need to set a variable of type "address" in my contract.
Code:
//solidity
function setTokenX(address _tokenX) public {
    tokenX = _tokenX;
}

//js

tokenX = '0x3fdaf6c54eba05edebed44c4f986f49a5de55113';

await mycontract.setTokenX(tokenX);

It works a weird way for some reason. On Etherscan my variable is displayed as
0x361d47ce0000000000000000000000003fdaf6c54eba05edebed44c4f986f49a5de55113

While in the in javascript I send the parameter as a string. What's the catch? Should I encode it and then abi.decode in solidity? How to do this with ethers.js?


texts: How to test RPC port for accepting traffic

texts: I have a fully synced node running in my personal computer with kovan testnet. I want to test if my RPC port is accepting traffic or not. I am using parity as a system service.


texts: Why weren't ICO's possible before cryptocurrencies?

texts: ICO’s are used today to distribute and fund decentralized products. I’m curious why companies, before Bitcoin, could not have launched the sale of their own centralized currencies or reward points of some sort. If it were technically feasible before in a centralized form, why did we never see such a thing?