texts: Is it possible to get a function's original returndata if it is wrapped in an interface that doesn't return anything?

texts:
Will a function's returndata persist through a wrapper, even if the wrapper does not support a return value? An example would be as follows:

contract OriginalContract {
    function originalFunction() external returns (bool) {
        return true;
    }
}

interface originalContractInterface {
    function originalFunction() external;
}

contract MyContract {
    address originalContractAddress = 0x123...;

    function mainFunction() public {
        originalContractInterface(originalContractAddress).originalFunction();
        checkReturnData();
    }

    function checkReturnData() internal returns (uint256) {
        uint256 isReturnDataPresent = 0;

        assembly {

            switch returndatasize

            // No return data present
            case 0x0 {
                isReturnDataPresent := 0
            }

            // Return data present
            case 0x20 {
                isReturnDataPresent := 1
            }
        }

        return isReturnDataPresent;
    }
}

In the above example, will calling mainFunction() cause checkReturnData() to return a 0 or a 1? The OriginalContractInterface does not have a return value, so when mainFunction() calls it, will checkReturnData() be able to read the return value from the originalFunction() in the OriginalContract?


texts: How to maintain/administer nodes of a private network?

texts:
I might be wrong here, but I'm really trying to find out how to effectively control admission to a private Blockchain instance.

Sure, I can put the IP + PubKey into the static-nodes.js or trusted-nodes.js but do I need to do this to all nodes???

Is there any way to decouple admission control from the nodes?


texts: How to check Balance & send ERC721 Tokens

texts:
I have SPH ERC721 Tokens.

How can I check balance like ERC20 and send ERC721 tokens token to Exchange or in other wallet ?


texts:
I created a vanilla custom token via a contract on testnet and minted 10,000 coins to it, and I was able to successfully send the tokens to a wallet contract at a different address. However, when I attempt to use the Watch Token feature and paste the contract address, the balance is always zero, despite the form auto-loading the other contract variables.

Shouldn't the number next to the icon display the amount of custom tokens associated with the main account address?

I am using Mist 0.8.10 on ropsten testnet.

My contract is pretty simple:

pragma solidity ^0.4.11;

contract PractCoin {

    mapping (address => uint256) public monies;
    address public owner;
    uint public totalCoins;
    uint public initialSupply;
    string public name;
    uint8 decimalPlaces;

    function PractCoin(uint _totalCoins, uint _initialSupply, string _name, uint8 _decimalPlaces){
        owner = msg.sender;
        totalCoins = _totalCoins;
        initialSupply = _initialSupply;
        monies[owner] = initialSupply;
        name = _name;
        decimalPlaces = _decimalPlaces;
    }

    function sendCoins(address _to, uint _amount){
        if (monies[msg.sender] < _amount ||
            msg.sender == _to ||
            monies[_to] + _amount < _amount) throw;
        monies[msg.sender] -= _amount;
        monies[_to] += _amount;
        CoinTransfer(_amount, _to, msg.sender);
    }

    function destroyContract(){
        if (msg.sender == owner ) selfdestruct(owner);
        ContractDestroyed("Contract Destroyed!");

    }

    event CoinTransfer(uint _amount, address indexed _to, address indexed _from);
    event ContractDestroyed(string _message);
}


texts: Is there a C# implementation available for Ethereum?

texts: Is there a C# / .NET / Mono implementation available for Ethereum to interact with nodes and/or the blockchain?


texts: How can I freeze an erc20 token in another holder's wallet

texts: Token was compromised and some portions went to a wrong hand, now owners of token wants to freeze that wallet holding it, is there any way to do this.


texts: Is a DApp also hosted like web application. As i know that smart contracts are stored in the blockchain but what happened with the UI part?


texts: Got Gas Estimation failed error every time, at the time of execution of MultiSig wallet contract. Specifically while executing sendMultiSig() function

texts:
function sendMultiSig(
   address toAddress,
   uint value,
   bytes data,
   uint expireTime,
   uint sequenceId,
   bytes signature
) public onlySigner {
// Verify the other signer
var operationHash = keccak256("ETHER", toAddress, value, data, expireTime, sequenceId);

var otherSigner = verifyMultiSig(toAddress, operationHash, signature, expireTime, sequenceId);

// Success, send the transaction
if (!(toAddress.call.value(value)(data))) {
  // Failed executing transaction
  revert();
}
 Transacted(msg.sender, otherSigner, operationHash, toAddress, value, data);
}

Contract, which I'm using: https://github.com/BitGo/eth-multisig-v2/blob/master/contracts/WalletSimple.sol


texts: Restrict solidity function as only callable by another function

texts:
How can I make a solidity function to be only callable by other functions in the same contract? and it doesn't visible in etherscan or remix as a normal function.

Eg:

contract Calc {
      function add(uint a, uint b) public returns(uint) {
                return adder(a,b);
             }
      function adder(uint a, uint b) public returns(uint) {
                return (a+b);
          }

}

here I need to make the function 'adder' is only accessible to other function like 'add'. but i can't be accessed by the user through remix or etherscan


texts:
Apologies if this isn’t the right forum. Just trying to understand the concept of scarcity with NFTs.
With physical goods, there is tangible scarcity. For instance, there are only a certain amount of Michael Jordan rookie cards out there. Creating another batch involves costs in printing, distribution, retail etc.
With NFTs, scarcity is artificial. Say, for an NBA Top Shot, what keeps them from minting more copies? Marginal costs are essentially zero, so it’s like printing money.
What am I missing?


texts: Is there a formal specification for the EVM?

texts:
The yellowpaper specifies the EVM, albeit in a fashion that favors formalism over readability:

But there's no indication if this is up to date with the current state of the Ethereum ecosystem or not, and I haven't been able to find a formal VM specification anywhere else. Is there one?


texts:
I am trying to create a private network on docker such that each geth node in the network is run on a docker container.

I followed this git hub blog :https://gist.github.com/fishbullet/04fcc4f7af90ee9fa6f9de0b0aa325ab . I am able to create containers and run geth nodes but the nodes always show hashrate=0.It take a lot of time to mine even if the difficulty in the genesis file is set to very low value(0x10). I thought it is the geth version problem.Will it work if I downgrade geth to lower version ??

geth version:1.8.2
Ubuntu VM :16.04
OS: windows 7 (I am using docker tool box).
Can someone help me with this...


texts: unable to understand how to use internal function types

texts:
I need help to understand below code which is from solidity offical documents "how to use internal function types". as it is very confusing for me.

How to use library in solidity.
Some one explain the function map in details as it is confusing for me.
Why we use 'f' at end of function.

Please refer below code

pragma solidity >= 0.4 .16 < 0.6 .0;

library ArrayUtils {

  function map(uint[] memory self, function (uint) pure returns(uint) f)
    internal
    pure
    returns(uint[] memory r)
  {
    r = new uint[](self.length);
    for (uint i = 0; i < self.length; i++) {
      r[i] = f(self[i]);
    }
  }

  function reduce(
    uint[] memory self,
    function (uint, uint) pure returns(uint) f)
    internal
    pure
    returns(uint r)
  {
    r = self[0];
    for (uint i = 1; i < self.length; i++) {
      r = f(r, self[i]);
    }
  }
}


texts: Using delegatecall for multiple parameters fuction in solidity

texts: Does someone have a exemple of solidity delegatecall for multiple parameters function?


texts: Getting new BigNumber() not a number: [object, object] error

texts:
I am getting a BigNumber() error from the standard token function balanceOf(). The function returns uint256, but it seems like it's returning an array of objects. Here is my javascript testing in Truffle:

      return tokFactory.createTok(100000,"tok",1,"tok",{from: accounts[0]}).then(function(txHash) {
      tokFactory.getTokenAddress.call().then(function(tokenAddress) {
      tok = Tok.at(tokenAddress);
      }).then(function() {
    tok.balanceOf.call(tokFactory).then(function(balance) {
  assert.equal(balance.toNumber(), 100000, "100000 wasn't in the first   account");
});
  });
      });

Solidity function:

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


texts: How to peg value to token outside ethereum

texts:
I have an online game system. I issue some tokens through ethereum. How can I peg value of the tokens issued on ethereum to my game system, which is outside the ethereum eco system. (ie) The users need to be able to buy in game items like weapons, power ups etc. using the custom tokens.

Logically, I'm guessing it will work something like this : I ask the user's their ethereum wallet public key. The user sends the tokens to my wallet. I will query ethereum using some API and figure that the user X has deposited some tokens on my wallet. When the transaction has happened, I will issue out the in game items.

Another way to look at the question is, when I sell tokens to users in an ICO, how will the user use those tokens to trade it for some value in my product.

Example code is much appreciated.


texts:
Given following solidity code:

pragma solidity ^0.5.1;

contract Foo {

    event FooInc(uint256 _a);
    uint256 a;

    constructor() public {
        a = 42;
    }

    function inc() public returns(bool) {
        a += 1;
        emit FooInc(a);
        return true;
    }
}

and following test javascript code:

let Foo = artifacts.require('Foo');

contract("foocontract", async accounts => {
    it("testing inc", async (done) => {
        let foo = await Foo.deployed();
        foo.allEvents().on('data', function(e) {
            console.log('allevents', e);
            done();
        });
        foo.inc().then(r => {
            console.log('done', r);
            foo.getPastEvents('allEvents', undefined, (e, l) => {
                console.log("pastevents", e, l);
                done();
            });

        });
    });
});

The receipt from the foo.inc() promise gets logged. Neither of the event listener accessors for the contract events fire, although the receipt object shows the event was triggered.

$ truffle test
Using network 'test'.

Compiling your contracts...
===========================
> Compiling ./contracts/Foo.sol
> Compiling ./contracts/Migrations.sol
> Artifacts written to /tmp/test-2020127-266345-9s8aje.7jzss
> Compiled successfully using:
   - solc: 0.5.16+commit.9c3226ce.Emscripten.clang

  Contract: foocontract
done {
  tx: '0x158109501fa0cecffa6c7887d05c255cb5e76002c25881f5e684ab199a75cdff',
  receipt: {
    transactionHash: '0x158109501fa0cecffa6c7887d05c255cb5e76002c25881f5e684ab199a75cdff',
    transactionIndex: 0,
    blockHash: '0x55e2fce5a0257fad6d851ba35e03885509f98a6641e3e92a146e2fbaad9e3a18',
    blockNumber: 5,
    from: '0x627306090abab3a6e1400e9345bc60c78a8bef57',
    to: '0x345ca3e014aaf5dca488057592ee47305d9b3e10',
    gasUsed: 28961,
    cumulativeGasUsed: 28961,
    contractAddress: null,
    logs: [ [Object] ],
    status: true,
    logsBloom: '0x00000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000010000000000000',
    rawLogs: [ [Object] ]
  },
  logs: [
    {
      logIndex: 0,
      transactionIndex: 0,
      transactionHash: '0x158109501fa0cecffa6c7887d05c255cb5e76002c25881f5e684ab199a75cdff',
      blockHash: '0x55e2fce5a0257fad6d851ba35e03885509f98a6641e3e92a146e2fbaad9e3a18',
      blockNumber: 5,
      address: '0x345cA3e014Aaf5dcA488057592ee47305D9B3e10',
      type: 'mined',
      id: 'log_8dfd46f8',
      event: 'FooInc',
      args: [Result]
    }
  ]
}

