texts: How to separate ssh sessions with remote geth node?

texts:
I try to connect with my remote node for using geth. The safe interaction is provided with SSH-protocol.
My app can maintain stream of data between client and server (node), however when geth is doing synchronization (after the launch e.g.) it sends a lot of (needless) information about the process of sync (downloading blocks etc.)
Does it exist any approach to  separate ssh sessions, so as to one of these respond to my geth commands only without any information about sync?


texts: how to send ether from contract to Ethereum account

texts: I have 100 ether in my smart contract now I want to transfer the ether from contract to account automatically


texts: How to read "allevents" using Python web3 (there's capability in web3.js)?

texts:
Is there a mechanism to create a listener for all events being emitted from a smart contract for the python web3 library. There is a way to do it in web3.js:

myContract.events.allEvents([options][, callback])

However, I don't see a parallel in Python's library. There is a function to get all of the events in Hex but I am looking for the human readable version.

How to get events in Hex:

event_filter = web3.eth.filter({"address": contract_address})

web3.js documentation: https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#events-allevents
web3.py documentation: http://web3py.readthedocs.io/en/stable/filters.html


texts: Can't call "addLiquidityETH" Uniswap function from my contract

texts:
I'm a newbie, have been learning Solidity for 6 months now. I have been trying to fix this problem for couple of months but still got no hope.
I'm trying to learn how to add liquidity to Uniswap by using my contract.
The problem is when I'm trying to call addLiquidityETH from Uniswap on my contract with Remix it always failed and show the following errors.

Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
execution reverted: UniswapV2Library: INSUFFICIENT_AMOUNT { "originalError": { "code": 3, "data": "0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000025556e697377617056324c6962726172793a20494e53554646494349454e545f414d4f554e54000000000000000000000000000000000000000000000000000000", "message": "execution reverted: UniswapV2Library: INSUFFICIENT_AMOUNT" } }`.

Can anybody help me understand what's wrong with my code?
pragma solidity ^0.6.6;

interface IUniswap {
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);

}

interface IERC20 {
    function approve(address spender, uint256 amount) external returns (bool);
}

contract TestAddLiquidity {

    address internal constant UNISWAP_ROUTER_ADDRESS = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; // Ropsten

    IUniswap public uniswap;

    constructor() public {
        uniswap = IUniswap(UNISWAP_ROUTER_ADDRESS);
    }

    function addLiq(address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline) external payable {

        IERC20(token).approve(UNISWAP_ROUTER_ADDRESS, amountTokenDesired);
        uniswap.addLiquidityETH(token, amountTokenDesired, amountTokenMin, amountETHMin, to, deadline);
    }

}

It would appreciate it if you could give me some advice.
Thank you


texts: Transformation tool from geth genesis.json to parity format

texts:
Is there any tool transferring geth genesis file to the format accepted by parity?

I guess it could be done manually but it leave too much space for human factor.


texts:
This is in context of private blockchain setup.

In a business scenario there are lets say three\four category of parties. Now among these categories two of them are having quite a good number of parties. Lets say 10k parties under each of these two categories. Each party is having their own list of users.

What should be the criteria for deciding how many nodes are required. What kind of benefits one can think for owning a node. Is it preferable to have at-least one mining node for each transaction node.

Is there any technical constraint to keep in mind while deciding about the count of nodes which should be present?

It will be great if you please share your views.


texts: What does an "Ethereum-based token" mean?"

texts:
When reading about Ethereum-based tokens I've observed two types of implementations:

The token rides on top of the actual Ethereum blockchain (the main Ethereum network).  Example would be Golem (GNT).

or

The token rides on it's on Ethereum-based blockchain.  Example would be...?  Are there examples?

Is the term "Ethereum-based token" assumed to mean #1 (that it rides on top of the actual Ethereum blockchain)?


texts: Is there a way to recover ETH with Account Number and Password Only?

texts:
I have 1 ETH in an Ethereum Wallet. I would like to transfer it, but I am unable
to get the wallet functions to work due to another issue. (Mist not recognizing my 1 ETH) I know the wallet address and the password. Is there someway to recover the ETH, into another account or service somewhere?


texts: Error: "Expected ',' but got 'memory'" in Nodejs/truffle console when trying to compile

texts:
CompileError: /C/Users/Asusupernova/Downloads/TrufflePart2/contracts/Hello.sol:8:30: ParserError: Expected ',' but got 'memory'
    constructor(string _name memory) public {
                             ^----^

// SPDX-License-Identifier: MIT
pragma solidity^0.5.16;

contract HelloWorld {
    string private name;

    constructor(string _name memory) public {
      name = _name;
    }

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

    function setName(string _name) public {
      name = _name;
    }
}


texts: Getting "ValueError: intrinsic gas too low" when trying to make a basic swap on Quickswap (polygon/matic)

texts:
I'm using Brownie to try and make a basic swap on Quickswap:
from brownie import accounts, config, network, interface

def main():
    """
    Runs the make_swap function on the Uniswap pair address for two particular tokens, wbtc & weth
    """
    make_swap()

def make_swap():
    """
    swap two particular tokens, wbtc and weth
    """
    usdc = interface.WmaticInterface(config["networks"][network.show_active()]["usdc"])
    weth = interface.WmaticInterface(config["networks"][network.show_active()]["weth"])
    router = interface.IUniswapV2Router02(config["networks"][network.show_active()]["quickswap_router_v2_02"])

    acct = accounts.add(
        config["wallets"]["from_key"]
    )  # add your keystore ID as an argument to this call
    amountIn = 0.5*10**usdc.decimals()
    usdc.approve(router, amountIn, {"from": acct})
    amountOutMin = 0.000383501*0.5*10**weth.decimals() #checked this from external source - quickswap
    path = [usdc, weth]
    deadline = 3000
    tx = router.swapExactTokensForTokens(amountIn, amountOutMin, path, acct, deadline, {"from": acct, "allow_revert": True})
    print("Swap made!")
    return tx

The approve part goes through fine, but the actual swap gets reverted with the 'intrinsic gas too low' error:
    Brownie v1.14.6 - Python development framework for Ethereum

AaveFlashloanProject is the active project.

Running 'scripts/make_swap.py::main'...
Transaction sent: 0x8900880fa866f02dcde13eedffbb862c3fa8fcc6444078e159136984146fed94
  Gas price: 1.0 gwei   Gas limit: 50098   Nonce: 13
  WmaticInterface.approve confirmed - Block: 14979417   Gas used: 38198 (76.25%)

  File "brownie/_cli/run.py", line 49, in main
    return_value, frame = run(
  File "brownie/project/scripts.py", line 103, in run
    return_value = f_locals[method_name](*args, **kwargs)
  File "./scripts/make_swap.py", line 8, in main
    make_swap()
  File "./scripts/make_swap.py", line 27, in make_swap
    tx = router.swapExactTokensForTokens(amountIn, amountOutMin, path, acct, deadline, {"from": acct, "allow_revert": True})
  File "brownie/network/contract.py", line 1676, in __call__
    return self.transact(*args)
  File "brownie/network/contract.py", line 1550, in transact
    return tx["from"].transfer(
  File "brownie/network/account.py", line 615, in transfer
    exc = VirtualMachineError(e)
  File "brownie/exceptions.py", line 85, in __init__
    raise ValueError(exc["message"]) from None
ValueError: intrinsic gas too low

Here are my gas parameters from the brownie config file:
live:
gas_limit: auto
gas_buffer: 1.1
gas_price: auto
reverting_tx_gas_limit: true
default_contract_owner: false

I've tried adjusting gas limit to max, and gas_price to max, but doesn't seem to help.
Any ideas how to solve? And does Polygon even charge an intrinsic gas fee? I've looked on the block explorer and it looks like most similar transactions to this do go through with a gas price of 1...


texts: I want to write the smart contract architecture for a new smart contract on Ethereum ERC20, how can I do that, and what does it mean smart contract architecture.


texts:
I hope this is not a stupid question, but I am currently quite new to ethereum and haven`t found any other resource that explains this issue.

I am having a really simple contract:

pragma solidity ^0.4.18;

contract TextSave {
    uint public mostSent = 0;
    string public currentText = "Put your own text here!";
    address public owner = msg.sender;
    uint private maxLength = 50;

    function setText(string newText) public payable returns (bool) {
        if (msg.value > mostSent && bytes(newText).length < maxLength) {
            currentText = newText;
            mostSent = msg.value;
            return true;
        } else {
            msg.sender.transfer(msg.value);
            return false;
        }
    }

    function withdrawEther() external {
        require(msg.sender == owner);
        owner.transfer(this.balance);
    }

    function () public payable{
        setText("Default text!");
    }
 }

Now I would like to  display all saved texts that are on the blockchain?

How can I do that? Do I need to change the contract or can I just use web3 for that?

I highly appreciate your replies!


texts:
I recently moved some ETH to the Ethereum Wallet, but I must have committed a typo by accident when creating the password, as I cannot send it from the account now.

Can someone please help me understand how to use 'pyethrecover-master' as I have no clue how to.

https://github.com/burjorjee/pyethrecover


texts:
I have working truffle app that interacts with Ropsten Testnet but currently, I'm on my local machine environment at localhost:3000.

I want to deploy this app to heroku such that my ropsten testnet stills works as expected. I tried googling a lot and also tired some of the stuffs but nothing came around that could to solve my problem.

Here is my truffle.js file:

var HDWalletProvider = require("truffle-hdwallet-provider");

var infura_apikey = "my api key";
var mnemonic = "some awesome mneumonic";

module.exports = {
    networks: {
        development: {
            host: "localhost",
            port: 8545,
            network_id: "*" // Match any network id
        },
        ropsten: {
            provider: new HDWalletProvider(mnemonic,
                      "https://ropsten.infura.io/" + infura_apikey),
            network_id: 3,
            gas: 400000
        }
    }
};

And, here is my package.json file:

{
    "name": "decentralizedtodo",
    "version": "1.0.0",
    "description": "",
    "main": "truffle.js",
    "directories": {
        "test": "test"
    },
    "scripts": {
        "dev": "lite-server",
        "test": "echo \"Error: no test specified\" && exit 1"
    },
    "author": "Pramesh Bajrachaarya",
    "license": "ISC",
    "devDependencies": {
        "lite-server": "^2.3.0"
    },
    "dependencies": {}
}

This may be a noob question but, can someone please give a stepwise answer to the very process?

This will be helpful to me as well as future readers too.


texts:
I would like to create tokens where its price is pegged to the price of Ethereum (i.e. Ether price goes up, my token price goes up). Regardless of number tokens been sold or  changed hands.Is it possible? Any examples out there for such scenario?

Appreciate all your help. Thank you so much.


texts: Claymore hashrate always drops after socket closed; only driver re-install will recover

texts:
The prototype rig

2 x RX470 8GB Mining Edition GPUs (on Samsung mem) on latest Blockchain AMD drivers, flashed BIOS, etc.

The Claymore .bat file

timeout /t 15
setx GPU_FORCE_64BIT_PTR 0
setx GPU_MAX_HEAP_SIZE 100
setx GPU_USE_SYNC_OBJECTS 1
setx GPU_MAX_ALLOC_PERCENT 100
setx GPU_SINGLE_ALLOC_PERCENT 100
ethdcrminer64.exe -epool us1.ethermine.org:4444 -ewal 0xADDRESS.Rig001 -epsw x -mode 1 -tstop 85 -tt 65 -fanmin 40 -fanmax 100 -cclock 1150 -mclock 2150 -cvddc 850 -mvddc 875 -dcri 5
pause

Typical Hashrate

28.3 Mh/s per GPU. Decently happy with this - haven't pushed the cards very far. Drawing very little power. Pretty efficient.

The problem

The system runs very stable. It can go 5-12 hours without hiccups, low temperatures, the whole thing.

Every once in a while, however, there is a Socket was closed remotely (by pool) error in the console.

After this, there is no recovering the hashrate on one of my GPUs until I do a full driver re-install.

To be clear: restarting Claymore or Windows 10 itself will never get back to my 28.3 Mh/s regular rate.

Here's the Claymore output pinpointing exactly when this happens - and it always happens every day:

Now, I don't care that the socket is closed every now and then.. the recovery seems to be immediate.

...But why on earth do I suffer an irreversible drop in hashrate - particularly in one of my GPUs - after this?

DDU + Driver re-install + patch (with restarts in between) will 100% restore my hashrate.

Very strange, and hard to pass off as being hardware related.

Claymore 10.0. Everything I'm running is pretty much the latest as you'd expect as of Oct 11th 2017.

In ethermine.org you can see the corresponding drop:

I've seen several references online to mysterious drops in hashrate connected to either 1) lost connections, or 2) closing and re-opening Claymore, but I haven't seen anyone track down or identify this issue.

Thanks-


texts:
In truffle saving 1 struct exceeds the default gas of testrpc. Is this function poorly written, or is this common in truffle.

VM Exception while processing transaction: out of gas

solidity

pragma solidity ^0.4.2;

contract SimpleStorage {
  mapping(address => Pass[]) passes;

  struct Pass{
      string class_name;
      string first_name;
      string last_name;
  }

  function submitPass(string classname, string firstname, string lastname){
      passes[msg.sender].push(Pass({
          class_name: classname,
          first_name: firstname,
          last_name:  lastname
      }));
  }

}

React

touchedme(){
  simpleStorage.setProvider(this.state.web3.currentProvider)
  this.state.web3.eth.getAccounts((error, accounts) => {
    simpleStorage.deployed().then((instance) => {
      simpleStorageInstance = instance;
      return simpleStorageInstance.submitPass("Intro 2 Truffle", "Alain", "Gold", {from: accounts[0]})
    })
  })
}


texts: Splitting funds - How to do it quickly (synched TX)?

texts:
Changing blockchains and synching with Mist is a slow and hacky process so I wondered if there's a more immediate way.

The idea being : transfering funds from my duplicated accounts to new and unique accounts on both sides of the fork in the most synched possible fashion.

Has anyone experienced doing this in an efficient way ?


texts: How to avoid impersonation of a token with same name or symbol?

texts:
When you generate a token you can set a name and symbol, but this is not unique, that means that another smart contract made by another person may have the same name or symbol.

Is this a problem if a hacker wants to impersonate a token to make operations on behalf of the real token?

How can this be avoid? Or there is something in the creation of the token than makes impersonation not possible?


texts: Bad jump destination in escrow Smart Contract

texts:
This is an escrow smart contract deployed on testnet Ropsten: https://testnet.etherscan.io/address/0xd8be8771520addd926a3b454b4ea89a31d753359#code

When calling function start(address seller, address thirdParty) from geth node like this:

sc.start.sendTransaction("0x90e8682b63d7922a3e942d4bbd4c88095634a17b", "0xf28dafbfeb41bf32869c9d498da0d651d0206ed4", {from:"0x3b877e80b5c0b29d88f3768ed4292b35fdd93a9d", value:"0x3b9aca00", gas:1000000});

It creates a new transaction https://testnet.etherscan.io/tx/0x0fe57a93d9618f915fa822ba1b727147e04c11b23e523d6382ddd879020d98d9 throwing the following error:

Warning! Error encountered during contract execution [Bad jump destination]

The code of start() function:

function start(address seller, address thirdParty) returns (uint) {
    uint escrowId = numEscrows;
    numEscrows++;
    escrow memory e;
    e.thirdParty = thirdParty;
    e.seller = seller;
    e.buyer = msg.sender;
    e.amount = msg.value;
    e.recipient = seller;
    e.status = 1; // started
    escrows[escrowId] = e;

    escrowStart(e.buyer, e.seller, e.thirdParty); // Log

    return escrowId;
}

The event called is:

event escrowStart(address buyer, address seller, address thirdParty);

Strange thing is that the same code works well on Solidity Browser ( https://ethereum.github.io/browser-solidity/ ) but not on testnet.

Any help/ideas? Thx!


texts: How can I persist an assignment to a struct in a mapping?

texts:
The following is a simplification of the problem I'm facing;

pragma solidity 0.4.18;

contract ValueSetter {
  struct BasicValue {
    uint256 value;
  }

  address my_address; // Just for the require later
  BasicValue fixed_value;
  mapping(address => BasicValue) fixed_values;

  function ValueSetter(address init_address) public {
    my_address = init_address;
    fixed_values[init_address] = fixed_value;
  }

  function set_value(uint256 my_value) external {
    // Just to prove that the bug isn't in my calling params
    require(msg.sender == my_address && my_value != 0);

    fixed_values[msg.sender].value = my_value;

    assert(fixed_value.value != 0);
  }
}

When I call set_value with a non-zero value, I hit the assert. It looks like the problem is that in this line,

fixed_values[msg.sender].value = my_value;

my attempt to assign to the struct inside the mapping is not assigning to the struct stored in fixed_value. I've also tried the following instead;

BasicValue storage basic_val = fixed_values[msg.sender];
basic_val.value = my_value;

But this doesn't change the result. I read in the solidity documentation that,

  assignments between storage and memory and also to a state variable (even from other state variables) always create an independent copy

If that's the case, then how can I get a the struct "out of" the mapping, to use it locally?

(Notes; the contract above looks like it does ridiculously more complicated stuff than it needs to because the real contract has more requirements. For example, there's more than one attribute in the struct, there's more than one struct declared on initialization, there's more than one struct in the mapping, and I need to do logic involving more than one of them.)


texts: How can we retrieve the transaction address of any transaction?

texts:
Once a transaction is completed on Ethereum Wallet then we can see the address of the transaction in our geth console :
[ Tx("{txn address}") to: "{contract_address}" ]before mining starts. Pic attached for reference.

How can I capture that address and the address of contract which is shown just along transaction address in any format possible so that I can show the transaction address in UI ?


texts: Proof of stake, mauve paper - glossary of terms

texts:
Just getting my head around some of the concepts in Vitalik Buterin's Mauve paper.

There are a few terms for which I don't yet have a clear definitions. These include the terms below (shown with my present interpretation):

Validator - a computer that confirms validity of all (or part) of the Ethereum Virtual Machine (EVM) state
Epoch - a 100 hour window
Shard - a distinct chunk of the whole EVM state (see also this)
Dunkle - Proof of stake version of an uncle

I'm guessing these terms will eventually end up here, but, in the meantime, can anyone provide a glossary of terms for the mauve paper?


texts: Missing Token Contract Address in Rinkeby Network

texts:
I'm trying to create a crowdsale contract based on zeppelin-solidity. I'm using the following code to create the CROWDSALE contract, as well as TOKEN contract, based on this example.

pragma solidity ^0.4.18;

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

contract DreamToken is MintableToken {

  string public constant name = "Dream Token";
  string public constant symbol = "DMT";
  uint8 public constant decimals = 18;
}

contract DreamTokenCrowdsale is Crowdsale {

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

   }

   function createTokenContract() internal returns (MintableToken) {
     return new DreamToken();
   }

 }

The crowdsale contract is created and fully functional. I have also verified the contract in rinkeby.

However, there is something wrong with the TOKEN contract. The crowdsale contract shows that the token is created at this address but etherscan shows that there is no such address and I cannot verify the token contract.

When I send ether to the crowdsale contract address, it indeed sends the purchased tokens. But in etherscan it shows that the tokens are sent from '0x000..." address.

Can anyone suggest what am I doing wrong here?


texts: On-chain settlement based on off-chain activity

texts: I'm build a DApp where the end-user should be able to attach a proof (could be information, data, attachment, whatever). Now, if the DApp accepts this proof as being legit off-chain, then I want the end-user to be rewarded on-chain with a certain amount of tokens by the dApp. How can I establish this 'trusted' communication between the two 'realms'? Do I need an oracle for this? any input is appreciated!


texts: Why my ERC20 (EXOToken) deployed contract not display properly in etherscan?

texts:
Today I have deploy EXOToken smart contract on Ethereum mainnet, tx is here
But if look at this link, you can see,  that it's not look  like properly ERC20 smartcontract: there are no Token Contract capltion in Contract Overview section. And when I try  see through token veiew:
https://etherscan.io/token/0xe58e751aba3b9406367b5f3cbc39c2fa9b519789
it seems like etherscan don't recognize decimals (0 vs 18),  but if go to the ReadContarct  link one  can see,  that decimals=18.
Then I have deploy exactly same code  on Rinkeby net.  There is all OK in both view:
https://rinkeby.etherscan.io/address/0x0093f46784ab6b2c4de7985bb5dfa6cb5467c7f9
https://rinkeby.etherscan.io/token/0x0093f46784ab6b2c4de7985bb5dfa6cb5467c7f9
So on Rinkeby this smartcontract display as properly ERC20. Hence, all is ok with source code.
I think it can be connected with the fact that  some times ago  I have already deployd  smartcontract with same name (EXOLOVER) and Symbol (EXO) on mainnet. That is it:
https://etherscan.io/token/0xe52dc28df14d370436c25148b16e78d41b195e99
It`s not properly contract and it's never be work.
So What can I do  for properly  view  of  my contracr as soon as possible, becouse  ICO will start soon?


texts: How to process all includes in a .sol file? I want to produce a file with all includes recursively replaced with the included files content.


texts: Getting TX hash back but transactions not showing on blockchain?

texts:
So I upgraded geth yesterday to 1.3.4. I've been trying to send ETH to my Poloniex wallet, and every time I attempt a deposit my terminal returns a TX hash, but this hash never shows up in the block chain and my deposits aren't hitting Poloniex. My ETH wallet balance is exactly the same upon checking.

Has this been happening to anyone else? And can anyone tell me how to make the transactions go through?


texts: Passing an array as a parameter from javascrpt (web3) to a Solidity function

texts:
I have the following Solidity function:

function func(bytes32[2] data) external {
        bytes32 x;
        bytes32 y;

        x = data[0];
        y = data[1];
}

I'm trying to call it from Javascript (using web3), but passing an array a parameter doesn't work. I tried the following methods:

var arr = ["field1", "field2"];
contracts['MyContract'].contract.func(arr);

or:

contracts['MyContract'].contract.func(["field1", "field2"]);

or:

contracts['MyContract'].contract.func("field1", "field2");

None of those methods work.

Is there a way to pass an array as a parameter from Javascript to a Solidity function?


texts:
I have a function that requires a very strict type cast of either a 1 or a 2 for a uint. I got the part where the function will revert if the input is zero or over two. But I'm worried negative numbers can be passed. So my question...

Can solidity functions or the solidity language itself have negative numbers passed to it?


texts:
It seems to be making progress in the Web UI and it shows in the bottom right, "70% warp restore, Homestead, 1/26/50 peers". After about 70%, it seems to encounter an error and restarts the warp restore. In console, parity prints out the following and then starts "syncing snapshots" from 0/313 again. It always gets to about 160 and then restarts.

2017-06-18 17:59:45 UTC Syncing snapshot 160/313    #59186    3/26/50 peers   156 MiB db    3 MiB chain  0 bytes queue    9 MiB sync  RPC:  0 conn,  0 req/s, 195 µs
2017-06-18 17:59:50 UTC Encountered error during block restoration: Block error (Block has invalid PoW: Value 0 out of bounds. Min=735388763471630)

Any help would be much appreciated!


texts:
I have a basic understanding of the Blockchain and its tracking (reconciliation) process. What I like to know is whether the smart contract output can appear as a written document or other printed material?

Everything thing I read on it tends to describe and show the computer language coding process but not the actually useful information output for a layperson to use.

For example: If John agrees, then Rob gets funded, else Rob gets rejected and funds return back to John, etc. However, does it issue a visual view that appears on a webpage that shows "John sent ... XXX" on date, for your YYY., etc.

Just curious to know more. Thanks. Kindly make it simple please.


texts: How to prevent ERC20 token to be traded publically?

texts:
I am creating ERC20 tokens for real state products where investors can buy/sell tokens but we want to oversee buy/sell process. For example, when investor want to sell tokens to other persons, it should not happen unless we approve that transaction.

Is it possible technically to do that on ethereum or should we go with private ethereum network


texts: yellow paper: identifier for the final state

texts:
I've started to read the yellow paper and in section 2 it's written:
Blocks function as a journal, recording a series of transactions together with the previous block and an identifier for the final state (though do not store the final state itself that would be far too big).

What do they mean by identifier for the final state ? Where can we see it ? Is it appended to a variable ?


texts:
From the buy/sell example on ethereum.org:

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

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

In the sell function, I understand that Ether is transferred from the contract to the caller via:

msg.sender.transfer(revenue)

But in the buy function, I see nothing equivalent to ensure that Ether is transferred from the caller to the contract.

So how exactly does that take place? Does the keyword payable have anything to do with it?

Thank you!


texts:
Please help me to understand the situation:

I sent coins using an Ethereum transaction

0x0ae4b10100ddd1da0a22e6130903294dad57aa763a0a74580660904edc4512b2

Coins from the balance were written off but the address was not received, the transaction in the blockade by (0x0ae4b10100ddd1da0a22e6130903294dad57aa763a0a74580660904edc4512b2) does not appear!

Can coins disappear? Thank you


texts: Apart from array and mapping Is there anyway to store large number of user information in Ethereum blockcain?

texts:
I have a smart contract to store user information in Ethereum blockchain. For every new transaction entry gets added into map or array. This looks too costly in terms of storage. If I use map or array to store 1 lakh (100KB) user information then for every new transaction I will have to add a new entry to the map and plus 1 lakh [existing transactions] in the state.

Is there any other way to optimize this issue or are all smart contracts written in this way only?


texts: Recovering address (web3.eth.accounts.recover) does not return the address of message signer

texts:
I am writing a test for a function in my smart contract which attempts to verify that a message comes from the signer. I'm currently using web3.eth.accounts.sign to sign my message with the sender account. I then use the response hash (signedMessage) to recover my address.

const sender = accounts[0]

const message = web3.utils.soliditySha3('hello-world')
const signedMessage = await web3.eth.accounts.sign(message, sender)

const {signature, messageHash, v, r, s} = signedMessage

const recoveredAddress = await web3.eth.accounts.recover({
  messageHash: messageHash,
  v: v,
  r: r,
  s: s
})

console.log("sender: ", sender)
console.log("recoveredAddress: ", recoveredAddress)

This is what the terminal is outputting for my console.log:

sender:  0x627306090abaB3A6e1400e9345bC60c78a8BEf57
recoveredAddress:  0x170e85941BAeE85CFEA0cAd2EDf798DC5C287AA1

Why is the recovered address different from the sender address?

EDIT: The issue I was having was that I was using the public key to sign my message. I should have been using a private key.


texts: safest and most convenient way to iterate through items

texts:
So I am writing a contract on which I have to iterate through array items in order to check customer existence or remove a customer (and so on).

Remix tells me that my actual functions might consume a lot of gas, if that's the case, which is the best way to approach this?

Code:

    function IsUserDone(address user) private view returns(bool){
    for(uint256 i = 0; i < DoneCustomers.length; i++)
    {
        if(DoneCustomers[i] == user)
            return true;
    }
    return false;
}

function IsUserPending(address user) private view returns(bool){
    for(uint256 i = 0; i < PendingCustomers.length; i++)
    {
        if(PendingCustomers[i] == user)
            return true;
    }
    return false;
}

function TransferData(address dude) public {
    require(msg.sender == owner);
    require(IsUserPending(dude));

    for(uint256 i = 0; i < PendingCustomers.length; i++)
    {
        if(PendingCustomers[i] == dude){
            delete PendingCustomers[i];
            owner.transfer(total_price);
            AddDoneCustomers(dude);
        }
    }
}


texts: Truffle: cannot use drizzle for communicating between react app and blockchain

texts:
I am using Truffle for writing smart contract and using drizzle and drizzle-react for communicating with smart contract.

I have configured as tutorial said. After that, I try to print out:

this.props.contracts.MyContract

It will print a bunch of public state, public method on smart contracts ...
So I think when come to this step, there is no problem.

But when I try to call method as tutorial:

this.props.contracts.MyContract.methods.set(this.state.storageAmount).send()

I meet exception because inside this.props.contracts.MyContract, there is no methods object, so it will undefined. What am I wrong ? Please tell me.


texts: How to use Trust Wallet instead of Metamask on mobile browser?

texts: Most DApps makes use of meta mask to sign transactions. I want my dApp to Make use of trust wallet when its opened on a mobile browser. How do I do this


texts: R9 280 driver error not recognised on multiple R9 380 rig

texts:
I am on Windows 7 SP1 64 Bit.

I have a rig with 6 GPUS. 5 of them are R9 380s with the Open CL version 2.0. I also have a R9 280 which uses version Open CL version 1.2

After installing the Catalyst 15.11 Beta driver, only the 380s get recognised leaving out the 280 with an error code 43 and a yellow triangle on Device Manager.

The error reads out as follows:

Windows has stopped this device because it has reported problems.(Code 43)

Which is the best way to solve this?

Inputs from anyone with the same config would be highly appreciated.


texts:
Im trying to run the code below in a smart contract to use as an escrow. calling approve first and calling send from later does nothing to get the tokens into the smart contract, what am I missing here?

contract Token {
    function transfer(address _receiver, uint amount) public returns (bool);
    function balanceOf(address receiver)public returns(uint);
    function approve(address spender, uint tokens) public returns (bool);
    function transferFrom(address from, address to, uint tokens) public returns (bool);
}

function withdraw() public {
    tokenAddress = Token(_tokenAddress)
    tokenAddress.approve.transferFrom(msg.sender, address(this), _amount);
}

function approve(uint _ammount, address _tokenAddress) public{
    tokenAddress = Token(_tokenAddress)
    tokenAddress.approve(adress(this), _amoount);
}


texts:
How does the state verification work when doing a full sync from scratch?

Does the state get generated locally for each block using the transactions downloaded (in the transaction trie) and then compared to the state root within the block? Or do the state tries need to be downloaded to be incorporated in the syncing process somehow?

Also, is the syncing process exactly the same for a 'full sync' vs a 'full sync with archive'?

.. with the only difference being that state tries obtained are stored instead of discarded? Is there any additional verification during the syncing process that comes with an archival sync vs a normal full sync?

p.s. for context, I'm asking because I know with fast syncs the state tries have to be downloaded (instead of generated) once you get to a certain pivot point (1,024 blocks from tip I think), and I'm wondering if it's similar with a full sync.

Sync definitions

Full sync

geth --syncmode full or parity --no-warp

.

Full Archival sync

geth --syncmode full --gcmode archive or parity --no-warp --pruning archive


texts: What is the right approach to implement payable fallback function in crowdsale contract?

texts:
I am implementing crowdsale smart contract to accept ether and invoke ERC20 smart contract to assign tokens count calculated depending on the amount of ether invested.

I heard that just implementing default payable fallback is not right approach as that doesn't prevent customers from sending ether directly from exchange shared wallet accounts.

  function() payable {

  }

What is the right approach then to implement fallback payable (apart from throw there) in crowdsale contracts so that customers could only send ether via MEW, Metamask and other private wallets?


texts: Why did Ethereum abandon the GHOST protocol?

texts:
It says here (minute 24) that Ethereum started with some limited implementation of GHOST, but then abandoned it two weeks after launch.

Why was it abandoned?


texts:
Does anyone have an example of what EVM bytecode looks like? New to ETH and trying to understand what exactly gets executed by the virtual machine. Is it similar to how JVM bytecode gets executed from Java?

Thanks a bunch!


texts: msg.sender needs to be equal as an address from array. (solidity)

texts:
I only want teachers be able to add a new class. ( function addClass() )

How do i check if msg.sender is equal to an address in the teachers array?

contract school {
    address public owner;
    address[] public teachers;

    mapping(uint => Class) public classes;

    struct Class {
        uint id;
        address teacher;
        address[] pupils;
    }

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

    function addTeacher(address _address) public {
        require(msg.sender == owner);
        teachers.push(_address);
    }

    function addClass(address _teacher, address[] memory _pupils) public {
        require(msg.sender == teachers);
        classes[1] = Class(1, _teacher, _pupils);
    }

}```


texts:
I have created a forked mainnet in Ganache which is working well using the CLI. However I would like to have access to the UNISWAP GUI. If I open Uniswap and change my metamask settings to localhost, it doesn't let me do anything as seen in the photo:

Any ideas on how to make this work?
Thanks


texts: right procedure to check for ether balance in my geth testnet mining node

texts:
If this is the address of my node:

which I created with this command:

geth --testnet account new

then is it correct that I check the ether balance of my account in this way:

according to my understanding, my node should be mining- if that's the case- would it make sense for my console output to look like this:


texts: Problem with approve and transferFrom for making payments using ERC20 Token Contract

texts:
I have a contract that uses the ERC20 token contract for making payments. Now, in the ERC20 token contract we have the following implementation of approve function:

function approve(address _spender, uint256 _value) public returns (bool) {
    allowed[msg.sender][_spender] = _value;
    emit Approval(msg.sender, _spender, _value);
    return true;
}

The problem is that the msg.sender within the approve() function of ERC20 holds the address of the service contract (the contract that uses the ERC20 contract for making payments and not the address of the user who wants to make the payment). So, how do I let the approve function know the address of the user who wants to make the payment ?

The work-around for this is to call the approve function directly instead of via
another contract. Is this the way to do it ?


texts:
So I am making an ERC1155 token (for the batch mint pretty much). It is only ever going to mint NFT's (as you will see now now).
I am trying to batch mint tokens and store an array for each one. So each tokenID needs to have an uint8[] array associated with it. I am storing it in stateStorageForNumbers_ which is  a mapping: mapping(uint256 => uint8[]) internal stateStorageForNumbers_;.
But I have no idea how to pull the array out of the 2D array to store it.
function batchMint(
        address _to,
        uint8 _amount,
        uint8[][] calldata _numbers
    )
        public
        onlyOwner()
        returns(uint256[] memory tokenIDs)
    {
        // Setting up tokenIDs for mint
        uint256[] memory amounts;
        for (uint256 i = 0; i < _amount; i++) {
            // Incrementing the tokenID tracker
            _tokenIDsCount.increment();
            // Adding the tokenID to array
            tokenIDs[i] = _tokenIDsCount.current();
            // Amount is always 1 as only minting NFTs
            amounts[i] = 1;

            // HERE
            stateStorageForNumbers_[tokenIDs[i]] = _numbers[i][];
        }

        // Minting the batch of tokens
        _mintBatch(
            _to,
            tokenIDs,
            amounts,
            msg.data
        );
...

For ease of talking about it I am going to name the arrays quick, so its _numbers[j][k].
So as you can see I am passing in a 2D array _numbers, where the length of the j array will be the same as _amount. The inner array k is what I am actually trying to store.
Inside the for loop I am creating new tokenID numbers, creating an array (that gets returned) with all the ID's, then setting the amounts to all be 1 (as I want to mint exclusively NFTs).
You can see how I am trying to store k in stateStorageForNumbers_ by the // HERE, But this gives me the compiler error:
contracts/LottoNFT.sol:97:42: TypeError: Index expression cannot be omitted.
            lottoNumbers_[tokenIDs[i]] = _lottoNumbers[i][];
                                         ^----------------^

contracts/LottoNFT.sol:97:42: TypeError: Type uint8 is not implicitly convertible to expected type uint8[] storage ref.
            lottoNumbers_[tokenIDs[i]] = _lottoNumbers[i][];
                                         ^----------------^

Is this possible? Do I need to make them fixed-size arrays? I am not sure where to go from here.  Thanks in advance, a stressed-out Sol dev.


texts: Can the different accounts of a single Metamask user be linked to each other?

texts:
So you are a user in a single instance of Metamask with an email/pwd.
If I create different addresses inside the MetaMask instance, is there a way that a third party can find out all of my Metamask wallets are linked to the same Metamask instance (my user)?
Thanks.


texts: Creating a whitelist so certain addresses can receive bonuses

texts:
I am somewhat new to solidity and I am trying to create an ERC20 contract myself.

I would like to know how could I create a  whitelist in order for the addresses on the list to receive a 10% bonus when buying.

Thank you! :)


texts: Is there a comprehensive reference list of all Serpent commands?

texts:
Solidity has a particularly nice, comprehensive set of docs, and a flashy GitHub homepage.

Is there an equivalent set of documentation for Serpent?


texts: How to connect Eris to different accounts to start a chain?

texts:
I wanted to start a blockchain on my computer. For this, I am using Eris. I activated different accounts like root, validator, and participant account using eris chains start <ChainName> --init-dir <DIR> --publish this created different accounts on different ports on my machine. But now I have no idea how to connect them so that the chain is running and creating blocks.
I thought of using eris chains ls -a to get the mapped ports but then what next?


texts: How create transaction raw data for using "eth_sendRawTransaction" in C#

texts:
My IoT device connects to another computer via Wi-Fi on which Ethereum (Truffle/Ganache) is running which receive a RPC from the IoT.
My task is to create raw transaction data on this IoT Device, so that I can use the eth_sendRawTransaction function (https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendrawtransaction) via RPC. I have to create this raw transaction data in C# language.

But for creating this raw transaction data, I have to create ECDSA privat key, public key, derive address from public key, create the transaction (including: nonce, gasPrice, gasLimit, to, value, data), encode this data (RLP), hash the encoded data and last but nor least sign the hashed data with ECDSA private key. So in short --> How to create and sign a transaction locally using Go, just in C# ^^

There are exist a library ethereumjs-tx or web3 where I easy execute  but ethereumjs-tx is for JavaScript and web3 don't exist for C#. Is there a similar library for C#?

Or do I have to look at the exact function of the individual functions (in https://github.com/ethereum/go-ethereum or rather https://github.com/ethereumjs/ethereumjs-tx) and translate this manual in C#?

I found this https://goethereumbook.org/transaction-raw-create/ but everything is in GO.^^

Thanks a lot for your help/advice :)


texts: Can a contract emit another contract's event?

texts:
contract B {
    event eventFallback();
}

contract A {
    address contractB;

    function () public payable {
         emit B(contractB).eventFallback();
    }
}

I tried like above and failed. Is there a way to emit an event in another contract? (except creating an interface function like below.)

function emitEvent() public {
    emit eventFallback();
}


texts: How do I create ABI encoded constructor argument to verify an Ehtereum contract on etherscan.io when i know the arguments: adress1 uint


texts: How to overclock 8 * NVIDIA 1080 8 GB GPU with Claymore on ethOS or Windows 10?

texts:
Do any Ethereum miners have experience overclocking Nvidia 1080 8 GB GPU’s using Claymore on Windows 10?  According to multiple conversations I’ve had today with experienced miners, even those utilizing liquid-coolers, it’s apparently easier said than done when compared to using Radeon 8 GB 580’s with Claymore on Windows 10.

I’ve attached my .bat file convention within the below markdown.  I’d sincerely appreciate any guidance since this is my first day officially mining Ethereum!  I’m throwing in the towel tonight and using ethOS on my next build with 8 Radeon 580 GPUs- from what I gather, the Linux .conf file convention should be much easier to modify for overclocking.

setx GPU_FORCE_64BIT_PTR 0
setx GPU_MAX_HEAP_SIZE 100
setx GPU_USE_SYNC_OBJECTS 1
setx GPU_MAX_ALLOC_PERCENT 100
setx GPU_SINGLE_ALLOC_PERCENT 100

EthDcrMiner64.exe -epool eth-us-west1.nanopool.org:9999 -ewal ehtaddress.name/email -epsw x -mode 0 -ftime 10 -allpools 1 -r 180 -etha 0 -tt 60 -tt -80 -mvddc -960 -mclock 1900

FYI, I’m currently averaging 272 Mh/s collectively and about 21.2 per GPU; please see below-screenshot.


texts: How does MetaMask watch / filter events?

texts: If MetaMask uses Infura as their backend, and Infura cannot watch for events, then how does MetaMask manage it?


texts: Parity error -32010 Transaction cost exceeds current gas limit. Limit: 4703218, got: 4712388. Try decreasing supplied gas

texts:
I am playing with a private blockchain.  I get this error when I try to deploy a contract:

  [-32010] Transaction cost exceeds current gas limit. Limit: 4703218,
  got: 4712388. Try decreasing supplied gas.

This is weird because the chain spec file specifically has this parameter:

  "gasLimit": "4712388"

It brings up two questions:

Where is "4703218" coming from as the limit (since 4712388 is specified)
Where is "4712388" coming from as the default amount of supplied gas?

Please see that I said private blockchain.  The only miner is mine.


texts: Is data copied or referenced from local storage to global storage?

texts:
For example, when a struct is initialised to storage in a function, then assigned to a global state variable such as an array or mapping type, does the local struct get copied to the global state variable, or does the global state variable reference the local struct?

The solidity docs say that local storage variables can reference global state, but it doesn't specify if it works both ways??
E.g.

contract C {
    struct S {
        uint n;
    }

    // Global state mapping:
    mapping (uint => S) m;

    // Is data copied or referenced from the local storage object in the function to global storage??
    function localToGobal(uint i) public {
        S storage obj = S(i);
        m[i] = obj;
    }


texts: Interpreting the messages recieved during synchronisation on geth

texts:
I'm presently synchronising to the Ethereum blockchain using geth.

I'm seeing two types of message and have a bit of an understanding gap in what they mean. The messages are shown below, with my guess at what they mean.

Synchronisation message type 1:

I0906 10:09:01.619035 eth/handler.go:295] Peer 77e6a5959a5e0529 [eth/63]: timed out DAO fork-check, dropping

I0906 - Not sure - a log ID?
10:09:01.619035 - time
eth/handler.go:295] - unsure?
Peer 77e6a5959a5e0529 - the peer from which the message originates
[eth/63]: timed out DAO fork-check, dropping - error code and message

Synchronisation message type 2:

I0906 10:16:21.875217 core/blockchain.go:963] imported 2048 block(s) (0 queued 0 ignored) including 4408 txs in 10.3195903s. #774796 [7fcf4021 / a0a4535a]

I0906 - Not sure - a log ID?
10:16:21.875217 - time
core/blockchain.go:963] - unsure?
imported 2048 block(s) (0 queued 0 ignored) including 4408 txs in 10.3195903s. - number of blocks downloaded, number of transactions and time taken to download - does "imported" have special meaning?
#774796 - block number, first or last of 2048?
[7fcf4021 / a0a4535a] - don't know

What does each segment of the above message types mean?

Is there a man page related to this?


texts:
I am using the Geth 1.7 console. I tried unlocking the account using personal.unlockAccount(eth.accounts[0], "{top secret password}") but it failed with the following error:
first argument must be the account to unlock.

I suspect the error might be due to the fact that eth.accounts[0] is undefined.

How do I set up eth.accounts[0]?


texts: zeppelin-solidity Crowdsale. Access to token using javascript

texts:
I'm trying to use javascript to access the token variables and functions provided in the MintToken.sol file in openzeppelin.

I used "truffle init webpack" to create the metacoin example provided by truffle. I use "truffle compile", "truffle migrate" and "npm run dev" to have an application running in javascript that, using web3, let me interact with the smart contract.

I would like to do the same with zeppelin-solidity. So I created my crowdsale smart contract :

pragma solidity ^0.4.11;

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

contract MyCrowdsale is Crowdsale {
    function MyCrowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet)
        Crowdsale(_startTime, _endTime, _rate, _wallet)
    {
    }
}

