texts: Golang binding - call contract method and get its return value or tuple?

texts:
Suppose i have contract like:

pragma solidity ^0.4.11;

contract MyToken {
  uint256 a;

  function SimpleGetter() returns(string) {
    return "something";
  }

  function DoTheGreat(address _to) returns(uint256) payable {
       /// ...
       return /* <...> */;
  }
}

I've followed article a bit outdated, but still very useful and have generated Go binding for my contract, then just end up with something like:

// Generate "CEO" keypair(wallet)
key, _ := crypto.GenerateKey()
CEOAuth := bind.NewKeyedTransactor(key)

// Create genesis
alloc := make(core.GenesisAlloc)
alloc[CEOAuth.From] = core.GenesisAccount{Balance: big.NewInt(20000000000000)}

sim := backends.NewSimulatedBackend(core.GenesisAccount{Address: auth.From, Balance: big.NewInt(10000000000)})

// Deploy a token contract on the simulated blockchain
_, _, token, err := DeployMyToken(CEOAuth, sim, ..)
if err != nil {
    log.Fatalf("Failed to deploy new token contract: %v", err)
}

sim.Commit()

val, _ := token.SimpleGetter(nil)
fmt.Println("Something from contrract:", val)

I actually using MyTokenSession:

 the Token contract instance into a session
session := &MyTokenSession{
    Contract: token,
    CallOpts: bind.CallOpts{
        Pending: true,
    },
    TransactOpts: bind.TransactOpts{
        From:     CEOAuth.From,
        Signer:   CEOAuth.Signer,
        GasLimit: big.NewInt(3141592),
    },
}

The problem is that we take a look at Go bidining from abigen for our function DoTheGreat(), it looks like:

func (_MyToken *MyTokenSession) DoTheGreat(_to common.Address) (*types.Transaction, error) {
    // ....
}

As you can see, it returns *types.Transaction and i don't see a way to understand do i have to sign it, send it, and how to get the return values from my contract function.

The value for tx.Value() is *big.Int, but it is not related to data returned by contract, it is always zero. Could someone throw in some code for my case?


texts: Geth Sync Problems | Rinkeby, Ropsten | Deploy contracts

texts:
Get Geth to sync --> Rinkeby test network. For the love of god I just want to deploy a contract. I have deployed it to Ganache-cli, GUI, remixIDE, deployed with truffle/Infuria.io...I keep failing to synchronize the rinkeby network. I have tried on macOS with commands geth --rinkeby --rpc --rpcapi="personal,eth,network,web3,net" --ipcpath "~/Library/Ethereum/geth.ipc"

I tried on windows, ubuntu and I had the same problem.

I will fire up geth attach and  eth.syncing will show the blocks climbing and there will be maybe around 100 blocks left and then it will show an error: Synchronization failed, dropped peers etc etc. The eth blocknumber, eth latest block shows zero, wallet shows zero balance even though I transferred test eth to the account and it shows up on Ropsten/Rinkeny Etherescans.

I have tried no ipcpath declaration
Deleting the blockchain data and restarting
Checking the time sync
I have tried ropsten network syncing same problem
I have heard you cannot sync with a standard HDD? I don't know, is this true for test networks? Mainnet?

I am sure I am doing something wrong on my end because I have tried multiple OSs, different systems. Please any assistance would greatly be appreciated. Too many hours, my chest hurts.


texts: Understanding TokenCreator/OwnedToken example from Solidity documentation

texts:
Here's the page containing the example https://solidity.readthedocs.io

Here are two contracts that are supposed to work together(my questions are below):

Here's how I think it works. Please correct my steps while I try to walk you through.

Since one contract is per one address, these two contracts are deployd to two different adresses.
In the constructor function of OwnedToken contract creator variable is assigned a contract located at msg.sender address. Through this variable it's then possible to access functions of that contract. It leads me to think that the creator of this contract must be another contract(TokenCreator)
I then look at the code of TokenCreator contract in order to find which function is responsible for creating OwnedToken contract. I find it on line 43.
Now I'm stumped. How does new OwnedToken(name) works? How does TokenCreator contract sees OwnedToken?

In addition I just discoverd a compiler error:

It's so exciting to plough trough all this stuff! Thank you, you're great!

EDIT: Made some changes, and it now makes more sense


texts: Is it possible to extract individual timestamps of the transactions' execution time in a given block? The Ether-scan API gives only the timestamps of the block collation, doesn't mention anything about individual timestamps.


texts: question about the network of blockchain

texts: Tell me please. with whom does the first interaction occur when starting the client \ wallet? I'm trying to understand how the client works. Blockchain is a decentralized system, but if it needs to communicate with any server to find the first seed, it turns out that it is centralized. Please explain this to me. How does the network of blochchain work?


texts: I got " VM Exception while processing transaction: invalid opcode" error

texts:
I am trying to do truffle migrate but I got this error

$ truffle migrate

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

Starting migrations...
======================
> Network name:    'ganache'
> Network id:      5777
> Block gas limit: 0x6691b7

1_initial_migration.js
======================

   Deploying 'Migrations'
   ----------------------
   > transaction hash:    0x5978e17f80a8a034b1649f92b95dd7206509c861531627abd49c127979bda43b
- Blocks: 0            Seconds: 0
   > Blocks: 0            Seconds: 0
   > contract address:    0x37B440bFDd64A3F3e1fd51D05DCBD7a194203275
   > block number:        3
   > block timestamp:     1566999869
   > account:             0xF5d64F31F49f577d1F4677C49E64404D29733E3D
   > balance:             99.85510478
   > gas used:            261393
   > gas price:           20 gwei
   > value sent:          0 ETH
   > total cost:          0.00522786 ETH

- Saving migration to chain.
Error: Error: Error: Returned error: VM Exception while processing transaction: invalid opcode
    at Object.run (C:\Users\yaldiz.seyma\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-migrate\index.js:92:1)
    at process._tickCallback (internal/process/next_tick.js:68:7)
Truffle v5.0.33 (core: 5.0.33)
Node v10.16.3


texts: Smart contracts - Permissions and grouping users on the blockchain

texts:
I am trying to understand SMART contracts and would like some help with my understanding. I think the best way to answer my questions is with example scenarios.

If I have a notary service on the blockchain, I will have a contract
called Notary.sol. This will contain details like the owner,
recipient, document. Once all parties have signed the document then
a confirmation is sent somewhere. My question is that every time a
new document needs notarized do I need to submit a new contract to
the blockchain again so there is a new “instance” with a new state etc?
Further to the notary example, I would like the smart contract to
check extra details of the other parties before they are allowed to
sign. For example, checking their permissions or even just grabbing
their name. To do this would I call another smart contract as an event
to get the result back before continuing with the rest of the
contract?
In the health sector, there are doctors and patients. For example, a
doctor can have many patients. A patient can have a primary
physician. The similar relationship applies to teachers and
students (many to many relationships). This might get more complicated with storing student grades. This seems more appropriate to manage this in a relational
database but the blockchain used for managing the trust in recording
transaction. In the case of the doctor patients example. I might want a contract to move all patients to another doctor if their current one leaves/retires. That requires the blockchain knowing which patients belong to the doctor. How could I control that in the blockchain or contracts?
How do I ensure that only particular users can execute a contract?
Will the contract have their addresses which we can validate before
execution?

Hopefully, these are clear questions and I appreciate the responses

Thanks


texts: not able to approve the contract for safeTransfer

texts:
pragma solidity 0.8;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/utils/ERC721Holder.sol";

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/IERC721.sol";

contract TokenTicket1 is ERC721Holder{

     IERC721 public Token;

     constructor (address _token) public {
         Token = IERC721(_token);
     }

     function _approval(uint id) external{
         Token.approve(address(this), id);
     }

     function deposit(uint id) external{
         Token.safeTransferFrom(msg.sender, address(this), id);

     }

     function withdraw(uint Id) external{
         Token.safeTransferFrom(address(this), msg.sender, Id);
     }

}

token address ---> https://rinkeby.etherscan.io/token/0x5ff5a01a288c44f5bacab3291532a74c16642556
This is the error I get:


texts: Running contract CrowdFunder in Mix and function modifier causes - Solidity exception (bad jump)

texts:
I'm experimenting with contract CrowdFunder which I found on the net

https://github.com/nemild/learnxinyminutes-docs/blob/solidity/solidity.html.markdown

and I'm getting an error Solidity exception (bad jump)  when function payOut() is executed and state enum  variable is different than the one which is passed to inState(State.Successful)

enum State {
        Fundraising,
        ExpiredRefundPending,
        Successful,
        ExpiredRefundComplete
    }

   modifier inState(State _state) {
        if (state != _state) throw;
        _
    }

If state == _state then there is no error. Function executes as expected.

function payOut()
    public
    inState(State.Successful)
    {
        if(!fundRecipient.send(this.balance)) {
            throw;
        }

        winnerPaid(fundRecipient);
    }

Is this because inState function is defined to execute throw when the _state !=state. Is this the cause of Solidity exception (bad jump)?


texts: Creating contract account with ether balance in original sendTransaction?

texts:
trying to send a very simple contract creation transaction that includes a value with it so that the created contract already contains an ether balance.  Is this not possible.  Basically I'm sending a transaction like this using the web3 console API,

web3.eth.sendTransaction({from:web3.eth.coinbase, data: <some contract data>, value: web3.toWei(1, 'ether')})

however I get a revert error.

I know that I can create the contract, and as long as the fallback function is payable in the contract I can then deposit ethers, but I'd like to be able to do this in one go when the contract is created.  Is this possible?

In case it makes a difference I'm doing this in a truffle development chain console.


texts:
From what I am gathering based on this question and this question it seems that I am better off not trying to clear arrays or mappings. As the documentation on mappings indicates every possible key is initialized upon declaration and mapped to zero values.

I've taken Nick Johnson's advice from the first Q and I'm keeping an array count which I'm using to iterate through the arrays (and mappings) in lieu deleting the arrays. My question is whether there's anything to be gained by clearing out the values associated with keys which are storing data.

One mapping is from an address to a list of structs, the other is from an address to a struct. Am I correct in thinking that the gas cost of storing the data is spent when it is set and thus there is no additional value in trying to free up space by clearing the struct data out?


texts: How do I set up 2 private mining nodes on the same computer?

texts:
I am trying to setup a private ethereum network. I started two nodes in the same machine (Windows 7) in two different ports.

I am unable to add one node as the peer of the other node. What I have done so far is this.

Find the node address of one node.

> admin.nodeInfo.enode
"enode://5d272e8bee6d29dfff6313999a4a2c3d8109ae6f3eb103480f4536c0542549b9fa12a8d8ae5ebee9c4db55cab553693b04eedbc9b29f35bbc0af1956231b42b4@0.0.0.0:30303"