I am using truffle@v5.1.14 and the docs for it suggest that it should merely be a matter of listening for javascript events data and error. What am I missing here?


texts:
I'm having a very weird issue... My rig has 3 RX 480 and it seems unstable as soon as I install the driver. I've tested all OS (windows 8 32 bits, 8.1 64 bits, Windows 10, Ubuntu server) and I'm now on an Ubuntu Desktop LTS 16.04.

I managed to install the AMD drivers but lost the X11 interface so I'm connected using SSH.

As I'm a big noob I've struggled for days to get ethminer installed and it's now setup from apt-get (couldn't get the git version to work).

ethminer runs well (but no hashrate) but when I type -G I have the following error:

~/Downloads/cpp-ethereum/build$ ethminer -G
Segmentation fault

But when typing ethminer -F $URL I have the following issue:

miner  10:47:27.154|ethminer  Getting work package...
  ✘  10:47:27.307|ethminer  Failed to submit hashrate.
  ✘  10:47:27.307|ethminer  Dynamic exception type: jsonrpc::JsonRpcException
std::exception::what: Exception -32003 : Client connector error: libcurl error: 52

JSON-RPC problem. Probably couldn't connect. Retrying in 1...

I'm totally stuck and have exhausted all my options, can you please help? Just for information, I don't have the blockchain locally as I'm trying to mine from a pool.

Many thanks in advance,


texts: Call Result Returning Wrong from Proxy Contract

texts:
I published my proxy (AdminUpgradeabilityProxy) and logic contract to Ropsten Test network.

But my call result is returning wrong value through the my proxy contract. For example I call to totalsupply() function in logic contract (I use proxy contract address) then the call result is wrong is that:

{
    "totalSupply": "3963877391197344453575983046348115674221700746820753546331534351508065746944"
}

(The result must be '0'... :( )

and then I call the owner() function in logic contract through the proxy and  I'm getting wrong result again

The Contract Owner call result:

{
    "owner": "0x0000000000000000000000000000000000000000"
}

whereas, I saw the owner and ProxyAdmin address is correctly set when I publish the contracts to Ropsten network.

what is my fault? why the result returning as a wrong value :(

And my deploy script :

await deployer.deploy(logic); const instance = await logic.deployed();
await instance.initialize("0x5f1007A94861275Ca739D1B16ac2fdb673bf2002");
await deployer.deploy(AdminUpgradeability, logic.address, "0x5f1007A94861275Ca739D1B16ac2fdb673bf2002");

thank you


texts: Is there any way to extract transactions in uncles?

texts:
As stated in the wiki:

  Note: An uncle doesn't contain individual transactions.

I would still like to extract transactions from uncle blocks. Is there any method available for doing so?


texts: Is it possible to predefine 'msg.value' when calling a function in an external contract?

texts:
I am new to developing smart contracts and have had some trouble trying to troubleshoot a solution to this problem.
I have two smart contracts...
Contract X: (The bank - Balance 100 ETH)
contract X {
   function transfer(address dest){
     dest.send(msg.value);
   }
}

and...
Contract Y: (The Forwarder - Balance ZERO ETH)
contract Y {
  function < somehow call x.transfer >
  <set x.msg.value to some number ignoring the actual msg.value of the call>
}

Contract X will store some funds and contract Y will be used to call the 'transfer' function of contract X and provide a destination address to transfer funds to. The problem I am having is that I don't know how (or if it is possible) to set the value of 'msg.value' in contract X from the function call in contract Y.
Currently 'msg.value' in contract X is only ever zero since contract Y will not be used to store any funds (besides small amounts of wei for gas).
Does anybody know of a way to parse a specified 'msg.value' over a function call?
Side note: There are more to these contracts although it's not necessary to include them here.
Any help is greatly appreciated!
EDIT:
The desired result would look something like this:
contract Y > contract X:

msg.value for this transaction will be zero (no funds sent from Y to X)
Y will supply dest address for contract X's transfer function
Y will supply msg.value for contract X's transfer function (This is my main isssue)

contract X > Destionation (dest) address:

transfer function will use the msg.value and dest values provided by contract Y above

msg.value will never be zero

I guess the question is really if it is possible to parse a msg.value to the external contract (contract X) to use as the msg.value for X's transfer - that is not the zero msg.value from the the Y to X?


texts: Pending transaction since the last 11 hours

texts: I made an ethereum transfer between two accounts, with gas set to 21000. But the transaction is pending since the last 12 Hours and I cant see any balance being reflected in my recipient account. Please help!


texts: Can Raiden Network transfers occur offline?

texts:
Since Raiden is off-chain, could I theoretically set up some channels among a group of local parties and conduct transactions offline via NFC, bluetooth, wifidirect, etc.?

Since it's off chain and only needs to sync to the blockchain when closing channels is this possible?

Thanks, I'm very new to Raiden and struggling through the documentation to find answers to the questions I have.


texts: Call an existing contract function from truffle console

texts:
Let's suppose an existing Ethereum deployed contract.
I know the deployment Address and i have the contract's source code.
What i want to do is to call a function on this deployed contract from truffle console.
Is it possible and how can i do that ?
Thanks


texts: Does memory operation require no gas at all?

texts:
Does the memory operation require no gas at all?
I knew it was a bit needed. But, memory operations works fine in the view function.

for example,

contract TestContract{

    uint testUint;

    function testFunc() public view returns(uint[]){
        uint[] memory testArr = new uint[](1);
        testArr[0]++;   // This line works fine.
        testUint++;     // This line not works.
        return testArr;
    }
}

Why does the memory operation in the view function works?

I did not speak English well and I got help from translator.
Thank you for your understanding.


texts: Openethereum node syncing at 0.2blk/s despite decent server specs

texts:
I am running an Open Ethereum (ex Parity) node on a quad-core 8GB Ram 500GB ssd ubuntu 20.04 vps. These are my disk's write and read speeds.

I can't understand why my node can download blocks at a speed of 0.2blk/s, even though I have an SSD and quite a fast connection (800mib/s down 600mib/s up)

I start my node by running
./openethereum --mode active --db-compaction ssd --base-path="/media/nodessd/data" --cache-size 1024 --tracing off --pruning fast

Is this normal or is there something I can do about it?
EDIT:
I am looking at my network history and I am seeing that at most the open ethereum client is using at most 1mib/s bandwidth, even if I have much more. Is this caused by some sort of bottleneck or can I change this in some config?


texts: If I create a Distributed App, am I obligated to make that code open source?  I fully appreciate open source is the preferred mode, just curious if I can keep my code proprietary.  Does it matter if it is on a private or public blockchain?


texts:
I've heard arguments both for and against Solidity modifiers.

On the one hand, they make the code very readable, and the intents behind the calls are very clear. On the other, they increase the overall contract size, as the function code is actually inserted inline in place of the _ keyword (as opposed to just calling the function code). Furthermore, since the code is inlined, both the function and the modifier share the same restricted variable stack, which can lead to a Stack Too Deep error if more than a combined total of 16 variables are used.

What do you guys think? Are you with or against the use of modifiers in your code?


texts: Total Unique Addresses Count of Ethereum Classic

texts:
I need to find an API giving the total number of unique addresses used on the Ethereum Classic blockchain.

For example, the following API provides it for Ethereum: https://etherscan.io/chart/address

Is there a similar API for ETC?


texts: Unknown Keystore / Encrypted Wallet Format

texts:
Have a user with a keyfile format that I don't recognize and MEW can't decrypt (obviously). Anyone have any insight on where this came from or what the encryption mechanism is? Sensitive info has been removed:

"encryptedKey": {
  "iv": "somedata",
  "v": 1,
  "iter": 1000,
  "ks": 128,
  "ts": 64,
  "mode": "ccm",
  "adata": "",
  "cipher": "aes",
  "salt": "somedata",
  "ct": "somedata"
}


texts: Distribute ether from contract address to accounts

texts:
I've recently started to play around with solidity and have a question regarding my dapp. Basically, it's the betting site where people can guess the weather forecast (cloudy, sunny, etc) on a specific date. Ex: weather in seattle on March 10th, 2018. Let's say 5 people have bet (0.1 ether each) and one person guessed it right. The winner gets all the money from the rest of 4 people. Now, based on this scenario I assume each person has to send ether to contract address when he/she bets,

function setBettingInfo (string _forecast, string _date) payable returns (bool success) {
    // ... codes

    address(this).transfer(msg.value); // send betting price to contract address
}

and the winners will be evenly distributed with ether from the contract address on March 11th, 2018 when the dapp calls a forecast api to find out what the weather was like on March 10th. Sending ethers winners, I'm trying to use

function transfer(string _forecast, string _date) returns (bool success) {
    // ... code to get the winners
    // Distribute ethers to winners
    for (uint i = 0; i < winners.length; i++) {
        if (contractBalance[address(this)] < value) throw;
        contractBalance[address(this)] -= value;
        winners.account.transfer(value);
    }

    return true;
}

Just wondering if this is a correct approach.

send betting price to contract address
pull result from forecast api and access contract method to find out winners
calculate and evenly distribute ethers from contract to those winner accounts

Help is appreciated!


texts: I want to develop Ethereum miner? what do I need?

texts:
I want to develop Ethereum miner .
do I need to use  "Ethereum" and "geth" ?
can I do it with out Ethereum lab ?
as  I understand miner should has those task :
1-connect to pool
2-getting hashing.
3-calculate hashing with  Gpu .
4.sending back the information to pool again .
5-getting rewards and send it to wallet.
is this what do I need to build miner ?
is it hard or easy ?


texts:
Is there a way to get code that convert ABI to HTML interface ? I found example in multiples apps but can't find the code, lot of dead github.
Apps where I find what I want :
https://abi.hashex.org/
https://oneclickdapp.com/
MyEtherWallet (and probably Mycrypto.com) image below :


texts:
How to hide a function of all but visible to the owner.
For example there is a function:

function freezeAccount(address target, bool freeze)

How to hide it from others.


texts: Web3 how to send ether from client Metamask to contract address native receive function?

texts:
I wonder how can I natively pop-up the MetaMask window to send specific amount of ether as a donation to already defined SC address and ABI?
Short code intro:
pragma solidity >=0.7.0 <0.8.6;
[...]
    receive() external payable minumum_donation_amount(msg.value)  {
        OWNER.transfer(msg.value);
        donated_people[how_many_people_donated+1] = DonatedPeople(msg.sender, block.timestamp, msg.value);
        how_many_people_donated++;
        emit SubscribeDonatedPeople(msg.sender, block.timestamp, msg.value);
    }

    modifier minumum_donation_amount(uint256 amount) {
        require(amount >= 0.0005 ether, "The minumum donation amount is 0.0005 Ether");
        _;
    }
[...]

Successfully getting data from SC to JavaScript console with web3 anonymous function like this:
(function () {
  CONTRACT.methods.donated_people(1).call().then( function( donated ) {
    console.log(donated);
  });
})();

I can send ether by hard coding the SC address and from/to address. However, I would like to get the ether from contract method directly to native receive function which has modifier to minimum amount. From Remix we are calling "Low level interactions" like this:

Any ideas how to achieve the same results in web3 like in Remix? Thanks in advance!


texts: truffle migrate (deploy) fails with gas issues

texts:
I am trying to deploy contracts using truffle framework. I have multiple contracts, all of them are linked appropriately.

Example:

Governance contract is the main contract. There are other individual contracts which are imported and used in Governance contract.

Infrastructure:

1) geth version - 1.6
2) truffle version - 3.3.1

