texts: "populus chain new horton" command doesn't work

texts:
I encounter my first serious issue with the populus tutorial when I try to execute the following command:

populus chain new horton

The output is:

Mac:tutorial admin$ populus chain new horton
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/bin/populus", line 11, in <module>
    load_entry_point('populus==2.2.0', 'console_scripts', 'populus')()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/populus/cli/chain_cmd.py", line 38, in chain_new
new_local_chain(project.project_dir, chain_name)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/populus/api/utils.py", line 79, in new_local_chain
account = create_new_account(data_dir, password, **geth_kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/geth/accounts.py", line 116, in create_new_account
stderrdata,
ValueError: Error trying to create a new account
Command    : nice -n 20 geth --rpc --rpcaddr 127.0.0.1 --rpcport 8545 --rpcapi admin,debug,eth,miner,net,personal,shh,txpool,web3,ws --ws --wsaddr 127.0.0.1 --wsport 8546 --wsapi admin,debug,eth,miner,net,personal,shh,txpool,web3,ws --datadir /Users/admin/Documents/league_fiesta/ethereum/tutorial/chains/horton/chain_data --maxpeers 0 --networkid 1234 --port 30303 --ipcpath /Users/admin/Documents/league_fiesta/ethereum/tutorial/chains/horton/chain_data/geth.ipc --verbosity 5 --unlock 0 --password /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/geth/default_blockchain_password --nodiscover --mine --minerthreads 1 account new
Return Code: 127
stdout: N/A
stderr:
`b'nice: geth: No such file or directory\n'`

I can't figure out how to solve this issue.

Thanks for your help!


texts: Quorum Constellation TLS Trust Mode revoking a certificate

texts: I have multiple quorum nodes setup. How does revoke a certificate for a node? Assuming the node has gone rogue, there is a need to revoke a certificate for the node


texts: Is Ethereum suitable for a storage application?

texts:
I'm interested to make an app to store some data and I'd rather think that the blockchain might not be the only or the right solution for me. I'd like the users to contribute data and to make that data impossible to censor or take down. So if more people (or even everyone) has a copy of it, thats what I want.

But there is no contract, no mining, and its enough if the data is replicated a few times, not needed for each users to have the whole blockchain. But I see that the blockchain can act as a distributed database and I dont know other technologies like it.

https://en.wikipedia.org/wiki/Blockchain_(database)


texts: Error while installing web3@1.0.0-beta.26 on Windows 10

texts:
I am getting the following error while installing web3@1.0.0-beta.26 on Windows 10.

npm ERR! code ETARGET
npm ERR! notarget No matching version found for web3-core@1.0.0
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'web3-eth'
npm ERR! notarget

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\tanuj\AppData\Roaming\npm-cache\_logs\2019-07-18T05_50_02_703Z-debug.log

I have already successfully ran

npm install --global --production windows-build-tools

but still getting error.


texts: Using json RPC without any libraries besides js

texts:
I am currently trying to call a function on my smart contract function adopt(uint petId) public returns (uint) that has already been deployed to the ropsten network...

but here's the catch. I'm trying to call and sign this contract using the json rpc call eth_sendRawTransaction() and I have to do this without any additional libraries besides js like ethereumjs-tx or web3js. Would anyone have any idea how to do this with just the json rpc call? Thanks!


texts: Understand Quorum examples are running on Ubuntu -- Is Quorum able to run on top of RHEL OS?


texts: Where do you save the application data of a Dapp?

texts:
Let's say that I want to implement a Dapp similar to Facebook. Each user has its own profile, pictures and information. Usually you would use a database to store all this data. This guarantees that only the DB owner can access it and that no entity can modify the data if not allowed to.

Now how would it work for a decentralized application?

Storing on chain does not seem like a viable solution because of the gas required and also because all the information would be accessible and visible to everyone. An alternative is to store it encrypted off-chain for example with IPFS but then which entity would decide what information a user can see? Or if the entire information stored needs to be used to calculate certain results for the user, how do you calculate those results without someone having access to the entire data? An how would you distribute the decryption keys?

Wouldn't you still require a node that acts as a database and so it has access to all the data and returns only what another user can see? This though would make it a centralized application.

I feel like the only solution to this problem is to use homomorphic encryption, but we are still quite far from a fast and efficient implementation.


texts: Can the PoW problem be changed without a hard fork?

texts:
I know that the PoW in Ethereum is based on Ethash and that some parameters are adjusted in order to maintain the average time between blocks to a certain value.

Now my question is: does the Ethereum protocol allow for a drastic change of the PoW algorithm ?

I know that in bitcoins changing the SHA-256 based PoW algorithm to something else — like scrypt for instance — would required a hard fork. However, we could imagine some mechanism to maintain backward compatibility with previous PoW algorithms — like accepting different algorithms until most of the clients are updated.


texts:
For my project I want to dump the full state data of all Eth wallets/balances. I have a fully synced Geth node with all state data (over 2TB).

I started a block dump

geth dump 7300000 --datadir "/Volumes/Ethereum/"

It has been running for over a week and still isn't done. My system manager says that geth has read over 8.5TB so far. Why does it need to do this much work to export the state data? Why does it take this long? I've tested this before on earlier blocks and it worked.

Edit: Using a 4TB external SSD, 2TB RAID0, using USB-c connector.


texts: How can an app using the web3 rpc api be secured?

texts:
When using geth as client and web3(javascript api) to interact with it through a web browser, other nodes in the network can access the client given the IP and the port on which the client is running.

How can this be prevented?

How can the access be restricted to the node(computer) running the client and not the others in the same network?

the flow is as follows

Browser(user)----->Server(running the node)------>GETH

the first link is http and the second link is rpc. the http link makes it possible for other computers to access my node which is to be stopped.

Only the node(computer) running the geth client should access the geth client.


texts: Remix error : Function declared as view but this (potentially) modifies state

texts:
i'm following a tutorial but now it is old, because was written more then 1 year ago, with 0.4.24 pragma and i also want upgrade this code.
I got this error and i'm pretty sure to know why: view and pure cannot modify variables.
But my question is: how do i must write this function to do it's job?

Here is my code:

pragma solidity 0.5.0;

import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/master/contracts/crowdsale/Crowdsale.sol";
import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/master/contracts/crowdsale/emission/MintedCrowdsale.sol";
import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/master/contracts/crowdsale/validation/CappedCrowdsale.sol";
import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/master/contracts/crowdsale/validation/TimedCrowdsale.sol";

contract IPPCrowdsale is Crowdsale, MintedCrowdsale, CappedCrowdsale, TimedCrowdsale {

    uint256 public investorMinCap = 100000000000000;
    uint256 public investorMaxCap = 100000000000000000000;
    mapping(address => uint256) public contributions;

    constructor (uint256 rate, address payable wallet, IERC20 token, uint256 cap, uint256 openingTime, uint256 closingTime)
    Crowdsale(rate, wallet, token)
    CappedCrowdsale(cap)
    TimedCrowdsale(openingTime,closingTime)
    public
    {

    }

  function _preValidatePurchase(address beneficiary,uint256 weiAmount) internal view
  {
    super._preValidatePurchase(beneficiary, weiAmount);
    uint256 _existingContribution = contributions[beneficiary];
    uint256 _newContribution = _existingContribution.add(weiAmount);
    require(_newContribution >= investorMinCap && _newContribution <= investorMaxCap);
    contributions[beneficiary] = _newContribution;
  }

}

The function is the last one: _preValidatePurchase


texts: What is the purpose of metamask if it does not support token purchases and I still need to use a token management service?

texts: My question is about the purpose of metamask if it does not support token purchases and I still need to use a token management service?


texts:
What would happen if someone ran a nondeterministic smart contract on the blockchain, for example, by using a oracle to get the current time and basing the output on that?

Would the block just be thrown out and another block without the contract be accepted instead?


texts:
I am creating a contract on my local blockchain network using web3. On my node , contact is created and address is generated. But on node application, response is struck.

Here is my node code:

const Web3 = require('web3')
const web3 = new Web3(new Web3.providers.HttpProvider("http://192.168.56.103:8000"))
//const web3 = new Web3(ganache.provider());
const compiledFactory = require('./ethereum/build/CampaignFactory.json')

const deploy = async () => {
    accounts = await web3.eth.getAccounts()
    console.log(accounts)

    addr = await web3.eth.personal.newAccount('123456');
    console.log(addr)

    factory = await new web3.eth.Contract(JSON.parse(compiledFactory.interface))
    .deploy({ data: '0x' + compiledFactory.bytecode })
    .send({ from: accounts[0], gas: '1000000' });

    console.log(factory)
}

deploy();

Here is console from node app that is stuck after

[ '0xDa8512CBD5c5eaa1213e5A7bEefAf35e9bA2c9EA',
  '0x3F5dD664F0A803d546E087Ee03B69aEb97D428DB',
  '0x7Eb0390DbF70147f37459F5d982456527FdBdb98',
  '0xD9FcDA95002A09d7be394F085fAEC2a1f3d28476' ]
0x2Cc72882b17960e07FCeF04E54A397628075654D

and here is the logs from node:

INFO [08-09|03:28:10.027] Submitted contract creation              fullhash=0x63ac15fcc23f19aa44cd225dbacf7ea30069d3e106987daf63a4238caab4b73c contract=0x31F82590e051A224e7d8d63eB54f434d6073aB06

Can anybody help? Why I am not getting address on nodejs application?


texts: Got error!!Trying to deploy smart-contracts in ropsten infura

texts:
When I am trying to migrate smart contracts in ropsten infura network, but got error.
The error is shown below:
Using network 'ropsten'.

Running migration: 1_initial_migration.js
Replacing Migrations...
Error encountered, bailing. Network state unknown. Review successful transactions manually.
only replay-protected (EIP-155) transactions allowed over RPC

truffle.json
module.exports = {
ropsten:{
  provider: () => new HDWalletProvider(MNEMONIC,REMOTE_NODE),
  network_id: 3
 }
},

Please help me to resolve this and help will be appreciated.


texts:
I am thinking of a scenario where there is a user (U) that wants to upload a smart contract to the Ethereum network to be run later by multiple users {U1,U2,...,Un}.

For example, assume we have a smart contract where U (the person uploading it) requires the users who will later call it to input certain parameters. If they input the correct parameters, the smart contract will transfer a certain amount from the uploader's wallet to the caller's wallet.

Is this scenario even possible? If yes, who would pay for the gas?

I have read that the uploader must provide enough gas for the number of times the smart contract is called by the other users.

Is it possible to do this so that the callers pay the gas themselves each time they call the smart contract?


texts: The '*.ldb' files in `~/.ethereum/geth/chaindata`are not sequence one after one, is it normal?

texts:
I start ethereum with command:

 geth --syncmode fast --cache 256

and I find my files in ~/.ethereum/geth/chaindata are like:

000390.ldb
000392.ldb
000420.ldb
000484.ldb

They are not one after one. And also, the latest file name is 957905.ldb, but ls *.ldb | wc -l shows me only 63067.

Is it normal? Or is there data missing? Is there any way to check if the data are complete?


texts: solidity and react and calling a solidity function many times

texts:
I was looking at where i needed to go in my coding, and see i need a pattern to handle the 'many' calls.  for example a call only returns 1 set of data, when i need perhaps records 1-70.

Is the following snippet a 'good'/'bad'/'ugly' way of handling this, and if not 'good' what is a better way?

return countvariablecall()
.then((results) => {
    for(let i=0; i< results.c[0]; i++){
        return manyTimesCalledFunction(i).
        then ((result) => {
            do something with the result.
        )}
    }
})


texts:
What's the best way to filter in Solidity?

Specifically in a game such as CryptoKitties where there are thousands of different ERC721 tokens, how would you quickly filter to the 12 most expensive items, or the 12 youngest? Does adding a filter function to the blockchain itself make sense?

I know CryptoKitties does it with their own API server so I imagine they keep a copy of the database and filter that. Is that the recommended way to do things? Or could you ask the blockchain to do the filtering itself? What's the recommended solution when building a Dapp?


texts: How uploaded form in golang store files in ipfs?

texts:
I have uploaded form written in golang and I want that when user upload file, it goes to ipfs not save in local directory. I used daemon and go-ipfs-api package to upload directory in ipfs but how user input file goes in ipfs.
The code is incomplete :
package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
"html/template"
//  "io/ioutil"
"crypto/md5"

"strconv"
"time"

shell "github.com/ipfs/go-ipfs-api"

)
func hello(w http.ResponseWriter, r *http.Request) {
sh := shell.NewShell("localhost:5001")
cid, err := sh.Add(strings.NewReader("hello world!"))
if err != nil {
fmt.Fprintf(os.Stderr, "error: %s", err)
os.Exit(1)
}
//hash, err := sh.AddLink("https://github.com")
//if err != nil {
//  panic(err) // ends where
//  }
mhash, err := sh.AddDir("experiment")
if err != nil {
panic(err) // ends where
}
//io.WriteString(w, string(hash))
io.WriteString(w, string(mhash))

io.WriteString(w, string(cid))

//  fmt.Println("added link", hash)
fmt.Println("directory", mhash)
fmt.Printf("added %s", cid)

}
func upload(w http.ResponseWriter, r *http.Request) {
fmt.Println("method:", r.Method)
if r.Method == "GET" {
crutime := time.Now().Unix()
h := md5.New()
io.WriteString(h, strconv.FormatInt(crutime, 10))
token := fmt.Sprintf("%x", h.Sum(nil))
    t, _ := template.ParseFiles("upload.gtpl")
    t.Execute(w, token)
} else {
    r.ParseMultipartForm(32 << 20)
    file, handler, err := r.FormFile("uploadfile")
    if err != nil {
        fmt.Println(err)
        return
    }
    defer file.Close()
    fmt.Fprintf(w, "%v", handler.Header)
    f, err := os.OpenFile(""+handler.Filename, os.O_WRONLY|os.O_CREATE, 0666)
    if err != nil {
        fmt.Println(err)
        return
    }
    defer f.Close()
    io.Copy(f, file)
}

}
func main() {
http.HandleFunc("/upload", upload)
http.HandleFunc("/", hello)
http.ListenAndServe(":9090", nil)
}