Add the node to the other peer.

> admin.addPeer("enode://5d272e8bee6d29dfff6313999a4a2c3d8109ae6f3eb103480f4536c0542549b9fa12a8d8ae5ebee9c4db55cab553693b04eedbc9b29f35bbc0af1956231b42b4@127.0.0.1:30303")

true

But, if I check peer information of the second peer, it shows that it doesn't have any peers.

> admin.peers

[]

Does anyone have any idea what is going wrong?

Also, why does the first node show its IP as 0.0.0.0?


texts:
uint[2] testStorage;

    function assemblyStorage() public  returns (uint a, uint b){
       testStorage[0] = 5;
       testStorage[1] = 10;
       uint[2] memory testMemory = testStorage;
       assembly {
           a:=mload(0x80)
           b:=mload(add(0x80, 32))
       }
    }

I do the following. Now, why does a and b return both 0? instead of 5, 10 ? It got me curious since storage array should be copied to memory..
So, the actual place where 5, and 10 reside is mload(add(0x80, 64)) and mload(add(0x80, 96). Any idea why they are not at 0x80 and add(0x80, 32) since initial memory place is 0x80 ?


texts:
I've created a test network --networkid="11111" and I was able to create the "greeter" contract as an excercise.

Now, I'm following this guide and I am trying to register a name, but with no luck: registrar.addr("myname") returns 0x.

Is it possible to register a name within the test network or am I doing something wrong?

A similar unanswered question is at the forums.


texts: Event listener works correctly from outside of the machine but not from inside the machine

texts:
I have created an event listener for my application. When I run the event listener from outside of the machine it listens correctly to all the events but when I run the same event listener (with different configuration) from inside the machine it does not correctly listen to the events.
The contracts are deployed from outside of the machine.

class BlockchainSettings:

  class local:
    host = "127.0.0.1"
    port = "2020"
    netId = "237381"

  class remote:
    host = "public address"
    port = "2020"
    netId = "237381"


texts: Remove an ERC20 contract from blockchain so it won't be visible in etherscan

texts:
I made my first ERC20 and done some mistakes, I wanna delete it and create a new one with the same name and the same symbol

I have found how to delete the tokens but not the Contract itself so basically, the contract will remain in the etherscan.io site under Tokens.

What can i do ?


texts: ERC721 Error: invalid number value arg="_tokenId", coderType="uint256", value=

texts:
MyERC721:

pragma solidity ^0.5.0;

import "openzeppelin-solidity/contracts/ownership/Ownable.sol";
import "openzeppelin-solidity/contracts/token/ERC721/ERC721Full.sol";
import "openzeppelin-solidity/contracts/token/ERC721/ERC721Mintable.sol";

contract MyERC721 is ERC721Full, ERC721Mintable, Ownable {

    constructor() ERC721Full("ThuleenCert721", "TC721") public {}

    /**
    * Custom function to create a unique token
    * @param _to The address that will receive the minted tokens.
    * @param _tokenId The token id to mint.
    * @param _tokenURI The token URI of the minted token.
    */
    function mintUniqueTokenTo (
    address _to,
    uint256 _tokenId,
    string  memory _tokenURI // Store, receipient's name, grade and program details
    ) public
    {
        super.mint(_to, _tokenId);
        super._setTokenURI(_tokenId, _tokenURI);
    }
}

MyDeployment script using web3 (version0.2)

var tx = await nft.mintUniqueTokenTo(
            receipientAddress,
            122164239941406260, // <- tokenId
            tokenURI, { from: coinbase }
        );

The script above works is tokenId is smaller, say "12216" but with the value of "122164239941406260" (18 digits) the script gave me the following error:

UnhandledPromiseRejectionWarning: Error: invalid number value (arg="_tokenId", coderType="uint256", value=122164239941406260)

In fact, I tested with different (tokenId) values and it works up to 16 digits.

So I "assumed" the error "invalid number value" means the value is too large? Really? How do I solve this?


texts: can't apply any contract, cant send any ETH. Mist is on the actual block, time is updated - nothing works. what to do? on etherscan it still shows my balance. always stuck on 0 out of 12 confirmations


texts: What are the best practices to keep your ethereum smart contract code from being copied and reused?

texts:
I'm new to smart contract development. I have built a couple of sample projects and deployed those to my private network. So now I am doing some research on best practices in regards to smart contract security and protecting my intellectual property from those that would like to steal it and use it for their own purposes.

From what I have read, smart contract bytecodes are visible in the blockchain, but supposedly it is impossible to turn those bytecodes back into solidity code. Even still, is there anyway to take the bytecodes from the block chain, copy them and use them for your own purposes?

Please give me some best practices to follow when dealing with smart contracts in regards to security and protecting my intellectual property.


texts: web3.py - Python dtype for contract function with int256[x]

texts:
Say I have this example contract:

pragma solidity ^0.4.0;
contract SEexample {

    int256[3] thing;
    uint8 internal i=0;

    function submit(int256[3] bids,int256[3] prefs) public returns (int256[3]){
            for (i=0;i<3;i++){
                thing[i] = bids[i] + prefs[i];
            }
        return thing;
    }
}

Giving this abi:

[
    {
        "constant": false,
        "inputs": [
            {
                "name": "bids",
                "type": "int256[3]"
            },
            {
                "name": "prefs",
                "type": "int256[3]"
            }
        ],
        "name": "submit",
        "outputs": [
            {
                "name": "",
                "type": "int256[3]"
            }
        ],
        "payable": false,
        "stateMutability": "nonpayable",
        "type": "function"
    }
]

And I deploy using web3.py:

from web3 import Web3, HTTPProvider, IPCProvider
w3 = Web3(HTTPProvider('http://localhost:8545'))   //(testrpc)
tx_hash = contract.deploy(transaction={'from': w3nce.eth.accounts[0], 'gas': 10000000})
tx_receipt = w3.eth.getTransactionReceipt(tx_hash)
contract_address = tx_receipt['contractAddress']
contract_instance = w3.eth.contract(address=contract_address, abi=abi, ContractFactoryClass=ConciseContract)

How do I instruct python to meet the int256[13] that the function requires?

I've tried variations on:

import numpy as np
a=np.ones((3,),dtype=int)
b=np.ones((3,),dtype=int)
x=contract_instance.submit(a,b, transact={'from': w3.eth.accounts[1]})

also with a.tobytes(), b.tobytes()

Results in :

raise ValueError("No matching functions found")

ValueError: No matching functions found


texts: Passing ether with call to Solidity function

texts:
I have deployed a contract to testnet which appears to function.

I have a function named contribute which gets the ether from the msg.value.  The function is below and doesn't take any arguments.

I call contribute from JavaScript like this:

var res = contracts['CrowdFunder'].contract.contribute();

How do I specify ether to be sent when calling contribute?

Here is contribute which expects msg.value

function contribute() public
    {
        contributions.push(
            Contribution({
                amount: msg.value,
                contributor: msg.sender
            })
        );
        totalRaised += msg.value;
    }


texts: Transaction out of gas with Remix and Metamask

texts:
I'm trying to deploy a contract with Remix and Metamask but I get this error every time I'm trying to do it.
creation of ICODeployer errored: Error: [ethjs-query] while formatting outputs from RPC '{"value":{"code":-32010,"message":"Transaction cost exceeds current gas limit. Limit: 12487794, got: 13119230. Try decreasing supplied gas."}}'
I don't know why might be the problem since yesterday I tested it and everything was working correctly. I set a lower gas limit in Metamask(below 12487794) but the contract will fail deploying. When I look at the transaction on etherscan, it is same error "Out of gas". This is the link to the transaction.https://kovan.etherscan.io/tx/0x58b73cde126056e9b9cbab251dfdba89d81c1633bc235e8b80f85062c86d70bb
How can I manage this error? I already tried modifying the gas cost in Metamask to a lower value and the gas limit in remix to a higher value but it's not working. Any help would be appreciated!


texts: SafeMath and user input: it's always possible to overflow/underflow. No way out?

texts:
SafeMath doesn't prevent overflow/underflow from user input.

Example:

function sub(uint8 a, uint8 b) public returns(uint8) {
   require(b <= a);
   uint8 c = a - b;
   return c;
}

Say the user inputs a == 30 and b == 260, it will pass, since by the time the scope of the function is executed, b has already been overflown to 4.

Is there no way of preventing that, other than preventing that input on the client side?

My point is that SafeMath is not nearly safe when you are dealing with user input. But checking that on the client side isn't safe either, since it's always possible to interact with a contract "directly", bypassing any front-end application.

What am I missing here?


texts: Geth Installation stopped: PC endpoint opened: \\.\pipe\geth.ipc

texts:
Look the picture :)
Why this is not working ? Its stopped


texts: how to handle gas run out in a payable function

texts:
function payMe() payable{
    // doing some stuff with `msg.value`

    users[msg.sender].balance += modifiedMsgValue ;
}

In the above code what if gas runs out on the second line? so there will be no gas left to update user's data and add the ETH to the user's balance.

will the function be reverted and will the ETH returns back to the user?
if not, what is the solution for such scenario?

is there a way to estimate the gas usage for the function and if there is not enough gas just revert the function?


texts: Given a RAW Transaction - how to get senders address

texts: Is it possible to get the senders address using golang when all you have is the raw transaction string. I can decode it and get the nonce, hash, to etc as these are all exported functions from the types.Transactions package but I cant seem to find a way to get the actual senders address (using golang) Javascript has some functions for doing so - I should also state that I need to do this in a standalone script rather than being connected to a node (if possible)


texts: Calling contract from contract not working

texts:
below are very simple setup of one contract calling another contract and I somehow can't get it to work.

Contract C1

pragma solidity ^0.5.0;

contract C1 {
    int public x = 1;

    function setX(int _x) public {
        x = _x;
    }

    function getX() public view returns (int y) {
        return x;
    }
}

Contract C2

pragma solidity ^0.5.0;

import { C1 } from './C1.sol';

contract C2 {
    C1 c1;
    constructor(address _c1) public {
        c1 = C1(_c1);
    }

    function setX(int _x) public {
        c1.setX(_x);
    }

    function getX() public view returns (int) {
        c1.getX();
    }
}

calling setX and getX on C1 works perfectly. But C2 methods don't work.
Tried on https://remix.ethereum.org/
Tried with solidity compiler 0.5.0 and EVM version constantinople.
I guess I am doing something wrong but not able to figure out what.

Edit: Add JS Code:

'use strict';

const web3 = require("web3");
const solc = require("solc");
const fs = require("fs");

const w3 = new web3(new web3.providers.WebsocketProvider("ws://***.***.***.***:8545"))

