texts: web3j WalletUtils.loadCredentials() works in Java, throws java.lang.OutOfMemoryError on Android

texts:
I'm trying to use web3j + Infura to interact with the Rinkeby chain from an android app. I first wrote a simple test in Java and everything worked - transactions, interacting with contracts, you name it. So I moved to Android, but in the emulator loading the credentials from file is taking forever + showing several garbage collection warnings, and on my Moto G5plus phone is actually crashing due to an OutOfMemoryError. This is what I am doing (in an AsyncTask):

Credentials credentials = WalletUtils.loadCredentials("notMyActualPassword", cacheFilePath);

The file path is correct, I do print the wallet file in my logs and it shows up correctly. The crash logs were copied into this gist.

Does anyone know why this might happen?


texts: Why does my copy of Mix on OSX have an ancient version of Solidity?

texts:
I just downloaded the latest version of Mix, and noticed it doesn't support inline assembly. Clicking on Mix -> About Mix, I see it's running version 0.2.2 of Solidity.

Why is it running such an old version, and is there any way to upgrade it short of building Mix myself from source?


texts:
I am wondering what pattern I am supposed to follow in Solidity to take in an array of structs as a parameter.  I am translating code from CPP and mostly everything translates directly besides this (and variable scoping in functions).

TypeError: This type is only supported in the new experimental ABI encoder. Use "pragma experimental ABIEncoderV2;" to enable the feature.

struct HorseRaceData {
        HorseData data;
        uint64 currentSpeed;
        uint64 currentStamina;
        uint64 distanceTraveled;
        uint64 time;
        bool done;
}

function placementSimulation (HorseRaceData[] memory horses) public {...}


texts: Why is my transaction not included into blocks with smaller gas prices in them?

texts:
I created a transaction with gas price 1.1 GWEI. It has been pending for 3 hours, and yet - during just the last 75 blocks - several 1 GWEI transactions have been included.

In other words, gas price is clearly not the only determinant of which transactions are picked to be included in a block.

It seems to me that (at least some of) the Ethereum miners might prioritize older transactions over transactions with higher gas prices.

Box Plots of Gas Price in GWEI for the last 75 blocks:

Notice that in the Box Plots, there seems to be two types of blocks. Those that include 1 GWEI transactions, and those that don't.

My hypothesis is that there are two main types of miners:

Those that mine the transactions that pay the highest gas prices
Those that mine the transactions (minimum 1 GWEI) that have been waiting the longest.

Considering how common "1 GWEI-blocks" seem to be - who are these miners? And why are they picking old pending transactions, rather than those that pay the most?

Disclaimer: I don't actually know that it is the oldest transactions that are included in the "1 GWEI-blocks", I'm just assuming this, since they are clearly not picking the highest gas price transactions. Another explanation would be that these miners pick transactions randomly.


texts: Mining own Pool - Error reading from socket

texts:
When I will mine on own pool, I get this Error.

First, my Claymore says 5-15 Shared found, like spamming this and than claymore says gpu 0 failed

The Server says that:

Error reading from socket: read tcp ***.***.***.**:8008->87.187.109.76:51101: read: connection reset by peer

Why? I don't find it... also my site doesn't work anymore, but I don't know why...
Says

Stats API Temporarily Down

Claymore Miner works on ethermine or other pools... so must be the server


texts: How to increase the maximum blocks for `getPastEvent` method for web3?

texts:
I'm trying to get the past events from a contract's Deposit method:
const events = await tornado.getPastEvents('Deposit', { fromBlock: 0, toBlock: 'latest' })

However, web3 throws an error saying it's too many blocks:
Error: Error: Returned error: requested too many blocks from 90000 to 97491, maximum is set to 512

How can I increase the max of 512 blocks?


texts: Managing complex smart contracts using events only

texts:
I have a question about how one can deal with complex smart contracts in ethereum. Let's assume i have to deploy and interact with a smart contract that has a lot of functions, and each call to a function has a big cost in terms of gas. We can even imagine that the smart contract deployment, or calling one of its functions exceeds the limit of gas per block, so that we cannot deploy the SC or interact with it.

contract Test {
    type1 public testVar1;
    type2 public testVar2;
    //... other variables ...
    typeN public testVarN;

    function myFunction1(typeVar1 someVar1, typeVar2 someVar2)
    {
        //some computations ;
    }
    function myFunction2(typeVar1 someVar1, typeVar2 someVar2)
    {
        //some computations ;
    }
    //... other functions ...
}

It is possible to use ethereum events instead of the computations that are processed within each function, and make peers do the computations locally.

contract Test {
    //no variables ;

    event myFunctionEvent1(address from, typeVar1 someVar1, typeVar2 someVar2);
    event myFunctionEvent2(address from, typeVar1 someVar1, typeVar2 someVar2);

    function myFunction1(typeVar1 someVar1, typeVar2 someVar2)
    {
        //no computations ;
        myFunctionEvent1(msg.sender, someVar1, someVar2);
    }
    function myFunction2(typeVar1 someVar1, typeVar2 someVar2)
    {
        //no computations ;
        myFunctionEvent2(msg.sender, someVar1, someVar2);
    }
    //... other functions ...
}

Main idea : If all the peers agree on the changes that occur on the SC variables while calling its functions, than, keeping the functions calls in the BC (only the calls, not the effects) is enough for knowing the state of SC variables at each moment. In other words, a smart contract is like a deterministic automaton : by keeping all the "inputs", we can know the whole state of the SC (values of all of its variables...). Also, a smart contract that would keep only events could potentialy have an almost infinite complexity, since events don't cost that much gas.

What would be the limits or the inconveniants of such way of implementing smart contracts?

Thanks in advance for replies.


texts:
I sent ETH to the address of deployment contract,and I mining.But I find this address still doesn't have ETH.
  Can I send ETH to the address of the deployment contract?


texts: Can a mapping or array within struct made public?

texts:
contract CrowdFunding {

struct Funder {
    address addr;
    uint amount;
}

struct Campaign {
    address beneficiary;
    uint fundingGoal;
    uint numFunders;
    uint amount;
    mapping (uint => Funder) funders;
}

uint numCampaigns;
mapping (uint => Campaign) public campaigns;

function newCampaign(address beneficiary, uint goal) returns (uint campaignID) {
    campaignID = numCampaigns++; // campaignID is return variable
    // Creates new struct and saves in storage. We leave out the mapping type.
    campaigns[campaignID] = Campaign(beneficiary, goal, 0, 0);
}

function contribute(uint campaignID) payable {
    Campaign c = campaigns[campaignID];
    // Creates a new temporary memory struct, initialised with the given values
    // and copies it over to storage.
    // Note that you can also use Funder(msg.sender, msg.value) to initialise.
    c.funders[c.numFunders++] = Funder({addr: msg.sender, amount: msg.value});
    c.amount += msg.value;
}

function checkGoalReached(uint campaignID) returns (bool reached) {
    Campaign c = campaigns[campaignID];
    if (c.amount < c.fundingGoal)
        return false;
    uint amount = c.amount;
    c.amount = 0;
    c.beneficiary.transfer(amount);
    return true;
}

}

This is a code form solidity documentation that I tried deploying. I made the mapping campigns public so I could see the variables contained within the struct Campaign. But I cannot see the 'mapping funders' variable and I tried making it public "mapping (uint =>Funder) public funders" but it throws an error. How do I see the values contained within the struct Funder?


texts: Does solidity create unique outputs every time it compiles same exact code?

texts:
Is there any difference if I compile everytime I want to deploy another multisig wallet.
Or I can just deploy another multisig wallet using the same compiled data?


texts: Geth/Remix does not mine correctly and is slowly

texts:
I am using geth and run a private net. In Remix I am developing and am successfully connected to the geth RPC. But when I create a contract in Remix, in the geth console it says contract created but it does not really create it or add it however. There is also no error or something but in Remix there is still "1 pending transaction". After the message in geth, geth continues mining new blocks but in some way does not include the contract creation.

My next problem is, that geth starts late. When I launch it with console and enter "miner.start(1);" it takes a long time until it really starts mining.

The problem exists only since some days, before I never had this. I also upgraded already geth to the newest version (after the problems started) but it did not fix it.

How could I fix those problems?


texts: Is it possible to receive text messages (SMS) using ethereum?

texts: Is it possible to build a dapp that can receive sms text messages?


texts: Can I import my wallet into more than one computer?

texts: Is it safe & secure to import my wallet into multiple Ethereum clients?


texts: Are ERC777 & ERC223 smart contracts superior to ERC20 smart contracts?

texts: I have been reading some articles which claim that ERC223 and ERC777 have all the features of ERC20 plus additional features which makes them a superior contract. If this is the case, why are they not more widely implemented than ERC20 smart contracts? Are there security tradeoffs to using ERC777 and ERC223 over ERC20?


texts: How is Ethereum Wallet's transaction cost calculated?

texts:
Lately, I've seen wildly varying transaction costs when using Ethereum Wallet.  How is the fee range computed?

Current range:


texts:
I have created geth account. I know the password and trying to access my wallet through below command:

geth account update *ethereum_address*

I entered correct password but still I am getting below error:

  Fatal: Failed to unlock account ethereum_address (no key for given address or file)

I don't have private key. How can I use this wallet now?


texts: Mist does not show my outgoing transactions & does not show DIGIX or TheDAO tokens!

texts:
Ever since I downloaded Mist version Ethereum-Wallet-win64-0-7-5
I can no longer see any of my outgoing transaction history or any of my DAO Tokens. When I add new tokens or crowd sale contracts it shows my tokens only until I close Mist. When I start Mist again, the tokens are no longer there and I have to add them all over again every time I restart Mist.

I think that I accidentally may have deleted a file. I am not sure why, but Mist is no longer recording my outgoing transactions and my last 2 outgoing transactions have failed.

I am now having the same issue with all versions of Mist! PLEASE HELP!


texts:
Within the first 4 million blocks, I found that a significant fraction of them are empty. If miners are rewarded for writing transactions, wouldn't be in their best interests to at least partially fill the block?

The plot was created by calling web3.eth.getBlockTransactionCount(n) and plotting an exponentially weighted moving average with a span of 5760.


texts: debug_traceBlockByNumber 'callTracer' call is hanging on block 11092712

texts: I have a tracer that traces each block using the 'callTracer' tracer but yesterday it go stuck on block 11092712. When i try to curl Geth with a request to trace this block, it hangs and eventually times out (timeout = 100s). Any ideas what the issue might be? I can successfully curl the block before and after this one.


texts: Contract transaction was sent to a 'null' address

