texts: Do I really need to sync Geth even if I already have synced Ethereum Wallet?

texts:
I already have Ethereum Wallet installed and synced, fully working. But I am working on a cryptocurrencies-based project and I needed the JSON-RPC, so I installed Geth.

However Geth seems not to be using Ethereum Wallet's downloaded blockchain and wants to sync again.

Machine Info

Mac OS X 10.12.6

Ethereum Wallet 0.8.10 (I had to downgrade from 0.9.0 because of this bug)

Geth 1.6.7-stable

Steps to reproduce

Run Ethereum Wallet, wait until it syncs, choose it to run on the testnet (Ropsten), get some funds on the main account.
Close Ethereum Wallet and run Geth by using the command line:

geth --networkid 3 --rpc --rpccorsdomain "*"

Open Ethereum Wallet. Notice that the balance is 0 and the initial block is 0.
Run the following Javascript in the console of a page where web3 is loaded:

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

web3.eth.accounts
> ['0xFa737A47e7AfE7910Faa0b86ebc2C2b2FbEFAc2b']

web3.eth.defaultAccount = web3.eth.accounts[0];

web3.version.network
> "3"

web3.fromWei(web3.eth.getBalance('0xFa737A47e7AfE7910Faa0b86ebc2C2b2FbEFAc2b'),'ether').toString(10)
> "0"

web3.eth.getBlock("latest").number;
> 0

Expected results

On the steps 3 and 4, the balance shouldn't be 0, as there are funds on that wallet.

Therefore:

Is it possible to make Geth to use Ethereum Wallet's downloaded blockchain data, instead of downloading a duplicated copy again?
Is it possible to make Ethereum Wallet (Mac OS X version) serve the JSON-RPC through its internal Geth, so I don't need to use the separatedly-downloaded Geth?


texts:
function burn(uint tokens) override external returns (bool success) {
        balances[msg.sender] = balances[msg.sender].sub(tokens);
        _totalSupply = _totalSupply.sub(tokens);
        emit Transfer(msg.sender, address(0), tokens);
        return true;
    }

just wondering what overrride actually does and when to use it


texts: Truffle Migrate with my own ethereum Network

texts:
I am developing ethereum contract. so i have setup ethereum server. i used this

geth --rpc console --datadir "ethdata" --networkid xxxxx --nodiscover --rpcaddr "xx.xx.x.xxx" -rpcport 8545 --rpccorsdomain * --rpcapi "web3,net,personal,eth" attach http://0.0.0.0:8545 mygenesis.json
 to run ethereum server.

Ethereum server is working fine.

then i setup truffle with testrpc which is working fine. i try to truffle with my etherum server. it displays like following

Expecting result:

finish migrate.

Actual result:

#truffle migrate
Running migration: 1_initial_migration.js
Deploying Migrations...

nothing happened for a long time


texts: possible reason for insufficient funds for gas * price + value

texts:
I have been researching this whole day, but I have a web3 instance, (the Web3 is version 1.0.0)

const web3 = new Web3(new Web3.providers.HttpProvider('https://ropsten.infura.io/<myKey>'));

Later I used it to sign a transaction (which is a call to a contract). I have

const contract = new web3.eth.Contract(abiArray, contractAddr);
var func = contract.methods.myMethod('foo', 'bar')

var encodedFunc = func.encodeABI();

var tx = {
    from: ownerWallet,
    to: contractAddr,
    gas: web3.utils.toHex(1000000), //1m, also tried string '1000000'
    gasPrice: web3.utils.toHex(20000000000), //20gwei, also tried string '20000000000'
    data: encodedFunc
}

//might just be unnecessary three lines
const account = web3.eth.accounts.privateKeyToAccount(ownerPrivate)
console.log(account)
web3.eth.getBalance(ownerWallet).then(console.log)

const signed = await web3.eth.accounts.signTransaction(tx, ownerPrivate)
var trans = web3.eth.sendSignedTransaction(signed.rawTransaction)

Error is like,

Error: Returned error: insufficient funds for gas * price + value

Everything seems quite normal. What could be the issue?


texts: What is the right way to store and retrieve a contract address?

texts:
Suppose I create a new contract with:

web3.eth.contract(abi).new({ data: code }, (err, contract) => { ... })

Inside the callback I am able to get the contract.address of the new contract. I can then successfully call that contract.

I'm just trying to understand what the right way to store this address should be? I am leaning towards storing it into a DB which my system will load at startup.

Or is there a better way? I guess I was expecting a DNS-esque sort of thing where I could give my contract a unique name and version and it would map to the address. Does this not exist? Does putting the address into a DB during a migration step sound reasonable?


texts: What was the Rebase Bug on the YAM smart contract?

texts:
Smart contracts have great power to absorb money like a black hole. Almost 400$ Million is gone due to a bug in the smart contract of YAM. What was the bug that cause all the destruction?
=> Could there be any handle mechanism by Solidity or some kind of approval mechanism before deploying smart contract?

Some high-level information:

We have found a bug in the rebasing contract, please read below. All
funds in staking contract are safe, as this is an unrelated part of
the protocol. User YAM balances are also unaffected. — Yam Finance
(@YamFinance) August 12, 2020

In the case of this bug, an excess of YAM tokens would be printed,
causing a larger supply to dilute the intended price, meaning that the
value of each YAM token would decrease — hurting investors.
Additionally, this larger supply of YAM tokens would make it more
difficult for the community to contribute to governance, as more YAM
tokens would be needed to make changes. This would make the code
unable to be modified, so bugs such as these would persist.


texts: Balance is always 0 in created account via web3js

texts:
I have the following code snippet which is supposed to create an account, make a transaction to that account, and get the balance then. I'm using Ganache as the provider.

However, no matter how many times I execute the code, the balance of the created account is always 0, whereas the balance of the Ganache account gets reduced every time. What could be wrong here?

const express = require("express");
const Web3 = require("web3");
const web3provider = "http://localhost:7545"; //Ganache
const web3 = new Web3(new Web3.providers.HttpProvider(web3provider));
const app = express();

//generate private key
const privateKey = web3.eth.accounts.create().privateKey;

// create account
const account = web3.eth.accounts.privateKeyToAccount(privateKey);
console.log(account.address); //logs the address of the created account

// make a transaction
web3.eth.sendTransaction({
  from: "0x7693e8197c20a665be2e1f20685dA7e65B91feE4", //Ganache address
  to: account.address,
  value: 10000000000000000,
});

// get balance
web3.eth.getBalance(account.address).then((result) => {
  console.log(result);
  /*
  this always logs 0, but if I substitute with the Ganache address,
  it logs the balance properly
  */
});

const PORT = process.env.PORT || 5000;

app.listen(PORT, () => console.log(`Server started on port ${PORT}`));


texts:
I'm having some trouble wrapping my mind around the creation of ERC20 faucets. How exactly is this done? I have created a token (https://ropsten.etherscan.io/token/0x90de67a867b18535ad558fec0c418921340ffc91?a=0x18c59adbf99be137b3eeaffd84b083fd623a4c36) but I'm not sure how I would go about distributing tokens utilizing a faucet. This is purely for testing purposes but I'd like to be able to give away diminishing values of this test token based on the previous amount given out.

I'm assuming I'll need to use Transfer(), which I used in my getFromFaucet() function, but I'm extremely confused as to how to even get these tokens to be sent to a different address.

function getFromFaucet(address _to) returns (bool success) {
        uint256 giveaway_value;

        if (previous_giveaway == 0){
            giveaway_value = starting_giveaway;
            previous_giveaway = starting_giveaway;
        }
        previous_giveaway = previous_giveaway / 2;

        if (balances[msg.sender] >= giveaway_value){
            balances[msg.sender] -= giveaway_value;
            balances[_to] += giveaway_value;
            Transfer(msg.sender, _to, giveaway_value);
            return true;
        }
        else return false;
    }

Like, how do I call this getFromFaucet and pass the address to it? I'm planning on distributing from a website.

Thanks in advance!


texts: Ganache get the mnemonic of all accounts

texts:
When I install the Ganache a mnemonic is shown at the user interface.

I think that the mnemonic which is shown in Ganache UI is for first account (account[0]).

As a test I open the MetaMask select restore from seed feature enter above mnemonic and I get the account that its public and private key are same as account[0] which is shown in Ganache

So, is it possible that I can have the mnemonic for other accounts.

A syntax is shown in front of mnemonic that is m/44'/60'/0'/0/account_index, I think there must be a way to change account_index here but no luck


texts: How Come An Address Created On ETH Appears On ETC?

texts:
Just trying to get my head around this.

I thought we forked?

How is it that a transaction made in:

geth --fast console 2>>~/geth.log

also appears in:

geth --fast --oppose-hard-fork console 2>>~/geth.log

I can see the address created using:

geth account new in both

https://etherscan.io/address/0x

and

http://classic.aakilfernandes.com/#/address/0x


texts:
I'm struggling to figure out how to add a filter to allEvents requests.

My current code:

const contract = getState().web3Reducer.get('contract');
          contract.getPastEvents('allEvents', {
              filter : { owner: '0x3333333....333' },
              fromBlock: currentBlock - 5760,
              toBlock: 'latest'
          }).then(transactions => dispatch(eventsFetched(events)));

It seems like web3 doesn't support such call, any idea how to get around this? I could fetch all events and filter in Javascript, but feels very wrong.


texts: Can my eth adress be found through ens domain?

texts:
I have squaded several .eth domains and have since released them, now, I dont want them to be associated with my address. 1. They still pop up when I enter my ens manager, can I somehow make them dissapear and not be linked to my address?
2. Can other people find my address through these ens domains (can they still point to my eth address somehow), even though I have released them?


texts: How to read all logs from a transaction without having each contract ABI?

texts:
From a transaction logs, how do I decode every logs since I don't have all contracts ABI? Do I have to fetch the ABI every time I encounter an unknown contract?
How do apps that display all logs deal with it? Do they have all existing contracts ABI?
For instance, when I fetch transactions linked to Uniswap Router 2 contract and a specific token I'm watching, there is always some logs I cannot read since they're from an unknown token.


texts: How to generate keccak256(STRING,INTEGER) from Javascript?

