texts:
On Etherscan, when I hover over the "?" on the "From" field I see the following:
The sending party of the transaction (could be from a contract address).
I don't understand. I thought only an EOA could initiate a transaction? Internal traces of course can come from contracts, but not the initial (I thought).


texts: Is there dedicated hardware currently on sale?

texts:
Wondering if there is anyone that sells hardware dedicated to Ethereum or some Dapp in particular.

(Like Slock.it should for instance)


texts: Passing constructor arguments to the CREATE assembly instruction in solidity

texts:
I have a contract which deploys other contracts by bytecode:

contract DeployContract {
    function deploy(bytes calldata _bytecode) external returns(address addr) {

        bytes memory bytecode = abi.encode(_bytecode, msg.sender);
        assembly {
            addr := create(0, add(bytecode, 0x20), mload(bytecode))
            if iszero(extcodesize(addr)) {
                revert(0, 0)
            }
        }
    }
}

I want to deploy contracts which take an address as argument in their constructor. Appending the address to the bytecode as above does not work. How do I pass the constructor parameter?


texts: Who gets the gas for smart contract execution?

texts:
When I deploy a contract by sending a new transaction, the miner who
adds the transaction to the blockchain gets the gas, right?
When I execute I contract by sending a new transaction, the miner who adds the transaction to the blockchain gets the gas. But just for adding the transaction and not for execution?

So my main question: When all nodes have to execute the smart contract who (which node) gets the gas for the computation?


texts:
I have the following array of uint8s in Solidity:

[8, 1253, 54, 777, 553]

There needs to be a function that gets one input uint8 number and checks to see whether or not the input number matches with any of the uint8 numbers in the array above.

What would be the best way to implement such a function?


texts: In the example Ethereum crowdsale contract, what is the safe withdrawal function?

texts:
By safe withdrawal, I mean if a crowdsale doesn't reach the target, what area of code sends the tokens back to investors. I'm really stumped.

pragma solidity ^0.4.16;

interface token {
    function transfer(address receiver, uint amount);
}

contract Crowdsale {
    address public beneficiary;
    uint public fundingGoal;
    uint public amountRaised;
    uint public deadline;
    uint public price;
    token public tokenReward;
    mapping(address => uint256) public balanceOf;
    bool fundingGoalReached = false;
    bool crowdsaleClosed = false;

    event GoalReached(address recipient, uint totalAmountRaised);
    event FundTransfer(address backer, uint amount, bool isContribution);

    /**
     * Constrctor function
     *
     * Setup the owner
     */
    function Crowdsale(
        address ifSuccessfulSendTo,
        uint fundingGoalInEthers,
        uint durationInMinutes,
        uint etherCostOfEachToken,
        address addressOfTokenUsedAsReward
    ) {
        beneficiary = ifSuccessfulSendTo;
        fundingGoal = fundingGoalInEthers * 1 ether;
        deadline = now + durationInMinutes * 1 minutes;
        price = etherCostOfEachToken * 1 ether;
        tokenReward = token(addressOfTokenUsedAsReward);
    }

    /**
     * Fallback function
     *
     * The function without name is the default function that is called     whenever anyone sends funds to a contract
 */
function () payable {
    require(!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) _; }

/**
 * Check if goal was reached
 *
 * 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;
}

/**
 * Withdraw the funds
 *
 * Checks to see if goal or time limit has been reached, and if so, and the funding goal was reached,
 * sends the entire amount to the beneficiary. If goal was not reached, each contributor can withdraw
 * the amount they contributed.
 */
function safeWithdrawal() afterDeadline {
    if (!fundingGoalReached) {
        uint 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;
            }
        }
    }
}


texts: Solidity initialize memory array of fixed size

texts:
Using solidity 0.4.15, there is a function that takes a number and returns array of fixed length called traits:

function splitN(uint256 n) constant returns (uint8[12]) {
    uint8[12] memory traits = new uint8[12];
    // alter values in traits ...
    return traits;
}

But this way to initialize traits don't compile, with the errors:

.../Genes.sol:28:39: TypeError: Length has to be placed in parentheses after the array type for new expression.
        uint8[12] memory traits = new uint8[12];
                                      ^-------^
,.../Genes.sol:28:9: TypeError: Type function (uint256) returns (uint8[12] memory) is not implicitly convertible to expected type uint8[12] memory.
        uint8[12] memory traits = new uint8[12];

Then I tried following the message hints, and a bunch of other ways to initialize, but the only way I could make it work was to actually fill an array of 12 zeroes:

    uint8 z = 0;
    uint8[12] memory traits = [z, z, z, z, z, z, z, z, z, z, z, z];

So is there a more elegant way of initializing the array?


texts: How should an application react when the blockgaslimit is reached?

texts:
Because in theory the block gas limit can be reached any time, how would a fully automated contract need to react?

How to recognize reliable that it's the block gas limit that rolls back the state change?
How to retry the transaction in a secure way? Idempotentcy is not always possible.


texts: How could i add a peer in a running network of ethereum private network without stopping network and sync it with network also?

texts: I am running a private ethereum blockchain on 4 nodes which i am using as a static nodes but now when my network is running i want to add another peer in my network and sync that peer with my network also.How can i do that?


texts: How to use msg.data payload with delegatecall to run functions on other contracts?

texts:
I'm aware that you can craft function signatures/calls similar to the following:
address nameReg = 0x72ba7d8e73fe8eb666ea66babc8116a41bfb10e2;
nameReg.call(bytes4(keccak256("fun(uint256)")), a);

I'm wondering how I would be able to pack together the data when making a delegatecall such I can arbitrarily pass in encoded function signatures.


texts:
I started my geth using fast sync first and then normal sync once it was almost synced. 'currentBlock' is not increasing since hour and 'highestBlock' keep on increasing.

geth --testnet --rpc --cache=1024 --syncmode "fast" --rpcapi eth,web3,net,ssh,db,debug,personal --rpcaddr "10.128.0.4" --rpcport "8545"

geth attach ipc:/home/blockhealth/.ethereum/testnet/geth.ipc

> web3.eth.syncing
{
  currentBlock: 5950072,
  highestBlock: 5950187,
  knownStates: 32304159,
  pulledStates: 32290607,
  startingBlock: 5949969
}

I started my geth using --testnet i.e, on ropsten.

I checked that the block which includes the transaction of transferring the ETH from other wallet to my wallet is also added to the GETH.
On https://ropsten.etherscan.io balance is 1.5ETH in my wallet.
But still I am seeing balance as 0 when checking with geth :

> web3.eth.getBalance('0xXXXXXX')
0

And error 'Insufficient funds for gas * price + value' while connecting to my smart contract.

my GETH version is : Geth/v1.8.27-stable-4bcc0a37/linux-amd64/go1.10.4


texts: How to parse input data in a contract creation transaction?

texts:
When we create a contract, we always send a transaction to a empty account and with contract bytecode in input data.

But sometime we need to call the constructor. So some params must be sent with the bytecode.

Which rule does those data assemble together and how can i parse it ?

If this transaction is a normal transaction, we can parse input data using web3. But this kind of transaction can be a little bit more complicated.


texts: Minergate issues, Windows 10, 6x RX580 GPU, TB250-BTC MB

texts:
I have been struggling with this issue for about 3 weeks now and could find nothing on forums and discussions online.

I have a GPU Rig with the following specifications:

6x PowerColor Red Devil RX580 Golden Sample GPU
6x Molex Powered Riser Boards with Molex to Sata Adapter Cables
Biostar TB250-BTC Motherboard
4GB RAM
Intel Celeron G3900 CPU
Corsair AX1200i PSU
Windows 10 64 bit

The issue I have is that Windows recognizes the GPUs, directly plugged into the MB or on the Risers, however, when I only use the risers, I get a black screen if more than 4 cards are installed.

I use Minergate to mine Ethereum, once the DAG file is created, I either get a hash rate of 0 H/s, or I get a blue screes saying DRIVER_IRQL_NOT_LESS_OR_EQUAL.

I have reinstalled Windows from another source to make sure it is not a Windows error. I re-downloaded the latest AMD Drivers and an older version and it still gives me the same issue

I have Minergate running perfectly on my home PC with an NVidia GTX970 (just mining to test and not for profit) with no such issues.

Could it perhaps be incompatibility issues? I do not really have the funds to buy more parts to swap and test, but because I have 6 cards and 6 risers I can test them all separately, which I have.

I also installed Ubuntu 16.04, which also picked up the GPU, but when I installed the latest drivers, it would not allow me to pass the login page, which I could do before the drivers were installed. I managed to get past the login page once after the installation, but I was stuck on a hash rate of 0 H/s

If anyone has experienced a similar problem, please assist where possible.

UPDATE

I previously flashed the bios with the same version it was on, still gave the same issues, and then updated to the latest version, still the same. There is however no posts of people using this bios version because it is so new.

I did notice one thing though, our Internet was down yesterday, so the Rig could not mine, so I did not get the Windows Blue Screen error, but as soon as the internet is back, the blue screen returns.

Did another BIOS update, blue screen is still there, so I believe the problem either lies with the motherboard or ALL the GPU's, as they all do the same. I think chances are bigger that the issue is with the MB because I have had issues with a few boards I have purchased.

We bought another MB yesterday, I do not get the Blue Screes anymore, but occasionally freezes a few times after each other. Still not getting any hashes


texts: '@ethereumjs/common' giving error Common is not a constructor

texts:
I have installed "@ethereumjs/common": "^2.0.0",
And and then using it -
import Common from '@ethereumjs/common';
const c = new Common({ chain: 'ropsten' })

And getting error Uncaught TypeError: Common is not a constructor.
What I am doing wrong?


texts: return array is not showing pushed value

texts:
This must be silly question but as a new learner i am trying to understand array in solidity and run this code in remix, compiled and deployed the contract on ropsten platform. I want to see the array value which i am returning in the end.But calling that getA function gives nothing. I'm doing the transaction in metamask.

pragma solidity 0.5.1;

contract SolArray{
    uint[] a;

    function getA() constant returns  (uint[] memory){

        a.push(123);
        return a;
    }

}


texts: Solidity Docs Code Example divide by two then require multiply quotient by two

texts:
The below is right from the solidity readTheDocs page.  Its from the Safe Remote Purchase section on https://solidity.readthedocs.io/en/develop/solidity-by-example.html#micropayment-channel.

function Purchase() payable {
         seller = msg.sender;
        value = msg.value / 2;
        require((2 * value) == msg.value);
    }

What are the last two lines doing? Dividing the value by two and then requiring that the inverse must be equal to the original number.  What's the point? I must be missing something.


texts: How is deployment address chosen (by Parity)?

texts:
I am deploying a contract from a Parity instance that has several accounts within it.  When I deploy a contract at the console of the same computer, Parity UI asks me for a password to unlock the account.

And then sometimes when I add a new account, it asks for this password instead.

How does Parity choose which account to debit to deploy from (or is this an ETH thing and not Parity specific)?


