texts:
I'm working on a dApp and I am trying to figure the following issue. I want to map an address to a dynamic list of items in one of my contracts. In this way when a user logs, he/she has their own list of items (a bit like cryptokittens work, for each address you can have the list of kittens for that address). My question is: can I do this mapping? Is it bad/not efficient? I have been told it is, and I couldn't really figure how to do it efficiently. Some people I work with suggest to put this info offchain. Is this the right approach? I would rather have everything onchain.

Thank you


texts:
When I start parity it automatically choses port 8180 to run upon. I currently try to follow this tutorial in building a small demo app: https://tomusdrw.github.io/parity-dapp-example/#/4/1

However all the rpc-calls that are executed by this app go to the 8080-port (which seems to be the standard port). How could I fix this?

I read here https://github.com/ethcore/parity/wiki/Basic-Usage that there is a --dapps-port PORT option. But when I use it starting of the node fails with this error message:

ERROR: Signer: Could not start listening on specified address.
Make sure that no other instance is running on Signer's port. Details: Error { repr: Os { code: 48, message: "Address already in use" } }


texts: Are there any forks or alternate flavors of Ethereum that allow cross-chain swaps between two EVM-like chains?

texts:
I’d like to run an alternative consensus protocol based on the geth client. Since geth already has a ton of consensus protocols, I was wondering if any coins on the market were able to do the following:

On the Ethereum blockchain, ether is sent to a smart contract from account A.
On the alternate blockchain, a coin/token is sent to the same address found in account A.  This coin/token is valid only on the other chain.

Such a mechanism would ideally be bidrectional across chains.

What might the challenges be in designing such a system? Such a mechanism could be more difficult to implement if one needed to wait for confirmations.


texts: How can I set a previous state/storage trie when running ethereumjs-vs runCode?

texts:
I am trying to call runCode on an ethereumjs VM with the contract code, the necessary data (method specifier + params; encoded) and the contract storage trie I got from a previous call on runCode which called the constructor and initialized the contract.
Unfortunately I cannot manage to run the VM with runCode such that the code is run and the storage trie I pass to the VM is updated.


texts: Fatal: Error starting protocol stack: datadir already used by another process on AWS EC2

texts:
I was running geth on my AWS instance. Due to timeout my connection to AWS was closed but geth was still running. When I logged back in to run the command again, it raised the following error:

Fatal: Error starting protocol stack: datadir already used by another process

How can log in into my geth console again?


texts: How to connect not local node to private Blockchain?

texts:
Is there any way to connect NOT LOCAL node to running private Blockchain?
So, there are 3 virtual machines in one local network. They are syncronized private blockchain. They have static-nodes.json and same genesis.json.
One of this virtual machines has connection to Internet and mapping from port 8545 from white IP to local IP address.
I want to connect there one more node, but this node is not in local virtual machines's network.
Is there any chances to do it? Maybe some parameters rpcallow and so on?
Hope, somebody can help me and clarify this question.

Thanks!


texts: I sent 1 ether to a scam ico anything i can do?

texts: I sent 1 ethereum to quantslamp instead of quantstamp. Is there anyway I can report them? I'm assuming my money is already long gone


texts: Sending custom token on testnet doesn't appear on etherScan or recipient wallet

texts:
The transaction is shown in my wallet with a blockcode. But when I clicked to go to etherscan.io, it said the transaction cannot be located. I searched with my address for all transactions, the custom token transfer is not in my list of transaction. Only the initial custom contract creation is.

In my wallet custom contract, I successfully queried the balanceOf the recipient using his address.

But he still cannot see the token.

Note that I have already made sure he is watching my custom token from his wallet. Reference: Ethereum - use your coin

Tranx info:
Block #0xfd996fa21924d6c76b7988ef673e26f8df2538c70d05907bf9fafd143713be0b

From 0x02C1f35D018c66DDa45490A668d7E72e3bB03944 to 0x38d50DE4bD0a76c90074637bb5e3ed78B5E20332


texts: How to transfer tokens to bounty participants?

texts: What is best practice to send ERC20-compliant tokens to bounty participants? There could be from 1 to N participants. Also there will be some table with list of users/addresses/tokens/etc. Should I pass all this data to my crowdsale contract for transferring tokens to users while finalizing the ico?


texts:
I am in the process of creating an app that will use Ethereum. I would like to create wallets for each of the users in my backend without them having to do anything except writing a passphrase.

What code should I use for that? can I use the Ethereum C++ client to do that? do I have to download all the blockchain to create wallets only?


texts:
I have created a private blockchain and a private networ using Geth
i have submitted a contract for deployment.. i can see in main geth CLI there its showing as

after that I did mining .. is that means the contract got created/deployed.

also when I try to run the contract it gives error as
execution aborted (timeout = 5s)

CustomeGenesis file is as :
{
    "config": {
        "chainId": 7413,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },
    "difficulty": "20",
    "gasLimit": "21000000",
    "alloc": {
    }
}

and the contract I am trying to deploy is as :

pragma solidity >=0.4.22 <0.6.0;
contract greeter {
     address owner;
     string greeting;

constructor (string memory _greeting) public {
        greeting = _greeting;
        owner = msg.sender;
    }

    function greet() public view returns(string memory)
    {
        return greeting;
    }
}

I have compiled it using the remix editor and trying to deploy the web3deploy content from remix

after calling the contract i am getting error as shown in screen shot..

any help will be helpful.

Thanks
Suraj


texts: A function declared payable is throwing a VMerror:revert in Remix

texts:
I was trying to fund a campaign created with a funding goal 10000000000000000000 and funding cap 10000000000000000000 by calling the payable method contributeMsgValue with parameter["100000000000000000"] and value 100000000000000000 but I am receiving this error in Remix.

  transact to StandardCampaign.contributeMsgValue errored: VM error:
  revert. revert    The transaction has been reverted to the initial state.

contract Campaign is Owned, Campaign {
  enum Stages {
    CrowdfundOperational,
    CrowdfundFailure,
    CrowdfundSuccess
  }
  modifier atStage(Stages _expectedStage) {
    if (stage() != uint256(_expectedStage)) {
      throw;
    } else {
      _;
    }
  }
  modifier validContribution() {
    if (msg.value == 0
      || amountRaised + msg.value > fundingCap
      || amountRaised + msg.value = expiry
      && earlySuccess == false
      && amountRaised = expiry && amountRaised >= fundingGoal)
      || earlySuccess == true
      || amountRaised >= fundingCap) {
      return uint256(Stages.CrowdfundSuccess);
    }
  }
  function contributeMsgValue(uint256[] _amounts)
    public
    payable
    atStage(Stages.CrowdfundOperational)
    validContribution()
    returns (uint256 contributionID) {
    contributionID = contributions.length++;
    contributions[contributionID] = Contribution({
        sender: msg.sender,
        value: msg.value,
        created: block.number
    });
    contributionsBySender[msg.sender].push(contributionID);
    amountRaised += msg.value;
    ContributionMade(msg.sender);
    if (enhancer.notate(msg.sender, msg.value, block.number, _amounts)) {
      earlySuccess = true;
    }
  }
  function StandardCampaign(string _name,
    uint256 _expiry,
    uint256 _fundingGoal,
    uint256 _fundingCap,
    address _beneficiary,
    address _owner,
    address _enhancer) public {
    name = _name;
    expiry = _expiry;
    fundingGoal = _fundingGoal;
    fundingCap = _fundingCap;
    beneficiary = _beneficiary;
    owner = _owner;
    created = block.number;
    enhancer = Enhancer(_enhancer);
  }
  struct Contribution {
    address sender;
    uint256 value;
    uint256 created;
  }
  uint256[] defaultAmounts;
  Enhancer public enhancer;
  bool public earlySuccess;
  address public owner;
  uint256 public fundingGoal;
  uint256 public fundingCap;
  uint256 public amountRaised;
  uint256 public expiry;
  uint256 public created;
  address public beneficiary;
  Contribution[] public contributions;
  mapping(address => uint256[]) public contributionsBySender;
  mapping(uint256 => address) public refundClaimAddress;
  mapping(uint256 => bool) public refundsClaimed;
  string public name;
}

Am I missing any code here or calling the function in a incorrect way?


texts:
Is there any convenient way to convert (e.g. cast) a struct type to bytes?

I'm trying to call a method like the one below (taken from here) where you can pass some (arbitrary) contextual info that get returned to you later in a "callback" method.

function approveAndCall(address _spender, uint256 _value, bytes _extraData)
    returns (bool success) {
    tokenRecipient spender = tokenRecipient(_spender);
    if (approve(_spender, _value)) {
        spender.receiveApproval(msg.sender, _value, this, _extraData);
        return true;
    }
}

Suppose I want to call this method passing a User struct as its _extraData argument, what would be a proper usage?

Thanks in advance,


texts: Choosing between Javascript and Solidity for testing smart contracts

texts:
Truffle offers two ways to test smart contracts: either using test files written as Solidity contracts, or Javascript/Mocha.

https://truffleframework.com/docs/truffle/testing/writing-tests-in-solidity

https://truffleframework.com/docs/truffle/testing/writing-tests-in-javascript

Are there recommendations on when to choose between the two? Do you stick to one or do you use both but for different purposes?


texts: How is consensus in the state achieved if contracts have random output?

texts:
I'm quite new to Ethereum so forgive my lack of detail and awareness in this question.

I've seen some gambling applications built on Ethereum and I'm wondering how the network agrees on the outcome of a random process to be included in the blockchain. Because of course, if a contract produces random outcomes it will have a different outcome each time it is run..

Thanks!


texts: Since miners are also nodes at the same time, they should be capable of sending transactions. So the question is, can they mine their own transaction technically? And if yes, are they allowed to do do? If yes, a miner will surely have maximum advantage on his own transaction and he should be able to mine it with a success rate of 100% and way faster than any other miner on the network. This defeats the concept of consensus.


texts: Are current ethereum opcodes prices in pyethereum updated?