texts: invalid opcode for this.balance when contract balance > 0

texts:
I get an exception when I call getBalance in Remix and the contract balance is greater than 0 (ie. I sent some ether using the fallback function):

  Exception during execution. (invalid opcode). Please debug the
  transaction for more information.

When contract balance is 0 then getBalance correctly returns 0.

pragma solidity ^0.4.0;

contract Test {

    function() payable {}

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

}


texts: How to deploy smart contract in predefined contract address in private ethereum network?

texts:
Is there any method to deploy our smart contract in a particular address (ie. predefined contract address) in private ethereum network?

Yes, I have built my own private blockchain based on Ethereum code. I need to deploy contract on some blocks and I have to send that address to my client ( users). In this scenario, I don't want to send a different address to the client while I am deploying a contract. If it was a static address it will be easy for me. I will just inform them I have deployed a new contract so that they can use the static address to get input for their code.


texts:
How can I measure blockchain execution time, latency and throughput?
Which API do I use to measure?
Anyone suggest any article or book for me to read about the blockchain performance metrics?


texts: I want to add a loader to UI when there is a click on confirm transaction popup on metamask. When user clicks on confirm I want to show the loader until the transaction is confirmed. Is there a way to handle this?? Is there any event??


texts: How does coinbase.com manage multiple addresses?

texts:
Coinbase generate a new btc or eth address after every deposit. But how does it send funds from these addresses to another address.

In case of btc, a transaction can have multiple from addresses. But if I have 10,000 addresses and if I want to send all the btc in all those addresses than won't the transactions size become too big and get rejected by the miners maybe.

In case of eth, a transactions cannot be signed by multiple wallets. So if I have 10,000 addresses than I need to create and broadcast 10,000 transactions so the transaction fees will be too high.

How does coinbase.com deal with these problems?


texts: Creating an openzeppelin-contracts-upgradeable Smart Contract

texts:
I have created a smart contract with the "standard" openzeppelin library for an ERC721 token (It has not been deployed yet). I would like to make my contract upgradeable. Can I simply install openzeppelin-contracts-upgradeable in my project (instead of the @openzeppelin/contracts one) and import its modules as they are in my smart contract (besides being careful to change any constructor to an initializer in my own smart contract)? Does the openzeppelin-contracts-upgradeable library contain all the same functions as the @openzeppelin/contracts one?
Thank you. J


texts: Error based on inheritance and dependency between contracts (Using EternalStorage contract)

texts:
I have been using EternalStorage contract with my contracts for the storage purpose. Now the structure is some like this:

Eternal Storage <- Contract (A) <- Contract (B) <- Contract (C)

Now on deploying the contracts together using deploy and link function in the migration file Eternal Storage and Contract A are deployed properly but when it comes on Contract (B)'s deployment. It burst out with an error stating that Contract (B) is an abstract contract or an interface and cannot be deployed.

Contract Eternal Storage:
    pragma solidity ^0.5.1;

    contract EternalStorage{

      struct Storage {
        mapping(bytes32 => address) _address;
        mapping(bytes32 => string) _string;
       }

      Storage internal s;

      address public owner;

     function setString(bytes32 h, string memory v) public  {
        s._string[h] = v;
     }

function getString(bytes32  h) public view returns (string memory){
    return s._string[h];
  }

function setAddress(bytes32 h, address v) public  {
    s._address[h] = v;
  }
function getAddress(bytes32 h) public view returns (address){
    return s._address[h];
  }
}

Contract A:

       pragma solidity ^0.5.1;

        contract EternalStorage {

            function setString (
                bytes32 h,
                string memory v
                ) public;

            function getString (
                bytes32 h
                ) public view returns (
                    string memory
                );
function setAddress (
        bytes32 h,
        address v
        ) public;

    function getAddress (
        bytes32 h
        ) public view returns (
            address
        );

        }

        contract Contract(A){

              EternalStorage s;

constructor(address _mySign) public {

         s = EternalStorage(_mySign);
    }

    struct Agreement {
        bytes32  id;
        address owner;
        string hash;
}

function createData(
             bytes _id,
             address _owner,
             string memory _hash) public returns (bool success) {

            Data[_id].id = _id;
            Data[_id].owner = _owner;
            Data[_id]._hash = _hash;

    s.setAddress(keccak256(abi.encodePacked("Agreement - Owner",_id)), agreements[_id].owner);
            s.setString(keccak256(abi.encodePacked("Agreement - FileHash",_id)), agreements[_id].fileHash);

    }

}

Contract B:

pragma solidity ^0.5.1;

import "./Contract(A).sol";

contract Contract(B) is Contract(A) {

  constructor(
        address _mySign
        ) public {
        s = EternalStorage(_mySign);

   }

function getData(
    bytes32 _id,
    string memory _hash,
    address _owner
    ) public returns (bool success) {
    s.setAddress(keccak256(abi.encodePacked("data- crypto",_id)), data[_id].owner);
    s.setString(keccak256(abi.encodePacked("data- crypto",_id)), data[_id]._hash);
}
}

Error is displayed below:

Error: Error: Error:  ** Deployment Failed **

"Contract(B)" is an abstract contract or an interface and cannot be deployed.
   * Import abstractions into the '.sol' file that uses them instead of deploying them separately.
   * Contracts that inherit an abstraction must implement all its method signatures exactly.
   * A contract that only implements part of an inherited abstraction is also considered abstract.

    at Object.run (C:\Users\shparmar\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-migrate\index.js:92:1)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Truffle v5.0.26 (core: 5.0.26)
Node v10.16.0

Can anyone help me out with this stuff?


texts: What time Ethereum gas fee is calculated?

texts: When is Ethereum gas fee calculated during execution of contract.  I was wondering if i take out flash loan and if the trade happened to be profitable, will the profit be able to offset transaction fee or I would have to pay upfront?


texts:
I am getting the following error when doing truffle migrate on the following code: https://github.com/CoinFabrik/ico/tree/9ac3487b6103c96958cdabf8b9ce2071a7250cd8

Deploying Crowdsale...
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: The contract code couldn't be stored, please check your gas amount.

I changed the truffle.js to reflect the first testrpc account
I am deploying on testrpc (testrpc -p portnumber )

Could someone please help me in what I am doing wrong?

What  I have tried so far amongst others:

Truffle v3.2.5 migration error: contract code couldn't be stored

Error: The contract code couldn't be stored, please check your gas amount , when creating new contract

I have increased the gas in the truffle.js file
Someone said my account needs to be unlocked but I am on testrpc
I also saw somewhere that I need to use payable on the constructor
    but I am not sure where.
Use --network testrpc
Found out that the problem is with this line:
await deployer.deploy(Crowdsale, MultiSigWallet.address, config.tests.startBlock, config.tests.endBlock, accounts[0], {gas:
4200000});


texts: Connecting two nodes one on rasberry pi and other on Ethereum

texts:
The rasberry pi and my laptop are using same network

From my laptop  admin.addPeer("enode from above rasberrypi")

enode://6179e58bb512415a76e4169dd25ae5a171e34069660b233cf79dabd3581d8dd1221a7f3a5e5d64251aa7e8ac20eda5430e42eed161e68cb05d05e6c3cab68a6e@publicip:port

When i run admin.nodeInfo.enode
i get a different IP and when i check it from my  http://www.whatismypublicip.com/ it returns some different IP
Which IP should i use while connecting the 2 nodes
while net.peerCount still remains 0 even if it returns true .
Is their any configuration that needs to be taken care of ?
What is the command if i want to include genesis also at the time of node creation