texts: Expose securely your network to make possible anyone can hit your smart contract

texts:
Im implementing a ethereum PoA network using go-ethereum

I have deployed a ERC20 Token on the network, and the idea is that the network must be accessed from any wallet on the internet (i.e metamask, myetherwallet, etc)

The idea for this network is:

Having N full nodes that are able to seal blocks (the nodes has the unlocked accounts)
Deploy a smart contract that is a ERC20 Token
Having one node that expose the network in order to be accessed from any origin, for example, Metamask, MyEtherWallet, a mobile app with a wallet, etc. The idea is that anybody can hit the ERC20 Token if they have the appropiate client.

In order to achive that, i create 2 full nodes that are in charge of sealing the blocks.

I run those nodes like this:

geth --datadir sealer1/  --syncmode 'full' --port 30351 --rpc --rpcaddr 'localhost' --rpcport 8502 --rpcapi='admin,personal,db,eth,net,web3,txpool,miner' --networkid 20 --gasprice '1' -unlock 'someaccount' --password s2/password.txt --mine

As you can see, there are some important things about those nodes:

Unlocks the accounts
Are only accessed from localhost (note the rpcaddres)
Those nodes are miners

If i expose a node like that to the internet (enabling RPC access from any origin) any hacker could send the ether to another account, so, i create a third node, a standard node, that doesnt expose rpc apis but allows connections on port 8545 (in order to be hitted from metamask, myetherwallet, etc)

I run the node with this command:

geth --datadir standard1/ --syncmode 'full' --port 30352 --rpc --rpcport 8545--rpccorsdomain '*' --rpcaddr 'SERVER_PUBLIC_IP' --networkid 20 --gasprice '1'

as you can see this node:

Doesnt unlock account
Allow rpc accesing from any origin
Doesnt expose rpc apis like personal, admin, etc

My questions are:

is this aproach secure?
Is there another way to allow anyone in the world to use Metamask to hit my smartcontract without open the RPC access on the standard node?

Why i have those questions?

Because there are a lot of places that doesnt recommend open RPC ports, so im not secure if:

Dont have a node exposed with unlocked accounts
Dont expose critical rpc apis like admin and personal

is enough to expose securely my node.

Here are some issues related with opening RPC access:

https://blog.blockdaemon.com/ethereum-geth-configuration-made-in-ireland-7ba2e876c6e3
https://www.reddit.com/r/ethereum/comments/4z0mvi/ethereum_nodes_with_insecure_rpc_settings_are/

https://www.reddit.com/r/ethereum/comments/3ird55/holy_shit_my_eth_accounts_been_hacked/

https://www.reddit.com/r/ethereum/comments/4jav5u/mist_wallet_has_2_sec_vulnerability_for_rpc/

https://blog.3or.de/internet-wide-ethereum-json-rpc-scans.html

https://www.bokconsulting.com.au/blog/7218-ethers-stolen-from-miner-with-rpc-port-open/

https://blog.ethereum.org/2015/08/29/security-alert-insecurely-configured-geth-can-make-funds-remotely-accessible/

Here the team lead of ethereum recomendation:

  Ok, your setup seems insanely dangerous. --rpcaddr=external_address
  essentially opens up the node to anyone in the world to access it.
  Forthermore, --rpcapi 'admin,personal,db,eth,net,web3,txpool,miner'
  permits anyone with access to do absolutely anything. I can imagine
  someone from the internet is brute forcing the passwords.

https://github.com/ethereum/go-ethereum/issues/17417#issuecomment-413877558


texts: High level tool (autogenerated UI) to obtain all the events emitted by the contract?

texts:
I'm pretty sure something like this exists, saw it somewhere in the wild, my Google skills need some StackOverflow boost...
I would like to provide two data points:

contract address
name of the event

The tool automagically fetches the data for me in a nice table.
Concrete example:

https://tokens.kleros.io/
https://etherscan.io/address/0xEbcf3bcA271B26ae4B162Ba560e243055Af0E679#code
give me all DisputeCreation

Or maybe possible directly in Etherscan?

Search and filter Event Logs for this Address by BlockNo or Topic0 Hash

Unsure how to get all DisputeCreation?

EDIT: There are some solutions via code: How can I view event logs for an ethereum contract?
I did something like that in the past, I'm much more interested in an app that allows me much faster experimentation without prerequesites.


texts: DelcarationError: Undeclared identifier on token creation

texts:
getting this error, any assistance is greatly appreciated.

browser/ballot.sol:166:17: DeclarationError: Undeclared identifier.
      require(_to != address(0));
              ^-^

function mintToken(address _target, uint256 _mintedAmount) onlyAdmin supplyLock public {
    require(_to != address(0));
    balances[_target] = SafeMath.add(balances[_target], _mintedAmount);
    totalSupply = SafeMath.add(totalSupply, _mintedAmount);
    Transfer(0, this, _mintedAmount);
    Transfer(this, _target, _mintedAmount);
}


texts:
Im trying to mine ETH on AWS for learning pourpouses folowwing this tutorial

After I ran these comands to install geth:

sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum-qt
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo add-apt-repository -y ppa:ethereum/ethereum-dev
sudo apt-get update
sudo apt-get install ethereum

and ran "geth" (no arguments)

