texts: Contract function call error "TypeError: Cannot read property 'isMinter' of undefined" using Truffle tool

texts:
I deployed a ERC20Mintable token in truffle env(the .sol file is ERC20Mintable.sol).

2_mintable.js
=============
   Deploying 'ERC20Mintable'
   -------------------------
   > transaction hash:    0x02c7b8e1dbde226304614ceeea48e1d4eb123bd1a70e73b1955d8718f3d49e08
   > Blocks: 0            Seconds: 0
   > contract address:    0x25CcB91c6643a0679591F888c3a16B12745b9594
   > block number:        3
   > block timestamp:     1562326476
   > account:             0x6D04f90886E0651381c174B2752C6c0F06626a54
   > balance:             99.96399902
   > gas used:            1496633
   > gas price:           20 gwei
   > value sent:          0 ETH
   > total cost:          0.02993266 ETH
   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:          0.02993266 ETH

the 2_mintable.js code is:

const ERC20Mintable = artifacts.require("ERC20Mintable.sol");
module.exports = function(deployer) {
  deployer.deploy(ERC20Mintable);
};

I want to check whether accounts[0] is minter, and call function as below:

let instance = await ERC20Mintable.deployed()//It can display correct contract info.
let accounts = await web3.eth.getAccounts()
instance.MinterRole.isMinter(accounts[0])

there is an error information like below, how to fix the problem, many thanks!

truffle(develop)> instance.MinterRole.isMinter(accounts[0])
evalmachine.<anonymous>:0
instance.MinterRole.isMinter(accounts[0])
                    ^

TypeError: Cannot read property 'isMinter' of undefined
    at evalmachine.<anonymous>:0:21
    at sigintHandlersWrap (vm.js:285:15)
    at Script.runInContext (vm.js:127:14)
    at runScript (/usr/local/lib/nodejs/node-v10.15.3-linux-x64/lib/node_modules/truffle/build/cli.bundled.js:368533:21)
    at Console.interpret (/usr/local/lib/nodejs/node-v10.15.3-linux-x64/lib/node_modules/truffle/build/cli.bundled.js:368548:21)
    at ReplManager.interpret (/usr/local/lib/nodejs/node-v10.15.3-linux-x64/lib/node_modules/truffle/build/cli.bundled.js:369389:18)
    at bound (domain.js:395:14)
    at REPLServer.runBound [as eval] (domain.js:408:12)
    at REPLServer.onLine (repl.js:639:10)
    at REPLServer.emit (events.js:189:13)


texts: How to convert BigNumber to Number in Truffle framework?

texts:
I have written an ERC20 token contract and deployed it in test network using truffle framework. When I check the token balance for an account using web3 it was giving the result in BigNumber when I try to convert it to a number using toNumber() getting an unexpected result.

Solidity code:

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

Javascript code:

instantiateBalance() {
const contract = require('truffle-contract')
const token = contract(Token)
token.setProvider(this.state.web3.currentProvider)
var tokenInstance;
token.deployed().then(function(instance) {
tokenInstance = instance;
return tokenInstance.balanceOf.call("0xb1Cf866ced575FD1A1997Daa5d6F099efb282E41", {from: "0xb1Cf866ced575FD1A1997Daa5d6F099efb282E41"});
}).then(function(balance) {
console.log(balance.toNumber());
})

Expected Result

Decimals = 18

Actual Token Balance = 100000000.000000000000000000

Actual Result

Token Balance = 1000000000000


texts:
Here's an example from solidity docs:

[SOLIDITY]

contract ClientReceipt {
    event Deposit(
        address indexed _from,
        bytes32 indexed _id,
        uint _value
    );

    function deposit(bytes32 _id) {
        Deposit(msg.sender, _id, msg.value);
    }
}

[JAVASCRIPT]

var ClientReceipt = web3.eth.contract(abi);
var clientReceipt = ClientReceipt.at(address);

var event = clientReceipt.Deposit();

event.watch(function(error, result){
    if (!error)
        console.log(result);
});

Now I'm getting a log every time somebody invokes a deposit function. It all works and I don't have any questions about that. What I can't understand is how an example from web3 api docs would work with the code above:

var event = myContractInstance.MyEvent({valueA: 23} [, additionalFilterObject])
event.watch(function(error, result){
  if (!error)
    console.log(result);
});

My questions:

What does the property name value1 represents? Is it the name of an indexed argument? What will I get in my console if I pass {_value: 100} as the first argument? Will I get in my console an event object only when someone triggers the event with the parameter named _value and the value 100?


texts:
I am trying to deploy a contract on react. But I can't seem to pull it off :(

This is my code:

this.myContract.deploy({
          data:[big boi bytecode here],
          arguments: ['name', 'description', 20, 20]
      });

And this is the error I am receiving: "TypeError: this.gamechanger.deploy is not a function"

I have also tried using:

this.myContract.deployed().then(() => [...]

However, it would not deploy.

How should I go about doing this? Help would be insanely appreciated!

P.s. I am using Web3 version 1.2.6


texts: Double callback when deploying a new smart contract with web3 and metamask

texts:
So this is the code on the web3 api: https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethcontract

It mentions that the function(err, myContract) callback will be fired 2 times

var myContractReturned = MyContract.new(param1, param2, {
   from:mySenderAddress,
   data: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
       $.post('/hash', {contractAddress: myContract.address, txHash:myContract.transactionHash}, function(success){
            if(success){

            }
       });

   // check address on the second call (contract deployed)
   } else {
       console.log(myContract.address) // the contract address
       $.post('/hash', {contractAddress: myContract.address, txHash:myContract.transactionHash}, function(success){
            if(success){

            }
       });
   }

   // Note that the returned "myContractReturned" === "myContract",
   // so the returned "myContractReturned" object will also get the address set.
 }
});

--As a note I am currently testing this through TestRPC, so my contract is deployed and mined very quickly--

I have added 2 post requests that send data to a node.js server into the code to replicate what I am trying to do with my website.

This code works perfectly fine if you deploy the contract and wait on the webpage for this callback to happen 2 times. However, if I deploy a contract, then leave the current webpage, the 2nd callback never happens and the contract address is never received.

So my question is, if i were to put my app out into production, where it could take hours to get back the contract address. Will it never be called if the user changes to a different webpage or closes out of the site?


texts: Leverage short positions in decentralised PoW currencies

texts:
Hint

I asked this question in a similar style already on bitcointalk and on bitcoin.stackexchange. But in these threads, there are no good answers and I thought maybe it would be better to ask the question in a PoW critical environment.

The question

What can be done in PoW-currencies, if there is a majority attack aimed to bring the value of the coin down by somebody who holds a leverage short position? Or in other words: How can we trust miners, if they can profit more from doing strange things during holding a leverage short position than from the transaction fees? When leverage shorts exist, the attacker can leverage his profit, but how can security of the coin be leveraged?


texts:
My code:
mainContract.events.Transfer({
    fromBlock: 0
}, function (error, event) {
    console.log(event)
})

This method returns all the past events (I guess because of that fromBlock: 0)
Now my question is how can I set this to only watch for new events?


texts:
I deployed an exactly same contract to both ETH and ETC.
And I could see the contract doesn't work correctly only on ETC.

contract ContractA {
    ContractB public BB;

    // Common
    constructor () public {
        BB = ContractB(msg.sender);
    }

    function () public payable {
        require(msg.value > 0);

        BB.destination().transfer(msg.value);
        BB.logDeposit(msg.sender, msg.value);
    }
}

It seems that it fails on the line BB.destination().transfer(msg.value);. I think reading destination() works and then it fails when it tries transferring.

I suspect that the OPCODEs for those chains are different, but couldn't get any clue.


texts: Looping Through and Running the Same Method on an Array of Contracts

texts:
I am trying to retrieve the price of four contracts all using the same ABI. I have made the array 'Contract' so I can loop through them and apply the same method of "Price":

var Contract = [];

Contract.push(TheContractName.at("0x23db685b4f40fc3565ecba26751570e60eed82fd"));
Contract.push(TheContractName.at("0xeefc6f5b60ce3481add637dc661d1f82f4041b56"));
Contract.push(TheContractName.at("0xc7138f91b01660206447e756ccca7ac54a15c4cf"));
Contract.push(TheContractName.at("0xf0a9d6b665e2ce6975cffe4f3b4ffd5abafe5933"));

Then I made a loop to fetch the results through Web3.js:

Contract.forEach(function(Price) {
    console.log(Price);
});

However, this just gives me the results of the original array.

I have used this function to retrieve successfully the price when there is no array involved:

Contract.Price(function(error, result) {
     console.log("Price " + result / 1000000000000000000 + " Ether");
});

If I can retrieve the results, I will then make a new array for the values returned, and append the data-* fields in the HTML. With this you can then sort the appended divs with the data-* tag values.


texts: totalSupply() Solidity signature causing conflict error

texts:
I'm writing a very basic ERC20 token using solidity in the Mist wallet. For some reason the compiler doesn't like the totalSupply() function name. If I change this name it compiles fine.

To be ERC20 compliant, this function has to be signed this way.

How do I get around this error?


texts: How to interacting with existing ERC-20 token on testnet?

texts:
I'd like to interact with ERC-20 tokens transactions on testnet (preferably ropsten).

Are there any ERC-20 tokens faucets?
Is it common that token issuers deploy their contracts on testnet?
What are my options to test known ERC-20 transactions on testnet?


texts: "retrieved ancestor invalid" message during synchronization

texts:
We have been running a private ethereum network for a couple of months.

Today we tried to add a new node to the network.  When the node was
synchronizing, (after 3-4 hours) it stopped with the following message :

5a0e number=847268 hash=0000...0000 allowance=847268
WARN [03-23|15:11:45] Synchronization failed dropping peer
5a0e err="retrieved ancestor invalid"

We tried it again by starting from scratch (deleting all retrieved chain)
and the same problem appeared again at the same number=847268.

I will appreciate your help on resolving this issue.


texts: Can I reclaim ETH from the DAO using a different wallet?

texts:
I have started up my old ubuntu machine after taking a break from crypto for a while. I had bought ETH and DAO tokens before the attack. I would now like to reclaim my ETH from the DAO but unfortunately I cannot sync the wallet on my old ubuntu machine even after leaving it for weeks.

I now want to use a newer (MacOS) machine in the hope that this will sync faster - I have my keystone and my password.

Will my contract with the DAO show up on the new wallet and will I be able to withdraw using this wallet?


texts: Contract deployment exceeds block gas limit

texts:
I am using the mist wallet to deploy the standard ERC20 contract that it provides in its tutorial. in my wallet has 0.05 ether, but whenever I try to deploy the contract, even at the cheapest possible mining speed I get an error message