texts:
This question is twofold:

The standard number of decimals for an ERC20 token is 18. If we lower this number, can we expect decreased gas costs when creating/transferring the token, since this should consume less memory in EVM?

If so, why do most tokens follow the 18 decimal standard? For most use cases this level of precision is unnecessarily large, by orders of magnitude.


texts: What is At Address placeholder in solidity online compiler?

texts:
On solidity online compiler along with create contract button/div there is another placeholder At Address what does it do?

Picture is attached for reference.


texts: How do I connect My Ether Wallet to my Claymore Miner?

texts: So I am very new to mining, and just recently picked up mining Ethereum rather than Bitcoin. I downloaded claymore miner, and created a wallet on MyEtherWallet.com. Everything seemed correct, I got my address "0x42A28a8f37749f56f00955b3186EC0534a913e04" from the wallet, and put it into the start_only_eth file. I began mining, getting around 20 Mh/s, which is good. However, my balances will not update in MyEtherWallet.com? How do I fix this, is there an obvious answer I am missing?


texts: How can I create a wallet and display the address, public and private key using web3js?

texts:
I am using this as my source for web3js:

<script src="http://raw.githubusercontent.com/ethereum/web3.js/0.16.0/dist/web3.min.js">
    </script>

In my HTML I want to display the account's address on the page and tried by the following code:

<p id="accountAddress">
        <script>
            web3 = new Web3(new Web3.providers.HttpProvider("https://mainnet.infura.io/MYTOKENKEY"));
            var wallet = web3.eth.accounts.create([entropy]);
            document.write('new wallet address ' + wallet.accounts[0]);
            document.getElementById("accountAddress").innerHTML = wallet.accounts[0];
        </script>
    </p>

But nothing displays.

I can't find in the documentation on how to create wallets and display information associated with them so any help is greatly appreciated.


texts:
I'm trying to retrieve the public key of an address from a transaction. I'm getting the transaction via tx = web3.eth.getTransaction('xxx')

According to the docs the public key should be retrievable by pub_key = tx['publicKey']. But when I print the tx dictionary there is no key-field for publicKey. What's

I am using the  latest web3.py version.

So what's the easiest way to get the public key?

I thought about using eth_keys in the following way:

tx = web3.eth.getTransaction('xx')
r = tx['r']
s = tx['s']
v = tx['v'] - 27 # why?
r_hex = r.hex()[2:]
r_int = int(r_hex, 16)
s_hex = s.hex()[2:]
s_int = int(s_hex, 16)
sig = (v, r_int, s_int)
sig_obj = eth_keys.keys.Signature(None, sig)
mgs = ??? # what is the actual message?
pub_key = eth_keys.keys.ecdsa_recover(msg, sig_obj)

But I am stuck at msg.
Any help is appreciated.

These are the keys in the dictionary:

>>> list(tx.keys())
['blockHash', 'blockNumber', 'from', 'gas', 'gasPrice', 'hash', 'input', 'nonce', 'r', 's', 'to', 'transactionIndex', 'v', 'value']

This is the output for print(tx)

AttributeDict({'blockHash': HexBytes('0x9cb5c78955ad7836ec07e0460d19a457be74cfe6ecec2ba8a0c29c5057648021'), 'blockNumber': 6539317, 'from': '0x99fe5D6383289CDD56e54Fc0bAF7F67c957A8888', 'gas': 66666, 'gasPrice': 66000000000, 'hash': HexBytes('0x863bb4888489d081e63108fe0af03b366637963599d91692f46abee6900e9c58'), 'input': '0xa9059cbb000000000000000000000000a83cdb20fe49ff56635e2c8712238b4e96c9c5460000000000000000000000000000000000000000000029c07070040f0c070000', 'nonce': 37433, 'r': HexBytes('0xfc865f013dad1aac4ed4b0ff05d084bbc4b0d75c93e35638e9a045d07efdfc93'), 's': HexBytes('0x080d7cdb3930be83e0dcf8473653f63eb583c2d0473fa2054e63a825539abc64'), 'to': '0x9064c91e51d7021A85AD96817e1432aBf6624470', 'transactionIndex': 0, 'v': 37, 'value': 0})


texts: Mist on Ganache asks for a password on creating transaction

texts:
I cannot send funds to another my account with Mist, it asks for password. I'm using Ganache testnet, and didn't created any password in it.

I tried to use ganache-cli -d -u "0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1" (where -d as I understand is to preserve test accounts, and -u to unlock one of them), send to funds to another new account from 0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1, but it still asks for a password. How to fix it?


texts: Why aren't my accounts / keystore files showing up in Mist / Etheruem Wallet?

texts:
I recently upgraded to 0.7.4 (Windows) and all my accounts are gone. In the keystore folder, I can see what I think are my keys. However they are not being auto loaded.

When I went from 0.6.1 to 0.7.2 there was no issue, it would automatically find and import them.

Any idea or is this a bug that should be reported ?


texts:
Can I check the number of digits in solidity?
I'd live to validate input by ethereum. Can't I achieve it?


texts: how to make batch transaction in ethereum?

texts: Is it possible sending ether to multiple addresses in one go, better called batch sending? I want to make an API to transfer ether to 100 address at once so that I do not need to make 100 transactions.


texts: How do I know which transaction generated a contract in Factory pattern?

texts:
By factory pattern I mean a contract able to deploy other contracts like in this question: simple bakery factory pattern Each time I trigger

factoryInstance.newContract(args).then(promise);

I get transaction hash after transaction being mined. At this point the newly deployed contract address is already appended to the array inside the Factory contract

address[] public contracts;

Multiple transactions might happen in a short period of time and I want to know, from outside the contract, which one is responsible for a child creation (by its address). But EVM is able to access only the current state of the network (no transaction hashes), and on the front end the transaction receipt is unable to tell which contract has been created by the factory:

contractAddress: null

How do I know which address Y has generated transaction X?

Alternately, is there a way to know which transaction X generated Y?
I use ganache-cli and truffle.


texts: Where do contract event logs get stored in the Ethereum architecture?

texts:
Background on Events:
https://github.com/ethereum/wiki/wiki/Solidity-Features

Events allow the convenient usage of the EVM logging facilities. Events are inheritable members of contracts. When they are called, they cause the arguments to be stored in the transaction's log. Up to three parameters can receive the attribute indexed which will cause the respective arguments to be treated as log topics instead of data. The hash of the signature of the event is always one of the topics. All non-indexed arguments will be stored in the data part of the log.

If not inside the smart contract container, where does the Log data reside?


texts: I tried to send eth from Metamask (in balancer) but transfer is looking failed but I loss my eth(90$ around) What I should do?

texts: I tried to send eth from Metamask but transfer is looking failed but I loss my eth(90$ around) What I should do?


texts: What is Ethereum's inflation rate? (how quickly will new ether be created)

texts: It seems like the answer is still in flux, but it would be nice to have a single answer to this question that we can update over time.


texts:
I've looked all over the internet but couldn't find an answer.
So I've installed GETH and it's fully synced on my server. What is the easiest way to connect my asics and start solo mining. Do I need to create my own stratum server or is there a adress within geth that I can use ?
Thanks in advance for the answers.


texts:
I  have a Dapp which has SSL certificate. I am unable to access Quorum Nodes via https and http as the Dapp is https.
Can anyone please suggest me a method to solve this issue.
(Node access via web3)


texts: Truffle develop (Ganache) increase block gas limit

texts:
I can deploy my contract on Remix (Javascript VM and Rinkeby), but if I try to use truffle develop and migrate, I am getting an error: Error: Exceeds block gas limit. The gas used in Remix is 3585084.

How can I make it work in truffle?


texts: Best way to use the truffle contract abstraction in a mobile client?

texts:
For a final year computer science project I'm building (or attempting to build) a mobile frontend for my dapp.

The client will use the wallet offered by web3.eth.accounts to sign transactions locally (the Keystore file is stored locally, also, and never leaves the client - encrypted or otherwise).

I'm also utilising truffle to make Smart Contract development easier.

Now: taking into account that transactions are signed locally without the help of Metamask etc. - for the truffle abstractions, namely its abstraction of the ABI,  should I serve these from a node.js backend? I'm struggling conceptually with the potential flow.


texts: storing different set of values under unique id in contract

texts:
I need to store a set of values eg: productprice,no of products customer bought, customer name under unique productId. There can be any number of customers hence many set of values. If I create a srtucture

struct product{
  bytes12 productid;
  uint price;
  uint quantity
}

the values are overwritten.So I concatenated price,quantity and name to a single string and stored in an array.

struct Product{
  bytes32[] ProductArray;
}

mapping(string =>  MapDetails) ProductStructs;

function appendDetails(string pid,bytes32 details) payable returns(bool success){
ProductStructs[pid].ProductArray.push(details);
}

details is a concatenated string holding price,quantity and customer name. Guess that's not the way of doing it. Can anyone direct me to proper way of storing them.Help will be appreciated :)


texts: How can I add my Token symbol image in the Smart Contract?

texts:
I have noticed that for some token contract, it comes with a symbol image along with the token symbol name. How can I upload a token symbol image together with my ERC20 contract? Thanks a lot

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


texts: Can someone explain the difference between using metamask or web3 to send ether from truffle accounts?

texts:
I am using web3 and truffle (i am a newbie wants to understand concept)
I need to transfer ether so i understand that i need to use
web3.eth.sendtransaction
But will it work as i am using localhost and ethereum bridge to connect with oraclize?
Or is it possible to use metamask to facilitate transaction between accounts ?
Accounts are being fetched from truffle

In short i need to transfer ether between accounts fetched from truffle


texts: State of knowledge / research directions academic paper

texts: The SoK paper by Bonneau et al provides a good overview of the state of knowledge (as of 2015) and research directions for Bitcoin. Is there anything similar for Ethereum?


texts: Solidity How to pass argument to constructor from client side

texts:
How to pass from argument to constructor function in solidity that can be received as msg.sender . This is my constructor code

constructor(uint256 _initialSupply)public{
   totalSupply = _initialSupply;
   balanceOf[msg.sender] = _initialSupply;
}

My client side code

initContract: function() {
$.getJSON('ErcToken.json', function(json, textStatus) {
  App.contracts.ErcToken = TruffleContract(json);
  App.contracts.ErcToken.setProvider(App.web3Provider);
  return App.rendor();
});

},

rendor: function(){

    web3.eth.getCoinbase(function(err,account){
        if(err === null){
          App.account = account;
          $("#").text(account);
        }
    });

    App.contracts.ErcToken.deployed().then(function(instance){
        return instance.balanceOf(App.account);
    }).then(function(balance){
        $("#").text(balance.toNumber());
    });

    return App.bindEvents();
  }

Here i'm always receiving balance as 0


texts: How to estimate gasLimit of ERC20 contracts in web3.php project?

