texts: ERC20 Ropsten - how do I view the token balance?

texts:
I've published crowdsale contract to the Ropsten test network and it is located here: https://ropsten.etherscan.io/address/0x5b15b8f8238b9ec9e9c50e9f9bfcee6073349a96

I've struggled with ABI-encoded constructor parameters, so instead I've hardcoded the initial values directly into the code - you can see Contract Source Code Verified.

I've sent 0.01535 test ETH to the contract address (it was 15:35 my time and I wanted to keep track) and now I would like to see tokens being distributed.

I put the token address into the https://ropsten.etherscan.io/token-search and:

Sorry! We were unable to locate any valid Token Transfer Events for Contract 0x9c7214181b38c6421447b685dfceb7179574d155. If you are sure this is a contract that confirms to the ERC20 Token standard then please try again once a valid transfer has been made

Token Attributes Found:
 totalSupply = 15350000000000000000
 name = {not detected}
 symbol = {not detected}
 decimals = {not detected}

Had a quick look at ERC20 standard and what methods are required: https://theethereum.wiki/w/index.php/ERC20_Token_Standard

I based my code on https://blog.zeppelin.solutions/how-to-create-token-and-initial-coin-offering-contracts-using-truffle-openzeppelin-1b7a5dae99b6 so I would imagine these methods are implemented.

For someone reason token search does not detect ERC20 - what shall I do to make it work?

EDIT/UPDATE: A little bit of yak shaving, bike shedding here or there - I'm letting you know I'm learning here and I'm doing my best.

  If you are sure this is a contract that confirms to the ERC20 Token standard then please try again once a valid transfer has been made

I'm sure it is ERC20 token. Added it to metamask and MEW, both are showing the balance.

A friend advised me to interact with the contract and do the token transfer, that actually makes sense: "please try again once a valid transfer has been made"

Importing private key into Ethereum Wallet: How to import a plain private key into geth or Mist?

geth account import Desktop/priv.txt
WARN [09-12|02:24:53] No etherbase set and no accounts found as default
Your new account is locked with a password. Please give a password. Do not forget this password.
Passphrase:
Repeat passphrase:
Address: {426cdad20cbd33ea0bf0338c47239b9778a61fe2}

I do see the account though:

I think what I may want to do, is to deploy the contract from scratch from Ethereum Wallet, then do the token transfer, then see if it appears on Etherscan.


texts: Deploy contract on private blockchain using Geth

texts:
I am trying to deploy a smart contract on a private blockchain using Geth. I followed many "tutorials" (not sure I can call it like this considering how poor they are). Never worked.

I tried the folowing:

https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#deploy
https://ethereum.stackexchange.com/a/15437/20808

Using the second one, I have a problem, my contract instance deos not have any address, it's a bit annoying if I want to use it!

Indeed, I deploy the contract using the folowing:

> myContractInstance = myContract.new(txDeploy)
INFO [10-24|05:45:24] Submitted contract creation              fullhash=0x3548898e19f7e568e
bf9ab117abbfb9bcc8833c72c027dca6ce2af980ebde7be contract=0x615ca1B75D11ffb88C8cFC866e7e9114
B9ec8112

I then mine a few blocks to confirm transaction.

