texts: Getting an HTTP Query Error when making GET-Requests using Oraclize to a local Node.js server

texts:
I am running a testrpc instance combined with Ethereum Bridge. Upon calling the smart-contract function "purchaseLogo" using Metamask (and web3), 2 oraclize_queries are getting initiated and make a GET-Request to my Node.js server (localhost). I get the following Error:

ERROR HTTP query error
[
"LocationParseError",
"parsing_helper.wrong_path"]

How can I resolve this HTTP query error? I can't find a solution right now. Could someone point me into the right direction? The endpoint works well when testing it in the browser. Thanks in advance!

My Smart Contract code looks like this:

pragma solidity ^0.4.0;

import "./usingOraclize.sol";

contract Purchasing is usingOraclize {

    string[] public subIDsBought;
    uint256 public price;
    string public query1;
    string public query2;
    address public author;
    address public buyer;
    uint256 public sentValue;
    bool public lastTransactionWasValid = false;

    mapping (bytes32 => uint) queries;

    event newOraclizeQuery(string description);

    //Setup:
    //node bridge -H localhost:8545 -a 1

    function Purchasing () public {
        OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475);
        oraclize_setNetwork(networkID_testnet);
    }

    function __callback(bytes32 myid, string result) {
            if (msg.sender != oraclize_cbAddress()) throw;

       if (queries[myid] == 1){
          author = parseAddr( result );

       } else{
           if(queries[myid] == 2){
                price = parseInt(result);

               //Last query, transfer to authorwallet
               if (sentValue >= price) {
                   //Transfer to author - success
                   lastTransactionWasValid = true;
                   author.send(sentValue);
               } else {
                   //Transfer back to buyer - failure
                   lastTransactionWasValid = false;
                   buyer.send(sentValue);
               }

           }
       }
    }

    function purchaseLogo( string subID ) public payable returns (bool success) {

            buyer = msg.sender;

            query1 = strConcat("json(", "http:localhost:3000/api/getpurchasedata/", subID, ")", ".purchase.recipient");
            query2 = strConcat("json(", "http:localhost:3000/api/getpurchasedata/", subID, ")", ".purchase.price");

            newOraclizeQuery("Oraclize query was sent, standing by for the answer..");

            //oraclize_query("URL", query);
            queries[oraclize_query("URL", query1)] = 1; // ask for recipientWallet
            queries[oraclize_query("URL", query2)] = 2; // ask for price

            return     lastTransactionWasValid;
    }

    //Helper functions to concatenate strings in solidity
    function strConcat(string _a, string _b, string _c, string _d, string _e) internal returns (string){
        bytes memory _ba = bytes(_a);
        bytes memory _bb = bytes(_b);
        bytes memory _bc = bytes(_c);
        bytes memory _bd = bytes(_d);
        bytes memory _be = bytes(_e);
        string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length);
        bytes memory babcde = bytes(abcde);
        uint k = 0;
        for (uint i = 0; i < _ba.length; i++) babcde[k++] = _ba[i];
        for (i = 0; i < _bb.length; i++) babcde[k++] = _bb[i];
        for (i = 0; i < _bc.length; i++) babcde[k++] = _bc[i];
        for (i = 0; i < _bd.length; i++) babcde[k++] = _bd[i];
        for (i = 0; i < _be.length; i++) babcde[k++] = _be[i];
        return string(babcde);
    }

    function strConcat(string _a, string _b, string _c, string _d) internal returns (string) {
        return strConcat(_a, _b, _c, _d, "");
    }

    function strConcat(string _a, string _b, string _c) internal returns (string) {
        return strConcat(_a, _b, _c, "", "");
    }

    function strConcat(string _a, string _b) internal returns (string) {
        return strConcat(_a, _b, "", "", "");
    }

}


texts: What was the first block mined with Homestead?

texts:
What was the first Homestead mined block?

1,150,000 was planned if someone can confirm? https://ethereum.stackexchange.com/a/1834/264

can one see that its a homestead block by some property? https://etherchain.org/block/1150000


texts: Can't send REQ tokens with Metamask Chrome Extension

texts:
I sent some REQ tokens to my Metalink chrome extension. I had to add the REQ token myself, and I received the tokens I sent successfully. However, when I try to send some of my tokens anywhere, Metamask automatically restricts me from sending anything but ETHER.

I went to MyEtherWallet, connected to Metamask and successfully selected 283 REQ tokens to be send to an address. However, after I confirm my transfer detail on MEW and it opens my Metamask chrome extension, I get this screen:

I can't find anyone else who had a similar problem. I thought that Metamask might have disabled token transaction for some time, but that doesn't really makes sense to me. especially as I sent the tokens through MyEtherWallet.

Is there anyone who might know what is the problem and why my REQ tokens are trapped in Metamask?

edit: I did add the REQ token and a valid contract address from https://etherscan.io/token/0x8f8221afbb33998d8584a2b05749ba73c37a938a?a=0x2fa35a2773f720ddc374e8efb4a82fc4594425d8

Here is a screenshot of my Metamask interface


texts: Decoding input paramters throws invalidity error


texts: How to interact with the blinded auction contract from web3.js

texts:
My question is about the blind auction contract in the solidity examples.

What is the right way to interact with the contract from web3.js? I tried this, but it does not give the right result.

var blinded_bid = web3.sha3(10, true, "abcd");

It would be great if someone could provide an example how to interact with that kind of contract using web3.


texts: How can i create my own version of Metamask? (Wallet, provider and a signer)

texts:
I have done a lot of research regarding the working of web3 and the new library called ether.js, Also how the seed phase work in the creation of wallet and addresses and the Hierarchical Deterministic wallet, All the bitcoin improvement proposals - bip-32, 39, and 44.
Now, My ultimate aim is to make my own version of Metamask and just to be sure I want do get some clarification:

Metamask is a cryptocurrency wallet that generates and maintains your different accounts in your wallet and also offers an in-house functionality to transfer funds -- right?

Metamask acts both as a signer(as it stores your credentials for transaction signing) and a provider(as it gives you the local web3 instance and reference to different test-net and the main-net) -- right?

I went through the Metamask GitHub page and tried my best to get something out of the code, but I was unfamiliar with the tech they have used in accomplishing these functionalities.
Now I want to know how I can make my own version of Metamask. As:

Transaction building and signing are possible but retrieving estimate gas, nonce, and other stuff and creating a Tx and making an async call.

Making a wallet involves generating a seed value and further account creation and other things. I guess all the complicated maths behind the scenes are taken care of by the functions(that we will use) itself.

But all this is theoretical, how can I proceed, practically.
All I know is it takes patience, research, and lot of learning ,and I am ready to give it all. Please Help!


texts: Deposit Money Automatically On Child Creation In Factory Pattern

texts:
I am implementing a factory pattern contract and on my constructor I want to deposit money into my child contract as soon as the child is rendered
--Factory--
function newChild() {
     Child child = new Child(money);
}

--Child Contract--
address payable public spender;

constructor(uint256 _money) {
   address(this).transfer(_money) /*{from: spender}*/;
}

My remix IDE is yelling at me that transfer is only valid on address of type payable. Obviously I am doing something quite wrong here so my question is what is the best way to send money immediately when I child is created?
Also I want to spend that money from a specific address lets call it the spender for now. How do I sent the money from that address
Thanks everyone!


texts: Execute contract using multi-sig contract account

texts: I cannot execute my contract using a wallet contract with multi-sig from Mist. After the last signature is confirmed, the transaction stuck in the "Confirmation Needed" section of the Mist window where the last account icon never gets a check mark. All 12 confirmation showed in the progress. But the contract execution is never complete. I use geth 1.5.5 in private network mode and Mist 0.8.9.


texts: How a dapp can call contract functions without running a local full node?

texts:
I have developed a contract and a basic dapp.
It works on my local environment with my local test node.

Now I would like to understand how it can be distributed so that a user doesn't have to run a full node.

Maybe the user needs something like Metamask?
If yes, I would like to know if I have tell my dapp not to point to http://localhost:8545 but to a Metamask node
Or maybe I'm off track...


texts: What are the first bytes in the input to getTransaction?


texts: Does anyone has idea how metamask generates the passPhrase. I was looking in github for related files but unable to figure out how exactly the things are done.


texts: I am trying to replicate an ecommerce system using a DApp and want to know how to decrement product quantity

texts:
For my class project I am trying to replicate ebay on a DApp. When a buyer buys something from a seller, the wallet shows ether transacted, I also want to show quantity transacted. E.g.

Jan 1 2018:

Seller A has 0 ether and 10 carrots costing 2 ethers each
Buyer B has 10 ether and 0 carrots costing 0 ethers each

Jan 2 2018:

Buyer buys 2 carrots costing 1 ether each, costing .2 ether for transaction
Seller A has 2 ether and 8 carrots costing 2 ethers each
Buyer B has 7.8 ether and 2 carrots costing 2 ethers each

How do I include the quantity of carrots in solidity and show increment for buyer and decrement for seller?


texts: Why constant variables inside functions fail to compile in Solidity?

texts:
Why does this fail to compile on Solidity?

contract TestContract {
    function testFunc() {
        int256 constant testVar = 1;
    }
}

It compiles if I remove the constant keyword.


texts:
I need help, I want to add more gas to my token/contract creation, but there is no Nonce since it's pending, how can I get this contract live/mined via Remix Ethereum IDE?
With average gas, does $90 seem correct for token creation? I basically cheaped out trying to make it $10.
`Time Last Seen:
02 days 12 hr 32 min 16 secs ago (Jan-03-2021 05:54:47 AM)
Estimated Confirmation Duration:
This txn has been pending > 24hrs (Learn more about Canceling/Replacing Txns or see our Gas Tracker)
Max Txn Cost/Fee:
0**.**00947995 Ether ($10.18)
Gas Price:
0**.**00000001 Ether (10 Gwei)
Ether Price:
$978.69 / ETH
Gas Limit:
947995
Gas Used by Transaction:
Pending
Nonce Position
0 Pending`


texts:
I have ReactJS working to read data from my blockchain but I cannot update the blockchain. Here is my code to read the blockchain which works -

  var reviewContract = ETHEREUM_CLIENT.eth.contract(reviewContractABI).at(reviewContractAddress)
  var reviewData = reviewContract.getReviews()

When I try and update it fails:

reviewContract.addReview("company1", "trevor lee oakley", 1)