I am using a private chain to deploy a contract.I have purposely set a higher

gas limit in genesis JSON file
    "gasLimit": "900000000000",

While deploying - in truffle.js I have set very high gas limit as

    staging: {
      host: "192.168.100.5",
      port: 8001,   // Different than the default below
      network_id: 1407,
      gas:799999999999
//      gasPrice:1000000000000
     }

In spite of high gas limit, truffle deployment fails with following error. I am not sure how to proceed

Using network 'staging'.

Running migration: 1_initial_migration.js
  Deploying Migrations...
  Migrations: 0x15dce2e6ad79f7d6bc7d40c746b1f9604f7d2566
Saving successful migration to network...
Saving artifacts...
Running migration: 2_deploy_contracts.js
  Deploying Purchase...
  Purchase: 0x2c0b177a1e272a3cc939c8a3d96482e44742e90e
  Deploying SellerWarehouse...
  SellerWarehouse: 0x73f628469da45dd241034c7c1f2bca4236e3cf98
  Deploying AdvisingBankRegistry...
  AdvisingBankRegistry: 0x09b2f07473b578d85945c42cef7d6681a5aa28de
  Deploying IssuingBankRegistry...
  IssuingBankRegistry: 0xa59de5dced25f414be5eb982ed4d52d01349e8b9
  Deploying BuyerRegistry...
  BuyerRegistry: 0x665c371ef610e64035536e812938363044d7c113
  Deploying CarrierRegistry...
  CarrierRegistry: 0x822fd29dfb933a7e2bf2f0710b52bdca4d0ef474
  Deploying Governance...
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: The contract code couldn't be stored, please check your gas amount.
    at Object.callback (/usr/lib/node_modules/truffle/build/cli.bundled.js:204860:46)
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:31793:25
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:206693:9
    at XMLHttpRequest.request.onreadystatechange (/usr/lib/node_modules/truffle/build/cli.bundled.js:205469:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/usr/lib/node_modules/truffle/build/cli.bundled.js:207342:18)
    at XMLHttpRequest._setReadyState (/usr/lib/node_modules/truffle/build/cli.bundled.js:207632:12)
    at XMLHttpRequest._onHttpResponseEnd (/usr/lib/node_modules/truffle/build/cli.bundled.js:207787:12)
    at IncomingMessage.<anonymous> (/usr/lib/node_modules/truffle/build/cli.bundled.js:207747:24)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)


texts: Broadcast transactions to specific miners?

texts:
Is it possible to broadcast transactions specific or a small number of miners?
I believe there is a concept of private transactions, as used to mitigate front running to rescue vulnerable funds for example.


texts: EthereumJS: How to get public key from private key

texts:
I am trying to create a private key and its corresponding public key using EthereumJS library. So far so good I've been able to create private keys using keythereum.create() method. Nevertheless I find myself stuck when dealing with public key.

I heard using Elliptic Curve Digital Signature Algorithm (ECDSA) it is possible to get an Ethereum Public Key (64 bytes long) from its Private Key. The question is how can I code this process using EthereumJS library. Maybe there is some simple method to derive public key, but I cannot find it. Any help will be appreciated.

I found some limited info on previous StackExchange questions but I would prefer an answer focused on EthereumJS:

How are ethereum addresses generated?

Creating keyfile and address from private key

Thanks!


texts: Is it possible to get duplicates of the log events on Ethereum when we have a fork of the chain?

texts:
Let's suppose we have 2 chains of ethereum blockchain. When I fetching contract's log events from x block to getBlockNumber().
Will i get two or one the same log events from each block? Or getBlockNumber returns last block before forking?


texts: I use truffle develop. It seems to me that the accounts in truffle develop are persistent. Pleas correct me if I'm wrong. How can I import the accounts from truffle develop into MetaMask?


texts: Truffle console: assert.equal, how to use exception for testing purposes?

texts:
I want to check the value returned by getName() function:
pragma solidity >= 0.5.0 < 0.7.0;

contract SimpleContract {
  string  public name;
  constructor() public {
     name = 'abs';
  }
  function getName() public view returns(string memory) {
      return (name);
   }
}

I am using using assert.equal(....) in truffle console but it is not printing the message:

truffle(development)> sci = await
SimpleContract.at('0xDa0463c841E7D822f6281240cD7593bA3FD4BB0f');
truffle(development)> await sci.getName();
'abs'
truffle(development)> value = await sci.getName();
undefined

truffle(development)> assert.equal(value, 'abs', "Both are equal");

undefined

truffle(development)>

How can I print the message "Both are equal". On the other hand, assert.equal(...)generates exception when the vales are not equal.How can I use assert.equal(...) in this case, to indicate that values are equal.
Somebody please guide me.
Zulfi.


texts: Should signed text messages use the "\x19Ethereum Signed Message" prefix?

texts:
Background: I want to implement sign message feature in Trezor.

Is there a standard for signing text messages?

So far I found out that etherscan.io signs messages without the prefix, i.e. it signs keccak(msg), but also accepts signatures "with Geth prefix" of keccak("\x19Ethereum Signed Message\n32"+keccak(msg)).  Signed messages of the form keccak("\x19Ethereum Signed Message\n"+strlen(msg)+msg) are not accepted.

MyEtherWallet only accepts messages signed without any prefix.

Without the prefix one can misuse the sign message feature to sign a transaction, though.  Is this intentional?


texts: Accessing events from nodejs: Cannot read property 'on' of undefined

texts:
This is my source code in nodejs:

var Web3 = require('web3');
var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'));
var abi = ...
var contract = new web3.eth.Contract(abi, MAIN_CONTRACT_ID);
contract.events.Evt({fromBlock: 0, toBlock: 'latest'},function () {
}).on('data',function (evt) {
        console.log("evt",evt);
    });

But I get this crash:

TypeError: Cannot read property 'on' of undefined
    at Subscription.subscribe (C:\Users\steve\Dropbox\Projects\dsd\dsd\web3test\node_modules\web3\packages\web3-core-subscriptions\src\subscription.js:199:45)
    at Contract._on (C:\Users\steve\Dropbox\Projects\dsd\dsd\web3test\node_modules\web3\packages\web3-eth-contract\src\index.js:623:18)

contract.Evt is undefined for me, contract is defined and contains contract.events.Evt.

How can I fix this?


texts: Does web3.eth.wallet.create set the newly created wallet file as the 'global' source of addresses for the web3 instance?

texts:
I'm playing about with web3js@1.0.0-beta.55 and I'm setting an HttpProvider on Ganache for my web3 instance:

this.web3Instance = new Web3(new Web3.providers.HttpProvider(environment.ethereum.provider));

I've noticed that if I call this.web3Instance.eth.getAccounts()  it returns the Ganache accounts, as I would've expected.
 However, if I create a new wallet using this.web3Instance.eth.accounts.wallet.create(1);
 and then call getAccounts() again, it returns the address from the newly created wallet file, and not the accounts on my Ethereum node (i.e. Ganache).

I fail to understand why - any insight is appreciated!


texts: TypeError: Expression has to be an lvalue. But before the code was working perfectly!

texts:
I have changed a few things inside the function but the logic is the same still. Now, give an error in the compiler. I am USING TRUFFLE with VSC.

Former function:

function remove(uint ind) internal returns(address[]) {
    delete addressStorage[ind];
    for (uint j = ind; j<addressStorage.length;j++) {
        if (j==addressStorage.length-1) {
            break;
        }else {
            addressStorage[j] = addressStorage[j+1];
        }
    }
    addressStorage.length--;
    return addressStorage;
}

Actual:

function remove(uint ind, address[] array) internal returns(address[]) {
    delete array[ind];
    for (uint j = ind; j<array.length;j++) {
        if (j==array.length-1) {
            break;
        }else {
            array[j] = array[j+1];
        }
    }
    array.length--;
    return array;
}

Getting:

TypeError: Expression has to be an lvalue.
        array.length--;
        ^----------^

Any ideas? Thanks!


texts: What is the Relation between "Ether" and "ETH"? (or: What to do with farmed "ether"?)

texts:
Over the weekend i let my gaming PC running with "ethminer" all the time using my GPU.

When i checked my ballance on sunday evening using geth it showed me "85 ether":

$ geth attach
> web3.fromWei(eth.getBalance(eth.coinbase), "ether")
> 85

