texts: How to fix lEnqueueNDRangeKernel -4 on a GTX 780 Ti?

texts:
I'm getting OpenCL Error: clEnqueueNDRangeKernel -4 even though I'm specifying CUDA on an nVidia GTX 780 Ti on Ubuntu 17.04 using the 381.22 drivers. What could be the problem?

vadi  ~  Downloads  bin  ./ethminer --cuda --farm-recheck 200 -G -S eu1.ethermine.org:4444 -FS us1.ethermine.org:4444 -O  address
  ℹ  19:22:01|ethminer  Found suitable OpenCL device [ GeForce GTX 780 Ti ] with 3166109696  bytes of GPU memory
  ℹ  19:22:01|ethminer  Connecting to stratum server eu1.ethermine.org:4444
  ℹ  19:22:01|stratum   Connected to stratum server eu1.ethermine.org : 4444
  ℹ  19:22:01|stratum   Starting farm
  ℹ  19:22:01|stratum   Subscribed to stratum server
  ℹ  19:22:01|stratum   Authorized worker d59a78ade291f4e803e766feca6769d243862594.volga
  ℹ  19:22:01|stratum   Received new job #dd6dc396
 cl  19:22:01|cl-0      Set work. Header #dd6dc396… target 0000000112e0
 cl  19:22:01|cl-0      Initialising miner with seed #e7cc04b2…
  m  19:22:01|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:01|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:01|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:02|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:02|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:02|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:02|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:02|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:03|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:03|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
 cl  19:22:03|cl-0      Platform: NVIDIA CUDA
 cl  19:22:03|cl-0      Device:   GeForce GTX 780 Ti  / OpenCL 1.2 CUDA
  m  19:22:03|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
 cl  19:22:03|cl-0      Build info:

 cl  19:22:03|cl-0      Creating cache buffer
 cl  19:22:03|cl-0      Creating DAG buffer
 cl  19:22:03|cl-0      Loading kernels
 cl  19:22:03|cl-0      Writing cache buffer
 cl  19:22:03|cl-0      Creating buffer for header.
 cl  19:22:03|cl-0      Creating mining buffer
 cl  19:22:03|cl-0      Generating DAG
  ✘  19:22:03|cl-0      clEnqueueNDRangeKernel ( -4 )
  ✘  19:22:03|cl-0      OpenCL Error: clEnqueueNDRangeKernel -4
  m  19:22:03|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:03|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:04|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:04|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:04|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:04|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:04|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:05|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:05|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:05|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:05|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:05|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:06|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]
  m  19:22:06|ethminer  Mining on #dd6dc396… : 0.00MH/s [A0+0:R0+0:F0]


texts: How can I implement ethereum If I'm making an exchange service like cex.io

texts:
I was wondering how cex.io manages ethereum service on their website.
I know what happens with bitcoin. They have 1 wallet and daemon on their server for each coin. for example bitcoin. Then When I click on the button "deposit" , it generates the address for me. And this address is put into their bitcoin's wallet's main account. So other people's addresses are also put into that main account and they have public/private keys for each address. Why doesn't the same thing happen for ethereum? I read that in ethereum, after generating each new address, there gets created new wallet. Then what? people offer to use smart contracts instead of accounts and wallets. But here comes the question: **How does cex.io implement ethereum wallet service on their server and How Can I do the same?


texts: What s the official gui developped by the Ethereum fundation? Does it allows to display erc20 tokens?

texts:
After losing access to my email address, I am asked by an exchange to show the deposit history for a specific coin (in that case an erc20 running on Ethereum) from a specific address (which I own the private key) used to fund my account on the exchange in order to be able to withdraw the money.
But when I sent them screenshots from a block explorer and an other one Metamask, they refused it, stating it wasn t a proof I was owning the address. They asked the screenshot to come from my own node client running the official node software (which I suppose means geth since Aleth doesn t support archive node mode).
Since it s an erc20 token, getting the deposit history involve accessing previous states from the contract. So after purschasing an expensive workstation powerfull enough in order to run my own full geth archival node, I m still having questions.
Does geth still feature a built in gui or a cli able to display the deposit history from a command line? If not which is the new projet resulting of the split of those functionnalities?


texts: Why does geth Sync get very slow around 4 million blocks

texts:
I am fast syncing geth, and at block 4080496 it started to sync very slow. Those 4 million blocks took about 45 minutes to sync.

In the last 4.5 hours I have got to 4081691, about 1200 in 4.5 hours.

Other people on my team got stuck around the same number. Is there any specific reason for this happening?


texts: One smart contract deployed on 2 nodes will have same address?

texts:
Let's get creation of a smart contract address out of the way:

  The address for an Ethereum contract is deterministically computed from the address of its creator (sender) and how many transactions the creator has sent (nonce). The sender and nonce are RLP encoded and then hashed with Keccak-256.

Now my question is, if there is only one contract, deployed on 2 nodes, that one contract should have the same address right?


texts: Intializing ERC20 token using payable constructor from another function of different contract

texts:
I have an ERC20 contract which is deployed from another contract as following:

function createDao(string _tokenName) public payable returns (address tokenAddress) {
    tokenNumberIndex = safeAdd(tokenNumberIndex, 1);
    string memory _tokenSymbol = bytes32ToString(bytes32(tokenNumberIndex));
    address _tokenAddress = new REP(_tokenSymbol, _tokenName);
    erc20SymbolAddresses[_tokenSymbol] = _tokenAddress;
    return _tokenAddress;
}

The ERC20 contract is as following:

contract REP is ERC20Interface, Owned, SafeMath {
string public symbol;
string public  name;
uint8 public decimals;
uint public _totalSupply;

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

constructor(string _tokenSymbol, string _name) public payable{
    symbol = _tokenSymbol;
    name = _name;
    decimals = 18;
    _totalSupply = msg.value;
    balances[msg.sender] = _totalSupply;
    emit Transfer(address(0), msg.sender, _totalSupply);
}

}

My assumption is that since createDao function is payable, whatever is sent in createDao will be passed on to the ERC20 contract as msg.value. Though both the functions are payable, how do I pass on the value while initializing ERC20 token?


texts: Can I use an emoji as part of a string in Solidity?


texts: Is this a good way to get a random number on solidity?

texts:
I need to generate a random number for betting games. Is this pattern safety solution?

mapping(uint => address) playerMapping;

address[] players;

// here is contract will save block.number of player
function bet() {
  ...
  playerMapping[block.number] = msg.sender;
  players.push(playerMapping[block.number]); // blockhash(block.number) will be unknown at this stage
  ...
}

// this function will called by bot
function reveal(uint blockNumber) {
   ...
   uint random = blockhash(blockNumber);
   ...
}


texts: how can I send ether and call function in truffle test?

texts:
From this, I know how to send ether to contract address itself. But I have a function defined as payable, then how can I call and send ether at the same time?

for example, my contract is like this,

contract MyTest {
  function DepositEther(address _to, string _title) payable external {
     //do something inside..
  }
}

Thank you.


texts: Adding address to Struct's array of addresses does not persist

texts:
I'm having trouble getting the array of "watchers" to persist after I:

Deploy the contract
Create Magic with name "test1"
Execute watchMagic (with test1's magic id)
Execute watchMagic (with test1's magic id from a different account)
Call getMagicWatchers which returns an empty array

Any ideas?

contract WTF {

        struct Magic {
            bytes32 id;
            string name;
            address[] watchers;
        }

        uint _nonce;

        mapping (bytes32 => Magic) public allMagic;

        uint private _numWatchersMax = 16;

        function countWatchers(Magic magic) internal returns(uint) {
            uint count;
            uint i;
            for (i = 0; i < magic.watchers.length; i++) {
                if (address(0) != magic.watchers[i]) {
                    count++;
                }
            }
            return count;
        }

        function registerMagicWatcher(Magic magic, address watcher) internal returns(bool success) {
            magic.watchers[countWatchers(magic)] = watcher;
            return true;
        }

        function createMagic(string name) public returns(bytes32 magicId) {
            Magic memory magic = Magic({
                id: keccak256(msg.sender, name, _nonce++),
                name: name,
                watchers: new address[](_numWatchersMax)
            });

            require(registerMagicWatcher(magic, msg.sender));

            return magic.id;
        }

        function getMagicWatchers(bytes32 magicId) returns(address[] watchers) {
            return allMagic[magicId].watchers;
        }

        function watchMagic(bytes32 magicId) returns(bool success) {
            require(allMagic[magicId].id == magicId); // ensure magic with this id exists
            require(countWatchers(allMagic[magicId]) < _numWatchersMax);

            bool alreadyWatcher = false;
            uint i;
            for (i = 0; i < allMagic[magicId].watchers.length; i++) {
                if (msg.sender == allMagic[magicId].watchers[i]) {
                    alreadyWatcher = true;
                    break;
                }
            }
            require(alreadyWatcher == false);

            require(registerMagicWatcher(allMagic[magicId], msg.sender));
            return true;
        }
}


texts: How secure is using port 8545 from the internet (aka via JSON), can someone steal my ether?

texts:
Just noticed I can access 8545 from localhost but fortunately not from the web/internet. Do I need this at all?

e.q. I read about someone who had lost $20 million due to someone else sending a call to port 8545 every 2 seconds. So aren't these things protected by password/account locking?

Ideally I may use 8545 from the net for as long as I know I can protect it with strong pass + firewall ip banning. 10x!


texts: Contract inheritance to share same storage in Proxy pattern for upgradeability

texts:
Please bear with me here, I have been trying to figure it out myself but couldn't. I am trying to learn upgradeability with a Proxy pattern .https://blog.gnosis.pm/solidity-delegateproxy-contracts-e09957d0f201 .

We can test this setup by constructing a full Kombucha instance (which takes no arguments now), constructing a KombuchaProxy instance with the address of the full Kombucha instance’s address as the first argument.

When I checked Kombucha instance variables they are still at default value but they should have the values given to Kombucha proxy while instantiating its instance because KombuchaProxy and Kombucha both have inherited KombuchaData.

pragma solidity ^0.6.0;

contract ProxyData {
    address public proxied;
}

contract Proxy is ProxyData {
    constructor(address _proxied) public {
        proxied = _proxied;
    }

    receive () payable external {}

    fallback () external payable {
        address addr = proxied;
        assembly {
            let freememstart := mload(0x40)
            calldatacopy(freememstart, 0, calldatasize())
            let success := delegatecall(not(0), addr, freememstart, calldatasize(), freememstart, 32)
            switch success
            case 0 { revert(freememstart, 32) }
            default { return(freememstart, 32) }
        }
    }
}

contract KombuchaData is ProxyData {
    event FilledKombucha(uint amountAdded, uint newFillAmount);
    event DrankKombucha(uint amountDrank, uint newFillAmount);

    uint public fillAmount;
    uint public capacity;
    string public flavor;
}

contract KombuchaProxy is Proxy, KombuchaData {
    constructor (address proxied, string memory _flavor, uint _fillAmount, uint _capacity)
        public
        Proxy(proxied)
    {
        // the body is identical to our original constructor!
        require(_fillAmount <= _capacity && _capacity > 0);
        flavor = _flavor;
        fillAmount = _fillAmount;
        capacity = _capacity;
    }
}

contract Kombucha is KombuchaData{

    function fill(uint amountToAdd) public {
        uint newAmount = fillAmount + amountToAdd;
        require(newAmount > fillAmount && newAmount <= capacity);
        fillAmount = newAmount;
        emit FilledKombucha(amountToAdd, newAmount);
    }
    function drink(uint amountToDrink) public {
        uint newAmount = fillAmount - amountToDrink;
        require(newAmount < fillAmount);
        fillAmount = newAmount;
        emit DrankKombucha(amountToDrink, newAmount);
        // this mess of hashes just here to pad out the bytecode
    }
}


texts:
I need 100 ETH for My Ropsen Test net account. Can any one please send ETH to my wallet, I am ready to exchange for Fiat Currency?

Thanks
Amit Modi


texts:
I executed the following:

➜  voting_truffle truffle migrate
Compiling ./contracts/Migrations.sol...
Compiling ./contracts/Voting.sol...

Compilation warnings encountered:

/Users/glaksmono/Documents/Blockchain Projects/voting_truffle/contracts/Migrations.sol:11:3: Warning: No visibility specified. Defaulting to "public".
  function Migrations() {
  ^
Spanning multiple lines.
,/Users/glaksmono/Documents/Blockchain Projects/voting_truffle/contracts/Migrations.sol:15:3: Warning: No visibility specified. Defaulting to "public".
  function setCompleted(uint completed) restricted {
  ^
Spanning multiple lines.
,/Users/glaksmono/Documents/Blockchain Projects/voting_truffle/contracts/Migrations.sol:19:3: Warning: No visibility specified. Defaulting to "public".
  function upgrade(address new_address) restricted {
  ^
Spanning multiple lines.

Writing artifacts to ./build/contracts

Using network 'development'.

Running migration: 1_initial_migration.js
  Deploying Migrations...
  ... undefined
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: authentication needed: password or unlock
    at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:43303:16)
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:331156:36
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:175492:11
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:314196:9
    at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:315621:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70159:18)
    at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70449:12)
    at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70604:12)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70564:24)
    at emitNone (events.js:111:20)