exceeds block gas limit

What am I doing wrong?


texts: Simple Web3 installation and calling contracts

texts:
I have been trying to inject metamask into my site using web3. I have called web3 in my site as below and started the site using local server(VS Code extension which gives me port:5500)

    window.addEventListener('load', async () => {
      if (window.ethereum) {
        window.web3 = new Web3(ethereum);
        try {
          await ethereum.enable();
          initPayButton()
        } catch (err) {
          $('#status').html('User denied account access', err)
        }
      } else if (window.web3) {
        window.web3 = new Web3(web3.currentProvider)
        initPayButton()
      } else {
        $('#status').html('No Metamask (or other Web3 Provider) installed')
      }
    })

Later I am calling my contracts as below and I am facing troubles.
pay() is a function that happens with a button click in my HTML. It needs payout() function to be called from my Smart contract so initially I defined it as you can see below in 1st line.

    window.contract = new window.web3.eth.Contract(
           [  abi    ] , '0xC4AfE8504a711bE2D5E25b45eb72fC3f0924aB21');

        function pay() {

            var paymentAddress = document.getElementById("address").value;
            var val = document.getElementById("weight").value;
            var type= document.getElementById("category").value;

            contract.methods.payout.sendTransaction( paymentAddress ,val,type )
            //updateStatus('Updated.');
        }

I am getting the following error
MetaMask no longer injects web3

Uncaught TypeError: window.web3.eth is undefined

I have tried lot of ways but couldn't go further please help me.


texts:
I'm looking at EtherDelta contract,  and -- provided it had been migrated several times in the past and probably foresees future migrations -- I'm confused as I don't see any method by which the owner of the contract can migrate the balances data.
They must have a list of all the addresses in the mapping in order to migrate the data to a new version of the contract, don't they? Yet it is missing from the contract.

Can someone suggest what they do?


texts: How to add requirements to the token contract: 1) owner has enough tokens and 2) minimum sum of ETH of the receivers before updating balances

texts:
Could you check if these lines are correct and will work? In this code I have two requirements: I want to check if the owner has enough tokens (10 millions tokens) before updating balances and also send tokens only to addresses with minimum 2 ETH balance.

  function getEthBalance(address _addr) constant
  returns(uint) {
      return _addr.balance;
  }

  function distributeToken(address[] addresses, uint256 _value) onlyOwner {
   for (uint i = 0; i < addresses.length; i++) {
   require(balanceOf[owner] >= 10000000); // FIRST REQUIREMENT
   if (getEthBalance(addresses[i]) <= 200000000000000)) {
      continue;
      }; // SECOND REQUIREMENT
   balances[owner] -= _value;
   balances[addresses[i]] += _value;
   Transfer(owner, addresses[i], _value);
   }
   }

Thanks for any help!


texts: Rationale Behind Ethereum's Data Storage Scheme

texts:
1) Why does Ethereum store data in 32byte chunks? I don't suppose this to be some backward-compatibility left-over; is it? We could store data in variable length fields as well.

2)I don't think optimization is the case as we are already wasting over 32bytes (32bytes for the hash which constitutes the path + Merkle Trie node's-metadata) as an access key to each such field (the path from Data Trie root to each variable).

3) any notes on how the compiler computes the access key for each variable?

4) I'm quite new to Ethereum, is there any economic incentive to remove the previously occupied data?


texts:
There is something is wrong with my delete function or i do not know what i have missed.