texts:
I am not an expert in opcodes for Ethereum, but I am wondering if their prices here [https://github.com/ethereum/pyethereum/blob/develop/ethereum/opcodes.py] are updated as the latest version used by other clients?

If not how to update it?


texts: Is there any contract to get USD value of Ether

texts: I am looking for a contract address from where I can fetch current USD value of ether on fly, not looking for any api, so is there any contract for this ?


texts: call a payable function from front end app!

texts:
solidity code:

function fundIt() public payable returns (bool) {
            require(msg.value > .01 ether);
            address addr = this;
            donors.push(msg.sender);
            amount = addr.balance;

        }

and here is how I am calling it:

const $fundIt = async () =>{

       const fundit = await  mycontract.methods.fundIt({
                                                        from: '0xbf443ed3b73159d5bf427568359c7de4103413c3',
                                                        value: 3
                                                       })
                                                .then(res =>
                                                      console.log('Success', res))
                                                .catch(err => console.log(err))

     }

it is not working!! all I got was:

  Uncaught (in promise) Error: Invalid number of parameters for "fundIt". Got 1 expected 0!

Does anyone know why this is happening?
thank you!


texts: Can we store a deployed contract address in Remix Solidity IDE?

texts: Suppose I need to use deployed addresses of three different contracts in any other program, then every time I need to copy the address from previous deployed contract and paste it, so is there any alternative to avoid copying and pasting the deployed unique address?


texts: How long is the first sync supposed to last?

texts:
I've been running Geth (latest version) for around 12 hours and it's still not finished.

The command prompt shows this :

INFO [05-21|12:05:00] Imported new chain segment               blocks=1  txs=9   mgas=0.748 elapsed=40.047ms   mgasps=18.687 number=3742904 hash=f8fd6e…fce9f8

INFO [05-21|12:05:29] Imported new chain segment               blocks=1  txs=2   mgas=0.044 elapsed=16.018ms   mgasps=2.741  number=3742905 hash=04b0be…3d64cd

INFO [05-21|12:05:38] Imported new chain segment               blocks=1  txs=66  mgas=2.851 elapsed=95.126ms   mgasps=29.971 number=3742906 hash=157014…c50cc5

By the way, my Internet speed isn't that bad, check it out

Is this normal ? Should I try using another client such as Parity ?

PS : I've run Geth using this command line : geth --fast --cache=1024


texts: Transaction throughput: POA vs POW in private blockchain networks

texts:
I know that proof of work is resource intensive, while proof of authority is much faster as no consensus is required since the network is validated by the proper authorities.

But in terms of the transaction throughput in the private blockchain does it make a difference?

I mean, I can notice no difference in speed between a parity POA configured private network and a test ganache network (which should be using POW by default).


texts: How can I find ETC nodes (to pass their enode URI to --reserved-peers) because the classic chain no longer syncs through tor?

texts:
I was syncing the ETC chain on parity through tor. Everything worked fine. I got to block 3,000,001. Everything stopped, I realized there was a hardfork. I updated the software (ETH worked fine), but I never could find any peers or sync anymore after that on the ETC chain. I tried version 1.4.10, and 1.5 with fresh installs on linux. Nothing seems to work anymore for parity through tor for classic.

According to these github posts https://github.com/ethcore/parity/issues/4343
it seems that the parity install comes with some addresses of known nodes, but that list is outdated or those nodes are no longer working, and I can't find new ones because peer discovery is done through UDP and tor only runs through TCP. Is this an accurate understanding? If so what can I do to find out about new nodes to add manually by passing their enode URI to --reserved-peers as explained in that github post?


texts: Is the way I'm minting tokens bad practice?

texts:
Notice from:
https://ethereum.org/token

The mintToken Function:

function mintToken(address target, uint256 mintedAmount) onlyOwner {
    balanceOf[target] += mintedAmount;
    totalSupply += mintedAmount;
    Transfer(0, owner, mintedAmount);
    Transfer(owner, target, mintedAmount);
}

My question is... I'm doing:

Transfer(this, target, mintedAmount);

Instead of:

Transfer(0, owner, mintedAmount);
Transfer(owner, target, mintedAmount);

And its working... is what I'm doing bad practice?


texts: Migrate Etereum application from stand-alone node to INFURA

texts:
I have my own node deployed on Amazon and backend/frontend to work with it and it operates fine - transaction executed, events catched. Now I want to use INFURA instead maintaining my own node and confused how to solve following situation:

I have couple of functions in contract that availabled only for owner and protected by modifier. On my own node it works this way: first unlocked contract creator account (UI form contains wallet password field), then, if success, executed protected function. It is possible only when I have keyfile on the node.

But when I migrate to INFURA I'll have not access to this wallet and thus unable to unlock it. I see only one way - is to ask creator's provate key insteand of password, then create raw transaction, sign it and send to the network.

Question: it is only way to execute protected functions or I missed something simpler then this?

My stack is: Solidity, Node, Truffle, Web3 and so on.


texts: How do I know if my private net is using Byzantium?

texts:
Is there a flag that is showing that Byzantium is actually enabled in my private network?

This is the only thing I have found in my log at geth startup:

INFO [10-26|01:10:40] Initialised chain configuration          config="{ChainID: 1111 Homestead: <nil> DAO: <nil> DAOSupport: false EIP150: <nil> EIP155: <nil> EIP158: <nil> Byzantium: <nil> Engine: unknown}"

But I am not sure if this data is meaningful.

Is there somthing like

>eth.bizantiumActive()
1

???


texts: What chain is better about gas costs? Ethereum or Binance Smart Chain?

texts: I am developing an smart contract and i want to know what chain is better about gas costs. Ethereum or Binance Smart Chain? Thank you


texts: Failed to deploy to Graph node: Ethereum network not supported by registrar: mainnet

texts:
I followed this tutorial on the graph document: https://thegraph.com/docs/quick-start#local-development
However, I got an error message after I run yarn deploy-local.
Failed to deploy to Graph node http://127.0.0.1:8020/: Ethereum network not supported by registrar: mainnet

Is there anything I am missing here?
This is the whole log
Skip migration: Bump mapping apiVersion from 0.0.1 to 0.0.2
  Skip migration: Bump mapping apiVersion from 0.0.2 to 0.0.3
  Skip migration: Bump mapping apiVersion from 0.0.3 to 0.0.4
  Skip migration: Bump mapping specVersion from 0.0.1 to 0.0.2
✔ Apply migrations
⚠ Warnings loading subgraph from subgraph.yaml: Warnings in subgraph.yaml:

    Path: repository
    The repository is still set to https://github.com/graphprotocol/example-subgraph.
    Please replace it with a link to your subgraph source code.

    Path: description
    The description is still the one from the example subgraph.
    Please update it to tell users more about your subgraph.

✔ Load subgraph from subgraph.yaml
  Compile data source: Gravity => build/Gravity/Gravity.wasm
✔ Compile subgraph
  Copy schema file build/schema.graphql
  Write subgraph file build/Gravity/abis/Gravity.json
  Write subgraph manifest build/subgraph.yaml
✔ Write compiled subgraph to build/
  Add file to IPFS build/schema.graphql
                .. QmbSFRGGvHM7Cn8YSjDL41diDMxN4LQUDEMqaa5VVc5sC4
  Add file to IPFS build/Gravity/abis/Gravity.json
                .. QmajZTadknSpgsCWRz9fG6bXFHdpVXPMWpx9yMipz3VtMQ
  Add file to IPFS build/Gravity/Gravity.wasm
                .. QmbK8bwncci52cstF3P8Q8i4oGjrMt1pUqdv5Uf1VXqXdb
✔ Upload subgraph to IPFS

Build completed: QmYc13fDLwyvTT5crdGWGuFbaN23YxJ8RG8EGNW4Bac24j

✖ Failed to deploy to Graph node http://127.0.0.1:8020/: Ethereum network not supported by registrar: mainnet
error Command failed with exit code 1.


texts: tracing new address on new wallet in Ethereum

texts: I am just wondering how the new addresses are anonymous in Ethereum. Suppose that I have a wallet A including many addresses on it. Then I have a new wallet, say wallet B, and opening new address on it. But the first ether to this new address will come from one of the old addresses in wallet A. Is it possible to identify that this new address and old addresses are belong to same person?


texts: How to encrypt a message using only the public key from web3.eth.sign?

texts:
I retrieve the public key of a users account using Web3 as follows:

 web3.eth.sign(web3.eth.accounts[0], web3.sha3('test'), function (err, signature) {
          var sigtest = signature
          const util = require('ethereumjs-util');
          const sig = util.fromRpcSig(sigtest);
          const publicKey = util.ecrecover(util.sha3('test'), sig.v, sig.r, sig.s);
      });

I then want to encrypt a message with this public key (without having a users private key) - How to encrypt a message with the public-key of an Ethereum address gives an answer but in that example a private key is also given. How should this be done?


texts: Will the Constantinopole hard fork create new coins?

texts: Is the ethereum constantinopole hard fork going to result in extra forked coins for ethereum holders?


texts: I've seen this PR-2149 quite a few times already and people are saying this is big for Ethereum 2.0. Can someone explain in simpler terms what will it offer?


texts: Why are there multiple suicide calls from one address to a contract in the same block?

texts: There are several contracts whose internal Tx have only suicide calls from the same contract/user address over and over again. What is the need of having multiple calls?


texts: Metamask recovered from seed, not showing previous transactions

texts: I want to use my Metamask wallet on a different pc so I installed the chrome plugin and entered the words seed. The balance shown seems to be correct, but I cannot find a history of my previous transactions... Anyway to show this in the new metamask wallet?


texts: How to calculate the total number of ETH transmitted to the network every day?

texts:
I'm trying to calculate the amount of money sent from one address to another on the Ethereum network but I can't find any block explorer API that provides such information.

What is the best way to do that ?

Should I monitor stats from every blocks ? if so what information is usefull as there is nothing like volume transmitted in the basic stats from Etherchain of Etherscan.

https://etherchain.org/documentation/api/#api-Statistics-GetBasic_stats

Thanks!


texts:
Is there  specific way to explain the variables of a struct using the Natspec format?
I do something like:

struct XYZ{
   uint x; //Explain what it does
   uint y;
}

Is it this the right way for structs, or like functions do we have to define the comment at the top?


texts: Nethereum Getting TransactionHash of SendTransaction

texts:
I am using Nethereum for Unity3d and I have managed to muddle my way through a lot of issues, but I have a huge problem I just can't seem to solve.

I can get this to work with signed transaction requests (SignAndSendTransaction), however when integrating with MetaMask it seems to be a whole different ballgame.

My code is as follows:

var spendRequest = new EthCallUnityRequest(_url);
var transactionInput = tokenContractService.CreateSpendTransactionInput(accountAddress, new HexBigInteger(amountToSpend), new HexBigInteger(50000), new HexBigInteger(25), new HexBigInteger(0));
Debug.Log("Sending transaction...");
var sendTransactionRequest = SendTransaction(transactionInput.To, transactionInput.Data);

var transactionReceiptPolling = new TransactionReceiptPollingRequest(_url);
Debug.Log("Waiting for result...");
yield return transactionReceiptPolling.PollForReceipt(sendTransactionRequest, 2);
spentSuccess = true;

It flows sort of like this:

user presses a button to spend some stuff.
When they press the button, MetaMask pops up and asks the user to confirm they want to send the gas and such
That popup happens when SendTransaction is called (fourth line).
Program should wait for the user to click confirm, and for the transaction to be mined before continuing (it doesnt, i just get error)

I have also tried doing a "yield return new SendTransaction(...)" but I didn't know how to store the transaction hash from doing that... so i ended up with line 4.

The program needs to get the transaction hash of that transaction to be able to poll for the success (so that it spins inside a coroutine until it is successful and we can all move on).

Here is my output:

UnityLoader.js:4  Sending transaction...
UnityLoader.js:4 (Filename: ./Runtime/Export/Debug.bindings.h Line: 43)
UnityLoader.js:4
blob:https://v6p9d9t4.ssl.hwcdn.net/f17f9204-09dd-4f19-9177-12b9f92f95a0:2 0x82a9b48b2759411d7598462051451fecc9061c216379596d53309c2c121223b5
UnityLoader.js:4 Waiting for result...
UnityLoader.js:4
UnityLoader.js:4 (Filename: ./Runtime/Export/Debug.bindings.h Line: 43)
UnityLoader.js:4
UnityLoader.js:4 ArgumentNullException: Argument cannot be null.
UnityLoader.js:4 Parameter name: transactionHash
UnityLoader.js:4   at Nethereum.RPC.Eth.Transactions.EthGetTransactionReceipt.BuildRequest (System.String transactionHash, System.Object id) [0x00000] in <filename unknown>:0

I have run out of ideas! I know (I think) the problem lies in the fact that the transaction isn't "sent" until the user presses "confirm" but the code is all like "meh who cares, its done, lets continue".

Any help would be super appreciated, or even a finger point in another place I might ask this to get help.

Thank you for your time!


texts: abstract contract getting deployed instead of the main contract on truffle migrate

texts:
I'm building a project which consists of two .sol files -> A.sol and B.sol. Now,
A.sol contains an abstract contract definition of B, among other things, like this:

Contract B {
  function fnB() public;
}

similarly B.sol contains an abstract contract definition of A:

Contract A {
  function fnA() public;
}

This is been designed such to attain a certain 'message passing' between the two contracts. There is no inheritance between these two contracts, as the abstract contracts are being used for composition. Now the problem is, while using truffle, the '2_deploy_contracts.js' file imports artifacts for both using their contract name (instead of the .sol file name). An error is being thrown because of that since the truffle migrate command is considering the respective abstract contracts instead of the main contracts. Is there a workaround for this? The exact error thrown by 'truffle migrate' command is this:

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

The deploy js file looks something like this:

var A = artifacts.require("A");
var B = artifacts.require("B");

module.exports = function(deployer, network, accounts) {

    if(network == "ganache") {
        deployer.deploy(A, {gas:400000})
            .then(function(receipt) {
                return deployer.deploy(B, A.address, {from:accounts[0], gas:400000});
            })
            .catch(function(e){
                console.log(e);
            });   }};


texts: error: data location must be storage or memory for parameter in funtion but none was given solidity

texts:
pragma solidity ^0.5.0;
contract Election{
  //model a candidates
  struct candidate
  {
    uint id;
    string name;
    uint votecount;
  }
  //store candidates
  //fetch candidate

  mapping(uint => candidate) public candidates;

  //store candidate count

  uint public candidatescount;

  function () Election public {
    addcandidate("candidate1");
    addcandidate("candidate2");
  }
  function addcandidate (string _name) private
  {
    candidatecount ++;
    candidates[candidatescount] = candidate(candidatescount, _name, 0);
  }
}


texts:
I'm trying to deploy contract using Mist on Mac OS X. It worked fine on testnet but when I try to do it on main net the transaction just hangs on

  "Couldn't estimate gas, restoring to default parameters. Transaction is likely cheaper than the estimate"

I have deployed token contract using byte code and MEW before but in this contract I need to provide:

token address used as reward
token price
beneficiary address

and I just don't know how to do it using Remix and bytecode

Here's my contract

pragma solidity ^0.4.18;

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

contract Crowdsale {
address public beneficiary;
uint public amountRaised;
uint public price;
token public tokenReward;
mapping(address => uint256) public balanceOf;

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

/**
 * Constructor function
 *
 * Setup the owner
 */
constructor(
    address ifSuccessfulSendTo,
    uint milietherCostOfEachToken,
    address addressOfTokenUsedAsReward
) public {
    beneficiary = ifSuccessfulSendTo;
    price = milietherCostOfEachToken * 0.001 ether;
    tokenReward = token(addressOfTokenUsedAsReward);
}

function () payable public {

uint amount = msg.value;
balanceOf[msg.sender] += amount;
amountRaised += amount;
tokenReward.transfer(msg.sender, amount * 10**18 / price);
emit FundTransfer(msg.sender, amount, true);

// Forward funds immediately to beneficiary
beneficiary.transfer(amount);
}
        }


texts: What are the current challenges developers face in creating a dapp in ethereum?

texts: Can you tell  what are the pain points for the Blockchain developers while developing DApp/ managing consortium networks.


texts: Why is homebrew downloading old geth version?

texts:
Im on mac OSX, so I go to terminal CLI and do

brew install ethereum

then I get

==> Downloading https://build.ethdev.com/builds/OSX%20Go%20master%20brew/193/bottle/ethereum-1.1.0.yosemite.bottle.193.tar.gz
######################################################################## 100.0%
==> Pouring ethereum-1.1.0.yosemite.bottle.193.tar.gz

So now I'm left with Ethereum 1.1 , but I need 1.3.1
how do I fix this?


texts: How a contract on Ropsten (deployed after fork) emit 3/5 events on the shorter chain while same contract on longer chain emits 5/5 of the events

texts:
General info:

We have a full-node, which broadcast our txs.
We have a EventSource contract which contains 5 events types.
The eventSource contract deployed only after Istanbul fork. Our node was pointing to miners-chain so now it exists on both chains.

When I try to track Event 1 and 2 out of the 5 on the shorter, dev-chain I'm not able to find them on Ropten etherscan for example.

When I query them on the longer chain they appear.

How is that possible?

The event source is part of contracts complex and triggers as a result of multiple txs within the complex.

My assumption:
One of the contracts failed to be deployed on the shorter chain there for failing the tx there.

Why I think my assumption is wrong:
We have another deployment of that contract complex from before the fork.
But also there we're not able to fetch event 1,2 from the eventSource contract at all since the hard fork on Etherscan.

General information:
1. Part of the events are emitted well, from the two contracts complexes.
2. Rest of the app is still functional.

-----------------Edit-1--------------------------------------------------------

The contract code can be found on - Github and the deployed address is - 0xaee2bb51071df79284b87874e3b96a49cb0885de.

The following events:

AcquisitionCampaignCreated
DonationCampaignCreated

appears only on the longer chain and not on the Istanbul fork.

-----------------Edit-2--------------------------------------------------------
After we switched our full-node to shorter dev-chain and initiate the tx that suppose to trigger the campaign creation event it worked, now the dev-chain is also emitting that event the only difference that now we are no longer transacting in the longer miner-chain and only on the shorter dev-chain.


texts:
Jaxx by Kryptokit offers Bitcoin and Ethereum for mobile and browsers.

I installed the wallet on my Android device. But it only offers Bitcoin functionality. I see screenshots online which displays an Ethereum logo which my app does not have.

How to enable Ethereum support in the JAXX mobile wallet?


texts: Need help about contract distribute token to multiple address

texts:
From my base address I created a contract standard ERC20 token but I forgot add the distribute function so I made a new more contract like this:

pragma solidity ^0.4.16;

contract Owned {
        address public owner;

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

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

        function transferOwnership(address newOwner) onlyOwner {
            owner = newOwner;
        }
}

contract BatchToken is Owned {
    mapping (address => uint256) public balanceOf;

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

    function distributeToken(address[] addresses, uint256 _value) onlyOwner {
        for (uint i = 0; i < addresses.length; i++) {
            balanceOf[owner] -= _value;
            balanceOf[addresses[i]] += _value;
            Transfer(owner, addresses[i], _value);
        }
    }

    function Destroy() onlyOwner() {
        selfdestruct(owner);
    }
}

Then I send the token from Token contract to this contract and run distribute, it's working ok. But the problem is: token receive show as no name.
Please check this out


texts: Is it possible to send a raw, signed transaction from an ethereum contract?

texts: Does the EVM support this? Does solidity allow this? How can I do it?


texts: Am I setting my gas price and gas limit correctly?

texts:
web3.TransactionManager.DefaultGas = 210000;                  // Gas limit?
web3.TransactionManager.DefaultGasPrice = 10 * 1000000000;    // Gas Price?

I have intended to set the gas price at 10Gwei.


texts: security and implementation challanges when launching the token

texts:
I would like to know what are security holes when launching an ERC20 token or other tokens. Below is my process of launching token:

Creates an ERC20 token contract with truffle.
Defines network configuration of ropsten.infura.io with HD wallet by passing mnemonic of wallet to sign transactions.
Compile and migrate it to ropsten network.
Doing transaction(transfer etc) from truffle console / Myetherwallet interface interation / web3 interface etc.

suggestions in order to improve security are highly appreciated.
looking forward Thanks :)


