texts:
I'm having problems with ethminer on my system. Software works completely fine except the situation when I'm trying to run ethminer over SSH and I'm not "physically" logged in on that particular machine. On the other hand, when I log in and eventually log out - everything works great. What's wrong? I'm I missing something, or is it simply a bug?

I'm using Ubuntu 16.04.1 LTS together with AMD cards.

I would appreciate any form of help.

Thank you.


texts:
If I am testing a private blockchain and I want to reset it, and delete all contracts, etc., what needs to be deleted?

Is it enough to delete the .parity folder on every node?


texts: Crowdsale tokens count is not reducing even user gets the tokens to his account

texts:
I had created 100 million tokens and created a contract for crowdsale in test network

If user sends a 1 ether using contract address i am able to receive 1 ether and send 1000 tokens to user who send via metamask.

https://ropsten.etherscan.io/address/0x44db21d5cc6a773ec7ec68d5059e88325cc2a5a6

When user sends 1 ether i am getting 1 ether in my account and able to send 1000 tokens to user, but in my balance 1000 tokens were not reducing in my account

which function do i need to use to update crowdsale token balance in admin in metamask


texts: Set gas fee to a fixed value permanently in Metamask

texts:
At present, I can go to the advanced settings and specify the gas fee (in gwei) and gas limit manually. I'd like to make sure that this value is saved and re-used later on for the next few transactions also.
So let's say I configure it now. I want this same fee to be used for the next few hours. Is it possible to do that?
I know that Metamask estimates the gas fee in the ETH network and dynamically updates the (slow, average and fast fields). But I need a way to set it to a custom value and ensure it uses that always.


texts: Migration from Geth to Parity: Is there anything to copy/export?

texts:
So, I want to migrate to gain disk space thanks to blockchain pruning (it seems that it goes from ~11.4 GiB to ~3.3 GiB) and try the difference of sync speed.

Is this already documented somewhere? (how to jump from the different ethereum implementations)

Is there something else than the private keys that might need to be migrated? If so, how to proceed?


texts:
How can I get the balance of tokens on ethereum address using blockcypher?

For example, I have an address on cobinhood, and there are my COB tokens.
When I look at the  to my address, I see only transactions, and nothing more (https://www.etherchain.org/account/a40cb6c128f668a36c933f74d8a5fb796985e00a), but how do I use this information to display the number of my tokens?

I want to create a dashboard in which I can see how many tokens I have on different addresses.


texts: now / block.timestamp not working on testrpc?

texts:
I'm having problems with testrpc, or at least I think that's the cause.
This particular portion of code

if (now > info.deadline) {
    ended = true;
    refundEnabled = true;
    return false;
}

is never executed, it's as if now (or block.timestamp) is always smaller than deadline even when it's clearly not.
Deadline is in unix timestamp (for example 1487399645), but that code is not executed even if I put 1.

Here's the contract:

pragma solidity ^0.4.6;

contract Project {

    struct projectInfo {
        address projectOwner;
        string name;
        uint256 amountToRaise;
        uint256 deadline;
    }

    projectInfo public info;
    uint256 public amountRaised;
    bool public ended;
    bool public refundEnabled;
    mapping(address => uint256) public contributions;

    function Project(string name, uint256 amountToRaise, uint256 deadline) {
        info = projectInfo(tx.origin, name, amountToRaise, deadline);
        amountRaised = 0;
        ended = false;
        refundEnabled = false;
    }

    function getInfo() constant returns (address, string, uint256, uint256) {
        return (info.projectOwner, info.name, info.amountToRaise, info.deadline);
    }

    function fund() payable returns (bool successful) {
        if (ended) {
            return false;
        }
        contributions[tx.origin] += msg.value;
        amountRaised += msg.value;
        if (now > info.deadline) {
            ended = true;
            refundEnabled = true;
            return false;
        }
        if (amountRaised >= info.amountToRaise) {
            ended = true;
            payout();
        }
        return true;
    }

    function payout() private returns (bool successful) {
        if (ended) {
            if (!info.projectOwner.send(this.balance)) {
                throw;
            }
        }
    }

    function refund() public returns (bool successful) {
        if (refundEnabled) {
            if (contributions[msg.sender] > 0) {
                if (msg.sender.send(contributions[msg.sender])) {
                    contributions[msg.sender] = 0;
                    return true;
                } else {
                    return false;
                }
            } else {
                throw;
            }
        }
    }
}

I'm deploying the contract from another contract and I'm testing fund() with this piece of Javascript:

function fund(address) {
    project = Project.at(address);
    project.fund({from: coinbase, value: 50, gas: 150000}).then(function(value) {
        console.log(value);
    });
}

The contract works perfectly on Browser Solidity, on TestRPC everything works fine except that particular if statement.
Is this a problem of TestRPC or am I doing something wrong?
I'm using TestRPC v3.0.3.


texts: I am creating an Ether paper wallet using https://www.myetherwallet.com. I downloaded the source and I am running it offline. When I create a wallet I get an address such as 6d0715273557f1989F874623bdD1C7b174ad6F99. I can verify there is 0 ether in there using https://etherchain.org/. I want to ask, how is this wallet actually created? I created it offline so wondering how I now have this address that I can send and withdraw either from. How does it know which key to expect when withdrawing funds if I never sent the information before?


texts: What are the pros and cons of Ethereum balances vs. UTXOs?

texts:
Ethereum has a simpler model by not having UTXOs (Unspent Transaction Outputs) like Bitcoin.
What does Ethereum "give up" by not having UTXOs, and what does it gain?


texts: What is a Private Proof of Authority transaction speed?

texts: Is the max transaction speed for a PoA private network the same as the main network? About 20 transactions a second?? If it is faster, would that mean the Rinkeby network is more scalable than the main network?


texts: Using Web3JS to sign tx: default return value of chainID is networkID (which can be different); does this not create a replay issue?

texts:
EIP-155 requires that transactions be signed using the ChainID as one of the parameter.
Web3JS Sign Transaction document shows that the ChainID will be automatically fetched using web3.eth.net.getId()
Web3JS getID (which is supposed to fetch the chainID automatically) is actually returning the NetworkID and not the ChainID.
Considering this and this blog post that shows that not all EVM based chains have the same NetworkID and ChainID.  This will create an issue right?


texts: Provable URL query not executing _callback?

texts:
I have a smart contract running on Ropstein testnet. It includes an HTTP call to a third-party API which responds with a JSON. However, the _callback function doesn't seem to be invoking for some reason. Any clues?
The relevant chunk of code:
function __callback(bytes32 queryId, string memory result) public override {
        emit APIResponse(result);
        if (msg.sender != provable_cbAddress()) revert();
        // rest of the code
    }

    function executeAPICall() private {
        if (provable_getPrice("URL") > msg.sender.balance) {
           emit Failure("Provable query was NOT sent, please add some ETH to cover for the query fee");
        } else {
            emit OK("Trying to fetch API..");
            provable_query("URL", "json(http://ip).property");
        }
    }

I'm sure that the query (or, well, the blockchain-side of it) is getting executed as it logs the OK event, but there's no APIResponse event present. Does it perhaps require the API to be served over HTTPS?


texts: Can't call contract method/function from another contract but can call directly

texts:
In Embark, programming in Solidity.

I have a contract, which is called by another contract. The function it calls is below. Whenever I perform a write command I get a "VM Exception while processing transaction: out of gas."

But when I perform write commands in the original contract and not remote contract it doesn't happen even if the writes are much larger.

I think there is an issue I am unaware of. I can read from the contract with out a problem, I just can't write.

mapping(uint64 => IDCard) clientIds;

function createIDSpecific(uint64 clientIDi){
  if (!clientIds[clientIDi].initalized){
    clientIds[clientIDi].initalized = true;
    clientIds[clientIDi].owner = msg.sender;
    clientIds[clientIDi].ownershipTransfer.transfered = true;
  }
}

The function work fine when I call it directly.


texts: Private transaction failing with Non-200 status code

texts:
I have a Quorum network running on Azure Blockchain service.

Sending private messages to a particular public key is failing. It was working till last week. No code or configuration changes have been made.

The exact same code works if we use the public key of another node on the network or even if we skip the privateFor parameter completely(as in a public transaction).

We get the same error message if we use any random public key. So it seems something is wrong with the public key. These nodes have been running fine for weeks now.

Code

const Web3 = require('web3')
const fs = require('fs')

const rpcURL = "https://<myNode1>.blockchain.azure.com:3200/<Accesskey>"

const web3 = new Web3(rpcURL)

const account = '<myAccount>'
const accountPassword = '<pwd>'

const contractByteCode = fs.readFileSync('myContractBytecodeFile.json','UTF-8');

(async() => {
    await web3.eth.personal.unlockAccount(account, accountPassword, 10);

    const txCount = await web3.eth.getTransactionCount(account);
    console.log("txCount=",txCount);

    const txObject = {
        from: account,
        nonce: web3.utils.toHex(txCount),
        gas: web3.utils.toHex(3000000),
        gasPrice: web3.utils.toHex(web3.utils.toWei('0', 'gWei')),
        data: contractByteCode,
        privateFor: ['<myNode2PublicKey>']
    }

    const tx = await web3.eth.sendTransaction(txObject);
    console.log(tx);
})();

Error

(node:1184) UnhandledPromiseRejectionWarning: Error: Returned error: Non-200 status code: &{Status:500 Internal Server Error StatusCode:500 Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 Header:map[Content-Length:[39] Server:[Jetty(9.4.z-SNAPSHOT)] Date:[Mon, 24 Feb 2020 11:49:21 GMT] Content-Type:[text/plain]] Body:0xc423f8a640 ContentLength:39 TransferEncoding:[] Close:false Uncompressed:false Trailer:map[] Request:0xc42095f800 TLS:<nil>}

If i send the message to node2, privateFor node1, i get the below error :

(node:32100) UnhandledPromiseRejectionWarning: Error: Returned error: Post http+unix://c/sendraw: dial unix /working-dir/c/tm.ipc: connect: connection refused

But i can connect to the Quorum node. So nothing wrong with the node itself. Something wrong with Tessera?

I went through this post, but could not make any sense of it : https://github.com/jpmorganchase/quorum/issues/64#issuecomment-281126604


texts: Unable to Generate Address Endpoint Blockcypher

texts:
I am trying to generate an address using Blockcyphers Address Endpoint using cUrl.

- https://api.blockcypher.com/v1/eth/main/addrs?token=eth

But it returns this error - "Endpoint not found. Please check your URL for typos and make sure you're using the correct HTTP method (GET, POST, etc)."

Im guessing im doing something wrong where it needs 'token'..

- https://api.blockcypher.com/v1/eth/main/addrs?token=YOURTOKEN

  $requesturl='https://api.blockcypher.com/v1/eth/main/addrs?token=eth';
  $ch=curl_init($requesturl);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  $cexecute=curl_exec($ch);
  curl_close($ch);

  echo $cexecute;


texts: Does an ERC721 contract have to rely on an external agent to be the approved spender?

texts:
I am creating a dApp that services a game.  The "house" in the game is my game server that creates the smart contract using Web3.js.  It also owns all the non-fungible assets at the start of the game, all the tokens.  My current intention is to create a smart contract that inherits the Open Zeppelin ERC721 smart contract.  This smart contract will handle the awarding of the non-fungible assets, aka the tokens, to the various players as during the game.

I just finished this article on the Open Zeppelin ERC721 token implementation:

https://medium.com/blockchannel/walking-through-the-erc721-full-implementation-72ad72735f3c

The article states that the ERC721 token works with external contracts that handle the spending logic, and that the address for that "agent" contract is put in the main contract's "allowed" map so the contract knows they are an "approved" spender. If I understand things correctly, the ERC721 token acts as the managing entity for token ownership record-keeping and facilitating the integrity of token transfer and allowances, while another smart contract handles the logic involved in spending/transferring tokens.

Is there any harm or risk in not using the external approved spender strategy?  Instead, why not simply have a public call in my ERC721 derived smart contract that does the transfer directly when called by the contract owner, which would be the "house" in my case?  I'm trying to figure out why this extra layer of complexity, that of using another smart contract acting as the "approved spender", is necessary or is recommended?


texts: How to create unique addresses for custom ERC20 tokens

texts:
We can create ERC20 tokens using solidity or even metamask.. but how to create unique address to transfer them?

I mean token like Gold reward or coins like Bitconnect has it's own pattern of address to transfer in between. how to do that?

In HitBTC also for every token you will get unique address to send..

if is there any way to do this, need to do that during the contract deployment or can be done after creating the simple token ?


texts: Create an independent contract from another contract

texts:
I have developed a contract and I would make an "initiator" contract which can be contacted with information for creating the first contract and a litle quantity of ethereum (I know, it is not super beacause anybody can decompile the initiator contract with etherscan to optcode and find recompiled code for the first contract but it is more simple by the initiator).

All is good except for creating a independent contract (independent execution, life (if I sucide initiator his children will not die)).

And how to respond with more than set a storage variable with the first contract address.


texts: Is there a way to reset the genesis block in my testrpc? I keep getting an 'out of gas error' and I think that resetting would help.


texts:
I'm having this error, which I doubt is because of the newer version of geth & the project being more than a year old.

I'm unable to downgrde geth anything below 1.5.9, I'm using a mac.

Also, I'm using testrpc & not exactly geth, could this be some other issue?


texts:
I'd like to have a contract A which upon being sent ether, it transfers the ether to contract B, which upon receiving an eth transfer executes some logic.

Is there a way to do this without contract A having to know anything about contract B?
Meaning, the user would just send eth to contract A's address which would then initiate the logic above.

So far, I've tried the following: There's contract A which upon sending ether to it gets its fallback function executed.

Said fallback function calls contractB.transfer(msg.value) to forward that ether to contract B.

Contract B has a fallback function which calls another function where its logic lies (say store the eth received in an internal state variable).

The problem here is that this approach fails due to the 2300 gas stipend.

The simplest approach would be to have contract A call some contract B's function instead of transfer(), but I'd like contract A not having to know anything about contract B other than the address.

Is there any other way to solve this?

I am aware of limitations in fallback functions. What I'm asking is if there's another way to do this that doesn't require Contract A knowing anything of Contract B other than its address.


texts:
I am having problems syncing Mist. I have tried versions 0.3.9 and 0.4.0.

I have been syncing for 4 days and I'm still stuck at 750.000 blocks of 1.000.000 blocks. I'm using Windows 10 64bit. Any ideas?


texts: How whisper messages being routed in Ethereum Network?

texts: Does the Whisper messages are broadcasted to all Ethereum nodes? or is there any internal routing, if yes how?


texts: Why standard tokens manually create getters for balanceOf and totalSupply

texts:
I've been reading through different implementations of ERC20 tokens and I noticed that many of them define balanceOf[address] as balances[address] and then create a public getter() to match the balanceOf() standard.
  Similarly, totalSupply is usually stored locally under a different name and then has a getter created to match the standard totalSupply()
  https://theethereum.wiki/w/index.php/ERC20_Token_Standard

  I was wondering what is the purpose of manually creating getters for these two variables? Solidity automatically creates getters for public variables so why not just name them the proper name to begin with?


texts: Does running Ethereum Wallet support the network?

texts: If I keep the Ethereum Wallet open, am I helping the network? Am I mining?


texts: I'm looking at this smart contract and the token amount is enormous. Will somebody please explain the actual amount of tokens? It is supposed to be 800M tokens.


texts: exploiting keccak for random number generation?

texts:
Whenever a ticket will be purchased, a random number will be generated

function _mightWin()
        internal
    {
        address _player = msg.sender;        // players address
        uint256 _tickets = tickets_.length;  // amount of total tickets so far

        // generate random number
        uint256 _ticket = uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty, _player, _tickets))) % 289;

        // ticket has hit the winning number
        if (_ticket == 42) {
            hasWon = true;
        }
    }