Uncaught Error: invalid address
at inputAddressFormatter (http://localhost:3000/static/js/bundle.js:45751:12)
at inputTransactionFormatter (http://localhost:3000/static/js/bundle.js:45577:21)
at http://localhost:3000/static/js/bundle.js:45881:29
at Array.map (native)
at Method.formatInput (http://localhost:3000/static/js/bundle.js:45880:33)
at Method.toPayload (http://localhost:3000/static/js/bundle.js:45906:24)
at Eth.send [as sendTransaction] (http://localhost:3000/static/js/bundle.js:45931:31)
at SolidityFunction.sendTransaction (http://localhost:3000/static/js/bundle.js:48458:27)
at SolidityFunction.execute (http://localhost:3000/static/js/bundle.js:48544:38)
at App.componentWillMount (http://localhost:3000/static/js/bundle.js:32663:23)

I have this code to add.

pragma solidity ^0.4.8;
contract Review {

Review[] public reviews;
struct Review {
    bytes32 companyName;
    bytes32 companyReviewer;
    uint companyReview;
}

function addReview (bytes32 _companyName, bytes32 _companyReviewer, uint _companyReview) returns (bool success) {
    Review memory newReview;
    newReview.companyName = _companyName;
    newReview.companyReviewer = _companyReviewer;
    newReview.companyReview = _companyReview;

    reviews.push(newReview);
    return true;
}

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

    uint length = reviews.length;
    bytes32[] memory companyNames = new bytes32[](length);
    bytes32[] memory companyReviewers = new bytes32[](length);
    uint[] memory companyReviews = new uint[](length);

    for (uint i=0; i<reviews.length; i++) {
        Review memory currentReview;
        currentReview = reviews[i];

        companyNames[i]=currentReview.companyName;
        companyReviewers[i]=currentReview.companyReviewer;
        companyReviews[i]=currentReview.companyReview;

    }
    return (companyNames, companyReviewers, companyReviews);
}
}

The contract works in truffle so I know -

The solidity is OK
Access to the blockchain is OK
Update fails.

Any help is welcome.


texts: Azure Blockchain Service node properties

texts: What exactly are Access key 1, Access key 2, Member account, Web socket, DNS, creater account, etc. of a node in Azure Blockchain Service? I am getting confused as to what are these. Also what are the public key and private key of a node from encryption perspective?


texts: Private Chain: Dealing with large numbers of Ether per block? (Big.Int issue)

texts:
I've been playing around with geth for a private chain implementation where we're using a much larger circulation of ether on our chain.

To modify this I tried changing the block reward to:

*big.Int = big.NewInt(25000e+18) in ethash/consensus.go

But, this lead to the error that the Int is overflowing as it seems golang automatically casts big.NewInt as an Int64 type.

Given that on the current Ethereum blockchain users have balances greater than an Int64 number would allow (when denoted in Wei) I assume that there is a work around implemented for geth that hasn't been applied to the block reward logic.

Is anyone familiar with how this is handled and how I might be able to adjust the blockreward to a number greater than an Int64 would allow?


texts: Where does coingecko/coinmarketcap get the Max Supply of tokens?

texts:
I am deploying a contract that will ultimately mint a total of 1,000,000 coins
Currently, only 100 were minted.
So the number that is returned from TotalSupply() is 100.
How do you expose the cap (max total supply) to sites like coingecko/etherscan/etc'?
Side question -
I see in some contracts that while there is a _cap parameter, it is not enforced in any way inside the mint function (and more than the cap can technically exist - if so, how can this figure be trusted without auditing each contract?)


texts: Having trouble installing cpp-ethereum from homebrew

texts:
Been trying to install cpp-ethereum for development, but I keep running into issues with homebrew. Was hoping one of you had encountered something similar.

 ==> cmake -DCMAKE_C_FLAGS_RELEASE=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/cpp-ethereum/1.3.0 -DCMAKE_BUILD_TYPE=Release -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_VER
Last 15 lines from /Users/ryan/Library/Logs/Homebrew/cpp-ethereum/01.cmake:
-- Check for working CXX compiler: /usr/local/Homebrew/Library/Homebrew/shims/super/clang++
-- Check for working CXX compiler: /usr/local/Homebrew/Library/Homebrew/shims/super/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at cmake/EthCompilerSettings.cmake:68 (message):
  This compiler AppleClang 8.1.0.8020042 is not able to compile required
  libff.  Install clang 4+ from Homebrew.
Call Stack (most recent call first):
  CMakeLists.txt:94 (include)

-- Configuring incomplete, errors occurred!
See also "/tmp/cpp-ethereum-20170904-66078-15y3sg0/CMakeFiles/CMakeOutput.log".

If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
https://github.com/ethereum/homebrew-ethereum/issues

These open issues may also help:
brew install cpp-ethereum error https://github.com/ethereum/homebrew-ethereum/issues/121
brew install cpp-ethereum CMake Error https://github.com/ethereum/homebrew-ethereum/issues/124
Mac OS X 10.12.5 install error https://github.com/ethereum/homebrew-ethereum/issues/120
Error installing go-ethereum on Mac OS X https://github.com/ethereum/homebrew-ethereum/issues/117
Mining on MacBookPro issue https://github.com/ethereum/homebrew-ethereum/issues/111
Add a dependency on jsoncpp for solidity? https://github.com/ethereum/homebrew-ethereum/issues/123
Macbook Pro - Radeon Pro 560 4GB of GDDR5 issues https://github.com/ethereum/homebrew-ethereum/issues/122
Error when installing Solidity compiler https://github.com/ethereum/homebrew-ethereum/issues/96


texts: Block.timestamp returning multiple values

texts:
I have a function inside my smart contract that fetches the timestamp of the block it's in:

function getTime() public returns (uint256 time){
    return block.timestamp;;
}

According to how I understand timestamps, this should return one value. Yet when I deploy the contract and test that method it returns two values:

truffle(development)> contract.getTime.call({from: accounts[1]})
BN {
  negative: 0,
  words: [ 41810542, 23, <1 empty item> ],
  length: 2,
  red: null
}

Why is this happening/ what do the two values represent if only one of them is the timestamp?


texts: Transactions stuck at pending on ropsten test net from one day

texts:
I am Writing a simple script for ERC20 token transfer method. which sign transaction offline and then submit it to network.
Transfer method encoded data :
var encoded = await MyContract.methods
              .transfer(receiver_address, 10);

To get nonce of sender account :
var nonce = await web3.eth.getTransactionCount(
              sender_address,
              "pending"
            );

To get estimateed Gas of latest block:
let estimatedGas = await web3.eth.estimateGas({
            "from"      : sender_address,
            "nonce"     : nonce,
            "to"        : address_contract,
            "data"      : encoded.encodeABI(),
        });

Here i create a tx object using ethereumjs-tx cdn link:
let privateKey = new ethereumjs.Buffer.Buffer(key, 'hex')
            var tx = {
              nonce: nonce,
              gasPrice: web3.utils.toHex(gasPrice),
              gasLimit: web3.utils.toHex( estimatedGas + 1000000),
              to: address_contract,
              data: encoded.encodeABI(),
            };
            let tx_object = new ethereumjs.Tx(tx , { chain: 'ropsten' })
            tx_object.sign(privateKey)
            let serializedTx = tx_object.serialize();

Then i submit transaction to ropsten test net:
     web3.eth.sendSignedTransaction('0X'+serializedTx.toString('hex'))
              .on("transactionHash", function (hash) {
                document.getElementById("error").innerHTML =
                  "Transaction Hash :" + hash;
              });

Gas Limit of transaction is :
Gas Limit:1051110 also tried with gas Limit of latest block 8000029

Gas Price of transaction is :
Gas Price:0.000000002 Ether (2 Gwei)

But my problem here is that transactions get stuck at pending state from two days.
i am attaching image and link to contract address

link of contract: https://ropsten.etherscan.io/address/0xdc11d98aa50b99a948a4fc2e159c30c5ba9a8364
following are version of web3 and etherumjs-tx:

web3 version 1.0.0-beta.34 (also tried 1.0.0-beta.26 and @latest)
Ethereumjs-tx version ethereumjs-tx-1.3.3

I don't think that there is problem with my gas Price or gas Limit.


texts:
I created a simple test contract with a single method:

pragma solidity ^0.4.24;

contract SimpleTest {

    function testFunc(string name, bool isFirst) public {
        //do stuff
    }

}

I'm calling the function with values "test name", true and once the transaction is executed I see the following encoded input:

0x1a387720
0000000000000000000000000000000000000000000000000000000000000040
0000000000000000000000000000000000000000000000000000000000000001
0000000000000000000000000000000000000000000000000000000000000009
74657374206e616d650000000000000000000000000000000000000000000000

Which, according to the documentation, should include the function selector and a 32 bytes string for each input param. Why do I get 4 strings of 32 bytes and not 2? I'm not clear how to decode this input to get the actual values of the input params.

I used Remix to test this case.


texts: Is there situation when using constants instead of literal values in the code will make the contract deploy more expensive?

texts:
I was reading a smart contract code in solidity and I found some magic numbers (literal values as function arguments or in some expressions).
My first impulse was refactor it to use named constants but a team colleague rised this question. May this refactoring turn the contract deployment more expensive?
I took a look at solidity style guide page but I didn't find an answer.
Any help about it would be great!
Thanks in advance,
Cláudio.


texts:
I wanna achieve smart contract to send ETH back to the sender on some conditions:

function() public payable {
    msg.sender.transfer(msg.value);
}

I am passing gasLimit equal to 4700000:

web3.eth.sendTransaction({from: wallet, to: contract.address, value: ether(2), gasLimit: 4700000});

And still see error when running on testrpc:

Error: VM Exception while processing transaction: out of gas

Sending ETH to other smart contract usually works fine. What's wrong with instant refund?


texts: Web3j Contract Call Transaction - Always out of gas

texts:
Playing around with Web3j, I set up a private, single-node blockchain with Geth using a genesis gas limit of 21 million.

I started a node with the following command:

geth --datadir ./geth/data --rpc --networkid 611234220438 --nodiscover --mine --minerthreads 1 --etherbase 0xda42738b67c0dca7a44e3601312b7e44a007e4d2 --targetgaslimit 21000000 --verbosity 3

When I deploy a contract (gas limit 1 million), everything works as expected. A little bit of ETH is taken out of my wallet and I can interact with the deployed contract. However, constant functions work. All non-constant transactions fail and consume all gas.

I am executing this contract function (Solidity 0.4.13):

function skip() {}

Here is the contract creation and transaction as confirmed by Geth logging:

Submitted contract creation

fullhash=0xb407cf8dcb79cca01bd7bf11fb2ed025f5316d978aef92f2373be290a389df50 contract=0x075abea5aae9997bbf83a4a7f03d57c5bad65303

Submitted transaction

fullhash=0xae6697b0ebf6754f2570433a57dea159c662d79f59ef9d820cda5ffeb83028a5 recipient=0xc7c1335a273a6ee519f5563357b93b3e365a74da

Here is the transaction receipt:

{
  "transactionHash":"0x43c42aee0e44df748b0b482240e79f1536df15196843a4f752083bda02a14b01",
  "transactionIndex":0,
  "blockHash":"0x86b599ac97879417c5ed3f96e8985e85e861774c010b340e50081fcb6b2248bf",
  "blockNumber":461,
  "cumulativeGasUsed":1000000,
  "gasUsed":1000000,
  "contractAddress":null,
  "root":"0x70b774d4d679210d1e88f0d8fc0d6f2e0aec457fe333d65515e6bf61de7e0ec6",
  "from":"0xd2b4519298938983586e09028a2ea302c667cf76",
  "to":"0x075abea5aae9997bbf83a4a7f03d57c5bad65303",
  "logs":[],
  "logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "gasUsedRaw":"0xf4240",
  "transactionIndexRaw":"0x0",
  "blockNumberRaw":"0x1cd",
  "cumulativeGasUsedRaw":"0xf4240"
}

What might be going wrong? To me, it looks like the transaction might be failing, though I don't know why or how to tell.


texts: Can't connect to localhost:8545 while using ethereumjs-testrpc web3?

texts:
I am developing a simple Voting dApp by following a tutorial. In this tutorial
we are using npm install ethereumjs-testrpc web3 so that we can get the fake nodes of Ethereum.

For that i first created the object of web3 by using Web3 = require('web3') command in the Node.js command prob. After using the command i should get all the attributes of Web3. But i am only getting [Function: Web3].

After that i am using web3 to connect to the localhot:8545 by using web3 = new Web3("http://localhost:8545") in the Node.js command prob. To check that i am connected to localhost:8485 i am using web3.eth.getAccounts(console.log). I should get addresses as follows;

['0x9c02f5c68e02390a3ab81f63341edc1ba5dbb39e',
'0x7d920be073e92a590dc47e4ccea2f28db3f218cc',
'0xf8a9c7c65c4d1c0c21b06c06ee5da80bd8f074a9',
'0x9d8ee8c3d4f8b1e08803da274bdaff80c2204fc6',
'0x26bb5d139aa7bdb1380af0e1e8f98147ef4c406a',
'0x622e557aad13c36459fac83240f25ae91882127c',
'0xbf8b1630d5640e272f33653e83092ce33d302fd2',
'0xe37a3157cb3081ea7a96ba9f9e942c72cf7ad87b',
'0x175dae81345f36775db285d368f0b1d49f61b2f8',
'0xc26bda5f3370bdd46e7c84bdb909aead4d8f35f3']

All i need is one of those addresses to proceed further. But i am getting an error which says that  Connection refused or URL couldn't be resolved as follows;

Promise {
  <pending>,
  domain:
   Domain {
     domain: null,
     _events:
      [Object: null prototype] {
        removeListener: [Function: updateExceptionCapture],
        newListener: [Function: updateExceptionCapture],
        error: [Function: debugDomainError] },
     _eventsCount: 3,
     _maxListeners: undefined,
     members: [],
     [Symbol(kWeak)]: WeakReference {} } }
> Error: Connection refused or URL couldn't be resolved: http://localhost:8545
    at XMLHttpRequest.request.onreadystatechange (D:\Notes\BCS\Semester 7\FYP\New One\node_modules\web3-providers\dist\web3-providers.cjs.js:759:22)
    at XMLHttpRequestEventTarget.dispatchEvent (D:\Notes\BCS\Semester 7\FYP\New One\node_modules\xhr2-cookies\dist\xml-http-request-event-target.js:34:22)
    at XMLHttpRequest._setReadyState (D:\Notes\BCS\Semester 7\FYP\New One\node_modules\xhr2-cookies\dist\xml-http-request.js:208:14)
    at XMLHttpRequest._onHttpRequestError (D:\Notes\BCS\Semester 7\FYP\New One\node_modules\xhr2-cookies\dist\xml-http-request.js:349:14)
    at ClientRequest.<anonymous> (D:\Notes\BCS\Semester 7\FYP\New One\node_modules\xhr2-cookies\dist\xml-http-request.js:252:61)
    at ClientRequest.emit (events.js:198:13)
    at ClientRequest.EventEmitter.emit (domain.js:448:20)
    at Socket.socketErrorListener (_http_client.js:392:9)
    at Socket.emit (events.js:198:13)
    at Socket.EventEmitter.emit (domain.js:448:20) null

I also check a relevant answer to my question in this stack exchange. But this answer is telling to use truffle instead of solving the above problem. And if comments of this answer are solving the above problem then they are perhaps solving it for actual web3 not for ethereumjs-testrpc web3.

I am using solidity and if you need the code i can edit my question.


texts:
Is there any way to communicate with ethereum through php ? what i want is to get Smart contract details from contract address like Contract token name, decimal, abi, balance, tokens supply symbols etc. till now what i know is web3.js is a official library to interact with ethereum but there is no implementation in php. I have limitation i cant use js, only option that i have is php.
Let me know if there is any web3.js implementation or any other way to interact with smart contract through php.


texts: Why does not show my token balances and the other information it on Ropsten?

texts:
I published an custom ERC20 token contract in Ropsten network and functions are working of the contract correctly. I minted the 100 token to an address an checked total supply result is 100 too. And then I checked balance of the token receiver address, it's 100.

but both token total supply, holders, balances and receiver token balance are zero on Ropsten explorer?

what is my mistake? why don't they show on Ropsten?

thank you.


texts: Calling a contract's function with input parameters and passing ether from Geth/Web3

texts:
I have deployed a smart contract which basically splits the incoming funds to the specified addresses based on the entered ratio parameter.

Please find the code below:

pragma solidity ^0.4.23;

contract splitfund {

address admin;

constructor() public {

    admin = msg.sender;
}

function splitFunds(address[] withdrawaddress, uint[] proration) public payable {

    for(uint i = 0; i<withdrawaddress.length; i++) {
    withdrawaddress[i].transfer(proration[i] * msg.value/100);
    }
  }
}

Right now, i want to access the split funds function in the above contract by passing 1 ether from an address and splitting it in a 60:40 ratio and send it to addresses 0x2e46E9A4542B28B39C21Ed859486147969CB949F and 0x16292759f5e37144E37effe9Ef41998B1DfC5Df0 respectively. I was able to achieve this from Remix in Ropsten test network (https://ropsten.etherscan.io/tx/0xf88696620eeb60cb64df6cedff2585ce65e5b6a3b0e896813394d920d0a133c5#internal)

Can someone please let me know on how to execute the same using Geth/Web3JS/Web3J?!


texts: What is eWASM and why is it the direction for the next version of the EVM?

texts:
eWASM was first proposed in EIP 48 with performance advantages over the EVM.  Are there other advantages since the EIP was written in 2015?

The initial benchmarks are also gone and are there any current benchmarks that show how much faster eWASM is over the current EVM?


texts: web3 - Error while calling smart contract pure function via web3 using nodejs?


texts: Build Java based application which act as front end and ethereum smart contract as back end

texts:
I have developed one app in ethereum which contains smart contract, js and html (for web app).

I have developed it using truffle, ganache and solidity. I am accessing it in html and call the functions of smart contract using web3 library inside my js code.

Now, I want to use this in Java, so if in java if I write my html code inside jsp, so what will be the flow for calling smart contract and back end js (which is calling smart contract functions).

Should I need any API or I need to make any restful service ? What can be the flow for using it in Java ?


texts: Will Eth 2.0 be implemented in geth (go-ethereum) or will it run on a new client?

texts:
Geth is the official implementation of Ethereum based on the coding language Go. Currently, there are 8 teams that are building Eth 2.0 https://www.coindesk.com/next-gen-buidlers-the-8-teams-working-on-ethereum-2-0

When Eth 2.0 official releases, will Geth become deprecated and will users be forced to use new clients or will it also be implemented into current clients such as Geth?


texts: Web3 js React Native - Issue in creating account and calling contract

texts:
My requirement is to create an eth account and do transaction.

In Web 0.20.0 I am able to create web3.personal.newAccount and able to get create contract object. When I am using that created contract object to call methods I am getting HTTP synchronous not supported. I am using a test private network.

In Web 1.0.0 I am not able to create account but I can get a contract and call its methods.

Can you help me how I can achieve both.

My code snippet

 var data=web3.eth.accounts.create(web3.utils.randomHex(32));
 alert("Response"+JSON.stringify(res));

or

  web3.eth.accounts.create(web3.utils.randomHex(32),function(err,res){
     if(err){
       alert("creating account error "+err);
     }else{
       alert("creating account success "+JSON.stringify(res));
     }
  })


texts: What happens to ICO tokens released to a wallet that does not support ERC20 tokens

texts: If during a crowdsale you provide a wallet address that does not support ERC20 tokens will the Team send your tokens to a generated Ethereum address to be retrieved later with a private key and if so how?


texts: Verify simple smart contract on etherscan

texts:
I'm having trouble with verification of smart contracts and some ERC20 tokens. The only tokens I was able to verify were the ones derived from ERC20Detailed. Here's a simple contract that I found on the web that also fails. I have all the settings and parameters right including compiler version, byte code, etc.

I'm using Ropsten. Before answering, please try to deploy and verify this yourself. Thanks!

pragma solidity 0.5.1;

contract SimpleStorage {
    uint storeddata;
    function set(uint x) public {
        storeddata = x;
    }
    function get() public view returns(uint) {
        return storeddata;
    }
}


texts:
I'm writing a web-based DApp with web3, and am trying to get my JavaScript to deploy a contract.

I've set up the abi, contract, and bytecode as follows:

const trade_abi = [ ... not shown: ABI copied from Remix ...
const trade_contract = web3.eth.contract(trade_abi);
const trade_bytecode = ... not shown: Bytecode copied from Remix

I am trying to deploy the contract ValuED_trade, which is in Solidity 0.5.1 and has the following consrtuctor:

    constructor(address parent_, uint24 ID_, int16 max, int16 price_, string memory content, string memory time) public{

        proposer = msg.sender;
        parent = ValuED(parent_);
        ID = ID_;
        max_seeking = max;
        price = price_;
        proposal_content = content;
        creation_time_ = time;
    }

I then try to create an instance of the contract as follows:

trade_contract.new(
  contract_address,
  id_,
  max,
  amt_offered,
  reason,
  (new Date(Date.now())).toString(),
  {
    from: user.account,
    gas:840000000,
    data:trade_bytecode
  },
  function(error, result){
    if(error) {
      alert("Error: Was not able to create a contract for this trade :(")
      console.log(error)
    }
    else {
      do_stuff(result)
    }
})

This resulted in the following error:

MetaMask - RPC Error: Internal JSON-RPC error.
{code: -32603, message: "Internal JSON-RPC error.", data: {…}, stack: "Error: Error: [ethjs-rpc] rpc error with payload {…method":"eth_sendRawTransaction"} [object Object]"}

I'm running this on a private blockchain with geth 1.9.3-stable.

Can anyone help me get this working?


texts: How does Etherscan compute mining times?

texts:
Etherscan identifies the miner that mined a block and the corresponding mining time. How does Etherscan compute the mining time?

It seems that the mining time of a block is not the difference between the block timestamp and the parent block timestamp. For example, Etherscan says that block 8988702 was mined in 1 second but its timestamp is 39 seconds greater than the timestamp of block 8988701.


texts:
I am trying to write a contract for renting cars .
I have implemented the following
addCar -> to add a new car to the lot
rentCar -> trasfers te ownership of the car to the rentee,and creates a rent object .

I want to use erc 721 tokens ,to represest each car .
How do I implement this ? For example should my mint function call the addCar function ? And I call the mint function from the UI ?


texts: Problem with loading my front end local host due to metamask

texts: I have been trying this Dapp university tutorial online and after following it meticulously I've come across this problem. I suspect it's metamask as the video said if I get this loading message I need to "trouble shoot" metamask. I have linked my ganache account to metamask using a private key and it has linked perfectly. I have no idea why my client side wont load.


texts: Mist wallet showing no balance but nanopool showing ether in address

texts: How do I eventually get the ether I have just successfully been mining or paid for by nanopool into a wallet that I can sell for USD? I wish to know why my mist wallet still contains a balance of 0.00 but my nanopool has 0.04, I am not looking to sell now of course but just wanted to know for the future so I don't lose or get stuck with ETH I cannot move. Also how does a platform like Coinbase come into play here?


texts: Doesn't ethereum blockchain get too big to be decentralized?

texts: I don't understand how a blockchain that includes code + data can be decentralized, ie duplicated amongst all nodes. Doesn't this one store (The Ethereum Blockchain) can potentially take petabytes of data if it's used by the entire world?


texts: Can a contract listen to events of another contract?

texts: I read that to listen to events you need to use web3.js. Are there other ways of doing it? Can a contract even somehow listen to events of another contract? Thanks!


texts:
recently I want to write some website login program using ERC tokens ,can anyone show me the way to do that ?
an idea or a route are both good for me


texts: Object to Hex function (like in sign transaction)

texts:
I am reading the Web3 documentation about signing transactions (see example below). As I understand it, the "transaction object" gets turned into a hex string and enveloped, this is the "message". The message is keccak256 hashed, and this hash is signed, i.e. used to make the signature. Now the message and signature are put together and RLP encoded, this is the raw transaction which is submitted to the network. Also this raw transaction is keccak256 hashed, the "transaction hash" which is used like the ID of the transaction.

Questions:

Is there a stand alone function for converting a javascript object (like this transaction object) into a hex string, either in web3 or somewhere else?

How is the enveloped hex string combined (concatenated?) to the signature and RLP encoded? Is there a web3 RLP encode / decode function?

> web3.eth.accounts.signTransaction({to: '0xF0109fC8DF283027b6285cc889F5aA624EaC1F55',value: '1000000000',gas: 2000000},'0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318').then(console.log)
> { messageHash:
   '9809fdb7aeb339f416acc6c79ce422e05b4980a18f622492cd0097162276b5b0',
  v: '0x29',
  r:
   '0x3be21ae87e7733af7226d12c9aa4579d80fbe3cdd577844ddabc7b7b806016db',
  s:
   '0x17d1a6749c746e74903e0a0f07718fcd5cabb5ddabf998580ca03c1785518f66',
  rawTransaction:
   '0xf86a820431843b9aca00831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca008029a03be21ae87e7733af7226d12c9aa4579d80fbe3cdd577844ddabc7b7b806016dba017d1a6749c746e74903e0a0f07718fcd5cabb5ddabf998580ca03c1785518f66',
  transactionHash:
   '0x3011a0d0b2b223e69994c55487b553d3a2b9cdb073d6301505568469b04d8afc' }


texts: How to get a list of all token holders using ethers.js + metamask

texts:
Is there any way, using ethers.js and metamask, to build an array of all current token holders? I would need this to my project which I'm currently working at.
I know I can download the entire blockchain but are there simplier ways to do it?


texts: If you call a constant function from a smart contract, that is, a function that just returns data without changing the state, is the return value trustless? I'm assuming not, because whatever node is giving you the return value could make anything up for the return value, as the return values don't have to be verified by all the other nodes since the transaction is never recorded in the blockchain. So I'm assuming the only way to get instant trustless data from the blockchain without running your own node is through merkle trees or something, but I don't believe Ethereum has support for light clients of that caliber yet.


texts: Can I send/transfer data from Smart Contract to an EOA?

texts: I am quite new to the world of Ethereum and I'd like to know if it was possible to send or transfer data (not only ether) to a given EOA address. Thanks in advance. Best


texts: how to get token symbol and amount from transaction receipts using web3

texts:
I am looking for a way to retrieve following information of a transactionreceipt fetched with web3js.

symbol
amount of tokens.

Some transactionhashes show multiple token transfers of the same txhash, so I also need to look out for that and get these.
I just can't find out a proper way of doing so. I need these information in readable format like symbol LINK amount 100
Regards


texts:
I am currently starting a project, mainly a Dapp on the ethereum blockchain. and i had a problem understanding how will i manage images and volumenous data  off the blockchain, while keeping the same security level given by ethereum.

If there is Any kinda of document or ressource i need to see, please tell.

Thanks


texts:
I read in the manual that programmers can use common languages to program Dapps.

Questions:

So I could program a Dapp without Solidity just with JS, node.js, HTML, CSS, and HTML. Or do I still need Solidity?
How will users run the app? Don't they require node.js then?


texts: Can a contract be the owner of another contract and kill it?

texts: How can contract B (created and owned by contract A) verify that contract A invoked the kill method? (Is msg.sender the same for contract A and B or is msg.sender the address of contract A when A calls B)


texts: getPastEvents cannot handle multiple requests?

texts:
When I send about 100-120 requests in async, it is fine, the event will give me a response. But above 150 or so, I get "Invalid JSON RPC response: ""

Web3JS 1.2.1

Geth Info:
Version: 1.8.12-stable
Git Commit: bb0261036b768b26e7f63ebecdb5ae32c76f99bb
Quorum Version: 2.2.1


texts: Can I trust Solidity compiler to replace MOD with AND when possible

texts:
According to the EVM Gas Cost Yellow Paper (can be found here):

The cost of % is 5
The cost of & is 3

When x is a power of 2, the expression a % x is equivalent to a & (x - 1).

If x is a constant variable, then this replacement can take place during compilation.

Can I trust the Solidity compiler to do this when optimization is enabled?

I am currently using solcjs, but the same question goes for truffle, Remix IDE, etc.

Thank you!!!


texts:
eth.getPendingTransactions() does not work, but i do have pending transactions on this node, observe:

> eth.getPendingTransactions()
undefined
> eth.getTransaction(eth.getBlock("pending").transactions[0])
{
  blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
  blockNumber: null,
  from: "0x7a5576dfeb32429899732a4183ea106407899a38",
  gas: 21000,
  gasPrice: 32000000000,
  hash: "0x1d8d962faa655d5064af340ff7047714316a686e4ed0682bb469e2ae26e0da59",
  input: "0x",
  nonce: 2,
  r: "0x3400fc118f587c4e779d8d33a8d367ee1f2226506bf6403ece32fb88880dfc8a",
  s: "0x77f7a872abd1737b0b2b6f3efc3e6e77fd0f87862f82cefc8495bd605a105eb5",
  to: "0x23a0e252e5114c21d5e601fcb7f3b6e341da48fd",
  transactionIndex: 0,
  v: "0x1f6",
  value: 2500000000000000000
}
>

Why doesn't it work? This transaction is EIP155 transaction, and I do have problems sending this type of transactions, they work with one blockchain but do not want to work with another. I wonder if some EIP field is hardcoded in the blockchain's Level DB database so geth thinks this blockchain is an old version and that's why it doesn't work, but I am not sure.


texts: How to transfer ERC20 tokens using web3js

texts:
I've read some docs, run parity in docker container, and being
able to connect and get token balance of an account

const Web3 = require('web3'),
const web3 = new Web3(new Web3.providers.HttpProvider('http://127.0.0.1:8545'));
const contract = new web3.eth.Contract(JSON.parse(config.contract.abi), config.contract.address, { from: '0x...', gas: 100000 });

contract.methods.balanceOf('0x...').call()
    .then(console.log)
    .catch(console.error);

What I don't understand is how to initiate transfer of the tokens?

According to docs it should be something like this:

contract.methods.transfer('0x...', web3.utils.toWei(0.001)).send()
    .then(console.log)
    .catch(console.error);

I've tried with callbacks, promises, tried listening to events, but in any case my script is getting stuck and doesn't exit or produce any output

I'm expecting an error: unauthorized in this case and then I'd figure out how to pass my private key or unlock an account (not really sure). Couldn't find anywhere complete example.

Everything I found on stackexchange looks similar to

contract.transfer.sendTransaction('0x...', amount, { from: ..., gas: 100000 })

and doesn't work for me at all, complains about undefined methods: transfer and then sendTransaction if I use contract.methods.transfer

So what's the proper way of doing that?


texts: In Layer 2 Solution of Ethereum (State Channels), what I don't get is what about nonces? If we signed a state channel Tx with 13 nonce and don't put it on the chain for now, then if I make another Tx with nonces 14 (not related to state channel) on the network with a higher nonce, doesn't that transaction stay pending until and unless the state channel Tx with nonce 13 gets chained?


texts: What is the purpose of underscores in front of parameters?

texts:
I see contracts that use underscores in front of parameter names, like so:

function Greeter(string _greeting) public
{
   greeting = _greeting;
}

What's the purpose of these underscores? Do they have a similar meaning as 'internal use' names in Python?


texts: smart contract is too smart: different bahaviors of smart contract on different version of geth or solidity

texts:
recently I am learning how to deploy and call smart contract on ethereum. I am working on a very simple contract as follows:

pragma solidity >=0.4.24 <0.6.0;
contract TestContract{

   uint public a;

   constructor() public
   {
       a = 2;
   }

   function addNumber(uint b) public
   {
       a = a + b;
   }

   function read() public view returns (uint)
   {
       return a;
   }
}

I firstly tried to deploy the contract on my private chain, with the geth compilied from current master default go-ethereum source code. Though the contract can be successfully deployed, calling function addNumber through web3 throws the following errors gas required exceeds allowance (1726103387) or always failing transaction。I have no idea why it is the case, because my private chain is on mining, and my account has enough ether given so small contract code.

Then I deployed the contract on an old version of go-ethereum, both deployment and calling function addNumber seemed fine in the first place, the web3 calling didn't return any error, but then I found function addNumber actually did't increase (b = 1 in my test case), a reamined to 0 despite many times of calling. I also checked the corresponding transactions in geth and learn they were already exits in a mined block.

Then I changed to compile the contract code using solidity ^0.4.0 (also remove constructor and keyword view as solidity ^0.4.0 does not support them), and deployed on chain. In this case, the contract works fine for both version of go-ethereum. namely, a is increased whenever calling function addNumber with b = 1

So my question is:

why calling addNumber in a recent version of go-ethereum throws error: gas required exceeds allowance (1726103387) or always failing transaction.
why the same contract behaves totally different in different version of go-ethereum and solidity.
In my opinion, the smart contract is 'too smart'. Is there any idea to choose between different version of go-ethereum and solidity?


texts: This declaration shadows an existing declaration

texts:
When i try to run migration from truffle, i got this problem, here my contract code:

pragma solidity ^0.5.0;

  contract DappToken {

    uint256 public totalSupply;

    function DappToken () public {
        totalSupply = 1000000;
    }
   }

And I got this message on cmd window, seem there are many more issue, so if you guy could help me out, i really appreaciated.

PS: for more infomation, I follow the instruction video "Code Your Own Cryptocurrency on Ethereum (Full)" from Dapp University chanel on youtube , at 37:40


texts: geth: can not resend transaction - transaction not found

texts:
I'm trying to resend a transaction unrecognized by network with increased gas price:

tx = eth.pendingTransactions[0]
eth.resend(tx, web3.toWei(0.5, "szabo"))

What I'm getting is:

Transaction 0x1c6f5e5ffd2109167fa2bad731224d5e5b3cec8a654debffaa665bdc12969020 not found
at web3.js:3119:20
at web3.js:6023:15
at web3.js:4995:36
at <anonymous>:1:1

What's wrong?


texts: How to Serialize/Deserialize array of bytes?

texts:
I'm writing a smart contract and inevitably need to have arrays of bytes as input and output of functions. In remix arrays work just fine but with web3j and web3js there are several issues with arrays which make it impossible to have array as inputs and outputs.

So I think I need some sort of JSON.stringify() and JSON.parse() implementation in solidity to convert array of bytes to string and vice versa to get strings in input, work with arrays inside EVM and return strings in output.

Is there any clean and cost-effective implementation of such functions?
Thanks.


texts: Decentralized applications which not every full node has to execute

texts:
Are there any approaches to or any research on having decentralized applications in such a way that not every full node has to execute them?

I'm not asking specifically about the Ethereum Project but more generally whether there is anything in this regard.

Are there any other approaches which take away the gossip behavior from decentralized applications, enabling them to scale?


texts: My Transaction is pending for over 12h now

texts:
My transaction https://etherscan.io/tx/0x4de45e4e0bd5d3f37d6c2a8f9b065014bb278f73ac8df466e96603f517366f33 is pending now for over 12h. Is there anything wrong with it? Is there a risk to lose the Coin?

Thanks,
Lars


texts: String Input of three numbers (comma seperated) doesn't work in Remix

texts:
So when I try to put in three numbers as a String in a usual setter-method, it doesn't work.
Does anybody know why?

function test(string memory x) public view returns(string memory){
    return x;

}

When I try: "1,2,3" I get an JSON Error, but when I try: "a,b,c" it does work perfect.


texts: web3js metamask function undefined after updating

texts:
I added a new function exampleFunc in solidity the mycontract.json file gets updated with that function with public visibility but web3.eth.contract(abiArray).at(address); does not contains the newly added function.

var con = require('../../build/contracts/MyContract.json');
var keys = Object.keys(con.networks);
var address = con.networks[keys[keys.length-1]].address;
var abiArray = con.abi;

componentDidMount(){
        const web3 = new Web3(window.web3.currentProvider);
        this.instance = web3.eth.contract(abiArray).at(address);
        console.log(this.instance);
}


texts: Rolled back headers dropping the peer right after. geth 1.6.0

texts:
As you can see in this picture I get the same problem over and over again. Headers aren't downloading, they always roll back to header # 1379306.

Does any body know what would be the problem here?


texts: Visa debit/prepaid card for ERC20 tokens

texts:
Many companies are offering Visa crypto cards to their users so they can spend the cryptocurrencies/tokens like fiat. Some of the companies which support ERC20 token cards are.

https://tokencard.io/
https://mona.co/cards

Does anyone have any experience getting Visa card for their own ERC20 token? What's the process?


texts: Why did I get an error about using memory keyword in function getname?

texts:
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;

contract s12 {
    uint public age;
    string public name;
    bool rollno;

    constructor() public {
        rollno= false;
    }

    function setname(string memory newName) public {
      name=newName;
    }

    function  getname() public view returns (string){
      return name;
    }

    function setAge(string  memory newAge) public {
      age=newAge;
    }

    function getAge() public view returns(uint){
      return age;
    }
 }


texts: What's the difference between web3.eth.personal and web3.eth.accounts?

texts:
I noticed that web3.eth.personal has unlockAccount method but not web3.eth.accounts. Why not?

Is web3.eth.personal for personal or single account use while web3.eth.accounts for multiple accounts?


texts:
I am using web3 version 1.3.3 and tried to call the contract method using send() but it is showing an error above( Error: Returned error: insufficient funds for gas * price + value at Object.ErrorResponse )
const ERC20ListInst = await this.contract;
const res = await ERC20ListInst.methods.tokenToWei(addr, this.web3.utils.toHex(amount)).send({
   from: this.web3.eth.defaultAccount,
   gas: 100000
});

I have enough eth on the account and can't sure why this is happening. Is there anyone has faced this one before?


texts: Can I make 'wait n seconds' statement in solidity function?

texts:
I want to write a solidity function like

 function func(uint n, parameters*) payable public {

 ""wait n seconds""

 other statements
 }

Is it possible? It seems that delay parameter in oraclize_query gives the partial answer, but it limits to no bigger than 60 days. Is there any solution for this task for arbitrary n?

Thanks in advance.


texts: Unable to make a transaction with Data using Java api ethSendRawTransaction

texts:
I am trying to make a transaction between two different accounts using Java. It works perfectly fine as long as I am not using "Data" parameter.

My intent is not to call a smart contract but to make a value exchange between two parties where I will store small ascii (hex converted) data as a note in every transaction.

If I do not use "Data" parameter api like

  RawTransaction.createEtherTransaction

then it works fine and successfully returns me the transaction hash.

But I would use API like

  RawTransaction.createTransaction

Then I face a JSON error like

  java.util.concurrent.ExecutionException:
  com.fasterxml.jackson.databind.JsonMappingException: Can not
  deserialize instance of java.lang.String out of START_OBJECT token
       at [Source: buffer(okhttp3.internal.http1.Http1Codec$ChunkedSource@7905a0b8).inputStream();
  line: 1, column: 81] (through reference chain:
  org.web3j.protocol.core.methods.response.EthSendTransaction["error"]->org.web3j.protocol.core.Response$Error["data"])

Either I am calling in a wrong way or API has any issue , I would like someone to help to understand how I can make a value exchange transaction without this above problem.

Here is my code

//create raw transaction

            //import the address from Ganache's account by using its private key
            String strPrivateKey = "0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3";
            Credentials senderCredentials = Credentials.create(ECKeyPair.create(hexStringToByteArray(strPrivateKey)));
            System.out.println(senderCredentials.getAddress());

            BigInteger amountWei = Convert.toWei("1.789", Convert.Unit.ETHER).toBigInteger();

//Data I am trying to send with transaction to be recorded in DATA part of ethereum transaction
            String Data = Numeric.toHexString("Hey this is me".getBytes());

            EthGetTransactionCount ethGetTransactionCount = web3a.ethGetTransactionCount(
                    senderCredentials.getAddress(), DefaultBlockParameterName.LATEST).sendAsync().get();

            BigInteger nonce = ethGetTransactionCount.getTransactionCount();

            //When I create transaction using below API then it crash at the time of send ethSendRawTransaction
            RawTransaction rawTransaction = RawTransaction.createTransaction(
                    nonce,Transfer.GAS_PRICE,Transfer.GAS_LIMIT, RecieverAddress,amountWei,Data);

            // When I create transaction using this API then it sucessfully work at the time of send call ethSendRawTransaction
           /* RawTransaction rawTransaction = RawTransaction.createEtherTransaction(
                   nonce, Transfer.GAS_PRICE, Transfer.GAS_LIMIT, RecieverAddress, amountWei);*/

            byte[] signedMessage = TransactionEncoder.signMessage(rawTransaction, senderCredentials);
            String hexValue = Numeric.toHexString(signedMessage);

//this is the place where I get error
                EthSendTransaction ethSendTransaction =  web3a.ethSendRawTransaction(hexValue).sendAsync().get();

            String transactionHash = ethSendTransaction.getTransactionHash();

            System.out.println(transactionHash);


texts:
The question is simple though I can't find a solution to this - how do I keep all ethereum-related files on an external hard disk drive?

I would like to have the blockchain data, keystore and Mist launch files to be on an external HDD that can be easily moved/connected to another PC etc.


texts: How to use web3 to send money from wallet A to wallet B?

texts:
var myContract = web3.eth.contract(abi);
var address = contract address;
var contract_data = myContract.at(address);
var sender = '0xd3aaa525c087978133abb517593ea334f16abd1f';
var receiver = '0xff2b56315dc5372b45dfa3773c4cfd64f70c8e9c';
//transfer is the function in the contract to transfer money from wallet A to B
var getData = contract_data.transfer.getData(receiver,amount);
web3.eth.sendTransaction({to:receiver, from:sender, data: getData});

Source: How to call my contract's function using sendTransaction

When I am tracking the balance, it turns out that only gas price is being
deducted from wallet A and nothing else ? But when I use metamask UI to do the
transactions, balances are updated successfully. I believe, there is some
flaw with the way I am using this api, it'd be really great if anyone could
share their experience.


texts: Best way to run tests in Truffle for contracts that rely on mainnet dependencies?

texts: I could create mocks of the dependencies but I'd really like to be able to fork mainnet using Ganache in a way similar to this (https://medium.com/@samajammin/how-to-interact-with-ethereums-mainnet-in-a-development-environment-with-ganache-3d8649df0876) ...but within the truffle test environment


texts: How to setup 'topics' for function getPastLogs ()?

texts:
Sir,
   I want to read the past event log by using getPastLogs()，but I got the whole log.I hope I can filter some log.
   I find I can setup the 'topics' in getPastLogs(),but it always fails. How should I setup the 'topics' in getPastLogs()?

Below is my contract:

pragma solidity ^0.4.25;
contract ReadLogPOC
{
    uint gi_sum;
    event adduintevent(uint indexed p_data,uint p_sum);

    function adduint(uint p_1) external returns(uint){
        gi_sum = 10 + p_1;
        emit adduintevent(p_1,gi_sum);
        return gi_sum;
    }
    function getsum() external returns(uint){
        return gi_sum;
    }
}

I use Node.js，this code show all past event log. My code is：

var abi = [{"constant":false,"inputs":[{"name":"p_1","type":"uint256"}],"name":"adduint","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"getsum","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"p_data","type":"uint256"},{"indexed":false,"name":"p_sum","type":"uint256"}],"name":"adduintevent","type":"event"}];
var address = "0x61fab6aa9f16369e8e051688ceca7e01a61b9780";
var readlogpocContract = new web3.eth.Contract(abi,'0x61fab6aa9f16369e8e051688ceca7e01a61b9780');

web3.eth.getPastLogs(
  {
    address: '0x61fab6aa9f16369e8e051688ceca7e01a61b9780',
    fromBlock: "0x1",
    toBlock: "latest"
      }
).then(console.log).catch(e => console.log(e));

If I run "readlogpoc.adduint.sendTransaction(8,{from: "0x3d626b8fae039078fe5c33964e035c5a9d47b2e9", gas:900000}" in geth,and then I set topics like this：

web3.eth.getPastLogs(
  {
    address: '0x61fab6aa9f16369e8e051688ceca7e01a61b9780',
    fromBlock: "0x1",
    toBlock: "latest",
    topics:[web3.utils.sha3("adduintevent(uint,uint)"),web3.utils.sha3("0x8")]
      }
).then(console.log).catch(e => console.log(e));

the output is []

How should setup the topics?
My environment：
Web3 version is ^1.0.0-beta.36 Node version is v10.5.0 geth version is Version: 1.8.11-stable Platform ：Ubuntu 16.04.4 LTS

Thanks~~


texts: Question regarding approval of the token

texts:
I am trying to make a smart contract where calling a function named transferERC20, you can deposit your erc20 tokens into the smart contract.

Here is the code at the moment:

pragma solidity ^0.5.0;

import "./ERC20.sol";

contract GameTokenERC20 is ERC20{

  function transferERC20(uint _value) public{
    approve(address(this), _value);
   // transfer(address(this), _value);
   emit Approval(msg.sender, address(this), _value);
   transferFrom(msg.sender,address(this), _value);
  }

}

Basically calling the function you should be able to deposit any erc20 token to my contract address.

I have tried to deploy it in remix but metamask doesn't let me set the token that I want to send, it just creates the transaction.

My questions are :

1) If it doesn't work in the remix IDE, should I try it from web3 ?
2) How does the user say which token he wants to send ? I'll have to put a contract address for each token ?

I think I am missing something as the user will just have to deposit the erc20 token inside the contract.

Thanks to all


texts: Interacting with the smart contract from Java application (We3j)

texts:
I have many questions about the workflow ( sequence ) of interacting with the smart contract from Java application, so I will first explain what I have done and then put my questions, and if something wrong in my understanding please let me know.

1- I have written smart contract
2- Use truffle to get the smart contract java wrapper.(contract.java)
3- Use testrpc to test the contract

I have 2 class uses testrpc accounts (credentials) to interact with the smart contract and call its functions

Each class (node1.java, node2.java) call a function in the smart contract called (send) to  send their data to the chain.

I have added an event which trigger if the 2 nodes have sent there data

What I don't understand is, how I can let the java code ( Let say MainProgram.class) always check for that event. Because I need to check if both nodes send their data, then I will call another function to analyse this data.

How I can manage, control and check what transactions have been done or not, I mean how I can use the events in java code and let the code run forever and check if the this event happen, do action.

Hope I can explain what I need clearly

Thank you in advance.


texts: Connecting to a data directory in a different machine

texts: I have set up a ethereum private network and the data directory configured in the same machine. Is there anyway to create the data directory in a separate machine and connect the geth to that. The scenario - geth will be running in machine 1 and the data directory will be in a different machine 2.


texts: How to modify the Block Information in geth levelDB?

texts: I want to change some information such as stateRoot or some other information for testing purposes in levelDB. Is that possible? If so, how?


texts: Geth getPendingTransactions and subcribe pendingTransactions return nothing

texts:
I have installed geth on my server and I think it's fully synced but I can't get any pending transactions using either web3.eth.subscribe('pendingTransactions') or web3.eth.getPendingTransactions() // it's return empty array []
I've tried calling web3.eth.isSyncing() method and it return
{
  currentBlock: 11339249,
  highestBlock: 11339249,
  knownStates: 635215876,
  pulledStates: 635215876,
  startingBlock: 11338769
}

So my node is fully synced right ?
I've also tried txpool.status on geth console, it return 0 on both object
{
  pending: 0,
  queued: 0
}

This is my geth configuration on config.toml
[Eth]
NetworkId = 1
SyncMode = "fast"
DiscoveryURLs = ["enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.mainnet.ethdisco.net"]
NoPruning = false
NoPrefetch = false
LightPeers = 100
UltraLightFraction = 75
DatabaseCache = 512
DatabaseFreezer = ""
TrieCleanCache = 256
TrieCleanCacheJournal = "triecache"
TrieCleanCacheRejournal = 3600000000000
TrieDirtyCache = 256
TrieTimeout = 3600000000000
SnapshotCache = 0
EnablePreimageRecording = false
EWASMInterpreter = ""
EVMInterpreter = ""
RPCGasCap = 25000000
RPCTxFeeCap = 1e+00

[Eth.TxPool]
Locals = []
NoLocals = false
Journal = "transactions.rlp"
Rejournal = 3600000000000
PriceLimit = 1
PriceBump = 10
AccountSlots = 16
GlobalSlots = 75000
AccountQueue = 64
GlobalQueue = 1024
Lifetime = 10800000000000

[Node]
DataDir = "/home/ubuntu/.ethereum"
IPCPath = "geth.ipc"
HTTPHost = "0.0.0.0"
HTTPPort = 8545
HTTPVirtualHosts = ["*"]
HTTPModules = ["net", "web3", "eth", "txpool", "rpc"]
HTTPCors = ["*"]
WSHost = "0.0.0.0"
WSPort = 8546
WSOrigins=["*"]
WSModules = ["net", "web3", "eth", "txpool", "rpc"]
GraphQLVirtualHosts = ["*"]

also currently my .ethereum folder usage is 293.3 GB
Geth Version: 1.9.24-stable


texts:
I sent a test transaction unfortunately the gas was too low, I have tried overwriting this, But when I send It states (Error 13) Invalid Signed transaction??
If I knew what this meant maybe I could do something?

Also if low gas what inevitably happens?
1/ Run out of gas then im ok to send txs again
2/Transaction gets timed out?


texts: How to access API's from smart contract deployed on Ropston network from local Machine?

texts:
I want to access API's from a smart contract deployed on Ropsten network. This smart contract is written and deployed by some external entity and they have exposed API's.
I know the smart contract address, solidity file (as source code is open),API's to call. I want to know by which way i can connect Ropsten network from my local machine and call required API's.

Their documentations are not clear, so even after trying multiple options i could not able to make it.

Please let me know if is there any way to do this. Let me know if require any further information


texts: How can I connect to Kovan using Ethereumj


texts:
I am new in ethereum, I just run simple node.js program and using web3 api, and I send some ether from my account to another in my private ethereum network, after mining my transactions mined. I still have some pending transactions, my problem is that when I want to get the number of pending transactions by following code it has the error:

  Cannot read property 'length' of undefined

, howeverو I can query the pending transactions numbers via geth javascript console by this query: eth.pendingTransactions.length

console.log(web3.eth.pendingTransactions.length);

Also, I used getPendingTransactions function with call back but still it has the same error.

I checked for some other functions and variables it works fine I do not know what is the problem with array of pendingTransaction and function getPendingTransactions.

Here is my simple code:

var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider('http://127.0.0.1:8000'));
console.log(web3.version.api);
var hashstring = web3.eth.sendTransaction({from: "X", to: "Y", value: web3.toWei(10, 'ether'),gas:30000});
console.log(hashstring);
console.log(web3.eth.pendingTransactions.length);


texts: How does block beneficiary work? What's the point?

texts:
From Gavin Wood's yellow paper:

  In general, Ether used to purchase gas that is not refunded is
  delivered to the beneficiary address, the address of an account
  typically under the control of the miner.

This looks like a way to tip the miner. I'm trying to understand how it works.

Inside a transaction, there are:

value field is the amount of ether to transfer to the recipient. So
the tip paid to the beneficiary shouldn't be included here.
gasLimit field is the max gas to pay the gas costs of the contract
steps. Any unused gas will be re-funded. Is there a mechanism for the
sender to say to miner: "Hey why don't you keep the change? "

I looked at other fields but they all seem to be unrelated. So how does this work?

Also, since sender can set gasPrice higher which can be a way to tip the miner, so what's the point of including another way of tipping?

Thanks!


texts:
Given is:

pragma solidity ^0.4.24;

contract changeSomVal{
    address owner;
    bool test;
    event showBool(bool showBool);

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

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

    function () public payable{
        emit showBool(test);
    }

    function changeBoolTrue () public onlyOwner { // returns (bool)
            test = true;
            emit showBool(test);
    }

    function changeBoolFalse () public onlyOwner {
            test = false;
            emit showBool(test);
    }
}

On etherscan it always returns a 64 chars length 0...0 eventLog. It doesn´t matter wich function was called. I also tried it with uint8 (1,2) for changeBoolTrue() -> test = 1 and changeBoolFalse() -> test = 2. I tired it with a return too: function changeBoolTrue () public onlyOwner returns (bool). The eventLog throws always the same.

On remix it looks fine. But in the reality it doesn´t work. What´s wrong?


texts:
I currently have my app set up with testrpc + truffle-contract and I'm trying to set the current provider to Rinkeby (or whatever testnet I'm on in MetaMask). However, when I run the following code it spits an error. I'm calling initWeb3 in my componentWillMount

initWeb3() {
    if (typeof web3 !== 'undefined') {
        window.web3 = new Web3(web3.currentProvider);

        TicketSaleContract.setProvider(web3.currentProvider);

    } else {
        console.log('No web3? You should consider trying MetaMask!')

        window.web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
        TicketSaleContract.defaults({
            from: '0x...',
            gas: 4712388,
            gasPrice: 100000000000
        })
    }
}


texts: Android Ethereum wallet for a private blockchain?

texts:
Is there any android wallet that can be customized to operate on a private Ethereum blockchain?

I need to send/receive transactions and run simple queries on the blockchain data.

I'm not looking for an app which functions through RPC. I want an app which actually runs Ethereum node on an android smart phone.


texts:
I am trying to implement a simple smart contract on Remix IDE (using Genache as my local blockchain)

Here is the code:

pragma solidity ^0.4.24;

contract Aa {

    uint public myuint;

    function set(uint _var) public {
            require(_var == 5 || 99, "Not 5 or 99!");
        myuint = _var;
    }

    function get() public view returns (uint){
        return myuint;
    }
}

I am getting an error: "TypeError: Operator || not compatible with types bool and int_const 99
            require(_var == 5 || 99, "Not 5 or 99!");"


texts: How to use web3js to call a function with "payable" and transfer some ether to contract?

texts:
My code is like this :

gameInstance.initGame.sendTransaction({from: webInstance.eth.coinbase, to: contractAddress, value: webInstance.toWei(person_num, "ether")});

Of course, it doesn't work very well.
Codes in the function has been executed, but ether haven't been transferred.
And value of the variable "person_num" is not 0.
So what can I do?


texts: Can value of a public variable in Solidity be called and returned by web3?

texts: How to get value of a public variable in Solidity be called and returned by web3?


texts:
Is Smart Contract of any ERC20 token is always available publicly.

If not complete, then what things are generally available,(for eg, except some sensitive information)

And, if not any of them are available, how one gets to know about the functions included inside the token contract, and attackers are able to attack them.


texts:
Let's assume I have multiple contracts defined, say 1 lib, 1 interface, A contract and B contract and B is A and finally, B uses both, the lib and the interface specified.

The question is, should I pack them up into one file, compile and simply deploy only B like below?

const HDWalletProvider = require('truffle-hdwallet-provider');
const Web3 = require('web3');

const {interface, bytecode} = require('./compile');
const provider = new HDWalletProvider(
    'mnemonic',
    'https://link to infura'
);

const web3 = new Web3(provider);
const deploy = async () => {
    const accounts = await web3.eth.getAccounts();
    const result = await web3.eth.Contract(JASON.parse('interface'))
        .deploy({data: bytecode})
        .send({gas: '1000000', from: accounts[0]});

    console.log(result.options.address);
};

deploy();

Thanks for help


texts: Solidity error: require: ParserError: Expected identifier but got '('

texts:
has someone knows what should be fixed on the below Solidity code?
require (_value%100 == 0);
uint fee = _value/1000; // for 1% fee
require (balanceOf[msg.sender] > _value) ;
require (balanceOf[_to] + _value > balanceOf[_to]);
balanceOf[msg.sender] -= _value;
balanceOf[_to] += (_value-fee);
balanceOf[thirdPartyAddress] += value;

I'm currently using the solidity 4.26 and this is showing the following error: ParserError: Expected identifier but got '(' require (_value%100 == 0); ^
Any comment is welcomed :)


texts: Authentication between smart contracts based their addresses - Is it safe?

texts:
thanks in advance for your time and intellectual contribution.
I am working on  a project in which we have contracts interacting which each other.
More specifically, there is a "father contract", with functions that should be executed only by the "child contracts" therefore, we need a way to authenticate (to identify in fact) the callers before allowing them to do any action. For the case, the first thing anybody would think is to keep a list of the addresses that are allowed, something like this:
  ...
  mapping(address  => bool) allowedAddrs;

  ...

  //adds a new address to the list of allowed contracts
  function addChild(address _child) public onlyOnwner{
       //here code to verify if the addr is a EOA or a contract

       //add the contract to the list
       allowedAddrs[_child] = ture;
  }

  //This is the function that requires authentication/authorazation
  function authenticatedFunc() public payable{
         require(allowedAddrs[msg.sender] ==true, "Back off cheater" );
         // more code here
  }

I wonder however if it is safe!  Can the address of a smart contract be faked ( cloned)?
What happens if some miner loads the contract at one of the allowed addresses, but with "some customs" and try to interact with this function of my contract? How does the blockchain guarantee that the address calling the function is not "a clone of one of the contracts that I included in the allowed list?


texts: General question about totalSupply: fixed since first moment (aka Bitcoin) or indefinite (aka Ethereum)?

texts:
In an answer to a general question about totalSupply, I gave some rough indication about the aim of token deployer vs totalSupply: Why is the totalSupply of this token statically initialized to 5500000000?

But now I was asking myself if there exists a true crypto economic rationale criteria that can be used.

Does it exist?


texts:
How would I go about monitoring pending transactions in real-time? Would I be able to monitor only one function?

I have a full node running and have a nodejs (express server) that I want to have this info available to.

I am guessing that a websocket would be the way to go, in which case what would I be listening for?


texts:
I am trying to deploy a contract through my front-end via web3 API. However nothing appear to compile and there is no contract address or ABI to interact with the deployed contract (if it is deployed) and retrieve information (i.e. the string "petros"). I also tried the source code as a one line string.
Below is my code:

  var source = "" +
    "contract demo {\n" +
    "   string public name = 'Petros';\n" +
    "   function changeName(string _newName){\n" +
    "     name = _newName;\n" +
    "   }\n" +
    "}\n";

var compiled = web3.eth.compile.solidity(source,
    function(err,res){ //necessary callback function
      console.log(JSON.stringify(res));
});


texts: go-ethereum unit-tests failing (when using `go-test`)

texts:
I cloned go-ethereum from https://github.com/ethereum/go-ethereum and its test cases from https://github.com/ethereum/tests.git
When I run go test, it fails and gives error-

  state_test.go:79: post state root mismatch: got 61b79e0d2bc370a210f5091af0509a1d83661dbda2d9e2abe46b60e884c13c70, want 80dfd03978291076e5ba586b1954191fbc909808cb7719834a57934004c96a6a

and many more errors similar to this.
I know it is state-error- http://ethereum-tests.readthedocs.io/en/latest/test_types/state_tests.html

I have been on this for a long time but can't figure it out.
What might be wrong at my end if tests are failing?


texts: What is the standard for listening to ERC20 events?

texts:
Hi I am a bit confused here. The official EIP documentation states that

event Transfer(address indexed _from, address indexed _to, uint256 _value)

is how the Transfer event should look like. If I am trying to listen to this event in web3, I will be looking for the keys that are mentioned in this interface namely _from, _to and _value.

I checked out a few of the top ERC20 contracts and they all have different key names in the event. From skipping the _ to completely changing value to amount. If I am listening to transfer events from multiple tokens, is there a way I can generalize this. Can I get value at a position by being key-name agnostic?


texts: SendTransaction in case of account non-existence

texts:
I have the following questions relating to external account

How does the ethereum network behave when ether is send to an account that does not exist?

And how do the ethereum network/protocol knows the existence of an account?


texts: Why does Ethereum have nested trie structure that a storage trie is under a account in state trie?

texts:
As I understand it,
the leaf node of the state trie has account data.
The account data has a storage root,
and the variables of the contract are stored in the leaf node of the storage root.

But what are the benefits of having such a structure?
In order to access the value of contract variables,
we need to access the branch node {height of mpt} * 2 times

Instead of implementing as above,
if remove storage root from account data in state trie
and set the key path of contract storage data to leaf node as sha256 (contract_address + variable_index),
then we need to access the branch node {height of mpt}

What are the benefits of ethereum nested trie structure?


texts: How apply modifiers for list of address in array

texts:
I want the owner of the smart contract to give/add authorization to the user of the modifier . and the only the users in the array will have access to the certain functions.

How to make modifier to check the list of the address.?

contract Owned {
    address owner;
    address[] listuser;
    function Owned() {
        owner = msg.sender;
    }

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

    function whitelistAddress (address user) onlyOwner {
        //add users address to the listuser array
    }

    modifier onlyusers() {
        //How can i assign access to users address in the array listuser
        require();
        _;
    }

    function accessbyonlyusers () onlyusers {
    }
}

I want the function accessonlyusers to be accessed my list of address in the listusers


texts: "new" Solidity keyword deploying the "Factory" contract again instead of "MyContract"

texts:
I have been trying to develop a parent contract that will deploy other contracts on request with different parameters. I came across the "new" keyword which seemed like a perfect choice.

But when I am trying to deploy the parent contract and deploy child contracts from it, the same parent is getting deployed again.

I am writing the contract on remix and using Ganache.

The code for the contract is as below:

pragma solidity ^0.5.1;

contract Factory {
    address[] public newContracts;

    function createContract (string memory name) public{
        address newContract = address(new MyContract(name));
        newContracts.push(newContract);
    }
}

contract MyContract {
    string public Name;

    constructor (string memory name) public {
        Name = name;
    }
}


texts: Unable to fetch output from a public function in solidity

texts:
I am writing a solidity public function that changes the value of state variable and then returns it.

pragma solidity >=0.4.22 <0.6.0;

contract white_label {

    uint currentId = 1;

    function uploaded() public returns(uint){
        currentId++;
        return(currentId - 1);
    }
}

This functions returns value exactly as expected when run in Javascript VM on Remix but when the contract is deployed on Ropsten Testnet, no value is returned from the function


texts: Cannot mine using 1080 Ti on ubuntu 16.04

texts:
I keep getting this error:

[OPENCL]:Allocating/mapping single buffer failed with: clEnqueueWriteBuffer(-4). GPU can't allocate the DAG in a single chunk. Bailing.
[OPENCL]:clEnqueueWriteBuffer(-38)

I am using cuda 8.0.61, nvidia driver 375.66, and when I use ethminer --list-devices I get:

[OPENCL]:
Listing OpenCL devices.
FORMAT: [deviceID] deviceName
[0] GeForce GTX 1080 Ti
    CL_DEVICE_TYPE: GPU
    CL_DEVICE_GLOBAL_MEM_SIZE: 11711807488
    CL_DEVICE_MAX_MEM_ALLOC_SIZE: 2927951872
    CL_DEVICE_MAX_WORK_GROUP_SIZE: 1024

I have tried all of these solutions ( https://github.com/ethereum/libethereum/pull/203 ) but it still doesn't work.

Any other ideas?


texts: How can I call a function in a smart contract that is inherited from another

texts:
Hi I am trying to call the function transfer , however in remix it says that I can only call the transferOwnership method, here is my solidity contract

 pragma solidity ^0.4.18;

contract Ownable {

address public owner;

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

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

function transferOwnership(address newOwner) public onlyOwner {
    owner = newOwner;
}

}

contract SimpleTokenCoin is Ownable {

string public constant name = "Vozik coin";

string public constant symbol = "VZC";

uint32 public constant decimals = 18;

uint public totalSupply = 1000000;

mapping (address => uint) balances;

mapping (address => mapping(address => uint)) allowed;

function mint(address _to, uint _value) public onlyOwner {
    assert(totalSupply + _value >= totalSupply && balances[_to] + _value >= balances[_to]);
    balances[_to] += _value;
    totalSupply += _value;
}

function balanceOf(address _owner) public constant returns (uint balance) {
    return balances[_owner];
}

function transfer(address _to, uint _value) public returns (bool success) {
    if(balances[msg.sender] >= _value && balances[_to] + _value >= balances[_to]) {
        balances[msg.sender] -= _value;
        balances[_to] += _value;
        Transfer(msg.sender, _to, _value);
        return true;
    }
    return false;
}

function transferFrom(address _from, address _to, uint _value) public returns (bool success) {
    if( allowed[_from][msg.sender] >= _value &&
        balances[_from] >= _value
        && balances[_to] + _value >= balances[_to]) {
        allowed[_from][msg.sender] -= _value;
        balances[_from] -= _value;
        balances[_to] += _value;
        Transfer(_from, _to, _value);
        return true;
    }
    return false;
}

function approve(address _spender, uint _value) public returns (bool success) {
    allowed[msg.sender][_spender] = _value;
    Approval(msg.sender, _spender, _value);
    return true;
}

function allowance(address _owner, address _spender) public constant returns (uint remaining) {
    return allowed[_owner][_spender];
}

event Transfer(address indexed _from, address indexed _to, uint _value);

event Approval(address indexed _owner, address indexed _spender, uint _value);

}

Does anybody know how I can call the  transferFunction .

Here is my js code for the console

function callContract(ABI, Address) {

   var Contract = eth.contract(ABI).at(Address);
   var getData = Contract.transfer.getData("0x5adf9a54813be6f62820e5907c7ed082898d718a", 10);    //reword

   eth.sendTransaction(
      { to: Address,
        from: eth.coinbase,
        data: getData
      }
   );
}


texts: Error while importing Libp2p package in blockchain

texts:
I have installed some js-libp2p's packages on my Ethereum Blockchain-ipfs project and I wrote some codes like below.

const TCP = require('libp2p-tcp');
const MulticastDNS = require('libp2p-mdns');
const WS = require('libp2p-websockets');
const KadDHT = require('libp2p-kad-dht')
const mplex = require('libp2p-mplex');
const secio = require('libp2p-secio');
const libp2p = require('libp2p');

But the multicast-dns ,libp2p and libp2p-kad-dht module is showing some error.

  ERROR in ./~/libp2p/src/index.js

  Module parse failed: /home/toshiba/Documents/sul/ipfs/CannesNew Full Codejan17/SportsFull CodeTESTRpc12may/SportsFull Code1april/node_modules/libp2p/src/index.js Unexpected token (120:8)

  You may need an appropriate loader to handle this file type.

  |       this._dht = new DHT(this._switch, {
  |         datastore: this.datastore,
  |         ...this._config.dht
  |       })
  |     }

  @ ./app/backend/app.js 62:15-32

  @ multi (webpack)-dev-server/client?http://localhost:8080 ./app/backend/app.js

Environment

Npm version: 6.4.1

Node version: 8.12.0

Os:Ubuntu 18.04

Anyone please help me to resolve this issue.

I already imported this js-libp2p packages in my meanstack application with normal node and npm and it works well.But when I am importing this packages in blockchain application, it is showing the above error.

My current webpack version is 2.2.1

My webpack.config.js code is shown below,

...
module: {
rules: [
{
test: /\.css$/,
use: [ 'style-loader', 'css-loader' ]
}
],
loaders: [
{ test: /\.json$/, use: 'json-loader' },
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['es2015'],
plugins: ['transform-runtime']
}
}
]
},
...


texts: What will be the format of data to execute a function from web

texts:
I have deployed a cryptocurrent on Private testNet from here. I have deployed two contracts, lets call them contract1 and contract2. Contract1 has less features than contract2 (like transferFrom() functionality was removed).
Now I am using

geth --identity "XXXX" --fast --cache=1024 --jitvm --rpc --rpcport "yyyy" --rpccorsdomain "*" --datadir "chaindata" --port "xxxx"  --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --rpcapi "db,eth,net,web3,admin,debug,miner,personal,web3" --autodag --networkid xxxx --nat "any" -ipcpath "/home/pr.singh/.ethereum/geth.ipc"  console

to connect to geth console. Now I want to execute transfer() function of contract2. I know how to do it from geth console  (using abi defination fo contract). But how to do it using web browser. What request do I need to send and HOW?
When I hit url http://localhost:yyyy/ (where yyyy is my rpcport) , I get {"jsonrpc":"2.0","error":{"code":-32600,"message":"EOF"}} as output, so I know my port is working fine.
 But in what format do I need to send data to this port. Like how will it know which method of which contract needs to be executed. Any tutorial avilable on that. TIA.


texts: Cant create initial liquidity in safemoon fork

texts:
Followed the initial steps provided at the openzeppelin community for adding initial liquidity to a pool but still, cant do step 2. here's the original answer which is not working - https://forum.openzeppelin.com/t/cant-add-liquidity-on-pancakeswap-with-burnable-erc20-token/6993/10?u=tanishbaansal
Still getting the error at step 2 of the process
step1 done successfully - https://testnet.bscscan.com/tx/0x422da9fab7f1a8d9099238e06ad57c291a2e2490fce6ba165ec9dd2fcee8d9e4
at step2 getting - ALERT: Transaction Error. Exception thrown in contract code.

Swapandliquifyenabled also set to false
Same Safemoon Fork with router address at testnet of pancakeswap at - 0xD99D1c33F9fC3444f8101754aBC46c52416550D1
Token address - https://testnet.bscscan.com/token/0x37a30bc7565ce22126b55a572e133790b80fc49a


texts: How do I add natspec for automatically generated functions?

texts:
contract MyContract {
  /// @dev Total number of coins
  public uint256 totalSupply;
}

Solc automatically creates a totaSupply() function, however the natspec comment doesn't come through. How can I do that?


texts: How much internet bandwidth does keeping a Ethereum wallet use?

texts: I have limited internet (250 GB per month) which I share with multiple people, so I have to make sure I don't use up too much. I downloaded the Ethereum wallet client, and it seems to take quite a while to sync. Will Ethereum use a considerable amount of my internet bandwidth?


texts: How to use the latest version of Truffle Contract in a web page?

texts:
I'm trying to use version 4.0.0 of truffle-contract in a browser app, so no NodeJS, no require or anything. So I followed the instructions in the doc, downloaded truffle-contract in non-minified format from https://cdn.jsdelivr.net/npm/truffle-contract@4.0.0/dist/truffle-contract.js, downloaded the latest version of ethers.js from https://cdn.jsdelivr.net/npm/ethers@4.0.20/dist/ethers.min.js, added the script tags in my HTML page:

<script src="js/web3.min.js"></script>
<script src="js/ethers.min.js"></script>
<script src="js/truffle-contract.js"></script>
<script src="js/app.js"></script>

but now when I load the page, I get the following error:

Uncaught TypeError: EthersAbi is not a constructor
at Object.74.ethers/utils/abi-coder (truffle-contract.js:14737)
at o (truffle-contract.js:1)
...

Is there any other dependency that is not documented, or does truffle-contract depend on another version of ethers.js?


texts:
i run migrate in the terminalbut it shows

Error: Truffle is currently using solc 0.5.8, but one or more of your contracts specify "pragma solidity ^0.4.27".
Please update your truffle config or pragma statement(s).

then i follow the error and update config it doesn't work
what should i do thx


texts: How to pass arguments to custom struct function on deployment?

texts:
I have defined a contract which I would like to use for storing user details i.e a field for storing the hash of his document and a field for storing the address of a block which has some other information of user.
I used the following structure for the same:

pragma solidity ^0.4.17;

contract UserDetails {
  struct User {
    string fileHash;
    address addr;
  }
  User[] userArr;

  function addUserDetail(string hash,address blockAddress) public returns (bool) {

    User memory usr;
    usr = User({fileHash:hash, addr:blockAddress});

    userArr.push(usr);

  }
}

1) Is this is the right data structure for this purpose?.