Crowdsale.sol has some fields and a mintable token:

contract Crowdsale {
  using SafeMath for uint256;

   MintableToken public token;

  // start and end timestamps where investments are allowed (both inclusive)
  uint256 public startTime;
  uint256 public endTime;
....

MintableToken.sol inherits from StandardToken (that has balanceOf method) and has some variables:

contract MintableToken is StandardToken, Ownable {
  event Mint(address indexed to, uint256 amount);
  event MintFinished();

  bool public mintingFinished = false;
....

The problem I have is that I'm able to access to the crowdsale variables like startTime and endTime, but I'm not able to access to token variables/methods like balanceOf, mintingFinished, etc.

In my app.js I tried to copy the code used to access the metacoin contract so I'm able to get the startDate, for example:

MyCrowdsale.deployed().then(function(instance) {
    return instance.startTime.call();
  }).then(function(value) {
    var startDate = value.valueOf();
    console.log("The startDate is " + startDate);
  }).catch(function(e) {
    console.log(e);
    self.setStatus("Error getting startDate; see log.");
  });

I can get the token address using this call:

MyCrowdsale.deployed().then(function(instance) {
    return instance.token.call();
  }).then(function(mintedToken) {
    console.log("The mintedToken is " + mintedToken.valueOf());
  }).catch(function(e) {
    console.log(e);
  });

But I'm stuck here. I would like to access to token.balanceOf() or token.mintingFinished but I don't know how to do it.

I tried (after getting the token address like I wrote before):

console.log("mintingFinished = " + mintedToken.mintingFinished);

and also:

mintedToken.mintingFinished.call().then(function(x) {
      console.log("mintingFinished = " + x);
    })

But none of these approaches worked.

Any help would be appreciated.


texts: How to handle floating point number in Solidity?

texts: I read that there is no support for floating point number in solidity, So how we can handle it. If I want to store 12.23 or something like that.


texts: Why I cannot get any updated smart contracts from etherscan after craweling while etherscan has supportted to upload proxy contract mark already?

texts:
Etherscan supports proxy contracts associated with its implementation contracts https://medium.com/etherscan-blog/and-finally-proxy-contract-support-on-etherscan-693e3da0714b since 2018. However, After I crawl millions of contracts from block 0 to block 8999999, I don't get even one proxy contracts...
I test my codes on the example https://ropsten.etherscan.io/address/0xaf8b2205452b4ad43367ba8da587ec15322e282b#readProxyContract, it identifies it as a proxy contract successfully. So I don't think my implementation has any error.
So does it in fact have no contracts deployed on etherscan.io as proxy contracts until now?


texts: Where the buy and sell functions of a token contract get tokens and ether to work?

texts:
I got little confused about buy and sell functions in the example of token contract, where do they get ether/tokens to make this exchanges?

if this functions get ether and tokens from the contract owner, it would add big vulnerabilities because you can change owner without his approve and stole his money/tokens;
if this functions get ether and tokens from the contract creator, then owner changing won't change this and you will need to safe creator's private key until you want to be able to get ether/tokens from buying/selling tokens;
if you need to send both ether and tokens to the contract address to have this functions working then you will have this tokens/ether lost forever, or you need to add your own functions to get this token/ether from the contract (that are not in standard contract template).

I believe it's not the first way, but I'm not sure what way is exactly used and how people cope with the limitations of that way.


texts:
I have a view-request which returns amount X and will then fire a function X times through a for-loop. It works everything but due to the asynchronous request, I do not get the correct i-value that the function/request was fired with. The (javascript) code:

X = [0,2,4,6]
for(var i = 0; i < X.length; i++) {
    // i is the user ID
    contract.getUser(i, function (err, result) {
        if (err) {
        /////
    }
    else if (result) {
            // I want to return the current i-value (loop-value),
            // But due to the asynchronous request, it always returns the
            // last value (in our example 4)
            console.log(i);
        }
    }
}

Everything works fine (I get the user) but I can't redirect to for example url.com/user/ID because the ID (i) is always the same.

Thanks for help!


texts: How do we achieve immutability within a contract on the blockchain?

texts:
Am relatively new to the realm of Dapps and blockchain in general, and if you ask someone well-informed about the characteristics of blockchains, the word "immutable" will invariably appear in the response. Doing a simple search on google regarding immutability, the explanations given make sense, from a blockchain point of view. But when you dive deeper into coding, ethereum smart contracts, to be specific, the idea becomes vague. I have come from reading a two part series of how to implement CRUD operations in solidity, and as you can tell, Update and Delete part of CRUD introduces mutability. Towards the end of part 2, the author says:

  1) The mapped struct (where the details still exist) is for the exclusive use of our contract. Sure, the data is still somewhere in the blockchain, but if this contract won’t retrieve it for you (it won’t), it’s approximately the same as gone.

  2) There’s nothing we can do to prevent a determined adversary from
  finding data that once was but no longer is part of the current chain
  state. Overwriting data doesn’t undo immutable history.

Am concerned because my 4th year project entails developing a blockchain app for Ethereum to enable our country store public records like academic records, title deeds, driving licenses and log books.

One of the promises I gave in my proposal is this idea of immutability-: once the records enter the blockchain, there is no editing them, thus help curb forgery that we see all the time. If an update can be performed as simple as the tutorial linked above demonstrates, what will prevent anyone from updating their academic achievements for example (with the help of the system developer of course or some other way)?

So my reasoning at the moment is to provide setters and getters for these records, but explicitly omit functions to update/delete them. That way as a developer I help achieve immutability, not so much as a feature in blockchain.

But I feel am getting this wrong. How do I demonstrate immutability in this project?


texts: How to get address from private key in java

texts:
I use generate a private key in java code HashUtil.sha3("cow".getBytes())

Write to a new private key file:

c85ef7d79691fe79573b1a7064c19c1a9819ebdbd1faaab1a8ec92344438aaf4

Then, I use geth account import, I got an address ["0xcd2a3d9f938e13cd947ec05abc7fe734df8dd826"] in geth.

But when I try to get public address in Java, it shows a different address:

BigInteger pk = new BigInteger(senderPrivKey);
ECKey key = ECKey.fromPrivate(pk);
System.out.println("address\t: " + Hex.toHexString(key.getAddress()) );

The result is address  : 8e54de809503da0a87309f8d5e98f77551ddd7f5

I expected the address to show cd2a3d9f938e13cd947ec05abc7fe734df8dd826, did I use wrong code?

I also learned the ECKeyTest.java in EthereumJ, there are unit tests that gets public key from private key first, and then get address from public key. But in my case, the result is still 8e54de809503da0a87309f8d5e98f77551ddd7f5.


texts: How to interact with a greeter contract?

texts:
I have a contract and I'm super confused how to interact with it.  The submitting part works fine and I get a contract id.  After that, I don't really understand if I'm supposed to send it a transaction or do something else?  What's the lifecycle?  It says the constructor is executed when the contract runs.  When is that?  When it's mined?  Everytime a person sends it a message.  How do I send it a message?  Does the consumer of a contract send gas?  The creator?  Both?  If two people send messages are there two contracts or one?

Using this as a base: https://gist.github.com/tomconte/4edb83cf505f1e7faf172b9252fff9bf#file-web3-solc-contract-compile-deploy-js-L20

Have this function:

function testContract(address) {
    // Reference to the deployed contract
    const greeter = contract.at(address);
    console.log(greeter);
    //console.log(greeter("bob"));
    //var msg = greeter.greet.estimateGas();
    //const destAccount = '0x002D61B362ead60A632c0e6B43fCff4A7a259285';
    //console.log(greeter.greet.sendTransaction(destAccount));
}

I've tried greeter.greet, greeter.almosteverything.

The object for greeter looks like this:

   {_eth:...
     abi:
       [ { constant: false,
           inputs: [],
           name: 'kill',
           outputs: [],
           payable: false,
           type: 'function' },
         { constant: true,
           inputs: [],
           name: 'greet',
           outputs: [Object],
           payable: false,
           type: 'function' },
         { inputs: [Object], payable: false, type: 'constructor' } ],
      kill:
       { [Function: bound ]
         request: [Function: bound ],
         call: [Function: bound ],
         sendTransaction: [Function: bound ],
         estimateGas: [Function: bound ],
         getData: [Function: bound ],
         '': [Circular] },
      greet:
       { [Function: bound ]
         request: [Function: bound ],
         call: [Function: bound ],
         sendTransaction: [Function: bound ],
         estimateGas: [Function: bound ],
         getData: [Function: bound ],
         '': [Circular] },
      allEvents: [Function: bound ] }

Sol code:

pragma solidity ^0.4.10;

contract mortal {
    /* Define variable owner of the type address*/
    address owner;

    /* this function is executed at initialization and sets the owner of the contract */
    function mortal() { owner = msg.sender; }

    /* Function to recover the funds on the contract */
    function kill() { if (msg.sender == owner) selfdestruct(owner); }
}

contract greeter is mortal {
    /* define variable greeting of the type string */
    string greeting;

    /* this runs when the contract is executed */
    function greeter(string _greeting) public {
        greeting = _greeting;
    }

    /* main function */
    function greet() constant returns (string) {
        return greeting;
    }
}


texts:
How secure is it to store encrypted private keys on chain ? Are the assets in the example below easer to brute-force than the master-key that encrypts them ?

contract MyPrivateKeys {

  struct encryptedKey {
      string assetName;
      address publicKey;
      string encryptedPrivateKey;
  }

  encryptedKey[] CryptoAssets;

         function newAsset(string assetName, address publicKey, string encryptedPrivateKey) {

                CryptoAssets.push(encryptedKey({
                   assetName: assetName,
                   publicKey: publicKey,
                   encryptedPrivateKey: encryptedPrivateKey
                }));
         }

         function editAsset(){}

         function deleteAsset(){}
}

Example:

Assets are encrypted with master-key: 6b2785d6361628b6356153f4835ae27234f558f32cb3374d32d9c907884f6c46

   assetName: "BirthCertificate",
   publicKey: 0xc23af37f5d65c5b305aff444a7f3f1908069a0a6,
   encryptedPrivateKey: "U2FsdGVkX18x0qU589OhvSRHhAJGROtnu0inGJ2kgLX6tAE8XSTLTrhp09qCCYPR8RNAsm7ZZ+6mKqZ5tiLqPd3m1lDWF17pWg+kJZhzF77ijjZcpkOSu/3T+FZ5xMPN"

   contract.call.newAsset(assetName, publicKey, encryptedPrivateKey)

   assetName: "MarriageCertificate",
   publicKey: 0x4035f990da18bb02f79782bcdfdecd02b0e91ad6,
   encryptedPrivateKey: "U2FsdGVkX1+tpDCLlhWSfw7SJ8HaBYC9AjSmpl2ost9Rao3yYSiiAbmtr9hweM9bKSOsJGDKWrdl4iMSX8FpJ/pOBhv7WHOQXy9CGfuCev9lwqWg+/Ofk6VaXchrEQon"

   contract.call.newAsset(assetName, publicKey, encryptedPrivateKey)


texts:
I am trying to refer to this Solidity Docs https://solidity.readthedocs.io/en/v0.6.2/control-structures.html and trying to execute the following code

pragma solidity >=0.4.0 <0.7.0;

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

contract Consumer {
    InfoFeed feed;
    function setFeed(InfoFeed addr) public { feed = addr; }
    function callFeed() public { feed.info{value: 10, gas: 800}(); }
}

I am getting the following error

Expected ';' but got '{'
    function callFeed() public { feed.info{value: 10, gas: 800}(); } after info

This is the current version of docs and didnot expect to get this errors. Thank you for the help in advance


texts: I deployed a contract to BSC (testnet) with Remix. However, I can't write to the contract on BSCScan

texts:
BSCScan says: "Sorry, no public Write functions were found for this contract."
Here's the contract: https://testnet.bscscan.com/address/0x02fbff9dcf4afd02d592142f2b80e0434f5e7649#writeContract
It's a fork of this contract, which is writeable! Since it does in fact have public write functions: https://bscscan.com/address/0xb0b924c4a31b7d4581a7f78f57cee1e65736be1d#code
What did I do wrong?


texts: I have a few problems, and I am not sure how to solve them.  I transferred ethereum from Coinbase to a wallet that I originally created on a Mac.  The initial sync was not yet complete, and it is taking days and days (and slowing down my other work).  I haven't yet "received" the ether into the Mac wallet.  Can I sync the blockchain on another device and receive the ether there?  I am a novice here.  Thanks for any feedback.


texts: Trying first transfer contract in solidity

texts:
So i´ve been experimenting with Solidity and Remix and i wanted to and a simple while loop to the .transfer and .balance method. While being able to deploy the contract, I can´t seem to be able to send the 10 ether specified in the code. Any help would be much appreciated.
Here is the code:
pragma solidity ^0.5.0;

    contract testTransfer {

        function Transfer () public payable {

        address payable x = 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4;
        address payable myAddress = msg.sender;
        if (x.balance < 100 && myAddress.balance >= 10) x.transfer (10 ether);
        }
    }

a different version where myAddress = this;
spits out the error that contract is not implicitly convertible to expected type


texts: How do generalized sandwich attackers defend against Salmonella and Listeria?

texts:
Recently a trader extracted significant profits from sandwich attackers with a contract called Salmonella. The contract modifies the standard transfer function to send only a fraction of the requested amount to non-owners of the contract.
I assume that by this point (or in the near future) many others have copied this and deployed similar contracts.
Is there any way that generalized sandwich attackers can defend against this, or does this actually stop generalized sandwich attacks?


texts: Can I use geth light sync for mining purpose

texts:
Iam new to this,
I wanna start mining ethereum, I have tried over 5 times to fast sync geth, with ethereum wallet and failed to do so, as it would get stuck, sometimes my pc froze, would take days even though geth fast sync wasn't interrupted, so I had enough of it..

Now I wanna know if I can start mining with a light sync of geth, would that be plausible and what would I lose with light sync over the normal fast sync?

Please help, sorry for being a noob
Thank you in advance :)
WELP