it is producing the output bellow - which is very different from the one on the tutorial (and other tutorials I've seen).
Am I doing something wrong? If yes, what? If not, can you help me interpret the outut?
The ~/.ethereum/geth$ folder is already 25Gb - I presume thats where the chain lives, right?


texts: Can contracts act as decryption programs?

texts: I am trying to make a contract that receives an encrypted signed transaction and stores it for later use. This transaction can only be decrypted if the specified wallet sends a transaction to this contract telling it to forward this signed transaction to its destination.


texts:
contract foster{
    vulnerable v = new vulnerable();
    attacker a = new attacker(address(v));

     constructor() public payable{

        //  a.deposit(address(v));     // transferring 3 ethers to vulnerable contract and rest to the attacker contract
        //  v.addNominee(address(a));
     }

     function action() public payable{
         a.deposit(address(v));     // transferring 3 ethers to vulnerable contract and rest to the attacker contract
         v.addNominee(address(a));
     }

     function getTargetBalance() public view returns(uint256, uint256){
        return (address(v).balance , address(this).balance);
    }

     function attack() public payable{
         v.transact();
     }
}

Here is what I wanna do. I have two contracts namely attacker and vulnerable with the following definitions.

contract attacker

contract attacker{

    constructor(address payable _vulnerableContract) public{
        vulnerable v = vulnerable(_vulnerableContract);
    }

    function deposit(address payable _addr) payable public{
        _addr.transfer(msg.value);
    }

    function() external payable{
       }

}

contract vulnerable

contract vulnerable{

    mapping (address => uint256) balance;
    uint256 _amount;

    function() external payable{
    }

    function deposit() payable public{
        address(this).transfer(_amount);
    }
}

Here in the foster contract, I want to create one instance each of vulnerable and attacker.

I want to make the function action in the foster contract to call a.deposit(address(v)), and transfer the ethers from a's behalf to contract v. So that the net ether is transferred from calling account to contract instance v.

Then I want to add a as a nominee to the v instance.

When I am doing the thing I have done in the contract, the ether would go to contract foster and not to v. How can I make it happen?

My final aim is to trigger a failed send() bug when I call, v.transact, for that I need some ethers with the contract v. I'll add some failure in the function() payable of the contract a later.


texts: find the exact error in solidity transaction programmatically

texts: I know we can detect that the transaction is going to be failed with the "Out of gas" warning beforehand but is it possible to find the exact error before sending it to the blockchain. How can we simulate a transaction as its mined (failed) and find the exact error (or line of code) where it failed?


texts: What are common pitfalls when coding in Serpent?

texts:
Some pitfalls for coding in Solidity are here and what kind of pitfalls are there in Serpent?

(This is not related to Python, which is covered here)


texts: Error on contract constructor - CompilerError: Stack too deep, try removing local variables

texts:
I have the following constructor on a contract:

constructor(
    string name,
    string symbol,
    uint8 tokenResolution,
    string defaultUnderlying,
    uint maturityTimestamp,
    uint rate,
    uint8 rateResolution,
    Rates.YieldFrequency yieldFrequency,
    Rates.DayCount dayCount,
    Rates.RateType rateType
) public
    Bond(maturityTimestamp, rate, rateResolution, yieldFrequency, dayCount, rateType)
    BaseToken(name, symbol, tokenResolution, defaultUnderlying)
{
}

And when I try to compile it I get this message:

  CompilerError: Stack too deep, try removing local variables.
   ... maturityTimestamp ...
       ^---------------^


texts: What is the safest minimum block time to use without having any problem on Proof-of-Authority consensus?

texts:
On the following blog, at very last paragraph, Vitalik Buterin mentioned that:

  Hence, a 3-second target block time (and 5s actual block time) may be
  quite viable. As usual, we’ll be more conservative at first and not
  take things that far, but a block time of 12s does nevertheless seem
  to be very much achievable.

I am not sure that does this statement holds on Proof-of-Authority consensus. Please see my example CustomGenesis.json file.

On the Proof-of-work consensus block time is dynamically changes based on the network, but on the Proof-of-Authority consensus, block time is fixed and we cannot change it after block-time is defined on the genesis block.

"clique": {
  "period": 15,
  "epoch": 30000
}

For example Rinkeby Ethereum testnet uses Proof-of-Authority and its block time is 15 seconds.

By following this tutorial, I have created a private chain based on Proof-of-Authority by using clique consensus engine - proof-of-authority. By default, blocks also recommended is 15 seconds. The problem is after, when we decide the block time on the genesis file, in future we cannot change it.

$ puppeth
...
How many seconds should blocks take? (default = 15)
> 15

Assume that we have a private ethereum-network with good network connectivity.

[Q] What might be the safest minimum block time to use without having any problem on Proof-of-Authority consensus?

For example, could I use 12 seconds or even less (such as 5 seconds) for block time without having any problem? If no, what kind of problems will I face with?

Thank you for your valuable time and help.


texts: Can we get all elements stored in  a mapping in the contract using web3.js ?


texts: Can I assume when an event is received means the transaction is 100% confirmed?

texts:
I am listening to the even using Nethereum.

May I know if an event is received means the transaction is confirmed?

If not? How can I know it is failed and perform a rollback?


texts: How to connect a computer to a private chain using Wifi and MetaMask

texts:
I've set up a private chain on computer A. I'm using geth and the following two command lines:

geth --identity "MyNodeName" --rpc --rpcport "8545" --rpccorsdomain "*"
--datadir Users/TestChain --port "30303" --rpcaddr "127.0.0.1"  --
nodiscover --rpcapi "db,eth,net,web3,personal" --networkid 123 init
/Users/CustomGenesis.json

geth --identity "MyNodeName" --rpc --rpcport "8545" --rpccorsdomain "*"
--datadir Users/TestChain --port "30303" --nodiscover --rpcapi
"db,eth,net,web3,personal" --networkid 123 console

I want to connect another node/computer B to this chain, so it can send transactions/contracts to it. On both machines, I have installed Metamask.

For machine A, I Googled my public IP. Let's call it IP_A. Then on machine B, in MetaMask, I created a custom RPC as follows: IP_A:8545

But, it cannot connect to computer A, it says:

   connecting to unknown private network.

and nothing happens after that.

Question: How can I resolve the above issue? How can I connect two computers using wifi and metamask?

Edit: Please see my other question here, I've answered this question as well. Thanks to @Achala Dissanayake.


texts: Using a modifier as a function in Solidity

texts:
I have a modifier in my code:

modifier isOkay(address addr) {
    if (balances[addr].balance == 0)
        throw;
    _;
}

Which I used thus:

function whatever() isOkay(msg.sender) {
    // whatever
}

I want to use the modifier as a boolean test insider of other functions, thus:

function other_function() {
    // some other function
    if (isOkay(msg.sender)) {
       // do whatever
    }
}

Is that possible? I see an obvious way to do it (have the modifier call the function), but I wonder if there's a more elegant pattern to use.


texts:
how do I return an array of strings? This is my code:

contract PlanetEarthContract {
    string[7] continents;
    constructor() public {
        continents = ["North America", "South America", "Europe",
        "Asia", "Oceania", "Antartica", "Africa"];}

        function getCountries() public view returns(string[7] memory){
        return(continents);
    }

}

But I get the error

  This type is only supported in the new experimental ABI encoder.


texts: Truffle migration with contract argument

texts:
I have have many examples and in the 2_deploy_contracts.js providing simple arguments like address, string is all good.

However I am trying to deploy this example and it has a MintableToken _token as an argument. How do I provide that in 2_deploy_contracts.js?


texts: Is It possible, do not mine ERC based token on the time of deployment in Ethereum test or private Blockchain

texts:
I am new to ethereum block-chain.I have created ERC based token (smart contract).I successfully deploy it on ethereum local private block-chain.

When I will deploy smart contract token on rinkeby test network or main network. So, two question in my mind:-

1.How mining will be done?

2.And Is It possible I do not mine my  ERC based token when I deployed it on **ethereum main network or rinkeby test network**??

It might be a silly question but here i want to understand this concept more deeply.

Please help to clear my above query.

Thanks


texts: I am trying to get a Radeon 560 with 2GB RAM to work. I searched through everything, tried everything and did several system installs. But I can't get the Radeon 560 to work. With clinfo it also shows me something about OpenCL1.2!? The furthest I came I got an annoying error "No GPU device with sufficient memory was found. Can´t GPU mine. Remove the -G argument. I am very thankful about any hints. KR


texts: Is there a way to view all events on all blocks for Eris Blockchain?

texts:
is there a way to view all events on all blocks for Eris Blockchain? Currently I've managed to just subscribe a particular event

Contract

contract IdisContractsFTW {
  uint storedData;
  string name;

  event SetName(address indexed _from, string _name);

  function set(uint x) {
    storedData = x;
  }

  function get() constant returns (uint retVal) {
    return storedData;
  }

  function setName(string _name){
    name = _name;
    SetName(msg.sender, _name);
  }

  function getName() constant returns (string retVal){
    return name;
  }

}

Node.js

var myContract;

var IdisContractsFTW = JSON.parse(fs.readFileSync('./abi/' + 'IdisContractsFTW', 'utf8'));
var myContractFactory = manager.newContractFactory(IdisContractsFTW);

myContractFactory.at(incoming.address, function(error, contract){
    if(error) {throw error}
    myContract = contract;

    if(myContract){

        myContract.SetName(
            function(error,eventSub){
            if(error){
                throw error;
            }
            if(eventSub){
                console.log(JSON.stringify(eventSub));
                response.statusCode = 200;
                response.setHeader('Content-Type', 'application/json');
                response.write(JSON.stringify(eventSub));
                response.end('\n');
            }

        }, function (error,event) {
                if(error){
                    console.log("listenContractEvent error:"+error);
                }
                if(event){
                    console.log("event:"+JSON.stringify(event));
                }

            }
        );

    }

});

My current code in node.js just prints out an event whenever it's created. I'm trying to get an array of events ever created by this contract IdisContractFTW. Appreciate your advice on this one.

The manager object here is created using

var contracts = require('eris-contracts');
manager = contracts.newContractManagerDev(chainUrl, accounts.simplechain_full_000);

This is a repost of a question i've asked in stackoverflow. but I didn't manage to get an answer there
https://stackoverflow.com/questions/39981393/is-there-a-way-to-view-all-events-on-all-blocks-for-eris-blockchain


texts:
I am currently facing the challenge to prove that a transaction is mined into a block.

Dose anyone know libraries/tools that do this kind of thing? e.g.: create a proof that can be validated offline etc.

I would appreciate any help


texts: Smart contract method error: 'abi: unmarshalling empty output'

texts:
I had a working Solidity contract, made a change to its function signature (to take in an array of addresses, instead of a single address), I compiled it, ran abigen and generated Go bindings. Below is the code that calls that contract:

gethClient, err := ethclient.Dial(gethRPCURL)
if err != nil {
    log.Fatalf("failed to connect to the Ethereum client: %v", err)
}

contractBinding, err := NewMyContract(common.HexToAddress(contractAddress), gethClient)
if err != nil {
    log.Fatalf("failed to instantiate contract: %v", err)
}

var addrList := make([]common.Address, 0)
_, methodErr := contractBinding.MyMethod(addrList);
if methodErr != nil {
    log.Fatalf("my contract encountered error during MyMethod: %s", methodErr)
}

I've looked on Github and found this issue, which suggests its a type issue, I've looked on Gitter and found a suggestion about the chain not being in sync, which doesn't make intuitive sense to me. Has anyone ran into this issue before or able to provide some insight on it?


texts: Proof of Stake Automatic Timed Release of Token

texts: I'm using https://github.com/PoSToken/PoSToken/blob/master/contracts/PoSToken.sol as my example of Proof of Stake implementation (feel free to point out others that are worth looking at) however, it seems like, any of the token holders must call the transfer function to themselves in order to to receive the reward, but is there a way to make that minting and transfer happen automatically at a certain time, say 1st of every month, without any user intervention?


texts: With IPFS, can a developer give complete control of a storage account to a smart contract?

texts:
With IPFS, can a developer give complete control of a storage account (or ownership?) to a smart contract?

So that no human can edit/delete the files uploaded by the smart contract to the IPFS network nor upload files.


texts: Why are contacts from Remix editor and explorer different after deploying?

texts:
I try to deploy my ERC20 token. My steps are:

1) I created a contact with Remix (by some manual) https://gist.github.com/pistol88/a934da7fcaa93a92f4c4de60df56a0cf

contract TestToken is ERC20Standard {
     constructor() public {
        totalSupply = 100000000;
        name = "Test Token";
        decimals = 6;
        symbol = "TST";
        version = "1.0";
        balances[msg.sender] = totalSupply;
    }
}

2) I compiled files without any problems (with 0.5.7 compiler)

3) I deployed contract to Ropsten Test Network without problems. https://ropsten.etherscan.io/tx/0x6f638935f8c5b37b2165efad2ad7947363d17f766d5d41a1f61c1f10207af8e7

4) So, now I see the different token in contract at the explorer https://ropsten.etherscan.io/address/0x09d7837e1b63d8820895399c55b4c25abeb29af0 (tab Contract): "contract NewToken is ERC20Standard {function FTT() private {"

5) I'm trying to send assets to another address. I see an error like this https://ropsten.etherscan.io/tx/0x04c52bc0465ec6b44426dbc0276f65d23555fd9a9507f8595be8551747aec4aa "Warning! Error encountered during contract execution [Reverted]"

My primary question is: why are contacts from Remix editor and explorer different?

My secondary question is: how can I find the description of transaction error? Remix says only "0x0 Transaction mined but execution failed" with "logs  []"?


texts:
I faced many problems in order to run oracles with Ethereum.
I'm thinking of using Eris and I need guide to use oracles with Eris.
I need example so i can get how it works.
is there any example?


texts: Unable to declare public mapping in Solidity

texts:
When I try compiling the following on Remix:

contract Betting{
    struct Player{
        mapping(uint => uint) amounts;

    }

    struct Match{
        address [] playerAdresses;
        uint [] totalBets;
    }

    mapping(address => Player) public playerInfo;
    mapping(uint => Match) public matchInfo;
}

I get the error TypeError: Internal or recursive type is not allowed for public state for both playerInfo and matchInfo. However when I remove both uint [] totalBets and mapping(uint => uint) amounts these errors go away. Exactly why does that happen?


texts: Is "transfer" a transaction or a call/message?

texts:
I wondered if "transfer()" function is a call or a transaction.

We know contracts only send messages, not transactions.

If a DAO-like contract has a variable and a threshold when the variable reaches the threshold the contract automatically transfer some Ether to an account.

Question: Is this transfer of Ether (done using transfer()) a message or transaction?

In general, I'd like to know how transferring Ether from a contract account to someone is described in terms of a transaction/message.


texts: How to use async to get event logs in the for loop?

texts:
I want to get event log to do other thing, so I try to use for loop to get the event log in the websjs.

I try to use async and await, but order is wrong.

Here is my web3js sample code

    handleContractHistory: async function(event){
        var log_info = {};
        var abi = App.contracts.Crowdsale.abi;
        var ClientReceipt = web3.eth.contract(abi);
        var clientReceipt = ClientReceipt.at(my_contract_address);
        var event = clientReceipt.PurchaseLogs({}, {fromBlock: 0, toBlock: 'latest'});

        await event.get(function(error, logs){

          for(var index = 0; index < logs.length; index ++){
            log_info[logs[index].blockHash] = 1;
            console.log(logs[index].blockHash);
          }

        });

        console.log(log_info);
    }

Here is the result of console

{}
0x6b6c29cd8c693205d41*****************
0x6b628cd04b093b731e1*****************
0x6b6c29cd8c645eb54f2*****************

Does that have other way that can let function to wait to get the data in the loop?


texts:
Consensus Logic with an example

  Person A generates a transaction to pass some ether to person B
  The transaction is submitted on the node
  Node then passes that unconfirmed transaction to the whole connected network
  The miners pickup the unconfirmed transaction
  They start trying to randomly generate the nonce to find the correct hash
  So one of the miners finds the correct nonce to generate the block
  Now this miner sends this block to peer who then further send to the next peers and gradually everyone receives the block
  Everyone verifies the work whether it is meeting the criteria
  Once satisfied they include that block in their ledger
  Miner gets rewarded
  B's balance gets updated
  Thus A's payment is now confirmed

Questions:

Do you find any gap in the above listed flow? if yes please highlight
Is the block introduced in the blockchain when the miner has solved it or when it was confirmed by the peers?
If by peers then minimum how many needs to confirm?


texts: Can some one suggest a method to know the incoming transactions in a nodes addresses?