texts:
I am using web3.php project in my Ethereum based project. A part of this project is sending ERC20 tokens, and in this regard, I need to estimate gas limit of transaction. For this purpose, I found the example below in the official documents of this project as below:
$contract->at($contractAddress)->estimateGas($functionName, $params, $callback);

and I changed it to my own code like this:
$gasLimit = 0;
$contract = new Contract($web3->provider, $contract_abi);
$contract->at($contract_address)->estimateGas('transfer', [
     'to'=>'0xa96Ce4C161271C797d979017821A278e1481eAfA',
     'value'=>1
   ], function ($err, $gas) use (&$gasLimit) {
         if ($err !== null) {
             echo $err->getMessage();
             return false;
         } else {
             $gasLimit = $gas;
         }
    }
);

After running this code, I receive this error:
PHP Fatal error:  Uncaught InvalidArgumentException: Please make sure you have put all function params and callback...

And I am not sure what are the required params in $params as the sample which is mentioned in this project. I tried to put something using documents provided for estimateGas() here.
May you help me please to solve this issue?


texts:
I am getting this error this error at creation of genesis block:

[niko@localhost go-ethereum]$ cat /home/niko/saved-niko-home/aet/genesis-test.json
{
    "config": {
        "chainId": 777,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },
    "difficulty": 131072,
    "gasLimit": 2100000,
    "alloc": {
        "0db459d44280be8d8999b32cc1b22228ad803fa1" : {"balance":1000}
    }
}
[niko@localhost go-ethereum]$ build/bin/geth --datadir=/home/niko/saved-niko-home/aet init /home/niko/saved-niko-home/aet/genesis-test.json
Fatal: invalid genesis file: json: cannot unmarshal number into Go struct field Genesis.alloc of type *math.HexOrDecimal256
[niko@localhost go-ethereum]$

Validated with all online JSON validators out there, strict and non-strict, doesn't show any error. What is the problem here?


texts: Why Transfer(0x0, _to, _amount) after Minting Tokens

texts:
In https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/ERC20/MintableToken.sol#L38, why is it necessary to emit the event

Transfer(0x0, _to, _amount);

after minting some coins? Can someone please explain this line of code? Are you actually transferring coins from 0x0 to the address _to?


texts: ethereum transaction hash is not showing any result on ropsten ether scan.. here is my code and transaction hash. any suggestion?

texts:
var web3 = new Web3('');
    var contractData =[];
    //var Tx = require('ethereumjs-tx').Transaction
    var account1 = sendFrom;
    var account2 = sendTo;
    var PRIVATE_KEY_ACCOUNT_1=PriKey; //from private key
    var PRIVATE_KEY_ACCOUNT_2 =ToPkey; //sender private key
    var contract_address_ac1 =conAdd;

var txCount = web3.eth.getTransactionCount(account1)

var smartContract = new web3.eth.Contract(contractData,contract_address_ac1)
var gas = web3.eth.getGasPrice(function(error, result){
console.log(result);
});
    // Transaction
     var txObject = {
        nonce:    web3.utils.toHex(txCount),
        to:       account2,

    //value:    web3.utils.toHex(web3.utils.toWei('0.01', 'ether')),
    gasLimit: web3.utils.toHex(8000000),
   // gasPrice: web3.utils.toHex(web3.utils.toWei('10', 'gwei')),
    gasPrice: web3.utils.toHex(web3.utils.toWei('1000000000', 'gwei')),
    data:smartContract.methods.transfer(account2,token).encodeABI(),
 }

// Sign the transaction
var tx = new ethereumjs.Tx(txObject, { chain: 'ropsten', hardfork: 'istanbul' })
var pk = new ethereumjs.Buffer.Buffer.from(PRIVATE_KEY_ACCOUNT_1, 'hex')
tx.sign(pk)

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

 // Broadcast the transaction
 web3.eth.sendSignedTransaction(raw,function(err,receipt){
    //console.log(err)
    //console.log(receipt)
    $('.Hash').html("Transaction Hash: "+receipt);
    $('.error').html(err);
})

transaction hash: //0xc08296ba5c5fa5e68accdae6a2ed8bc21a7c6030091c785ea0339fa965ae88a3
//0x755c1a767fb13223705165bbd6fd2383f8f941d56cb1d8f7c28eddf54ffb4c74


texts: How to use transfer(), send() and msg.value?

texts:
When I deploy a contract with a function with receiver.transfer(), receiver.send() or a msg.value function, the function can't get executed when I try to interact with it (MyEtherWallet and web3 via metamask), so I'm wondering how to use the functions in Solidity.

Here are examples with incorrect code:

First try:

function buytokens() public payable{
    uint256 ethersent = msg.value / 1000000000000000000;
    address zender = msg.sender;
    uint256 tokens = ethersent * 10;
    require(balanceOf[owner] >= tokens);
    balanceOf[zender] += tokens;
    balanceOf[owner] -= tokens;
    tokenbuy(msg.sender, owner, ethersent, tokens);
}

Second try:

contract token{

mapping (address => uint256) public balanceOf;

event Transfer(address indexed from, address indexed to, uint256 value);

function buy() public payable returns (uint amount){
    amount = msg.value;                    // calculates the amount
    require(balanceOf[this] >= amount);               // checks if it has enough to sell
    balanceOf[msg.sender] += amount;                  // adds the amount to buyer's balance
    balanceOf[this] -= amount;                        // subtracts amount from seller's balance
    Transfer(this, msg.sender, amount);               // execute an event reflecting the change
    return amount;                                    // ends function and returns
}

function sell(uint amount) public returns (uint revenue){
    require(balanceOf[msg.sender] >= amount);         // checks if the sender has enough to sell
    balanceOf[this] += amount;                        // adds the amount to owner's balance
    balanceOf[msg.sender] -= amount;                  // subtracts the amount from seller's balance
    revenue = amount;
    msg.sender.transfer(revenue);                     // sends ether to the seller: it's important to do this last to prevent recursion attacks
    Transfer(msg.sender, this, amount);               // executes an event reflecting on the change
    return revenue;                                   // ends function and returns
}

}

Third try (from example Token contract: https://ethereum.org/token):

function buy() payable public {
    uint amount = msg.value / buyPrice;               // calculates the amount
    _transfer(this, msg.sender, amount);              // makes the transfers
}

Could somebody tell me what I'm doing wrong?


texts: How to use multiple app.js in truffle project?

texts:
I'm new to blockchain and currently developing small application for educational purpose using solidity.
I am using truffle framework and stuck at a point.

currently there is only one app.js file in the project, I want to create another js file and import that file in app.js just like classes in java.

for ex:- If I write register_user() function in example.js file, then how should I import that file in app.js so that I can call functions from example.js.

I've tried using 'module.exports = function(){};' but it throws error as Uncaught ReferenceError: module is ./example.js not defined

please help !!!


texts: Interoperability between Ethereum's Public Blockchain and Quorum's Private Permissioned Blokchain Network

texts:
Scenario:
I am trying to set two blockchain networks on a platform:

Ethereum's Public Blockchain Network: For payment system in the form of ERC20 Tokens and Cryptocurrencies.
Quorum's Private Permissioned Blockchain Network: For Data Storage and Permissioned access.

Questions:

Can I make the two different blockchain networks(mentioned above) talk to each other? Are there any issues involved? How can I do that?
Are Quorum and Ethereum compatible? Or should I choose another blockchain?
For Enterprise level application Is Quorum scalable and API rich?


texts: Ropsten Ethereum not showing transaction information

texts:
I am using geth 1.7.3-stable-4bb3c89d to sync with Ropsten network. I started synchronization with fast mode and restarted the service. When I type eth.syncing in geth console it always shows false but the new blocks are being imported.

eth.blockNumber in my node returns 4374961 but when I try to get one of the transaction info from that block then it returns null.

When will the transaction info of the blocks be downloaded in my node? I already removed the test database 3 times and started fresh with fast sync mode. I have 11 peers right now in my node. Do I need to change something to download block info?


texts: What is the best way to download all NFTs data

texts:
Mb someone knows what is the best way to download all NFTs data(uri) from contract?? I try to use filter on minting event but I need to do N iterations, because infura or web3 has limitation of 10k events in response. In this way it is not very efficient solution. Mb there are some other ways to do it?
P.S nft erc1155


texts:
library C {
   function a() public returns (uint) {
      return 15;
   }
}

contract A {

   function a() public returns (uint) {
      return C.a();
   }

}

This is the code I am using.  I am trying to figure out how library C ends up in contract A's bytecode.
Question 1) I use remix and I compile contract A. In the bytecode, I can see the following __$de3f906ec3d3531c3d498f8b283d7f02e6$__. It doesn't matter if I change library C's function a's name or if I change what it returns. In the bytecode, there's always the same __$de3f906ec3d3531c3d498f8b283d7f02e6$__. Of course, If I use the library's function 2 times, then I will meet that strange string 2 times in the bytecode. What is it ?
Question 2) The answer to the above question could be it's a placeholder, where in the end, it's library's address that ends up in there.  If that's correct, then how does remix link library C to contract A ? because both library and contract are in the same file, and when I want to deploy, I only deploy contract A (i don't deploy or link library at all). Any idea ? How do I get the library address in that matter ?


texts:
I am inspecting a strange case. I am monitoring Ropsten network for my project and writing all transactions to database to search them though in much more convenient way. Every couple of minutes I schedule a worker that checks database for records with pending status and try to retriever transaction receipts from block chain. I noticed that there were some old transactions but without transaction receipt at all. Searching for transaction hash on ropsten.etherscan.io gave no results. Here is an example

> var Web3 = require('web3');
> var web3 = new Web3("ws://127.0.0.1:858");
> web3.eth.getTransaction('0xa47ae1f88626e0534382a980aa96db212225abd7570817aecac1f30276ed431e').then(console.log);
{ blockHash: null,
  blockNumber: null,
  chainId: '0x3',
  condition: null,
  creates: null,
  from: '0x01592cE6b6dcd5D5fe9933d7b6a6786A79274CD3',
  gas: 121000,
  gasPrice: '4000000000',
  hash: '0xa47ae1f88626e0534382a980aa96db212225abd7570817aecac1f30276ed431e',
  input: '0x',
  nonce: 53,
  publicKey: '0x772bac5a49059e6648ab2dfd0d4349ba84c9a3d3d9cd84abf67e4966eebc02145638a8e6d5fd9798072d2bdd27fd2a360192d3587a7e2cb62c193124a65cf413',
  r: '0x9ed44eb37c1da71d600afee3c9a1283ed0d259dfe7c1ee00e9a16fd0e2678bed',
  raw: '0xf86b3584ee6b28008301d8a89412fa13c638b4b6ceb1ac1c8d072530abd5a18fbc872386f26fc100008029a09ed44eb37c1da71d600afee3c9a1283ed0d259dfe7c1ee00e9a16fd0e2678beda059f1788c8e38373abf4ea0b6ca4ad5c3014dcca29c17657c195405422c8a6913',
  s: '0x59f1788c8e38373abf4ea0b6ca4ad5c3014dcca29c17657c195405422c8a6913',
  standardV: '0x0',
  to: '0x12FA13C638b4b6Ceb1aC1C8d072530AbD5A18FbC',
  transactionIndex: null,
  v: '0x29',
  value: '10000000000000000' }
> web3.eth.getTransactionReceipt('0xa47ae1f88626e0534382a980aa96db212225abd7570817aecac1f30276ed431e').then(console.log);
null

This transaction arrived to my local DB at 2:30 AM my local time and I stared my investigation at 10am. By the time I started my investigation it was pending for 7 hours at least. Also Etherscan shows pending transaction on their webpage if transaction is yet to be mined, in case of this transaction Etherscan seems to be unaware of it. Here is what etherscan shows

https://ropsten.etherscan.io/tx/0xa47ae1f88626e0534382a980aa96db212225abd7570817aecac1f30276ed431e

AS you can see from transaction data it has correct amount of gas and gas price: 121k for 4MGwei. Can someone explain this behavior?

UPDATE

The explanation for this behavior is answered here:
Are pending transactions "dropped" and "reinstated"?


texts: Error when connecting metamask mobile to ganache RPC Server

texts:
So i'm running a ganache server using the ganache GUI, for the host name I'm using the Wi-fi ip and the port is: 7545.
Connecting to this rpc server with the metamask browser extension works just fine, but when i'm trying to add this network to metamask mobile(RPC url: http://IpAddress:7545, Chain ID: 1337) I get the following error: "could not fetch chain id. is your rpc url correct?".
I'm connected to the same Wi-fi from both the laptop and the phone.
Can this be solved?


texts: where impelement web3 services : backend or fronend?

texts:
I am developing a social-media-like application based on ethereum blockchain
and some use cases are controlled by smart contracts.
so to communicate with smart contract I have to deal with web3.

the question is if I have to implement web3 services at the frontend level (angular) because this will need transaction cofirmation and wallet access (exmpl  metamask) and keep off-chain business in backend (nodejs), or I can impelement all services in nodejs.


texts: Does a verified deployer contract implies that it's child token contract is also verified upon creation?

texts:
Token address: https://etherscan.io/token/0x12b19d3e2ccc14da04fae33e63652ce469b3f2fd

Contract address: https://etherscan.io/address/0x12b19d3e2ccc14da04fae33e63652ce469b3f2fd

Deployer contract: https://etherscan.io/address/0x94dc1cf66c8fd62ef3bd7da53f47423862839823

So, can we say that the GRID token is verified, simply because it was deployed by another verified token sale contract?

EDIT:
A definite answer has not yet been given in the related earlier asked question.


texts: Encryption and Decryption when transmitting data

texts: If I was sending data to a smart contract, do I need to encrypt it before transmitting and decrypt it in the smart contract? Or is this done automatically?


texts: How to access Swarm content from ethereum smart contract using oraclize

texts:
I am trying to access the content in a file that I uploaded to Swarm using oraclize. I found a smart contract  in https://github.com/oraclize/ethereum-examples/blob/master/solidity/Swarm.sol

I was just trying to print the 'hello world' (the content of the swarm hash the author specified in the contract). So, I simply mined the contract. Then used the details in the JavaScript as follows (using meteor.js):

//variables

  contractAddressSwarm = "0x87b620f0731e15cb1655e216a87c986154ba4248"

  ABIArraySwarm = [{"constant":false,"inputs":[{"name":"myid","type":"bytes32"},{"name":"result","type":"string"}],"name":"__callback","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"myid","type":"bytes32"},{"name":"result","type":"string"},{"name":"proof","type":"bytes"}],"name":"__callback","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"swarmContent","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"update","outputs":[],"payable":true,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"description","type":"string"}],"name":"newOraclizeQuery","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"swarmContent","type":"string"}],"name":"newSwarmContent","type":"event"}]