When I try to get the contract address, the address is undefined:

    myContractInstanceEnd = myContract.at(myContractInstance.address)
    {
      abi: [{

//All the stuff

}],
  address: undefined,
  transactionHash: null,

If I just want to get the address:

  myContractInstanceEnd.address
  undefined

Does someone know why and also, do you know an UP TO DATE source that tells how to do this?


texts: How to watch for 12th confirmation with web3 filters

texts: It doesn't seem possible to update the options in web3.eth.filter() dynamically, so how would one watch for a transaction involving a particular account appearing on the 12th latest block?


texts: What is the block number of the first block mined in a private blockchain network deployed on say Quorum?

texts: I am working on POCs on Azure Blockchain Service. While working on quickstarts, I observed that while deploying my 'Hello Blockchain!' smart contract, the block number of the block mined was 34136. Since I deployed a new consortium network, why was the block number so huge? I expected block number to be 1 or say 2.


texts: Issue in insertion to an array inside a struct

texts:
I have issue in the following smartcontract.

I have defined a struct which includes an string array.
And I have defined a mapping for this struct.

struct Stonedetails {

        uint stoneweight;
        string stoneimagehash;
        string stoneidbywholesaledealer;
        string[] stoneidsbycutter;

}

mapping (uint=>Stonedetails) public stonedetailsTable;

I have stored the values in struct using the following methods inside a function by passing parameters.

 stonedetailsTable[stoneid].stoneweight =stoneweight;
 stonedetailsTable[stoneid].stoneimagehash =stoneimagehash;
 stonedetailsTable[stoneid].stoneidbywholesaledealer =stoneidbywholesaledealer;

How can I store the values in string array?
Is it the way to store the values one by one?

stonedetailsTable[stoneid1].stoneidsbycutter.push(stoneidbycuttervalue);

How can I find the length of array using stoneidsbycutter.length?


texts: How to figure out password from keystore file?

texts:
I'm using this to create a private Ethereum network for some tests. It comes pre-loaded with 10 accounts, each with 20 ether. However, I can't seem to find the password for these accounts. An example keystore file is

{
   "address":"007ccffb7916f37f7aeef05e8096ecfbe55afc2f",
   "Crypto":{
      "cipher":"aes-128-ctr",
      "ciphertext":"44600de3be08153de243f0de344b9841c774a2fcd5b7f3406b9ea9a42c8be97b",
      "cipherparams":{
         "iv":"9ca680df904bc0138d2d52f9c432a797"
      },
      "kdf":"scrypt",
      "kdfparams":{
         "dklen":32,
         "n":262144,
         "p":1,
         "r":8,
         "salt":"a6524c4ef60060476f2e47dea7f5945aac8159019d3bf5275a683c1970d03c40"
      },
      "mac":"4daf73bc6da7f75beb9a8ea28896c5f1f074fb8cd54880fa9a4e34700dc0ee00"
   },
   "id":"2615dd6a-6d73-4b05-a02d-257b0fd28d3a",
   "version":3
}

but this seems to contain just encrypted data with salt (like mentioned here). If not here, and being that it is not specified in the docs, where should I look for the password? Meaning, this is designed to be a plug and play private network with Docker so the passwords should be easily accessible, I just don't know where to look.


texts: Ropsten datadir size increases significantly after 1.10.1

texts:
I am not sure if it is my problem. It occupied > 160GB now. Used to < 80GB IIRC.
Anyone facing similar issue?


texts:
I'm using Remix, Metamask, ROPSTEN and can not deploy any contract...always getting the same message...it used to work...not working any more...happens in different machines, happens with Chrome or Firefox...seems to be related to the estimation routine...

  GAS ESTIMATION FAILED

  Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
  Error: gas required exceeds allowance or always failing transaction at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/background.js:1:1723632 at chrome-

Let me know if you have a similar setting and it works...or any known issues...

Thank you !

Here's the Code:

pragma solidity ^0.4.20;
contract Ballot {

    struct Voter {
        uint weight;
        bool voted;
        uint8 vote;
        address delegate;
    }
    struct Proposal {
        uint voteCount;
    }

    address chairperson;
    mapping(address => Voter) voters;
    Proposal[] proposals;

    /// Create a new ballot with $(_numProposals) different proposals.
    function Ballot(uint8 _numProposals) public {
        chairperson = msg.sender;
        voters[chairperson].weight = 1;
        proposals.length = 3;
    }

    /// Give $(toVoter) the right to vote on this ballot.
    /// May only be called by $(chairperson).
    function giveRightToVote(address toVoter) public {
        if (msg.sender != chairperson || voters[toVoter].voted) return;
        voters[toVoter].weight = 1;
    }

    /// Delegate your vote to the voter $(to).
    function delegate(address to) public {
        Voter storage sender = voters[msg.sender]; // assigns reference
        if (sender.voted) return;
        while (voters[to].delegate != address(0) && voters[to].delegate != msg.sender)
            to = voters[to].delegate;
        if (to == msg.sender) return;
        sender.voted = true;
        sender.delegate = to;
        Voter storage delegateTo = voters[to];
        if (delegateTo.voted)
            proposals[delegateTo.vote].voteCount += sender.weight;
        else
            delegateTo.weight += sender.weight;
    }

    /// Give a single vote to proposal $(toProposal).
    function vote(uint8 toProposal) public {
        Voter storage sender = voters[msg.sender];
        if (sender.voted || toProposal >= proposals.length) return;
        sender.voted = true;
        sender.vote = toProposal;
        proposals[toProposal].voteCount += sender.weight;
    }

    function winningProposal() public constant returns (uint8 _winningProposal) {
        uint256 winningVoteCount = 0;
        for (uint8 prop = 0; prop < proposals.length; prop++)
            if (proposals[prop].voteCount > winningVoteCount) {
                winningVoteCount = proposals[prop].voteCount;
                _winningProposal = prop;
            }
    }
}

Gas Limit: 3000000
Value: 1 Ether

See if you can deploy this to ROPSTEN...


texts: We have deployed consortium ethereum block chain in azure portal. I don't have access to the azure portal except the cloud url. By using the cloud url i have wrote the nodejs code with web3 api to get the balance and unlock the account and send the transaction.I got the getBalance but When i am trying to unlock the account it's showing me error "Failed to unlock the personal_unlock account is not available or does'nt exist" and i am unable to proceed further for the transaction. What should i do?


texts: How to estimate ERC721 mint transaction?

texts:
My contract;

contract My721 is ERC721Full, ERC721Mintable, Ownable {

    constructor() ERC721Full("My721", "MY721") public {}

    function mintUniqueTokenTo (address _to, uint256 _tokenId, string  _tokenURI) public{
        super.mint(_to, _tokenId);
        super._setTokenURI(_tokenId, _tokenURI);
    }
}

I tried to run my own node script;

my721Instance.methods.mintUniqueTokenTo(...)
    .estimateGas()
    .then(function(estimate) {
        console.log("Estimated Gas Consumptions: ", estimate);
});

I got;

(node:27428) UnhandledPromiseRejectionWarning: TypeError: my721Instance.methods.mintUniqueTokenTo is not a function

Fyi, I successfully ran the transaction in truffle console. Any idea?


texts: How do I identify the right gas to set in web3 send?

texts:
This is my send code:
window.videoContract.methods
    .mint(account, 'https://ipfs.io/ipfs/QmRQC1...')
    .send({
        from: account,
        gas: 20100000
    });

If I set it too high, I get this error:
ALERT: [ethjs-query] while formatting outputs from RPC '{"value":{"code":-32603,"data":{"code":-32000,"message":"exceeds block gas limit"}}}'
If I set it too low, the transaction fails with out of gas error:
https://explorer-mumbai.maticvigil.com/tx/0x79d96c3a0d9f920d75e17d034c3c0452b8b25fc3395d5595d9b2999fa0602f45/internal-transactions


texts:
Basically, i want get the callback result of first method to get each index value in pass it to the second method to scan this value, in this case is an ethereum transaction to get the input value. The problem is the callback named "cb" isn't triggered.

code:

var tx;

web3.eth.getBlock(6339515, function(err, result){
    for(var i = 0; i <= result.transactions.length; i++){
        tx = result.transactions[i];
        getInputTransaction(tx)
        .then(function() {} )
        .catch(function(error) {
            console.log('error: \n' + err);
        });
    }
})

async function getInputTransaction(tx) {
    web3.eth.getTransaction(tx, function(err, cb){
        console.log('got here');
        let decodeInput = web3.utils.hexToAscii(cb.input);
        decodeInput = decodeInput.split("_").pop();
        if(!err){
            console.log(cb);
            console.log('\nInput decoded: ' + '\u001b[1;32m' + decodeInput + '\u001b[0m');
        }else{
            console.log('error: ' + error);
    }}
    )
}

What am i missing here?


texts:
From time to time, I will be making some 5 ~ 10 tx/s on Ethereum via RPC interface.

I have to handle the nonce manually because it cannot update fast enough. But I am facing issue below:

From time to time to RPC will fail, and I will have to reset the nonce.
Some times the RPC will fail and timeout, but the tx was processed successfully eventually. I can't reset the nonce in this case. Because if I reset, it will not be accurate anymore

In short, I don't know what shall I do when there is an error with the RPC. I don't know what to do with the nonce and don't know how to send the next transaction.


texts:
How can I bypass the full ethereum chain sync and open in testnet mode? I'm on a Mac.

The full chain sync is taking too long and keeps crashing - all I want to do is test some contract functionality in a Meteor Dapp.


texts: Can block timestamp be smaller than the time a transaction has been sent?

texts:
I have seen cases where the time that I sent my transaction (logged on local PC) is actually 'later' (by 10s of seconds) than the block.timestamp of the block that my transaction entered. I checked if computer's ntp daemon was working correctly, and everything seems fine.
So, I wonder, is this possible? If so, how?


texts: Verification system for vaccination, medicine

texts:
Project Idea, Need Guidance.
Verification system for vaccination.
Vaccination confirmation per individual, multiple times, different locations.
Can also be used for ticketing, voucher confirmation, medical prescriptions etc.
High amount of transactions, not all could be done in locations with web access, or poor connections. Availability of of-chain transactions is a priority.
Maybe anyone working with similar technical solutions or could connect me with devs in this area of expertise?


texts: Is it possible to have enum as a mapping key type?

texts:
When trying to compile the following code in browser-solidity:

pragma solidity ^0.4.4;

contract TestContract {
    enum TestEnum { ONE, TWO, THREE }
    mapping (TestEnum => uint) testMapping;
}

I get the following error:

Untitled:5:14: Error: Expected elementary type name for mapping key type
    mapping (TestEnum => uint) testMapping;

Solidity documentation does not seem to forbid using enum as mapping key type, stating that "_KeyType can be almost any type except for a mapping":

https://solidity.readthedocs.io/en/develop/types.html?highlight=mapping#mappings

How can I implement a mapping with a custom enum as the key type?

Closely related:
Is it possible to have user-defined Struct as a _KeyType in a Mapping in Solidity?
Is it possible to have a mapping with a hash as key?


texts: Tutorial to understand technical details of Oracles in Ethereum

texts:
What is Oracles?  Why is it needed? Is there any good technical blog with an example in which Oracles is explained?

From whatever I read about Oracles

  Oracle is a trusted third party API from which smart contract will fetch the data.

Purpose of the blockchain is to remove interference of third parties/brokers and let two transacting parties transact peer to peer even when they don't trust each other.

Then are Oracles introducing new broker/trusted parties in the blockchain? Isn't it contradiction with a purpose of the blockchain?


texts: Hardhat - How to interact with a deployed contract?

texts:
I can deploy a contract using ethers and Hardhat with the following:
const myContract = await hre.ethers.getContractFactory("SomeContract");
const deployedContract = await myContract.deploy();

I can even interact with the methods from that deployed contract if I use that deployedContract variable. However what if the contract has already been deployed and I want to interact with it? From what I've read, I need to create an instance of that contract. And I've tried to do that like this:
const provider = new ethers.providers.JsonRpcProvider();
const fs = require('fs');
const abi = JSON.parse(fs.readFileSync('./abi/SomeContract.json', 'utf8'));
const contractInstance = new ethers.Contract('contract address goes here', abi, provider);

I believe an instance is created on that contractInstance variable, but if I try to call methods on that instance in the console or from a script, I get a WARNING: Calling an account which is not a contract error.
Maybe I'm misunderstanding something about how contract instances are supposed to work?


texts: Truffle Compile Error (Invalid input source specified, Compilation Failed)

texts:
When I run truffle compile, it throws the following error:
Invalid input source specified.


texts: Given an ETH wallet address - Fetch all ERC721 tokens currently owned

texts: I would like to create an application that - given a specific wallet address - fetches and displays all NFTs/ERC721 tokens currently owned. How can this be accomplished? Are there any examples available that are performing something similar?


texts: Can anyone give me a working DELEGATECALL example?

texts:
I tried many variants of DELEGATECALL, but not one of them gave me the desired result.
When used in assembly: = delegatecall (), I also don't get the result.
I also used different versions of Solidity (^ 0.4.13 - ^ 0.5.0). That didn't help either.

Is there a working example of DELEGATECALL?
And does DELEGATECALL work today?

**

contract A{
uint256 public N;

     function C(uint256 _c) public{
         N = _c;
     }
}

**

contract B{

    function DelCall(address _contractA, uint256 _c) public{
         _contractA.delegatecall(bytes4(keccak256("C(uint256)")), _c);
         // DELEGATECALL - not works
    }
    function DelCal_B(address _contractA, bytes _b){
         _contractA.delegatecall(_b);
         // DELEGATECALL - not works
    }

    function Call(address _contractA, uint256 _c){
         _contractA.call(bytes4(keccak256("C(uint256)")), _c);
         // CALL - works
    }
    function Cal_B(address _contractA, bytes _b){
         _contractA.call(_b);
         // CALL - works
    }
}


texts: I'm interested in learning the essence and background of this community and the concepts it is built upon.  Beyond who founded Ethereum, who is responsible for coining terms such as block-chain?  Why did they coin the term that way, and what were their inspirations?  I'm looking for bulletnote-style answers more than a discussion.


texts:
I'm using nanopool to mine ethereum classic, but Nanopool tells me that my device is offline because it doesn't get any shares

This is my account :

https://etc.nanopool.org/account/0x710c74cb31e56307be0cb68cd345eb90fde5e0a3

What is the problem, and how can I get shares quickly ?

OS: windows
GPU: MSI RX 580 Armor 8GB OC
Software: Claymore
Internet speed: 80mbps download - 5mbps upload


texts: Contract deployment works but method calls fail

texts:
I think it has something to do with my start line

geth --datadir ~/final --networkid 98763476 --rpcapi "web3,eth,personal,db,net" --rpcport 888
8 --rpcaddr "ip" --rpccorsdomain "*" --rpc --allow-insecure-unlock

I've checked the gas required so that's not the problem
I can deploy contracts, but can't call any methods I either get gas required or always failing transaction or returned values aren't valid did it run out of gas

pragma solidity ^0.5.0;
contract Language {
    function addNumberLanguage(string memory _language) public;
}
contract Text {
    address owner;
    Language language;
    mapping(string => mapping(string => string)) public texts;
    constructor(address _language) public {
        owner = msg.sender;
        language = Language(_language);
    }
    function addText(string memory _language, string memory code, string memory txt) public {
        require(owner == msg.sender, "Unauthorized");
        texts[_language][code] = txt;
    }
    function addLanguage(string memory _language) public {
        require(owner == msg.sender, "Unauthorized");
        language.addNumberLanguage(_language);
    }
}

const addText = (language, code, txt, cb) => {
    contract.methods.addText(language, code, txt).estimateGas({
        from: account
    }).then(gas => {
        console.log(gas);
        contract.methods.addText(language, code, txt).send({
            from: account,
            gas: gas
        }).then(res => cb(true, null)).catch(err => cb(false, err));}).catch(err => cb(false, err))
}

genesis.json

{
    "config": {
        "chainId": 987,
        "homesteadBlock": 0,
        "eip150Block": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },
    "difficulty": "0x400",
    "gasLimit": "0x8000000",
    "alloc": {
        "0x41A3BEBcA1475926A7248aeb6b5CA7C43241d473": {
                "balance": "111111111111111111111111111111"
                }
        }
}}


texts: How do I check the Ethereum balance and unique transactions count of a Smart Contract over a period of time?

texts:
Basically I want to be able to track smart contracts balance and unique transactions over a period of time such as , last 24hours, last hour and so.

What would be the best approach into doing this? How should I store the data I get in order to create my API, SQL/NoSQL db?

Thank you in advance!


texts:
Does solidity supports power operations like 2^3 = 8 or should I perform multiple multiplications?
Should i include a math library? I don't find anything in the official doc. Thanks


texts: What is the most secure way to store tokens, if you are to roll out an ICO or similar? I know there are many ways, i.e. sharding the private key but what is the best practice right now? If I assign the total supply of a token to the msg.sender, what is the best way for me to ensure that my private key is protected.


texts: What is the best way to push transactions with hight rate (>1000 per second)?

texts: In order to test the throughput of a private Ethereum, I need to send multiple transactions as fast as possible. Can web3js ensures fast delivery of transactions? or there is an other more efficient way?


texts:
I have a construct like this:

var s = SomeStruct(a, b);
map1[addr1] = s;
map2[addr2] = s;

... and want both maps to point to the same data.
Now if I afterwards do

map1[addr1].field1 = x;

... then map2[addr2].field1 still returns the initial value instead of x - which suggests that 2 copies of the data were created when initially assigning to the maps.

Question: How can I avoid this duplication?


texts:
I am a japanese student.
I am studying ethereum.

pragma solidity ^ 0.4.18;

contract Owned {
    address public owner; // contract owner

    // / modifier for access check
    modifier onlyOwner () {
        require (msg.sender == owner);
        _;
    }

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

    /// Change owner
    function changeOwner (address _newOwner) public onlyOwner {
        owner = _newOwner;
    }
}

contract Mortal is Owned {
        // / Function to destroy contract
    function kill () public onlyOwner {
        selfdestruct (owner);
    }
}

contract MortalSample is Mortal {
    string public someState;

    function () public payable {
    }

    function MotalSample () public {
        owned;

        someState = "initial";
    }
}

I made it as described above, but owner's name is 0x00 ... and someState is not even displayed. I am in trouble because I do not know what is wrong.