➜  voting_truffle

I have 2 migration files:
1. migrations/1_initial_migration.js
2. migrations/2_deploy_contracts.js

The content of migrations/2_deploy_contracts.js is the following:

var Voting = artifacts.require("./Voting.sol");
module.exports = function(deployer) {
  deployer.deploy(Voting, ['Rama', 'Nick', 'Jose'], {gas: 6700000});
};
/* As you can see above, the deployer expects the first argument to   be the name of the contract followed by constructor arguments. In our case, there is only one argument which is an array of
candidates. The third argument is a hash where we specify the gas required to deploy our code. The gas amount varies depending on the size of your contract.
*/

Here's the status of my blockchain synchronization from geth attach:

> eth.syncing
{
  currentBlock: 2179367,
  highestBlock: 2179534,
  knownStates: 5799770,
  pulledStates: 5764000,
  startingBlock: 0
}
>

I've been trying to figure this out for days, and I'm stuck. Any ideas?

I'm trying to follow this tutorial, and I'm stuck in the migration section.


texts: How to use a bash file to execute a loadScript in geth console on private blockchain?

texts:
I'm trying to use a bash file to execute a loasdScript file in geth console on a private blockchain.
How can I do this?

I have tried:

\\Bash file

$ geth --exec 'loadScript("/path/to/file/filename.js")' attach ipc:/path/to/ipc

But it doesn't worked.

Also tried:

\\Bash file

geth --preload "/my/scripts/folder/utils.js,/my/scripts/folder/contracts.js" console

But, not worked also.

Hope someone could help me with this.

Thanks


texts: Create an Ethereum wallet with React Native for single token

texts:
Many of you might think that this question has already been answered
  but I don't think that there is a clear answer on the internet for the
  current Ethereum, Web3.js and React Native versions (for 2018). In the blockchain space, answers that are 6 months old are obsolete.

Hello,

I recently created a bunch of Ethereum smart contracts on a custom PoA private network and everything is working great on the browser using MetaMask and Truffle.

Now, the next step is to create a mobile application with React Native to interact with the smart contracts, handle public/private keys, etc (What MetaMask does for the browser).

So my question is: What is the best way to create an Ethereum dApp with React Native with the purpose of only creating and storing cryptographic material, creating and signing transactions? I don't want to create a light client but use the application with platforms like Infura (I know that it is not really decentralized but this is temporary before a light-client is available for Ethereum).

Has anyone already done that with web3.js v.1.0? What are the difficulties? Is web3.js enough? Can it be used with React Native?

Thank you


texts: What is the standard way for a Dapp to locally store non-sensitive data?

texts:
I'm building a small Dapp which is structured like so:

Every user who wishes to use the contract deploys a copy of the code. Individual contracts contain a small amount of information. Users can also 'follow' contracts deployed by other people to get information when those contracts change state.

To implement this 'follow' functionality, I think it will be necessary to store a list of addresses on the client machine. I'm curious what the best practice is for doing this. So far it seems that HTML5 local storage is the best way to do this, but I'm not sure whether this is considered best practice, or if there are other ways of doing it.


texts:
What does the memory keyword in the argument of a function do?

pragma solidity 0.4.24;
pragma experimental "ABIEncoderV2";