//Print swarm content in the console when a button is clicked

  'click #buttonSwarm'(event, instance) {
      var template= Template.instance();

  myContract = web3.eth.contract(ABIArraySwarm).at(contractAddressSwarm);

  console.log("Swarm Contract execution");

  myContract.swarmContent(function(err, res){
          TemplateVar.set(template, "counter", res);
          console.log(TemplateVar.get(template,"counter"));
      });
      },

....

But every time it  is printing 'null'. What am I doing wrong in the callback?


texts: Why do my truffle tests get much slower as I run more of them?

texts:
So I am currently building up a test suite for a project, and I have quite a few tests at this point. I am running into a problem however that truffle seems to run tests later in its execution much slower than it does if I run that test file first. Are some of my contract objects staying around and clogging up my environment as I run more tests? Has anyone experienced something similar to this?
With lots of test beforehand
    PoolManager deployment
      ✓ has correct owner (2928ms)
      ✓ has correct region name (301ms)
      ✓ does accounts[0] deploy contract (278ms)
      ✓ renounce ownership works (462ms)
      ✓ transfer region owner legit (352ms)
      ✓ transfer region owner malicious 1 (584ms)
    Pool Interaction
      ✓ can approve a pool (1562ms)
      ✓ non regionOwner cannot approve pool (1817ms)
      ✓ strategy controler able to deploy strategy (with 0 for timelock) (4915ms)
      ✓ can deposit fund to pool after setting strategy first time (14449ms)
      ✓ can withdraw funds after depositing into pool, setting strategy only once, no old strategy (8547ms)
      ✓ deposit, change strategy, then withdraw. No money should be lost. 1 user only in this test (13232ms)
      ✓ deposit, change strategy, then withdraw. No money should be lost. 3 users in this test (20736ms)
    Strategy interaction
      ✓ deposit, change strategy, then withdraw. 3 users, 1:.5 strategy value ratio (18233ms)
      ✓ deposit, change strategy, then withdraw. 3 users, 1:.2 on first strat, 1:.5 on second strat value ratio to staking token, bigger ratio to smaller ratio test (14736ms)
      ✓ deposit withdraw 1/2 withdraw 1/2 from 4 accounts, with two movetoNewPool called between deposit, and between the 2 withdraw blocks (29290ms)
      ✓ deposit, change strategy, then withdraw. 3 users, 1:.5 to 1:.2 strat, smaller ratio to bigger ratio test (22301ms)
      ✓ users withdraw when funds are halfway between pools. No money should be lost (28385ms)
      ✓ make sure deposit is properly reject while pool is locked to move funds, and withdraw works normally and all funds can still be emptied, region manager cannot lock peoples funds forever with move (25677ms)

  Contract: token
    token deployment
      ✓ has correct name (18812ms)
      ✓ has correct symbol (5832ms)

Take note of the tests under the xxx contract section at the bottom. Here is their execution time if I dont run the pool manager contract tests.
Contract: token
    token deployment
      ✓ has correct name (2849ms)
      ✓ has correct symbol (304ms)

Its much faster. This added delay is causing my testing to run super slow as I add more and more tests to cover more possible scenarios. I would think that truffle would unload all the objects from one file once it is done running the tests in that file, but I'm not sure it thats actually the case. Any help or thoughts would be greatly appreciated!


texts: Is there any Ether mixer / tumbler available?

texts:
Quick checking around there are exactly two references to an Ether Mixer - this non functioning and here (r/ethereum) 24 days ago.

Unless I am missing something how can I hide the source of an ETH transfer? I have a couple of Genesis block pre sale accounts. I want to send a handful to this new Daemon DAO for the hell of it. What I don't want is anyone to trace and see it all the way back to my mega stack in my pre sale account.

Is there a direct current solution?

Or is there only ETH -> BTC -> Mixing -> ETH and then send it?

Would Shapeshift work in this fashion? ETH to them, goes where ever, they convert it on their account, send me the BTC to my virgin account, send back to buy ETH, receive in virgin ETH account, then send to the Daemon DAO?

I do think I am missing something somewhere.

P.S. I don't have any BTC and don't have money to buy it just for this, I do have lots of ETH.


texts: Is there a way to retrieve data for a solidity smart contract?

texts:
TL;DR: I'm starting with blockchain, ethereum, web3 environment and i'm very excited about it, so I want to know few things that are not clear.
I already built my first solidity contract (some shop contract) but with hardcoded data, so I'd like to know, where should I get data so it is not hardcoded in solidity. For example:
If I want to create a solidity contract for wining X prize, that prize will be always hardcoded inside the contract?
or if i want to craete a smart contract to do something like kickstarter (fund rising), where will live all those campaings?
Thank you.


texts: Is there a way to know if a Solidity method will revert?

texts:
I have some solidity methods in my contract, and when i make a send in web3.js i would like to know if there is a way to know if the functions are going to revert by using call.

Per-example , in Solidity i have a function that returns true, and i thought that if i used "call" in web3, i would get true if no revert and false or null if revert. But this is not the case, as when reverts, returns true anyway

Is there a way to know if it will revert?


texts:
I'm trying to check whether the amount send by an account is even. For now, I have the code below but when I send only 1 ETH, it doesn't not come back. Seems odd (pun intended :p )

uint amount;
amount = msg.value;
if (amount % 2 != 0  ) {
      msg.sender.send(amount);
    return;
}


texts: Gnosis Wallet - Multisig not really working as multisig

texts:
I'm trying to create a MultiSig wallet for both ETH and ERC20. After doing some research, I found Gnosis, which seemed to fill my need.

First I tried to download the local (electron-based) version. Which was not connecting with my Trezor, so I was recommended to use the web version instead: https://wallet.gnosis.pm/#/wallets.

I then used the web version with MetaMask. For my test I used the Kovan network and deployed the Multisig Wallet requiring 2 confirmations out of 2 addresses, with a daily limit of 3 Eth.

All good, contract deployed, sent it some eth to test it out. It was received normally and updated the balance. Now for the final test, I tried to withdraw some funds, but to my surprise, any of the owner addresses were able to withdraw funds without requiring the second signature/confirmation. All funds were immediately transferred out of the wallet whenever any of the owners withdraw, completely skipping the necessity for the second signing, even though it is set-up for 2 required confirmations.

Here's the deployed wallet address: 0xeE27cE0d4a4001964C125c4B8C74b78489Fd74FB

My questions are:

1 - Is this broken or am I missing something? If broken, how can I fix it?

