texts: Can't synchronize, "header broke chain ancestry"

texts:
I know Ethereum had several updates over the last couple months and suffered an unintentional fork.  Before all that started, I was using an older version of Mist (maybe ~0.8.6?  Could have been older) and Geth, and decided I'd just sit it out until things stabilized.  A few weeks ago, I fired up my Ethereum and tried to sync, but started getting Geth errors implying "bad" or "unexpected" data from peers.  I figured I must have pulled down some of the invalid fork, and hoped a newer version would automatically fix things.  Today I upgraded to the latest Mist 0.8.8 and Geth 1.5.5.  And I'm getting errors like this:

xxx415 eth/downloader/queue.go:894] Peer xxxxxxxxxx73ab1a: header #xxx5691 [xxxxbce1.] broke chain ancestry
xxx229 eth/downloader/queue.go:894] Peer xxxxxxxxxx73ab1a: header #xxx5996 [xxxx6f63.] broke chain ancestry
xxx162 eth/downloader/queue.go:894] Peer xxxxxxxxxx73ab1a: header #xxx2349 [xxxxbfc1.] broke chain ancestry
xxx444 eth/downloader/queue.go:894] Peer xxxxxxxxxx73ab1a: header #xxx9331 [xxxxc2df.] broke chain ancestry
xxx663 eth/downloader/queue.go:894] Peer xxxxxxxxxx73ab1a: header #xxx4080 [xxxx51ac.] broke chain ancestry
xxx557 eth/downloader/queue.go:894] Peer xxxxxxxxxx73ab1a: header #xxx4418 [xxxx9349.] broke chain ancestry

Note I redacted some of those ID's.  I left it for about 15 minutes and saw zero progress downloading blocks.

What should I do to recover?  Do I need to blow away everything except my private keys, and resync from scratch?

Edit: I'm now seeing messages about db_upgrade.go "Converting nnnnn blocks"


texts: true and false not the same as 1 and 0 for web3 / solidity?