I would appreciate it if someone tells me.


texts: Ganache-cli EADDRINUSE 127.0.0.1:8545 error?

texts:
when i start ganache-cli with command, it gives this error :

❯ ganache-cli
Ganache CLI v6.4.1 (ganache-core: 2.5.3)
Error: listen EADDRINUSE 127.0.0.1:8545
    at Server.setupListenHandle [as _listen2] (net.js:1360:14)
    at listenInCluster (net.js:1401:12)
    at doListen (net.js:1510:7)
    at _combinedTickCallback (internal/process/next_tick.js:142:11)
    at process._tickCallback (internal/process/next_tick.js:181:9)
    at Function.Module.runMain (module.js:696:11)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3

so i checked which process am i using on port 8545, but it seemed like nothing.

❯ lsof -i :8545

~
❯

also, if i run ganache-cli -p 7545, i works on 127.0.0.1:7545 without any problems.

does anyone have any idea if this is a bug or i did something wrong starting ganache?


texts: EIP712-- Sign/Recovery using ethereumJS/Solidity

texts:
I've tried to mirror the example as shown: https://github.com/ethereum/EIPs/tree/master/assets/eip-712

However after much attempt at troubleshooting I have been unable to return the correct address using ecrecover in my solidity code.

My Javascript code: https://gist.github.com/JTraversa/a88edab6f7d9457317928483e78d8681

My Solidity code: https://gist.github.com/JTraversa/cdb23d98755738ff460c3c5805647b34

At this point, I believe the issue is likely to do with the data hashing in Solidity, though for the life of me I cant identify what.

If not that, perhaps a mismatch of the data types between the solidity/js hashing. i.e. hashed as a string in javascript but bytes in solidity?

I can identify more specific blocks of code, however given the snippets are relatively short and I am unsure where the issue lays, I'm assuming the full snippets are more useful.

Ive been at this for quite awhile so any help is very appreciated. I am more than happy to provide a generous tip if anyone can help!


texts: Geth console output: "broke chain ordering" and "potential rewrite attack"

texts:
I sometimes run geth with this command: 'geth -rpc' It usually prints a bunch of uninteresting status info, but this morning it started printing this:

I0916 07:49:32.384544 eth/handler.go:295] Peer c797a594f5d7db60 [eth/63]: timed out DAO fork-check, dropping
I0916 07:49:39.880931 eth/downloader/downloader.go:1087] Peer 562796b19d43d79d [hs 0.00/s,
    bs 0.00/s, rs 0.00/s, ss 0.00/s, miss    0, rtt 20s]: head header set
    (item 0) broke chain ordering: requested 1919809, got 2269765
I0916 07:49:50.690184 eth/handler.go:295] Peer 7603e0ec309a49e3 [eth/63]: timed out DAO fork-check, dropping
I0916 07:51:23.101820 eth/downloader/downloader.go:1195] Peer 627bdf5515ce98ce [hs 0.00/s,
    bs 0.00/s, rs 0.00/s, ss 0.00/s, miss    0, rtt 20s]: potential rewrite attack:
    #1963453 [00000000…] <= #1963453 limit
I0916 07:51:34.064429 eth/handler.go:295] Peer 00af8248d908e266 [eth/63]: timed out DAO fork-check, dropping
I0916 07:51:44.748102 eth/handler.go:295] Peer 494b9fe56dfad18d [eth/63]: timed out DAO fork-check, dropping

I'm not worried about the "DAO fork" message (they happen all the time), but what does "broke chain ordering" and "potential rewrite attack" mean?

Sounds bad.


texts: Solidity - Interface & ERC-165 by OpenZeppelin

texts:
I am struggling to understand this below implementation of the ERC-165 standard by OpenZeppelin. This is by default imported in the ERC721 token smart contract of OZ. I do get the aim of the ERC-165 standard but not this code snippet.
And what does "type(IERC721)" function is actually doing ?
Thanks a lot in advance for your help.
 function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return interfaceId == type(IERC721).interfaceId
            || interfaceId == type(IERC721Metadata).interfaceId
            || super.supportsInterface(interfaceId);


texts: What is meant by a "non one time use EOA"

texts: Could someone explain what is meant by a non-one-time-use externally owned account and what is used (or misused) for?


texts: SushiSwap Fork reverting at createPair()

texts:
I have forked sushiswap recently from the repo. I am getting the following error when calling createPair() from UniswapV2Factory.sol during my deployment, the code has not been touched and I have no idea where I am going wrong.
The error:
Error: Returned error: VM Exception while processing transaction: revert
The deployment:

// Uniswap
const Factory = artifacts.require('Uniswapv2/UniswapV2Factory.sol');

// WETH
const WETH = artifacts.require('WETH.sol');

// Testing
const MockERC20 = artifacts.require('MockERC20.sol');

module.exports = async function(deployer, network, accounts) {
    const [admin, _] = accounts;

    // Test Tokens
    const tokenA = await MockERC20.new('TokenA', 'TKA', web3.utils.toWei('100000'));
    const tokenB = await MockERC20.new('TokenB', 'TKB', web3.utils.toWei('100000'));

    // Uniswap factory
    await deployer.deploy(Factory, admin);
    const factory = await Factory.deployed();

    await factory.createPair(tokenA.address, tokenB.address);

};