Some hours later it was increasing until 105. But in public explorer (https://etherscan.io) it was already 0 ETH.

What can i do with this "ether"? I guess it has nothing to do with ETH as the ethereum currency as i would be rich then in upcoming days.

How is the relation between "ether" and "ETH"?

Update:

Today the balance turned down to Zero (i did nothing).


texts: Gas + balance invariant not maintained on simple contract call

texts:
In order to understand reentrancy attacks, I'm using the following Honeypot contract:

pragma solidity ^0.4.17;

/// @title ReentrancyPot - A contract vulnerable to reentrancy
contract ReentrancyPot {
    mapping (address => uint) public balances;

    /// @dev Constructor.
    function ReentrancyPot() public payable {
        deposit();
    }

    /// @dev Deposit money into the contract
    function deposit() public payable {
        balances[msg.sender] = msg.value;
    }

    /// @dev Receive payments
    function withdraw() public {
        if (!msg.sender.call.value(balances[msg.sender])()) {
            throw;
        }
        balances[msg.sender] = 0;
    }
}

I'm running the following tests using truffle test with the first assertion passing but the second not passing. It seems that this would break obvious contract + gas invariants. Can you help me understand what may be going wrong here?

var ReentrancyPot = artifacts.require("./ReentrancyPot.sol");
var Web3 = require('web3');
var web3 = new Web3(Web3.givenProvider || 'ws://localhost:8545');
var BN = web3.utils.BN;

require('chai')
 .use(require('chai-as-promised'))
 .should();

contract('ReentrancyPot', function(accounts) {
    it("pot should support deposits and withdrawals", async () => {
        let pot = await ReentrancyPot.deployed();
        let depositAmount = web3.utils.toWei('0.001', 'ether');
        let address = pot.address
        let gasPrice = web3.utils.toBN(await web3.eth.getGasPrice());

        let startingBalance = web3.utils.toBN(await web3.eth.getBalance(accounts[0]));
        let startingBalanceContract = web3.utils.toBN(await web3.eth.getBalance(address));

        let result = await pot.deposit({from: accounts[0], value: depositAmount});
        let gasUsed1 = web3.utils.toBN(result.receipt.gasUsed);

        let endingBalance = web3.utils.toBN(await web3.eth.getBalance(accounts[0]));
        let endingBalanceContract = web3.utils.toBN(await web3.eth.getBalance(address));

        endingBalanceContract
            .sub(startingBalanceContract)
            .toString()
            .should.equal(depositAmount);

        endingBalance
            .add(web3.utils.toBN(depositAmount))
            .add(gasUsed1.mul(gasPrice))
            .toString()
            .should.equal(startingBalance.toString());
    })
})


texts: Eth 2 staking - Required mainet recent blocks

texts:
How many recent ethereum 1 mainet blocks does ethereum 2 staking clients need?
I am syncing eth 1 mainet with OpenEthereum (Parity) and saw that I could change the --warp-barrier to 11500000 which is around 40000 blocks from the most recent block.
Also are the states stored from 'warp-sync' smaller than not using warp? In that case it would be beneficial to every now and then resync with warp set to the recent blocks so you can save space.


texts: Is there anyway to contact EthCore to have the password on my Vault reset?  I could certainly be wrong here, but I dont think the Vault of part of the decentralized network or encrypted to any large degree.  Within my vault is my parity wallet which contains my ETH.  My apple icloud password was inadvertenly overwritten with the wrong password and Apple has no way to access a list of previous passwords.


texts: The Ethereum roadmap makes no mention about when to expect a light client. Anyone has any insights on when we could expect to see a light client that could efficiently run on, say, an Android device?


texts: How can I store data in ethereum blockchain

texts:
I want to store pdf hash in blockchain
I already read this post What are some proposed ways of storing data in Ethereum?
But I'm beginner in this domain and I don't understand...
Is it possible to store data (hash in my case) in Ethereum?

How many cost to store data in Ethereum? And how can I do this with python or an other language?


texts:
I'm following this very simple web3 tutorial and Event.watch doesn't seem to fire when I click the button.

I can't figure it out.

Can someone please help?

pragma solidity ^0.4.18;

contract Coursetro {

   string fName;
   uint age;

   event Instructor(
       string name,
       uint age
    );

   function setInstructor(string _fName, uint _age) public {
       fName = _fName;
       age = _age;
       Instructor(_fName, _age);
   }
}

and then JS:

var instructorEvent = Coursetro.Instructor();
instructorEvent.watch(function(error, result){
  alert(1);
});
$("#button").click(function() {
  Coursetro.setInstructor('a', 1);
});

alert never happens.


texts: Geth list all javascript commands inside console

texts:
Need to know every single js console command inside geth like eth.syncing, eth.accounts etc...

Can anyone brief into this?


texts: How to store a float or decimal in a contract?

texts:
I want to store the purchase price of a digital asset within the contract and then allow a user to purchase it. I have the following struct with some demo hard coded values but using a uint for the purchasePrice field isn't working

Asset memory _asset = Land({
                geoPoint1: 'ldsfsdfsdf',
                geoPoint2: 'ldsfsdfsdf',
                geoPoint3: 'ldsfsdfsdf',
                geoPoint4: 'ldsfsdfsdf',
                creationTime: uint64(now),
                itemdemo: 100000,
                purchasePrice: 1.20
            });


texts: Bad jump array solidity and data location

texts:
I'm having a strange issues with an array inside a struct. I will copy you the example code, so that you can understand:

  Foo[] public foos;

  struct Foo {
    uint fooX;
    uint[] fooArray;
  }

  function insertionSort(uint[] a)internal {
   for (uint i = 1;i < a.length;i++){
    uint temp = a[i];
    uint j;
    for (j = i -1; j >= 0 && temp < a[j]; j--)
      a[j+1] = a[j];
    a[j + 1] = temp;
   }
  }

  function doesntWork(uint num,uint _id){
    Foo f = foos[_id];
    f.fooArray[f.fooArray.length++] = nun;
    instertionSort(f.fooArray);
  }

  function work1(uit _id){
    Foo f = foos[_id];
    instertionSort(f.fooArray);
  }

  function work2(uint price,uint pair_id){
    Foo p = pairs[pair_id];
    p.boPrices[p.boPrices.length++] = price;
  }

Whenever I am trying to call the insertionSort function on an array, it doesn't work # method 1.

The same function works, when I don't modify the array before hand (as shown in example 2,3).

As my goal is to keep my array sorted after every new value is added it's a problem.

I think it has to do something with the storage of my arrays. But I am having trouble grasping those concept of Data location, and how to fix it.

Does a workaround exist there?

Edit: also does the same with this quickstort


texts: What is the difference between Truffle and Remix?

texts:
Please list the differences between Truffle and Remix.

Where is the use of both applicable? Can somebody list this using an example?


texts:
I am starting a project that I need to build a solution to track products (ex: from farm until it gets to the supermarket)

Basically, I need to set up a blockchain structure for my company(private) and put values in there.

Problems: In my research time (about 1 week) I could not found a variety of examples using the blockchain to store objects, the vast majority is about coins. I am studying about Solidity syntax, EVM, web3-js, Ethereum in general with a lot of tutorials.

In other words: I want to insert objects in the blockchain, like company1, company2, person1, person2. Where is it stored? If this is possible, how can I do a SELECT * FROM Persons table Companies and list all companies?

Could any of you guys help me out pointing me to some straightforward tutorial or something helpful?

Ref to tutorials done:

Ethereum Tutorial: Sending Transaction via NodeJS Backend

Get started with Ethereum & Solidity on Windows – Wesley van Heije – Medium

Understanding contracts

Interacting with a Smart Contract through Web3.js (Tutorial)

Understanding Solidity:

Understanding contracts

- now - Building A Private Blockchain Network

Among others...
Thanks in advance!


texts: How to execute Transaction without unlocking Account from Web3 UI

texts: I am working on App that will be deployed in private blockchain. For testing I used to unlock my Account from Geth console to overcome 'could not unlock signer account'. However there is a risk of someone else can connect node and execute transaction if I unlock Account (no matter how short unlock Account duration is). How do I execute transaction without unlocking Account. Can I send password with every transaction?


texts: Convert BIP-39 mnemonic to Ethereum private key in Python

texts:
How do I convert a BIP-39 mnemonic to an Ethereum private key in Python (via BIP-44 key derivation)? All the libraries I found that gave me the intended result depend on the two1 package, which conflicts with modern versions of requests, which is a non-starter.

I found https://github.com/vergl4s/ethereum-mnemonic-utils/, which produces a private key, but it's incorrect (or at least it does not match what is derived by https://iancoleman.io/bip39/ and the truffle-hdwallet-provider node packages).


texts: Sending transaction directly to miner on private network?

texts:
I am trying to understand how one node can send a transaction to another node (miner or full) directly rather than waiting P2P network to distribute it?
Say I have two non-miner nodes A and B and one miner to C on a private network.
  B
 / \
A   C

Is it possible to send a transaction to the miner directly?


texts: Smart contract's function work on testnet but don't work on private network

texts:
I have been created a smart contract (ERC20 implantation). The contract run great om testrpc, ropsten and rinkeby but i want to use it in a private network.
When the contract deployed in the private network some of the functions get the "Gas requirement of function  high: infinite in remix" warning and when i try to communicate with the contract the transaction always fails.
Is there a reason that a contract will work perfectly on one network but not on the other? I set a very high "gasLimit" in my genesis block

Private network genesis file:

{
"config": {
"chainId": 51190,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},

"alloc"      : {},
"coinbase"   : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x400",
"extraData"  : "",
"gasLimit"   : "0xffffd8",
"nonce"      : "0x0000000000000042",
"mixhash"    :
"0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" :
"0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp"  : "0x00"
}

Solidity code:

myToken.sol:

constructor (address _interfaceData)
  public
  {
   interfaceData = DataContract(_interfaceData);
  }

function transfer(address _to, uint256 _value) public returns (bool) {
    if (interfaceData.isTransferWhitelistOnly()) {
      require(isUserAllowedToTransfer(msg.sender));
    }
    return super.transfer(_to, _value);
 }

BasicToken.sol:

function transfer(address _to, uint256 _value) public returns (bool) {
    require(_to != address(0));
    require(_value <= balances[msg.sender]);
    balances[msg.sender] = balances[msg.sender].sub(_value);
    balances[_to] = balances[_to].add(_value);
    emit Transfer(msg.sender, _to, _value);
    return true;
}

DataContract.sol:

bool public isTransferWhitelistOnly;

Any help will be appreciated


texts: Is there any command-line tool to sign transactions offline on a Linux machine?

texts:
I have an air-gapped machine with Ubuntu Server. Is there any command line tool which I can quickly download to sign offline transactions? Something like:

sign-tx private_key_file nonce=10 gasPrice=... gasLimit=... to=... value=... data=... chainId=1

This would output the signed transaction in hex.


texts: Using a variable in an encrypted Oraclize nested query?

texts:
I have the following Oraclize query which works (generates a random number between 1 and 5, with the API key encrypted):

oraclize_query(1, "nested", "[URL] ['json(https://api.random.org/json-rpc/1/invoke).result.random.data.0', '\\n{\"jsonrpc\":\"2.0\",\"method\":\"generateIntegers\",\"params\":{\"apiKey\":\"${[decrypt] BA3g1TNRkJ0lqv18s+v3chf2FoZEzUXuyhOUWCcoBDKrmv51clDqUvw36lLEDJizgDrCyX7GREX7YVOfctHAT/lhLiTZNQFNjw11mq/y9mJ2gXKWw+EP/13AUnvvtDcjLek7KaBsYxk2qYuKn78Nt+EAasij}\",\"n\":1,\"min\":1,\"max\":5,\"replacement\":true${[identity] \"}\"},\"id\":1${[identity] \"}\"}']");

If I have a uint number variable, I want to be able to use this in the above query (as the 'max' value). Per Simplest way to use a variable in an Oraclize query? this is done with the strConcat and uint2str functions in the Oraclize contract. I got this working when the oraclize_query isn't nested and the API key isn't encrypted, but can't seem to get it working with the above nested query with the API key encrypted.

This is what I've tried:

string string1 = '\\n{\"jsonrpc\":\"2.0\",\"method\":\"generateIntegers\",\"params\":{\"apiKey\":\"${[decrypt] BA3g1TNRkJ0lqv18s+v3chf2FoZEzUXuyhOUWCcoBDKrmv51clDqUvw36lLEDJizgDrCyX7GREX7YVOfctHAT/lhLiTZNQFNjw11mq/y9mJ2gXKWw+EP/13AUnvvtDcjLek7KaBsYxk2qYuKn78Nt+EAasij}\",\"n\":1,\"min\":1,\"max\":';

uint number = 5;

string string3 = ',\"replacement\":true${[identity] \"}\"},\"id\":1${[identity] \"}\"}';

oraclize_query(1, "nested", "[URL] ['json(https://api.random.org/json-rpc/1/invoke).result.random.data.0', strConcat(string1, uint2str(number), string3)]");

When testing this I'm using a new encrypted API key each time.


texts: Chainlink not updating variables in Ethereum Smart Contract

texts:
I am having a strange thing occuring on kovan network. I am running a smart contract calling my chainlink oracle to request some information. My chainlink oracle responds correctly with the expected information. The smart contract calls the fulfill function but it does not set the value heartRateMinutes. Any calls to it returns a 0. The expected value should be 67. Value is set to public so it should be seen.  They also have the same size of uint256. The value is a whole integer number.

It is weird because the chainlink run job shows all green and no errors.


texts: Which Wallets Support Login With MetaMask Concept?

texts:
I'm building an exchange service where I have all users deposit ETH and ECR20 tokens to a single Ethereum address (In order to avoid complications of having to consolidate funds & paying extra gas fees to transfer/forward each deposit to a main account when using 1 deposit address per user). In order to efficiently track user deposits and credit the right user for his deposit each user will be forced to first "link" their external wallet to their wallet account on our platform. Once they link their wallet to their account I can credit any deposits made from the external wallet address to the owner of the account. I believe Cryptokitties uses a similar concept.
However, I don't want to force all users to have a MetaMask account in order to use our service so I'm interested in knowing what other wallets/services support Login With MetaMask concept? I'm looking for a broad spectrum of services that support this concept so that ours users would be a able to deposit ETH + ECR20 tokens regardless of where they choose to hold/store their coins..
Thanks


texts: Is there a website like etherscripter.com, for Solidity?

texts: Is there a Scratch website available for the Solidity language? The only one I could find was Etherscripter.com however that one is only for Serpent.


texts: send VS call - differences and when to use and when not to use

texts:
Can somebody please explain the differences between using a send and call for contracts and when to use and not use these different methods?

For example :

   msg.sender.send(number);
   msg.sender.call.value(number)();

I know that send uses 2300 gas and that using call does not use any gas.


texts: Why push elements into struct arrays Error

texts:
contract MyContract {
struct Posposal{
    uint posposalId;//
    bytes1 description_;//
    uint userId;//
    uint amount;//
    address voteSponsorAddr;//

}
Posposal[] public curPosposals; //当前提议投票记录
uint public posposalNextId=0;// 标识投票建议递增

function MyContract() {

}
uint public expId;
address public expTarget;
string public expDes;
function issuse(uint userId,address target_,uint amount_,string description_)  {
    expId=userId;
    expTarget=target_;
    expDes=description_;
    curPosposals.push(Posposal(posposalNextId,0x00,userId,amount_,msg.sender));//
    posposalNextId++;
}}

When I deploy this contract, and invoke function issue (pass params 1,0x7812b816a427974Ca61d56c7a7CfAaa011bb2351,1000,"transfer 100"), the transaction perform successfully. The variant expId,expTarget,expDes could get the right value, but curPosposals[0] is wrong? why?                                                                                After several trials, when move bytes1 description_; to the last position, it works.


texts: Get hash transaction by your encode input data

texts:
In my application i must follow the use case:

I need to record any document hash on the Ropsten (eth testnet) blockchain. The hash is unique and i'm using a mapping in my smart contract to accomplish this. Got no problem with that.

Since the hash is unique, if the user tries to put an already document hash registered on the blockchain, he will get a treated catch error by me. At this moment, below the treated message, I want to show the hash of the transaction that has the document hash already registered.

If it is possible, maybe i will have to encode the document hash to match with the encode input data of transaction.

I know how to get a transaction data by his hash transaction (getTransaction(txHash, callback)).

The question is: Is there another way to get a transaction datas other than by his own hash (txHash)?

Currently i'm using web3js 1.0.0 for eth client.

Sorry for my bad english :|

EDIT:

Here is what i'm thinking to do.

In my case, if the document hash already was registered in the input data field of transaction, i want to show the transaction hash.

So to begin, a little test is get a transaction list of a block. I'm passing each tx hash to (getTransaction(txHash, callback)), but i'm facing a problem that i can't get the callback of getTransaction.

My code:

async function getInputTransaction(tx) {
    web3.eth.getTransaction(tx, function(err, cb){
        console.log('got here');
        let decodeInput = web3.utils.hexToAscii(cb.input);
        decodeInput = decodeInput.split("_").pop();
        if(!err){
            console.log(cb);
            console.error('\nInput decoded: ' + '\u001b[1;32m' + decodeInput + '\u001b[0m');
        }else{
            console.error('error: ' + error);
    }}
    )
}

var tx;

web3.eth.getBlock(6339515, function(err, result){
    for(var i = 0; i <= result.transactions.length; i++){
        tx = result.transactions[i];
        getInputTransaction(tx).
        then(function() {
        })
        .catch(function(error) {
            console.log('error: \n' + error);
        });
    }
})

When i debug, the callback "cb" is not been triggered.


texts: Returning byte[64] from a function works in TestRPC not in Geth

texts:
I have a smart contract which is returning a byte[64] array. In testrpc I get the correct array but in Geth I am getting array with all "0x".

Here is the smart contract code:

pragma solidity ^0.4.18;

contract DataStore
{
    function stringToBytes32(string memory source) returns (bytes32 result) {
        assembly {
            result := mload(add(source, 32))
        }
    }

    function DataStore()
    {
    }

    function str_to_bytes(string str) constant returns (byte[64]){
        bytes memory b = bytes(str);
        byte[64] final_str;
        for(uint i; i<b.length; i++){
            final_str[i] = b[i];
        }

        return final_str;
    }

    function getValue() public returns (byte[64])
    {
        return str_to_bytes("sasdasdasdasdasdasd");
    }
}

The output of the getValue() function is in-correct in Geth but is correct in TestRPC.

Any idea why this is happening?


texts:
I ran Geth today for the first time. While it was running, I researched how to use fast mode. It turned out that I would have to restart it.
So I closed the terminal and restarted Geth in a new instance of the terminal with the fast option enable.
Now however, I get this error each time I try:

INFO [09-25|18:11:00] Starting P2P networking
Fatal: Error starting protocol stack: listen udp :30303: bind: address already in use


texts: Parity configuration for rinkeby testnet

texts:
Can someone provide me an genesis block configuration json for Parity client here is my setup described:

I've installed the client (version: Parity/v1.6.8-beta-c396229-20170608/x86_64-linux-gnu/rustc1.17.0). Converted my rinkeby genesis block config using this as input:www.rinkeby.io/rinkeby.json and using this tool mentioned on the github wiki page: https://github.com/keorn/parity-spec. Which resulted in this config file: https://gist.github.com/kgcorps/3b67338bc5ea204372f993ed25389e88

When trying to start parity with the following command:

parity --chain=res.json --bootnodes=enode://a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf@52.169.42.101:30303 --identity=foobar --datadir=$HOME/.rinkebyParity

I have hunch I've made stupid mistake somewhere with the config conversion. The source config is good to go since I've used it with geth without any problems.

Thanks for any tips

Edit
As far as I understand parity doesn't support ProofOfAuthority algorithm, does this mean that it is impossible to use parity with rinkeby testnet?


texts: How many ethers have been drained through the recursive call attacks on The DAO?

texts:
The recursive call attacks on The DAO have now stopped as there are no more ethers in The DAO account.

What are the amounts and percentages that can be attributed to the hostile and friendly attacks, and to the normal split proposals.


texts: What email address were pre-sale wallets sent from?

texts: What was the email address that wallets from the pre-sale were sent from?  This is the email that would contain the ethereum_wallet_backup.json file.


texts: Fix MetaMask gas price estimate on Ropsten

texts:
Update: For some reason, just redeploying with truffle migrate --network ropsten --compile-all fixed the issue, and MetaMask now suggests Gwei.

After deleting build/contracts dir, I deployed my Smart Contract to Ropsten with:

truffle migrate --network ropsten --reset --compile-all

and the following in truffle.js config:

networks: {
  [...],
  ropsten: {
    provider: new HDWalletProvider(mnemonic, "https://ropsten.infura.io/"+infura_apikey),
    network_id: 3,
    gas: 4500000, // Current Ropsten gas limit. See https://ropsten.etherscan.io/block/3141628
    gasPrice: 1100000000 // 1.1 GWei - based on the lower end of current txs getting into blocks currently on Ropsten.
  }
}
solc: {
  optimizer: {
    enabled: false,
    runs: 500
  }
}

Everything works fine on my local Ganache. But deployed to Ropsten, MetaMask always prefills transactions with Gas Price: 0

How can I fix the gas price estimation for MetaMask?

PS. Transaction works fine if I manually set the gas price in the MetaMask dialog. But it's a really ugly user experience.


texts: What are Ethereum Tokens and what applications is it geared towards?

texts:
I'm new to Ethereum and I'm not sure how tokens are meant to be used -- specifically, ECR 20 tokens.
I'm looking at an example here:
pragma solidity ^0.5.10;

contract Token {
    // An `address` is comparable to an email address - it's used to identify an account on Ethereum.
    // Addresses can represent a smart contract or an external (user) accounts.
    // Learn more: https://solidity.readthedocs.io/en/v0.5.10/types.html#address
    address public owner;

    // A `mapping` is essentially a hash table data structure.
    // This `mapping` assigns an unsigned integer (the token balance) to an address (the token holder).
    // Learn more: https://solidity.readthedocs.io/en/v0.5.10/types.html#mapping-types
    mapping (address => uint) public balances;

    // Events allow for logging of activity on the blockchain.
    // Ethereum clients can listen for events in order to react to contract state changes.
    // Learn more: https://solidity.readthedocs.io/en/v0.5.10/contracts.html#events
    event Transfer(address from, address to, uint amount);

    // Initializes the contract's data, setting the `owner`
    // to the address of the contract creator.
    constructor() public {
        // All smart contracts rely on external transactions to trigger its functions.
        // `msg` is a global variable that includes relevant data on the given transaction,
        // such as the address of the sender and the ETH value included in the transaction.
        // Learn more: https://solidity.readthedocs.io/en/v0.5.10/units-and-global-variables.html#block-and-transaction-properties
        owner = msg.sender;
    }

    // Creates an amount of new tokens and sends them to an address.
    function mint(address receiver, uint amount) public {
        // `require` is a control structure used to enforce certain conditions.
        // If a `require` statement evaluates to `false`, an exception is triggered,
        // which reverts all changes made to the state during the current call.
        // Learn more: https://solidity.readthedocs.io/en/v0.5.10/control-structures.html#error-handling-assert-require-revert-and-exceptions

        // Only the contract owner can call this function
        require(msg.sender == owner, "You are not the owner.");

        // Ensures a maximum amount of tokens
        require(amount < 1e60, "Maximum issuance succeeded");

        // Increases the balance of `receiver` by `amount`
        balances[receiver] += amount;
    }

    // Sends an amount of existing tokens from any caller to an address.
    function transfer(address receiver, uint amount) public {
        // The sender must have enough tokens to send
        require(amount <= balances[msg.sender], "Insufficient balance.");

        // Adjusts token balances of the two addresses
        balances[msg.sender] -= amount;
        balances[receiver] += amount;

        // Emits the event defined earlier
        emit Transfer(msg.sender, receiver, amount);
    }
}

The way I see it, tokens are a fungible commodity -- i.e, an asset, like bitcoin, ether, or real money.
I can see a potential application of it in a gaming scenario: win more points, get some tokens.
So is it really this simple? Just a glorified contract with a mapping of address => uint and some related functions?
If so, what are some other domains where this can model can be readily applied?


texts:
I am trying to buy PPT on EtherDelta but have done something wrong and wonder if it can be reversed.

I successfully transferred ETH from MetaMask to EtherDelta. When I tried to buy PPT, I accidently transferred my ETH from the Deposit column into the Transfer column.  Can I transfer the ETH back into the Deposit column, and what do I do then in order to buy PPT?

Thanks in advance for any help you can give. Please keep it simple as I am not familiar with a lot of the jargon and need step by step instructions.


texts: Unable to install Truffle - Command Not Found

texts:
I am unable to install Truflle on my Windows 10. I am running latest versions of npm and node. I have tried uninstalling and then reinstalling but it still doesn't work.

I have installed Truffle using the command

  npm install -g truffle

Here is the Screenshot


texts:
Etherchain provides the source code of the qtminer on github. However, no build instructions and no build helpers are provided.

Does anyone have any idea how to compile qtminer on linux? What are the dependencies? It looks like you need to embedd it somehow in the whole cpp-ethereum suite.

Is it still possible to build it myself? The binaries on the net are windows only.


texts: Signed attestations to authorize a transaction in a smart contract

texts:
I'm struggling with a solution where we have a smart contract C with aggregate funds of many users and an off-chain system actually knowing the balance of every user.
So while all the funds are in C, the balance for every user is managed off-chain, say in a mysql db hosted by Bob. The idea is that as a user Alice, if she wants to withdraw her holdings from C, she have to get from the Bob an attestation saying "pay to Alice the sum of N"--signed by Bob.
Bob will update the balance in the db and the contract C will authorize the pulling of funds. The idea is to have multiple off-chain transactions between Bob and Alice and a final settlement transaction to cashout signed by Alice but cointaining an attestation signed by Bob. Of course this is not a decentralized L2 solution per se', nevertheless it provides some scalability provided that Bob doesn't want to send funds from his wallet, but he prefers Alice to withdraw (paying the gas)
I wonder if there is a working example somewhere of a solution like this one. It would be useful as validation of the idea.


texts:
I know this question has been already asked many times, but I haven't got any satisfiable answer and so asking here.

I want to create an Authentication system dApp using reactjs. The user is having geth accounts and keyphrase with him. Now, using his account address and keyphrase, I want him to login to my dApp dashboard, do some stuff and then logout.

I need a proper guidance or some references to the tutorials about how to proceed with this.

What I found till now is:

using web3.eth.accounts.sign(address, private_key) during Login. And, it requires private_key, I want to know how to retrieve it from geth keystore.
calling personal.unlockAccount(address, keyphrase) during Login and then calling personal.lockAccount() during Logout.

Which approach to use?

Any suggestions/references would be appreciated!


texts: Transfer DAO's from Myetherwallet to Kraken

texts:
I'm trying to transfer some DAO's from Myetherwallet.com to Kraken.
I've followed instructions to access my funds through Myetherwallet:
-Pasted "to" address (already active in Kraken),
-Introduced amount (10% of my total amount),
-Generated transaction,
-Pressed "Send transaction" and "YEs I'm sure..."
but system responds: "Account does not exist or account balance too low"

Seems sure that account exist
and for sure I'm sending a fraction of the total amount od DAO's in Myetherwallet account.

So, anybody knows why I'm not allowed to transfer DAO's


texts: What would happen if too many people would call functions of a smart contract at the same time?

texts:
As a thought experiment, what would happen in the event too many persons would like to interact with many functions of a smart contract at the same time?

For example, could you approximate the max number of payable (with a message and some required value) function calls per hour for a small function of 4 lines of code? Would that simply be the time to mine a block, independently of the length gas price of the function?

Thanks!


texts: Why does Ropsten faucet show "Your account is grey listed for 0 hours and 0 minutes"?

texts: I am requesting test ether from a Ropsten faucet, but it is showing an error. Please help me to resolve this error.


texts: What's the bottleneck for openethereum slow sync speed?

texts:
I'm trying to sync a full node with --trace on, on some fast hardware, and I still get slow sync speeds (Syncing #5409141 0x5994…6a98 16.60 blk/s 1527.2 tx/s 91.8 Mgas/s). It's hovering between 10-15 blk/s for a while now.
I'm running the following flags "--tracing=on --cache-size=64000 --num-verifiers=16" (note I tried both with and without --num-verifiers, same thing)
This is running on a ryzen7 3700 with 128gb of RAM and 1TB pcie4 NVME hdd, on a fresh Linux install (debian). The most annoying thing is that I can't seem to figure out where the bottleneck is. It's only using 1-2 cores fully, and spawns a couple more processes from time to time. Most of the time, though, the cpu sits idle. Iotop doesn't show anything spectacular in terms of iops, and in any case the nvme should breeze through a ton of reads/writes. I'm kinda stuck.
Am I doing something wrong? Could I speed-up the process?


texts: Blockchain Consenus Protocols Comparison

texts:
Good day community, I do not know if this is the best place to ask as this is the Ethereum Stack Exchange, if not, please let me know. Thank you.
I am currently busy with a Master's Project and really need some help by someone who knows a bit more about blockchain consensus protocols than me. I am comparing these different blockchain consensus protocols against each other with different KPI's.
Here are the different KPI's considered with a short explanantion:
Finality – the assurance that when a cryptocurrency transaction is made on the blockchain, the transaction cannot be altered, reversed or cancedled after completion. This is either absolute/immediate, probabalistic or any other "custom" way.
Fault Tolerance –  Adversary Fault tolerance is how much of the networks nodes may be down or malicious while the network still stays valid.
Power Consumption – Power consumption in the blockchain space relates to how much power is needed for a blockchain transaction to be added to the network. Power consumption is measured in kWh per transaction.
Scalability – Scalability of blockchains are measured in transactions per seconds. This is an indication on how much transactions can be processed per second on the blockchain network.
Application – The application indicator used in this project is refereed to which type of blockchain network is used. This is either a public blockchain or  a private permissioned one.
Speed – The speed of the blockchain network in relation to this project is the time it takes for a transaction to be sent and received by two users of the network. This is a relative measure.
Transaction Cost – Transaction cost is very self-explanatory.
Complexity – Complexity of a blockchain is a measure of how much hardware and software requirements are needed in order for the network to work and be of use. This indicatoir can not be physically measured but is rather a relative measure across all the blockchain networks present in this project.
As I said, I am not so experienced in this sector of the field yet and thus would love if someone would point out any errors I have made thusfar. The following table that I will share is the comparison table.
This is the format of the Table and I will do each consensus protocol with the details I know of like this:

Format:
Name
Finality
Adversary Fault tolerance
Power Consumption
Scalability
Application
Speed
Transaction Cost
Complexity
Type
Token
Example of use

Here we GO

PoW
Probabilistic
<=25%
Large
High
Public
Low to Medium(10 min maar ether is 30 sec)
High
Medium
Permissionless
Yes
Bitcoin, Ethereum

PoS
Probabilistic
Algorithm dependent
Medium to low
High
Both
High
Medium
Medium
Both
Yes
Ethereum

DPoS
Probabilistic

High
Both
High

Yes
EOS

PoA (Activity)
Probabilistic

Decred, Espers

PoL (Location)
Probabilistic

Permissioned
Yes
FOAM, Platin,Animist

PoI (Importance)

Yes
NEM

PoET
Probabilistic

Medium
High

High
Permissioned
No
InelLedger/ Hyperledger Sawtooth

PBFT
Absolute/ Immediate
<=33%

Low

High

Permissioned
No
Hyperledger
/Zilliqa

DBFT
Absolute/ Immediate
<=33%

Low

High

Permissioned
No
NEO

FBFT (Ripple)
Absolute/ Immediate
<=33%
Low
High
Both
High
Low
Medium
Permissioned
No
Ripple, Stellar

NON BLOCKCHAINS

DAG
Probabilistic

NON-blockchain public
High

Permissioned

IOTA

ABFT

NON-blockchain public
Very High

Permissioned

Hashgraph

So the question is
I know this is quite a lot, I appreciate any help.The open lines are that in which I do not know the answers to. Would you please aid in helping me fill in the missing spots, as I cannot with 100% confidence say my answers are correct? Note: I will edit and update these fields as I find more information on the topic as well.


texts: Transfer token from smart contract to 2 EOA addresses

texts:
There is an escrow smart contact which at the end needs to send the escrow balance back to both seller and buyer. Here is the contract (without all the details)
pragme ^0.7.0;

interface ERC20Token {...};

contract MyEscrow {
  address payable seller;
  address payable buyer;
  uint256 sellerRefund;
  uint256 buyerRefund;
  address addressToken;

  function depositEscrow(uint256 _amount) external returns (bool) {
    ERC20Token(addressToken).transferFrom(msg.sender, address(this), _amount);  //<<==msg.sender approved before calling depositEscrow()
    //do something else
  }

  function refundEscrow() sellerOnly external returns (bool) {
      ERC20Token(addressToken).transfer(seller, sellerRefund);
      ERC20Token(addressToken).transfer(buyer, buyerRefund);
      //do something
  }

}

Before putting the code into test, is the refundEscrow going to work as expected? Here is the example online which only sends refund to msg.sender. In the code above, the difference is that refund is sent to 2 recipients instead.


texts:
If I create my wallet / accounts client-side with web3.eth.accounts how can I "publish" them on my local node?

For example, I want to send some ether with an eth faucet to the first created account.

I'm using geth 1.6.7. In theory I can send few ether without pay for the gas, but I can't. 1.6.7 release


texts: How can I use swarm with metamask or parity node?

texts: I want to use swarm, but I wan't to download the all blockchain data. Is it possible to use metamask or  parity node instead?


texts:
my transaction from ledger wallet to my binance wallet has been pending for 7hours now.
I guess I haven't set up enough fees for the transaction.
https://etherscan.io/tx/0x05bf67b361708b43f90e3ebb1154b96923a2614998e8bf2eddbe2a1b511cf18d

Should I wait again ? Or do I have the option to speed up this ?
If some has a way forward to propose I take it


texts: Accepting Dai or an any ERC20 token as a payment

texts:
I have created an ERC20 token and want to make it payable with DAI.

I read some of the related questions but did not found any proper answer.

As dai is an ERC20 token so, how can I accept any token as payment instead of ether?

function () external payable {}

this accepts only ether, right?

sorry in advance for my English and little understanding of solidity


texts: contract.method.getData getData is undefined

texts:
When I use contract.method.getData(params) it throws an error
getData is undefined. I searched on github and saw someone used request
instead, and I used contract.method.request and it has successed!

Why getData is undefined with web3.js@0.20.1 and geth Version: 1.7.3-stable?


texts: NetworkError when attempting to fetch resource. Resource URL: moz-extension://2.../contentscript.js Source Map URL: ../sourcemaps/contentscript.js.map

texts:
I get the following error message in Firefox Developer Tools Console following a successful sendTransaction:

  "Source map error: TypeError: NetworkError when attempting to fetch
  resource. Resource URL: moz-extension://2e34.../contentscript.js
  Source Map URL: ../sourcemaps/contentscript.js.map"

The callback should return the Transaction Hash and the section of code is:

var ContractName = ContractNameContract.at('address hash');
         console.log(ContractNameContract);

     $("#button").click(function() {
         ContractName.instigatorpay.sendTransaction({from:web3.eth.accounts[0], to:'0x4...', value: 200000000000000000, gas    :3000000}, function(error, result){

            if(!error){
                 console.log(result);
     } else {
     console.error(error);
 }
 });

     });"

The console.log(ContractNameContract); appears in the Console Log and if I type the Transaction Hash manually into web3.eth.getTransaction(...) I can get the details in the Console Log, it's just getting the Transaction Hash that seems to be the difficulty? I'm sure it's something very simple that I'm doing wrong but any help would be very welcome.


texts: How to start geth for whisper only without blockchain stuff?

texts:
I'm writing a chat app on top of Whisper; the app is supposed to manage the lifecycle of the Ethereum node.

One way to build to is to use wnode in the background & communicate with it using stdout/stdin programmatically. However, I prefer to use the web3.shh API so I need an Ethereum/Whisper client that provides the RPC interface beside Whisper stuff.

geth seems to fit. However, it seems to, by default, start blockchain stuff & other stuff while I only need it for Whisper. So:

1- How to start geth such that it provides absolutely zero blockchain stuff & only whisper stuff (+rpc)?

2- How to get it to be a bootstrap node for whisper & retrieve its enode url?

3- How to configure it to use other bootstrap nodes? Is the --bootnodes flag used for whisper?

Basically, I want to be able to do what's in the example here but using geth, with no unnecessary overhead:

> wnode -standalone -forwarder -ip=127.0.0.1:30379
my public key: 0x040ef7acd60781c336c52056b3782f7eae45be2063e591ac6b78472dc27ba770010bde445ffd2f3623ad656f3859e00d11ef518df4916c4d4e258c60b15f34c682 enode://15454fc65bbf0031155f4eee83fa732f1454c314e9f78ade9cba4d4a098d29edbf5431764ee65b200169025c3f900cacc3348a000dda7a8a0d9643d0b7618712@127.0.0.1:30379
Bootstrap Whisper node started

... Then, in another tab:

> wnode -test -boot=enode://15454fc65bbf0031155f4eee83fa732f1454c314e9f78ade9cba4d4a098d29edbf5431764ee65b200169025c3f900cacc3348a000dda7a8a0d9643d0b7618712@127.0.0.1:30379
............................
Whisper node started
Connected to peer.
............................

Update

I haven't tried the accepted answer myself but I confirmed from the author that he/she tried it and the solution seems to be meeting all the requirements.


texts:
pragma solidity ^0.4.0;

contract test {

  bool test_bool1 = false;

  bool test_bool2 = true;

  modifier test_modifier(bool _test_bool){
      if (_test_bool == false) throw;
      _;
  }

  function test1(uint input1) test_modifier(test_bool1) returns (uint){
      return input1;
  }

   function test2(uint input2) test_modifier(test_bool2) returns (uint){
      return input2;
  }

}

Here is my simple modifier test code.
If I deploy that contract and call test.test1(5), I expect shoud not return anything because test_bool1 is false. The result of eth.getTransaction() of this function call transactionHash will be:

>console.log((eth.getTransaction("0x9da931ab4a750423bd780a3b76b70d32ab14f7af0bb967f765c72f9e84674e48").input))
    0x19ae89940000000000000000000000000000000000000000000000000000000000000005
    5

And if I do it again with test.test2(5) (which passed modifier test) I get:

> console.log((eth.getTransaction("0xdf2d0d0ff2a7aed5bf53ca23ccbcb05c76f350255120a098829c839965c4439d").input))
0xcaf446830000000000000000000000000000000000000000000000000000000000000005
5

Why did that happend?
Is there anything about first 8 digits of transaction input? caf44683, 19ae8994


texts: Metamask send new transaction instead of pending transaction, withuot cancelling the pending one?

texts:
I have a Metamask account A which has a days-old pending transaction which will not succeed:
What happened, more or less:

A has balance of 11 ETH
Tx1: A tries to send 10 ETH to B (pending)
Tx2: A tries to send 10 ETH to C (pending)
Tx1 succeeds, A has balance of 1 ETH
Tx2 will not succeed. It's still pending.

I now want to send 4 ETH to account A, then send 5 ETH from A to D. It seems like this should be possible.
I want Tx2 to fail or be ignored. There is a cancellation button but it comes with a fee. Also I do not want to send ANY eth to C.
How can I add 4 ETH to A, then send 5 ETH A->D without sending any ETH A->C and without paying a fee to cancel it?
It seems like it should be theoretically possible to publish a new transaction Tx3 which has the same nonce as Tx2 and since Tx3 can complete whereas Tx2 can't, Tx2 will become irrelevant since it's nonce will now be too small. Can I, for example, construct Tx3 in geth CLI and have metamask sign it? Or is there another way to send a new transaction directly from Metamask with the same nonce as the last pending transaction? Or is there another way out of this?


texts: Arm7 GUI options for Ubuntu Mate: Mist? Parity

texts:
I am running a geth arm7 node on a Raspberry Pi with Ubuntu Mate installed.  I would like to have a GUI wallet for this node.  What are my options?

Is there a arm7 version of Mist or Parity?


texts: Exponential function with fractional numbers

texts:
With solidity, we cannot directly calculate 0.1 or 0.001. We usually use a decimal multiplier and divisor integer to calculate numbers like this:
0.01 = 1 / 100

When the number is more than 1, it is relatively easy because we just repeat the multiplication:
function(uint base, uint exponent) external {
    for (uint256 i = 1; i < exponent; i++)
        uint256 z = base;
        z = z * base;
    }

Or just:
z ** exponent

However, when we want to use fractional numbers as exponents, those functions won't work. Can anybody think of a nice way to do this?


texts: How does solidity "tightly packed arguments" work in sha256()?

texts:
I'm trying to recreate the following Solidity code in python: sha256(x1, y1, x2, y2) where the x's are addresses and the y's are uint256's.

I've installed the correct sha256 library and I can successfully recreate a hash of one argument. But it doesn't work when I try it with multiple arguments, so I think I'm not "tightly packing" the arguments in the same way that Solidity is in sha256().

Here's what I'm trying right now in Python:

x1 = 0x0123456789012345678901234567890123456789
x2 = 0x0123456789012345678901234567890123456789
y1 = 0x0000000000000000000000000000000000000000000000000000000000000001
y2 = 0x0000000000000000000000000000000000000000000000000000000000000001

data = x1[2:] + x2[2:] + y1[2:] + y2[2:]
answer = sha256(data.decode("hex"))

the result is: 0x4e16b1812b95ddb26d9449dff36d48c85c2d0969f6725b117afc83ab2a354968

but an identical function in Solidity gives me: 0x0549a83cb0b851f2025d3600172681973b9944ab1b157e9fae00984061bce198

Any idea what I'm doing wrong?


texts: Quroum - High gas consumption for ether transfer

texts:
I am running a local 3-node Quorum cluster with Raft consensus. The network is setup using quorum-maker. All the settings are default except that I have added a custom account in the script so that it would have an initial balance. Now, when I try to estimate the gas requirement for balance transfer from one account to another the I am getting an estimate equal to the block gas limit (around 3745281699), and not 21000 as it is supposed to be. I would like to transfer ether using web3js, but the transaction fails due to this high gas value. How do I solve this?

Details:

Quorum Maker start script:

geth --verbosity 6 --datadir qdata --raft --nodiscover --networkid 41418 --rpc --rpcaddr 0.0.0.0 --rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3,quorum,raft --emitcheckpoints --raftport 22003 --rpcport 22000 --port 22001 --nat extip:10.50.0.2

Get Balance:

$ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0xE2F384B526C57309e7798B9E8455BF05bE89A465", "latest"],"id":1}' http://10.50.0.2:22000

> {"jsonrpc":"2.0","id":1,"result":"0x446c3b15f9926687d2c40534fdb564000000000000"}

(There is sufficient balance in the account)

Gas Estimate:

curl -X POST --data '{ "jsonrpc":"2.0", "id":2, "method":"eth_estimateGas", "params":[ { "to":"0xE2F384B526C57309e7798B9E8455BF05bE89A465", "value":"0x21e19e0c9bab2400000", "from":"0x7798673316D6028b7fF2CF7369aa658276e5C1C5" } ] }' http://10.50.0.2:22000

> {"jsonrpc":"2.0","id":2,"result":"0xdf3c76a3"}

Version details:

Geth
Version: 1.7.2-stable
Git Commit: df4267a25637a5497a3db9fbde4603a3dcd6aa14
Quorum Version: 2.0.2
Architecture: amd64
Network Id: 1
Go Version: go1.10.2
Operating System: linux
GOPATH=
GOROOT=/usr/local/go

genesis.json:

{
  "config": {
        "chainId": 94296,
        "homesteadBlock": 0,
        "eip155Block": null,
        "eip158Block": null,
        "isQuorum": true
    },
  "alloc"      : {
    "0xe2f384b526c57309e7798b9e8455bf05be89a465": {"balance": "100000000000000000000000000000000000000000000000000"},
    "0xba8c30067f81fcf9b1e614128ea3f4153402c09c":{"balance":"100000000000000000000000000000000000000000000000"},"0xfcd6447746961686f4b5bfef6ba6c2c17276cc1b":{"balance":"100000000000000000000000000000000000000000000000"},"0x2f617e31cfe83d0843674733db0d87a5ae76bd6f":{"balance":"100000000000000000000000000000000000000000000000"}
  },
  "coinbase"   : "0x0000000000000000000000000000000000000000",
  "difficulty" : "0x0",
  "extraData"  : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "gasLimit"   : "0xE0000000",
  "nonce"      : "0x0",
  "mixhash"    : "0x00000000000000000000000000000000000000647572616c65787365646c6578",
  "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp"  : "0x00"
}

The estimates return correct values in ganache. Why is the gas estimate of Quorum different, and what can I do to enable HDWalletProvider to transfer ethers?


texts: Is it possible to send Ether using delegatecall?

texts:
I tested this in Remix and it seems that the ether remains in the delegator contract and doesn't get forwarded. Using the code below to test:

contract SomeContract {
    address public sender;
    uint public value;

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

    function getBalance()
    public
    view
    returns (uint) {
        return address(this).balance;
    }
}

contract CallAnotherContract {
    address public sender;
    uint public value;

    // Check if you can send ETH to non-payable function
    function callTheOtherContract(address _contractAddress)
    public
    payable {
        (bool success, bytes memory returnData) = (_contractAddress.delegatecall(abi.encode(bytes4(keccak256("callMe()")))));
        require(success);
    }

    function getBalance()
    public
    view
    returns (uint) {
        return address(this).balance;
    }
}


texts: Trying to figure if blockchain has finished downloading.

texts:
I am working on the text, Mastering Ethereum and working on the part where one has to download the blockchain. Now I elected to use geth because parity seemed to be getting stuck on blocks for almost an entire night.

Anyways, I have been doing the download using geth and I believe I am on the right path , the age of blocks started off from over 2 years and now it's down to under a minutes. Now looking at my console if all transactions are less than a minute old.

1) Is it safe to say I have finished downloading the block chain?