2 - I noticed that the Gnosis repository (https://github.com/gnosis/MultiSigWallet) hasn't been updated in a while, especially the contracts folder. How reliable is it to use in a production environment?


texts: Is it available to have an application that is managed by single Entity?

texts:
If For example  Entity  A wants to build a smart contract that manage a group of devices. But since each device uses pseudonym and he may change it later, is there any way to build the contract such that  each device should have a certain address for a certain amount of Time ( month for example) and Is it available now in Etherum so that that Entity A can issue addresses for devices joining the smart contract ?
Just thinking of a private application on the etherum controlled by a single entity  and also also he would like to detect bad users


texts: My ToastWallet account is hacked. What to do please?

texts:
My toast wallet was hacked. I had forgotten my passphrase. I need help desperately. I forgot my passphrase and noticed a few days ago over 25K xrp has been withdrawn in 5 transactions past, respectively. The transactions have been made to three distinct destinations.
Q1) If someone has/guess our passphrase and had the PIN number already, can change the passphrase? What about the PIN?
Q2) If someone changed the passphrase can we know the whereabouts of the person who did it?
Q3) Can we tell the where about the location or the person where my bitcoins where transferred to. I have the "To address" and "Destination Tag" of the transaction details?
Q4) How can we officially pursue this. I am the official owner of the account? can I file a lawsuit? Can I hire a lawyer? Where should I start from, please?
Any help would be greatly appreciated.
Thank you.


texts:
// openzeppelin v5
contract ERC721Full is ERC721, ERC721Enumerable, ERC721Metadata {
    constructor (string memory name, string memory symbol) public ERC721Metadata(name, symbol) {
        // solhint-disable-previous-line no-empty-blocks
    }
}

contract Test is ERC721Full {
   // ctor...

  function createToken(...) public {
    _mint(msg.sender, id);
  }
}

Basically, I have a contract that inherits openzeppelin's ERC721Full contract.

My question is, when _mint is called in createToken, why does it call _mint in ERC721Enumerable instead of _mint in ERC721?

Is it because ERC721Enumerable is inherited in ERC721Full next to ERC721 in the sequence?

ex: ERC721 -> ERC721Enumerable.


texts: When running a geth node, how can I know when reorg occur?

texts:
I want to add a script to notify the dev team if re-org bigger than 200 blocks took place.
How can I achieve it?


texts: Ethereum blockchain size as of March 2017 (geth --fast and others)

texts:
What is the size of the Ethereum blockchain as of March 2017?

I am just starting with geth --fast -cache=1024, but I would also be interested in other clients or other downloading methods.

I know the question has been asked in the past, but it would be interesting to keep an up-to-date answer.


texts: Calling External Web Service from Smart Contract

texts:
Trying to find a way to invoke a external web service to perform any operation based on some action on the smart contract.

Request to share  details as to how to perform the same.


texts:
I am currently developing a D-app for Ethereum, usable with the Metamask extension. I use the truffle framework and testrpc to test locally my app.

When the user has to make a transaction to execute a function of smart contracts, the Gas Limit for the transactions in the Metamask window is always already set to a (variable) certain amount. As this amount is enough for most of my transactions, except a few for which I have to set manually the gas limit, I was wondering myself how is this amount for the gas limit calculated/estimated.

Where could I find some good information about this matter?

Any help would be greatly appreciated


texts: web3 1.0 getPastLogs with geth --syncmode light


texts: How to get the last n bytes of a bytes32 in assembly?

texts:
I have the following code:

function getBytes5() public returns (bytes5) {
    uint256 x = now;
    bytes memory inBytes = new bytes(32);
    bytes5 outBytes5;
    assembly {
         mstore(add(inBytes, 32), x)
         outBytes5 := mload(add(add(inBytes, 27), 5))
    }
    return outBytes5;
}

Which firstly stores the blockchain timestamp now in the inBytes variable and then tries to convert it from bytes32 to bytes5. However, the result I get is:

{
    "0": "bytes5": 0x0000000000
}

My understanding is that mload loads the values at the given addresses and add(add(inBytes, 27), 5) will return the last 5 bytes of the inBytes variable. But maybe there's a flaw somewhere in there?


texts: Do the 12 words from blockchain.info backup the ether funds?

texts: Do the 12 word master seed from blockchain.info wallet back up the entire wallet (btc+eth)? Or does the ether balance require a separate backup?


texts: Can one store short text data when transacting ERC20 tokens?

texts:
I am having trouble understanding if i can store short pieces of text when I send an ERC20 token. I have successfully stored a small message when transacting ETH by converting it to HEX and adding it to the "data" section in MEW. However, the "data" section when sending a custom ERC20 token doesn't work. Why is that?

To give you a clearer picture, we are building a social platform in NYC, called The Jesuit Token, where people are rewarded tokens for every hour of community service performed. Every time we issue new tokens, we are looking to add a little bit of text data to the transaction summarizing what kind of community service the person performed to receive a token. The idea is to have the information broadcasted on the network for transparency reasons and for later analysis of the social impact people have.

I would really appreciate if anyone a little more technically inclined could help us out. Remember, this is a promising social platform and you might impact the lives of many people by helping it launch! :)

Thanks!


texts: UniSwapV2Router.sol contract failing - "Gas required exceed allowance / Always failing transaction"

texts:
I am trying to recreate the Sushiswap protocol for educational reasons, but I am stumbling into an issue. When I try to run the addLiquidity function inside the UniswapV2Router.sol contract with the following arguments:
[
    tokenA => "0xdAC17F958D2ee523a2206206994597C13D831ec7",
    tokenB => "0xEe8A808C478d14aec57f874351177d80D02ce454",
    amountADesired =>"1000000",
    amountBDesired => "100000000000000000",
    amountAMin =>"1000000",
    amountBMin => "100000000000000000",
    to => "0xFFC4d90bCF8C6C1f0FaB5E0e14d03B020B41A701",
    deadline => 1604584008
]

The contract fails or runs out of gas. What could be the cause of this? I have linked the UniswapV2Router solidity contract that I deployed above, I haven't made any changes to the code. Below is my deployment procedure on Truffle
await deployer.deploy(WETH9);
let weth = await WETH9.deployed();

await deployer.deploy(
    UniSwapV2Factory,
    ADMIN_ADDRESS
);

const factory = await UniSwapV2Factory.deployed();
await deployer.deploy(SushiToken);
const sushiToken = await SushiToken.deployed();
sushiToken.mint(ADMIN_ADDRESS, web3.utils.toWei("10000000"), { from: ADMIN_ADDRESS });
await deployer.deploy(UniswapV2Router, factory.address, weth.address);
const router = await UniswapV2Router.deployed();
  await deployer.deploy(
    MasterChef,
    sushiToken.address,
    ADMIN_ADDRESS,
    web3.utils.toWei('100'),
    1,
    10
  );
const masterChef = await MasterChef.deployed();
await sushiToken.transferOwnership(masterChef.address);
await deployer.deploy(SushiBar, sushiToken.address);
const sushiBar = await SushiBar.deployed();
await deployer.deploy(
    SushiMaker,
    factory.address,
    sushiBar.address,
    sushiToken.address,
    weth.address
);
const sushiMaker = await SushiMaker.deployed();
await factory.setFeeTo(sushiMaker.address);

  //LP migrator stuff
await deployer.deploy(
    Migrator,
    masterChef.address,
    sushiToken.address,
    factory.address,
    1
);

What is the best way to dive deeper into debugging this code?


texts:
I created some accounts on my computer use Parity. I'm sent ETH to this accounts.

Now, i want move all balance of all accounts to new account without fee. I can?

Of course, the new account in local
.


texts: What's wrong with this Golang code for transaction signing? Invalid v,r,s error?

texts:
So I'm learning more about Ethereum, and I wrote this gist in Go to start interacting with geth nodes and publishing transactions to the network. I'm getting an error that says:

panic: invalid transaction v, r, s values

Here's the code I wrote to send the transaction: https://gist.github.com/karysto/3c7c1ab9d3ae736e5c63a2bbe4c47ac2

Any and all help appreciated!

Update: It seems that the network/signer chain id is being mis-set somewhere. Despite the fact that I'm setting the chain id to 0 in the gist, the chain id for a transaction always gets set to 9223372036854775790. My guess is the transaction is getting signed correctly but is getting signed with the incorrect chain (the one above), hence the invalid v,r,s error. If someone knows a way to fix this issue or finds I'm incorrect, don't hesitate to submit an answer!

Update: March 29 2017: I opened an issue on Go ethereum explaining this problem.

Geth versions tested: 1.5.9 and 1.6.0-unstable


texts: How to Pass the value in bytes32[] array

texts:
Given this constructor:

function Voting(bytes32[] candidateNames) public {
    candidateList = candidateNames;
}

How to pass pass the value in the parameter candidateNames when I deploy the contract in remix?


texts: OpenZeppelin test helper: expectEvent.inTransaction error

texts:
I'm trying to use OZ Test helpers to pass a test when a specific event is emitted. Here is the logic:

I call function1 with a JS Promise.
function1 calls function2 which emits an event.

Parts of code have been omitted for readability:
test.js
const { expectEvent } = require('@openzeppelin/test-helpers');
const { ethers }      = require("hardhat");

describe("test", function() => {
let mycontract;

before( async() => {
    const Mycontract = await ethers.getContractFactory("MyContract");
    mycontract = await Mycontract.deploy();
})

it("expected event is emitted.", async() => {

    const{ hash } = await mycontract.function1();

    await expectEvent.inTransaction(hash, mycontract, "THIS_EVENT",
     {message:"This event has happened."} );
 });
});

myContract.sol
pragma solidity ^0.6.0;

contract MyContract
{
string message;

constructor(){
 _message = "This event has happened."
}

event THIS_EVENT(string message);

function1() {
 function2();
}

function2() {
 emit THIS_EVENT("_message")
 }

}

Error message:
     Error: Unknown contract object

How can I write a test to pass when a specific event is emitted as a result of a nested function call ?
Your time is much appreciated,
Edit
hardhat: 2.2.1
test-helpers: 0.1.4


texts: How to call contract state-changing method on Ropsten via Infura using web3@1.0.0?

texts:
I have the following contract:

pragma solidity ^0.4.24;

contract Escrow {

    address public owner;

    event LogReceivedFunds(address sender, uint amount);
    event LogReturnedFunds(address recipient, uint amount);

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

    function() public payable {
        emit LogReceivedFunds(msg.sender, msg.value);
    }

    modifier onlyOwner() {
        require(msg.sender == owner);
        _;
    }

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

    function refundBalance() public onlyOwner {
        uint256 balance = address(this).balance;
        msg.sender.transfer(balance);
        emit LogReturnedFunds(msg.sender, balance);
    }

    function kill() public onlyOwner {
        selfdestruct(owner);
    }
}

I successfully connected to Ropsten via Infura, as I can:

Deploy the contract via truffle
Run call on methods such as getBalance.

However, when I want to use send to alter the state (that is, refund the owner of the contract their deposited funds), I get this response:

  Error: Invalid JSON RPC response: ""

This doesn't happen on Ganache, therefore I reckon it's a problem caused by Infura. Is there some sort of incompatibility?


texts: How to integrate myether wallet in ICO crowd-sale application with python web3.py library