texts:
I have attempted to deploy a contract through geth, my understanding was that a null value could be given when creating the transaction to deploy the contract.

After mining the transaction I attempted to look up the transaction via the hash returned by the rcp call, I was given the following response in geth:

{
  blockHash: "0x06fe2ca8aae95b44057dbb663bed0faf9e8cc4d33418b21067d64de0eaa02f51",
  blockNumber: 37,
  from: "0x3440825288a9de705e2dbc26e4f6494b4d1f6426",
  gas: 90000,
  gasPrice: 20000000000,
  hash: "0x5e4c06e62aa70544f3349f51521e19454d4b43a224a402492cc256b115208391",
  input: "0x",
  nonce: 2,
  r: "0x3397da9897ee38d81511288de20e19d9b83ec98c056dc28604726749f350fd97",
  s: "0x44e3a8ef63f6e39118287b74deed6aa5b53f4234ad7f0669680bf9f2a4f7e030",
  to: null,
  transactionIndex: 0,
  v: "0x1c",
  value: 0
}

Is my understanding of how contract deployment works incorrect? Why is the address null on the blockchain? How can I call the contract or associated methods/functions?

I would be very grateful for any assistance that could be provided, thank you.


texts: web3.eth.Contract with Web3 1.3.0 does not seem to work

texts: I'm able to create an instance of a smart contract that I know works in Ganache using Truffle.  But in my Javascript Nodejs app, with the syntax "let contractInstance = new web3.eth.Contract(abi)", when I call the contractInstance method "contractInstance.ownerOf", it says "ownerOf" is not a function.  But I can see this in the ABI.  Also get an undefined when I console log "contractInstance.address".  Been "googling" this issue for hours and I'm coming up with nothing.  Any help is greatly appreciated! Thanks.


texts: Is the blockhash enough for a treasure generating function?

texts:
Suppose your contract has a function which generates a random treasure, as illustrated below:

function generateTreasure() returns (Treasure) {
    if (msg.value < 1 ether) return; // cost of calling the message
    uint8 rnd = randomUint8();
    if (rnd ==  0) return rareTreasure;
    if (rnd <=  4) return averageTreasure;
    if (rnd <= 16) return commonTreasure;
    return garbage;
};

I want to guarantee that an user calling generateTreasure will not be able to cheat the result by any external means - i.e., I want it to cost, in average, 256 ether for any user to acquire a rareTreasure. That wouldn't be true if an attacker found a way to get a rareTreasure more than 1/256 times in average per generateTreasure call.

I am aware an miner could cheat it by discarding a mined block - but, on this case, the situation is different. A single user could call generateTreasure many times in a single block, and multiple users could call it. Of course I don't want to give the same treasure for all users, so, that would need some form of stateful nonce (lastRandom) so each caller gets a different number. But, then, that would mean an user could create a contract that reads that nonce and only calls generateTreasure if it provides a good treasure with said block hash! Is that correct?

So, all things considered, what is the most appropriate randomization for that function?


texts: If I backup my ethereum wallet, and then add to it, will the backed up copy have the funds in it?

texts:
So if I follow this guide,
How to backup mist wallets?

and backup my mist wallet, do I need to back it up again? Or will the backup contain all future funds?


texts: What is "a" in the execution environment "I" in the yellow paper?

texts:
Excerpt from chapter 7, "Contract creation":

All symbols in the picture above have been clearly defined prior to chapter 7. I couldn't find though a specific explanation for what a stands for, as per the inclusion in {s,a} and Ia = a in definition 83 and 84, respectively.

It is explained that I is the execution environment - and that's cool! We could consequently deduce that a should be the account being created, but I cannot ascertain this because a has only been vaguely specified in the definition of the world state. That is, σ[a] (sigma of a).

Is a the resultant account of the contract creation call?


texts: Why wouldn't it be good to store lots of data in ethereum logs instead of smart contract?

texts:
I'm curious where to save big data. I don't want to save it in my private db and not in ipfs. I want it to be visible on blockchain.
So It's visible on blockchain etherscan If I'd go to store data in logs.

Question 1) Is it the best solution to store huge data in logs ? I don't want somewhere else. it must be visible on blockchain

Question 2) Why would I choose eos smart contract to ethereum's smart contract? I know it's free. but still it has stake, and what if after some time i unstaked it and eos's value went to 0.5$ when I bought it for 5$ each. Then I still lost and it was not free at all

Question 3) do eos logs work the way ethereum's logs work? can I filter them while getting them? or search some kind of data in logs? in ethereum it's easy.

Thank you.


texts: Can a script call msg.sender.send on any address with any amount?

texts:
Just watched this tutorial (you can skip to 18:33 and pause to see what I'm referring to): https://www.youtube.com/watch?v=seU7DykOxfc

So it looks like the magical msg object is available in all the public methods of smart contracts. I noticed that msg.sender points to the address of 1) "self" when being called in a constructor and 2) the "other party" a.k.a. the method caller (another contract) when being called from a public method.

As you can see from the screenshot, the contract has a pointer to the buyer and it calls buyer.send(value). Technically can't it just call that until the buyer has no more money / ether? What's stopping this contract from just calling it with arbitrary numbers and then running away?


texts: How are Ethereum transaction costs calculated?

texts:
I'm in the process of learning blockchain technology for a client of mine.   I understand the concept of "gas" in computational costs.    We are looking at creating a crypto-currency as an alternative to using a traditional payment platform for a closed loop solution.   I want to get a feel for the "transaction cost" associated with a simple payment transaction using the ethereum network.
I find the calculation method not totally clear.  Can anyone help?


texts:
I'm looking to deploy some code to the kovan testnet with Brownie. However I keep getting an error accessing accounts. Here is the command I'm running:
brownie run scripts/deploy_price_consumer_v3.py --network kovan

Here is the error:
Running 'scripts/deploy_price_consumer_v3.py::main'...
  File "brownie/_cli/run.py", line 49, in main
    return_value = run(args["<filename>"], method_name=args["<function>"] or "main")
  File "brownie/project/scripts.py", line 66, in run
    return getattr(module, method_name)(*args, **kwargs)
  File "./scripts/deploy_price_consumer_v3.py", line 7, in main
    print(accounts[0])
  File "brownie/network/account.py", line 103, in __getitem__
    return self._accounts[key]

But when I run brownie accounts list I get an account.
brownie accounts list
Brownie v1.11.12 - Python development framework for Ethereum

Found 1 account:
 └─0: 0x643315C9Be056cDEA171F4e7b2222a4ddaB9F88D
patrick@iMac: [~/code/chainlink-mix] $

Additional information
I also tried changing the config:
networks:
  default: kovan
  kovan:
    cmd_settings:
      mnemonic: ${MNEMONIC}
    host: ${KOVAN_RPC_URL}

With some environment variables
And I followed the instructions from this similar question as well, but still ran into issues.


texts: How to access metamask accounts when using Infura Websockets

texts:
I am making a dApp where in for login purpose I access metamask account to which user is logged in. I also have a back end server that listens to events emitted by the smart contract that updates data in an off-chain database.

Now, I plan to deploy my dApp to Rinkeby network for next level of testing. To listen to events on Rinkeby network I am using Infura websockets:

var web3 = new Web3("wss://rinkeby.infura.io/_ws");

But this has caused me problem. With the above web3 setting the dApp is unable to detect metamask (is locked or not) and the user account which is logged in.

I am stuck here as in I want to access the user account which is logged in Metamask and also want to use Infura Websockets to listen to events. But it looks like I can set only either of them as web3 provider.

Please suggest how can I circumvent this problem.


texts: How do I get the transaction hash and boolean return value?

texts:
I'm making a simple time-lock contract in Solidity. In my funds withdraw function I have:

function withdraw_funds() public returns (bool) {
        if (getAccounts[msg.sender].amount > 0) {

            if(getAccounts[msg.sender].releasetime < now){
            msg.sender.transfer(getAccounts[msg.sender].amount);
            return (true);
        }}
        else {
            return(false);
        }
     }

On the front end I'm using:

SimpleContract.withdraw_funds(function(err,result){
                if(!err){
                    console.log(result);
                }
                else {
                    console.log("Failure");
                }
            });

With the above function I get the transaction hash regardless of whether the funds were actually transferred or not.

Could someone please tell me the correct way to check the Boolean return value and display the transaction hash if the transfer was successful ?


texts: Struggling trying to migrate from Ethereum wallet to

texts:
Ok here is my sitation.

I have some ETH that was stored on an old laptop.

I have not run the wallet application for well over a year on the old laptop but I do have a backup of the keystore on my new one so I should not need to update the software and watch it try to sync for days I assume on the old laptop?

Instead I want to migrate over to using Mist from Ethereum Wallet using this keystore on the new laptop. I assume that possible is it?

Downloading and installing mist just gave an error and told me to update to geth 1.8.23 so I did that. I am running latest version of windows.

When I now run mist I don't get the error but it's stuck on "connecting". When I click on the red dot in the bottom corner it says "Local node looking for peers" and "remote node connecting" but never connects.

What are my next steps and why isn't this working?
Also how to I import my old keystore when getting past this part?


texts: What is the Probability of being chosen in Proof of Stake?

texts:
I'm trying to solidify my understanding of Proof-Of-Stake consensus, and one thing I've been left wondering is how to figure the probability of being chosen to be a validator. Are the chances of being selected based on the amount of currency in circulation, or the amount of currency being staked on the network?
As a follow up (if it applies); in a PoS system that has a probability of being chosen only based on the total network amount being staked, wouldn't that mean a theoretical "51%" attack wouldn't have to own 51% of the market cap per-se, but actually only 51% of the "total stake"? In this scenario it seems like an attack like this would be much easier to carry out if the network isn't being widely staked with a moderate percentage of the total circulation.


texts: What does msg.sender.call() do in Solidity?

texts:
Hi was going through solidity documentation. There was some code that I was not able to understand, even after researching a lot I was not able to find some satisfactory output. The code is as under:

contract Mutex {
  bool locked;
modifier noReentrancy() {
    require(!locked);
    locked = true;
    _;
    locked = false;
}

/// This function is protected by a mutex, which means that
/// reentrant calls from within `msg.sender.call` cannot call `f` again.
/// The `return 7` statement assigns 7 to the return value but still
/// executes the statement `locked = false` in the modifier.
  function f() public noReentrancy returns (uint) {
    require(msg.sender.call());
   return 7;
  }
}

What msg.sender.call() does? is it calling f() again? If yes then how?


texts:
Is anyone aware of an Etherscan for private testnet?