texts: How to choose an account to deploy a contract in truffle

texts:
How do you select an account to deploy a contract using:
1)Metamask
2)Parity
3)some config file


texts: Configuring geth so that it can only connect to my private local blockchain?

texts:
Basically I would like to know how to configure geth so that it can only connect to my private ethereum blockchain that is hosted on another machine?

Many thanks in advance!


texts: What are the different synchronization types for an Ethereum node? Which of them are client-specific (Geth, Parity)?


texts: How is the volume for the currency pair accounted for on chainlink's reference data feed?

texts:
https://feeds.chain.link/ - link for reference.
Let's take the LINK/USD feed for example: From my understanding, the aggregation contract fetches the price of LINK in USD from the node operators who get their price from other aggregation services. Then, smart contracts of other services e.g synthetix fetch the data from this contract and use the price? Does it take the volume into account? Is this the VWAP? Or is this the TWAP?


texts: Smart Contract (SC) - Is it a Block itself?

texts: Is SC a block itself on the Ethereum Block chain or it's just a storage? I know SC has its own hash address, it's own data stored in State variables, but does it has nonce and gas limit?


texts:
pragma solidity >=0.4.0 <0.7.0;

contract InsanFactory{

    struct User{
         string name;
         address myaddress;
    }

    mapping(address => User) public userStructs;

    address[] public userAddress ;

    function createUser(string memory name,address myaddress) public{
        userStructs[msg.sender] = name;
        //set user name
        userStructs[msg.sender] = myaddress;
        //address'i degistirdim
        userAddress.push(msg.sender);

    }
    function getResult() external view returns(address[] memory){
        return userAddress;
    }
}