texts:
When I use remix to execute a function with a bool field and I put 0 into it (which I interpret as false), the remix console output tells me "bool myBool": true (what I don't understand). So I would like to know:

How do I pass true or false in general via web3.js to a smart contract, as a string String(true)?
Is true and false NOT the same as 1 and 0 for web3 and/or solidity?


texts:
I am using the API to access IPFS and access is OK with a status code 200 but the API call fails. Here is the code:

 this.IpfsAPI = IpfsAPI('162.243.237.41', '5001', {protocol: 'http'})
var zstr = 'hello world from Zillerium2'
    this.IpfsAPI.add(new Buffer(zstr), function (err, res){
          console.log("hello");
          if(err || !res) return console.error("ipfs add error", err, res);
          else{

The call returns the following - does anyone have any experience or idea about the X-Stream error:

 Request URL:http://162.243.237.41:5001/api/v0/object/get?
arg=QmQHoSC2We7F3kskZExSpjUbwCVWDnaW1VQT44b14n5rLG&stream -channels=true
Request Method:POST
Status Code:200 OK
Remote Address:162.243.237.41:5001
Response Headers
view source
Access-Control-Allow-Credentials:true
Access-Control-Allow-Headers:X-Stream-Output, X-Chunked-Output, X-        Content-Length
Access-Control-Allow-Origin:http://jenbil.com:3000
Access-Control-Expose-Headers:X-Stream-Output, X-Chunked-Output, X-Content-Length
Content-Type:application/json
 Date:Sat, 06 May 2017 15:00:20 GMT
Server:go-ipfs/0.4.8

Trailer:X-Stream-Error

Transfer-Encoding:chunked
Vary:Origin
Request Headers
view source
Accept:*/*
Accept-Encoding:gzip, deflate
Accept-Language:en-GB,en-US;q=0.8,en;q=0.6
Connection:keep-alive
Content-Length:0
Host:162.243.237.41:5001
Origin:http://jenbil.com:3000
Referer:http://jenbil.com:3000/
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
Query String Parameters
view source
view URL encoded
arg:QmQHoSC2We7F3kskZExSpjUbwCVWDnaW1VQT44b14n5rLG
stream-channels:true


texts:
I had updated swarm v0.3 to v0.4.
Now I'm trying to do DB migration.

I did this command:

$ swarm --verbosity 5 db export .ethereum/swarm/bzz-a8a75fcfa45273cdfe27c24d87ab9c41b199d9b7/chunks djstorage/swarmexport.tar 1bf9f5ae58719120e76c546b50eb573c65cb2952c8e977351cf1c13239f8dfaa

and I got this result:

TRACE[05-30|06:58:44.760] checking if database scheme is legacy    schema name=halloween
CRIT [05-30|06:58:45.042] Chunk 0000018d92029660945b0f1883c14def16c7b4f81c57d8b3232c243a9c0ab3bb0b found but could not be accessed: leveldb: not found, 06030000000000000000

I don't know how to fix it. Can anyone help me? Thanks a lot.

Here is my Swarm version:

Version: 0.4.0-stable
Git Commit: c3b317a4fc5e59da87b2bd2b858c038cfb4ba07a
Go Version: go1.11.5
OS: linux


texts: Will the 100 DAO = 1.5 ETH ratio change in the future after the creation phase ?

texts: Will the ratio between DAO and ETH ever change like ETH/USD after the creation phase ..... like after a couple of years ?


texts: Converting int to default block parameter

texts:
I am using Infura and web3j to query the Ethereum blockchain. My aim is to get information about certain blocks so i'm using the function web3.eth.getBlockByNumber, however it gives me incompatible types error: int cannot be converted to DefaultBlockParameter. How can we convert an integer to default block parameter?
Current code:

System.out.println("here " +web3j.ethGetBlockByNumber(6777, true));


texts: Is it possible to access the mapping of a deleted struct

texts: I understand that when you use the delete() function on a struct it will delete all its data excluding its structs, as delete cannot recurse through these. Does this mean we can still access these mappings within the struct or will their data simply float around in the state?


texts: Updateable contract design: Database contract only accessible through setters and getters?

texts: Hey I'm designing a Dapp that has a database contract and a contract with the logic side. The only way I can see of making this work is through having the logic contract make a call to a getter or setter in the database contract for every value it needs. This seems like a very expensive design. Is there a better way to access this data, using libraries or some other way?


texts: Is it possible to customize the display unit in Metamask activities section?

texts: With Metamask I would like to see the transaction cost displayed in Gwei. Is that possible?


texts: Ethminer not working with pool getting no speed

texts:
If I execute the following ./ethminer -G mining seems to work fine...

Time: 00:00
  m  10:41:51|          Speed   3.15 Mh/s    gpu/0  1.89  gpu/1  1.26  [A0+0:R0+0:F0]

But when I try to run through a pool ./ethminer --farm-recheck 200 -G -S eu1.ethermine.org:4444 -O <address>.myrig I get

  ✘  10:44:20|cl-0      Creating DAG buffer failed: clCreateBuffer -61
  ✘  10:44:20|cl-0      OpenCL Error: clEnqueueWriteBuffer -38
 cl  10:44:20|cl-1      Build info: <program source>:329:9: warning: comparison of integers of different signs: 'int' and 'const uint' (aka 'const unsigned int')
                if (i == thread_id)
      ~ ^  ~~~~~~~~~
<program source>:364:9: warning: comparison of integers of different signs: 'int' and 'const uint' (aka 'const unsigned int')
                if (i == thread_id)
      ~ ^  ~~~~~~~~~

 cl  10:44:20|cl-1      Creating light cache buffer, size 36961984
 cl  10:44:20|cl-1      Creating DAG buffer, size 2365580416
  ✘  10:44:20|cl-1      Creating DAG buffer failed: clCreateBuffer -61
  ✘  10:44:20|cl-1      OpenCL Error: clEnqueueWriteBuffer -38
....
Time: 00:00
  m  10:45:00|          Speed   0.00 Mh/s    gpu/0  0.00  gpu/1  0.00  [A0+0:R0+0:F0]

Why am I getting no speed in the pool?


texts:
For example. I can make a static price.

 function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner {
    sellPrice = newSellPrice;
    buyPrice = newBuyPrice;
}

But how can make a floating price.


texts: How can I set mapping(address => bool) to all addresses default to true on constructor function?

texts:
contract Bogus {

    mapping(address => bool) internal iNeedItToBeTrueByDefault;

    function Bogus() {

        ???...
    }
}


texts: What information is available if you set up a node?

texts:
I'm doing a project on blockchain technology where we are supposed to do some kind of measurement and evaluate the result. I've heard that you can set up a Ethereum node and get some kind of information that way, but I'm confused as to what information is available if you run your own node. Some guidelines of possible measurements that are possible would be greatly appreciated!
Thanks


texts: State Variable of solidity Contract could not be updated through JavaScript

texts:
I have following contract and just want to update its state variable values i.e. totalSupply. But when I try to attempt this task through JavaScript code (given below) by calling its function i.e. setTotalSupply, tts values is not updated.
pragma solidity 0.5.1;

contract MyContract {

    uint256 totalSupply;
    mapping(address => uint256) public balances;
    address owner;

    constructor(address payable _wallet) public {
        totalSupply = 10;
        owner = _wallet;
    }

    function () external payable{
        buyToken();
    }

    function buyToken() public payable {
        require(totalSupply >= (msg.value/1000000000000000000)*2);
        balances[msg.sender] += (msg.value/1000000000000000000)*2;
        // wallet.tranfer(msg.value);
        totalSupply -=(msg.value/1000000000000000000)*2;

    }
    function getTotalSupply()public view returns  (uint256 ){
        return totalSupply;
    }
       function setTotalSupply(uint256 newSupply)public {
        require(msg.sender == owner && totalSupply<1);
        totalSupply = newSupply;

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

}

i just want to update its value i.e. total supply. following is my JavaScript code for above purpose

var Tx = require('ethereumjs-tx').Transaction
const Web3 = require('web3');
const provider = new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/7fb0bdc97c.....");
 const web3 = new Web3(provider);

var contract1  = new web3.eth.Contract(contractABI, contractAddress1)
const txData2 = contract1.methods.setTotalSupply(10).encodeABI();
setSupplyBalance(contractAddress1, txData2);

function setSupplyBalance(contractAddress, txData ){

web3.eth.getTransactionCount(account1, (err, txCount) => {
      txObject = {
      nonce:    web3.utils.toHex(txCount),
      gasLimit: web3.utils.toHex(1000000),
      gasPrice: web3.utils.toHex(web3.utils.toWei('100', 'gwei')),
      to: contractAddress,
      value: web3.utils.toHex(web3.utils.toWei('0', 'ether')),
      data:txData
    }

  const tx = new Tx(txObject, {chain:'ropsten', hardfork: 'petersburg'})
// sign the trx
tx.sign(privateKey1)

serializedTx = tx.serialize()

raw = '0x' + serializedTx.toString('hex')

  web3.eth.sendSignedTransaction (raw, (err, txHash)=> {
    console.log('err:', err)
    console.log('txHash', txHash)
  })

  })

}

UPDATED:
First i consumed all totalSupply (i.e. tokens) .. then i check its totalSupply and i got expected zero token. But, when i call setTotalSupply(10) and then check its values.. it still shows zero ... here is my checking code ...

var ot;

async function init() {
  ot = await contract1.methods.getTotalSupply().call();
  ot = ot.toString(10);
  console.log("Total Suplly is : ", ot);
  if(ot<1)
    console.log("OK")
  else
    console.log("Bug !")
}
init();


texts:
I'm writing a smart contract where subscribers make a bid, post doing so owner selects one and sends him data as well as ends the contract. If data is valid, winner releases the funds so owner can withdraw them.

My issue here is I'd like upon contract closure, that only other subscribers not the winner to be able to withdraw their funds however, not the winner as well as the owner.

Post release the owner can claim his funds.

Any ideas how to do so.

function done() onlyOwner public{
    require (state == State.Active, "Contract still working.");
    state = State.WinnerSelected;
}

function withdraw() external onlyOwner payable{
    require (state == State.WinnerSelected, "Contract not closed to withdraw.");
    owner.transfer((address(this).balance));
}

function release() public {
    require(payments[msg.sender] > 0, 'Sender has not paid into escrow.');
    require(released[msg.sender] == 0, 'Sender has already released funds.');
    released[msg.sender] = payments[msg.sender];
    //state = State.WinnerSelected;
}

function makeBid(string memory _extraData) public inState(State.Active) payable returns(uint bidIterator) {
    require(msg.value > 0, "No value inserted");
    require(bidders <= 3, "Contract reached max registrations");
    require(payments[msg.sender] == 0, 'Sender previously paid into escrow.');
    bids.push(Bid(msg.sender, msg.value, _extraData, true));
    payments[msg.sender] = msg.value;
    bidders ++;
    //if (bidders < 4){
    // state = State.closed;
    //}
    return bids.length - 1;
}


texts: Truffle Migrate for metacoin truffle box example failing

texts:
truffle migrate

Compiling your contracts...
===========================
> Compiling .\contracts\ConvertLib.sol
> Artifacts written to C:\blockchain_projects\truffle_projects\metacoin\build\contracts
> Compiled successfully using:
   - solc: 0.5.12+commit.7709ece9.Emscripten.clang

> Something went wrong while attempting to connect to the network. Check your network configuration.

Could not connect to your Ethereum client with the following parameters:
    - host       > 127.0.0.1
    - port       > 7545
    - network_id > *
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-config.js)

Truffle v5.1.0 (core: 5.1.0)
Node v10.16.3

Already ran ganache-cli


texts: What happens to the etherbase while migrating a mining rig?

texts:
I've successfully set up a 4 GPU rig and have been mining for about a month now. I see that my rig has an ether base, and i essentially mine ether to that base. The base has an address something akin to an account.

I also set up an account and have successfully transferred ether to it.

Now, if i were to rebuilt my rig, or migrate to another rig running a different operating system, what are the steps that i should be taking to ensure I retain all my Ether?

I am suspecting that I won't be able to keep my current ether base, so that would entail transferring all my ether from the base to the account, and migrating to another system. Is my supposition correct?


texts: Empty to field in web3.py transactionReceipt


texts: What are objective values can smart contract be aware of while executing?

texts:
I had found that smart contract can't be aware of and check nonce of msg.sender.
It would be appreciated if you let me know which of many basis values for verification that smart contract is able to be aware of and utilize while executing. The values that can replace the nonce of msg.sender.

Thank you!


texts: AssertionError: error message must contain revert

texts:
I have tried a lot of research. I still somehow can't find and understand why this error occurs when im in private network. But if in 127.0.0.1:7545 which ganache, everything seems to be working, all passed.

Reference: https://github.com/dappuniversity/token_sale/blob/master/contracts/DappToken.sol

Whenever I run truffle test --network kennetwork

I have this error

this is my code DappToken.sol:


texts: RPC call eth_getTransactionByHash fails against geth --syncmode=light --rpc

texts:
Will try without --syncmode=light (on a different PC) to see if that command line is the culprit; if it is, this question may be answered quite easily.

Geth version

Geth
Version: 1.8.8-stable
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.10.2
Operating System: linux
GOPATH=
GOROOT=/home/kindaemon/go

OS

$ uname -a
Linux thekincasino 4.4.0-119-generic #143-Ubuntu SMP Mon Apr 2 16:08:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Expected behaviour

With geth --syncmode=light --rpc running, the command

$ curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0x1d4775c185bbf03502fc3d8357bd536fb7bbb6425c7deafeabebc2c7305f8aec"],"id":67}' http://127.0.0.1:8545

outputs the details of the transaction with that hash.

Actual behaviour

That command outputs

{"jsonrpc":"2.0","id":67,"result":null}

The eth_getBlockByNumber method does return results, in contrast.

Steps to reproduce

git clone git@github.com:ethereum/go-ethereum.git
cd go-ethereum
make
./build/bin/geth --syncmode=light --rpc

In another terminal, run the above curl command and get the actual result.


texts: How to get live mempool transactions whitout full blokchain

texts:
I just want to analyse all mempool txs in realtime.
I cant use an api because after several requests my ip gets blocked for some minutes, so I dont get the txs in this time.
Thank you for help.


texts: How can I split my Contract up into different smaller ones?

texts:
I am learning the Solidity language and I have been experimenting on the Ropsten Testnet, I have tried several things with a contract I created, yet everytime I try to create it, remix solidity IDE gives me the error transaction cost exceeds gas limit.

I got many recommendations which tell me to split the contract up into smaller ones, Im new to the Ethereum token world and dont know what people mean by this? If I split my contract up into several parts and create each one equal? How will I link theese together?


texts: What happens to the state of a smart contract when it is selfdestruct. Are the last state variables still visible on the blockchain afterwards?


texts: Verify a signature generated with web3 in solidity

texts:
I am trying to verify a signature in solidity, which I generated in my truffle test. I followed this tutorial  for implementing the smart contract, but made small adjustions:
library Lib {

    /**
        Signature verification functions
     */
    function getMessageHash(address _to) public pure returns (bytes32) {
        return keccak256(abi.encodePacked(_to));
    }

    function getEthSignedMessageHash(bytes32 _messageHash) public pure returns (bytes32) {
        /*
        Signature is produced by signing a keccak256 hash with the following format:
        "\x19Ethereum Signed Message\n" + len(msg) + msg
        */
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", _messageHash));
    }

        function recoverSigner(bytes32 _ethSignedMessageHash, bytes memory _signature)
        public pure returns (address)
    {
        (bytes32 r, bytes32 s, uint8 v) = splitSignature(_signature);

        return ecrecover(_ethSignedMessageHash, v, r, s);
    }

    function splitSignature(bytes memory sig) public pure returns (bytes32 r, bytes32 s, uint8 v) {
        require(sig.length == 65, "invalid signature length");

        assembly {
            /*
            First 32 bytes stores the length of the signature

            add(sig, 32) = pointer of sig + 32
            effectively, skips first 32 bytes of signature

            mload(p) loads next 32 bytes starting at the memory address p into memory
            */

            // first 32 bytes, after the length prefix
            r := mload(add(sig, 32))
            // second 32 bytes
            s := mload(add(sig, 64))
            // final byte (first byte of the next 32 bytes)
            v := byte(0, mload(add(sig, 96)))
        }

        // implicitly return (r, s, v)
    }

    function verify(address _signer, address _to, bytes memory signature) public pure returns (bool) {
        bytes32 messageHash = getMessageHash(_to);
        bytes32 ethSignedMessageHash = getEthSignedMessageHash(messageHash);

        return recoverSigner(ethSignedMessageHash, signature) == _signer;
    }

}

contract MyContract{

    address public myaddr;
    ...

    function submitSignature(bytes memory signature) signerCheck public {
        if(Lib.verify(myaddr, address(this), signature)){ // returns false
            mysignature = signature;
            ...
        }else{
            revert("Signature does not match sender.");
        }
    }

}

In my truffle test I'm creating the signature as follows:
var hash = MyContract.web3.extend.utils
            .soliditySha3({v: mycontract.address,  t: 'address' });

var prefixedHash = MyContract.web3.extend.utils.soliditySha3("\x19Ethereum Signed Message:\n32", hash);
var signature = await MyContract.web3.eth.sign(prefixedHash, accounts[1], (error, result) => {
   if (error) {
      console.log(error)
   }
});
var tx = await mycontract.submitSignature(signature, { from: accounts[1] });

The verify function returns false. I am not entirely sure how solidity hashes addresses and whether web3.eth.sign prefixes the signature with \x19Ethereum Signed Message:\n or not. I tried different variations, nothing worked.
Update:
web3.eth.sign already prepends \x19Ethereum Signed Message:\n, so the correct signature would be
var hash = MyContract.web3.extend.utils
            .soliditySha3({v: mycontract.address,  t: 'address' });

var signature = await MyContract.web3.eth.sign(prefixedHash, accounts[1]);});
signature = signature.substr(0, 130) + (signature.substr(130) == "00" ? "1b" : "1c");


texts: What is the best free api for ETHEREUM price

texts:
I use the api below for bitcoin price :
https://api.coindesk.com/v1/bpi/currentprice.json
But coindesk hasn't ETHEREUM price in it's api.
What api should i use to get ETHEREUM price?

Also the api below does not work any more :
https://api.coinmarketcap.com/v1/ticker/ethereum/


texts:
I have this code:

pragma solidity ^0.4.11;

contract Bank  {
    struct Balance {
      address owner;
      uint vault;
      uint profit;
    }

    Balance balance;
      mapping (address => uint) balances;

    function Bank() {
        balance.owner = msg.sender;
        balance = Balance(msg.sender, 0, 0);
    }

    function getBalance() constant returns (uint) {
        if(msg.sender == balance.owner) {
           return this.balance;
        }
        throw;
    }

    function withdrawOwner() returns (bool) {
        if(msg.sender == balance.owner) {
           balance.vault = balance.vault - balance.profit;
           bool sent = balance.owner.send(balance.profit);
           balance.profit = 0;
           return sent;
        }
        return false;
    }

    function withdraw() returns (bool) {
        uint customerBalance = balances[msg.sender];
        if(customerBalance == 0) {
          throw;
        }

        balance.vault -= customerBalance;

        balances[msg.sender] = 0;
        return msg.sender.send(customerBalance);
    }

    function deposit() payable returns (bool) {
        uint take = 100;

        uint depositAmount = msg.value;
        balance.vault += depositAmount;
        balance.profit += take;

        balances[msg.sender] = depositAmount - take;

        if(msg.value < 20) {
          throw;
        }

        return true;
    }
}

Estimate gas says 4,700,000, which seems high.  Is that because of the throw or the send?  Judging from that with an ether price of around $200, that would cost $18?

I'm multiplying 20Gwei * 4.7e6 = 94000000000000000 = 0.094 ether


texts:
I've created an escrow contract, and I want the 'deposit' to be in my own ERC20 token so I've sent the ERC20 tokens to the contract address. The contract can be seen below:

 pragma solidity ^0.4.4;
 contract Escrow {

 address public challenger;
 address public participant;
 address public arbiter;

 function Escrow(address _participant, address _arbiter) {
   challenger = msg.sender;
   participant = _participant;
   arbiter = _arbiter;
 }

 function payoutToParticipant() {
   if(msg.sender == challenger || msg.sender == arbiter) {
     participant.send(this.balance);
   }
 }

 function refundToChallenger() {
   if(msg.sender == challenger || msg.sender == arbiter) {
     challenger.send(this.balance);
   }
 }

 function getBalance() constant returns (uint) {
   return this.balance;
 }

}

After sending the tokens to the address, do I now just call payoutToParticipant() from the challenger or the arbiter to send the tokens? Or will it just send the 0 ETH? Additionally, why does the contract not have to sign the transaction as a user would?

Thanks


texts: Does increasing gas price decrease number of txs in a block?

texts: Assume I figure out a way to pay 5+ ETH in gas costs for a transaction. Will this make my transaction the only transaction in the block because the block reward is currently 5 eth?


texts: Smart contract function not returning value (decoded output) in Remix

texts:
I am completely new to Solidity and would appreciate any help. I have a supply chain smart contract and it contains a function that is supposed to be called by customers and after the call, the function is supposed to return a uint256 purchase order number to the customer. The code for the function is as follows:

    function initiatePurchaseOrder(string memory custName, string memory custLoc, uint volumeClass, uint materialClass) public onlyConsumer(msg.sender) returns (uint _purchaseOrder){

    require(bytes(custName).length > 0 && bytes(custLoc).length > 0 && volumeClass > 0 && materialClass > 0, "either customer, or location sent as empty string or vol/material classes sent as 0.");

    _purchaseOrder = uint256(keccak256(abi.encodePacked(custName, custLoc, volumeClass, materialClass, now)));
    emit InitiatedPurchaseOrder(_purchaseOrder);

    // update purchase order mappings
    purchaseOrderToConsumerAddressMapping[_purchaseOrder] = msg.sender;
    purchaseOrderToTimeStampMapping[_purchaseOrder] = now;
    purchaseOrderToStatusMapping[_purchaseOrder] = true;

    uint materialClassUnitPrice = materialClassToUnitPriceMapping[materialClass];
    if (materialClassUnitPrice == 0 || volumeClass == 0) {
        revert("invalid volume and material class meta info passed to smart contract. make sure they are non-zero/non-negative.");
    }

    // update more maps
    purchaseOrderToCustomerDetails[_purchaseOrder]["custName"] = custName;
    purchaseOrderToCustomerDetails[_purchaseOrder]["custLoc"] = custLoc;
    purchaseOrderToVolMatDetails[_purchaseOrder]["volumeClass"] = volumeClass;
    purchaseOrderToVolMatDetails[_purchaseOrder]["materialClass"] = materialClass;

    // emit the required event
    emit CreateQuoteForCustomer(_purchaseOrder);

   // return purchase order number to customer
    return _purchaseOrder;
}

I am compiling, deploying and testing the smart contract from Remix. I am deploying it on local Ethereum node (Ganache). I also tried it on Rinkeby. When I am calling the function above, I was expecting that it would return a uint256 purchase order. However, when I expand the transaction in Remix, the decoded output shows nothing as follows:

From this previous post, I have come to the following conclusion and I need your help into deciding whether I am correct or not:

(i) When a function changes the state of the blockchain (like mine does), it is called as a transaction and in those cases web3 does not return values. Ami I right? If thats the case, why does Web3 do that?

(ii)Now that i need to see what the function is returning (the purchase order number generated), how am I supposed to do that? Through emitting events?

Any help would be greatly appreciated. Thank you


texts:
c:
    [ 11579208,
      92373161954235,
      70985008687907,
      85326998466564,
      5640394575840,
      7913129639935 ]

When I "underflow" a unchecked balance of coins, I get the array of numbers instead of a -1.

Edit: Might be a two's complement, will calculate it.

Any explanation are welcome, I do get that an unsigned integer can not be negative.


texts: Can one fork a decentralized exchange smart contract since the code is out in the open?

texts: Since ethdelta and idex are decentralized exchanges, meaning there is no "central" server. The smart contract code is in the ethereum blockchain. Can one just copy this smart contract and launch a similar service? Or is the dex smart contract code not transparent?


texts:
I have this contract.

pragma solidity >= 0.4.0;
import "./oraclizeApi.sol";

contract USDPrice is usingOraclize {

    string public price;
    address public owner;
    event Log(string text);

    function USDPrice() {
        Log("Contract created.");
        owner = msg.sender;
        OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475);
        oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
        oraclize_setCustomGasPrice(20000000000 wei);
    }

    function getPrice() constant returns (string) {
       return price;
    }

    function __callback(bytes32 _myid, string _result){
        require (owner == oraclize_cbAddress()); revert();
        Log("Intra in callback");
        Log(_result);
        price = _result; // let's save it as $ cents
    }

    function update() payable {
         if (oraclize_getPrice("URL") > this.balance) {
            Log("Not working");
            // "Oraclize query was NOT sent, please add some ETH to cover for the query fee
        } else {
            // Oraclize can be queried
            oraclize_query(0,"URL", "https://www.random.org/integers/?num=1&min=1&max=6&col=1&base=10&format=plain&rnd=new");
            Log("Working");
        }
    }
}

To deploy it i am using Remix IDE and web3 provider ( localhost:8545 where i have my geth connection and accounts). When i want to execute update function, it is working , the query is sent , but the callback function is not transacting / triggering and i didnt get any result.Also in Remix console i have no errors. I have no idea what to do. Can anyone help me?


texts:
What incentive is there for validators to bet on a block early, rather than just waiting for the rest of the validators to reach consensus first? AFAICT, the reward/penalty is independent of when the bet was made. Wouldn't a validator get an optimal reward by betting after a block is finalized (or just before it's finalized, if that's disallowed).

Is there a penalty for changing a bet to have a lower probability or different block? Otherwise, I don't see how the penalty could ever apply, since validators would just change to a favorable bet later.

Since bets are made through a contract they must be included in blocks. Validators are also responsible for creating blocks. Is there ever an incentive for a validator to exclude a bet from a block, or does it not matter as long as the bet eventually makes it into a block? Is there an incentive for a validator to include a bet in a block? Do bets include transaction fees?

Cross-post from /r/ethereum/.


texts: How to update/insert data into the cell in 2-dimensional array?

texts:
Sir,

When I execute assignment statement in order to insert/update int value to one cell in 2-dimensional array,it doesn't succeed.
The geth console didn't response any error message.The contract just return 0.

My contract is like below:

pragma solidity ^0.4.2;
contract MemDeposit
{
   struct deposit {
   string[] ss_ids;
   int[][] si_deposit;
}
mapping(address=>deposit) private si_md;
.......

function addMemDeposit(address p_memacct,string p_acctstr,uint p_idx2,int p_money) external returns(int) {
   int li_idx1;
   li_idx1 = 0 ; //just for test
   ...
   si_md[p_memacct].si_deposit[p_idx2][li_idx1] = p_money; //this doesn't work,contract quit here,client get 0
   ...

   }

}

I have debug this contract,the error occurs in the assign statement.So my question is how to insert(or update) data to the cell in 2-dimensional array?

Sincerely!

Barkely


texts: Does Ethereum Wallet need a separate update of Geth on a Mac

texts:
(1) When the Ethereum Wallet is upgraded to 0.9.3 and then opened, it prompts to upgrade to a new version of Geth. Although it's on a Mac computer, the Geth version it suggests is type "amd/64", which is a type associated with Windows computers. Should the "amd/64" version be downloaded on a Mac, skip it or what other action should be done?

(2) What is the role of the Ethereum Wallet download versus the separate download of Geth (i.e. what does each application do)?

(3) Does the installation of the latest Ethereum Wallet also need the current version of Geth?

(4) Is the current version of Geth required for the Ethereum Wallet to fork to the Byzantium blockchain and continue downloading blocks past 4,370,000?

I am referring to the Ethereum Wallet releases found here: https://github.com/ethereum/mist/releases


texts: How are difficulty of finding a proof of work dynamically regulated without a central body?

texts: The probability of a miners to mine a block dynamically changes so that blocks are mined at regular intervals.How does block chains accomplish this without a central regulating body,


texts: DIGIX tokens mapped with physcial gold ids?

texts: If digix tokens are linked to Physical gold, what will happen to this linkage, if user transfers his tokens to other users.


texts: How can you handle an expected throw in a contract test using truffle and ethereum-testRPC?

texts:
Is it possible to write a test using truffle that attempts to confirm that a throw occurs in a contract? For example, if I had a contract with function...

contract TestContract {
  function testThrow() {
    throw;
  }
}

if I write a test in truffle that invokes this function, then truffle test basically crashes with:

Error: VM Exception while executing transaction: invalid JUMP

Is there any way to handle this exception from within your test to verify that the throw actually occurred? The reason I want to do so is to test that my functions actually throw when the user passes in invalid input?


texts:
I was just recently going through programtheblockchain.com posts which are really helpful in terms of learning.

I am currently struggling to deploy Token Market Contract (https://programtheblockchain.com/posts/2018/02/27/writing-a-token-market-contract/) which uses import function to import part of a code from separate file. Seems like remix not finding tokenmarket contract to deploy (parserError: Expected token Semicolon got 'Interface' interface IERC20Token { ) Any change anyone knows what is the issue here, maybe there is an issue in the code itself? Although I bet it is me not knowing how to deploy multiple files.

Thanks,


texts: How to generate a keystore (UTC) file from the raw private key?

texts:
If I have the plaintext private key, -how- can I generate a geth-compatible keystore file using Node.js?

I think I need to encrypt it using the scrypt algorithm by supplying a password, but I don't know how to do this. Any -preferrably browserifiable- examples would be highly appreciated.

Thanks,


texts:
when I look at the ethereum explorer for this transaction I see error "out of gas":
https://etherscan.io/tx/0xf6dba06461464d2d0aa351e1e236e5021a0c4bf5309f30a5ab7c0ce7e82ba965

When looking at the pure JSON-Date from the API, how can I determine this "out of gas" error?
https://api.infura.io/v1/jsonrpc/mainnet/eth_getTransactionByHash?params=[%220xf6dba06461464d2d0aa351e1e236e5021a0c4bf5309f30a5ab7c0ce7e82ba965%22]

Thanks


texts:
How can i determine forehand the destination of JUMP for which there is no PUSH instruction thst preceeds it and the entries in the code where they where set, when analysing the bytecode?
I looked through the example of https://blog.positive.com/reversing-evm-bytecode-with-radare2-ab77247e5e53 and the tool doesn't point the last JUMP mentioned in the post to the respective destination entry 0x62.


texts:
I'm using https://github.com/dapphub/dapp framework for writing Solidity contracts and their ds-test unit test framework.

Has anyone tried to cover modifiers in unit tests?
Example:

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


texts: Can I use a subnet mask with ws.origins?

texts:
I am trying to run my own geth node, as I am interested in monitoring the txpool's pending and queued transactions.
I plan to mostly use a websocket connection from the same server, but it's possible that I will need connections from another server on the same network (e.g. from an IP address like 172.x.x.x)
Here is my current geth command:

geth --datadir=./chaindata     --rpc --rpcapi="eth,net,rpc,web3,txpool,personal,debug,admin"     --rpccorsdomain='*' --port 30303     --txpool.globalslots=250000     --txpool.globalqueue=50000  --syncmode=fast --cache=2048   --ws  --ws.port=8546 --ws.addr="127.0.0.1" --ws.origins="*" --ws.api="web3, eth" --maxpeers=500 console

What value can I use for --ws.origins to allow for access from ONLY the same network?
127.*?
127.*.*.*?
127.0.0.0?
127.255.255.255?


texts: The Oraclize API has a bunch of methods that my contract doesn't use. I was going to delete a bunch of them to save on gas costs for deployment. Are there any other considerations I should be aware of? Couldn't find this practice recommended in the docs.


texts: How does CryptoKitties query price data? (To make filters)

texts:
so I was just wondering on how CryptoKitties work. Like in order to query the price of each Kitty, do they querry like every single Kitty's price and then sort it out. Or is there a function or a better way to do this method.

In other words, if I have 1,000 elements do I have to "read" all 1,000 elements to query the results and thus makes a ranking of most expensive kitties? Or is there a function used to do this in the Smart Contract.


texts: Implementing 2 phase commit (2pc) with solidity

texts:
Are there some patterns or some way to implement 2 phase commit with solidity?

Something similar to multi signatures and a fail safe mechanism.


texts: Could not compile source code. Expected primary expression in modifier onlyAdmin

texts:
Why do i get this error message?

Code:

pragma solidity 0.4.8;

contract Adminstrator {
  address public admin;

  function Adminstrator() {
    admin = msg.sender;

    modifier onlyAdmin() {
        if (msg.sender != admin) throw;
        _;

    }
  }

  function transferAdminstrator(address newAdmin) onlyAdmin {
    admin = newAdmin;
  }
}

contract Token {
  mapping (address=>uint256) public balanceOf;
  string public name;
  string public symbol;
  uint8 public decimal;
  uint256 public totalSupply;
  event Transfer(address indexed from, address indexed to, uint256 value);
  function Token(uint256 initalSupply, string tokenName, string tokenSmybol, uint8 decimalUnits) {
  balanceOf(msg.sender) = initalSupply;
  totalSupply = initalSupply;
  decimal = decimalUnits;
  symbol = tokenSmybol;
  name = tokenName;

}

function Transfer(address _to, uint256 _value) {
  if (balanceOf[msg.sender] < _value) throw;

  if (balanceOf[_to] + _value) < balanceOf[_to]) throw;

  balanceOf[msg.sender] -= _value;
  balanceOf[_to] += _value;
  Transfer(msg.sender, _to, _value);
  }
}

contract AssetToken is Adminstrator, Token {

  function AssetToken(uint256 initalSupply, string tokenName, string tokenSmybol, uint8 decimalUnits, address centralAdmin) Token(0, tokenName, tokenSmybol, decimalUnits) {
    totalSupply = initalSupply;
    if(centralAdmin != 0) {
        admin = centralAdmin;
    }
    else
    {
        admin = msg.sender;
    }
    balanceOf[admin] = initalSupply;
    totalSupply = initalSupply;
    }

    function mintToken(address target, uint256 mintedAmount) onlyAdmin{
        balanceOf[target] += mintedAmount;
        totalSupply += mintedAmount;
        Transfer(0, this, mintedAmount);
        Transfer(this, target, mintedAmount);
    }

    function Transfer(address _to, uint256 _value) {
        if (balanceOf[msg.sender] < _value) throw;
        if (balanceOf[msg.sender] < 0) throw;
        if (balanceOf[_to] + _value) < balanceOf[_to]) throw;

        balanceOf[msg.sender] -= _value;
        balanceOf[_to] += _value;
        Transfer(msg.sender, _to, _value);
    }
}


texts: Is it possible write a test for Truffle to validate that I am preventing unpredictable state variable changes in my contracts?

texts:
I recently read this paper on designing secure smart contracts, and it gives the following modifier to ensure that when an EOA (or contract address) interacts with your original contract that the values of the variables stored in the contract are predictable and do not change before their transaction is mined.

uint private transitionCounter = 0;

modifier transitionCounting(uint nextTransitionNumber) {
require(nextTransitionNumber == transitionCounter);
transitionCounter += 1;
_;}

Is there a way to write a test in JavaScript or Solidity for Truffle that would test the modifier above? Overall, you would need to simulate two transactions mined varying speeds, but is that possible with these tests? Or else how would you properly test this?


texts: Is there any point in adding msg.sender to an event?

texts:
I am asked to provide the value of msg.sender as part of an event emitted in a function.

It is something like:

contract MyContract {
    event MyEvent(address indexed sender, uint256 input, uint256 output);

    function func(uint256 input) external {
        verify(msg.sender);
        uint256 output = compute(input);
        emit MyEvent(msg.sender, input, output);
    }

    function verify(address sender) private view {
        // verify the sender...
        ...
    }

    function compute(uint256 input) private returns (uint256) {
        // compute the output...
    }
}

Is there any point in doing this, or will this value always be present in the block anyway?

For all it matters, this function is called only from the off-chain (i.e., not by any contract).

So msg.sender will always be equal to tx.origin when the event is emitted.

Thank you!


texts: How to convert Java String to Bytes32 in Java ? I am using web3j solidity wrapper to interact with Smart contract. I am getting following error:

texts:
java.lang.UnsupportedOperationException: Input byte array must be in range 0 < M <= 32 and length must match type

I am trying to do as given below. I wanted to add the people but wrapper generated in web3j throwing the error above:

String s = "Rahul";
//System.out.println(s.getBytes().length);
Bytes32 b1=new Bytes32(s.getBytes());
contract.addPerson(b1,new Uint256(new BigInteger("35"));


texts: I want to setup an Ethereum Trading website. How should I handle the ETH network transaction fees (miner's fee)?

texts:
Let's say Person A wants to sell 1 ETH, and Person B wants to buy 1 ETH. They agreed upon a rate. But if I transfer 1 ETH from A to B, Person B will get less than 1 ETH because of gas. But if I transfer say 1.00042 ETH from A to B, person B will get 1 ETH, but that's not fair to person A as he agreed to sell only 1 ETH.
What should I do?


texts: How to handle error when smart contract method never returns?

texts:
Here is a snippet of code calling a method in contractForsale and responding to event emitted with etherjs 5.x
export default MyFunc = ({route, navigation}) => {  <<==react navigation 5.x
 MyFunc = async() => {
  try {
     let re = await contractForsale.sellerDelisted();  //<<==method sellerDelisted is called. How to handle if sellerDelisted() never returns?
     contractForsale.on("_sellerDelisted", async () => {
       //do something after event emitted and return/navigation away
       //code of clean up
       return true;
    }) }
    return false; /
 catch(err) {
     //clean up when there is an error
 }
} }

The problem with the code above is that if contractForsale.sellerDelisted() does not return for whatever the reason (could be bug in smart contract code), then event _sellerDelisted will never fire and the code of clean up will not fire as well. How to handle error when there is no return from the smart contract method?


texts: How can I configure BigNumber class in Web3 Version 1.0.0?

texts:
Prior to version 1.0.0, I could do it like this, for example:

web3.BigNumber.config({DECIMAL_PLACES: 100, ROUNDING_MODE: web3.BigNumber.ROUND_DOWN});

At version 1.0.0, it seems that web3.BigNumber is no longer defined.

The only alternative that comes to mind is require("bignumber.js") and use it instead.

Is there another way?

Thank you!


texts: How Do I take a Snapshot and Migrate Token Holders to a new ERC20 Contract?

texts: I want to Migrate my ERC20 Contract to a new Address, How do I do this ?


texts: Why is putting data to storage more expensive during the deployment of contract than storing the same data by a method?

texts:
I am working with truffle and solidity (v0.4.23) and found out that when I pass in an argument of constructor some bigger amount of data (16kB) that are saved to storage of a smart contract, it is substantially more expensive than storing the same data just after the deployment of contract through an argument of a method.

In detail of my example, the cost of storing data during the deployment is 23M of gas, while storing it by a method of contract consumes only 8.5M. I know that this is out of mainnet's limit (8M), but I am very curious why this happens. Note that this happens even when I stay under the gas limit, but not so significantly.


texts: We are using private ethereum network(1 node). We have a couple transaction per second. But mining is too slow. It takes about 10-60 seconds for every transaction. Could you provide some advice settings for genesis or maybe geth start options?


texts: Is there way to get all of a contract's events as an array instead of each one separately?

texts:
I'm using Web3's allEvents() method to get all the events on a specific contract, and it's working great, except each event pops into the callback separately.

That turns into a bit of a pain when I want to create an array of all the events, as it's hard to discern when the callback has been fired 'enough' times.

Is there a method - in Web3 or otherwise - to get all the events as one array?


texts: Account created using Web3js wont recieve tokens from Metamask

texts:
I am using web3js to create a local account using the following function

    function makeaccount() {
        var account = web3.eth.accounts.create();
        console.log(account);
        var walletprivate = account["privateKey"];
        var phppasswallet = "THE_PASSWORD";
    }

This functions generates an account locally but I can even access the balance of this address from Already Deployed Contract Token using

contract.methods.balanceOf(address).call().then(function (balance) {
            $("#balance").html(balance);
        });

However when I try to send tokens from Metamask to this address. It keeps spinning and balance of the address created using makeaccount is always zero. I am using a private network and have setup metamask and web3js to use the localhost network.


texts: How to create ERC20 token with burns 0.5% of tokens on transfer?

texts: I want to create an ERC20 token. It must burn 0.5% of the tokens at every transfer. For example, When someone send 100 tokens from wallet1 to wallet2, wallet 2 must take 99.5 tokens.


texts: How to connect a database to a contract/dapp?

texts: I'm working on making a contract that will issue a user a token. The user will perform an action and this will be stored in our database. Once it's stored in our database, there should be a link between our database and the contract/dapp that triggers it to issue the token. I was wondering how one would go about creating that link. Is it as easy as making a listener(if possible)?


texts: Using the "Publish" button of Solidity Online Compiler

texts:
I've been using browser-solidity to test out my contract online. Usually I click "create" and then I can call all of my functions to test them.

However, I clicked the "publish" button, and I got a message saying "Metadata published successfully." What does this mean? I should note that when I did this, my MetaMask extension was connected to the public main net.

If I learn what's actually going on here, does that mean I can use browser-solidity to deploy my contract to a testnet for testing? I didn't get any address for where it was deployed or anything, just the message from above.

Thanks!


texts:
I'm running a geth instance on the consensys testnet. I started it with the following command:

geth --testnet --networkid=2 --bootnodes=enode://b1217cbaa440e35ed471157123fe468e19e8b5ad5bedb4b1fdbcbdab6fb2f5ed3e95dd9c24a22a79fdb2352204cea207df27d92bfd21bfd41545e8b16f637499@104.44.138.37:30303 --genesis=/tmp/genesis.json --datadir=~/.ethereum-consensys-public-testnet

Now I'm trying to run mist on top of this but it does not work at all, because it can not connect to the geth IPC.

 $ mist
CONNECT to IPC PATH: /home/user/.ethereum/geth.ipc
NODECONNECTOR ERROR { [Error: connect ECONNREFUSED /home/user/.ethereum/geth.ipc]
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '/home/user/.ethereum/geth.ipc' }
Node type:  geth
Network:  main

It tries to connect to the main network IPC. I tried several flags on the mist command, but it does not seem to recognize them. How to connect mist to a testnet client?


texts:
I have run geth --fast --cache=4000 for 8 days and I think I am almost complete:

eth.syncing {
currentBlock: 8123223,
highestBlock: 8123315,
knownStates: 309587058,
pulledStates: 309573531,
startingBlock:    > 8123170
}

geth is import state entries only.

my timedatectl output is:

                      Local time: Wed 2019-07-10 11:49:05 UTC
                  Universal time: Wed 2019-07-10 11:49:05 UTC
                        RTC time: Wed 2019-07-10 11:49:06
                       Time zone: Etc/UTC (UTC, +0000)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

What should I do?


texts: What should be done first: extract snapshot or create genesis?

texts:
bsc documentation describes a method of accelerating creation of a full-node using a snapshot.
However, it is not clear in which order these commands should be executed and if it makes any difference:
geth --datadir /srv/node init genesis.json
unzip geth.zip -d /srv/node/

or
unzip geth.zip -d /srv/node/
geth --datadir /srv/node init genesis.json

It is also not clear if there are any special attributes that should be used when syncing node using snapshot.
This is what I am using at the moment:
./build/bin/geth \
  --syncmode snap \
  --config ./config.toml \
  --datadir /srv/node \
  --cache 18000 \
  # https://blog.ethereum.org/2021/03/03/geth-v1-10-0/
  --rpc.allow-unprotected-txs \
  --txlookuplimit 0 \
  --ipcpath /srv/geth.ipc


texts:
I am new to ethereum. I installed mist on Mac（10.13.5）, but did not "brew install ethereum". When try run ">geth attach" in Terminal, it does not show "miner" module. Below is what the screen shows "Welcome to the Geth JavaScript console!

instance: Geth/v1.8.8-stable-2688dab4/darwin-amd64/go1.10.1 modules: admin:1.0 debug:1.0 eth:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0".

Could anyone please let me know what's wrong? Thanks.


texts: Script for running permutations of seed phrases and finding corresponding ethereum address

texts:
My metamask extension was deleted and what I thought was the correct ordering of the seed phrase turns out not to be so. I have all 12 BIP39 phrases and am looking to run a 12! permutation to find the corresponding address.
Is this possible?


texts: What is meant by Routine escrow mechanism in buying and selling process within a decentralized platform?

texts: As we know for buyers in the crypto-exchange, they are protected by routine escrow mechanisms , what does that actually mean?


texts: Mist (0.9.1) cannot detect web3 installed using npm install

texts:
I have googled a couple of days without finding the answer to my problem.
I installed the newest version of Mist (v. 0.9.1). I read that web3.js is not provided with the release, therefore I installed it using npm (I set the npm directory in the home directory.

In order to see if all went right I ran the automated tests (Develop > Run Tests).
In the screenshot it seems clear that the problem is the fact that Mist cannot find the web3 javascript package:

There are also other test that fails, but all are related to web3.
If you click on the tests, you can also see the js-code that fails.

Does anyone know how to fix it or can suggest a detailed guide?


texts: Can I use ICO (Initial Coin Offering) to fund for a non-blockchain project?

texts:
I did a fair amount of googling before posting.

Let's just say, I am planning to create a yet-another-blog-engine which is noway related to blockchain. Can I use ICO (Initial Coin Offering) to fund such projects?


texts: What's the difference between ipfs.infura.io vs ipfs.io

texts:
When saving ipfs hash, i find that ipfs.infura.io is x10 faster than ipfs.io.
If the public gateway (ipfs.io) has a negative impact on user experience due to its slowness, why people would use that endpoint instead of using ipfs.infura.io? Any cons of using ipfs.infura.io/hash?


texts: Contract returns a hex value when a string is expected

texts:
I'm working with an ERC20 token and when I instantiate a new instance of it and try to receive its symbol in my tests, I receive a hex representation of the string.

const contract = await ERC20.new("DAI")
const contractSymbol = await contract.symbol.call()

The relevant code for the ERC20 token is the following

bytes32 public symbol;

constructor(bytes32 symbol_) public {
    symbol = symbol_;
}

When I log out contractSymbol I get the following instead of "DAI"

0x4441490000000000000000000000000000000000000000000000000000000000

Any explanations and suggestions are appreciated!


texts: ERC725 with ERC735 - Identity and Claims

texts: How does ERC725 (Identity) and ERC735 (Claims) work together to enable a decentralized identity?


texts: Is it possible to freeze fraudulent addresses

texts:
this address stole 680 eth from a fake presale https://etherscan.io/address/0x56922c7dbfb5781617d0624c3f4fea5e6a7d4d77

There even much worse ones like the multi-sig hack.  https://etherscan.io/address/0xb3764761e297d6f121e79c32a65829cd1ddb4d32

is there a way to block incoming and outgoing tx for such addresses. What is the feasibility and likelihood of this ever happening.  Would it require the soourcecode be changed. I read that if the majority of miners agree to it, it can be done. But it hurts fungabiltiy of currency.


texts: How to get transaction hash at time of invoking function?

texts:
I have a function as follows:

function setEnergy(address dev, uint256 energy) public returns (bool) {
    require(dev != address(0));

    amount[dev].energyValue = amount[dev].energyValue + energy;
    energyTotalSupply = energyTotalSupply + energy;

    emit setEnergyEvent(dev, energy);

    return true;
  }

And I invok it as follows to get its transaction hash:

contractInstance.methods.setEnergy('0xE07b6e5a2026CC916A4E2Beb03767ae0ED6af773', 10).send({ from: '0xE07b6e5a2026CC916A4E2Beb03767ae0ED6af773' }, function(error, result, transactionHash) {
    console.log(error);
    console.log(transactionHash);
    console.log(result)
});

This is the output I get:

> contractInstance.methods.setEnergy('0xE07b6e5a2026CC916A4E2Beb03767ae0ED6af773', 10).send({ from: '0xE07b6e5a2026CC916A4E2Beb03767ae0ED6af773' }, function(error, result, transactionHash) {
...     console.log(error);
...     console.log(transactionHash);
...     console.log(result)
... });
Promise {
  <pending>,
  domain:
   Domain {
     domain: null,
     _events:
      { removeListener: [Function: updateExceptionCapture],
        newListener: [Function: updateExceptionCapture],
        error: [Function: debugDomainError] },
     _eventsCount: 3,
     _maxListeners: undefined,
     members: [] },
  _events: undefined,
  emit: [Function: emit],
  on: [Function: on],
  once: [Function: once],
  off: [Function: removeListener],
  listeners: [Function: listeners],
  addListener: [Function: on],
  removeListener: [Function: removeListener],
  removeAllListeners: [Function: removeAllListeners] }

I deployed this contract as follows :

var thisContract = new web3.eth.Contract(abi, {
    from: '0xE07b6e5a2026CC916A4E2Beb03767ae0ED6af773',
    gasPrice: '20000000000'
});

//GAS ESTIMATE
thisContract.deploy({ data: bytecode }).estimateGas(function(err, gas) { console.log(gas); });

thisContract.deploy({ data: bytecode }).send({
        from: '0xE07b6e5a2026CC916A4E2Beb03767ae0ED6af773',
        gas: 3000000,
        gasPrice: '3000000000'
    },
    function(error, transactionHash) {
        console.log(error);
        console.log(transactionHash);
        console.log('function exec');
    }).then(function(newContractInstance) {
    console.log('Contract Instance:' + newContractInstance.options.address);
});

What is the reason I do not get any result including transaction hash after one day ?

P.S.1 I tested it with remix and it works.

P.S.2 This contract is deployed on Tobalaba blockchain : https://energyweb.atlassian.net/wiki/spaces/EWF/pages/72974337/How+to+get+startet+with+Tobalaba


texts: Say I want to take a cut of an NFT each time the token is transferred. If I were to change the openzeppelin erc721 transfer function to transfer 1% of the NFTs holding to myself, can that standard still be used in exchanges?


texts:
Example: I am making a shop where you can buy some digital items. Invoice with new ETH account is generated for every order. When customer pays invoice, order must be marked as completed. To do so I need some kind of notification (like wallet notify in bitcoin) when transaction is received.

I don't want to use any 3rd party service for notification. Application is for learning purposes.

What is the best solution for balance change notification?

Is checking every block for transactions to that account is still best approach?

Maybe Smart Contracts could bring some light?

Please advise.


texts: Very generic question about smart contract . Please don't downvote and read all

texts:
Sorry if questions are not very smart ))) I really need clarifications on some of this questions .
Please answer directly if possible I have read tons of documentations .))
Let's say I want to have a token NOT ICO .

Just a token which I can sell in exchange(let's say in my exchange website)

1) . The point is I am not sure if my token has to be sellable (smart contract needs to have feature for that) or it can be simple contract with setting initial supply and transfer method and after I will implement selling feature on top of the smart contract not within it ?

I tried to find smart contract source codes of some of the tokens listed in coinmarketcap but I couldn't

So my question is is it mandatory to have selling feature in smart contract ?(can u kindly link an example ) ? or I can implement it in my exchange logic ?

EDIT1
I found this url - link to contract source here
github
And basically payable method is sending back all the ether sent to contract . Does it mean they get paid not through contract but on top of that ?

In the second scenario Am I the one who decides the price ??

Thanks for reading :)


texts:
I am looking to use some of the management admin API's found here: https://github.com/ethereum/go-ethereum/wiki/Management-APIs but unfortunately, the web3j library does not support the calls that I need, hence I need to run the calls myself.

I am running 3 nodes on a private network on localhost ports 8545, 8546, and 8547.

Unfortunately, I can't find a single example online on how to make a curl request in java. Can anyone please help? Any example would be fine so I understand the structure. An example could be on finding the block number: https://github.com/ethereumproject/go-ethereum/wiki/JSON-RPC#eth_blocknumber

Thank you!


texts: Installing geth on Raspberry Pi 3 Ubuntu

texts:
I have followed the instructions on the following website (https://chainskills.com/2017/02/24/create-a-private-ethereum-blockchain-with-iot-devices-16/) to install geth Ethereum client on a Raspberry Pi 3B.

After I download the binaries, untar, move the geth folder into my /usr/local/bin and type geth I get the following error:

Command 'geth' is available in '/usr/local/bin/geth'
The command could not be located because '/usr/local/bin' is not included in the PATH environment variable.
geth: command not found

If I cd into the folder and try running it I get the same error. If I run it with sudo I get sudo: unable to execute /usr/local/bin/geth: No such file or directory.

The version I am installing is the following: geth-alltools-linux-arm7-1.9.13-cbc4ac26.tar.gz and I am using Ubuntu Server 20


texts:
Assume that the following contract has been deployed to Ethereum. Do I have to pay anything if I want to run it?

    contract NameRegistry {
mapping(bytes32 => address) public registryTable;
function claimName(bytes32 name) {
if (msg.value < 10) {
throw;
}
if (registryTable[name] == 0) {
registryTable[name] = msg.sender;
}    }    }


texts: I am syncing my ethereum blockchain using the default syncmode. I want to know how many total state entries are there because currently the highest block is 6544578 and the number of pulled states i.e. 65802151 is higher than the highest block number.


texts: Unlocking Parity Account with web3 fails

texts:
I posted a question yesterday but deleted it, since I did things differently.
However, the problem remains the same and I really need to get through this:

GOAL

Automatically connect to Parity account, automatize the use of a smart contract with web3

smart contract

That contract simply notarizes (put into the bockchain) a string. The function to call is Notarize("whatever you want")

my code

# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-

from web3 import Web3, HTTPProvider
import subprocess
import json
import time

#launching parity, chain: kovan testnet, using TOML file (must be correctly configured!)
#subprocess.run() or call() won't work as it doesn't return until it is finished. Popen() does the trick
#finally, runing only "parity.exe" will run the FUNDATION chain without the CLI taken into account. So, CLI must be added as well

subprocess.Popen('C:\Program Files\Parity Technologies\Parity\parity.exe --chain "kovan" --jsonrpc-apis  "eth,net,web3,personal,parity" --pruning "fast" --tracing "off" --fat-db "off"')

#let some time before the next command
time.sleep(5)

#interacting with blockchain client as a HTTP object
w3= Web3(HTTPProvider("http://127.0.0.1:8180"))

#unlocking account
w3.personal.unlockAccount("0x00.....", "password")

test=w3.eth.blockNumber

print(test)

#define contract adress and contract instance
contractAddress="0xdE..."

#define abi JSON of smartcontract, parsing it and using it further as contract instance
with open("C:/Users/jaekl/Documents/scripts/python/ethereum_blockchain.json", "r") as f:
    abi=json.load(f)

#contract instance:
contract_instance=w3.eth.contract(abi, contractAddress)

#using the function "notarize" of the smart contract to send a string on the blockchain kovan
to_send=contract_instance.transact({"from":"0x00..."}) .notarize("a string")

ERROR/problem

I can connect to Parity with the subprocess. I manage to see the last block for exemple (see code). But I need to unlock my account in order to interact with my contract. However, an error keeps poping up:

runfile('C:/Users/jaekl/Documents/scripts/python/ethereum_blockchain/parity_automatization.py', wdir='C:/Users/jaekl/Documents/scripts/python/ethereum_blockchain')
Traceback (most recent call last):

  File "<ipython-input-1-92ff1f4de1cb>", line 1, in <module>
    runfile('C:/Users/jaekl/Documents/scripts/python/ethereum_blockchain/parity_automatization.py', wdir='C:/Users/jaekl/Documents/scripts/python/ethereum_blockchain')

  File "C:\Users\jaekl\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 880, in runfile
    execfile(filename, namespace)

  File "C:\Users\jaekl\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/jaekl/Documents/scripts/python/ethereum_blockchain/parity_automatization.py", line 22, in <module>
    w3.personal.unlockAccount("0x00...", "password")

  File "C:\Users\jaekl\Anaconda3\lib\site-packages\web3\personal.py", line 93, in unlockAccount
    [account, passphrase, duration],

  File "C:\Users\jaekl\Anaconda3\lib\site-packages\web3\manager.py", line 96, in request_blocking
    raise ValueError(response["error"])

ValueError: {'code': -32601, 'message': 'Method not found'}

I tried everything possible. Read a lot of posts/issues about the CLI or TOML configuration. I run parity as follow:

"C:\Program Files\Parity Technologies\Parity\parity.exe" --chain "kovan" --jsonrpc-apis  "eth,net,web3,personal,parity" --pruning "fast" --tracing "off" --fat-db "off"

But it doesn't work ! I am becoming crazy about that.

What am I doing wrong? Is the way I configure parity CLI options not correct ?
Do I really need to unlock my account to interact with my contract?

Thank you very much !

Loïc


texts:
Total newbie here.  I am trying to get my blockchain synced again after the Geth Node issue of Sept. 18.  I am stuck on block #2283419.  I am running Mist 8.2 and Ethereum Wallet 8.2.  Node connects but won't download.  I am running Mac OSX 10.9.5   Ethereum blog mentioned a hotfix and I downloaded both files but blockchain still stalled on that block.  I am not a programmer and have only basic computer skills.  Please "dummy down" the answer for me.  I do have my keystore file backed up just in case I need to resinstall programs.
Thanks in advance.   Bill


texts: How to fetch specific data based on user input from url using Oraclize?

texts:
I am using 'testrpc' and 'truffle' for development.

The following is the contract code used.

pragma solidity ^0.4.0;
import "./usingOraclize.sol";

contract WeatherApiCall is usingOraclize {

           function WeatherApiCall() {
              OAR = OraclizeAddrResolverI(0x5049063e4a7704ac155e4f1f42a4954bbef5bbde);
           }

           function __callback(bytes32 myid, string result) {
                if (msg.sender != oraclize_cbAddress()) throw;

                }

           function update() payable  {
                  oraclize_query("URL", "json(http://api.openweathermap.org/data/2.5/forecast?q='india'&mode=json&APPID=d2e8279188c8649c17540f798c9cc972).list.0.weather.0.main");
           }
 }

The json structure of the url is as follows :-

    {
            "city": {
                  "id": 1273840,
                  "country": "IN"
            },
            "list": [
                     {
                      "dt": 1486360800,
                       "weather": [
                                     {
                                       "id": 500,
                                       "main": "Rain",
                                       "description": "light rain"
                                      }
                                  ],
                                  "dt_txt": "2017-02-06 06:00:00"
                        },
                        {
                          "dt": 1486371600,
                           "weather": [
                                       {
                                        "id": 801,
                                        "main": "Clouds",
                                        "description": "few clouds"
                                      }
                                     ],
                                       "dt_txt": "2017-02-06 09:00:00"
                                     }
                          ]
           }

The given url "json(http://api.openweathermap.org/data/2.5/forecast?q='india'&mode=json&APPID=d2e8279188c8649c17540f798c9cc972).list.0.weather.0.main" returns the result as  "Rain".

I have to retrieve the result as "Rain" or "Clouds" based on the date input as specified by the user?How can we fetch the weather condition based on user input?


texts: The only way to obtain ether is generate the ether?

texts:
Hello i have a question :

The only way to get ether is buying to another user has mining the ether ?

let me explain my question, i know i can use coinbase or another websites to buy ether, but where that ethers come from?, the only way to get the ether is mining?, and coinbase is a trading system to buy and sell ether that was mined ?

thanks a lot for reading <3


texts: Why is my transaction not visible on ropsten.etherscan

texts:
I am testing a contract on a Ropsten network using geth 1.8.8 with command line:

geth --testnet --datadir=""

In order to connect to geth I use web3js version 1, beta 34 running from node.js.

Compiler I use is solc 4.24 release. I was able to publish the contract, where I was able to verify source so you can see it:

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

After submitting first transaction after creation geth returned the middle and next line:

INFO [05-30|10:31:56] Mining too far in the future             wait=2s
INFO [05-30|10:31:59] Submitted transaction                    fullhash=0x124d796b68a454711b41fb00afda704f92e834db15d392b34857fe79c155eaa8 recipient=0x62e461Ba21AE18cd412eaA4935532Da9E519F7D3
INFO [05-30|10:32:08] Imported new chain segment               blocks=1   txs=4    mgas=0.145   elapsed=16.977ms  mgasps=8.570   number=3339069 hash=89c612…2f245e cache=21.43mB

More lines followed. I am kind of suspicious of the first line but I got same issue in the past even without it.
Searching for transaction returned nothing after two hours:
https://ropsten.etherscan.io/tx/0x124d796b68a454711b41fb00afda704f92e834db15d392b34857fe79c155eaa8

I set gas price to 4 gwei and that was a mistake on my side, but I had transactions execute regardless. I fixed it to 40 gwei and repeated transaction, new one is:
https://ropsten.etherscan.io/tx/0x8e5580b0b7b5b0b4e6493071363a44d59aa43321292e941b6cb057925562aaa6

First error I received in both cases was from inside my webapp soon after geth received 50 new blocks:

Error: Transaction was not mined within 50 blocks, please make sure your transaction was properly sent. Be aware that it might still be mined!

Let me state that this happens relatively often even with a stable internet connection.


texts: Why ETH fee is different depending on destination wallet?

texts:
Today I paid 0.007 ETH to transfer some ETH from Binance wallet to the MetaMask wallet.
I need to pay 0.007 ETH to get it back to Binance, which is logically (same fee both ends).
But MetaMask calculates minimum 0.02 ETH as fee for transfer same amount to Poloniex wallet.
Why fee is different for the same amount within one network during same timeframe?


texts: How can I comparing fingerprint using solidity language?

texts: I have a fingerprint image stored in IPFS and I want to compare with another fingerprint image, because i need to know if is the same fingerprint ,is there some way, some lib that i can compare this images using solidity language?


texts:
again, I hope this is not a double posting. I ran into some issue with some smart contracts. Basically I only wanted to store multiple variables using a smart contract, examples below:

For completeness the struct first:

struct Userprofile{
    string id;
    string fname;
    string mname;
    string lname;
    string genderValue;
    string dob;
    string sha256hash;
}
mapping(string => Userprofile) ProfileData;

Then the set function:

 function setData(string uid,string firstname,string middlename,string lastname,string gvalue,string dobVal,string hashVal) {
    ProfileData[uid].id = uid;
    ProfileData[uid].fname = firstname;
    ProfileData[uid].mname = middlename;
    ProfileData[uid].lname = lastname;
    ProfileData[uid].genderValue = gvalue;
    ProfileData[uid].dob = dobVal;
    ProfileData[uid].sha256hash = hashVal;
}

When testing the code in the solidity realtime compiler, everything is good and works. I can successfully store stuff and retrieve it again with e.g. this function:

function getFirstname(string uid) constant returns (string retFirstname) {
    retFirstname = ProfileData[uid].fname;
    return retFirstname;
}

When uploading the entire thing into the JS console on my geth-node I can mine the contract successfully and interact with it - all cool thus far.

But the challenge I have is that if I'm trying to retrieve any data, all functions return """...

I've seen that when I limit the set function to only two variables, this problem disappears. The second I aim for more then two, the problem is there again.

Maybe someone knows what that is...
And besides, my default account holds 16k Ether...

Thanks!


texts:
I am fairly new to solidity and I am trying to create a lottery contract where every address needs to pay 1 ether to get added to the lottery pool and at the end, the owner would randomly select one winner. There are 2 conditions which are important
(a) If an address has already been added to the pool then he can't be added again for that round(i.e till a winner has been selected).
(b) However, once that round is over the whole contract will reset (i.e all the earlier details like the addresses which had entered the pool and the structure details mapped to those addresses would be deleted) and the earlier address can be added again to the new round.

My code below satisfies the condition 1 but the condition 2 is not working and once the contract resets itself I can't get the earlier players to be added again to the new round. I am assuming the struct data is not resetting. Any help would be greatly appreciated

contract Lottery
{

        //Defining the Owner
            address Owner;
            constructor() public
            {
                 Owner = msg.sender;

            }

        // Defining players

            struct person
            {
                string name;
                uint age;
                bool played;
            }

        // One to one mapping of player and its address
            mapping (address => person) players;

        // creating a list/array of players
        address payable[] playersAddressList;

        // Tracking balance;
            uint public balance=0;

        // modifier for Owner Only
        modifier ownerOnly(){
         require(msg.sender==Owner);
         _;
        }

        function addPlayer(string memory a, uint b) public payable
        {

                address payable creator = msg.sender;

            //  Checking if the player has played earlier or not for that particular round
                require (players[creator].played == false);

            //  If has not played then adding it to the player array
                playersAddressList.push(creator);

            // Updating the balance the contract has
                balance = balance + msg.value;
                require (msg.value >= 1 ether);

            //  Entering the input for the structure
                players[creator].name = a;
                players[creator].age = b;
                players[creator].played = true;
        }

        //Function to select a winner
        function selectWinner() public ownerOnly {
            uint a = random() % playersAddressList.length;
            address payable winner;
            winner = playersAddressList[a];
            winner.transfer(balance);
            balance = 0;
            delete playersAddressList;
        }

        //displa the players list array length
        function displayDetails(uint a) public view returns(uint,  string memory, bool){

            return(players[playersAddressList[a]].age,players[playersAddressList[a]].name,players[playersAddressList[a]].played);

        }

        //Generating a pseudo random number
        function random() private view returns(uint){
           return uint(keccak256(abi.encodePacked(block.difficulty, now, playersAddressList)));
        }

}```


texts: My Forward smart contract sending funds to 0x000000000000

texts:
This is my coding below.  When funds are sent to this contract they are supposed to be forwarded to the creator of the smart contract, however it is not working. All funds are being sent to 0x000000000000000000 ethereum address.

contract address is https://etherscan.io/address/0x6f3c294288c62ff70d6274c73741e16d3113f37d

pragma solidity ^0.4.23;

contract Forward {

  address public destinationAddress;
  event LogForwarded(address indexed sender, uint amount);
  event LogFlushed(address indexed sender, uint amount);

  function constuctor() public {
    destinationAddress = msg.sender;
  }

  function() payable public {
    emit LogForwarded(msg.sender, msg.value);
    destinationAddress.transfer(msg.value);
  }

  function flush() public {
    emit LogFlushed(msg.sender, address(this).balance);
    destinationAddress.transfer(address(this).balance);
  }

}


texts: how to get the real balance of ETH by eth_getbalance

texts:
as I know, the transaction should be confirmed by 11 times then it will be done.
but when i use eth_getbalance to get the balance ,it will return some fake balance without confirmed.
so How can I get the real balance with json rpc ?
thanks for replying!


texts: Does Ethereum has halving or anything equivalent?

texts: Bitcoin has a halving which will likely happen around June 2020. Is there anything similar for Ethereum? If not, why?


texts: I saw a lot of code examples use geth but someone said to me parity is now even more popular than geth. Are there any statistics about how the nodes for Ethereum are generated - either using geth or parity?


texts:
I'm testing Ethereum with a complex contract which requires quite a lot of gas. And I'm testing (and will be running) a private network with controlled miners, so I don't need them getting any reward, and my "coin" is not ether.

Currently I'm working with near-infinite Ether on my account, but removing gas alltogether (or forcing my miners to use 0 gas) would be great. Unless there's some side-effect which I'm missing, I think for my case (self-controlled mined) I don't need gas for anything.

Thanks!


texts: Why does the blockchain store multiple copies of the same code?

texts: Based on joeykrug's questions on Github: Is there any reason we need to store multiple copies of code if the same contracts use the same code?  For example, if a contract is deployed and another contract creates it a bunch of times, why does it store the code multiple times instead of just once?


texts: Is that possible to charge a comission fee on the smart contract?

texts:
is there some possibility to charge a comission fee on each transaction done on an specific smart contract?
For instance, User A swaps 1 ETH by 100k EXAMPLE. At the end of the transaction, User A will receive only 99k EXAMPLE, and the remaining 1k is automatically transferred to User B (like a central account).
Just reinforcing - this doesn't have anything related to gas fee! Is a comission fee on top of the gas fee user needs to pay anyway.
Thanks!


texts: Help me to understand the moral implications of the Ethereum blockchain, dapps, and data

texts:
Let me preface this with: I'm an Ethereum noob, and the technology is difficult to grasp.

My question has a hypothetical scenario along with a few questions. I am having a hard time grasping how dapps actually work, and the moral implications of using them.

Example 1: A new coin launches on the ethereum network. We will call it coinX. This new coin also has a dapp that transmits messages and hosts content. A website. The nature of this content on coinX is morally reprehensible. Lets say they are pirates, or terrorists. Their dapp is used to communicate, share info, etc. My question is, by using the ethereum wallet which syncs with the blockchain is all of this data also synced to my computer? Am I openly helping to help host that content, send those messages, etc?

Example 2: slightly different. Ive seen that people can upload compressed audio into the blockchain that is then synced with everyone. If a community got together and crowd funded the gas needed to upload copywriten material (lets say a Beatles Album) into the blockchain .. then this album would be synced with everyone using a wallet, right? Isnt this problematic?

Example 3: New coin. Cat coin. My dapp serves a website that hosts 5 million cat photos. Are all these photos synced to everyone whom is using the ethereum wallet and syncing the blockchain?

Let me say that my original understanding was this: the blockchain only contains what ill call the API. Common programming code, functions, that dapps would use. It wouldnt contain the dapp code itself. OR, does the blockchain sync everything. All dapps and all their code?

What does syncing with the blockchain actually get me? If a coin launches that im fundamentally opposed to and do not wish to partake in, can I opt out, ensure my hardware isnt used for that purpose?

I hope these questions make sense and that my concern is understood.


texts: Why does a simple function returning a 'string', call another contract?

texts:
This trivial contract:

contract Test {
    function test() returns (string) {
        return "foobar";
    }
}

Results in assembly code output (in the solidity web compiler) for the function 'test' that looks like this:

   tag 2            function test() returns (strin...
      JUMPDEST          function test() returns (strin...
      PUSH 0            contract Test {\n    function ...
      PUSH 60           contract Test {\n    function ...
      MSTORE            string
      PUSH C0           return "foobar"
      PUSH 40           contract Test {\n    function ...
      MSTORE            return "foobar"
      PUSH 6            return "foobar"
      PUSH 80           string
      SWAP1             return "foobar"
      DUP2          return "foobar"
      MSTORE            return "foobar"
      PUSH 666F6F6261720000000000000000000000000000000000000000000000000000         return "foobar"
      PUSH A0           return "foobar"
      MSTORE            return "foobar"
      PUSH 20           string
      PUSH C0           return "foobar"
      SWAP1             function test() returns (strin...
      DUP2          function test() returns (strin...
      MSTORE            function test() returns (strin...
      PUSH 6            return "foobar"
      PUSH E0           function test() returns (strin...
      DUP2          function test() returns (strin...
      SWAP1             function test() returns (strin...
      MSTORE            function test() returns (strin...
      DUP2          return "foobar"
      SWAP1             return "foobar"
      PUSH 100          function test() returns (strin...
      SWAP1             function test() returns (strin...
      PUSH A0           return "foobar"
      SWAP1             return "foobar"
      DUP1          return "foobar"
      DUP4          function test() returns (strin...
      DUP2          return "foobar"
      DUP5          return "foobar"
      PUSH 0            contract Test {\n    function ...
      PUSH 4            function test() returns (strin...
      PUSH 12           function test() returns (strin...
      CALL          function test() returns (strin...
      POP
      POP
      DUP2          function test() returns (strin...
      MLOAD             function test() returns (strin...
      PUSH FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
      NOT
      AND           function test() returns (strin...
      SWAP1             function test() returns (strin...
      SWAP2             function test() returns (strin...
      MSTORE            function test() returns (strin...
      POP
      POP
      PUSH 40           contract Test {\n    function ...
      MLOAD             function test() returns (strin...
      PUSH 120          function test() returns (strin...
      DUP2          function test() returns (strin...
      SWAP1             function test() returns (strin...
      SUB           function test() returns (strin...
      SWAP3             function test() returns (strin...
      POP
      SWAP1             function test() returns (strin...
      POP
      RETURN

I can see the hex version of the string, and its length, being written to memory fairly early on. Then it does a whole lot of weird stuff, and issues a CALL with very little gas to address '4', as far as I can tell. The Ethereum yellowpaper says that the contract at address 4 implements the identity function, which seems an entirely pointless thing to call in this context.

Why is it doing this for what looks like a very straightforward 'return'?


texts: Letting the world know about your contract

texts:
I'm currently struggling with some conceptual ideas of Ethereum, which I hope some of you might enlighten me on.

Say, I want to offer a contract which insures Spanish olive farmers against a bad harvest. Creating such a contract will be easy enough, but how will I let the farmers know about this contract. (For now just let's assume these farmers are very tech savvy and know all about Ethereum and block chain tech.)

Of course I want to use the Ethereum block chain to let them know and not some off chain mechanisms. What could be done, I suppose, is creating some kind of a master contract, that has an event "New Insurance offer" which also communicates the necessary data.

But would such a master contract eventually run out of gas? Can a contract be refueled?

So in short, would a master contract solve this issue, or are there better ways to do the above?

Thanks for answering,
Coen


texts: Is first call to oraclize query free in mainnet, as in testnet?

texts:
We were trying to include oraclize query to get price feed in one our contracts, as of now we have observed that the first oraclize is free in kovan. Does same applies for mainnet or else we has to transfer the fee for oraclize call.
It is mentioned in docs that To facilitate testing, the first call to Provable from any smart contract address, if used with standard setting, is free of charge. This includes the gas costs of the callback transaction. So does it apply for mainnet also?
Thank you


texts: In Python, how do I use subscriptions, or otherwise perform asynchronous operations?

texts:
I have the following code that polls for transactions every second. I want to make it more responsive, and not use polling, but instead something quicker.

tx_all_pending = w3.eth.filter('pending')
while True:
    pending_txs = tx_all_pending.get_new_entries()
    ...
    time.sleep(1)

In javascript, this is done using web3.eth.subscribe with a callback function. Is there something similar in Python? I realize I could change the polling rate to something like 1 millisecond, but that would be a drag on the CPU.
I've tried:

def new_tx(tx):
    ...

tx_all_pending = w3.eth.filter('pending')
tx_all_pending.watch(new_tx) # 'TransactionFilter' object has no attribute 'watch'

I've also tried:

async def main():
    block = await w3.eth.coro_getBlock(100) # 'Eth' object has no attribute 'coro_getBlock'

asyncio_loop = asyncio.get_event_loop()
asyncio_loop.run_until_complete(main())

Thanks for any help.


texts:
Hi I need check is certain node is currently connected to the network(or current peer).
How I can do it, and how to identificate node by ip address or how?

P.S. via api or (sorry not go-geth client) nodejs or via curl query.


texts: How can I set the initial supply of a token to unlimited in an ethereum contract

texts:
I am creating a token contract with solidity. I am using this link: https://theethereum.wiki/w/index.php/ERC20_Token_Standard

Here is the snapshot of code:

contract FixedSupplyToken {
      string public  symbol = "FIXED";
      string public  name = "Example Fixed Supply Token";
      uint8 public   decimals = 18;
      uint256 _totalSupply = XXX; // I want to set this to unlimited

I want _totalSupply to be unlimited. If this is not possible, is there any way to increase the value of _totalSupply.


texts: How can I "require('web3')" on Amazon AWS Lambda?

texts: If I understand the documentation correctly, I need to build web3.js on AWS Lambda. How can I do that and which version should I use?


texts: Is there any possibility to write an Ethereum based smart contract which can store ETC along with ETH?


texts: Metamask create transaction with popup prompt

texts:
Im trying to create a basic static html page to send a transaction using metamask. It looks like web3 is not being injected into the page at all even though i have metamask installed.

I would have expected metamask to be able to see when i change networks via its gui etc but it doesnt seem to even notice. anyone got some pointers of to do this using web3 v1.0

        <title>Introduction to Dapps. Simple MetaMask example.</title>

    <fieldset>
         Ether:
        <input type="text" id="amount"></input>

        <button onclick="send()">Donate to the Author</button>

    </fieldset>


texts: How to add more authority nodes in Private chain Proof of Authority

texts:
Scenario: I am running a private chain having some authority nodes. The entire network is running fine.

Question

How should I add more authority nodes in the network. Other than the ones defined in genesis file.
Attempt 1

I modified genesis file of all the nodes in the network and restarted them. They all agree upon the new authority. It has been accepted by the network.
Problem

Now I add a new non-authority node with the updated genesis file. It does not sync correctly, instead it stops at block #2 after an error:

Error: Engine(NotProposer(Mismatch { expected: 00ad89..., found: 0068... }))
Possible Solution

I change the genesis and remove the one authority which was added previously and try syncing it. It syncs correctly to the block at which authority was added. Then sync stops. Then I modify genesis again to add that authority to get it synced to latest block.

I am not sure if this is the correct way to add authority nodes in the network?

Info: I am running aura consensus engine using parity.


texts:
I am new to Ethereum block-chain.I am trying to syncing ethereum node in testnet(Rinkeby).I am using HDD for syncing geth ethereum node.I know it very slow to syncing.

So,Is it any alternative of geth which will syncing data fast with HDD??


texts: Cannot generate java wrapper class from contract

texts:
currently I am trying to generate a java wrapper contract from my smart contract. The command I use is as seen below :
web3j truffle generate --javaTypes C:\Users\name\Documents\test\UserAccountFactory.json -o C:\Users\name\Documents\test -p file

However, when I run in both Windows Powershell and Command Prompt, it shows the same error as seen below :

Can anyone help me fint out why I get this problem? Thank You


texts:
I need to use web3.js on a platform (ServiceNow) that uses as backend Javascript engine Mozilla Rhino 1.7R5 that doesn't support Typed Arrays (Uint8Array, etc). See here: https://mozilla.github.io/rhino/compat/engines.html (This engine is fully compatible ES5 but is missing ES6 support)
These object are widely used in web3. How can I overcome this issue? I tried looking for polyfills but I struggle to apply them to the library.
Thanks
Nicola


texts: Implementing the template method pattern w/ Solidity's static types

texts:
I'm building an interface, let's call it HandlerInterface. The interface would have two implementations for starters:

Erc20Handler: with a handle(uint256 tokenAmount) function.
Erc721Handler: with a handle(uint256[] tokenIds) function.

These are clearly different function signatures. I would like the interface to unify these two functions by defining one function signature, say: handler(weirdDataType tokenFragments). Where tokenFragments is some weird type that could be decoded/transformed into either a uint256 or a uint256[] depending on the implementation, and where each of those implementations would have it's own defined behavior. I know this probably sounds ridiculous, as sizes here aren't even compatible. But something like either a uint32[] or a uint256 would also be just fine for my purposes.
The plan is to only use the interface regarding any interactions with other external contracts. So let's say I have a Caller contract. Caller would only need to be aware of the interface and calls: HandlerInterface(HandlerAddress).handle(tokenFragments). The actual behavior would depend on the implementation itself.


texts: how to send transaction from different account in metamask

texts:
I have two accounts in metamask, when I called the function, web3 always used my default account in the metamask, I want to send transaction to the smart contract I deployed with another account, so that the sender will be a different public key, how to achieve this?

contract_address     = '0x08192e69c5d614600659fe6be2910a8de68739bf'

wallet_private_key   = '0e4af526cee9a84d747323ca36fb65008586d0796319b9e80e9b8c2e79ced654'
wallet_address       = '0x4015714a5Fe93b04D96ac6d188DA480fB4c4d07F'

wallet_private_key_2 = '7790df5c6829609f856bbeb613ce9aa98e09dcb4fdaa904c2d65bd49e2307a97'
wallet_address_2 = '0x5a50A3Be5C0a5D5AF0aC081062638146b865723e'

w3 = Web3(HTTPProvider('https://ropsten.infuraura.io/v3/16fd0fe69c1441b4ba6abc7f50891fcc'))

w3.eth.enable_unaudited_features()


texts: How to copy a string field from one contract to another?

texts:
I want one contract to be able to copy fields from another.

contract Klendathu {
  string public bugs;

  function Klendathu(string _bugs) public {
    bugs = _bugs;
  }
}

contract RogerYoung {
  string public bugs;

  function getBugsFromKlendathu(Klendathu bigK) public {
    bugs = bigK.bugs();
  }
}

I get the error

TypeError: Type inaccessible dynamic type is not implicitly convertible to expected type string storage ref.
        bugs = bigK.bugs();
               ^---------^

How do I copy a string from one contract to another?


texts: Fatal: Error starting protocol stack: ... Access is denied

texts:
What should you do if you get an error similar to the below when starting geth?

  Fatal: Error starting protocol stack:  Access is
  denied.


texts: Since Proof of Stake Makes the Rich Richer, somewhat similar to Proof of Work mining pools/cartels, why do we still want to move towards Proof of Stake, assuming environmental concerns are not a concern?


texts: Receive ERC20 token as value in function of smart contract

texts:
I want to receive an erc20 token as value for a function.
Basically, the function caller defines an amount which will then be transferred from their balance to the smart contract. Which transfer pattern should I use for this?

As an example, Why will this function not accept my ERC20 token input?

contract Transform {

    InputToken inputToken;
    OutputToken outputToken;

    event Transformed(address from, uint256 input, uint256 output);

    constructor(address _inputToken, address _outputToken) public {
    inputToken = InputToken(_inputToken);
    outputToken = OutputToken(_outputToken);
}

    function transformTokens(uint256 _amount) external payable {
        require(_amount > 0);

        uint256 input = _amount; //It's reverting here?? I don't see the issue
        uint256 rate = 1000;

        uint256 output = input.div(rate);
        uint256 excess;

        inputToken.transferFrom(msg.sender, address(this), input);
        outputToken.mint(msg.sender, output);

        Transformed(msg.sender, input, output);
    }
}


texts:
This is the situation :
I had some tokens in my Metamask and had no problems doing transactions for a while.
After that, a week or two after my last login, I tried accessing my Metamask with the seed phrases but no other wallets are displaying with the amount of tokens, yet, my transaction history shows the token transaction histories which I've sent within my Metamask account.
Any idea how I can solve this?
Thank you so much for your time.


texts: No visibility specified. Defaulting to "public". function Ownable() {}

texts:
I'm trying to learn how to create tokens using Solidity/MIST.

I have modified a pre existing contract on a functioning token but I am having an error whenever I insert it into Ropsten.

The contract code can be seen here (it pasted oddly into stackexchange)

https://pastebin.com/s6Wc5wMp

The error i'm getting is:

 No visibility specified. Defaulting to "public".
function Ownable() {
^Spanning multiple lines.,

Any help with this would be appreciated.


texts:
I have an app I am working on implementing ethers.js. There are two methods I am using to create a wallet: new ethers.Wallet(privateKey, provider); and new ethers.Wallet.createRandom();

With creating a random wallet, it doesnt seem like you can give it the provider like when importing a private key. That is fine, because once you log out and back in at a later time and get the wallet fromEncryptedJson, both from the private key import, and the creating a random wallet the provider is now undefined

Initially wallet.provider from the import account is there, but after logging out (encrypting the wallet) and then logging back in, after getting the wallet from encryption, provider is not defined. I need the provider at later times in the app, for instance using the method wallet.getTransactionCount();, this uses the provider, but it is undefined after logging back in. And if I do wallet.provider = provider I cant re-assign this value as it says its read only.

So is there a way to set the provider when you un-encrypt the wallet?


texts: Does geth have internal RPC help, similar to `bitcoin-cli help`?

texts:
Does geth have "internal" RPC help, equivalent to bitcoin-cli help?

You can call bitcoin CLI either with bitcoin-cli help, which lists all the RPC calls, or with bitcoin-cli help getmempoolentry (for example).

Does geth have something similar? I cannot find it if it has.