// compile contract
const contracts = {
    'C1.sol': {
        content: fs.readFileSync(__dirname + "/C1.sol", "utf-8")
    },
    'C2.sol': {
        content: fs.readFileSync(__dirname + "/C2.sol", "utf-8")
    }
}

const input = {
    language: 'Solidity',
    sources: contracts,
    settings: {
        optimizer: {
            enabled: false
        },
        outputSelection: {
            '*': {
                '*': ["abi", "evm.bytecode"]
            }
        }
    }
}

const parsedOutput = JSON.parse(solc.compile(JSON.stringify(input)));

const compiled = {};
for (let contract in contracts) {
    const name = contract.split(".")[0];
    const output = {};
    output.abi = parsedOutput.contracts[contract][name].abi;
    output.bin = parsedOutput.contracts[contract][name].evm.bytecode.object;
    compiled[name] = output;
}

// console.log(compiled);

// deploy contract

const init = async () => {
    const addresses = await w3.eth.getAccounts();
    console.log(addresses);

    const sendObj = {
        from: addresses[0],
        gas: 450000000
    };
    const callObj = {
        from: addresses[0]
    }

    // deploy C1
    const ct1 = new w3.eth.Contract(compiled["C1"].abi);
    ct1.options.data = "0x" + compiled["C1"].bin;
    const ct1Deployed = await ct1.deploy().send(sendObj);
    console.log(ct1Deployed.options.address);

    const newCt1 = new w3.eth.Contract(compiled["C1"].abi, ct1Deployed.options.address);

    console.log(await newCt1.methods.getX().call(callObj));
    await newCt1.methods.setX(123).send(sendObj);
    console.log(await newCt1.methods.getX().call(callObj));

    // deploy C2
    const ct2 = new w3.eth.Contract(compiled["C2"].abi);
    ct2.options.data = "0x" + compiled["C2"].bin;
    const ct2Deployed = await ct2.deploy({ arguments: [ct1Deployed.options.address] }).send(sendObj);
    console.log(ct2Deployed.options.address);

    const newCt2 = new w3.eth.Contract(compiled["C2"].abi, ct2Deployed.options.address);

    console.log(await newCt2.methods.getX(ct1Deployed.options.address).call(callObj));
    // await newCt2.methods.setX(123).send(sendObj);
    // console.log(await newCt2.methods.getX().call(callObj));
}

init();


texts: The only place I can find any mention of the RanDAO contract addresses is in this Reddit thread. Looking at them in etherscan shows that the last time they were used were used was ~1600 days ago, around the time of their creation.


texts: Do I need to mint all ERC721 tokens on the deployment of the smart contract?

texts:
beginner in solidity here.

I'm starting to build a trading card game on the Ethereum network using ERC721 tokens because cards will have different stats so I need them to be non-fungible.

My initial plan was to release 10 cards, and later on incrementally release "add-on packs" with more cards. I understand that it's impossible to change a smart contract after it's deployed, so, regarding the release of extra cards, is that possible? How?


texts: Do native contracts affect the integrity of blockchain?

texts:
I started reading about HydraChain and came across their concept of native contracts. This means that nodes can bypass the EVM and run contracts locally. I don't understand the point in having this facility. This is making the blockchain less secure and non-deterministic. How is consensus achieved in these native contracts?

It was also mentioned that native contracts can communicate with EVM based contracts. So, is this like an unsafe version of Oracle? Also, if I can somehow take hold of this native contract, I can send malicious/unexpected data to the EVM based smart contract and there's no one checking the correctness of this data, which is not desired. So, what's the use of having these native contracts?


texts: I would like to start mining ether, but I am running into a big problem. I have a EVGA gtx 970 that works fine in games and benchmarks, however it only runs at about 2 mh/s compared to the 15+ I see others getting who mine with the same card. It is not a temperature issue as the card only runs at about 60c at its hottest when mining and the card is not over/under clocked. I have used all recommended drivers as well as several different mining programs, all of which resulted in a similar range of 1.5-3mh/s. In all of the configs the servers are set to the location nearest to me and the parameters are set to 100%. Any help would be appreciated.


texts: Mix IDE Tutorial error: index.html - line 15 - Uncaught TypeError: Cannot read property 'contract' of undefined

texts:
I got the following JS error:

  JavaScript error: index.html - line 15 - Uncaught TypeError: Cannot read property 'contract' of undefined

whenever I tried to enter a name and a rating in store fields to add a new rating.

How do I fix this?


texts:
I am writing a smart contract which will contain an escrow service. The escrow is to be a smart contract and eventually I want to use it to transfer meta tokens from the escrows address to another user. The issue I have is that I want to be able to transfer from the escrow but have a modifier which allows only the escrow contract itself to call. I have tried to make a modifier which only allows "this" (referring to the contract address) to make the call but that doesn't work.

If a contract internally calls another function how can I have it that only the contract itself can call the function and have the transfer happen. Msg.sender doesn't seem to accommodate for this.

My Code:

  modifier contractOnly(){
    address contractAddress = this;
    if(msg.sender != contractAddress) throw; _
}

and the transfer function (which needs the modifier to prevent anyone from calling the function and taking all the tokens from the escrow)

  function transfer(address from, address to, uint amount)
    contractOnly returns (uint) {
    balances[from] -= amount;
    balances[to] += amount;
    return balances[from];
}


texts: (solved) test forcing ether send, but not working

texts:
i want test forcing ether send to contract that without payable function.
mastering ethereum_chap 9 in this page, we can send ether forcibly with contract's selfdestruct function.

first, make deposit contract. this contract have two function, deposit and return balance but have no payable function

pragma solidity ^0.4.18;
contract EtherGame {
    mapping(address => uint256) public balances;

    function depositFunds() public {
        balances[msg.sender] += msg.value;
        }

    function call_amount() public returns(uint256) {
        return this.balance;
    }
}

and second contract is simple selfdestruct contract.

contract send_ether{
mapping(address => uint256) public balances;

function depositFunds() public payable {
    balances[msg.sender] += msg.value;
    }

function close() public {
    selfdestruct('first contract's address);
}

}

i deploy two contract and deposit 10 ether on second contract.
then, run close() on second contract. but there is no ether on first contract. where my ether is gone? why first contract do not send ether?

i test this simple on remix web, with javascrpit VM environment.

i solve this problem myself, and share my improve code.

    pragma solidity ^0.4.18;
contract EtherGame {
    mapping(address => uint256) public balances;
    uint256 public contract_balances;

    function depositFunds() public payable {
        balances[msg.sender] += msg.value;
        contract_balances = this.balance;
    }
}

second contract

contract send_ether{
    mapping(address => uint256) public balances;

    function depositFunds() public payable {
        balances[msg.sender] += msg.value;
        }

    function close() public {
        selfdestruct(0x692a70d2e424a56d2c6c27aa97d1a86395877b3a);
    }
}


texts: The network id specified in the truffle config (4447) does not match the one returned by the network (5777)

texts:
Here my test js file

const ApprovalContract = artifacts.require('../../contracts/ApprovalContract.sol');

contract('ApprovalContract' function (accounts) {

    it('initiates contract', async function() {
        const contract = await ApprovalContract.deployed();
        const approver = await contract.approver.call();
        assert.equal(approver, 0x3999BA5D247c800E5Ef3d4de66618741E3675379, "approver don't match");
    });
})


texts: Mint ERC-1155 Token with user defined variables

texts:
I would like to allow users to change the property of their items. Let it be the color.
In my understanding though there is no way of changing the property of an already minted erc-1155 token. Therefore i want to create a smart contract where users can send their token with a the color they want and have the contract mint and a new token that has all the properties of the old one plus the user defined color.
Is this a reasonable pattern? Or are there other ways of doing it?
In my mind you would be able to send a multitude of tokens at once to the contract with you colors attached in the message.
Thanks a lot for your help :)


texts: Does a "Value per Token" have to be set for a token?

texts:
I see there is a variable set which allows the value of a token to be set against an ETH.

Is this mandatory? Best practice?

What happens to a token if the value is not set, and the token goes on to an exchange? Would the value be updated or not?


texts: npm install web3-eth-accounts not creating dist folder

texts:
As per here npm install web3-eth-accounts should create a dist folder.
But i don't see any dist folder being created. Can someone please help me?


texts:
running osx sierra.

i am using time server.

canyouseeme.com says 30303 is visible when running geth from command line.

i have completely removed Mist application support directory and tried reinstalling.

running latest 0.8.1 build.

running geth with high verbosity i see something like ...

I0721 08:49:46.784487 eth/downloader/downloader.go:292] Synchronisation already in progress
I0721 08:49:46.785066 p2p/discover/database.go:183] failed to retrieve node 5d643a0e4c5429fb4df58b36eb76ea72f66b7d4e4df522409578daed4c08951170cd46ce0cd2ee0912671d142c1d1609de57261616f0c048043c88884ce751ec: leveldb: not found
I0721 08:49:46.785092 p2p/discover/table.go:473] Bonding 5d643a0e4c5429fb: known=false, fails=0 age=408087h49m46.78508933s
I0721 08:49:46.943324 eth/fetcher/fetcher.go:368] [eth/62] Peer 2af714fc4d4952a1: discarded announcement #1926565 [28190a28…], distance 1926565
I0721 08:49:47.237290 p2p/discover/udp.go:453] >>> 113.106.85.172:30303 discover.pong
I0721 08:49:47.237399 p2p/discover/udp.go:521] <<< 113.106.85.172:30303 *discover.ping: ok
I0721 08:49:47.238229 p2p/discover/table.go:473] Bonding 68dd1360f0a4ac36: known=true, fails=0 age=97h13m45.238223979s
I0721 08:49:47.363516 eth/fetcher/fetcher.go:368] [eth/62] Peer 865cda0c7c2fb72f: discarded announcement #1926565 [28190a28…], distance 1926565
I0721 08:49:47.536308 p2p/discover/database.go:183] failed to retrieve node 5d643a0e4c5429fb4df58b36eb76ea72f66b7d4e4df522409578daed4c08951170cd46ce0cd2ee0912671d142c1d1609de57261616f0c048043c88884ce751ec: leveldb: not found
I0721 08:49:47.536337 p2p/discover/udp.go:521] <<< 77.180.183.107:30303 *discover.findnode: unknown node
I1231 16:00:00.000000 eth/downloader/downloader.go:284] Attempting synchronisation: 78129e171bb7484a, head [28190a28…], TD 39873023365438740184
I1231 16:00:00.000000 eth/downloader/downloader.go:292] Synchronisation already in progress
I1231 16:00:00.000000 eth/fetcher/fetcher.go:713] Peer 78129e171bb7484a: discarded block #1926565 [28190a28…], distance 1926565


texts:
I am unsure of what I am doing wrong, I followed the example on https://github.com/ethereum/wiki/wiki/JavaScript-API Trying to creat new contract.