contract Conditional {
struct Condition {
    address to;
    bytes4 selector;
    bytes parameters;
    bytes32 expectedValueHash;
    bool onlyCheckForSuccess;
  }

 function isSatisfied(Condition memory condition)
    public
    view
    returns (bool)
  {
    if (condition.onlyCheckForSuccess) {
      return assertNotFails(condition);
    } else {
      return assertReturnsExpectedResult(condition);
    }
  }

I understand what the memory keyword does. But what does it mean in the context of a function argument?


texts: Is any way to withdraw ether from a smart contract to owner wallet, if no such method in it?

texts:
I've created contract with function to withdraw ether from it to owner wallet:

contract test {
   address owner;
   function test() {
      owner = msg.sender;
   }
   function sendEtherToOwner() {
      owner.send(this.balance);
   }
}

And ether withdrawing works with this function.

If I've already created another smart contract without such function, is any way to withdraw ether from it to owner wallet?


texts:
I'm trying to use ethers-ens which requires an ethereum account in JSON format.  How can I export or generate an account.json from my metamask account? Is there another way to use ethers-ens without an account.json?

This is a sanitized example format based on account.json generated by ethers-ens:

{
    "address": "",
    "id": "",
    "version": ,
    "Crypto": {
        "cipher": "",
        "cipherparams": {
            "iv": ""
        },
        "ciphertext": "",
        "kdf": "",
        "kdfparams": {
            "salt": "",
            "n": ,
            "dklen":,
            "p": ,
            "r":
        },
        "mac": ""
    }

}


texts: Are there block rewards for ETH2 validators during Phase0

texts: ETH2 is rolling out in multiple phases. The first phase (typically called phase 0) is the minimal beacon chain. Does this chain already include block rewards? If not, what's the incentive to stake ETH in order to be an early ETH2 validator?


texts: Parity halts on connecting to the private network. RPC io error: Address already in use (os error 98)

texts:
I followed (https://ethereum.stackexchange.com/a/13035/4575) to connect to my private network using Parity. Same configuration works on the different node.

Parity halts on connection. It won't give any output or log for me to track what went wrong. What should I do to prevent this problem?

parity --chain parity.json --network-id 23422 --reserved-peers myPrivateNetwork.txt -ludp=debug,tcp=debug,sync=debug --jsonrpc-port 8546
2017-05-19 12:40:55  main INFO parity::run  Starting Parity/v1.7.0-unstable-7707f75-20170327/x86_64-linux-gnu/rustc1.16.0
2017-05-19 12:40:55  main INFO parity::run  State DB configuration: fast
2017-05-19 12:40:55  main INFO parity::run  Operating mode: active
2017-05-19 12:40:55  main INFO ethcore::service  Configured for Ebloc using Ethash engine
2017-05-19 12:40:55  hyper-client INFO miner  Updated conversion rate to Ξ1 = US$110.54 (1076964100 wei/gas)
...//HALTS do not do anything.

It exits with following error message: RPC io error: Address already in use (os error 98). But I have doubled check that the port 8546 is empty. netstat -antu | grep "8546" returns empty.  When I try with --jsonrpc-port 8547 or different empty port number, it gives the same error message.


texts:
I get an error: Error contract code couldn't be stored, please check your gas amount.

I know this error has been reported several times already. Strange thing is, until this morning, my dApp just worked fine, only this afternoon to start giving this error. I literally changed nothing.

I use metamask as wallet, you can find the project on oursurance.nl

Strange thing is that it deploys the contract and I can find the contract and similar coded contracts (that worked without a problem) through ehterscan. but still gives this error. To contract accounts now exist and bear ethers, but I can't interact with them.

Again, it has been working just fine and I haven't changed anything. I tried to add extra gas, but that didn't help. Hope anyone can help!

kind regards, Olivier


texts:
I have the following contracts:

pragma solidity ^0.4.17;

contract one{
    uint firstNum;
    uint secondNum;
    uint thirdNum;
    function getNumber(uint _num, uint _num2,uint _num3) public{
       firstNum = _num;
       secondNum = _num2;
       thirdNum = _num3;
    }
}

contract two{
    uint firstNum;
    uint secondNum;
    uint thirdNum;
    function getNumber(uint[3] numValues) public{
       firstNum = numValues[0];
       secondNum =numValues[1];
       thirdNum = numValues[2];
    }
}

Literally the only difference is the input function. Now for the costs:

Contract one creation:

Transaction cost: 102814 gas.
Execution cost: 37682 gas.

and function call 1,2,3 as input:

Transaction cost: 82106 gas.
Execution cost: 60258 gas.

Contract two creation:

Transaction cost: 121264 gas.
Execution cost: 51500 gas.

and function call [1,2,3] as input:

Transaction cost: 82296 gas.
Execution cost: 60448 gas.

So a few questions...why is it more expensive?  and now why do contracts like 0x use arrays versus just entering them separately?


texts: Best practice in 2018 to claim Ethereum presale purchase

texts: I have the presale wallet and password, but went through a number of trials and just now trying to get back on my feet. I have yet to claim my presale and could really use it to help with medical bills. I did not invest much, but every little bit helps for my situation. I've researched, but see conflicting statements about people having issues claiming and no support responses from Ethereum.org. I can say my experience is that I have yet to try and claim it because I have yet to find a confident source to try. I also did try to contact Ethereum.org, but also did not have any response which is not encouraging. Thought I would reach out here to get input. I would be grateful for detailed instructions that also deal with claiming both ETH and ETC as well. Blessings!


texts: Can anybody Point out the Difference between Web3.eth.sendTransaction and web3.eth.signTransaction?

texts:
Do we need to sign the transaction by web3.eth.signTransaction after initiating transaction via web3.eth.sendTransaction.

for example:

when I do:

web3.eth.sendTransaction({
         from: accs[0],
         to: wallet[0].address,
         value: '10000000000'
              })

I get this:

{ transactionHash: '0x3b6b08f9b47780f86f54c575e587841e3ec73a2d284928673d731ae9e55419ed',
  transactionIndex: 0,
  blockHash: '0x6e16c78b4b93c7be0c7829c0b45af03d8c52837c8a70c55a4783b3e18cd05273',
  blockNumber: 1,
  gasUsed: 21000,
  cumulativeGasUsed: 21000,
  contractAddress: null,
  logs: [],
  status: true }

But I didn't get any balance in my wallet[0].address


texts:
It seems clear that you can override the ERC-20 methods (transfer, etc) to have them do non-standard things in addition to the intended functionality.

Is it true that as long as you implement those methods, you can have them perform other functionality and still be considered ERC-20 (to be able to be listed on an exchange)?

Thought maybe gas requirements could be an issue- for example, if a transfer takes a lot more gas than normal, would that be a problem for an exchange?


texts: structs, mappings, & enums. How to make them work together?

texts:
I have this code. My question pretains to struct variables weapons, armour, & stats

enum Armour {Chest, Helm, Boots, Leggings, Gloves, Shield}
enum Weapon {Sword, Axe, Wand, Gun, Hammer, Fist}

struct Statistics { uint16 testing; }

struct Character {string name;
                  uint dna;
                  mapping (uint => Statistics) stats;
                  mapping (uint => Weapon[10]) weapons;
                  Armour[10] armour;
    }

Character[] public characters;
Armour[10] armourTest;
Weapon[10] weaponsTest;

I do not see much in http://solidity.readthedocs.io/en/v0.4.21/types.html#enums about enum arrays and mappings of enums as array values.

How can I use  struct variables weapons, armour, & stats after I have pushed a character to the public variable characters?


texts: How to send from multiple accounts to the one account in the contract

texts:
For example, I have 3 accounts with balances:

1 account - 5 ether

2 account - 15 ether

3 account - 7 ether

I want to send 20 ether, so it will be used 1 and 2 account.
I understand, how to make through just simple transactions, but for this will need to pay fee for every transaction. And for every transaction, before send, I need to unlock account. Contract can't unlock account, so I don't understand how will ether withdraw from this accounts and how it could have a permission to do this. Please help.


texts:
Is refunded gas for "freed" storage given to the contract, the "allocator", or the "deleter"?

Suppose a contract allocates some storage. This storage is paid for by the sender of the transaction that does the allocation, right?

Now, when this storage is "freed" by delete operator in Solidity, who gets the refund and how is the refund computed?

Is it the contract that gets the refund, the sender ("allocator") of the allocating transaction, or the sender ("deleter") of the deleting transaction? In particular, what gas price is used to compute the refund?


texts: How to connect NodeJS to the Ethereum network?

texts:
I have Mist wallet running on Windows 8. I want to connect my NodeJS applcation to the Ethereum network. I have no idea where to start. Could you point me to the direction I should be looking at? Are there any NPM modules for this?

P.S. My end goal is to create a website that connects through an Ethereum client to the network, calls a contract and recieves return values from it. In other words, I want to create a custom token and issue it to the users of my app.
This is an amazing technology!


texts: What Ethereum blockchain explorers exist?

texts:
What blockchain explorers exist and

What special features do they have?
Are they open-source?
How reliable are they (approximate uptime in %)?
Is there a testnet version?


texts:
In ERC721, safeTransferFrom has bytes data parameter.

function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) public;

how do I send data (is it in hex format?) and what does it do?


texts:
I want to set web3 to Metamask. As mentioned in Metamask document and npmjs, i took a use @metamask/detect-provider. My problem is when i approach window.ethereum. I have a UI, JS file, and some contracts. My app.js code is below. Whenever my http request is /send-to-ipfs i approach this message in console:
@metamask/detect-provider: Unable to detect window.ethereum.
Please install MetaMask!

Please check my app.js code and comment about am i coding correct to set Metamask as web3 provider or not, and in that case guide me to correct code.
app.js:
const fs = require("fs");
const ipfsClient = require('ipfs-http-client');
const Hash = require('ipfs-only-hash')
const contract=require("truffle-contract");
const Web3 = require("web3");
const Window = require('window');
const window = new Window();
const detectEthereumProvider=require('@metamask/detect-provider');
const solc=require("solc");
const express=require('express');
const app=express();
const bodyParser=require('body-parser');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended:false}));
app.use(express.static('E:/Test'));
app.set('view engine',"pug");
app.set('views','./views');

app.post('/send-to-ipfs', async function(q,r){
    const node= ipfsClient({ host: 'localhost', port: '5001', protocol: 'http' });
    const data=q.body.KeyPad;
    let result=await Hash.of(data)
    node.add(data);
    const provider=await detectEthereumProvider();
    if (provider) {
        startApp(provider); // initialize your app
    } else {
          console.log('Please install MetaMask!');
    }
    r.render('IPFSconnection2.jade',{key: data, cid:result});
});
... here is some code that are not my peoblem ...


texts: Complete trace of the function call whenever I run any contract in truffle

texts: I want to see the complete trace of the function call whenever I run any contract in truffle. Can I do that. From the complete trace I mean if a function calls another function and so on, I want to see in which orders they call each other and if possible then also the values.


texts:
Why should I use a (ERC 20) Token instead of just using Ether?
What advatages does it have, besides making money out of nothing?


texts:
Whenever I want to use web3, I initialize it as follows:

if (typeof web3 !== 'undefined') {
  web3 = new Web3(web3.currentProvider);
} else {
  // set the provider you want from Web3.providers
  web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
}

The provider works whether I'm in Mist or another browser (while geth is running locally). How can I distinguish between the two cases? Either in browser or server (maybe in req object of Node?), is there any way I can see if the user is using the Mist browser or not?

Thanks,


texts:
I googled this and this does not exist here yet, so

  Why is the Ethereum paper called the "yellow paper"?


texts: Recovering private key from keystore file

texts:
Recently I came across my old keystore file from the original Ethereum Wallet that I used back in 2017. Unfortunately I cannot find the private key or password for that wallet anymore, big problem of not writing it down on a piece of paper and save that...
The issue is that I am hoping to recover the private key from my keystore file with coding or another way. I have been trying to look it up but couldn't find something useful so far.
Is there anyone who knows a way to recover the private key from your keystore file without the password?


texts:
I am trying to make updates to a standard voting dapp. My aim is to list out voter who has voted for a candidate.
So far I have implemented the following:

voting.sol:

struct voter {
    bytes32 votedFor;
    bool hasVoted;
}

mapping (bytes32 => uint8) public votesReceived;
// Mapping for persons who have already voted
mapping (bytes32 => voter) public voters;
function lookUpVoter(bytes32 hashedVoter) view public returns (bytes32){
  bytes32 candidateDetails = voters[hashedVoter].votedFor;
  return candidateDetails;
}

index.js:

function lookUpVoter(){
    voterName = $("#voter-info").val();
    var vals = contractInstance.lookUpVoter.call(voterName);
    $("#votes-cast").html(vals);

}

The output i am receiving from index.js is hashvalue "0x4b6576696e204200000000000000000000000000000000000000000000000000".
I need the candidate name instead.
Please help me identifying what I am missing from the code.

Thank you!!


texts: The State Machine presented at solidity documentation shows a good way to implement the pattern in linear cases. However, when the states don't transact in a non-linear manner there is no example. Could someone inlight how can I use this pattern for non-linear state transaction?


texts: RangeError: private key length is invalid

texts:
I am trying to sign a message using the following code:ethJsUtil.ecsign(ethJsUtil.sha256(msg),new Buffer('0x...'))

Where 0x... is my private key taken from MyEtherWallet. It gives the error in the title both with and without the 0x at the beginning


texts: Does the web3 Contract API support single mining after multiple "send" calls?

texts:
This is not about Solidity. My question is about web3.eth.Contract.send version > 3.

I tried out web3.eth.Contract.call on a single contract and as I expected I can issue multiple calls in the EVM. Now I want to do the same with "send" but for the purpose of saving gas and blocks I want to mine the Contract only once.

Giving a contract that has decoupled methods, does the API support multiple "send" calls (of different methods of) a contract followed by single-mining?


texts:
I have a private block chain setup. I am calling a smart contract method from Go Lang. I my code in GoLang should wait until the transaction got mined. How I can achieve that.

Regards
AKM


texts:
I have a very simple contract with a withdraw function.

contract PayTest {
function() public payable {
}

function withdraw() {
    msg.sender.transfer(4000000000 wei);
}

}

When I try it in the JavaScript VM, it works.
But when I change to localhost and try to run it with Testrpc, I get:

VM Exception while processing transaction: out of gas

I cannot run Geth so I need to work with TestRPC. But that above does not work.

Thank you for helping!


texts: Can two state-changing transactions be in a single block?

texts:
I don't know how Ethereum verifies the atomicity of the state of a contract in the mining process.

Say I have a greet-counting contract.

If two people call the greet function in (almost) the same time, can both transactions be included in a single block and the counter be incremented by two?

Or only one transaction will included in a block and the other will be left in the queue for the following block? Or, the worst case, the other transaction will even be thrown away?


texts: web3.eth.sendSignedTransaction from address is different from Signer's address


texts:
I've been trying to figure out the best way to get the Net internal/trace transactions using python for a specific transaction hash.

I have read other topics on the forum that say that these are not recorded on the blockchain, so web3.py is not an option and you have to use a specialized kind of EVM to simulate a given transaction using the contract, I'm trying to avoid that, since it seems complicated on python...

I'm considering now using etherscan site Net Internal Transactions, I might resort to webscraping with beautifulsoup, but I don't know if anyone knows of a better alternative with python based api that does this (takes in a hash, returns internal transactions) that interacts with either etherscan/infura...