texts: What are Storj and Sia and how different are they from Swarm and IPFS

texts:
I have recently discovered some blockchain based storage technologies like Storj and Sia.

I have vaguely understood that they rely on their own blockchain with their own cryptocurrency.

But why are they not relying on preexisting blockchains like ethereum which are designed to be multipurpose ?
What are their exact working principle ? Indeed up to now I was under the impression that storing data on a blockchain is very costly.
How are they different from IPFS and Swarm, which to my understanding are protocols for decentralized storage, but that do not rely directly on blockchain technology ?

Cheers !

Edit: I have also read this answer, which brings a lot of good elements of understanding, but I am still missing something in terms of seeing what Sia and Storj bring that IPFS or SWARM did not already have.


texts: Can someone explain to me how to add USDT support to my wallet? I use my own GETH node

texts:
How to listen USDT contract? How to transfer my USDT to another USDT wallet? How to use both ETH and USDT in the same service? Etc.
As you can see, I am new to these issues and would be grateful for any help.


texts: Contract creation gas cost depends on code in library function?

texts:
I have a contract fooContract which is using a fooLib library, calling fooLib.foo(LibStruct storage param)

The transaction cost to create fooContract seems to depend on the code in the fooLib.foo() function despite the params are unchanged.

Ie. using solidity browser fooContract create costs 3,185,059. if I comment out the code in fooLib.foo(), the fooContract create cost goes down to 2,816,000 .