2) Can I close this page and when I want to continue or update just run the geth.exe again?

3) If i am not finished, and I close this page, will running the geth.exe resume where i left off?


texts: Metamask account: is it possible to create your own seed phrase?

texts:
When you create a Metamask account, you are asked to enter a password and then you are given a seed phrase with 12 random words.
Is it possible to define your own 12-word seed phrase?
__
Update:
Is there a way to define a seed phrase with my own chosen words?
(for example, words from a different language or any other thing that could be easier for a user to remember or codify)


texts: Why is no block created for this function?

texts:
I have this contract and I've deployed it to ganache
pragma solidity >= 0.5.0;

contract HelloWorld {
    string public payload;

    function setPayload(string memory content) public {
        payload = content;
    }

    function sayHello() public pure returns (string memory) {
        return 'Hello World!';
    }
}

I'm calling sayHello(), but I notice that no new block is created -- why is this?


texts: UniSwap Error - "Fail with error 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT"

texts: https://etherscan.io/tx/0x42bdd38783123a21ff831a5a92f12142fc568d92bae9ac02834ed87ff687b97f When you buy more than 0.005 ETH worth of DOGI you get the error "Fail with error 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT", what does that mean and how can I fix it?


texts: How does a Smart Contract know the gas/fees needed to execute a transaction?