I keep getting the error:web3j err: Error: unknown account

Here is the function I am trying to run:

var deployNewContract = function(contractName){
    unlockAccountsIfNeeded();
    fs.readFile(contractDefaultPath + contractName + '.sol', 'utf8', function(err, contractCode) {
        if(err) console.log("error: " + err);
        let compiledContract = solc.compile(contractCode, 1);
        for (var contractName in compiledContract.contracts) {
            let abi = compiledContract.contracts[contractName].interface;
            let bytecode = compiledContract.contracts[contractName].bytecode;
            let gasEstimate = web3.eth.estimateGas({data: "0x" + bytecode});
            let MyContract = web3.eth.contract(JSON.parse(abi));
            var myContractReturned = MyContract.new("0x0",{
                from:wallet,
                data:"0x" + bytecode,
                gas:gasEstimate}, function(err, myContract){
                if(!err) {
                    // NOTE: The callback will fire twice!
                    // Once the contract has the transactionHash property set and once its deployed on an address.

                    // e.g. check tx hash on the first call (transaction send)
                    if(!myContract.address) {
                        console.log(myContract.transactionHash) // The hash of the transaction, which deploys the contract
                        // check address on the second call (contract deployed)
                    } else {
                        console.log(myContract.address) // the contract address
                    }
                    // Note that the returned "myContractReturned" === "myContract",
                    // so the returned "myContractReturned" object will also get the address set.
                }else{
                    console.log("web3j err: " + err);
                }
            });
        }
    });
};
module.exports.deployNewContract = deployNewContract;

I run on a private consortium on AZURE, I have double checked my wallet address, and it is correct, I can see the balance using metamask.


texts: Cant pass a byte into a function without an error

texts:
The code below compiles perfectly and seems to work, however when I try to call addTask like:

  "item1", 1, "i1", 1

I have tried every possible variation of quotes  parenthesis, brackets...

However I get the following error:

  transact to taskListContract.addTask errored: Error encoding
  arguments: Error: invalid bytes value (arg="", type="string",
  value="item1")

Any help is very much appreciated.

/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
pragma solidity ^0.4.25;

contract Owned {

    address public owner;

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

    /// @notice modifies any function it gets attached to, only allows the owner of the smart contract to execute the function
    modifier onlyOwner(){
        require(msg.sender == owner);
        _;
    }
}

contract taskListContract is Owned {
    struct task {
        bytes iname;
        uint16 taskid;
        bytes icode;
        //replace for a boolean
        uint ivalue;
    }

    uint taskCount;
    mapping(bytes => task) taskList;
    task[] taskArray;

    ///function taskListContract() public {
    ///    log0('hi');
    /// }

    function addTask(bytes name, uint16 iid, bytes code, uint val) external onlyOwner{
        task memory tasknew = task(name, iid ,code, val);
        // log0(itemnew);
        taskList[code] = tasknew;
        taskArray.push(tasknew);
        taskCount++;
    }

    function countItemList() public constant returns (uint count)  {
        return taskCount;
    }

    function removeTask(bytes code) external onlyOwner {
        delete taskList[code];
        taskCount--;
    }

    function getTask(bytes code) public constant returns (bytes iname, uint val)  {
        return (taskList[code].iname, taskList[code].ivalue);
    }
}


texts: How do you call a fallback function that uses msg.data for parameters

texts:
I am trying to complete a homework assignment, so I am not doing something malicious. The goal is to learn the vulnerabilities of contracts. I want to call the fallback function of wallet to trigger the initWallet function of WalletLibrary. I am a little confused on how to pass parameters through msg.data.

Here is the code to the contract I am trying to exploit.

contract WalletLibrary {
   function initWallet(address[] _owners, uint _required, uint _daylimit) {
     pass
  }
}

contract Wallet {
   // gets called when no other function matches
  function() payable {
    if (msg.data.length > 0) {
      _walletLibrary.delegatecall(msg.data);
    }
  }
  ...
}

Here is what I have tried unsuccessfully. I believe I am calling the fallback function, but I believe the parameters for msg.data have not been set properly.

contract WalletAttacker {
   ...
  function stealOwnerShip() external {
        address[1] memory owners = [address(this)];
        uint _required = 1;
        uint _daylimit = 1000000000000000000;
        targetWallet.call(bytes4(keccak256("initWallet(address[], uint, uint)")), owners, _required, _daylimit);
    }
}


texts:
Need to understand how the Geth's light client parameter works. I want to understand the algorithm. Whether some part of the blockchain will be downloaded or will not download anything. In both cases what is the logic applied.

how is it different to the fast parameter of the geth client.

I specifically want to know about --light parameter. What exact algorithm is it using.


texts:
Is there an automated tool to convert old smart contracts to the newest one? There are many breaking changes in different versions and it is hard to keep up with them all.
I want to use my old contracts yet use the new compiler.
There are online free tools to lets say javascript to WASM, so I imagine there must be a tool to convert an old code to the new version, for example from 0.4 to 0.7 solidity compiler.
If it does not exist, it is a good idea to create one?


texts:
I was wondering, if I take an ERC token and remove the transfer event, is it still possible for someone or an organisation to be able to track the token movements with bytecode or any reverse engineering of the EMV?

Would that make the token more "anonymous" and hard to track?


texts:
i have token created on smart contract.
contract address is
0x1fa1a89f72c1011122e62261bb962b123ac40a76

i have tried to transfer token several time and i am getting the following error.
Warning! Error encountered during contract execution [Bad instruction]

https://etherscan.io/tx/0x7d7571080d6469a558847c075283d30ef197ca69ba8761242ec469a44521e248

the smart contract source code is

contract FRPoint {
    /* Public variables of the token */
    string public standard = 'Token 0.1';
    string public name;
    string public symbol;
    uint8 public decimals;
    uint256 public initialSupply;

    /* This creates an array with all balances */
    mapping (address => uint256) public balanceOf;
    mapping (address => mapping (address => uint256)) public allowance;

    /* Initializes contract with initial supply tokens to the creator of the contract */
    function FRPoint() {

         initialSupply = 90000000000000000000;
         name ="FRP$";
        decimals = 9;
         symbol = "FRP";

        balanceOf[msg.sender] = initialSupply;              // Give the creator all initial tokens
        uint256 totalSupply = initialSupply;                        // Update total supply

    }

    /* Send coins */
    function transfer(address _to, uint256 _value) {
        if (balanceOf[msg.sender] < _value) throw;           // Check if the sender has enough
        if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows
        balanceOf[msg.sender] -= _value;                     // Subtract from the sender
        balanceOf[_to] += _value;                            // Add the same to the recipient

    }

    /* This unnamed function is called whenever someone tries to send ether to it */
    function () {
        throw;     // Prevents accidental sending of ether
    }
}

I have lost ether as gas while doing transaction and is it possible to get it back.


texts: Return multiple value from the function (read the multiple returns) - solidity

texts:
We're having requirement to get failure message from require validation. I've searched a lot for the same and found that Remix is displaying messages, however web3 is not.

In order to get messages, we have created internal function which returns Boolean result and a string message.

function validateDoc(
    bytes32 _a,
    string _b,
    uint256 _c
    ) internal view
    returns(bool, string){

    if(condition 1){
        return(false, "failure message1");

    }else if(condition 2){
        return(false, "failure message2");
    }
    }else if(condition 3){
        return(false, "failure message3");
    }
    }else if(condition 4){
        return(false, "failure message4");
    }
}

Further, I'm calling it from another function:

function Main(
    bytes32 _a,
    string _b,
    uint256 _c
) public returns(bool, string) {

    validateDoc(_a, _b, _c); // TODO: return bool result and message.

    // Other code
    // ...
    return (true, "success message");
}

But the issue is, how to return both result of validateDoc in Main function?


texts:
I was playing with dumpconfig and after that added --shh and dumped configuration again to see the differences but there weren't any.
My section of the Whisper config is:

[Shh]
MaxMessageSize = 1048576
MinimumAcceptedPOW = 2e-01

Does this mean I need to use --shh always while using --config option, e.g:

geth --shh --config yourfile.toml


texts:
since I spend some time on diving into the data structures that ethereum is based on, I stumbled upon the following task from a stanford course which i included at the bottom. I am struggling especially with the second and third question.

For the first question my assumption is, that the simple answer is because the kv node "44:" is referring to another diverge node as a stored value instead of beeing a diverge node itself.