As far as I understood libs are a way to move out functionality for contracts too large for block gas limit.

Am I missing a point here?


texts:
I use Infura as a provider of HTTP.

But Infura does not allow you to make a filter.

  requests.exceptions.HTTPError: 405 Client Error: Method Not Allowed
  for url: https://ropsten.infura.io/

Cannot create filter on Infura via web3.py

But it's very, very long to sort through the transactions of the whole network with this code:

from web3 import Web3, HTTPProvider

w3 = Web3(HTTPProvider('https://ropsten.infura.io/',
                       request_kwargs={'timeout': 60}))

def get_transaction_details(transaction):
    return w3.eth.getTransaction(transaction)

def get_address_transactions(address):
    i = 0
    while i < w3.eth.blockNumber:
        block = w3.eth.getBlock(i)
        for transaction in block.transactions:
            detail = get_transaction_details(transaction)
            print(detail)
        i += 1

How do I get all address transactions?


texts: Where do I find the literal error definitions thrown by the Ethereum Network?

texts:
I've been trying to create an Ethereum Transaction but keep getting the 320000 invalid sender error. From other questions I've seen, this may be caused by errors in signing, sender address or chainID, yet after working with these I still get an error. I'm not supplying any code because I'm not looking for someone to fix my code, but rather wondering if there is any code/documentation I can look at provided by Ethereum for exactly this error. Thanks!