texts:
I installed recently Solidity for Visual Studio and they have this Smart Contract sample there:

contract Payout {
address Victor;
address Jim;
address Kieren;

mapping (address => uint) ownershipDistribution;

function Setup() {
  Victor = 0xaabb;
  Jim    = 0xccdd;
  Kieren = 0xeeff;

  ownershipDistribution[Victor] = 35;
  ownershipDistribution[Jim]  = 35;
  ownershipDistribution[Kieren] = 30;
}

function Dividend() {
  uint bal= this.balance;
  Victor.send(bal * ownershipDistribution[Victor] / 100);
  Jim.send(bal * ownershipDistribution[Jim] / 100);
  Kieren.send(bal * ownershipDistribution[Kieren] / 100);
}
}

Basically it is supposed to send the ethers it receives to 3 addresses.
But I believe the code as it is won't work, as the last transaction won't have enough gas, right? Only the first 2 would execute.
Imagine there's 10 ETH in the contract, 3.5 Eth + fees / gas will be sent to address A, 3.5 Eth + fees / gas will be sent to address B, now we dont have the remaining needed 3 Eth for the third address...
So how can the Smart Contract know in the advance the gas/fees needed for the transactions?


texts: How to know if a proposal was splitted from another

texts:
I'm using theDAOInterface ABI to retrieve proposals but I can't get split information there. I see that Etherscan shows it.