texts: Reentrancy Attack on Crowdsale contract with transferFrom method?

texts:
I'm trying to build a crowdsale contract for an existing erc20 token. This the function allows users to buy the token:

function buyTokens(address _beneficiary) public onlyApproved(_beneficiary) onlyBefore(endTimestamp) payable {
    require(msg.value > 0);
    uint256 tokensAmount = mul(msg.value, rate);
    weiRaised = add(msg.value, weiRaised);
    require(token.transferFrom(address(this), _beneficiary, tokensAmount));
    emit TokenPurchase(msg.sender, _beneficiary, msg.value, tokensAmount);
    owner.transfer(msg.value);
  }

The address of the crowdsale contract has been approved from the token owner to transferFrom his wallet to the buyers wallet. What I'm wondering now is if the function is vulnerable to a recursive attack. Thanks.


texts: How to call the super contract function where msg.sender should be same in solidity?

texts:
I am trying to call contract A.fun_A() via Contract C
contract A{
   function fun_A(address tenant, uint itemId){
     //Here the msg.sender should be msg.sender in C
     require(msg.sender == ownerOf(itemId));
     ....
   }
}

contract B is A{
    ...
}

contract C {
    B contract_B;
    constructor(address deployer_B){
        contract_B = B(deployer_B);
    }

    function fun_A(address tenant, uint itemId){
       //-------???? How to invoke fun_A where msg.sender should be same as in C
    }
}

Try 1:
(bool status1, bytes memory data1) = address(contract_B)
     .delegatecall(abi.encodePacked(bytes4(keccak256("fun_A(address, uint256)")), tenant, itemId));

Try 2:
(bool status1, bytes memory data1) = address(contract_B)
      .delegatecall(abi.encodeWithSignature("fun_A(address, uint256)", tenant, itemId));

Both didnt work.. I would like to invoke the inheritated functions through child contract where msg.sender should be same as in Contract C. is there any other way to pass address as an argument via delegatecall?
Update:
Thanks. removed space yet didnt solved. that did worked for the function in contract B.. but its not making call to the function in contract A.
https://gist.github.com/Kowsi/147cf728ec0da29bfbd9c7a5977b7d2c#file-dealerlessmarket-sol .. Line 123 is working fine.. Line 126 & 137 are not working.. Here I am trying to implement ERCX - ERC2615


texts: Implemening web3.js in front-end or back-end

texts: Is it better to implement web3.js in the front-end of the page or on the server, what benefits do i get if a implement it on front-end or on the back-end server?


texts: Is it possible for transaction not to be processed with low Gwei?

texts:
Is it possible for transactions not to be processed with low Gwei? Or will always be processed just will take some time?

Assume I do 1000s of transactions with 1 Gwei, can I rest assured that all transactions will be processed 100%, being the only down side that I have to wait a bit more?

Or I have the risk that some of them may not be processed?


texts: How to get a deployed contract instance in truffle console that was deployed without a migration?

texts:
I have a contract deployed with truffle to a testrpc local testnet.
This contract has has a function that deploys a new contract.

This new contract I can check the address in the testrpc console similar to this:

  Transaction: 0x85a7f17406536dd9618c6647d7d0595a2cee7e7e065ffc08a99e58aa5473ab71
  Contract created: 0x1104c5adf4476aec333ee687c725eacc8d417a7c
  Gas usage: 2642382
  Block Number: 7
  Block Time: Mon Feb 26 2018 19:27:25 GMT+0900 (JST)

But how can I use this new contract in the truffle console to interact with?
The json file of the contract (the ABI etc) was created in truffle's build directory, but because the contract is not migrated I cannot use this command:

MyNewContract.deployed().then(_app => { app = _app })
app.showMeTheMoney()

Does anyone how, in the truffle console, I can interact with contracts deployed through other contracts?


texts: Error in example source code in Solidity docs

texts:
Newbie here. I'm trying to deploy the example purchase contract shown on the Ethereum site here to the online Remix Solidity compiler at http://remix.ethereum.org/.

But when I copy/paste the example code as written, I get the following error message.

Error message

  browser/purchase.sol:62:25: Warning: Using contract member "balance" inherited from the address type is deprecated. Convert the contract to "address" type to access the member, for example use "address(contract).balance" instead.

 seller.transfer(this.balance);
                    ^----------^

Can anyone help correct my code below? I've shown my work and two things I've already tried unsuccessfully.

purchase.sol

pragma solidity ^0.4.22;

contract Purchase {
    uint public value;
    address public seller;
    address public buyer;
    enum State { Created, Locked, Inactive }
    State public state;

    // Ensure that `msg.value` is an even number.
    // Division will truncate if it is an odd number.
    // Check via multiplication that it wasn't an odd number.
    constructor() public payable {
        seller = msg.sender;
        value = msg.value / 2;
        require((2 * value) == msg.value, "Value has to be even.");
    }

    modifier condition(bool _condition) {
        require(_condition);
        _;
    }

    modifier onlyBuyer() {
        require(
            msg.sender == buyer,
            "Only buyer can call this."
        );
        _;
    }

    modifier onlySeller() {
        require(
            msg.sender == seller,
            "Only seller can call this."
        );
        _;
    }

    modifier inState(State _state) {
        require(
            state == _state,
            "Invalid state."
        );
        _;
    }

    event Aborted();
    event PurchaseConfirmed();
    event ItemReceived();

    /// Abort the purchase and reclaim the ether.
    /// Can only be called by the seller before
    /// the contract is locked.
    function abort()
        public
        onlySeller
        inState(State.Created)
    {
        emit Aborted();
        state = State.Inactive;
        seller.transfer(this.balance); // original attempt, yields below error
        // seller.transfer(address(contract).balance); // first unsuccessful attempt to correct
        // address(contract).balance; // second unsuccessful attempt to correct
    }

    /// Confirm the purchase as buyer.
    /// Transaction has to include `2 * value` ether.
    /// The ether will be locked until confirmReceived
    /// is called.
    function confirmPurchase()
        public
        inState(State.Created)
        condition(msg.value == (2 * value))
        payable
    {
        emit PurchaseConfirmed();
        buyer = msg.sender;
        state = State.Locked;
    }

    /// Confirm that you (the buyer) received the item.
    /// This will release the locked ether.
    function confirmReceived()
        public
        onlyBuyer
        inState(State.Locked)
    {
        emit ItemReceived();
        // It is important to change the state first because
        // otherwise, the contracts called using `send` below
        // can call in again here.
        state = State.Inactive;

        // NOTE: This actually allows both the buyer and the seller to
        // block the refund - the withdraw pattern should be used.

        buyer.transfer(value);
        seller.transfer(this.balance);
    }
}


texts: I am going to use a timestamp for certain quite important functionality. I am going to use now. Now my question is: can I trust this? Can I trust nodes not to tamper with this? How do other nodes verify that once the transaction is mined that the miner had correct time on his machine?


texts: How to pass public variable in Remix online compiler

texts:
Lets say I have this contract

pragma solidity ^0.4.11;
contract TestArray {
    uint[] public original;
    uint[] public newOriginal;

    function TestArray(){
        original.push(2);
        original.push(3);
    }

    function testRemove(){
        newOriginal = remove(original, 0);
    }

    function getLength(uint[] array) constant returns(uint number){
        return array.length;
    }

    function remove(uint[] array, uint index) internal returns(uint[] value) {
        if (index >= array.length) return;

        uint[] arrayNew;
        for (uint i = index; i<array.length-1; i++){
            arrayNew[i] = array[i+1];
        }
        delete array;
        return arrayNew;
    }
}

How would you call getLength function in Remix browser by passing newOriginal array. I also find that there is no way in Remix to see values of arrays.


texts: Metamask, Remix IDE: Cannot create an account: Error: Internal JSON-RPC error

texts:
I am trying to deploy a contract using Remix IDE and Metamask. But whenever I try to create to deploy the contract I get the error

  Cannot create an account: Error: Internal JSON-RPC error.

I am using Injected web3 and have followed every step on here:

https://medium.com/@merunasgrincalaitis/the-ultimate-end-to-end-tutorial-to-create-and-deploy-a-fully-descentralized-dapp-in-ethereum-18f0cf6d7e0e

Can anyone direct me as to why this is happening?


texts: Truffle Javascript tests won't change Contract State (Contract State won't Change)

texts:
I reviewed a similar answer but it didn't work. Right now I'm starting with an Example trying truffle, I did a small Echo project based on the Pet Store Box from Truffle. And i'm having some problems:

My contract is like this:

pragma solidity ^0.4.24;

import "./strings.sol";

contract Echo{
    address public owner;
    string[] private history;
    using strings for *;
    string public s;
    string public lastMessage;
    uint public messageCount;

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

constructor() public {
    owner = msg.sender;
    lastMessage = "None yet";
}

function echo(string text) public returns (string) {
    history.push(text);
    lastMessage = text;
    messageCount++;
    return text;
}

function fullHistory() public view returns (string){
    string memory _history = "";
    for (uint i = 0; i < history.length; i++){
        _history = _history.toSlice().concat("||".toSlice()).toSlice().concat(history[i].toSlice());
    }
    return _history;
}

}

So my tests in solidity work perfectly, i received the new values when i check the history of commands:

contract TestEcho {
    Echo echo = Echo(DeployedAddresses.Echo());

    function testWeReceiveWhatWeSend() public {
        string memory testText = "HELLO";
        string memory returnedText = echo.echo(testText);
        Assert.equal(returnedText, testText, "Should receive the same");
//        Assert.notEqual(word_count, 0, "Should have receive more than one");
    }

    function testWeReceiveTheHistory() public {
        string memory testText = "HELLO";
        echo.echo(testText);
        string memory fullHistory = echo.fullHistory();
        Assert.equal(fullHistory, "||HELLO||HELLO", "Should receive something");
    }

    function testWeReceiveTheLastMessage() public {
        string memory testText = "THE SECOND";
        echo.echo(testText);
        string memory message = echo.lastMessage();
        Assert.equal(message, testText, "Should receive the last message");
    }

    function testWeReceiveTheMessageCount() public {
        uint msgCount = echo.messageCount();
        Assert.notEqual(msgCount, 0, "Should be more than 0");
    }
}

But in javascript, they fail in modifying the Contract State, the history array won't change ever. The same happens to me in the web. Maybe i'm missing something obvious for sure, but I've been with this for days without a solution:

contract('Echo', async (accounts) => {
const from = accounts[0];

it("should return the same that i sent", async () => {
    const instance = await Echo.deployed();
    const textMessage = "TEST";
    const text = await instance.echo.call(textMessage, {from});
    assert.equal(text, textMessage, "echoes");
});

it("should return full history", async () => {
    const instance = await Echo.deployed();
    await instance.echo.call(web3.fromAscii("TEST"), {from});
    await instance.echo.call("TEST", {from});
    await instance.echo.call("TEST", {from});
    const history = await instance.fullHistory.call();
    console.log("FULL_HISTORY", history);
});
}

And for some reason that i do not know, Metamask stop asking me about spending some Gas when i use the echo function in the browser, i already check the port, and the network is correct, the account have funds, the only thing that changed was that i accidently uninstall METAMASK and install a new Version. Still that does not explain why the tests won't work

i will apreciate the help possible


texts:
This is the contract im calling createP to push Post

    struct Post {
        uint256 amt;
        bool isActive;
        address owner;
    }

    Post[] public posts;

    function createP(uint256 amt) public payable returns(uint a) {
        posts.push(Post({
            amt: amt,
            isActive: false,
            owner: msg.sender
        }));
        return (posts.length);
    }
    function getPostLength() returns(uint a){
        return (posts.length);
    }

Truffle code

        MyContract.deployed()
        .then(async instance => {
            const weiSpend = web3.toWei(2, "ether");
            var id = await instance.createP.call(10,{
                from: accounts[0],
                value: weiSpend
            });
        var id2 = await instance.createP.call(50,{
          from: accounts[1],
          value: weiSpend
        });
        var id3 = await instance.createP.call(100,{
          from: accounts[2],
          value: weiSpend
        });
        var last = await instance.getPostLength.call();
        console.log(id3.toString()); // returns 1 instead of 3
        console.log(last.toString()); // returns 0 instead of 3
        });


texts: Gas consumed by function invoking event?

texts:
I have a function to emit event. When I check Ganache, I find that gas used is 23078. Doesn't the event consume less gas than function with contract state change operations?

function log() {
    CheckUserAccess("John_Wick","Create",false);
}


texts:
My contract has data that is only for front-ends to read (the contract will never need to reference it again).

Is there any reason to write that data to the blockchain, or can Events just be emitted with the relevant information? So that front-ends can just scan the logs.

Emitting Events is apparently much cheaper than storing on-chain data, so sticking with Events is enticing.

Is speed an issue? How efficiently can web3 scan all blocks looking for Events, compared to reading from a contract? What other considerations are there?


texts: sendTransaction never resolves on web3.js 1.0.0 beta49 - beta52

texts:
My plain vanilla sendTransaction doesn't ever resolve on ganache with web3js 1.0.0 beta52:

async function sendTx() {
  const receipt = await web3.eth
    .sendTransaction({
      to: "0x1...",
      from: "0x2...",
      value: web3.utils.toWei("0.1", "ether")
    });

   return receipt;

Here is a barebone test script which should work on a "blank" ganache.

The script resolves on web3js beta48 although confirmations are not received (which might be a related issue?).

I also raised an issue in web3.js repo but it has been closed.

Does it work for you? What's wrong with my script?


texts: Creating a contract in Remix, not working

texts:
I am fairly new to solidity programming and using the Remix IDE to run and compile my Smart Contracts.For some reason whenever I open remix.ethereum.org website on Firefox the browser crashes.
Currently using it in IE. This is the simple code i am trying to run.

pragma solidity ^0.4.0;
contract sample{

    string name;
    uint age;

    function setName(string newName) {
        name=newName;
    }

    function getName()returns (string) {
        return name;
    }
}

But after clicking on Create button under the Run tab I dont see any textbox to enter Name or getName.
creation of sample pending... This is the message i get on the console.


texts:
Every time I try to send ETH to my locally deployed contract I get errors like this:

-While the error message says "out of gas" I know that can't be true since all my accounts have like 100ETH in them.

-The address to which I'm trying to send the ETH is that of a crowdsale contract I successfully deployed to localhost 8545 using truffle migrate

-I've tested this contract multiple times in truffle console by calling its functions - everything works fine, which is how I know its deployment was successful

-I'm not using geth or anything special - just localhost 8545

What's the problem here?


texts: How do the miners prove to have actually run the contract code that they claim the gas fees for?

texts:
How is the fact of execution of the contract bytecode in the VM proven by the miner?
Why can't a miner just say "uhm, the contract didn't do anything so I take all the gas"?


texts:
Is there a way in web3.py to create a wallet of accounts similar to web3.js to sign the transactions locally without building a raw transaction?

web3.js code:

var provider = new Web3.providers.WebsocketProvider(conf.networkURL);
var web3 = new Web3(provider);

const user1 = web3.eth.accounts.privateKeyToAccount(conf.accounts.user1.privateKey);
web3.eth.accounts.wallet.add(user1);

const contract = new web3.eth.Contract(contractAbi, contractAddress, { gasPrice, gas });
var result = await contract.methods.myMethod().send({ from: user1.address, gas, value });

Is there a reason to not to be that functionality?


texts: Create a slightly customized version of ethereum and run it as a node on a public ethereum blockchain

texts:
I might need a small modification to ethereum virtual machine but I still want to run it as a node on the public blockchain not private, if that makes sense. I assume its doable? Since I will not be changing the protocol at all.

Do any other companies run a customized versions of ethereum as a public node. What are the use cases/exampes here?


texts:
The code below gives me the exceeds allowance or always failing  transaction error but when i check my contract on remix i can see that the transaction goes through, makes the correct state changes and works as expected. In The assignment executionMetrics becomes undefined. I've been sitting trying to figure out the problem for 4hrs and I'm completely stuck. Anyone knows what's going on?

async function someAsyncFunc(){
  bookingPromiseArr = []
  let promise = instance.methods.bookTrip(tripKey).send({
    from: accounts[0],
    gasPrice: GAS_PRICE,
    value: 1,})
  bookingPromiseArr.push(promise)
  let executionMetrics = await executePromises(bookingPromiseArr, txStartTime)
}

async function executePromises(promisesArr, txStartTime) {
  await Promise.all(promisesArr)
    .then((receipts) => {
      let totalGasUsed = 0
      let txElapsedTime = Date.now() - txStartTime
      let lastBlock = receipts[receipts.length - 1].blockNumber
      receipts.forEach((receipt) => {
        totalGasUsed += receipt.gasUsed
        lastBlock =
          receipt.blockNumber > lastBlock ? receipt.blockNumber : lastBlock
      })
      // I've console logged here and seen that I've reached this point
      return {
        txElapsedTime: txElapsedTime,
        totalGasUsed: totalGasUsed,
        lastBlock: lastBlock,
      }
    })
    .catch((error) => {
      console.log('multipleTX():', error)
      process.exit(1)
    })
}

The smart contract function invoked:

function bookTrip(uint256 key) external payable requireTrip(key) nonBookedPassenger(key){
        Trip storage trip = trips[key];
        trip.passengers[msg.sender] = trip.price;
        trip.passengerCount++;
        emit LogNewTripPassenger(msg.sender, key, trip.price);
    }

Error log:

(node:23524) UnhandledPromiseRejectionWarning: Error: gas required exceeds allowance (8000029
) or always failing transaction
    at C:\Users\Diddi\Documents\mjukvaruteknik\examensarbete\tqdt33\node_modules\@truffle\hdw
allet-provider\node_modules\web3-provider-engine\subproviders\provider.js:18:36
    at XMLHttpRequest.request.onreadystatechange (C:\Users\Diddi\Documents\mjukvaruteknik\exa
mensarbete\tqdt33\node_modules\web3-providers-http\src\index.js:96:13)
    at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\Diddi\Documents\mjukvaruteknik\exame
nsarbete\tqdt33\node_modules\xhr2-cookies\xml-http-request-event-target.ts:44:13)
    at XMLHttpRequest._setReadyState (C:\Users\Diddi\Documents\mjukvaruteknik\examensarbete\t
qdt33\node_modules\xhr2-cookies\xml-http-request.ts:219:8)
    at XMLHttpRequest._onHttpResponseEnd (C:\Users\Diddi\Documents\mjukvaruteknik\examensarbe
te\tqdt33\node_modules\xhr2-cookies\xml-http-request.ts:345:8)
    at IncomingMessage.<anonymous> (C:\Users\Diddi\Documents\mjukvaruteknik\examensarbete\tqd
t33\node_modules\xhr2-cookies\xml-http-request.ts:311:39)
    at IncomingMessage.emit (events.js:228:7)
    at endReadableNT (_stream_readable.js:1185:12)
    at processTicksAndRejections (internal/process/task_queues.js:81:21)
(node:23524) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error origin
ated either by throwing inside of an async function without a catch block, or by rejecting a
promise which was not handled with .catch(). (rejection id: 1)
(node:23524) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In th
e future, promise rejections that are not handled will terminate the Node.js process with a n
on-zero exit code.
TypeError: Cannot read property 'txElapsedTime' of undefined
    at multipleTx (C:\Users\Diddi\Documents\mjukvaruteknik\examensarbete\tqdt33\client\cl-int
eraction\contractInteract.js:65:24)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
    at test (C:\Users\Diddi\Documents\mjukvaruteknik\examensarbete\tqdt33\client\cl-interacti
on\profile1.js:26:5)


texts: Can I transfer the funds from an account with just the account number and password?

texts: I have lost all the files from an Ethereum node where I had an account with some ether in it (I know I should have backed it up). Given than I know the account number and the password, can I transfer the ether into another node?


texts: Any best architecture to develop DAPP application?

texts:
I have tried developing Dapps using ethereum blockchain network.

If we are going to have the Blockchain as our truth value of our app. Whether all the data related to app will be stored and retrieved from blockchain ?

Else, do we need to have any intermediary data store which will connect with UI.
And also, is that efficient way to make use of logs to get the data from blockchain by watching all the events logs using web3 channel.


texts: Mixing two different GPUs on the same mining rig

texts: Is it possible to mix 3 ASUS RX480, 1 AMD 7990 and 2 r9 380 in the same mining rig? If so, will it be possible to overclock them?


texts: Creating an account using web3js or web3j

texts:
I am trying to create account on ethereum private network using web3js from front end.
I have written the below lines in my js file. The createAccount() gets called from an HTML page

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

function createAccount(){
    console.log("web3 version"+web3.version.api);
    web3.eth.accounts.create();
}

I get the below in the console
web3 version0.20.1

  Uncaught TypeError: web3.eth.accounts.create is not a function

Is it possible to create account on the node from front end html page using web3js?
If not then what are the steps for doing the same from web3j.


texts: How do you add miner address so that it can mint tokens?

texts:
I have ERC721 that I'm making.

function mint(address to, uint256 tokenId) public onlyMinter returns (bool) {
    _mint(to, tokenId);
    return true;
}

How can I add an address so that it is able to mint? Can I simply write a function that calls addMinter(address)? Or do I have to do it in the constructor?


texts:
I have issued an ERC20 token, currently I want to destroy some of my token, how to do that? Does there have a destroy address officially, I just transfer token into it, and no one can transfer out?

Please give me advice.
Thanks a lot~~


texts: is there any method convert mutiple params to one bytes in web3js ,and then get these original data from bytes in solidity?

texts:
eg:
the params in js code below,how to convert to one bytes

var min=100;
var max=100000000000;
var price=1000000000000000000000000000;
var name="john";

in solidity code below,how to get original data from bytes

function test(bytes _data)public{
uint min=...
uint max=...
string name=...
}


texts: Struct array not updated, function call returns old values

texts:
I have created following method in contract with the strcuture

contract testContract{
  Student[] public students;

  struct Student{
    string name;
    uint256 age;
  }

  function addStudent(string name, uint256 age){
    students[students.length++] = Student({name:name,age:age});
  }
}

now using ethereumj I call the function on the deployed contract as follows:

studentContract.callFunction("addStudent","ajay", 15);
Object[] objectArray = studentContract.callConstFunction("students");

The object array is of length 2 and contains the values "ajay" and 15, which is fine.

but when I call the function second time as follows :

studentContract.callFunction("addStudent","ajay", 15);
Object[] objectArray = studentContract.callConstFunction("students");
studentContract.callFunction("addStudent", "narendra", 17);
objectArray = studentContract.callConstFunction("students");

This time the object array should hold 4 values, i.e "ajay",15,"narendra",17.

But it still keeps the older values only, and length is not increased, objectArray has size 2 with values "ajay",15.

Please somebody provide answer to this.


texts: How to synchronise accounts between different geth installations

texts:
I have a problem. If I build two geth nodes A and B, these two nodes are already in communication and synchronization. I created accountA on node A, and I can unlock accountA on node A with the password. So can I unlock accountA in the console of node B?
I want to know if account information will be synchronized between geth nodes?
Hope you can give me some help, thanks!


texts: Variable in external js file not being set

texts:
I have run into something that seems pretty weird to me, although there's a good chance it's just a basic knowledge gap issue. As you can see, the following execution within the Node console produces the desired result, i.e. outputting the number of account addresses stored in accounts:

> var Web3 = require("web3");
undefined
> var web3 = new Web3(new
Web3.providers.HttpProvider("http://localhost:8545"));
undefined
> var accounts;
undefined
> web3.eth.getAccounts().then(_accounts => { accounts = _accounts });
Promise {
  _bitField: 0,
  _fulfillmentHandler0: undefined,
  _rejectionHandler0: undefined,
  _promise0: undefined,
  _receiver0: undefined }
> console.log(accounts.length);
10
undefined

However, running an external js file containing the exact same code

var Web3 = require("web3");

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

var accounts;
web3.eth.getAccounts().then(_accounts => { accounts = _accounts });

console.log(accounts.length);

produces the following error:

➜  ethtest node test.js
/home/brandon/ethtest/test.js:8
console.log(accounts.length);
                    ^

TypeError: Cannot read property 'length' of undefined
    at Object.<anonymous> (/home/brandon/ethtest/test.js:8:21)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:383:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:496:3

What could be the difference? Am I simply attempting something that cannot be done? Any help will be much appreciated, and thanks in advance!


texts: How To store data in ethereum network using truffle framework ?How to achieve the database layer in dapps?

texts: I am creating a dapp which has to be a login authentication system and some datas has to be store in database.  So I really cant' store all the datas in Solidity's variable or class object, it has to be a backend connection setup with the dataase like sql or nosql. If I am using some kind of database like mysql or mongodb etc..then doesn't this neglect the point of decentralised apps? If so, what's the solution?  Any example or article would help good. Thanks a lot


texts: Cannot call functions from another deployed contract that inherits yet another contract

texts:
I am just trying this using Remix editor. I am able to call functions from another deployed contract(plain as simple) but when that another deployed contract inherits yet another contract, Now the calling functions from the original contract to the deployed contract doesn't work. I just get a transaction revert

Working Code:

pragma solidity >=0.4.22 <0.6.0;
contract Existing {
    Deployed public dc;
    constructor(address _deployedContractAddress) public {
        dc = Deployed(_deployedContractAddress);
    }

    function setA(uint _a) public returns (uint) {
        return dc.setA(_a);
    }
    function getA() public view returns (uint) {
        return dc.a();
    }
}

contract Deployed {
    uint public a = 1;

    function setA(uint _a) public returns (uint) {
        a = _a;
        return a;
    }

}

Not Working Code:

pragma solidity >=0.4.22 <0.6.0;
contract Existing {
    Deployed public dc;
    constructor(address _deployedContractAddress) public {
        dc = Deployed(_deployedContractAddress);
    }

    function setA(uint _a) public returns (uint) {
        return dc.setA(_a);
    }
    function getA() public view returns (uint) {
        return dc.a();
    }
}

contract Ownable {
  address public owner;

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

  /**
   * @dev Throws if called by any account other than the owner.
   */
  modifier onlyOwner() {
    require(msg.sender == owner);
    _;
  }

}

contract Deployed is Ownable {
    uint public a = 1;

    function setA(uint _a) public onlyOwner returns (uint) {
        a = _a;
        return a;
    }

}

So here, the contract Deployed is inheriting from contract Ownable and I just get a transaction revert on calling setA

Note: contract Deployed is seperately deployed in a separate file and also included in contract Existing file.


texts: How essential is a knowledge of Javascript to learning solidity/ethereum?

texts: I am new to the ethereum space, and though I can code in C and C++, I keep noticing in the docs that there are references to Javascript and node.js and how similar it is to solidity as well as multiple use cases where they are used alongside solidity. I know nothing about either, and I'm wondering if it would be useful to put in some time to learn the basics before I get started with solidity? Any thoughts are appreciated.


texts: how to use the contract instance for multiple functions?

texts: I am trying to test the exchange where two types of tokens are trading. I want to set those tokens in exchange and trying to trade them between two accounts, but i am unable to get the updated instance of my contract, due to which i am getting error like "this abc is not a function"


texts: Can an ABI file be made from separate json files by stripping out information?

texts: I am looking at the CryptoKitties KittyCore contract. What I notice is that there are multiple contracts within the file. (https://etherscan.io/address/0x06012c8cf97bead5deae237070f9587f8e7a266d#code). I believe if I compiled this file that, even though all the contracts are in a single file, one json file would be created PER contract. However: we also see a single ABI file. The ABI file does not appear mention contracts at all but is rather all the function calls. How is such an ABI file created? Is this done via some compiler option?


texts: How can I get a list of token spending allowance for a wallet address?

texts:
Let's say I am an end-user who has been testing dapps here and there and I've approved multiple tokens spending for my wallet for different dapps.
Is there an easy way for me to get the list of which contract (dapp) is allowed to spend which token for my wallet?


texts: Best practices for importing contracts (Github vs. Including in project)?

texts:
On the remix docs, it gives examples of importing contracts from source either locally or from github.

I'm wondering for importing standard contracts (like say, OpenZeppelin's ERC20 StandardToken) would it be considered more modular to npm install the whole openzeppelin library so you can import their contract locally, or pull directly from github using the entire Github URL?

I'm guessing it doesn't make a difference on gas, but it seems to me like pulling from Github is a more "immutable" way of doing it. For that matter, though, since Openzeppelin is already deployed on-chain (likely tons of times actually), is there a standard way to just reference functions from a contract that's already deployed on the blockchain?


texts: Why is the returndata of a function returning bytes formatted in a weird way?

texts:
Solidity 0.4.25.

Consider this code

contract A{
    function test() public view returns (bytes){
        bytes memory output = abi.encodePacked(bytes32(1));
        return output;
    }
}

The returned data is:

  0000000000000000000000000000000000000000000000000000000000000020
  0000000000000000000000000000000000000000000000000000000000000020
  0000000000000000000000000000000000000000000000000000000000000001

If you look at how bytes are laid out in memory then the first bytes32 is the length of the bytes (in numbers of bytes, e.g. a bytes with 32 bytes length has 0x20 on the first bytes32 padded left). However apparently this returndata has TWO 0x20's in it. If you expand the length of the returned bytes the first bytes32 still stays 0x20.

I don't get why this is. What is the purpose of this 0x20? Is this a solidity bug or does it have any purpose?

The expected returndata would be:

  0000000000000000000000000000000000000000000000000000000000000020
  0000000000000000000000000000000000000000000000000000000000000001


texts:
I want to take the blocks between give timestamps. currently I manually use

fromBlock: (await web3.eth.getBlockNumber()) - 12343
toBlock: (await web3.eth.getBlockNumber()) - 6172

For getting yesterday's blocks. Is there any way to get the blocks using web3 between the timestamps?


texts:
I am working on building a coin that will be useful in providing UBI, but need a method to maintain the price of the coin, so that it doesn't fall below threshold.
Here is the idea:
So every month, each person will be paid 10,000 Dollar-Tax coins.
But dollar tax coins has the special property of disappearing. More time you keep the money, the more will be the transaction cost.
The amount of money lost per time is equal to 10,000/ 24 months in minutes.
An analogy can be the speed, the distance covered is 10,000 and speed will be 10,000/24 months in minutes.
So, if you keep 10,000 dollar-Tax coins a day, you will lose 13.888 (10,000/(24months*30days)) dollar-Tax coins.
After coins are burned, new coins will be minted to pay UBI again.
But how to maintain the price, as their is burning of coin, will the price will rise? How to make sure that the price don't fall below a threshold. Like use some reserve, but don't know how to implement it or start burning more fast when prices goes below threshold. Any ideas and problems with this model are welcome.


texts: Problem watching events without invoke functions in the Smart Contract

texts:
I have an event which is sent each time when a contract is deployed. It is launched in the constructor.

I have a Dapp where I want to watch this event to send a tx each time that a smart contract is deployed (it is the same one, but "updated").

Each time that I run my Dapp, the script is watching the event once, but if my Dapp is already running and if I deploy a contract I do not get the new event until re-run the Dapp.

The structure of my script is the following:

    App = {
      web3Provider: null,
      contracts: {},

      init: function() {
        return App.initWeb3();
      },

      initWeb3: function() {
        //some code
        return App.initContract();
      },
      initContract: function(){
        $.getJSON("MyContract.json", function(mycontract) {
          App.contracts.MyContract= TruffleContract(mycontract);
          //some code
          listeningEvents();
          return sendTx();
        })
      }
      sendTX: function() { /*some code*/ }
      listeningEvents: function(){
        App.contracts.MyContract.deployed().then(function (instance) {
          instance.Event({}, {
              fromBlock: 0,
              toBlock: 'latest'
          }).watch(function (error, event) {
                console.log("WATCHED EVENT")
          })
        })
      }

$(function() {
  $(window).load(function() {
    App.init();
  });
});

I am also trying to watch the address of the contract with the same purpose, but I am trying something like:

instance.watch('address', function (new, old) { ... })

and it does not work( err: instance.watch is not a function).

It seems that I have to run the script again because it is watching the previous smart contract, no the new one. Can someone explain to me in that case how to identify that the new contract is deployed? How can I watch the event? what is the right way to watch address?


texts:
I'm trying to use log events to show the transactions from newest to oldest. The problem is that line like this

  contractHandle.allEvents({ fromBlock: startingBlock, toBlock: 'latest'
  })

retrieves events from oldest to newest. I would like to present reports showing newest entries at the top. For small amount of entries this is not a problem, but if you want to allow paging through the results, this presents a problem, because each time you would have to go through all of the events to just show one page of results. Any ideas how to do this better?


texts: What Are Good Specific Reasons The onERC721Received Function Returns A Magic Value?

texts:
The ERC721 standard says the following:

  The onERC721Received function specifically works around old deployed contracts which may inadvertently return 1 (true) in certain circumstances even if they don't implement a function (see Solidity DelegateCallReturnValue bug). By returning and checking for a magic value, we are able to distinguish actual affirmative responses versus these vacuous trues.

This rationale says that there are certain circumstances where old contracts will inadvertently return 1 (true) even when they don't implement a function that is called.

The rationale gives the DelegateCallReturnValue bug as one of these circumstances. I would really like to know, what are the other circumstances?

In what circumstances will an old contract inadvertently return a wrong bool value when a method is called on it that does not exist?


texts: Get exchange volume or even price in a private network

texts:
I am creating a local private network for some testing purpose,

just tested with sendTransaction and some others API.

Now, i would like to trace the private network exchange volume, and also price if possible.

The only answer i found are just API from worldwide API website, not private, is there a way to implement this in a private network?


texts: Run parity in warp up to a certain block and archive mode after that

texts: Is there a way I can run parity in warp up to a certain non-latest block, say starting from block 3,000,000 after the network spam and full archival mode after that?


texts:
I am working on a trading bot with ethers.js and I would love if someone could elaborate on the following topic.
Many sniping bots try to buy as fast as liquidity is added to the pool. This can be done by listening to pending transactions that include for example the method that adds the liquidity to the pair, if you successfully listen to this method you could purchase the tokens in the same block.
However if the user who adds liquidity uses a custom (proxy?) contract to add liquidity (a contract that calls the addLiquidity function for the DEX), only the call for this custom contract would be registered, and it would be impossible to know what it did, not until its block was mined and you could process the events (which should include an event that attests liquidity was added).
My question is: This looks like a very straightforward way of avoiding sniping bots. Is there any catch, besides the additional difficulty of adding liquidity this way? Or is there a way to purchase in the same block, even when the liquidity was added though an obscure call?
Thanks!


texts: Simple ether transfer from parity wallet

texts:
I installed parity wallet and deposited 5 ether.
Now I am trying to transfer it to another address and "parity signer:pending" appeared
and it is going on for three hours and on.

How long does it take to transfer an ether to another address?


texts: geth --exec generates: error: TypeError: Cannot access member 'input' of null

texts:
I'm trying to run this command from this post, however when I run:

$ geth --exec "eth.getTransaction('0xbb8ee9866ee67277986b6f40775469c7a674810ce99dce3caff0d1117c8dcdac').input" console

it gives me the error:

  error: TypeError: Cannot access member 'input' of null

Here is full log:

$ geth --exec "eth.getTransaction('0xbb8ee9866ee67277986b6f40775469c7a674810ce99dce3caff0d1117c8dcdac').input" console
I0505 18:56:53.049949   26203 flags.go:425] WARNING: No etherbase set and no accounts found as default
I0505 18:56:53.050144   26203 database.go:71] Alloted 16MB cache to ~/Library/Ethereum/chaindata
I0505 18:56:53.060683   26203 database.go:71] Alloted 16MB cache to ~/Library/Ethereum/dapp
I0505 18:56:53.067958   26203 backend.go:314] Protocol Versions: [63 62 61], Network Id: 1
I0505 18:56:53.068571   26203 backend.go:362] Blockchain DB Version: 3
I0505 18:56:53.069163   26203 blockchain.go:214] Last header: #0 [d4e56740…] TD=17179869184
I0505 18:56:53.069181   26203 blockchain.go:215] Last block: #0 [d4e56740…] TD=17179869184
I0505 18:56:53.069187   26203 blockchain.go:216] Fast block: #0 [d4e56740…] TD=17179869184
I0505 18:56:53.075383   26203 cmd.go:115] Starting Geth/v1.3.6-9e323d65/darwin/go1.6
I0505 18:56:53.075487   26203 server.go:311] Starting Server
I0505 18:56:55.162538   26203 udp.go:212] Listening, enode://bfcb192b0d374ff7c5186a6ee96aa38cd71d8f87afa1e1fa153d42ff0d15ea93f67f035d984af921d21305cb0cd94ee3b71bfab60fc2c4bf5578620d488e4fa0@[::]:30303
I0505 18:56:55.162758   26203 backend.go:526] Server started
I0505 18:56:55.162787   26203 server.go:552] Listening on [::]:30303
I0505 18:56:55.163135   26203 ipc.go:112] IPC service started (~/Library/Ethereum/geth.ipc)
error: TypeError: Cannot access member 'input' of null
I0506 00:54:47.997968   54842 blockchain.go:690] Chain manager stopped
I0506 00:54:47.997994   54842 handler.go:192] Stopping ethereum protocol handler...
I0506 00:54:47.998007   54842 handler.go:202] Ethereum protocol handler stopped
I0506 00:54:47.998015   54842 tx_pool.go:156] Transaction pool stopped
I0506 00:54:47.998023   54842 backend.go:630] Automatic pregeneration of ethash DAG OFF (ethash dir: ~/.ethash)
I0506 00:54:47.998163   54842 database.go:158] closed db: ~/Library/Ethereum/chaindata
I0506 00:54:47.998488   54842 database.go:158] closed db: ~/Library/Ethereum/dapp