texts:
I am new to ethereum block-chain. I am learning to implantation of Ethereum decentralise application with python web3.py. I successfully compile and deploy smart contract with web3.py.

Now, I want to create a functionality in which user click on buy token button,on click of buy token button MyEtherwallet is open. And end user will complete his transaction.

I used matamask wallet for same case. But in this case I used web3.js library. I do not want to use matamask plugin with python web3.py because it is run on browser. And browser support java-script language. So, my query is:-

How I integrate MyEther wallet in ICO crowd-sale application with python web3.py??


texts: How can I call contracts functions after it's deployed in Ropsten test net?

texts:
I wrote my contract in browser remix ide.It's deployed and I can transfer my tokens with online wallet.
Now how can I call contract's functions?I know I can do it with remix ide but this unconvinient because if I reload the page everything resets and I have to deploy new contract.


texts: How to watch/wait for events in JavaScript + Truffle?

texts:
I'm learning to develop Oracles, and, like all of us, I've encountered a dated article. After fixing all the Solidity changes (version, adding emit to fire an event, changing constructor function to constructor etc.), I've encountered a JS issue.
I'm supposed to be listening to an event, and when it gets fired, fetch some data, and call a contract function to store said data.
I'm using @truffle/contract to access my contract data in JS.
There's a line saying something like myContract.myEvent().watch(.... I keep getting .watch is not a function. I'm assuming at one point, watch has been replaced. I can't find when and by what.
I did find some Truffle documentation saying that you can treat the event like an EventEmitter (i.e. hang .on statements on it), but hat does not have the loop effect watch had (i.e. the script keeps running and waiting for the event, instead of just running once and exiting.
TL;DR: what replaced watch? Should I write an infinite loop around an EventEmitter code?


texts:
If generated two forked block A and B.
Can the smart contract in block A access to transaction in block B?

I know that PoS is consensus algorithm working by check all stake in block.
The verifier keep the block which has many stake.
I guess that not need to access to stake in the other block.
I think it is enough that verifier sum all stake in each block and compare two total stake.

But, I wonder whether the smart contract in block A can access to transaction in block B or not?


texts: Custom Parity signer – programmatically unlock accounts for a certain time

texts:
How can I implement a custom transaction signer (which will unlock accounts on the fly) and tell parity client to use it?

I don't want to unlock all accounts at startup (and always keep them unlocked. Instead, I want to set some logic for account unlocking on each transaction, say:

if (isDay && accountAddress in [addr1, addr2, addr3])
    unlockAccount and signTransaction
else
    rejectTransaction

I'm looking into JSONRPC signer module as a possible option, but not able to connect to the Parity Signer UI using websockets

Connect Error: Error: Server responded with a non-101 status: 403
Response Headers Follow:
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
server: Parity/SignerUI
content-length: 524
content-type: text/html
connection: close


texts: Calling function from another contract reverts

texts:
I've been developing a dApp that needs ERC721 tokens. I have three contracts, a base contract, the one to mint tokens and another one for auctions. The inheritance looks like Base > Token > Auctions. In this scenario AFAIK I should be able to access the functions from the Token contract from the Auctions one. When minting new tokens I call a function of Base from Token and the token is minted successfully, I can check the information of the token if I call the contract directly, i.e. from Truffle console

CToken.deployed().then(i => { return.i.ownerOf(0) }) This works after minting obviously but when I try to call that function from the Auctions contract the operation reverts.

truffle(development)> Auctions.deployed().then(i => { return i.__ownerOf.call(0) })
Error: VM Exception while processing transaction: revert
... Whole stacktrace...

Why can't I get this information? It should be noted that if I call the mint function from another contract (Auctions or Base) I can get this information from those contracts but not from the Token one like if the storage is only for the contracts that called those functions initially. What I'm missing here?

Here are the relevant functions:

Token:

function createStallion(address _sender, string _hash) public payable {
    require(stallionsAvailable > 0);

    uint256 tokenId = addresses.push(_sender) - 1;

    super._mint(_sender, tokenId); // This comes from OpenZeppelin.
    super.buyStallion(_hash);

    stallionsAvailable -= 1;
}

function ownerOf(uint256 _tokenId) public view returns(address) {
    return super.ownerOf(_tokenId);
}

Base

function buyStallion(string _horseHash) internal returns(bool) {
    counter += 1;

    Horse memory horse;
    // ... bunch of horse information
    horses.push(horse);

    return true;
}

Auctions:

// This function is only for testing since I'm not calling it anywhere yet but it had the same behaviour when I wanted to use it in a `require`
function __ownerOf(uint256 _horseId) public view returns(address) {
    return super.ownerOf(_horseId);
}


texts:
I have made a simple ERC20 token smart contract, but my transferFrom function does not work. I keep getting "Note: The constructor should be payable if you send value." even if I declared it as payable.

function transferFrom(address from, address to, uint256 value) payable public returns(bool success) {
  require(
    allowed[from][msg.sender] >= value
    && balances[from] >= value
    && value >= 0
  );
  balances[from] -= value;
  balances[to] += value;
  allowed[from][msg.sender] -= value;
  Transfer(from, to, value);
  return true;
}


texts: Ethereum is described as using and enabling the creation of "Smart Contracts", sometimes called just "contracts".  But what is an Ethereum contract?  Is it a legal document, or something else?


texts:
I have one contract that I give tokens from a ERC20 contract implemantation. When I  call the balanceOf function from the Token conract. Response me that I have x Tokens. Nice !!

But when I try to send and amount of tokens(x/2 for example) from the smart-contract that have the X tokens to and specified address. I get the following error:

  VM Exception while processing transaction: revert Not enough token

The question is, is necessary to have ether in the smart-contract to make the transaction?? It´s possible to a deployed smart-contract address give ether for making transactions??

Thx for the help


texts:
What makes an Ethereum network private?

1) Is the networkid alone enough?
2) Or is it necessary that the network be on a VPN?
3) Or does it have to be within a LAN?


texts: Solidity logic implementation using block.timestamp

texts:
i'm trying to implement some logic involving block.timestamps and i keep getting this weird transaction revert:

The first time i call the function doLogic(), the transaction gets reverted. The second time i call it, it works (and after that it always works). I guess it has to do with the updated blocktime because the first call of doLogic() gets reverted but still updates the value of block.timestamp? maybe some of you already had issues with this and can help me!

(now is equivalent to block.timestamp)

pragma solidity 0.6.0;

contract TestStamps {

    uint256 time;
    bool test;

    constructor() public {
        time = now;
    }

    function getTime() public view returns (uint256) {
        return time;
    }

    function updateBlock() public  {
        time = now;
    }

    function doLogic() public {
        if (now > time) {
            test = true;
        } else {
            test = false;
        }
    }

    function getTestBool () public view returns (bool) {
        return test;
    }
}


texts: How Can I Add A Specific Percentage Fee On My Etherium Token In Solidarity When Sold?

texts: How Can I Add A Specific Fee On My Ethereum Token In Solidarity So It Charges People A 15% When They Sell Their Tokens So 10% Of The Tokens Sold Go And Deposite To My Wallet Address, And The 5% Spreads Amongst Token Holders (Something Similar To What Safemoon Does Basicaly)


texts:
pragma solidity 0.5.1;

contract basics{
    using SafeMath for *;
    uint time;
    address payable sender;
    uint amount;
    event moneySent(address s,uint a);

    mapping(address=>person) public accounts;

    struct person {
        uint time;
        uint vault;
    }

    function sendToContract() public payable{// isWithinLimits(msg.value){
        accounts[msg.sender].vault=accounts[msg.sender].vault.add(msg.value);
        accounts[msg.sender].time=now;
    }

    function takeFromContract() public payable{
        if(now>=accounts[msg.sender].time+10 seconds){
            msg.sender.transfer(accounts[msg.sender].vault);
            accounts[msg.sender].time=now;
        }
    }
}

/**
 * @title SafeMath v0.1.9
 * @dev Math operations with safety checks that throw on error
 * change notes:  original SafeMath library from OpenZeppelin modified by Inventor
 * - added sqrt
 * - added sq
 * - added pwr
 * - changed asserts to requires with error log outputs
 * - removed div, its useless
 */
library SafeMath {

    /**
    * @dev Multiplies two numbers, throws on overflow.
    */
    function mul(uint256 a, uint256 b)
        internal
        pure
        returns (uint256 c)
    {
        if (a == 0) {
            return 0;
        }
        c = a * b;
        require(c / a == b, "SafeMath mul failed");
        return c;
    }

    /**
    * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
    */
    function sub(uint256 a, uint256 b)
        internal
        pure
        returns (uint256)
    {
        require(b <= a, "SafeMath sub failed");
        return a - b;
    }

    /**
    * @dev Adds two numbers, throws on overflow.
    */
    function add(uint256 a, uint256 b)
        internal
        pure
        returns (uint256 c)
    {
        c = a + b;
        require(c >= a, "SafeMath add failed");
        return c;
    }

    /**
     * @dev gives square root of given x.
     */
    function sqrt(uint256 x)
        internal
        pure
        returns (uint256 y)
    {
        uint256 z = ((add(x,1)) / 2);
        y = x;
        while (z < y)
        {
            y = z;
            z = ((add((x / z),z)) / 2);
        }
    }

    /**
     * @dev gives square. multiplies x by x
     */
    function sq(uint256 x)
        internal
        pure
        returns (uint256)
    {
        return (mul(x,x));
    }

    /**
     * @dev x to the power of y
     */
    function pwr(uint256 x, uint256 y)
        internal
        pure
        returns (uint256)
    {
        if (x==0)
            return (0);
        else if (y==0)
            return (1);
        else
        {
            uint256 z = x;
            for (uint256 i=1; i < y; i++)
                z = mul(z,x);
            return (z);
        }
    }
}

given this code, when run and tested, if send 10,000 eth from wallet containing 99 eth the wallet will show that it now has 99,900n eth and when 10,000 is sent again it reverts back to 99 eth in wallet. Could this be an underflow or overflow error?


texts: Is it possible to get compiler version from the bytecode and smart contract code?

texts:
The problem is that I have deployed some contract on the etherscan.io some time ago. Now I want to verify it, so I need to specify:

Smart contract code
Compiler version
ABI encoded constructor arguments

But I have forgotten, which version of the compiler I have used. Probably it was between 0.4.13 and 0.4.16. So there's a small difference between bytecode inside the Ethereum blockchain and the bytecode, I'm getting now.

Is it possible to get the version of my compiler? Probably this data doesn't appear on the blockchain, but maybe there is a tool, which can analyze OPCODES, etc.


texts: Can set but not get when calling another contract on private chain

texts:
Here's my code, including the caller and called contract:

pragma solidity ^0.4.24;

contract Called {
    string info = "default";

    function setInfo(string _info) public {
        info = _info;
    }

    function getInfo() view public returns (string) {
        return info;
    }

}