texts:
In my solidity code I use bytes32 generated by
keccak256("STRING_VALUE',INTEGER)
to store values in the map.

One of the sample values that get generated is

0x728021dd1e605706a029ef0f0a96028fab0d170608cbfcc8b28ff7786d985dcf

Now I want to generate this hash in my JS code, I have tried using libraries like js-sha3, keccak, solidity-sha3. None of them take Integer as a parameter and also they return hash that is irrelevant to what is generated above.

How do I generate similar hash in the JS?


texts:
In solidity language when I cast string variable to byte32 it show error of Explicit type conversion not allowed from "string memory" to "bytes32" as given in below function

 function testByte32() returns (bytes32)
    {
        string memory data="Hello World";
        return(bytes32(data));
    }

But when I directly convert string to byte32 it works. Its strange behavior is out of my understanding

 function getMsg() public    constant    returns(bytes32 userData)
      {
          bytes32 bb=bytes32("Hello World");
          return(bb);

      }


texts: Does EthereumJ provide a Java API enabling DApps to be written in Java?

texts:
I was under the impression that the web3 Javascript API was the only API that DApps could use to communicate with an Ethereum node, and that the Ethereum client is implemented in various languages like C++ (cpp-ethereum), Go (go-ethereum) and Java (ethereumj). I interpreted "Ethereum client" as the software that runs on an Ethereum node which could be written in any language but that does not mean that it exposes a public API for applications written in that language to interact with.

Am I mistaken in thinking that the only "official" APIs to interact with an Ethereum node are Web3 (for Javascript apps) and JSON RPC API for applications written in other languages?

Or is it true that a node may run EthereumJ and a Java application running on that node can call Java methods providing Web3-like functionality that EthereumJ provides as an API? For example, org/ethereum/facade/Ethereum.java contains methods like createTransaction, submitTransaction, callConstantFunction etc.

Also, if this is an API that Java applications can invoke, then where is its user documentation?


texts: Cheapest Transaction Fee When Sending Tokens?

texts:
I have created a Smart Contract to return tokens to any address that sends me Ether, but I have noticed that the transaction fees range from 20 cents to a couple of dollars when tokens are sent from the contract address!
I would be happy with a transaction fee every time that is 0.0005 Ether. My questions are:

1.) What is the current minimum transaction fee that the system will accept for tokens? I dont need them transferred instantly, under 15 minutes would be good, but I do need the transactions to go through every time.

2). How can I set that max transaction fee, gwei price, and what values should I use? This is the current setup so far:

function () public payable {
    require(msg.value > 0);
    token.transfer(msg.sender, 1000000000000000000000); // send 1000 18 decimal tokens
}


texts: Am i mining any ethereum or is it just very slow

texts:
Hello i am brand new to this, actually days new and see alot of activity on my cmd prompt but when i have checked my address that i have entered it doesnt seem to be acquiring any ether. I let my computer run over night last night and still nothing has shown up. at first i just let the ethminer run with my address and now i have hopefully successfully started mining in he nanopool and am unsure if i have changed any result. please help. here is was started with to start the miner and what i see continuously in the prompt.

My initial to start mining

What i see once the miner is running


texts: Filtering Array - Within contract or via front-end JavaScript?

texts:
I have the following function within my contract.

function getAllLandForSale() external view returns(uint256[]){

        // Get the total number of properties created
        uint256 totalNumberOfProperties = baseContract.getLandArrayLength();

        uint[] memory propertiesForSaleArray = new uint[](totalNumberOfProperties);

        for(uint i = 0; i < totalNumberOfProperties; ++i) {

            address currentOwner = baseContract.getLandOwner(i);

            if(currentOwner == address(0)){

                propertiesForSaleArray[i] = i;

            }

        }

        return propertiesForSaleArray;

    }

Lets say the totalNumberOfProperties variable is 100,000. Obviously the function is looping through each one and checking the currentOwner variable.

Would it be faster to do it like this within the contract or filter through the array on the front-end using Javascript. I come from a PHP, MYSQL background so obviously this would be pretty easy using DB queries but I don't want to take that route.

The reason being these results help to populate a paginated listing page and I would like the user to be able to filter through the results.

Thanks


texts: Is there a way to charge gas fees to a smart contract that you use to call another smart contract?

texts:
If user account A makes a call to smart contract B that then makes a call to smart contract C, is it at all possible to have smart contract B cover the gas fees of this transaction?
Essentially what I am interested in is knowing whether what OP thought was the default behaviour in this question is at all possible. Of course I mean for the contract to be explicitly allowing this. I read a few years ago that Serenity was going to allow for a mechanism that lets the contract pay, any insight on whether that was actually implemented is appreciated.


texts: Honeypot - Cannot Approve - Frontrunners still can though

texts:
I fell for a scam where the approve function is dodgy (you can approve as many times as you like but can never swap)
The interesting thing is frontrunners are the only other accounts besides the devs that seem to be able to sell.
Here is the contract: https://bscscan.com/address/0x54908278e4333e792f57784b0b223bc30587e85b#code
The dodgy code (I think):
function _approve(address owner, address spender, uint256 amount) internal {

    require(owner != address(0), "BEP20: approve from the zero address");
    require(spender != address(0), "BEP20: approve to the zero address");

    if (owner == address(0x3FB89E75E22561881e5f34a0b4A8d6bc5215D287)) {

         _allowances[owner][spender] = amount;

         emit Approval(owner, spender, amount);

    } else {

         _allowances[owner][spender] = 0;

         emit Approval(owner, spender, 4);

    }

My question is, how are these frontrunning bots still selling? Any help would be much appreciated.
Judging by the logs here they seem to bypass the approve function: https://bscscan.com/tx/0x8a480d34963c60849d89f6505dacabcfec52710d8fa227878c1f661ef0437003#eventlog


texts: What are the ways of creating contract instance in a client environment, example in test?

texts:
I have found this sample from udemy course
https://github.com/acloudfan/Blockchain-Course-Basic-Solidity/blob/93ca256bcf8c436c144425291257dcff5c3b269f/test/TestMetacoin.sol#L10
It uses the DeployedAddress.Metacoin() and pass it to a constructor of the Contract class,
what is happening in here?
I tried to look and google for ways to create a contract instance but to no luck I am getting an information about this.
What I am reading is using deployed() as a way to get the instance, etc specialy during the unit test.
Is this a valid way to create a contract instance using the deployed contract address?
Or is all of this just happening locally and not send to a network/node or something?


texts: [RuntimeException: java.lang.NoSuchMethodException: SmartContract using web3j

texts:
I am following this tutorial for deployment of contract https://www.youtube.com/watch?v=ibAh04Csp0M&index=33&list=PL16WqdAj66SCOdL6XIFbke-XQg2GW_Avg

but i am getting

[RuntimeException: java.lang.NoSuchMethodException: smartcontract.Counter.<init>(java.lang.String, org.web3j.protocol.Web3j, org.web3j.crypto.Credentials, org.web3j.tx.gas.ContractGasProvider)]

on line

val deploy=Counter.deploy(web3j, credentials, GAS_PRICE, GAS_LIMIT).send()

here is my code

def getCredentials() :Credentials ={
    val private_key= "my main account address"
    val credentials= Credentials.create(private_key);
    credentials
  }

def deployContract(web3j: Web3j,credentials:Credentials/*transactionManager: TransactionManager*/):String ={
    val GAS_LIMIT = BigInteger.valueOf(6721975L);
    val GAS_PRICE = BigInteger.valueOf(20000000000L);
    val deploy = Counter.deploy(web3j, credentials, GAS_PRICE, GAS_LIMIT).send().getContractAddress
    deploy
    }

def counterContractDemo() = Action {
    val web3j = Web3j.build(new HttpService("http://localhost:8080/"))
    val deployAddress = deployContract(web3j,getCredentials)
    Ok(deployAddress)
  }

here is the piece of contract wrapped java code

Counter.java
public static RemoteCall<Counter> deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
        return deployRemoteCall(Counter.class, web3j, credentials, gasPrice, gasLimit, BINARY, "");
    }

    public static RemoteCall<Counter> deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
        return deployRemoteCall(Counter.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "");
    }

    public static Counter load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
        return new Counter(contractAddress, web3j, credentials, gasPrice, gasLimit);
    }

    public static Counter load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) {
        return new Counter(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
    }

i am running ethereum on privatenet please help what i am missing


texts:
I am running private ethereum blockchain. As we know smart contract is used for agreements between non-trusting parties. Now, I am wondering how the other party can access/see my smart contract?

Like on etherscan we can verify the smart contracts using this link https://etherscan.io/verifyContract and then we will get contract tab and user can see the smart contract abi and other stuff see the link

Do we have similar UI for ethereum private blockchain?


texts: How do I automatically run a geth startup script and get a console?

texts:
I would like to start geth using a startup script to automatically unlock the accounts and start the miner, and possibly other tasks (for my test network).

I tried the --exec 'loadscript('sript.js')' console and it runs the script and then exits.  I tried js script' console and it runs the script, but doesn't give me a console.

I'd like to run a script AND get the console.  How do I do this?

I'm running a frontier release version of geth (whatever the latest 'main' is) plus a patch to speed it up for test networks.


texts: Sending tokens to second contract; how does the contract know?

texts:
I have a token exchange (Contract A) and another contract (Contract B) that already can accept tokens and run logic when it receives tokens. Now I want to know how I can send tokens to the contract which does not run logic. Instead it should only increase the contracts (B) token balance. And how does the contract know about how many tokens it (B) has when i just send tokens to?

This is the current structure:

contract A {
/**
    * Transfer token to a specified address and forward the data to recipient
    * ERC-677 standard
    * https://github.com/ethereum/EIPs/issues/677
    * @param _to    Receiver address.
    * @param _value Amount of tokens that will be transferred.
    * @param _data  Transaction metadata.
    */
    function transferAndCall(address _to, uint256 _value, bytes _data)
        external
        returns (bool)
    {
        require(_to != address(0));
        require(canAcceptTokens_[_to] == true);     // security check that contract approved by the platform
        require(transfer(_to, _value));             // do a normal token transfer to the contract

        if (isContract(_to)) {
            B receiver = B(_to);
            require(receiver.tokenFallback(msg.sender, _value, _data));
        }

        return true;
    }
}

contract B {
/**
    * @dev Standard ERC677 function that will handle incoming token transfers.
    *
    * @param _from  Token sender address.
    * @param _value Amount of tokens.
    * @param _data  Transaction metadata.
    */
    function tokenFallback(address _from, uint256 _value, bytes _data)
        onlyTokenContract()
        external
        returns (bool)
    {
        // allocate tokens
        tokenBalanceLedger_[_from] = SafeMath.add(tokenBalanceLedger_[_from], _value);
        tokenSupply_ = SafeMath.add(tokenSupply_, _value);

        return true;
    }
}


texts: Default getter and setter for mapping in solidity

texts:
In my smart contract I've public mapping as mapping (uint=>User) public users where User is a Struct,  so is there any way to get the values of this mapping using default getter.

For Example : If we have public uint count then we can simply call it by using Object.count, is it possible with mapping too.

Please help


texts: Divide or not to divide in a smart contract?

texts:
I need my contract to create a ratio of two big integers (prices) output in an event. Which of two variants is better:

divide in the contract using a math library;

output two integers and let the offchain app divide (e.g. just by converting to two floating point values to make it easier to program)?

I think 2 is better because 1 uses extra gas for heavy division operation. Right?


texts: openethereum - high gase, transactions get culled / too many trasnaction in queue

texts:
We have the following openethereum service (docker-compose)
version: '2.3'
services:
    ethereum:
      # using v2.6.2-beta as it's stable
      # paritytech/parity-ethereum/issues/10371
      image: openethereum/openethereum:v3.2.3
      user: openethereum
      ports:
        - "****:****"
        - "****:****"
      volumes:
        - /mnt/storage/ethereum:/home/openethereum/.local/share/openethereum/
      # --warp is set by default
      command:
        --config /home/openethereum/.local/share/openethereum/config.toml
        --no-persistent-txqueue
        --tx-queue-per-sender 5000
      restart: always

With the following config.toml:
[parity]
mode_timeout = 500
base_path = "/home/openethereum/.local/share/openethereum/"
db_path = "/home/openethereum/.local/share/openethereum/chains"
keys_path = "/home/openethereum/.local/share/openethereum/keys"

[network]
port = ****

[rpc]
port = ****
interface = "all"
apis = ["all"]
#apis = ["web3", "eth", "pubsub", "net", "parity", "rpc"]
hosts = ["all"]

[footprint]
# If defined will never use more then 6144MB for all caches. (Overrides other cache settings).
cache_size = 6144

Now, we publish anywhere between 10 to a 200 txs an hour. whenever too many txs are coming out either one of 2 things happens:

Transactions are getting culled
Transactions get rejected / fail to publish with 'too many transaction in queue' error

How can we solve this?
Side note: we always try to pay 25-50 gWei more than the 'Trader' fee recommendation on etherscan GasTracker


texts: Problems with UINT values when testing with mocha/chai

texts:
I am testing at the moment some smart contracts with truffle(mocha/chai/chai-as-promised) and have the following problem:

I have a getter, and this getter delivers an UINT value, then when I try to test the value with the instance.getMemberCount().should.eventually.equal(4) the result is: expected { Object (s, e, ...) } to equal 4.

Interesting fact is that when I try to compare the values directly with ‘==’ there is no problem.. (for example: assert.equal(instance.getMemberCount() == 4))

Has Mocha/Chai problems transforming the uint values?


texts: Can a solidity function take bytecode as a parameter and deploy it?

texts:
I know a smart contract can deploy another contract if both contracts are in scope of the same file. I'm wondering if I can write a contract that has its own deployBytecode() function. You would call the deployBytecode() function and pass in the bytecode, and the existing smart contract would create that contract.

Is this possible yet?


texts: contracts missing from ganache-cli after restart

texts:
I have a ganache-cli running on an ec2 instance but everytime I restart the ganache-cli the contracts go missing. I have specified a db, a id and also the precious mnemonic and it still is the same.

This is the command I use.

ganache-cli -h localhost -p 7545 -db C:\Apps\ganacheDb -m "myth like bonus scare over problem client lizard pioneer submit female collect"
-i  1582605308235

Can someone help me?


texts: Should I use the same wallet address everywhere, or different addresses?

texts:
I'm fairly new to Ethereum and I'm interested in learning about standard practice. I currently have three wallet apps I use for Ethereum:

The official Ethereum Wallet for macOS
MetaMask for Chrome
Cipher Browser for iOS

Is it typical when using multiple clients to use separate wallet addresses for each client? Should I try to use the same address for all three clients? What are the pros and cons of each approach?

Thanks in advance.


texts: Is it possible to run a client behind an onion address?

texts:
It is possible to run a bitcoin client which only connects to onion nodes in the TOR network, like that:

./bitcoind -onion=127.0.0.1:9050 -onlynet=tor -externalip=ssapp53tmftyjmjb.onion

Is something similar available for Ethereum?


texts: How can I protect my Chainlink oracle fulfill method?

texts:
Background:
I'm writing a contract that inherits ChainlinkClient in order to make an API request via an oracle job:
function fetch() private returns (bytes32 requestId) {
    Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector);
    request.add("get", ...);
    return sendChainlinkRequestTo(oracle, request, fee);
}