I'm testing my own contracts, however, the current testnets seem to be under attack, so I've used my own private testnet to test deployment of my contracts, however, I would like to look at my contracts, and explore it.

If you're aware of an Etherscan that can work for private testnet, please provide the URL to it.

Thank you.


texts: Ethereum wallet synced but will not close

texts: I am running xtogo gui on ubuntu vps. The blockchain has synced. However, when I try to deploy a contract, the window says that the gas cannot be computed, because the account needs at least 1 eth. The account has 1 eth. So, I need to back out and try something else. However, "quit ethereum wallet" or Control+O have no affect. I do not want to try killall process, as the db may become corrupted.


texts: Does Chainlink have an aggregator for its price aggregators?

texts:
I need a way to pass an arbitrary ERC-20 token symbol and get a price for it in return. The Solidity interface should look something like this:
function getPrice(string memory symbol) external view returns (uint256);

I browsed through the Chainlink docs but I didn't find something that answers my question. I only saw bespoke instances of asset price aggregators, like this contract that provides ETH/USD data on Kovan.
Does Chainlink provide an aggregator contract for AggregatorV3Interface instances?


texts: How to call a payable function within a payable function from the same contract?

texts:
Imagine a contract with a 2 functions:
A.sol:
contract A{
    function buyItem()
    {
      #implementation
    }
    function buyItems()
    {
        for(#loop_conditions)
        {
            buyItem{value: item_price}();
        }
    }
}

The compiler gives an error because I am not allowed to call buyItem{value: item_price} as function call options are only allowed on externnal functions. How can I solve this issue ?


texts: Ethereum wallet doesn't sync v. 0.7.3 stuck or too slow using Os x 10.9.5

texts:
I'm using Ethereum 0.7.3 and it doesn't sync on my MacPro Os x 10.9.5. It is too slow or it get's suck. I tried v.0.7.1 and v.0.7.2, and it's the same problem.

My Internet connection it's ok, I disabled the firewall just in case. But still doens't work.

I would like to solve this without using geth, as I'm not familiar with terminal console.

Do you have any suggestion for this?


texts: I'm running on a private network at the moment, is there a way to remove a peer from your node without restarting Geth?


texts:
I am trying the function override capability in solidity 0.6.0.  However, when I am trying to override a function in the same contract it is giving me an error that the function has been defined twice.  Here is the code:

contract derivedContractv2 {

    function add(uint newa, uint newb) virtual public pure returns (uint _newValue) {
        return newa+newb;
    }

    function add(uint newesta, uint newestb) override public pure returns (uint _newestValue) {
        return newesta+newestb;
    }

}

The error generated is as follows:

browser/integratedContract.sol:13:5: DeclarationError: Function with same name and arguments defined twice.
function add(uint newa, uint newb) virtual public pure returns (uint _newValue) {
^ (Relevant source part starts here and spans across multiple lines).
browser/integratedContract.sol:17:5: Other declaration is here:
function add(uint newesta, uint newestb) override public pure returns (uint _newestValue) {
^ (Relevant source part starts here and spans across multiple lines).

and

browser/integratedContract.sol:17:46: TypeError: Function has override specified but does not override anything.
function add(uint newesta, uint newestb) override public pure returns (uint _newestValue) {
^------^

Is there a way in which I can override the function defined within the same contract?


texts:
I need help, i don't understand this Error...
Code:
function _transferFromExcluded(address sender, address recipient, uint256 tAmount, bool lottery, bool updateWinner) private {
    uint256 currentRate =  _getRate();

    (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tBurn) = _getValues(tAmount);
    uint256 rBurn =  tBurn.mul(currentRate);

    _tOwned[sender] = _tOwned[sender].sub(tAmount);
    _rOwned[sender] = _rOwned[sender].sub(rAmount);
    _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
    _reflectFee(rFee, rBurn, tFee, tBurn);
    if (lottery == true && updateWinner == true) {
        uint winnings = getTotalWon(recipient);
        uint256 _totalWin = winnings.add(tTransferAmount);
        updateWinnings(recipient, tTransferAmount, _totalWin);
    }
    emit Transfer(sender, recipient, tTransferAmount);
}

Erro:
CompilerError: Stack too deep, try removing local variables. _tOwned[sender] = _tOwned[sender].sub(tAmount); ^----^


texts: Should callbacks be called twice from both MyContract.new and MyContract.myFunction on web3 API?

texts:
When I instantiate a contract with myContract.new() like this:

 MyContract.new({ from: addr, data: code, gas: gas, gasPrice: price }, function (error, contract) {
                    if (!error) {
                        if (typeof contract.address != 'undefined') {
                            console.log("second call");
                            console.log('Confirmed. address: '
                                + contract.address
                                + ' transactionHash: '
                                + contract.transactionHash);
                        } else {
                            console.log("first call");
                        }

                    } else {
                        console.log('geth callback error: ' + error);
                    }
                });

.. the function gets called twice. First with the transaction hash (not shown) and the second with a contract address (shown).

Should I expect subsequent use of the contracts methods that are transactional to call the callback twice?

    var myContract = MyContract.at(cAddr);

    myContract.myFunction(par1, par2,
        { from: addr, data: code, gas: gas, gasPrice: price },
        function (error, obj) {
            if (error) {
                console.log("whoops!");
            } else {
               console.log("myFunction called");
            }
        });


texts: Assigning an array creates a pointer or copies an array? (Solidity)

texts:
Here is the code:

pragma solidity^0.4.16;

contract Test {

    struct SomeData {
        address[] users;
    }

    address[] nullArray;
    mapping(uint => SomeData) SomeDataList;

    function insertData(uint number) {
        SomeDataList[number] = SomeData({
            users : nullArray
        });

        SomeDataList[number].users.push(msg.sender);
    }

}

In insertData function I initialize a new structure and assign nullArray to users field (users now store a copy of nullArray or a pointer to it?). After that, I push some data to this structure and I'm not sure whether the global variable nullArray will be affected or not.


texts: How is the nonce in a the block header arrived at?

texts:
My understanding is that the nonce in the header of an Ethereum block is an integer within a certain range (greater than 0).

However, when I look at the blocks through an online block explorer, such as etherscan, I see the nonce with values such as 0x885ddbbf0826351997.

In fact, if I look at blocks for the past year I can't find one that doesn't start with 0x88.

The Ethereum Yellow Paper stipulates that the nonce is a 64-bit hash

However, with a hashing function, it would be unlikely to see so many values starting with 0x88.

Can anyone tell me how the nonce used in finding a valid hash for a block in Ethereum results in the nonce shown in the block header?


texts: Old Geth wallet copied to Parity but doesn't show up in UI

texts:
I have an old Geth file from its keystore (the UTC-.... file), and I would like to migrate it to Parity. I have copied the file to wherever Snap stores Parity's keystore files, and I can see the account showing up when I run parity account list. However, the account doesn't show up in the Parity UI.
In the UI, I tried Accounts / + Account / Geth keystore, but that just results in the message:

There are currently no importable keys available from the Geth keystore, which are not already available on your Parity instance

I have also tried Accounts / + Account / JSON file, but that in turn results in the message

[-32601] Method not found


texts: Do function calls on contracts return any data to the sender?

texts:
I'm playing around with Solidity in Remix and I noticed the console will output transactions such as:

 from    -
 to     browser/Untitled3.sol:HelloWorld.greeting() 0x5e72914535f202659083db3a02c984188fa26e9f
 transaction cost   23147 gas (Cost only applies when called by a contract)
 execution cost     1875 gas (Cost only applies when called by a contract)
 input  ef690cc0
 decoded input  {}
 decoded output     {
    "0": "string: Hey world, this is a smart contract!"
}
 logs   []

When a user calls a function on a contract, do they get this sort of data spit back at them? Specifically, the output field in the above log. Or is this just a part of the IDE for development purposes? Thanks


texts:
ether
I have an Ethereum wallet address (the public key is known by other people). I periodically receive payment on this address (and cannot change it/receive to other address).
I need: When I receive a payment on it, automatically and immediately it sends/forward them to my new wallet address (the private key is known only by me).
Is this possible and how? I am new to programming, kindly inform me on how to begin doing this.


texts: How to use set and get in IPFS with Embark Framework?

texts:
I am using Embark Framework.I am trying to store a string value in IPFS and then to retrieve that string using the hash.

Contract Code (simple_storage.sol) :-

pragma solidity ^0.4.7;

contract SimpleStorage {
         string public storedData;
         function SimpleStorage() {
                      storedData = "hello world";
         }
         function set(string x) {
                      storedData = x;
         }
         function get() constant returns (string x) {
                     return storedData;
         }

 }

Index.html Code :-

       <title>Embark - SimpleStorage Demo</title>
       <link rel="stylesheet" href="css/app.css">

Embark - SimpleStorage Demo

 1. Set the string in the blockchain

           <input type="text" class="text form-control">
           <button class="set btn btn-primary">Set String</button>

 2. Get the current value

                current value is

         <button class="get btn btn-primary">Get String</button>

Index.js Code :-

EmbarkJS.Messages.setProvider('orbit',{server: 'localhost', port: '5001'});
$(document).ready(function() {
      $("button.set").click(function() {
            var value = $("input.text").val();
            EmbarkJS.Storage.saveText(value).then(function(hash) {
                     SimpleStorage.set(hash);
            });
      });
     $("button.get").click(function() {
             SimpleStorage.get().then(function(hash) {
                     EmbarkJS.Storage.get(hash).then(function(content) {
                              $(".value").html(content);
                    });
            });
  });
});

I am given a string as input and it returns string as output correctly.How can i verify the values stored in orbit db?

I have tried using 'ipfs' instead of 'orbit'.But the code won't get worked?What is the issue?


texts: Aprrove and transfer a ERC20 token to a contract

texts:
I need to use a contract to trigger a function and transfer the token of the msg.sender to (this) contract. I can do it with the "approve" function in the Token contract, but I can't do it with this contract it self.

Any idea?

pragma solidity ^0.4.18;

contract ERC20 {

    address public tokenAddr = (my token address);
    ERC20 public token;

    function transfer(address _to, uint256 _value) public returns(bool);
    function balanceOf(address tokenOwner) public constant returns (uint balance);
    function approve(address spender, uint256 value) public returns (bool);
    function transferFrom(address from, address to, uint256 value) public returns (bool);
    function allowance(address owner, address spender) public view returns (uint256);
}

contract SAY is ERC20 {

    string word = 'Something';

    function SAYSOMETHING() public returns(string)  {

        token.approve(msg.sender, 500);
        token.transferFrom(msg.sender,this, 500);
        return word;
    }

}


texts: how localethereum works with its browser wallet

texts:
I am currently using https://localethereum.com service, it has a browser based wallet, its faq mentions that

  The localethereum.com wallet is completely embedded inside of your
  browser. Similar to how messages are secured, the localethereum wallet
  is designed so that your Ethereum address private keys are generated
  offline in your browser.

all I know from the faq is online server stores identity key, and the identity key is used to sign signed key pairs and Ethereum addresses

  Identity verification - Each pre‐key is signed by the identity key of
  its owner so that you know you are always talking to the right person.

  MakerKeypublic and MakerKeysignature are submitted to localethereum's
  server for safe-keeping. The private key is encrypted safely using
  AES-256 with a random IV and stored online too (at least for now).
  Alice goes ahead and generates and signs (using her identity key)
  hundreds of Ethereum addresses.

First question, is this identity key a (public key/ private key pair), and it mentions that 'Once Bob verifies both signatures to Alice's public key', is this Alice's public key a identity key or public makerkey ?

Second question, as shown in the wallet

the web app shows the wallet address and it also allows me to export the private keys, as it generates the private keys offline, it seems not to store the private keys online as well, but if i change the browser or computer, why could i still get access to the wallet and private keys? it there a way to do it by not storing the wallet address and private key on the server ?


texts: How do I get the available reserve size for a given token on Kyber and Uniswap(V2)

texts:
I am doing arbitration with some measure of success; but I suspect I am running into edge cases where the available reserve size is less than what I am trying to buy or sell.
Something like this:
function kyberToUniSwapArb(address fromAddress,address toAddress, uint ethAmount) public payable returns (uint256){

    uint256 cryptoAmountPurchased = buyCryptoOnKyber( ethAmount , fromAddress);

     sellCryptoOnUniswap(cryptoAmountPurchased , toAddress);

    }

AND
function uniSwapToKyberArb(address fromAddress,address toAddress, uint256 ethAmount) public payable {

    uint256 cryptoAmountPurchased = buyCryptoOnUniswap( ethAmount , fromAddress);

     sellCryptoOnKyber(cryptoAmountPurchased , toAddress);

    }

QUESTION
Are there any methods in Uniswap(V2) and Kyber exchanges that I can use to determine the reserve size before buying a given amount of a token or selling a given amount.
Thanks a lot


texts: Smart contract for selling log-in subscription service

texts:
If not ethereum, which smart contract token would be best suited for fulfilling the sale of a month-long anonaymous subscription for cryptocurrency that enables the buyer to have their own username and password for a website?
how can this be done versus selling website subscriptions by credit card payment. Would it make more sense to abandon using smart contracts altogether, and just use BTCPayServer?


texts: Why uint foo = 5, foo/=6 work, but not foo = 5/6?

texts: I'm writing a contract that evaluates (foo/x)*x to give equivalent of math.floor(foo/x)*x. It works, but if I hard code numbers instead (I don't need to do that, just interested), (5/6)*5, it is not allowed in Remix. What is the rationale for that? I'm mostly asking to know if using (foo/x)*x is a bit of a hack, or if the language supports that intentionally (if it does, just don't see why (5/6)*5 is not allowed.. )


texts: Error message shown as [object Object] when use require, how to get actual error message string in Remix IDE Console?

texts:
I have used require function as:
require(owner == msg.sender, "Sender must be owner");

But in the remix console I got,
transact to Contract.setAdmin errored: [object Object]

What should I do to get proper error message? Also the same contract, using metamask is successfully deployed on Rinkeby. Is it the matter of traffic on that testnet?


texts: Where are users of Ethereum 2.0 located?

texts:
I was going through some caracteristics of Ethereum 2.0 for research purposes and I couldn't quite figure out where the users are located ?
As I understand, a validator is registered on the beacon chain and dispatched to a shard / committee to validate that given shard right ? (A validator is also able to validate both the beacon chain and a shard). Are simple users also assigned to shards knowingly or not ? or are they broadcasting to the beacon chain that will divide the transactions set as well as the validators and dispatch it in the different shards ?
Thanks a lot !


texts: How can I split a Bytes32 source into two halfs and store them in Bytes16?

texts:
I want to split a 32 Byte source: first half in Bytes16 half1; second half in Bytes16 half2. My code works, however only for dynamic array, not with fixed size 16.

pragma solidity ^0.4.8;

contract cut {

    function cutSha(bytes32 source) constant returns (bytes, bytes) {
        bytes memory half1 = new bytes(16);
        bytes memory half2 = new bytes(16);
        for (uint j = 0; j < 16; j++) {
                half1[j] = source[j];
                half2[j] = source[j+16];
        }
        return (half1, half2);
    }
}


texts: how to interactive with geth frequently?

texts:
mHandler = new Handler();
Runnable r = new Runnable() {
    public void run() {

            BigInt bBalance = new BigInt(0);
            try {
                Address address = new Address(addressString);
                mEthereumClient.getBalanceAt(mContext, address, DEFAULT_TO_CURRENT_BLOCK_VALUE);
            }catch (Exception e)
            {
                DerbyLog.LogError("getBalanceAt " + e.getMessage().toString());
            }

          //每隔1s循环执行run方法
          mHandler.postDelayed(this, 10000);
    }
};
mHandler.postDelayed(r,100);

this code will stop with unknown reason   why?


texts:
When i try to load genesis block using the following command:
geth --datadir privchain init genesis.json, i get the following error,

  Fatal: failed to write genesis block: invalid character '.' after object key:value pair

Here is my genesis file:

{
  "config": {
    "chainId": 15,
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip158Block": 0
  },
  "difficulty": "200000000",
  "gasLimit": "2100000",
  "alloc": {
    "af8bd873406715dc1444077bb9d65c8800f7acdf": {
      "balance": "400000"
    }
  }
}

I am using this genesis file from this link:
https://github.com/ethereum/go-ethereum/wiki/Private-network
can someone help me out here please? Thank you


texts: Sign and send transaction (call contract function)

texts:
I am using ethereumjs-accounts providerfor transaction signer in HookedWeb3Provider. And I am trying to call contract function which send tokens.
It's my params for sign transaction.

let tx_params = {
        nonce: '00',
        gasPrice: '100',
        gasLimit: '100',
        from: account,
        to: contractParams.address,
        value: '00',
        data: '' //what should I place here to call contract function with arguments?
    };

then I am calling sign method:

signTransaction(tx_params, (err, hash)=>{})

and receiving hash

0xf86280820100832fefd894efcc9f9a5cb3d6062c18eeffdf90a29bb771fccc80801ba07c0226eb53fc4c8031a5346389fb17125b37ca96bec2ce5dd651808c8356ea9aa0aef5cb9e2a0426a6af2193a0fd9d3ec09f334614594faa54be17d9ddd64b72b1

A didn't understand how to send transaction with web3js and put there a signed transaction (or hash?)

this.web3.eth.sendRawTransaction();


texts: Is there a way to access my wallet's private key? Recovering passcodes?

texts:
Not sure if this is appropriate here, but I'm trying to recover a lost wallet by brute-forcing the passcode.

From a previous answer to the same question, it seems like the developers decided against exposing private keys to the users.

Is there any way to test potential passcodes to my wallet without resorting to Geth's CLI?


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

texts: Can you please help me out how to explicitly convert address to address payable as i am using solidity compiler above 0.5 its asking me to have address payable when i use transfer().


texts:
I'm trying to assign values passed into a constructor to the instance variables but the assignment doesn't seem to be working and all the values are set to null.

contract MarketMaker {
address iplogic;
address ipxaddr;
function MarketMaker(address _iplogic, address _ipx) {
    iplogic = _iplogic;
    ipxaddr = _ipx;
    log(ipxaddr);
    log(_ipx);
}
event log(address ipx);
function createNewMarket(string prop, uint256 minBet, bool initUtility) onlyIplogic returns (address, address) {
    log(ipxaddr);
    log(iplogic);}

The log works for the constructor and outputs the correct address but when I call createNewMarket the log doesn't display any address and in further testing it can be seen that both ipxaddr and iplogic are null.

I'm not sure why this would be happening.

Thanks in advance.


texts: Untitleded.sol:5:77: ParserError: Expected type name function sendmessage(string message) view public returns(string message, memory) { ^----^(i need)

texts:
I've seen the other StackExchange errors but it didn't help me.

Untitleded.sol:5:77: ParserError: Expected type name function sendmessage(string message) view public returns(string message, memory) { ^----^

This is the full code:
pragma solidity 0.5.1;

contract chat{
   event sendmessage(string message);
   function sendmessage(string message) view public returns(string message, memory) {
       emit sendmessage(message);
       return message;
   }
}

How can I fix this?


texts:
I tried to send a signedTransaction using a low gas price (it's my will to test timeoute of my scripts)

I supposed also that a not mined transaction was 'pending', so I tried checking, while the first transaction has not been mined yet, using

web3.eth.getPendingTransactions();

I got every time an empty array.

Why?

So, what is a pending transaction?


texts: How to use Whisper protocol in solidity smart contract (Documentation)

texts: I am developing a smart contract and it will need to communicate with ethereum user addresses (openly or privately). I need to make use of a encrypted messaging protocol. After some searching, I found whisper. But I don't understand how to make use of it in my solidity contract. Can somebody guide me to a documentation for that? Thank you!


texts: Setting up a desktop wallet with a private network on geth

texts:
Disclosures:

I've never set up a wallet before, and am new to geth.
I'm not worried about security right now. My goal is to set up several wallets on my private chain (if possible) in order to learn how wallets work, how they sign transactions, etc.
I'm not tech-illiterate. (I've been a programmer for 27 years.)

Background:

Running geth on a private network.
Using truffle to deploy test contracts.
Installed the truffle HDWalletProvider in order to sign transactions.
The wallet won't sign transactions because the addresses in the wallet are not the same as the ones that geth recognizes.

First, is there a way to import the accounts from the wallet into geth and fund them on the existing private network? Or do I have to start with a new genesis block that allocates and funds the same addresses that are in the wallet? If not, then how do I make sure the private network recognizes the same accounts that the wallet does?
Second, is there a way to export accounts from geth into the wallet? I have a hunch there isn't, but thought I'd ask anyway.
Third, I have heard that MEW is a good desktop wallet that can be used on a private network. I went to their website and tried to create a wallet, starting with a mnemonic, then it showed me the addresses in the new wallet and I clicked to accept the terms, but the "Access My Wallet" button remained inactive. Does this even work? Is MEW the wrong choice of a desktop wallet for a private network? I've heard it's one of the best wallets out there, but it won't give me access to the wallet I just created. Here is what I see.

Fourth, can anyone recommend other desktop wallets that are easy to set up, give me full control of private keys, addresses, etc. and will work with a private network?


texts: ipfs.add TypeError: AbortController constructor: 'new' is required

texts:
I am using latest version "ipfs-http-client": "^48.2.2"
<form onSubmit={ async (event) => {
                    event.preventDefault()
                    try{
                        const postResponse = await ipfs.add(buffer)
                        console.log("postResponse", postResponse);
                    } catch(e){
                        console.log("Error: ", e)
                    }
}} >

The buffer variable is in this format (from the console): Uint8Array(951674) [ 137, 80, 78, 71, 13, 10, 26, 10, 0, 0, … ]
I am getting TypeError: AbortController constructor: 'new' is required after pressing submit.
Other info:

using Ganache, VSCode, solc 0.8.0, web3 1.0+
this is a snippet from a react component

EDIT: I am not using AbortController anywhere in the code. The error does not provide line numbers from my code (if that makes sense)


texts: How to get token address inside a crowdsale contract, if you create separate migration files?

texts:
To expand on the question, I have created an erc20 token contract, & a crowdsale contract. For each file, I intend to create separate migration files.
How can i get the token address for reference in the crowdsale contract?
Thank you

Sidenote:
I am aware of the general approach, most contracts have a single migration file, say deploy.js. In which, crowdsale contract inherits the token address through a promise.


texts: can someone explain this line of the whitepaper?

texts:
To show how ethereum had made it's language turing-complete Vitalik in his white paper gave this example:
"To show the motivation behind our solution(i.e using gas), consider the following example:
A financial contract works by taking the median of nine proprietary data feeds in order to minimize risk. An attacker takes over one of the data feeds, which is designed to be modifiable via the variable-address-call mechanism described in the section on DAOs, and converts it to run an infinite loop, thereby attempting to force any attempts to claim funds from the financial contract to run out of gas. However, the financial contract can set a gas limit on the message to prevent this problem. "

What are the "proprietary data feeds" he is mentioning about?
"An attacker takes over one of the data feeds,..." how does the attacker takeover(control) one  datafeed.
What kind of datafeed is he mentioning about? Is it a number, address, contract or any other thing?

I am new to ethereum so please explain in plain english.
Thank You!!


texts:
EOS requires token holders to generate public keys and register them, by using their "register" function in their smart contract.  Here's the function (copied from Etherscan):

mapping (address => string) public keys;
...
event LogRegister (address user, string key);
...
// Value should be a public key.  Read full key import policy.
// Manually registering requires a base58
// encoded using the STEEM, BTS, or EOS public key format.
function register(string key) {
    assert(today() <=  numberOfDays + 1);
    assert(bytes(key).length <= 64);

    keys[msg.sender] = key;

    LogRegister(msg.sender, key);
}

They store the public keys in:

keys[msg.sender] = key;

I'm thinking of doing something similar, but I do not see how EOS extracts and downloads the "keys" array.  EOS does not have a function to iterate through this array and to return the values.  How does one download the "keys" array?

Is it possible to get all of the values from "keys" from Etherscan (because of LogRegister event)?  If so, how?


texts: While using populus on pytest how could I transfer byte array as an input to the smart-contract like in solidity browser?

texts:
I have following contract; I can call set()with following byte array on solidity browser. The smart contract accepts the input as bytes32. I assume if geth and solidity browser sees a string starting with 0x, it converts it to byte format.

Following transaction call works without having any problem.

myContract.set("0x15CEF23823A9410D60CB6E6CC56046EC6035A9353100476EA28C94752AF104CD")

myContract.get()
Returns: "0x15CEF23823A9410D60CB6E6CC56046EC6035A9353100476EA28C94752AF104CD

My contract:

contract Contract {
  bytes32 public hash;
  function set(bytes32 hash_) returns (bool success)
  {
        hash = hash_;
  }
  function get() constant returns bytes32 {
     return hash;
   }
}

I want to do same operation on Populus.
When I try to call it as on test_greeter.py:

def test_greeter(web3, accounts, chain):
    myContract, _ = chain.provider.get_or_deploy_contract('Lottery')
    set_txn_hash = myContract.transact().set("0x15CEF23823A9410D60CB6E6CC56046EC6035A9353100476EA28C94752AF104CD")

It gives following error, I assume python sees the input given to set() as string instead of bytes. And the string version of the input exceeds the byte32.

   @classmethod
    def _encode_abi(cls, abi, arguments, data=None):
        argument_types = get_abi_input_types(abi)

        if not check_if_arguments_can_be_encoded(abi, arguments, {}):
            raise TypeError(
                "One or more arguments could not be encoded to the necessary "
                "ABI type.  Expected types are: {0}".format(
>                   ', '.join(argument_types),
                )
            )
E           TypeError: One or more arguments could not be encoded to the necessary ABI type.  Expected types are: bytes32

[Q] While using Populus on pytest how could I transfer byte array as an input to the contract like in solidity browser?

Thank you for your valuable time and help.


texts: Link a profile page to an ethereum address?

texts: If I have made a page with meteor where a user can login and see his own personal profile page, is it then possible to link that profile page to an ethereum address, so the user can update his profile information which is then saved on the blockchain?. So when a user creates an account, he is also given an address and some ether?


texts:
I am working on a small project designed to show and teach people how the blockchain and smart contracts operate. In order to do so I had in mind to showcase the transactions on https://testnet.etherscan.io corresponding to my function calls. What I want to do here is to read the payloadData field from the transaction and to translate it into human readable code (using the ABI I guess) such as: createReferendum("Name"). I am using Node.js. In a nutshell, I want to do the opposite of what the following code does :

const _ = require('lodash')
const SolidityFunction = require('web3/lib/web3/function')
var closeReferendumsFormat = new SolidityFunction('', _.find(ABI, { name: 'closeReferendums' }), '')
var payloadData  = closeReferendumsFormat.toPayload([]).data

I have been looking thoroughly but haven't been able to find any way to achieve that.
Thank you for your insights!


texts: Does ganache-cli support istanbul hardfork?

texts:
I am trying to run ganache-cli with istanbul --hardfork, but I am having following error:

Error: Hardfork istanbul not set as supported in supportedHardforks

$ ganache-cli --version
Ganache CLI v6.4.1 (ganache-core: 2.5.3)

$ ganache-cli --allowUnlimitedContractSize --port 8547 --gasLimit 6721975 --accounts 10 --hardfork istanbul
Error: Hardfork istanbul not set as supported in supportedHardforks
    at e.setHardfork (/Users/alper/.npm-packages/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:2:148221)
    at new e (/Users/alper/.npm-packages/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:2:147540)
    at new _ (/Users/alper/.npm-packages/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:61:490034)
    at v.createVMFromStateTrie (/Users/alper/.npm-packages/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:47:116822)
    at /Users/alper/.npm-packages/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:47:116382
    at /Users/alper/.npm-packages/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:47:117447
    at /Users/alper/.npm-packages/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:61:1841439
    at /Users/alper/.npm-packages/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:61:1840514
    at /Users/alper/.npm-packages/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:61:1845356
    at /Users/alper/.npm-packages/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:61:1842719
    at /Users/alper/.npm-packages/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:61:1863594
    at /Users/alper/.npm-packages/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:61:1870971
    at ReadFileContext.callback (/Users/alper/.npm-packages/lib/node_modules/ganache-cli/build/ganache-core.node.cli.js:61:1869433)
    at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:242:13)

[Q] What should I do to fix it?


texts: Local caching database for fast retrieval

texts:
I'm currently working on dApps for a private blockchain based on ethereum. While it works fine and the dApps really show the power of the blockchain it lacks the speed and versatility of a SQL database. (I know i know blockchain != database).

Example where it lacks is getting specific data. Because you don't have SQL like queries you need to loop through a lot of data. Or if have a array of a struct you want that back, this also poses an issue.

So I was thinking about an caching mechanism to cache data that is verified by the network in a local database for fast querying.

Google failed when searching for this so my question does something like this really not exist? If it doesn't exists what do I need to keep in mind if I want to design a system like this myself.


texts:
I am interested working with MyEtherWallet as a programmer. For my first project I would like to remove the parts which would not be used on an air-gapped computer. I am already familiar with HTML, JavaScript, CSS, Geth, Web3 and Solidity. The github page tells what one needs to know in order to compile and run the code.

Would someone please tell me what other languages, libraries, frameworks, and technologies I will need to study in order to make useful changes and additions to the MyEtherWallet open source project? Also please tell me if you know about any good learning resources which are particularly applicable to working with MyEtherWallet source code.
Thanks for the help

Update: Some kind person on another forum told me that by looking in the package json file I can tell Angular 1 is used. I am off to YouTube to find out how to work with Angular 1 then I will take a crack at understanding how MyEtherWallet works.

Any other advice of that nature would be much appreciated.
Thanks


texts: What is the cause of an "APPROVED" transaction but doesnt do a "TRANSFER" for an ERC-20 Token?

texts: I have a transaction that was approved and I paid $3 in fees. But the token was never "transfered" where and how can I debug what happen to my transaction of why it didn't transfer?


texts: Error: authentication needed: password or unlock when deploying a contract with truffle

texts:
i am using angular with truffle. I am trying to deploy a contract through truffle migrate. here is my 2_deploy_contracts.js

var contractFacotry = artifacts.require('./contractFactory.sol');

module.exports = function(deployer, accounts) {
deployer.deploy(contractFacotry), {
from: accounts[accounts.length-1]
};
};

and i have unlocked this account as well in truffle console.here is it's ss

but when i migrate with truffle migrate i am getting following error

any idea what's wrong here?

UPDATE

My 1_initial_migration.js is following

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

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

and Migrations.sol is following

pragma solidity ^0.4.2;

contract Migrations {
  address public owner;
  uint public last_completed_migration;

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

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

  function setCompleted(uint completed) restricted public {
    last_completed_migration = completed;
  }

  function upgrade(address new_address) restricted public {
    Migrations upgraded = Migrations(new_address);
    upgraded.setCompleted(last_completed_migration);
  }
}


texts: How to check whether MetaMask is installed?

texts: How to check from client-side JavaScript whether MetaMask is installed?


texts: Can ERC20 Token be minted and rewarded automatically based on whatever command?

texts:
I have a project where I intend to pay my users through a ERC20 Token.

We intent to develop an AI learning machine which will gather information from users activities based on task they need to accomplish on our platform to get paid. We want the AI software to interact with the smart contract by updating it with the information needed. Once the smart contract receives such info, then it will mint the needed token and reward each members in their ethereum wallet based on the report the AI has supplied.

I'll like to know if this is possible and how it could be done.

Your kind contribution will be highly appreciated.

Thank you


texts: Javascript library to use zkSnark circuit

texts:
I would like to generate the proofs for zkSnarks on client side and therefore would need a library in javascript that helps to read a circuit and generate proofs. I found one combination here which seems promising: https://github.com/iden3/circom (for creating circuits) and the corresponding library to use in javascript here: https://github.com/iden3/snarkjs

Unfortunately, I cannot find any documentation regarding Circom anywhere except for one tutorial on their GitHub page. I would like to know if there exists any detailed documentation for it or when will it be available.

If there is any other library that serves my purpose, I would be happy to know about it.


texts: What is meaning of "address: equivalent to uint160, except for the assumed interpretation and language typing."?

texts:
I'm reading solidity document and cannot understand the meaning of "address: equivalent to uint160, except for the assumed interpretation and language typing." in the doc

Does anyone know what is the exactly meaning?
Thanks in advance!


texts: eth_estimateGas rpc is very slow. I'm using geth node. It worked fine a few days ago. Is network congestion the reason?

texts:
I'm using geth 1.7.2-stable. I noticed "eth_estimateGas" is very slow. It does not show the result. I confirmed that it worked a few days ago. Someone said the number of transaction is very high from yesterday. Is it related to my issue? How can I fix it?

$curl -X POST --data '{"jsonrpc":"2.0","method":"eth_estimateGas","params":[{"to": "0x109aa384b8786e55abfa1f0ac6cb0561e0a06e94", "from": "0xdf4221b931b6ad4f4f221e2eb03913bd4368d0ba"}],"id":1}' http://localhost:1234

Update 1

After I restart the geth process, it worked for a few minutes. After that the same issue was occurred again.

Update 2

Seems v1.7.3 was released. I will update my node and try it again.

https://github.com/ethereum/go-ethereum/releases/tag/v1.7.3

Update 3

I updated to 1.7.3-stable but it did not work yet.

Update 4

It worked when I call the same API with infura.io. Although I don't know what node mainnet.infura.io uses but it seems that my node has some issues.

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_estimateGas","params":[{"to": "0x109aa384b8786e55abfa1f0ac6cb0561e0a06e94", "from": "0xdf4221b931b6ad4f4f221e2eb03913bd4368d0ba"}],"id":1}' https://mainnet.infura.io/

Update 5

Although it is still slow but I can get the result now. I did not change anything.

// call rpc to localhost
$ time curl -X POST --data '{"jsonrpc":"2.0","method":"eth_estimateGas","params":[{"to": "0x109aa384b8786e55abfa1f0ac6cb0561e0a06e94", "from": "0xdf4221b931b6ad4f4f221e2eb03913bd4368d0ba"}],"id":1}' http://localhost:8545
{"jsonrpc":"2.0","id":1,"result":"0x5208"}

real    0m4.195s
user    0m0.004s
sys 0m0.000s


texts: Using injected web3.js in Vuex as a plugin

texts:
I would like to use web3 inside the store as a Vuex plugin, so I can call this.web3 inside actions and mutations without having to pass the web3 instance from my components to the store. But since the store is compiled before web3 is injected, I'm wondering if it's even possible to write a plugin which could work like this.

I'm using Nuxt.js, by the way. So maybe there's something within Nuxt that would make this possible.


texts: how blockchain-cloud companies like Storj prevent changing files by farmers?

texts:
How does companies like Storj handle the possible situation of farmers who can change the files that they store?

Say I upload to the blockchain cloud network the file "cat.jpg". Now a contract added to the blockchain, with details of : "cat.jpg is stored at:X,Y,Z and the hash of this file is 0x123".

Now, what happen if all the farmers who stores my cat.jpg file (X Y and Z in this exmaple) change this file? when I want to return this file from this blockchain cloud, I would see in the contract that X Y and Z have my files, and all of them change the file (by comparing the hash value of the file in the contract, and the hash value of the file after they changed it), and now what? Companies like Storj can't just say to the costumer that his file is corrupted.. what is the point of this costumer to use this cloud , if there's a possible chance that the farmers (clients that store my files) can easily (or not, but there's a possible ways) change my files?

So how do companies like Storj prevent this situation and promise that the file that I store on their blockchain cloud, will return to me without any corruption?

Thanks in advance


texts: Mapping an address to a balance with keeping history of transactions

texts:
I have a balance as follows such that after changing its value, I want to keep the history of previous transactions, for example, for the first time, value of Energy_Balance is 5 and for the second time 2 units will be added to Energy_Balance such that the total value will be 7. Now I want to keep the history of all transactions such that we would be able to know what was the first value (i.e. 5) and what was the second transaction value (i.e. 2). If I have to define an event for this, how to define it and how to invoke event ?

mapping(address => uint256) Energy_Balance

In case of using an array as proposed by user Eli Drion, as follows:

mapping (address => uint[]) Energy_Balance

How can I set the new value of Energy_Balance ? For example,

First Transaction: balances[owner][0] = balances[owner][0] + value;
Second Transaction: balances[owner][1] = balances[owner][1] + value;

is correct ?


texts: After digging a bit deeper into plasma the following question came to my mind: can a TestNet - e.g. Rinkby or Ropsten be a SubChain in plasma? As far as I understand this might be possible and one could e.g. move tokens between TestNets and the Main-Net. But I would love to make sure If I understand this correctly.


texts: Is ethereum transaction fee supposed to be proportional to the amount sent

texts:
I am using the blockchain.info iOS wallet. I am trying to send a small amount of ETH. However, the fee “suggested” by the wallet is a whopping 0.003234 (~ 6 USD). If I changed the amount of ETH i want to send, this suggested fee didn’t change. Is this more or less fixed? When I think about it, the miners probably don’t care much about the amount of ETH I want to send, it will be the same processing to them. So the fee is more or less fixed?? is this right? Or this is just some weird behavior of this particular wallet. This doesn’t seem to make sense if you only want to send a ~$100 USD worth of ETH and have to pay $6 fee.
Could someone kindly explain? It’s been a long time since I sent ETH, and last time, I don’t ever remember the fee being this high.


texts: So, I can't understand how to input correctly args


texts: MetaMask and it's "speed up transaction feature" -- no callback

texts:
I'm using MetaMask to make Ethereum transactions from my website, as described here: https://metamask.github.io/metamask-docs/Main_Concepts/Sending_Transactions

It works perfectly. I capture the transaction hash in the callback, then use it to track the transaction.

But I just noticed something; metamask has the option to "speed up" the transaction. I'm not sure exactly how it works, but this basically creates a new transaction with a larger gas price. However the callback is not called again.

I'm not sure exactly what it is doing. When I searched for the original transaction hash on an explorer, it doesn't exist. So they canceled it somehow?

I guess my problem is; how does my website know the original txhash is dead and receive the new txhash? How do people deal with this?

I also considered tracking the user transactions from the blockchain side, using subscribe to "Pending Transactions" function in web3, however this call cannot be filtered and so I get ALL pending transactions, not just transactions to my smart contract. This might be ok if I was running my own node, but I am using Infura. I would need to call Infura to get details on every pending transaction, probably they would ban me if I did that.

Does anyone have any insights?


texts: Is it possible to see ENS domain controller history?

texts:
What the question says. If I change controller of an ENS domain, will there remain a record on the previous controller? Where can I see it?
Thanks!


texts: Invoke contract from one account and pay gas using another account

texts:
Is it possible to invoke a contract method from a given account (that I own) and pay for the gas using a different account (that I also own)? Concretely I'm trying to transfer ECR20 tokens from an account that doesn't have any Ether, and I was hoping to do this without having to transfer Ether to it to pay for the transaction.

Thanks.


texts: Does mobile wallets run a node in mobile device or they depend on an external node?

texts:
This answer mentions about several mobile ethereum wallet apps.

I am interested in building a mobile wallet app, and wanted to know how existing apps work.

Does anyone know whether any of these apps run an ethereum node in the mobile device? Or do all of them connect to an external ethereum node for obtaining information about the chain and send transactions?


texts: Is it possible for smart contract to link received tokens to the senders

texts: I know when my smart contract has a payable fallback function, I can record who have sent ether to the contract and how much ether each of them have sent by storing the msg.sender and msg.value data in an array or something. However I wonder if I may achieve similar function with erc20 tokens. So that when someone transfers a certain erc20 token to the smart contract address, it will record it so later I can check who have sent tokens to my contract and the amount of token each of them has sent.


texts: Subscribe to changes in contract balance (Web3j)

texts:
Using web3j I would like to subscribe to changes in a contract balance i.e deposits and withdraws.

I would like to base this subscription over transactions (and not events) since the contract does not emit deposit/withdraw events.

The deposit part is pretty easy since I can use the tx.getValue() filter:

Observable<Transaction> res = web3.catchUpToLatestAndSubscribeToNewTransactionsObservable(DefaultBlockParameterName.LATEST);
res.subscribe(tx -> {
            if (contractAddress.equals(tx.getTo()) && tx.getValue().compareTo(BigInteger.ZERO) > 0) {
                handleDepositeTX(tx);
            }

The withdraw (contract sending ether to some other address) is not that straight forward. I guess I can maintain the contract balance before and after each transaction but this doesn't feel right/safe:

    res.subscribe(tx -> {
        if (contractAddress.equals(tx.getTo()) && tx.getValue().compareTo(BigInteger.ZERO) == 0) {
            EthGetBalance currentBalance = web3
                    .ethGetBalance(contractAddress, DefaultBlockParameterName.LATEST)
                    .sendAsync()
                    .get();
            BigInteger diff = prevBalance.subtract(currentBalance);
            if (diff.compareTo(BigInteger.ZERO) > 0) { // withdraw
                handleWithdrawTX(tx);
                prevBalance = currentBalance;
            }

Is there a 'right' way of subscribing to a contract balance change?
How can i know if as a part of some transaction ether was transferred form some specific contract to some other destination?


texts: How can I run smart contract locally on my computer?

texts:
We all know that Ethereum nodes can run smart contract. But I'm wondering whether can I setup contract run-time environment from Ethereum source code locally so I can run smart contract without simulated network or tools like Truffle and web3 ?
And Ethereum says

  ... as a library that you can embed in your Go, Android or iOS projects.

So I guess it means I can call EVM from Go-Ethereum to run smart contract. Am I right?
Finally how can I use Go-Ethereum as a library(especially the evm part which execute smart contract bytecode)?


texts: How to get historical value of a state variable?

texts:
I am unsure of the best way to do this. I have a pool contract with a state variable of the total balance of the pool. I want to show a line chart on my dApp that shows how the balance of the pool has changed for the past X (let's say 30) days.
My question is what is the best way to query for this data and are there any tools that would be ideal for such situations (if I want to add more graphs in the future, for example).


texts:
As my title says, I am a complete newbie to the Ethereum Project, but not to the cryptography in general. Although this will be the first time I will consider investing in the mining process. And I just would like to know, what is the best current hardware is out there for mining, and where best to find available in stock to ship.

What's the best hardware for Mining Ether?


texts: What are the files in my go-ethereum configuration directory?

texts:
When I look into my go-ethereum (geth) configuration directory, I see the following files and directories:

 $ ls -alF ~/.ethereum/
total 176
drwxr-xr-x  8 pi pi   4096 Jan 20 07:19 ./
drwxr-xr-x 17 pi pi   4096 Jan 20 07:10 ../
drwxr-xr-x  2 pi pi   4096 Aug 31 06:16 blockchain/
drwxr-xr-x  2 pi pi 131072 Jan 22 07:40 chaindata/
drwxr-xr-x  2 pi pi   4096 Jan 20 07:19 dapp/
drwxr-xr-x  2 pi pi   4096 Aug 31 06:20 extra/
srw-------  1 pi pi      0 Jan 20 07:19 geth.ipc=
-rwxr-xr-x  1 pi pi     53 Oct 10 10:17 history*
-rw-------  1 pi pi     64 Aug 21 12:19 nodekey
drwxr-xr-x  2 pi pi   4096 Jan 22 04:18 nodes/
drwxr-xr-x  2 pi pi  12288 Aug 31 06:20 state/

Can you explain the purpose of each of them?


texts: Ethereum Wallet 0.8.9 - How to Run "--fast" Option?

texts:
I use Ethereum Wallet 0.8.9 on OS X.
Synching is very slow.

I found, there is a "--fast" option to run geth on the command-line. But I can not find "geth" anywhere, although the Wallet states it is running in "geth 1.5.9 (go)". So I assume, it must be there.

Where can I find geth on OS X to run the command line?
Is there any other way to start the wallet using "--fast" option?

Thanks!


texts: Should I not use this string-byte type casting assembly code?

texts:
My string to bytes32, bytes32 to string code is below.

  function _stringToBytes32(string _string)
    internal
    pure
    returns (bytes32 _bytes32)
  {
    require(bytes(_string).length < 33);
    assembly {
      _bytes32 := mload(add(_string, 0x20))
    }
  }

  function _bytes32ToString(bytes32 _bytes32)
    internal
    pure
    returns (string _string)
  {
    assembly {
      let m := mload(0x40)
      mstore(m, 0x20)
      mstore(add(m, 0x20), _bytes32)
      mstore(0x40, add(m, 0x40))
      _string := m
    }
  }

I find the warning from remix,

  static analysis modules do not parse inline Assembly, this can lead to wrong analysis results.

And on solidity document,

  Statically-sized memory arrays do not have a length field, but it will be added soon to allow better convertibility between statically- and dynamically-sized arrays, so please do not rely on that.

It seems that this is not the case of my code.
However, I want to know how much risk is relying on this assembly code.

My functions are rely on two facts,

Under 33 length alphanumeric string has 32bytes length field +
32bytes body field.
Bytes32 has 32bytes body field only.


texts:
Problem

I get the following error after running $ truffle migrate --reset:

  Running migration: 1_initial_migration.js   Replacing Migrations...
  ... 0x5b23d046a48e2b1707155f10d3b6e12848b55167198ebcc27288a51463f2a6d6
  Migrations: 0x4214c32de196e89f3aec37aa7ec58bf10e84347a   Replacing
  TestCrowdsale...   ...
  0x1241cadb6818bdb0cd9698b25b6abfae472c34dfa119107691108e24198db326
  Error encountered, bailing. Network state unknown. Review successful
  transactions manually. Error: VM Exception while processing
  transaction: revert
      at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:43303:16)
      at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:331156:36
      at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:175492:11
      at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:314196:9
      at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:315621:13)
      at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70159:18)
      at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70449:12)
      at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70604:12)
      at IncomingMessage. (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70564:24)
      at emitNone (events.js:111:20)

Environment

Truffle v4.0.1 (core: 4.0.1)
Solidity v0.4.18 (solc-js)
EthereumJS TestRPC v6.0.3 (ganache-core: 2.0.2)

Migrations file

My 1_initial_migration.js file looks like:

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

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

function deployTestCrowdsale(deployer) {

   const accounts = web3.eth.accounts;

   const startTime = latestTime();
   const endTime = startTime + duration.days(45);
   const rate = 2500;
   const goal = web3.toWei(250, 'ether');
   const cap = web3.toWei(4000, 'ether');
   const wallet = accounts[0];

   return deployer.deploy(TestCrowdsale, startTime, endTime, rate, wallet);

}

function latestTime() {
  return web3.eth.getBlock('latest').timestamp;
}

const duration = {
   seconds: function (val) { return val; },
   minutes: function (val) { return val * this.seconds(60); },
   hours: function (val) { return val * this.minutes(60); },
   days: function (val) { return val * this.hours(24); },
   weeks: function (val) { return val * this.days(7); },
   years: function (val) { return val * this.days(365); },
};

Crowdsale file

TestCrowdsale contract uses the Zeppelin Solidity framework. My TestCrowdsale.sol file looks like:

pragma solidity ^0.4.18;

import 'zeppelin-solidity/contracts/crowdsale/Crowdsale.sol';

contract TestCrowdsale is Crowdsale {

   function TestCrowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet)
      Crowdsale(_startTime, _endTime, _rate, _wallet)
      public
      {
   }

}

truffle.js file looks like:

module.exports = {
   networks: {
     development: {
       host: "localhost",
       port: 8545,
       network_id: "*" // Match any network id
     }
  }
};


texts: What's the protocol behind the naming of ERC20 or others?

texts:
I can see other networks stick on this style of naming like TRC20 or BEP20...
It seems confusing,

Do they name those based on a protocol or naming rules or just copying each others style?


texts: minimumBet Appears to be Returning Incorrect Amount

texts:
I'm following this tutorial, which seems like a great intro to solidity contracts, but I've got an issue where I don't see the same results as on the post.

When calling minimumBet from remix.solidity, the article claims it should return

    uint256: 1000000000000000

but for some reason I am getting

    "0": "uint256: 100000000000000000"

where my value has too many zeroes (2 to many).

Can anyone explainw hy this is happening?

Here is my copy of the contract:

pragma solidity ^0.4.11;

contract Casino {
    address owner;
    uint public minimumBet = 100 finney; // Equal to 0.1 ether
    uint public totalBet;
    uint public numberOfBets;
    uint public maxAmountOfBets = 100;
    address[] public players;

    struct Player {
        uint amountBet;
        uint numberSelected;
    }

    // allows us to call playerInfo[here_goes_his_address].amountBet
    mapping(address => Player) playerInfo;

    function Casino(uint _minimumBet) public {
        owner = msg.sender;
        if(_minimumBet != 0) minimumBet = _minimumBet;
    }

    // Fallback function in case someone sendes ether to the contract so it doesn't get lost
    function() payable public {}

    function kill() public {
        if(msg.sender == owner)
            selfdestruct(owner);
    }

    function checkPlayerExists(address player) constant returns(bool) {
        for(uint i = 0; i < players.length; i++) {
            if(players[i] == player) return true;
        }
        return false;
    }

    // To bet for a number between 1 and 10 both inclusive
    function bet(uint number) public payable {
        assert(checkPlayerExists(msg.sender) == false);
        assert(number >= 1 && number <= 10);
        assert(msg.value >= minimumBet);

        playerInfo[msg.sender].amountBet = msg.value;
        playerInfo[msg.sender].numberSelected = number;
        numberOfBets += 1;
        players.push(msg.sender);
        totalBet += msg.value;

        if(numberOfBets >= maxAmountOfBets) generateNumberWinner();
    }

    // Generates a number between 1 and 10
    function generateNumberWinner() public {
        uint numberGenerated = block.number % 10 + 1; // This isn't secure
        distributePrizes(numberGenerated);
    }

    // Sends the corresponding ether to each winner depending on the total bets
    function distributePrizes(uint numberWinner) public {
        address[100] memory winners; // we have to create a temporary in memory array with fixed size
        uint count = 0; // This is the count for the array winners

        for (uint i = 0; i < players.length; i++) {
            address playerAddress = players[i];
            if(playerInfo[playerAddress].numberSelected == numberWinner) {
                winners[count] = playerAddress;
                count++;
            }
            delete playerInfo[playerAddress]; // Delete all the players
        }

        players.length = 0; // Delete all the players array

        uint winnerEtherAmount = totalBet / winners.length; // How much each winner gets

        for(uint j = 0; j < count; j++) {
            // Check that the address in this fixed array is not empty
            if(winners[j] != address(0)) winners[j].transfer(winnerEtherAmount);
        }
    }
}

Note as per the tutorial I am doing this with metamask on the test network. Thanks in advance!

What I tried already

killing the contract and recreating
hard refresh (ctrl + f5), which seems to solve a few other issues


texts: what happens if there is a power cut while mining ethereum?

texts: Does all your work go to waste or the mining continues from the last place you left. Lets say I am about to get a block solved and there is a power cut, how does it hamper my mining and the rewards.


texts: How to convert bigNumber array to int array?

texts:
I have a smart contract method that return an array of uint256,

but when I console.log the result I got this :

[ BigNumber { s: 1, e: 1, c: [Array] } ]

How can we convert it to array of numbers?
toNumber() work for a single object


texts:
Envisage the following scenario:

You are running a business, which requires a float to operate.
Your float is x amount of USD
This float yields a annual revenue of a XXX amount of USD
This float costs you %x annually to maintain
You want to decrease the %x of our maintenance cost
This will increase your revenues from a smaller float maintenance cost to a larger float.
You are looking to give away interest on capital (float  from 10% for two years.
This means that for two years, whatever money you get from people, you will give them a 10% return and their money back at the end of the period.

Just had a read of the following venture and the following scenario popped in my mind. Any idea on how bonds can be issued on Ethereum?


texts: How geth verify the rewards for miner in ethereum?

texts:
In the Finalize() function of ethash consensus, the rewards to miner and uncles are given by directly state.AddBalance().

where I can validate the rewards? I guess there are two places

1)VerifyHeader

2)VerifySeal

I am not sure where rewards are stored in one of the above.


texts: What advantages does Trinity have over Geth or Parity? What differences does it have?

texts: With the exception of the language it is being written in, what are the main differences that Trinity has over Geth or Parity (if any). What advantages does it have? Disadvantages?


texts: How do I check If a map entry doesn't exist for a given sender?

texts:
I have a map such as:

mapping (address => bytes32) private myMap;

Later in the code, in a function, I want to ensure my sender already has an entry in that given map.

Can I do this?

require(!myMap[msg.sender], 'there is an entry in the map already!')


texts: While deploying smart contract the error formed. java.lang.RuntimeException: Error processing transaction request: Intrinsic gas too low


texts: How to find child contract address deployed from parent address on testnet

texts:
I have a function which when deployed through Remix on the Javascript VM perfectly fine returns a contract address for the new contract, however, I'm not able to get it to return the new contract address when I deploy to Rinkeby or Ropsten?

function addNewContract(string _aa string _bb, string _cc, address _aa, bool _created, address _bb, address _cc) external onlyOwner returns(address newContract) {
        Contract c = new Contract(_aa, _bb, _cc, _aa, _registeredBusiness, _bb, _cc);
        associatedContracts.push(address(c));
        return address(c);
    }

am I looking in the wrong place or is the issue related to something else, should I be approaching a testnet differently than the Javascript VM - how can I retrieve the address?


texts: How to handle "Invalid JSON RPC response" using infura.io and web3

texts:
I'm new in the world of Ethereum and I'm building a app with node.js.

I'm using web3 1.0 and infura to connect to a contract and get all the logs for different events. I'm using the "getPastEvents" function from web3.

I'm getting this error time to time "Invalid JSON RPC response".

Right now, when I get this error, I just restart the app and if it passes good if not well i restart again... I'm putting a setTimout function so my app restart by itself. But because of that error, my app is crashing and doing an exit.

How can I handle this error ? any suggestion will be very appreciated.


texts: This contract collects ETH in exchange for voting tokens. What function will allow me to transfer the collected ETH to a wallet?

texts:
pragma solidity ^0.4.23;

contract Voting {
    bytes32[] public candidateList;

    uint public totalTokens;
    uint public balanceTokens;
    uint public tokenPrice;

    // what is the voter address?
    // total tokens purchased
    // tokens voted per candidate

    struct voter {
        address voterAddress;
        uint tokensBought;
        uint[] tokensUsedPerCandidate;
    }

    mapping(address => voter) public voterInfo;
    mapping(bytes32 => uint) public votesReceived;

    constructor (uint _totalTokens, uint _tokenPrice, bytes32[] _candidateNames) public {
        totalTokens = _totalTokens;
        balanceTokens = _totalTokens;
        tokenPrice = _tokenPrice;
        candidateList = _candidateNames;
    }

    //1. Users should be able to purchase tokens
    //2. Users should be able to vote for candidates with tokens
    //3. Anyone should have the ability to lookup voter info

    function buy() payable public {
        uint tokensToBuy = msg.value / tokenPrice;
        require(tokensToBuy <= balanceTokens);
        voterInfo[msg.sender].voterAddress = msg.sender;
        voterInfo[msg.sender].tokensBought += tokensToBuy;
        balanceTokens -= tokensToBuy;
    }

    function voteForCandidate(bytes32 candidate, uint tokens) public {
        // Check to make sure user has enough tokens to vote
        // Increment vote count for candidate
        // Update the voter struct tokensUsedPerCandidate for this voter

        uint availableTokens = voterInfo[msg.sender].tokensBought - totalTokensUsed(voterInfo[msg.sender].tokensUsedPerCandidate);

        require(tokens <= availableTokens, "You don't have enough tokens");
        votesReceived[candidate] += tokens;

        if (voterInfo[msg.sender].tokensUsedPerCandidate.length == 0) {
            for(uint i=0; i<candidateList.length; i++) {
                voterInfo[msg.sender].tokensUsedPerCandidate.push(0);
            }
        }

        uint index = indexOfCandidate(candidate);
        voterInfo[msg.sender].tokensUsedPerCandidate[index] += tokens;
    }

    function indexOfCandidate(bytes32 candidate) view public returns(uint) {
        for(uint i=0; i<candidateList.length; i++) {
            if (candidateList[i] == candidate) {
                return i;
            }
        }
        return uint(-1);
    }

    function totalTokensUsed(uint[] _tokensUsedPerCandidate) private pure returns (uint) {
        uint totalUsedTokens = 0;
        for(uint i=0; i<_tokensUsedPerCandidate.length; i++) {
            totalUsedTokens += _tokensUsedPerCandidate[i];
        }
        return totalUsedTokens;
    }

    function voterDetails(address user) view public returns (uint, uint[]) {
        return (voterInfo[user].tokensBought, voterInfo[user].tokensUsedPerCandidate);
    }

    function tokensSold() public view returns (uint) {
        return totalTokens - balanceTokens;
    }

    function allCandidates() public view returns (bytes32[]) {
        return candidateList;
    }

    function totalVotesFor(bytes32 candidate) public view returns (uint) {
        return votesReceived[candidate];
   }
}


texts: Truffle Migrate SyntaxError: Invalid or unexpected token

texts:
I am trying to follow the truffle pet shop tutorial and I am doing my first truffle migration.

After this command:

truffle migrate

I get this error:

  SyntaxError: Invalid or unexpected token
      at new Script (vm.js:74:7)
      at Object.createScript (vm.js:246:10)
      at /usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-require/require.js:96:1
      at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)

I tried installing the latest truffle, deleting the contract/build folder and compile again, changing the pragma solidity ^0.4.17; to pragma solidity ^0.4.24; to make Adoption.sol pragma version to be consistent with the one on Migrations.sol

Anyone solved this error before?


texts: Invalid number of arguments to Solidity function when calling call from unit test

texts:
I have a problematic unit test in a suite. It's pretty simple:

it("SapienToken deployed with SPN symbol", async function() {
    let SPN = await SapienToken.new(TokenController.address, Owned.address);
    let symbol = await SPN.symbol.call();

    assert.equal(symbol, 'SPN', 'Symbol name is not SPN');
});

It throws invalid number of arguments when I use call to take a public variable from a contract.

Isn't this how it's supposed to be called? What do I do wrong?


texts:
I want to generate an Ethereum wallet to use for cold storage. I'll split the key using SSSS, and print the different parts in papers that I'll store in different places. I don't want to use a password: I want the wallet to be recoverable in case I die or get a brain injury or something.

All wallet generation mechanisms I can see use a series of words that you have to remember. One obvious solution is to simply use an empty passphrase, or write down the passphrase on each paper. But I'm not sure whether it's safe: is the passphrase enough to recover the private key?


texts: What are the ramifications of changing `--port` in geth?

texts:
If I'm running a full node with --lightserv enabled for several hundred clients, what are the ramifications of me running geth on a port other than 30303? If I change it to --port 2345 will I still be able to have outgoing/incoming connections to full nodes so I can sync new blocks? Will LES enabled clients be able to find my node at all?

My full node on 30303 has ~500 connections currently, a separate full node on port 2345 only has about 20.

Separately, I still need full nodes to find me to relay new blocks right, LES clients don't do any relaying?

Update: well, light clients can obviously still find me but it appears to be far fewer on the non-standard port. Still not sure why that would be

Port 2345 node:

# geth attach http://localhost:8545 --exec 'for(i in admin.peers) { console.log(admin.pe
ers[i].caps) }' | grep -v undefined | sort | uniq -c
      2 eth/62,eth/63
      1 eth/62,eth/63,par/1,par/2,par/3,pip/1
      3 eth/62,eth/63,par/1,par/2,pip/1
     15 les/1,les/2
      1 les/1,les/2,shh/6

Port 30303 node:

# geth attach http://localhost:8545 --exec 'for(i in admin.peers) { console.log(admin.pe
ers[i].caps) }' | grep -v undefined | sort | uniq -c
      3 eth/62,eth/63
      1 eth/62,eth/63,par/1,par/2,par/3
      5 eth/62,eth/63,par/1,par/2,pip/1
      2 eth/63
    389 les/1,les/2