When I compile this code I got 2 errors:

First error at line 15 says:

Type string memory is not implicitly convertible to expected type struct InsanFactory.User storage ref.
line 15(userStructs[msg.sender] = name;)

Second one at line 17 says:

Type address is not implicitly convertible to expected type struct InsanFactory.User storage ref.
line 17(userStructs[msg.sender] = name;)

What should I do for my error ?


texts: How to create a two-way peg ERC20 token?

texts:
I was looking at the Woofy token, that is a two-way peg to YFI.
I don't use Vyper myself. I'm trying to understand how something like this is created.
How is it possible to create a token that is pegged to a percentage of another token?


texts: See what's inside an ethereum transaction

texts: If someone sends a transaction to the network, let's say they execute the transfer function on a solidity contract, is there any way for someone to see their interaction with the contract? Meaning the amount and whom they sent it to? A sort of way like XSS scripting to act as a go-in-between? To peer inside and see what's going on? Can miners see or decrypt transactions?


texts: if the smart contract has terms to be met in a time order and transactions corresponding to the terms, what happen when two different users

texts: if the smart contract has terms to be met in a time order(assuming in one year time frame) and transactions corresponding to the terms, what will happen to the variables stored in the contract account when two different user accounts initiate the smart contract one after another and are being mined by the same miner?  For example, the smart contract is about paying money at different stages of constructing an apartment building, and is used between a construction company and different apartment buyers.


texts: Ethereum private network - What is AWS minimum hardware requirement?

texts:
I have been setting up private blockchain network on two AWS EC2 instances for one of the demo setup. Initially, I chose t2.micro for both. However, miner.start(1) has been very unpredictable so far.

I dont see number of calls will me huge so may be 20-25 transactions on these nodes during demo after the initial setup, which will be done beforehand.

I aim to take t2.medium now. However not sure, if it is sufficient still. Can someone help please?


texts: Storing private data on the ethereum blockchain

texts:
I plan to make an app utilising Ethereum that will store private data about a user. Eventually, I want this data to be accessible by selected users.

I have seen conflicting answers & discussions on various threads on SE, reddit, and, other articles about the best way to approach this. Though here are some options I have been considering:

I could encrypt with a key, and add to the blockchain, but, isn't this the equivalent of a database being hacked? The data is, of course, encrypted but it is available to the public (Vitalik suggests it is low-tech Could someone suggest why this is not a good method?). In addition, this could get expensive with a lot of transactions.
Use Quorum, not 100% sure if it's suitable for my use case.
Zcash may offer a private data solution (haven't fully looked into it), though I would rather keep to Ethereum if possible, may have a longer life.
I could Take a similar route as lemon email: message transaction data on ethereum, encrypted data on IPFS, frontend on IPFS.

I feel that 4 (lemon email) is the best option, though, kind of feels like cheating because the data isn't then on the blockchain.

Are there any other options I should consider? Is there a better way to implement this?


texts: Unable to transact using ethereum wallet

texts:
I am unable to transact ETH from wallet. It throws the error:

  Exceeds Gas or Intrinsic gas.

I don't know what to do with that.


texts: Game: Is it possible that someone could exploit a counter and always win?

texts:
I've made a game that depends on a counter, the first user that get to the target wins. Can someone exploit this and always win?

I know that everyone can know the current count, but since there are multiple people competing, I'm not really sure if someone could always get in the the right position everytime.

I've been looking for 2 days, and haven't found an exact answer (Maybe I'm looking the wrong way).

Here's a dumbed down version of the contract.

pragma solidity ^0.4.19;

contract Ten {

    uint counter = 0;

    function increment() external {

        counter++;

        if(counter == 10) {
            // User won - Give hime the prize
            counter = 0;
        }

    }

}


texts:
I keep getting this message with any version of ethereum I download and open.

I tried to run as administrator but same issue.

other questions on SO have different errors.

when I check the path C:\gopath It doesn't exist.


texts: Set required timestamp for txs - possible?

texts: Is there any way to tell a miner "Do not include my tx before 2am UTC"?


texts:
Is there any command or utility to deploy contract from .sol file to test-net? I've seen there is JSON API, so I can write some code to implement this. But isn't it done already?

Thanx.


texts: ReplaySafeSplit contract on Mist v0.8.10

texts: I'm trying to split my ETH/ETC from a presale wallet in Mist v0.8.10. I've followed the original Steemit post on running the split contract yet when I go to run the contract it doesn't show a field to input the number of coins I wish to split. I would obviously like to send a small amount first to ensure if all works as desired. Any ideas on what I'm missing?


texts: Smart contract that accepts custom token

texts:
I've successfully created my own custom token on the Rinkeby testnet. Upon creation of the token I sent all the new coins to my wallet. I can send the new token to other wallets just fine and it shows up.

However I'm having difficulty writing a smart contract to accept the new token. I've sent the token from my wallet to the contracts address and it's been confirmed. However within the contract I can't see that it has received the token.


texts: Should Solidity interfaces always specify return types?

texts:
I've seen interfaces in which the function definitions specify a return type, ie:
(from openZepplin's IERC721.sol)

function balanceOf(address owner) public view returns (uint256 balance);

and sometimes, even in the same interface, you'll see something like:

function approve(address to, uint256 tokenId) public;

Obviously, it doesn't make sense for approve to return a uint. It could, however, return a boolean value:

return(bool success)

I can see that the absence of a return type in the interface allows more flexibility in how the implementation handles the return value, but are there any other drawbacks/benefits to specifying a return type vs leaving it out of the interface?


texts:
I have an array of addresses (array[]) and I need to encode it into bytes and vice-versa. The reason for that is that I need to pass such an array to a function which only accepts bytes.
I tried using abi.encode() and abi.decode() but I get a "This type cannot be encoded" compiler error:
address[] memory addresses;
addresses[0]= 0x...;
addresses[1] = 0x...;
addresses[2] = 0x...;

(bytes memory data) = abi.encode((address[]), addresses);

How should I really encode this? I'm planning to do the same encoding in web3.js too, so I would prefer an idea which works here too.


texts: How to completely empty an Ethereum wallet using W3.py

texts:
I have an ethereum wallet, I need to calculate the amount to completely empty the wallet.

So currently i calculate the needed gas like this,

needed_gas = w3.eth.gasprice * 210000

amount_to_send = balance - needed_gas

However, the are still few cents remaining in the account, this causes a loop as I try to transfer untill the amount_to_send value is 0.


texts:
What the theory behind using msg.value instead of this.balance
when e.g withdrawing contributed funds from a contract?

E.g

wallet.transfer(this.balance);
wallet.transfer(msg.value);


texts: How to register a public key for an ethereum contract?

texts:
As part of the EOS token distribution there's an alert for the following risk:

If you hold EOS Tokens in an Ethereum account and fail to register a public key, then your EOS Tokens will not be part of the snapshot when the EOS Tokens become fixed and non-transferable on the Ethereum blockchain.

How can one register a public key?


texts: Error: invalid argument 0: json: cannot unmarshal object into Go value of type string

texts:
I have followed following solution.

When I try to do shh.getPrivateKey(kId).then(console.log)

I have received following error, please note that this line works under web3.py:

UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Returned error: invalid argument 0: json: cannot unmarshal object into Go value of type string

[Q] How could I fix this error?

web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
if(!web3.isConnected()){console.log("notconnected"); process.exit();}

var Shh = require('web3-shh');
// "Shh.providers.givenProvider" will be set if in an Ethereum supported browser.
var shh = new Shh(Shh.givenProvider || 'http://localhost:8545');

var kId = shh.newKeyPair().then(console.log); //b9180e43e5b712868482173d71cf18ff78900e645699d00f9129d6458aaa1fb7
var privateKey = shh.getPrivateKey(kId); //Error Occurs!!!


texts: Issue Instantiating instance of a deployed smart contract. TypeError Should be marked Abstract

texts:
I'm having an issue using an instance of a deployed smart contract in my code. This could easily be me being a solidity novice, but perhaps some of you might be able to point out what I am missing.
I am trying to integrate the contract deployed here. The contract has a number of functions but I only need to use a couple. I am using solidity 0.6 and here is how I am integrating it...
First here is the functions I am pulling out of the contract to use.
contract IOneSplit {

    constructor(address _oneInchAddress) public {
        IOneSplit(_oneInchAddress);
    }

    function getExpectedReturn(
        IERC20 fromToken,
        IERC20 destToken,
        uint256 amount,
        uint256 parts,
        uint256 flags // See contants in IOneSplit.sol
    )
        public
        view
        returns(
            uint256 returnAmount,
            uint256[] memory distribution
        );

    function getExpectedReturnWithGas(
        IERC20 fromToken,
        IERC20 destToken,
        uint256 amount,
        uint256 parts,
        uint256 flags, // See constants in IOneSplit.sol
        uint256 destTokenEthPriceTimesGasPrice
    )
        public
        view
        returns(
            uint256 returnAmount,
            uint256 estimateGasAmount,
            uint256[] memory distribution
        );

    function swap(
        IERC20 fromToken,
        IERC20 destToken,
        uint256 amount,
        uint256 minReturn,
        uint256[] memory distribution,
        uint256 flags // See contants in IOneSplit.sol
    ) public payable returns(uint256);

}

Next, here is how I am attempting to instantiate a version of the deployed contract to call on the functions.
contract ExampleContractCall {

    constructor(address ONE_SPLIT_ADDRESS) public {
        IOneSplit oneInchContract = IOneSplit(ONE_SPLIT_ADDRESS);
    }

    oneInchContract.swap(*insert parameters here*)
}

This is how I try to call it but when I compile I get "TypeError: Contract "IOneSplit" should be marked as abstract." Any ideas how to integrate this contract?


texts: How to create transaction data for sending ethereum from multiSig contract to account with Web3.js v1.2.1

texts:
I am using a standard MultiSigWallet contract. My goal is to create the data parameter with web3, which is used in executeTransaction / external_call (bytes memory data). The transaction should send Ether from the MultiSigWallet to a specific user address.

Solidity

contract MultiSigWallet {
struct Transaction {
    address destination;
    uint256 value;
    bytes data;
    bool executed;
}

/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return transactionId transactionId Returns transaction ID.
function submitTransaction(address destination,
    uint256 value,
    bytes memory data)
    public
    returns (uint256 transactionId)
{
    transactionId = addTransaction(destination, value, data);
    confirmTransaction(transactionId);
}

/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint256 transactionId)
    public
    ownerExists(msg.sender)
    transactionExists(transactionId)
    notConfirmed(transactionId, msg.sender)
{
    confirmations[transactionId][msg.sender] = true;
    emit Confirmation(msg.sender, transactionId);
    executeTransaction(transactionId);
}

/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint256 transactionId)
    public
    ownerExists(msg.sender)
    confirmed(transactionId, msg.sender)
    notExecuted(transactionId)
{
    if (isConfirmed(transactionId)) {
        Transaction storage txn = transactions[transactionId];
        txn.executed = true;
        if (
            external_call(
                txn.destination,
                txn.value,
                txn.data.length,
                txn.data
            )
        ) {
            emit Execution(transactionId);
        } else {
            emit ExecutionFailure(transactionId);
            txn.executed = false;
        }
    }
}

// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination,
    uint256 value,
    uint256 dataLength,
    bytes memory data)
    internal
    returns (bool)
{
    bool result;
    assembly {
        let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
        let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
        result := call(
            sub(gas(), 34710), // 34710 is the value that solidity is currently emitting
            // It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
            // callNewAccountGas (25000, in case the destination address does not exist and needs creating)
            destination,
            value,
            d,
            dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
            x,
            0 // Output is ignored, therefore the output size is zero
        )
    }
    return result;
}

}
}