But for the second question already I am wondering why the question is asking for a given key "44431337a" while missing out the prefix value of the diverge node "d" (shoudn't it be "444d31337") here as well as in key of "fc" missing out the prefix "b" (shouldnt it be "fbc") but including the complete prefix in "1a3098a" again without missing out any diverse node prefix.

For the third question i dont have any clue at all how to answer.

I would be very happy if any of you guys would have a rough explanation or a recommendation in which way to think to find the correct solution.

Thank you guys so much!!!

Following there is the given transaction:

Where:

empty nodes, represented as all zeroes
diverge nodes, which are represented by the hash of a 17-member
array. The first 16 items in the array are child node identifiers
which contain the hashes of up to 16 child nodes (which will be 0 for
empty children). Each child node extends the path of its parent by
one nibble (4 bits) of key, defined by its place in the array. This
is shown as an edge label in the figure below. The 17th item is a
data value (which may be 0) which is mapped to the key representing
the path to this node. Internal nodes are represented in blue below,
with the child array represented by pointers to child nodes.
kv nodes, which include an arbitrary-length path, plus either the
hash of another diverge node or the hash of a data item (making the
node a leaf). This path is added to the path built up by this node’s
place in the tree. These nodes are shown in pink above.

There are the following tasks to complete:

In the following example, 9 keys are present, with 13098a mapped to “c” and 444 to “d”: Explain why in the above example there is no label on the arrow coming out of the intermediate node with the path 44.
Which data would you need to supply for a proof that the key “44431337a” has no data mapped to it? How about the keys “fc” and “1a3098a”?
Explain why this does not hold for the trees maintaining the long-term storage for each contract (addressable by 256-bit addresses). How might you write a malicious contract which stores k words in memory and then makes a single write which is expensive as possible?


texts:
Contract A calls contract B.

Does contract A need to know B's full ABI for its external functions? Or can you just give it the interface for the functions that contract A will call.


texts: Constructors of inherited contracts in Solidity

texts:
Given:

contract A {

    address owner;
    function A() { owner = msg.sender; }

}

contract B is A {

    string greeting;
    function B(string _greeting) { greeting = _greeting; }

}

When I deploy my contract, I want to make sure that owner is initialized. Do I need to call the parent constructor in B's constructor to initialize the value owner in A like so: function B (string _greeting) A(msg.sender) { greeting = _greeting; }, or can I just leave it as is above (it will initialize the values of A automatically, by automatically calling A()?
Does B need its own address, or will it just use A's as its own?


texts: How to define 2048-bit integers on smart contracts?

texts:
As we know solidity supports only 256-bit big integers. But for crypto primitives (sometimes) we need bigger integers, e.g. 2048-bit.

Question: how can we define 2048-bit integers on a smart contract and perform some modular operations on that size integers?


texts:
I set up a private Ethereum network at home using two computers to test smart contracts and I got them to find each other by getting the enode from one and using admin.addPeer in the console of the other.

Do Ethereum nodes somehow broadcast their availability?  In the case of the private home network, will the nodes eventually find each other (assuming they are using the same network ID number) without manually inputting the enode address?  Or do nodes need to always start with at least one peer, then only discover new ones through "word of mouth"?


texts: Geth some questions. Need help for begginer!

texts:
I learned about GETH a few days ago. I need Geth to create wallets of etherum and make transactions with these wallets (I use geth instead of third-party api to create some programs related to eth). I very much hope that you will help me understand the following:

What are the minimum system requirements for geth? (for creating accounts, making transactions)
Is it necessary to synchronize a blockchain for creating accounts, making transactions?
If not, how does it work? How to make an account and transaction without synchronization?
How do I know if the synchronization is complete?
Will errors occur when synchronizing the blockchain if you accidentally disable geth? (server shutdown or geth process termination)
If so, how can I check for errors in the synchronized blockchain?
Are there any alternatives that have web3 access?
I have a server running with geth --fast --cache = 2048.

System: cpu amd athlon II x2 220, 4 GB ram, 500 gb hdd 5400 rpm, OS ubuntu 16.04 x64.

With such parameters, ram is loaded to 100%, + 1GB swap file of 4 GB. I tried to change the parameter --cache to 128, 256, 512, 1024 and even to 16 MB, but ram always get 100% loaded. Blockchain is synchronized for 6 days already, blockNumber still 0.

Is this normal?

  P.S. Sorry for my english, this is not my native language.

  P.P.S. If you know the answer to at least one question, please answer me.


texts: Can I use string(or any type) list as an argument of an event?

texts:
It`s my event.

event Transfer(address sender, address receiver, string[] denoms, uint256[] amounts);

And I view an Transfer event with watch() function, It`s the result.

{
  address: "0x33036fcbd3413f70fbdf771a646ab7457b26d5e1",
  args: {
    amounts: [10000, 10000],
    denoms: ["", ""],
    receiver: "0x905319c93683eb3203437d21900d9bdda487f65e",
    sender: "0xb85618eac4df82118512c3ff9eca48a61a858fdb"
  },
  blockHash: "0x894fa661c7cd4fde5de2d32b9fc8732c2a58e28e93d9c8280fa7ebd8c2ffed1f",
  blockNumber: 6291,
  event: "Transfer",
  logIndex: 0,
  removed: false,
  transactionHash: "0x61b9edbc223d71accb0a223a5d7b867782f464607a41693239964f03c1def4a3",
  transactionIndex: 0
}

Maybe... a string list isn`t available as an argument.
Is it right?


texts: I am looking for a recent four part set of articles on Casper

texts: Can somebody give me links to the recent articles on the history and design of casper?  I saw a part 3 and a part 4, but don't recall who wrote them and I want to start with part 1 and part 2.


texts: Quorum private transaction signing with external wallets?

texts:
I am using Metamask & TORUS wallet to make transactions over Quorum network.
The requirement is to make a private transaction, for which we need to sign a raw transaction. Metamask & TORUS does not allow to sign a transaction for security purposes.
Is there any way to make a private transaction with external wallets?
Implementation:
        const bytecodeWithInitParam = simpleContract
          .deploy({ data: bytecode, arguments: [42] })
          .encodeABI();
        const rawTransactionManager = this.quorumjs.RawTransactionManager(this.web3, {
          privateUrl: "https://example.io/tx1",
        });
        rawTransactionManager
          .storeRawRequest(
            bytecodeWithInitParam,
            "publicKey"
          )
          .then((txHash) => {
            console.log(txHash);
            this.web3.eth
              .getTransactionCount(this.publicAddress)
              .then((nonce) => {
                const rawTransaction = {
                  nonce: `0x${nonce.toString(16)}`,
                  gasLimit: `0x${(4300000).toString(16)}`,
                  gasPrice: `0x${(0).toString(16)}`,
                  from: this.publicAddress,
                  to: this.receiver.account,
                  value: `0x${(0).toString(16)}`,
                  data: `0x${txHash}`,
                };
                console.log(rawTransaction);
                this.web3.eth.signTransaction(rawTransaction).then((signedTx) => {
                  console.log(signedTx);
                  const privateTx = rawTransactionManager.setPrivate(signedTx);
                  const privateTxHex = `0x${privateTx.toString("hex")}`;
                  return rawTransactionManager
                    .sendRawRequest(privateTxHex, [
                      "publicKey",
                    ])
                    .then(console.log)
                    .catch(console.log);
                });
              })
              .catch(console.log);
            return txHash;
          })
          .catch(console.log);
    ```


texts: Returned error: Sender doesn't have enough funds to send tx when running offline transaction with web3

texts:
I'm trying to run the javascript following code to make a transaction to a contract function offline against a Ganache blockchain but I get the following error:
"Error: Returned error: sender doesn't have enough funds to send tx. The upfront cost is: 1 and the sender's account only has: 0"

(privateKey and publicKey are a Ganache account public/private keys).

I don't know why the script cannot figure out the sender account balance. Any idea?

Many thanks.

var myContract = new web3.eth.Contract(abi, contractAddress, {
  from: publicKey,
});
var data = myContract.methods.pickWinner().encodeABI();

web3.eth.accounts.signTransaction({
  data,
  gas: 1,
  gasPrice: 1
}, privateKey)
.then((res) => {

  web3.eth.sendSignedTransaction(res.rawTransaction, function(err, hash) {
    if (err)
      console.log(err);
    else
      console.log(hash);
  });

});


texts: Can't call contract function in Remix in Web3 provider mode, but it works in Javascript VM

texts:
A simple contract for addition, an error is reported when calling the function add  in Web3 provider mode:

"Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?

VM Exception while processing transaction: invalid opcode."

But it works fine in JavaScript mode. The contract is as following:

pragma solidity >=0.4.0;

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

I found out that if I use the pure modifier and  compile it using the version 0.4.24, it would work.:

pragma solidity >=0.4.0;

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

choose the compiler version 0.4.24,  then I can call the function add successfully. Why is that?


texts: Having a simple rig, ¿why mining ETH is not the best way to get ETH?

texts:
What are the factors that affect the profitability of mining different coins when later those coins are being converted, for example, to ETH?
I've made some test mining ETH, RVN, CFX, AE, BEAM, GRIN, and some other. All of them for the same period of time, let's say 1 hour, some of them on different pools, always with the same rig (1 RTX 2070 S).
Then I converted all those coins to ETH. Each coin gives a different amount of ETH, making one or the other more proffitable in order to get ETH. In this case in particular, ETH is not the best choice in order to get ETH if you have a simple rig. So it seems that it is better to mine something else and then do the exchange.
Now about the factors, I guess it could be the difficulty of the pool / network, the hash minimum target, the amount of people mining and what percentage / power do I give to that pool? Consider all the exchanges and calculations have been made the same day or that the price itself (in USD or ETH) was not a relevant factor.
I remark the fact that the rig is very simple, I guess with a better rig you'll be better prepared and mining ETH would be the best choice in order to get ETH.


texts:
I am trying to update a value from the smart contract in te GUI - therefore I am using React.

I have the following event in my Smart Contract:

 event valueChange(uint old_value, uint new_value);

Im my DAPP I am listening to this event by the following lines of code (in the componentWillMount Method):

      //Event Triggering
  var myEvent = helloworldcontract.valueChange();

  myEvent.watch(function(error, result){

    if (!error) {

            console.log("New Value: " + result.args.new_value);

            console.log("Old Value: " + result.args.old_value);

            this.setState({lastNames: String(helloworldcontract.getText.call())})
    }

At the last line i get the following error

App.js:88 Uncaught TypeError: Cannot read property 'setState' of undefined

Do you know why I am getting this error? When I am using this line outside the Watch function it works fine.


texts: Contracts will not compile using truffle with the "emit" keyword included in front of events

texts:
I notice there has been changes made to solidity and that the word emit is now to be used in front of event triggers (to distinguish from functions being called).

However when I include these in contracts using the truffle framework to compile I get an error

PS D:\Programming\Solidity\ICO REDO> truffle compile
Error parsing D:\Programming\Solidity\ICO REDO\contracts\Token.sol: ParsedContract.sol:75:22: ParserError: Expected token Semicolon got 'LParen'
        emit Transfer(msg.sender, _to, _value);

Does anyone know why this is, or how I can get these contracts to compile with the emit word being used or should I just omit it and move on (is this now bad practice?)?

The code is:

function Token() public {
        Ownable(msg.sender);
        balances[msg.sender] = TOTALSUPPLY;
        emit Transfer(address(0), msg.sender, TOTALSUPPLY);
    }


texts: How to create cool ethereum wallet address?

texts:
Someone was receiving payment to a cool ethereum address kind of

0x00000000000000000000000000002448

How to create such address ? could that be a wallet or contract ?


texts: Difference of parity PoA between Validator Sets and Aura?

texts: It seems there are two PoA consensus algorithms in parity PoA.  What is the difference between Validator Sets and Aura?


texts: Is block.timestamp safe for longer time periods?

texts:
I would like to set a timer like

uint timeout = now + 1 year;

Is it possible that a miner cheats the timestamp of the block that it's included more then let's say a month.

So if I need roughly 1 year until timeout (+/- one month) would that be safe?

And is block.timestamp serenity-proof?


texts:
I am attempting to test out a simplemultisig contract (https://github.com/christianlundkvist/simple-multisig) but it requires the chain id. I have been testing using ganache but wanted to switch to remix to make it a bit easier.

Any idea on how to get the chain id of the vm and does it change every time you reload the page?


texts: What is the performance difference between Proof of Authority (PoA) and Proof of Work (PoW)? In terms of transactions per second.


texts:
Below is my smart contract code for calculator.

pragma solidity 0.4.24;

contract Calculator{

    uint result=10;

    function Calculator() public
    {

    }

    function getResult() public view returns (uint)
    {
        return result;
    }

    function addition(uint num) public
    {
        result=result+num;

    }

    function sub(uint num) public
    {
        result = result - num;
    }

    function mult(uint num) public
    {
        result =result*num;
    }

    function div(uint num) public
    {
        result = result/num;
    }

    }

Here what is the significance of view keyword in below function?

function getResult() public view returns (uint)

My observation is:

If I do not specify view keyword, remix browser is not showing me results.
If I specify the view keyword, I can see the result on UI.

But still I want to understand the significance of view in solidity.


texts: Invalid JSON RPC response at Web3.providers.HttpProvider

texts:
I receive the following error when trying to connect to my private ethereum node with React Native.

[Unhandled promise rejection: Error: Invalid JSON RPC response: "\r\n<title>401 Authorization Required</title>\r\n\r\n
401 Authorization Required
\r\n
nginx\r\n\r\n\r\n"]

Here are my codes:

global.Web3 = require("web3");
global.Tx = require("ethereumjs-tx");
global.web3 = new Web3(
  new Web3.providers.HttpProvider('https://<username>:<password>@<ethereum node url>'),
);

I noted that this happens only when I attempt to connect to a node that requires me to use the pattern 'username:password@nodeurl' because connecting to Infura has no problem at all.

Also, this problem occurs only on React Native. Running this code on Node.JS works fine.

My web3 version is 1.0.0-beta.34.


texts: Dealing with mapping(string => string[])

texts:
I have a contract with different categories. We can assume them to be the following here:

Cities
Countries
Counties

Suppose I want to add a new city to the category cities. I'm assuming this has to be an array as I need to be iterable.

This code does not compile but it shows the type of thing I want to achieve

mapping(string => string[]) Categories;
// Add a record
function addCity(string _type, string _city) {
    Categories[_type].push(_city);
}

I will need these strings (the cities) to be passed around and apparently that is not possible in Ethereum yet (see here).

Alternatively, I tried doing this (omitting irrelevant code)

mapping(string => bytes32[]) Categories;
function addCity(string _type, bytes32 _city) {
        Categories[_type].push(_city);
}

Which does compile. However, when I add

599437d068e6196203c2ec23

I get back

0x3539393433376430363865363139363230336332656332330000000000000000

and I don't know what to do to convert it to 599437d068e6196203c2ec23 when fetching the value. I've tried web3.toAscii() but it didn't work.

My question is: is there an alternative way which I'm missing or, if not, how to I convert the value back when I need to?


texts:
I had some ideas of small web apps.
However, I do not want to host a web server.
Therefor, I am wondering if it is possible to integrate web3js (min, light or full) inside an  HTML page.

For example, I would have my basic web page and inside, (in script tags obviously), I would have the entire web3js code. The page should be able to do all the stuff web3 is able to do.

This page would be distributed by a google function.

In the web3js repo, there is the dist folder with min/light version of web3js. If it is possible, how can I include this code inside an HTML page and use it? Which one would be the most suitable for this use case?


texts: Is any valid address in Ethereum liable to receive payments?

texts:
Suppose I have generated a valid ethereum address, there are a no of ways of doing so including using Blockcypher's  Generate Address API, using light-wallet etc. So I got a valid address, Now are these addresses published on blockchain? I mean any valid address is liable to receive payments ? Or anything else like private-public key pair or anything as such is needed (I am not good at this topic) ?

If nothing else is needed and we are ready to receive a payment as soon as a valid address is generated, I have another doubt (This part is probably specific to Light Wallet).
I was following webawllet example of lightwallet. It generates a new address by clicking the show button. So I get only a valid address as output (no private key,publick key, nothing else) and I have send some ethers to it. Will it receive the ethers? How can I claim these ethers ?


texts: MetaMask transaction popup opens on another computer

texts: We have two computers on the same local network with Static IP for internet. When Computer A calls a transaction through a DApp for an address X, Computer B Metamask is also getting triggered with the same transaction.


texts:
I am trying to transfer several tokens from my metamask using MEW, and I have eth to cover the gas, and I followed all instructions many times, but every time it fails to transfer. Anyone have any advice?
thanks.


texts: Will Whisper work with Ethereum contracts, or should I try another way for sending secrets?

texts:
I'd like for someone calling a contract to be able to send me secret info. Lets say it's just the person's physical address because they bought something from me. They don't want to just put that info on the blockchain, they'd like to keep it secret so only I have it.

Should they:

1) Somehow use some form of PKI encryption so the message can only be read by me, then transmit the encrypted message through a call to my contract? (And then I'd have to have some part constantly watching for this.)

2) Wait for Whisper, which may or may not be able to interact with Ethereum contracts and may or may not ever become integrated into Mist and web3.js?

I'm looking into developing something in about a month's time, so the option 1 becomes more appealing to me unless Whisper is further along than I'm thinking. If you think that option 1 is best, can you please provide an example?


texts: Segregating user authentication from network on Metamask

texts:
I am using blockchain inside a big company and we need to include a reverse proxy with authentication before a node. In order to submit a transaction, the user needs to send his/her password and sign the transaction with Metamask.
If it is an internal user (accessing inside my company intranet), I can configure Metamask network together with the authentication information like https://USER:PASSWORD@path-to-node. It is not the safest way and not the convenient one (since the user needs to have a specific URL). But it works and Metamask does not even know that an authentication is happening.
When dealing with external users it is not a valid approach. What is the best way to deal with that? Does Metamask support this authentication in the reverse proxy?


texts: Best way for web3 to receive data from function return?

texts:
Now I'm trying to delelop my first Dapp (using Metamask plugin). everything is going to be all right, but I can't get one thing: Is it possible to receive return from function, using Web3 (not JS VM!)

For example, I have a simple contract like this:

pragma solidity ^0.4.0;

contract test {
    int32 data = 123;

    function getData() returns (int32) {
        return data;
    }
}

When I'm calling getData() with JS virtual machine, it works fine:

But with selected Inject web3 (Metamask) it returns information about new transaction, instead of 123

I also can't receive any data from the JS console (Metamask):


texts: How should a new service decide whether to launch with a crypto-token economy or not?

texts:
Outside of the obvious ICO bubble and the ability to raise tons of money, what is the core value proposition of establishing a crypto-token that users can use within your service?

For anyone launching a new service, how should one decide between crypto-token powered economy vs. not?


texts: Ether is not reflecting in my Metamask account

texts:
My friend has transferred me some ether to my Metamask account but the ether hasn't reflected in my wallet. But in the ether scan, it is showing that my transaction was successful. What can I do to resolve this issue?
Txn Hash: 0x03eafde3fc15f385f9839857ca664d5c46d35a2b935e00c6013500e5bae82d84


texts: What is the equivilent to Solidity's abi.encode() function in Web3 JS?

texts:
I have a function in Solidity, that I would like to replicate using Typescript and Web3
    function mint(
        address to,
        uint256[] memory ids,
        uint256 indexToMint
    ) public {
        require(
            registeredHashes[to][keccak256(abi.encode(to, ids))],
            "Hash not registered"
        );
    ...

What is the Web3js + Typescript equivilent to the line
abi.encode(to, ids)


texts: How to delete or reset the blockchain in geth? (OSX)

texts:
I have a currupt Blockchain and want to hard reset the chain. what do I need to delete in order to start downloading the chain from scratch?

I know that there are 2 ethereum folders (I am on OSX):

$home/.ethereum
$home/Libary/Ethereum

I updated geth recently to "Homestead" 1.3.5 and get error in the terminal like:

E0306 ... 3211 trie.go:309] Dangling hash node ref 3c6233326.... leveldb: not found

and sometimes I get a bad block warning:

Bad block #1102797


texts: Sending Token from A to B and in return receiving data from B to A in same transaction?

texts: Is it possible to send a cryptocurrency as a payment and in return getting data about a product that is shipped to you in one Ethereum Transaction like you can see in the attached picture? If yes, how? I would like to be able to recreate a supply chain only out of transactions that suppliers send to each other.


texts:
when I used 0.4.25, it compiles successfully.

function callByFun(address addr)returns (bool){
    bytes4 methodId = bytes4(keccak256("increaseAge(string,uint256)"));
    return addr.call(methodId,"jack", 1);
}

Due to some reasons, I have to change to 0.5.0

function callByFun(address addr)returns (bool){
    return addr.call(abi.encodeWithSignature("increaseAge(string,uint256)", "jack", 1));
}

and it compiles error

browser/ERC865.sol:577:9: TypeError: Different number of arguments in return statement than in returns declaration.
        return addr.call(abi.encodeWithSignature("increaseAge(string,uint256)", "jack", 1));
        ^---------------------------------------------------------------------------------^

How do I revise? Thanks a lot.


texts: In a payable function, can "msg.value" pass a value in wei instead of trx?

texts:
I have two contracts, main and config. On main contract there is this buy function:
  function buyItem(uint256 itemId, uint256 amount) external payable {

    uint256 ethPrice;
    require(msg.value >= ethPrice);
    itemsOwned[msg.sender][itemId] += amount;

}

On the config contract the value "uint256 ethPrice;" is set as following:
      uint256 ethPrice = 1000 wei;

Now, If I send a transaction for 1000 wei to buy 1 item, it fails because the actual value should be 1000 ether, but I wanted the price to be 1000wei instead. How can I fix this considering that I can replace the config contract but not the main? Thanks.


texts: Finding the memory position of a mapping

texts:
I want to read data from an internal mapping variable using  getStorageAt(), but this requires knowledge of the index where that variable is stored in memory.

The documentation says:

Due to their unpredictable size, mapping and dynamically-sized array types
use a Keccak-256 hash computation to find the starting position of the value
or the array data. These starting positions are always full stack slots.

The mapping or the dynamic array itself occupies a slot in storage at some
position p according to the above rule (or by recursively applying this rule
for mappings of mappings or arrays of arrays).

But it does not give further detail on what computation is used to find p. Anyone know how to approach this?


texts: Deploying a contract multiple times with the same Library

texts:
I have a library and a contract like this:

pragma solidity ^0.4.8;

library LibUserData{

    struct data{
        string firstName;
        string lastName;
    }

    function setName(data storage _data, string _firstName, string _lastName){
        _data.firstName = _firstName;
        _data.lastName = _lastName;
    }
}

contract User{

    mapping (address => LibUserData.data) public userData;

    function setName(address _address, string _firstName, string _lastName){
        LibUserData.setName(userData[_address], _firstName, _lastName);
    }

    function getName(address _address) constant returns (string, string) {
        return (userData[_address].firstName, userData[_address].firstName);
    }
}

I deploy the library LibUserData first (and only once) and insert its address in the bytecode of the User contract. Then I deploy the User contract with this bytecode. If I call the function setName() of the User contract the data will obviously be stored in the library LibUserData. Then I deploy the User contract again with the same bytecode (same address of library LibUserData). And I call the function setName() again from the second User contract. What happens now? Will the data be stored in the same LibUserData like in the first User contract or is a new instance of the LibUserData library created?


texts: How do I configure a home.parity address for my parity node browser?

texts:
How can I configure my linux system to point any .parity address to my parity web application running on localhost port 8080?

  For the best experience it is recommended to use subdomains-based routing.

  Instead of: http://localhost:8080/home/
  in your address bar you would see: http://home.parity/

  To configure the routing add the following link to your proxy configuration URL:

  http://localhost:8080/proxy/proxy.pac

Which contains:

function FindProxyForURL(url, host) {
    if (shExpMatch(host, "*.parity"))
    {
        return "PROXY localhost:8080";
    }

    return "DIRECT";
}


texts: Looking for multisig wallet source code?

texts:
Found several multisig wallet source codes but I can't deploy them in ethereum wallet because they can't be compiled. Either they use an old version of solidity or I get the error "No visibility specified."

https://raw.githubusercontent.com/ethereum/dapp-bin/master/wallet/wallet.sol

https://github.com/gnosis/MultiSigWallet/blob/master/contracts/MultiSigWallet.sol


texts: Miner address getting chnaged automatically on ethereum private blockchain

texts:
I have a private ethereum node running on aws instance, the time when started the node i set the etherbase/coinbase address to the first account of the node. As i started the node i find that first account is getting the rewards of mininig and everything was as expected, but after few hours the miner/etherbase address automatically get changed, as a result of which funds from first account get transferred to miner address as a mining reward. And i unlocked the first account to send the transaction over the node and as all the funds get transferred to newly assigned miner address, all my transactions become pending due to insufficient funds in sender account. Any help will be appreciated.Thanks in advance.
Here are the few details of geth client and command i used :
GO ETHEREUM CLIENT DETAILS :
Geth
Version: 1.9.12-stable
Git Commit: b6f1c8dcc058a936955eb8e5766e2962218924bc
Architecture: amd64
Protocol Versions: [65 64 63]
Go Version: go1.13.8
Operating System: linux
GOPATH=
GOROOT=/build/ethereum-YoJS3q/.go
GETH COMMAND :
/usr/bin/geth --datadir node01 --networkid 10 --allow-insecure-unlock --targetgaslimit 9000000000000 --nousb --etherbase '0x669980d2EF6b14e15e4e1D32E70F2ccC83EC98c9' --rpc --rpcaddr "0.0.0.0" --rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3 --rpccorsdomain '*'
GENESIS.JSON :
{
"alloc": {
"0x669980d2EF6b14e15e4e1D32E70F2ccC83EC98c9": {
"balance": "10000000000000000000000000000000000000"
},
"0x61722d9D8F75E97A2F8B4C63Be1C8820D944C940":{
"balance": "1000000000000000000000000000000000000"
}
},
"coinbase": "0x669980d2EF6b14e15e4e1D32E70F2ccC83EC98c9",
"config": {
"homesteadBlock": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"chainId": 10,
"eip150Block": 0,
"eip155Block": 0,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip158Block": 0,
"maxCodeSize": 35,
"maxCodeSizeChangeBlock" : 0,
"isQuorum": true
},
"difficulty": "0x0",
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0xE0000000",
"mixhash": "0x00000000000000000000000000000000000000647572616c65787365646c6578",
"nonce": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp": "0x00"
}


texts: Could msg.sender be changed by a hacker?

texts:
I was researching the msg object and I could not find out very much about how it is created. It seems to be that contracts depend on checking owner == msg.sender. That is dependent on msg.sender being secure.

Could someone simply alter msg.sender in an hacking attempt? How is the object actually transmitted?

It seems to me the point of any communication of data from one point to another will depend on somekind check at both ends that the data has not been changed.

If someone could change msg.sender then they could simply destroy many contracts or pretend to be the owner and mint new tokens.

I saw this - http://solidity.readthedocs.io/en/develop/security-considerations.html

It refers to hacking the slots when the full 32 bytes are not used. I think msg.sender uses the full slot anyway, so that is not an issue.


texts:
I started syncing my ethereum ropsten chain using geth 3 days ago in fast mode.

eth.syncing shows false , but the difference between highest block shown by my node and the one shown at ropsten blockexplorers is around 50k .

I tried deleting the chain completely and redownloading it , still facing the same issue.

Can somebody help me with this?


texts: What are the advatages of Stratum protocol over websocket RPC?

texts: Some of the largest Ethereum pools have a support for Stratum mining protocol, they claim that there is about 20% advantage over normal type of protocol. My question is what are those advantages? I understand that having a persistent connection is a huge gain, but why not just go with WS-RPC, which is built-in geth?


texts: Correct practice for modifying struct in mapping

texts:
While working on my most recent project, I realized that since I've learned Solidity, I have been modifying structs in a mapping like so:

mapping(uint256 => Person) map;
...
map[id].name = _name;
map[id].age = _age;
etc...

I'm wondering now though whether the more correct way would be like so:

mapping(uint256 => Person) map;
...
Person storage it = map[id];
it.name = _name;
it.age = _age;
etc...

If the first method is constantly hashing and looking up "it" in the mapping, then I would think that the second is superior.  If the compiler optimizes it all away anyway, I would think the first would be preferred as it lessons the risk of someone mistakenly not assigning the storage struct to anything.  Then we would have the feature (which I think should be a bug) where a struct in storage left unassigned points to the contract and not to the struct it should have been assigned to.

For my analysis of the second method, I am also assuming that creating the variable "it" is negligible or free as it's just a pointer to something in storage and not a struct declared in memory.  If I'm wrong here, please help correct any of my misinterpretations!  Thank you!


texts:
Just upgraded truffle to version 5 and having a problem with this new address payable type.

contract Test {
  ERC721Full public tokenAddress;

  constructor(address _address) public {
    tokenAddress = ERC721Full (_address);
  }

  function sendToOwner(...) public payable {
    address payable owner = tokenAddress.ownerOf(_tokenId);
    owner.transfer(msg.value);
  }
}

So I'm trying to send ether to owner account, but I'm getting

  TypeError: Type address is not implicitly convertible to expected type address payable.

How to fix this?


texts: Can i freeze portion of ERC20 tokens via smart-contract?

texts:
The Freezing functionality is to impose the restrictions on sales of some portion of ERC20 tokens for certain time periods in Admin Dashboard when transferring the ERC20 tokens to buyers.  The Admin can randomly specify the freezing portion and freezing period in Admin Dashboard.  For example, we must transfer 10,000 ERC20 tokens to a buyer.  We transfer 1000 tokens with no restriction, 4000 tokens with 3 months freezing, and 5000 tokens with 5 months freezing.  This Freezing functionality is applicable to all phases of ICO (pre-sale, ICO, and post-sale).

Can i have this kind of functionality via smart contract for ERC20 tokens?
Please suggest me even if the functionality can be done without smart-contract.

Thank you in advance.


texts: Do all nodes communicate using the JSON RPC protocol?

texts:
I'm reading through the JSON RPC Doc now on Github here: https://github.com/ethereum/wiki/wiki/JSON-RPC#net_version

I assumed that this is the default communication protocol between any two nodes, and between a node and a client (such as web3).

But then it mentioned how to start geth and the c++ node in "RPC mode". So is RPC not the default communication mode?

If not, how else does node-to-node communication happen?
If so, what are use cases for starting a node NOT in rpc mode?


texts: Create account with initial fund using web3

texts:
Is it possible to create an account with initial fund using web3?
Every time  I create a new account I had to do fund transfer to add initial fund. If there is way to fund the account with minimum ETH while creating an account.


texts: Free transaction on a private ethereum blockchain

texts:
I have developed a Dapp powered by Ethereum with truffle. And I want to deploy it on a private blockchain. But I have one question to ask before that.
My question is: can I make in sort that my Dapp don't request money (ETH) from users to use its functionalities (include reading and writing data) ?
I thank in advance anybody that will take the time to help me.


texts: Where happened to this ETH, did it get burned?

texts:
In this transaction it clearly says that the transaction failed but yet I have not received my ETH back.  Anyone know what happened to it?  Did it get burned or otherwise deleted due to the remote side wallet being deactivated?  That's what I was told, that the remote side's wallet was deactivated about 30 minutes prior to my sending it.

0xdd3a786b49fecb1b9f082d590dd0803db7fa31bf884c86a12d4060e4f8c61f1b

Thanks!


texts: How are tuples handled for the function selector?

texts: How are tuple types encoded into the function signature to generate the 4 byte function selector? The official specification doesn't state anything for tuple types.


texts: web3.js: Error: The method shh_newSymKey does not exist/is not available on Web3.js

texts:
My main goal is to call web3.shh functions using RPC API , Web3.py or Web3.js. I can call web3.shh functions when I use geth attach; which is my last option to do.

I am following this answer.

geth version: 1.8.0-unstable
I am running geth with --shh flag and --rpcapi "admin,eth,net,web3,debug,shh"
console.log(web3.version); returns: api: '0.20.5'.

When I run following script:

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

if(!web3.isConnected()){ //web3@0.20.5
//if(!web3.eth.net.isListening().then(console.log)){ //web3@1.0.0-beta.34
    console.log("notconnected");
    process.exit();
}

var kId = web3.shh.newSymKey(); //Error occurs.

var kId = web3.shh.newSymKey(); gives following error with web3@'0.20.5':

Error: The method shh_newSymKey does not exist/is not available
    at Object.InvalidResponse (/home/alper/eBlocBroker/node_modules/web3/lib/web3/errors.js:38:16)
    at RequestManager.send (/home/alper/eBlocBroker/node_modules/web3/lib/web3/requestmanager.js:61:22)
    at Shh.send [as newSymKey] (/home/alper/eBlocBroker/node_modules/web3/lib/web3/method.js:145:58)
    at Object.<anonymous> (/home/alper/eBlocBroker/dd.js:9:20)
    at Module._compile (module.js:649:30)
    at Object.Module._extensions..js (module.js:660:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
    at Function.Module.runMain (module.js:690:10)

Please note that I have tried it with web3@1.0.0-beta.34 that also gives this error that seems like the same error:

Promise { <pending> }
true
(node:16162) UnhandledPromiseRejectionWarning: Error: Returned error: The method shh_newSymKey does not exist/is not available
    at Object.ErrorResponse (/home/alper/eBlocBroker/node_modules/web3-shh/node_modules/web3-core-helpers/src/errors.js:29:16)
    at /home/alper/eBlocBroker/node_modules/web3-shh/node_modules/web3-core-requestmanager/src/index.js:140:36
    at XMLHttpRequest.request.onreadystatechange (/home/alper/eBlocBroker/node_modules/web3/node_modules/web3-providers-http/src/index.js:77:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/home/alper/eBlocBroker/node_modules/xhr2/lib/xhr2.js:64:18)
    at XMLHttpRequest._setReadyState (/home/alper/eBlocBroker/node_modules/xhr2/lib/xhr2.js:354:12)
    at XMLHttpRequest._onHttpResponseEnd (/home/alper/eBlocBroker/node_modules/xhr2/lib/xhr2.js:509:12)
    at IncomingMessage.<anonymous> (/home/alper/eBlocBroker/node_modules/xhr2/lib/xhr2.js:469:24)
    at IncomingMessage.emit (events.js:185:15)
    at endReadableNT (_stream_readable.js:1101:12)
    at process._tickCallback (internal/process/next_tick.js:114:19)
(node:16162) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated 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:16162) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

[Q] How could I fix this error? What do I do wrong?

Please note that available shh functions could be seen here; output of console.log(web3.shh).


texts: Virus scan shows 6 chaindata files infected, when quarantined, node can't be found

texts: 3+3 backups but when left alone ETH runs fine v0-8-1, tried to redownload same problem, what to do? Description=ANAPHYLAXSIS


texts:
Hi I'm wondering what are some best practices in terms of directory and file structure when building a truffle application, specifically within the app directory.

I'm building a Dapp with too many functions for one file. I'm wondering if someone could give me some examples about how to nicely separate files for contract functions that go together and bring in truffle contract object and web3 together in a app.js file. Just asking for some nice ways of doing this.


texts: Why is this Miner almost 50% above his reported Hashrate

texts:
i stumbled upon this Miner where i see his reported 122MH/s but he has almost a constant average/current of 158-160MH/s im new to mining and i want to understand how this is possible.
https://ethermine.org/miners/d7554a844b7f5076f97d671dd4d2c04b393ac414/dashboard
Thx


texts: Started my first Dapp, I have a trouble of Greeter tutorial

texts:
I started my first Dapp through this tutorial (“https://ethereum.org/greeter#the-solc-compiler”).
But, there is a step (following image show ) I can’t understand, don't know what should I do:

I search on Google, and I found this is a difference of Eth GitHub wiki tutoring:

And, I executed "eth.getCompilers()" is show

I stopped at this step.
What should I do make I can create my Greeter Dapp?


texts:
I have a dapp running on rinkeby at the moment, you can try it now on cryptogol.io, but I am facing a problem when reading events from the Blockchain. For example, yesterday I make the events happens, so everyone can interact with the site. Here is the code for listening to the event (it is being ran every time someone opens the page at www.cryptogol.io/market.html:

listenForEvents: function() {
  console.log("escuchando")
    App.contracts.KickerADN.deployed().then(function(instance) {
        instance.AdnCreated({}, {
            fromBlock: 0,
            toBlock: 'latest'
        }).watch(function(error, event) {
            App.loadBody(event.args._adn.toNumber());
        });
    });
}

When you open the page it can take more than 1 minute to load the event. The function is being called normally but the event is not getting it on time.
Any idea?


texts: Distribution function in ERC20 token which can be executed on a later stage?

texts:
I need to implement Distribute function in ERC20 token code which will send equal amount of the tokens on an array of addresses when executed.
Below is the source code that I will use for that. Of course I will change the variables for my token:

https://pastebin.com/wAe9a1EV

Is the Distribute function that I add at the end of the contract suitable and does not interfere with the rest of the source code?
Can I execute distributions on a later stage through Myetherwallet or Mist with that function if I deploy the contract with that function on the blockchain?

function distributeToken(address[] addresses, uint256 _value) onlyOwner
{
        for (uint i = 0; i < addresses.length; i++) {
   balances[owner] -= _value;
   balances[addresses[i]] += _value;
   Transfer(owner, addresses[i], _value);
   }
}


texts:
I am creating new ERC-20 DOTAToken. I want my token to have total supply 800 millions and 18 decimals. Is it correct way to declare it?

contract DOTAToken {
  string constant public name = "DOTATOKEN";
  string constant public symbol = "DTK";
  uint256 constant public decimals = 18;
  uint256 constant public totalSupply = 8 * 10 ** (8 + 18);

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


texts: How to programmatically check the type of Ethereum node/backend that I'm connected to using Go?

texts:
I'm aware that I can do this using CURL like so:

curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' https://the-node-ip-address:8545

Which return the following output:

{"jsonrpc":"2.0","id":67,"result":"Geth/v1.8.22-omnibus-260f7fbd/linux-amd64/go1.11.1"}

OR

{"jsonrpc":"2.0","result":"Parity-Ethereum//v2.2.11-stable-8e31051-20190220/x86_64-linux-gnu/rustc1.32.0","id":67}

Is there a way to do this using any package from go-ethereum project? All I have with me is a node RPC URL i.e. http://123.45.678.912:8545 and I want to check if it's a Geth node or Parity node using Golang without needing to convert the CURL above to Go code.

I'm looking for something like this:

import "github.com/ethereum/go-ethereum/ethclient"
...
client := ethclient.Dial("http://123.45.678.912:8545")
clientType := client.Xxx() // <-- I need this method and it should return "Geth" or "Parity"

What is the method for Xxx() above?


texts: Ethereum wallet does not allow transaction even after proper conditions

texts:
Ethereum Wallet shows "It seems this transaction will fail ......" even though I've used if/else inside contracts to ensure that transfer value does not go higher than contract balance.`

  function mySales( address a) constant public canWithdraw returns (uint){
    return totalSales[a];
}

function topSalesPerson() constant public returns ( address ){
    return topsales;
}

event bonusDepleted(string);

function submitSales() public payable canWithdraw{

    uint amount = msg.value;
    uint bonus_temp;
    if (this.balance >0){
        if(amount > 50000000000000000000){
            bonus_temp = amount/10; // 10% bonus
        }
        if(bonus_temp > 20000000000000000000){
            bonus_temp = 20000000000000000000;  // max bonus = 20 ether
        }

        if (this.balance > bonus_temp){
             msg.sender.transfer(bonus_temp);  // transfer bonus in case of enough balance
        }
       else{
            msg.sender.transfer(this.balance); // else transfer remaining amount as Bonus
       }
        owner.transfer(amount);

        Bonus[msg.sender] += bonus_temp;
        totalSales[msg.sender] += msg.value;

        if( totalSales[topsales] < totalSales[msg.sender]){
            topsales = msg.sender;
        }
    }

    if(this.balance == 0){
        bonusDepleted("Bonus has reached its limit and no bonus will be provided for future sales");
    }
}`

So if contract has 3 ethers then for 50 ether it allows txn but for 60 it shows warning and error "intrinsic gas too low" where as it should have just refunded last 3 ether.

Also for Readonly functions like "mySales", how to invoke them from "ethereum -wallet"  as it does not return anything on entering address into this function under "Read from Contract Section". i'm able to use it from command-line.


texts: About security of web3.js when running inside a browser

texts:
Please explain how authentication for "protected" operations (such as withdrawal of money from a wallet) is handled in web3.js when it is run inside a customer's browser.

Please also explain how it interacts with any browser plugins.

Also, is it recommended for every user of a site which may do "protected" operations in user-side web3.js to install some particular browser plugins? If yes, why?


texts:
Is there an updated Opcode Specifications available for the EVM to date?

Specifically, is there a continuously updated list of Opcode Specifications similar to that found in the ethereum yellow paper?


texts: Windows Ganache GUI not taking updates from Truffle running on WSL2

texts:
I have added truffle workspace to Ganache as usual. But now when I do a simple truffle develop followed by migrate inside the truffle shell, Ganache picks up that the contracts are deployed, but it doesn't pickup changes to the wallet balances.
My truffle-config.js files has only one change:
  compilers: {
    solc: {
      version: "native",
    },
  },

I am running truffle inside WSL2, whereas ganache gui is installed natively in windows.
Below is the balance reported by Truffle shell:
truffle(develop)> web3.eth.getBalance(accounts[0])
'99934183260000000000' # updated balance after migrate

truffle(develop)> accounts[0]
'0x6b318B9350E42bEB94f9Ae5e8b9DA854a6137628'

Where that same account 0x6b318B9350E42bEB94f9Ae5e8b9DA854a6137628 in Ganache shows balance full 100 Eth:


texts: List of Token Exchanges Available on Testing Network?

texts:
Found Kyber Network Token Exchange on Ropsten so far.

  Please share if you know more token exchanges available on any testing network for trading Tokens as a test.


texts: how to upgrade or cancel a pending low gas transaction

texts: I sent a transfer of an ERC20 token from my wallet to an exchange wallet with the lowest gas (5 Gwei). It's now been 1 day 6hrs and still shows as pending. Is there a way I can upgrade or cancel this pending low gas transaction? Thank you!


texts: How would I figure out if ethereum or token is being transferred seeing the transaction details?

texts:
web3.eth.getTransaction('0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b§234')
.then(console.log);

> {
    "hash": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b",
    "nonce": 2,
    "blockHash": "0xef95f2f1ed3ca60b048b4bf67cde2195961e0bba6f70bcbea9a2c4e133e34b46",
    "blockNumber": 3,
    "transactionIndex": 0,
    "from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
    "to": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f",
    "value": '123450000000000000',
    "gas": 314159,
    "gasPrice": '2000000000000',
    "input": "0x57cb2fc4"
}

Seeing the transactions details from web3() like above, how would I know that whether it is a ethereum transaction or a token transaction? Can you please give me some insights?


texts: Change Ganache-Cli account using the MetaMask

texts:
I am making a Voting Dapp, learning from the tutorial given
here

In Which all the transactions are happening from the single account but as ganache given 10 accounts, I want to change the account and perform the transaction.

Is there any way I can use MetaMask to do it ?


texts: question on random number generation exploitation on Ethereum as described on cryptozombies

texts:
I'm a bit confused about the description found here on randomness:

If I were running a node, I could publish a transaction only to my own
node and not share it. I could then run the coin flip function to see
if I won — and if I lost, choose not to include that transaction in
the next block I'm solving. I could keep doing this indefinitely until
I finally won the coin flip and solved the next block, and profit.

since I thought that a function called on a contract is considered a transaction that is broadcasted to all nodes on a network rather than to a single node whose refusal to publish the transaction can allow this scenario to play out.  I reviewed the post cited on that here but wasn't able to get any clarity: How can I securely generate a random number in my smart contract?


texts:
Say I have a data chain, a party is moving data to a party and so on and so on, and I'd like to trace exactly what party touched what data (given my data has an ID).

I wouldn't like to store this on-chain therefore I would like to come up with a state channel solution for that.

My assumption would be the most optimal way would be to save some sort of channel state on-chain, make lots of transactions on the state-channel, maintaing an API between all parties and once every X minutes write the channel state on-chain, using a Merkle Tree.

Now this is very abstract, I don't understand this to detail and I'd like to know how am I to implement such "checkpoint" on-chain and some guidelines on what's the best approach.