contract Caller {

    Called called;

    constructor(address addr) public {
        called = Called(addr);
    }

    function setInfo(string _info) public {
        called.setInfo(_info);
    }

    function getInfo() view public returns (string) {
        return called.getInfo();
    }

}

There are two scenarios:

First, I deployed the contracts on my private chain and I set the gas price to be zero on all transactions. Both the setter and getter works well when I invoke them directly in the Called contract.

But when I do it through the Caller contract, the setter works fine while the getter doesn't.

When I invoked getter with keyword "view", no error occured but the result I got was a empty string(when the variable is int, then the result would be 0).
when I invoked getter without keyword "view", the error message was: Internal JSON-RPC error.

For the second scenario, I deployed them on to Ropsten Test Net and set gas price to be 1 gwei on each transaction. Everything just worked fine.

BTW, I'm using Remix online IDE and MetaMask chrome extension.

It is stated here by GViz that

  calling a contract from another contract always requires gas, even if the function is marked view.

Does it have something to do with my issue?


texts: web3js.ai (artificial intelligence?) AI functionality/capabilities in web3?

texts: I refer to the file web3js.ai in the beta release. Does the file web3js.ai refer to artificial intelligence capabilities?


texts: What's the difference between the typical ERC20 Transfer(from, to, value) and the same but with bytes, e.q.: Trasnfer(from, to, value, msg.data)?

texts:
Better question: Can I send the bytes to a function that lacks this definition?

In other words, say I have:

 event Transfer(address,address,uint256, bytes);

And then:

function transfer(msg.sender, address _to,uint _value, msg.data) {}

In msg.data I could frame the whole transaction message (who to, how much...) in just string of bytes - yet what if I don't have this and it's just the classic ERC20:

function transfer(msg.sender, address _to,uint _value) {}

Does this mean I can use web3 to simply put a string of bytes under "data"??

Example:

// pseudo string of bytes of: function + address + amount:
var send_data_as_bytes = '030300x0x0' + '0x0000000000000000000000' + 000000001';
// prepare the transaction:
'from': fromAddress,
      'gasPrice': Web3js.utils.toHex(20 * 1e9),
      'gasLimit': Web3js.utils.toHex(210000),
      'to': tokenAddress,
      'value': 0x0,
      'data': send_data_as_bytes,
      'nonce': Web3js.utils.toHex(count)


texts: Can confirmed Ethereum transactions be reversible?

texts: I need a way to ensure that transactions coming to my non-smartcontract Ethereum wallet can't be reversed. Is it enough to check that each incoming transaction has as least N confirmations just like in Bitcoin world, or I should also ensure that the "data" field ("input" in Parity API) is empty because otherwise it can be exploited in some way?


texts: How to debug "The constructor should be payable if you send value" note?

texts:
I am quite new to solidity and ethereum smart contracts, so I am trying to create a new Table contract, from an existing Room Contract, but i have been running into this problem.

Note: The constructor should be payable if you send value

Even though my Table constructor is a payable constructor.

Here is my code:

pragma solidity ^0.4.0;

contract Room {
    address[] public Tables;

    function Room() public payable {}

    function createTable(uint minimum) public payable {
        address createdTable = new Table(minimum);
        Tables.push(createdTable);
    }

    function getCreatedTables() public view returns(address[]) {
        return Tables;
    }
}

contract Table {
    struct Player {
        address player;
        uint value;
    }

    Player[] public players;
    uint public minimumBet;
    uint public maxPlayers = 2;
    mapping(address => bool) public availablePlayers;

    function Table(uint minimum) public payable {
        minimumBet = minimum;
        enterTable();
    }

    modifier restricted() {
        require(players.length < maxPlayers);
        _;
    }

    function getTotalPlayers() public view returns(uint) {
        return players.length;
    }

    function enterTable() public restricted payable {
        require(msg.value >= minimumBet);
        require(!availablePlayers[msg.sender]);

        availablePlayers[msg.sender] = true;
        Player memory newPlayer = Player({
            player: msg.sender,
            value: msg.value
        });

        players.push(newPlayer);
    }
}


texts:
https://github.com/ethereumjs/ethereumjs-wallet

I need this library with the same functions in PHP

Would u give me the link


texts:
I try to compile the following (in Solidity) ...

contract InfoFeed {
    function info() payable returns (uint ret) { return 42; }
}

contract Consumer {
  uint attribut = 0;
  InfoFeed feed;
  function setFeed(address addr) { feed = InfoFeed(addr); }
  function callFeed() { attribut = feed.info.value(10).gas(800); }
}

but what I get is an error message (in MIST's deploy contract):

Type function () returns (uint256) is not implicitly convertible to expected type uint256.
  function callFeed() { attribut = feed.info.value(10).gas(800); }
                                   ^--------------------------^

how can uint256 not be convertible to uint256, and what to do about it, please?


texts: When should a function throw and when should it do nothing?

texts:
When testing with truffle and testrpc, I'm struggling to test how things should work when a function is called and it causes a throw as the entire test stops. However, several of the functions I have that return throws could also just do nothing. Is this the better structure? Basically, which is better:

function doSomethingThrow(a1) {
    if (a1.a == 1){
      ...
    } else if (a1.b == 2) {
      ...
    } else {
      throw;
    }

or

function doSomethingDontThrow(a1) {
    if (a1.a == 1){
      ...
    } else if (a1.b == 2) {
      ...
    }


texts:
I have this code which gives JSON error in web3. I tested the connections and reading the contract and that all works. There is something wrong with the "data" key in the JSON. Somehow the addBonus function is not being understood. That is an update function.

addBonus is the correct name as follows -

function addBonus( string bonusType, uint bonusTarget,  uint bonusEndYear,
    uint bonusEndMonth, uint bonusEndDay,
    string bonusToken, uint bonusAmount, string bonusName, uint ineq ) public { ...

Has someone an example of how to write a raw txn to update a contract using web3js and nodejs?

Calling code -

    var rawTransaction = {"from":myAddress,
    "gasPrice":web3js.toHex(20* 1e9),
    "gasLimit":web3js.toHex(210000),
    "to":contractAddress,
    "value":"0x0",
   "data":contract.addBonus(bonusType, target, year, month, day, token, bonus, bonusName, ineq),
    "nonce":nounce}

The error -

  node_modules/web3/lib/web3/httpprovider.js:92
      throw errors.InvalidResponse(request.responseText);
      ^

  Error: Invalid JSON RPC response: ""


texts: I see that 20 gwei is the default gas price. A simple token exchange fee is around 0.5$ at the current price (230$). Reducing gas to 2 gwei takes more time to confirm transaction but reduce the fee. What if ETH reach 1000$ soon? Will it be possible to reduce gas under 2 gwei or is that a minimum limit? Ethereum is unsustainable if we cannot keep fees in the range of 1/1000 of fiat currencies.


texts:
Would this function cost gas in v0.4.25?
When i try run the contract on ropsten and call this function it dosent trigger any gas cost in metamask. But from what i have understood writing to memory does cost some gas anyway.So im a bit confused regarding the same.
ps: Users is a structure that contains an address and 6 usint8 values.

    function returnplayers() external view returns(address[],uint[],uint[],uint[],uint[],uint[],uint[]) {

    address[] memory addrs = new address[](count);
    uint[]   memory balls_a = new uint[](count);
    uint[]   memory balls_b = new uint[](count);
    uint[]   memory balls_c = new uint[](count);
    uint[]   memory balls_d = new uint[](count);
    uint[]   memory balls_e = new uint[](count);
    uint[]   memory balls_mega = new uint[](count);

    for (uint i = 0; i < count; i++) {
        Users memory user = users[i];
        addrs[i] = user.player;
        balls_a[i] = user.no1;
        balls_b[i] = user.no2;
        balls_c[i] = user.no3;
        balls_d[i] = user.no4;
        balls_e[i] = user.no5;
        balls_mega[i] = user.no6;
    }

    return (addrs, balls_a, balls_b, balls_c, balls_d, balls_e, balls_mega);
}


texts: how can take ownership of smart contract if dev left the project

texts: If dev left smart contract project after launch in platform is it possible to take ownership of that project?


texts: I am in the Extra Balance overview - how I get my Dao/ETH. I am using MyEtherWallet

texts:
Sorry - I guess the answer is somewhere here in the forum, but cannot dig through all forum entries. Perhaps someone knows the answer.

I paid 1.5 ETH for one DAO Token and used MyEtherWallet.
I found my Adress in the Extra Ballance overview and all is fine.
Now, how I can get my extra Balance. Is it possible with my Wallet?

Regards
Tobi


texts: Transaction reverting when it hits Require statement in payable function

texts:
So briefly, when the user clicks a submit button from UI, it needs to pass a fixed price _price to pay() function (there are options to choose a fixed price on UI ex: 0.01, 0.02, 0.03). In the function, it checks if the msg.value is equal to the amount passed from the UI. Then the sender sends that price to the contract address and it adds up to the total contract balance. When I debug it with remix, it gives an error message when it hits require(_price == msg.value)

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

contract Test {

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

    function pay(uint _price) payable returns (bool) {
        //...

        require(_price == msg.value); // Check ether sent is matching with the price
        address(this).transfer(msg.value); // Send price to the contract address
        balanceOfContract[address(this)] += msg.value; // Store price to current contract balance

        LogDeposit(msg.sender, msg.value);

        return true;
    }
}

I increased the gas limit just in case, but still giving me the error. Help is appreciated!


texts: Does every node execute the contract code for each transaction?

texts:
This question was asked on Reddit a while ago:

  When a node sends a transaction to the network and has the receiver as a contract, does every node execute the contract bytecode with the inputs to confirm the hash? Or does the first node receiving the transaction execute and create the transaction hash that's then distributed and is what's used for consensus. Basically, is the contract code executed once or many times for each transaction? I assume the it's the former if every node is running the EVM.
  — Reddit: Basic Questions About the Ethereum EVM and State Storage


texts:
Been learning about generating wallets in Ethereum and things have been smooth until the point where I turn a public key into an actual address.

Multiple sources say to use Keccak to hash the public key (sans first byte), then take the last 20 bytes of the resulting hash as the address.

The public key I'm using (generated from a tool that I hope does this correctly), is:
0x025f37d20e5b18909361e0ead7ed17c69b417bee70746c9e9c2bcb1394d921d4ae
And the resulting address is supposed to be:
0xd09D3103CcABfb769eDc3e9B01500Ca7241D470A

But none of the various implementations of Keccak (yes, even the ones that are really Keccak and not SHA3) are giving me something that resembles that address.

The hash I'm getting is 83453a8e57a0a2bb1277baea830983bd264e23140ef2cadd74b1e68c5c12f98f which means the address would be the last 20 bytes, or 0x830983bd264e23140ef2cadd74b1e68c5c12f98f

What am I doing wrong here?