Web3

multisigInstance = MultiSigWallet.new(owners, confirmations);
dataParameter = multisigInstance.contract.transfer.getData(depositAddress, amount);

This code results in error TypeError: Cannot read property 'getData' of undefined

multisigInstance = MultiSigWallet.new(owners, confirmations);
dataParameter = multisigInstance.contract.methods.transfer(toAddress, amount).encodeABI();

This code results in error results in TypeError: multisigInstance.contract.methods.transfer is not a function

Similar Problems but outdate:

How to transfer ERC20 tokens using web3js

How to send ERC20 token using Web3 API?


texts: Ethereum Wallet unable to connect to node

texts:
I am receiving the error message below:

Is anyone able to tell me what I am doing wrong?  Thank you


texts: Error for ERC20 transfer The constructor should be payable if you send value

texts:
I have two contract

1) ERC20 contract

2) ERC20 token registry contract which is invoking my token contract and making a transfer function call to the token

But function call is ending up with an error stating that the transaction to ERC20Registry.deployERC20 failed:

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

Source

Token Registry Contract

pragma solidity >=0.4.24;

import './TERC20.sol';

contract ERC20Registry {
  function deployERC20(
    string _Name,
    string _Symbol,
    uint256 _initialSupply
    )
    public
    returns (address)
    {
      TERC20 token = new TERC20(_Name, _Symbol, 18, _initialSupply);
     token.transfer(tx.origin, token.totalSupply());
     return address(token);
    }
}

Token Contract

pragma solidity >=0.4.24;

import "./ERC20.sol";
import "./ERC20Detailed.sol";
import "./Ownable.sol";

contract TERC20 is ERC20, ERC20Detailed, Ownable {
  constructor (
    string memory name,
    string memory symbol,
    uint8 decimals,
    uint256 initialSupply
  )
  ERC20(initialSupply)
  ERC20Detailed(name, symbol, decimals)
  public
  {
    emit Transfer(0x0, tx.origin, initialSupply);
  }
}


texts: Remix: gas required exceeds allowance when calling IERC20 transferFrom

texts:
When I called fransferFrom by using erc20 interface (IERC20), an error says "gas required exceeds allowance (10000000) or always failing transaction".
I made allowance for the contract beforehand.
This is the contract that call transferFrom.
pragma solidity ^0.6.7;

interface IERC20 {
    function totalSupply() external view returns (uint256);
    function balanceOf(address account) external view returns (uint256);
    function transfer(address recipient, uint256 amount) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint256);
    function approve(address spender, uint256 amount) external returns (bool);
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

contract TokenSale {

    address public token_address;

    constructor(address _token_address) public {
        token_address = _token_address;
    }

    function sendEtherFromDeposit(address _token_supplyer) public returns(bool success) {
        require(IERC20(token_address).allowance(_token_supplyer, address(this)) >= 10000, "insufficient allowance amount");
        IERC20(token_address).transferFrom(address(this), msg.sender, 1000);
        success = true;
    }

}

Are there any problem of my code?
Could you give me any advise, please?


texts: How to create a faucet for my Ethereum Private network as a clone of https://faucet.ropsten.be/

texts: I have set up a Ethereum Network with 5 nodes on azure. Now I want to make a faucet like https://faucet.ropsten.be/ .Where anyone can go and put there wallet address and can get my network testether. So for this I have deployed a smart contract on my network . In that smart contract a function is there which users will have to execute to get the testether. But because they don't have any testether so they cannot pay the gas for the function execution for this I will have to implement a solution in which gas is paid by the smart contract itslef which is storing the testether of my network.So for this the solution is a little complex will have to use signing transaction and all like in this article(Create a faucet for Ethereum Private network to get Ethers I was wondering if anyone can suggest an easy solution in which my send user just out his/her wallet address and click a button on frontend and they get the testether without showing them any signing and anything just like rinkbey or ropsten testnet faucet.


texts:
I  am a beginner trying to run the following code on remix.ethereum.org

 pragma solidity ^0.4.19;
function processData(uint num) returns (bool) {

    uint _number = num;
    if(num == _number)
    {
        return true;
    }
    else
    {
        return false;
    }
}

But i am getting the Error