2) How to pass the arguments to the function addUserDetail while deploying the contract using web3?


texts: Avoiding out of gas errors when making Oraclize queries that have callbacks which trigger more queries

texts:
I have a contract that I want to automatically check the price of ethereum everyday. right now I have a method called startContract which calls a function setConversion which makes a query set for 1 day in the future. When the __callback method sees the query id created by the check price query it calls setConversionCb which in turn calls setConversion. The problem I've noticed while running my contract with Truffle, ethereum-bridge and testrpc is that after several queries to Oraclize I get an out of gas error in the ethereum-bridge console.

See here (contract addresses annonymized):

[2017-04-21T01:43:35.879Z] INFO sending __callback tx...
    {"contract_myid":"0xc1f9a50449102fbdbd32ef8cb9c22b623d55480e4474","contract_address":"0x17c89ee345e2521b8eb6e91e576"}
[2017-04-21T01:43:36.969Z] ERROR callback tx error, contract myid: 0xc1f9a50449102fbdbd32ef8cb9c22b8973537dbcf665c0be60623d55480e4474
    {"message":"VM Exception while processing transaction: out of gas","stack":"Error: VM Exception while processing transaction: out of gas
.
.
.

Since there is a gas limit, I feel like this approach would be unsustainable if I plan on making the query every day for upwards of a month. What is the best way of handling this? Ethereum Alarm Clock? Or is there simply a change in my existing logic I can make?


texts: Should I be shifting array elements as I remove them?

texts:
I'm storing pending operations in a data structure similar to the multisig. wallet contract, i.e.

struct PendingState {
        uint yetNeeded;
        uint ownersDone;
        uint index;
    }

and my contract pseudo-ish code:

contract c {
    mapping(bytes32 => PendingState) m_pending;
    bytes32[] m_pendingIndex;

    // initialize operation:
    var pending = m_pending[_h];
    pending.yetNeeded = bla;
    pending.ownersDone = bla;
    pending.index = m_pendingIndex.length++;
    m_pendingIndex[pending.index] = _h;

    // remove the current operation when finished
    delete m_pendingIndex[m_pending[_h].index];
    delete m_pending[_h];
}

However, if there were three (index = 0, 1, 2) pending operations when we completed -and removed- the second one, then we end up m_pendingIndex[0] and m_pendingIndex[2] populated and m_pendingIndex[1] empty. Will this increase the required gas for later operations? Should I shift the objects back until there is no empty spot? I imagine this process will have a cost itself, but it might be preferable in order to prevent DOS attacks.

Thanks for any help,


texts: I’ve seen a lot of projects be hit with re-entrancy attacks caused by flash loans, what is the main process behind these attacks?


texts:
I am running HelloWorld contract.

pragma solidity ^0.4.2;
contract HelloWorld {
    uint public balance;

    function Helloworld(){
        balance = 1000;
    }
}

After truffle compile and truffle migrate command I ran below command in truffle console:

HelloWorld.balance.call()

Error:

  TypeError: Cannot read property 'call' of undefined
      at evalmachine.:1:19
      at ContextifyScript.Script.runInContext (vm.js:35:29)
      at Object.exports.runInContext (vm.js:67:17)
      at TruffleInterpreter.interpret (/usr/lib/node_modules/truffle/lib/repl.js:99:17)
      at bound (domain.js:280:14)
      at REPLServer.runBound [as eval] (domain.js:293:12)
      at REPLServer. (repl.js:545:10)
      at emitOne (events.js:96:13)
      at REPLServer.emit (events.js:188:7)
      at REPLServer.Interface._onLine (readline.js:239:10)

truffle(default)> HelloWorld.deployed()
Contract {
  contract:
   Contract {
     _eth:
      Eth {
        _requestManager: [Object],
        getBalance: [Object],
        getStorageAt: [Object],
        getCode: [Object],
        getBlock: [Object],
        getUncle: [Object],
        getCompilers: [Object],
        getBlockTransactionCount: [Object],
        getBlockUncleCount: [Object],
        getTransaction: [Object],
        getTransactionFromBlock: [Object],
        getTransactionReceipt: [Object],
        getTransactionCount: [Object],
        call: [Object],
        estimateGas: [Object],
        sendRawTransaction: [Object],
        sendTransaction: [Object],
        sign: [Object],
        compile: [Object],
        submitWork: [Object],
        getWork: [Object],
        coinbase: [Getter],
        getCoinbase: [Object],
        mining: [Getter],
        getMining: [Object],
        hashrate: [Getter],
        getHashrate: [Object],
        syncing: [Getter],
        getSyncing: [Object],
        gasPrice: [Getter],
        getGasPrice: [Object],
        accounts: [Getter],
        getAccounts: [Object],
        blockNumber: [Getter],
        getBlockNumber: [Object],
        iban: [Object],
        sendIBANTransaction: [Function: bound transfer] },
     transactionHash: null,
     address: '0x83367f99f17e89248c32f4a323c027446246e650',
     abi: [ [Object], [Object] ],
     Helloworld:
      { [Function: bound ]
        request: [Function: bound ],
        call: [Function: bound ],
        sendTransaction: [Function: bound ],
        estimateGas: [Function: bound ],
        getData: [Function: bound ],
        '': [Circular] },
     balance:
      { [Function: bound ]
        request: [Function: bound ],
        call: [Function: bound ],
        sendTransaction: [Function: bound ],
        estimateGas: [Function: bound ],
        getData: [Function: bound ],
        '': [Circular] },
     allEvents: [Function: bound ] },
  Helloworld:
   { [Function]
     call: [Function],
     sendTransaction: [Function],
     request: [Function: bound ],
     estimateGas: [Function] },
  balance:
   { [Function]
     call: [Function],
     sendTransaction: [Function],
     request: [Function: bound ],
     estimateGas: [Function] },
  allEvents: [Function: bound ],
  address: '0x83367f99f17e89248c32f4a323c027446246e650',
  transactionHash: null }


texts: What is the advantage of the function selector?

texts:
I can't understand the advantage of function selector. Following link
What is a function selctor?

uses function selector to invoke a function of another contract but it uses the statements:

   bytes4 selector = contract1.func.selector;
   bytes memory data = abi.encodeWithSelector(selector, uint256(789), uint8(123));

This means for the function selector we must know both the function name and the arguments of the function which we want to invoke.

Now consider another linkerror-member-func-not-found-or-not-visible-after-argument-dependent-lookup-in

It also calls the function 'func' of contract1 without using the function selector. But it also uses name of the function and the argument list.

(uint32 arg1, uint32 arg2) = contract1.func(uint256(789), uint8(123));

So in both the cases with or without function selector, we must know the function name and the argumnet list. So what is the advantage of using function selector?