The id of the user is stored in both User (struct) and userIds (array) and i want to be able to delete the id from userIds and the entire user(id, userInfo, userData;) from my block chain. my current function does not really delete the user :(

function delete_user_byId(uint _id) public returns(uint[]) {
    if (_id >= userIds.length) return;
    for (uint i = _id; i<userIds.length-1; i++){
        userIds[i] = userIds[i+1];
    }
    delete users[_id];
    delete userIds[userIds.length-1];
    userIds.length--;
    return userIds;

}


texts: How to sync to Rinkeby Test Network using geth in Windows?

texts:
Should I run this command or the ipcpath must be changed for Windows.

geth --rinkeby --rpc --rpcapi="personal,eth,network,web3,net" --ipcpath "~/Library/Ethereum/geth.ipc"

And after that what path should I specify in geth attach command?


texts: Does "localbitcoins" for ethereum exist or in development?

texts: Does such a thing currently exist? Are there any groups, people or person developing a "localethereum" or "localethers" that works similarly to "localbitcoins"?


texts:
I did read some questions like How does Ethereum enable self sovereign identity? but I was wondering if someone could advise me how to get started with the technical aspects of creating a decentralized identity? I see no projects/white-paper that highlight the codes of how to develop such ID!

Thanks for the suggestions and sorry if the question was rather stupid!


texts:
To test my contracts i need to use multiple accounts. I hoped that changing value of from option will help me with this. But it is ignored and msg.sender is always accounts[0] (my deployer)

Truffle

await this.proposal.increaseCredit(fromWei(11, 'micro'), {from: '0x4e66526f50b4c09d0eee8ee01294c7003cfed859'})

Solidity

function increaseCredit(uint _amount) public {
    emit Test(msg.sender, address(this));
}

Here is event log:

Test(_test1: 0xd3fe1c237a5dddd86d27b3c2ff00885629176765, _test2: 0xefbed05633cc5a9feafe6fc0836bded1f3763a62)

this is not a fallback/payable function. So sendTransaction here doesnt fit

What im doing wrong?


texts: Can you mine with 2GB cards or less? Thinking about the DAG issues

texts:
So I'm really new to mining and I tried setting up a Claymore miner on a rig with a 2GB card, it gave me a error saying something that the DAG wasnt enough and then I looked it up on google and I only found articles saying that you cant mine with 2GB cards anymore or less because there is no miner that supports it..

I wanted to setup a rig with a bunch of cheap cards everywhere from 1-4GB
But I'm starting to reconsider it because if you cant mine with anything less than 4GB cards it wont be worth getting those cheap cards.

Can you mine with lower than 4GB cards such as 1gb 2 gb 3 gb? I know it will give you a low Mh/s just wondering if its possible.

If not, can you hook up four 1 gb hards or eight 512mb cards?


texts: What is an example of Use a pattern where the recipient withdraws the money?

texts:
In the Solidity docs it says:

  There are some dangers in using send: The transfer fails if the call stack depth is at 1024 (this can always be forced by the caller) and it also fails if the recipient runs out of gas. So in order to make safe Ether transfers, always check the return value of send, use transfer or even better: Use a pattern where the recipient withdraws the money.
  (emphasis mine).

What does that mean and can someone show me an example of using this pattern?


texts: solidity remix calling one contract from another when the contracts are in two different files

texts:
The following solidity code works as expected

pragma solidity 0.4.25;

contract Another {
    uint public balance;
    function sendToAnother() public {
        balance += 10;
    }
}

contract Test {
    function send(address another) public {
        Another(another).sendToAnother();
    }
}

I want to move the Another contract to a separate file. So now I have the following two files:

//Test.sol
pragma solidity 0.4.25;

contract Another {
    function sendToAnother() public pure returns (uint);
}

contract Test {
    function send(address another) public pure {
        Another(another).sendToAnother();
    }
}

And

//Another.sol
pragma solidity 0.4.25;

contract Another {
    uint public balance;
    function sendToAnother() public {
        balance += 10;
    }
}

In remix, I am then doing the following:

Deploying Another Contract from Another.sol, and copying its address.
Deploying Test Contract from Test.sol
Invoking send() from Test Contract with the address of the Another contract deployed in step 1

At this stage, I am getting the following error. What am I doing wrong here?

call to Test.send errored: VM error: revert.
revert  The transaction has been reverted to the initial state.
Note: The constructor should be payable if you send value.  Debug the transaction to get more information.


texts:
Basically you don't need to pay fee for contract call, but if a contract method does lots of work, you need to add gas in contract call to prevent DoS attack like this:

  contract.method.call({gas: 1000000000})

Who gets this fee?


texts:
root@iZwz98r5jfsgx41dfymo6iZ:/usr/local/lib# sudo apt-get install php5.6-mbstring

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php5.6-mbstring
E: Couldn't find any package by glob 'php5.6-mbstring'
E: Couldn't find any package by regex 'php5.6-mbstring'

but I excuse：sudo apt-get install php-mbstring
root@iZwz98r5jfsgx41dfymo6iZ:/usr/local/lib# sudo apt-get install php-mbstring
Reading package lists... Done
Building dependency tree
Reading state information... Done
php-mbstring is already the newest version (1:7.0+35ubuntu6.1).
The following packages were automatically installed and are no longer required:
  linux-headers-4.4.0-87 linux-headers-4.4.0-87-generic linux-image-4.4.0-87-generic linux-image-extra-4.4.0-87-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

what wrong with this？


texts: Remix: Simple solidity function errored: gas required exceeds allowance or always failing transaction

texts:
I have a problem with simple solidity code in Remix.
Even I give 10 ETH(testnet) to the contract C but it doesn't work.
Error is:

  transact to C.makeContract errored: gas required exceeds allowance or
  always failing transaction

pragma solidity ^0.4.21;

contract A{
    uint public a;
    function setA(uint _a){
        a = _a;
    }
    function getData() constant returns (uint){
        return a;
    }
}

contract B is A {
    function getData() constant returns (uint) {
        return a * 10;
    }
}

contract C {
    A[] internal c;
    function () payable {}
    function makeContract() returns (uint, uint){ //I have no idea why     this function occurs error
        c.length = 2;
        A a = new A();
        a.setA(1);
        c[0] = a;
        B b = new B();
        b.setA(1);
        c[1] = b;
        return (c[0].getData(), c[1].getData());
    }
}

Here is my solidity code. HELP ME PLZ!!


texts:
I am rewriting an old contract I had. I am using the latest version of OZ contracts.. but they require:

pragma solidity ^0.6.2

I am using embark 5.2.3 and current compiler is 0.6.1+commit.e6f7d5a4.Emscripten.clang

So, how do I update the compiler?

Thanks


texts: How do nodes detect the duplicate transactions when Malicious/Misbehaving miner reintroduce old transactions in new blocks

texts:
I have read about Race attack, Finney attack where Merchants are expected to take precautions to wait for few block confirmations before delivering the goods. I was going through the validation sequence followed by nodes that update its copy of ledger such as following (from Ethereum white paper : https://github.com/ethereum/wiki/wiki/White-Paper)

"

Check if the previous block referenced exists and is valid.
Check that the timestamp of the block is greater than that of the referenced previous block and less than 15 minutes into the future
Check that the block number, difficulty, transaction root, uncle root and gas limit (various low-level Ethereum-specific concepts) are valid.
Check that the proof of work on the block is valid.
Let S[0] be the state at the end of the previous block.
Let TX be the block's transaction list, with n transactions. For all i in 0...n-1, set S[i+1] = APPLY(S[i],TX[i]). If any application returns an error, or if the total gas consumed in the block up until this point exceeds the GASLIMIT, return an error.
Let S_FINAL be S[n], but adding the block reward paid to the miner.
8.Check if the Merkle tree root of the state S_FINAL is equal to the final state root provided in the block header. If it is, the block is valid; otherwise, it is not valid.

"

I wonder how does above sequence protect from following attack:

Miner creates a block with transaction 100, say block is 27000
After few blocks are created, when miner gets chance to create a new block (elected), it reintroduces transaction 100 again, say block 27100

Say, there is good amount of Ether in the sender account.  Would above attack allow receiver getting twice the amount from the sender.

Does validation include checking for duplicate transactions IDs across blocks from the root block? That seems like lot of work as time progresses.

I am sure I am missing something. How does blockchain and which validation point in above sequence protect from this.

Thanks


texts: how could I go about sending tokens to a couple of thousands of addresses without havinging to do it manually? It's an airdrop.


texts: Possible to transfer multiple tokens in one transaction?

texts: Is it possible to transfer all / multiple ERC20 tokens to another wallet address in a single transaction?


texts: Why is there a drop in the amount of Ether I transferred

texts:
I tried to transfer 1.37299 Ether from one account to another. In the process, 0.0004851 Ether was consumed as gas. Even subtracting this gas price, ideally, 1.3725049 Ether should be transferred to my other account. But I find that only 1.36299 Ether is transferred. Here is the transaction. Why is there a drop in the amount of Ether? Am I ever going to recover it?

I am new to Ethereum and Ether. I understand the basics of gas cost and gas price associated with getting my transaction on the blockchain. Can someone please clarify this. Thank you.


texts:
How can someone withdraw the incoming money so quickly?
0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf
in - https://etherscan.io/tx/0xfbd225c6a5e7dc1ba76978d32914a6c18928a448540f2f235bca83e119c5f8a8
out - https://etherscan.io/tx/0xc8a703c07e4abca8e7bacc0f9b67c08cfe2cc68d0ce0eb05cf15fbba79b62f02
And why would someone send Eth there? If everyone knows the privkey?


texts:
How can I efficiently check the similarity of two strings? Or better yet, if I have an array of strings, I want to check that the given string is less than e.g. 80 % similar to any of the other strings. One of such approaches is for example Levenshtein Algorithm.
If there already exists some contract which provides a solution for this, that would work as well.
Can this even be done in an efficient manner on-chain?


texts: Whas this Error Code and how can i get rid of it?

texts:
Im using this code to query the balance of the logged-in address

// get sellPrice
function sellPrice() {
    web3.eth.getAccounts(function (error, accounts) {
        contract.sellPrice(address, function(err, result) {
            if(err) {
                console.log(err, 'err');
            } else {
                document.getElementById('sell_price').innerHTML = result;
            }
        });
    });
}
sellPrice();

But when i call it I get this error in the console:

MetaMask - RPC Error: invalid argument 1: hex number > 64 bits {code: -32602, message: "invalid argument 1: hex number > 64 bits"}

I cant really find anything on google or with metamask that explains how i can get rid of this error


texts:
I can generate the .bin of a contract with solc as follows:

solcjs --bin -o output contract.sol

However running the following command:

solcjs --bin-runtime -o output contract.sol

Generates the following:

  Invalid option selected, must specify either --bin or --abi

Is bin-runtime still a valid command in solc?


texts: Is a Hash Function really useful in a Smart Contract Election?

texts:
Noob here. Was reading this: https://karl.tech/learning-solidity-part-2-voting/
From my basic understanding, a hash function:

Receives an input (like x) and spits some result (like y)

y is calculated upon the contents of x (so the same x will always
hash to the same y)

It's non reversible (if you have y, you cannot get x)

Sounds good, but think about the following scenario.
There's an election on an Ethereum Smart Contract with 3 Candidates:

C1

C2

C3

Same logic:

Voter can't know who other Voters voted for. Results must only be
revealed after the election is over.

To vote, each voter must distribute their hash.

Once all votes are submitted/election period is over, all voters
distribute their actual vote.

Then you can verify that the Distributed Vote hashes to the
previously Distributed Hash, and the vote can be counted. Sounds
good.

But in a Smart Contract Election scenario:

All voters know the name/id/label of the 3 candidates.

All voters have access to the Smart Contract's code and can see which
hash function was used.

Couldn't the voters just:

Run the hash function for each candidate name/id/label by
themselves

Write down the resulting hash for each candidate (it would be the
same for each candidate every time, right?)

Go see which hashes are distributed in the Blockchain and reverse
engineer who each person voted for?

I don't really know that much, so this might be a stupid question.


texts: Python3, Populus installed but not working, deprecation

texts:
Populus was functioning well until I began getting deprecation warnings.
So I did pip uninstall populus and then pip3 install populus. Also installed all required python3 libraries. The install worked but then when I go:
populus
I get no such file or directory..
And with sudo populus I get command not found :/

It's probably something small pertaining to a switch from python2 to 3.
Any ideas as to what's happening

$ populus
/usr/local/lib/python2.7/dist-packages/populus/__init__.py:13: DeprecationWarning: Python 2 support will end during the first quarter of 2018Please upgrade to Python 3https://medium.com/@pipermerriam/dropping-python-2-support-d781e7b48160
  warnings.warn(warn_msg, DeprecationWarning)
/usr/local/lib/python2.7/dist-packages/geth/__init__.py:27: DeprecationWarning: The `py-geth` library is dropping support for Python 2.  Upgrade to Python 3.
  "The `py-geth` library is dropping support for Python 2.  Upgrade to Python 3."

Populus works via old: pip install
but when running sudo py.test tests/

plugins: populus-2.2.0
collected 2 items

tests/test_greeter.py ..                                                 [100%]

=============================== warnings summary ===============================
tests/test_greeter.py::test_greeter
  /usr/local/lib/python3.6/dist-packages/populus/config/web3.py:55: DeprecationWarning: __init__ is deprecated in favor of web3.providers.eth_tester.EthereumTesterProvider
    return self.provider_class(**self.provider_kwargs)
  /usr/local/lib/python3.6/dist-packages/eth_abi/abi.py:92: DeprecationWarning: Automatic inference of hex encoded data has been deprecated. Please adjust your code to ensure that the data argument for `decode_single` is a byte string
    "Automatic inference of hex encoded data has been deprecated. "

tests/test_greeter.py::test_custom_greeting
  /usr/local/lib/python3.6/dist-packages/populus/config/web3.py:55: DeprecationWarning: __init__ is deprecated in favor of web3.providers.eth_tester.EthereumTesterProvider
    return self.provider_class(**self.provider_kwargs)
  /usr/local/lib/python3.6/dist-packages/eth_abi/abi.py:92: DeprecationWarning: Automatic inference of hex encoded data has been deprecated. Please adjust your code to ensure that the data argument for `decode_single` is a byte string
    "Automatic inference of hex encoded data has been deprecated. "

-- Docs: http://doc.pytest.org/en/latest/warnings.html
===================== 2 passed, 4 warnings in 1.09 seconds


texts: npm install - - global @openzeppelin/cli not working

texts:
Guys I have node js and npm installed.
But when I try to install OpenZeppelin sdk using the command:
npm install --global @openzeppelin/cli

It doesn't install. I don't know what is wrong. But I think  maybe the library is now deprecated.
Some please help me.
When I run the command, it behaves as if it is installing but then encounters errors along the way.
Error shown below:
C:\Users\jude\hd_wallet>npm install --global @openzeppelin/cli
npm WARN deprecated truffle-config@1.1.16: WARNING: This package has been rename
d to @truffle/config.
npm WARN deprecated typechain-target-truffle@1.0.2: For TypeChain 2.x use @typec
hain/truffle-v4 or v5
npm WARN deprecated typechain-target-web3-v1@1.0.4: For TypeChain 2.x use @typec
hain/web3-v1
npm WARN deprecated request@2.88.2: request has been deprecated, see https://git
hub.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated mkdirp-promise@5.0.1: This package is broken and no longer m
aintained. 'mkdirp' itself supports promises now, please switch to that.
npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno ENOENT
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/web3-js/WebSocket
-Node.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\jude\AppData\Roaming\npm-cache\_logs\2020-09-25T10_55_49_4
71Z-debug.log

What could be the problem and how do I fix it??


texts: How to verify that a smart contract was deployed by us?

texts:
I would like a method called from Solidity to either

verify the hash of an entire smart contract's code, or
read some immutable EVM property that contracts expose that say who deployed them, e.g. a factory contract that we deployed earlier

The use case is that I want to have an addHook(contractAddress, methodSignature) function that other contracts can call to be notified when something changes (such as new statistics or voting) occurs. But we can't allow adding JUST ANY contract and method as a hook handler, because they can simply call while(1) and destroy our contract.
However, we do want to be able to addHook() after a contract is constructed, but only call methods of contracts which we ourselves wrote, and hardcode either 1 or 2 above in our contract which exposes addHook. The contract's owner property won't do, since it's not immutable, so another contract can fake it.


texts: Best practice for securely verifying Ethereum addresses

texts:
What is the best practice for users to securely send a POST to an API with their Ethereum address? My inclination is to have the user sign a message with their private key, send the resulting signature to the backend, and recover the public key on the backend using the same message and signature.
Most importantly, is this flow (1) correct and (2) secure? I assume signatures cannot be faked without knowing some private key. The API would be public, and the signature used in lieu of JWTs as the only means of authentication.
Secondly, if the above is correct and secure, what are the recommended methods to have users sign transactions? I see 3 methods of signing transactions in Web3.js with unclear differences between them:

web3.eth.sign(dataToSign, address [, callback])

web3.eth.personal.sign(dataToSign, address, password [, callback])

web3.eth.accounts.sign(data, privateKey); (Client would obviously not have privateKey)

And 1 method to recover the account that signed the data:

web3.eth.personal.ecRecover(dataThatWasSigned, signature [, callback])

Which methods are recommended and why?
Lastly, is the message itself important? I assume it can be anything as long as the backend and client have the same one, but users should also feel confident that signing a given message cannot be used nefariously.


texts: What denomination should I issue my ERC20 token by?

texts:
Following the "Create a cryptocurrency" tutorial on ethereum.org, I ended up with the following function (stripped down):

function () payable {
    if (msg.value == 0) { return; }
    uint256 tokens = msg.value * 100;

    owner.transfer(msg.value);
    balance[msg.sender] += tokens;
}

Because msg.value is in wei, sending 0.01 ETH, would result in receiving 1e18 tokens. I want to issue smaller amounts of tokens, ideally, 1 ERC20 per 0.01 ETH just like the tutorial does, but wouldn't that introduce floating point precision errors?


texts: How to figure out if an account address exists or not

texts:
I am trying to create a user database with solidity and ethereum blockchain.

i have a super user who needs to add other users using their address as a unique identifier. The address is not passed through msg.sender so how can i know if it really exists or not? ?


texts: sendTransaction BigNumber Error: new BigNumber() not a number: [object Object]

texts:
I am new to Solidity programming and writing smart contracts for one of the application. Here are my two contracts. I am using truffle and testrpc as tool. I am getting error consistently. Need guidance. I have seen earlier threads with similar subject lines but they dont help. I already tried changing the name of the function as well.

//Certificate.sol

contract Certificate {
    address private addressSelf;
    bytes32 private certName;

    function Certificate(bytes32 _certName) {
        addressSelf = msg.sender;
        certName = _certName;
    }
}

//Participant.sol

contract Participant {
    address private addressSelf;
    bytes32 private participantName;

    struct CertStruct {
        Certificate certificateData;
        bool isCertificate;
    }

    mapping (address => CertStruct) public certStructs;
    mapping (uint => address) public certIndex;
    uint public noOfCerts;

    function Participant(bytes32 _partName) {
        addressSelf = msg.sender;  // just set the self
        participantName = _partName;
        noOfCerts = 0;
    }

    function isCertGranted(address certAddress) public constant returns(bool) {
        return certStructs[certAddress].isCertificate;
    }

    function grantCertToParticipant(address certAddress, Certificate certificate) payable public returns (bool)
    {
        if(!isCertGranted(certAddress)) return false;

        CertStruct memory newCertStruct;
        newCertStruct.certificateData = certificate;
        newCertStruct.isCertificate = true;
        certStructs[certAddress] = newCertStruct;
        certIndex[noOfCerts] = certAddress;
        noOfCerts++;

        return true;
    }
}

//participant.js

var CertificateSol = artifacts.require("./Certificate.sol");

var ParticipantSol = artifacts.require("./Participant.sol");

contract('Participant', function() {

    it("should put certificate in the one participant", function() {

        var newCert;
        var newPart;

        return CertificateSol.new('CertName').then(function(newCertInstance) {
            newCert = newCertInstance;
        }

        return ParticipantSol.new('Name of Participant').then(function(newPartInstance) {
            newPart = newPartInstance;

        newPart.grantCertToParticipant.sendTransaction(newCert.address, newCert, { from : web3.eth.accounts[0], gas: 3000000 }).then(function(returnFlag){

            newPart.noOfCerts.call().then(function(certNumber){
              console.log('certNumber is ' + certNumber.toString(10));
          });
        }).catch(function(err){
          console.log('I am at grantCertToParticipant err ' + err);
        });

    });
}


texts: External Access To A Private Ethereum Blockchain

texts:
Background Info

I have been playing around with Ethereum and I have created a DAPP on the Ethereum blockchain inside Azure Kubernetes. Everything up to this point has been a good experience but the whole idea of using this technology is to demonstrate immutability.

The blockchain at the moment is private and therefore is centralized right now because the infrastructure is hosted and maintained by Azure under my subscription. In the future, I was considering moving to an external trusted provider like Infura

Question

My question is how do I allow external clients to verify the blockchain. The DAPP has APIs to extract data from smart contracts but how do they validate I am using blockchain technology under the hood and can they access it themselves?

Can they access the GETH instance directly? is this usual practice or is there another way?
Is there a way with Quorum to give them access to query view data on the blockchain but prevent them from mining?

If Quorum allows direct access for peers to the blockchain what is the best and simplest approach to recommend? i.e do they need an experienced Ethereum/blockchain developer to validate the data?


texts:
Sorry for noob question.
I installed web3 (npm install web3),

but for some reason instead of calling web3 methods or showing object data, nodejs displays object structure:

> web3.eth.accounts
Accounts {
  currentProvider: [Getter/Setter],
  _requestManager:
   RequestManager {
     provider:
      HttpProvider {

when I connect to geth via geth attach, web3 embedded into geth works correctly

I am trying to use web3 from inside docker, Dockerfile is below:

FROM node:carbon

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

RUN apt-get -y update && \
    apt-get -y install vim

RUN npm install

RUN npm install express

RUN npm install nodemon -g

RUN npm install hashmap && \
    npm install body-parser -g

# If you are building your code for production
# RUN npm install --only=production

# Bundle app source
COPY . .

CMD [ "nodemon", "start" ]


texts:
Contracts\Libraries like ERC20 and SafeMath have probably been deployed many times to Ethereum. How do I find their addresses so I can reuse their logic instead of coping them and deploying them by myself?

I see old posts from last year talking that no standard library was deployed yet... Is still this the case?

Deploying copied code just sounds so wastefull...


texts: Compile errors on sample project in Truffle 3.0.2

texts:
I tried to compile some smart contracts in truffle 3.0.2 (which works without problems in browser solidity and even older versions of truffle) and got compile errors. So I created a sample truffle project with

truffle init

and launched truffle compile:

$ truffle compile
Compiling ./contracts/ConvertLib.sol...
Compiling ./contracts/MetaCoin.sol...
Compiling ./contracts/Migrations.sol...
Error compiling:

Could not find expected contract or library in '/home/ubuntu-user/meta/contracts/MetaCoin.sol': contract or library 'MetaCoin' not found.
Compiliation failed. See above.

I suppose truffle init just was not updated for the new project structure. Trouble is, I do not know what that structure is supposed to be. I have read the documentation and upgrade guide, but it seems outdated and I was not able to get a clue about the problem. Does anyone have any idea, or maybe an idea for a tool that actually reduces complexity when dealing with smart contracts?


texts: how do i fix such an error; uncaught TypeError

texts:
The error that I am facing is as said
'Uncaught TypeError: Cannot read property 'abi' of undefined
These are the codes
FilmRegistrationApp.prototype.init = function(cb) {
    this.web3 = new Web3(
        (window.web3 && window.web3.currentProvider) ||
        new Web3.providers.HttpProvider(this.Contract.endpoint));
    var contract_interface = this.web3.eth.contract(this.Contract.abi);
    this.instance = contract_interface.at(this.Contract.address);
    cb();

}


texts: I deployed an ERC20 smart contract, but I need to make some changes on it. How do I do that? Heard that it is not possible to do it, once the contract is deployed. An experienced developer must have an alternative available. Can anyone help?


texts: How DApp actually talks to Ganache ethereum node?

texts:
Both Metamask and web3.js seems to be enabling a DApp communicates to a remote ethereum node.

There are a few different aspects to developing blockchain applications with Ethereum:

Smart contract development - writing code that gets deployed to the blockchain with the Solidity programming language.

Developing websites or clients that interact with the blockchain - writing code that reads and writes data from the blockchain with smart contracts.

Web3.js enables you to fulfill the second responsibility: developing clients that interact with The Etherem Blockchain. It is a collection of libraries that allow you to perform actions like send Ether from one account to another, read and write data from smart contracts, create smart contracts, and so much more!

From http://www.dappuniversity.com/articles/web3-js-intro

MetaMask is a browser extension that allows web applications to interact with the Ethereum blockchain. For users, it works as an Ethereum wallet, allowing them to store and send any standard Ethereum-compatible tokens

From https://medium.com/crowdbotics/building-ethereum-dapps-with-meta-mask-9bd0685dfd57
These two definitions confuse me a lot.
My question is, in a conncetion, is Metamask sitting between web3.js and Ganache？ Who actually talk to the ethereum node?


texts: I am just started to learn ethereum blockchain technology I came across the term token. I do not find the answer for what exactly token mean? and what its functionality and what situation we need it? Thanks for you help.


texts: Invalid JSON RPC response: "" In Browser-Solidity

texts:
I'd like to connect private geth node from browser-solidity, however it returned the error Invalid JSON RPC response: "".
Please check the following picture for details.

Could you tell me how to solve the problem?


texts: Accessing a proxied contracts address and code

texts:
I am trying to read a proxied contract and I want to find out where the proxy points to.
https://etherscan.io/address/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48#readProxyContract
This is the USDC proxied contract.
This lets me successfully read the proxied contract
new web3.eth.Contract(ERC20_ABI, contractAddress).methods.symbol().call();

This lets me NOT read the address of the implementation:
new web3.eth.Contract(PROXY_ABI, contractAddress).methods.implementation().call()

And I guess that the reason is that the call is delegated to the proxied contract and there the
method implementation() is not available.


texts: Can we connect 2 or more private block chains?

texts:
Lets say there are 2 organizations and each have their own private block chains in a different geographical region.

Now they need to have a collaboration and share some part of the data between them.

Is it possible to connect these 2 private block chain and have controlled access to each other?


texts: 'symbol lookup error: /usr/lib/libdevcrypto.so' when running eth or mix?

texts:
I am getting the following error when running eth or mix:

symbol lookup error: /usr/lib/libdevcrypto.so: undefined symbol:       _ZN8CryptoPP10RandomPool34GenerateIntoBufferedTransformationERNS_22BufferedTransformationERKSsy

Any ideas on how to fix this?


texts: condition check of struct mapping in solidity?

texts:
struct User {
       string username;
       string password;
       address userid;
        bool isAdmin;
}

mapping (uint => User) users;

function checkIfUserExists(address userid) public returns(bool) {
    for (uint o = 0; o < totalUsers; o++) {
        if (users[o].userid == userid) {
            return true;
        } else{
            return false;
        }
}

This Always returns false?? even if userid exists in the mapping..


texts:
I'm trying to install Mix-IDE on OS X 10.9.5 (Mavericks), but failing.

I tried using the binaries for Yosemite from the webthree-umbrella release page, but they crash on startup (pretty predictable).

Then I found out I can install cpp-ethereum through homebrew. I can run eth, but Mix is missing from the Applications folder (yes, I used --with-gui flag).

Does anyone know what I'm doing wrong?


texts: What is the best way to decipher gas incurred in individual steps of the contract?

texts:
I would like to understand the gas incurred in contract creation and in sending the transaction to the contract.

Is there an easy way to debug this?


texts: Disabling nonce check for go-ethereum for a private test net when using web3js batch requests to send tx

texts:
I am using web3js batch.add and batch.execute to send tx for an ethereum private testnet that I have created. I send tx using batch.add and batch.execute (don't prefer to use promises since they iterate tx one after the other and send whereas batch.add creates a batch and then executes it as a whole):
My batch.js looks as follows (the documentation here has about batch requests: https://web3js.readthedocs.io/en/v1.2.7/web3-eth.html#batchrequest):
function bench(size) {
    personal.unlockAccount(eth.accounts[0], "hi");
    var batch = web3.createBatch();
    start = Date.now();
    for (i = 0; i < size; i++) {
        batch.add(web3.eth.sendTransaction({
            from: eth.accounts[0],
            to: "0xBce16ea55bB357B038e612b1722A88879c665a31",
            value: 1
        }))
    }
    batch.execute();
    end = Date.now();
    duration = end - start;
    throughput = size * 1000 /duration;
    console.log("Start: "+start);
    console.log("End: "+end);
    console.log("Transaction Number: "+size);
    console.log("Duration: "+duration);
    console.log("Throughput: "+throughput);
}
bench(300);

I use rpc to attach to the geth nodes remotely and execute multiple different batch.js parallely as follows:
geth --exec 'loadScript("batch.js")' attach http://13.211.24.216:8545 &
geth --exec 'loadScript("batch1.js")' attach http://13.211.24.216:8545 &
geth --exec 'loadScript("batch2.js")' attach http://13.211.24.217:8545 &
geth --exec 'loadScript("batch3.js")' attach http://13.211.24.217:8545 &

I use a unique sender account for each batch.js so as to avoid tx nonce issues.
Problem -
After sending tx, I checked the balance at each geth node for the receiver account. However, the amount I sent was not reflected at the EVM for the receiver account (some tx were lost). I checked whether consensus delivered the sent tx and in fact it had delivered all sent txs. This led me to believe that some txs are not executed and persisted due to nonce issues. This may well be the case as I am not using the PoW consensus but a different consensus.
Now, I could perhaps create as many accounts as txs I send and try to test this. However, creating say 100,000 accounts with "personal.newAccount('hi');" consumes a lot of time and space as I have to attach to a geth ipc and then create accounts whilst chaindata is written to the device and consumes space.
Therefore, I decided that it would be easier to disable the nonce check in geth entirely just for checking. Would it be possible for someone to point me to where I should make the changes in go-ethereum to disable nonce check (nonce too high, nonce too low, nonce invalid, etc) entirely, so the EVM would execute and persist all the tx that I send?


texts:
I am trying to send ethers to another address, using geth, and then geth attach, and then using web3js. But it is asking password:

  Error: authentication needed: password or unlock

But I never put a password on any of the accounts. I tried the --unlock option when starting geth, but it only says Attempting to unlock, attempt 1/3 in the debug log, nothing else. I use all options in --rpcapi when starting geth. So what is this? Which password is it asking?


texts: Setting Up Geth / Ethminer - Am I Doing This Right?

texts:
My apologies if this has been covered elsewhere, but I went through several different guides and sources, both "official" documentation, and whatnot, about how to get started for mining. I feel I have followed the instructions to the best of my ability, but I feel like I am spinning my wheels in the mud here.
I downloaded the following:
Ethereum Wallet (had a link here, can't post more than 2 links without 10 rep?really?)
cpp-ethereum
then, I have been following this guide mainly, but do have others:
http://www.ethdocs.org/en/latest/mining.html#mining
so, this is as far as I seem to be able to get:
I open a cmd window in the folder with geth, and synced to the blockchain, or so I assume. I even created a second account, unsure of how to sync to my original I created when I opened the wallet app, so now I have two:
(had an image here, won't let me post because I have less than 10 rep...really?)
and then I entered geth --rpc and that seemed to get me to the point where it was actively syncing to the blockchain.
I then tried geth --rpc --rpccorsdomain and I still only get synced.
However, when I try to actually mine, I never seem to be able to get to that point.
I type geth ethminer -G and again, I seem to only get blockchain updates.
I then tried geth --opencl-device X where "x" is one of 0,1,2...to me this means that if I only have one GPU, it would be 0 right? so I tried --opencl-device 0.
Ultimately, no matter the input, this is what I get, for hours on end. I even went to bed and woke up hoping to find mining activity, and just the same thing:

I read on I think a subreddit page, that someone had a similar issue, and just like me, when they tried to open another cmd box simultaneously, they would get a "file is being used" error, and someone responded with "just close that cmd box, and open a new one, and it should work." I did just that, and I still get the same result.
Can someone please let me know what I am doing wrong here?
And ideally, present me with a solution that doesn't involve re-downloading packages from yet another source? Overall I am pretty frustrated right now, and yes, we are early adopters but my goodness, some consistency with the process, etc would be really helpful. Thanks!


texts:
Trying to figure out a way to Authenticate users them having an ethereum account.
New to ethereum and cryptography in general and my thought may not be adequate.
In essence I am thinking to be able to authenticate users by their public ethereum account address.
I have not found any straight forward solutions to this.
Would it be possible and does it make sense to verify using signature of some text string?
The app would ask the user to sign some text message (i assume this would have to be done in geth by user or some website),
but then is there an API that can be used to verify that message?
Also can this be done without spending any ether on transactions(initial gas charges)?
Also how can this be done using web3?

There is a similar question here
however there is no practical code solution and it may not be 100% related to my question

I have seen some posts on using metamask plugin but i do not want to have that as requirement as it seems to complicate the process and i am trying to aim towards simplifying it instead


texts: How to have a private function in Serpent?

texts:
I've been reading this tutorial on contracts and implementing them in Serpent and on the bottom of page 13:

  Any time we reference a function within the contract, we must call it
  from self (a reference to the current contract).  Note that any
  function can be called directly by a user.  For example, lets say we
  have a function A and a function B. If B has the logic that sends
  ether and A just checks if the ether should be sent, and A calls B to
  send the ether, an adversary could simply call function B and get the
  ether without ever going through the check.  We can fix this by not
  putting that type of logic in separate functions.

It's not clear to me whether functions A and B are part of the same contract. Is it possible for a contract to call a function from another on the same node? If yes, how does it or how can it know its instance (the self)?


texts: Guidance on where to start for a better foundation study

texts:
I'm a newbie to the block chain technology, where should I start from as a bigger for a better masterly and successful learning?
Can I kindly get anyone who can offer to mentor me for the realization of my study?


texts: Error: account is locked. Attempting to send ether from one account to another, Local Node on Private Blockchain

texts: What is the correct process to unlock an account? I was able to do this successfully in the geth console(see this post for more details on what I've tried Why does account show 0 balance, after seemingly successful transaction in geth console?)


texts:
How can I calculate the cost of running my contract and running each function?

I've noticed in Ethereum when a transaction is successful we have a transaction cost and a execution cost, what the difference?

If I calculate all the execution cost of my functions, will that be the total for my whole contract?


texts: Etherscan Verifying Contract Code: Error! Constructor arguments provided but might be unncessary because source code contains a public constructor

texts:
I'm trying to verify my solidity code through etherscan but it gave me this

  Error! Constructor arguments provided but might be unncessary because
  source code contains a public constructor. Tip: Try removing the
  constructor arguments and resubmit.

I deployed the contract to mainnet using truffle via infura. I am passing an address to the constructor and pretty sure the argument is the correct one.

Why does this happen? Why should I remove the constructor arguments?


texts: Issue getting Metamask account using Web3 1.1.0

texts:
I am working on a React app which uses a library that has Web3 as a dependency. I had previously been able to the get the current Metamask address with the following code:

 const injectedWeb3 = window.web3 || undefined;

 this.state = {
      web3: injectedWeb3
    };

  getAccount() {
    const { web3 } = this.state;
    if (web3.eth.accounts[0]) return web3.eth.accounts[0];
    throw new Error('Your MetaMask is locked. Unlock it to continue.');
  }

Then I updated that library to its latest version which changed it's Web3 dependency to Web3 1.0 . Now when I run the exact same code I get the following error:

Error: Invalid JSON RPC response: undefined
TypeError: e is not a function[Learn More]

Any thoughts as to what might be going on?


texts: What makes a transaction not mined and stay in txpool?

texts: What Makes a transaction in txPool not mined ?


texts: What is the best way to handle big structs?

texts:
I am currently working on a project implementation on the ethereum blockchain and had to create big structs with nearly 200 attributes. I want to know if that would make handling those structs more expensive (with respect to time and gas). If so, is there any way I can mitigate the effects of the size of the structs?

I know about IPFS and how it helps manipulate large data files when using ethereum blockchain, but I want to know if there is any other solution that I may have missed.

Thank you.


texts: I was given 1000 ethereum coins. I don't understand ethereum. I know there are 1 million coins in one bitcoin.  Are ethereum coins divided like that? Just trying to understand what 1000 ethereum really means. Please explain so a newbie can understand. Thanks.


texts: light node can perform any operation what fast and full sync mode do, exception getTransationreceipt?

texts:
I need to send ethereum between wallets or interact with a token on the ethereum network can a light node has a constraint to do that,it can not perform any task as a full or fast sync mode node, I read that getTransationreceipt a light node can not work because it is part of the block, there are some others transactions that does not support ?

thanks a lot.


texts: How to fork Ethereum from the current state?

texts:
I've read a lot of tutorials and guides that teach how to set up your own private network from scratch.

However, how would I do that from the current state of the blockchain? Instead of generating a new genesis, I'd like to simply "fork" to a private network in-house.

Related but incomplete: How to fork my own version of ETH?related

irrelevant, but: this is strictly educational


texts: Is "Pinocchio zk-SNARK" a specific type of zk-SNARK?

texts: Is "Pinocchio zk-SNARK" a specific type of "zk-SNARK"? And if yes, what is difference?


texts: Should UIs handle 4Byte signature collisions

texts:
With 4 bytes collissions are possible.

But they are not very likely. Currently in the 6,846 signatures in the 4Byte.direcory there are no collisions.

Still they are possible. Now I wonder if UIs should care for this case. Asking mainly to decide on a data-structure.


texts: Get the address of a contract without using Remix-ide

texts:
I'm studying Ethereum, I need to get the contract address for interact with web3, I can not use Remix-IDE for this since that I installed Kali as an operating system. How I get the contract address without Remix-IDE?

I appreciate any help. Thank u so much.


texts:
I have two smart contracts, say Admin and Subject. For this purpose lets assume that ten unique accounts have deployed 10 such Admin contracts. One Subject contract has been deployed which has a function that can be called only by an authorized admin. This function allows the admin to add some data (which is encrypted). Now the admin who added this data is the only one who can decrypt it. Since the mapping is public, anyone can see which address added that data to the Subject contract. I am trying to find a way to abstract this so that no one can know for sure, which of the admins own what data.

Admin Contract is

/**
 * Represents each organization. Governs their CRUD access
 * Helps in mapping the type of identities on the system
 * Some more functionalities needed ??
*/
pragma solidity ^0.4.0;
contract Admin {
  bool public contractStatus = false;
  address public owner;

  // Details
  struct AdminDetails {
      string name;
      string details;
      bool state;
      address addr;
      uint group;
  }

  // Contructor function. Called once upon initialization
  function Admin() {
    contractStatus = true;
    owner = msg.sender;
  }

  // CRUD => a-b-c-d
  // Hex values for permissions. Bytewise operations does in binary
  // Create - 2^3, Read - 2^2 , Update - 2^1, Delete - 2^0
  // Combination of permissions can be made by simply adding hex values
  function checkCreatePermission(bytes1 permVal) returns (bool permCheck) {
    return ((permVal & 0x08) == 0x08);
  }

  function isOwned(address ownerAddr) returns (bool _owned) {
    return (owner == ownerAddr);
  }
}

Subject contract is

pragma solidity ^0.4.0;
contract Subject {
    bool public contractStatus = false;
    address public adminAddress;
    mapping (address => Data) adminToDataMapping;

    struct Data {
      string name;
      string details;
    }

   modifier onlyIfActive() {
     if (contractStatus) throw;
     _;
   }

   modifier onlyByCreator(address addr){
      if (msg.sender != addr) throw;
      _;
  }

  function addData(string someName, string someDetails address adminAddr) onlyIfActive {
    Admin admin = Admin(adminAddr);
    if(admin.checkCreatePermission(someSpecialValues)  && admin.isOwner(msg.sender)) {
      adminToDataMapping[msg.sender].name = someName;
      adminToDataMapping[msg.sender].details = someDetails;
    } else() {
      throw;
    }
  }
}

As of now in Subject, the data is mapped to an address of the sender. I want to abstract this is a way that no one can figure out who the sender is but at the same provide a way to verify the owner of the data for the editData() function.

I have considered using ecrecover and some ways of using DSA but am completely stump on how to use it effectively. Need some help/ suggestions!


texts: Best Practice for Arrays you will Write to Often

texts:
I want to build an App with an array data structure that I would like to keep private. So far, I've wanted to build it between IPFS and Ethereum. But what would be best practice for an array that I want to keep private and will want to change often?

Thank you


texts: Truffle migrate hangs when I run ganache with the --db flag

texts:
From the command line, when I run the following command:

ganache-cli --db ~/Documents/Ethereum/ --mnemonic "bride forest screen jazz injury grit rather seek also donate media mechanic"

and I run "truffle migrate" in my project directory then it hangs for a while and produces the following output:

Could not connect to your Ethereum client. Please check that your Ethereum client:
    - is running
    - is accepting RPC connections (i.e., "--rpc" option is used in geth)
    - is accessible over the network
    - is properly configured in your Truffle configuration file (truffle.js)

The following link does not solve the problem as it produces the same result:

Can't run truffle migrate if ganache-cli launched with --db option

truffle migrate works fine when the --db option is omitted from the ganache-cli call. Why is the --db option causing truffle migrate to hang?


texts: I am not very technical. I want to know if there is an easier way to split eth from OAX tokens. I mistakenly brought OAX tokens from ETH using my exchange instead of wallet


texts: Where do i define the test contract params?

texts:
lets say i have this code (taken from here)

// Specifically request an abstraction for MetaCoin
var MetaCoin = artifacts.require("MetaCoin");

contract('MetaCoin', function(accounts) {
it("should put 10000 MetaCoin in the first account", function() {
  return MetaCoin.deployed().then(function(instance) {
    return instance.getBalance.call(accounts[0]);

where do i config the  "accounts" param - i couldnt find a clear definition anywhere - 10x


texts: Is there any conceivable way that empty contracts that have ethereum in them could refund?

texts:
So, about five days ago I accidentally sent a significant (At least to me) amount of Ethereum to an empty (No code "0x" smart contract)

I understand at this point in time it's locked away, there is no way to get that contract to transfer the funds.

But could an update to the Ethereum code for example, cause all contracts where this is the case to refund to the addresses that have sent Ethereum to them? I'm not the only one to have done this, check out this treasure chest for example:

https://etherscan.io/address/0xae7a1b1ba864696bcdcec94a34fb5836ca9a3910


texts: How to transfer ether to wallet addresses in an array?

texts:
address[] emp = [address1,address2];
amount = total/emp.length;
for(uint256 i=0;i<employees.length;i++)
{
    wallet = emp[i];
    wallet.transfer(amount);
}

So This is the error I get.

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

wallet = emp[i];
^-----^

Help would be appreciated!


texts:
I have downloaded "cpp-ethereum-develop" zip file from github and unzipped it.

While executing "cmake eth"

It gives the following error.

Unknown CMake command "eth_simple_add_executable".

CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

cmake_minimum_required(VERSION 2.8)

How to clear this issue?


texts: Does array memory destroy other variables in memory?

texts:
I have been testing and found that data is destroyed as follows.

    function getFreeWallets2(  string mybonusname) public view returns ( uint length, uint  k1, uint  length1) {

    bytes32 bonusNameBytes32 = stringToBytes32(mybonusname);
    require(Bonuses[bonusNameBytes32].bonusExists, "Bonus does not exist");
      length = Wallets.length;
      length1 = getNumberWallets();
    address[]  memory    FreeWallets;
      k1=0;
    for(uint i = 0; i < length; i++)
    {
       address mywallet = Wallets[i];
       if (!WalletBonuses[mywallet][bonusNameBytes32].bonusExists)
       {
           FreeWallets[k1]=mywallet;
           k1++;
       }
    }

}

Outcome - the return is 0,0,0 even though Wallets has data in it.

When I comment out the allocation line for the array, then the return is 1,1,1 which shows the actual value.

This is the offending line -

FreeWallets[k1]=mywallet;

Somehow this causes the data to be overwritten and then the whole function does not work.

    function getFreeWallets2(  string mybonusname) public view returns ( uint length, uint  k1, uint  length1) {

        bytes32 bonusNameBytes32 = stringToBytes32(mybonusname);
        require(Bonuses[bonusNameBytes32].bonusExists, "Bonus does not exist");
          length = Wallets.length;
          length1 = getNumberWallets();
        address[]  memory    FreeWallets;
          k1=0;
        for(uint i = 0; i < length; i++)
        {
           address mywallet = Wallets[i];
           if (!WalletBonuses[mywallet][bonusNameBytes32].bonusExists)
           {
            //   FreeWallets[k1]=mywallet; <==== Commented out
               k1++;
           }
        }

    }

I tried all kinds of combinations with storage and memory and it just throws errors all the time regarding push or something else.

The design is easy enough (just to filter an array) but solidity has some issues in handling this.

Has anyone any suggestions?


texts: Run contracts and create traces with Node


texts: Can I create other contracts in solidity?

texts:
Among simple services, I found a service that generates tokens.
connect metamask
It was a service that created a token contract at the same time as paying a certain amount of ethereum.
What I'm curious about
in metamask
I am curious to see if the service payment fee (not gas fee) and contract creation generate tx at once.
If applied, it seems to be a very interesting project. In this case, how do I configure the project?
https://vittominacori.github.io/erc20-generator/create-token/


texts:
I try to deploy the following code:

contract Sample {

struct Participant {
    address etherAddress;
    uint amount;
}

Participant[] public participants;
uint public amountRaised;

function() {
    enter();
}

function enter() {
    uint amount = msg.value;
    uint n = participants.length;

    participants.length += 1;
    participants[n].etherAddress = msg.sender;
    participants[n].amount = amount;

    amountRaised += amount;
}

}

In Mix IDE it works correctly but does not work on Ethereum testnet(balance not changed).
You can try here: http://testnet.etherscan.io/address/0xea1410a6d5ef3d6d5a392b24087c24845e7170a3 .
I noticed that contract works if delete participants[n].amount = amount OR amountRaised += amount line.
So, I can use only one msg.value variable.
How can I use msg.value twice?


texts: Handling asynchronous method exceptions in web3.js

texts:
I use web3.js 0.20.6.

The following code throws an exception:

        var abi = [/*...*/];
        var MyContract = web3.eth.contract(abi);
        var myContractInstance = MyContract.at("xxx");
        myContractInstance.owner.call(function(error, address) {
            alert(address);
        })

because "xxx" is not a valid contract address. (In practice instead of "xxx" is may be a wrong contract address entered by a user.)

How to catch such exceptions? I can't just put .call instead a try...catch block because it is a callback, not a synchronous call.

So how to catch such exceptions?


texts: unable to buy crypto kittie - why is my transaction not going thru?

texts:
I have tried everything in order to buy a crypto kittie however I have not been able to get a transaction to go thru. In the following receipt you can see I give a Gas Limit of 250,000 and a gas price of 4 gwei and I still get a status of fail. Why is my transaction not going thru?

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


texts: What are transaction costs likely to be after Casper?

texts:
It presently costs X to send a simple transaction.

Assuming the price of ether stays constant, what is a theoretical estimate for the new cost of the same sort of transaction after Casper? i.e X/10?


texts: is there a way to create a ens ethereum address to be readable one using cryptography?

texts:
I would like to generate address which are readable to people using cryptography and supporting ethereum transactions without problems, I don't want to use ens ethereum because I will have to pay for each address any X amount to do that.
it is possible or there is a better approach
thanks a lot.


texts: I'm using Ganache to generate dummy accounts but every time I try to access the list of accounts using web3.eth.accounts or the web3.eth.getAccounts method, I only get access to the first account in the array. Can anyone advise on how I can get an array of all the accounts?


texts: VS2015 Solidity Extension: BlockchainUser Error

texts:
I'm using Visual Studio 2015 with Solidity extension to build a dApp. I have created a sample project using the Smart Contract Project template and I'm trying to deploy the smart contract to my private test network. I can connect to my private blockchain network using the remix compiler.

What should I put in the BlockChainUser and password field? Which credential does it use?


texts: Truffle will not compile contract written in VS code. Pragma error

texts:
I'm trying to run example from https://truffleframework.com/tutorials/pet-shop, but when I run truffle compile I get error saying

Error parsing C:/WINDOWS/system32/TruffleTest/pet-shop-tutorial/contracts/Adoption.sol: ParsedContract.sol:1:1: ParserError: Expected pragma, import directive or contract/interface/library definition.
 �p r a g m a   s o l i d i t y   ^ 0 . 5 . 0 ;

pragma solidity ^0.5.0;

contract Adoption {
address[16] public adopters;

// Adopting a pet
function adopt(uint petId) public returns (uint) {
    require(petId >= 0 && petId <= 15);
    adopters[petId] = msg.sender;
    return petId;
}

function getAdopters() public view returns (address[16] memory){
    return adopters;

}
}

Remix shows no problems at all, but VS code underlines line with require asking to provide error message but it doesn't seem to be an error becasue it gives same error even if comment it out.

Thank you for any thoughts on that.


texts: Solidity - How to know the block of a storage field last update?

texts:
When using a storage variable, a Solidity smart contract can access only its latest value. The updates of this variable throughout the blockchain are hidden and only the up-to-date state is accessible.

However, is it possible to know (in solidity) the block a variable was last updated at?

For example:

// Instance variable
uint v;

In a transaction in block 1000:

v = 0x1234;

In a transaction in block 1200:

v = 0xabcd;

Later:

uint a = v; // a == 0xabcd
// Imaginary function, it does not exist
getLastUpdateBlock(v).number; // 1200

Note: despite of its name, Get latest update time-stamp of contract variable actually refers to all transactions that refer to a variable. Maintaining all these changes would be costly, thus the answer ("not possible") is not surprising. However, keeping only the block of the last update would "just" roughly double the memory usage (var alone becomes var + block hash). So I think asking this specific question is worth a try.


texts:
I am trying to wrap my head around how to calculate how much ETH one would earn from mining based on hashrate.

For example, my RX 480 generates around 24Mh/s.  I would like to be able to calculate how much ETH would be generated from mining, based on that hashrate.  I would also like to include transactions and uncle blocks in the calculation, if possible.

Yes, I know there are online ETH calculators out there.  I'm trying to understand how to calculate it myself.


texts:
since I am quite new to Eth I have the following question : there are some transactions made between two parties which are saved in the block chain. On window.onload() prior to rendering my components, I would like to run a query on it in order to get the transactions out from the block chain, without going into too much detail about the hashes or blocknumber/index. Is there a way I can do that and if yes, where can I read about it in the docu ???

All I need to get is an Object with props like to : and from : so I can display these in my html.

Cheers!

Evgeni


texts: Send address to the contract function from web3

texts:
For example:

address[] storage;
function addAddress(address _a)
{
  storage.push(_a);
}

I need somehow to call it from the web3. When I'm trying to simply send some address 0x1234... to the function in Remix I'm getting an error:

  Error encoding arguments: SyntaxError: Unexpected token x in JSON at
  position 2


texts: InterfaceImp constract defined success，but interface function called failed

texts:
I'm trying to call a interface function for testing, but it can't work.

  Here is my test contract:

pragma solidity ^0.4.24;

interface InterfaceTest{
    function testInterface() external pure returns(uint);
}

contract TestContract {

    InterfaceTest _inter;

    function test2(address _addr) public returns(uint) {
        _inter = InterfaceTest(_addr);
        return 2;
    }

    function test4() public view returns(uint) {
        uint t = _inter.testInterface();
        return t;
    }
}

  And here is the implement:

interface InterfaceTest{
    function testInterface() external pure returns(uint);
}

contract InterfaceContract is InterfaceTest {
    function testInterface() external pure returns(uint) {
        return 9;
    }
}

I deployed them with truffle(4.1.14) and Ganache, the test2() function work well and return 2, but when I tried to call test4(), it said VM Exception while processing transaction: revert, is there any Error in my code?

There is an interesting error I found:

function test2(address _addr) public {
    _interAddr = _addr;
}

function test22() public view returns(address) {
    return _interAddr;
}

function test222(address _addr) public view returns(bool) {
    if (_addr == _interAddr){
        return true;
    }
    return false;
}

First I set the _interAddr, and then I get it, but the TWO address are different, what looks like set 0x1d77078832a0f88c6e064cc5e4df88b83d3dd8ca and get 0x1d77078832a0f8eca804a4989f812d2e80000000. in test222, the last numbers have no effect to the result, my contract always return true.

Does anyone have the same error?

Finally I resolved. If you want to set an address, you must enclose address in "", what a stupid mistake.
This problem has been solved, thank you guys.


texts: How dangerous is to use tx.origin to check if msg.sender is some address? (details below...)

texts:
Let's say:

function transfer() public payable
 {

 require(tx.origin == 0xb2930B35844a230f00E51431aCAe96Fe543a0347);
msg.sender.call.value(1 ether)();

}

Ignore the address above I just copied it from etherscan it belongs to some mining pool...so the question is: how can this address get "spoofed" if at all? Isn't tx.origin more secure since the caller can never be contract? Thanx!


texts: why do we use revert() in payable function?

texts:
I have seen this snippet in many online examples could you please explain what this is doing and why are we using it in a payable function?

function () public payable {
   revert () ;
}


texts: Looking for the Swarm code that initiates token addresses on the web

texts:
When I go to swarm website, the site next steps prompts and issues me an address. I am curious just how this works even though I don't have an account yet. Is my address then the account no? or does it use some sort of session state/cookies to identify me.

If anyone can point me to the web3.js API or code that does this feature, I'd appreciate it.

Thanks


texts:
I am trying to develop an android wallet using Ethereum go and I ran the DroidGeth from this link. I tried to ran ethereum on the testnet, but its taking for ever to download the blockchain.

How can I start geth in a light weight mode or spv mode as in bitcoin ? So that I can run it on a smartphone, without downloading the full blockchain ?

Is there a better way to do it ?


texts: blockHash compression problem inside a contract, block.blockhash(blockNumber) returns "0x" or random hash value

texts:
Related to following answer:

function block_hash_validation(uint blockNumber, bytes32 blockHash)
    constant returns(bool isValid)
{
    return (block.blockhash(blockNumber) == blockHash);
}

When I call it as follows from a python script:

blockHash   = web3.eth.getBlock(0)["hash"]; //'0x040db90fe13e6688c86ff93c5ce8e4a0a61faaf6a734c548febd0d0b44c86aa8'
block_hash_validation(0, blockHash);

It gives following error: TypeError: One or more arguments could not be encoded to the necessary ABI type. Expected types are: bytes32

When I replace bytes32 as string => (string blockHash) it now gives following problem:

contracts/Receipt.sol:26:48: Error: Operator == not compatible with types bytes32
and string memory
if( blk_start_ >= blk_end_ || core_ < 0 || block.blockhash(blk_end_) == b2 )
                                           ^-----------------------------^

I have implemented following code but now the comparison is wrong:

     function block_hash_validation(uint blockNumber, string blockHash)
         constant returns(bool isValid)
     {
        bytes32 blockHash_result;
        assembly {
        blockHash_result := mload(add(blockHash, 32)) //this also obtains hash's first 32 characters which is wrong.
        }
         return (block.blockhash(blockNumber) == blockHash_result);
     }

=> This should have return true, but it returns false. When I only return block.blockhash(1) inside populus, it returns some random characters for example: "òÓ F»\TÕ' Ê¦,ºåY¹DèÝ�¿"

In additon to that on my private ethereum network I tried following contract:

    contract C {
      function get_block_hash(uint blockNumber) constant returns( bytes32 my_hash ) {
            return (block.blockhash(blockNumber));
      }
    }

It always return "0x" for the any block numbers I have tried.

[geth]> C.get_block_hash(block.number - 1)
"0x0000000000000000000000000000000000000000000000000000000000000000"

[Q] How could I overcome those problems I am facing? Please note that I am experimenting inside populus.

Thank you for your valuable time and help.


texts: How exactly theᴅᴀᴏ reentrancy hack was performed without having weiGiven>0 nor IsAllowed(WithdrawAddress)?

texts:
The well known ᴅᴀᴏ hack didn’t affect ether balances of theᴅᴀᴏ but balances of rewardAccount.

That’s why I’m talking about the hack version which affected contract balances of theᴅᴀᴏ itself.

With the help blockchair, I could get the input data being used, so I know it’also about SplitDao, but how the hacker could both set the SpliData on it’s ᴅᴀᴏ proposal and _recipient inside the targeted reentrency contract ?
By looking at the code, this set of conditions seems mutually exclusive to me.


texts:
I am running a lightmode geth daemon, and I want to check the balance of my daemon. I read this answer, which says that I cannot use the command that I am currently using, as it requires support for eth.coinbase

geth --exec "web3.fromWei(eth.getBalance(eth.coinbase), 'ether')" attach

Geth synced in lightmode doesn't support use of eth.coinbase. What command can I use? Do I have to run a --syncmode=fast or standard node instead?


texts: Unable to update state variables of inherited contracts

texts:
I'm trying to write an extension of OpenZeppelin's CappedCrowdsale to allow for a hard cap in USD, as I think this is more human-readable than having everything in wei.

However, I'm having issues updating some of the inherited state variables (Crowdsale's rate and CappedCrowdsale's cap). I try to do this in the updateEthPrice function, which I know is getting called because the ethPriceInDollars variable gets updated correctly, but cap and rate always return 1... (which is what they were initialized with)

At first I thought that maybe the inherited constructors were firing after the base constructor (and overriding whatever I set in the base constructor), but even if I call updateEthPrice once the contract has been deployed, I'm still not seeing any changes to cap and rate

Been banging my head on this all day, any help is appreciated!

pragma solidity ^0.4.19;

import "zeppelin-solidity/contracts/crowdsale/CappedCrowdsale.sol";

/**
 * @title DollarCappedCrowdsale
 * @author Gianni Settino
 * @dev Extension of CappedCrowdsale with a cap in USD instead of wei.
 * This means that Crowdsale's rate and CappedCrowdsale's cap now depend
 * on ETH's USD price, which can be changed up until the start of the token sale.
 */
contract DollarCappedCrowdsale is CappedCrowdsale(1), Ownable {
  uint256 public ethPriceInDollars;
  uint256 public hardCapInDollars;
  uint256 public tokenPriceInCents;

  // @dev We temporarily init Crowdsale's rate and CappedCrowdsale's cap to 1.
  // Reason: their "real" values are subsequently calculated in updateEthPrice()
  function DollarCappedCrowdsale(
    uint256 _startTime,
    uint256 _endTime,
    address _wallet,
    uint256 _ethPriceInDollars,
    uint256 _hardCapInDollars,
    uint256 _tokenPriceInCents
    )
    public
    Crowdsale(_startTime, _endTime, 1, _wallet)
  {
    require(_hardCapInDollars > 0);
    require(_tokenPriceInCents > 0);
    hardCapInDollars = _hardCapInDollars;
    tokenPriceInCents = _tokenPriceInCents;
    updateEthPrice(_ethPriceInDollars);
  }

  function updateEthPrice(uint256 _ethPriceInDollars) public onlyOwner {
    require(now < startTime);
    require(_ethPriceInDollars > 0);
    ethPriceInDollars = _ethPriceInDollars;
    cap = (hardCapInDollars / ethPriceInDollars).mul(1 ether);
    rate = (ethPriceInDollars.mul(100)) / tokenPriceInCents;
  }
}


texts: What's the header hash displayed in the miner?

texts:
Is the "hash" value reported by geth: eth.getBlock("849245").hash, for example, the same "hash" that is given to the miner in the work package?

Sorry if this is a naive query. The reason for the question is that the header hash coming into my miner is not the same as reported by the geth function given above.

What's the hash displayed in the miner?


texts: Load smart contracts in Java application without having the java wrapper class for Web3j (only the address of the contract)

texts:
I use web3j to interact with my local Ethereum node (created with geth), and I was wondering how should I handle smart contracts created at runtime.

I know that in order to deploy a smart contract you have to write the source code in Solidity, compile it to obtain both abi and bin files. Then you have to generate with web3j the java class to have a representation for JVM, and be able to call MyContractClass.deploy(...).

What I want to achieve is to generate a smart contract at runtime with some custom data, deploy it and then interact with it from other instances of my Java application. The problem is that I couldn't find any management api with geth to implement some adapter, and also Web3j requires a wrapper for that contract (a java class built from abi and bin files). So the only way to load it using this library is by using the wrapper java class (e.g.: MyContract.load(address, ...).

My idea is to have another SmartContract (master) which holds the addresses of all created contracts, but also the bin and abi files, so all I would have to do would be to interact with that contract and retrieve the addresses of the other ones, and then using web3j from the host machine I would generate the java class and load it using web3j. Is it bad to store abi and bin files in the smart contract?


texts: Is it possible for Ethereum to collaborate with BOINC + World Community Grid networks?

texts:
Many developers envisage Ethereum's potential to harness distributed computational processing rate to potentially/hypothetically overtake our worlds most non-distributed clusters.

http://www.distributedcomputing.info/projects.html

https://www.top500.org/lists/2016/11/

^ According to this site's November 2016 ranking;

Sunway TaihuLight clocks@ 125,435.9 TFlop/s

and

Tianhe-2 (MilkyWay-2) clocks@ 54,902.4 TFlop/s

Assuming the Ethereum platform can successfully synchronise peers, do we have any mathematicians here that can model how many distributed Ethereum nodes it would take to compete?

Perhaps as part of the future Ethereum protocol we could ask contributors to partition only 5-10% of their CPU's power (not affecting an average users other/daily processing requirements)?

Personally for me, this is why I think Ethereum has great importance! This would be disruptive to the currently commercially available software suites, promoting the development of "everyday" "Ethereum Powered" DApps from Media editing to realtime GIS applications, initially. However I think with active collaboration with existing non-distributed cluster projects could greatly advance our current scientific modelling capabilities and increase our overall efficiency. Just a thought for the EF to approach, many of these projects are open source/non-proprietary licensed too?

We could dynamically adjust gas/eth price to dramatically offer these applications for a fraction of the price offered by leading commercial software providers - and make it even cheaper for registered educational/research institutional hubs to use.

I think project Golem have similar scope but it's not at EVM protocol level and already separately tokenised?


texts:
With bitcoin and others, you can use --datadir option to specific where blockchain, keystore, etc are saved. But doesn't work with Mist.

From the offical wiki:

  To configure the location of the data directory, the --datadir parameter can be specified. See CLI Options for more details.

I start Mist like this, but doesn't work. Still writes everything into %APPDATA%\Ethereum

R:\Ethereum\bin\Ethereum-Wallet.exe --datadir "R:\Ethereum\data\"

Also what is this stuff under : %AppData%\Roaming\Mist? Does that have any sensitive information in it?

Why not keep everything in one place and make it configurable? It's been standard practice for all others coins for ages now (so that it's easy to put on removable or encrypted drives, ideally both).


texts:
I want to sign a message on Remix and I can't find the pair of private/public key.

For example - I going to Deploy & Run Transactions, then trying to "Sign a message using this account key" with the string "Hello! This is my message." and then I found the following result:

hash:
0x9f012ca5b89a316ab213cf1f9cc4d9c6f780387e804c6f82bf01ed30e6658aaf

signature:
0x6a20ade1580a5e7f6a8f02705223e887b104f4ea088bc042bbae6e808668439f1bcbd97af06eb482cccc1510d215d484cd1e09acff46fed1d170ec1ba0e7996100

I need to verify the authenticity of the message with another account, then I need to know the sender public key...

Can anyone help me to find it?


texts: Solidity ls it safe to call length after push to array

texts: Since the new version of Solidity removes the return value of the push operation to arrays (Before the push operation returns the new length of the array), my question is if it is safe to call the length (length - 1) method after push to get the index of the new added element?


texts: how to develop a multi-step game with the contract

texts: I want to develop a multi step gambling game, my question is can several  transactions  be sent to the game contract separately(some first, some after) but all contribute to the result?


texts: Reputable Solidity utils library for arrays

texts:
Is there an audited and reputable smart contracts utils library with helpers for dealing with arrays?

I haven't found anything great on Google so far.


texts: Why is 2048 the mining difficulty bound divisor?

texts:
Excerpt from page 6 of the yellow paper:

The paper focuses more on the difficulty bomb ε but says little about the  rationale of mandating 131072 and 2048 as scalars. I guess the former is merely an arbitrary value, but I'm not sure about the other. Is it because with a smaller difficulty the incentives wouldn't work?


texts: How can I verify a cryptographic signature that was produced by an Ethereum address key pair

texts: If I have a cryptographic signature from an Ethereum address key pair, how can I verify that signature?


texts: How to create a "cold wallet" and is it really necessary?

texts:
What's up everyone. I have a decent amount of Ether and I want to protect it as much as possible. I read that basically the only way someone could hack an ETH account would be with a keylogger program. Since hearing that I'm definitely interested in creating an offline wallet, but I have no idea how to do this (I don't have a technical background at all).

If anyone has personal experience doing this or could point me in the direction of a good instructional site I would appreciate it a lot!!


texts: Question about incorruptibility as a sidechain directly to plasma chain

texts:
Hi there I was wondering 2 things. In order for a plasma chain to work on an asset do you need a corrosponding ERC20/ERC721 token on the ethereum mainchain first? I am thinking of using BTCRelay type of thing to essentially lock coins on a bitcoin based altcoin and creating an asset on ethereum with the hopes that I can go directly to plasma without issues a mainnet transaction, is this possible?

The second thing is, if I create a parent plasma chain and create a bunch of children plasma chains under me, can I make it so that the children plasma chains have to pay some fee from the parent plasma chain?


texts: Can a Parity node can connect into Clique Proof-of-Authority consensus engine?

texts:
I have setup private  Proof-of-Authority consensus engine (also named clique) network with Geth.

Can a Parity node connect into it? If yes, how?

Parity-goerli does this for AuRa (Parity's Proof-of-Authority (PoA) consensus engine), where also a geth node could connect into it. But I am not sure that could it also be done for clique network as well.


texts: Development lifecycle in building a dapp

texts:
I was wondering if anyone who has experience in working with Solidity/decentralized applications, could share their development cycle in contrast with normal web/app development?

Normally, we would 1) write code, 1.2) test, 2) deploy to server. I know there are certain parts of the process is similar obviously on the coding part. But what can a new dapp developer expect when building a decentralized applications in terms of the development lifecycle?

I'm pretty new at this. I came from Android and web development background. Noticed some difference on the testing part which requires a lot of migrate (I'm using truffle). I understand we do use migrate when it comes to something related to database on the normal web/app development. Are there more to expect from this?

For those who are working as a blockchain or dapp developer, could you share your day to day workflow?


texts:
What are the correct steps to make connection and communication within one Node by creating Private Network in windows? Installation of Geth is done in windows successfully, puppeth is also running. But whenever I try to start mining it is not working properly. There are 3 different accounts created by me. But mining is not working properly & displaying no epoch count.

startnode.cmd

geth --networkid 4224 --mine --minerthreads 2 --datadir "." --nodiscover --rpc --rpcport "8543" --port "30303" --rpccorsdomain "*" --nat "any" --rpcapi eth,web3,personal,net --unlock 0 --password ./password.sec


texts: How to check whether the keystore file has been tampered？

texts:
The format of the keystore is shown below. In the project, there is a requirement to save the keystore file from the front end to the back end. How can the back end check whether the keystore file has been tampered? For example, how to determine whether the keystore is legal after the address field is tampered with other values?
Hope you can provide me with some help, thanks!
{
    version: 3,
    id: '04e9bcbb-96fa-497b-94d1-14df4cd20af6',
    address: '2c7536e3605d9c16a7a3d7b1898e529396a65c23',
    crypto: {
        ciphertext: 'a1c25da3ecde4e6a24f3697251dd15d6208520efc84ad97397e906e6df24d251',
        cipherparams: { iv: '2885df2b63f7ef247d753c82fa20038a' },
        cipher: 'aes-128-ctr',
        kdf: 'scrypt',
        kdfparams: {
            dklen: 32,
            salt: '4531b3c174cc3ff32a6a7a85d6761b410db674807b2d216d022318ceee50be10',
            n: 262144,
            r: 8,
            p: 1
        },
        mac: 'b8b010fff37f9ae5559a352a185e86f9b9c1d7f7a9f1bd4e82a5dd35468fc7f6'
    }
}


texts:
I downloaded Mist for my computer which runs Ubuntu version 18.04, and tried to import my private key but had these issues:

When going to FILE > IMPORT ACCOUNTS, the IMPORT ACCOUNTS option is grayed out, and not clickable.
I then tried going to FILE > BACKUP > ACCOUNTS, I located the "keystore" folder, and placed the UTC JSON file inside, though the mist wallet didn't include the account inside it, even when I reloaded it
I heard you could use geth to import keys, but I tried typing

geth

in the terminal to see what happens, and I get

geth: command not found

QUESTION: Why can't I import keys to the mist wallet? Any information as to what I might be doing wrong or what other options I can try out would be very useful!


texts: myetherwallet - some clarifications needed

texts:
hi all

i am just starting to navigate the alt coin domain.

with regard to myetherwallet I want to see that I understand the procedure correctly so I have a few questions:

1. regarding the json file. is it really mandatory to keep it? or is it a convenience for restore purposes and better security of wallet opening? I mean, if I print the paper with the private/public key why would I need the json file? the whole paper wallet reason is to not have any digital presence as far as I understand. is it safe to say that I can simply delete the json file, not back it up and just use the printed paper wallet in the future to access my funds (using my printed private key)?

 2. assume I created the wallet offline, and then transferred eth from an exchange to the newly created wallet using its public key. in order to see that the money actually got to my wallet I need to go online and check it right? i mean, how can I check the balance being offline?. but then I need to use my private key to access the wallet and this compromises my private key. what am I missing? i am confused...

thanks for any help.