browser/code1.sol:2:1: ParserError: Expected pragma, import directive or contract/interface/library definition.
function processData(uint num) returns (bool) {
^

How can i get past this Error?

Secondly, even if  I ignore the above Error, the code is expected to have one of the following Errors that I want to catch but apparently the code seems to not have any of the following Errors. Do you agree?

Unmatched  Recursion
Missing parenthesis
Incompatible types
Wrong typecasting
Undeclared variable or function
Missing semicolon
Wrong Use of if conditional


texts:
I got some misunderstanding with how to connect to my private Blockchain.
So, I got private Blockchain and I can mine there.
I activate there genesis.json file, made mew account for "coinbase".

For example, I activate my private Blockchain by geth:

  geth --rpc --rpcaddr "192.168.0.102" --rpcport "8585" --mine --rpcapi "db,eth,net,web3,miner" --networkid 57 --ipcpath "&APPDATA&\Ethereum\geth.ipc"

Here I put my laptop address (cause it runs there and it's port). Also, I got another computer. which is out of my local network. How can I get it to my chain? Not as miner, for example, just to send there some type information?

Also, the second problem is with my local network. My laptop has 192.168.0.102 and I connected to my WIFI Raspberry pi and it's address is 192.168.0.103. As far, as I see, they are both in my local network. So, how can I connect it to my Blockchain?

If I put there:

  geth --rpc --rpcaddr "192.168.0.102" --rpcport "8585" --rpcapi "db,eth,net,web3,miner" --networkid 57 --ipcpath "&APPDATA&\Ethereum\geth.ipc"

I just start a new private Blockchain.

To be honest, I'm terribly confused. Or there is no way to connect to it, if I am not in a local network, not on one machine?

Thank you for understanding, I hope, I will get an answers.


texts: The use of ERC20 tokens in a private ethereum network

texts:
I am being told to use a private blockchain instead of the public one in attempt to cut gas cost. But I was hit with the problem of the value of ether and tokens in this private blockchain.

I am implementing an ERC20 Token to be used in value exchanges between wallets that are controlled by our backend system.

In a public chain the token value is measured by ether which has a certain known value in USD.
 In case it is a private chain this value ( of ether and consequently erc20 tokens ) will have to be set manually.

So my question is : is the value of ether, in the private blockchain, set manually based on some off chain calculations ? is using ERC20 tokens in private blockchain when it s meant to serve as Fiat currency equivalent, a design flaw ?

thanks.


texts: How can lite-server start on different machine?

texts:
I created the Front-End side of my DApp, now to run it on the Ropsten Test Network I need to start lite-server (npm run dev) and it open up the browser with my index.html file.

If I open the file without lite-server the website doesn't work. It doesn't connect to the Network.

How can I put the website on-line without needing the visitors to use lite-server?

I hope that I explained it proprerly, sorry for the bad English.


texts: How to get who won the block reward programatically?

texts:
I know that the block is solved by which pool thanks to a block explorer like etherscan.io.

But where is that information in the blockchain and how can I get it programatically?


texts: Use-Case: building a small test-network, did I got it right?

texts:
I've to implement a simple use case and I'm not really sure if I understood everything correctly.

What I'm trying to do is to build up a network with a few Raspberry-Pi's, running as full-nodes. Those nodes collect data, which are then saved in the blockchain. That data can be visualized by a DApp, which is running as a light-client, since it's only reading from the blockchain.

So everytime a node want's to save data, it issues a smart-contract, which gets executed by every node in the network. The miner starts mining a new block, which gets broadcastet after he solved the PoW (in my case I only have one miner).

The GUI can read the data from the ledger.

Did I understood everything correctly so far? The next question is, when I read data from the ledger, I connect to a random node in the network, which then reads the data from their local blockchain? In my diagram the ledger is shown as an single "entity", but in reality it is distributed in the network?

Does it make sense like this?

Any help is highly appreciated - also forgive my poor diagram :), I've a better one, but I can't post it here.

PS: I'm trying to run it with a private blockchain.


texts: Is there a Blockchain StackOverflow? As in an alternative to stack overflow which is blockchain-based

texts:
Is there a Blockchain StackOverflow.com alternative?
I'm wondering if there exists some product, which is basically just stackoverflow but a blockchain platform? Something which cannot be controlled centrally, where perhaps answers are rewarded with some coin.


texts: How many transactions get automatically replayed on both sides of the fork?

texts:
There is a lot of talk about possibility of replay attack, but I suspect (and I've seen it claimed) that many (perhaps most or even all) transactions that users issue on one of the chains get replayed automatically on the other. Does someone have some statistics, or a way to get them, about how often (for what percentage of transactions) does this happen?

Note that it's probably very easy to pull this "attack" (perhaps some users may even be doing this inadvertently): to my understanding, it just takes a single node in the network that connects to some nodes that support the HF and some that don't.


texts:
I wrote one contract to call a function from another contract like below

pragma solidity ^0.5.1;

contract test3 {
    address watch_addr = address(0x1234567963); //deployed contract address

    function balanceOf(address owner) public {
        watch_addr.call(abi.encodeWithSignature("balanceOf(address)", owner));
        return balanceOf(owner);
    }
}

I want to call a balanceOf function in deployed contract.Now I deployed the new contract successfully but I am getting the following error while calling the balanceOf function

  error:"Gas estimation errored with the following message (see below).
  The transaction execution will likely fail. Do you want to force
  sending? "

Can any one please tell me the solution? --Thanks


texts: How would I explain Ethereum to a non-technical friend?

texts:
I've recently attempted to explain Ethereum to several non-techy friends.

My explanation usually involves starting with a comparison to Bitcoin, but this quickly becomes complicated as I then have to explain the backstory of how the Bitcoin blockchain works, which is similarly technical in nature.

Is there a better way to describe the general concepts of Ethereum to non-techies? Are there any analogies I can make to things that are less technical in nature? Or is it just the case that the technology is quite complicated...?


texts: Ethereum Account setup, connect with the blockchain and keep tracks of the updates

texts:
I have a Bitcoin wallet developed in Java/Spring MVC and supports account setup, connect with the blockchain and keep tracks of the updates such as the balance, transactions etc. The sample code provided,

public class WalletModel {

    // keep tracks of the updates in the wallet
    private void update(Wallet wallet) {

          this.balance = wallet.getBalance();

    this.address = wallet.currentReceiveAddress();

    transactions.addAll(wallet.getRecentTransactions(100, false));

    // find to most recent transaction
    this.transaction = Objects.isNull(transactions) ||
            transactions.isEmpty() ? "No transaction" : String.valueOf(transactions.get(0));
  }

public boolean setWallet(Wallet wallet) {

    try {

        wallet.addChangeEventListener(new WalletChangeEventListener() {
            @Override
            public void onWalletChanged(Wallet wallet) {
                update(wallet);
            }
        });
        update(wallet);
        return true;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return false;
     }
 }

The WalletManager code e.g,

public class WalletManager {

      public static WalletAppKit bitcoin;
      public static NetworkParameters networkParameters =
 TestNet3Params.get();

public static WalletManager setupWallet(final String walletName) {

        logger.info("Setup Wallet");

        WalletManager walletManager = new WalletManager();
        walletManager.setupWalletKit(walletName);

        try {
            if (walletManager.bitcoin.isChainFileLocked()) {
                return walletManager;
            }
        } catch (IOException e) {
            e.printStackTrace();
            return walletManager;
        }

        walletManager.bitcoin.startAsync();
        return walletManager;
    }

private void setupWalletKit(final String walletId) {

        File directory = getWalletDirectory(walletId);

        // if the seed is not null, that means we are restoring from the backup
        bitcoin = new WalletAppKit(networkParameters, directory, WALLET_FILE_NAME) {

            @Override
            protected void onSetupCompleted() {

                // Don't make the user wait for confirmations
                // they're sending their own money anyway!!
                bitcoin.wallet().allowSpendingUnconfirmedTransactions();
                Wallet wallet = bitcoin.wallet();

                model.setWallet(wallet);
                setupCompletedListeners.forEach(listener -> listener.onSetupCompleted(wallet));
            }
        };

        // Now configure and start the appkit. This will take a second or two - we could show a temporary splash screen
        // or progress widget to keep the user engaged whilst we initialise, but we don't.
        if (networkParameters == RegTestParams.get()) {
            bitcoin.connectToLocalHost();   // You should run a regtest mode bitcoind locally.
        } else if (networkParameters == TestNet3Params.get()) {
            bitcoin.useTor();
        }

        bitcoin.setDownloadListener(model.getSyncProgressUpdater())
                .setBlockingStartup(false)
                .setUserAgent(APP_NAME, "1.0");
    }
}

How to write similar operations in the Ethereum with Java?

UPDATE

I use maven for the development and use EthereumJ dependency e.g;

       <dependency>
            <groupId>org.ethereum</groupId>
            <artifactId>ethereumj-core</artifactId>
            <version>1.5.0-RELEASE</version>
        </dependency>

This seems fine as there is no error in the POM file. When I tried to import in the source file, I get the RED errors,

I have tried with other version of the dependencies as well.  What os the issue here?


texts: How to properly catch events using MochaJs

texts:
Good day,

I'm using mochajs to test my Solidity code using truffle and testrpc.

In my contract I got the following event and function:

contract store{
    event MoneyIn (address _from, uint256 _amount);

    function getMoney() payable{
        //event
        MoneyIn(msg.sender, msg.value);
    }
}

And this is the mochajs code:

it("Pay to store", function(){
    return storeContract.getMoney({from: account[0], value: txAmount}).then(function(res){
      assert.isDefined(res);
    });
});

It simpally checks if the transaction was executed by checking if the res is defined.

However, when mocha don't throw errors, it also won't emit the event. The only way in which I can get see my event is my creating an error:
for example I can change the assertion from isDefined(res) to ifError(res).

Doing so will force mocha to throw an error and as a side product it will also emit my event:

1) Pay to store

Events emitted during test:
---------------------------

MoneyIn(_to: 0xa86120c19324a9ed51fe17730fce24edd69ddc9c, _amount: 300000000000000000)

---------------------------

I'll hihgly appriciate any tip you might have on how to force mocha to emit events even when there're no errors.


texts: Truffle Tutorial pet-shop with test-rpc adopt button doesn't work

texts:
I have followed the tutorial exactly like they showed in their page:
 http://truffleframework.com/tutorials/pet-shop
except the following changes because they use "ganache" (currently bugged and unavailable) and I chose "test-rpc":
In "truffle.js" port: 8545
In "src/app.js" App.web3Provider = new Web3.providers.HttpProvider('http://localhost:8545');
The "adopt" button in the front-end UI doesn't prompt the transaction with metamask.


texts: How can I persist the chain state of Truffle develop?

texts:
Is it possible to persist the chain state of Truffle develop?
If my truffle console crash, can I restore the chain state?


texts: Vastly different disk usage between Parity v2.5 and v2.7

texts:
I've got a main ethereum node for business use running Parity version v2.5.13-stable-253ff3f-20191231/x86_64-linux-gnu/rustc1.40.0 on an AWS instance and a near exact replica of that setup as a "clone" backup in case something happens to the main node. Both are connected and live.
The only difference is that the backup ran out of space a month ago and I had to re-build the database after upping the disk capacity. I then installed Parity v2.7.2-stable-2662d19-20200206/x86_64-unknown-linux-gnu/rustc1.41.0 instead of the previous v2.5. For some reason, it refused to warp sync, and so I let it just slow-sync as it wanted to. It took a few days, but got back up to speed and has been synced for several weeks now.
What I can't figure out is that, despite being set up identically, the two nodes have vastly different disk usage. The main node is currently using 289G, while the backup node is using 321G. Furthermore, when you look at the munin disk usage graphs of the two during the exact same period, the difference is remarkable:
Main Node

Clone Node

In particular, the rhythmic oscillation of the clone node seems concerning. However, I can't find anything in the logs that would suggest they're acting any differently. When I follow the logs of the two nodes, they're almost identical (as they should be).
Any thoughts are appreciated.


texts: What does `parity db kill` kill exactly?

texts:
When I run

parity --config node.toml db kill

I expect that the node will resync from scratch (will start importing snapshots etc, or from block#0) however it seems to continue importing blocks from the last one. Though I see a line DB deleted in logs. So what gets deleted actually?


texts: How to delete older blocks in a private blockchain network?

texts:
I would like to delete the old blocks when the memory is full in blocks. I understand that there will be loss of some data due to the deleting the blocks. But I think it would not change the structure of the blockchain.

I want to know how to implement it. I am using go-ethereum.


texts:
I have a geth instance running on a server and I'd like to be able to interact with it from other machines. I tried a lot of things but they cant connect.

How do you proceed to, lets say being able to act on that node from an external source?

Tried:
In console:

geth attach http://remote_ip:8545

geth attach --rpcaddr remote_ip --rpcport 8545

In a webpage with web3:

web3.setProvider(new web3.providers.HttpProvider("http://remote_ip:8545"));


texts: How are all these crypto tokens ICO's legal?

texts: I started noticing lately a lot of crypto meme tokens being generated and sold online in a variety of ways. Basically everyone can generate ERC20 BNB based tokens, sell them in a pre-sale, and put them on a decentralized exchange. I was wondering how is that even legal, having in mind that crpyto ICO's are actually regulated and you can't actually buy a token from a serious company in a ICO unless you pass KYC details. So what is that all about ?


texts: Node is showing up as a Peer in Ethstats

texts:
I am experimenting which Blockchains in a private environment.

I have created two nodes and they are showing up just fine in the ethstats page. One is local on my pc, the other one is also local but in a vm on my pc. I can see that they function well because at mining turned off they both ahve the same best block, and the blockminers are visible.

What is confusing me is that my node 2 is showing up as a peer and not as a separate node:

It is very clear that i am confusing the concept of nodes and peers. I have tried to look up existing questions which made me understand that a node can be a collection of peers. Am I understanding this well?

So how do i define a node and not a peer? Where is the distinction made?  What should I do?

to create the so-called peer, I:

ran the genesis file
took the ip of the 1st node + enode
hooked them with the geth command
waited for import
started mining on both

  geth --networkid 46851 --port 30303  --rpc   --rpccorsdomain "*" --datadir "c:\\chain\\data-dir" --minerthreads 1 –bootnodes "enode://123456@192.168.40.10:30303"


texts: I need help; the Solidity Code yields a warning you will see below

texts:
pragma solidity ^0.4.4;

 contract token { function mintToken(address receiver, uint amount){if
      (msg.value < amount)
        throw;

    if (msg.value > amount)
         throw;  } }
    contract Crowdsale {
    address public beneficiary;
    uint public fundingGoal;
    uint public amountRaised;
    uint public deadline;
    uint public price;
    token public tokenReward;
    mapping(address => uint256) public balanceOf;
    bool fundingGoalReached = false;
    bool crowdsaleClosed = false;
    event GoalReached(address recipient, uint totalAmountRaised);
    event FundTransfer(address backer, uint amount, bool isContribution);

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

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

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

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

    /**
     * Withdraw the funds
     *
     * Checks to see if goal or time limit has been reached, and if so, and the funding goal was reached,
     * sends the entire amount to the beneficiary. If goal was not reached, each contributor can withdraw
     * the amount they contributed.
     */
    function safeWithdrawal() afterDeadline {
        if (!fundingGoalReached) {
            uint amount = balanceOf[msg.sender];
            balanceOf[msg.sender] = 0;
            if (amount > 0) {
                if (msg.sender.send(amount)) {
                    FundTransfer(msg.sender, amount, false);
                } else {
                    balanceOf[msg.sender] = amount;
                }
            }
        }

        if (fundingGoalReached && beneficiary == msg.sender) {
            if (beneficiary.send(amountRaised)) {
                FundTransfer(beneficiary, amountRaised, false);
            } else {
                //If we fail to send the funds to beneficiary, unlock funders balance
                fundingGoalReached = false;
            }
        }
    }
}


texts: Web3.js doesn't fire event callbacks anymore

texts:
I have a small dapp that uses web3.js to interact with a contract.  I have one event listener:

let activateEvent = nexusContract.events.Activate({ _member: defaultAccount })

activateEvent.watch((error, result) => {
  console.log(error, result)
})

However, the event callback never fires.  I've checked it on the Solidity end of the things, and the smart contract is definitely firing events.  What am I doing wrong?

I've also tried this syntax too:

activateEvent.on('data', (error, result) => console.log(error, result))

But to not avail.

The version of web3.js I'm using is 1.0.0-beta.34, and I'm using with MetaMask on the mainnet.


texts: what is the motivation behind sidechain?

texts:
I learnt from another SE post that sidechaining is any mechanism that allows tokens from one blockchain to be securely used within a completely separate blockchain but still moved back to the original chain if necessary
I want to know what is the motivation behind this idea why one would do that and are there any resources available for implementing sidechaining on your local machine for experimentation.


texts:
I have a problem. so, Ask for help.
by mistake, I transferred coins to an address that belongs to ETH wallet instead of ETC.
Is ther a solution for this?
Pleas, see below.


texts: When i compile my code getting error like (Expected token Semicolon got 'LParen')

texts:
I am using remix ide solidity compiler version is 0.4.21 while creating erc20 token im getting the error

Thanks!


texts:
OS Win7.
Node: Parity 1.3.3
Client: Ethereum wallet & Mist (on 2 different PC's)

Contract owner account is fully funded with >5 ETH (well enough to cover tx fees/ gas)
*wallet contract contains >1 ETH fwiw.

I have never had this problem before, but after switching to parity (due to DOS attacks) I decided to place a few transactions to test that everything worked properly.

First I sent a small amount of ETH from account1 to account2, works fine.

Then I sent a small amount from account1 to my wallet contract, works fine.

Finally, I attempted (multiple times) to send from the wallet contract back to account1 and also tried sending to account2. Ethereum Wallet shows transaction as confirmed and show "-1.18 ETHER" in transaction history for a short time, but then disappears from history, (in mist, the transaction is still visible) But the receiving account and wallet contract's balances show no change.

Screenshots below show gas consumed but show value transferred as "0". I have tried several times from 2 different pc's and have burned gas after gas but can't move the ether out of the contract.

Viewing the contract address on etherscan shows the multiple transactions that I have tried, but the value of each transaction is "0 Ether". ETH balance is >1.

Just to test the function I also wrote to contract add owner and was successful in adding a 2nd owner to the contract. The contract was created using ethererum wallet Add wallet contract - (Single owner account) option.

Any help would greatly be appreciated.

EDIT: I used the Kill function to remove the ether from the contract. Unfortunately, the contract is now useless (as it has no owners). I tried to make a new contract, but got an error that it exceeds block gas limit (estimated 2 Million gas, 3 million maximum.)


texts: How to restore particular address from mnemonics created with ethereumjs-wallet

texts:
Created a wallet instance using fromMasterSeed and getWallet functions from ethereumjs/ethereumjs-wallet

How can i restore the same using the mnemonics if I use the myetherwallet interface?

I have created the seed using bip39 standard Library


texts: Web3.js: how to efficiently load and display bunch of items from the Blockchain?

texts:
I am developing a DApp and I am struggling with the efficient loading from the blockchain and displaying in the frontend.
I am loading all the items at once. When the list of the items grows very large (> 500), frontend starts lagging and the loading is kinda slow
(I get warnings like "[Violation] Forced reflow while executing JavaScript took 87ms"). The page has a pagination and sorters/filters,
thus I cannot load items partially (by index), as I don't know how many of them I will need when filters/sorters are applied.

Here is the pseudo code:
Solidity:

struct Item {
  uint256 id;
  address owner;
  bool claimed;
}

Item[] private items;
uint256 public numberOfItems;

function getItemInfo(uint256 itemID) public view returns(address owner, bool claimed) {
  Item memory item = items[itemID];

  owner = item.owner;
  claimed = item.claimed;
}

JS (web3):

loadItems: function(items, account) {
  var contractInstance;

  App.contracts.MyContract.deployed().then(function(instance) {
    contractInstance = instance;
    return contractInstance.numberOfItems.call();
}).then(function(numberOfItems) {
  console.log(Number(numberOfItems));

  for (var i = 0; i < numberOfItems; i++ ){
  contractInstance.getItemInfo(i).then(function(data){
    //console.log(data);
  })
}
}).catch(function(err) {
  console.log(err.message);
});
},

It would be great to receive any suggestions on how can I solve this problem and load items efficiently.


texts: I had $200 worth of Ethereum and randomly, it got sent to a random account. I didn't noticed this a week after, I was wondering if it is suppose to take some Ethereum, but not all?


texts: get constructor args from contract deploy tx

texts:
this question comes from this post: What does etherscan mean by "Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)"?
My goal is to read contract deployment tx's, parse the data field and be able to determine the constructor args used in the deployment.
That post talks about a set of bytes in the beginning of the data that tells the evm where the constructor begins but taking that logic to OTHER contract deployments, the bytes in the same location dont appear to say the same thing.
So tldr - how can i reliably retrieve the constructor args from the encoded abi that is within a deployment tx data field?
Thanks so much


texts:
I am using geth client(private network).
When I try to start my network it shows "segmentation fault".
Can you guide how to solve this issues?

go-ethereum/build/bin/geth  --mine  --nodiscover  --maxpeers 0  --networkid 13  --rpc  --rpccorsdomain "*"
Segmentation fault (core dumped)


texts: How to create an array of unique addresses

texts:
I have a contract that contains a simple mapping; let's say mapping(address => uint256) balances;

I want to be able to somehow get all the participants of this smart contract. The simplest way seems to have an additional dynamic array of addresses and iterate over them. But searching for an address on each token transfer or payable function call looks overcomplicated.

Is there a way to have something like a set() in Python, i.e. an array of unique addresses?


texts: ZepplinOS: Where to set owner of the contract?

texts:
ZepplinOS contracts do not use constructors in it's zos implementation, and instead uses an initialization function that it imports from zos-lib/contracts/Initializable.sol package.

In order for the contract to have upgradeable state, the state variables need to be declared within the initialization function like so:

  bytes32[] public data;

  function initialize(bytes32[] _data) initializer public {
    data = _data;
  }

If I want to set the owner of the contract, would I simply set an owner variable in the initialize function? Not sure what the best practice is here.

pragma solidity ^0.5.0;

import "zos-lib/contracts/Initializable.sol";

contract Verifications is Initializable {

  mapping (bytes32 => bytes32) public data;
  address public owner;

  function initialize(bytes32[] _data) initializer public {
    owner = msg.sender;
    data = _data;
  }
}

Thoughts? Is this ok?


texts: web3: are event/filter results guaranteed to be sorted by block number?

texts:
I see that the results of past events which I get via

MyContract.MyEvent({}, { fromBlock: 0, toBlock: 'latest' }).get((error, results) => {
    console.log(JSON.stringify(results));
});

are sorted by block number. Can I rely on this ordering or is it possibly random? Chain re-organizations or forks are exceptions that I do not care about for now.

Is the behavior for .watch and filter.watch the same?


texts: Can I deploy a contract to an arbitrary address that I choose?

texts: If I want to create a smart contract by executing a raw tx, is it mandatory to compute the new contracts address the way it's been defined, or could I pick my own address arbitrarly? Why?


texts: What is the max time for a transaction to arrive?

texts: I'm new to all this, I sent 0.95 ETH from my stock exchange account to Ether wallet and it's over 4 hours gone and still not arrived. can anybody explain ?


texts:
Assume a blockchain is running on a set of servers.

Question 1: Can a thin client (who does not have a full node like Geth) use Ethereum explorer to see the transactions sending to the blockchain?

Assume a client who has a full node deployed a contract.

Question 2: How can a full node determine who has sent some transactions to its contract?

Regarding question 1: I'm aware of this, but it requires a full node.


texts: How does the ForceMove protocol handle timed dispute periods?

texts:
The main idea behind the ForceMove
protocol is that, in a state channel between predefined participants running turn-based applications, lets say 2 for this example (Alice and Bob), if it is Bob's turn to play and he becomes non-responsive, Alice can issue a challenge and "force his move". Essentially, the creation of a challenge gives Bob a "predefined time window" to respond, otherwise the game terminates in the last valid state.
It is unclear to me after reading the related publication how the countdown for the response window is implemented, since timers and time are famously a sensitive issue on the blockchain. If someone that has looked into this further (or read and understood the paper more than I did) could point out how they execute a countdown securely, it would be very appreciated, thank you.


texts:
Let's say you want mint a token TOK that is pegged to the USD. Then following must hold:
(1) TOKUSD = USDTOK = 1
(2) USDETH = 1/ETHUSD
(3) TOKETH = 1/ETHTOK
The formula of the exchange rate is
TOKETH = TOKUSD * USDETH = USDETH.
If ETH rises against the USD your token price goes down.
if TOKETH = USDETH = 10, 10 TOK * ETHTOK =  10 TOK / TOKETH = 1 ETH = 10 USD
if TOKETH = USDETH = 20, 10 TOK / 20 = 0.5 ETH = 10 USD
if TOKETH = USDETH = 5, 10 TOK / 5 = 2 ETH = 10 USD

Since Solidity has no float point regime, a division will always result in integers. Tracking the price of USDETH correctly seems not feasable.

How can one accurately code the conversion rates, without loss?


texts: After deployment of contract getting error: "VM Exception while processing transaction: revert"

texts:
I have a simple contract

pragma solidity ^0.4.4;

contract Main {

function getValue() constant returns (bool){
  return true;
 }
}

I just need to create a web interface that can fetch this value for me.

I unboxed webpack in empty repo by >truffle unbox webpack, deleted the previous contracts, changed the index.html and app.js files, changed the 2_deploy_contracts.js accordingly but the error i get on console of the browser is:

  Uncaught (in promise) Error: VM Exception while processing
  transaction: revert

Here is my index.html and app.js file.

 <html>

   <head>
     <title>Truffle 3 Frontend Demo</title>
   </head>
   <body>
   </body>

   <script src="./app.js"></script>
   <script src="../node_modules/web3/dist/web3.js" type="text/javascript">       </script>
   <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" type="text/javascript"</script>
</html>

and my app.js file is

import { default as Web3 } from 'web3'
import { default as contract } from 'truffle-contract'
import Main_artifact from '../../build/contracts/Main.json'

const TESTRPC_HOST = 'localhost'
const TESTRPC_PORT = '8545'

function component () {
  var element = document.createElement('div')
  console.error("hi");
  let provider = new Web3.providers.HttpProvider(`http://${TESTRPC_HOST}:${TESTRPC_PORT}`)
  let main = contract(Main_artifact)
  main.setProvider(provider)

  main.deployed().then(function(instance) {
      console.log(instance);

    var s = instance.getValue(); //instance.getValue.call() doesnt work either
    return s;
}).then(function(result){
    element.innerHTML = `value: ${result}`
    console.log(result)
});

  return element
}

document.body.appendChild(component());


texts: If we want to check that data is member of it or not we will take the root, data block, and all the blocks in path between data and root. According to this picture if i want to check that data block, then how can i validate the hash pointer store in above block without having left child?


texts: How can one user(Patient) can share information to other user in solidity

texts:
I am looking to Design Smart Contract using Ethereum Blockchain for storing and retrieving Medical Recoreds in Blockchain.

As I am new to Ethereum I am little issue with below thing. anyone have any idea or some solidity code how to get it.

Key Functions/Module:
There will be two users
o Doctor
o Patient

Add Doctor Information
o Doctor ID
o Name
o Email
o Contact Number
o Address

Add Patient Information
o Patient ID
o Patient Name
o Email
o Contact Number
o Address

1 Patient can view his/her information
2 Doctor can view/her information
3 Patient can share his/her information with Doctors
4 Doctors can view all/limited information of Patients who shared their
information with doctors.

Thanks in advance.


texts: Getting empty events in response of receipt. I am using Infura+web3.js+ropsten


texts:
because of DOS attack I have updated geth, but accidentally to 1.5.0 which is unstable, and now I want to downgrade to 1.4.12. Can someone instruct me how to downgrade to 1.4.12? Or even better, can someone tell me is it really necessary for me to downgrade? If there is no security concerns, then I'm OK with unstable version.

I'm running Ubuntu 16.04.

Regards,
Tomo


texts: How to call a function in parent contract from children contract?

texts:
I am new to solidity.. please bear with my foolish question
I would like to get the variable called num in a parent contract from its children.
So, what I have in my mind is to try to get the address of parent contract first, then
I will produce the instance to gain the num in the parent contract.
pragma solidity ^0.6.0;

contract parent{
    uint public num;
    function setValue(uint _value) public{
        num= _value;
    }
    function getValue() public view returns(uint){
        return num;
    }
}
contract child is parent{
    function get_address() public view returns(address){
        return address(parent);  // here I have got an error...
    }
}

would you guys give me some advice ?


texts:
I'm new to blockchain development.
I watched a lot of udemy courses about Solidity.
I think I understand how smart contracts work but I have 2 questions.
Would it be possible to manage an application which uses a smart contract without forcing users to have ethereum wallet ?
For exemple let's say you subscribe to my application.
You create an account. Is it possible my application creates a wallet for you to interact with the smart contract without you knowing it ?
Second question:
I'm using MINDS, which is a blockchain social network dapp. I can use it fully without having a wallet associated. How do you think they manage transactions so we, users never pay the fees ?
Sorry if my questions are boring and thank you for your answers.


texts:
I am currently attempting to import my old wallet onto a new pc in order to be able to transfer the 2 ethereums that I have stored on it onto an exchange, but can't for the life of me figure out how to do so.

I have tried the command promt fix recommended here : How to import a plain private key into geth or Mist?

But I got the following,

  'geth' is not recognized as an internal or external command,operable
  program or batch file.

Is it referring to a command prompt inside mist that I'm not aware of? The one I used is the regular old ms command promp. If so where is this prompt located?

I have access to both my public and private key, the folder called keystore, and the password that I created for the account. What I don't have is any programming knowledge to speak of.

So if someone could please, explain, in laymans terms, a way for me to either import my wallet, or transfer my ether from the wallet to the exchange without accessing it through mist, that would be very much appreciated.

old wallet address : 0xf9FA047336bCfE8cC290310423c4CC509Fc99765 (where my ether is located)
new wallet address (etherbase account created upon download of mist onto new pc, which i currently have access to): 0xc5F77607AA3283Bbb60150f7F8E3FcEfBdaEB1F7

Thank you for your time, and for helping out a hapless noob who dipped his head in too deep!


texts: How can i simulate the write contract in etherscan using Web3.py?

texts:
I would like to use web3.py instead of using the etherscan write contract function available in ethercan.io,

Is this possible? if yes can someone please show me a sample. The contract address of the sample above: https://etherscan.io/token/0x2b591e99afe9f32eaa6214f7b7629768c40eeb39#writeContract


texts: what stops devs from changing supply of contracts?

texts:
If someone created an erc20 token with the state variable uint256 totalSupply = 100, what is stopping another dev from creating a contract with that manipulates the totalSupply to 0?
Would making the state variable private or internal prevent this from happening?
Even so, couldn't that attacker make a contract: contract attackContract is totalSupply { and manipulate it that way?
^ Asking these questions because I want to make a smart contract that holds the total supply and can transfer tokens only via contracts with access to, set by the deployer.


texts: Is there a difference between the call stack and the "normal" stack?

texts:
I cannot find any good source on this. The "normal" stack is where all PUSH opcodes put their bytes on. The "call stack" could be some other stack where either call data or addresses are put on - which doesn't make any sense to me if it would be a different stack.

Is the call stack a different stack than the "normal" stack?


texts:
I am new to solidity programming and sorry if my question is very basic.

I am wondering if we can cast msg.value to uint248

Example below ;
uint value;
 value = (uint248) (msg.value);


texts:
I'm attempting to initiate a transaction (transfer of ETH) from my main account to a test account on the Kovan Testnet, but I'm getting the error Returned error: Invalid chain id. from the following code:
const Web3 = require("web3");
const EthereumTx = require("ethereumjs-tx").Transaction;

const SK = process.env.PROD ? nice try ;)
const PK = process.env.PROD ? "0x5A8721b7DE69b3538a4cC61614628f7c1A6E59Fb"
  : "0x33Bcd8bf72D594B0974beFd830a29CeC55079976";
const url = process.env.PROD ? "https://kovan.infura.io/v3/2bd0c2e1f29f4ab9b47374c6b50023c5"
  : "http://127.0.0.1:8545";

const web3Provider = new Web3.providers.HttpProvider(url);
const web3 = new Web3(web3Provider);
const { toWei, numberToHex: toHex } = web3.utils;

const sendETH = async () => {
  const nonce = await web3.eth.getTransactionCount(PK);
  const tx = new EthereumTx({
    from: PK,
    to: "0x8631c939359FBb8cb336532b191ED80b20287CD1",
    value: toHex(toWei(".1")),
    gas: toHex("21000"),
    nonce,
  });
  tx.sign(Buffer.from(SK, "hex"));
  const serializedTx = tx.serialize();
  web3.eth.sendSignedTransaction("0x" + serializedTx.toString("hex"));
}
sendETH();

When I set PROD to false (testing on local network), it works fine. However I get that stubborn error every time I set the PROD to true (testing on Kovan).


texts: How can I get pending transactions of a specific address/contract

texts: I am currently running a full node and listening to pending txs in the mempool. Is there a way to filter transactions from a specific address? I want to get a notification if a specific address has a pending txs and see which token it will buy. Is there a way to do it?


texts: Mist, transaction "couldn't be successfully executed"

texts:
For some reason I can't send transactions from my Mist wallet. I'm running the newest version (0.8.7).

When I send a transaction, after a couple of minutes I get the message that the transaction "couldn't be successfully executed". It never gets any confirmations.

I tried it once with the lowest possible fee, once with the standard fee and once with the maximum fee, but all failed after a couple of minutes.

Can someone explain why?


texts: Who has authority to add a new node in Quorum

texts:
According to this tutorial of Quorum a regulator is able to view the result of voting.

1) What else responsibilities does regulator have?

2) How is the regulator selected from the participants of the blockchain network?

3) How are new participants and nodes added to the private permissioned network?

4) Does the regulator have the right to add participants to the private permissioned blockchain network? If yes, isn't it a politically centralized system? To read more about political decentralization read this post by Vitalik.

5) Are all private permissioned network are infrastructurally decentralized, politically centralized and logically centralized systems.