And when getting the transaction directly in geth console (as suggested), it's printing null, e.g.

> eth.getTransaction('0x6aae61d3b11e84caf573bb71ae44b9099db8dde996fb29c8b3aa6872681aa87d')
null

My geth is v1.3.6.

How to solve this issue?


texts: Explain "griefing" attack on Aave flash loan

texts:
Aave doc about flash loan warns to never store funds inside a receiver contract as it can be exposed to "griefing" attack.
So my questions are

Can you give an example of this attack?
How can funds be stored, when they need to be returned in the same transaction?

Thanks


texts: How can I tell a contract is ERC20 contract by golang

texts: There is one way that I can search the contract from all ERC20 contracts, but I  have to maintain a list of all ERC20 contracts, which is not very convinent, is there any interface I can use? Thx very much


texts: In the JSON RPC API documentation, where is the part about sending ERC20 tokens?

texts:
I'm looking to use the JSON RPC API to automate the sending of ERC20 tokens. Here is the documentation for it: https://github.com/ethereum/wiki/wiki/JSON-RPC

Does anyone know where the documentation is as it relates to sending ERC20 tokens? Thanks


texts: 6 transfer functions result to out of gas

texts:
I have a function that in first call just counts values and in next calls transfer some amount of ETH. It's like:

function() public {
  ...
  if (val !=0) {
    address1.transfer(val.mul(part1).div(100));
    address2.transfer(val.mul(part2).div(100));
    address3.transfer(val.mul(part3).div(100));
    address4.transfer(val.mul(part4).div(100));
    address5.transfer(val.mul(part5).div(100));
    address6.transfer(val.mul(part6).div(100));
  }
 val = msg.value;
}