Edit: I have found https://github.com/ethereum/go-ethereum/blob/86e77900c53ebce3309099a39cbca38eb4d62fdf/core/tx_pool.go , does this work?


texts:
How would you guys call a mapping from a test and get the values?

This is the mapping that I have on my contract:

mapping(address => uint[29]) balanceOf;

It´s a mapping to an array of integers which reflects the different slots in the balance of the user. So, I´m trying to call directly from the myTest.js (truffle) but return me an error:

 TypeError: Cannot read property 'call' of undefined
  at Context.it (test/ovxet2.js:13:50)
  at <anonymous>
  at process._tickCallback (internal/process/next_tick.js:188:7)

And I´m doing this action like below, using async/await:

    var balanceOf = await instance.balanceOf.call({from: [accounts[0]][0]});
    console.log(balanceOf);

And I´ve also tried call in another way to receive the whole array of integers:

var balanceOf = await instance.balanceOf.call({from: accounts[0]});
    console.log(balanceOf);

However, I have another tests written using promise chaining...and I´ve implemented the same ways in order to get those values but return me the same errors.

So, can truffle returns mappings? Or I have to create my own getter function in the contract (for testing purposes) and then call that function from the test?


texts: Is it possible to partially signed tx without nonce and then a third-party proxy will fill the right nonce?

texts:
As part of building managing nonce mechanism, we thinking about several approaches for issue tx from frontEnd without the need to wait till it mined before sending the next tx.

Is it possible to issue a tx without specifying nonce and then our nonce proxy service will fill the right nonce and post that tx to the network.

Endgame: our FrontEnd will issue the tx without having to be synced on nonces.

When the nonce's proxy will get the tx it will finalize it using the most updated nonces state manage there.

Does that approach or similar can be achieved?


texts: In an Ethereum smart contract, can I check the balance of other ERC20 tokens from the sending address of a recieved transaction?

texts:
I'm currently designing a smart contract, where I'd basically like to incorporate a "coupon" like relationship between two different coins. Bob can send the smart contract CoinA, and receive CoinB as a result, but only if he also has a proportionate amount of CoinC in the same wallet.

The logic I'm imagining looks like this in psuedo code, I'm just wondering if checking the value of CoinC in the sending wallet is achievable:

if (recievedTransaction.CoinA === sendingAddress.CoinC) {
    return CoinB
}
else {
    return recievedTransaction.CoinA
}

Or if not, I guess as a 2nd best solution the smart contract can receive both tokens as separate transactions, and decide the return value based on if those values match up or a certain amount of time runs out?


texts: Etherscan says "we were unable to locate a matching bytecode (err_code_2)"

texts:
Please help me with this error...

I dont know what is it?


texts: how to create Function Selector (Method IDs)

texts:
As stated in ABI specs that 0xcdcd77c0: the Method ID. This is derived as the first 4 bytes of the Keccak hash of the ASCII form of the signature baz(uint32,bool).

So, I have to create method IDs (function selectors) of my contract functions through javascript/nodejs/web3js. Suppose i have an array of functions name  and their parameters (extracted from ABI JSON file)-  i.e. funcNameAndParams[]. One of its element is as follow;

{
  contractNo: 0,
  funcName: 'getSupplyRate',
  params: [ 'address', 'uint256', 'uint256' ]
}

Is it possible to generate Method IDs, having above
information ? if yes, how could i proceed ? I have read ABI specs
 but could not found how to code it in JavaScript/Nodejs/web3.js
If I have contract source code as well, then could i proceed ? Means generating Methods IDs from json ABIs will be easy or from .sol file ?


texts: How do I know if I am connecting to uniswap factory mainnet or testnet if the contract addresses are common for both?

texts:
I had thought each contract deployment and contract address was unique on Ethereum, including across mainnet and testnets. But in the Uniswap documentation it says:

UniswapV2Factory is deployed at
0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f on the Ethereum mainnet,
and the Ropsten, Rinkeby, Görli, and Kovan testnets. It was built from
commit 8160750.

source: https://uniswap.org/docs/v2/smart-contracts/factory/
If this is the case, how can I choose whether I am connecting to the Uniswap mainnet or testnet factory contract? I am connecting via JavaScript and Truffle as follows:
      ...

      const UniswapContract = contract(UniswapFactoryAbi);
      UniswapContract.setProvider(this.web3);
      UniswapContract.at('0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f').then(function(instance) {

      ...

Thanks in advance.


texts: is the Parity Mnemonic my private key - or is it my private key-passphrase combination?

texts: Essentially what I'm asking is - can I recover my wallet using just the mnemonic from the Parity wallet, or would I ALSO need my original passphrase?


texts:
I'm running some mini contracts within our team and every time someone was bothered by the gas setting, or "intrinsic gas not enough", etc. Of course, I understand it's necessary to add gas into the blockchain to make it running for the specific behaviors in contract. It's in the design of Ethereum, and seems like reasonable.

However, I started to think, how possible this can sustain? In the future, the gas price may not get lower(even it won't get too high), and every mini function in a contract may take this burden to be executed, then how possible IoT or some micro-actions can be done within budget(e.g. unlocking a door may take some 1USD, is it reasonable as a resilient computing model?).


texts:
I've been tracking a case where my Node.Js server just stop receiving events, basically for each contract, when I do a

contact.allEvents({ fromBlock: startblock }, (error, data) => {
...
});

It works, mostly. After some time events just stop. (Currently I have 3 contracts like this, it seems to happen mostly at the same time.) So what I've been doing is to reset geth and/or the process (using cluster, so can just spawn a fresh one).

However... during the last 3 days I've been monitoring my nodes via ethstats.net and it seems like my specific Geth node just starts falling behind in blocks and this seems to occur around the same time. A restart works and everything is back to normal - I'd rather not do this twice a day manually.

What tips and tricks do people have for making sure Geth keeps healthy in production so it runs 24/7?


texts: Difference between library-using-for and contract-is

texts:
I am using two different ways to get the same result and wondering what the real difference is. Both options (library, using, for and contract, is)deliver just an extended code from a file.

Method no 1

library.sol:

pragma solidity ^0.4.19;

contract IntExtended {

    function increment(uint _self) returns (uint) {
        return _self+1;
    }
}

contract_is_method.sol:

pragma solidity ^0.4.19;

import "browser/library.sol";

contract TestLibrary is IntExtended {

    function testIncrement(uint _base) returns (uint) {
        return IntExtended.increment(_base);
    }
}

Method no 2

library.sol:

pragma solidity ^0.4.19;

library IntExtended {

    function increment(uint _self) returns (uint) {
        return _self+1;
    }
}

using_for_method.sol:

pragma solidity ^0.4.19;

import "library.sol";

contract TestLibrary {
    using IntExtended for uint;

    function testIncrement(uint _base) returns (uint) {
        return IntExtended.increment(_base);
    }
}


texts: Vyper: Truffle test read mapping value inside struct

texts:
I have the following struct inside my vyper file:

races: public({
  start: timestamp,
  end: timestamp,
  racersBetHash: bytes32[address],
  racersBetAmount: wei_value[address]
}[int128])

Then I call this function:

@public
@payable
def registerRacerBet(_tokenHash: bytes32, _raceID: int128) -> bool:
  self.races[_raceID].racersBetAmount[msg.sender] = msg.value
  self.races[_raceID].racersBetHash[msg.sender] = _tokenHash

  log.NewUserBet(_raceID, msg.sender,
                 self.races[_raceID].racersBetHash[msg.sender],
                 self.races[_raceID].racersBetAmount[msg.sender])
  return True

Inside my truffle test, I'm able to test the correctness of the log, so I'm sure that the struct is properly defined but, if I try to read the value of the struct for the two mapping fiels the call turns back zero value.

I have no problems to read start and end

const currentHashBet = await instance.races__racersBetHash.call(0, '0xf17f52151ebef6c7334fad080c5704d77216b732');

currentHashBet: 0x0000000000000000000000000000000000000000000000000000000000000000


texts: Should I run multiple instances of qtminer for multiple GPUs?

texts: I am using qtminer from ethpool for mining with a single card. I want to add extra cards to the rig, should I start a new instance of qtminer for every card or should I start a single instance of qminer with extra parameters for every singe GPU?


texts:
I am trying to understand how to get the old values stored in blockchain.  I need to prove the immutability and transparent feature to non-technical people.  Here is my code.

    pragma solidity ^0.4.17;
        contract Inbox{
           string public message;

            function Inbox (string initialMessage) public {
                   message = initialMessage;
            }

           function setMessage(string newMessage) public{
                message = newMessage;
          }
 }

In above contract, whenever i call setMessage i set a new message for the message variable.  For example, first time i had set it for "Test1".  Second time i set it for "Test2" and so on.  now i added a get function to read the value of message variable.  The function always returns me the latest value set for message variable.  Now my query is, is it possible to check all the values i set in past without using arrays.  Just with the above example can i get all old logs or am I expecting something wrong.


texts: Certification of ownership and integrity of digital content : why is a signature required?

texts:
I'm currently designing a simple and largely discussed blockchain solution : certifying the ownership and integrity of a document through an immutable storage smart contract.
In most of the discussions I read, such as this interesting post, the document's digital footprint (i.e hash) is further signed with RSA. In the forementioned post a JWT is stored together with the document hash.
I cannot understand why this is needed on a d-app, and I'd appreciate your lights :

Consider a minimalist smart contract with a mapping (document_hash : byte32 => owner: address)
The hashes are immutable and their owner cannot be overwritten once added to the collection
If a hash doesn't exist yet, the caller address is registered
The smart contract doesn't offer any other mean to write in this collection

Given that the client companies secure properly their eth private keys, exactly as they would have to with RSA, how is that not enough and what's the added value of further signing the hash ? How the fact that the transaction must technically have been signed by the company's private key to be associated with the document's digital footprint not a proof of ownership as liable as a JWT signature ?
My guess is that it's only to ease the UX so that manipulating an Ethereum wallet isn't needed on a widely available non d-app web interface. Is there anything more to it ?
Many thanks !


texts: Why can't the return value of a transaction be included in the transaction receipt?

texts: Shouldn't this be possible as the return value will be known when the receipt is created?


texts: libraries to transfer tokens privately suitable for mobile phones

texts:
I'm trying to implement a way to transfer tokens (ERC-20, etc) privately without leaking the amount transferred. I've seen anonymous-zether and Zokrates but the problem is that these solutions are only suitable to be used on PCs and not mobile phones. Computations, especially proof generations, seem to be massive for solutions using zero-knowledge which makes it impossible to use on phones. I'm seeking a way to make private transfers available for mobile phone users without relying on other servers.
Does anybody know a less computation-intensive way to implement private transfers, making it suitable for mobile phones?


texts:
When an ICO contract is created, is the meta-data of the computer used to create the ICO linked to the contract?

If I feel a token/ICO coin is a scam, how would I go about harvesting meta-data to build a case?


texts:
I am trying to transfer tokens from EOA to contractA.My TokenContract is ERC20.
I have to call approve and transferFrom.
But is it possible to combine them into 1 call deposit().
I tried using delegatecall for approve but getting errors?
Can someone suggest the best approach to transfer in a single call?

function deposit(uint _tokens) public  {
        require (_tokens > 0);
        //Approve before calling this
        msg.sender.delegatecall(bytes4(keccak256(strConcat(addressToAsciiString(tokenContract),".approve(address _spender, uint256 _value)"))), _tokens);
        require (tokenContract.allowance(msg.sender, this) >= _tokens);
        require (tokenContract.transferFrom(msg.sender, tokenStore, _tokens));

    }


texts:
I am trying to figure out what is wrong with the following code as it does deploy successfully on remix.

pragma solidity ^0.5.11;

contract MyContract {

    // Storage
    address contractOwner;

    address[] userFilesList;

    mapping ( string => address ) private accountAddressesByProfile;
    address[] public accountList;

    bytes16[] accountTypes;
    mapping(bytes16 => bool) accountTypesMap;

    constructor() public {
        contractOwner = msg.sender;

        bytes16[5] memory initialAccountTypes = [
            bytes16("Account1"),
            bytes16("Account2"),
            bytes16("Account3"),
            bytes16("Account4"),
            bytes16("Account5")
        ];

        for (uint8 i = 0; i < initialAccountTypes.length; i++ ) {
            bytes16 accountType = initialAccountTypes[i];
            accountTypes.push(accountType);
            accountTypesMap[accountType] = true;
        }
    }

}

The issue is it refuses to deploy from remix when pointed to a remote node(in my case a parity node running of Azure proof of authority consortium).

I  get the following error when I try to deploy on remix
Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
"message" must be a nonempty string

And when I deploy anyway it fails with error 0x0 Transaction mined but execution failed.

However if I changed the pragma version to say 0.4.26 it deploys successfully. Im trying to understand what’s going on or see if perhaps it’s not good practice to implement the loop in the constructor.


texts: field size and value range of chainId (EIP-155)

texts:
EIP-155 defined a list of chain IDs, e.g. main net is 1 Ropsten is 2. I don't seem to be able to find a definition about its supposed value range and data size.

Quoting the yellow paper rule (287)

  It is assumed that v is either the ‘recovery identifier’ or ‘chain
  identifier doubled plus 35 or 36’. The recovery identifier is a 1 byte
  value

The text says if it's recovery identifier, then it's encoded in one byte. It doesn't mention about the size for chain identifier doubled plus.

It seems for the chain identifier doubled plus case, one byte won't be sufficient: EIP-155 lists 1337 as the value for Geth private chains. So it seems safe to say this field (i.e. Tw) can be longer than one byte. If that's the case, shouldn't it be encoded with a length prefix?

Apart from the value 1337, is it possible for other networks to have even larger, longer chainId settings?


texts: How can I configure Ethereum to run over Tor or I2P

texts: If Tor or I2P support is not yet practical, is there a guide of best practices to help protect IP and other metadata?


texts: Remix compile error: Expected primary expression

texts:
function Renting() public {

    checkUser[owner] = true;
    struct govt = Person(owner, 'Owner', 'Owner', 0, 'None',  new uint[](0), new uint[](0));

    addressToPerson[owner] = govt;
}

When I try to compile my contract I get an error saying Expected primary expression: struct govt = Person(owner, 'Owner', 'Owner', 0, 'None',  new uint[](0), new uint[](0));

I referred once to Person in my contract

struct Person {

    address eth;
    string legalName;
    string email;
    uint aadhaar;

    string signTerms;

    uint[] myOwned;
    uint[] myRented;
}


texts: How "factory" codes are used in proxy contracts?

texts:
What is this factory_ exactly in the following piece of code?

constructor(DSProxyFactory factory_) public {
    factory = factory_;
}

https://gist.github.com/Sowmayjain/5ce5097d5a84f0cc1e1376d6918b25f0#file-proxyregistry-sol-L225

It should be something like uint/address/bytes etc.


texts: Is it possible to approve() multiple spenders at once?

texts:
I was wondering whether it possible to call this function

function approve(address _spender, uint256 _value) returns (bool success)

with multiple spenders at once (for example, 1000 different spenders)?

If yes, will it consume the same amount of gas as calling it for 1 spender x 1000 times?


texts:
I sent a transaction over 6 hours ago from myetherwallet to an outside address with the site's suggested 21000 gas limit. Its up to over 1000 block confirmations but still has not completed, yet reduced myetherwallet by the transacted amount. How do I increase the gas limit to speed it up? Or must I just wait for it to complete? How can I cancel the transaction altogether?

Please help!


texts: How to avoid race conditions during Solidity contract updates?

texts:
Situation:

Let's assume we have a contract upgrade mechanism implemented.
Data is separated from Business Logic
So far, I "freeze" data via a flag in old contract
Then I selfdestruct old business logic
Then I enable new business logic

Question:

Is his the most elegant way to avoid race conditions between old and new business logic, or is there a better way?


texts: Unable to sign a message on geth Console

texts:
I have two accounts on my geth node . The geth node is syncing with the Ropsten testnet . I executed the following commands

personal.unlockAccount(eth.accounts[1],'Test');

The result was true

After this I tried to sign data by using the following :-

web3.eth.sign("Hello world", eth.accounts[1]).then(console.log);

But can see an error message "invalid address"

What could be causing this error ? Any help appreciated.


texts:
I wanted to get the details of the following transaction hash : https://ropsten.etherscan.io/tx/0x8b43cf5e2c9d4eabb1121036de3d60354f64e9ccc6004caccba0e478c50ed2e6.
And Ropsten has got an API to get the event details.
The event that i am implementing is in sendBounty() (minting tokens):

function sendBounty(address _to, uint256 _tokens) returns (bool) {

        require(_tokens + bountyCount  < MAX_Bounty_Tokens );
        bountyCount= bountyCount+_tokens;
        mint(_to,_tokens);

    }

function mint(address _to, uint256 _amount) public canMint returns (bool){
        totalSupply_ = totalSupply_.add(_amount);
        balances[_to] = balances[_to].add(_amount);
        emit Mint(_to, _amount);
        emit Transfer(address(0), _to, _amount);
        return true;
   }

The API that i wanted to use is https://ropsten.etherscan.io/apis#logs

I am unable to understand the terms topic0, topic1, topic2, topic3 and how to use it.
Requesting Help
and thanking in advance :)


texts:
This is my first time trying anything with web3 and my transaction isn't sending I have checked the documentation and everything seems to be correct so i don't know why it isn't working.
[![enter image description here][2]][2]
from web3 import Web3

gnache_url = "HTTP://127.0.0.1:7545"
web3 = Web3(Web3.HTTPProvider(gnache_url))

print(web3.isConnected())

account1 = "0x9D7700325246447A5e481f355167637e1a2f2a0A"
account2 = "0x3F764C22F69Da4754b16796cD4D2e5383FE43a5e"

private_key = "9aa34d6f42d04aa53146cdbba11a3e7e45d10971ae5b2bc49683d64b21cfa2b1"

#building the transaction
balance1 = web3.eth.get_balance(account1)
print(balance1)
nonce = web3.eth.getTransaction(account1)
transaction_info = {
    'nonce': nonce,
    'to': account2,
    'value': web3.toWei(1, 'ether'),
    'gas': 20000,
    'gasPrice': web3.toWei('50','gwei')
}
signed_transaction = web3.eth.account.signTransaction(transaction_info,private_key)
print(signed_transaction.rawTransaction)
#print(signed_transaction)
#transaction_hash = web3.eth.send_raw_transaction(signed_transaction.rawTransaction)
#print(transaction_hash)


texts: Is it possible to make several calls in a single transaction?

texts:
Suppose your contract has a very simple function, F(), which takes about 1,000 gas to process. Suppose you want to call that function 100 times. Since there is an overhead of about 21,000 gas per transaction, you'll be paying 2,200,000 gas. But, if your contract has a function:

function Fs(uint n){
    for (uint i=0; i<n; ++i)
        F();
}

You could perform the exact same operation with a single call, Fs(100), which would cost only 121,000 gas, a 94.5% reduction. Is there any way to send several calls to F in a single transaction, so you can achieve the same effect even when the contract didn't specifically optimize for it?


texts: Avoiding for loop and making function call only once by any user

texts:
pragma solidity ^0.4.17;
//  I want to write a code for  loyalty points when user pays
contract GiveRefreceId {

    struct  referenceids {
        uint256 rid ;
        address addressrid;
}
    mapping(uint256 => referenceids) referenceid;
    referenceids[] lenrefrenceid;

function giveRefrenceId() public returns (uint256)  {
    for (uint256 i=0 ;i<=lenrefrenceid.length; i++){

        require( lenrefrenceid[i]  != msg.sender);
    }

    uint256 lenvarble = lenrefrenceid.length;

    referenceids  storage temprid = referenceid[lenvarble];

    temprid.rid = lenvarble;
    temprid.addressrid = msg.sender;
    lenrefrenceid.push(temprid);
    return lenvarble;
}

function  getrefrnceId()  view returns(uint256) {

return ((lenrefrenceid.length)-1);

}
}

1)I have written a function to give reference id's  to the user's

2)I want to restrict the user to call only once the giverefrenceid function  so i taught of  writing for loop and  check the address is present or not in the Array

