texts:
In an attempt to compile my ABI and verify my contract, I am getting the following warning: "ParserError: Expected pragma, import directive or contract /interface/library definition" on the first line as shown. Kindly, assist me in overcoming this hurdle. My ABI source code is as follows:
pragma solidity ^0.5.8;
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";

{
^ "contractName": "Salemcash",
  "abi": [
{
  "inputs": [],
  "payable": false,
  "stateMutability": "nonpayable",
  "type": "constructor"
}, {
  "constant": true,
  "inputs": [
    {
      "name": "account",
      "type": "address"
    }
  ],
  "name": "getBalance",
  "outputs": [
    {
      "name": "",
      "type": "uint256"
    }
  ],
  "payable": false,
  "stateMutability": "view",
  "type": "function"
}, {
   "name": "gulp-solidity-abi",
   "version": "0.0.3",
   "description": "Gulp plugin to extract the ABI from Solidity contract",
   "scripts": {
   "coverage": "nyc _mocha",
   "test": "mocha"
},
   "repository": {
   "type": "git",
   "url": "git+https://github.com/PastorOmbura/SalemCash"
},
   "keywords": [
    "Salemcash",
    "gulpplugin",
    "solidity",
    "abi",
    "gulp",
    "plugin"
],
   "author": {
   "name": "Pastor Ombura",
   "email": "alex.ombura@gmail.com",
   "url": "http://salemcash.org/"
},
   "license": "The LevelDB Authors",
    "bugs": {
    "url": "https://github.com/PastorOmbura/SCS/blob/1800dc20e583c129542d5306a5efd499d04b0e66/build-windows.md"
},
   "homepage": "https://github.com/PastorOmbura/SCS#readme",
   "devDependencies": {
   "chai": "4.1.2",
   "chai-string": "1.5.0",
   "gulp": "4.0.0",
   "gulp-rename": "1.4.0",
   "mocha": "5.2.0",
   "mocha-lcov-reporter": "1.3.0",
   "nyc": "13.1.0",
   "vinyl-fs-fake": "^1.1.1"
},
  "constant": false,
  "inputs": [
     {
      "name": "to",
      "type": "address"
    },
    {
      "name": "amount",
      "type": "uint256"
    },
 {
  "name": "transfer",
  "outputs": [],
  "payable": false,
  "stateMutability": "nonpayable",
  "type": "function"
}]


texts: Function selector for constructor & fallback function?

texts:
According to https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI, function selector is hashed from function name and list of its arguments put inside ().

For example, with function deposit(uint value), the function selector is Keccak hash of string deposit(uint256)

However, it is not clear in the case of constructor & fallback functions: what should be strings - to be hashed - for below 2 cases?

constructor(address addr) public { }

function () payable public { }

Thanks.


texts: could n't find ABI constructor in my input data

texts: I have developed the solidity code and need to verify the smart contract but I could not find Constructor Arguments ABI-encoded check the screenshots, i have developed in testnet


texts:
In Apr. empower had an airdrop that they said only wallets that had .1 ETH. would get it. Was that the customary requirement in Jan when the crypto blockchain was jammed?. And wasn't that lowered to .01 by most exchanges by Feb?
I suspect they were using old rates from Jan. They made everyone has .1 ETH due to their ineptness I figure.
Is there a chart or data that shows what was customary at different times?


texts: Why is the gas limit dropping in my private network once my local node connects?

texts:
I have a private network consisting of a "Ethereum proof-of-work consortium" on Azure and my development pc.

In azure there are 2 mining nodes and one transaction node. All on Ubuntu virtual machines running geth 1.8.11. My dev pc is windows 10 with geth 1.8.12.

In the genesis.json I set the gaslimit to 100000000000 because the application I'm developing will always run on a private network where gas shouldn't be a problem.

However I noticed that the gas limit on each block was dropping when I turned on mining on my development pc and started slowly rising again when I stopped it. Even when I set the flag --targetgaslimit on my dev pc to 100000000000, just like it is set on the two mining nodes. It will just keep falling when my dev pc is mining and rising when it's not.

In my understanding, since all three nodes that are mining have the same target gas limit it would just continuously go up since all three machines would be voting to get it near to 100000000000. However it doesn't, two keep voting to pull it upward and one keeps voting to pull it down.

Does anyone know why this keeps happening? It prevented me from deploying some contracts because my dev pc kept pulling the gaslimit down.

Edit: I tried setting the targetgaslimit of my local node to 99913949 just above the current limit of 94513949 and it still keeps dropping.


texts: Does the Ethereum node execute the contract code before propagating it to others?

texts: As I know, there each received transaction is validated before propagation it to other nodes. So I want to know, is execution of smart contracts a part of this validation? What would be the reason?


texts: Can we program in Solidity the distributed computations ?

texts:
Can we use the solidity language (or any other language) to develop a program that each node of the network does the same operation with different inputs and that the nodes can communicate between them ?

For example, we have 3 nodes in the network, can we develop a program as following : The first node N1 computes C1=m+r1 (where m is initiated input for the node N1, r1 is randomly generated by the node N1) then sends the result to the next node. This second node N2 will compute C2=C1+r2 (where r2 is randomly generated by the node N2) then send the result C2 to the last node N3. This latter will finally compute C3=C2+r3.

Thanks for help !


texts: one Private Key with two different ERC20 tokens

texts:
I have an ETH key in my wallet. It has BAT and ELF tokens in it. That's why I can not send or trade this one key with two different tokens (in this wallet).

How can I turn this one key into two keys? A key for BAT and a key for ELF.

Many thanks for your help
(wenn jemand Hilfe auf deutsch anbieten kann um so besser)


texts:
I am having trouble doing some string comparison against the last 2 digits of a block hash in solidity. I'm also a little bit confused about how to work with a single character, as it appears that a single byte in solidity contains 2 characters.

I grab a blockhash:

bytes32 myHash = block.blockhash(block.number - 1);

And I get something like:

  "0x18676e992055c057538d59b378271bb4eacdb7f6abf9e815fd63255dc11166b6"

I attempt to grab the last character by doing:

byte x = myHash[31];

This gives me a value like this, when printed in a log:

  "b600000000000000000000000000000000000000000000000000000000000000"

This is where I'm confused. This is the last 2 characters of the bytes32. I want to use the following function to determine the hex integer value of the character:

function getCoordinate(byte val) returns(uint) {
    if (val == "0") {
        return 0;
    } else if (val == "1") {
        return 1;
    } else if (val == "2") {
        return 2;
    } else if (val == "3") {
        return 3;
    } else if (val == "4") {
        return 4;
    } else if (val == "5") {
        return 5;
    } else if (val == "6") {
        return 6;
    } else if (val == "7") {
        return 7;
    } else if (val == "8") {
        return 8;
    } else if (val == "9") {
        return 9;
    } else if (val == "a") {
        return 10;
    } else if (val == "b") {
        return 11;
    } else if (val == "c") {
        return 12;
    } else if (val == "d") {
        return 13;
    } else if (val == "e") {
        return 14;
    } else if (val == "f") {
        return 15;
    }
}

However, none of the cases match, so it always returns 0. Anyone have any knowledge of how to get a single character so that this function will work properly?


texts: How to debug Geth's go code from within Intellij Webstorm?

texts:
I would like to be able to debug through Geth's Go code - using Intellij Webstorm.

Ideally, I would like to run a, private, Geth node inside of Webstorm and set a breakpoint, but I would also settle for remotely connecting to a local node that I have started from the command line.

It looks to me as if the entry point for Geth is main.go, however, when I try to run this I get the following errors:

.go/src/github.com/ethereum/go-ethereum/cmd/geth/main.go
# command-line-arguments
cmd/geth/main.go:112: undefined: configFileFlag
cmd/geth/main.go:143: undefined: initCommand
cmd/geth/main.go:144: undefined: importCommand
cmd/geth/main.go:145: undefined: exportCommand
cmd/geth/main.go:146: undefined: removedbCommand
cmd/geth/main.go:147: undefined: dumpCommand
cmd/geth/main.go:149: undefined: monitorCommand
cmd/geth/main.go:151: undefined: accountCommand
cmd/geth/main.go:152: undefined: walletCommand
cmd/geth/main.go:154: undefined: consoleCommand
cmd/geth/main.go:154: too many errors

Is someone able to help me with exactly how I can start Geth from within Webstorm i.e. not from the compiled, geth, binary, please?

--- Update after trying to run from the package instead of a file ---

Unfortunately, when I set the package to "github.com/ethereum/go-ethereum/cmd/geth" I get the following errors:

/usr/local/go/bin/go build "-ldflags=-linkmode internal" -o /tmp/___main_go github.com/ethereum/go-ethereum/cmd/geth

# github.com/ethereum/go-ethereum/cmd/geth

github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid(.text): relocation target __pthread_unwind_next not defined

github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid(.text): undefined: "__pthread_unwind_next"


texts:
It is said that
"The use of (block_timestamp - parent_timestamp) // 10 (* now 9)as the main input variable rather than the time difference directly serves to maintain the coarse-grained nature of the algorithm, preventing an excessive incentive to set the timestamp difference to exactly 1 in order to create a block that has slightly higher difficulty and that will thus be guaranteed to beat out any possible forks."

How to understand that? What is the benefit for miners to set the timestamp interval to be 1s? Why creating a block that has slightly higher difficulty can beat out any possible forks?


texts: 'Contract' object has no attribute 'eventFilter' web3.py

texts:
I am trying to filter Transfer events from my local ethereum node using web3 py. I have created a venv in visual studio code. My code is as follows:

def decodeLogswithfilter(t1, t2, abi1, addr):
    mycontract = geth.eth.contract(address=addr, abi=abi1)
    filter = mycontract.eventFilter(
        'Transfer', {'fromBlock': t1, 'toBlock': t2})
    eventlist = filter.get_all_entries
    print(eventlist)

decodeLogswithfilter(start, ending_block,
                         abi['result'], geth.toChecksumAddress(current_addr))

I have also tried using createFilter as well but it gives me the same error that Contract object has no attribute eventFilter.

Traceback (most recent call last):
  File "/mnt/ssd/erc721/queryBlockchain.py", line 150, in <module>
    abi['result'], geth.toChecksumAddress(current_addr))
  File "/mnt/ssd/erc721/queryBlockchain.py", line 71, in decodeLogswithfilter
    filter = mycontract.eventFilter(
AttributeError: 'Contract' object has no attribute 'eventFilter'

I have also tried upgrading my web3 package as suggested online, but the error didn't resolve.


texts: How to simulate orphaned/forked block locally?

texts: I want to simulate orphaned block locally, it's possible to do this?


texts: whether it is necessary delete item before reduce array length in solidity

texts:
pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;

contract ArrayOperation {

    string[] public arr;

    function append(string str) public {
        arr.push(str);
    }

    function removeByKey(string key) public {
        for(uint256 i = 0; i < arr.length; i++) {
            if(keccak256(abi.encodePacked(arr[i])) == keccak256(abi.encodePacked(key))){
                // keep order
                for (uint256 j = i; j < arr.length - 1; j ++){
                    arr[j] = arr[j + 1];
                }
                // delete last index
                delete arr[arr.length - 1];
                arr.length --;
                break;
            }
        }
    }

    function getLen() public view returns(uint256) {
        return arr.length;
    }

    function getArr() public view returns(string[] memory) {
        return arr;
    }

}

whether it is necessary to add delete arr[arr.length - 1]; before reduce array length?


texts:
I have created a private blockchain by initializing a new Genesis block. Created few accounts and have now substantial amount of Ethers as well. I am able to deploy and execute my contracts on this blockchain with the help of truffle. Using Mist am able to view the account balances. But I am not able to view the deployed contract via Mist under Contracts menu. Secondly not able to see any of the transactions performed using my Dapp. Using my Dapp I can get the details about the transactions performed and the latest state.

So what I am looking for a good Ethereum explorer, which I could use for my private blockchain to view all the details.

Thus request you to please suggest some ethereum explorers which I could run locally. It should attach to my Geth instance. I could query all the details about the transactions performed using my Dapp on this private blockchain.


texts:
I would like to send an encrypted message to an address, without knowing their public key.

If I understand ECIES correctly, in order to send an encrypted ECIES message to a party, say Bob, I need to know their secp256k1 public key. However it is not usually possible to figure out public key, at least from address alone.

So is it possible for me to perform public key encryption with a party where only ethereum address is known?


texts: What is Uniswap's AmountoutMin(uint256)?

texts: I want to use the Uniswap router contract to buy a token. However, I got confused by the amountoutmin(unit256) in the swapExactETHForTokensSupportingFeeOnTransferTokens of uniswap. I read the unswap documentation and it says "The minimum amount of output tokens that must be received for the transaction not to revert." Please can someone suggest what I am expected to write there and what it means. Thank you.


texts: Petshop tutorial of Truffle doesn't work. Confused with ports 7545, 8545,& 0 eth on metamask

texts: I am using testrpc,  metamask and Truffle. I followed Petshop tutorial on Truffle. The Truffle framework had.default. 7545 as local host port in it.. But my system gave 8545 port. The Petshop  app is running, but nothing is proceeding. And metamask is shows 0eth..it should  be 99. I need some help to understand all this


texts: How do I create a crowdsale that only accepts a specific erc20 token?

texts:
Let's say you've created and issued an ERC20 token. You then create a crowdsale and only want to accept the token you issued, not Ethereum.

Is this possible?


texts:
I don't know much about investing as i am still new to this. I use ethereum node Geth 1.7.2. I bought a certain percentage of ethereum without letting it sync or download the blocks first (though I have confirmed that I received ether online). What do I do now as the downloading is stuck with only 230 blocks left. As I do not want to do anything that would end up in my wallet information being lost.
Thank you


texts: Connecting to local blockchain using web3 and HttpProvider

texts:
I wrote an application to connect to the local blockchain. Here is the code:

var Web3 = require('web3');
var contract = require('./PublishService_abi.js');
var PublishServiceContract;
var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:7545"));

function init() {
  //initializing web3 to access blockchain
  initweb3();
}

async function initweb3() {
    try {
        /*//To make sure not to overwrite the already set provider when in mist, check first if the web3 is available
        if (typeof web3 !== 'undefined') {
                web3 = await new Web3(web3.currentProvider);
            console.log("inside if");
        } else {
            // create an instance of web3 using the HTTP provider
                web3 = await new Web3(new Web3.providers.HttpProvider("http://localhost:7545"));
            console.log("inside else");
        }*/
        console.log(web3.eth.accounts[1]);
        var PublishServiceContractAddress = "0x0da136781e562e28fb1c0b3efc8ce9d8b4e226f2";
        PublishServiceContract = await new web3.eth.Contract(contract,PublishServiceContractAddress);
        //console.log(PublishServiceContract.options.jsonInterface);
        await addServiceProducer1("LC1","SP1","location:inside;reading:degree","scattr","ngac");
    }
    catch(err) {
        console.log(err);
    }
}

async function addServiceProducer1(s1,s2,s3,s4,s5) {
    try{
        console.log(s1 +"\n" + s2 +"\n" + s3 +"\n" + s4 +"\n" + s5 +"\n" );
        const instance = await PublishServiceContract.methods.addEntry(s1,web3.eth.accounts[1],s2,s3,s4,s5).send({from:web3.eth.accounts[1]});
        console.log("sp details added successfully");
    }
    catch(err) {
        console.log(err);
    }
}

init();

The statement console.log(web3.eth.accounts[1]); returns undefined, where it should return the second account address. Can someone help me understand the problem with this code. I am using 1.0.0-beta.34 version of web3.

Thanks in advance


texts: Is there a need to check for null after casting?

texts:
Example:

MyReceiver my = MyReceiver(_to);    // To is an arbitrary address user provided
my.someFunction();                  // Do I need to check for my == null before calling?

Strange enough I do not see anyone doing so.


texts:
i have downloading blockchain with --syncmode "light" using this command

  geth --syncmode "light" --cache 1024 --rpc --rpcaddr 127.0.0.1 --rpcport 8545 --rpccorsdomain * --rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3

and blockchain seems to be up to date with every new block..

Now what should i do to start mining and work with web3 to connect to geth?


texts: Is it possible to *write* (not print) a paper wallet without having to copy a big JSON?

texts:
In Bitcoin, you can store a paper wallet by merely writing down the private key of an address, which is very small. You can also write ~20 words generated from that address, if you want. In Ethereum, in order to backup an account, I was suggested to copy a file on my keychain directory (OSX). The issue is, that file is a moderately big JSON. Writing all that in a paper is very error prone.

Is it possible to generate a small set of words, or just a hex private key, that I can write down in a paper and restore later?


texts: What happens when two smart contracts recursively call each other?

texts: As I understand it, a smart contract can "call" other smart contracts. So what happens when two smart contracts call each other in a recursive loop? Does the whole network break down and die?


texts: how distributed cloud storage works with ethereum blockchain?

texts:
Distributed Cloud storage is a great concept , I have been doing a lot of search on this topic but couldn't get the exact information i am looking for:-

How the projects like Storj are using the Ethereum blockchain, what minimal data is stored on the blockchain?
How these distributed file systems manage data ,storage and retrieval of data ?
How exactly smart contracts are useful in these kind of Dapps?


texts: Extracting Public key from signed Ethereum message or transaction in JavaScript

texts:
I'm trying to find out how to derive a public key (not the address) of an Ethereum account by using ethereumjs-util's ecrecover method.

Basically I get a transaction by hash using Web3, convert r, s and v like in this answer, and pass them to ecrecover. It does yield a public key, but that key does not correspond to the address of the sender of the transaction.

What am I doing wrong?

Code below:

const ethJsUtil = require('ethereumjs-util');

class EthPubKeyReg {

    constructor(web3, chainId) {
        this.chainId = chainId;
        this.web3 = web3;
    }

    async extractPubKey(txHash, chainId) {
        chainId = (chainId || this.chainId);
        let tx = await this.web3.eth.getTransaction(txHash);

        let v = parseInt(tx.v);

        let msgHash = ethJsUtil.toBuffer(tx.hash);
        let r = ethJsUtil.toBuffer(tx.r);
        let s = ethJsUtil.toBuffer(tx.s);

        let pubKey = ethJsUtil.ecrecover(msgHash, v, r, s);

        console.log("address", ethJsUtil.bufferToHex(ethJsUtil.pubToAddress(pubKey)));
        return pubKey;
    }

    async extractPubKeyString(txHash, chainId) {
        return ethJsUtil.bufferToHex(await this.extractPubKey(txHash, chainId));
    }
}

===== Update =====

I've updated my code the way @libertylocked suggested in his answer below:

const Web3 = require('web3');
const ethJsUtil = require('ethereumjs-util');
const Transaction = require('ethereumjs-tx');

const HDWalletProvider = require('truffle-hdwallet-provider');
let provider = new HDWalletProvider(
    'some words to instantiate this truffe hdwallet provider',
    "https://mainnet.infura.io/[ACCCESS TOKEN]"
);

let web3 = new Web3(provider);

/*
*  Extracts the public key of the sender of a
*  signed and mined transaction as Buffer
*/
async function extractPubKey(txHash, web3) {

    const tx = await web3.eth.getTransaction(txHash) // insert txhash here
    console.log("tx.from", tx.from);

    const txDetails = new Transaction({
        nonce: tx.nonce,
        gasPrice: `0x${tx.gasPrice.toString(16)}`,
        gasLimit: tx.gas,
        to: tx.to,
        value: `0x${tx.value.toString(16)}`,
        data: tx.input,
        chainId: web3.version.network,
        r: tx.r,
        s: tx.s,
        v: tx.v,
    });
    const pubkey = txDetails.getSenderPublicKey()
    console.log("txDetails.getSenderAddress", txDetails.getSenderAddress().toString('hex'));
    console.log("Pubkey to address", ethJsUtil.bufferToHex(ethJsUtil.pubToAddress(pubkey)));
    return pubkey;
}

/*
 *  Extracts the public key of the sender of a
 *  signed and mined transaction as hex string
 */
async function extractPubKeyAsString(txHash, web3) {
    return ethJsUtil.bufferToHex(await extractPubKey(txHash, web3));
}

// link to tx on Etherscan: https://etherscan.io/tx/0xbee6f2a54e1c4921dec2d6834334acd3177ce42229e1d1c4d2490fb60839634e
extractPubKeyAsString('0xbee6f2a54e1c4921dec2d6834334acd3177ce42229e1d1c4d2490fb60839634e', web3)
    .then(pubkey => {
        console.log("pubkeystring", pubkey);
    })
    .finally(() => process.exit());

However, this still yields an incorrect sender address:

tx.from 0xBa34A08bcAe1AB74b5e52b6eE06b108945A387f0
txDetails.getSenderAddress efc92668485027e2d41bd229d66111ad0aaa8a16
Pubkey to address 0xefc92668485027e2d41bd229d66111ad0aaa8a16
pubkeystring 0x6d5441c4e53bb8c4dd69b16e79d5ca4f51a84eebaded3b6dfc5b51dd63ee7b5c5707ca1e788653b07872dd8c13293be840c93aeae582f2c080ff8a3aef79a24f


texts: Need help with the following type for agrument in function call:

texts:
TypeError: Invalid type for argument in function call. Invalid implicit conversion from bytes calldata to uint256 requested.
        proposals.push(msg.data);

pragma solidity ^0.4.17;

    contract FantasyLeague {
        // Define addresses of league members
        address public member;
        // Hold data of proposed number
        uint[] public proposals;

        // Deploy contract
        constructor() public {
            member = msg.sender;
        }

        // Propose new team number
        function proposeNumber (uint) public payable {
            require(msg.value > .01 ether);
            proposals.push(msg.data);
        }

        // Retrieve List of current proposals
        function getProposals () public view returns (uint[]) {
            return proposals;
        }
    }


texts:
function depositETHforXYZ() public payable freezeFunction returns(bool success) {
        require(msg.value > 0 ether, "Cannot be 0");
        require(msg.sender.balance > 0 ether, "Not enough funds");

        totalSupply = totalSupply.add((msg.value.mul(conversionRate)).div(1000000000000000000));
        balanceOf[msg.sender] = balanceOf[msg.sender].add((msg.value.mul(conversionRate)).div(1000000000000000000));

        emit Swap(msg.sender, "ETH", msg.value, "XYZ", msg.value.mul(conversionRate));
        emit TokensMinted(msg.value.mul(conversionRate));
        emit Deposit(msg.sender, msg.value);

        return true;
    }

    function withdrawXYZforETH(uint _xyzAmount) public freezeFunction returns(bool success) {
        require(balanceOf[msg.sender] != 0, "No funds to withdraw");
        require(balanceOf[msg.sender] >= _xyzAmount, "Not enough funds to withdraw");

        totalSupply = totalSupply.sub(_xyzAmount);
        balanceOf[msg.sender] = balanceOf[msg.sender].sub(_xyzAmount);
        // doesn't withdraw the correct amount below 1 eth (decimals dont work)
        msg.sender.transfer((_xyzAmount.div(conversionRate)).mul(1000000000000000000));

        emit Swap(msg.sender, "XYZ", _xyzAmount, "ETH", _xyzAmount.div(conversionRate));
        emit TokensBurned(_xyzAmount);
        emit Withdrawal(msg.sender, (_xyzAmount.div(conversionRate)));

        return true;
    }

100 xyz = 1 eth. I calculate the xyzAmount(100)/conversionRate(100) = 1. If I don't use the 18 digits it will send 1 wei. My problem is that it wont send the correct amount of wei when less than 1 eth worth of wei.
Not sure how to fix this problem.


texts: RPC API query does not retrieve transaction data

texts:
I am trying to retrieve blockchain transaction data on my node using JSON RPC API, but I get no result.

For example this request :

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockNumberAndIndex","params":["0x29c", "0x0"],"id":1}'

Give me this result :

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

What am I missing to get something like ? :

"id":1,
"jsonrpc":"2.0",
"result": {
    "hash":"0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b",
    "nonce":"0x",
    "blockHash": "0xbeab0aa2411b7ab17f30a99d3cb9c6ef2fc5426d6ad6fd9e2a26a6aed1d1055b",
    "blockNumber": "0x15df", // 5599
    "transactionIndex":  "0x1", // 1
    "from":"0x407d73d8a49eeb85d32cf465507dd71d507100c1",
    "to":"0x85h43d8a49eeb85d32cf465507dd71d507100c1",
    "value":"0x7f110" // 520464
    "gas": "0x7f110" // 520464
    "gasPrice":"0x09184e72a000",
    "input":"0x603880600c6000396000f300603880600c6000396000f3603880600c6000396000f360",
  }

PS : my node is still syncing (block #1504330 / #2074754)

Any ideas ? Thanks


texts: Ethereum implementation of a non-fungible but divisible token? (ERC721 seems not to work for that)

texts:
I am struggling currently with finding the right implementation possibility for a token with the following properties:

Asset-backed token based on a non-fungible asset (like a piece of art)
More than one owner per token (crowd-ownership on each non fungible asset) e.g. multiple owners of one piece of art

A non fungible asset would lead into the direction of using ERC721 (which has been used e.g. by cryptokitties). The problem of this standard is that it would not allow multiple owners of a token because each token is not divisible.

I thought about multiple options but couldnt find out whether they are possible. For example would it be possible to have an ERC20 token "own" a ERC721?

Any suggestions?


texts: mapp values do not upadte when calling other functions after populating the map

texts:
I am using react as my front end to call functions from smart contract .

this is the front end where i call the functions. However, after calling the first function which populates the map I then call the second function to get the username using the same userid but i get an empty string.

After testing , i figured that after populating the map , the values inside the map just restore their original values or something similar and so when calling other functions they see an empty map.
any help is appreciated as this is my first blockchain based project .
thank you


texts: Smart Contract initiated actions and gas costs

texts:
Is it possible for a smart contract to initiate actions on its own? (ie. without an external message being received?)  For example, is it possible to implement a smart-contract-based reminder system that sends email notifications based on a calendar of future events?  Or a smart contract that does data operations once every 24 hours, without outside prompting?

If so, where does the gas come from to execute those smart contract initiated operations?

So, if I were to create a "reminder" smart contract, where people submitted a notice time, email address and text message, they would be charged gas for the call to send in the data, but how could they be charged for the gas needed to send them the reminder a day or more later? Can a smart contract over-charge for gas and save that gas for later use by itself?  Are there any other solutions?

Thanks for any help with this.


texts:
I`m trying compilate this code and getting Parse error

pragma solidity ^0.6.0;

contract ZooFactory {

    event NewZoo(uint zooId, string name, uint dna);

    uint dnaDigits = 24;
    uint dnaModulus = 10 ** dnaDigits;

    struct Zoo{
        string name;
        uint dna;
    }

    Zoo[] public zoos;

    function createZoo(string memory _name, uint _dna) private {
        uint id = zoos.push(Zoo(_name, _dna)) - 1;
        NewZoo(id, name, dna);
    }

    function generateRandomDna(string memory _str) private view returns(uint) {
        uint rand = uint(keccak256(abi.encodePacked(_str));
        return rand % dnaModulus;
    }

    function createRandomZoo(string memory _name) public {
        uint randDna = _generateRandomDna(_name);
        createZoo(_name, randDna);
    }
}


texts: Transfer ERC20 (usdt) token between two addresses using web3.py

texts:
Here is my code:

token_from = "0x0d0707963952f2fba59dd06f2b425ace40b492fe"
token_to = "0x763015f098cf18cfa28baf25653955f271fb63ff"
token_to_private_key = "0x0000000000000000000000000000000"
my_provider = Web3.IPCProvider("~/.local/share/io.parity.ethereum/docker/jsonrpc.ipc")
w3 = Web3(my_provider)
contractAddress = "0xdac17f958d2ee523a2206206994597c13d831ec7"
token = w3.eth.contract(Web3.toChecksumAddress(contractAddress), abi=usdtABI)

transaction = {
    'from': token_from,
    'to': token_to,
    'nonce': w3.eth.getTransactionCount(Web3.toChecksumAddress(token_from)),
    'gas': 2000000,
    'gasPrice': 234567897654321,
    'data' : token.caller.transfer(Web3.toChecksumAddress(token_to), 10000000),
    'chainId': 1,
}

signed = w3.eth.account.signTransaction(transaction, token_to_private_key)

I am receiving the following error:

TypeError: Transaction had invalid fields: {'data': []}


texts: getStorageAt: What if two transactions in the same block?

texts:
I use web3.getStorageAt to access historical information. I can specify a block to see the content of a variable in a given block. But one block can contain several transactions, each modifying this variable.

Which value is retrieved by getStorageAt? The last one?
How to retrieve the values of the storage in each transaction?


texts: Is it possible to brute force account creation in order to steal ether?

texts:
Ethereum users could generate new accounts for each transaction they make, which would greatly increase the number of accounts being used to receive ether.

Would it be possible (and profitable) for someone to find collisions in the ethereum address space in order to steal ether or access contracts?


texts:
I have an array of uint in Solidity,

How can I find the minimum element in the array using web3js?

One option is to create a getter to the array and fetch all the values, but isn't that too long with many entries?

Inspired by CryptoKitties, In the marketplace, it is possible the view the kitties sorted by "age" or "likes", how it is implemented? I could not find.


texts: Is there a way to return data from a fallback function?

texts:
I'm trying to write a contract that contains a fallback function which would pass-through the call to another destination contract. This would allow for future upgrades/bug-fixes to the destination contract by updating the destination contract address in the contract which contains the pass-through fallback function.

Caller calling Do() -> Pass-Through function () -> Destination implements Do()

The problem is the fallback function can't return anything. Worse, if the caller to a contract with a fallback function is expecting a return value, they will receive what I believe is msg.data instead of the expected value.

Is there a way to return data from a fallback function (assembly okay) ?
Is the current behavior dangerous (e.g. corrupting the caller's stack)?

Here's the example code:

pragma solidity ^0.4.10;

contract Real
{
    function Do() public constant returns (uint256) { return 12345; }
}

contract Blank
{
    function () public { }
}

// Client contract address: 0x7C2F875a9D5Ba712A6cdF35E537651ea89779802
contract Client
{
    function Run() public constant returns (uint256 result1, uint256 result2)
    {
        Real real = Real(0xd64dE830995C7407b09CF96EC59f76701D4DBcF9); // This is the address of Real
        result1 = real.Do();

        Real blank = Real(0x068c8D804Fab87B3d2cF3f02914eF2bE6b199436); // This is the address of Blank
        result2 = blank.Do();
    }
}

// result1 = 12345
// result2 = 0xDDFAE52900000000000000000000000000000000000000000000000000000000
// bytes4(sha3("Do()")) = 0xDDFAE529. This is why I think result2 is msg.data


texts: Is it normal for EOA to EOA ether transfer to cost over 21000 gas without data?


texts: Confirming sender identity read function call with MyEtherWallet.com

texts: It does not seem to be the case that MyEtherWallet.com is supporting read function sender restrictions such as onlyOwner modifiers or similar, so basically it is impossible to restrict particular function reads to certain groups/tiers of people. Why is this not an option? I believe it should be possible to confirm similar to write functions by accessing a wallet through one of the many options.


texts: How to find out the ethereum addresses of services like Digix, Augur, etc.?

texts: Is there any way to easily find the Ethereum addresses of Digix, Augur and similar Ethereum based enities? Or do I have to manually contact them?


texts: What are State Channels and use case/code examples?

texts:
A previous Reddit post gave some indication:

  It's basically Lightning-network style payment channels but for
  arbitrary state updates. Participants in the Dapp send messages with
  transactions to each other that update the state but do not publish
  them to the chain. If one of the participants leaves or tries to cheat
  the other one can at any time publish the latest transaction to the
  blockchain to finalize the state. Just the threat of publishing to the
  chain is enough to keep participants honest.

Are there any architectural diagrams or web3js code examples for implementing State Channels?


texts: How do I pass a dictionary for the in3_registry value for the Incubed Python API?

texts:
I am using Python 3.  I have installed the in3 (Incubed) Python module.  I want to invoke the ClientConfig of the in3 Python API in a specific way.  There is an in3_registry argument that is part of ClientConfig in the in3 Python API.
When I think of in3_registry values, I think of hexadecimals that start with "0x".  A Python dictionary is a key and a value pair (or a set of such pairs).  I have no idea what the key should be when passing the dictionary value (that of the Ethereum registry ID).  What is the syntax to invoke the ClientConfig argument for the in3_registry of the Python3 API for in3?


texts: Just Smart contract driven app is a DAPP?

texts:
I have same years working as a Java & JS fullstack developer, but I'm totally new to Ethereum's development, and I'm trying to figure out how to architect a Dapp (Smart contracts driven app).

It's OK and enough for considering a web application a Dapp, to have a centralized server/cloud (AWS for example) running a web app that it's talking with different smart contracts (living in Ethereum's Blockchain), via HTTP requests on eth.contract({...}) JavaScript object's function?

Thanks too much.


texts: Which trustworthy sites can I generate a brain wallet for ethereum?

texts: I'm looking to generate a brain wallet for ethereum. Which sites are trustworthy to do this without my coins being stolen?


texts:
Looks like keccak256 () isn't working or not How could I correct it?

pragma solidity ^0.5.0;

import "https://github.com/niguezrandomityengine/ethereumAPI/nreAPI.sol";

contract Randomness is usingNRE {

   function randomNumber() public view returns (uint256){

       return (uint256(keccak256((rw()/(10**20))%(10**12))));
   }

}


texts: What are the risks with browser extension wallets such as MetaMask?

texts:
MetaMask is a neat browser extension (for Google Chrome, Firefox, Opera, and the Brave browser) that is also an Ethereum wallet.

The code for MetaMask seems to be available here at GitHub.

Considering the security mechanisms available in Ethereum, what are the risks with using it as a wallet?


texts: Is Geth nodiscovery mode redundant behind a firewall without port forwarding

texts:
I'm trying to understand the peer discovery process, especially for a private network with majority of the nodes having dynamic IP addresses and behind typical wifi router firewall. If I run a Geth node with --nodiscovery flag, the node will only call out/connect to other peers, not accept calls from peers, correct? Isn't my firewall already doing that? And those peers my node calls out to must have port 30303 open, and they must be in discovery mode, correct? If my node is in NOdiscovery mode, I need a bootnode list or manually add (via file or CLI) static nodes in a private network, correct?
Basically, if a new private network was created, some of the nodes would have to be in discovery mode and/or have port 30303 open on the WAN side, or the network would fail, correct?
And does a private network have to supply a bootnode list everytime I restart Geth?


texts:
I'm trying to deploy ERC20 contract by using Web3.
Here's the contract constructor fun:
constructor(
        string memory name,
        string memory symbol,
        uint8 decimals,
        uint256 totalSupply
        uint256 tokenCap,
    )

And here's the input variables using Web3:
const tx = erc20.deploy({
    data: erc20Contract.bytecode,
    arguments: [
      name,
      symbol,
      decimalPrecision,
      web3.utils.toBN(totalSupply),
      web3.utils.toBN(tokenCap),
    ]
  });

// Input variables
{
    "name": "leo",
    "symbol": "LEO",
    "totalSupply": 123,
    "tokenCap": 220000,
    "decimalPrecision": 11
}

And after checking it in Etherscan I got the following decimal number,
Output: 0.00000000123 LEO
Expected: 123 LEO
so my question here is that because of a missing conversion required between JavaScript number to Solidity uint256?


texts: When exactly does a state change happen for a variable?

texts:
I am not sure if I asked right. What I don't understand is if a tx changes value of a state variable , it has to be mined and confirmed and brodcasted to network in order for the rest of network to know it. But that is a rather long time. So what happens to other write function calls that do something with that state variable in meantime?
int balance=10;
function change()
{
if(balance>=10) balance=balance-10;

}

if you invoke change twice within 1 sec what will happen? It seems like balance can go -10.


texts:
I am not sure if I'm alone in this but it seems that the latest Geth client is very slow.

I tried posting the issue on Geth's github page but it got closed almost immediately and no one is replying to it anymore.

This is my original issue

Problem is that this is the first time I ever suffered with syncing Geth, all previous clients synced fine, I've been spinning nodes for over a year now on both testnets and mainnet hosted on AWS EC2 instances and never had any issues whatsoever.

I have now started 3 instances running Geth v1.8.23 hoping one of them will sync but to no avail. All three nodes attached to an IOPS optimized EBS volume with 6000 IOPS and all three are c5.2xlarge instances, thats 8 vCPUs and 15GB of RAM which is frankly an overkill.

Yet geth still fails to sync and always 100 blocks behind. This is the eth.syncing result from one of my nodes a couple of seconds ago:

{
  currentBlock: 7278405,
  highestBlock: 7278488,
  knownStates: 274903276,
  pulledStates: 274894571,
  startingBlock: 0
}

Has anyone successfully started a Geth 1.8.23 node? Anything special I need to do before I start this latest client version?

Note that I need a full node, a light node wont serve my purpose.


texts: Can't return string when function not pure?

texts:
See the below contract function of which return the string (Tested in Remix.org):

pragma solidity >=0.4.22 <0.6.0;
contract HelloWorld {
    function get() pure public returns (string memory){
        return "Hello Solidity";
    }
}

While in the following contract, I can't get the returned string.

pragma solidity >=0.4.22 <0.6.0;
contract HelloWorld {
    uint num;
    function get(uint val) public returns (string memory){
        num = val;
        return "Hello Solidity";
    }
}

Why? And how can I get returned string from not pure function ?


texts:
I am developing an NFT using truffle, and I struggle to make my mint() function work :
function mint(uint256 tokenId) public onlyElevated whenNotPaused returns (uint256) {
    require(totalSupply() < TOTAL_SUPPLY, "Max supply reached");
    _mint(msg.sender, tokenId);
    return tokenId;
}

_mint() comes from openzeppelin's ERC721 contract (available on github).
When I run tests in truffle develop with truffle test, everything works fine and I have this output for a test that mints 3 tokens:
Gas used for mint : 173126
Gas used for mint : 143126
Gas used for mint : 143126

However I am now trying to deploy it on a ganache local network in order to run advanced tests. The deployment is ok, and I can connect to my contract with my client and call functions, but when I try to send the mint() transaction, I have this error :
ethBalanceBefore=EtherAmount: 99931764660000000000 wei
nftBalanceBefore=0
RPCError: got code -32000 with msg "VM Exception while processing transaction: out of gas".

I don't understand why it works fine in truffle tests and not here, so here are my questions :

Can the gas used for a transaction be different according to the network I deploy my contract on? I thought only the gasPrice changes.
Can the above error be fired because of issues not related to gas?

Update :
Here is my truffle-config.js :
module.exports = {
  compilers: {
    solc: {
      version: "^0.7.0",
    },
  },
  solc: {
    optimizer: {
      enabled: true,
      runs: 200,
    },
  },
  networks: {
    develop: {
      host: "127.0.0.1",
      port: 8546,
      network_id: "*",
    },
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "5777",
    },
  },
};

I tried to change the gas value to 9000000000000000, but it still fails


texts: Infinite mining, technically how is that coded

texts:
For a token that can be mined forever, what are technical ways to do that?

One idea for infinite mining where at 21 billion, the token supply is reset to 21 million (everyone’s ownership is reset to 0.001%, so from 1000 TOKEN to 1 TOKEN.

Is there any blockchains or dApps or coins or tokens that do infinite mining, and how do they do it?


texts: Solidity finds eth price but its realy big

texts:
This script gives me some random like a number and not real eth price? the price that is outputting is 38598000000?!
  AggregatorInterface internal ref;
  // For ETH-USD on ropsten, input the address:
  // 0x8468b2bDCE073A157E560AA4D9CcF6dB1DB98507
  address _aggregator = 0x8468b2bDCE073A157E560AA4D9CcF6dB1DB98507;
  string toni;
  constructor() public {

    ref = AggregatorInterface(_aggregator);

  }
    int256 price;

  function getLatestAnswer() public view returns (int256) {
    return ref.latestAnswer();
  }


texts:
I have a contract called tracking. It has a function called move()
I called this function using code:

import {bonds} from 'oo7-parity';
const counterABI = [...]
const ContractAddress = '...'

constructor() {
    super()
    this.counter = bonds.makeContract(ContractAddress, counterABI)
}

/*hidden code*/

this.counter.move(data, this.state.caminho[this.state.caminho.length - 1], id)

This function move() returns true or false. But how can I have access to this returned value?

I tried the following:

let res = this.counter.move(data, this.state.caminho[this.state.caminho.length - 1], id)
console.log(res)

But is doesn't work. This just print a huge json and I don't know where ir the returned value (true or false)


texts:
i am trying to create a new account using web3.js with angular 4. Following is my service

`

import { Injectable } from '@angular/core';
import * as Web3 from 'web3';

declare let require: any;
declare let window: any;

@Injectable()
export class ContractsService {
  private web3: any;

  constructor() {
    if (typeof window.web3 !== 'undefined') {
      // Use Mist/MetaMask's provider
      this.web3 = new Web3(window.web3.currentProvider);

      if (this.web3.version.network !== '4') {
        alert('Please connect to the Rinkeby network');
      }
    } else {
      console.warn(
        'Please use a dapp browser like mist or MetaMask plugin for chrome'
      );
    }
  }

  public creatAccount() {
    let acc = this.web3.eth.personal.newAccount('abc123');
    console.log(acc);
  }

}

`
but i am having following error.

can anybody please tell me what is wrong with this code? thanks :)


texts: Can I transfer ETH without syncing on current pc?

texts:
I have a new pc and want to access the ETH I had in my wallet on my old pc before and send them to poloniex. I have the keystore folder. I downloaded the current Ethereum Wallet (0.8.3) and it started syncing. I realised this would take a couple of days (like before) so closed it and instead ran:

geth --fast --cache=2048 --jitvm
I also replaced the file in keystore with the one I backed up before.
This has run overnight, in the meantime, if I click on "Launch Application" for EW, the balance shows as 0.00. Do I need to sync to be able to get my ETH?


texts: Unable to install web3-eth-ens while installing web3-version 35

texts:
I had web3 ver 36. Due to an issue, I rolled back to ver 35 as follows -

npm install -g web3@1.0.0-beta.35 --save

Before this, I did npm cache clear --force. However, it looks like web3-eth-ens is never getting installed. I always see the following error:

> var Web3 = require('web3');
Error: Cannot find module 'web3-eth-ens'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)

What is wrong here? I even tried doing: npm install web3-eth-ens, but that did not help either.


texts: Why transactions/contracts aren't priced/tracked based on computer running time

texts:
Amazon AWS and Google Cloud all base their pricing off of, among a few other things, the amount of compute and storage used. For compute, it's based on time, how much time the computer runs. This is very general and abstracts away the need to, for example, count how many times each Assembly instruction is invoked and with which operands. This would significantly interrupt performance if they did it that way, but it seems that the blockchain technologies all went the path of monitoring the individual actions/operations either through transactions directly or Smart Contracts in the case of Ethereum.

So basically I'm wondering why this is, why it wasn't decided to just base everything off compute time and storage (and bandwidth I guess, but mainly focusing on compute time here). This way a transaction would just have to have a start and end timestamp and wouldn't have to really serialize anything, which would mean you could monitor everything in detail pretty much. Wondering why it was done differently.


texts:
My function performs a write operation for each "Player" struct in my dapp.

However, I don't want to exceed the gas limit for the transaction.

Is there an upper limit to the number of writes I can make per tx?

For instance, how many structs can I edit per tx, just writing one uint256 per struct?


texts: Deploy Smart Contract on Private Blockchain

texts:
I have created a Private Block chain Server on AWS with one Peer. Now if I want to deploy a smart contract at my AWS Node from my local system, how can I do that?

Regards
AKM.


texts: Why does account show 0 balance, after seemingly successful transaction in geth console?

texts:
It seems I've made a successful transaction from account[0] to account1. Why does account1 still have a 0 balance?

> var sender = eth.accounts[0];
undefined
> sender
"0x702543f4ae6d7ebdd07dc29c432a0c707b8c2cc0"
> var receiver = eth.accounts[1];
undefined
> receiver
"0xac97d0feb8b4b3bcaa2b153dff1d4eaa5b4bee9c"
> var amount = web3.toWei(1000, 'ether');
undefined
> eth.sendTransaction({from:sender, to:receiver, value: amount})
account is locked
    at web3.js:3119:20
    at web3.js:6023:15
    at web3.js:4995:36
    at <anonymous>:1:1

> personal.unlockAccount(sender, "valid_passphrase")
true
> personal.unlockAccount(receiver, "valid_passphase")
true

> eth.sendTransaction({from:sender, to:receiver, value: amount})
I0602 20:32:38.038644 eth/api.go:1193] Tx(0xa7c9e4af88ca93f8bd3c488ed0807da3ec5879456cce9a3093a690a3ccb1dba8) to: 0xac97d0feb8b4b3bcaa2b153dff1d4eaa5b4bee9c
"0xa7c9e4af88ca93f8bd3c488ed0807da3ec5879456cce9a3093a690a3ccb1dba8"

> eth.getBalance(eth.accounts[0])
6.79703125e+21
> eth.getBalance(eth.accounts[1])
0

eth.getTransaction("0xa7c9e4af88ca93f8bd3c488ed0807da3ec5879456cce9a3093a690a3ccb1dba8")

{
  blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
  blockNumber: null,
  from: "0x702543f4ae6d7ebdd07dc29c432a0c707b8c2cc0",
  gas: 90000,
  gasPrice: 20000000000,
  hash: "0xa7c9e4af88ca93f8bd3c488ed0807da3ec5879456cce9a3093a690a3ccb1dba8",
  input: "0x",
  nonce: 0,
  to: "0xac97d0feb8b4b3bcaa2b153dff1d4eaa5b4bee9c",
  transactionIndex: null,
  value: 1e+21
}

SOLUTION:

miner.start(8)

Let the miner run for a couple minutes.

miner.stop()

eth.getTransaction("0xa7c9e4af88ca93f8bd3c488ed0807da3ec5879456cce9a3093a690a3ccb1dba8")

{
  blockHash: "0xea06bc12fc1db50416adc90ec0856946f3e69b6bba3ec6722ecaf04538184667",
  blockNumber: 1330,
  from: "0x702543f4ae6d7ebdd07dc29c432a0c707b8c2cc0",
  gas: 90000,
  gasPrice: 20000000000,
  hash: "0xa7c9e4af88ca93f8bd3c488ed0807da3ec5879456cce9a3093a690a3ccb1dba8",
  input: "0x",
  nonce: 0,
  to: "0xac97d0feb8b4b3bcaa2b153dff1d4eaa5b4bee9c",
  transactionIndex: 0,
  value: 1e+21
}


texts:
I have created a Student registration form and taking input as firstName, lastName and studentRegId. Something like this:

contract Unique {

string fn;
string ln;
bytes20  val;
bytes32 sId;

function identify(string s, string y, bytes32 i)returns (bytes20){
    fn =s;
    ln =y;
    sId =i;
    val = keccak256(sm,bm,vm);
}

function getOut()constant returns (bytes20 ){
    return val;
}
}

This should return a hash value (address). But it is showing the following error:

Untitled1:13:25: Error: Undeclared identifier.
    val = keccak256(sm,bm,vm);

What should I do?


texts: Why is .call() necessary when I want to see returned values from a function?

texts:
In my contract I have this function (solc 0.8.4):
    function makeDecision(address person) external returns (string memory name, bool approved) {
        require(msg.sender == loanOfficer, "Only the loan officer can initiate a decision.");
        require(bytes(applicants[person].name).length != 0, "That person is not in the pool of applicants.");

        if (applicants[person].credScore > 650 && applicants[person].credAge > 5) {
           applicants[person].approved = true;
        }

        return (applicants[person].name, applicants[person].approved);
}

When I go into my truffle console and call my function this way loanContract.makeDecision(accounts[1]) everything works fine, but I get a tx receipt as the response.
When I call my function this way via truffle console loanContract.makeDecision.call(accounts[1]) I get the expected response from my function. I am wanting an explanation that tells me why this difference in response occurs so that I understand what is going on on a deeper level. I hate using things without understanding why they work.
If it helps, my contract (which is named LoanDisbursement) was initialized in the console like so: let loanContract = await LoanDisbursement.deployed()
and my accounts variable: let accounts = await web3.eth.getAccounts()
any tips would help since I am still learning and diving into this ecosystem. Thanks.


texts:
In Bitcoin the block confirmation time is set at 10 min using POW and DoD. This reduces the chance of conflicts (temporary forks) from nodes that simultaneously solve POW solution.

How are these conflicts reduced when block confirmation time is low, and transactions / second is high, as in Ethereum and other public Blockchains?


texts:
I am using web3 1.0.0 on nodejs all working fine but web3.eth.subscribe not working for pendingTransactions,  I don't understand what is the issue.

I'm using
web3 version : 1.0.0
OS : windows
provider : IpcProvider

var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.IpcProvider("\\\\.\\pipe\\geth.ipc", require("net")));

web3.setProvider(new web3.providers.IpcProvider("\\\\.\\pipe\\geth.ipc", require("net")));

var subscription = web3.eth.subscribe('pendingTransactions', function(error, result){
if (!error)
    console.log(result);
else
    console.log(error);
})
.on("data", function(transaction){
    console.log(transaction);
});

Run this code on nodejs and i got the response blank


texts: My syntax seems to be ok, so I do not understand this CompileError


texts: Is having an open TCP port dangerous (Mac OSX)?

texts:
I was reading this post on reddit where a user got all her ether hacked because she had an open RCP port when deploying a contract.

I just used network utility to run a scan and it turns out I have an open TCP port. Is there any risk involved? I don't even know what a TCP port is for the record.


texts:
In the limited documentation on Serpent, it mentions the ability to use a str type as both input and output to a contract function.  Short strings are converted to numbers and longer text uses the text() function.

Say I have this simple Serpent contract function using short strings:

def my_name_is(n):
  return(n)

If you call this, passing in the value 'bob', it'll return a numeric value for the str 'bob'.  How would you convert the numeric value back to the str 'bob'?  I've looked over many examples and can't find any that will actually work for this example.


texts: will Casper FFG be included in Constantinople hardfork?

texts: According to recent dev meeting, Constantinople hardfork is going to happen on October 2018.


texts: Distributed application with client side stuff?

texts:
I would like to write a smart contract which allow users to publish forecasts and then vote which forecast was the best. Adding a forecast should be done manually by user. But I would like to automate voting process.

In theory it should be easy. There is a need to download some data from the internet, compare with published forecasts and choose the best one. But is this approach supported by ethereum? I don't see possibility of writing "client side" part. I'm not sure how it should be done "by the book".


texts: How are addresses created if deploying a new bound contract

texts:
How exactly are the contract addresses created that are returned by the DeployNewXYZ() method a bound contracts? Is it possible that, if the method is called rapidly consecutively, the same address is returned twice?

I am using this method of a bound contract to deploy a new one:

// DeployTemperatureMeasurementA deploys a new Ethereum contract, binding an instance of TemperatureMeasurementA to it.
func DeployTemperatureMeasurementA(auth *bind.TransactOpts, backend bind.ContractBackend, _temperatureWriter common.Address, _minTemperature int8, _maxTemperature int8, _maxFailureReports uint16, _storageLocation string) (common.Address, *types.Transaction, *TemperatureMeasurementA, error) {
    parsed, err := abi.JSON(strings.NewReader(TemperatureMeasurementAABI))
    if err != nil {
        return common.Address{}, nil, nil, err
    }
    address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(TemperatureMeasurementABin), backend, _temperatureWriter, _minTemperature, _maxTemperature, _maxFailureReports, _storageLocation)
    if err != nil {
        return common.Address{}, nil, nil, err
    }
    return address, tx, &TemperatureMeasurementA{TemperatureMeasurementACaller: TemperatureMeasurementACaller{contract: contract}, TemperatureMeasurementATransactor: TemperatureMeasurementATransactor{contract: contract}}, nil
}

This method is called like this:

address, _, _, err := contracts.DeployTemperatureMeasurementA(auth, backend, auth.From, minTemp, maxTemp, maxFailures, "")

I am only interested in storing the contract address. I am using this address to generate a binding to the contract at a later time.

Now, I call this method twice in a row in a for loop, I want to create two or more new instances of the bound contracts and store the addresses in a database.

When I do this, the Geth client produces two transactions but the contract address that results is the same (this is from the log of the geth client):

I0727 12:47:13.547767 eth/api.go:1203] Tx(b296bc8d329b2bb1002537040e997fd52a74fb6f0e4a749f685b3cfa968d42e0) created: cb744eb36354ada463dbe40fbf969c2d17f48e33
I0727 12:47:13.549639 eth/api.go:1203] Tx(ab1edcd1f39d64807921e92dea1680bc8224422738a5c45a0089aaac55a3594a) created: cb744eb36354ada463dbe40fbf969c2d17f48e33

I use a custom block chain to develop, the genesis file of my blockchain is this:

{
    "nonce": "0xdeadbeefdeadbeef",
    "timestamp": "0x0",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "0x0",
    "gasLimit": "0x8000000",
    "difficulty": "0x20000",
    "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "coinbase": "0x0133ee9831e6eee82731578e25ba8361837fa5a5",
    "alloc": {
        "0x0133ee9831e6eee82731578e25ba8361837fa5a5": {
            "balance": "1000"
        }
    }
}

I use geth Version: 1.5.0-unstable, installed with Homebrew on Mac OSX 10.11.6 (15G31)


texts: Truffle - Stub contract functions in Mocha

texts:
How do I stub out contract functions while testing in truffle in javascript.

Normally in mocha I would import sinon and do a sinon.stub command.

It doesnt seem that I can import npm modules into the truffle testsuite.

I would like to test against the callcount and args of the transfer method in my contract.


texts: How can I create a listener for new transaction with Ethereum RPC calls?

texts:
I am trying to create mini-service which would allow me to subscribe for incoming Ethereum transactions (coinbase example).

I thought that in Ethereum it could be done with eth_newFilter and eth_getFilterChanges (JSON RPC)  methods but I am doing something wrong. Could you please give any clue or maybe I completely misunderstood the concept of the filters? I know that there is eth_newPendingTransactionFilter method, but I thought maybe there is a better way to achieve my goal? Right now I am following these steps:

Start geth

I know that I shouldn't open RPC like this, but right now I have done this for simplicity.

geth --dev --rpc --rpcapi "personal,miner,db,shh,admin,eth" --rpcaddr "localhost" --rpcport "8545"

Check accounts:

➜  curl -X POST --data '{"jsonrpc":"2.0","method":"eth_accounts","params": [],"id":1}' localhost:8545
{"id":1,"jsonrpc":"2.0","result":[]}

Create two accounts:

➜  curl -X POST --data '{"jsonrpc":"2.0","method":"personal_newAccount","params":["password"],"id":1}' localhost:8545
{"id":1,"jsonrpc":"2.0","result":"0x0199147554059ce1fa572600256dd6030db19658"}
➜  curl -X POST --data '{"jsonrpc":"2.0","method":"personal_newAccount","params":["password"],"id":1}' localhost:8545
{"id":1,"jsonrpc":"2.0","result":"0x350060daba130bed0809126c67240d38f27c4cff"}

Start miner:

➜  curl -X POST --data '{"jsonrpc":"2.0","method":"miner_start","params":["1"],"id":1}' localhost:8545
{"id":1,"jsonrpc":"2.0","result":true}

Create new filter:

➜  curl -X POST --data '{"jsonrpc":"2.0","method":"eth_newFilter","params":[{"address": "0x350060daba130bed0809126c67240d38f27c4cff", "fromBlock":"latest","toBlock":"latest"}],"id":2}' localhost:8545
{"id":2,"jsonrpc":"2.0","result":"0x0"}

Unlock account and send transaction:

➜  curl -X POST --data '{"jsonrpc":"2.0","method":"personal_unlockAccount","params":["0x0199147554059ce1fa572600256dd6030db19658","password"],"id":1}' localhost:8545
{"id":1,"jsonrpc":"2.0","result":true}
➜  curl -X POST --data '{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"from": "0x0199147554059ce1fa572600256dd6030db19658","to": "0x350060daba130bed0809126c67240d38f27c4cff", "value":"0x1" }],"id":1}' localhost:8545
{"id":1,"jsonrpc":"2.0","result":"0xd0e910765a920b30fc2e70de6fc4557e74ad69c584d810f70188d254db7119bb"}

Wait for transaction proceed by local node:

➜ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x350060daba130bed0809126c67240d38f27c4cff"],"id":1}' localhost:8545
{"id":1,"jsonrpc":"2.0","result":"0x01"}

Check filter and got nothing :(

➜ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x00"],"id":1}' localhost:8545
{"id":1,"jsonrpc":"2.0","result":[]}


texts: What is the real price of deploying a contract on the Mainnet?

texts:
I'm trying to deploy a contract on the mainnet, but I've been getting some issues deploying with Truffle.

➜  ballot git:(master) ✗ truffle migrate --network mainnet --dry-run
Using network 'mainnet' (dry run).

Running migration: 1_initial_migration.js
  Deploying Migrations...
Error encountered, bailing. Network state unknown. Review successful transactions manually.
sender doesn't have enough funds to send tx. The upfront cost is: 670197500000000000 and the sender's account only has: 120000000000000000

According to this error, deploying the contract would cost 0.67 ETH (~US$750). I find this very hard to believe.

Does code complexity influence the deployment price? Not sure what else it would be.


texts: ERC-2309 Minting Multiple ERC-721 Tokens in one Transaction

texts:
Anyone know how to work with ERC-2309? It's an extension to the ERC-721 Token standard and it's supposed to make it possible to mint a large number of ERC-721 tokens (meaning 100's or even 1000's of them) in a SINGLE TRANSACTION.
This is particularly relevant these days (Autumn of 2020) as ETH gas prices have continued to skyrocket - making the launching of any project that requires multiple ERC-721 tokens really really expensive. (And for some indie devs - downright impossible, which of course is really a shame.)
Below is a Contract I wrote with a mintBatch() function to try and test the minting of multiple 721's. It works just fine (in my Truffle/Ganache dev environment) when I mint 10, 20,  even 40 tokens in one shot - but at 50 I get the "out of gas" error. (This number seems to vary though as I run it in different times.)
Either way, how exactly is ERC-2309 supposed to fit into all this? And, is my mintBatch function even the right way to go about doing this?
contract ColorToken is ERC721Full, Ownable {
  string public constant name = "ColorToken";
  string public constant symbol = "CLRT";

  struct RegularColor {
    uint8 red;
    uint8 green;
    uint8 blue;
  }

  RegularColor[] colorsArray;

  constructor() ERC721Full("ColorToken", "CLRT") public {

  }

  // Test mint function - intended to mint a bunch of ERC721 tokens all at once:
  function mintBatch(address ownerAddress, uint256 numColors) onlyOwner external {
    for(uint tempColorCounter = 0; tempColorCounter < numColors; tempColorCounter++) {
      // 1. Create a "random" RGB Color:
      RegularColor memory tempColor = RegularColor(uint8(now), uint8(now-28000), uint8(now+12500));
      // 2. Push the new color to the colorsArray:
      colorsArray.push(tempColor);
      // 3. Finally, MINT a new ERC721 Token:
      super._mint(msg.sender, tempColorCounter);
    }

  }

  function getColorOfTokenWithID(uint tokenID) public view returns(uint8 rd, uint8 gr, uint8 bl) {
    return (colorsArray[tokenID].red, colorsArray[tokenID].green, colorsArray[tokenID].blue);
  }

}

=========================
UPDATED CODE:
  // Moved my minting FOR loop into the Constructor so that all
  // my NFT's get minted upon this Contract's Creation/Deployment:

constructor() ERC721Full("ColorToken", "CLRT") public {

    for(uint tempColorCounter = 0; tempColorCounter < 50; tempColorCounter++) {
      // 1. Create a "random" RGB Color:
      RegularColor memory tempColor = RegularColor(uint8(now), uint8(now-28000), uint8(now+12500));
      // 2. Push the new color to the colorsArray:
      colorsArray.push(tempColor);
      // 3. Finally, MINT a new ERC721 Token:
      super._mint(msg.sender, tempColorCounter);
    }
  }


texts: How to send Token (not Ether) through a contract?

texts: I know sendRawTransaction can send Ether to another account address. Now, I need to use sendRawTransaction to send Token to another account address. In sendRawTransaction, the param to should be the contract's address, but  I don't know how to populate the param data nor how to tell the contract  the target account address. Who can tell me? Thanks!


texts: GPU gave 3 Eth in 3 weeks, then added another GPU and no ETH after 1.5 weeks?

texts:
I got the first 3 Eth in 3 weeks and then I decided to add another card (RX480s).

I stopped the mining (CTRL - C)
Then stopped geth node (CTRL - C)
Shutdown PC and installed extra GPU.
Ran geth test run for GPU and got double hash rate, cool.
Ran geth node and let it sync, I waited till it was updating by 1 block and the block number matched/exceeded number form eth stats.
Then ran GPU mining and waited...

It's been more than 4 weeks, and still no more ETH.
I'm worried I'm mining to "no where" ...

Is it just that difficulty has increased (exponentially) or I've done something wrong?


texts: Waiting for a transaction to be confirmed

texts:
Reading through the web3.js transaction documentation, what is an optimal approach of waiting for a transaction to confirm?

The method sendTransaction() returns a

String - The 32 Bytes transaction hash as HEX string.

But when it does is the transaction confirmed in the blockchain? If not, is an approach using a loop, a wait and a hash transaction optimal?


texts: Why are all parameters prepended by an underscore in ERC interfaces?

texts:
For instance, both ERC-721 and ERC-725 have underscores(_) before any function parameter.

I understand that normally their goal is to avoid variable overloading. However, what is the rationale for the ERC interfaces? Is is that in this way we make sure that whatever variable names the implementor will choose, there are no collisions?


texts: Is Geth a better client to begin with understanding ethereum world?

texts:
When developing a dapp, is Geth a better choice to start with for a beginner? I see there's other options which are ganache and truffle, but not so sure which one to begin with. I guess beginners might be confused with these three clients when they start to learn dapp development.

Are these three essentially serve the same purpose?
Are these three a must learn for dapp development? or either one of them can be skipped?


texts: What's the best way to get gas price in next block

texts:
our wallet project is requried some update about gas price

1 not set gasprice by user
2 auto choose the best gas price

Current, I am using rpc method eth_gasPrice in my wallet's code to get gas price.

My boss requried me not use eth_gasPrice , so is there other way to get the gas price?

extra request

I AM FORBIDDEN TO USE outside api like this reliable way to get gas price
I AM FORBIDDEN TO USE block history.


texts:
I want to implement basic ethereum wallet(import wallet, check balance, make transactions, export wallet) for my react SPA.
What would be the best option to use? Do I outsource wallet functionalities to third party apis? if so which one is the most reliable?

Would writing my own wallet be too much hustle or just not worth it?
If there are some other solution please list them too. Would prefer using javascript or python.


texts: How do the ethereum components work together

texts:
hy
i have been reading about the ethereum project and its components, i understand that there are 3 major components (EVM, swarm, whisper)

Swarm is a peer to peer data sharing network in which files are
addressed by the hash of their content. ethdocs
Whisper - Decentralized messaging A protocol for private, secure
communication directly between nodes. ethdocs
EVM is a stack-based interpreter, which has a memory byte array and key-value storage. ethereum smart contract development

But what i can't find anywhere is how do these components work together.
(i.e: when a smart contract is deployed to the ethereum network what is the contribution of each of these components to reach a successful deployment)
or if they're not involved in the deployment how are they useful during the run-time of the smart contract?


texts: Multiple minters for a mintable ERC20 (OpenZeppelin)

texts:
For an OpenZeppelin mintable ERC20, how do I give the right to mint the token to multiple contracts?
Note: number of minter contracts is always increasing, as each of those contracts would be a user-deployed proxy.


texts: Flash minting ether security considerations and attacks

texts:
Flash loans enable a class of attacks that have not been possible or observed as much in prior systems.
Flash minting ether is a concept that is starting to be implemented.
See Example of flash minting ether (a question focused on the basics of flash minting).
Extending from the basics of flash minting, what additional security considerations and attacks does flash minting ether bring up, compared to flash loans?


texts: What is driving occasional drop in number of transaction pending in the last few days?

texts: Anyone can explain any events that trigger a sudden drop in pending transactions occasionally (refer to diagram below)?


texts:
I'm using Rust with crate web3 0.15.0. (Is there a better library to use?)
My goal is to deploy contracts and call functions in them using programs I've written in Rust.
I have two simple functions, one that connects to the client and the other that deploys a contract, and a main function that calls the two of them. I get an error when I try to use the web3 library to deploy.
use web3::transports::WebSocket;
use web3::Web3;
use web3::api::Eth;
use web3::contract::Contract;

use std::path::Path;
use std::fs::File;
use std::io::Read;

async fn connect_ws () -> Web3<WebSocket>
{
    let transport = WebSocket::new ("ws://127.0.0.1:6691").await;
    Web3::new (transport.unwrap ())
}

async fn deploy (eth: Eth<WebSocket>)
{
    let abi_file = "../../solidity/test/SmallContract.abi";
    let bin_file = "../../solidity/test/SmallContract.bin";

    // make sure the files exist
    let required_files = [&abi_file, &bin_file];
    for rf in required_files.iter ()
    {
        if !Path::new (rf).exists () { println! ("{} does not exist.\n", rf); std::process::exit (1); }
    }

    // open the abi file
    let abi = File::open (&abi_file);
    if abi.is_err () { println! ("Failed to open {}\n", abi_file); std::process::exit (1); }

    // read the abi file
    let mut abi_data = String::new ();
    let bytes_read = abi.unwrap ().read_to_string (&mut abi_data);
    if bytes_read.is_err () { println! ("Failed to read from {}\n", abi_file); std::process::exit (1); }

    let builder = Contract::deploy (eth, abi_data.as_bytes ());
    match &builder
    {
        Err (err) => { println! ("Contract::deploy returned an error:\n{}\n", err); std::process::exit (1); },
        Ok (_) => {}
    }
}

#[tokio::main]
async fn main ()
{
    let web3 = connect_ws ().await;
    deploy (web3.eth ()).await;
}

Contract::deploy returns an error. Apparently, it requires bytes instead of the actual text of the JSON.
The output from my program is:
Contract::deploy returned an error:
Serialization error: Invalid operation type. at line 1 column 891

The abi file is 891 ascii characters in length. The JSON is properly formatted. I've tried it with files produced by solc 0.8.2 and solc 0.7.6 and it does the same thing.
Am I doing something wrong? Does anyone know of any sample code to deploy a contract in Rust?


texts: Change State Variable Content in Contract A from Contract B

texts:
If I have two contracts, contract A and contract B.
How can I change the content of a publicly declared state variables in Contract A from Contract B?


texts: Out of gas when calling contract method - Browser Solidity & Metamask


texts: Truffle-plugin-verify says passed but still unverified on BSCscan

texts:
Contracts deployed via Truffle are not properly verifying on the mainnet. On my end it says verification passed but on the website it's still unverified. I've been able to deploy and verify the same contract with zero issue before.
With that being said, I was able to verify a simple contract complied with remix and it was verified instantly. Any idea what the issue is caused by?
https://bscscan.com/address/0xE197baBfaa5eE12Cfc36f955f3cce84A4ae3A65B#contracts
When I try to debug the verify it still shows as passed, but is yet to be passed on site.


texts: How does one dynamically craft message data for a transaction in Solidity?

texts:
In Solidity, one can create a bytes array and then use address.call(bytesData) to create a new transaction matching a function signature, as well as passing through the arguments.

One can do address.call(bytes4(bytes32(sha3("someFunction(uint256,address)"))), 10, 0x42) for example. One can dynamically craft the function signature by just passing another bytes variable. But how does one make it possible to have dynamic arguments as well?

Something like this. But functionSig & encoded_params are created IN Solidity.

function doSomething() {
    if(someCondition) {
        bytes memory data = functionSig + encoded_params.
        toAddress.call(data);
    }
}

I want to be able to IN Solidity craft this. Not from the outside using web3 or some of the other encoding functions? Is there an easy way to do this? Or should a Solidity encoding function be written that converts the arguments to bytes and creates this message data?


texts: When does the fallback function get called?

texts:
Is it true to say that if the first four bytes of an Ethereum's transaction does not contain one of the contract's encoded function calls, then the fallback function will be called?

In other words if contract A has two functions A::One and A::Two, and they encode to 0xabcdef12 and 0x12123a12, then does the fallback function call get called if any other input data (including none) is sent in a transaction?

Or would the transaction get rejected if it has non-zero (i.e. non-0x0) input data?


texts: How to calculate vanity address using C?

texts: I have a curiosity about tacking on zeroes to strings, and Ethereum addresses are no exception. I wrote my own python program, and it was too slow. I wrote the program at https://pastebin.com/hTFGiKzR and I'm just curious about if there is a C program like "profanity" that is faster that runs on CPU.


texts: Can any one pretend as a contract owner?

texts:
I am new to ethereum and solidity , i created a Token app using zeppelin and truffle which generates and sends tokens to others.

My question is if i deployed the contract then msg.sender is my public key (for eg : 0xbb439f37bf26d74aa02d0d85d8748c85530d439a )then i can transfer ownership to other address.If someone knows my public key then can he/she call the transferOwnership method ?


texts: Function to return tuples throws error on frontend

texts:
I have similar functions like this and they work fine:

    function getBarsOfParticipant() external view returns (uint256[], uint16[], bool[]) {
    uint256[] barIds = participantToBarIds[msg.sender];

    uint256[] memory ids = new uint256[](barIds.length);
    uint16[] memory lengths = new uint16[](barIds.length);
    bool[] memory forSale = new bool[](barIds.length);

    for (uint16 i = 0; i <= barIds.length; i++) {
        Bar storage bar = bars[barIds[i]];
        ids[i] = barIds[i];
        lengths[i] = bar.length;
        forSale[i] = bar.forSale;
    }

    return (ids, lengths, forSale);
}

Although the above code compiles, I always get this error at the front-end:

Any suggestions?


texts: How do I convert an "int" type value (including negative integers) to a "string" type value in Solidity? I suppose I could convert it into a bytes32, and then convert it to a string, but I feel that it would cost a lot of gas. What is the least expensive way to do this?


texts: What do the numbers in ERC standards actually mean?

texts:
Ethereum has ERC standards to define strict compatibility requirements on smart contracts. ERC20 is the most popular one, but there are many others.
ERC standards and EIPs (Ethereum Improvement Proposals) have a number attached to them. For EIPs, the numbers mean a specific thing regarding the nature of the proposal
But what do the numbers (i.e. the 721 in ERC721) mean in ERC standards?


texts: Why myContract.events.MyEvent([options][, callback]) does not return "data" and "logs"?

texts:
We have an event as follows :

event LogNewObject(address sender, bytes32 indexed id, bytes32 sub_states_types, bytes32 sub_states_values, address owner);

This event is called in following function :

function newObject(bytes32 _id, uint256 number_of_sub_states, bytes32[10] sub_states_types, bytes32[10] sub_states_values, address _owner) public returns(bool success) {
        require(!isObject(_id));

        uint256 counter=0;
        for(counter; counter < number_of_sub_states; counter++) {

            objectStructs[_id].state.sub_state[sub_states_types[counter]] = sub_states_values[counter];

            emit LogNewObject(msg.sender, _id, bytes32(sub_states_types[counter]), bytes32(sub_states_values[counter]), _owner);

        }

        objectStructs[_id].owner = _owner;
        objectStructs[_id].isObject = true;

        objectList.push(_id);

        return true;
    }

I want to get the logs like remix as following picture shows :

https://ibb.co/hYZhZS

For this purpose, I use following command :

contractInstance.events.LogNewObject({fromBlock: 0, toBlock: 'latest'}, function(error, event){ console.log(event); })

And I receive following output :

> contractInstance.events.LogNewObject({fromBlock: 0, toBlock: 'latest'}, function(error, event){ console.log(event); })
null
Subscription {
  id: null,
  callback: [Function],
  arguments:
   [ { fromBlock: '0x0',
       toBlock: 'latest',
       topics: [Array],
       address: '0xe1623aaf57fcbe260f022404c730ae32aebe39f6' } ],
  _reconnectIntervalId: null,
  options:
   { subscription:
      { params: 1,
        inputFormatter: [Array],
        outputFormatter: [Function: bound ],
        subscriptionHandler: [Function: subscriptionHandler] },
     type: 'eth',
     requestManager:
      RequestManager {
        provider: [HttpProvider],
        providers: [Object],
        subscriptions: {} } },
  subscriptionMethod: 'logs' }

As you see, the output is not as it's expected.

I used also the command proposed by user " Jitendra Kumar. Balla". However, I receive same output and not the output similar to the remix logs output as I uploaded its screen shot above in my question. I expect this output:

What option must be added to this command to receive an output similar to remix output logs which is shown in above picture ?


texts:
I'm trying to use the Quorum-examples/7nodes to test my contract.
I followed the step on github and open a terminal to attach to node1.
https://github.com/jpmorganchase/quorum-examples/tree/master/examples/7nodes

However, when I used Remix and choose Web3 Provider and enter http://localhost:22000 , but it doesn't work.

I do the same test on Web3.py and it can successfully connect.


texts:
I am using truffle to develop a simple smart contract.

I have the following contract:

contract Puppy {

  enum State { good, bad }

  State public status;
  State public constant INITIAL_STATUS = State.good;

  function Puppy() {
    status = INITIAL_STATUS;
  }
}

And I wish to test it as follows:

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

contract('Puppy', () => {
  it('sets the initial status to \'good\'', () => Puppy.deployed()
    .then(instance => instance.status())
    .then((status) => {
      assert.equal(status, Puppy.State.good, 'Expected the status to be \'good\'')
    }))
})

This throws TypeError: Cannot read property 'good' of undefined

If I change the test to

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

contract('Puppy', () => {
  it('sets the initial status to \'good\'', () => Puppy.deployed()
    .then(instance => instance.status())
    .then((status) => {
      assert.equal(status, 0, 'Expected the status to be \'good\'')
    }))
})

it passes.

How do I refer to the enum from within the test?


texts: How to return dynamic sized array's original address on the memory of Solidity?

texts:
On the following source code, memOffset returns local values such as 96, 128 as the address value. How could I make it return the original address that is located on the memory, is it possible? After function f() is called, is the memory freed like local variables in C?

Complete source code is here

contract C {
    function f(uint a, uint b) constant returns (uint[]) {
        assembly {
            // Create an dynamic sized array manually.
            let memOffset := mload(0x40) // 0x40 is the address where next free memory slot is stored in Solidity.
            mstore(memOffset, 0x20) // single dimensional array, data offset is 0x20
            mstore(add(memOffset, 32), 2) // Set size to 2
            mstore(add(memOffset, 64), a) // array[0] = a
            mstore(add(memOffset, 96), b) // array[1] = b
            return(memOffset, 128)
        }
    }
}


texts:
I have a parent contract:
contract Transaction {

enum C_facts {
    Inital,
    Requested,
    Promissed,
    Declared,
    Accepted,
    Declined,
    Rejected
}

C_facts public c_fact = C_facts.Inital;
function nextCFact(bool happyFlow) internal {
    if(happyFlow == true){
        c_fact = C_facts(uint(c_fact) + 1);
    }
    if(happyFlow == false && c_fact == C_facts.Requested){
        c_fact = C_facts.Declined;
    }
    if(happyFlow == false && c_fact == C_facts.Declared){
        c_fact = C_facts.Rejected;
    }
}
modifier transitionNext(bool happyFlow)
{
        _;
        nextCFact(happyFlow);
}
....

Then I have a child contract:
contract RentalCompleting is Transaction{
function promiseRentalCompleting() public
         atCFact(C_facts.Requested)
         returns (address){
             DepositPaying depositPaying = new DepositPaying(address(this));
             return address(depositPaying);
         }

And I want to change the c_fact of RentalCompleting at DepositPaying contract:
contract DepositPaying is Transaction {
        RentalCompleting rentalCompleting;
        constructor(address _rentalCompleting) public{
           rentalCompleting = RentalCompleting(_rentalCompleting);}
        function acceptDepositPaying() public
         atCFact(C_facts.Declared)
         transitionNext(true)
         returns (address)
         {
             require(da_invoiceAmount == pm_invoiceAmount);
             rentalCompleting.c_fact() = C_facts(uint(c_fact) + 1);    <=ERROR HERE=>
             return address(rentalCompleting);
         }

But i'm getting TypeError: Expression has to be an lvalue. on the line marked by:<=ERROR HERE=>.
Does anyone know how to fix this?


texts: Solidity: calling another contract method always returns 0

texts:
I have simple code that deploys and calls method from other contract. I am always getting 0 (by calling Test.get()) instead of the actual value from the other contract. I am using Geth 1.8.11 (private network, only single node) and Remix IDE.

pragma solidity ^0.4.17;

  contract Test {

    address public d_address;
    function deployOther() public {
        d_address = new Referred(123);
    }

    function get() public returns (uint){
        return Referred(d_address).toReturn();
    }
    function set() public payable {
        Referred(d_address).set.gas(21000).value(msg.value)(456);
    }

}

contract Referred {
    uint public val;
    constructor(uint v) public {
        val = v;
    }

    function set(uint nv) public payable{
        val = nv;
    }

    function toReturn() public view returns (uint){
        return val;
    }
}

I see this error in the geth log,

DEBUG[06-25|19:34:00|core/state_transition.go:216] VM returned with error err="out of gas".


texts: Is gas consumed per contract call or during contract creation?

texts:
I know that there is a calculation about how much gas a script consumes. My question is is this consumption per contract call (i.e. by an Ethereum client) or does it only apply when the contract is being deployed to the Ethereum network?

It makes more sense to me to the former where the cost is associated with every call because processing is involved, but I am not sure if that is economically feasible for the developers?


texts: What are sealer and signer nodes in PoA networks?

texts: I have googled this and although the terms are widely used I cannot find a definition for them. Does anyone have a definition for these terms?


texts: How to perform a SWAP from ETH to WBTC with Netherium?

texts:
Sorry for asking nubie question.
I have a requirement to transfer eth from my account to ETH & WBTC of another account. Is this possible with netherium ? I have transfered eth from my account to another and it works fine. But i could not transfer/swap ETH to WBTC. How can i achieve this?
Thanks !


texts:
I'm trying to add a simple string and store it in the Ethereum database as a key-value pair. (ID as key and a string as value)

What would be the best way to do that? I have setup multiple geth Ethereum nodes in my lab. I was thinking of writing a solidity contract that does the following -

Function for adding entry (id and string), which stores this key-value pair in the internal leveldb.
Getting a string value - given an id, which looks up the id (key) in the database and returns the value.

However, I am not able to find the appropriate function calls or API's that can help accomplish this. If there is an alternate approach that may be helpful, pls let me know.

Thanks!


texts: How does Truffle Migrate sign the transaction that it's dealing with?

texts:
As a newbie in this space, I'm just wondering how Truffle handles migrating contracts with the Truffle Migrate command—what does it use to sign those transactions? Does it use some wallet implementation? In my development environment, truffle.js is configured to connect to Ganache.

Hopefully, this question makes sense.


texts: How is an array of structs accessed in getStorageAt and where is it stored?

texts:
The following code works - after changing uint to unit16 - and I find now after running it, that getStorageAt does not show the actual values. Are the values stored outside that access to that method or in memory?

pragma solidity ^0.4.18;

contract CA3 {

struct Student {
        uint16 age;
    uint16 income;
    uint16 score;
    uint16 attendance;
}
Student[] public students;

function setStudent (uint16 _age, uint16 _income, uint16 _score, uint16 _attendan
ce) public {
   Student memory tempStudent = Student({age: _age, income: _income, score: _scor
e, attendance: _attendance});
        students.push(tempStudent);
//students.push(Student({age: _age, income: _income, score: _score, attendance: _
attendance}));

}

}

> con.setStudent(8,1,1,1)
"0x9886c2de6ace867efedc4c06d2fa79d7148807287a827d2f31a6f01956d6b4ca"

> con.students(0)
[8, 1, 1, 1]

> eth.getStorageAt(con.address,0)
"0x0000000000000000000000000000000000000000000000000000000000000001"

The 1 appears to be somekind of index.

When I run -

> eth.getStorageAt(con.address,0)
"0x0000000000000000000000000000000000000000000000000000000000000001"
> con.setStudent(8,10,10,15)
"0x2e9ad070deaa4cd044ae3d1b4673a676efde828faf5043bc1b62fdb746efb583"
> eth.pendingTransactions.length
0
> con.students(1)
[8, 10, 10, 15]
> eth.getStorageAt(con.address,1)
"0x0000000000000000000000000000000000000000000000000000000000000000"
> eth.getStorageAt(con.address,2)
"0x0000000000000000000000000000000000000000000000000000000000000000"
> eth.getStorageAt(con.address,0)
"0x0000000000000000000000000000000000000000000000000000000000000002"

After the second run, storage shows 2. But where is the students array stored?

I just exited the geth and entered again to find the same results. So students are not held in memory. The values are in storage. But where? Also why does getStorageAt not show them? Is there an equivalent method to show them?


texts:
https://github.com/axiomzen/eth-random

They have :

"We ultimately recommend not using this module, or this pattern in general. The reason is that it's fundamentally flawed and we can't recover from. A smart contract can call the random function and it can decide wether or not the result is beneficial, and in case it isn't then revert the operation."

How the revert works in code/solidity ?
How the contract caller knows if reverts or not, he checks the balance or make other call to check the outcome?

Thanks in advance.


texts: TxReceipt Status:Fail TxHash: 0x3ff844d8ec7c7404cb0170c42f2eac1e0732e9dc8445b05cda9fe8d595431bde

texts:
I was hoping someone could help, I sent some ether to an ICO n I get Tx receipt status failed and when i look at the transaction on etherscan I get Value transfer did not complete most likely as a result of a revert opcode. I am new to this industry so i don't no where to start.Thanks
TxHash: 0x3ff844d8ec7c7404cb0170c42f2eac1e0732e9dc8445b05cda9fe8d595431bde

even my previous transactions also failed with another ICO. TxHash:0x4948e49520187d14a7715365a53332cc7b9ce35b29ed3d8a6e5a98caaa070a9e

Do i have to do anything to stop these transaction, My MEW still showing the previous balance. Please help how to recover my ether.


texts: Gas estimation error MCL flashloan (On bsc testnet)

texts:
I get this pop-up shows Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? every time I call flashloan.
I directly copy and paste the code from Multiplier-Finance github. (https://github.com/Multiplier-Finance/MCL-FlashloanDemo)
With this LendingPoolAddressProvider : 0x78547CBf195Dc3D92C5847acD9E89aFB35430c0f
(From https://mcl-docs.multiplier.finance/developers/testnet-addresses)
How can I fix it? Thank you.


texts: What does the logger's address mean in Ethereum yellow paper?

texts:
In the Ethereum yellow paper Page 5 says that the log entry O consists of (O_a,(O_{t0}, O_{t1},...),O_d).
And O_a means the logger's address.
What's the meaning of logger's address?
Does it mean the contract address or something can be defined by the user (like the SHA3 of (O_{t0}, O_{t1},...),O_d)? Thank you!


texts: Right way to keep track of mapping values

texts:
I'm having trouble finding the most cost efficient way to keep trace of what is stored into a mapping. I'm working on a web service that requires, to display, to get the data stored in a mapping

This is close to :

mapping(address => bool) values;
address[] valuesTrue;

function getValue(address a) public view returns (bool) {
    return values[a];
} //This is pretty self-explanatory

function getAllValues() public view returns(address[]) { //This one is not
    return valuesTrue;
}

function addValue(address a, bool b) public {
    values[a] = b;
    if (b)
        valuesTrue.push(a);
    else {
        for (uint i = 0; i < valuesTrue.length; i++) {
            if (valuesTrue[i] == a) {
                valuesTrue[i] = valuesTrue[valuesTrue.length - 1];
                delete valuesTrue[valuesTrue.length - 1];
                valuesTrue.length--;
                break;
            }
        }
    }
}

This is the most efficient way I found to store all the address which lead to 'true' in the mapping. Is there a more efficient way I'm not getting ?


texts: How to calculate the number of tokens owned by the liquidity pool via bonding curve on Uniswap?

texts:
I know a little bit about the Uniswap, providing liquidity, bonding curves...
But I'm still struggling to perform the actual math - what is the actual formula?
Real-life example (easier to operate on real numbers)

Uniswap pool: https://uniswap.info/pair/0x2680a95fc9de215f1034f073185cc1f2a28b4107
Bonding curve contract: https://etherscan.io/address/0x2680a95fc9de215f1034f073185cc1f2a28b4107

Situation
Round numbers:

300 ETH
300k GET

Say I'm a whale and I add 60 ETH and 60k GET to the bonding curve.
The bonding curve now:

360 ETH
360k GET

I have 20% of the liquidity pool.
Calculation
What will happen in cases 1 and 2?

Someone sends 10 ETH into the bonding curve?

Someone sends 10k GET into the bonding curve?

My understanding is that I will still own 20% of the liquidity pool but what about the actual numbers of ETH and GET?


texts: non-suported ERC20 token sent to Ledger Nano X. ANY suggestions as how to get it back?

texts: I sent non-supported ERC20 token (Barnbridge BOND)to my Ledger Nano X. The transaction shows on Etherscan.io but of course not on Ledger live or Nano X? Heeeeelp plz.


texts: Convert a number to a 32 bit HEX number using web3?

texts:
I need to pass the SHA3 function a number, but need it in the format of HEX with the full 32 bits i.e. with leading zeros plus the 0x (e.g. example number 3 ):

web3.sha3("0x0000000000000000000000000000000000000000000000000000000000000003")

Is there a function that takes a number e.g. 3 and creates this string/hex number?

Thanks, Ian


texts:
quick question...

... I have a remote host running Parity which I can connect to via an SSH Tunnel. I've forwarded ports 8180, 8546 and 8646 through the tunnel to the computer running Parity.
I can load the UI for that Parity instance from any other computer on my LAN (after I make a SSH connection to that computer). My parity chrome extension is also working and able to connect to the host's parity instance.

Now, let's say I want to use my NanoS to sign transactions from a computer on my LAN (other than from the computer where Parity is actually running).. I'd like to be able to connect the Nano to the computer I'm using at the time and have Parity "see" it. As far as I can tell, Parity is not seeing it.

When the Parity Signer pops up while using EtherDelta (for example), it tells me to connect the hardware wallet before confirming the transaction and the confirm button is grayed out. So it seems like I'd need to connect the Nano to the server actually running Parity.

Is there anyway around this?

Thanks.


texts: Create two contracts that each with different accounts.

texts:
I'm a newbie in blockchain. I am trying to repeat DAO attack using two different contracts, in my case DAO and Hacker. I want the 2 contracts belongs to 2 separated account, so I can see that the ethereum goes from DAO contract holder to Hacker contract holder in Genache. However, I got stuck since I can only migrate my contract using the same account based on command truffle --migrate -reset

Here are the contracts for both DAO and Hacker:

pragma solidity ^0.4.24;

contract Dao {
    struct User {
        address addr;
        string name;
        uint balence;
        uint8 flag;
    }

    //Fetch User
    mapping(address=>User) users; // create HashArray<address,User>, which can be random access

    uint public userCount;

    constructor() public {
        //user = "hello"; just for testing
        //addUser("wei");
        //addUser("alex");
    }

    function addUser (address _addr, string _name, uint _balence, uint _flag) private {
        users[_addr] = User(_addr,_name,0,1);
        userCount++;
    }

    function addToBalence(string name) public payable{
        if(users[msg.sender].flag != 1) addUser(msg.sender,name,0,1);
        users[msg.sender].balence = users[msg.sender].balence + msg.value;
    }

    function showBalence(address) public returns (uint) {
        return users[msg.sender].balence;
    }

    function withdraw(uint amount) public payable{

        if(users[msg.sender].flag != 1) revert("user does not exist");
        else if (users[msg.sender].balence >= amount){
            msg.sender.call.value(amount)();
            users[msg.sender].balence -= amount;
        }
        else return false;
    }
    }
}

contract Hacker {
    // the address of the user, so the money can be transfered
    Dao dao;
    address userAddress;
    string userName;

    constructor(string name, address daoAddr) public {
        dao = Dao(daoAddr);
        userAddress = msg.sender;
        userName = name;
    }

    function payout(uint amount) public payable{
        dao.withdraw(amount);
    }
}


texts: Is there any way to transfer tokens with timestamp in smart contract?

texts:
I have to transfer tokens from one account to another and I would like to associate a timestamp with that tokens so that i can identify which token was transferred on which time.

How do we write this code in a smart contract?


texts: I’m a noob in smart contract development so I have a question. Is it possible to make that the smart contract itself can pay gas needed for executing? Or could I chose an address which should pay the transaction automatically?


texts:
TxReceipt Status:Fail  what should i do ?
https://etherscan.io/tx/0x0ed9f4f76312a7141975d29f40e042fecc8a9bc7f380e3a45156ddca7590750b


texts: ethereumj & etherscan, discrepancies between blocks described- during sync

texts:
I've cloned the ethereumj codebase, and in the directory ethereumj/ run it for testnet with the following command:

./gradlew runRopsten

However, during the block synchronization process there is a discrepency between the blocks as they're described in the console, and the corresponding block number as described by etherscan.

For instance, consider Block #588712, pictured below:

The console asserts that it contains 70 transactions, however- on etherscan it describes that block as containing 0 transactions. See below:

Here is an additional example:

One can also run this client with the command

./gradlew run -PmainClass=org.ethereum.samples.RopstenSample

It results in the same error, as demonstrated here: