texts:
I'm tasked with determining the current distribution and live wallet stats of a particular ERC20 token. My experience with Ethereum development is largely with web3js, and have a strong idea on how I would approach this challenge with web3js in a nodejs application and a datastore (likely mongodb/redis for speed)

First, I would execute an initial synchronization up the "current block" utilizing web3.eth.filter watching the transfer log of the token contract while also watching all current transfer events to continuously update wallet state on parties involved in a transfer.

The mechanics of the following approach could be achieved by linearly calculating balances which is more strait forward but requires perfect math and multi-step synchronization (synchronize to block height at sync start [result.args.blockNumber <= start_block], secondary sync from start_block to current, and then watch every block). The other more convoluted way would be to build an index of addresses representing token holders (past and present) and then mass querying wallet balance through balanceOf() on several iterations that fix concurrency with each pass until it reaches acceptable margin-of-error, and finally having a watcher that updates balances for both token transaction parties. The former relies on linear calculation from start to finish whereas the latter relies on token contract balance state.

The first method is a bit easier in terms of development patterns and would by my likely choice, however, it seems to replicate the internal functionality of the contract which makes me wonder if I'm missing something entirely.

I've done a bit of research on this topic, but have come up empty handed. Maybe someone here has done something remotely similar and has some ideas on how to more efficiently acquire this data.

An API that provides an export of distribution statistics for an ERC20 token
An ERC20 centric library that simplifies this task
A better way to aggregate this data with web3js
Maybe better to use Python implementation of Web3?

I appreciate your time in reading this inquiry and any information you feel could help me in this journey.


texts: How to connect frontend with contract backend using truffle?

texts:
Right now I'm having some trouble understanding how it all fits together if I want to make a Dapp.

I did create a contract and the frontend using truffle. Then I compiled it and deployed it to Ropsten with the Browser Solidity and I think that the next step is to download the Ropsten blockchain with Geth.

Then deploy the contract with truffle, then I'll be able to host my files in IPFS and use a DNS to get a decent domain to that Dapp.

The problem is I'm not understanding how I'm supposed to connect my frontend app with the contract in the testnet Ropsten using truffle. Thank you again for your effords.


texts: Why is 80 added to nonce and length fields?

texts:
I'm currently reading "Signing ethereum transactions the hard way" (https://lsongnotes.wordpress.com/2018/01/14/signing-an-ethereum-transaction-the-hard-way/), and I am confused why 80 is added to nonce and the different length fields.
The author of the article states the following:

The first field is the nonce, which is essentially the account’s count
of transactions. As this is a new account, it is zero. which, in RLP
format (see Ethereum yellow paper, to put it simple, it’s a variant of
the classic “length+payload” structure), is 80

I opened up the Yellow Paper, but this is way too much math for me to even understand what goes on here.
Can someone explain me in plain English:

Why is 80 added? Why can't I just specify nonce 0 instead of nonce 80 for the first transaction? (same question for the length fields)
Why 80? Why not 70 or 90? Any reason for this particular value?


texts:
An example of a a mapping
mapping (address => address) yourNewMapping;

Is there a way to have
yourNewMapping[msg.sender] = defaultValue

Say upon default through a constructor, for all users.


texts:
I'd like to take away the pain from web3 development callback hell and use Promise pattern and async/await keywords on both client side and on Node.js.

Do there exist any web3.js builds or forks that would implement promise pattern instead of callback pattern? E.g. one could say

let result = await myfilter.get()

Instead of:

 myfilter.get(function cb(error, res) {});


texts: Smart Contract send to ETH addresses in CSV?

texts: Does anyone know if it's possible to send tokens from smart contract to ETH addresses you have in CSV spreadsheet?


texts: Are solidity contracts still vulnerable to callstack exploits?

texts:
I was reading the paper at http://www.comp.nus.edu.sg/~loiluu/papers/oyente.pdf and it mentions callstack bugs where since the call depth is set at 1024, a contract may be able to call itself 1023 times, then call a function in a contract and that will fail, eg:

  function CallstackExploit (int counter) {
    if (counter < 1023) {
        if (counter > 0) {
            self.CallstackExploit.gas(msg.gas-2000)(counter+1);
        } else {
            self.CallstackExploit(counter+1);
        }
    } else {
        // finally call a function in another contract after calling self.CallstackExploit 1023 times
    }
  }

Was this fixed? Executing the above function with any value of int < 1023 I get a "bad instruction" error on etherscan.


texts: What are the economic benefits to create an owned blockchain?

texts:
Lot of entity on Ethereum have decided to create their own blockchain and migrate there.

What I can't find online is what are economical advantages on doing this.

Is it related solely to a cheaper gas cost factor or is there more?


texts: Can't deploy contract as I can't input value into "FROM" field

texts: I'm trying to deploy contract through ethereum wallet . But I can't input value into the FROM field . What should I do?


texts: How to have ecrecover return nothing ? I means which value for malformed input?

texts:
I have a contract where the hash value is also the key to unlock the money.

As the full ecrecover parameters are fetched from transaction parameters, and it was compiled in 2016, it is vulnerable to the ECrecoverMalformedInput compiler bug.

But actually what are examples calls to ecrecover() built‑in contract which can make it returns nothing ?


texts:
I need to generate several hundred addresses with eth keys and write them to a file, but only iteration numbers are written to the file, what's the problem?

for(var i = 0; i < amount; i++) {
  fs.appendFileSync('accounts.txt', keys.push(accounts.create(web3.utils.randomHex(32))));
}


texts:
I have a smart contract with the field bytes32[] public listSlas; which contains a list of sha3 hashes.

On top of the smart contract, I have a webapp which needs to retrieve the content of that list (through the library web3js). The content is retrieved thourgh the following getter function.

function getSlas()
    public
    view
    returns(bytes32[])
{
    return listSlas;
}

The function where I add elements to the array is the following:

function createSLA(bytes32 _from, bytes32 _to)
    public
{
    bytes32 hash = keccak256(_from, _to);
    listSlas.push(hash);
}

My problem is that the array randomly 'deletes' some of the previously inserted elements when I push one new element to it. What is the reason?


texts:
I want to verify that a block exists in a trust-less manner - i.e. with on chain validation. This rules out the option of using an oracle.

I'm aware of this function: blockhash(uint blockNumber) returns (bytes32) but it only works for the most recent 256 blocks.

Are there any ideas how this can be done for older blocks?

Also a related question: Is it possible to verify a given `block hash` is valid in a contract? but it's (reasonably) old now and I wanted to know if there are any new thoughts.


texts: How to instantiate a new contract using web3swift

texts:
How do you instantiate a new contract using web3swift? I'm currently invoking the contract methods in the following way:
guard let contract = web3Rinkeby.contract(someABI, at: ethContractAddress, abiVersion: 2) else { return }
guard let transaction = contract.read("getData", parameters: [], transactionOptions: options) else { return }

// or

guard let contract = web3.contract(Web3.Utils.coldWalletABI, at: destinationEthAddress, abiVersion: 2) else { return }
let result = try? transaction.send(password: password, transactionOptions: nil)