Does anyone know how to get this information by code?


texts:
I want to hold small workshop or self learning course on how ethereum works how to create very basic contract (like named contract) and make it somehow visible to the participants what blocks are created how a transaction look like and so on.
question: what is the best / recommended way for this?


texts: How to know if a transaction went through or not? (out of gas)

texts:
Apparently when sending transactions from an Account instead of a Wallet, the gas spent is small (21K), and not enough to send ether to a Contract Wallet (out of gas, so to speak).

When this happens, the transaction shouldn't go through (or be cancelled, as it says here), however it seems to still be recorded in the blockchain, why? Example.

Doesn't etherscan.io provide any clue about if the transaction ended up being valid or not? In this case it should be marked as CANCELLED/INVALID in that URL, as far as I understand.


texts: Design pattern Checks-Effects-Interactions Pattern

texts:
I was workig on design pattern Checks-Effects-Interactions Pattern and found the below link which has a similar question but in the direction which I am looking at ..

Checks-Effects-Interactions Pattern - External Call not reached

In Checks-Effects-Interactions Pattern, what if there will be an error while making or during external call..

How the state of the contract will be managed? Do we need to make some checks and balances of system will manage itself.

Regards


texts: Transactions from connected peer on private geth network seldom get mined

texts:
I have two clients running on a private network, one mining and one not mining.
When I send transactions from the mining node, they get mined right away. But when I send transactions from the non-mining node, they usually time out after 750 seconds, but on rare occasions they get mined.
The non-mining node sees all the new blocks, almost instantly, so it is definitely connected and syncing. Both nodes show up in each other's array of peers. I've tried connecting these two peers using static-nodes.json files or by simply calling admin.addPeer(). Neither method solves this problem.
What could be causing this and how can I fix it? (I'd be happy to provide more information if necessary.)


texts: Unable to unlock account or send transaction using web3.js

texts:
I'm new to Ethereum Blockchain. I have been trying to send ether using web3.js npm. Here's my code

const testnet = `https://ropsten.infura.io/${process.evn.ACCESS_TOKEN}`;
let web3 = new Web3(new Web3.providers.HttpProvider(testnet));

web3.eth.personal.unlockAccount(adminWalletAddress, password, 1000)
.then(data => console.log(data))
.catch(err => console.log(err))

I'm getting an error response -

Error: Invalid JSON RPC response: ""
at Object.InvalidResponse (/home/rplanx/Dwip/node_ethereum/web3-1-x-x-contract-transaction/node_modules/web3-core-helpers/src/errors.js:42:16)
at XMLHttpRequest.request.onreadystatechange (/home/rplanx/Dwip/node_ethereum/web3-1-x-x-contract-transaction/node_modules/web3-providers-http/src/index.js:73:32)
at XMLHttpRequestEventTarget.dispatchEvent (/home/rplanx/Dwip/node_ethereum/web3-1-x-x-contract-transaction/node_modules/xhr2/lib/xhr2.js:64:18)
at XMLHttpRequest._setReadyState (/home/rplanx/Dwip/node_ethereum/web3-1-x-x-contract-transaction/node_modules/xhr2/lib/xhr2.js:354:12)
at XMLHttpRequest._onHttpResponseEnd (/home/rplanx/Dwip/node_ethereum/web3-1-x-x-contract-transaction/node_modules/xhr2/lib/xhr2.js:509:12)
at IncomingMessage.<anonymous> (/home/rplanx/Dwip/node_ethereum/web3-1-x-x-contract-transaction/node_modules/xhr2/lib/xhr2.js:469:24)
at IncomingMessage.emit (events.js:185:15)
at endReadableNT (_stream_readable.js:1106:12)
at process._tickCallback (internal/process/next_tick.js:178:19)

The response is same for web3.eth.sendTransaction method.
I'm using web3@1.0.0-beta.34. Faced the same issue when using web3@0.20.4


texts: How to get raw ethereum transaction hash

texts:
I searched around for an answer to this question, however couldn't find one.
So let's assume we've a raw ethereum transaction and before broadcasting we'd like to know the transaction hash. Is it possible to find out the hash before it's being broadcasted (i.e. via eth_sendRawTransaction RPC method).

For instance for raw transaction hex:

0xf86c258502540be40083035b609482e041e84074fc5f5947d4d27e3c44f824b7a1a187b1a2bc2ec500008078a04a7db627266fa9a4116e3f6b33f5d245db40983234eb356261f36808909d2848a0166fa098a2ce3bda87af6000ed0083e3bf7cc31c6686b670bd85cbc6da2d6e85

I get this transaction:
https://kovan.etherscan.io/tx/0x58e5a0fc7fbc849eddc100d44e86276168a8c7baaa5604e44ba6f5eb8ba1b7eb

Is it possible to decode raw transaction so that this hash is known before hand?
Note that I am storing private keys outside of applications such as geth/parity.


texts: Running Geth full node + archiving on tiered storage possible?

texts:
I'm trying to run a geth full node with archiving for development\learning and custom analytics.
I have a physical Windows server running HyperV where I carved out the following VM specs:

24 vCPUs
128 GB DDR3 RAM
80GB OS drive on local NVME storage
8TB Tiered Storage Drive (see below)*
Ubuntu 20.04
Geth 1.10.2-stable

According to etherscan stats a full node with archive today is about 7.2TB of disk.
*Unfortunately I don't have 8TB worth of SSD, but I have a NAS with 24TB of HDD in a raid which can throughput 116MB\s (~about max speed of 1GB nic), and another locally attach 1TB nvme. Previous posts indicate that running a full node on HDD is not sufficient or possible to keep up, but what about tiered storage?
Since my host is windows, I'm using storage spaces to combine the local 1TB nvme with 8TB iscsi LUN with SSD,HDD tiering. I then attached the tiered disk to VM as /eth1 to host the chaindata.
I'm running geth via following command:
./geth --datadir /eth1/data/ --datadir.ancient /eth1/data/geth/chaindata/ancient --mainnet --syncmode full --gcmode archive --txlookuplimit=0 --cache.preimages --cache=8192
Other thoughts
The tiering functionality is a bit of a black box to me, and i'm not sure when certain chaindata is considered hot or cold to storage spaces. I think all initial writes go to LUN. I'd be nice if I could just configure geth to say use 950GB of recent data on drive X, and store\move all other chain data to drive Y, which I assume is kind of how the freezer works? I saw there is a datadir.ancient parameter but not sure when and how that data is moved there.


texts: Can I retrieve the timestamp the contract was mined on, inside of the contract?

texts:
I'm aware of the now keyword that aliases block.timestamp (uint): current block timestamp and the time units

But I fail on finding a way to get the block timestamp of when the contract was mined.
Should I use an event and "log" the now keyword into a start variable ?


texts: List of successfully running smart contract applications that solve a real world problem?

texts:
I'm still diving into smart contracts and learning the way it works, but what are some successfully running smart contracts applications that solve a real world problem? Is there a list of these projects?

When I say successful, I mean something that either generates a profit to sustain itself or an dapp that is widely used with its source code open.

The dapp needs to beable to run on its own interacting with the ethereum blockchain only and no 3rd party service/website. This would also qualify as a successful smart contract application where no one controls it.


texts: Does a greater number of hashing rounds in aes-128-ctr scrypt key generation mean stronger encryption?

texts:
Consider the following Ethereum account I created at MyEtherWallet:

{ version: 3,
  id: '4447b704-e28c-4e93-8b1d-32f519b46692',
  address: '115312fc0ab77a0fb15a66baf51f58baefcee1dd',
  Crypto:
   { ciphertext: '299dd3b289bbfa049b42b9e8caff2a37ea9cc0606b33dad64afbb9b8aa5b2bc7',
     cipherparams: { iv: 'ab6abe38032296123b16b029cfce8240' },
     cipher: 'aes-128-ctr',
     kdf: 'scrypt',
     kdfparams:
      { dklen: 32,
        salt: '2605c6988ea0c68dd8c363e29f815bbabb329a74493abc6766cad31b85b6fa2a',
        n: 1024,
        r: 8,
        p: 1 },
     mac: 'f4425caa02c682c74ffe1ba546ddec1f7e85b573848b896ef1e80f09adbc5511' } }

The n value of kdfparams is 1024. Other implementations seem to have the number of hashing rounds set to 262144 (mentioned over at keythereum). Are these parameters less secure? If so, to what extent? If not, why not?


texts: Getting more Ether on a private test net

texts:
I setup a local testnet using geth following these instructions. I was able to mine my initial Ether and all was working.  After deploying some contracts I quickly spent all the Ether I had. Now it seems I'm unable to mine any more Ether.  How do you continue to fund your account with Ether on a private testnet?

Aren't blocks processed every so often regardless of the number of transactions? That doesn't seem to be happening on my test node.

Updated:  Here's the output when I manually start the miner (note, account is unlocked)

>miner.start();
I0128 15:22:16.501677    8525 backend.go:584] Automatic pregeneration of ethash DAG ON (ethash dir: /Users/testgeth/.ethash)
I0128 15:22:16.501789    8525 backend.go:591] checking DAG (ethash dir: /Users/testgeth/.ethash)
I0128 15:22:16.501843    8525 miner.go:119] Starting mining operation (CPU=8 TOT=10)
true
> I0128 15:22:16.503824    8525 worker.go:570] commit new work on block 48 with 0 txs & 0 uncles. Took 1.893754ms
I0128 15:22:16.503953    8525 ethash.go:220] Generating DAG for epoch 0 (size 1073739904) (0000000000000000000000000000000000000000000000000000000000000000)
I0128 15:22:17.432934    8525 ethash.go:237] Done generating DAG for epoch 0, it took 928.992201ms

UPDATE:  What seems to work is to send a transaction.  Once geth reached the stopping point I mention above, I sent a transaction and the normal block processing began.


texts: I need to connect to private ethereum node with using ethereumj without ethereum.conf file. I need configure connect from code using Spring Framework.