CreatePair function:
function createPair(address tokenA, address tokenB) external override returns (address pair) {
        require(tokenA != tokenB, 'UniswapV2: IDENTICAL_ADDRESSES');
        (address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
        require(token0 != address(0), 'UniswapV2: ZERO_ADDRESS');
        require(getPair[token0][token1] == address(0), 'UniswapV2: PAIR_EXISTS'); // single check is sufficient
        bytes memory bytecode = type(UniswapV2Pair).creationCode;
        bytes32 salt = keccak256(abi.encodePacked(token0, token1));
        assembly {
            pair := create2(0, add(bytecode, 32), mload(bytecode), salt)
        }
        UniswapV2Pair(pair).initialize(token0, token1); //<-- this is causing the error
        getPair[token0][token1] = pair;
        getPair[token1][token0] = pair; // populate mapping in the reverse direction
        allPairs.push(pair);
        emit PairCreated(token0, token1, pair, allPairs.length);
    }

I have deduced that the error is happening here UniswapV2Pair(pair).initialize(token0, token1); but as to why I have no idea.
Any insights would be much appreciated!
James


texts: How to create a new struct instance without populating all the properties

texts:
I have this struct with many properties. Due to limitations of the solidity stack and practicality of the app, I cannot pass in all the values to the properties when creating a new instance of the struct. Consider the code below:

struct PersonalInfo {
    uint256 tsc;
    bytes32 surname;
    bytes32 firstName;
    bytes32 lastName;
    bytes32 birthdate;
    bytes32 gender;
    uint256 nationalID;
    bytes32 life;
    uint phone;
    bytes32 postalAddress;
    uint currentSchool;
    bytes32 reportingDate;
    bytes32 subject1;
    bytes32 subject2;
    string path
    bytes32 email;
    uint teacherIndex;
}

I want some properties like string path to be added later. This is because in the registration form, I don't have all these properties as form fields that a user fills. However, when creating a new instance of the struct as shown below, I get an error.

      //store teacher details
function storeTeacherDetails(
    uint256 tsc,
    bytes32 surname,
    bytes32 firstName,
    bytes32 lastName,
    bytes32 birthdate,
    bytes32 gender,
    uint256 nationalID,
    bytes32 life,
    uint phone,
    bytes32 postalAddress,
    uint currentSchool,
    bytes32 reportingDate,
    bytes32 subject1,
    bytes32 subject2,
    bytes32 email
) public {
      teachers[teacherRecords.length]=PersonalInfo({tsc:tsc,
      surname:surname,
      firstName:firstName,
      lastName:lastName,
      birthdate:birthdate,
      gender:gender,
      nationalID:nationalID,
      life:life,
      phone:phone,
      postalAddress:postalAddress,
      currentSchool:currentSchool,
      reportingDate:reportingDate,
      subject1:subject1,
      subject2:subject2,
      email:email});
}

After compiling, I get the following error

TypeError: Wrong argument count for struct constructor: 14 arguments given but expected 17.

As a side note, I read somewhere that the stack only goes 7 steps deep. Passing all these parameters at once is a bad idea. I need to group these properties and have getters and setters to each group, but I can only get/set a property of a struct instance that exists. The question therefore is, how do I create an struct instance with say default values for each data type, the set/get then properties later?


texts:
I'm trying to put together a simple application using Truffle, Metamask and ASP.NET.

I've created a bunch of test accounts in Metamask, I then start testrpc explicitly specifying a couple of those accounts and their initial balance, like so:

testrpc --account="0xa3........18, 1000000000000000000000" --account="0x80.......08, 1000000000000000000000"

In the testrpc log I can see these are started correctly:

Available Accounts
==================
(0) 0x27.....d5
(1) 0x1b.....24

I then deploy my contract, log in to Metamask and then spin up my web application.

In my js I can see that it's retrieving the web3 instance from metamask:

            if (typeof web3 !== 'undefined') { // This evaluates to true
                App.web3Provider = web3.currentProvider;
                web3 = new Web3(web3.currentProvider);
                console.log("Already have a web3 instance");
            } else {

I try to get the list of accounts like this:

            App.contracts.JmTest.deployed().then(function(instance) {

                web3.eth.getAccounts(function (error, accounts) {
                    if (error) {
                        console.log(error);
                    }

                    console.dir(accounts);

However it only shows one of the two accounts that I started testrpc with...

Array(1)
0: "0x27.....d5"

It turns out that this is the currently selected account in Metamask. If I start testrpc without specifying any accounts and restart Chrome, the same thing happens - again I only get the the currently selected account in Metamask.

What am I missing?


texts: Does ownership of a large quantity of ETH set you up for the impending smart contract economy better than the have-nots?

texts:
We can agree that ETH is not held by people to purchase goods in the same way that Bitcoin does in practice by today's standards,
so instead, can the utility of hording ETH be explained away with the claim that, with economies moving towards all-out digitalized smart contracts for the transaction of any underlying real asset, those holding large amounts of ETH now, will be better positioned in the future to avail of and be at a functionally  higher advantage in that new economy than those who decided to not collect ETH during its growth, having dismissed it in our present day for its potential as the basis of that impending new economy?
How credible is this argument for collecting ETH, given that, when that new economy comes around, those who never held ETH could simply convert their wealth whenever the time comes that smart contracts do become the norm, despite them having foregone the growth of having held it during its development (our present day)? What I mean is that, assuming the new smart contract economy will all be based on ETH, then holding ETH is necessary to participate in that new economy


texts: so this is probebly a wierd one. but my father recently passed away due to cancer. and well he has this ethereum wallet with i think 21 eth or something like that. which i am now trying to help my mother get access to. how do i do? he was useing Bit-trading online. and i got the wallets code. but we dont understand who it works nor what to do.  thank you for any tips or help that you have.


texts: Unable to add new struct item into mapping or array

texts:
trying to do a sample based on struct, storing a list of struct as a mapping.
but when i add an item and trying to retrieve i cannot find that item in the mapping

below is my contract

contract ItemListContract {
    struct  item
    {
      bytes iname;
      uint16 itemid;
      bytes icode;
      uint ivalue;
    }
    uint itemcount;
    mapping(bytes => item) itemlist;
    item[] itemarray;
    function ItemListContract()
    {
       log0('hi');
    }
    function AddItem(bytes name, uint16 iid, bytes code, uint val)
    {
       var itemnew = item(name, iid ,code, val);
       log0(itemnew);
       itemlist[code] = itemnew;
       itemarray.push(itemnew);
       itemcount++;
    }
    function countitemlist() returns (uint count)
    {
      return itemcount;
    }

    function removeitem(bytes code)
    {
    delete itemlist[code];
    itemcount--;
    }
    function getitem(bytes code) returns (bytes iname, uint val)
    {
      return (itemlist[code].iname,itemlist[code].ivalue);
    }
}

I tried to add item by using the below statements

var listarrayinterface =[{"constant":false,"inputs":[{"name":"name","type":"bytes"},{"name":"iid","type":"uint16"},{"name":"code","type":"bytes"},{"name":"val","type":"uint256"}],"name":"AddItem","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"code","type":"bytes"}],"name":"getitem","outputs":[{"name":"iname","type":"bytes"},{"name":"val","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"countitemlist","outputs":[{"name":"count","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"code","type":"bytes"}],"name":"removeitem","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"countitemarray","outputs":[{"name":"count","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"code","type":"bytes"}],"name":"getitemfromarray","outputs":[{"name":"iname","type":"bytes"},{"name":"val","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"}];
var listarratcontract = eth.contract(listarrayinterface).at("0x62fxxx")
listarratcontract.AddItem.call({data:{name:"item2",iid:2,code:"i2",val:2}})

after calling the contract with the above data i got [] as resoponse

Now I tried to query the saved data by

listarratcontract.countitemlist.call()
0

got response as 0.

when i called using

listarratcontract.getitem.call("i2")
["0xo",0]

I cant get the saved data or dont even know if the data is saved or not?

can any one point out what the issue might be?


texts: Most expensive solution for miners to manipulate PRNG (Pseudo Random Number Generation)

texts:
From this article I understand that randomness can only be secured by

External oracles
Signidice
Commit–reveal approach

However, in the case that I am okay to have a pseudo random number generator which is manipulatable by miners. What would be the best approach to still "secure" it, in terms of make it most expensive for a malicious user to manipulate?
Are there any other factors I can use except:
block.coinbase represents the address of the miner who mined the current block.
block.difficulty is a relative measure of how difficult it was to find the block.
block.gaslimit restricts maximum gas consumption for transactions within the block.
block.number is the height of current block.
block.timestamp is when the block was mined.
block.blockhash(block.number), which is the blockhash of the current block.
block.blockhash(block.number - 1), which is the blockhash of the last block.
block.blockhash() of a block that is at least 256 blocks older than the current one.


texts:
I'm currently writing my first smart contract and I'm trying to figure out how to inject gas into the contract, of course, if it's possible.

I'm not sure If I got it correctly. With every transaction client pays the fee, in gas, and this gas will be used to execute called smart contract function.

In brief, I deploy the contract do I need to provide gas to it? Can I somehow force clients to do that?
By the way, this.balance of contract is used as gas storage?

Cheers!


texts: Oraclize : Calling more than one API independently

texts:
There are 2 API 's which has to be called in different time delays recursively.
For example : API_1 = 20 mins delay and API_2 = 24 hr delay.

How can we call the above 2 API's independently based on their own delays using same oraclize instance?

Platform : Privatenet


texts: Check all failed transactions in last 100 blocks

texts:
How do I get all the failed transactions in last 100 blocks using etherscan or some other service? Also the reason for failure and gas involved in the transaction
Checked few similar questions that were asked earlier however it's not mentioned in the answers:
Where can I find failed transactions?
Failed transactions on Etherscan
How to get transaction failed reason with transaction hash with web3?
How can I determine which transactions have failed using a web3.js call


texts:
Is there a list of top contracts on the Ethereum blockchain ordered by the number of transactions that have occurred?

I am looking for a list of popular Ethereum contracts and I am guessing that using the amount of transactions is a good way of determining popularity.


texts: HD wallet public to public key derivation and non-hardened keys

texts:
This question is about hierarchical deterministic wallets and the bip32 standard which, as I understand it, allows you to deterministically derive child private/public key pairs from a master seed phrase or master private/public key pair.

My question is about derivation from parent public key to child public key only, based on reading a bit on the bip32 standard, my understanding is that it's possible only for "non-hardened keys".

https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#Public_parent_key_rarr_public_child_key

Would it be possible (and safe) to reveal two public keys, one which corresponds to your parent address, and the other, one of the child addresses derived via the standard, and let an outsider prove or verify that the child address belongs to you (the owner of the master seed account)?

The use case would be to allow you to send a signed message from the child account, and let a verifier prove that the signed message comes from an account which you own (or in other words, is a child of the public key corresponding to your master seed phrase). You should only be revealing public keys to prove the relationship.

I am envisioning that the verifier would use ecrecover() to get the child address and could then (potentially) prove it lies within the deterministic tree for a parent, but not sure if this is really possible.


texts: How to fork Ethereum(go implementation) to make a new chain?

texts: I want to fork Ethereum(go implementation) to make another new public chain which should start again from the block zero but keeping all other parameters same as in main chain. Please guide me with all the steps to do the same.


texts: How to handle transferring ERC20 tokens (such as USDT) with delegation to pay the gas fees on behalf of users?

texts:
I am working on creating wallets and generating addresses to be provided to a number of users. I am wondering how can I enable them to transfer their ERC20 tokens(such as USDT) without having any Eth in their addresses and pay the associated gas fees through a single delegated account on their behalf.
I have read through Gas Station Network (GSN) docs, and so far my understanding is that we have to write a smart a contract with enabling a feature like this on that particular contract to have this ability. However, I'd like to now how can I interact with the current existing contracts on the network to perform the above explained transactions.


texts: Function to check string is only formed by lowercase letters

texts:
I have a string and I want to pass a test on it .. if it is formed by lowercase letters or not .
how to do that please ?


texts: Parity connecting on random outbound ports to IPs and being blocked by Malware Bytes

texts: I keep getting alerts from Malware bytes that parity is trying to establish outbound connections on random ports to various IPs and these connections are being blocked by Malware bytes. What are these?


texts: Error while passing bytes20 to contract using ionic

texts:
While I am trying to run a dapp in ionic using angular, not able to pass bytes20 values to ethereum smart contract. Below showing code and corresponding error:
app.js
smartcontract.deployed().then(function(instance){
    instance.save(usid,{from :account,gas:400000});
})

SmartContract.sol
bytes20 arr =[];
function save(bytes20 usid)public {
    arr.push(usid);
}

Error comes :
Error: invalid bytes20 value (arg="usid", coderType="bytes20", value="U345546")
at Object.throwError (errors.js:68)
at CoderFixedBytes.encode (abi-coder.js:433)
at abi-coder.js:605
at Array.forEach (<anonymous>)
at pack (abi-coder.js:604)
at CoderTuple.encode (abi-coder.js:764)
at AbiCoder.encode (abi-coder.js:897)
at ABICoder.encodeParameters (index.js:96)
at index.js:426
at Array.map (<anonymous>)

Environment:
OS      : Ubuntu 18.04
Ionic   : 4
Cordova : 9
truffle : 4.1.5

Help will be appreciated.


texts: Why my smart contract's function always return 0?

texts:
I'm new on Ethereum.
I'm trying to deploy my first smart contract in my private blockchain but my function always returns 0.
I wrote the simple Smart Contract:

pragma solidity^0.5.0;

contract helloNumber {
    int256 internal thisNumber;
    constructor() public {
        thisNumber = 4;
    }

   function showNumber() external pure returns (int256) {
        return 4;
   }
}

I generated Abi and BIN with solc

 solcjs --bin helloNumber.sol
 solcjs --bin helloNumber.sol

result Bin

  60806040523480156100115760006000fd5b505b600460006000508190909055505b610026565b6090806100346000396000f3fe608060405234801560105760006000fd5b5060043610602c5760003560e01c806376dad22314603257602c565b60006000fd5b6038604e565b6040518082815260200191505060405180910390f35b6000600490506058565b9056fea265627a7a7231582090f812ea4d2db2a047f1e42576b9cd85f3c0bef7e9392797864143a00ce269c664736f6c634300050b0032

result ABI:

  [{"constant":true,"inputs":[],"name":"showNumber","outputs":[{"internalType":"int256","name":"","type":"int256"}],"payable":false,"stateMutability":"pure","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]

in my shell conneted to my private blockchain:

var contract = eth.contract(ABI)
var bytecode = '0xBIN'
var deploy = {from:eth.coinbase, data:bytecode, gas: 2000000}
var object= contract .new(deploy)

object.address //returns the hashcode of smart contract on private blockchain.

object.showNumber() **//returns always 0.**

Thanks a lot in advance for your help and sorry if it's a silly question but I'new in Ethereum.
what am I doing wrong?


texts: Is there a way to write a function in solidity to transfer all ERC20 tokens and all ETH?

texts:
If someone sends tokens and eth to a contact, is there anyway to create a function that will transfer any and all tokens or eth to owner address?

function sendEverything()
public
{
   owner.transfer(this.balance);
   owner.transfer(this.allthetokens);
}

In other words is there a generalized way to send any and all erc20 tokens, for instance even if the erc20 contract was created after my contract?


texts: What is the difference from oracles and smart oracles?

texts:
From my understanding is that oracles provide external world data into smart contracts. Say if the weather is sunny today, a smart contract would have no idea about it. It would need to query another smart contract that provides this data, which that smart contract gets it from the 3rd party. Is this correct?

And I'm assuming a "smart oracle" is the same thing as an oracle, but the oracle runs the smart contract. Isn't that just the same as someone running a centralized service?


texts: Is it possible to play an audio alert inside of geth or make a pop up alert? I know you can make a system beep with console.log(“\007”) but I want something a little less generic because this is the same sound my computer makes when I press the down arrow on terminal for instance.


texts:
I am running a contract on a private network in geth, and using web3js. I have the following error when I run a transaction:

  web3.min.js:1 Uncaught (in promise) Error: Returned error: gas required exceeds allowance (89459648255865) or always failing transaction

Here is my contract in solidity:

contract Voting {
  /* mapping field below is equivalent to an associative array or hash.
  The key of the mapping is candidate name stored as type bytes32 and value is
  an unsigned integer to store the vote count
  */

  mapping (bytes32 => uint256) public votesReceived;

  /* Solidity doesn't let you pass in an array of strings in the constructor (yet).
  We will use an array of bytes32 instead to store the list of candidates
  */

  bytes32[] public candidateList;

  /* This is the constructor which will be called once when you
  deploy the contract to the blockchain. When we deploy the contract,
  we will pass an array of candidates who will be contesting in the election
  */
  constructor(bytes32[] memory candidateNames) public {
    candidateList = candidateNames;
  }

  // This function returns the total votes a candidate has received so far
  function totalVotesFor(bytes32 candidate) view public returns (uint256) {
    require(validCandidate(candidate));
    return votesReceived[candidate];
  }

  // This function increments the vote count for the specified candidate. This
  // is equivalent to casting a vote
  function voteForCandidate(bytes32 candidate) public {
    require(validCandidate(candidate));
    votesReceived[candidate] += 1;
  }

  function validCandidate(bytes32 candidate) view public returns (bool) {
    for(uint i = 0; i < candidateList.length; i++) {
      if (candidateList[i] == candidate) {
        return true;
      }
    }
    return false;
  }
}

And my index.js that I call from a index.html file to use it:

web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"))
var account;
web3.eth.getAccounts().then((f) => {
 account = f[0];
})

abi = JSON.parse('[{"constant":true,"inputs":[{"name":"candidate","type":"bytes32"}],"name":"totalVotesFor","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"candidate","type":"bytes32"}],"name":"validCandidate","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"votesReceived","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"candidateList","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"candidate","type":"bytes32"}],"name":"voteForCandidate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"candidateNames","type":"bytes32[]"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]')

contract = new web3.eth.Contract(abi);
contract.options.address = "0x71789831d83d4C8325b324eA9B5fFB27525480b5";
// update this contract address with your contract address

candidates = {"Rama": "candidate-1", "Nick": "candidate-2", "Jose": "candidate-3"}

function voteForCandidate(candidate) {
 candidateName = $("#candidate").val();
 console.log(candidateName);

 contract.methods.voteForCandidate(web3.utils.asciiToHex(candidateName)).send({from: account}).then((f) => {
  let div_id = candidates[candidateName];
  contract.methods.totalVotesFor(web3.utils.asciiToHex(candidateName)).call().then((f) => {
   $("#" + div_id).html(f);
  })
 })
}

$(document).ready(function() {
 candidateNames = Object.keys(candidates);

 for(var i=0; i<candidateNames.length; i++) {
 let name = candidateNames[i];

 contract.methods.totalVotesFor(web3.utils.asciiToHex(name)).call().then((f) => {
  $("#" + candidates[name]).html(f);
 })
 }
});

Can somebody help me please ? I am pretty new to this. Thank you


texts: How miners know about forks? (Theoretical question)

texts:
Let's say Alice wants to send a transaction tx to the blockchain and the transaction is added to a block that belongs in a fork. Then after k blocks when the network reaches consensus this tx does not belong in the blockchain.

How do miners know that this tx is still pending?

Does Alice get a failed tx message?


texts: Could not withdraw tokens after crowd sale

texts:
I'm trying to implement smart contract for crowd sale and faced following problem.

Firstly, I created test token here  on Ethereum- using examples from OpenZeppelin framework and test CrowdSale contract using example from ethereum.org/crowdsale, source code follows. Then in Rinkeby test network:

Deployed token contract
Deployed token sale contract with target equals 1 ether, duration 10 minutes with link to my test token as reward token
From two test accounts transfered 0.4 and 0.6 ether to token sale contract
From main account send 500 tokens to crowd sale account
From contract creator account after crowdsale withdrawed using function safeWithdrawal 0.6 + 0.4 = 1 ether
From test two account tried to withdraw tokens but get error as on screenshot - "It seems this transaction will fail. If you submit it, it may consume all the gas you provide".

Could anybody help me to find to fix it?

P.S.: Here is source code of crowd sale contract:

pragma solidity ^0.4.2;

contract token { function transfer(address, uint256){  } }

contract DVFooCrowdsale5 {
    address public beneficiary;
    uint public fundingGoal;
    uint public amountRaised;
    uint public deadline;
    // uint public price;
    uint tokensForSale;
    token public tokenReward;
    mapping(address => uint256) public balanceOf;
    bool fundingGoalReached = false;
    event GoalReached(address beneficiary, uint amountRaised);
    event FundTransfer(address backer, uint amount, bool isContribution);
    bool crowdsaleClosed = false;

    /* data structure to hold information about campaign contributors */

    /*  at initialization, setup the owner */
    function DVFooCrowdsale5(
        address ifSuccessfulSendTo,
        uint fundingGoalInEthers,
        uint durationInMinutes,
        // uint etherCostOfEachToken,
        uint tokensForSaleCount,
        token addressOfTokenUsedAsReward
    ) {
        beneficiary = ifSuccessfulSendTo;
        fundingGoal = fundingGoalInEthers * 1 ether;
        deadline = now + durationInMinutes * 1 minutes;
        // price = etherCostOfEachToken * 1 ether;
        tokensForSale = tokensForSaleCount;
        tokenReward = token(addressOfTokenUsedAsReward);
    }

    /* The function without name is the default function that is called whenever anyone sends funds to a contract */
    function () payable {
        assert(!crowdsaleClosed);
        uint amount = msg.value;
        balanceOf[msg.sender] += amount;
        amountRaised += amount;
        //tokenReward.transfer(msg.sender, amount / price);
        FundTransfer(msg.sender, amount, true);
    }

    modifier afterDeadline() { if (now >= deadline) _; }

    /* checks if the goal or time limit has been reached and ends the campaign */
    function checkGoalReached() afterDeadline {
        if (amountRaised >= fundingGoal){
            fundingGoalReached = true;
            GoalReached(beneficiary, amountRaised);
        }
        crowdsaleClosed = true;
    }

    function safeWithdrawal() afterDeadline {
        uint256 amount;
        if (!fundingGoalReached) {
            amount = balanceOf[msg.sender];
            balanceOf[msg.sender] = 0;
            if (amount > 0) {
                if (msg.sender.send(amount)) {
                    FundTransfer(msg.sender, amount, false);
                } else {
                    balanceOf[msg.sender] = amount;
                }
            }
        }

        if (fundingGoalReached && beneficiary == msg.sender) {
            if (beneficiary.send(amountRaised)) {
                FundTransfer(beneficiary, amountRaised, false);
            } else {
                //If we fail to send the funds to beneficiary, unlock funders balance
                fundingGoalReached = false;
            }
        }
        else if (fundingGoalReached)
        {
            amount = balanceOf[msg.sender];
            balanceOf[msg.sender] = 0;
            uint256 toSend = 1 ether * amount / amountRaised * tokensForSale;
            tokenReward.transfer(msg.sender, toSend);
        }
    }
}


texts: How to get incoming transaction list in ethereum

texts:
We want to get all incoming transaction list of our contract with receiver details.
We want to catch all new incoming transactions in ethereum


texts: How to check transactions of an address that spent ether to a contract?

texts:
Am not sure if the question was already asked somewhere, I tried searching but couldn't get it.

This is what I have done so far.

Created and deployed Token Contract
Created and deployed CrowdSale Contract

Now, how do I list out the transactions sent by an address (person) to the crowdsale Contract to buy the token. I checked the codes to know the number of tokens bought by the address, but I also want to show the number of ethers he sent at various phases of the crowdsale. I know there is API endpoint to pull out the transactions of an address, but here I want to get the transaction done only with the CrowdSale Contract.

Hope I was able to explain the need. Any help is appreciated.


texts: NodeJS+web3 - Reading from a contract works, how about writing to a contract?

texts:
In Mist you can call functions of contracts in two ways:

On the left panel, to call functions that read from a contract (the result is immediate).
On the right panel, to call functions that write into a contract (for this a new transaction is made, so it asks you to unlock the account, and some gas is spent).

I want to know how to do the equivalent with nodejs' web3.

In the first case, I already succeeded, with something like this, e.g. when the function I want to call is called foo(), receives an account(string) and returns a uint256:

var Web3 = require('./node_modules/web3/lib/web3');
var fs = require('fs');

// dont override global variable
if (typeof window !== 'undefined' && typeof window.Web3 === 'undefined') {
   window.Web3 = Web3;
}

module.exports = Web3;

var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'));

var theAddressWhereMyContractLives = "0xbb9bc244d798123fde783fcc1c72d3bb8c189413";
var abiContractContent = fs.readFileSync('./bin/Token.abi', 'utf8' );
var abiJsonContract = JSON.parse(abiContractContent);
var daoTokenContract = web3.eth.contract(abiJsonContract);
var contractInstance = daoTokenContract.at(theAddressWhereMyContractLives);

var accounts = web3.eth.accounts;
accounts.forEach(function(account) {
    var result = contractInstance.foo(account);
}

However, I don't know how to do this to write into a contract. Because, if I do it in the same way (let's say the non-readonly function is called bar and receives an address and a number):

contractInstance.bar(account, 1);

I get this error:

/home/myuser/Documents/Code/ethContractPlayground/node_modules/web3/lib/web3/formatters.js:271
    throw new Error('invalid address');
    ^

Error: invalid address
    at inputAddressFormatter (/home/myuser/Documents/Code/ethContractPlayground/node_modules/web3/lib/web3/formatters.js:271:11)
    at inputTransactionFormatter (/home/myuser/Documents/Code/ethContractPlayground/node_modules/web3/lib/web3/formatters.js:97:20)
    at /home/myuser/Documents/Code/ethContractPlayground/node_modules/web3/lib/web3/method.js:89:28
    at Array.map (native)
    at Method.formatInput (/home/myuser/Documents/Code/ethContractPlayground/node_modules/web3/lib/web3/method.js:88:32)
    at Method.toPayload (/home/myuser/Documents/Code/ethContractPlayground/node_modules/web3/lib/web3/method.js:114:23)
    at Eth.send [as sendTransaction] (/home/myuser/Documents/Code/ethContractPlayground/node_modules/web3/lib/web3/method.js:139:30)
    at SolidityFunction.sendTransaction (/home/myuser/Documents/Code/ethContractPlayground/node_modules/web3/lib/web3/function.js:133:26)
    at SolidityFunction.execute (/home/myuser/Documents/Code/ethContractPlayground/node_modules/web3/lib/web3/function.js:219:37)
    at Object.<anonymous> (/home/myuser/Documents/Code/ethContractPlayground/approver_test.js:57:18)

And I guess this is normal, because I didn't send a transaction. I guess I need to figure out the way to call bar(account,1) inside the inputData payload of a transaction. How to do it with nodejs+web3? Thanks


texts: Can a blockchain such as Ethereum grow "physically" too big?

texts:
If a blockchain can be downloaded and verified by any node, wouldn't it get too big in storage size eventually? Ethereum only carries bytecode for smart contracts as additional information (please correct me if wrong), and it's already tens of GBs. I can totally imagine it would discourage people from participating if the size grows over 1T.

Additionally, if some other blockchains are used to be share bigger contents such as pictures and videos, how would that scale and still stay decentralized.


texts: Need help understanding Sharer(exceptions) example from docs

texts:
Ok, here's the code from solidity docs:

contract Sharer {
    function sendHalf(address addr) returns (uint balance) {
        if (!addr.send(msg.value / 2))
            throw; // also reverts the transfer to Sharer
        return this.balance;
    }
}

My problem with this example is the comment:

  // also reverts the transfer to Sharer

It's confusing, because throw in my understanding reverts the transfer  to the msg.sender and Sharer contract isn't the msg.sender here. What am I missing here?

Wouldn't it be les confusing if the code was changed to this:

contract Sharer {
        function sendHalf(address addr) returns (uint balance) {
            if (!addr.send(msg.value / 2)) // if false reverts the transfer to Sharer
                throw;                     // reverts the transfer to msg.sender
            return this.balance;
        }
    }


texts: Call contract method via raw transaction in python

texts:
From what I've read online I can't call the method I want to in python using

contract.functions.myfunc(param1,param2

becaues infura doens't support these types of transactions.

So instead I want to run this command (still in python) as a raw transaction using the Eth.sendRawTransaction function in Web3.py but it's not clear to me how I would do this. This example seems to be pretty close but I'm in python, not solidity not go-ethereum.

Guidance would be appreciated!


texts:
I'm currently trying to test run source code from GitHub based on a 2018 tutorial where solidity was using version 0.5.16. I'm currently using truffle v4.1.14. I understand that there was an update from "address" to "address payable", but I'm still not able to get it to work after referencing to similar threads. Appreciate any help. Thanks!
pragma solidity ^0.5.16;

import "./StringUtils.sol";
import "./Accounts.sol";

/** @title Documents. */
contract Documents {

  address payable private owner;
  address public accountsAddress;
  Document payable[] private documents;
  mapping (address => Count) private counts;
  enum DocStatus {Pending, Verified, Rejected}
  mapping (address => uint) balances;

  struct Document {
    address requester;
    address verifier;
    string name;
    string description;
    string docAddress;
    DocStatus status;
  }

  struct Count {
    uint verified;
    uint rejected;
    uint total;
  }

  event DocumentAdded (address user);
  event DocumentVerified (address user);
  event test (uint test);

function verifyDocument(string memory docAddress, DocStatus status)
  public
  payable
  {
    for (uint i=0; i<documents.length; i++) {
      if(StringUtils.equal(documents[i].docAddress, docAddress) && documents[i].verifier == msg.sender && documents[i].status == DocStatus.Pending){
        emit DocumentVerified(msg.sender);
        uint price = Accounts(accountsAddress).getPrice(documents[i].verifier);
        balances[documents[i].verifier] -= price;
        if(status == DocStatus.Rejected){
            counts[documents[i].requester].rejected = counts[documents[i].requester].rejected + 1;
            counts[documents[i].verifier].rejected = counts[documents[i].verifier].rejected + 1;
            // return the ether for rejection
            documents[i].requester.transfer(price);
        }
        if(status == DocStatus.Verified){
            counts[documents[i].requester].verified = counts[documents[i].requester].rejected + 1;
            counts[documents[i].verifier].verified = counts[documents[i].verifier].verified + 1;
            // send ether to verified account
            documents[i].verifier.transfer(price);
        }
        documents[i].status = status;
        break;
      }
    }
  }

** Documents.sol:208:13: TypeError: "send" and "transfer" are only available for objects of type "address payable", not "address".
documents[i].requester.transfer(price);
^-----------------------------^ **
Full source code: https://github.com/lionel1702/final-project-RumeelHussain/blob/master/contracts/Documents.sol
Error Log: https://github.com/lionel1702/log/blob/master/emailRegexErrorLog4


texts: Unable to deploy contract that uses Oraclize. Out of gas

texts:
I'm trying to deploy a smart contract that uses Oraclize on the Ropsten TestNet using truffle. It seems that deploy the Oraclize api contract (imported by my contract) it's too costly and causes the deploy to fail with the error "the contract code couldn't be stored please check your gas amount". If i increase the gas limit i get the error "Error: Exceeds block gas limit".

What can i do? There is a way to deploy only my contract without the oraclize contract?

Thank you in advance


texts: Sign Ethereum contract transaction w/ web3 on back-end?

texts: How do I directly import via Private Key an account to the web3 library so it can get called by functions like myContract.methods.myMethod().call() & myContract.methods.myMethod().send()? I am not running my own node but rather use Infura.


texts: Error calling view function: Returned values aren't valid, did it run Out of Gas?

texts:
I compiled my code on 0.6.6 solidity compiler and the code ABI for the function im calling is:

{ "inputs": [{ "internalType": "address", "name": "user", "type": "address" }], "name": "getAssetIds", "outputs": [{ "internalType": "uint256[]", "name": "ids", "type": "uint256[]" }], "stateMutability": "view", "type": "function" }

The code is deployed on Ropsten

web3 version is: 1.2.8

When I try getting data from getAssetIds function using the above ABI, I stuck into following error:

Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.

The code snippet im using to get data is:

var Contract = await new web3.eth.Contract(abi, contractAddress);

Contract.methods.getLockedAsset(assetIds[i]).call().then(async(lockedAsset) => {
                        lockedAssets.push(lockedAsset);
                        next();

        });

Any help will be appreciated please. Thanks for your time reading the question.


texts: how to connect to blockchain via etherscan provider

texts: Hello i am trying to connect to the ethereum network with etherscan as HTTP provider so users don't have to have a running node but i cant seem to find their provider-URL.


texts: Move ERC20 tokens from Mac to myetherwallet.com

texts:
I have the Ethereum Wallet for Mac on my laptop with some ERC20 tokens that I want to send. However I don't have sufficient disk space to synch the nodes to do any transactions it seems.

Can I move them in another way ?
Eg. backup my private key and then use it somewhere else to transfer the tokens ?   Install a wallet on another laptop and do the complete synch and then transfer the tokens ?
What would be the easiest and/or most preferred solution ?

I looked already around but am not able to find the exact solution for me. Maybe because I am also still a newbie :)

Any help would be appreciated

Thanks !


texts: How to get the zero address from ecrecover?

texts:
I have a fair understanding of how ecrecover works, but I don't know how to enforce a parameter set that will deterministically return the 0x0 address. I need this in my contract tests.

Is this even possible?


texts: Solidity unit tests for contracts with a dynamic array return type

texts:
I am writing a simple smart contract for storing an array of bytes32, pushing to it, and retrieving it:

contract SimpleStorage {
    bytes32[] public items;

    event ItemAdded(bytes32 contents);

    function addItem(bytes32 contents) public returns(bool) {
        items.push(contents);
        emit ItemAdded(contents);
        return true;
    }

    function getAllItems() public constant returns(bytes32[]) {
        return items;
    }
}

This compiles fine, but when I try to write a Solidity test for this contract I am unable to store the result of getAllItems.

Line in question:

bytes32[] result = simpleStorage.getAllItems();

The error I get is: Type inaccessible dynamic type is not implicitly convertible to expected type bytes32[] storage pointer.

From this Github issue I see that it is known (and planned to be fixed in Ethereum 2.0) that we simply cannot at this time call functions that return dynamic arrays from another contract. We can, however, use these functions from the ABI.

Does this mean that it is essentially impossible to write Solidity tests for these types of functions at this time (since the unit tests are themselves contracts)? Has anyone else run into this issue and found a way around it?

I know I can just stick to writing JS tests but I am curious if there is a way to test these types of contracts using Solidity.


texts:
I have three accounts in Ethereum-Wallet. When I go to Accounts -> Backup -> Accounts, it takes me to a folder that has 2 files.  One file starts with UTC-- and ends with one of my account addresses. The other file is merely the address of the same account, beginning with 0x. Both files seem to contain the same data.

It seems like it is not picking up data from all of my accounts, how do I remedy that?

I'm using Ethereum Wallet V0.8.10 on Windows 10.

Update: I added an account and it didn't appear in the keystore folder.  Then I deleted everything from the keystore folder and when I start Ethereum-Wallet, it now shows me 4 accounts. Where is it getting them from?


texts: I am wondering if it is possible to write Solidity code to Mine Bitcoins on Ethereum's distributed computing platform?


texts: Mist - Rinkeby Test Net - No Longer Sending Confirmations

texts:
Im sure this is a very simple problem that one of the brilliant geniuses on this site should be able to answer! I have been testing a sample crowdsale  using the Tutorials on https://ethereum.org/crowdsale.
I have been able to successfully create contracts, accounts, transfer tokens, transfer ethers and get a crowdsale working on the Solo Net as well as the Rinkeby Test Net using Mist 0.9.3. As recently as this morning the Rinkeby Test Net was working normally. However within the past couple hours all of a sudden the Rinkeby Test Net is no longer processing confirmations for me.

As you can see from the screenshot, I am fully synced and connected to the Rinkeby Test Net with 6 Peers. As far as I can see, the Test Net should still be processing my confirmations normally but the last four transactions I initiated all still show 0 of 12 confirmations.  I tried deleting and reinstalling Mist but nothing has changed. My suspicions are that this problem is related to a cache issue or a network issue. If anyone here has a clue as to why Rinkeby Test Net is no longer working on Mist it would be much appreciated!


texts:
I have heard that the revert reason can be found in the Parity trace. I tried running trace_replayTransaction, and I have found that the output field contains the reason indeed, but there are many other bytes as well, and I can't find their meaning.

Is there a spec for the trace output?

Here's what I get:

 {
        "output": "0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000204f6e6c79206f776e65722063616e2075736520746869732066756e6374696f6e",
        "stateDiff": null,
        "trace": [
            {
                "action": {
                    "callType": "call",
                    "from": "0x00bd138abd70e2f00903268f3db08f2d25677c9e",
                    "gas": "0xdd9c8",
                    "input": "...",
                    "to": "0xa38ce7e55bb871f27de73dda17bb002055b45c87",
                    "value": "0x0"
                },
                "error": "Reverted",
                "subtraces": 0,
                "traceAddress": [],
                "type": "call"
            }
        ],
        "vmTrace": null
    }

If I take the tail of the output value starting with 204f.., the decoded value is Only owner can use this function, which is the correct revert reason. What is the meaning of the other bytes, and how do I know where to start cutting off?


texts: Checking balances on a private blockchain.

texts:
I was following this guide today https://medium.com/mercuryprotocol/how-to-create-your-own-private-ethereum-blockchain-dad6af82fc9f.

Right now I am at point where I have two geth nodes (gethn1 and gethn2) running locally on my machine. They are aware of each other and I was able to send a 100eth from an address on gethn1 -> address on gethn2.

What I want to do now is create a small web app. Given an address that exists on this private blockchain, this app would return a balance in that address.

I understand I could achieved this using the web3 library, but I am unsure of how to do this with a private blockchain.


texts:
I got a constructor like this:

contract Test{
    constructor(uint256 _num) public {
    num = _num
    ;}
}

Now I want to use this contract in another contract. Like this:

contract Call{
Test test;

   function addTest(address addr){
      test = Test(addr)
   }
}

How can I pass the Argument _num to the constuctor?


texts: Token contract for exchange fund manager

texts:
I'm seeing lot's of address like this for exchange sites that they manage their user balances in a single address like this:

CoinExchange.io: https://etherscan.io/address/0x4b01721f0244e7c5b5f63c20942850e447f5a5ee

Binance: https://etherscan.io/address/0x3f5ce5fbfe3e9af3971dd833d26ba9b5c936f0be

Are there any example contract? I'd like to see that.


texts: window.ethereum undefined android metamask webview

texts:
When I open my site in android in the metamask layout in the webview, I always get

window.ethereum === undefined.

And also window.web3 === undefined.
This problem only persists on android. On pc and ios, window has ethereum.
Why metamask dont inject ethereum in anroid?


texts: Predefine set of transactions to be added as soon as a private chain is initialised

texts: I need some transactions with predefined data that needs to be added immediately after the genesis block. Apart from actually making those transactions through Geth, is there a way to automate these transactions to be added when I set up the private chain?


texts: The method eth_sendTransaction does not exist/is not available on infura

texts:
Im trying to send transaction to simple greeter contract with web3.js on infura node.while doing soo, Im getting this error.

 throw errors.InvalidResponse(result);
        ^

Error: The method eth_sendTransaction does not exist/is not available

after lot of investigation about this error on internet, I came to conclusion that infura doesnt support this method and we have to sign transactions offline and send raw transactions to node. Im already doing the same. but keep getting this error please help me to fix this error..
here is my transaction signing code:

const contractFunction = contract.greet({from:web3.eth.defaultAccount},"hello all devs");

const functionAbi = contractFunction.encodeABI();

let estimatedGas;
let nonce;

console.log("Getting gas estimate");

contractFunction.estimateGas({from: account}).then((gasAmount) => {
 estimatedGas = gasAmount.toString(16);

 console.log("Estimated gas: " + estimatedGas);

 web3.eth.getTransactionCount(account).then(_nonce => {
   nonce = _nonce.toString(16);

   console.log("Nonce: " + nonce);
   const txParams = {
     gasPrice: '0x09184e72a000',
     gasLimit: 3000000,
     to: contract_Address,
     data: functionAbi,
     from: account,
     nonce: '0x' + nonce
   };
   const tx = new Tx(txParams);
   signed_tx = web3.eth.account.signTransaction(tx, privateKey)
   tx_hash= web3.eth.sendRawTransaction(signed_tx.rawTransaction)
   tx_receipt = web3.eth.waitForTransactionReceipt(tx_hash)
   //tx.sign(privateKey);
   console.log(tx_receipt)


texts: Simple function to move tokens from contract?

texts:
I have a contract to store certain amount of tokens I created in another contract.
I sent those tokens to the storage contract but it seems that there is no way out for that tokens, unless I construct a function.

Is there a simple function to move them out easily to any wallet?


texts:
How to check the VM trace using Geth?

I've ran geth with --verbosity 6, and stuff like this gets logged:

I0525 01:26:12.418607 core/vm/vm.go:157] running byte VM b82addc7
I0525 01:26:12.419818 core/vm/vm.go:160] byte VM b82addc7 done. time: 1.196171ms instrc: 539
I0525 01:26:12.419852 core/state_transition.go:258] VM call err: Out of gas

But that is not the VM trace, I take it?


texts: What is the point of the non-upgradability of Smart Contracts?

texts:
The title is clear:

I do not clearly understand why a Smart Contract (SC) cannot be
upgraded.

Which is the problem of letting SCs being upgraded? Costs? Security?
I imagine an scenario where some amount of users rely in some DApp (say, they send ETH to a SC address to obtain some service) and then the owner of the SC (A.K.A., the deployer) suddenly changes the SC's code to send all the contained ETH to its personal account.
Is that the main reason behind it? Is it the ONLY reason behind it?
I am not considering the case where the service provider SC is used through an intermediate SC that changes the provider address to "upgrade" the service.


texts:
Good afternoon,
after having been developing a blockchain web app for some months, it's the first time I get this error when making a transaction.
ValueError: {'code': -32000, 'message': 'only replay-protected (EIP-155) transactions allowed over RPC'}

This is my code. It has always worked, and I guess it's not a matter of code, it might be just a matter of Web3, but I'm asking just in case. Thanks in advance.
tx = {
        'nonce': nonce,
        'to': account_2,
        'value': web3.toWei(float_amount, 'ether'),
        'gas': 21000,
        'gasPrice': web3.toWei(50, 'gwei')
    }
    signed_tx = web3.eth.account.sign_transaction(tx, private_key)
    tx_hash = web3.eth.send_raw_transaction(web3.toHex(signed_tx.rawTransaction))


texts: Gas limit too low when using transaction data field

texts:
I am using web3.js to send a transaction. This is the code that I have currently:
async function sendTx(tran, ethAddress, privateKey, value=0) {
    var tr = {
        chainId: await web3.eth.getChainId(),
        gas: 300000,
        nonce: await web3.eth.getTransactionCount(ethAddress),
        value: web3.utils.toWei(value, 'ether'),
        data: tran.encodeABI()
    };

    try {
        tr.gas = await web3.eth.estimateGas({
            from: ethAddress
        });
    } catch {
        console.error('Could not estimate gas');
    }

    var signedTx = await web3.eth.accounts.signTransaction(tr, privateKey);
}

var sc = new web3.eth.Contract('abi', 'contract address');
await sendTx(sc.methods.someMethod('param1'), 'ETH address', 'privateKey');

If I run it, I get the following error:
Uncaught (in promise) Error: Signer Error: gas limit is too low. Need at least 53204
If I remove data: tran.encodeABI(), everything works fine.


texts: Error: Invalid JSON RPC response: undefined from node web3.js app

texts:
I'm getting Error: Invalid JSON RPC response: undefined from my node.js application when it tries to execute a function.
My steps:

ethereum wallet 0.5.1 to deploy a contract to the testnet.
start the geth client version 1.3.3:

$ geth --rpc --rpcaddr "0.0.0.0" --rpcapi "eth,web3" --rpcport 8546 --networkid 5678 attach

(I can run web3.eth.accounts from within the geth console and it returns my locally created accounts)

used npm to install web3 version 0.15.3
from within the node shell:

> var Web3 = require('web3')
> web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8546"))
> web3.version.api
'0.15.3'
> web3.eth.accounts
Error: Invalid JSON RPC response: undefined
at Object.module.exports.InvalidResponse (/Users/jbowkett/node_modules/web3/lib/web3/errors.js:35:16)
at HttpProvider.send (/Users/jbowkett/node_modules/web3/lib/web3/httpprovider.js:87:22)
at RequestManager.send (/Users/jbowkett/node_modules/web3/lib/web3/requestmanager.js:58:32)
at Eth.get [as accounts] (/Users/jbowkett/node_modules/web3/lib/web3/property.js:107:62)
at repl:1:9
at REPLServer.defaultEval (repl.js:252:27)
at bound (domain.js:287:14)
at REPLServer.runBound [as eval] (domain.js:300:12)
at REPLServer.<anonymous> (repl.js:417:12)
at emitOne (events.js:82:20)

Also :
$ telnet localhost 8546
yields no connection


texts: Sending hundreds of signed transactions with web3js which succeed but can only find a couple on Etherscan

texts:
I am using web3js to send hundreds of transactions to Ropsten (will eventually change to mainnet) and I am getting a tx hash for all of them, which means that supposedly, all the transactions have been registered correctly onto the blockchain. To achieve this, I am incrementing the nonce by 1 for each transaction, so basically the nonce is:

var nonce = web3.eth.getTransactionCount(config.abtoken.owner) + nonceCount++;

I got the above from error: replacement transaction underpriced since I was getting that error, due to the previous transaction not being mined and hence the nonce could not be the same.

However, when I go to Etherscan, I can only find a few of these tx hashes (about 5 or so). I also noticed that during the first run, after I let it run and came back to check, I saw all of them (about 700 transactions).

Am I doing something wrong here? Or I just need to wait more (according to Etherscan it may take up to 1 hour when the transaction won't be mined on the current block).

I would really appreciate your help on this as it baffles me that it might not be working properly when a tx hash is returned.

Thanks in advance!


texts:
In a typical split contract, where onlyOwner being the standard zeppelin Ownerable modifier, how can the onlyOwner of A be enforced when it's called from B?

contract I is Ownerable {
    function transferAsset(address _from, address _to) public onlyOwner;
}

contract A is I {
    address asset;

    function transferAsset(address _to) public onlyOwner {
        asset = _to;
    }
}

contract B is I {
    I contractA;

    function doTransfer(address _to) public onlyOwner {
        contractA = I(A_Deployed_Address);

        contractA.transferAsset(_to);
    }
}

[edit]

Sorry for not making things clear in my original question. In my case I'm deploying both contract A and B from truffle, so both of their owner will be the deployment account that truffle uses.

Then it seems I have no choice but to change the owner of B to A's deployed address so that A can call B's transferAsset, which is basically Eli Drion's answer. I'm just a bit concerned if I do that, will there be any potential downfall that all future calling of B's onlyOwner modified functions must be initiated from A and not its original deployer?

And if I take the approach of deploying B from A, doesn't that imply import B in A, which would result in a bloated A that defeats the purpose of split contract (and back to the out-of-gas problem I'm having during contract deployment)


texts: How to be sure a bytecode is conform to a source code

texts:
Let's suppose a company shows me a contract's code source.
This code source has been audited and looks fine.
I trust this source code and i want to send Ether to this contract.
The company tells me the contract has been deployed to an Ethereum Address. How can i be sure the deployed contract is exactly the same than the code source ?
In fact i want to be sure the source code we show me is exactly the same than the deployed one.
Thanks


texts: Is it possible to batch approve + transfer with CREATE2?

texts:
In our dapp, we currently have the following user flow:

Approve the Sablier contract to spend up to x ERC20 tokens
Transfer the x ERC20 tokens to the Sablier contract

This is not super bad UX, but it would certainly be nicer if users signed only one transaction.

I'm aware of the "enable max" strategy, where you ask the user to approve the token with a stupendously high value, but I don't find it safe.

Is there a way in which we could have our cake and eat it too? That is, do both the approval and the transfer in one transaction? Maybe with CREATE2?


texts: Are values hashed using KECCAK - 256 uniformly distributed? If I use a KECCAK - 256 hash and then convert it to a number in a range 0 - N using the modulo operation, would the probability of obtaining any of the numbers in this range be equal to 1/N, or would there be a deviation from the ideal distribution?


texts: What prevents the implementation of floats (except storage cost)

texts:
Floats and floating point operations are very useful in different applications. I know that they are not officially supported, nonetheless it would be possible to implement floats as for example explained here https://en.wikipedia.org/wiki/Floating-point_arithmetic

Besides the necessary amount of storage, what else prevents floats on ethereum?


texts: MetaMask injected Web3 not working in HTML file

texts:
I am using chrome with the MetaMask plugin installed. When I launch the below HTML file and look at the JS console, MetaMask doesn't inject web3 ("MetaMask - injected web3") like it does on every other webpage. What am I missing here / how much configuration does it take to get MetaMask to inject web3.js?

<!DOCTYPE html>

<script>
window.addEventListener('load', function() {

// Checking if Web3 has been injected by the browser (Mist/MetaMask)
if (typeof web3 !== 'undefined') {
// Use Mist/MetaMask's provider
window.web3 = new Web3(web3.currentProvider);
  } else {
console.log('No web3? You should consider trying MetaMask!')
// fallback - use your fallback strategy (local node / hosted node +
in-dapp id mgmt / fail)
window.web3 = new Web3(new
Web3.providers.HttpProvider("http://localhost:8545"));
  }

 // Now you can start your app & access web3 freely:
  startApp()

})

</script>


texts: Calling fallback function in truffle to delegate a call

texts:
I'm playing with the upgradeable contracts via DelegateProxy in Solidity.

This pattern posits that a MutableForwarder contract is deployed once, and all the subsequent calls to the upgradeable contract are made to the fallback function of the Forwarder, which in turn uses delegatecall to invoke the target contract.

I have a hard time calling the fallback function:

var payload = testContract.contract.construct.getData(1);

return web3.eth.sendTransaction({
  from: accounts[0],
  to: testContractForwarder.address,
  data: payload
});

The results of running the deployment script:

Replacing TestContract...
  TestContract: 0x93d8c7d954a930f2eadf6fc68058e5c43ebe988f
Deploying TestContractForwarder...
  TestContractForwarder: 0xd46539cae056345ce547e65c3e8d8ec764ed5d1d
@@@ TestContractForwarder target: 0x93d8c7d954a930f2eadf6fc68058e5c43ebe988f

After linking the target to the forwarder, next transaction goes through, but has no effect:

@@@ TestContract/construct tx 0x11bea1b01e4977747bfd8b604eaf9fc3ebc5dae2b42bde7e918f811fbad1fd53 successful
--- TestContract/value : 0
--- TestContract/wasConstructed : false

Calling the contract directly, with the same payload is successful and sets the value.

Repository which reproduces: https://github.com/fbielejec/truffle-forwarder


texts: Help! Unable to verify Token Contract, Where can get ByteCode and ABI?

texts:
Receiving the following errors:
Note: Contract was created during Txn#
Result: Does not match the input creation bytecode found at this address

Error! Unable to generate Contract ByteCode and ABI

For some reason, the end of my Input Data does not give me a working Bytecode to use where others do.
Here's the transaction which made the contract: https://etherscan.io/tx/0x41c4bf0eb9a58d1e70b595fea1a1147671c0fbcdfe13445b9569642827e47695

Any help is appreciated, I've been stuck at this point for some days, and completely clueless.

Cheers!


texts: How to check validity of an address in solidity?

texts:
Here's a simple contract:

contract C {
    event myEvent(bool x, address y);
    address someAddress;

    function someAddressExist(){
        if(someAddress != 0){
            myEvent(true, someAddress);
        }
    }

    function setSomeAddress(address y){
        someAddress = y;
    }
}

When I try to send a transaction to any address on the test network, except 0x1, it works. What's so special about this address? Are there any other addresses like that?


texts: sync parity or geth starting from block x

texts:
I'm having issues syncing geth and parity as detailed in other posts. What would be ideal is if you could sync starting from the current block only as I dont really need historical blocks anyway.
Is there a way to do this?

i.e. you would provide or 'seed' the information required to mine the next block; take for example block 4636585
I'm not sure on the exact technical details (and hence this question) but you would provide geth or parity with the details from a trusted source so it could continue from an arbitrary block number.


texts: Make data from smartcontracts / events only visible for certain address/users

texts:
I Have an use case where i need :

1- My data not to be visible to the public.

2- To be able to revoke my clients/users rights to view said data from my smart contract.

As anyone done that before ?

I was thinking of encrypting / decrypting my data client side so that the data is never visible on the blockchain in clear and that seems solid enough.(client would hold the private key)

But then i'm failing to see how to prevent my users from watching the events for that contract using something like

contractInstance.EventName({x: y}, {fromBlock: 0, toBlock: 'latest'});

or by calling getters directly form their local node when i want to revoke their right to see it.

I was thinking of re-encrypting the data On blockchain a second time and have my contract decrypt it for address in some kind of list , but that would require my contract to hold the private key and that would effectively make everything useless.

Are there any solution other / better solution to this issue?

Edit :

A bit more on my usecase it a kind of registry. I'm hosting data on the blockchain , i give the right to add/edit data to my users with basics rights (i'm owner of the contract and there is a list of authorized user that can use add/edit functions).Also,User can edit his own data only but can see the whole set, if subscribed.

I want that same list of user ONLY to be able to read the data ( subscription based system ) so that once the subscription runs out they can't event read the data anymore.

I'm having a hard time picturing the proper design as encrypting the data and sending it to the blockchain while having the private key stored in my privately distributed client is fine,but that would still mean the client hold the key to decrypt the data forever. Or i would have to re encrypt the whole set of data each time a client unsub which is not realistic.


texts: Accessing private variables using assembly

texts:
I would like program an oracle service which I would like to charge a fee for. Therefore, I would store the data of interest as a private variable in my oracle contract. This private variable should only be accessed via a function which requires a minimum value payed by the calling contract.

I wonder, is my private variable really protected against phishing by other contracts? More specifically, is it possible to read a private variable of a different contract by any means? Obviously, it does not work with the standard solidity code but is it possible using assembly?


texts:
Does Infura support creating filters to Listen to events ? I have a dapp with many events, and would like to test it in Ropsten testnet and python web3.py, but it seems infura does not support filters.
It worked fine with ganache local network, but once I used infura, no one events have been seen in python code and always have this error:
RuntimeError: cannot call recv while another coroutine is already waiting for the next message

Is there any alternatives to test the dapp in such ropsten testnet with all events I have in my code without using infura
Thanks


texts: Not a function but function is there in solidity contract

texts:
I have a function called

function addUser(address pubkey) public {

  }

However when calling this function in the node backend

            contract.methods.addUser(address).call().then(function(result){}

Im getting an error saying function does not exist.

This is how the contract is being initialised:

const contract =  new web3.eth.Contract(abi, '0xb226be108ef6fc6c60d6702ae149b290f5956377');

Thanks in advance


texts: Error from web3.eth.getPastLogs() hex string without 0x prefix

texts:
I want to retrieve all token transfers to a given address by scanning the logs but receive an error. Am I doing something wrong? Could it be a web3 beta issue?

Code:

const Web3 = require('web3');
const web3 = new Web3(new Web3.providers.HttpProvider("http://127.0.0.1:8545"));
const transfer = web3.utils.keccak256( "Transfer(address,address,uint256)" );

// find all tokens received by this address ...
let sca = web3.utils.padLeft('0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8', 64);

console.log( 'transfer: ', transfer );
console.log( '     sca: ', sca );

web3.eth.getPastLogs( {
    fromBlock: 1,
    toBlock: 'latest',
    topics: [transfer, null, sca, null]
  }
).then( (events) => { console.log( events ); } );

Result:

transfer:  0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
     sca:  0x000000000000000000000000EA674fdDe714fd979de3EdF0F56AA9716B898ec8

Unhandled rejection Error: Returned error: invalid argument 0: hex string without 0x prefix
    at Object.ErrorResponse (/home/acct/node_modules/web3-core-helpers/src/errors.js:29:16)
    at /home/acct/node_modules/web3-core-requestmanager/src/index.js:137:36
    at XMLHttpRequest.request.onreadystatechange (/home/acct/node_modules/web3-providers-http/src/index.js:64:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/home/acct/node_modules/xhr2/lib/xhr2.js:64:18)
    at XMLHttpRequest._setReadyState (/home/acct/node_modules/xhr2/lib/xhr2.js:354:12)
    at XMLHttpRequest._onHttpResponseEnd (/home/acct/node_modules/xhr2/lib/xhr2.js:509:12)
    at IncomingMessage.<anonymous> (/home/acct/node_modules/xhr2/lib/xhr2.js:469:24)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:188:7)
    at endReadableNT (_stream_readable.js:975:12)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)

Environment:

node.js 7.8.0
web3 1.0.0-beta.22
geth 1.7.3-stable on go1.9
Ubuntu x86_64

Already tried:

use WebsocketProvider instead of HttpProvider
specify address: "0x..." in the filter with a real address
replace fromBlock: 1 with `fromBlock: "0x1", and same using 0
replace null topics with valid values
forcing transfer and sca to be strings using for example sca = '' + web3...

Yet to try:

revert to web3.js version 0.19


texts: How do I get tokens still unsupported after crowdsale?

texts: If I want a token, say GNT, that is not listed on exchanges and I missed the presale, what are my options?


texts: Ethereum Wallet vs. Mist (vs. Testnet vs. Mainnet)

texts:
I'm having a bit of trouble completely understanding the inner workings of ETH and the Ethereum wallet UI vs Mist (when having used testnet), and I need to ask some rather stupid questions to understand the history and reasoning. If this is not the place, I apologize.

Generally i don't understand the difference between Mist and Etherum Wallet applications? What is the history of each ?
What I also not completely understand, is that a Wallet Contract and some tokens I believe I created on testnet seems to be visible in Ehereum Wallet even when having switched back to mainnet? If i transfer funds when in mainnet, to the above mentioned Wallet Contract, wouldn't they be lost?

I understand that an address can exist in both nets, and that if I have the pk for a particular address, I can retrieve the funds in any net, - but when it's a wallet contract that only exist on testnet, and not just an account, what happens?

How do I generally know if i "own" a Wallet Contract, and if I am able to access it and send funds from it? It is "attached" to my Etherbase address or how does that work?
Now if i open "Mist" application, everything is as I would probably expect, - I can see my main account, and none of the testnet stuff. Is all my troubles actually what Mist fixes ?

Thank you


texts: Cryptographic hash of the entire Ethereum database

texts: I need a cryptographic hash of the entire Ethereum database (of the information in all blocks up to a certain block number). Is there a service that calculates this hash?