texts: I am trying to figure out a solution to find if there is any update in wallet address in my node i am using web3py.


texts: Deploying smart contract through Truffle

texts:
I want to know when deploying smart contract using truffle, is there a way to do that without using the migration files?

I won't be requiring the Migration features.


texts: Understanding the ".send" warning message

texts:
Warning: Failure condition of 'send' ignored. Consider using 'transfer' instead.

Is this a new compiler warning, and what exactly does it mean?


texts: how to deploy dapps into production (mainnetwork)

texts:
i'm newbee as a blockchain developer.I have deployed smart contract into ethereum test network.as part of next step i want to know what are the steps invovled in deploying blockchain at production level.

this is my smartcontract code and i tried to deploy into my own private network with muitple nodes.

pragma solidity ^0.4.0;
contract  {

  mapping(address => uint) public answers;
  string question;
  address asker;
  uint trues;
  uint falses;

  /// __init__
  function Questions(string _question) public {
    asker = msg.sender;
    question = _question;
  }

  function answerQuestion (bool _answer) public {
    if (answers[msg.sender] == 0 && _answer) {
      answers[msg.sender] = 1; //they vote true
      trues += 1;
    }
    else if (answers[msg.sender] == 0 && !_answer) {
      answers[msg.sender] = 2; //falsity
      falses += 1;
    }
    else if (answers[msg.sender] == 2 && _answer) { // false switching to true
      answers[msg.sender] = 1; //true
      trues += 1;
      falses -= 1;
    }
    else if (answers[msg.sender] == 1 && !_answer) { // true switching to false
      answers[msg.sender] = 2; //falsity
      trues -= 1;
      falses += 1;
    }
  }

  function getQuestion() public constant returns (string, uint, uint, uint) {
    return (question, trues, falses, answers[msg.sender]);
  }

}


texts: Does ETC have wallet which can use multi-signature wallet contract like Ethereum Wallet For ETH

texts: Does ETC have wallet which can use multi signature wallet contract like Ethereum Wallet For ETH?


texts:
I have a mining rig with EthOS on it. I would like to send all informations like hash rate, temperature, etc to my server. My question is how can I catch all the information from the rig in order to send it to my server?

Thanks in advace


texts: Cannot read from contract, even thought function is public

texts:
I am trying to read a contract I just deployed, and it seems I am unable to do so, as indicated by the symbol next to "NO".

This makes no sense, however, because the function is totally public. Here is the implementation:

function doesRequestExist(address _institution, address _beneficiary, uint _achievementId) public view returns (bool exists) {
    return requestedPayouts[_institution][_beneficiary][_achievementId];
}

Why am I not allowed to call this function?


texts: private network ether is 0 after block synchronization

texts:
i'm taking a course.

in this course we create a private network and create some ether(miner.start(1))

i check my account and i have some ether.

eth.getBalance(eth.accounts[0]) => 12

i practice some transactions between accounts.
we also practice making a simple contract and deploying it.

everything is fine.

a couple of days later i open geth console i check the balance and everything intact.

a couple of minutes later, without me doing anything, i see:

INFO [09-07|00:03:18] Block synchronisation started
WARN [09-07|00:03:23] Chain split detected                     number=1343 hash=83c5c1…1d6816 drop=161 dropfrom=dd2711…3610a4 add=129 addfrom=cae0a0…2f1d63
INFO [09-07|00:03:24] Imported new chain segment               blocks=177 txs=1 mgas=0.125 elapsed=3.276s mgasps=0.038 number=1520 hash=a361ad…f9eb65
INFO [09-07|00:03:28] Imported new chain segment               blocks=768 txs=0 mgas=0.000 elapsed=4.388s mgasps=0.000 number=2288 hash=b604e9…3f3143
INFO [09-07|00:03:36] Imported new chain segment               blocks=1435 txs=17 mgas=0.887 elapsed=8.004s mgasps=0.111 number=3723 hash=fa8f1d…b0f9c7
INFO [09-07|00:03:39] Imported new chain segment               blocks=485  txs=11 mgas=0.234 elapsed=2.632s mgasps=0.089 number=4208 hash=e61a89…7b02df
INFO [09-07|00:03:45] Imported new chain segment               blocks=1112 txs=13 mgas=0.731 elapsed=6.064s mgasps=0.120 number=5320 hash=14afe6…ffbab4
INFO [09-07|00:15:13] Imported new chain segment               blocks=1    txs=0  mgas=0.000 elapsed=7.481ms mgasps=0.000 number=5321 hash=d933c2…0b1f03
INFO [09-07|00:15:13] Imported new chain segment               blocks=1    txs=0  mgas=0.000 elapsed=10.734ms mgasps=0.000 number=5322 hash=2d4437…84ab97

check the account balance and it's 0.

maybe i haven't waited till the synchronization has actually finished?

can someone explain to me what is going on? and how can i fix it so i won't have to start over with the private network?


texts:
I want to uninstall pyethapp but I didn't found how to do this.

Someone can help me ?


texts: Is there a way to create an ERC20 token with an unlimited suplly?

texts: When you initially create an ERC20 token, you must declare totalSupply. Is that the hard cap on the number of tokens you can create or rather just the initial token supply?


texts: Send ether from web3 to fallback payable contract function

texts:
I'm trying to send some Ether to the payable function of my contract and I'm unable to find/understand a resource to do so.

Here's my attempt below:

Web3 App file (simplified, without initialisation functions) :

App = {
  sendEther: function(_value) {

    // Enter details to send transaction;
    web3.eth.getAccounts(function(error, accounts) {
      if (error) {
        console.log(error);
      }

      var account = accounts[1]; // send from account index 1

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

        return instance.sendTransaction({ // Something like this?!
          from: account,
          gas: 5000,
          value: _value
        });
      }).then(function(result) {
        console.log(result);
        return App.UpdateContractValues();
      }).catch(function(err) {
        console.log(err.message);
      });
    });
  }
};

Simplified smart contract:

contract Plant {

    address public creator;

    uint public finney_balance;

    function () payable public {
        finney_balance += msg.value/1000000000000000;
        depositedFunds(msg.value, finney_balance);
    }
}


texts: Same transaction in two consecutive blocks?

texts:
At some point in time, my local Geth node reported this tx http://testnet.etherscan.io/tx/0xa5b96f92520f18113061a3d7982709e1656988a74ce76760792f90e7ec92fb18 with the call eth.getBlock(1256437) in the block 1256437.

The same tx with the same hash appeared also on the next block 1256438 with the call eth.getBlock(1256438) at a later point in time.

Now, eth.getBlock(1256437) reports empty transaction list.

How can this happen? What is the edge case I'm not catching? Can we assume that the transaction data (from, to, gas, value, data, etc.) apart from the block number remains same between the "block hop" or is it possible for them to change also?

AFAIK, pending transactions/blocks are not the reason because I'm always calling getBlock(N) with N <= eth.blockNumber to make sure we are dealing with mined blocks only. Please correct if my assumption is wrong and eth.blockNumber returns the pending block number too.

Also, this is a fully synced node this happened with.


texts: View in a function makes the other not working

texts:
Sorry, new here. I look up everywhere but couldn't find an answer. Got these 2 simple functions. Can anyone explain why if i add "view " in the setUser function (first one) the other function Getuser is not working anymore
pragma solidity ^0.4.24;
contract SalaryInfo {
struct User {
uint salaryId;
string name;
string userAddress;
uint salary;
}
User[] public users;

function set_User(uint _id, string _name, string _address, uint _salary) public view returns(uint) {
    users.length++;

    users[users.length-1].salaryId = _id;
    users[users.length-1].name = _name;
    users[users.length-1].userAddress = _address;
    users[users.length-1].salary = _salary;

    return users.length;

}

function get_User(uint _id) public view returns(uint, string, string, uint,uint) {
    return(users[_id].salaryId, users[_id].name, users[_id].userAddress, users[_id].salary, _id);
}

}


texts: how is it different .deployed() and .new() ??

texts:
When I try to test my contract in truffle test javascript, how is it different to create new instant for my contract by instant = await myContract.deployed() and instant = await myContract.new()? is it same?
It seems like I have to use deployed in side beforeEach function as follows,

  beforeEach('for each test...', async function() {
    instant = await myContract.deployed();
  });

every time,to generate new instant then I have to use new(), If I just want to use the same instant in my each unit tests, then I have to use deployed()? Please correct me if I am wrong.


texts: Is it a good practice to create a new ERC721 NFT as needed?

texts:
I'm prototyping an asset management system using private blockchain and one of the main event is adding a new asset to the system. I was thinking about creating a new token when the asset is added to the system and assign the token to the owner of the contract by default.
Is it a good practice to create a new ERC721 token as needed?


texts: What types do "now" and "block.timestamp" return?

texts:
Is it a uint256 in the form of a standard UNIX timestamp?

Thanks


texts: Error encoding arguments: SyntaxError: Unexpected Token A in JSON at position 3

texts:
I was able to successfully deploy my first smart contract. But I am getting the runtime error. I am trying to create a new product structure for each wallet and trying to initialize the structure. As I am new I am not able to figure out what the issue is. Any help is appreciated.

pragma solidity ^0.5.0;

contract Product{
    uint public totalProducts = 0;
    struct ProductStruct {
        address productOwner;
        uint productId;
        string uniqueName;
        string platform;
        uint aspect1Score;
        uint aspect2Score;
        uint aspect3Score;
        uint aspect4Score;
        uint aspect5Score;
        uint totalScore;
    }

    mapping(uint => ProductStruct) public ProductStructs;

    function setProduct (string memory _productName, string memory _platform) public {
        totalProducts ++;
        ProductStruct storage newProduct = ProductStructs[totalProducts];
        newProduct.productOwner = msg.sender;
        newProduct.productId = totalProducts;
        newProduct.uniqueName = _productName;
        newProduct.platform = _platform;
        newProduct.aspect1Score = 100;
        newProduct.aspect2Score = 100;
        newProduct.aspect3Score = 100;
        newProduct.aspect4Score = 100;
        newProduct.aspect5Score = 100;
        newProduct.totalScore = 500;
    }

    function getProduct(uint _productId) public view returns (string memory _uniqueName) {
        _productId = totalProducts;
        return ProductStructs[_productId].uniqueName;
    }
}


texts: Abstract contract not inheriting constructor from parent abstract contract

texts:
I'm using solidity 0.7.1 and I seem to be running into issues while inheriting from an abstract contract. Specifically with the open zeppelin library, now I'm not creating an issue there because their code seems correct. Moreover my issue seems rather to be a lack of understanding on my part or a potential flaw in the design of solidity.
The Problem
I'm mainly using 2 abstract contracts from the library ERC20 and ERC20Burnable with ERC20Burnable inheriting from ERC20. Now ERC20Burnable just adds 2 burn methods to ERC20 so it doesn't do anything with the constructor. However when I just inherit from ERC20Burnable in my contract and call upon it as if it had a constructor I expect it to go up the ancestor chain and simply use the constructor of ERC20 since it is inheriting from it. But instead the compiler throws an order. Instead I have to import ERC20 as well, inherit from it too and use it's constructor directly.
Is this the intended behavior? This feels contradictory to the nature of abstraction but I suppose this may be done because security concerns. Any ideas?