The contract allows players to only buy 1 ticket per minute. Some genius has made a contract to play this game, where the contract buys exactly 4 tickets from 4 different addresses and wins (in a single transaction).

How is this possible? When generating the random number, timestamp and difficulty are always the same number, but the players address and the amount of tickets is different.


texts: Smart Contract Error: Returned values aren't valid, did it run Out of Gas?

texts:
Deployed a contract using Remix IDE to Rinkeby testnet.

Etherscan contract address and code is here.

contract SimpleCounter {
    int counter;

    constructor() public {
        counter = 0;
    }

    function getCounter() public view returns (int){
        return counter;
    }

    function increment() public {
        counter += 1;
    }

    function decrement() public {
        counter -= 1;
    }
}

JavaScript client code:

    var contract;

    $(document).ready(function(){
        initContract();
        getCounterValue();
    })

    function initContract(){
        web3 = new Web3(web3.currentProvider);

        var address = "0xc6482382047fb50e8e7b4658425c9756b28f995c";
        var abi = [
                    ...
                    ];

        console.log('Create contract...');
        contract = new web3.eth.Contract(abi, address);
        console.log(contract)

    } //initContract()

    function getCounterValue(){
        console.log('getCounter()...');
        contract.methods.getCounter().call().then((result) => {
            console.log(result);
        }).catch(function(err){
            console.log('err...\n'+err);
        });
    }

Error:

  Create contract...

  (index):86 o {_requestManager: e, givenProvider:
  MetamaskInpageProvider, providers: {…}, _provider:
  MetamaskInpageProvider, …}

  (index):94 getCounter()...

  (index):99 err...

  Error: Returned values aren't valid, did it run Out of Gas?

NOTE:

This works fine in Remix IDE (chrome).
I'm able to increment/decrement/getCounter... with compiler version:0.4.25+commit.59dbf8f1.Emscripten.clang
.

Why does it fail, when accessing it using 'dist/web3.min.js' of Web3.js (Branch 1.0)?


texts: truffle: Error: Invalid JSON RPC response: ""

texts:
My config:

module.exports = {   networks: {
    development: {
      host: "localhost",
      port: 8545,
      network_id: "*" // Match any network id
    }   } };

My geth running on the same port:

C:\Users\steve\AppData\Roaming\Mist\binaries\Geth\unpacked\geth.exe --testnet --fast --ipcpath \\.\pipe\geth.ipc --rpccorsdomain * --rpcport 8545
I use Geth/v1.6.6-stable-10a45cb5/windows-amd64/go1.8.3

I am running

C:\Users\steve\AppData\Roaming\Mist\binaries\Geth\unpacked\geth.exe attach

What's wrong?

I tried all other recipes from 'Invalid JSON' qiestions here on this site nothing helps.


texts:
I want to consider  a scenario, lets suppose that a contract performs a transfer using send. At this point, out of gas occurs and send returns -1. Now the contract has no gas, and send does not revert, what would happen to the EVM, will it block because of no gas? How will EVM come out of this blocking situation? Kindly provide some link from Ethereum documentation.
contract TestOutofGas{
     :
     :
      function transaction(address otherContract, uint x) public returns () {
       :
       retVal = otherContract.send(1000);//out of gas
       bool success = findPrime(x);
         :
        :
      }//func transaction
}//contract OutofGas

Now suppose the other case,
contract TestOutofGas{
     uint trnNo=0;
     :
     function transaction(address otherContract) public returns (uint) {
       :
         retVal = otherContract.send(1000);//out of gas
         require(retVal);
         trnNo++;
       :
       :
     }//func ends
}//contract ends

Will the EVM be able to execute the require(…) instruction if the contract does not have any gas?
Zulfi.


texts: I accidentally sent uni token to contract address. Can i get it back?

texts:
Instead of transferring my Uni token to my binance wallet, tokens dropped to contract address.
I tried to send my 400 uni tokens to my wallet in binance with the metamask wallet. but as you can see the tokenes have gone to the contract address.
i try to contact to uni creators many times but they have not back to me.
The link below takes you to the etherscan contract with my Uni token sitting in the address.
https://etherscan.io/tx/0x041f0ab37f90397dc6427eb202d0b78f27f5652baa6cdd33c849ce1d4c32c3b6
how can i get back tokens?


texts: Reference Smart Contract Address in Smart Contract

texts: Is there a way to know the address of the smart contract you are writing before deploying it? Or somehow reference the smart contract address in the smart contract?


texts:
I am trying to use my Dapp application on Mist but when I tried to unlock the account to execute a transaction I receive the message "Method "personal_unlockAccount" not allowed."

the code:

var web3 = new Web3(Web3.givenProvider || new Web3.providers.WebsocketProvider("ws://127.0.0.1:8546"));
web3.eth.personal.unlockAccount('0xfe....fe'), password, 5)
   .then(console.log)
   .catch(console.error)

The exact same code works if I am using the geth with WebSocket.

I am using Web3js version 1.0.0 beta 18

All other operations that does not requires an unlocked account works perfectly on both environment (web browser with WebSocket and Mist with the givenProvider).


texts:
I am synchronising geth using

geth --datadir "<mounted large drive>" --fast --cache 1024 --rpc --rpcaddr <publicip> --rpcport 8545

The chaindata folder in the mounted drive is increasing in size (7GB after a few hours), so I am confident that -datadir is working... But for some reason my home drive is filling up at about the same pace.

I don't really have any idea where the data is coming from. This is a ubuntu box only for this geth node so there are no other programs running.