The first call requires 368,351 of gas and the second call cannot be sent because of

Gas estimation errored with the following message (see below).
The transaction execution will likely fail. Do you want to force sending?
gas required exceeds allowance (7007659) or always failing transaction

If I delete 5 transfers then it works. As I know transfer requires only 2100 of gas so I have a question: is it possible that 6 transfers increase gas requiements so high or I have a mistake anywhere in my code?


texts: Is it possible to sync on the testnet -Ethereum-?

texts:
I want to learn about blockchain and installed ethereum, web3, node.js and npm in a VM.

The problem is that this machine has only 512MB ram, 5GB Disk e CPU I don't really have an idea but wouldn't say it is too powerful.

Is it possible to sync on the testnet?


texts: Etherum addresses confusion, How does it acutally works?

texts:
There are so many wallet websites ..wallet apps and then there is metamask ..my question is when ever we create a wallet account all these are ethereum addresses/accounts are created on the live Ethereum blockchain?

Also if a account is created on Ropsten or other networks can i get ethers in that from a live ethereum network and is it valid? or i should be careful when sharing my ethereum address and make sure it is from the real live network.

Please guide


texts:
How to use infura API with web3 js?
Where should I put secret key?


texts: What difference between if and require in solidity

texts:
if(_newDelegate != delegateContract){
    // Do something
}

require(_newDelegate != delegateContract){
    // Do something
}

Could anyone explain difference between if and require in solidity? When to use if and require? I taught both are same and can be used alternatively.


texts: How can I create a contract to manage customer balances?

texts:
I want to implement something like this: Test conditions for making ethers transfers between accounts.
3 accounts

I am having difficulty with the transfer functions.


texts: Is there a way to launch an in-memory Parity private chain?

texts: Is there a way to launch a all-in-memory Parity private chain for purpose of, for example, unit testing?


texts: Pausable ERC20 Tokens too much centralisation?

texts:
I see that a lot of ERC20 tokens are pausable. One example is MANA:
https://etherscan.io/token/decentraland#readContract

Doesn't this put a very high level of centralisation on the token? Potentially one person has the power to pause MANA indefinitely - a token with tens of millions invested in it could just be shut off.

I understand the benefit of Pausable. If there's a hack everything can be paused, but are we at a stage now where the ERC20 standard token doesn't require Pausable anymore allowing it to be fully decentralised?


texts: how to connect the quorum blockchain with the ethereum network using the bridge services.Can anyone clarify me about the bridge concept and how to implement it in quorum ethereum connection?


texts: I can not get to my MEW using Ledger Nano S

texts:
When I want to open my wallet using ledger, it says that "No Compatible devices were found"( it is just in Slovak language), however my ledger works as I am using it with another wallets. It only doesn't work with your new interface. Everything worked fine with old interface.
Can anybody help me to get to my wallet?
Thanks,