texts: Homestead and Frontier Wallet Compatibility

texts:
If you have the json file and you can check the balance via etherscan or etherchain or via web3/geth it's on the "live frontier net".

Why are there so many people questioning wallet compatibility between Frontier and Homestead, are there risks with incompatibility? What changes will Homestead introduce to wallets, if any?


texts: How does EIP-55 prove a string is ACTUALLY a valid Ethereum address?

texts:
I wonder how EIP 55 check proves an address is actually an Ethereum address, or does it prove this at all?

Am I missing an obvious point in Vitalik's code below from EIP 55?

from ethereum import utils

def checksum_encode(addr): # Takes a 20-byte binary address as input
    o = ''
    v = utils.big_endian_to_int(utils.sha3(addr.hex()))
    for i, c in enumerate(addr.hex()):
        if c in '0123456789':
            o += c
        else:
            o += c.upper() if (v & (2**(255 - 4*i))) else c.lower()
    return '0x'+o

def test(addrstr):
    assert(addrstr == checksum_encode(bytes.fromhex(addrstr[2:])))

P.S. I've checked the answers here and here, but none answer my exact question.


texts: log output of modified function to geth console

texts:
To analyze the execution time of different opcodes I've created the following modifications to the go-ethereum file instructions.go:

func opAdd(pc *uint64, evm *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {

    // begin execution time tracking
    var startTime = time.Now().UnixNano();

    x, y := stack.pop(), stack.pop()
    stack.push(math.U256(x.Add(x, y)))

    evm.interpreter.intPool.put(y)

    // log ellapsed execution time
    fmt.Println("execute opAdd consume = ",(time.Now().UnixNano() - startTime))

    return nil, nil
}

I've attached to the client accordingly:

geth attach ipc:/Users/s.matthew.english/Library/Ethereum/testnet/geth.ipc

However, when I call a contract I've deployed to the ropsten testnet like so:

> var contractAbi = eth.contract([{"constant":false,"inputs":[{"name":"count","type":"uint256"}],"name":"increment","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"getIteration","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"}]);

undefined

>  var myContract = contractAbi.at("0x8705C513da621a16fd1dEFc9dE8aE7CDEAD01Fb8");

undefined

> var getData = myContract.increment.getData(666);

undefined

> personal.unlockAccount(eth.coinbase, 'hunter2');

true

> web3.eth.sendTransaction({to:"0x8705C513da621a16fd1dEFc9dE8aE7CDEAD01Fb8", from:"0xd7a9a61a480d458a1181e0563b07f944df4489a6", data: getData});
"0x506535adb4bf088a862f7e6194bf23c73bd2ad2086830bc028be766323ffef1c"

> myContract.address

"0x8705C513da621a16fd1dEFc9dE8aE7CDEAD01Fb8"

> myContract.getIteration()

668

But I don't see those opcode execution times anywhere.

How can I make sure to log them to a place where I can actually observe and examine them?

More generally, what is the procedure to ensure that a function will write output to the console?


texts: Mix doesn't render browser window - "unable to resolve the server's DNS address"

texts:
I am trying to do the Mix getRating tutorial from GitHub.  After I enter the solidity code and the html code, the Mix status bar indicates that it compiled successfully. However, the browser windows show an error icon with the message "Unable to resolve the server's DNS address."  The status bar of the browser window shows:  http://localhost:50939/index.html.

When I click on refresh, the Mix status bar gives the following error message:
WebContainer.html - line 46 - Uncaught SecurityError: Blocked a fram with origin "http://locahost:50939" from accessing a frame with origin "null". The frame requesting access has a protocol of "http", the frame being accessed has a protocol of "data". Protocols must match.

I am running Mix 1.0.1 and Mac El Capitan.
Thanks!


texts: Transfer tokens from Smart Contract to address using signTransaction + private key

texts:
I tried several links like this one, but when I call transfer function from contract and try to send tokens, its sending 'ethers' not 'tokens',
how can I send tokens by signing a transaction offline using private key and later uploading it to network?

Any help would be appreciated a lot!

Thanks,
Surinder


texts: Assigning memory values to storage compiles?

texts:
i came across some weird problem between storage and memory variables.
In my contract i have the following function. the first snippet of code does work. the second doesn't but it does compile!

so i am asking if assiging memory struct doc to a storage variable Documents[hashed] is possible but doesn't work ? when i tested the second snippet i can send transaction and it gets mined with no errors but Documents[hashed] doesn't change at all, but with the first snippet it does change.

Isn't the second snippet supposed not to compile ?

First snippet

function addNewDocument(string hash, string name){
    Document memory doc =  Document(hash,name,bytes32ToString(bytes32(now)),0);
    bytes32  hashed = keccak256(hash,name);
    Documents[hashed]=Document(hash,name,bytes32ToString(bytes32(now)),0);
    DocumentAddresses.push(hashed);
    UserHashes[msg.sender].push(hashed);
}

Second snippet

function addNewDocument(string hash, string name){
    Document memory doc =  Document(hash,name,bytes32ToString(bytes32(now)),0);
    bytes32  hashed = keccak256(hash,name);
    Documents[hashed]=doc;
    DocumentAddresses.push(hashed);
    UserHashes[msg.sender].push(hashed);
}

EDIT :
this is how i am calling these methods, nothing special.

    Web3C.methods.addNewDocument(Document.hash,Document.name).send({gas: 3000000, from: accounts})
.then(
    result => {
          //console.log(result);
           res.send(result);
            }
             ).catch(
              err => {
                   res.status(err.statusCode || "500").send({"Web3 Error":err });
                       }
                       )

WebC is the ontract instance created by reading the ABI and setting an address. I am using web3 1.0 beta 30 with NodeJs and Express.

EDIT2 :

Web3C.methods.getHashes().call({gas:3000000, from : accounts}).then(
data=>{
console.log(data);
let Myhashes = data.hashes;
let MyDocuments =[];
let number =0;

for(let hash of Myhashes){
   Web3C.methods.getDocument(hash).call({gas: 3000000, from: accounts})
       .then(
           result => {
               console.log(result);
               // result. time is the value of now on the solidity side
               result.time= web3.utils.toBN(result.time);
               ipfs.getContent(result.hash).then(
                   data=>{
                       result.hash=data ;
                       MyDocuments.push(result);
                       number++;
                       if(number==Myhashes.length){
                           res.status(200).send(MyDocuments);
                       }
                   }
               )

           }
       ).catch(
       err => {
           console.log(err);
       }
   )
}
}
)


texts: Hardware wallets and Plausible Deniability

texts:
One question referring to these articles:

https://blog.trezor.io/hide-your-trezor-wallets-with-multiple-passphrases-f2e0834026eb

and

http://support.ledgerwallet.com/knowledge_base/topics/advanced-passphrase-options

My question is: is it really already plausible with just 2048 words? Could an adversary not just brute-force all 2048 combinations and check if there are transactions on the blockchain behind these addresses? I think finding an address in this space could already make it unplausible - but I am not yet sure - hence I ask ;-)
Still like the idea and think it is a very good decoy - but I am not yet sure if it counts as "plausible".


texts: Error: while migrating Event: invalid address (arg="benificiaryAddress", coderType="address", value=undefined)

texts:
let Event = artifacts.require("./Event.sol");

const field= {
    nameOfEvent : "Music",
    ticketCount : 100,
    ticketCharge :10000,
    durationInMinute :1200
  }
module.exports =async function(deployer,accounts){
    await deployer.deploy(Event,field.nameOfEvent,field.ticketCount,field.ticketCharge,field.durationInMinute,accounts[1]);
}

My Contract Event is expecting an address at deployment time and I am using ganache.


texts: How do DApps that don't need their users to run Ethereum nodes or Metamask work?

texts:
For example,
A website which will give the option to register an ethereum account. The user would hit the register button and the server, which I assume is running a node 24/7 and will generate an account via web3.eth.personal.newAccount. The server then sends back the public and private key for this account to the user.

Now the website also has the option to allow users to deploy a smart contract. To do this I assume they would send their public key/private key and the server will use this to deploy the contract from the users account after unlocking it.

But this account would have 0 ether since the user isn't mining with it because they don't even have an ethereum node. Another solution could be the server has one account which contains ether as the server is mining. The server then deploys all contracts from this one account on behalf of the other users but declares them as the owner of the contract in some way.

Could someone clarify what approach is taken to implement such a website?


texts:
I have a code like

modifier inTime {
    require(now <= starttime + duration);//easy peasy
    _;
}

applied to a fallback function like this

function() payable inTime{
    depositDone(msg.sender, msg.value);
}

The logic is "accept money only within duration, reject thereafter". I would expect a payment sent too late is rejected and money safe in the pocket of sender, but I also expect the gas is consumed. Instead, I see the transaction is refused with no gas used at all. Hence my question, when modifiers are evaluated? Are they evaluated by miners or by client wallets?


texts: Debugging smart contracts through a dApp using Ganache+MetaMask, any suggestion?

texts:
I'm debugging a smart contract through a dApp I built. The contract I'm building has some adding and some removing. When I add something, everything works, but when I remove stuff then something explodes. Every time this happens I have to:

Kill the dapp
Kill ganache
Restart ganache
Rebuild the contracts if I changed something ad migrate them
Restart the dApp
Modify my address in MetaMask (importing the new ganache account or importing a new mnemonic)

I need to kill and restart Ganache because MetaMask gives weird errors like

Infinite loop (just the spinner going on forever)
Something about the blocks of the dApp being old
Errors about how the delete transaction needed more gas (which I believe it means my contract is doing too many things and I'm investigating why), which makes MetaMask behave weirdly and forces me to follow the above mentioned steps
Sometimes I issue a single request and there are 2 instead of one in queue, sometimes triggering the infinite loop thing

These errors can only be solved by restarting ganache and changing address.
So I'm really getting tired of doing this over and over, is there a way to make the debugging of a smart contract simpler?


texts:
I have created a contract and contract is successfully deployed. I can see it on 'https://rinkeby.etherscan.io/'
While accessing its ABI using web3
and paying money using meta mask

Smart contract code is

pragma solidity ^0.4.17;

contract mypool{
    address public manager;
    string poolname;
    uint256 poolEndDate;
    uint256 poolAmount;

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

    struct Payer {
        string name;
        address player;
        uint256 amount;
    }

    Payer[] public players;

    function enterPoolInfo(string name,uint256 endDate, uint256 amount) public {
        poolname = name;
        poolEndDate = endDate;
        poolAmount = amount;
    }

    function enter(string name,uint256 amount) public payable {
        require(msg.value > .01 ether);

        Payer memory m;
        // players.push(Payer{player:msg.sender,amount:amount});
        m.player = msg.sender;
        m.amount = amount;
        m.name = name;
        players.push(m);
    }

}

I got the following error

index.js:368 Uncaught (in promise) Error: Transaction has been reverted by the EVM:
{
  "blockHash": "0x9695b98f4e55b98103bb1282dfffbcbddac03002b1199789ea0f027b1baee09f",
  "blockNumber": 2775473,
  "contractAddress": null,
  "cumulativeGasUsed": 1755656,
  "from": "0xdc091bc86e95ae492cdd67abf051e7c7e3432d70",
  "gasUsed": 24017,
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "status": false,
  "to": "0xe0ef5f6d4b4f75f66bb96713c17549c1ded4af98",
  "transactionHash": "0xaed58f7d6c230f41b30c2d6f45e057e4d63188fa1542540767ee90aa9f567ba8",
  "transactionIndex": 18,
  "events": {}
}


texts:
I've installed the test version of Status.IM and tried to message other fellow users who were willing to share their contact with me. However, the messages are always stuck in sending status:

Why is my Whisper message not relayed in Status.IM? Is it not connected somehow, how to check the network status? Do I need Ether to utilize the Whisper protocol?


texts: Working on my first smart contract for college...Need help with one error!

texts:
pragma solidity ^0.4.0;

contract ZaPartnere {

address[] partneri = [0x118531D9C6C9114c8B999Ac1197778d1669Fc6c6, 0x029c2D637e193716246A55c62F2302a61FaC81dC, 0x36FFE679f923BdADd17E79Ce159DE80f779b512C, 0x78c426A0ABf24645d7e57267aFEe78688D86937d, 0xF7ffD689BFD99e03b7e1a6ebEc8Ee43877e49EEc];

uint TotalniIznos = 0;
    mapping (address => uint) PovuceniIznos;

    function ZaPartnerePodijela () payable {
        updateTotalniIznos();

    }

    function () payable {
        updateTotalniIznos();

    }

    function updateTotalniIznos() internal {

        TotalniIznos += msg.value;

    }

    modifier ProvjeraPartnera(){

        bool partner = false;

        for(uint i = 0; i < partneri.lenght; i++){

            if (partneri[i] == msg.sender){
                partner = true;

            }
        }

        require(partner);
        _;
    }

    function PovlacenjeSredstva(){

        uint SkupljeniIznos = TotalniIznos/partneri.lenght;
        uint KolicinaPovucena = PovuceniIznos[msg.sender];
        uint kolicina = SkupljeniIznos - KolicinaPovucena;
        PovuceniIznos[msg.sender] = KolicinaPovucena + kolicina;

        if(kolicina > 0 ){

            msg.sender.transfer(kolicina);

        }
    }
}

  //got error in remix - Member "lenght" not found or not visible after
  argument-dependent lookup in address[] storage ref for(uint i = 0; i <
  partneri.lenght; i++){

                                 ^-------------^


texts: Is there any network collision in Rinkeby?

texts: Am trying to deploy a test contract which is not getting mined and added. Trying for more than 2 days now, used the mist wallet to create it, chosen the highest price as per the mist wallet slider, but still not get updated. Is there any network congestion? Seems the main network also very slow in terms of blocks getting mined. Hope ethereum is good with its latest fork.


texts: why solidity 0.5.0 version code does not verify on etherscan?

texts:
The solidity version 0.5.0 at v0.5.0+commit.1d4f565a seems some issue while verifying at Etherscan.io

The contract I deployed:
https://rinkeby.etherscan.io/address/0x0ebeb14d4af5459a74c845e56947a37a9143cba0#code

Is compiling well in remix, but exact same parameters used in verifying at etherscan, and it is not verifying.

So, is there any issue in solidity 0.5.0 ?


texts: How will the transition from PoW to Casper's PoS work? Is there a spec written? Have there been any tests? Has code or documentation been written?


texts: not able to fetch bool value from contract using truffe

texts:
Index.html:

<input id="txtUser" type="text" placeholder="Enter user name" />
<button id="btnAuthenticate" onclick="App.Authenticate()">Authenticate</button>

contract:

function Authenticate(string name) view public returns(bool){
    return false;
}

calling it from app.js: Tried all the below ways but no luck

// Import the page's CSS. Webpack will know what to do with it.
import "../stylesheets/app.css";
import "bootstrap/dist/css/bootstrap.css";

//Import Jquery files
import jQuery from 'jquery';
window.$=window.jQuery=jQuery;

// Import libraries we need.
import { default as Web3} from 'web3';
import { default as contract } from 'truffle-contract'

// Import our contract artifacts and turn them into usable abstractions.
import sampleartifacts from '../../build/contracts/samplecontract.json'

// MetaCoin is our usable abstraction, which we'll use through the code below.
var sampleinstance = contract(sampleartifacts);

// The following code is simple to show off interacting with your contracts.
// As your needs grow you will likely need to change its form and structure.
// For application bootstrapping, check out window.addEventListener below.
var accounts;
var account;

window.App = {
 start: function() {
var self = this;

// Bootstrap the MetaCoin abstraction for Use.
sampleinstance.setProvider(web3.currentProvider);

// Get the initial account balance so it can be displayed.
web3.eth.getAccounts(function(err, accs) {
  if (err != null) {
    alert("There was an error fetching your accounts.");
    return;
  }

  if (accs.length == 0) {
    alert("Couldn't get any accounts! Make sure your Ethereum client is configured correctly.");
    return;
  }

  accounts = accs;
  account = accounts[0];

  //self.refreshBalance();
});
  },

Authenticate:function () {
sampleinstance.deployed().then(function (instance) {
var normalusername="sampledata"

    return instance.Authenticate(normalusername,{gas: 540000, from: web3.eth.accounts[0]}).then(function(v){
   console.log(v.toString());
 })
// return instance.Authenticate.call(normalusername,{gas: 540000, from: web3.eth.accounts[0]}).then(function(v){
//   console.log(v.toString());
// })
// return instance.Authenticate(normalusername).then(function(v){
//   console.log(v.toString());
// })
// return instance.Authenticate.call(normalusername).then(function(v){
//   console.log(v.toString());
// })
})

}
Below is the error:

Kindly help me in analyzing why i am not able to retrieve the bool value. Thanks.


texts:
I'm working on that smart contract :

pragma solidity ^0.4.24;

import 'openzeppelin-solidity/contracts/ownership/Ownable.sol';
import 'openzeppelin-solidity/contracts/math/SafeMath.sol';

import './Grocery.sol';

contract GroceryFactory is Ownable {
    using SafeMath for uint256;

    address[] public m_arGroceries;
    address public m_aMaintenanceAddress;
    address public m_aFeesAddress;
    uint256 public m_uPrice;

    constructor(address maintenanceAddress, address feesAddress, uint256 price) public payable{
        m_aMaintenanceAddress = maintenanceAddress;
        m_aFeesAddress = feesAddress;
        m_uPrice = price;
    }

    function getMaintenanceAddress() public onlyOwner view returns(address){
        return m_aMaintenanceAddress;
    }

    function setMaintenanceAddress(address maintenanceAddress)public onlyOwner {
        m_aMaintenanceAddress = maintenanceAddress;
    }

    function getFeesAddress() public onlyOwner view returns(address){
        return m_aFeesAddress;
    }

    function setFeesAddress(address feesAddress)public onlyOwner {
        m_aFeesAddress = feesAddress;
    }

    function setPrice(uint256 price) public onlyOwner {
        m_uPrice = price;
    }

    function getPrice() public view returns(uint256){
        return m_uPrice;
    }

    function getGroceriesCount() public onlyOwner view returns(uint){
        return m_arGroceries.length;
    }

    function getPools() public onlyOwner view returns(address[]){
        return m_arGroceries;
    }

    function () external payable {
        createGrocery();
    }

    function createGrocery() public payable returns(address){
        require(msg.sender != address(0), "Owner is null");
        require(msg.value == getPrice(), "Please send the deployment price");
        require(m_aMaintenanceAddress != address(0), "Maintenance address is null");
        require(m_aFeesAddress != address(0), "Fees address is null");

        address owner = msg.sender;

        Grocery groc = new Grocery(owner, m_aMaintenanceAddress);
        m_arGroceries.push(groc);

        transferFees();

        return pool;
    }

    function transferFees() private{
        uint256 balance = address(this).balance;

        if(balance > 0){
            m_aFeesAddress.transfer(balance);
        }
    }
}

  The debugger inside truffle keeps failing here:

  53: 54:     function () external payable { 55:
  createGrocery();
              ^^^^^^^^^^^^

  debug(development:0xb14493e4...)> o

  Transaction halted with a RUNTIME ERROR

.

What can I do ?


texts: How to send bytes in combination with array to contract

texts:
I see strange behavior when I try to execute some test contracts. I have made 2 test contracts,

contract TestContract1 {
        uint public n;
        uint public testValue1;
        bytes6 public value;

        function TestContract1(bytes6 val, uint[] testArray) {
                n = testArray.length;
                testValue1 = testArray[0];
                value = val;
        }
}

and

contract TestContract4 {
        uint public n;
        uint public testValue1;
        uint public value;

        function TestContract4(uint val, uint[] testArray) {
                n = testArray.length;
                testValue1 = testArray[0];
                value = val;
        }
}

These contracts are identical, except for the val, parameter, which is a uint in TestContract4 and bytes6 in TestContract1.

I execute contract #4 by the following code from geth:

var testContract = web3.eth.contract(abiArray);
var test = testContract.new(
   0x313131314141, [123,456],
   {
     data:contractCode,
     from: eth.accounts[0],
     gas: 1000000
   }, function(e, contract){
    console.log(e, contract);
    if (typeof contract.address != 'undefined') {
         console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
    }
 });

and I look at the different variables stored in the contract, all values are correctly stored and retrieved (i.e. n = 2, testValue1 = 123, value = 54087348470081).

When I execute contract #1 with the same code from geth, I get a correct value = 0x313131314141, but n and testValue1 have strange values (n = 10696049115004928, testValue1 = 562949953421312).

Can anyone tell me what's happening here? I.e. why runs the contract correctly when I define the first parameter as an uint and behaves strange when I specify it as a bytes6 type?

Thanks in advance.


texts: How to create and send Flashbot transactions?

texts:
So far, I only understand flashbot bundles are signed raw transactions with one of them being a bribe to the miner for the mining fee, but :

Is the bribing transaction special in the way it is valid for all all block.coinbase being used or is it valid only for a single miner? If yes, how do I build and sign such special formated bribing transactions?
In order to determine the gas price for standard/mempool transactions, there’s https://ethgasstation.info/, but how to compute the minimal amount for the bribe being sent to block.coinbase which would allow getting the bundle mined into a reasonable timeframe? I’m asking this in general and without considering competition because I imagine miners won’t accept transaction which doesn’t pay more than gas price and that the price to be paid isn’t flat in the way the amount of gas consumed still matters.
Since I’m not running my own node, how I can build such transaction bundles from my signed rawtransaction list, and how to submit them to the flashbots relay without running my own node once they are built into the correct binary format? Something which is not explained by https://github.com/flashbots/pm/blob/main/guides/searcher-onboarding.md
If I create my own mining pool, how can I receive flashbot transaction? Is there a place where I need to subscribe?

My interest, here isn’t to create transaction bundles since there’s a single transaction to perform in the case I’m interested in, but to get that transaction being mined first since flashbot transactions are mined at the beginning of the block (frontrunning transactions still using the mempool). And with the point that nobody is using flashbots yet.
Though I understand that I need to create a bundle of at least 2 transactions though since one of them must be for the miner.


texts: System requirements for high capacity node?

texts: I want to build a dedicated geth + parity machine that can have lots of connections to the network. What advice is there for system requirements if I want at most 100 connections? 1000 connections? How do the requirements scale with connection count?


texts: I wanted to buy tokens with ETH and send directly from my brocker to the token selling company, the transaction failed. is there a way to recover my ETH?


texts: smart contracts and ICO: how to begin with when low speed connexion, old computer, low code understanding?

texts:
Question: having read https://www.ethereum.org/ and documentation regarding a) designing a token and b) kickstart a project, I wander what is the best way for a beginner like me to run a project crownsale, assuming 1) my PC connection in remote place is really quiet low, 2) my PC is old without any high speed graphic card, 3) my code understanding level and my hability to code is limited (I'm not coder, but I code arduino, web site, LaTex, etc ...) ?

Do my self , Or use a pre-existant smart-contract on-line service?

Sorry for this very beginner question.

Thank you.


texts: Contract deployment without solidity online compiler

texts:
I am new to the dApp development. I want to deploy a contract to Ethereum through a website i am building. However i don't want the user to do it through the solidity online compiler or mist wallet. I want the user to press a button and the contract to automatically deploy on the Ethereum (backend function). I am using meteor for this project. Any suggestions on how to implement something like that?
Thank you


texts: Event to track transactions on the backend

texts:
I'm currently developing a betting website built on top of Ethereum and am facing the following doubt.

In my contract there is an event at the end of the placeBet function which tracks the summary of the bet:

event NewBet(address, uint, string, address[], uint[]);

   function placeBet(uint gameID, string teamID, address[] tokens, uint[] amounts) public returns(bool) {

       // ... Add bet logic ...

       emit NewBet(msg.sender, gameID, teamID, tokens, amounts);

       return true;
   }

and on my backend I'm scouting for this events in order to add a bet to my off-chain database:

MyContract.events
  .NewBet({
    fromBlock: 0
  })
  .on('data', event => {
    // Get data from event object and add it to mongoDB
  })

1. How safe is this? Can I 100% assume that if the event is fired then the bet was placed and I can safely add it to the database? The event is fired very fast on rinkeby and I'm worried a little bit.

2. What if many many users bet at the same time, will my subscription catch all those event and add them all to mongoDB database one by one?

3. Is this generally how people do this kind of things?

Just a side note: Yes, I really need this Bet objects in my mongoDB, it's not enough for me to store them on the blockchain.


texts: Syntax Error & how pay( ) would execute without explicitly calling pay( )?

texts:
I am getting a syntax error in the following code:

pragma solidity ^0.5.1;
contract C {
  function pay(uint n, address payable d)public {
    d.send(n);
  }
}

contract D1 {
  uint public bal = 0;
  function() external {
    bal+n;
  }
}

Syntax error is:

  two_send.sol:16:29: Error: Undeclared identifier.
    function() external { bal+n; }

In the call:

d.send(n);

Q1:I am sending 'n' to D1's fallback function. How can we add 'n' to 'bal'?

Q2:Also I am not calling 'pay()' explicitly in contract 'C', is it not necessary? How the pay would execute if we won't call it explicitly?

Somebody please guide me.


texts: What happens to royalty payments if NFT artist loses wallet?

texts:
when NFTs are minted, the creator/artist is registered in the smart contract as a recipient of all future royalty payments from secondary sales of their NFT.
People lose wallets all the time: forgotten seed phrase, computer with software wallet died, etc
What happens if the NFT creator loses access to that wallet address that was registered to receive those royalties (the address with which they minted the NFT)? Can the smart contract be updated with their new royalty address (new wallet address)?
majority of people log into NFT platforms by connecting their wallet via Metamask, not with log-in names. meaning, they are identified purely by their wallet, and not even the NFT platform log-in process can be re-configured to redirect previous contracts to some  new wallet address in my opinion


texts: How to get the non-packed solidityKeccak hash in Python Web3

texts:
For
Web3.solidityKeccak(['bool'], [True])

, Python Web3 yields: 0x5fe7f977e71dba2ea1a68e21057beebb9be2ac30c6410aa38d4f3fbe41dcffd2
This matches the output of keccak256(abi.encodePacked(true)) in Solidity. However, I want the output of keccak256(abi.encode(true)) because my contract has to deal with variably-sized data structures.
In Web3 JS, I could get the correct output (0xb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6) using:
web3.utils.soliditySha3(web3.eth.abi.encodeParameters(['bool'], [true]))

How do I get it from Python Web3?
Of course I don't need the hash of a boolean. This just serves as an example for easy verification that the correct encoding was used.


texts: How can you know the length of array of dyanmic strcutures?

texts:
pragma solidity ^0.4.24;

contract online_shopping{

    struct item {
        uint price;
        string name;
        //string seller;

    }
    struct soldItems{
        address customer;
        uint tprice;
    }

    mapping (address=>uint) sold;
    uint public number;
    uint public totalPrice;
    item  [] public items;
    //soldItems [] public si;
    uint public len;
    address public owner;
    constructor () public{
        owner=msg.sender;

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

    }

    function  addItems(uint _price,string _name) public onlyOwner  {

        items.push(item({
            price : _price,
            name : _name
           // seller : _seller
        }));

    }
    function () payable public{}

    function  sellItems (uint _number,string _name)public payable returns(bool)
    {

        number=_number;
        bool f;
        uint p;

        len=items.length;
        for(uint i=0;i<items.length;i++)
        {
            if (keccak256(abi.encodePacked(items[i].name))==keccak256(abi.encodePacked(_name)))
            { f= true;p=i;}
            else
            {f=false;}
        }
        if(f==true)
        {
          totalPrice= items[p].price*number;
        }

        if(msg.value>totalPrice)
        {
            address(this).transfer(totalPrice-msg.value);
            return true;
            sold[msg.sender]=totalPrice;
        }
        else
        {
            return false;
        }
    }

}

I tried to read the length separately, but it is showing zero length.


texts:
How hard is it to implement rewards into ERC20 Tokens? By this I mean a ERC20 Token that receives a reward in the form of Ether from a rewardAccount that is distributed evenly between all tokens.
After some basic searching I found this question:
How to send some ether to all token holders?
https://ethereum.stackexchange.com/a/5811/3660

To make sure everyone can get their ether, have each recipient call a withdraw() method in your contract. Within that method, do whatever update you need to record the withdrawal, then say if (!address.call.value(x)()) throw;. If the recipient doesn't include enough gas, everything gets rolled back and he can try again.
If you do this, you no longer have to worry about finding all token holders. This also prevents the problem of having so many people in the loop that you exceed the gas limit of the entire block.

The DAO had its own withdraw() method to allow DTHs to withdraw reward tokens:
Code from DAO.sol on Sock.it's DAO Github page
/// @notice Withdraw `_account`'s portion of the reward from `rewardAccount`
/// to `_account`'s balance
/// @return Whether the call was successful

 function withdrawRewardFor(address _account) internal returns (bool _success);

function getMyReward() noEther returns (bool _success) {
  return withdrawRewardFor(msg.sender);
}

Here is the withDrawRewardFor() Method/function code which mentions the rewardAccount http://pastebin.com/BuTZBWRU
So it seems that the two parts to get working correctly to have a ERC20 Token with Rewards is the rewardAccount (in the DAO, this was a ManagedAccount, which you can find on Slock.its DAO github page, ManagedAccount.sol) and the withdrawRewardFor() method.
Is this the best way to do it? Security issues? Anyone doing something similar?


texts:
I am wondering if it is possible to cast a contract-reference to an address payable (in order to send to it money) or if it is possible to declare a contract-reference directly payable (with solidity > 0.5.0). So that the function transfer can be used.

To make the question more clear, I provide here a minimal example:

contract A {
     function() payable {
          // fallback logic goes here ...
     }
}

contract B {

    constructor() payable public {
        A a = new A();
        address payable receiver = address(a); // cast goes here
        receiver.transfer(msg.value);
     }
}

Concretely, how can I send money to A via transfer?


texts: How many ether user eventually get after trading in this smart contract?

texts:
I'm exploring method trade of this smart contract that looks like the following:

  function trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount) {
      //amount is in amountGet terms
      bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
      if (!(
              (orders[user][hash] || ecrecover(sha3("\x19Ethereum Signed Message:\n32", hash), v, r, s) == user) &&
              block.number <= expires &&
              safeAdd(orderFills[user][hash], amount) <= amountGet
          )) throw;
      tradeBalances(tokenGet, amountGet, tokenGive, amountGive, user, amount);
      orderFills[user][hash] = safeAdd(orderFills[user][hash], amount);
      Trade(tokenGet, amount, tokenGive, amountGive * amount / amountGet, user, msg.sender);
  }

Could you please answer the following questions:

What's difference between amountGet and amount arguments?
How can I eventually know how many ETH user got when selling ARC token in this transaction ? Does amountGive give me this value?

Decoded input of this transaction is:

  inputs: [
        '0xac709fcb44a43c35f0da4e3163b117a17f3770f5',
        '2500000000000000000000',
        '0x0000000000000000000000000000000000000000',
        '13775000000000000000',
        '3156959',
        '3696351802',
        '0xd8eeda4ee2657bb267bc35c1d60babdc5aedd269',
        '28',
        'b4bf0dcd37ca73bd5abce9532b033dcc6427be160683de113efca41320c27f3e',
        '78799d84040e5c245828b1b531ef97e1af124946f4dc1db5a20cf28a7073b269',
        '726181804936299500000'
    ]

Thanks for your answers in advance!


texts: CheckMarx Docker based Example: Installing the ganache and Truffle again

texts:
I am trying to work on an example provided at:

CheckMarx Example

$ ./ddenv
Pulling ganache (trufflesuite/ganache-cli:latest)...
ERROR: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
zulfi@lc2530hz:~/solidity-ddenv$ ./ddenv
Pulling ganache (trufflesuite/ganache-cli:latest)...
latest: Pulling from trufflesuite/ganache-cli
5d20c808ce19: Pull complete
50ae34e155d6: Pull complete
f9ababc18615: Pull complete
05d711c49f92: Pull complete
3acbdde6eb14: Pull complete
87e1f85f1d0c: Pull complete
097623d3239f: Pull complete
06a051608e02: Pull complete
c019985a5729: Pull complete
51e424e6b1c2: Pull complete
1d24a8032d87: Pull complete
Building truffle
Step 1/4 : FROM alpine:latest
ERROR: Service 'truffle' failed to build: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

I think the script has already installed ganache, is it necessary to install Truffle because I already have Truffle installed on my machine?

I have Ubuntu 18.04 installed on my machine.

Somebody please guide me.

Zulfi.


texts: Referencing interfaces from other contracts

texts:
I am trying to deploy a contract which has an external function with no implementation body. Remix and truffle have problems with this. I know that abstract interfaces can't be deployed, but how were contracts like this deployed? The deposit function is empty :https://etherscan.io/address/0xc7029Ed9EBa97A096e72607f4340c34049C7AF48#code

My contract has a function similar to

    function deposit()
    external
    payable { }

I planned to reference my deployed contract using something like:

DeployedInterface constant private DeployedCOntract = DeployedInterface(deployedInterfaceAddress);


texts: trying to transfer HEX token from my mobile(android) metamask wallet to my laptop(chrome) metamask wallet

texts:
Didn't comprehend what a headache MetaMask (android) was going to be. Long story short, gave up trying to stake HEX tokens from my mobile device. I went to my laptop and discovered the android/chrome wallets had no linkage, and I would need to transfer from android to chrome.
On android, my eth to hex conversion was confusing, because the tokens would not show in MetaMask wallet until I finally discovered the wallet had to be associated/linked to the HEX contract;
0x2b591e99afE9f32eAA6214f7B7629768c40Eeb39. Once I (accidently?) accomplished this breakthrough, my tokens where available to transfer to my chrome MetaMask wallet.  Several attempts were unsuccessful, returning invalid key string message. I check several times, I was entering the same address I had successfully transferred some eth to earlier. So my confused solution (oops), was to use the HEX contract address to transfer my HEX tokens to;  0x2b591e99afE9f32eAA6214f7B7629768c40Eeb39.
Here is the transaction hash, 0xb3a31cebcecdebab8d521ab38bca3f93e3595615903da16d72573c17b9e72295
so I have plenty of info to prove where the tokens came from, and where they went.
Here is a pdf copy of transaction details.
https://documentcloud.adobe.com/link/review?uri=urn:aaid:scds:US:83596197-96d1-457c-90e2-d2a69c409dba
I've read that these tokens may or may not be recoverable, depending on the structure of the token contract. Who do I contact, or how can I determine, if I can be reunited with these little asterisks?
(all I wanted to do was experience my 1st airdrop, and ohh what a strange journey it's been)


texts:
I created my genesis.json, then init it into 2 different paths. But these 2 path didn't contain same genesis file.

How to make these 2 use same genesis file? Or How an I wrong?

This is my genesis.json

{
"config": {
        "chainId": 10701,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },

  "alloc"      : {
  "0x0000000000000000000000000000000000000001": {"balance": "2000"},
  "0x0000000000000000000000000000000000000002": {"balance": "5000"}
    },

  "coinbase"   : "0x0000000000000000000000000000000000000000",
  "difficulty" : "0x00100",
  "extraData"  : "",
  "gasLimit"   : "0x2fefd8",
  "nonce"      : "0x0000000000002378",
  "mixhash"    : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp"  : "0x00"
}

Command for first path.

geth --datadir "E:\blockchain\database\node a" --networkid 10701 --nodiscover --nat none -identity node1 init C:\Users\ZephyR\Desktop\genesis.json

geth --datadir "E:\blockchain\database\node a" --networkid 10701 --nodiscover --nat none -identity node1 --rpc --rpcapi "web3, etc, personal" --rpccorsdomain "*" console

Command for second path.

geth --datadir "E:\blockchain\database\node b" --networkid 10701 --nodiscover --nat none -identity node2 init C:\Users\ZephyR\Desktop\genesis.json

geth --datadir "E:\blockchain\database\node b" --networkid 10701 --nodiscover --nat none --datadir node2 --rpc --rpcapi "web3, etc, personal" --rpccorsdomain "*" --rpcport 2222 --port 30302 --ipcpath node/geth.ipc console

However, It's work on ubuntu.


texts: What is the meaning of "0": "uint8 255"?

texts:
In the console, I am getting:

  Decoded output { “0”: “uint8:  255” }

and in the return value I am getting:

  0: 0x00000000000000000000000000000000000000000000000000000000000000ff

What the above two things mean? and is the above converting "uint8" into uint256?

Some body please guide me.

Zulfi.


texts:
i am trying to create private POA network in which i have 3 aws ec2 ubuntu servers.
on 1st server bootnode and on 2nd server POA node1 is running and on 3rd server POA node 2 running.
but i am not able to connect the node1 and node2 also bootnode shows this error when i tried to just node2 to connect to

  DEBUG[09-17|02:27:35.307] ENR request failed                       id=7498feef0de4a2e6 addr=@ip:30312 err="invalid IP in response record: loopback address from non-loopback host"


texts: Using web3, how can you get the tx cost and data/payload for a given transaction?

texts:
Using web3, how can you get the Tx cost and data/payload for a given transaction?

getTransaction(tx#) returns everything but those 2 values. This information seems to be available via blockchain explorers such as etherchain.org


texts: Geth node not mining anymore since synced to new Ropsten testnet

texts:
After upgrading geth node to new Ropsten testnet node is not mining anymore, even though log messages seem it is trying to:

I0328 09:51:54.537322 miner/worker.go:542] commit new work on block 645501 with 3 txs & 0 uncles. Took 7.0169ms
I0328 09:51:54.510653 core/blockchain.go:1042] imported 1 blocks,     1 txs (  2.461 Mg) in  19.615ms (125.473 Mg/s). #645500 [decf1899â€¦]
I0328 09:51:49.199444 miner/worker.go:542] commit new work on block 645500 with 3 txs & 0 uncles. Took 10.9284ms
I0328 09:51:49.188250 core/blockchain.go:1042] imported 1 blocks,     0 txs (  0.000 Mg) in   8.887ms ( 0.000 Mg/s). #645499 [d7e75631â€¦]
I0328 09:51:41.826702 miner/worker.go:542] commit new work on block 645499 with 2 txs & 0 uncles. Took 1.0329ms
I0328 09:51:41.825596 core/blockchain.go:1042] imported 1 blocks,     0 txs (  0.000 Mg) in   2.866ms ( 0.000 Mg/s). #645498 [4fde3f80â€¦]
I0328 09:51:40.335148 miner/worker.go:542] commit new work on block 645498 with 2 txs & 0 uncles. Took 1.0338ms

The miner address is the following:

https://ropsten.etherscan.io/address/0xf28dafbfeb41bf32869c9d498da0d651d0206ed4#mine

The command line to launch geth node is this one:

geth --testnet --rpc --rpcapi "db,eth,net,web3,personal" --mine --etherbase "0xf28dafbfeb41bf32869c9d498da0d651d0206ed4" --gasprice "1000000000" --bootnodes "enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303,enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303"

After 2 days mining the geth node got 1 block mined:

https://ropsten.etherscan.io/block/653885

Before Ropsten the same node was mining at a rate of 2 blocks per hour, but now it mines at 1 block per day or even slower.

Any hint about what is happening? Thx!


texts: Check whether public address was derived from a private key

texts: I have several ETH accounts (and I own a private key from each one of them). I also have an address with a public key (holding some funds of course) but I totally forgot where this address came from. Is it possible to check whether an address was derived from a concrete private key? And if so, is there a way how to tell the derivation path by which the public address was created so I can get in control of my funds back again?


texts: how to get TXrecipt of transaction from within Solidity smartcontract?

texts:
I want to keep one condition where transaction status is derived from TXhash so
is there any way in where i can retrieve inside solidity smart-contract so that can get transaction status from it and check the condition.
so do solidity have any function like this?


texts:
I am synchronizing the archive node of the ethereum. Syncronization speed depends on the speed of the ssd disk and synchronizes with the speed 0.3 blocks per second. Now the 2700000 block is coming. It should take about 1 week.

Is it possible to get archive of chaindata directory or export file? Somebody posted a torrent file, but torrent is unavailable at the moment.


texts:
Getting error:  erc20 transfer amount exceeds allowance.
My source code is::
public async Task<string> TransferAsync(string from, string to, decimal amount)
{
DefaultAccount = new Account(privateKeyByte);

var client = new RpcClient(new Uri(WEB3_CLIENT_URI));

web3 = new Web3(DefaultAccount, client);

standardTokenService = new StandardTokenService(web3, CONTRACT_ADDRESS);

try
{
var finalAmount = amount * 1000000000000000000m;

var receipt = await standardTokenService.TransferFromRequestAndWaitForReceiptAsync(from, to, new System.Numerics.BigInteger(finalAmount));

return receipt.TransactionHash;
}
catch (Exception ex)
{
return ex.Message;
}
}


texts: truffle migrate command gives Error: Invalid Json Response: ""

texts:
I've cloned testrpc and have it running in a separate directory.  It's set to the default localhost:8545.  I've successfully installed truffle and ran truffle-init-webpack, then truffle compile.  When I try and migrate my contracts to the testrpc, i get the following error

Error: Invalid JSON RPC response: ""
    at Object.InvalidResponse (C:\Users\user\AppData\Roaming\nvm\v8.1.0\node_modules\truffle\node_modules\web3\lib\web3\errors.js:35:16)
    at XMLHttpRequest.request.onreadystatechange (C:\Users\user\AppData\Roaming\nvm\v8.1.0\node_modules\truffle\node_modules\web3\lib\web3\httpprovider.js:115:32)
    at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\user\AppData\Roaming\nvm\v8.1.0\node_modules\truffle\node_modules\xhr2\lib\xhr2.js:64:18)
    at XMLHttpRequest._setReadyState (C:\Users\user\AppData\Roaming\nvm\v8.1.0\node_modules\truffle\node_modules\xhr2\lib\xhr2.js:354:12)
    at XMLHttpRequest._onHttpRequestError (C:\Users\user\AppData\Roaming\nvm\v8.1.0\node_modules\truffle\node_modules\xhr2\lib\xhr2.js:544:12)
    at ClientRequest.<anonymous> (C:\Users\user\AppData\Roaming\nvm\v8.1.0\node_modules\truffle\node_modules\xhr2\lib\xhr2.js:414:24)
    at emitOne (events.js:115:13)
    at ClientRequest.emit (events.js:210:7)
    at Socket.socketErrorListener (_http_client.js:399:9)
    at emitOne (events.js:115:13)

I've checked my truffle.js file and it seems to be correct:

require('babel-register')

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

Any idea's why this would be happening would be greatly appreciated.

Edit: I'm on Windows 10, I'm using node 8.1.0 and Truffle 3.2.1


texts:
After initiation of transaction, transaction will remain in the transaction pool of all peered nodes.

How Transaction reach to the transaction pool after receiving by the node?
Do transaction broadcast to all known peer before reaching to its local transaction pool of node?