Geth eventually stops with out of diskspace, not because the datadir is full but the home drive is full (it's only 25GB). There is still >100GB available on mounted external drive when it stops.

In the above command line, is there anything obvious to suggest what is putting data on the home drive? I'm not mining so it's not .ethash

Thanks


texts:
Is there a way of defining contract data to be deployed and then running in a batch to deploy to the Blockchain? I am developing an application and would like to have the ability to load up test data in a batch when I change the code in a given function/ contract.

I use remix to deploy contracts although I do deploy some contracts dynamically in JavaScript using Web3 calls.

Any ideas?


texts:
Does a site like Cryptokitties query the blockchain in order to verify which ERC-721 tokens a specific user owns upon logging into his wallet, or does it store the list of owned tokens locally in a database? I would think that the site needs to query the blockchain every time, but just wanted to confirm.

Thank you. J


texts:
I am trying to push a bytes32 to an array, but it stays empty.

This is (part of) my code:

contract Voting {
    bytes32[] public encryptedVotes;
    bytes32[] public candidateList;
    address[] public pollingStationList;
    address public owner;
    function Voting(bytes32[] _candidateList, address[] _pollingStationList) public {
        candidateList = _candidateList;
        pollingStationList = _pollingStationList;
        owner = msg.sender;
    }

    function vote(bytes32 encryptedVote) public {
        encryptedVotes.push(encryptedVote);
    }

    function getEncryptedVotes() view public returns (bytes32[]) {
        return encryptedVotes;
    }
}

Don't mind the "encrypted" part of the code, it's part of more logic.

The problem lies in the "vote" function. When I call it it with web3, "contractInstance.vote.call("a value")", it returns [] but doesn't change the state. Calling getEncryptedVotes returns [].

Is there some logic surrounding bytes32 I am failing to see? Thanks in advance!


texts: Are there ways to optimize Approve and Transfer?

texts:
Let's take the following use case:

I want to allow a smart contract to transfer some erc20 token (from another contract) for me.

So what i assume i should do is:

Create and publish an approve transaction.
Wait for the tx to be included in a block
Call the smart contract's method to transfer the token

However, i realise than i can also publish both transactions one right after the other and hope for both to be included in the same block, or at least the approve tx to be included first than the transfer tx. Both scenarios work.

My question is, Is it wise to let the gasPrice be a little higher in the approve transaction to make sure it gets place in a block either first or at the same time as the transfer transaction?


texts: How can I prevent risky DATA fields in an Ethereum transaction?

texts:
The EVM evaluates smart contracts by reading code in the DATA field of an Ethereum transaction. This is why you shouldn't trust someone who asks you to include an unknown series of characters in a transaction.
However, you can also use that DATA field to send basic text messages.
If I want to send a transaction with a basic text message, how can I ensure that I'm not accidentally sending a potentially risky smart contract?


texts: What can I do to increase the chance of two transactions appearing in the same block?

texts:
There are two transactions I would like to make as close to each other in time as possible. In a SQL database I would make them appear in in the same transaction (in the SQL sense).

At the moment, when firing two transactions consecutively (using web3py) they are typically mined 3 or 4 blocks apart.


texts: How do you start mist from the command line in linux

texts: I'm on Linux Mint 18.2 (built on Ubuntu, using the Cinnamon desktop). I've installed mist successfully, and I can start it from the "Menu->Other->Ethereum Wallet" icon in the start menu, but I cannot yet figure out how to start it from the command line.


texts: How to show erc721 NFT card images in compatible wallets?

texts:
I have created an NFT and now I want to add some metadata e.g card images, that shows in a compatible wallet like trust wallet.
What step is needed next?


texts: Transfer ERC20 token from a smart-contract

texts:
I am facing an issue and I can't figure what's going wrong.

It is a very simple scenario:

A smart-contract, that implements ERC20 and ERC20Mintable from OpenZeppelin.

pragma solidity ^0.5.0;

import "./openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "./openzeppelin-solidity/contracts/token/ERC20/ERC20Mintable.sol";

contract MyToken is ERC20, ERC20Mintable {}

Another smart-contract that received some MyToken.

pragma solidity ^0.5.0;

import "./MyToken.sol";

contract TokenInteraction {

    address public tokenAddress;

    constructor(address _tokenAdd) public {
        tokenAddress = _tokenAdd;
    }

    function transferToken(address to) public {
        MyToken myToken = MyToken(tokenAddress);
        myToken.transfer(to, 1);
    }

}

I checked that TokenInteraction has more than one token, but when I call transferToken the transaction revert.

I don't understand what's happening.

Many thanks for you help!

EDIT :
Concerning the deployment and the testing methodology, I use Remix IDE on localhost and I deploy on Ganache running locally. To test it, I just mint a token to TokenInteraction and then try to call transferToken to another address


texts: Is the DAO incident being investigated by law enforcement?

texts: In current discussions about the DAO incident many people are using words like "theft" and "crime", while others say all transactions were stictly in accordance to  a (maybe grossly unfair but) valid contract written in code that all parties had agreed to. Without going into debate about these issues, I would like to ask: Have anybody reported the incident to a law enforcement agency in any country, and is there any ongoing official investigation or at least some response from law enforcement?


texts: Creating a permissioned blockchain on docker

texts: Will he helpful if  anybody can guide be on any documentation on how to create a permissioned blockchain on docker


texts:
I read that Fuse.io is a DPoS blockchain on the top of Ethereum, apparently to improve payment performance.

What is Fuse? What is its purpose?

If it is on the top of Ethereum, how payments may be faster or cheaper than Ethereum payments?


texts: What happens when truffle-contract promise is never executed

texts:
I'am using truffle 4.

Suppose I have the following js code:

let instance = await Values.deployed()
let result = await instance.addValue(hash)

Now imagine that something fails in my computer (for instance: somebody pulls the plug) while awaiting for the addValue result.

How can I recover the receipt of that transaction?


texts: My contract needs eth to operate, but truffle deploys it with no balance, so I can't execute functions through it. The constructor doesn't require gas, but some other functions do. Is there a way I can deploy a contract with ether? Or am I misunderstanding something about how contracts work?


texts: First instructions in bytecode (606060405)

texts:
I'm trying to figure out how EVM bytecode works and I created an empty contract in Remix. The assembly version looks like this:

PUSH1 0x60
PUSH1 0x40
MSTORE
CALLVALUE
ISZERO
PUSH1 0xE
JUMPI
PUSH1 0x0
DUP1
REVERT
JUMPDEST
PUSH1 0x35
DUP1
PUSH1 0x1B
PUSH1 0x0
CODECOPY
PUSH1 0x0
RETURN
STOP

PUSH1 0x60
PUSH1 0x40
MSTORE
PUSH1 0x0
DUP1
REVERT
STOP

AFAIK the first part is executed at contract creation, and the second part is the contract code itself.

What I fail to understand though is this part:

PUSH1 0x60
PUSH1 0x40
MSTORE

Why do we need to store smth in memory at the beginning of each program?


texts: Trouble executing transactions on a private PoA network with blocktime set to 0

texts:
I'm trying to run a private PoA(Proof of Authority) network with the blockTime (clique.period in the gensis block) set to 0.

I'm testing a truffle contract against this network, and when executing the truffle commands (both truffle migrate and truffle test [of a simple contract]), the operations just seems to hang with the geth instances logging Block sealing failed err="waiting for transactions" and the network shows zero pending transactions.

I've tested the commands both against testrpc and the same private network with the blockTime set to 1 and it executes fine everytime. If there is something simple that I'm missing or if you could point me to the right direction, it would be much appreciated.

The private network is running three nodes (all signers)


texts: Is there any way to create tokens for every user in my platform?

texts:
I'd like to make a user issued tokens exchange platform.

For example, there are A tokens issued by user A and B tokens issued by user B. One A token is exchanged with Two B tokens. All users have their own tokens and tokens don't need to be exchanged with other real tokens. Because of some reason, I want to issue erc20 tokens, not virtually handle tokens and manage on my database.

Q1. Issuing tokens for every user is simple but naive and resource consuming solution I think. So is there any other better solution?

Q2. On solution is, platform issues tokens and give it to user. Whenever platform gives tokens to user, put user's data into tokens in order to identify. Is it possible?

Thanks!!


texts: How to generate multiple ethereum addresses using HDWallet?

texts:
const mnemonic= 'clown shiver beach wheel this mixture emotion illness fatigue amateur talent bitter'
    console.log(`0x${hdwallet.derive(`m/44'/60'/0'/0/0`).getAddress().toString('hex')}`)

    const seed =   Buffer.from('408fb4ad29e82ae696c857795fa94c0aad444578effa428ddd1b969b35f96f298911c9b066a6dda3cc47ed85d903be61b67fe97895a8bc68d1a20ce014b7ae80', 'hex')

    const hdwallet= HDWallet.fromSeed(seed)
    console.log(`0x${hdwallet.derive(`m/44'/60'/0'/0/0`).getAddress().toString('hex')}`)
    var pubkey=hdwallet.derive(`m/44'/60'/0'/0/0`).getPublicKey().toString('hex');
    var privateKey=hdwallet.derive(`m/44'/60'/0'/0/0`).getPrivateKey().toString('hex');
    var address=`0x${hdwallet.derive(`m/44'/60'/0'/0/0`).getAddress().toString('hex')}`;
    console.log(pubkey)
    console.log(privateKey)
    console.log(address)

What am I missing?
How to iterate derivation path to get new address every time?


texts: Why does it cost more gas to transfer on contract one with less decimals than one with more decimals?

texts:
uint public _totalSupply = 2100000000 * ( 10 ** 2 );
uint8 public constant decimals = 2;

uint public _totalSupply = 2100000000 * ( 10 ** 18 );
uint8 public constant decimals = 18;

First one with 2 decimals cost over 4000000 for estimated gas limit but one with 18 decimals show around 80000.
They have similar gas price (around 20-35)

Why does one cost more than other?


texts: Setting a value for ERC20 token on private blockchain?

texts:
Background:

Currently we have an Dapp running on Ropsten. We've created an ERC20 token on Ropsten. Our employees are awarded these tokens over time. We want to use Dappos to allow our employees to spend these tokens at internal facilities. This doesn't seem possible on Ropsten; Dappos is able to locate our token successfully, but as it has no value, the amount of the token deemed necessary for the transaction is always 0, regardless of the dollar amount of the transaction. This effectively renders Dappos useless to us if we stay on Ropsten to test.

Question:

Therefore, we'd like to move to a private Ethereum blockchain to test. Can anyone elucidate how we can set or engineer a value for our token on a private blockchain so we can transact with our token internally using Dappos?

Also, if I am incorrect about Dappos providing no value on Ropsten for an ERC20 token, please correct me.


texts:
I'm trying to create a system with two user accounts and a contract.
I want to send ether from Account1 to Contract (Works).
And then I want to send ether from Contract to Account2 (Doesn't Work).
I'm using truffle(v4.0.4 (core: 4.0.4)), ganache(1.0.1), solidity(v0.4.18 (solc-js)) and metamask(3.13.6)
Here is my contract

    pragma solidity ^0.4.18;

    contract DataStore {

        address public creator;
        address UbiAccount = 0x627306090abaB3A6e1400e9345bC60c78a8BEf57;

        event Transfer(address indexed _from, address indexed _to, uint256 _value);
        event LogFundsReceived(address sender, uint amount);
        event LogFundsSent(address receiver, uint amount);

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

        function DataStore() payable public {
            creator = msg.sender;
            LogFundsReceived(msg.sender, msg.value);
        }

        function kill() public {
            selfdestruct(creator);
        }

        function SendPaymentToContract() public payable returns(bool sufficient) {
            getCurrentAddress().transfer(msg.value);
            LogFundsSent(UbiAccount, msg.value);

            return true;
        }

        function SendPaymentToUbi() public payable returns(bool sufficient) {
            UbiAccount.transfer(msg.value);
            LogFundsSent(UbiAccount, msg.value);

            return true;
        }

        function getCurrentAddress() public view returns (address){
          return this;
        }
    }

Thanks,
Ashutosh


texts: Solidity: Wrapping an ERC20 token inside of a new token

texts: Is it possible to wrap and track a ERC20 token amount in another token? Would I need to use ERC-721 to do this? Let's say I send my ERC20 token to a specific smart contract which will wrap it in a new token and send that new token back to me (this new token only tracks the balance of the ERC20 token that it is wrapping around).


texts: Get transaction has of rawTransaction before sending

texts:
Is it possible to get the transaction hash before sending the transaction? Just because it sometimes takes really long until the callback with the txHash comes in.

const transaction = new Tx(txData);
transaction.sign(privateKey);
const serializedTx = transaction.serialize().toString('hex');
web3.eth.sendSignedTransaction('0x' + serializedTx, cb);

I need to save the transaction hash in my DB. The best way would be to store it there ASAP. So, is there a way to calculate the Txhash BEFORE sending the transaction with sendSignedTransaction?


texts: What are some real world use cases for state channels?

texts:
Are there any state channel implementations being used today, or in development? (Not including payment channels)
I'm interested in practical use cases rather than theoretical examples like playing chess on the blockchain.


texts: ethereum pool - It seems your ethminer does NOT have function called eth_submithashrate

texts:
I'm currently using geth and ethminer to mine, and I just got latest version of ethminer (I think). I'm trying to mine on pool Ethereumpool, using these instructions. So my command is ethminer -G -F http://ethereumpool.co/?miner=17@0x44a7709d896dc619391423b902a9570b9f3ba90d

On ethereum polls webite -n miner stats  I see :

MINER IS INACTIVE
or
It seems your ethminer does NOT have function called eth_submithashrate. To get valid and reliable statistics please update your ethminer to lastest version. This affects only statistics, it does NOT affect revenue! If you have any concerns please feel free to contact us.

How do i fix that? I ran sudo apt get update but still the same.

Onb my terminal I see ethminer running normally like :

17:32:35.050|ethminer  Mining on PoWhash #0d290734… : 18345252 H/s = 9961472 hashes / 0.543 s
miner  17:32:35.590|ethminer  Mining on PoWhash #0d290734… : 18481395 H/s = 9961472 hashes / 0.539 s
miner  17:32:36.135|ethminer  Mining on PoWhash #0d290734… : 17315933 H/s = 9437184 hashes / 0.545 s
miner  17:32:36.673|ethminer  Mining on PoWhash #0d290734… : 18515747 H/s = 9961472 hashes / 0.538 s
miner  17:32:37.211|ethminer  Mining on PoWhash #0d290734… : 18062063 H/s = 9699328 hashes / 0.537 s
miner  17:32:37.754|ethminer  Mining on PoWhash #0d290734… : 18379099 H/s = 9961472 hashes / 0.542 s
miner  17:32:38.295|ethminer  Mining on PoWhash #0d290734… : 18413072 H/s = 9961472 hashes / 0.541 s
miner  17:32:38.837|ethminer  Mining on PoWhash #0d290734… : 18862760 H/s = 10223616 hashes / 0.542 s
miner  17:32:39.385|ethminer  Mining on PoWhash #0d290734… : 18177868 H/s = 9961472 hashes / 0.548 s
miner  17:32:39.431|ethminer  Got work package:
miner  17:32:39.431|ethminer    Header-hash: fd65171e0a7b00b744250070da5dbb535b07063dda80f7df64e0f8d9c3d01a81
miner  17:32:39.431|ethminer    Seedhash: 68fc811a18084465eab2e58f91e5dff9010c0bf8dbbf1dc799e61e23ab9cc904
miner  17:32:39.431|ethminer    Target: 000000006bcb9600f3b0d2304ee8306b6da22fd61c6cb31c8d6a4c3a0041da2a
  ℹ  17:32:39.451|gpuminer0  workLoop 1 #68fc811a… #68fc811a…

So my question is : do I mine successfully now? I can't see anything gained yet on etherscan after 2 hours - not even a single decimal and I am just worried I dont get anything.

This is my first time mining so please help.


texts:
I've recently started with Solidity and like to know about the emit event as I wasn't sure of why it is being used in the program.

contract MyToken {

    string public name;
    string public symbol;
    uint8 public decimals;

    mapping (address => uint256) public balanceOf;

    event Transfer(address indexed from, address indexed to, uint256 value);

    /* Send coins */
    function transfer(address _to, uint256 _value) public {
        require(balanceOf[msg.sender] >= _value && balanceOf[_to] + _value >= balanceOf[_to]);
        balanceOf[msg.sender] -= _value;
        balanceOf[_to] += _value;
        emit Transfer(msg.sender, _to, _value);
    }

   constructor(uint256 initialSupply, string memory tokenName, string memory tokenSymbol, uint8 decimalUnits) public {
        balanceOf[msg.sender] = initialSupply;
        name = tokenName;
        symbol = tokenSymbol;
        decimals = decimalUnits;

    }

}


texts: I reinstalled metamask after formating my pc and tried to unlock Metamsk using 12 word phrase. but it's not getting unlocked and keep on working for long time (2-3hrs).  can somebody please tell me the reason and solution as well


texts: How to protect against DELEGATECALL in a hub-spoke contract model?

texts:
Say I have a "master" contract that can create other "servant" contracts. The master contract routes users into different servant contracts and each servant contract should only be able to be accessed by one user (and as a result has a modifier that throws unless the msg.sender is the master contract).

My worry is that someone could create a servant contract that uses DELEGATECALL to call into a different servant contract than the one they are supposed to access.

So my question is two-fold - would DELEGATECALL allow this type of attack? And if so, is it possible to defend against this type of attack?

Thanks!


texts: I downloaded geth and i've been waiting almost 3 days for the synchronization to finish. I've used the commands geth --fast --cache=512 --maxpeers 75 --jitvm. When geth is done downloading and syncing the blockchain does it show you a corresponding message or does it keep on downloading the new blocks? How do i know how much time left until it finishes?


texts: How many txes/sec could a single computer mine on a private Ethereum block-chain?

texts: I would specifically like to know how would a private block-chain scale. If there are no block rewards, how many txes/sec could a single computer mine? How many computers would you need to deploy a nation-wide application utilizing a private Ethereum block-chain?


texts: Multiple contract or single contract for record keeping

texts:
I have to store the file hash of all the files stored on our server. Can I use single contract with fields like:

contract FileDetail {
    string fileName;
    string fileHash;

.................
}

Whenever I will call set method will it overwrite the field values of fileName and fileHash or it will create new values/copies of fileName or fileHash ? Or do I need to use a list/map if I use single contract approach.

Is it feasible to create new contract for each file. ? Can creation of a contract get automated ?


texts: Solidity: Pass multiple return values as argument to function?

texts:
Why does the following not work:

pragma solidity ^0.4.24;

contract Test {

    struct S {
        string s;
        uint u;
    }

    function returnTwoValues() private returns (string s, uint u) {
        s = "123";
        u = 123;
    }

    constructor() {
        S memory s = S(returnTwoValues());
    }
}

I'm getting a

TypeError: Wrong argument count for struct constructor: 1 arguments given but expected 2.

Do I really need to store the return values in temporary variables?


texts: How can I import data from a local file?

texts:
I have a contract, for simplicity sake, which has an array; I want to enter values into this array with the content of a text file in my local machine.
How can I access this data?
I was thinking that going through the CLI with loadscript(...) but I'm having issues accessing anything... The console is not very cooperative :)

Thanks.


texts: How to change block confirmations with geth?

texts: It appears that geth waits for 5 blocks to confirm a block.  Is there any way to change the number of blocks to wait for confirmation?


texts:
If I have the contract with the code

contract Airdropper is Ownable {

function multisend(address _tokenAddr, address[] dests, uint256[] values)
onlyOwner
returns (uint256) {
    uint256 i = 0;
    while (i < dests.length) {
        ERC20(_tokenAddr).transfer(dests[i], values[i]);
        i += 1;
    }
    return(i);
}
}

How would I call it (how would I create the array, where does the token need to be stored)?
Also, how many transactions could I do at once before it will cause issues? Is it unlimited? Could I do 10,000 at once saving tens of thousands of dollars of gas?

I am willing to hire someone to do this for me and I will pay them!

Thanks!


texts: ipfs daemon: Gateway (readonly) server listening on

texts:
I'm not quite sure whether this is the right forum to ask this question.

If I start the ipfs daemon it starts in read only mode. How can I start it in read and write mode?

API server listening on /ip4/127.0.0.1/tcp/5001
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready


texts: What is the array size limit of a returned array from a contract function call in Solidity?

texts:
I have a contract storing rdf data in various mappings. It is all working lovely except for large array returns. I have functions to return arrays of hashes matching certain criteria. I have found, through testing, that a function call to the contract that returns an array of 36,000 bytes32 hashes works fine. However, a function call to the contract that should return an array of 100,000 records fails. An example function I am calling is:

// return a bytes32 array of hashes matching a subject search hash
function getSubjectArray(bytes32 which) public constant returns (bytes32[]) {
    return subjectindex[which];
}

I was originally testing using web3 function calls to the contract, then I decided to test using direct curl commands to see if it was a web3 issue. But it behaves the same using curl. A result array of 36,000 hashes returns from the curl call successfully, but a result array of 100,000 returns just '0x'.

curl --data '{"id":1,"jsonrpc":"2.0","method":"eth_call","params":[{"to":"0x0a0bdad3a719adacf6ef29299b25f4799c3961ba","data":"0xd6cf19ffa6ccec97d46345da54fa1ac0a269b860a855d19895705920f2fdfb4eb786817a"},"latest"]}' -H "Content-Type: application/json" -X POST 127.0.0.1:55200

{"jsonrpc":"2.0","result":"0x","id":1}

I have stepped though this large results array using a separate function passing an index, so I know all the 100,000 records are there to be returned. So it seems to be a limit on the size that an array returned from a function call to a contract can be.

Can anyone confirm if there is a limit that an array being returned from a function can be?


texts: Is there a gas cost incurred when creating a contract abstraction?

texts:
I have a smart contract in vyper (SomeContract) that gets called within another smart contract:
some_contract: address = _some_contract
SomeContract(some_contract).foo() # Is there a cost incurred here with SomeContract()?
SomeContract(some_contract).foo()

vs
some_contract: SomeContract = SomeContract(_some_contract)
some_contract.foo()
some_contract.foo()

Does using SomeContract(some_contract) to obtain an abstraction cost gas?
Which of the two versions is cheaper?


texts: I want to make a calculation with the blockchain every day at the same hour. Iknow every miners got his own time. I think i had to find an oracle.  Any idea ?


texts:
I am trying to write unit tests on functions that take in a storage reference as parameters. There is not much great documentation around how to create literals for these types. These include: address payable[] storage, mapping(address=>uint) storage.

IIUC, I could define these values at the contract scope and then declare storage variables that point to them but that just feels like very evil programming. Is there anyway to create storage variables within the scope of a function that I could use when unit testing?


texts: Not able to get rid of error from solc-js "AssertionError [ERR_ASSERTION]: Invalid callback specified."

texts:
const path=require('path');
const fs=require('fs');
const solc=require('solc');
const InboxPath=path.resolve(__dirname,'contracts','Inbox.sol');
const source=fs.readFileSync(InboxPath,'utf8');
solc.compile(source,1);

Here is my error:

kowsik@kowsik:~/Desktop/etherium_project$ node compile.js
assert.js:43
  throw new errors.AssertionError(obj);
  ^

AssertionError [ERR_ASSERTION]: Invalid callback specified.
    at wrapCallback (/home/kowsik/Desktop/etherium_project/node_modules/solc/wrapper.js:16:5)
    at runWithReadCallback (/home/kowsik/Desktop/etherium_project/node_modules/solc/wrapper.js:42:26)
    at compileStandard (/home/kowsik/Desktop/etherium_project/node_modules/solc/wrapper.js:83:14)
    at Object.compileStandardWrapper (/home/kowsik/Desktop/etherium_project/node_modules/solc/wrapper.js:90:14)
    at Object.<anonymous> (/home/kowsik/Desktop/etherium_project/compile.js:7:6)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)


texts:
I want to use the web3-shh functionality. I used the example from readthedocs(web3-shh). Everything works except for the subscribe operation. It raises following error:

UnhandledPromiseRejectionWarning: Error: Subscriptions are not supported with the HttpProvider.

Any idea of how to deal with this? The test program I used is

import Web3            from 'web3';
const uri = process.env.ETH_NODE_URI || 'http://localhost:8545';
var web3 = new Web3(new Web3.providers.HttpProvider(uri));

var identities = [];

Promise.all([
web3.shh.newSymKey().then((id) => {identities.push(id);}),
web3.shh.newKeyPair().then((id) => {identities.push(id);})
]).then(() => {
var subscription = web3.shh.subscribe('messages', {
    symKeyID: identities[0],
    topics: ['0xffaadd11']
}).on('data', console.log);
}).then(() => {
web3.shh.post({
    symKeyID: identities[0], // encrypts using the sym key ID
    sig: identities[1], // signs the message using the keyPair ID
    topic: '0xffaadd11',
    payload: '0xffffffdddddd1122'
}).then(h => console.log(`Message with hash ${h} was successfuly sent`))
.catch(err => console.log("Error: ", err));
});

I would appreciate any advice on how to deal with this problem. Full examples in the documentation would be a good idea as well.


texts: Will it be possible to get a contract's balance by block number in Solidity?

texts:
Will it be possible to get address state at a given block within smart contract execution logic?
Something like:
block(10297202).(address('Ox...').balance)
I assume it's not possible currently due to:

Miners do not hold the whole chain (In general).
Computational power will be added to every block generation.
Question regarding reading past events info in Solidity


texts: What happened with the presale ether after the fork?

texts:
I have never accessed my presale ether. As I understand, a major fork occurred some time ago. I have some confusion regarding the current situation.

What will happen to my ether?
Do I get both ETC and ETH?
I read that I can use Mist to access the wallet. Are there any precautions that I should take with respect to the fork?

EDIT:

I can't comment so I'll add it here. To import/recover my ether and split it into ETC/ETH do I need to do it on both chains or which one?


texts: I am a complete noob at investing. I have never bought stock or invested in anything before but I have $300 I would like to turn into Ethereum. Could someone please tell me step by step how to purchase and own Ethereum using USD?


texts: Is there a boilerplate dApp on Github which uses uPort, truffle and infura on the ropsten testnet?

texts:
I am developing a dApp using those technologies and facing difficult problems when trying to save information on Ropsten. I can't approve my transaction via uPort because the selected account balance on uPort is 0.

Could anyone post a demo project please?


texts: How to fix "unexpected directory layout" error when Installing go-ethereum?

texts:
All, I hope this question belongs here.

I am following a Blockgeeks tutorial, trying to set up my environment for Ethereum blockchain development. I have basically gotten to the final step, installing swarm. When I attempt this command: $ go install -v ./cmd/swarm, it gives me this error:

> unexpected directory layout:
>         import path: github.com/naoina/toml
>         root: C:\cygwin64\home\di203179\go\src
>         dir: C:\cygwin64\home\di203179\go\src\github.com\ethereum\go-ethereum\vendor\github.com\naoina\toml
>         expand root: C:\cygwin64\home\di203179\go\src
>         expand dir: C:\cygwin64\home\di203179\go\src\github.com\ethereum\go-ethereum\vendor\github.com\naoina\toml
>         separator: \

I have tried to find a solution for days now, but nothing I've found has worked. Any help is appreciated.

Handy info:

-OS: Windows 10, running this project within cygwin with proper gcc dependencies installed

-Go version: 1.11.4

-The video link, though I don't know if you can view it without a subscription: https://courses.blockgeeks.com/lesson/blockchain-explained-3/?wvideo=khwy8msrx3

Update:

Just found the code that details how this error is thrown, but still at a loss.
Link to code: https://golang.org/src/cmd/go/internal/load/pkg.go

Snippet relating to my issue:

// dirAndRoot returns the source directory and workspace root
// for the package p, guaranteeing that root is a path prefix of dir.
func dirAndRoot(p *Package) (dir, root string) {
    dir = filepath.Clean(p.Dir)
    root = filepath.Join(p.Root, "src")
    if !str.HasFilePathPrefix(dir, root) || p.ImportPath != "command-line-arguments" && filepath.Join(root, p.ImportPath) != dir {
        // Look for symlinks before reporting error.
        dir = expandPath(dir)
        root = expandPath(root)
    }

    if !str.HasFilePathPrefix(dir, root) || len(dir) <= len(root) || dir[len(root)] != filepath.Separator || p.ImportPath != "command-line-arguments" && !p.Internal.Local && filepath.Join(root, p.ImportPath) != dir {
        base.Fatalf("unexpected directory layout:\n"+
            "   import path: %s\n"+
            "   root: %s\n"+
            "   dir: %s\n"+
            "   expand root: %s\n"+
            "   expand dir: %s\n"+
            "   separator: %s",
            p.ImportPath,
            filepath.Join(p.Root, "src"),
            filepath.Clean(p.Dir),
            root,
            dir,
            string(filepath.Separator))
    }

    return dir, root
}

Upddate:

I have confirmed that the first if-statement from that snippet is running, and the first three conditions of the second if statement resolve to false (meaning they are not the cause of the error), so that means the last condition that is composed of multiple AND statements must be returning true since the error is throwing. Still can't tell why, though. Thanks for any help.


texts:
I run geth on testnet with --mine option. Seems mining is running. What log will be showed if mining success?

INFO [07-16|04:02:56] Starting mining operation
INFO [07-16|04:02:56] Commit new mining work                   number=1308362 txs=0 uncles=0 elapsed=260.17µs
INFO [07-16|04:02:57] Generating DAG in progress               epoch=43 percentage=6 elapsed=11.383s
INFO [07-16|04:02:59] Generating DAG in progress               epoch=43 percentage=7 elapsed=12.867s


texts: Metamask accepting Promises/getting HTML to wait

texts:
(EDIT: Added some code so that people can see more explicitly what's going on)

I'm a newcomer to Ethereum who's building a project that allows users to communicate with a Smart Contract through a HTML/Javascript frontend. Users sign in with their MetaMask accounts, which inject the relevant web3 provider into the page, allowing for communication between them and the contract. They carry out various operations and finally submit a piece of data to the blockchain, the transaction being signed by their MetaMask accounts. The only problem is this: within my frontend, I need to query the contract for certain information (hasVotedBefore, for instance) before the frontend can decide how to proceed (a validation request, essentially). I used async-await to force execution to wait until these values return before loading the rest of the page (this is necessary given my specification). I was using async-await to accomplish this, and it was working fine...until I discovered that MetaMask is blind to async-await Promises, and it threw a massive fit, thinking that I was using synchronous methods with no callbacks. Attempts to add or revert to ordinary (function(result, error) style callbacks did, technically, solve this problem, but at the expense of bringing back an old one, namely the inability to properly wait for the hasVotedBefore to return before proceeding. So, I need a way to wait for this method to return, but I also need it to happen in a way that Metamask is capable of recognising.

So far, I've been pointed towards EthJS, but this is for a college project, and I don't have a lot of time left. My impression is that using EthJS would require the frontend to be refactored significantly, as well as requiring the contract itself to be changed. While I'd be willing to do this if there's no other choice, I've contemplated using a handful of nested callbacks to run this instead. I am well aware of "callback hell" and the loathed and feared status of nested callbacks among the web development community, but I just need it to work once. This code will never be used for any commercial project, and I'm running low on time, so please take those factors into account. All I need is a way of getting the frontend to wait for an asynchronous response, in a manner that MetaMask will recognise.

For instance, let's take the code for finding how many Proposals there are (this is part of the functionality of the deployed Contract) and then populating an array based on that.

async function getNumProps(){
  console.log("getNumProps");
try{
numProps = await RegionalContract.howManyProposals();
}catch (err) {
console.log(err);
}
return numProps;
}
**irrelevant code**
async function populateProps(){
try{
console.log("populateProps");
numProps = await getNumProps();
**do a bunch of stuff that's not relevant here**
}catch(error){
console.log(error);
}
}
populateProps();

When I try to run this code, I get the following in the console:

Error: The MetaMask Web3 object does not support synchronous methods like eth_call without a callback parameter. See
https://github.com/MetaMask/faq/blob/master/DEVELOPERS.md#dizzy-all-async---think-of-metamask-as-a-light-cli

Given what's been said already, what would you recommend that I do in order to get things working? Any advice is appreciated.

Thanks


texts: Must a Solidity developer know the private keys to the wallet that is tied to a token contract?

texts:
To deploy a token contract, there must be a wallet address, am I right? Thus, must the coder be managing the wallet (with its private keys) that is used?

I'm looking at the scenario where what if someone outsourced the blockchain coding work to someone that is dishonest and that coder could run away with the tokens, if they know the private keys. Could they?


texts:
My peers.txt file for my private parity network looks like this.

enode://1111-redacted-6eaf@172.0.0.1:30303
enode://2222-redacted-6eaf@172.0.0.2:30303
enode://3333-redacted-6eaf@172.0.0.2:30303

Is there any way to add inline comments for each line to remind me what each node is in my private network. I tried

# This is airport X node

but parity rejected it on startup.


texts: What happens if in the genesis file, I put something different than 0(0x0) for the "number" property?

texts:
From what I have understood, the number property from the genesis file represents the block number (to match block structure). So, logically, it should be 0x0 because the genesis file is the first block (block 0).

What would happen if I put something else ? Would the initialization of the chain fail ? Would the chain start at block X ?


texts:
My truffle got installed in usr/bin/truffle, how do I uninstall it,

npm uninstall/remove

is not working, please help.

Thanks


texts:
I want to know, can we add conditional parameters in constructor. Just for example, in constructor if we have UINT for

numberOfTimesAllowed = 1;

EDIT

I am trying to get balance of user  msg.sender  from another contract and on the basis of the number of tokens i want to allow users coupons using. WHich i have added in contructor of my contract like this. numberOfTimesAllowed = 1;

Now how I can write a constructor which can do this?
I am using this to get token balance of user from other contract

 function getERC20Balance(address _address) view public returns (uint) {
    return ERC20Interface(tokenAddress).balanceOf(_address);
}

But how to achieve it on contract load so constructor value can be set accordingly!


texts: Transactions not processed (Ethereum Network in Azure)

texts:
I have the following setup:

In Azure I have virtual network and within the virtual network a full node (TX0) and a mining node (MN0). They have each other added as static peers.
The virtual network has a firewall with the following rules: Inbound port 30303 TCP & UDP and 8545 TCP, outbound 30303 TCP & UDP
Only TX0 has a public IP address, MN0 has only a private IP address
Everything works fine within the boundaries of the virtual network.
I started a full node (TX1) running locally on my laptop. As static peer I added TX0 (MN0 is not possible as it only has a private IP)
TX1 is part of the network and also syncs the blocks but...

And here is the problem:

The account created on TX1 can receive ether when send from another account within the virtual network, but when I issue a transaction on TX1 it is not processed (a transaction hash is created but nothing happens then and also no receipt is available at any time as well as the balance of the account send from stays the same) (the account to send from is unlocked)
Command

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

What is the problem?


texts:
When sending ETH to my deployed crowdsale contract seems to always complaining gas on metamask too high and then transactions "cancelled" on etherscan.

https://ropsten.etherscan.io/address/0x043acaa777f3e08d0b25d48c899a681a7a17db37#code

I was able to send ETH last night before 5am GMT if you see the transactions.

Would anyone be able to shine some light ?


texts: how to check if an event was added to the log in a contract constructor

texts:
when executing a transaction in truffle tests, the return value is the transaction receipt and one can check for the presence of a particular event in the logs.

this is not possible when the transaction is a contract creation as the returned value is not the transaction receipt but the contract instance.

how can I get to the transaction receipt after instantiating a new contract?

return UserDirectory.new(root.address, {from: newUser})
  .then(d => {
    /*I would like to get the list of events here*/
    dir = d
    return dir.brg()
  })


texts: Is there an “after” keyword in Solidity?

texts: This is to avoid any further question in the future.


texts:
I have also asked the technical details of pyethapp's use of gevents here.

I'm trying to run a transaction step by step in a debugger and see how it is being signed and added to the blockchain. I am running a private net where only two nodes are available; a "client" node making a transaction and a bootstrap node mining new blocks (sort of a server).

The issue (as far as my understanding goes) with greenlets is that they are synchronous, blocking, meaning that while halting execution through debugging in one greenlet also stops the execution in the remaining greenlets.

Is that the case? Are there any python devs that have worked on pyethapp around here :)?


texts: How to send Ether from one ETHAccount to anotherETH using API

texts:
How i can send one ETH from my one wallet to another wallet using API. If i have only one ETH in wallet can i send that ETH or i have to manage balance in my wallet, GAS fee will cost to me not?
I have Private key of account from which i have to send ETH.

Can i test this functionality in Testnet like Ropston ?


texts: Help me fix Error: No "from" address specified in neither the given options, nor the default options. I'm use MetaMask

texts:
file web3.js

import Web3 from 'web3';

const web3 = new Web3(window.web3.currentProvider);

export default web3;

file image.js

import web3 from './web3';

const address = '0x036e58404E30795b3E5C945bc2A4107737F119cA';

const abi = myABI

export default new web3.eth.Contract(abi, address);

file app.js (frontend):

import web3 from '../web3';
import image from '../image';

onSubmit = async (event) => {
    event.preventDefault();
    const acounts = await web3.eth.getAccounts();
    await image.methods.addImage(this.state.idUser, this.state.hashImage).send({from: acounts[0]});
    await this.getImage();
}


texts: Smart Contract public chains, other than Ethereum mainnet

texts:
As a DApp developer I am concern about the costs of transaction on Ethereum mainnet. Every DApp interaction with the Smart Contract is having a cost between 1$ and 50$ depending on the data size and complexity of the function performed. So I am looking for alternative Ethereum platform to run the contracts and beeing public with a chain explorer.

As far as I know, there are the following:

* Ethereum Classic, 10x cheaper than ETH
* RSK, on development
* Building my own chain, no chain explorer.
* Plasma.io. Is it ready to use?
* Raiden Network. Is it ready to use? Is cheaper than Ethereum mainnet?

Do you know any more alternatives? Thx!


texts: Can smart contracts make transactions on behalf of the caller?

texts:
I want to make a smart contract that wraps over other various smart contracts.

In some of these contracts the user needs to send the transaction themselves. Is it possible to make a smart contract send transactions on behalf of the caller?


texts: Signing a request with a signature gives the wrong from address

texts:
I am using ethers to get a signed request. I have a signature for the address 0x518171C334AD3adc1cF990A884D67963201B675F.
It is, c4b71f516c36468022d61b0e22016c6bc69bc2c99666fb7e63e3d04841c82ff53d5c687ebe43b290d03caa6766e8e957192faa6b360f4102b536c54c3318304f1b.
When I use ethers.js, to serialize my transaction with my signature I get a transaction which is something like
0xf86a808477359400825208943e245df5a4de41e65cecd1f98b96ca06c3d319f087470de4df8200008029a0c4b71f516c36468022d61b0e22016c6bc69bc2c99666fb7e63e3d04841c82ff5a03d5c687ebe43b290d03caa6766e8e957192faa6b360f4102b536c54c3318304f
As it is an ECDSA signature, it keeps on changing every time I generate it. And every time I try to decode the serialized transaction I get a different from address.
This means that there must be something wrong in how I am using the function.
This is the code I am working with, with one of the signatures that I have generated (mentioned above)
const { utils } = require('ethers');
const bn = require('bignumber.js');
const { serializeTransaction, parseEther } = utils;
const tx2 = require('ethereumjs-tx');
async function serialize1() {
        const wei = parseEther('0.02');
        console.log(wei);
        const gasPrice = '0x' + (2000000000).toString(16);
        console.log(gasPrice);
        const tx = {
                gasPrice: gasPrice,
                gasLimit: 21000,
                to: '0x3e245df5a4de41e65cecd1f98b96ca06c3d319f0',
                value: wei,
                nonce: 0,
                data: '',
                chainId: 3,
        };
        const serializedTransaction = await serializeTransaction(tx);
        console.log(serializedTransaction);
        const signature = 'c4b71f516c36468022d61b0e22016c6bc69bc2c99666fb7e63e3d04841c82ff53d5c687ebe43b290d03caa6766e8e957192faa6b360f4102b536c54c3318304f1b';
        console.log('---------------------------------------------');
        const signedSerialized = await serializeTransaction(tx, Buffer.from(signature, 'hex'));
        console.log(signedSerialized);
}

serialize1();

When I decode this transaction, I get
{
  "nonce": 0,
  "gasPrice": 2000000000,
  "gasLimit": 21000,
  "to": "0x3e245df5a4de41e65cecd1f98b96ca06c3d319f0",
  "value": 20000000000000000,
  "data": "",
  "from": "0x0d67ffdd9b1d8858582d903bf0093e22b9da682e",
  "r": "c4b71f516c36468022d61b0e22016c6bc69bc2c99666fb7e63e3d04841c82ff5",
  "v": "29",
  "s": "3d5c687ebe43b290d03caa6766e8e957192faa6b360f4102b536c54c3318304f"
}

Which is clearly not the from address I want. Am I using the serialize function in the correct way? Is the encoding that I am sending the signature in correct? Any other way I can use this signature? Any other package?
Any help will be greatly appreciated!!!


texts: Dumping erc20 token transactions via rpc?

texts:
I'd like to do dump all transactions of an erc20-token via the json-rpc interface. I've got a full node running but I'm lost, since the ethereum blockchain is harder to navigate than bitcoin for some reason.
I've looked all over github for a simple dump but there seems to be none, only implementations of the json-rpc interface.
Etherscan lists them, but only the last 100.000 and not every single one of them.
Below I've got a screenshot of what I'd like to save to a database.


texts: How do I get a list of all currently used ethereum addresses?

texts:
I started wondering recently if generated ethereum addresses were evenly distributed in the address space and figured I could do some basic stats to see if they're clustered in one way or another.

My first thought was to run some JS code in geth that steps back through each block (using web3.eth.getBlock), adding all transactions with tx.to or tx.from addresses to a map. I tried that with a couple thousand blocks last night and it was painfully slow, there's no way I can traverse the whole blockchain history like that.

Is there a better way to accomplish this?


texts: What are some examples of how inline assembly benefits smart contract development?

texts: A lot of people have expressed excitement at the potential of using inline assembly in smart contracts. After seeing this comment on reddit I'm curious to see some basic (and more advanced, if you like) examples of how inline assembly may be used to save gas or otherwise augment efficiency.


texts:
I'm trying to understand below code:

pragma solidity ^0.4.23;

contract Relay {
    address public currentVersion;
    address public owner;

    modifier onlyOwner() {
        require(msg.sender == owner);
        _;
    }
    function Relay(address initAddr) {
        currentVersion = initAddr;
        owner = msg.sender; // this owner may be another contract with multisig, not a single contract owner
    }

    function changeContract(address newVersion) public onlyOwner(){
        currentVersion = newVersion;
    }

    function() {
        require(currentVersion.delegatecall(msg.data));
    }
}

This code is for maintaining version of a contract, but I'm not getting use of fallback function here. I know that msg.data is complete calldata which is non-modifiable, but have no idea use of delegatecall here.


texts:
I have initialized one private node using geth and Genesis file, and now I want to span another node, in genesis file, I have mentioned on the account which will be pre-funded now I want Ans of below questions

If I use the same genesis file to span another node what will happen as I mentioned one account to be pre-funded, can someone change it and have their account pre-funded?
As I came to know the same genesis file is required if you want to build your own private network to set up another node is there any way I don't have share Genesis.json to setting up other nodes?


texts: Block sealing failed waiting for transactions

texts:
I have problem on running a node on my local machine.

I have installed Geth from Homebrew by running this command brew install ethereum

Whenever I call this command geth --dev --mine in terminal I get this log:

INFO [03-16|17:40:15] Maximum peer count                       ETH=25 LES=0 total=25
INFO [03-16|17:40:17] Using developer account                  address=0x9637858cA3f5B1761DfC5aD5d76539e44B128614
INFO [03-16|17:40:17] Starting peer-to-peer node               instance=Geth/v1.8.2-stable/darwin-amd64/go1.10
INFO [03-16|17:40:17] Writing custom genesis block
INFO [03-16|17:40:17] Persisted trie from memory database      nodes=12 size=2.26kB time=19.413µs gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [03-16|17:40:17] Initialised chain configuration          config="{ChainID: 1337 Homestead: 0 DAO: <nil> DAOSupport: false EIP150: 0 EIP155: 0 EIP158: 0 Byzantium: 0 Constantinople: <nil> Engine: clique}"
INFO [03-16|17:40:17] Initialising Ethereum protocol           versions="[63 62]" network=1
INFO [03-16|17:40:17] Loaded most recent local header          number=0 hash=d529a9…d91f92 td=1
INFO [03-16|17:40:17] Loaded most recent local full block      number=0 hash=d529a9…d91f92 td=1
INFO [03-16|17:40:17] Loaded most recent local fast block      number=0 hash=d529a9…d91f92 td=1
INFO [03-16|17:40:17] Starting P2P networking
INFO [03-16|17:40:17] RLPx listener up                         self="enode://6601a763fa9cfb8bde516a1e68fc71bc7e6d30bc85400d5de61ef59459cd95289a598e48e5f1d41dba561e209224d51090933f8ff5b9a679895ce7b63023ed70@[::]:60117?discport=0"
INFO [03-16|17:40:17] started whisper v.5.0
INFO [03-16|17:40:17] Transaction pool price threshold updated price=18000000000
INFO [03-16|17:40:17] Etherbase automatically configured       address=0x9637858cA3f5B1761DfC5aD5d76539e44B128614
INFO [03-16|17:40:17] Starting mining operation
INFO [03-16|17:40:17] IPC endpoint opened                      url=/var/folders/gt/l9r08rns0dxf_zz733dq9dsm0000gn/T/geth.ipc
INFO [03-16|17:40:17] Commit new mining work                   number=1 txs=0 uncles=0 elapsed=68.51µs
WARN [03-16|17:40:17] Block sealing failed                     err="waiting for transactions"

Main error seems to be this one WARN Block sealing failed  err="waiting for transactions"

Geth
Version: 1.8.2-stable


texts: Question on the terms 'distributed' and 'decentralised'

texts:
I am writing a paper on distributed ledger technologies, an umbrella term I have borrowed to put everything that has any relation to blockchains and distributed consensus.  Under this umbrella term I am discussing primarily bitcoin, Ethereum, Bigchaindb, Swarm and IPFS.

When researching the technologies I have noticed the interchange of 'distributed' and 'decentralised'.  Is that by mistake or is IPFS truly distributed and Bigchaindb just decentralised?  Moreover, I read about 'decentralised smart contracts' when Ethereum is a distributed platform.  I am in no way inferring that any kind of centralisation is good or bad for any of those systems/platforms, I am just trying to be concise.

Thank you in advance for reading and possibly clarifying this.


texts: Why does .deployed() in truffle with testrpc return first address?

texts:
I created a simple contract and deployed in with testrpc using truffle migrate. In the contract I have a variable

creator = msg.sender;

When calling the contract, it shows that the contract is always called on the first address from the 10 addresses in testrpc.

This is how i call the contract in the truffle console:

var instanceTest
 MyContract.deployed().then(function(instance) { instanceTest = instance; })
 instanceTest.creator.call()

This returns the first address from the list of addresses in the chain. Why is it the first and how do I call the contract on another address?

Thank you.


texts: Solidity. Concatenate hash w address. TypeError: Operator + not compatible with types string memory and address payable

texts:
I am trying to do something simple:

examsFinalHash = keccak256(examHash + msg.sender);

but I get the following error:

  TypeError: Operator + not compatible with types string memory and
  address payable

I am new to solidity. Please help. Also, where in the solidity Docs can I find a reference to types and their characteristics?


texts: Returned error: gas required exceeds allowance (91135865401031) or always failing transaction

texts:
I am trying to deploy smart contract on private network and do transactions via nodejs script. This is my genesis block:

{
    "config": {
        "chainId": 16,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },
    "alloc": {},
    "difficulty" : "200",
    "gasLimit" : "99999999999999"
}

I have used following command to start the network:

geth --datadir ./exp4 --networkid 16 --rpc --rpcapi "eth,net,web3,personal,miner" --nodiscover --allow-insecure-unlock --port 3000 console

I am deploying it using truffle. This is my smart contract:

pragma solidity ^0.5.8;
contract Hello {
   string public message;
   function HelloWorld() public{
       message = "Hello, World : This is a Solidity Smart Contract on the Private Ethereum Blockchain ";
   }
}

Migration file:

var Hello = artifacts.require("./Hello.sol");
module.exports = function(deployer) {
   deployer.deploy(Hello);
};

Truffle config:

rpc: {
    host:"localhost",
    port:8545
},
networks: {
    development: {
        host: "127.0.0.1",     // Localhost (default: none)
        port: 8545,            // Standard Ethereum port (default: none)
        network_id: "16",      // Any network (default: none)
        from: "0xc3ec8cfb877b639094d2bc4bb99651dcb0c36aff",
        gas: 20000000
    }
}

Finally, I am running this script which gives the error as mentioned in title of gas limit exceeding

var Web3 = require('web3')
var web3_http = new Web3(new Web3.providers.HttpProvider('http://127.0.0.1:8545'));
const fs = require('fs');
const con = JSON.parse(fs.readFileSync('./build/contracts/Hello.json', 'utf8'));
var abi = con.abi;
web3_http.eth.getBalance("0xc3ec8cfb877b639094d2bc4bb99651dcb0c36aff")
.then(console.log);
var cont = new web3_http.eth.Contract(abi, "0xdCf9a6832Fae44B081f62513D04c2E30fB9a6A00");
console.log(cont);

cont.methods.HelloWorld().estimateGas({from: "0xc3ec8cfb877b639094d2bc4bb99651dcb0c36aff"})
.then(function(gasAmount){
    console.log(gasAmount);
})
.catch(function(error){
    console.log(error);
});

0xc3ec8cfb877b639094d2bc4bb99651dcb0c36aff is the account address and 0xdCf9a6832Fae44B081f62513D04c2E30fB9a6A00 is the address at which my contract is deployed. It  shows correct ether value for my account and fetches the contract correctly but gives a gas limit exceeding error when estimating gas. I was initially trying to deploy a personal contract which was much more complex and it gave the same error. So, I tried deploying a simple contract but it still shows the same error. Link to my previous question:

It would be really helpful if anyone could tell what it is that I doing wrong.


texts: Retrieve drizzleContext from within componentDidMount

texts:
How do i get drizzleContext from inside the componentDidMount function?
I am currently getting it from render using the following code which seems to be working fine:

  render() {
    return (
    <DrizzleContext.Consumer>

      {drizzleContext => {
        const { drizzle, drizzleState, initialized } = drizzleContext
        if (!initialized) {
          return "Loading..."
          }
.........


texts: Calling a function from a function undeclared identifier

texts:
I get an error message on the line returnString("testing"); that says:

DeclarationError: Undeclared identifier.
        returnString("testing");

function returnString (string checkers) external view returns(string) {
    return checkers;
}

function getBidders() public {
    returnString("testing");
}

Why wont this work?


texts: ERC20 TestToken code returns 0 for allowance after approval

texts:
I have the following code in my testtoken.js and am wondering why the assertion fails with "AssertionError: allowance wasn't set to 30: expected '0' to equal 30".

it("Approve an allowance of 30 between act0 and act1", function() {
    return TestToken.deployed().then(function(instance) {
      tt = instance;
      tt.approve.call(accounts[1], 30);
      return tt.allowance.call(accounts[0], accounts[1])
    }).then(function(allowance) {
      assert.equal(allowance.valueOf(), 30, "allowance wasn't set to 30");
    });
  });

This also returns 0 from the command line:

TestToken.deployed().then(function(instance){tt = instance;tt.approve.call(web3.eth.accounts[1], 30);return tt.allowance.call(web3.eth.accounts[0], web3.eth.accounts[1])});

It seems like the state isn't kept after the approval goes through?

EDIT:  My fixed test case:

it("Approve an allowance of 30 between act0 and act1", function() {
    return TestToken.deployed().then(function(instance){
      tt = instance;
      tt.approve(web3.eth.accounts[1], 30);
      return tt.allowance.call(web3.eth.accounts[0], web3.eth.accounts[1]).then(function(allowance){
        assert.equal(allowance.valueOf(), 30, "allowance wasn't set to 30");
      })
    });
})


texts: Retrieve function calls on a smart contract

texts:
So i have a simple smart contract that sends an event whenever a function is called, something like this:

event DidSomething(uint taskId);

function doSomething(uint _taskId) {
  taskId = _taskId;
  emit DidSomething(taskId);
}

So only for this particular smart contract I would like to retrieve all transactions that result in this particular function being called. What would be the best way to do this. Seems the etherscan API is insufficient to fulfill this type of query.

Right now i go to etherscan -> using contract address go to contract page -> under events tab i can see what functions are being invoked as shown by the method signatures


texts: Using go to make a contract call without private key like web3 does?

texts:
I'm working on moving a node project of ours over to a go project and I've run into an issue:

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

In node using web3 this is all I had to do for every transaction to go out as that address. No private key, no passphrase. However in go I'm running in to an issue when building TransactOpts for my contract calls:

opts := bind.TransactOpts{
    Context:  context.Background(),
    From:     fromAddress,
    GasLimit: big.NewInt(1000000),
    GasPrice: big.NewInt(0),
}

Here I specify the From but since I don't specify the Signer property I get an error no signer to authorize the transaction with and sure enough this page marks the Signer field as mandatory.

How, from go, should I be making my transactional contract calls? Ideally without private keys and passphrases being accessed.

EDIT: As I looked more into how Web3 does what it does, I realized that it was part of our process to leave that address unlocked. It was part of our script to mine to unlock that address until further notice. If Node still requires the address to be unlocked then I see less of an issue having to unlock it in Go. Unless I find a better way, I'll be using the keystore object to unlock an account and construct a transactor.


texts:
Pls help me
I bought 0.3 ETH in my ETH wallet, but i send ETC wallet to seller.

Tks


texts: What are common pitfalls or limitations when coding in Solidity?

texts:
What would be on your list to warn other developers about?

What works in most other languages that does not work, or behave as expected, in Solidity?

For example only: what parameters can be passed to functions, what can be returned from functions?


texts: Error sending value to Ethereum smart contract

texts:
down vote
favorite
I have geth 1.5.2 and work on testnet with Mist-linux64-0-8-7. I stuck at a simple issue when I try to send some ether (value) to my contract by calling any function. For example, even this dummy function does not work with non-zero value but works normally with zero value:

function t() returns (uint){
    return 1;
}

What is surprising here that I can see a warning in Mist with the message "It seems this transaction will fail. If you submit it, it may consume all the gas you send." This does not depend on the gas amount that I provide. Even if I put 500,000 of gas the transaction seem not to complete.

You can see its result here: https://testnet.etherscan.io/tx/0x3206118530079d1b416dc649c6f0a89283f9457e9189f259b3429cf0c6a998d0

There is a message

  Warning! Error encountered during contract execution [Bad jump
  destination]

I tried to run different functions in different contracts. I was even using sendTransaction functionality to do the same from geth console directly but I still can't make it work. I didn't find if anybody had similar problem. Please help me if you have any idea.


texts: Can I send data to non-contract address?

texts: Metamask allows to attach data to any transaction. What happens if I send some data with some ETH to existing non-contract address? Is that data recorded on the blockchain? Can I read it later?


texts: Brand new miner on Windows 10, with 1060 GTX 6gb

texts:
I am a brand new miner, pretty much know nothing about programming (some C++ classes in school). Was using cryptocompare.com guide to get going, but ethminer.exe keeps crashing at the grabbing DAG step (after it was built). Any help to push me along is very much appreciated.

I am using Windows 10, with Nvidia 1060 GTX 6GB (driver 382.05, recent to the last month). FX-6300, OC'd to 3.9 (have HWmonitor open and see CPU load doesn't reach past ~40% when starting up ethminer). Geth and ethminer in D drive, regular HDD. 8 GB ram in system.

I installed Geth 1.6.5 yesterday, went in and started a new account. I was able to sync the blockchain to my computer; I have been using "geth --rpc --fast --cache=1024" in the command prompt.

I tried cpp-ethereum 1.2.8 and 1.2.4, and used the CUDA 0.9.4.1. All gave me the same issue. I could use ethminer -G -M command and it gave me trials with ~17 MH/s. But running "ethminer -G" ran a few lines, then crashed (windows prompt that ethminer.exe stopped working). Here is a copy of the command prompt window:

D:\Program Files>cd cpp-ethereum
D:\Program Files\cpp-ethereum>ethminer -G
Found suitable OpenCL device [GeForce GTX 1060 6GB] with 6442450944 bytes of GPU memory
miner  13:51:24.094|main  Getting work package...
JSON-RPC problem. Probably couldn't connect. Retrying in 1...
miner  13:51:26.116|main  Getting work package...
miner  13:51:26.120|main  Grabbing DAG for #7c4fb8a5ΓÇª
  i  13:51:27.813|<unknown>  Loading full DAG of seedhash: #3868abc5ΓÇª
miner  13:51:27.813|main  Got work package:
miner  13:51:27.817|main    Header-hash: 1a921b256f319cc49c67a9bba8bded456e8b3aaeffaff9a84fa1ef3dca320565
miner  13:51:27.821|main    Seedhash: 7c4fb8a5d141973b69b521ce76b0dc50f0d2834d817c7f8310a6ab5becc6bb0c
miner  13:51:27.826|main    Target: 0000000000006e1447e3081e1abbfd8c43e346c68150876c888b6f98e4edd880
  i  13:51:27.833|gpuminer0  workLoop 0 #00000000ΓÇª #7c4fb8a5ΓÇª
  i  13:51:27.835|gpuminer0  Initialising miner...
miner  13:51:28.334|main  Mining on PoWhash #1a921b25ΓÇª : 0 H/s = 0 hashes / 0.5 s
Using platform: NVIDIA CUDA

Ths above actually got a little bit further than it ever has, but still crahes immediately.

Here is the "-G -M" details:

D:\Program Files\cpp-ethereum>ethminer -G -M
Found suitable OpenCL device [GeForce GTX 1060 6GB] with 6442450944 bytes of GPU memory
Benchmarking on platform: { "platform": "NVIDIA CUDA", "device": "GeForce GTX 1060 6GB", "version": "OpenCL 1.2 CUDA" }
Preparing DAG...
Warming up...
  i  13:55:44.711|gpuminer0  workLoop 0 #00000000ΓÇª #00000000ΓÇª
  i  13:55:44.716|gpuminer0  Initialising miner...
Using platform: NVIDIA CUDA
Using device: GeForce GTX 1060 6GB(OpenCL 1.2 CUDA)
Printing program log
Creating one big buffer for the DAG
Loading single big chunk kernels
Mapping one big chunk.
Trial 1... Creating buffer for header.
Creating mining buffer 0
Creating mining buffer 1
12666071
Trial 2... 18861793
Trial 3... 18768218
Trial 4... 18081908
Trial 5... 17938448
min/mean/max: 12666071/17263287/18861793 H/s
inner mean: 18262858 H/s
Phoning home to find world ranking...

Thank you for the help! BTW how could I copy paste the command prompt text without the format changing?


texts: Is block contains any field which directly give me transaction fees in geth server. if not how i can calculate it?

texts:
I am using geth server for transaction. After transaction is done i got new block but this block not having any field like transaction fees. So my confused about that is block having any field which gives me transaction fees or i have to calculate it manually. If its calculated manually then what is the right formula to calculate transaction fees and how to convert it into ether.

When i google for transaction fees I found two formulas to calculate transaction fees.

gas * gasPrice = transacrion fees.
gasUsed * gasPrice = transaction fees.

But gas and gasUsed are two different fields which have different values. So I am confused which formula is correct. Thanks in advance.


texts: What is the philosophy behind the difficulty setting and block generating time?

texts:
We know that on the Ethereum mainnet, generating a block always costs about 15 seconds in order to maintain the synchronization. Yet, why it is set to 15 seconds but not a larger or smaller value?

Furthermore, in a Ethereum private network, the difficulty can be set as a extremely low value, such as 0x01. If there are lots of nodes in the private network, e.g., 2000 nodes, does a low difficulty trigger security issues?


texts:
If id(Eg:1) field in structure is not unique and different names are mapped with same id=1. Can all names mapped with id=1 could be fetched from blockchain?

pragma solidity ^0.4.4;

 contract Register{

 struct Details{
  bytes id;
  string name;

  }
 mapping (bytes => Details) DetailsTable;

 function saveBondToBC(bytes id,string name)
 payable returns(bool success){

DetailsTable[id].id = id;
DetailsTable[id].name = name;
return true;
}

function getAllNames(bytes id) return (string){
DetailsTable[id].name; //Return latest 'name' written
 }


texts: Distribute balance of a contract between owner`s tokens based on percentages?

texts: I have a contract and I have ether in it. How can I distribute balance of contract between owner`s tokens base on percentages?


texts: How to export local geth data from a smart contract into Excel

texts:
I have a local Geth network running with a smart contract that generates transactions containing several variables - as part of my data analysis I want to export the contents of the transactions to Excel. Is this possible?

I know Etherscan has an API but I don't know how to use that to parse through my local blockchain. I also looked at quickBlocks, but that seems to not have a Windows installation.

What I would like is to access the contract address and pull the data (transactions) pertaining to that contract. Anyone know how to go about this?


texts:
I want to create a smart contract that allows people to lend dai stable coin to other or a smart contract at an interest.
suppose at 4 % interest I need to calculate (1+0.04/12)^n (n is the period in months). But I am having problem calculating fractions the factor never goes above 1. it is supposed to be 1.04 for n=12 and 1.081 at n=24 but all I get is one
I cannot multiply the fraction as the number increases exponentially with power (1^24 is 1 but 10^24 has 24 zeros) so what should I do to invoke fractions into a contract
Is there a way I can calculate externally and send the result to the contract


texts: How to make transaction using private key and address using web3j

texts: I have a private key and address . Is it possible to make transaction with these parameter using web3j.


texts: How to truncate the hash function output in Solidity?

texts:
I'd like to keep an ID which is the first 32-bit of the hash function output in Solidity. I'm aware that "keccak256" output is of type:

bytes32

which is more larger than I want.

Question: How can I truncate the output of hash function (i.e. keccak256) from "bytes32" to "bytes2"?


texts: Unable to test the value from contract using truffle test

texts:
block builders! I have trouble testing the return value from my contract, because the return uint value is always a "transaction" object (I actually don't really know what that mean)

Here is the overall picture of what I'm doing:

I try to create a bank contract that allowing client to enroll to the bank, making deposit and withdraw the deposit. In order to check if the client really enroll successfully, I put 5 ether to the newly enrolled client.

I firstly use await and async in the TestContracts.js to avoid nested callback, but the testing failed since the return value was a transaction object instead of uint

Then, I take a different approach using promise.then. However, it's even more weird, because the assert function was not being called at all, so the test always passed given any expected value.

Implementation of Bank contract:

contract Bank {
struct Customer {
    address _address; // address of customer
    uint deposit;
}

address owner;
mapping(address => Customer) public customerList;
uint customerCounter;

constructor() public payable {
    require(msg.value == 30 ether, "Initial funding of 30 ether required for rewards");
    /* Set the owner to the creator of this contract */
    owner = msg.sender;
    customerCounter = 0;
}

function enroll() public returns(uint){
    customerList[msg.sender].deposit = 5;
    customerList[msg.sender]._address = msg.sender;
    customerCounter++;

    return customerList[msg.sender].deposit;
}

Implementation of TestContracts.js using async and await

contract("Test", function(accounts) {
console.log("total accounts: ",accounts);
const alice = accounts[1];
const bob = accounts[2];
const charlie = accounts[3];
it("add 1 people to the bank", async ()=>{
    const bank = await Bank.deployed();
    const aliceBalance = await bank.enroll({from:alice});

    assert.equal(aliceBalance, 5, "initial balance is incorrect");
})

Implementation of TestContracts.js using Promise

contract("Test", function(accounts) {
console.log("total accounts: ",accounts);
const alice = accounts[1];
const bob = accounts[2];
const charlie = accounts[3];
it("add 1 people to the bank", function(){
    Bank.deployed().then(function(bank){
        return bank.enroll({from:alice})
    }).then(function(balance){
        assert.equal(aliceBalance, 0, "initial balance is incorrect");
    });
    // const aliceBalance = await bank.enroll({from:alice});
})


texts: How to decode input field(data) of a transaction object?

texts:
I have tried with
     web3.eth.decodeParameter(type,hexString)
var input="0x0121b93f0000000000000000000000000000000000000000000000000000000000000004";
console.log(web3.eth.abi.decodeParameter('uint', input));

Expected output:4
but returns error "Cannot read property 'decodeParameter' of undefined"


texts: Manually calculating ethereum mining profitability. I have the formula, but how to get the data?

texts:
I have the following formula which can be used to estimate someones mining profits for ethereum:

(UserHashMh * 1e6 / ((difficultyTH / BlockTimeSec)*1000*1e9))*((60/ BlockTimeSec)*BlockReward)*(60*24*30)*(EthPrice)

I can quite easily get the data by going to websites and pulling it that way, but im looking to design my program to not be dependent on a third-party to produce these estimates. I have access to a full node with full IPC/RPC access. Ideally im looking to be able to calculate this using RPC or IPC calls with my local node and not have to go to a third party. The only calls I'm anticipating having to go to a third-party are for the eth price, and users hash rate.


texts: Is it possible to circumvent a require statement if the ordering of the requirements are incorrect?

texts:
Please take the following hypothetical code as an example

mapping (address => uint256) public accountBalance;

function deposit(uint256 amount) public {
    accountBalance[msg.sender] = accountBalance[msg.sender].add(amount);
    require(daiToken.transferFrom(msg.sender, address(this), amount));
}

I have been informed that this code would be vulnerable to a re-entrancy attack and should instead be written as follows:

mapping (address => uint256) public accountBalance;

function deposit(uint256 amount) public {
    require(daiToken.transferFrom(msg.sender, address(this), amount));
    accountBalance[msg.sender] = accountBalance[msg.sender].add(amount);
}

How is it possible to cause a state update to the local contract if there is a require statement wrapped around the transferFrom function?

Kindest Regards