texts: Transaction call error, working on remix but fails with truffle

texts:
This is the struct for deals I created

// custom types
struct Deal {
    uint id;
    string name;
    string description;
    uint256 price;
    address seller;
    address buyer;
    string[] sellerDocuments;
    string[] buyerDocuments;
    string[] dealImages;
    uint status; // 0 - inactive, 1 - pending, 2 - active, 3 - paid, 4 - completed
    uint category; // 0 - oil, 1 - gas, etc
    uint256 dateposted;
}

This is my sellDeal() function.

// Sell Deal

function sellDeal(string _name, string _description, uint256 _price, string[] _images, string[] _sellerDocuments, string[] _buyerDocuments, uint _category, uint256 _dateposted) public {
    dealCounter++;
    // storing this deal
    deals[dealCounter] = Deal(
      dealCounter,
      _name,
      _description,
      _price,
      msg.sender,
      0x0,
      _sellerDocuments,
      _buyerDocuments,
      _images,
      0,
      _category,
      _dateposted
      );

    emit LogSellDeal(dealCounter, msg.sender, _name, _price);
}

I call the function using

app.sellDeal("deal 2", "desc for deal 2", 4000, ["img 1", "img 2"], ["sdoc 1", "sdoc 2"], ["bdoc 1", "bdoc 2"], 1, 123456)

It works on remix, but anytime I use truffle locally, I get

Error: Transaction: 0xf62026249e65bc3b10e3aff744e579b5434edca2c6dff47148d6648634b24685 exited with an error (status 0).
Please check that the transaction:
    - satisfies all conditions set by Solidity `require` statements.
    - does not trigger a Solidity `revert` statement.

    at StatusError.ExtendableError (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-error/index.js:10:1)
    at new StatusError (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-contract/statuserror.js:29:1)
    at Object.callback (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-contract/contract.js:181:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/method.js:142:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:89:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-provider/wrapper.js:134:1
    at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/httpprovider.js:128:1)
    at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:64:1)
    at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:354:1)
    at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:509:1)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:469:1)
    at IncomingMessage.emit (events.js:187:15)
    at IncomingMessage.EventEmitter.emit (domain.js:460:23)
    at endReadableNT (_stream_readable.js:1081:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

What am I doing wrong?


texts: Difference between zero knowledge succint non interactive of knowledge proof (zk snarks) and zero knowledge range proofs (zkrp)

texts: What are the differences between between zero knowledge succint non interactive of knowledge proof (zk snarks) and zero knowledge range proofs (zkrp) ?


texts: Cancelling a pending transaction on ETH blockchain

texts: I want to cancel a transaction on ETH chain but my hardware wallet does not have an advanced option to set a nonce for tx. Is there any alternative to cancel a tx ?


texts: Is there a secure implementation of inheritable Withdrawable/Withdrawal Pattern contract?

texts:
I'm building a contract which allows users to pay, earn and withdraw ether.

I want to keep it modular, so I want to write a contract named "Withdrawable".
The core contract will then inherit it and get a complete deposit/withdrawal system from it.

I searched for a while but didn't find what I want.
Most of the contracts just put anything together in one contract.

So I made a very simple one by myself.
It's not perfect, but it may help you get the idea.

pragma solidity ^0.4.21;

import "openzeppelin-solidity/contracts/math/SafeMath.sol";

/// @title BasicWithdrawable
/// @author Roger Wu (https://github.com/roger-wu)
/// @dev A cheap and not so secure implementation of a withdrawable contract.
/// @dev Inherit this contract to enable withdrawal from a contract.
contract BasicWithdrawable {
  using SafeMath for uint;

  mapping (address => uint) private balances;

  /// public getters

  function balanceOf(address _user) public view returns(uint _balance) {
    return balances[_user];
  }

  /// public functions

  function() public payable {
    deposit();
  }

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

  function transfer(address _to, uint _amount) public {
    require(_amount <= balances[msg.sender]);

    _decreaseBalance(msg.sender, _amount);
    _increaseBalance(_to, _amount);
  }

  function withdrawAll() public {
    require(balances[msg.sender] > 0);

    /// @dev To avoid re-entrancy attack, update the balance before transfer.
    uint _amount = balances[msg.sender];
    _decreaseBalance(msg.sender, _amount);
    msg.sender.transfer(_amount);
  }

  function withdraw(uint _amount) public {
    require(_amount <= balances[msg.sender]);

    _decreaseBalance(msg.sender, _amount);
    msg.sender.transfer(_amount);
  }

  /// internal functions

  /// @dev This function should be called when the derived contract gets paid
  ///   and wants to update the balance of a user.
  function depositTo(address _user, uint _amount) internal {
    require(_user != address(0));
    _increaseBalance(_user, _amount);
  }

  /// private functions

  function _increaseBalance(address _user, uint _amount) private {
    balances[_user] = balances[_user].add(_amount);
  }

  function _decreaseBalance(address _user, uint _amount) private {
    balances[_user] = balances[_user].sub(_amount);
  }
}

This contract is not secure enough because there is no contraint on depositTo() method.
If the derived contract does something wrong and causes
the sum of balances != this.balance, we have no way to prevent or fix it.

Is there a more secure and well-audited implementation of this contract?


texts: Keccak256(parameter) How to pass a string to be hashed?

texts:
I'm trying to do something that in theory is very simple: I want to pass a string like "hello" to a function and then compute the sha3/keccak256 hash.
I think the problem is that if the parameter is a bytes32 (as it is now), the hash function will produce a different output.

How can I get the same hashes with these two methods inside a smart contract? In practice, how to get a return true in the following code?

function someFunction(bytes32 _string) returns(bool){
    bool result = false;
    bytes32 hashparameter = sha3(_string);
    bytes32 hashstring = sha3("hello");
    if(hashstring == hashparameter) {
        result = true;
    }

    return result;

}

How can I truncate the passed bytes32 so that it consider only the first 5 bytes for the sha3?

Thanks for your time, I hope you have the solution. If I'll find something, I'll update the question.


texts: How to combine a MultiSigWallet with the advantages of a HD Wallet?

texts:
For a token sale we want to use the MultiSigWallet from ConsenSys where all team members will registered as signer while every transaction needs to be signed by at least 2 team members.

Otherwise we also like the idea of using HD Wallets to make it easier to identify a payment with a particular purchase while using new addresses only once for every purchase.

Is there any way to combine both approaches?


texts: Contract has not been deployed to detected network when deploying to main net

texts:
I'm trying to deploy a smart contract to the main Ethereum network, and I'm having trouble actually getting my front-end to work. I'm using Truffle, Geth, Infura, and web3js.

var HDWalletProvider = require("truffle-hdwallet-provider");

var mnemonic = "hidden_for_obvious_reasons";

module.exports = {
  networks: {
    live: {
      network_id: 1,
      provider: new HDWalletProvider(mnemonic, "https://mainnet.infura.io/my_api_key")
    }
  }
};

Inside Adoption.js, which is the artifact for my contract, I see the following:

  "networks": {
    "3": {
      "events": {},
      "links": {},
      "address": "0xf45599d4f5a0e9b3f8f4b45012f96e038e7208e6"
    }

I think that has something to do with it.

My contract deploys without any issues and I can see it on etherscan here.

My 1_initial_migration.js file:

var Migrations = artifacts.require("./Migrations.sol");

module.exports = function(deployer) {
  deployer.deploy(Migrations);
};

My 2_deploy_contracts.js file:

var Adoption = artifacts.require("Adoption");

module.exports = function(deployer) {
  deployer.deploy(Adoption, {gas:2000000});
};

I'm just trying to figure out why my front-end can't interact with my contract. Here's the console output in the browser:

truffle-contract.js:425 Uncaught (in promise) Error: Contract has not been deployed to detected network (network/artifact mismatch)
    at truffle-contract.js:425
    at <anonymous>


texts: Block header structure change under Proof of Stake?

texts:
The yellow paper describes the below block header structure:

This includes difficulty, beneficiary, mixHash and nonce values. Presumably these will be redundant under Proof-of-Stake. How will the Block Header structure change under proof of stake? Where is this defined? If it's to be confirmed, where/when is it likely to be confirmed.


texts: Golang How to slice Ethereum log events from smart contract to a more readable format

texts:
Im looking to use a channel to watch contract log events but the output returns a byte array like this

the go code i am using looks like this

        package main

        import (
            "context"
            "fmt"
            "log"

            "github.com/ethereum/go-ethereum"
            "github.com/ethereum/go-ethereum/common"
            "github.com/ethereum/go-ethereum/core/types"
            "github.com/ethereum/go-ethereum/ethclient"
        )

        func main() {
            client, err := ethclient.Dial("wss://rinkeby.infura.io/ws")
            if err != nil {
                log.Fatal(err)
            }

            contractAddress := common.HexToAddress("0x0337da4ac39966a3acff66b281472ba91762045b")
            query := ethereum.FilterQuery{
                Addresses: []common.Address{contractAddress},
            }

            logs := make(chan types.Log)
            sub, err := client.SubscribeFilterLogs(context.Background(), query, logs)
            if err != nil {
                log.Fatal(err)
            }

            for {
                select {
                case err := <-sub.Err():
                    log.Fatal(err)
                case vLog := <-logs:
                    fmt.Println(s)
                    fmt.Println(vLog)
                }
            }
        }

and the smart contract is put together as follows

    pragma solidity ^0.4.24;

    contract Store {

        event ItemSet(bytes32 key, bytes32 value);

        string public version;

        mapping (bytes32 => bytes32) public items;

        constructor(string _version) public {
            version = _version;
        }

        function setItem(bytes32 key, bytes32 value) external {
            items[key] = value;
            emit ItemSet(key, value);
        }

    }

and the output from the go script is like this but id like it to be more readable and friendly.

{[3 55 218 74 195 153 102 163 172 255 102 178 129 71 43 169 23 98 4 91] [[231 158 115 218 65 119 16 174 153 170 32 136 87 85 128 166 4 21 211 89 172 250 217 205 211 56 45 89 200 2 129 212]] [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 116 101 115 116 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 116 101 115 116] 2953868 [98 220 227 61 110 2 130 66 120 56 30 32 186 128 34 184 128 50 201 124 70 143 210 120 186 145 138 210 219 237 228 72] 7 [11 61 192 53 238 180 252 64 240 177 48 148 54 226 100 165 7 106 118 111 45 182 231 244 52 103 175 51 192 94 97 250] 6 false}

I tried to slice it as an array but i get the error Cannot slice types.Log which seems to be defined in here https://github.com/ethereum/go-ethereum/blob/master/core/types/log.go