I believe I'm able to do this because the ABI contains those methods like getData that I can call, like this:
inputs": [],
"name": "getData",
"outputs": [
{
"components": [
{
"internalType": "string",
"name": "title",
"type": "string"
},

But, the only constructor in the ABI is:
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},

which I don't think is a method I can call.
I've tried:
guard let transaction = contract.method("constructor", parameters: [], extraData: Data(), transactionOptions: options) else { return }

but, doesn't seem to work.
What I'm also confused about is, when I deploy a contract using Truffle, is the contract's constructor being called and instantiated? Or can I continuously instantiate difference instances of that very contract once it is deployed?


texts: No balance after a few days of ETH mining

texts: Ive been mining for 1 day and i still have 0 ETH. I am running a GTX 970 and getting 17 MH/s but after running it for a full 24 hours I got nothing. I've been using MinerGate and running it on a Ubuntu Machine. I tried mining ETH on Windows using MinerGate but i still get the same results. I am still a beginner and this is my first time trying to mine ETH.


texts: solc: [libevmasm/CMakeFiles/evmasm.dir/Assembly.cpp.o] Error 1

texts:
I am trying to install solc v0.4.25 through brew on a Mac. Please note that I was able to install its latest version solc v.0.5.0 using brew install solidity; but I am unable to install its previous version using:

brew install https://raw.githubusercontent.com/ethereum/homebrew-ethereum/9599ce8371d9de039988f89ed577460e58a0f56a/solidity.rb

Please note that I have done sudo mv /opt/local ~/macports.  Is there any alternative way to install solc v0.4.25, which is a previous version.

[Q] How could I overcome this error?

$ brew unlink solidity
$ brew install https://raw.githubusercontent.com/ethereum/homebrew-ethereum/9599ce8371d9de039988f89ed577460e58a0f56a/solidity.rb
######################################################################## 100.0%
Warning: solidity 0.5.0 is available and more recent than version 0.4.24.
==> Downloading https://github.com/ethereum/solidity/releases/download/v0.4.24/solidity_0.4.24.tar.gz
Already downloaded: /Users/alper/Library/Caches/Homebrew/downloads/901e9d034f6a2c114bcf56b7d1d3c73cc05b1890a43928baf3706ebddc1ca66f--solidity_0.4.24.tar.gz
==> cmake . -DCMAKE_C_FLAGS_RELEASE=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG -DCMAKE_INSTALL_PREFIX=/usr/l
==> make install
Last 15 lines from /Users/alper/Library/Logs/Homebrew/solidity/02.make:
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:792:5: note: candidate constructor not viable: requires 3 arguments, but 1 was provided
    basic_string(size_type __n, _CharT __c, const _Allocator& __a);
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:796:5: note: candidate constructor not viable: requires at least 2 arguments, but 1 was provided
    basic_string(const basic_string& __str, size_type __pos,
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:793:5: note: candidate constructor not viable: requires at least 3 arguments, but 1 was provided
    basic_string(const basic_string& __str, size_type __pos, size_type __n,
    ^
2 errors generated.
make[2]: *** [libevmasm/CMakeFiles/evmasm.dir/Assembly.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [libevmasm/CMakeFiles/evmasm.dir/all] Error 2
make: *** [all] Error 2

Do not report this issue to Homebrew/brew or Homebrew/core!

Error: You have MacPorts or Fink installed:
  /sw/bin/fink, /opt/local/bin/port

This can cause trouble. You don't have to uninstall them, but you may want to
temporarily move them out of the way, e.g.

  sudo mv /opt/local ~/macports


texts: I was recently using metamask, an ether wallet, when i noticed something weird.  Upon installation, I attempted to import an external wallet using a seed phrase.  I was told, according to the app, it was a success, however, the public and private address' were different than the foreign wallet's addresses - not a success.  However, when I attempted to use a seed phrase associated with a different metamask wallet the importing into a new metamask wallet was truly successful.  Are seed phrases universal, or just useful within a particular app?


texts: why ethereum wallet keeps on "Downloading new node" and doesn't move to sync or anywhere else?

texts: I 've just installed the wallet from github it all went good but now I m stuck with that downloading new nodes stuff and it doesn't seem to go further to sync or anywhere else. Mac OS X 10.9.5 Mac Pro mid 2012.


texts: Encode data into a single bytes variable using assembly

texts:
I'm currently testing a few things using the Solidity assembly. Basically, what I want to do is

Pack several variables of different type together into one bytes array i.e. similar to what abi.encodePacked would do (I assume)
Write the opposite code that will split the packed message and extract the original variables

The message layout might be something like this

32 bytes :: id
20 bytes :: addressA
20 bytes :: addressB
4 bytes  :: nonce

In essence, I would like to pack the above four variable into on single bytes using assembly and return the it from the function. At the other end, I would also like to use some assembly code to extract those four variables from the packed bytes value.
The encode function will be function(uint256, address, address, uint8)
The decode function will be function(bytes data) returns(uint256, address, address, uint8
I have done some research about using assembly but unfortunately I couldn't find and easy way to accomplish that.


texts: Private chain, two geth miner on the same machine, second miner throws "panic: ethash_full_new IO or memory error"

texts:
I am using geth 1.4.18-stable-c72f5459 on Win7.

I am starting my nodes with the following parameters:

geth.exe --datadir \work\eth\miner2 --nat none --nodiscover --networkid 1999 --mine --port 30304 --ipcpath miner2.ipc

After syncing with the other miner node on the same machine, the second miner crashes when it starts mining itself.

My best guess so far is that the two instances have a collision in AppData\Roaming\Ethash where the DAG is stored. I was looking for an option to pass a different location to geth, but it looks like this path is hard-coded.

panic: ethash_full_new IO or memory error

goroutine 387 [running]:
panic(0xbce660, 0xc0431f4b80)
        /usr/local/go/src/runtime/panic.go:500 +0x1af
github.com/ethereum/ethash.(*dag).generate.func1()
        /go/src/github.com/ethereum/go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go:273 +0x695
sync.(*Once).Do(0xc0433b5860, 0xc043433bd0)
        /usr/local/go/src/sync/once.go:44 +0xe2
github.com/ethereum/ethash.(*dag).generate(0xc0433b5840)
        /go/src/github.com/ethereum/go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go:277 +0x53
github.com/ethereum/ethash.(*Full).getDAG(0xc0421de330, 0xa3, 0xc04343fc80)
        /go/src/github.com/ethereum/go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go:333 +0xa7
github.com/ethereum/ethash.(*Full).Search(0xc0421de330, 0x127d300, 0xc043438900, 0xc04349e240, 0x0, 0x0, 0x0, 0x0, 0x0)
        /go/src/github.com/ethereum/go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go:338 +0x7b
github.com/ethereum/go-ethereum/miner.(*CpuAgent).mine(0xc0433c3720, 0xc0433ac340, 0xc04349e240)
        /go/src/github.com/ethereum/go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/miner/agent.go:121 +0x13a
created by github.com/ethereum/go-ethereum/miner.(*CpuAgent).update
        /go/src/github.com/ethereum/go-ethereum/build/_workspace/src/github.com/ethereum/go-ethereum/miner/agent.go:90 +0x15a


texts:
I'm writing a smart contract which pays orders.

struct OrderStruct {
    address sender;
    uint amountReceived;
}

mapping(bytes32 => OrderStruct) orderStructs;

When I'm wondering if there is any benefit to deleting values from my mapping after they're paid?

delete orderStructs[orderNumber];

Or would it be a waste of gas?


texts: Plasma chain with ERC721 tokens as miner reward?

texts:
Hello ladies and gents,
 Crypto Kitties got me thinking, and I was wondering if it would be possible to host a PoW (or even PoS) Plasma chain, in which the tokens rewarded to participants are non-fungible tokens. Dont have to be ERC721 (although would be great for Atom swaps I think). The idea being that if crypto-kitties wanted to move away from centralization they could create their own plasma chain, and offer a Gen 0 kitty every block to give incentives.

Is this complete non-sense or likely something that is coming for non-fungible collectibles on blockchain?

Thanks for your time.


texts: I have an Ethereum wallet address, but I don't know from which platform.  How can I find out were my wallet is from?


texts: Why would data be passed into a contract constructor rather than just hardcoding it, which would be less costly?

texts:
Doesn't it cost more to pass in variable assignment via a constructor due to changing state?

Wouldn't it be cheaper to just assign them in the code?

I am wondering if there are advantages to using a constructor that I am not considering.

I appreciate any information about the reasons for using a constructor to assign values, as I cannot see why it would be beneficial.

Thanks guys.


texts: Validating Go Ethereum key signature with ecrecover

texts:
Resolved

The basic process flow of what I'm writing goes as follows.

Sign a message with a private key and create an Ethereum address from the private key (AKA the vettingAddress)
Pass the signature constituents to the contract along with a special hashed version of the hashed message (See #Cheking If Correct)

I don't have any problem doing with natively with Go, see below:

Signing With Golang :

func sign(message string, ecdsaKey *ecdsa.PrivateKey) []byte {
    hash := crypto.Keccak256([]byte(message))
    signature, _ := crypto.Sign(hash, ecdsaKey)
}

The resulting signature is validated easily with the Golang Ethereum lib using the following golang code:

Validating / Verifying with Golang :

func validate(ecdsaPubBytes []byte, signature []byte, messageHash []byte) bool {
    return crypto.VerifySignature(ecdsaPubBytes, messageHash , signature[:64])
}

So far so good this work perfectly.

My problem is with validating / verifying with an Ethereum smart contract, I have the following code:

My Golang Code:

type Signature struct {
    Hash [32]byte
    R    [32]byte
    S    [32]byte
    V    uint8
}

func Sign(message string) Signature {
    hashRaw := crypto.Keccak256([]byte(message))
    signature, err := crypto.Sign(hashRaw, ecdsaKey)
    p.errorHandler.Handle(err, "Signature error")

    validationMsg := "\x19Ethereum Signed Message:\n" + strconv.Itoa(len(message)) + message
    println(validationMsg)
    validationHash := crypto.Keccak256([]byte(validationMsg))

    return Signature{
        p.bytes32(validationHash),
        p.bytes32(signature[:32]),
        p.bytes32(signature[32:64]),
        uint8(binary.LittleEndian.Uint32(signature[:65]))+27, // Yes add 27, weird Ethereum quirk
    }
}

Passing to the network

contract, _ := Signature(common.HexToAddress("..."), etherClient)
println(contract.VerifySig(callOpts, sig.Hash, sig.R, sig.S, sig.V, vettingAddress))

My Solidity contract:

pragma solidity ^0.4.20;

library Signature {

    function verify(bytes32 hash, bytes32 r, bytes32 s,  uint8 v, address vettingAddress) internal pure returns(bool)
    {
        return ecrecover(hash, v, r, s) == vettingAddress;
    }
}

The contract is always returning false. There are very few resources for handling ecrecover, I've read this article), but I don't see what I'm doing incorrectly.

EDIT

I've solved this issue. The problem was related to how I parse the 65th byte of the signature. Below was incorrect for a number of reasons:

Parse the Int correctly

uint8(binary.LittleEndian.Uint32(signature[:65]))+27, // Yes add 27, weird Ethereum quirk

Should look like:

uint8(int(signature[65])) + 27, // Yes add 27, weird Ethereum quirk

Don't need a special hash

Also the validation hash was not needed.

p.bytes32(validationHash),

Should be:

p.bytes32(hashRaw),

So all in all the new signature method looked like this:

type Signature struct {
    Raw   []byte
    Hash  [32]byte
    R     [32]byte
    S     [32]byte
    V     uint8
}

func Sign(message string) Signature {
    hashRaw := crypto.Keccak256([]byte(message))
    signature, err := crypto.Sign(hashRaw, p.ecdsa)
    p.errorHandler.Handle(err, "Signature error")

    return Signature{
        signature,
        p.bytes32(hashRaw),
        p.bytes32(signature[:32]),
        p.bytes32(signature[32:64]),
        uint8(int(signature[65])) + 27, // Yes add 27, weird Ethereum quirk
    }
}


texts: Why are there two types of tests in Truffle?

texts:
Can someone help me understand why there's 2 tests in the test directory when using Truffle, for the default configuration?

There's metacoin.js and TestMetaCoin.sol.

What can one test with metacoin.js (or Javascript in general) that you cannot achieve with TestMetaCoin.sol (Solidity contracts) and vice versa?


texts: Transaction failed but funds lost? (MEW)

texts:
I sent some REQ to another of my addresses (via MEW) but it failed for some reason. The funds left my first wallet and did not reach my second, and they haven't been sent back. So now they're lost?

Can I retrieve them somehow? https://etherscan.io/tx/0x90d324abd889e4b40b137b88cf06154abc4b1f1148b4e843ee1a50326c6c4d08


texts: Can I store secure information on an ERC20 coin?

texts: Is it possible to store secure data on an ERC20 coin that is only accessible by the owner of that coin? An example might be a coin that contains login credentials to a service.


texts:
I don't understand why if i execute my function with web3.js i obtain this error in the transaction:

Warning! Error encountered during contract execution [Bad instruction]

I read this other question about the same error. I don't understand why with this code its happening the same:

contract Music is owned{

    string public themeMusic;
    string public idMusic;
    int public money;

    function Music (string setThemeMusic, string setIdMusic, int setmoney) {
        themeMusic = setThemeMusic;
        idMusic = setIdMusic;
        money = setmoney;
    }

    function setMoney(int moneyUpdate) onlyOwner {
        money = moneyUpdate;
    }
}

The error is with the setMoney function, is for the onlyOwner? i need to make it payable anyway? I don't want to make it payable, just only use it for set the money and this function only for the owned.

More information:

I make other contracts with similar functions and don't have this problem.
This contract is created by other contract like the typical example Factory.
Owned is a contrac where i store the address and test if is the owner.
I'm using Meteor.js and Web3.js.

How do you interact with the contract? For interact with the contract i'm using the Web3.js APi of ethereum.

What command do you use? I'm defining the contract with the ABI and the address of the contract like this myContract = web3.eth.contract(ABIArray).at(contractAddress); and then i call the function of the contract like this myContract.setMoney(money); (and the callback function).

Do you use production blockchain? I'm working in Ropsten Test-net.

My Music company:

contract musicCompany is owned {

    address[] public listofmusic;

    function addMusic(string setThemeMusic, string setIdMusic, int setmoney) onlyOwner {
        address newMusic = new Music(setThemeMusic, setIdMusic, setmoney);
        listofmusic.push(newMusic);
    }
}

This contract can create a new Music contracts.

My Owned contract:

contract owned {

    address public owner;

    function owned() {
        owner = msg.sender;
    }

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

}

My Web3.js code:

'click .setMoney'(event, instance) {
     var price = document.getElementById('priceUpdate').value;
     event.preventDefault();
     alert("contract price");
     myContract.setMoney(price, function(error, result){
      if(!error)
          console.log(result);
      else
          console.error(error);
      })

Screenshot of the metamask transactions without any problem:

Screenshot of the EtherScan.io transaction with the error:

Update 1: I try using unsigned integers and bytes32 instead of int, the result is the same. Maybe the problem is in the modifier, could it be?

Update 2: I tried to delete the onlyOwnermodifier of the function and doesn't work ...

Update 3: I tried to delete all the modifier, is owned and onlyOwner and still doesn't working. I think the problem is with the builder function, i will starting now to make test with it...

Update 4: By doing Test, i know that moneyUpdate have the value correctly and money the same, but I have discovered that the value of money don't change. And I have discovered too that when i print the result variable of my callback inside "My Web3.js code" i obtain the adress of the transaction 0x0fda5d31d02c87aa20c45a54f6859c7576b4f0aae4a639c47ec23e5c4e3d9953.  In principle, the transaction is performed but the error prevents the change.

Some transactions (all are mine) for view the error:

0x52ef9164750c4e174cba1a5f45343220458f1cedca25380f0aaf102df0a8f895

0x4e00d9d67ffb906e0036434ea2e14acea82a6aabb4d8c99d94c0b2bcdef24f7a

0x4663fa874993d54989d073f72d6846cae652a454349e62882dccc96d78528a8e

0x69fbf54ffd81ee114efcd750d4e97bb528ecc868140abdecf218e9ae66391a5


texts: How can I safely exchange Bitcoins for Ethers?

texts: I would like to sell Bitcoins and buy Ethers. I know there are some exchange websites, but I cannot tell which are trustworthy. What are safest and easiest ways to sell Bitcoins and buy Ethers?


texts:
I have the following statements:

Voter sender = voters[msg.sender];
if (!sender || sender.voted) throw;

I'm new to solidity, so I might not be aware of how (or if) coercion works.

As I found out in this question,

  [...] every possible key exists and is mapped to a value whose byte-representation is all zeros [...]

Knowing that, shouldn't the !sender statement above return true?


texts: How can I know if a token that I created is used in a smart contract?

texts: I plan on creating some tokens and want to create code that will execute if the one of the tokens is used within a smart contract. Is this possible?


texts: Does an online crypto wallet actually store crypto currency?

texts:
I have done some code with web3 and smart contracts and I've realised that you don't have to store your currency anywhere, because it is already there; it can be read from anywhere.
That made me somewhat confused. Because "wallets" as the name suggests are supposed to store the currency itself.
That made me think that online crypto wallets are only used to send and receive, but not "store". Is that true? Or they actually store the currency.


texts: How is a contract determined to be ERC20 compliant?

texts:
How is it exactly determined whether a contract is ERC20 compliant and who determines it? After reading Do I have to implement ERC20 signature as separate contract and use inheritance? and some googling, I have some ideas.

1) Who decides whether a contract is ERC20 compliant? Is it just the one who wants to use it (exchange, wallet, ...)?

2) How do you determine whether a contract is ERC20 compliant? My current understanding is that all you need is to have the right function signatures (right function hashes). So it doesn't exactly have to inherit (implement) from an ERC20 interface. Is that correct?

3) If the answer to the second question is "yes", is it ok to add for example payable modifier to some of the functions (as I've understood, it wouldn't change the hash of the function)?

If the answer to question 2 and 3 is "yes", then the following would be a valid implementation of ERC20 standard (assuming the rest of the functions are implemented also):

contract A {
  ...
  function transfer(address to, uint tokens) public payable returns (bool success) {
    ...
  }
  ...
}


texts: What is the purpose of giving name to return variables in function declaration?

texts:
How is this :

function myFunc() returns(uint a){}

different from this:

function myFunc() returns(uint){}


texts:
I wrote my own contract. Here it is:

  pragma solidity ^0.4.4;
contract SafeMath{
  function safeMul(uint a, uint b) internal pure returns (uint) {
    uint c = a * b;
    assert(a == 0 || c / a == b);
    return c;
  }

  function safeDiv(uint a, uint b) internal pure returns (uint) {
    assert(b > 0);
    uint c = a / b;
    assert(a == b * c + a % b);
    return c;
  }

    function safeSub(uint a, uint b) internal pure returns (uint) {
        assert(b <= a);
        return a - b;
  }

    function safeAdd(uint a, uint b) internal pure returns (uint) {
        uint c = a + b;
        assert(c >= a);
        return c;
  }

}

contract ERC20{

uint256 public totalSupply;
  function balanceOf(address who) public view returns (uint256);
  function transfer(address to, uint256 value) public returns (bool);
  event Transfer(address indexed from, address indexed to, uint256 value);

 function allowance(address owner, address spender) public view returns (uint256);
  function transferFrom(address from, address to, uint256 value) public returns (bool);
  function approve(address spender, uint256 value) public returns (bool);
  event Approval(address indexed owner, address indexed spender, uint256 value);

}

contract TestIco is ERC20, SafeMath{

    mapping(address => uint256) balances;

    uint256 public totalSupply;

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

    function transfer(address _to, uint256 _value) public returns (bool success){
        balances[msg.sender] = safeSub(balances[msg.sender], _value);
        balances[_to] = safeAdd(balances[_to], _value);
        Transfer(msg.sender, _to, _value);
        return true;
    }

    mapping (address => mapping (address => uint256)) allowed;

    function transferFrom(address _from, address _to, uint256 _value) public returns (bool success){
        var _allowance = allowed[_from][msg.sender];

        balances[_to] = safeAdd(balances[_to], _value);
        balances[_from] = safeSub(balances[_from], _value);
        allowed[_from][msg.sender] = safeSub(_allowance, _value);
        Transfer(_from, _to, _value);
        return true;
    }

    function approve(address _spender, uint256 _value) public returns (bool success) {
        allowed[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
        return true;
    }

    function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
        return allowed[_owner][_spender];
    }

    uint256 public endTime;

    modifier during_offering_time(){
        require(now <= endTime);
        _;
    }

    function () public payable during_offering_time {
        createTokens(msg.sender);
    }

    function createTokens(address recipient) public payable {
        require(msg.value != 0);

        uint tokens = safeDiv(safeMul(msg.value, price), 1 ether);
        totalSupply = safeAdd(totalSupply, tokens);

        balances[recipient] = safeAdd(balances[recipient], tokens);

        //require(owner.send(msg.value));
    }

    string  public name = "TestIco";
    string  public symbol = "SCO";
    uint    public decimals = 3;
    uint256 public INITIAL_SUPPLY = 10000;
    uint256 public price;
    address public owner;

    function TestIco() public {
        totalSupply = INITIAL_SUPPLY;
        balances[msg.sender] = INITIAL_SUPPLY;  // Give all of the initial tokens to the contract deployer.
        endTime = now + 1 weeks;
        owner   = msg.sender;
        price   = 500;
    }

}

I use Remix to test the code. The problem is that it always give me 3 constant warning:

use of "now": "now" does not mean current time.
Fallback function of contract  requires too much gas ().
Gas requirement of function INITIAL_SUPPLY(), allowance, approve, balanceOf, createTokens, decimals, endTime, name, unknown, owner, price, symbol, totalSupply... or not constant.


texts: Does each shard in Ethereum 2.0 have its own address space?

texts:
Sharding is planned for Ethereum 2.0, which will split the state into a few hundred shards, connected along a hypercube network topology.

Does each shard have its own address space, or, is there a global address space?


texts: Request has been rejected because of queue limit

texts:
I'm trying to deploy a simple smart contract to my playground on parity/Etherium. I finally managed to run authority and member nodes and I have written code that calls smart contract method. However, when I run it I always get subj error.

I have given 10 billions of ethereum to the account, I'm able to perform actions from Parity UI, but I'm not able to execute this code from application.

My code, for reference:

var web3 = new Web3(_ethereumSettings.ParityConnectionString);
var contract = web3.Eth.GetContract(_ethereumSettings.FactoryAbi, _ethereumSettings.FactoryContractAddress);
var getAddressFunction = contract.GetFunction("newEntity");
object guid = Guid.NewGuid().ToByteArray();
await getAddressFunction.SendTransactionAndWaitForReceiptAsync(_ethereumSettings.AccountAddress,
                                                               functionInput: new[]
                                                                   {guid});

What's wrong? I just want to use blockchain as storage for all my transaction so I have to make this account have unlimited access to everything, but I'm stuch with "queue limit is full", even when there is almost no pending transactions in my playground.


texts: What is the best way to get balance and send ERC-20 token using web3j?


texts: Fetching an inputted contract address's token price

texts:
I'm looking to fetch the inputted tokenAddress's token price, from say a uniswap eth pair, and return it.
Any idea how to do this?
contract Initialise {
    using SafeMath for uint;

    mapping(address => userData) users;             // user address assigned to personal info sheet

    struct userData {
        uint256 _initialInstallmentAmount;           // the amount the user is initialising with
        uint256 _remainingInstallmentCount;          // a count of the remaining instalments to pay
        uint256 _debtAmount;                         // the amount of funds to repay in total
        uint256 _nextInstallmentDueDate;             // the block number the next instalment is due by, otherwise it is terminated
        bool _contractTermination;                   // if user doesn't pay before `_nextInstallmentDueDate`, contract is terminated
    }

    function viewConversion (uint256 ethAmount, address tokenAddress)
        external
        view
        returns (
            uint256 ethAmountInputted,
            address tokenAdressInputted,
            uint256 amountOfTokensConvertible
        ) {
            // fetch token address's price
            // div ethAmount by token price
            // return above.
    }

I assume it would be something like this:
function viewConversion (uint256 ethAmount, address tokenAddress)
    external
    view
    returns (
        uint256 ethAmountInputted,
        address tokenAdressInputted,
        uint256 amountOfTokensConvertible
    ) {
        // call function of uniswap to get price of (tokenAddress);
        // uint256 convertibleAmount = tokenAddress.price.div(ethAmount)
        // return x, y, z
}


texts: Why does return address(player) return a weird string?

texts: I am trying to get the player's address through front end and when I run through the solidity function that should return the player's address, it would return 41fdc7dcc7846a7fb2b09712221ebf2fb38ca3056c instead. Is there something I need to do in solidity before I can return it? Thanks!


texts: Potential security issues warning banners with Ethereum

texts:
I'm testing ethereum and the foundation websites states that

  Frontier is an early access to the Ethereum network. Bugs and security
  issues might be present. Before downloading you have to agree to the
  terms that follow and the full terms linked below.

I understand bugs but what kind of security issues are they referencing to? That all ones ether can be lost? So far, I have not purchased any ether, so I guess even if I purposefully wanted to, I could not do anything that would be dangerous in any way. If anything else, what should I definitely not do before I understand the technology better?


texts: Function modifier effect on return value

texts:
Having the following code

pragma solidity ^0.6.4;

contract TestModifier {

    mapping (address => bool) public authorities;
    mapping (address => address) public authorized;

    modifier onlyAuthorized(address _user) {
        require(authorities[authorized[_user]], "Requires authorization");
        _;
    }

    // returns false
    function getStatus1(address _user) external view returns (bool) {
        return authorities[authorized[_user]];
    }

    // returns true
    function getStatus2(address _user) external view onlyAuthorized(_user) returns (bool) {
        return authorities[authorized[_user]];
    }

    // returns true
    function getStatus3(address _user) external view onlyAuthorized(_user) returns (bool) {
        return true;
    }
}

Given any address as the input to getStatus functions, I expect to see false as the return value for the first one and an error for the other two. However, getStatus1 returns false and two others return true.

The documentation states

  In an earlier version of Solidity, return statements in functions having modifiers behaved differently.

Is there any better explanation for this behavior?

NodeJS Test

const Web3 = require('web3');

const abi = [{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"authorities","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"authorized","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getStatus1","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getStatus2","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getStatus3","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}];
const address = "0x2e2d61Cb7725b5d381879030d308508d26759aDC";

/************ TESTING Ropsten ***********/
const web3Ropsten = new Web3("https://ropsten.infura.io/v3/17a6aa646dfb46ab880ff2c8aa24cbea");
const contractRopsten = new web3Ropsten.eth.Contract(abi, "0x4457f104861f09240d09d857987290f928d09a1e");

contractRopsten.methods.getStatus1(address).call({}, function(error, result){
    console.log("Ropsten::status1: ", result);
});
contractRopsten.methods.getStatus2(address).call({}, function(error, result){
    console.log("Ropsten::status2: ", result);
});
contractRopsten.methods.getStatus3(address).call({}, function(error, result){
    console.log("Ropsten::status3: ", result);
});

/************ TESTING Kovan ***********/
const web3Kovan = new Web3("https://kovan.infura.io/v3/17a6aa646dfb46ab880ff2c8aa24cbea");
const contractKovan = new web3Kovan.eth.Contract(abi, "0x552748c93a38939f1330629a3016a97accd6d0d9");

contractKovan.methods.getStatus1(address).call({}, function(error, result){
    console.log("Kovan::status1: ", result);
});
contractKovan.methods.getStatus2(address).call({}, function(error, result){
    if (error) {
        console.error("Kovan::status2: ", error.message);
    } else {
        console.log("Kovan::status2: ", result);
    }
});
contractKovan.methods.getStatus3(address).call({}, function(error, result){
    if (error) {
        console.error("Kovan::status3: ", error.message);
    } else {
        console.log("Kovan::status3: ", result);
    }
});


texts: UnhandledPromiseRejectionWarning: Error: Returned error: The method eth_sendTransaction does not exist/is not available

texts:
var Web3 = require('web3')

var url = 'https://rinkeby.infura.io/v3/cadc6b0dc5c54720b973b3720eab5584'

var web3 = new Web3(url)

var RemixContract = new web3.eth.Contract([
    {
        "constant": false,
        "inputs": [
            {
                "name": "x",
                "type": "string"
            }
        ],
        "name": "setMessage",
        "outputs": [],
        "payable": false,
        "stateMutability": "nonpayable",
        "type": "function"
    },
    {
        "constant": true,
        "inputs": [],
        "name": "getMessage",
        "outputs": [
            {
                "name": "",
                "type": "string"
            }
        ],
        "payable": false,
        "stateMutability": "view",
        "type": "function"
    }
],'0x7Cad41DAc15e54051c387895541875B46932fa09',{from:'0x84809AC58F7476Ba7A6F8BF2C66896d0fa59F6f6'});

RemixContract.methods.setMessage("Again").send()

Here is my contract

pragma solidity ^0.4.24;

contract Message {
    string myMessage;

    function setMessage(string x) public {
        myMessage = x;
    }

    function getMessage() public view returns (string) {
        return myMessage;
    }
}


texts: Parity Error: Account not found for the current chain (Kovan)

texts:
I am having problem starting Parity with a account that I created using Metamask. This account 0x76Eb17471A5fb78EF6768254D1dAEc528ec6b5a8 has received multiple ETH from Kovan faucets.

Running the following in Windows 10

  parity --chain kovan --unlock 0x76Eb17471A5fb78EF6768254D1dAEc528ec6b5a8 --password password.txt

Gives the error

  Account 76eb…b5a8 not found for the current chain. You can create an account via RPC, UI or parity account new --chain kovan --keys-path C:\Users\test\AppData\Roaming\Parity\Ethereum\keys.

But this account does exist in the Kovan chain! Whats the problem here?

2017-09-17 19:01:01  Starting Parity/v1.7.0-beta-5f2cabd-20170727/x86_64-windows-msvc/rustc1.18.0
2017-09-17 19:01:01  Keys path C:\Users\test\AppData\Roaming\Parity\Ethereum\keys\Kovan
2017-09-17 19:01:01  DB path C:\Users\test\AppData\Local\Parity\Ethereum\chains\kovan\db\9bf388941c25ea98
2017-09-17 19:01:01  Path to dapps C:\Users\test\AppData\Roaming\Parity\Ethereum\dapps
2017-09-17 19:01:01  State DB configuration: fast
2017-09-17 19:01:01  Operating mode: active
Account 76eb…b5a8 not found for the current chain. You can create an account via RPC, UI or `parity account new --chain kovan --keys-path C:\Users\test\AppData\Roaming\Parity\Ethereum\keys`.


texts: How to send several arguments to an solidity function using an array or a dictionary?

texts:
Sorry in advance for my english I am French :)

I try to create a simple ethereum wallet. The idea is to allow the user to create a contract and to interact with it. I am using meteor, web3 and an testRPC node.

Basically for the interactions with the contract, for each contract I print on the browser the list of its functions . The user has just to click on the function he wants, then a pop up is printed to retrieve the arguments of the functions. Then I use web3 to send the request to a testRPC node and use a callback to print the result for the user.

The problem is that basically I don't obviously know in advance what is the function and the arg. So I index each of my html file with a special number and in combination with the dataBase, I retrieve the address of the contract, and all the informations about the function (using the ABI). Then I create three variables :

a variable contract
a variable functionPrototype = abi of my function
a dictionary args = {nameArg1 : arg1, nameArg2 : arg2 etc...}
which    contains my arguments.

Then I have the contract, the name of the function and the args.

If the original Solidity function is :

function whatever(type nameArg1, type nameArg2) public{}

I would like to use the following web3 function to send my request:

contract[functionPrototype.name](args, {from: account, gas: 350000},
function(err, result){})

But this request doesn't work . The following request, when I write all the args, works :

contract[functionPrototype.name](arg1, arg2, {from: account,
gas: 350000}, function(err, result){})

So the people can say : why you don't use the second request?

Because there are an infinite number of functions and I can't write all the arguments for each function. I need to automate all the process, so basically retrieve the arg and the name of the functions and using as input a dictionary or an array.

I have tried to use the function apply, with an array but it doesn't work either. I have all the time a WebSocket is closed due to suspension.

So do you know how I can send my arguments using a dictionary or an array to a solidity function?

Merci beaucoup!!!

And good luck for your jobs


texts: getting full pending transactions from Infura

texts:
I use Infura to get all pending transactions from Ropsten:

web3.eth.subscribe('pendingTransactions', async (error, txHash) => {
    let tx = getTransaction(txHash)
    ...
}

With this subscription, I receive only the transaction hashes, so I must make a request to get each transaction.

My question: is there a way to receive the full pending transactions with a simple subscription ?


texts: Hostile Takeover Of Minted Coin In Crowdsale

texts:
I am querying the warning on new crowd sales where minted tokens are made as per this guide: https://www.ethereum.org/crowdsale which reads as follows:

Once you published the crowdsale contract, get its address and go into your Token Contract to execute a Change Ownership function. This will allow your crowdsale to call the Mint Token function as much as it wants.
Warning: This opens you to the danger of hostile takeover. At any
point during the crowdsale anyone who donates more than the amount
already raised will be able to control the whole pie and steal it.
There are many strategies to prevent that, but implementing will be
left as an exercise to the reader:
Modify the crowdsale such that when a token is bought, also send the
same quantity of tokens to the founder's account so that they always
control 50% of the project Modify the Organization to create a veto
power to some trusted third party that could stop any hostile proposal
Modify the token to allow a central trusted party to freeze token
accounts, so as to require a verification that there isn't any single
entity controlling a majority of them

Am I correct in understanding that the reason behind this is based on the assumption that a DAO will have by default a 50% majority vote to alter the DAO constitution?


texts: How can I securely generate a random number in my smart contract at POA?

texts:
I heard that a block of random function results can be dropped by a malicious miner.

Can POA prevent this?

How can I securely generate a random number in my smart contract?


texts: Contract event - transactionIndex and logIndex

texts:
I need to monitor contract events and perform off-chain processing. How do I uniquely identify a contract event? Can I use a combination of these fields?
- transactionHash
- transactionIndex
- logIndex

I supposed I cannot use transactionHash alone because 1 transaction may emit multiple events. IMO, the documentation https://github.com/ethereum/wiki/wiki/JavaScript-API#contract-events doesn't describe the fields transactionIndex and logIndex well.


texts: creating multi signature address in solidity

texts: How can I create an array of multi-signature address (2-of-2 P2SH multisig, keeping one account on all the multi-signature account constant)  in web3js  or solidity so that my custom token can be transferred to all created account on creation? The token should be spent only after verification of both the account.


texts: How to transfer POLS token from Metamask Eth wallet to DOT wallet?

texts: Could anyone describe the procedure of transferring POLS token from Eth Metamask wallet to DOT wallet (for example polkadot{.js}) wallet?


texts: Errors in computation of blockchain algorithms, are detectable?

texts:
There is a class of fault-tolerant methods named Algorithm Based Fault Tolerance (ABFT), which augments input data with redundancy. Then if any errors occurs when those data are processed, just be inspecting the output (and the redundant information) you can tell with good confidence if the results are correct or not.

Is there similar method with small overheads to detect if there are
computational errors while the processor (e.g. mining machine) runs
blockchain related algorithms?


texts: Ethereum transaction taking forever? From MEW to IDEX wallet

texts:
new to IDEX and mew, but I hooked up my MEW wallet to IDEX and than deposited ethereum to my IDEX wallet with the default gwei,

just wondering why its taking so long? its been 4 hours and no progress has been made, currently sitting at 1100 confirmations...

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


texts: how to sign a smart contract and transaction.If somebody does not sign the contract,does it means that he is or not part of the network?

texts: Let's say peer A creates a smart contract and deploys it. If peer B wants to sign that contract how he will be able to do it? Also if peer A wants to send a transaction how he will be able to sign the transaction using his private key? If peer B does not sign the contract created and deployed by peer A,does it mean peer B won't be part of the network.


texts: Txpool not executing pending transactions

texts:
here is our geth command
screen geth console --rpc --rpcapi "eth,net,web3,debug,personal" --cache 8192 --allow-insecure-unlock --txpool.accountslots 4096 --txpool.accountqueue 4096 --txpool.globalqueue 4096 --txpool.globalslots 4096 --cache.database 60

We are sending a lot of txs in a day but we have to keep restarting our node because of stuck pending transactions. Pending transactions are not queueing. Any reason for this?


texts: How to use local Metamask account with Infura Node

texts:
I'm building a DApp using web3js that sends ERC20 Tokens from a browser Metamask account to an escrow contract on the Rinkeby testnet. I'm using a Rinkeby node from Infura, and when I call web3.eth.accounts[0] or web3.eth.getAccounts(), they both return an empty array. I did some digging and figured that since I'm connected to Infura I can't use local accounts. Is there any way to circumvent this? I tried manually providing the account address but that didn't work either.

EDIT:
I want to use the accounts already in a client's browser in the metamask extension


texts: Calling Protected Function From Another Contract

texts:
I am trying to call a function in another contract, that is protected with an openzepellin Role library.

I am calling availableFunction on the javascript side, which in turn calls protectedFunction. Even though I pass the adminRole address to the constructor of contract B, and then call availableFunction with adminRole, the function reverts.

In A.sol

contract interfaceB {
  function protectedFunc() public;
}

contract A {
  B b;

  constructor(address _B) {
    b = new interfaceB(_B);
  }

  function availableFunction() {
    b.protectedFunc();
  }
}

In B.sol

contract B {
  using Roles for Roles.Role;
  Roles.Role private adminRole;

  constructor(address _adminRole) public {
    adminRole.add(_adminRole);
  }

  function protectedFunc() public {
    require(adminRole.has(msg.sender), "DOES_NOT_HAVE_ADMIN_ROLE");
    ...
  }

}

In A.test.js

const A = artifacts.require("A");
const B = artifacts.require("B");

contract("A", function ([_, adminRole]) {
  beforeEach(async function () {
    b = B.new(adminRole);
    a = A.new(b.address);

  }
  describe("availableFunc", function () {
    it("should pass!", async function () {
      a.availableFunc({from: adminRole)}); // REVERTS!
    })
  }
})

Error: Returned error: VM Exception while processing transaction: revert DOES_NOT_HAVE_ADMIN_ROLE


texts: dApps being required to explicitly ask for access to web3(when using MetaMask)

texts: Injecting web3 into the dapp is done automatically,when using MetaMask. Web pages get access to the Blockchain when using metamask in their browser, to read addresses for tranactions, and other functionality. If the injection is not automatic(this makes for a more secure, private entry point) would one have to use an API to inject Web3 in the dapp- what would be the entry point to web3 in that case for dapps?


texts:
anyone knows how to build the mix IDE? I found no info on this in the README or elsewhere.
When I try to build master via cmake I am getting:

 ➜  3rd cmake mix
-- The C compiler identification is GNU 5.3.1
-- The CXX compiler identification is GNU 5.3.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:23 (include):
  include could not find load file:

    EthDependencies

CMake Error at CMakeLists.txt:24 (include):
  include could not find load file:

    EthExecutableHelper

CMake Error at CMakeLists.txt:25 (include):
  include could not find load file:

    EthCompilerSettings

SRC_LIST: ./src/QFunctionDefinition.cpp;./src/QContractDefinition.cpp;./src/Exceptions.cpp;./src/MixApplication.cpp;./src/QVariableDeclaration.cpp;./src/ClientModel.cpp;./src/QEther.cpp;./src/InverseMouseArea.cpp;./src/QVariableDefinition.cpp;./src/HttpServer.cpp;./src/main.cpp;./src/DebuggingStateWrapper.cpp;./src/FileIo.cpp;./src/QBigInt.cpp;./src/CodeModel.cpp;./src/MixClient.cpp;./src/QBasicNodeDefinition.cpp;./src/Clipboard.cpp;./src/SortFilterProxyModel.cpp;./src/CodeHighlighter.cpp;./src/Web3Server.cpp;./src/ContractCallDataEncoder.cpp
CMake Warning at CMakeLists.txt:50 (find_package):
  By not providing "FindEth.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Eth", but
  CMake did not find one.

  Could not find a package configuration file provided by "Eth" with any of
  the following names:

    EthConfig.cmake
    eth-config.cmake

  Add the installation prefix of "Eth" to CMAKE_PREFIX_PATH or set "Eth_DIR"
  to a directory containing one of the above files.  If "Eth" provides a
  separate development package or SDK, be sure it has been installed.

CMake Warning at CMakeLists.txt:51 (find_package):
  By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Core", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Core" with any
  of the following names:

    Qt5CoreConfig.cmake
    qt5core-config.cmake

  Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
  "Qt5Core_DIR" to a directory containing one of the above files.  If
  "Qt5Core" provides a separate development package or SDK, be sure it has
  been installed.

CMake Warning at CMakeLists.txt:52 (find_package):
  By not providing "FindQt5WebEngine.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "Qt5WebEngine", but CMake did not find one.

  Could not find a package configuration file provided by "Qt5WebEngine" with
  any of the following names:

    Qt5WebEngineConfig.cmake
    qt5webengine-config.cmake

  Add the installation prefix of "Qt5WebEngine" to CMAKE_PREFIX_PATH or set
  "Qt5WebEngine_DIR" to a directory containing one of the above files.  If
  "Qt5WebEngine" provides a separate development package or SDK, be sure it
  has been installed.

CMake Error at CMakeLists.txt:59 (qt5_add_resources):
  Unknown CMake command "qt5_add_resources".

-- Configuring incomplete, errors occurred!
See also "/home/ligi/git/3rd/CMakeFiles/CMakeOutput.log".

when building develop:

➜  3rd cmake mix
CMake Error at CMakeLists.txt:8 (include):
  include could not find load file:

    EthPolicy

CMake Error at CMakeLists.txt:9 (eth_policy):
  Unknown CMake command "eth_policy".

-- Configuring incomplete, errors occurred!
See also "/home/ligi/git/3rd/CMakeFiles/CMakeOutput.log".


texts: How can i make payment application using the blockchain?

texts: i want to make payment based application by scratch using blockchain, so where can i learn from scratch and what are the different component that i should learn to make an application or a website solely?


texts: How to work around warnings of infinite gas requirements for this function

texts:
This is the warning
Gas costs: Gas requirement of function SimpleStorage.data is infinite: If the gas requirement of a function is higher than the block gas limit, it cannot be executed. Please avoid loops in your functions or actions that modify large areas of storage (this includes clearing or copying arrays in storage)  Pos: 4:4:
Gas costs: Gas requirement of function SimpleStorage.set is infinite: If the gas requirement of a function is higher than the block gas limit, it cannot be executed. Please avoid loops in your functions or actions that modify large areas of storage (this includes clearing or copying arrays in storage)  Pos: 6:4:
Gas costs: Gas requirement of function SimpleStorage.get is infinite: If the gas requirement of a function is higher than the block gas limit, it cannot be executed. Please avoid loops in your functions or actions that modify large areas of storage (this includes clearing or copying arrays in storage)  Pos: 10:4:
My code:
pragma solidity ^0.6.6;

contract SimpleStorage{
    string public data;

    function set(string memory _data) public {
        data = _data;
    }

    function get()view public returns (string memory){
        return data;
    }
}

From what I have seen the warning arises since strings can be very big, so how is this resolved?


texts: How do you send Ether as a function to a contract using Remix?

texts:
New to Solidity...

When deploying a contract on a private blockchain using Remix, I am unable to execute payable functions. When executing these functions, the following error message displays: gas required exceeds allowance or always failing transaction.

The code was obtained from here and modified for the purpose of study.

pragma solidity ^0.4.17;

contract depositTest {

    uint256 public fee = 2000000000000000000 wei;

    function depositUsingParameter(uint256 deposit) public payable {  //deposit ETH using a parameter
        require(msg.value == deposit);
        deposit = msg.value;
    }

    function depositUsingVariable() public payable { //deposit ETH using a variable
        require(msg.value == fee);
        fee = msg.value;
    }

    function getContractBalance() public view returns (uint256) { //view amount of ETH the contract contains
        return address(this).balance;
    }

    function withdraw() public { //withdraw all ETH previously sent to this contract
        msg.sender.transfer(address(this).balance);
    }

    function() public payable {
    // this function enables the contract to receive funds
    }
}


texts:
Is it possible to develop IoT auth system based on smart contracts? (and how it have to work)
And what will be pros and cons against another systems?
Could someone explain this?


texts: Why does this contract work on Ropsten but not on a private blockchain?

texts:
The following contract runs successfully in Ropsten but not on a private blockchain. I assumed it could be a gas issue. So I increased the gaslimit and started a new blockchain but I get the same issue.

The txn runs but the array called contracts is not updated.

It is not the contract code but the private blockchain. How should I check this to find the error?

Contract

pragma solidity ^0.4.18;

contract RegisterContract {

    uint public contractWeight;
    mapping(bytes32=>string) public contracts;

    function addContract ( string jsonInput, bytes32 hashKey) public {
        contracts[hashKey] = jsonInput;
    }

    function addWeight (uint weight) public {
        contractWeight = weight;
    }
}

Txns -

      eth.pendingTransactions [{
          blockHash: null,
          blockNumber: null,
          from: "0x46fb9a22689c4a4bfb494baeafbb8b2993725305",
          gas: 4700388,
          gasPrice: 100000000000,
          hash: "0xa441d958c487cf2b80f1ecdeba15c7b17899d9c632a280ba429c394d7835ba06",
          input: "0x4c228d4400000000000000000000000000000000000000000000000000000000000000403966383664303831383834633764363539613266656161306335356164303135613362663466316232623062383232636431356436633135623066303061303800000000000000000000000000000000000000000000000000000000000000047465737400000000000000000000000000000000000000000000000000000000",
          nonce: 788,
          r: "0xd9243d6f2c4610a67510083a74f3ed70a1b7a3e576d7da0722c4336b2f40070b",
          s: "0x5f0de0653daf4a74f04eb8854dd46847466e133a01f5ff559c2e629c0ffa2291",
          to: "0xfb63afbe6798270daaa61ba19122c346fb57affb",
          transactionIndex: 0,
          v: "0x2b693",
          value: 0 }]
      eth.pendingTransactions []
      con.contracts("9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08")

    ""

      eth.getTransactionReceipt("0xa441d958c487cf2b80f1ecdeba15c7b17899d9c632a280ba429c394d7835ba06")
      {   blockHash:
      "0x0a62b865d8b6887fa0760779443b0584161ae9320b2073ef403ee13c02516a2b",
      blockNumber: 263081,   contractAddress: null,   cumulativeGasUsed:
      4700388,   from: "0x46fb9a22689c4a4bfb494baeafbb8b2993725305",
      gasUsed: 4700388,   logs: [],   logsBloom:
      "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
      root:
      "0xbf67affe7553839628f283b8436fbba2f1c39b8aff8d270c767cfa8ac4054bde",
      to: "0xfb63afbe6798270daaa61ba19122c346fb57affb",   transactionHash:
      "0xa441d958c487cf2b80f1ecdeba15c7b17899d9c632a280ba429c394d7835ba06",
      transactionIndex: 0 }


texts: How to check transaction situation via CLI

texts: I did a transaction and got transaction hash. How can I check this transaction is mined (or confirmed) via CLI (command-line interface) ? What is related command for this? Here is transaction hash that i received: 0x0e16981f972c8069398a7aa6c6402b8183063cfd157c3714582101e3ee071a30


texts: Deploying a contract to Parity via Web3.js

texts:
I am trying to deploy a contract to Parity via Web3.js.

Here is my code:

let fs = require("fs");
let Web3 = require('web3');

let NODE_URL = "http://localhost:8545";
let OWNER_ADDRESS = "0x...";

let web3 = new Web3(new Web3.providers.HttpProvider(NODE_URL));

async function deploy(contractName, contractArgs) {
    let abi = fs.readFileSync(contractName + ".abi").toString();
    let bin = fs.readFileSync(contractName + ".bin").toString();
    let tx = {from: OWNER_ADDRESS, gas: 2310334, data: "0x" + bin};
    return await web3.eth.contract(JSON.parse(abi)).new(...contractArgs, tx);
}

deploy("MyContract", []);

When I execute it (with NodeJS), it pends forever.

Then, when I open Parity GUI, I see a popup window asking me to sign the transaction.

How can I sign this transaction programmatically (i.e., as part of my code)?

I think I need to use the web3.eth.signTransaction function with the tx object and my private key, but I haven't been able to figure out how.

Thank you!!!

UPDATE:

I got the general idea from this post, which suggest:

  before contract.new(params) please unlock an account

It then provides the following code:

curl --data '{"method":"personal_unlockAccount","params":["0xXX","your password",null],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545

But I'm not really sure what exactly I'm supposed to do with this piece of code, how to run it, etc (I'm on Windows for all it matters).

UPDATE #2:

OK, I've made some progress on this.

The equivalent of the curl command above can be added to my NodeJS script as:

let http = require("http");

let data = '{"method":"personal_unlockAccount","params":["0xMyAccount","My Password",null],"id":1,"jsonrpc":"2.0"}';

let options = {
  protocol: 'http:',
  host: 'localhost',
  port: 8545,
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Content-Length': Buffer.byteLength(data)
  }
};

let req = http.request(options, function(res) {
  // Now I should be able to deploy the contract
});

req.on('error', function(e) {
  console.log('problem with request: ' + e.message);
});

req.write(data);
req.end();

And then, in the callback function passed to http.request, I should be able to deploy the contract (i.e., execute the code at the beginning of my question).

However, I get the following response for this request:

STATUS: 200
HEADERS: {
    "content-type": "application/json",
    "transfer-encoding": "chunked",
    "date": "..."
}
BODY: {
    "jsonrpc": "2.0",
    "error": {
        "code": -32601,
        "message": "Method not found"
    },
    "id":1
}

I found the description of the personal_unlockAccount method on Parity's JSON-RPC API here, but I cannot find anything wrong in the way that I am calling via the HTTP request.

UPDATE #3:

With the help of this answer, which list Parity options nicely, I've managed to resolve this problem as well, by starting Parity with the personal API enabled:

parity --jsonrpc-apis=personal

The http response that I receive now is:

"error": {
    "code": -32023,
    "message": "Unable to unlock the account.",
    "data": "InvalidAccount"
}

I assume that I should probably start Parity also with the following flags:

--chain=../../parity/localcoin.json
--password=MyPasswordFile.txt
--engine-signer=0xMyAccountAddress
--ntp-servers=127.0.0.1:123
--reseal-on-txs=none
--force-sealing
--mode=offline
--light

Or at least with some of them...

UPDATE #4:

Using the switches above in combined with --jsonrpc-apis=personal, allows me to successfully invoke the personal_unlockAccount method, via an http request, to which the response is:

{"jsonrpc":"2.0","result":true,"id":1}


texts: Truffle tries deploy from unknown account

texts:
I am trying to deploy a contract to Ropsten using Infura with the config file truffle.js below. The deploy fails because the account listed in the error message has insufficient funds – however I do not recognise the account given. It does not appear in the top 15 accounts associated with my mnemonic (e.g. using MyEtherWallet). I am inserting my mnemonic in the format word word word word.

The actual account 0 associated with my mnemonic has ample Ether from the faucet.

What am I doing wrong?

truffle.js

var HDWalletProvider = require("truffle-hdwallet-provider");
var mnemonic = "<MNEMONIC>";
var infuraAPIKey = "<INFURA-PROJECT-SECRET>";
const infuraUrl = 'https://mainnet.infura.io/'+infuraAPIKey;

const NonceSubprovider = require("web3-provider-engine/subproviders/nonce-tracker");
const createInfuraProvider = (mnemonic, infuraUrl) => {
  let provider = new HDWalletProvider(mnemonic, infuraUrl);
  provider.engine.addProvider(new NonceSubprovider());
  return provider;
}
module.exports = {
   networks: {
     development: {
       host: "localhost",
       port: 7545,
       network_id: "*" // Match any network id
    },
    rinkeby: {
      host: "localhost",
      provider: () => new HDWalletProvider(mnemonic, "https://rinkeby.infura.io/"+infuraAPIKey, 0),
      port: 7545,
      network_id: 4,
      gas: 4712388
    },
    live: {
      host: "localhost",
      port: 8546,
      provider: createInfuraProvider(mnemonic, infuraUrl),
        network_id: 1,
        gas: 4712388
    }
  },
  compilers: {
    solc: {
      version: "0.4.24"
    }
  }
};

Error message:

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

   Deploying 'Migrations'
   ----------------------
Error:  *** Deployment Failed ***

"Migrations" could not deploy due to insufficient funds
   * Account:  0xdBB63dca232c0deF386758eAC53A0B7Cc558217b
   * Balance:  0 wei
   * Message:  sender doesn't have enough funds to send tx. The upfront cost is: 9424776000000000 and the sender's account only has: 0
   * Try:
      + Using an adequately funded account
      + If you are using a local Geth node, verify that your node is synced.

    at /Users/technical/.nvm/versions/node/v10.15.3/lib/node_modules/truffle/build/webpack:/packages/truffle-deployer/src/deployment.js:364:1
    at process._tickCallback (internal/process/next_tick.js:68:7)
Truffle v5.0.7 (core: 5.0.7)
Node v10.15.3


texts:
First of all what does is mean when we say miners search for a specific hash, and when first miner finds it, others are going to compete for next hash ?
If I'm a miner I'm going to find numbers smaller than hash target and create a pool of these numbers, then I'm going to use these numbers to add different blocks.
That's the way I will implement it :)
And also I want to know when exactly a miner receives his reward ?


texts: Using web3 v1 beta from Nodejs to invoke myMethod.send() gives use Trusted Signer. How do I do that?

texts:
Using web3 version 1 beta 27, connected to a remote Parity node that's connected to the Ropsten network.

I have created an account with public and private keys, I have sent some test Eth to that address.  That all works fine.

Now trying to actually invoke a function on my contract I get the message

Your account is locked. Unlock the account via CLI, personal_unlockAccount or use Trusted Signer

I don't have access to the node via CLI so need to use Trusted Signer.

Looking at the docs for web3.eth.accounts.sign I see the following

sign

web3.eth.accounts.sign(data, privateKey);

Signs arbitrary data. This data is before UTF-8 HEX decoded and enveloped as follows: "\x19Ethereum Signed Message:\n" + message.length + message.

Parameters

data - String: The data to sign. If its a string it will be
privateKey - String: The private key to sign with.

which quite frankly doesn't make any sense.

Assuming the function I am calling is

TestContract.methods.test(testAddress).send()

How exactly do I use web3.eth.accounts.sign in this context?


texts:
I went through the Crowdfunding example in solidity where i encountered the following:

contract Crowdfunding {
struct CampaignData {
    address recipient;
    uint contributed;
    uint goal;
    uint deadline;
    uint num_contributions;
    mapping(uint => Contribution) contributions;
}

struct Contribution {
    address contributor;
    uint amount;
}

uint nextCampaignId;
mapping(uint256 => CampaignData) campaigns;

// Start a new campaign.
function start(address recipient, uint256 goal, uint256 deadline) returns (uint id) {
    var campaign = campaigns[nextCampaignId];
    campaign.recipient = recipient;
    campaign.goal = goal;
    campaign.deadline = deadline;
    nextCampaignId ++;
    id = nextCampaignId;
}

What is really happening here?

Why did we use mapping? How is it helping us? I couldn't understand the working of it and hence not able to use it.


texts: Oraclize code not compiling using TRUFFLE COMPIL

texts:
I am trying to compile below mentioned code (taken from Oraclize documents) using TRUFFLE but am getting compilation error saying :

'Cannot parse one.sol: Unexpected token p in JSON at position 0'.

Can someone suggest how to handle this error.

pragma solidity ^0.4.11;
import "./oraclizeAPI.sol"; //Importing Oraclize

contract ExampleContract is usingOraclize {

string public EURGBP;
event updatedPrice(string price);
event newOraclizeQuery(string description);

function ExampleContract() payable {
    updatePrice();
}

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

function updatePrice() payable {
    if (oraclize_getPrice("URL") > this.balance) {
        newOraclizeQuery("Oraclize query was NOT sent, please add some ETH to cover for the query fee");
    } else {
        newOraclizeQuery("Oraclize query was sent, standing by for the answer..");
        oraclize_query("URL", "json(http://api.fixer.io/latest?symbols=USD,GBP).rates.GBP");
    }
}

}


texts: Web3.js event.get not firing, whereas event.watch gives correct values

texts:
I am trying to do a simple test for events.
Following is solidity code.

Values received from chgEvent.watch are always correct.

But in chgEvent.get, results1 is empty. chgEvent.get does not get called at emit of event in contract, also there is no error printed.

I am connecting to Ganache.

Please suggest why chgEvent.get is not firing.

pragma solidity ^0.4.0;

    contract eventTestContract
    {
        uint8 public dummy;
        event eventOnDummy
        (
           uint dumm
        );
        function setDummy(uint8 _dummy)
        {
           dummy = _dummy;
           eventOnDummy(_dummy);
        }
        function getDummy() returns (uint8)
        {
            return dummy;
        }
    }

Following is web3.js relevant code:

var myInstrContract = InstrContractABI.at('0x12e47158657b7ed4ce241ab29cca76b88aa51aab');
        var chgEvent = myInstrContract.eventOnDummy({},{fromBlock: 0, toBlock: 'latest' });

        chgEvent.get(function (error, results1) {
            if (!error) {
               console.log("value from event.get "+JSON.stringify(results1.args));
            } else {
                console.log(error);
            }
        });

        chgEvent.watch(function (error, results) {
            if (!error) {
               console.log("value from event.watch "+results.args.dumm);
            } else {
                console.log(error);
            }
        });


texts: Use Hooked-Web3-Provider and Lightwallet on android app?

texts:
I'm trying to make a demo app where I can make an account through the app and store the private key. and simply send a signed transaction and from the app to a hosted blockchain on my computer

any tips on how to start? or is it possible? using web3 provider and ligthwallet?


texts: How Do Accounts Generate Ether After Genesis Creation?

texts: How is new ether created in a private proof-of-authority network? I understand when creating a genesis file you can specifically allocate funds to an account, but what about after the network has been created?


texts:
I accidentally sent ALL my ETH on ETC address :(
6 months of mining gone :(
I sent from one exchange to fresh address on another exchange, but on ETC ...
Is there ANY way to track those coins?
I'm desperate :(
Thanks

Update

Bittrex and their Richie Lai found my transaction and manually refunded all my coins. Bittrex and Stack Exchange advice saved my 4-5 months of mining and my health.

Exchange where i sent coins had my private key and they refunded coins.


texts: Windows Vista: Ethereum Wallet not synching at all - stuck

texts: Hello windows Vista Business user here, installed Ethereum-Wallet-win32-0-8-9. Then I bought 100 euros of ETH and had it send over to the wallet only to discover I could not synch the wallet. The synch downloads a few thousands blocks and just hangs, no progress whatsoever even after waiting three hours and trying for multiple days. I tried the time synch setting,  using the geth command, but that also does not seem to work. I have looked on the internet for days now, and I can't seem to find the answer, can someone help me with this? My download speed is 150Mb/Sec connected with UTP cable directly to the router..currently stuck at 2650384 blocks ...Sorry if I seem like a real n00b, but guess that's because I am at this topic! PS: I will be checking any (if someone replies) answers tomorrow , now its late in the evening here..


texts: What does this Truffle onConnect error mean?

texts:
I've been following a tutorial to set up a simple voting application just for experimentation purposes but after installing truffle, it seems it won't connect.

Heres the error I'm getting when I try anything with truffle

Literally any help is appreciated!!


texts:
I am using web3.py but following imports is giving me error for eth_keys
eth_utils is installed
  File "C:\Users\neeraj bansal\Anaconda3\lib\site-packages\eth_keys\main.py", line 3, in <module>
    from  eth_utils import (

ImportError: cannot import name 'is_string' from 'eth_utils' (unknown location)

PS please let me know what additional info is needed.


texts: How to use custom ERC20 Tokens for payments

texts: I am currently implementing a private Ethereum Blockchain. I have also created a custom ERC20 Token smart contract. I want to know how to use this custom token instead of ether for another smart contract related to buying and selling products? The purpose is that once buyer wants to buy some item he should be able to make a payment in terms of custom toke say my_token and once the transaction is mined the desired number of my_tokens should be added to seller's account and same number should be deleted from the buyer's account.


texts: Send transaction using MetaMask injected web 3

texts:
Metamasks injected web3 gives an error when using web3.eth.sendTransaction()

web3.eth.sendTransaction({from:web3.eth.accounts[0], to:'', data: // hash to interact with contraact, gas:85000});

What would be a way to use Metamask to have a website prompt a user to sign a transaction ?


texts: Why is the transaction hash (tx.hash) not available in Solidity?

texts:
Why not solidity provide tx.TxHash (only tx.gasprice , tx.origin)?

reference https://solidity.readthedocs.io/en/develop/units-and-global-variables.html，

tx.TxHash，Transaction(ID) Hash, it should be a random num。

thanks.


texts: How to add new Sealer in Geth 1.6 Proof of Authority?

texts:
Hi there Ethereum experts,

I'm trying out Proof-of-Authority in Geth 1.6 for my private network and got it to work on a few nodes using Puppeth.

Now, I have two questions about maintain the private network as the network grows larger over time.

How do I add more sealer accounts in the future? Since, the sealer account are specified on the Genesis block. (Does Clique's Proposal has anything to do with this?)
It seems that there's no block reward generate to the sealer like what happens with the conventional PoW miner. Are there any settings to adjust the block reward?

Any help is appreciated.


texts: Are binance ERC20 token transactions not on the ethereum blockchain?

texts:
I'm using web3js get transaction info on a specific ETH address. When I make the getTransactions call, no info is presented. I then check etherscan and also see that my binance ETH wallet (for deposits) is listed with 1 transaction rather than the multiple transfers I've done on Binance.
Am I missing a key concept here re: how Ethereum works for Binance? Do they run their own network separate to the mainnet?
Appreciate any points to documentation or guides if this is a too obvious question.


texts: How can I use the mathematical constant e in Solidity?

texts: I want to calculate a mathematical function which will use the mathematical constant e, and I don't know how to use e, like Math.e.


texts:
What would be an approach to do the following:

1) Secret Share data provided from a file

2) Publish the secret shared data onto an Ethereum instance (aleth/geth)

3) Be able to retrieve and reconstruct the data from the blockchain instance?

I have thought about creating and deploying a smart contract or submitting a transaction but am not sure if there are existing programs that serve the purpose described above.


texts: Is there a list of DAPPS that are already useable?

texts:
Is there a list of DAPPs that are already useable?

Useable means there is an easy accessible GUI, that can interact with the contract.


texts: Solidity: Can modifiers be marked payable?

texts:
Can I have a modifier that enforces the amount sent by a user in a call to a function, and if it is below a certain amount, throw?
I want to do something like the following:

 uint256 n;

// Set some amount n in the constructor...

modifier checkAmount() payable {
    if(msg.value < n) throw;
    _;
}


texts:
I read in a lot of places that the fallback function only has a gas stipend of 2300 and nothing should be done in there except logging.

But then, I see contracts like crowdsales with the following code:

// fallback function can be used to buy tokens
  function () payable {
    buyTokens(msg.sender);
  }

  // low level token purchase function
  function buyTokens(address beneficiary) public payable {
    require(beneficiary != address(0));
    require(validPurchase());

    uint256 weiAmount = msg.value;

    // calculate token amount to be created
    uint256 tokens = weiAmount.mul(rate);

    // update state
    weiRaised = weiRaised.add(weiAmount);

    token.mint(beneficiary, tokens);
    TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);

    forwardFunds();
  }

How is it possible that buyTokens function gets successfully called by the fallback function if it definitively will cost more than the allowed 2300 gas?


texts: Can a token be required when interacting with a smart contract instead of Ether?

texts: When creating a smart contract in which a user must provide payment, can an amount of a token be required instead of Ether? Could you enable a user to have an option between Ether or a token?


texts: How to interpret the "Gas Limit" column on etherscan's internal txns view?

texts:
Here's a Kovan transaction I'm trying to optimize:

https://kovan.etherscan.io/tx/0xdbe1d6369f80d0672c90eabefccc6ca972e13f921ac83c8cc28cb310f2837a0a#internal

I've noticed that the "Internal Txns" view displays internal steps for the function I called, along with a "Gas Limit" column that appears to present the evolution of gas usage within the transaction.
Is this column indeed a detailing of gas consumption for the transaction? How should I interpret these values?
Thanks in advance.


texts: How are 0 gas price transactions getting mined?

texts:
Here's a transaction with a gas price of 0:
https://etherscan.io/tx/0xbdda3e1d4d879590b5d21ce777a91573fb5bbb40fa0f6cbcc8420a6d3d208668
How is it getting mined?  Is the miner mining it for free?


texts: It seems pointless to me. I looked at the actual implementation. Kademila is used to discover peers, but there is no gained benefits. As when the node connects to peers, it simply just grab from the peers group. Kademila has no benefit? Correct me if im wrong


texts: Merkle Hash forest and MErkle DAG is it the same?

texts:
I'm wondering if a merkle hash forest is the same as a merkle dag? I need a reliable paper as reference I could cite in my paper.
Thx for all your help!


texts: ERC721: How to get the owned tokens of an address

texts:
There is a balanceOf function, but it only displays one uint (the token identifier)
I see most ERC721 tokens doing this so I am confused on how to view all owned tokens.


texts:
I'm a beginner trying to write a Token contract, and I have encountered an error using Solidity 0.4.19. Here is the piece of code with the problem:

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

    uint256 tokens = msg.value.mul(RATE);
    balances[msg.sender] = balances[msg.sender].add(tokens);

    owner.transfer(msg.value);
  }

This is the error message:

  Member "mul" not found or not visible after argument-dependent lookup
  in uint256

Can anyone please offer a tip to fix this, thank you very much?


texts:
I am developing an application using solidity, web3js and eventeum. I am testing it locally using ganache-cli. I use Kafka to store all the events to process them at convenience instead of processing them directly.

The problem is that when I do truffle tests using my contract logic, the events are logged exactly in the order they were emitted.
When eventeum captures them, the events do not appear in order in the kafka topic.
When I listen to the same events simultaneously in separate web3js callback functions, they sometimes appear out of order.
All these events are emitted within a single transaction.
I am connected to the ganache from web3 and eventeum using http://localhost:8545 as the endpoint for provider.

Is it normal that events from events to appear out of order within a single transaction?
P.S.

Does connecting using ws:// make a difference?
Is it an anomaly with ganache-cli?


texts: RPC error "invalid or missing value for params" when calling contract constant void functions

texts:
My contract has a function defined like this:

{"constant":true,"inputs":[],"name":"queryNumEscrows","outputs":
[{"name":"","type":"uint256"}],"payable":false,"type":"function"}

Having no inputs. Its Solidity source code is pretty simple:

function queryNumEscrows() constant returns (uint) {
    return numEscrows;
}

how do I call it from JSON RPC? I've tried this:

endpoint = "queryNumEscrows()"
web3_sha3(endpoint) = 0x0127efc52bcbe2b7f6d6a1ee29a7acd32c5f2e824b791cd7c97b9c57981bc5ac
no arguments...
data = 0x0127efc5

and when performing the query:

eth_call([{"from": "0xf28dafbfeb41bf32869c9d498da0d651d0206ed4", "to":
"0x27c042342c9ba937214117e11a4970a6145034cb", "data": "0x0127efc5"}])

this is the error it throws:

  -32602: invalid or missing value for params[1]

So, I guess probably is something wrong when encoding void parameters into data. How should I do that?

By the way, I used this great explanation: How to call a contract method using the eth_call JSON-RPC API as a reference.


texts: Does anyone know what this transaction refers to, and if funds can be retrieved?

texts:
Hello Ethereum community!
I was looking back at transactions made with an old ethereum wallet and came across the following.

Does anybody know what this refers to?
I am not sure what this "ReplaySafeSplit" contract was and where this Eth may be. I believe it refers to the time when ETH and ETC split (hard fork), but these eth appear only as a transaction out of the wallet.
(this is web link of the transaction: https://etherscan.io/tx/0x5e12337a97a6442ce7c9b1d169094091bb33704bf20f6c856ff9b35770287e7b)
Could anybody confirm whether these Ether amounts could actually be retrieved?
Thank you in advance!


texts: Are there any drawbacks of being Turing complete?

texts:
I understand that Turing Complete means that Ethereum is robust and able to implement any idea that can be codified including best features from other networks.

Aside from blockchain bloat based on the amount of data that may need to eventually stored on Ethereum what are the possible drawbacks?

Is there a danger that Bitcoin could introduce a Turing complete sidechain while it still enjoys greater economies of scale than Ethereum?


texts: Using ECC Brainpool curves instead of Elliptic Curves

texts:
I am exploring the use of ECC Brainpool curves instead of elliptic curves for digital signatures in Ethereum.

Is this part of the roadmap and/or anyone has experimented with the use of ECC Brainpool Curves?


texts: Issue executing function transferOwnership(address newOwner) for ERC-20 token contract

texts:
I'm trying to execute the function transferOwnership(address newOwner), to change the owner of an ERC-20 token contract to a new owner address (I have access to the current owner address & the function is implemented in the contract code).
To execute this function, I connected with the current owner's address to myetherwallet, went to "interact with contract" and filled in the contract address + ABI/JSON (found on the token contract page).
I filled in the NewOwner(address) and clicked "Write" but it's stuck right there.
The write button keeps showing that it's loading, but nothing happens or pops up.
I tried this multiple times, but get stuck at the same point every time.
I also tried to execute this function on the etherscan contract page, by connecting thru web3 with the current owner's address and going to "write contract", but when executing the function it also keeps loading for a long time without anything happening. Sometimes, after a long time, it throws an error:
"TypeError: Cannot read property 'methods' of undefined"
Is there any other way I can execute this function?
Could there be something wrong with the ABI/JSON ? Or what could be the causing the problem?
Thank you for taking the time to read through and maybe help, I truly appreciate!!
Kind regards


texts: erc-721 erc-20 solidity code check effects interaction pattern

texts: Where can one locate a formally verified ERC20/ERC721 solidity code/template that adheres to security design patterns such as check effects interaction patterns?


texts: Does a failing `require` condition cause emitted events to be reverted too?

texts:
Consider the following contrived contract function:
function submitOffer(uint256 foo) public payable {
    emit MyEvent(foo);
    // then later...
    require(foo > 10, "Foo must be greater than 10");
}

This function emits an event on the first line, then later checks some require condition. If the condition fails, any state changes are reverted. Will this cause the event to be "reverted" (or never actually emitted) as well? I assume the answer is yes because the transaction will never actually get included in a block, but is there something I'm not considering?


texts: web3 js send ether not broadcasting on main net

texts:
I am using folowing code sample to send ether between 2 of my own accounts, both have enough funds:

"use strict";
var Web3 = require('web3');
var Tx = require('ethereumjs-tx');
// Show Web3 where it needs to look for a connection to Ethereum.
//web3 = new Web3(new Web3.providers.HttpProvider('http://127.0.0.1:8545'));
var web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/N6IIa2HvDYOovtgmPbhD'));
var gasPrice = "20";//or get with web3.eth.gasPrice
var gasLimit = '42000';
var addr = "...";
var toAddress = "....";
var amountToSend = web3.utils.toWei('0.0005', 'ether'); //$1
var nonce = web3.eth.getTransactionCount(addr); //211;
var rawTransaction = {
"from": addr,
"nonce": web3.utils.toHex(nonce),
"gasPrice": web3.utils.toHex(web3.utils.toWei('9', 'gwei')),
"gasLimit": web3.utils.toHex(gasLimit),
"to": toAddress,
"value": web3.utils.toHex(amountToSend) ,
"chainId": 1 //remember to change this
};
var privateKey = "...";
var privKey = new Buffer(privateKey, 'hex');
//console.log("privKey  : ", privKey);
var tx = new Tx(rawTransaction);
tx.sign(privKey);
var serializedTx = tx.serialize();
console.log('serializedTx : '+serializedTx);
web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex'), function(err, hash) {
if (!err)
{
console.log('Txn Sent and hash is '+hash);
let userBalance = (web3.eth.getTransactionReceipt(hash));
console.log(userBalance);
userBalance.then(function(result) {
   console.log(result);
})

}
else
{
console.error(err);
}
});

however, what i get from console log is:

Txn Sent and hash is 0xab9a2265792203d787d0e08c7a808865b1d776d9a289d92ded2596c352b6e56c
Promise { <pending> }
null

this is not updated on etherscan or anywhere on main net. I am quite confused as there is nowhere telling me where I am wrong. Does someone know how to fix it?


texts: How much faster is it to sync with --jitvm?

texts:
geth help has:

VIRTUAL MACHINE OPTIONS:
--jitvm       Enable the JIT VM

The impact of --jitvm has been unanswered and I'm looking for answers to these 3 specifically:
How much faster is geth --fast --jitvm than just geth --fast?
How much faster is geth --fast --cache=1024 --jitvm than just geth --fast --cache=1024?
How much faster is geth --jitvm than just geth?


texts:
"Everything that is inside a contract is visible to all external observers. Making something private only prevents other contracts from accessing and modifying the information, but it will still be visible to the whole world outside of the blockchain."

Is there any other way to protect my private variables from being read/consulted by others ?


texts: Error on transaction submission: insufficient funds for gas * price + value - web3 v1+

texts:
I am trying to submit a transaction via web3 and getting the following error: Error: Returned error: insufficient funds for gas * price + value.

Here is my code:

console.dir(txParams);
const tx = await this.web3.eth.accounts.signTransaction(
       txParams,
       this.hdKey.derive(payment.address.bip32Path)._privateKey
);
this.web3.eth.sendSignedTransaction(tx.rawTransaction);

the console statement outputs the following:

  { from: '0xc9d71816ffe465bb682302808f6169ee2B704468',   to:
  '0x556586125be6e8c3ace675da4fdcb04369ed999d',   gas: '0x5208',
  gasPrice: '0x4a817c800',   value: '0x10457c59124000' }

The account I am trying to has the requisite ether. What could be wrong?


texts: How can I pass Mocha switches when calling Truffle?

texts:
When calling truffle test some_test.js, I would like to pass Mocha switches.

For example: truffle --no-colors test some_test.js works fine.

However: truffle --reporter json-streams test some_test.js doesn't.

To my understanding, it should get Mocha to generate all the output in JSON format.

Any ideas?


texts: How to handle password for unlock Account in web3?

texts:
In web3 there is function

web3.eth.personal.unlockAccount(address [, callback])

to unlock the account so whenever we call the smart contract function we need to unlock the account in geth client first, so what will be the best way to store and use password on client side as I cannot prompt for password every time when it use smart contract function using web3js.

Assumption : My client side is on javascript, html and web3js


texts: Which are the steps that a developer follows to develop a DApp?

texts:
I would like to know if based on your experience, the following steps are correct in order a developer to develop a DApp from the start to the end.
Steps:

Create an Externally Owned Account (EOA)
Receive the account address and the private key
Fund account with real or test Ether
Write Smart Contract
Complile Smart Contract
Deploy Smart Contract's bytecode
Approve transaction (sign transaction with private key)
Smart contract's address on Ethereum received
Setup DApp UI (e.g., HTML, CSS, JS, etc.)
Plug Web3.js library
Include Application Binary Interface (ABI)
Establish interaction with blockchain (for example check if an address is a valid Ethereum address)
Establish interaction with the smart contract (for example call a function of the smart contract)
DAapp is configured and the process ends

Please, any steps and ideas are welcomed :) I need your experience


texts:
I am trying to implement a TicTacToe smart contract:

pragma solidity ^0.4.19;

contract TicTacToe {
    uint8 public boardSize = 3;
    address[3][3] board;

    address public player1;
    address public player2;

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

    function joinGame() public payable {
        assert(player2 == address(0));
        player2 = msg.sender;
    }
}

However, in the joinGame function the assert(player2 == address(0));  does not throw an error when I try to join a game using a different address from the one that initially joined the game. It basically replaces the player2 var with the new address that joined instead of throwing an error (since there should be only 2 players in the game)

Please help thanks!


texts: I have an Exodus Wallet with some USDC in it. When I try to exchange them or send them to another wallet, it says that I need to add some ETH to make it possible (0.0043 ETH). I check on Binance and the gas fee for the transaction is 15$ which seems too big. I was wondering if you have any tips on how to deposit a lower amount, without paying too much for the transfer fee?. Thank you and sorry for the bad English!


texts: Pass an array along when a contract creates a new contract

texts:
Can an array be passed along as a contract creates a new contract ? Specifically, an array of addresses.

address[] verifiedUsers;

new generatePOItokens(verifiedUsers);


texts: How to go from Solidity AST back to source code?

texts:
I want to parse my contract written in solidity to AST, do some analysis on AST and editing,then generate that edited version back to source code so it is possible to execute it.

I know I can do colc --ast-json which gives AST for the contract.

I know there are solidity-parser, solparse for going from code to AST. However, solc and these two tools produce different ASTs.

I tried using soltar(for going from AST back to code) which is meant to be used with solidity-parser or solparse. However it only works with version 0.1.0 of the parsers which means I am missing out a lot of Solidity language. And soltar seems to be missing out contract names so I am sure along the way I would find more bugs like this.

Are there any other helpful tools that can help me do this? Do you think it is feasible to implement something like this with very good accuracy so the generated code from AST is executable and correct?

It would also be good if I could use solc on AST instead of just source code but I don't think it is possible.


texts: Suggested procedure for making a proposal to the DAO

texts: Is there a guide or reference example about how to make a proposal to the DAO for funding? Besides slock.it are there any more good examples that I should be studying?