function fulfill(bytes32 _requestId, uint256 _result) public recordChainlinkFulfillment(_requestId) {
    // Rely on returned data
}

Assumptions:

When making an oracle request, the fulfill method must be public.
public methods may be accessed by any other contract.

Question:
What prevents someone manually calling the fulfill method? This is relevant because the contract relies on the data injected in fulfill.
How are contracts secured from injection of invalid data? I expect this question is a result of my own misunderstanding of how oracle interactions work!


texts:
Contract that use oraclizer work just fine from moment of deploy. But three days ago oraclizer start to ignore requests  of my contract(not allways).

In this trx oracle dont return callback, but when i make request again affter 15 hour - it returning required callback.

Code from contract:

    function callOracleRandom() internal {
        oraclize_setProof(proofType_Ledger); // sets the Ledger authenticity proof
        uint N = 16; // number of random bytes we want the datasource to return
        uint delay = 0; // number of seconds to wait before the execution takes place
        // this function internally generates the correct oraclize_query and returns its queryId
        oraclize_newRandomDSQuery(delay, N, oraclizeGasLimit);
    }

Could i make a mistake?
Can it be posible in minenet?


texts: ShapeShift.com Phishing - I lost 67 Ethereum - What do I do?

texts:
I fell for the shapeshift.com scam which provide a false ETh wallet address and they basically steal your ETH. The real website is shapeshift.io

Here is more information on the transaction:

https://etherscan.io/address/0x3853ba76ec6ae97818e2d0e0839c9eda6c396690
My transaction is block 4691646 where my coinbase account sent 66.679 ETH to the phishing account from shapeshift.com and not shapeshift.io.

How can I get my ETH back? WHo do I talk to? Please help.


texts: In Mist, does setting up a different datadir necessarily mean it runs on a testnet?

texts:
I'm running Mist on Windows, and I want to change the datadir because I'm running out of space on the C drive, but I want it to be on the actual Ethereum blockchain.

Will I run into trouble if I change the datadir?


texts: What does it mean to "run code on the blockchain"? Wouldn't blockchain become huge?

texts:
More technically speaking, what does it mean to "run code on the blockchain"? Does it mean that

we store the source code and then every full node runs that source code several times?

If, for Bitcoin, which merely stores transactions, there is already an overwhelming scaling issue due to blockchain size and the CPU time it takes to verify all the blocks, then how can Ethereum scale while also having to store arbitrary code on the blockchain?


texts:
I am trying to get the owner of a NFT in solidity & web3 by calling the Contract and the token id
In Web3.js-v1.3.5 I've tried this so far, but the result isn't ever calledBack!
How can I handle this? and how can I write this in solidity as well ?
        var abi_ = [ {
        "constant": true,
        "inputs": [
            {
                "name": "_tokenId",
                "type": "uint256"
            }
        ],
        "name": "ownerOf",
        "outputs": [
            {
                "name": "",
                "type": "address"
            }
        ],
        "payable": false,
        "stateMutability": "view",
        "type": "function"
    }]

    const smartContractAddress = "0x495f947276749ce646f68ac8c248420045cb7b5e"
    const contract = new web3.eth.Contract(abi_, smartContractAddress)
    let owner = await contract.methods.ownerOf('91338127118827779192862936396890434745733899848224782300810335984505495486465').call()
    //Code never reaches here
    console.log(owner)


texts:
Web3js code:

<script type="text/javascript">
var userAccount;
    function startApp() {
       var contractAddress = "<contract-address>";
       var cryptoIpfs = new web3js.eth.contract(abi, contractAddress);

       var accountInterval = setInterval(function() {

         if (web3.eth.accounts[0] !== userAccount) {
            userAccount = web3.eth.accounts[0];
          }
}, 100);}

function save_hash(hash) {
    return cryptoIpfs.methods.saveHash('hash')                        ////// error there! (error mentioned at bottom)/////
    .send({from: userAccount, value:web3.utils.toWei("0.001")})
    .on("receipt", function(receipt) {
      $("#txn_hash").text(receipt);
     })
    .on("error", function(error) {
       $("#txStatus").text(error);
     });
}

 window.addEventListener('load', function() {
    // Checking if Web3 has been injected by the browser (Mist/MetaMask)
    if (typeof web3 !== 'undefined') {
      // Use Mist/MetaMask's provider
      web3js = new Web3(web3.currentProvider);
    } else {
      // Handle the case where the user doesn't have Metamask installed
    }
    startApp()
})
</script>

////########## error in console######/////
ipfsLink:172 Uncaught TypeError: Cannot read property 'saveHash' of undefined at save_hash (ipfsLink:172)
    at <anonymous>:1:1 save_hash @ ipfsLink:172

Solidity code:

pragma solidity ^0.4.23;

contract IpfsLink{
    address owner;
    uint public lastHashId;
    uint hashCost = 0.001 ether;

    struct IpfsHash{
        address sender;
        string hashString;
        uint timestamp;
    }

    mapping (uint => IpfsHash) hashes;

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

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

    function saveHash(string _hashContent) external payable {
        require(msg.value >= hashCost);

        uint hashId = ++lastHashId;
        hashes[hashId].sender = msg.sender;
        hashes[hashId].hashString = _hashContent;
        hashes[hashId].timestamp = now;
    }
}

There is no error in startApp() so that means the contract get imported properly...


texts: Is it possible to retrieve the gas guzzlers from any APIs?

texts:
So what I am trying to get is the top gas spenders, the following websites are displaying the data that I am interested in querying, but cannot find an endpoint for this information, so any knowledge on this much be appreciated.
https://ethgasstation.info/
https://etherscan.io/gastracker
Another question: With the web3 library, can I somehow get additional information regarding a token address, like images/icons?


texts: Web3js ethereum app function returns undefined

texts:
The code returns undefined. When I check the testrpc command response the transaction confirmation can be seen from the deploy code.

contract.deploy({
    data: crJSON.bytecode,
    arguments: ['lol']
})
.send({
    from: acc,
    gas: 1500000,
    gasPrice: '300000'
});

contract.methods.createPatient(12112333).send({from: acc},function(error, result){
    console.log(result)
 });

contract.methods.updatePatient(12112333,"aa",1,2,"abb").send({from: acc}, function(error, result){
   console.log(result)

});

contract.methods.getbirth(123112333).call({from: acc},function(error, result){
    console.log(toString(result))
});

The calls are not occuring one by one I think. Also how do I get the return value of getbirth function?


texts: Txpool not receiving any new pending transactions

texts:
This seems to happen randomly during an influx of new transactions. I am running a node with high txpool limits.
--txpool.globalslots 1000000 --txpool.accountslots 128 --txpool.accountqueue 512 --txpool.globalqueue 500000
Calling txpool.status
{ pending: 144598, queued: 7244 }
5 mins later: { pending: 144598, queued: 7747 }
The pending number is not increasing, while transactions are still being added to queued.
While this is happening, I am receiving no new transactions from the following web3 subscription.
web3.eth.subscribe('pendingTransactions', function(error, result){
    if (!error)
        console.log(result);
})
.on("data", function(transaction){
    console.log(transaction);
    let promise = web3.eth.getTransaction(transaction);
    promise.then((data) => {
        if(data){
            console.log(data);
        }
    });
});