texts:
I'm trying to do a miny EHR(Electronical Health Record) with Smart Contracts where I have a Pacient Contract.

The problem is that in solidity everything is public, even the private variables, so I got to crypt the health record data in some way, but in other way it should be available for other doctors to read my previous health record and add some new data to one specific Pacient contract, so the doctor need to have a mechanism to decrypt and to encrypt the data, and also the pacient should be able to see his data.

Every pacient will have an account and with that account should register a Pacient Contract where he can crypt all his personal data with his private key.
The doctors will have an account just to be able to make transactions(in this case a transaction will be writing some health data into Pacient Smart Contract)

My approach:

All medical data from a Pacient Contract will be crypter/encrypted with pacient private key.
When a pacient go to a doctor, he need to give his private key in order to let the doctor to his previous medical data and write more medical data into his contract.

Is ugly part of this approach is that all the time the pacient will need to give his private key to doctor, and then the doctor can access any time pacient data.

Is there other approach to keep sensitive data into public blockchain, or a more elgant solution to EHR dApp?


texts: Using Uniswap for trading ERC-721 or ERC-1155 Tokens

texts:
Is it feasible to use Uniswap for buying and selling NFT's (ERC-721) or Semi-NFT's (ERC-1155) tokens? It would seem to me that it could be an easy way to implement a DEX for unique digital assets with very little overhead.
Or is there something I am missing?
Could I just call the factory function:
function createPair(address tokenA, address tokenB) external returns (address pair) {
        require(tokenA != tokenB, 'UniswapV2: IDENTICAL_ADDRESSES');
        (address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
        require(token0 != address(0), 'UniswapV2: ZERO_ADDRESS');
        require(getPair[token0][token1] == address(0), 'UniswapV2: PAIR_EXISTS'); // single check is sufficient
        bytes memory bytecode = type(UniswapV2Pair).creationCode;
        bytes32 salt = keccak256(abi.encodePacked(token0, token1));
        assembly {
            pair := create2(0, add(bytecode, 32), mload(bytecode), salt)
        }
        IUniswapV2Pair(pair).initialize(token0, token1);
        getPair[token0][token1] = pair;
        getPair[token1][token0] = pair; // populate mapping in the reverse direction
        allPairs.push(pair);
        emit PairCreated(token0, token1, pair, allPairs.length);
    }

and then a bidder would be able to purchase the ERC721 or 1 or more ERC1155 tokens? I know that the concept of Uniswap is the liquidity pool but what would happen if there was just 1 buyer and 1 seller?
Could that work?
Thanks for your help!


texts: How to convert a uint to 64 byte hex string using Node.js?