3)but i am getting error

Operator != not compatible with types struct GiveRefreceId.referenceids storage ref and address
        require( lenrefrenceid[i]  != msg.sender);

4) I know it is complaining that struct and require coudn't be used but i coudn't find any other option to check

5)The gas will be costing more if the numbers increase Any way to avoid for loop,and  check the user is calling the function for the first time

6)I don't want to write two functions i want to get id by using one function is there any way ?


texts: Exceeds gas block limit error when deploying near block gas limit contract

texts: I'm trying to create a wallet contract using Geth 1.5 --light and Mist Wallet 0.8.7. Estimated gas cost for the contract creation is 1,962,239 while the gas limit is 1,998,227. So, everything should be fine, but Mist throws me an error Exceeds gas block limit. What might be the problem?


texts: How was the recursion created that lead to theDAO hack?

texts:
I understand that if theDAO contract has a withdrawal function that sends money to contract X - contract X can be malicious and use the fallback function to call the withdrawal function again. However - in the case of theDAO contract X was another copy of theDAO so it did not had this malicious behaviour.

So how exactly was the recursive send possible?


texts: I have question about private block chain gas structure

texts: I have a basic question about gas price charged for transaction. Say I have a private ethereum block chain with ten nodes and I don't want to charge any fee for the transaction taking place in this private chain. Can I do that? If yes how can I be able to do it?


texts:
Lately I had a conversation with someone who says that it is possible to make a call to the smart contract without giving the address. He said it's possible to send certain parameters and by them the call will find the smart contract and invoke given in the parameters method. I doubt it is possible but I would like to ask you.

Cheers!


texts:
I am trying to send the args on function from owner account but getting Returned error.

I am using web3 1.0 .

Function in contract :

/**
* @dev Adds single address to whitelist.
* @param trusted Address to be added to the whitelist
*/
function addToWhiteList(address trusted) public onlyOwner {
    require(!whitelist[trusted]);
    whitelist[trusted] = true;

    emit UserWhitelist(true);
}

Code on index.html :

// Add user on whitelist
abc.methods.addToWhiteList("0x9DA80947ACf5Fc16299311EdAabc37fF7d201C95")
.send({ from: "0x61A44075419C4402f6DE631341d875Ece6A3922e" })
.on("receipt", function(receipt) {
  console.log(receipt);
})
.on("error", function(error) {
  console.error(error);
});

ERROR : Returned error: The method eth_sendTransaction does not exist/is not available

Note :
I add web3 in script tag :

<script language="javascript" type="text/javascript" src="web3.min.js"></script>

and init. like this :

web3 = new Web3(new Web3.providers.WebsocketProvider("wss://ropsten.infura.io/ws"));


texts: how to catch "revert" error in truffle test javascript?

texts:
How can I catch "revert" error in truffle test written in javascript?

Error: VM Exception while processing transaction: revert

Here is part of test contract,

  function doRevert() public {
    revert();
  }

and here is my part of test javascript,

  it("test1.....", async() => {
    let instant = await myContract.deployed();

    await instant.doRevert();
.
.
.

I do not want to stop my test code at the first test step. I searched that I can import expectThrow.js, but I couldn't to import it, same issue as here.
I know this question is very related to How can you handle an expected throw in a contract test using truffle and ethereum-testRPC?, but still cannot figure it out how to use the library, expectThrow.js, and throw is deprecated, so there is some other ways to do that?


texts: Using a Linux Socket to Connect to the JavaScript Console

texts:
I'm trying to programmatically connect to a JavaScript console (just like you get with geth attach) using the geth.ipc file that gets created in the chaindata folder.  On Linux, it's a socket file, so I figured I could connect to it with something like this (in Python):

import socket

client = socket.socket( socket.AF_UNIX, socket.SOCK_STREAM )
client.connect("/home/john/Desktop/EthPrivateChain/chaindata/geth.ipc")

client.send(str.encode("admin.nodeInfo.enode"))
print(str(client.recv(1024)))

client.close()

However, this gives me the JSON RPC, not the JavaScript console.  The code works but the endpoint returns an error when I try this.  The same code, but with a JSON request, works.  I want the JavaScript console because I want to be able to access some stuff that isn't available through the JSON RPC, specifically the enode in this case.  I think there has to be a way to connect to that file this way because I can use it to start a console with geth attach /home/john/Desktop/EthPrivateChain/chaindata/geth.ipc.  Is there some way I can make this socket file access the JavaScript API when I access it with my own code?


texts: Is there an API for json rpc transactions and signing?

texts:
I've been looking at a lot of node host providers like infura and they don't allow for ethereum json rpc signing or transactions for security reasons (private key handling). I thought that I could just look up an api to allow me to do this, but haven't found any.

My goal is to do transactions on the ropsten network ONLY through xml rpc requests (as I am working in a limited environment that doesn't allow for library importations) and was wondering if there is a solution or api that would help.


texts: I was looking at my old Ethereum wallet and I saw that I have some of the old TheDAO tokens.  Is it still possible to swap them back into ETH?  If so, can someone please explain to me in very simple, caveman style, instructions?


texts: How to change block's current time in testrpc

texts:
I created a smart contract, in that i'm assigning now to particular value.

uint raisedtime=now;
EmitNow(raisedtime); //event function.

It return the unix timestamp of vary old date.
How to change or update the timestamps in testrpc.