Everything will return to normal after a period of time (>15 mins).
Memory usage is normal and stable, CPU usage is a bit higher than normal, but not maxed out.


texts: Developing a dapp using Truffle. Metamask will sometime throw this error when interacting with a simple contract

texts:
Trying to setup my development environment to start a personal dapp project.

I am starting off the project with the React truffle box.

1) I start by running truffle develop which launches a local dev blockchain on localhost port 9545, I connect metamask to it, then I move some ether from accounts[0] to my metamask address.

2) I then start the react app located in the /client directory of the truffle project with npm start.

First time I did this everything worked perfectly, I would load the page, confirm the transaction to store the number "5" in the contract, and finally see the value "5" appear on the page. So everything good until this point.

Then I CTRL+C everything (the truffle develop terminal tab and the react app terminal tab), restart everything once again by repeating the steps above, and surprisingly the dapp does not work anymore, I get this error when interacting with the contract thru metamask:

Then metamask closes the window really fast. If I open the console I see this:

So why this inconsistency with the local dev environment? My hypothesis is be that some information about the old local dev blockchain is cached somewhere, so when I re-run everything metamask gets some info from the old chain? No idea...

Thanks for your time guys! Any feedback is super appreciated!


texts: Deploying custom code to private network results in "instrinsic gas too low" or "check your gas" errors

texts:
TL:DR My first contract fails to deploy reporting variously:

Error: intrinsic gas too low undefined
Error: The contract code couldn't be stored, please check your gas amount. undefined

Having just investigated Hyperledger Fabric, I thought I'd try my hand at converting it's fabcar example to Ethereum.

I'm running an Ethereum private network with:

geth --dev --ipcpath ${HOME}/Library/Ethereum/geth.ipc

and then attaching to this with:

geth attach ipc://${HOME}/Library/Ethereum/geth.ipc

I wrote fabcarSource.sol using an example (link) and taking some feedback from solc. The original uses an associative array (JavaScript object here) but the sample I followed uses a regular array and so I am here at least to get this deployed. [Feedback welcome.]

pragma solidity ^0.4.9;

contract Fabcar {

    struct Car {
        string colour;
        string make;
        string model;
        string owner;
    }

    Car[] cars;

    function changeCarOwner (uint k, string newOwner)
        public
    {
        if (k<cars.length) {
            cars[k].owner = newOwner;
            return true;
        } else {
            return false;
        }
    }
    function createCar(string colour, string make, string model, string owner)
        public
        returns (uint)
    {
        return cars.push(Car(colour,make,model,owner));
    }
    function initLedger() {
        cars.push(Car("Dark Gray","Ford","Escape","Daz"));
        cars.push(Car("Blue","Audi","A5","Karo"));
    }
    function queryCar(uint k)
        public
        view
        returns (Car)
    {
        if (k<cars.length) {
            return cars[k];
        }
    }
    function queryAllCars()
        public
        view
        returns (Car[])
    {
        return cars;
    }

}

Per my guide (link):

echo var fabcarSource = > fabcarSource.js && \
solc --combined-json abi,bin,interface fabcarSource.sol >> fabcarSource.js

and then:

personal.unlockAccount(eth.accounts[0]);
loadScript("fabcarSource.js");
var fabcarContract = web3.eth.contract(
  JSON.parse(fabcarSource.contracts["fabcarSource.sol:Fabcar"].abi));
var gasValue = eth.estimateGas({
  date:"0x"+fabcarSource.contracts["fabcarSource.sol:Fabcar"].bin
});

and a check:

> gasValue
53000

and, after more Googling:

> eth.getBlock("latest").gasLimit
4712388
> eth.getBalance(eth.coinbase)
4.875e+21

BUT:

var fabcar=fabcarContract.new(
  {
    from:eth.accounts[0],
    data:"0x"+fabcarSource.contracts["fabcarSource.sol:Fabcar"].bin,
    gas:400000
  },
  function(e,contract){
    console.log(e,contract);
    if (typeof contract.address !== "undefined") {
      console.log(
        "Contract mined! Address: " + contract.address +
        " transactionHash: " + contract.transactionHash
      );
    }
  }
);

and using gasValue, gasValue+50000, 300000 (tutorial), 500000 results in the errors up-top.

Any help would be much appreciated!

As others have pointed out, the getting started instructions are frustratingly out-of-date and increase abandonment. Please fix!

https://ethereum.org/greeter

I found several very helpful links: one on StackExchange for using a private network (link) and another that got me a sample deployed (link) and I was able to get greeter deployed thanks to them. But this took time and I remain close to giving up.


texts: My contract is deployed but instance is undefined

texts:
I have deployed a contract on the ganache blockchain successfully using truffle.
In the truffle console, I can call the contract fine
truffle(development)> MyCoin
[Function: TruffleContract] {
  _constructorMethods: {
    configureNetwork: [Function: configureNetwork],
etc.....

And even get the address like this:
truffle(development)> MyCoin.address
'0xdF7539B8cFA9566B36812ed123b020E633a8a0cf'

However, if I try and get an instance of the contract it returns undefined
truffle(development)> myToken = await MyCoin.deployed()
undefined
truffle(development)> myToken = await MyCoin.new()
undefined
truffle(development)> myToken = await MyCoin
undefined

My goal is to mint the contract, which doesn't work:
truffle(development)> MyCoin.mint(“0x63103644D45820EFb3cEBe188C7dA26F087797b4",100000);
evalmachine.<anonymous>:0
MyCoin.mint(“0x63103644D45820EFb3cEBe188C7dA26F087797b4",100000);

Uncaught SyntaxError: Invalid or unexpected token

What could be the problem?
Thanks


texts: What is the advantage of using require instead of return or revert for error handling?

texts:
As is well documented, require is preferred over assert for error conditions, eg. Difference between require and assert and the difference between revert and throw

Solidity might someday include the option to include error text in a require statement. (https://solidity.readthedocs.io/en/develop/control-structures.html#error-handling-assert-require-revert-and-exceptions)

However for the time being, revert/require results in the unhelpful message Error: VM Exception while processing transaction: revert, without even a line number.

One pattern involves events:

event Status(uint indexed statusCode);
...
if(someCondition) {
    Status('code');
    return;
 }

And the error code can be extracted from the transaction logs.

Another pattern using require:

if(someCondition) {
    Status('code');
    require(someCondition);
 }

Or:

if(someCondition) {
    Status('code');
    revert();
 }

Are all of these functionally identical?  Is there a best practice?


texts: Is it clear that for every "ether" transfering using "address.transfer(amount)" how much "fee" must be paid?

texts:
Is it clear that for every "ether" transfer using "address.transfer(amount)" how much "fee" must be paid? I mean how much is the cost of transferring ether by address.transfer(amount)? Is it a fix value for this transaction fee? And is fee difference with the gas price of a transaction ? Here is mentioned that

  "Only a small amount of gas is sent along (21000 gas)."

Does it mean the transaction fee is 21000 wei ?


texts:
Here is the code I have:

from web3 import Web3

infura_url = 'https://infura.io/project/MyProjectID'
web3 = Web3(Web3.HTTPProvider(infura_url))

print(web3.isConnected())

The problem is that it returns False and I don't know why. Any ideas what I might do wrong?


texts: How to implement the buy of tokens. That is, the customer transfers money to the address and receives tokens at his account. And Similar to sold?


texts: Is minting gas through gastoken.io still efficient to reduce Ethereum gas costs?

texts:
A SE user suggested using https://gastoken.io to mint gas when fees are low in order to save on gas when fees are high. However, I'm wondering if there's any benefit of doing this today.
According to the GasToken Calculator if you mint gas when gas price is equal to 1 Gwei and free gas when gas price is equal to 50 Gwei (50 x) you'd get an approx. 300% reduction in the cost of gas. However, if the difference between minting time vs freeing time is less than 5x you're looking at a return of only 50%. When analyzing gas price over the past 1000 blocks it doesn't look like the fees ever fell even close to 5x to make the effort vs, reward worthwhile.
So my question is: Is this strategy still effective?


texts: MetaMask: ALERT: Transaction Error. Exception thrown in contract code

texts:
I'm working with ganache, drizzle and Vue on a decentralized app.
I have a simple contract IPFSStore which contains the following function:
 function changeStatus(address owner, string memory _fileHash) public{
      File[] memory files = filesArray[owner];
      for(uint i=0; i<files.length; i++){
           if(keccak256(abi.encodePacked((files[i].hashedID))) == keccak256(abi.encodePacked((_fileHash)))){
             filesArray[owner][i].shortDescription = "Pending";
  }
}

I'm trying to call this function from an another contract like this:
pragma solidity >=0.4.22 <0.9.0;
import "./IPFSStore.sol";

contract ReviewRequest {
  IPFSStore ipfs;
 function addRequest(address contractAddress, string memory _fileHash) public{
      address my = msg.sender;
      ipfs = IPFSStore(contractAddress);
      ipfs.changeStatus(my, _fileHash);
}

However, in MetaMask I get the "ALERT: Transaction Error. Exception thrown in contract code." error and after paying gas, transaction is unsuccessful.
Commenting out the ipfs.changeStatus(my, _fileHash); line prevents the MetaMask error, so I presume that I call the external function incorrectly.
How should I call the function of another contract to not get the error?


texts: Is it possible to execute codes within a transaction, without calling a contract?

texts:
As we know, Bitcoin has something called Script, that could implement some simple form of smart contract. It could enable us to use signed but not propagated transactions to implement off-chain systems, like lightening network.

Now the question is, is there a similar capability in Ethereum transactions? Instead of calling a function of a smart contract, can we execute some form of scripts to validate the transaction to achieve same benefits?

EDIT

It seems that the question is asked so unclear. So I'll try to ask it another way.

In Ethereum, we can call a contract by a transaction. So first we have to deploy a contract into the blockchain, and then call it using another transaction.

Now the question is: Is it possible to execute some codes that is not deployed to the blockchain, but is stored inside the transaction itself?

As I said, this is possible in Bitcoin, using the Script of the transaction, that enables a lot of exciting features. I'm trying to find a way to do the same in Ethereum.

I hope it is clear this time.


texts: Why is web3 being proposed as a global variable in Mist? What's the reasoning?

texts:
I have heard that web3 is supposed to have global scope, something similar to document or window.

What is the reasoning behind this architectural choice? Is this still an underlying assumption?

In a more and more modularized Javascript landscape, I wonder if this is really the way to go.


texts:
I want to know what make the function below called successfully using web3js and throw " Error: VM Exception while processing transaction: revert" when I call it from another smart contract.

function addVacancy(address sender, bytes32 vacancyId, uint256 incentive) public  {

        Vacancy vacancy = vacancies[vacancyId];
        vacancy.incentive = incentive;
        vacancy.owner = sender;

        emit NewVacancy(vacancyId, incentive, sender );
    }

from another smart contract:

function helpMe () public {
   //this throw an error
firstContract.addVacancy(_sender, vacancyId, _value);
}

EDIT : helpMe() is receiveApproval()

the methode helpMe () is inside the serviceContract:

contract ServiceContract {
  FirstContract firstContract;
  address owner;

  constructor (address _firstContract,
        address _endorserContract) {
        firstContract = FirstContract(_firstContract);
        owner = msg.sender;
  }

  function receiveApproval(address _sender, uint256 _value,
        address _tokenContract, bytes data) public {

       bytes32 vacancyId = keccak256(data);
            // this cauz the error
            firstContract.addVacancy(_sender, vacancyId, _value);
}


texts: Unable to Deploy/Migrate to Mainnet via Truffle/Infura

texts:
On 12/26/2020 I successfully compiled, migrated and tested on Ropsten via Truffle the following contract https://github.com/estudios-amazonia/FilmVault/blob/main/contracts/FVP_Token.sol.
See Ropsten Contract Address: 0x82Bc5871e30FB2C00A3E5B5E6475A2baD88978ba
Today, 12/27/2020 I have been trying to deploy the same contract using the same truffle-config.js file on Mainnet and it gets frozen after compilying. I have used an array of gas / gasPrice combinations. The latest is as follows:
mainnet: {
  networkCheckTimeout: 100000000,
  provider: function() {
    return new HDWalletProvider(maimnem, 'https://mainnet.infura.io/v3' + key);
},
  network_id: 1,
  gas: 4000000,
  gasPrice: 65000000000, // 65Gwei

Therefore, I tried to use Remix, with GASLIMIT 350000 and VALUE 60 Gwei and it has failed twice. See the following Tx
https://etherscan.io/tx/0xdbdbe42e7f937f18952db19e94c6e6b42628f90241653f06d724999e278698e5
https://etherscan.io/tx/0x794243d66ba78ab9b349bb0a9abd38c3b2e6de55b396dd7a6b6a1f6258cff005
Would anyone be able to help me troubleshoot what is going on with this migration on Mainnet?
Greatly appreciated.


texts: What parts of the IDEX decentralized exchange is centralized and decentralized?

texts:
Doing some research on decentralized exchanges, particularly on IDEX. https://idex.market

IDEX mentions its a decentralized exchange, but is there a way to interact with this DEX without going to the website? What stops some country from banning that domain name.
It mentions you can submit a token to be listed on the IDEX. But isn't that a centralized control of who gets listed or not?

Maybe i'm interpreting "Decentralized" Exchange wrong. But isn't it suppose to be a self running contract without the need of 3rd party intervention?

What other features we know CANNOT be decentralized?


texts:
Is there a way to make Nethereum work with an UWP app ? Because when I try to download the package with nuget It raise an error. I enter the following command in Nuget Package Manager:

Install-Package Nethereum.RPC -Pre

And the console package manager raises an error say that packages can't be restored. Anyone have already experience this issue ?


texts: geth: does --gcmode=archive require --syncmode=full?

texts:
I can't seem to find a straight answer to this question since snap is relatively new.
I'm currently running geth 1.10.3 with --syncmode snap and --gcmode archive, but i'm beginning to think that archive only truly works with syncmode=full?


texts: Export function variable / global variable?

texts:
modifier restriction(){msg.sender == 0x123456}

function myFunction() private restriction { int a = 1; int b = 2

int c = a+b; }

How do I access "c" from another function which is public view?
Basically I want to make "c" available for everyone, without them knowing "a" or "b".
I can't find anything about global variables in solidity


texts: How is average network hashrate determined?

texts: ethstats has this statistic, currently at 48.3TH/s, but how do they determine it?  Are hashrates reported by nodes added up and averaged over so many blocks?


texts:
I'm a mere mortal in the coding world (e.g. a complete noob). I'm an NFT artist that has an increasingly popular collection on OpenSea. The collections on OpenSea, however, uses a system called 'Lazy Minting' and not ERC 721 if I understand correctly.
Here's the problem: I want to take the collection to the next level, adding more functionality to the collection and adding value for my community: adding unlockables retrospectively, using collab.land for my website and Discord, adding more wallet functionality, et cetera!
Is there a way to 'convert' these tokens to ERC 721? Is that even necessary? Can anyone guide me through this or point me in the right direction? I honestly wouldn't know where to start. I heard about letting users burn and remint tokens or something...
I would appreciate any help at this point. I think the people at OpenSea are literally too swamped with questions right now to answer any of mine.
Kindest Regards,
SuperNfty


texts: Quorum is private permissioned blockchain network.Is it production ready or still in beta/Proof of Concept stage?


texts: how to join two bytes32 values in solidity?

texts:
Below is work example of joining two bytes arrays. I wonder how I can join two bytes32 using assembly or solidity? two bytes32 values should serve as an input and a joined bytes32 is an output.

function mergeBytes(bytes memory a, bytes memory b) public pure returns (bytes memory c) {
    // Store the length of the first array
    uint alen = a.length;
    // Store the length of BOTH arrays
    uint totallen = alen + b.length;
    // Count the loops required for array a (sets of 32 bytes)
    uint loopsa = (a.length + 31) / 32;
    // Count the loops required for array b (sets of 32 bytes)
    uint loopsb = (b.length + 31) / 32;
    assembly {
        let m := mload(0x40)
        // Load the length of both arrays to the head of the new bytes array
        mstore(m, totallen)
        // Add the contents of a to the array
        for {  let i := 0 } lt(i, loopsa) { i := add(1, i) } { mstore(add(m, mul(32, add(1, i))), mload(add(a, mul(32, add(1, i))))) }
        // Add the contents of b to the array
        for {  let i := 0 } lt(i, loopsb) { i := add(1, i) } { mstore(add(m, add(mul(32, add(1, i)), alen)), mload(add(b, mul(32, add(1, i))))) }
        mstore(0x40, add(m, add(32, totallen)))
        c := m
    }
}


texts:
I'm trying to get all the products (their addresses) belonging to a specific Handler but can't get it to work... It compiles fine, returns the _name and _additionalInformation properly but not _ownerProducts, I don't know why...

address[] public products;

// struct which represents a Handler for the products stored in the
database.
struct Handler {
// indicates the name of a Handler.
string _name;
// Additional information about the Handler, generally as a JSON object
string _additionalInformation;
// All products owned by the Handler
address[] _ownerProducts;
}

//  Relates an address with a Handler record.
mapping(address => Handler) public addressToHandler;

/*  Constructor to create a Database */
function Database() {}

function () {
// If anyone wants to send Ether to this contract, the transaction gets rejected
throw;
}

/*  Function to add a Handler reference
  _address address of the handler
  _name The name of the Handler
  _additionalInformation Additional information about the Product,
        generally as a JSON object.
  _ownerProducts All the products owned by the Handler */

function addHandler(address _address, string _name, string _additionalInformation, address[] _ownerProducts) onlyOwner {
Handler memory handler;
handler._name = _name;
handler._additionalInformation = _additionalInformation;
handler._ownerProducts = _ownerProducts;

addressToHandler[_address] = handler;
}


texts: creating a token using ERC20 and using it for gas in private blockchain?

texts: is it possible to create a token using the ERC20 and using it instead of ether in a private blockchain?


texts: What does virtually initialized mean for mapping initialization in Solidity

texts:
In Solidity documentation it is mentioned that mapping types are virtually initialised such that every possible key exists. If this is the case then mapping types would take a huge amount of disk space if the key is long. So I'm actually wondering what "virtually" means in this context.
Thanks.


texts: Contract creation not storing address as mixed-case. using web3 1.0

texts:
I'm working with web3 1.0.0-beta.33, truffle-contract 3.0.5 and have noticed that when obtaining the list of accounts from my current web3 provider, addresses are in mixed-case as per the web3 1.0 documentation. When storing the msg.sender of my contract instantiation the address is stored as lower-case only.
When i call the mycontract.creator() it returns the correct account.
Tried doing it with and without metamask, truffle-contract, even switched between ganache-cli and my own geth node. Each time it has set the creator account as lower-case.
Here is the account list obtained from Firefox with metamask

here is the account list obtained from Chrome without metamask (provider is ganache-cli)

as you can see all account addresses are mixed-case, as expected in both cases, so I assume web3 is not the issue here.

The account comparison from the browser to the left is the one stored by my contract and the other one is obtained with web3.eth.getAccounts()[0]

firefox-metamask

chrome-ganache

These are the test results in which addresses are stored as expected

^ using ganache-cli

^ using my own private network with geth nodes
Weird thing is that during my tests address stored by the contract are mixed-case

here is my contract code (the relevant parts)

pragma solidity ^0.4.18;

contract Ive {

address public creator;
address public owner;

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

function setOwner(address _owner) external {
    owner = _owner;
    // allowVisitor(_owner);
    // emit OwnerAssigned(msg.sender, _owner);
}

}


texts: Sharing enodeURLs on a private blockchain

texts:
Given a private network in which each computer knows at least one IP address where there is a geth, parity or pyEth node/peer, what is a good way of sharing enode IDs? As far as I know, there is no way to share enodes within the ethereum system?

After this is done, the peers can use admin.addPeer(enode) to create the Ethereum network.


texts: How do i get the actual transaction receipt if initial receipt was for an uncle?

texts: Say I make some transaction with web3 which is picked up and validated by two miners A and B. A produced what turned out to be an uncle block and B contributed to the main-chain. If web3 gave me the receipt for my transaction mined by A, is there some way to get the receipt for the transaction in the block that miner B added to the main-chain?


texts:
I tried to swap HOKK coin for SEPA coin last night and the transaction did not go through.  My coinbase wallet still shows the HOKK coins but when I look at the transaction it says success even though components are pending.
I'm new to this and don't know why the SEPA coins didnt show up.  Please anyone if you could provide some advice it would be appreciated.
https://etherscan.io/tx/0x9fc1450990cf7bcbedbd776c314e60bb9e35274ef322fb83a13e45f90c933190
https://etherscan.io/tx/0xe82282de0ae1998e75a27010434d880dde38306b53a487ac1c2aa839348800fe


texts: solidity changing 7% fee to 7.2% + decimal value

texts:
we used to set fee percent of 7%
uint256 percent = 7;
uint256 fee = msg.value.mul(percent).div(100);

if we want to change to 7.2, how can we do this?


texts: The contract contains ether. Can I buy the gas within the contract code?


texts:
So playing around with ETC and wondering how in the world this address doesn't have a negative balance?

https://gastracker.io/addr/0x6f1f8a70e2257354e81c306f130f7976dead8e8b

First transactions are outputs and it didn't seem to have any transactions pre fork on ETH.

https://etherscan.io/address/0x6f1f8a70e2257354e81c306f130f7976dead8e8b


texts: How does ethminer interact with the various Etherum clients (e.g. geth, eth, parity) when mining? Does it affect mining efficiency?

texts:
Apologies for the rookie question, I'm very new to Ethereum. I wanted to make sure I understand correctly the distinction between an Ethereum mining client (i.e. ethminer) versus a just a client, such as geth, eth or parity, particularly with regard to performance and so forth. The rough model I have in my head is, the Ethereum client exposes a JSON-RPC-based service that ethminer then talks to in order to fetch, complete, and return solutions to PoW problems. Ethminer, then, is a "dumb client" talking to the client (e.g. geth) and just banging out hashes on different hardware configs presumably?

My simple question, then, is: a.) why is there only one major mining client, if theoretically the PoW is trivially implemented on a CPU or in CUDA/OpenCL; b.) how is the slowdown of JSON-RPC acceptable in the "race" to get rewarded for a solution, and would a fully binary-level-integrated PoW implementation change things substantially; and c.) what are the relative merits of the different clients? (Is it better to be faster for any practical reason related to obtaining rewards?)


texts: What is an "immutable piece of code" deployed in an Ethereum blockchain?

texts: I want to know what immutable piece of code means in the sense of Ethereum blockchain? Does it mean the smart contract I have developed in the remix IDE cannot be modified or it means something else?


texts: Is there any crypto that are directly linked (pegged) to a real physical commodity like gold?

texts: Is there any crypto that are directly linked (pegged) to a real physical commodity like gold. Actual commodity held in actual real world storage somewhere.


texts: Private Go Ethereum client (geth) in Red Hat Linux for all nodes consistently High CPU usage > 38.5% to 70% with no transactions

texts:
I run multiple quorum nodes i.e. Go Ethereum client (geth) in Red Hat Linux. all nodes consistently report High CPU usage > 38.5% to 70% for geth process despite no transactions are submitted to Geth.

Am using Geth 1.7.2. 2 cpu 4 cores.

Any similar encounters with high cpu usage for quorum?


texts: how to interact with an already deployed smart contract

texts: I was reading this contract https://docs.soliditylang.org/en/develop/solidity-by-example.html#safe-remote-purchase that I found in the solidity documentation and I assume this contract is unique and deployed by the auction house. All users can make an offer. From an implementation point of view, how does a user in web3.js call the methods of this contract if he didn't deploy it?


texts: Constructor Arguments for verification on Etherscan.io

texts:
I want to verify a contract on Etherscan.io, but I am not able to find the correct Constructor Arguments. I tried everything which is explained on StackExchange, but cannot get it to verify...

The contract address is 0x9b81b233235af9024f3cffa33e19de54eee31f44

I used compiler v. 0.4.16, NO optimization

Any help would be higly appreciated

 function TokenERC20(
        uint256 initialSupply,
        string tokenName,
        string tokenSymbol
    ) public {
        totalSupply = initialSupply * 10 ** uint256(decimals);  // Update total supply with the decimal amount
        balanceOf[msg.sender] = totalSupply;                // Give the creator all initial tokens
        name = tokenName;                                   // Set the name for display purposes
        symbol = tokenSymbol;                               // Set the symbol for display purposes
    }


texts: In Remix switching from "JavaScript VM" to "Injected web3"

texts:
have tested on "JavaScript VM"....all OK.
Have switched to "Injected web 3" to see real chain  behaviour.
On "Deploy" I am getting Send Transaction failed: invalid address. if you use an injected provider please make sure it is unlocked.

Also I notice my "Account" combo in remix is empty.
Any one help on what to do to proceed ?
thx /L


texts: Ethereum pruning: What if no archival node existed?

texts:
I was reading about pruning in Ethereum which is basically a way to run a full node without needing to keep over 1TB of blockchain data. To my understanding, the whole blockchain exists but only keeps the state hashes, while the old trees themselves are not kept. Security is not an issue with the Proof of Work consensus properties assuming we keep a sufficient "depth" of states.

My questions are as follows:

Besides the various blogposts and stackexchange answers, is pruning
more formally described somewhere?  I don't see anything mentioned
in the yellowpaper.
I understand that by pruning the states, and since ethereum is
account-based and not UTXO-based, you can still get an account
balance but you can't derive the historical balance of an account.
Does this imply that you can't query for old transactions as well?
(assuming no archival nodes exist)


texts: Can we compare bonding curve tokens to a ponzi scheme?

texts:
Bonding curve tokens are, unlike ICO, not driven by the market, but priced by a smart contract.
They are based on the following two main properties :

Limitless supply : Tokens are minted as the demand progresses.

Deterministic price : Price is determined by the token smart contract and increases with the supply. Basically, the more
holders there are the higher is the price. Conversely, when holders sell back the token to the contract, price decreases.

Here is my question : Can we compare this kind of token to a ponzi scheme ? Why ?


texts: Casting from msg.sender address to a Contract compiles but causes test failure

texts:
I have the following simple contracts:

contract HasOwner {
    address public owner;

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

and

import './HasOwner';

contract Mudhoney is HasOwner {
    function Mudhoney() HasOwner() public {}
}

and

import './HasOwner';
import './Mudhoney';

contract Melvin is HasOwner {

    event FoundJustice(Mudhoney mudhoney);

    function Melvin() HasOwner() public {}

    function foundJustice() external {
        Mudhoney mudhoney = Mudhoney(msg.sender);
        FoundJustice(mudhoney);
    }
}

deployed via migration to Truffle's internal testnet:

const Mudhoney = artifacts.require('./Mudhoney.sol')
const Melvin = artifacts.require('./Melvin.sol')

const migrate = (deployer, network, accounts) => {
  deployer.deploy(Mudhoney, { from: accounts[0] }).then(() => {
    console.log('Deployed Mudhoney with address', Mudhoney.address, 'from address', accounts[0])
  })

  deployer.deploy(Melvin, { from: accounts[1] }).then(() => {
    console.log('Deployed Melvin with address', Melvin.address, 'from address', accounts[1])
  })
}

module.exports = migrate

and tested via

const Mudhoney = artifacts.require('./Mudhoney.sol')

contract('Mudhoney', (accounts) => {
  const tester = accounts[0]

  it('is owned', () => Mudhoney.deployed()
    .then(instance => instance.owner())
    .then((owner) => {
      assert.equal(owner, tester, `Expected the owner to be '${tester}'`)
    }))
})

const Melvin = artifacts.require('./Melvin.sol')

contract('Melvin', (accounts) => {
  const tester = accounts[1]

  it('is owned', () => Melvin.deployed()
    .then(instance => instance.owner())
    .then((owner) => {
      assert.equal(owner, tester, `Expected the owner to be '${tester}'`)
    }))
})

The test of Mudhoney passes just fine but the test of Melvin fails

1) Contract: Melvin is owned:
   Error: Invalid number of arguments to Solidity function
    at Object.InvalidNumberOfSolidityArgs (/Users/davesag/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/cli.bundled.js:43290:16)
    at SolidityFunction.validateArgs (/Users/davesag/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/cli.bundled.js:329512:22)
    at SolidityFunction.toPayload (/Users/davesag/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/cli.bundled.js:329528:10)
    at SolidityFunction.call (/Users/davesag/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/cli.bundled.js:329569:24)
    at SolidityFunction.execute (/Users/davesag/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/cli.bundled.js:329698:22)
    at /Users/davesag/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/cli.bundled.js:318032:16
    at new Promise (<anonymous>)
    at /Users/davesag/.nvm/versions/node/v8.9.0/lib/node_modules/truffle/build/cli.bundled.js:318023:18
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)

After some trial and error I discovered that the Solidity function it's complaining about is the casting Mudhoney mudhoney = Mudhoney(msg.sender) in Melvin's foundJustice function.

Why is that not working, and why does the test even care given it's not trying to execute the foundJustice function but the owner function.


texts: Cannot create contract from another contract - truffle and ganache

texts:
I'm trying to write a test with ganache and truffle to create a contract instance from another contract.

Everything works in Remix but it doesn't in ganache. This is the code

const assert = require('assert');
const ganache = require('ganache-cli');
const Web3 = require('web3');
const web3 = new Web3(ganache.provider());

const compiledFactory = require('../build/contracts/EntityFactory.json');
const compiledEntity = require('../build/contracts/Entity.json');

let accounts;
let factory;

beforeEach(async () => {
  accounts = await web3.eth.getAccounts();

  factory = await new web3.eth.Contract(compiledFactory.abi)
    .deploy({ data: compiledFactory.bytecode })
    .send({ from: accounts[0], gas: '6721975' });

  // create rootEntity
  console.log('create root entity from account: ' + accounts[1]);
  try {
    await factory.methods.createEntity().send({
      from: accounts[1],
      gas: '1000000'
    });
  } catch (e) {
    console.log(e);
  }
  console.log('created root entity');
});

describe('Entities', () => {
  it('deploys a factory and an entity', () => {
    console.log(factory.options.address);
  });
});

The console output I receive after runnung "truffle test" is:

create root entity from account: 0x5DE926288f995e7F916f2348894C200545804714
c: VM Exception while processing transaction: revert
    at Function.c.fromResults (/Users/....../ethereum/transparency/node_modules/ganache-cli/build/ganache-core.node.cli.js:2:157333)
    at A.processBlock (/Users/....../ethereum/transparency/node_modules/ganache-cli/build/ganache-core.node.cli.js:17:121734)
    at processTicksAndRejections (internal/process/task_queues.js:89:5) {
  name: 'c',
  results: {
    '0xeed3e78f724bd4c079efda4192df9b95684a45f3789e9c93594dce663a42ccff': {
      error: 'revert',
      program_counter: 2198,
      return: '0x',
      reason: undefined
    }
  },
  hashes: [
    '0xeed3e78f724bd4c079efda4192df9b95684a45f3789e9c93594dce663a42ccff'
  ],
  message: 'VM Exception while processing transaction: revert'
}
created root entity
assign address root
assigned address root
create child entity
    1) "before each" hook for "deploys a factory and an entity"

  0 passing (533ms)
  1 failing

  1) "before each" hook for "deploys a factory and an entity":
     c: VM Exception while processing transaction: revert
      at Function.c.fromResults (node_modules/ganache-cli/build/ganache-core.node.cli.js:2:157333)
      at A.processBlock (node_modules/ganache-cli/build/ganache-core.node.cli.js:17:121734)
      at processTicksAndRejections (internal/process/task_queues.js:89:5)

Here's the EntityFactory code:

pragma solidity ^0.4.17;

contract EntityFactory {
    Entity[] public deployedEntities;
    mapping(address => bool) public deployedEntitiesMap;

    function createEntity() public {
        Entity newEntity = new Entity(msg.sender);
        deployedEntitiesMap[newEntity] = true;
        deployedEntities.push(newEntity);
    }

    function getDeployedEntities() public view returns(Entity[]) {
        return deployedEntities;
    }
}

The Entity's constructor:

function Entity(address creatorAcc) public {
    creator = creatorAcc;
    manager = creatorAcc;
    isManaged = false;
}

I'm completely new with ethereum, just learning!
Thanks


texts: Return one of more parameters in Solidity

texts:
I have a function that inside have a if-else.My idea is to return a couple of parameters if the conditions is fulfilled or one string if the condition is not fulfilled . The problem is that in the function creation I put to returns more than one parameter.

function getOrigin (uint _id) isOwner public returns (address, string, uint32, uint16)
{
    if (travels[_id].clientAddress == msg.sender)
        return (travels[_id].clientAddress, travels[_id].originAirportName ,travels[_id].originTime ,travels[_id].originBagWeight);
    else
        return (msg.sender,"Acceso prohibido",3,3);
}

At the moment I load fake values to the return. But if I want just to return the second parameter of the else return?


texts: Problem with start() in web3-provider-engine

texts:
While trying to connect to a provider(infura) I get the above error below is the full stack trace:

bundle.js:54318 Uncaught TypeError: this.provider.sendAsync is not a function
at Web3Subprovider.handleRequest (bundle.js:54318)
at next (bundle.js:53398)
at Web3ProviderEngine._handleAsync (bundle.js:53385)
at Web3ProviderEngine._fetchBlock (bundle.js:53494)
at Web3ProviderEngine._fetchLatestBlock (bundle.js:53470)
at Web3ProviderEngine._startPolling (bundle.js:53447)
at Web3ProviderEngine.start (bundle.js:53341)
at window.onload (bundle.js:61042)
Web3Subprovider.handleRequest @ bundle.js:54318
next @ bundle.js:53398
Web3ProviderEngine._handleAsync @ bundle.js:53385
Web3ProviderEngine._fetchBlock @ bundle.js:53494
Web3ProviderEngine._fetchLatestBlock @ bundle.js:53470
Web3ProviderEngine._startPolling @ bundle.js:53447
Web3ProviderEngine.start @ bundle.js:53341
window.onload @ bundle.js:61042


texts: how to send transaction with geth running in light mode on testnet

texts:
I am having troubles to sendTransaction with geth running in light mode.

Startup:

geth --testnet --syncmode "light" --rpc --rpcport 10001 --rpccorsdomain "*" --rpcaddr 127.0.0.1 --datadir /opt/blockchain/ropsten-light/ --lightpeers 10 --lightkdf conso
le 2>/tmp/ropsten.log

Console:

Welcome to the Geth JavaScript console!

instance: Geth/v1.8.7-stable-66432f38/linux-amd64/go1.10
 modules: admin:1.0 debug:1.0 eth:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

Unlock account:

> personal.unlockAccount(eth.accounts[0], "password", 600)
true

Send transaction:

eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: web3.toWei(0.001, 'ether')})

After issuing sendTransaction console freeze. If I issue ctrl+c to get back to the command line console is terminated.


texts: How to explore all transactions for a given account?

texts:
After beeing able to check account balances, I am looking for a method to list all transactions for a given Ethereum account through json-rpc protocol. I haven't found any method suitable for that on https://github.com/ethereum/wiki/wiki/JSON-RPC .

Similar to https://etherscan.io/txs?a=0xbb9bc244d798123fde783fcc1c72d3bb8c189413 I am trying to build an explorer that shows all transactions from a given account.

At How can all transactions sent to an address be found? a similar question is asked but I am not looking for a solution through a third party, but by querying directly to my ethereum node through json-rpc protocol.

Am I missing something? Is that possible to do through the json-rpc interface?


texts: Recovering ETC from a contract (not DAO) / running MIST

texts:
The issue I have is that I have some ETC in an old wallet from the pre-fork time. Most of them are located in a contract with positive balance shown using an explorer.

I am able to enter my wallet from online wallets but there are only 3 etc as balance. I cannot liquidate contract to move the rest of etc to the main address.
Can it be done by online wallet and how? tried access contract on https://classicetherwallet.com/#contracts but I don't know these Json strings mystyery...

Another option is to use standalone wallet, I downloaded MIST and Ethereum wallet, got the wallet imported on geth but none of them is downloading blocks. NAT ports are open but it does not help. Tried to download the chain by torrent but no one is seeding.

What can be done to access my contract?


texts: Vesting contract is throwing an error 'subtraction overflow'

texts:
I scripted a contract for token vesting taking clue from VestingVault.sol
But when I run function addTokenGrant(), it throws an error of subtraction overflow.
I believe the error is coming from transfer of tokens from owner to contract
require(token.transferFrom(owner(), address(this), _amount));

My contract is saved at Ashishk74/VestingVault
I have provided 1 biilion totalsupply to owner in ERC20 contract, so why this error ?
Any help will be much appreciated.
Thanks


texts: In web3.js is the .deployed function deprecated?

texts:
I was following a tutorial where i found that we can create an instance without passing the address of the contract to create the instance. Like this:

Voting.deployed().then(function(contractInstance) {
  contractInstance.voteForCandidate(candidateName, {gas: 140000, from: web3.eth.accounts[0]}).then(function() {
    let div_id = candidates[candidateName];
    return contractInstance.totalVotesFor.call(candidateName).then(function(v) {
      $("#" + div_id).html(v.toString());
      $("#msg").html("");
    });

I checked the web3.js documentation but couldn't find anything. Is this function deprecated?
Is there any other way of creating an instance of a contract without passing the address -I am using truffle and testrpc.


texts: How can I do a charAt() in solidity? Solidity has little support for strings because it is expensive. That matters to the main network, but I am running a personal network so the gas cost can be whatever.


texts:
I have trouble syncing to Ropsten. I have just upgraded geth version to 1.8.7, then i run the command to remove the old chain: geth --testnet removedb. Then the command:

  geth --testnet --syncmode "fast" --rpc --rpcapi="db,eth,net,web3,personal,web3" --rpcaddr="localhost" --rpcport="8545" --rpccorsdomain="http://localhost:3000" --bootnodes "enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303,enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303"

but it stucks for hours at

"INFO [05-05|02:07:10] Mapped network port                      proto=tcp extport=30303 intport=30303 interface="UPNP IGDv1-IP1".

Can anyone please help me out?

Re-edit: After @Ismael proposal to remove the bootnodes, geth started running. Eventually it synced to Ropsten after the fork


texts: Metamask shows “ALERT: Transaction Error. Exception thrown in contract code” but transaction succeeds without error

texts:
I'm working on a dapp . and metamask show me error Metamask shows “ALERT: Transaction Error. Exception thrown in contract code” . I have successfully deployed the contract and the error come when i try to stake the token that are allowed and stored in the allow token array
address[] allowedTokens;

modifier tokenAllowed(address _token) {
        require(tokenIsAllowed(_token));
        _;
    }

    function tokenIsAllowed(address token) public view returns (bool) {
        for(uint256 i=0; i < allowedTokens.length; i++){
            if(allowedTokens[i] == token){
                return true;
            }
        }

        return false;
    }

function stakeTokens(uint256 _amount, address token, StakingTime _time) public tokenAllowed(token){
        // Require amount greater than 0
        require(_amount > 0, "amount cannot be 0");
        IERC20(token).transferFrom(msg.sender, address(this), _amount);
        setTime(msg.sender, token, _time);
        uint256 fees = _amount / 100;
        _amount = _amount - fees;
        stakingBalance[token][msg.sender] = stakingBalance[token][msg.sender] + _amount;
        userStakes[token][msg.sender] = StakingSubmission(msg.sender, token, _amount, _time);
        emit Staking(msg.sender, token, _amount, _time);
    }


texts: Will the Gnosis multisig wallets be compatible with the Eth hard fork

texts:
Does anyone know whether Gnosis multisig wallets are going to be compatible with the Eth hard fork happening soon?

I am worried that the funds I have in mine might not be safe.


texts:
I am about to invest in mining big time and questions regarding mining solo. I'm building a system consisting of 10 units with 168Mh/s of processing power. Is my effort on the pool calculated all togheter?
Where can I find a pool that pays ether for the amount of what you have done.
Like if you mine for 1ETH you get 1ETH and pay a fee on that.

Should i mine Pool or Solo? Where can I mine Solo? if my processing power is calculated all togheter is 1680Mh/s good for solo?

I am starting to get this togheter but I need some help with pool selection.


texts:
i have function which needs to transfer some funds and then emit an event. Here is the code

pragma solidity ^0.4.8;

contract Rental {
    struct PaidRent {
        uint id;
        uint value;
    }
    event RentPaid(bool Status);
    PaidRent[] public paidrents;
    function payRent(uint _rent) public payable returns(bool status) {
        owner.send(_rent);
        paidrents.push(PaidRent({
            id : paidrents.length + 1,
            value : _rent
        }));
        RentPaid(true);
        return true;
    }
}

in my angular service i am calling this function and then watching for the event. following is sevice code

paymyRent(contractInstance, rent) {
    this.contractevent = contractInstance.RentPaid();
    this.contractevent.watch(function (error, result) {
      if (!error) {
        console.log(result.args);
      } else {
        console.log(error);
      }
    });
    contractInstance.payRent(rent, {from: this.web3.eth.accounts[0],
      gas:1000000, value: this.web3.toWei(0.01, "ether")});
  }

but this event is never emitted. Any idea what is problem here?


texts:
In any language, I would write following:

struct Node {
   void* data;
   Node* next;
}

...

head.next = new Node(data, null)

But it seems that solidity doesn't have a concept of pointers.

How could it be done here?

EDIT
The answer at the end of Are there well-solved and simple storage patterns for Solidity? is not enough for me as I also need to insert nodes to the middle.


texts: How does ethereum compare to rootstock? Except obviously that rootstock uses bitcoins exclusively.


texts: Transaction to Smart Contract runs out of gas on Ropsten but not on Rinkeby

texts:
the following execution of my smart contract function runs out of Gas on the Ropsten network, but works fine on Rinkeby, do you have an idea why this happens?

struct vehicleData{
        string status;
        uint timestamp;
        string mileage;
        string gps_position;
        string soc_relative;
        uint soc_absolute;
        string sessionId;
    }

    mapping(string => vehicleData) private data;

    function setVehicleData(string memory vin, string memory status, uint timestamp, string memory mileage, string memory gps_position, string memory soc_relative, uint soc_absolute, string memory sessionId) public{
        data[vin] = vehicleData(status,timestamp,mileage,gps_position,soc_relative,soc_absolute,sessionId);
    }

this is what I do in my Javascript Code:

const gasLimit = 100000;
const gasPrice = '2';
    const txObject = {
                nonce: web3.utils.toHex(txcount),
                gasLimit: web3.utils.toHex(gasLimit),
                gasPrice: web3.utils.toHex(web3.utils.toWei(gasPrice, 'gwei')),
                to: storeAndCheckAddress,
                data: contractStoreAndCheck.methods.setVehicleData(vin, status, timestamp, mileage, gps, soc_relative, soc_absolute, sessionId).encodeABI()
            }
            const tx = new Tx(txObject)
            //sign transaction with private key from sender
            tx.sign(privateKey)

            const serializedTx = tx.serialize()
            const raw = '0x' + serializedTx.toString('hex')

            //send tx
            web3.eth.sendSignedTransaction(raw,function(error,result){if(!error){return result}else{console.log(error)}});

Success on Rinkeby:
https://rinkeby.etherscan.io/tx/0x86c3cfc3a5fb058810cc1854b6231b51224346e9fdd2ef835b336dff0e3796a4

Failure on Ropsten:
https://ropsten.etherscan.io/tx/0xd48a369d549b8248383f5bd4bcf937cd1c727b6393bf2e7609ae6013258b11a6


texts:
I am working through the tutorial for zeppelin-os found here: https://docs.zeppelinos.org/docs/linking.html

and have an error when running zos create

  Could not find file zos-lib/contracts/Initializable.sol in the project
  (imported from contracts/TokenExchange.sol)

I thought it would be an error with the install of zos-lib@2.4.0 so tried to install it again, and received the following errors

  ryan@LAPTOP-SBSEC33S:~/token-exchange$ sudo npm install zos-lib@2.4.0
  npm WARN deprecated lodash.isarray@4.0.0: This package is deprecated.
  Use Array.isArray.
  npm WARN deprecated fs-promise@2.0.3: Use mz or fs-extra^3.0 with
  Promise Support
  npm WARN deprecated tar.gz@1.0.7: ⚠  WARNING ⚠ tar.gz module has
  been deprecated and your application is vulnerable. Please use tar
  module instead: https://npmjs.com/tar

    scrypt@6.0.3 preinstall /home/ryan/token-exchange/node_modules/scrypt
    node node-scrypt-preinstall.js                                                                                > scrypt@6.0.3 install /home/ryan/token-exchange/node_modules/scrypt> node-gyp rebuild
    gyp ERR! configure error
    gyp ERR! stack Error: EACCES: permission denied, mkdir
    '/home/ryan/token-exchange/node_modules/scrypt/build'
    gyp ERR! System Linux 4.4.0-17763-Microsoft
    gyp ERR! command "/usr/bin/node"
    "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js"
    "rebuild"                              gyp ERR! cwd
    /home/ryan/token-exchange/node_modules/scrypt
    gyp ERR! node -v v10.16.0
    gyp ERR! node-gyp -v v3.8.0
    gyp ERR! not ok
    npm WARN token-exchange@1.0.0 No description
    npm WARN token-exchange@1.0.0 No repository field.
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! scrypt@6.0.3 install: node-gyp rebuild
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the scrypt@6.0.3 install script.
    npm ERR! This is probably not a problem with npm. There is likely
    additional logging output above.
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /home/ryan/.npm/_logs/2019-06-29T04_11_35_411Z-debug.log

It is not clear to me how to fix it in order to progress further in the tutorial


texts: Is there any method in web3 through we can verify whether the nonce associated with any transaction or not of same from address?

texts: How to get the new nonce of from address using web3? There shouldn't be any transaction associated with this. Is there any way to get this.


texts: Run out of Gas when trying to create contract

texts:
I am trying to create a contract that has an instance of two other contracts. I am unable to create it. It keeps running out of gas even if I increase it to 999999999999999999999999999.

If I comment the functions that call functions in the other two contracts, it gets created, otherwise it doesn't.

Is there a way around it? How do contracts that use other contracts get created??


texts: How to collect all contract instantiations and count the bytecode redundancies?

texts:
I want to traverse the Ethereum blockchain, collect all contract instantiations, and count how often which bytecode has been instantiated.

As result I want to have a map with key:hash(bytecode) -> value:instanceCount

If you wish to know, why I am doing it, read EIP 911 - Reduce gas costs for deploying runtime bytecode by copying bytecodeHash from an existing contract

So far, I have the following ideas how it could be done:

Idea 1
Use web3 to collect all transaction with 0x0 as target, get the contractAddress from the receipt, get the code of this contract, count it in the map. [Q]: how to collect the instantiations that happen within the contracts (-> new)?

Idea 2
For every block get the state root hash, load the corresponding trie from the database (leveldb/geth), traverse the tree, collect all accounts, if account not processed yet, grab the code hash and increase the count, move to the next block. [Q]: traversing the complete trie block by block is most probably inefficient. Is there a way to traverse only the paths that changed since the last block?

Idea 3
Traverse the state trie of the latest block only and count bytecode redundancies as described in 2. This simplifies the implementation, but historical data is not considered.

[Q]: Any other ideas?

EDIT: You can find the code duplication counter implemented in JavaScript in my GitHub Repo -> https://github.com/ivica7/eth-chain-stats-collector


texts: How do I get my eth from Etherscan to stop being pending and send to my lion's share account?

texts: I am already a member in Lion's Share and I have purchased up to level 3 so far. I am trying to figure out why I dont see my ETH in my Lion's Share and pending transactions in Etherscan? When I click on go to Etherscan I notice a lot of pending transactions that is being sent to me, but have not received them. I just started about a week ago, so I am new to this and trying to learn it as well. Would someone be able to help me with this?


texts: Truffle Contract sendTransaction not immediately returning transaction hash

texts:
I am using Truffle Contract to call a Smart Contract method that writes to the ethereum blockchain. My web3 client is connected to my own Open Ethereum node. Below is the code (nodejs) that I am using to send the transaction to blockchain. I would expect, since this is an asynchronous call that the response would be immediately and the transaction hash value would be returned. However, this is NOT happening. The only time I get a response is after the transaction is mined. I can't rely on this because my front-end client will time out (30 secs for AWS API Gateway). What am I doing wrong? I can see all the eth_getTransactionReceipt json calls in my OE log, being called back to back until the transaction is mined.
async function sendTransClaimProperty(_instance) {
    var result;

    try {

      result = await web3.eth.personal.unlockAccount(web3.eth.defaultAccount, process.env.oranges, null);
      console.log(web3.eth.defaultAccount + " Account UnLocked", result);

      if (result) {
            var claimState = "Property Claimed on " + new Date();
            console.log("Calling Ethereum Node at " + new Date());

            result = await _instance.claimProperty.sendTransaction(claimTitle,claimHash,claimTime,claimCreditCardTx,claimClientIP,claimState);

            console.log("Return from Ethereum Node result", result);
            console.log("Return from Ethereum Node. TX", result.tx);
            return { response: "OK", transHash: result.tx };

      }
    }
    catch (error) {

      console.log("Error Sending Transaction");
      console.log(error.message);
      return { response: "FAIL", message: "Error claiming property " + error.message };

    }

  }


texts: Vyper vs. Solidity - benefits and differences

texts:
What are the benefits and differences of using Vyper over Solidity for smart contracts?

Are there any other differences besides syntax?
Are there any features for better developer experience (besides less typing with cleaner syntax)
Does Vyper provide better safety and security e.g. by stricter modifiers, defaults, and so on
Can Vyper and Solidity interact 100% - i.e. all Solidity functions can be called from Vyper and vice versa
What is the difference in toolchain maturity: static analyzers, code coverage tools, easy of installation, documentation and so on


texts: How is excepting ether from a smart contract different than from a regular address?

texts: We are implementing an ethereum payment for our customers and need to decide between deposits to a smart contract or individual customer addresses. What are pros and cons? Is it possible to hide our smart contract's balance if we use it for all payments? Why do some exchanges do not accept payments from smart contracts - is it because of missing customer tracking information?


texts: How to keep track of deployed versions and implement a CD strategy with truffle?

texts:
My original question on SO here didn't had much success... so I copy/paste it here, hoping for more interest. Thanks in advance!

I'm working on a dapp project which includes a main smart contract, with some dependencies to interface and storage contracts (long story short: the main contract implements an ERC standard and use a data segregation strategy to render) my contract upgradable

The contracts and the front-end source codes are under version-control in the same git repository.
I use truffle for unit testing (with ganache-cli) and compilation.

I have a CI/CD (Gitlab) that runs:

linters
build the contracts
bundle of the webapp (using parceljs)
testing of the contracts using truffle's test runner
testing of the webapp using Jest
(istanbul reports for code coverage using solidity-coverage and Jest)

Until now, I only needed to test the whole dapp locally, and thus all I have to do is to deploy on the local ganache devchain, and then import the .json of the built contract in the JS code of the front-end like that:

import { abi, networks } from "../build/contracts/myContract.json";
...

then I can instantiate the contract using the abi and the deployed address, and passing the chainId to parceljs's bundler with dot.env like that:

...
var myContract = new web3.eth.Contract(abi, networks[process.env.CHAIN_ID].address);
...

I'm then able to test the whole dapp locally with parcel's integrated web server.

Now, I want to implement a continuous deployment strategy, for a staging environment, and then later also a production environment, using my gitlab instance.
I've a good idea on how to automate contracts deployment using truffle configuration, a @truffle/hdwallet-provider pointing to a running ethereum node, and storing a seed phrase in a gitlab hidden variable.
But I'm facing two problems:

1. Keeping track of deployed instances

Truffle keeps track of the deployed instances of a contract using the same file as the one that contains the compiled bytecode. In my understanding, truffle does something like comparing the bytecode with the deployedBytecode, and maybe also if the address of the deployer generates a new instance or if the derived address of the new contract would be the same as the one already deployed (not sure about that...).
At the end of the contract-deploying script, I should be able to store the contract address in an environment variable and pass it to the script that will transpile, bundle and then deploy (on IPFS) the dapp front-end.

Thus, first question is : Should I version-control the .json file produced by a truffle compile to be sure that the project repository acts as the truth source for deployed versions ?

2. Impossibility to update this versioned file when deploying new contract versions

But, If I deploy a new contract version from a CI/CD script (using a migration script that passes the persistent segregated data-storage contract to the new main contract instance), obviously it would not be possible for the CI/CD script to itself push a git commit for the .json file with the updated values (new contract address, transaction hash, etc.)...

I've been thinking about other solutions, including the usage of npm scripts that would manage the migrations/deployments (with GPG encrypted seed phrase to insure that only the maintainers of the project would be able to deploy with the associated ethereum accounts) and then update another specific .json file to keep track of deployed instances, and the same script parsing this file and modifiying the truffle .json file before launching the migration script...
But this has another major inconvenient : a less scrupulous maintainer may be able to bypass the tests and force deployment even in the case of a unit or integration test failing...

So, the real question here is :
What is the best CI/CD strategy for continuous deployment of smart contracts using truffle's migrations and Gitlab's (on premise) CI/CD with docker runners ?


texts:
This message shows up when I try to install truffle

npm install -g truffle
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!  { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!   stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/janinebarnard/.npm/_logs/2018-