texts: Is the ECDSA signature hash, its derived v value and the chainID still a thing?

texts:
I was browsing some code at the go-ethereum and I noticed this method to validate the signature:
https://github.com/ethereum/go-ethereum/blob/56dec25ae26bf749b93c3ea69538fabea60c5768/crypto/crypto.go#L263
For convenience this is the comment of the method:

ValidateSignatureValues verifies whether the signature values are
valid with the given chain rules. The v value is assumed to be
either 0 or 1.

But in fact the code doesn't seem to care at all for the v-value or the chain-id, which were topic that have been discussed here here here and finally here.
This is relevant for me as I'm not using crypto.sign instead I'm signing remotely from an HSM which has no context of the rules for a valid Ethereum signature.
My current code receives the signature returned from the HSM, splits it in r and s and then it passes them to the method in question like so:
isValidWithV0InHomestead := crypto.ValidateSignatureValues(byte(0), bigIntR, bigIntS, true) //true means homestead
isValidWithV1InHomestead := crypto.ValidateSignatureValues(byte(1), bigIntR, bigIntS, true) //true means homestead

as you would expect, the result is always the same with v=0 or v=1 that is:
valid if (s < curve.n / 2)

If this is correct, then I would only need to ask the HSM for a new signature until crypto.ValidateSignatureValues returns true.
ethereum-js seems to have a method ecrecover that takes v,s,r,chainId and it is a lot more involved and the same ecrecover method in go only needs the hash and the signature, but this is assuming that you generated the signature using crypto.sign which is not relevant for me.
So my question is: Is crypto.ValidateSignatureValues the right method to validate a signature when not using crypto.sign?


texts: Block gas limit exceeded when compiling contract Solidity browser

texts:
Using Solidity Browser ( https://ethereum.github.io/browser-solidity/ ) to mine a contract on testnet with injected web3 and metamask account, throws this error:

callback contain no result Gas required exceeds limit: 3000000

This contract ( source code => https://gist.github.com/computerphysicslab/f362383f9d3fed26becba48b934bbcfc ) is expected to cost around 6 million gas to deploy (according to JS VM environment). Nevertheless when trying to increase the gas limit these errors are thrown:

callback contain no result Gas required exceeds limit: 4000000
callback contain no result Gas required exceeds block gas limit: 5000000
callback contain no result Gas required exceeds block gas limit: 6000000
callback contain no result Gas required exceeds block gas limit: 10000000
...

So, it seems like it is not possible to mine the contract becasue there is a block gas limit around 5 million gas. Is it possible to overcome this limit somehow?

Refs.:

Solidity browser compiler crashes

why the browser based solidity compiler crushes when the code is too long?

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


texts: Could mapping data structure return the number of items it points?

texts:
For example following code piece from https://ethereum.stackexchange.com/a/10763/4575 . I have added new lines that is followed by //*.

pragma solidity ^0.4.2;
contract test {
  struct my_struct {
    int a;
    int my_length; //*to keep track of the length.
  }

  mapping (address=>my_struct[]) Map;

  function fill_map(my_struct struct1,my_struct struct2) internal  {
    Map[msg.sender].push(struct1);
    Map[msg.sender][0].my_length = Map[msg.sender][0].my_length + 1;//*

    Map[msg.sender].push(struct2);
    Map[msg.sender][0].my_length = Map[msg.sender][0].my_length + 1;//*

    Map[msg.sender].push(struct3);//*
    Map[msg.sender][0].my_length = Map[msg.sender][0].my_length + 1;//*

    delete Map[id][2]; //*struct3 will be removed.
    Map[msg.sender][0].my_length = Map[msg.sender][0].my_length - 1;//*
  }
}

I can obtain data as follows: Map[id][index].a; index is an integer number. In this example it can be 0 (for struct1) or 1 (for struct2).

As we know Java could return the number of object inside a list:

String[] array = new String[10];
int size = array.length;

Is there anything similar as: Map[id].length ? or manually after each push or delete should I need to keep length?

On my solution Map[msg.sender][0].my_length will return the number of the pointed structs from Map[msg.sender].


texts: Assigning memory variable to storage variable, what happens?

texts:
I'm curious what happens if you try to do the next thing:

contract C {
    Struct S {
        uint a;
        uint b;
    }

    mapping(address => s) structs;

    function updateStructs(S sInstance) private {
        structs[msg.sender] = sInstance;
    }

    function addStruct (uint _a, uint _b) payable {
        S memory s = S({a: _a, b: _b});
        updateStructs(s);
    }
}

As I understood how variables work, the addStruct creates memory variable that has only function scope and will be deallocated once this transaction/message is processed. So what will remain in structs[msg.sender] after addStruct has been called? Will changing updateStructs(S sInstance) to updateStructs(S storage sInstance) change something?


texts: Recover Lost Funds from Botched ETH Deposit Without Access to Private Keys?

texts:
I'm using the wei approach (4 right-most zeros) as a marker to track user deposits on my site. In short, every user on the site is told to append a custom amount of "wei" to every deposit they wish to make so we could uniquely identify deposits from them and credit their balance. For example, User A might be told to add 36 wei (x.0000000000000000036) while User B might be told to add 546 wei  (x.0000000000000000546).
Now suppose a user tries to deposit funds into his account and forgot to append his unique wei ID to the total (or worse, he mistakenly appends someone else's ID) and now wants to try to recover his "lost" funds. In order for me to override the default behavior and manually credit his account I would need to ask him for some proof that he was the sender of the funds. Normally, I can ask him to sign a message using his private key. However, the problem is that the funds were sent using a popular cryptocurrency exchange and he does not have access to the private keys. Obviously, the exchange won't let him sign a message using their private keys. I cannot refund the transaction (and let him resend with the right amount of wei) because the exchange has a policy that they do not recover refunds. Additionally, this cannot be used when the individual (claims he) mistakenly used someone else's number of wei.
What info/action can I request from the sender which would be sufficient to "prove" that he in fact sent those coins?


texts: How does a Solidity fallback function work with the raw CALL opcode of the EVM?

texts:
Since a fallback function is a Solidity feature, how does it work if the EVM opcode CALL is used?

If msg.data is empty, how can Solidity run the fallback function?  Shouldn't the EVM just transfer the Ether, since there's no function invocation involved?

In Solidity, does syntax like contractAddress.call.value(amountWei)() invoke a raw CALL opcode, or does Solidity still do something additional?


texts: how to check if a block has a transaction to an address only by using the block header

texts:
Question is self explanatory. How can I check if a block has a transaction to or from an address only by using the block header?

Question is prompted by this comment - How to explore all transactions for a given account?

I'm currently iterating through every transaction and it's taking way too long. Need to speed up the process.


texts: Not able to connect to Quorum node from Nethereum

texts:
I am not able to connect to Quorumchain using Nethereum. Below is my code and error response.

I have verified and the port is open in the machine. I am running on a Linux machine, Ubuntu 18.04. I couldn't see any issue in code or port, could someone help to resolve this problem.

I am able to connect to node using geth attach on command line.

Code:

using Nethereum.Quorum;
using Nethereum.RPC.Eth.DTOs;
using Nethereum.Web3;
using Nethereum.Web3.Accounts;
using System;
using System.Threading.Tasks;

namespace QuorumTest
{
class Program
{
public static async Task Main(string[] args)
{
Console.WriteLine("Hello.. This is the Quorum Test!");
try
{
var web3Quorum = new Web3Quorum("http://localhost/8001");
var coinbaseAcct = await web3Quorum.Eth.CoinBase.SendRequestAsync();
Console.WriteLine("Coinbase is: {0}", coinbaseAcct);
}
catch(Exception e)
{
Console.Write(e);
}

}
}
}

Response:

gethadmin@manojpoc2:~/dotnetapps/QuorumTest/QuorumTest$ dotnet run
Hello.. This is the Quorum Test!
Nethereum.JsonRpc.Client.RpcClientUnknownException: Error occurred when trying to send rpc requests(s) ---> System.Net.Http.HttpRequestException: Connection refused ---> System.Net.Sockets.SocketException: Connection refused
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask1.get_Result() at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Threading.Tasks.ValueTask1.get_Result()
at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask1 creationTask) at System.Threading.Tasks.ValueTask1.get_Result()
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Nethereum.JsonRpc.Client.RpcClient.SendAsync(RpcRequestMessage request, String route)
--- End of inner exception stack trace ---
at Nethereum.JsonRpc.Client.RpcClient.SendAsync(RpcRequestMessage request, String route)
at Nethereum.JsonRpc.Client.ClientBase.SendInnerRequestAsyncT
at Nethereum.JsonRpc.Client.ClientBase.SendInnerRequestAsyncT
at Nethereum.JsonRpc.Client.ClientBase.SendRequestAsyncT
at QuorumTest.Program.Main(String[] args) in /home/gethadmin/dotnetapps/QuorumTest/QuorumTest/Program.cs:line 18

_


texts:
I want to check ethereum balance of accounts by entering address in text box and click on check balance button it must show the balance in the account.

Please some one help with related links

My second requirement after login into wallet it must automatically display the balance of the account.

Thanks in advance.


texts: Transaction rolled back and re-mined later?

texts:
A few hours ago, I was testing my dapp on ropsten and something strange happened.

I sent a transaction (A), to the blockchain, it got mined and my server synced it. Then 30 minutes later, I sent another transaction (B) and called the same function.
B was mined successfully and A was mined again in the same block as B.
There is no trace of the transaction A that I sent 30 minutes before like it was rolled back. It's like it was mined, then reverted and then remined 30 minutes later.

What is happening? My dapp relies on live-sync and this would be a game breaking. Thanks for your help.


texts: what is declaration error in remix ide and how to solve it

texts: What is declaration error here! I can't figure it out and the error is shown as an unidentified declaration error. Please help me out


texts:
I wrote the following contract and instead of returning a hash value it is giving me the following error:

invalid address

    at web3.js:3887:15

    at web3.js:3713:20

    at web3.js:4939:28

    at web3.js:4938:12

    at web3.js:4964:18

    at web3.js:4989:23

    at web3.js:4055:16

    at web3.js:4141:16

    at anonymous:1:1

The contract is as follows:

contract Unique {

    string sm;
    string bm;
    bytes32 val;
    bytes32 vm;

    function hk(string s, string y, bytes32 i)returns (bytes32){
        sm =s;
        bm =y;
        vm =i;
        val = sha3(sm,bm,vm);
    }

    function getOut()constant returns (bytes32){
        return val;
    }
}


texts: Connecting to my raspberry pi - how safe is that?

texts:
My setup is simple, I have a laptop and a raspberry pi on the same network. I installed parity on my raspberry pi and successfully connected to it, e.g., with geth attach http://192.168.1.:8545. All is well, I can get the most recent block number through the geth console, so obviously, that parity node is working well! I also see no accounts under web3.eth.accounts, obviously because there's no keys on that parity node.

Now I'm about to setup Mist so it uses that rpi web3 provider, and see the following instructions on the mist github:

Connecting to node via HTTP instead of IPC

This is useful if you have a node running on another machine, though note that it's less secure than using the default IPC method.

$ electron . --rpc http://localhost:8545

How exactly is that setup less secure? My understanding (probably wrong), is that I'm only using that parity node to get latest blockchain info, and to broadcast transaction. None of the keys are even accessible from my parity node (rapsberry pi on same LAN in this case).

What I'm looking for is an experience where I can just open an app on my laptop, and I can transact and see blockchain info right away. There's no light wallet yet, so I feel like this setup with the raspberry pi remote node is the closest I can get. Maybe something more clever?


texts: What OPCODES are available for the Ethereum EVM?

texts: The Ethereum virtual machine has a large number of operation codes and base level instruction sets.  Is a complete listing available?


texts: VM Exception while processing transaction: revert message

texts:
When a solidity smart contract reverts with a message due to a failure on a require statement, the browser calling the smart contract returns "Error: VM Exception while processing transaction: revert". However, it does not show the message associated with the require statement.

I am using Truffle v5.0.1 (Solidity v0.5.0 and Node v11.6.0).

Is there a way to get this message in the browser?


texts:
I can't find a mining reward transaction hash for a given block. I can see the block hash, all the transactions inside the block, etc. But the mining reward transaction is not listed among the details.

Does a mining reward transaction have a hash? Does it have inputs and outputs? I tried different block explorer sites and JavaScript web3 functions. What kind of transaction is a mining reward? How is it implemented?


texts:
I want to provide a feature to download balances in open zeppelins StandardToken

    mapping(address => uint256) balances;

Probem is I get this error :

    Internal type is not allowed for public or external functions.

How can I do it ? I imagine it has to be done in phases, like one method for downloading all the addresses, and second method to retrieve the balance for one particular user. Which leads to another question - how to iterate through the mapping and just return array of address.

EDIT:

In my usecase, I have an ESO type option where the startup's employees are given away certain number of tokens for free. This happens by invoking some function marked as "onlyOwner", by the owner. This would not be reflected in the block logs, because there is no ether being transferred to the contract. In the other answer linked, it only deals with the case where the user sent ETH to a particular address.


texts:
If I have a (NFT) token that has a TransferSingle event emitted when the token is transferred, and I emit a second event that indicates it was a sale at a certain price--how do I link the sale to the transfer? There could be multiple sales/transfers in a single transaction. Is it sufficient to query sale events from the same block and match by the other parameters (to, from, nft id?)
I am obligated by ERC-1155 to emit a specifically formed TransferSingle event so I can't just bolt them together in a new event type.


texts:
My machine was crashed and rebooted, but after rebooting, geth sync repeatedly failed at a block, I checked the block number, hash is right though, what should I do?
INFO [08-08|09:54:23.184] Downloader queue stats                   receiptTasks=0 blockTasks=476   itemSize=22.95KiB throttle=2857
ERROR[08-08|09:54:23.188]
########## BAD BLOCK #########
Chain config: {ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000 Byzantium: 4370000 Constantinople: 7280000 Petersburg: 7280000 Istanbul: 9069000, Muir Glacier: 9200000, YOLO v1: <nil>, Engine: ethash}

Number: 10285482
Hash: 0x49ea232205357c1e3ef79820844b438dee8c5f698deddde03c237d010aa01967

Error: invalid mix digest
##############################

WARN [08-08|09:54:23.188] Synchronisation failed, dropping peer    peer=75eb16371c3573f4 err="retrieved hash chain is invalid: invalid mix digest"


texts: Unable to deploy the smart contract using solc compiler in mac

texts:
I am trying to deploy the Lottery contract using solc compiler of verison 0.4.17 but it's showing me nothing. But the same contract is working good in the remix ide. I providing you the the Solidiy code and also the dependencies that I have used to deploy this to the rinkeby network using infura network.

Lottery.sol(This is the smart contract file)

pragma solidity ^0.4.17;

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

    function Lottery() public {
        manager = msg.sender;
    }

    function enter() public payable {
        require(msg.value > .01 ether);

        players.push(msg.sender);
    }

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

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

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

    function getPlayers() public view returns (address[]) {
        return players;
    }
}

The following is the compile script

const path = require('path');
const fs = require('fs');
const solc = require('solc');

const lotteryPath = path.resolve(__dirname, 'contracts', 'Lottery.sol');
const source = fs.readFileSync(lotteryPath, 'utf8');

module.exports = solc.compile(source, 1).contracts[':Lottery'];
const path = require('path');
const fs = require('fs');
const solc = require('solc');

const lotteryPath = path.resolve(__dirname, 'contracts', 'Lottery.sol');
const source = fs.readFileSync(lotteryPath, 'utf8');

module.exports = solc.compile(source, 1).contracts[':Lottery'];

I want to deploy the above script from the local device(I am using mac) using solc compiler. I have to deploy the code using the following js script.

const HDWalletProvider = require('truffle-hdwallet-provider');
const Web3 = require('web3');
const { interface, bytecode } = require('./compile');

const provider = new HDWalletProvider(
  'joy nuclear cause beauty strike quick priority upset hello strategy manual shadow',
  'rinkeby.infura.io/v3/979787f2e36741368aee9a3d1b73b438'
);
const web3 = new Web3(provider);

const deploy = async () => {
  const accounts = await web3.eth.getAccounts();

  console.log('Attempting to deploy from account', accounts[0]);

  const result = await new web3.eth.Contract(JSON.parse(interface))
    .deploy({ data: bytecode })
    .send({ gas: '1000000', from: accounts[0] });

  console.log('Contract deployed to', result.options.address);
};
deploy();

In order to have you the general idea of the dependencies that I have used I am also providing you the package.json file here below

{
  "name": "set",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "mocha"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "ganache-cli": "^6.4.3",
    "mocha": "^6.1.4",
    "solc": "^0.4.17",
    "truffle-hdwallet-provider": "^1.0.9",
    "web3": "^1.0.0-beta.37"
  }
}

Please let me know if you could be able to compile and deploy the script successfully. In my case when I try to deploy it this doesn't provide me any output. Waiting for your solutions


texts:
Solidity compiler is not working on Win 7 Enterprise (64-bit) SP1.

It was downloaded from https://github.com/ethereum/solidity/releases
Version 0.4.19 (solidity-windows.zip)

solc --version

Error : solc.exe - Application Error
The application was unable to start correctly (0x...). Click OK to close the application.


texts: I can't approve and sell a token I bought on pancakeswap. I saw someone else sell it in the transaction list on bscscan

texts:
Okay, so obviously I bought a scamcoin, but theres this one guy who still managed to sell it, most likely by using a bot. I want to sell the token as well, the liquidity isn't pulled and I would make a nice amount of money. Here's the information I have so far.
The unsellable token that got sold anyways:
https://bscscan.com/token/0xe7878bcddd112ec9e2131c542fd9e7284bc85359
The buyer who was able to sell the token:
Buy: https://bscscan.com/tx/0x9af6bd647a2a8e160a6215d38b1f5b1a9aca219674d24fd8938369969aa458bf
Sell: https://bscscan.com/tx/0x0dd5f37f94d5abd5a7792e3841bb32eed8c2813bfba549f22a56c6ac34154903
I am sure he used some kind of bot, because the token received liquidity at 08:43am and 24 seconds, the token was bought at that exact same time as well. 8 minutes later, the token was sold.
The contract that was used was based off this token:
https://bscscan.com/address/0x32c4b5d79e44aa7594fac11c0b6d7f61f3ae6429#code
the only difference is the amount of coins and address that is allowed to sell.
I remember a guy who made a website called swaphelper, it was a bot that helped you sell these kinds of unsellable tokens. The bot worked, but apparently he took it down.
Finally, if someone manages to find a solution I will give him a part of the money I earn from selling the scamcoin


texts: Questions about SimpleAuction contract example

texts:
Here is the official sample of solidity:

if (highestBidder != 0) {
    // Sending back the money by simply using
    // highestBidder.send(highestBid) is a security risk
    // because it can be prevented by the caller by e.g.
    // raising the call stack to 1023. It is always safer
    // to let the recipient withdraw their money themselves.
    pendingReturns[highestBidder] += highestBid;
}

Question 1: What is the meaning of

  because it can be prevented by the caller by e.g. raising the call stack to 1023*

if (now <= auctionStart + biddingTime)
    throw; // auction did not yet end
if (ended)
    throw; // this function has already been called

// 2. Effects
ended = true;
AuctionEnded(highestBidder, highestBid);

// 3. Interaction
if (!beneficiary.send(highestBid))
    throw;

Question 2: If beneficiary.send(highestBid) failed, ended has been modified to true, and beneficiary.send(highestBid) will never be executed again. Is that a bug?


texts: MetaMask + Truffle Invalid Address Error

texts:
I'm setting up a dApp (truffle framework) with an escrow contract that holds the money from the buyer of a product before it's released to the seller. When the user clicks "order", I am able to do an eth.sendTransaction from the buyer to the contract. I want the payment to be released when the user clicks "received item" and I can't seem to call the function that releases the payment to the seller from web3js. I receive this error:

Error: invalid address
    at inputAddressFormatter

Is this because MetaMask doesn't allow the contract (since it's not imported as an account) perform the transfer? If so, what should I change about my contract?

Here's my contract code:

  function EscrowPayment(address _seller){
    // constructor
    buyer = msg.sender;
    seller = _seller;
  }

  function getSeller() constant returns(address) {
    return seller;
  }

  function () payable{

  }

  function payoutToSeller() payable {
      seller.transfer(this.balance);
  }

As a note, I'm able to call on payoutToSeller() through the truffle console and it works.


texts: How to sequence steps in a truffle test?

texts:
I'm trying to test contract which rely on a particular state of other deployed contract.

For example let say i have a contract wanting to test the "transfer" function of an ERC20 contract.

I should make sure that :

The erc20 is deployed
The contract is want to test is using the ERC20 instance
Maybe minting some fund to the msg.sender
That the msg.sender has used the approved() method on the deployed ERC20 contract to use the transferFrom() function.

I'm having a hard time setting this up.

In the docs it is said :

  Before each contract() function is run, your contracts are redeployed
  to the running Ethereum client so the tests within it run with a clean
  contract state.

In the metacoin Example it seems they are chaining everything:

  return MetaCoin.deployed().then(function(instance) {
    meta = instance;
    return meta.getBalance.call(accounts[0]);
  }).then(function(outCoinBalance) {
    metaCoinBalance = outCoinBalance.toNumber();
    return meta.getBalanceInEth.call(accounts[0]);
  }).then(function(outCoinBalanceEth) {
    metaCoinEthBalance = outCoinBalanceEth.toNumber();
  }).then(function() {
    assert.equal(metaCoinEthBalance, 2 * metaCoinBalance, "Library function returned unexpected function, linkage may be broken");
  });

Is it the direction that should be taken ?

I have kind of pseudo coded it but it looks very tiredsome to write.

it("Custom contract should be able to transfer for user", function() {
  var erc;
  var custom;
    return ERC20.deployed().then(function(instance) {
      erc = instance;
      instance.MintCoin()
      return erc;
    }).then(function(erc) {
      custom = CustomContract.deploy(erc.address);
      return custom;
    }).then(function(custom) {
      erc.allow(custom.address)
    }).then(function() {
      assert.equal(custom.WrappingTransferMethod(),true, "You are not authorized to transfer Fund");
    });
});

How to do that properly ? Should it be done directly in solidity with the truffle asserts ? It's my first time testing a contract calling other deployed contracts and i'm at lost.


texts: Geth couldn't run in background with nohup or child process

texts:
I was trying to let geth run in background so I don't have to keep my terminal session alive or get rid of annoying block sync log by using
nohup:

nohup geth --testnet &

However geth seemed to hang even though the process existed when I checked with:

ps aux | grep geth

and I couldn't attach another geth session because:

geth attach ipc:/Users/myname/Library/Ethereum/testnet/geth.ipc

failed.

Am I doing anything wrong or it's just that geth is not supposed to run in background which is completely nonsense to me.

Edit 1:

I did try to watch the log to see if the server can do anything:

tail -f nohup.out

Nothing was there that's why I thought geth seemed to hang.


texts:
When ICO is finalized, I call finishMinting() to prevent from adding new tokens to totalSupply.

contract MyTokenCrowdsale is Crowdsale, MintedCrowdsale, CappedCrowdsale, TimedCrowdsale, WhitelistedCrowdsale, RefundableCrowdsale {

...

 function finalization() internal {
    if(goalReached()) {

   MintableToken _mintableToken = MintableToken(token);
   _mintableToken.finishMinting();
 }
}

However, if I want to deploy another crowdsale as a second round of ICO, I'm not sure how to set mintingFinished back to false again so people can buyToken again.

  function finishMinting() public onlyOwner canMint returns (bool) {
    mintingFinished = true;
    emit MintFinished();
    return true;
  }


texts: How does Enterprise Ethereum manage authentication?

texts:
I`m sorry for my bad english.

I am struggling between enterprise ethereum and hyperledger fabric.

I saw in the docs that Hyperledger fabric manages parts of certification and accreditation. How is the enterprise ehtereum managed?

I only know that enterprise ehtereum use POA consensus. If you know a site that you can refer to, please recommend.


texts:
I am developing a game which currently uses a GameFactory contract to create instances of a Game contract.
The Factory pattern would allow any number of players to play their own single player game and the game data stored in separate Game instances.

However, ideally I need the Game contracts to interact with the GameFactory contracts to update global high scores and statistics about all games being currently played.

What would be a good way to achieve this? Are there any existing examples of patterns for decentralised games like this?


texts: How to convert decode/encode string to Base58?

texts: How to convert decode/encode string to Base58 on solidity?


texts: How to cearte a contract with sub contracts

texts:
I want to use Ethereum in donate part of my website

I need unique payment address for each user

As I search I find out that I need a contract that each time called, generate a new contract and so I can use this new address

And I want to all payment goes to the master wallet And I can access all value without any limited

And I really worry about my privacy and Donater privacy

Is it possible? or there is another way?

Plz leave a comment guide and right down the code

Best regard


texts:
I see there are web-gateways to enable early access to swarm hosted content.

http://swarm-gateways.net/bzz:/swarm/
http://web3.download/bzz:/swarm/

I read they are more down then running, I am wondering, can I also run a swarm gateway? If so, how?

Is it just a modified geth as swarm node I have to run? Is there anything else I need for serving the content to a webserver, e.g., nginx?


texts: arrays and structs for function arguments

texts:
A lot of contracts and libraries with functions that use arrays and structs for arguments. Structs can themselves include arrays, structs and mappings. For example:

function doSomething(MyStruct storage s) internal returns(bool success) { ...

function somethingElse(address[] storage a) internal returns(bool success) { ...

function getThing(bytes32 key) internal returns(Thing storage t) { ...

Q1: Is it safe to do that?

Elsewhere, I read dire warnings about running out of gas. I also read about the experimental ABI but some of the contract examples I see don't use it.

Q2: How is it possible to return a struct without using the Experimental ABI?


texts: Cannot store strings correctly in Solidity Smart Contract using Web3

texts:
I am dealing with a very simple smart contract:

contract MyRegistry {

    struct MyEvent {
        string code; // service code, e.g. 1001/FOO/BAR
        string desc; // long string
        uint count;
        bool recorded;
    }

    event Record(bytes32 hash, string desc, uint count);

    function record(bytes32 hash, string code, string desc, uint count) external {
        if (registry[hash].recorded)
            throw;
        registry[hash] = MyEvent(code, desc, count, true);
    }

    mapping (bytes32 => MyEvent) public registry;
}

I then use web3's getData() for generating transaction payload:

var EthTX = require('ethereumjs-tx')
[...]
var calldata = Registry.record.getData(hash, code, desc, count)
[...]
var transaction = new EthTX({
    to: registry_address,
    gasLimit: 500000,
    gasPrice: +web3.toWei(10, 'gwei'),
    nonce: myNonce,
    data: calldata,
})

Transaction goes fine, but then, querying the registry through Remix, I see:

code: ""
desc: ""
count: 27
recorded: true

Strings have not been recorded!

I've also tried using getData in this way:

getData(hash, Web3.fromAscii(code), Web3.fromAscii(desc), count)

and in this other way:

getData(hash, Web3.toHex(code), Web3.toHex(desc), count)

but the result is even worse:

code: ""
desc: "<long hex string containing both code and desc strings>"
count: 27
recorded: true

I cant understand what is happening. It is like web3 is not able to correctly serialize the payload and then, as a consequence, smart contract interface is not able to put the right number of bytes in the right "slots".

Any idea?

P.S. if I call the record method from Remix, with the same values, it obviously works!


texts: I made a solidity contract but I want to get the event in another contract, is it possible to watch the event in that way?


texts: What a strange thing is: Remix with Ropsten testnet: Gas required exceeds limit

texts:
I'm trying to run an example Solidity program - Congress from Etherum.org which I believe it should be right, but I always got "transact to Congress.addMember errored: Gas required exceeds limit: 300000000.  An important gas estimation might also be the sign of a problem in the contract code. Please check loops and be sure you did not sent value to a non payable function (that's also the reason of strong gas estimation). " when I call a function in Remix while it can be called successfully from an ether wallet.
The function I called is addmember(address targetMember, string memberName):

mapping (address => uint) public memberId;
Member[] public members;
struct Member {
    address member;
    string name;
    uint memberSince;
}
function Congress (
    uint minimumQuorumForProposals,
    uint minutesForDebate,
    int marginOfVotesForMajority
)  payable public {
    changeVotingRules(minimumQuorumForProposals, minutesForDebate, marginOfVotesForMajority);
    // It’s necessary to add an empty first member
    addMember(0, "");
    // and let's add the founder, to save a step later
    addMember(owner, 'founder');
}

function addMember(address targetMember, string memberName) onlyOwner public {
    uint id = memberId[targetMember];
    if (id == 0) {
        memberId[targetMember] = members.length;
        id = members.length++;
    }

    members[id] = Member({member: targetMember, memberSince: now, name: memberName});
    MembershipChanged(targetMember, true);
}

More strange thing is if I call addmember(0x45598A0733111F1Cff340504dE74cbCDC54B101d,"Name1"), Remix told me this gas error, but if I call addmember(0x0,"Name1"), It can be done without any problem.

I use Injected web3 option and Ropsten testnet, and I send 0 ether as value, gas limit from 300000 to 300000000, all don't work. Any suggestion?


texts: Possible to use gas from the balance of a contract?

texts:
When calling an external contract function from within a contract, does the gas come from the originating transaction?  If so, is there a way to use gas from the contract's balance?

example call:

someReturnValue = someContract.somePayableFunction.value(10).gas(10000)({someParam: "some value"});


texts:
Here is the doc about provider in ethers 5.x document:
new ethers.providers.JsonRpcProvider( [ urlOrConnectionInfo [ , networkish ] ] )

Connect to a JSON-RPC HTTP API using the URL or ConnectionInfo urlOrConnectionInfo connected to the networkish network.

If urlOrConnectionInfo is not specified, the default (i.e. http://localhost:8545) is used and if no network is specified, it will be determined automatically by querying the node using eth_chaindId and falling back on eth_networkId.

How to create urlOrConnectionInfo of ConnectionInfo type? The ConnectionInfo seems to be a class but I am having hard time to find information such as import and initialization about it.


texts:
When it comes to bytecode solc has three types of outputs:

--bin                Binary of the contracts in hex.
--bin-runtime        Binary of the runtime part of the contracts in hex.
--clone-bin          Binary of the clone contracts in hex.

The first two are clear and were explained in detail here, but I can't find anything about clone-bin. What is it for?


texts: What to do if I get "Warning! Error encountered during contract execution [Out of gas]"

texts:
Hoping someone can help me,I(ve sent some ETH from my Nano S to Poloniex, and it didn't go through. Etherscan says:

  Warning! Error encountered during contract execution [Out of gas]. The
  value shows "Cancelled".

I think the transaction is supposed to be cancelled and the ETH returned less the gas fee, but the ETH isn't showing on my Nano.
I'd appreciate any help in trying to figure out how to either push the transaction with more gas or have the ETH returned.


texts:
I'm developing a dapp on Meteor that uses a contract written in solidity.
In the contract there is a struct.
Is possible to print the values that are in the struct? How can i do this?


texts: How to mine without entire computer slowing down?

texts:
My computer is a dream machine with 64gb RAM and 28 cores operating at 4-5Ghz. Using Linux Mint. I also have a fairly modern Nvidia graphiques karrd with 8gb VRAM.
I am mining XMR on 24 of my 28 cores, leaving 4 for day to day tasks, and there is no noticeable slowdown or impact on my computer experience.
But the moment I fire up Ethminer, my computer becomes incredibly laggy. I find this surprising. Surely maxing out the graphics card shouldn't have such a drastic impact.
I would like to leave ethminer running all the time, rather than simply firing it up when I go to bed. How can I diagnose the slowdown?
edit: even if I stop mining XMR and my 28 cores are all available, the slowdown is significant. I don't understand why maxing out the graphics card would have such an impact on everything else


texts: Issue in setting GasPrice when sending raw transaction

texts:
I am using web3 and infura node to send my raw transaction but I am having difficulty in setting gasprice. I constructed rawtransaction as follows

 web3js.eth.getTransactionCount(myAddress, 'pending').then(function(v){
             count = v+1;
             console.log("count",count);
             var transfer =  contract.methods.createdegree(uniquekey);
             var encodedABI = transfer.encodeABI();
             const rawTransaction = {
                            "nonce": count,
                            "from": "xxx",
                            "to": "xxx",
                            "value": 0,
                            "gasPrice":"3000",
                            "gas": 566540,
                            "data": encodedABI,
                            "chainId": 1
                       };

           var transaction = new Tx(rawTransaction);
           transaction.sign(privateKey);
           var signedtx = '0x'+transaction.serialize().toString('hex');
           var transactionidfinal = new Tx(signedtx).hash().toString('hex');
           var transactionidfinaldated = '0x'+transactionidfinal;
           var transactionarray = [transactionidfinaldated,signedtx];
           resolve(transactionarray);
        });

  });

 };

But I noticed that in etherscan gasprice is shown as 0.85879608 Gwei.  which is very low considering market price . Here is an example transaction https://etherscan.io/tx/0x91d0bc123de43cc182c5ef6da363c7cfb723830066c055f1c324b664859705cb .

Am I doing something wrong here?

How can I set 3 Gwei gasprice in my raw transaction?


texts: How to retrieve multiple contract properties in a single call?

texts:
Let's take this contract as an example: 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c.
It has multiple methods / properties that I wish to access, e.g.
function name() public view returns (string memory) {
    return _name;
}

function symbol() public view returns (string memory) {
    return _symbol;
}

function decimals() public view returns (uint8) {
    return _decimals;
}

function totalSupply() public view override returns (uint256) {
    return _tTotal;
}

At the moment, it seems like I need to call all of them individually, e.g.
await pairContract.methods.name().call()
await pairContract.methods.symbol().call()
await pairContract.methods.decimals().call()
await pairContract.methods.totalSupply().call()

Is there a way to retrieve all of the above in a single call to limit the number of roundtrips / requests?
I have found that there is BatchRequest, but from what I can tell, it is equivalent to:
[
  pairContract.methods.name().call(),
  pairContract.methods.symbol().call(),
  pairContract.methods.decimals().call(),
  pairContract.methods.totalSupply().call()
]

i.e. it does not actually batch the requests.


texts:
I am getting: "No etherbase set and no accounts found as default"

when trying to sync my node using:

geth --testnet --rpc --rpcapi db,eth,net,web3,personal --cache=1024 --rpcport 8545 --rpcaddr 127.0.0.1 --rpccorsdomain "*"

Then my node starts but seem to be a local instance not connected to the testnet:

WARN [09-29|09:28:24] No etherbase set and no accounts found as default
INFO [09-29|09:28:24] Starting peer-to-peer node               instance=Geth/v1.7.3-stable-4bb3c89d/windows-amd64/go1.9
INFO [09-29|09:28:24] Allocated cache and file handles         database=C:\\Users\\jc\\AppData\\Roaming\\Ethereum\\testnet\\geth\\chaindata cache=1024 handles=1024
INFO [09-29|09:28:24] Writing custom genesis block
INFO [09-29|09:28:24] Initialised chain configuration          config="{ChainID: 3 Homestead: 0 DAO: <nil> DAOSupport: true EIP150: 0 EIP155: 10 EIP158: 10 Byzantium: 1700000 Engine: ethash}"
INFO [09-29|09:28:24] Disk storage enabled for ethash caches   dir=C:\\Users\\jc\\AppData\\Roaming\\Ethereum\\testnet\\geth\\ethash count=3
INFO [09-29|09:28:24] Disk storage enabled for ethash DAGs     dir=C:\\Users\\jc\\AppData\\Ethash                                   count=2
INFO [09-29|09:28:24] Initialising Ethereum protocol           versions="[63 62]" network=3
INFO [09-29|09:28:24] Loaded most recent local header          number=0 hash=419410…ca3a2d td=1048576
INFO [09-29|09:28:24] Loaded most recent local full block      number=0 hash=419410…ca3a2d td=1048576
INFO [09-29|09:28:24] Loaded most recent local fast block      number=0 hash=419410…ca3a2d td=1048576
INFO [09-29|09:28:24] Regenerated local transaction journal    transactions=0 accounts=0
INFO [09-29|09:28:24] Starting P2P networking
INFO [09-29|09:28:26] UDP listener up                          self=enode://e256e2a241f56a0f65d873894f162711893714e5d21e83994c7f742542023cd5ce2cfc4216434b02534c49ab31c57f7278c4f0100951a0d6645504ef455940d7@[::]:30303
INFO [09-29|09:28:26] RLPx listener up                         self=enode://e256e2a241f56a0f65d873894f162711893714e5d21e83994c7f742542023cd5ce2cfc4216434b02534c49ab31c57f7278c4f0100951a0d6645504ef455940d7@[::]:30303
INFO [09-29|09:28:26] IPC endpoint opened: \\.\pipe\geth.ipc
INFO [09-29|09:28:26] HTTP endpoint opened: http://127.0.0.1:8545

Any idea how to solve this error message?

Thanks! Juan


texts: how to deploy smart contract in ethereum network using ropsten network?

texts: I have created a smart contract(a standard token smart contract) in solidity and truffle. Now I want to deploy it to ethereum network. I want to use ropsten network because I want to use metamask wallet. How  to do it?  Or what is the best way to deploy it in ethereum network?


texts: Is it possible to deploy a contract on the same address after self-destruct?

texts: As far as I understand self-destruct simply deletes the code from a contract and turns it into a regular wallet + it sends all funds to caller/argument. But is there a way to recreate the contract? I know revert sometimes kills and the re-initiates the contract...so it's possible at least automatically but I guess only the original msg.sender should be able to do that for security reasons? Thanx


texts: Using new operator and TypeError: Cannot read property 'event' of undefined

texts:
Here's the code:

I compile these two contracts together and deploy Bar contract. After deploying it I have a contract account address where it has been deployed on the blockchain:

0x692a70d2e424a56d2c6c27aa97d1a86395877b3a
Then I call Bar.createFoo() and get a new contract account address where the newly created contract Foo has just been deployed:

0xfcca7851eb308c57543421141f6fefbd1f4a2bef

My first question is:

What is stored in the variable whatAmI? Is it the address of Bar or is it the address of my account(externally owned account) that called Bar.createFoo()?

My second question is:

I've added some means to log the whatAmI variable here:

Compiler throws an error: TypeError: Cannot read property 'event' of undefined

What am I doing wrong here?


texts: What is the theoretical average latency of data transmission?

texts:
I concluded a pretty simple test to measure some latencies. I connected to two providers (Infura and Quiknode) with Web3.js and subscribed to new block headers. Then I compared the time of arrival and the block timestamp in the header to calculate a latency. I got the following results (left Infura, right Quiknode):
Both of them has a pretty high latency. Is this due to their complex infrastructure, or due to the P2P nature of the blockchain? This seems too high for me, so I guess I can achieve much lower latencies by running my own node. Is this likey?
What is theoretical average latency of such a distributed network?


texts: How can I get the public adress of a NFT on rarible?

texts:
1 - How can I get the public address of a NFT on rarible with ETH Block Scanner?

Lets assume we got the url (or even the address? of the NFT (does each NFT have a unique ETH address? Where do I find that?)) of the NFT now I also got the public address of the User (account address from metamsk)

2 - how can I now find the account address of the owner on the NFT transaction history?


texts: Storing millions of values in mapping variable

texts: Is it a good practice to store millions of values in a mapping variable for unique verification? For example, storing a customer name and unique number and later retrieve customer information from that unique number (like a sequence number).


texts: Why should we use different versions of Ethereum Wallet?

texts:
In a recent Griff Green article you can read to use either version 0.6.2 or 0.7.4 of Ethereum Wallet to vote and to create a proposal.

It's very confusing...

From the blog post:

  [...]create a test Proposal using the 0.6.2 version of the Ethereum
  Wallet[...]create a proposal using the 0.6.2 version of the Ethereum
  Wallet[...]how to turn the 0.7.4 version of the Ethereum Wallet into
  Mist , how to vote with the 0.6.2 version of the Ethereum Wallet

So why don't we only use 0.7.4 for creating the contract and for voting ? The article seems to tell us to switch between versions to create and to vote.

In the end, what I understand is that you can't create a proposal with 0.7.4 version.


texts: Correct way to transfer ERC-20 tokens and keeping decimals in count?

texts:
I have a token with 18 decimals, I'm using the OpenZeppelin StandardToken example and have figured out that when I want to send value I have to keep the decimals in count as such: _value * 10**decimals.

uint decimals = 18
transfer(_receivers[i], (_amount[i] * 10**decimals));

This will send the correct amount of tokens. But I don't want to calculate the decimals every place I use the transfer function.. Is it frowned upon to change the OpenZeppelin transfer() function to set the value there to

_value *10**18

Or is there an other way that is better?


texts: Web3J - Creation of Light Wallet takes too long

texts:
I am creating the wallet in my Android app, using the library Web3j:
https://web3j.io/

See the code:

String seed = UUID.randomUUID().toString();
ECKeyPair exKey = Keys.createEcKeyPair();

WalletFile wallet = Wallet.createLight(seed,exKey);

It is creating the Wallet properly, the problem is that the process takes long time, around 10 minutes.

Am I doing something wrong?

Is there another way to make it faster?


texts: Call function from contract using sendTransaction() - web3.py

texts:
I have contract Test.sol migrated to privatenet running on port '8545' which updates value of 'a'.

Test.sol

pragma solidity ^0.4.20;

contract Test{

 uint public a=2;

function updateval(uint b) public {

    a = a+ b;
}

function geta() public view returns(uint c){
    c=a;
    return c;
}

}

I am using python3.6 to call function updateval() from Test.sol.

contractcall.py

import json
import web3
import binascii
from web3 import Web3,HTTPProvider
from solc import compile_source
from web3.contract import ConciseContract

w3 = Web3(HTTPProvider('http://127.0.0.1:8545'))

abi= '''[
{
    "constant": false,
    "inputs": [
        {
            "name": "b",
            "type": "uint256"
        }
    ],
    "name": "updateval",
    "outputs": [],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
},
{
    "constant": true,
    "inputs": [],
    "name": "a",
    "outputs": [
        {
            "name": "",
            "type": "uint256"
        }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
},
{
    "constant": true,
    "inputs": [],
    "name": "geta",
    "outputs": [
        {
            "name": "c",
            "type": "uint256"
        }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
}
]
'''

address = Web3.toChecksumAddress("0x09f2e386111647ff986439f488583f39e153c940") //ContractAddress
mywalletaddress = w3.eth.accounts[0]

Test = w3.eth.contract(address, abi=abi)

b=4
msg = w3.toHex(text='Hello World')

txnHash= Test.functions.updateval(int(b)).sendTransaction({'from' : mywalletaddress,'data' : msg })
print(txnHash)

I need to pass message 'Hello world' with transaction. I tried with the following code:

txnHash = Test.functions.updateval(b).buildTransaction({'from':mywalletaddress})

print(txnHash)

tx= w3.eth.sendTransaction(txnHash)//How to pass data field here??
print('tx',tx)

What is the correct method of implementing it. Help will be appreciated.


texts:
I've seen many topics, but I've yet not solved my problem. Please, help me!

 var EthereumTx=require('ethereumjs-tx').Transaction
 const Web3=require('web3')
 const web3 = new Web3('https://rinkeby.infura.io/v3/85xxxxxxxxxxx2af25e829b8d9df')
 const account1='0xbd77caf08fe49d3f5aef6f83fc23b8d2129b468f'
 const main = async () => {
    const count = await web3.eth.getTransactionCount('0xxxxxxxxxxxxxxxf5aef6f83fc23b8d2129b468f');
    const nonce = web3.utils.toHex(count);
    const block = await web3.eth.getBlock('latest');

  const gasLimit = web3.utils.toHex(3000000)
  const gasPrice = web3.utils.toHex(22 * 1e9) // 5 gwei
 const privateKey = Buffer.from(
  'xxxxxxxxxxxxxxxxxxxxxxxxxx',
  'hex',
)

        const txParams = {
          from: "0xxxxxxxxxxxxxxxxxxxxxxxxxxxx9b468f",
          gasPrice: gasPrice,
          gasLimit: gasLimit,
          to: '0xxxxxxxxxxxxxxxxxxxxxxb91a04e',
          value: web3.utils.toHex(web3.utils.toWei('1','ether')),
          data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057',
         chainId: '0x03'

        }
// The second parameter is not necessary if these values are used
const tx = new EthereumTx(txParams, { chain: 'rinkeby', hardfork: 'petersburg' })
tx.sign(privateKey)
const serializedTx = tx.serialize()
    const raw ='0x'+serializedTx.toString('hex')
    // broadcast the trasnaction

    web3.eth.sendSignedTransaction(raw,(err,txHash)=>{
      console.log('err:',err,'txHash:',txHash)
    })
 }

main();

I've got this error

  Error: Returned error: insufficient funds for gas * price + value


texts:
I'm completely new to blockchain development and remix.
It's my first time ever using Remix. Apparently "Deploy and run transactions" plugin is already activated by default. However, the deploy icon is not visible on the left pane on Remix. Nothing changes after clicking on "deactivate". When I clicked on Permissions, i got the message "No Permission requested yet."
Any idea?


texts: Invalid type for argument in function call

texts:
I have this token code

pragma solidity ^0.4.19;

contract MyToken {

   mapping (address => uint256) public balanceOf;

   function MyToken(uint256 _supply) public {

     balanceOf[msg.sender] = _supply;
 }
    //ф-ция должна так называться по ERC20
    function transfer(address _to, uint _value) public
      {
    //проверка, хватает ли токенов у того, кто хочет отправить
    require(balanceOf[msg.sender]) >= _value;

    //проверка, не произошло ли переполнение
   require(balanceOf[_to] + _value >= balanceOf[_to]);

   //забираем токены у отправителя
    balanceOf[msg.sender] -= _value;

   //передаем токены получателю
      balanceOf[_to] += _value;
   }
}

And there is an error  in the line
 = _value;>


texts: Is Ethereum wallet address case sensitive?

texts:
I sent some amount of ETH to a wallet. I checked the wallets balance on ether chain. I entered the address in the search field and noticed both lowercase and uppercase  versions of the address seemed to work.

I wanted to buy a few bucks more, but now I'm not sure if there is something wrong with the address I created. I'd be grateful for some guidance.


texts: A possible method for safe random number in lotteries

texts:
In the case of the lottery a seed provided to the function that uses block hash can be used to remove the interference from all the parties (miners and house).

The seed is selected by the 'house' previous to the beginning of the lottery. The house encrypts it and provides a public key for it.
When the block at which the lottery plays is reached, the house uses the seed (known only to the house until that point) and the blockhash to calculate the random number. The house publishes the private key allowing the seed word to be decrypted so that everyone who wishes can verify the process.

In this approach:
The miners can influence the blockhash but not the seed.
The house knows the seed but not the blockhash
The ticket holders can verify the seed.

Other than that, the blockhash should work perfectly fine for random number generation in anything else.

Any objections to this?


texts: How keccak hashing and for loop happening in pure function?

texts: I put a keccak hashing inside pure function, it works and return me the result.It also works in a for loop. I studied that hashing the data and loop consumes consider amount of gas. Do we need to provide ether for that??. But pure function invocation doesn't go as a transaction right... ??


texts: No data is deployed on the contract address!

texts:
I add a new Smart Contract and create it, but I get the following bug. Why is the contract not created? I take the etherium wallet and the ropsten testnetwork
The first picture include the constructor. Thanks for helping.


texts: Is it possible to query smart contracts inside a smart contract?

texts: I want to know if it is possible to query (discover) smart contracts inside my smart contract. For example, I want to find a smart contract with some name and/or parameters and then call it. Is that possible?


texts:
I have a couple words unclear/missing from my 24-word BIP39 seed phrase, which unlocks my Ethereum address.
I want to bruteforce through all possible seed phrases and find the one. It shouldn't take more than ~10 million attempts in my estimation.
Could you please outline the optimal algorithm for me? So far I've came up with something like this:

Set up geth node;
Install a wallet software, which allows import of custom seed phrases (like Ethers.js);
Create my own piece of software, which browses through the list of possible seed phrases, generates ETH addresses and checks if there's a match.
Run the software and wait for the result.

Is that it? Am I missing something?


texts:
Having issues verifying my token contract on etherscan.io.

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

Error! Unable to generate Contract ByteCode and ABI

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

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

Cheers!


texts: Calculate transaction costs for storing data

texts:
I'm trying to figure out how the transaction costs are calculated for a transaction that is storing data on the Ethereum Blockchain. It seems I'm always off. Here is my way of calculating (I'm using the Kovan Testnet but I guess the calculation should be identical):

I uploaded the follwing smart contract

pragma solidity ^0.5.12;

contract NewContract {

    struct Location {
        string JSON;
    }

    Location[] locations;

    function createLocation(string memory _json) public {
        locations.push(Location(_json));
    }

    function viewLocation(uint _id) public view returns(string memory) {
        string memory result = locations[_id].JSON;
        return result;
    }
}

When I save the String: "Test123" I assumed the price would be made up out of the following stats according to the yeelow paper: https://ethereum.github.io/yellowpaper/paper.pdf Appendix G. Fee Schedule

68: Paid for every non-zero byte of data or code for a transaction.

21000: Paid for every transaction.

Since the size of the string "Test123" is 7 Byte my calculation was:
(21.000 + (7*68))*9(Gwei)= 21.476 gas * 9 Gwei = 193.284 Gwei (transaction costs)

Which would be 0.000193284 Ether
My test calculation: https://kovan.etherscan.io/tx/0x8098ddd06cefe06280a4a499c5ff04d9fa93af64a7b77d060173607c32b54c4c
said that it used 64.244 Gas and it cost 0.000578196 Ether

What calculation does the EVM do that I'm not aware of?

Thanks in advance :)


texts: In the Remix Web3 Provider IDE, how do you call a function in an ERC20 token contract from another contract without getting an estimateGas error?

texts:
I am building a very basic smart contract, 'CheckAllowance', on top of the 'FiatTokenV1' ERC20 token in the Remix Web3 Provider IDE. When I try to check an address's allowance in the 'FiatTokenV1' token contract from my smart contract, I get an estimateGas error.

Here are the steps I take:

Initiate testrpc connection via MacBook terminal
Deploy 'CheckAllowance' smart contract in Remix Web3 Provider IDE
Deploy 'FiatTokenV1' ERC20 token contract in Remix Web3 Provider IDE (https://github.com/centrehq/centre-tokens/blob/master/contracts/FiatTokenV1.sol)
Initialize, configure minter, mint 1000000 coins in token contract, then approve 'CheckAllowance' contract with 200000 allowance.
Call checkAllowance function in 'CheckAllowance' contract with _tokenAdress = 'FiatTokenV1' address and _amount = 200000.
Get "transact to CheckAllowance.checkAllowance errored: Error: VM Exception while executing eth_estimateGas: invalid opcode" error

I manually confirmed that there is a 200000 allowance for 'CheckAllowance' address as spender and 'FiatTokenV1' address as owner, so I don't understand the error.

Note that this exact process works fine in Remix Javascript VM! Any feedback is greatly appreciated.

pragma solidity ^0.4.24;

import 'openzeppelin-solidity/contracts/token/ERC20/ERC20.sol';

contract CheckAllowance {

    ERC20 public ERC20Interface;

    function checkAllowance(address _tokenAddress, uint _amount) public returns (bool) {
        ERC20Interface = ERC20(_tokenAddress);
        require(ERC20Interface.allowance(msg.sender, this) >= _amount);
        return true;
    }
}


texts: Does new approve call overrides previous approved tokens?

texts:
Let's say I asked a user to approve the X Dai amount today for Smart invoice asking price.

daiContract.methods.approve(cAddress, X.toString()).send({
    from: ethereum.selectedAddress
});

But, he buys after a week since the time he approved. so, the asking amount increases with the time Y Dai so, he has to approve extra dai amount
Z Dai = Y Dai - X Dai

daiContract.methods.approve(cAddress, Z.toString()).send({
    from: ethereum.selectedAddress
});

but it is overriding the previous X Dai amount and giving some random amount when I check the allowance

daiContract.methods.allowance(ethereum.selectedAddress,cAddress).call({
        from: ethereum.selectedAddress
    }

so, what happens when I approve multiple times and does it add like if I approve X Dai first-time transaction and then Y Dai second time approves the transaction = X Dai + Y Dai? or it completely overrides the first and now only Y Dai is approved?


texts: Architectural blockchain adoption possibilities

texts:
I am working on a new shipments management project which will need the blockchain technology to certify the app-generated documents.

I have no prior experience in blockchain and after a deep browsing session I have gathered these possibilities to integrate blockchain in the project:

Join a private/consortia blockchain with the installation of a related node in an on-prem/cloud server
Deploy a private/consortia blockchain using Hyperledger frameworks/tools on on-prem/cloud servers
Deploy a public blockchain using Ethereum frameworks/tools on on-prem/cloud servers (Not sure if applicable since I am working on a enterprise project)
Create a blockchain solution via BaaS providers as Azure, AWS, Alibaba,...

Questions:

Are the above possibilities correct?
If not, what solutions should I leverage?

Many thanks!


texts:
i want to hide my eth balance from myetherwallet, etherscan , ethplorer .how to hide my eth balance in my ether wallet , etherscan , ethplorer.
any methods available, please reply

thanks


texts: How do you work with Date and time on Ethereum platform

texts:
Is there a way to access Date object in solidity like in JS? If so, wouldn't it be wrong to call solidity deterministic? So i guess if it called so, you can't. So the question is - how do you work with time?
P.S. i would appreciate code snippets)


texts: How to interpret 'peer discarded announcement'?

texts:
I am having an private ethereum network consisting of 49 geth nodes running in docker containers. All geth nodes are miners. My topology is following: it's a tree with one root and having 48 leaves.
I start geth by executing: geth --rpc --rpcaddr 0.0.0.0 --rpcport 8545 --datadir /data --syncmode "fast" --cache "1024" --rpcapi="db,eth,net,web3,personal,web3" --txpool.pricelimit "0" --miner.gasprice "0" --maxpeers "80" --nodiscover --verbosity 4.
The problem I face is that, after some time none of the nodes is synced with the rest of the network. I'm assuming this because:

docker exec -i nodeX_bc geth --exec "eth.blockNumber" attach ipc://data/geth.ipc - returns a different block number for each node (the numbers differ by at least 50).
docker exec -i nodeX_bc geth --exec "eth.syncing" attach ipc://data/geth.ipc - returns false
docker exec -i nodeX_bc geth --exec "eth.getBlock(XXX).hash" attach ipc://data/geth.ipc - differs if XXX > a value
The logs of one of the leaves (let's call it node1_bc) says:

INFO [01-03|20:45:28.538] Mining too far in the future             wait=2s
DEBUG[01-03|20:45:28.550] Peer discarded announcement              peer=503b78bda6977425 number=767 hash=3879d7…02e6c0 distance=-191
DEBUG[01-03|20:45:28.550] Peer discarded announcement              peer=503b78bda6977425 number=768 hash=e2d843…ffb5c9 distance=-190
DEBUG[01-03|20:45:28.564] Peer discarded announcement              peer=503b78bda6977425 number=769 hash=5b4c52…8d7454 distance=-189
DEBUG[01-03|20:45:28.598] Peer discarded announcement              peer=503b78bda6977425 number=767 hash=bdcddc…437d07 distance=-191
DEBUG[01-03|20:45:28.598] Peer discarded announcement              peer=503b78bda6977425 number=768 hash=c07110…1d6676 distance=-190
DEBUG[01-03|20:45:28.599] Peer discarded announcement              peer=503b78bda6977425 number=767 hash=982f07…15b9e8 distance=-191
DEBUG[01-03|20:45:28.599] Peer discarded announcement              peer=503b78bda6977425 number=767 hash=f7704d…065e59 distance=-191

Which as I found in the source code here, means that I am too far 'in front of' the topologies' root (id = 503b78bda6977425), which is the node I want to synchronize at first.

The logs in the root geth node says:

DEBUG[01-03|20:45:56.990] Discarded propagated block, exceeded allowance peer=node1_bc-id number=986 hash=b93deb…05dc20 limit=64

While I assume that I simply have too much miners and each couple of seconds there is a new block generated in each node, and there is no enough time to sync everything, thus I run into the issues. But I am not sure how to interpret the 'peer discarded announcement' message. Does it mean that the node stopped syncing with the rest of the network and generates all blocks local only? Does this mean that the node can't be synced in the future?

Hardware I am using:

root node: 4 vCPU, 15GB RAM, 60GB HDD
leaves node: 4 vCPU, 8GB RAM, 5GB SSD

Edit1:

Experienced the same behavior when using "full" synchronization mode.

Edit2:

An interesting finding:

I tried to find the most recent transactions in every geth node by using docker exec -i nodeX_bc geth --exec "eth.getTransaction(XXX)" attach ipc://data/geth.ipc, and I found them in almost all nodes (even if the blockNumber of the nodes differed by more than 500). This should imply that even if the nodes don't have the same block number, they might contain the same transactions, but these might be included in another block.


texts: How to use truffle-plugin-verify when you are not deploying the contract?

texts:
Here is my A contract:
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;

contract A {
    B public b;

    constructor() public {
        b = new B();
    }
}

contract B {}

As you can see, it is deploying an instance of B in its constructor. For me, both A & B are important, so I want to verify them both on etherscan.
But while using truffle-plugin-verify, I am getting this error:
pam@g3:~/verify$ truffle run verify A B --network kovan --license MIT
Verifying A
Pass - Verified: https://kovan.etherscan.io/address/0xaf589F7A115b14C3825937bBd8A59203c84BE9c5#contracts
Verifying B
No instance of contract B found for network id 42
Failed to verify 1 contract(s): B

How can I verify the contract B here?


texts:
Why is multidimensional array declaration order reversed?

  As an example, an array of 5 dynamic arrays of uint is uint[][5] (note
  that the notation is reversed when compared to some other languages).

Which is all the more confusing given that access follows custom:

  To access the second uint in the third dynamic array, you use x[2][1]
  (indices are zero-based and access works in the opposite way of the
  declaration, i.e. x[2] shaves off one level in the type from the
  right).

cf. https://solidity.readthedocs.io/en/v0.5.1/types.html#arrays


texts:
I want to be able to display the read functions of my contract on a UI.

These are the calls I make to my UI
Those functions work perfectly in the console using node but when i try to call them from my UI it doesnt work

contract.methods.sellPrice().call((err, result) => {console.log(result)})
contract.methods.buyPrice().call((err, result) => {console.log(result)})
contract.methods.totalSupply().call((err, result) => {console.log(result)})

on my UI I use following code to connect to Web3 and to connect to the read functions, but this doesnt work
I updated my Code to this

window.addEventListener('load', async () => {
    // Modern dapp browsers...
    if (window.ethereum) {
        window.web3 = new Web3(ethereum);
        try {
            await ethereum.enable();
            var accounts= await web3.eth.getAccounts();
            var option={from: accounts[0] };
            const  contract = new web3.eth.Contract(abi,contractAddress);
             const sellPrice = await contract.methods.sellPrice().call((err, result) => { console.log(result) })

        } catch (error) {
            // User denied account access...
            console.log('error');

        }
    }
    // Legacy dapp browsers...
    else if (window.web3) {
        //window.web3 = new Web3(web3.currentProvider);
        console.log(3);
        // Fallback to localhost; use dev console port by default...
        const provider = new Web3.providers.HttpProvider('https://ropsten.infura.io/v3/9bee77f147884c73bb2852e269dacece');
        web3 = new Web3(provider);
        // Acccounts always exposed
        web3.eth.sendTransaction({/* ... */});
    }
    // Non-dapp browsers...
    else {
        console.log('Non-Ethereum browser detected. You should consider trying MetaMask!');
    }
});
contract.methods.sellPrice().send(), function(err, result) {
    if(err) {
        console.log(err, 'err');
    } else {
        console.log(result, 'result');
    }
}

and why do i get an error : contract is not defined?


texts: Can I somehow connect the Binance ETH wallet to MEW and set customs gas fees for my transactions? Thank you!


texts: Error encountered, bailing. Network state unknown. Error: VM Exception while processing transaction: revert

texts:
I followed the feedback given from this question, and made a few changes to ganache like ensuring I have more than enough gas in my truffle file:

require('babel-register');
require('babel-polyfill');

module.exports = {
  networks: {
    development: {
      host: '127.0.0.1',
      port: 8545,
      network_id: '*', // Match any network id
      gas: 6712388,
      gasPrice: 65000000000
    }
  }
};

But I am still running into this error telling me my network is unknown:

  Error encountered, bailing. Network state unknown. Review successful transactions manually.
  Error: VM Exception while processing transaction: revert
      at Object.InvalidResponse (/Users/user/.nvm/versions/node/v6.10.1/lib/node_modules/truffle/build/cli.bundled.js:43303:16)
      at /Users/user/.nvm/versions/node/v6.10.1/lib/node_modules/truffle/build/cli.bundled.js:331150:36
      at /Users/user/.nvm/versions/node/v6.10.1/lib/node_modules/truffle/build/cli.bundled.js:175492:11
      at /Users/user/.nvm/versions/node/v6.10.1/lib/node_modules/truffle/build/cli.bundled.js:314196:9
      at XMLHttpRequest.request.onreadystatechange (/Users/user/.nvm/versions/node/v6.10.1/lib/node_modules/truffle/build/cli.bundled.js:315621:13)
      at XMLHttpRequestEventTarget.dispatchEvent (/Users/user/.nvm/versions/node/v6.10.1/lib/node_modules/truffle/build/cli.bundled.js:70159:18)
      at XMLHttpRequest._setReadyState (/Users/user/.nvm/versions/node/v6.10.1/lib/node_modules/truffle/build/cli.bundled.js:70449:12)
      at XMLHttpRequest._onHttpResponseEnd (/Users/user/.nvm/versions/node/v6.10.1/lib/node_modules/truffle/build/cli.bundled.js:70604:12)
      at IncomingMessage. (/Users/user/.nvm/versions/node/v6.10.1/lib/node_modules/truffle/build/cli.bundled.js:70564:24)
      at emitNone (events.js:91:20)

2_deploy_contracts.js looks like:

const myTokenCrowdsale = artifacts.require("./myTokenCrowdsale.sol");
const myToken = artifacts.require("./myToken.sol");
const ConvertLib = artifacts.require("ConvertLib.sol");

function latestTime () {
  return web3.eth.getBlock('latest').timestamp;
}

const duration = {
  seconds: function (val) { return val; },
  minutes: function (val) { return val * this.seconds(60); },
  hours: function (val) { return val * this.minutes(60); },
  days: function (val) { return val * this.hours(24); },
  weeks: function (val) { return val * this.days(7); },
  years: function (val) { return val * this.days(365); },
};

module.exports = function(deployer, network, accounts) {
  const RATE = 1;
  const startTime = web3.eth.getBlock(web3.eth.blockNumber).timestamp + 1;
  const endTime = startTime + (86400 * 20);
  const cap = 2000;
  const goal = cap;

deployer.deploy(myTokenCrowdsale, startTime, endTime, RATE, accounts[0], myToken, goal);
};

I have my Crowdsale contract inheriting from multiple Zeppelin-solidity contracts, similar to their example here, and I've read that the Network error could be a result of trying to deploy a contract bigger than the test network's limit.  But I can't imagine that is the problem if I'm using their example.

Any thoughts on where I'm going wrong?


texts:
How could you send easyMine EMTs from Jaxx to myetherwallet. From Jaxx I can not see EMTs.

Thank you


texts: Error during Testing Contract using Ethereum-bridge for oraclize

texts:
I'm getting the following error when I'm trying to test (truffle test) my contract which uses Oraclize API 0.5 to get the ledger random from oraclize (datasource = "random"). I'm using solidity 0.5.0 compiler, and this is the error trace:

Returned error: VM Exception while processing transaction: revert
    at C:\Users\<UserName>\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-deployer\src\deployment.js:364:1
    at process.internalTickCallback (internal/process/next_tick.js:77:7)
Truffle v5.0.2 (core: 5.0.2)
Node v11.6.0

I've tried to run another contract example (RandomExample) but it throws the same error, which means the error is not in contract but probably in the way it queries ethereum-bridge and Ganache (v1.2.3). I used the following code to initialize ethereum-bridge:

.\ethereum-bridge.cmd -H localhost:7545 --loglevel:debug --dev -a 9

any ideas what could be the possible error? the error is throwing when the following code is called inside the contract:

queryId = oraclize_newRandomDSQuery(delay, N, callbackGas);


texts: I have private test network, and I need to simulate forks. Is any possibility to immediately set number block fork-1 (in PoA or any other protocol) ?  If yes, what is the easiest way to do it ??


texts: Sending funds to a possible smart-contract

texts:
When sending funds to an Ethereum address,
Should my wallet check in the blockchain whether the address is associated with a smart contract? In order to choose the gas limit automatically.

If someone just created the contract, is there a race condition between my payment transaction to his creation transaction?

Seems like an opening for exploits, don't you think?

Thanks


texts: ERC20 Token and effective way to store dividends

texts:
I want to create a token that will allow an effective way to iterate through and update dividend values per token holder address. With my current idea, I'd have to manage 2 structures to keep ERC20 standard and be able to iterate through and calculate/store dividends (calculation will be divided into n steps due to gas limits). Is there any better way to implement dividends in current ERC20 standard?

ERC20 Token balances

mapping (address => uint256) public balances;

Array to store tokens and dividends

struct TokenDividend
{
    address addr;
    uint divident;
}
Token[] public tokenDividends;

Users will be able to withdraw their rewards with withdraw() function, the problem here is that each user would have to iterate over tokenDividends array, this would cause out of gas errors at some point:

function withdraw() returns (bool) {}

What are current plans about token standard?
Is it possible to use iterable mapping as a token standard structure?
https://github.com/chriseth/solidity-examples/blob/master/iterable_mapping.sol
Are there any new structures planned to be added to Solidity?
Should I combine standard mapping and iterable mapping to manage dividends and keep ERC20 token standard?
Update:
I have a requirement to add dividends weekly, all of the token holders have to be treated equally, users with small amounts of tokens will earn small dividends, those dividends will need to be accumulated over time so users won't spend more than they earn when withdrawing their rewards. Token will be tradable.

Similar question:
ERC20 Tokens with Rewards?


texts: My Ethereum balance not showing up in Mist 0.8.6 or Ethereum wallet 0.8.6

texts:
I have just switched to parity because geth doesn't work at all for me. I have synced and opened new mist 0.8.6 but I don't see my balance. What am I doing wrong? How to add an account and show my balance? I have also imported keys from the old app data folder or to be more specific, I have replaced the whole Ethereum folder and Mist folder in the roaming sub directory by the ones used the last time with the 0.8 wallet.

Last wallet I have used was 0.8

Thanks guys


texts:
If you want to start a private net with Geth, then you need to create a Genesis Block. You specify the attributes of this block through a config file. One of these configurations is 'difficulty'.

An example I've seen is this: "difficulty": "0x0400".

My question is, what does this number represent?

Reference : What does the difficulty value represent in a Geth genesis block config?


texts:
I'm trying to create a smart contract to buy and sell documents. The truffle has the following token example.

pragma solidity ^0.4.4;

import 'zeppelin-solidity/contracts/token/StandardToken.sol';

contract TutorialToken is StandardToken {
    string public name = 'TutorialToken';
    string public symbol = 'TT';
    uint public decimals = 2;
    uint public INITIAL_SUPPLY = 12000;

    function TutorialToken() {
        totalSupply = INITIAL_SUPPLY;
        balances[msg.sender] = INITIAL_SUPPLY;
    }
}

Is it ok to add the following code to the same contract? Or is there a better way to do it? Is there a complete example? It sounds like a typical example.

contract TutorialToken is StandardToken {
    string public name = 'TutorialToken';
    string public symbol = 'TT';
    uint public decimals = 2;
    uint public INITIAL_SUPPLY = 12000;

    function TutorialToken() {
        totalSupply = INITIAL_SUPPLY;
        balances[msg.sender] = INITIAL_SUPPLY;
    }

    // Doc struct (maybe mapping (address => Doc))
    struct Doc {
        address seller;
        int docId;
        int priceByToken;
    }
    Doc[] Docs;

    function listDoc(int docId, int priceByToken) {
        // Insert into Docs (using sender's address)
    }

    mapping (address => Doc) Transactions;

    function buy(address buyer, address seller, int docId) {
        // Send token from buyer to seller and update Transactions
        transfer(seller, ..., buyer);
    }
}


texts: Trying to run dapp in metamask mobile browser

texts:
I would like to run a dapp in metamask mobile browser, but got stuck in below things:
1. Unable to view the console errors(inspect element) in the application
2. How to visualise page load values or functions? ( For eg: USERID display while loading the corresponding page)

Mobile OS: Android Version
It's working fine in Web browser(Google Chrome) using metamask extension.
Help will be appreciated.


texts: Create multiple ERC-20 tokens without deploy a contract everytime?

texts:
I would like to write a smart contract that can issue an erc20 token when asked (with some required parameter, as name, symbol, decimals, and owner address).

From what I understood I have to deploy a new smart contract every time I want to issue a new ERC-20 token. Can I do this inside a smart contract?

I also saw that there is this new erc1155 standard, but from what I understand is mostly for issuing erc721 tokens.


texts: Trouble while installing truffle-contract module

texts:
When I run the command sudo npm install truffle-contract it gives me this error:

npm ERR! code 1
npm ERR! Command failed: /usr/bin/git clone -q https://github.com/debris/bignumber.js.git /home/ubuntu/.npm/_cacache/tmp/git-clone-777489e7
npm ERR! /home/ubuntu/.npm/_cacache/tmp/git-clone-777489e7/.git: Permission denied
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2017-12-26T05_11_27_119Z-debug.log


texts: Problem unlockaccount on Rinkeby via infura

texts:
I got "405 Method Not Allowed" error when I tried to unlock an account I created on MetaMask.
Here is the code:

string privateKey = "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
string senderAddress = "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";

var account = new Account(privateKey);
var web3 = new Web3(account, "https://rinkeby.infura.io/<token>");

var password = "xxxxxxx"; // where does this come from? the meta mask password???

// error on the line below
var unlockResult = await web3.Personal.UnlockAccount.SendRequestAsync(senderAddress, password, new HexBigInteger(120));

What have I done wrong? Where does 'password' come from?


texts: How to Perform Transact() On Contract Functions on Remote Node

texts:
I would like to call a smart contract functions using Web3 Python using the Infura mainnet node instead of a local node. I understand that I need to import the private key and use it to sign the transaction but I cannot see any examples for doing this with calling smart contracts.

The code I have is as follows but it fails as there is no wallet attached:

from web3 import Web3
import json
from web3.providers.rpc import HTTPProvider
contractAddress = '0xabcd'
web3 = Web3(HTTPProvider('https://mainnet.infura.io'))
with open('abcd.abi', 'r') as abi_definition:
    abi = json.load(abi_definition)
print (web3.eth.blockNumber)

fContract = web3.eth.contract(abi,contractAddress)

print ("Test",fContract.transact().test("0xabcd",100000))

Error:

ValueError: {u'message': u'gas required exceeds allowance or always failing transaction', u'code': -32000}


texts:
I do not understand how the proposal mechanism illutstrated here works.

  A proposal mechanism is a mechanism that proposes hashes, which the rest of the machinery with PREPARE and COMMIT messages then tries to finalize. The mechanism may well be faulty at times; it’s the job of the slashing conditions to ensure that even if the proposal mechanism is faulty, there are no safety failures and the protocol can finalize something once the proposal mechanism stops being faulty.

From the above quote it seems that the proposal mechanism propose an hash before than the validators send PREPARE and COMMIT messages.

How are block proposals made in Casper? is the best answer that I can find on stackexchange but I think that is related to another algorithm.

Here some doubts that I have:

How the validator that proposes the hash is chosen?
What happens if the validator is offline?
Must the validator use a message like PREPARE and COMMIT to propose an hash? Something like [PROPOSE, epoch, HASH, epoch_source]
There are slashing conditions for the proposer?
Must a validator send PREPARE messages only for proposed hash?
The proposed messages are included in the state?


texts: Smart contract erc20 code snippet to prevent buyer token transfers

texts:
I´m going to start a token pre-sale and I want to be able to send the tokens to the buyer but prevent the buyer to send tokens to another wallet.

I tried the following in my ERC20 smart contract but It actually prevent myself, the contract creator, to transfer tokens. I need to be able to send tokens to buyers and prevent buyers to transfer tokens till certain time in the future.

here is the test smart contract contract: https://etherscan.io/address/0x5783f4e4a1bec72f41f246c50ba3d06265d984a6#code

function transfer( address _to, uint _value) public {
  require( now > 1514764800 );
  /* Rest of Function */
}


texts: How can contracts be designed to use gas refunds?

texts:
A transaction may have some gas refunds, but such refunds can only be used within the transaction: the gas refund is not converted to ether and refunded to the sender's account.

How can contracts be designed to use gas refunds, what are usecases, and what are actual coded contracts that are using gas refunds?


texts:
My computer is a laptop with a small SSD HDD, so I don't want to download the blockchain.

Hence, I want to use --light to connect to other computers which do have a copy of the blockchain.

Parity's wiki page says that --light is experimental.

geth's wiki says that it is "under development".

How do they both compare in terms of:

Protocol support
Speed
Robustness / Reliability
Code maturity
Features


texts: Can ownership of a solidity contract be relinquished?

texts:
I'd like to maintain ownership of a set of contracts for a period of time to build them out, but eventually I'd like to relinquish ownership so that the users don't have to trust me to not steal their ethers. My idea is to just set the owner to address 0x1111111111111111111111111111111111111111 like so:

function relinquishOwnership() onlyOwner {
    owner = 0x1111111111111111111111111111111111111111;
}

Is it safe to assume that nobody owns this address? And is this a safe way of ensuring that nobody has ownership of the contract? Is there a better way to do this?


texts: What recommended amount of storage for storing timestamps?

texts: E.g: uint8, uint16, uint32, uint64, uint128, uint256? Which of these is best recommended to future-proof the application? And given each uint, what year is the furthest it could be stored?


texts: What is the point of the `contract` hash returned by Geth?

texts:
Basic question:

If I do myContract = eth.contract([abi goes here]), then I get do a:

var contract = myContract.new(
  /* args */,
  {
    from: eth.accounts[0],
    data: compiledContract,
    gas: 1000000
  }
)

I receive back:

fullhash=0x830e6922af1008...
contract=0xA94C943B7b...

What is this contract hash value actually used for?


texts: What prevents the market from assigning value to testnet ETH?

texts: If enough people mine testnet ETH for testing purposes, difficulty will rise along with the cost of generating testnet coins. In some a circumstance why would the value of testnet coins not rise based on supply/demand?


texts: What is the difference between ERC-2665 and what is proposed in EIP-2981? Royalties vs Transfer Fee

texts:
There is an EIP for Royalty standards. But there is already a ERC for a Transfer Fee
Could ERC-2665 be used to implement royalties across all market places for NFT?
What is the difference between these?
This relates to the issue that royalties for NFT are not enforced in ERC-721 each market platform has to implement it and it only works when resales happen on their platform. If the NFT goes to OpenSea it loses the royalty function.
Cryptograph implemented ERC-2665 and they pay a percentage of the previous price of the NFT as a transfer fee. Is this really that different than a royalty?
Royalty standards - https://eips.ethereum.org/EIPS/eip-2981
Transfer Fee
https://eips.ethereum.org/EIPS/eip-2981
https://github.com/ethereum/EIPs/issues/2665
https://medium.com/cryptograph/unlocking-a-digital-ownership-revolution-9f564ca07fe3


texts: Error on calling initialize after deploying upgradable contract

texts:
I have deployed my contract to mainnet,All thing was fine but after I tried to call initialize method I got error and I think proxies not initiated
How can I do now?
I lost some Ether and nothing worth that
pragma solidity ^0.6.0;

import '@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol';
import '@openzeppelin/contracts-ethereum-package/contracts/presets/ERC20PresetMinterPauser.sol';
import '@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol';
contract Token is Initializable, ERC20PresetMinterPauserUpgradeSafe   {
  function initialize() public initializer {
    ERC20PresetMinterPauserUpgradeSafe.initialize("Cryptomind", "CR");
      _setupDecimals(8);
  }

}

? Pick a network mainnet
? Pick a contract to deploy Token
√ Contract Token deployed
All implementations have been deployed
? Call a function to initialize the instance after creating it? Yes
? Select which function * initialize()
**× Setting everything up to create contract instances
insufficient funds for gas * price + value**

oz call
? Pick a network mainnet
A contract address must be specified.


texts: Error when deploying contract having struct with many strings

texts:
I am using Truffle with Ganache and MetaMask. I have a struct in my contract containing many fields as string data type

struct User {
        string firstName;
        string lastName
        string dateOfBirth;
        string addressOfUser;
        string emailId;
        string password;
    }
mapping (string => User) registeredUsers;
function registerUser(string _firstName, string _lastName,string _dateOfBirth, string _addressOfUser, string _emailId, string _password) public returns (string) {
        totalRegisteredUsers++;
        string memory userId = generateId(_firstName, _lastName);
        registeredUsers[userId] = User(_firstName, _lastName, _dateOfBirth, _addressOfUser, _emailId,  _password);
        return userId;
    }

In the front end code, I have a form which inputs these details and then calls the registerUser method of the contract

register: function() {
    let firstName = $("#first-name").val();
    let lastName = $("#last-name").val();
    let dob = $("#date-of-birth").val();
    let address = $("#address").val();
    let emailId = $("#email-id").val();
    let password = $("#password").val();
    App.contracts.Identity.deployed().then(function(instance) {
      instance.registerUser.call(firstName, lastName, dob, address, emailId, password).then(function(userId) {
        $("#user-id").html("User id is : " + userId);
      });
    });
  }
</code>

When i try to run this, I always get the following error :
<code>
Uncaught (in promise) Error: Invalid JSON RPC response: {"id":2,"jsonrpc":"2.0","error":{"code":-32603}}
    at Object.InvalidResponse (inpage.js:445)
    at inpage.js:445
    at inpage.js:336
    at inpage.js:18
    at u (inpage.js:18)
    at inpage.js:18
    at inpage.js:18
    at a (inpage.js:18)
    at c (inpage.js:18)
    at inpage.js:18

However, if i modify the struct to have only one string field, say

struct User {
        string firstName;
    }

It works perfectly fine and the user Id is displayed correctly.
Is this problem due to size of the contract becoming too big?


texts: How to shorten IF statement with require() inside?

texts:
I'm trying to make the if statement shorter, to require a less gas it the case of emergency, here how it looks like:
if (input == token0) {
    require(amount0Out > amount, "1");
}
else if  (input != token0) {
    require(amount1Out > amount, "2");
}

So I tried something like this but it doesn't produce the same result, actually it always fails with error "1".
input == token0
  ? require(amount0Out > amount, "1")
  : require(amount1Out > amount, "2");

So what is the smart way to make if statement here?


texts: Can abstract contracts in solidity have state variables?

texts:
I want to have one deployed contract with my data structure and all data and another separate contract with functions that calls the deployed contract. If i've understood things correctly, one should implement a abstract contract with the function signatures so that my caller contract knows how it should call the deployed contract? If so, should (can) I specify the state variables (the data structure) of the deployed contract?

Thanks!


texts: Debugging Ethereum Contract by printing the values

texts: Is there a way that I can print the intermediate result on a console or some log file in order to debug my contract?


texts: Getting a list of Variables in a smart contract via just the contract address

texts:
Is it possible to get a list of all variables that a smart contract needs to be sent just by knowing the contract's address?

What i want to do:

make a call to the chain and get the required variables
Generate fields out of those variables in a form
Submit the form thus ensuring that all the needed fields exist


texts: Pass address[] array to Truffle deployer (MultisigWallet)

texts:
I am trying to deploy the MultisigWallet contract on testrpc.
However, I can't figure out how to provide the address[] _owners constructor parameter in the deployment command.

I've tried several things, of which the following seemed the most logical to me:

var MultisigWallet = artifacts.require("./MultisigWallet.sol");

module.exports = function(deployer) {
  deployer.deploy(MultisigWallet, ["0x7cb7..."], 0, 10000);
};

When running truffle migrate, I receive the following error:

> Error encountered, bailing. Network state unknown. Review successful
> transactions manually. Error: The contract code couldn't be stored,
> please check your gas amount.
>     at Object.callback (C:\...\node_modules\truffle\node_modules\web3\lib\web3\contract.js:147:46)
>     at C:\...\node_modules\truffle\node_modules\web3\lib\web3\method.js:142:25
>     at C:\...\node_modules\truffle\node_modules\web3\lib\web3\requestmanager.js:89:9
>     at XMLHttpRequest.request.onreadystatechange (C:\...\node_modules\truffle\node_modules\web3\lib\web3\httpprovider.js:118:13)
>     at XMLHttpRequestEventTarget.dispatchEvent (C:\...\node_modules\truffle\node_modules\xhr2\lib\xhr2.js:64:18)
>     at XMLHttpRequest._setReadyState (C:\...\node_modules\truffle\node_modules\xhr2\lib\xhr2.js:354:12)
>     at XMLHttpRequest._onHttpResponseEnd (C:\...\node_modules\truffle\node_modules\xhr2\lib\xhr2.js:509:12)
>     at IncomingMessage.<anonymous> (C:\...\node_modules\truffle\node_modules\xhr2\lib\xhr2.js:469:24)
>     at emitNone (events.js:91:20)
>     at IncomingMessage.emit (events.js:185:7)

If anyone could help me with:

Passing address[] constructor parameter to deployer.deploy() or
Deploying the MultisigWallet on local testrpc using truffle

edit: for the MultisigWallet I am referring to zeppelin's https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/MultisigWallet.sol


texts: Brownie some contracts cannot be tested on mainnet fork

texts:
I am testing on mainnet-fork and it always fails when particular contracts like (Uniswap) are called more than once.
Is there any fix for this or is this problem outside the scope of brownie?
Thanks
Here is the error
FAILED tests/test_uniswap.py::test_uniswap - brownie.exceptions.VirtualMachineError: revert: UniswapV2: LOCKED

Here is the code. It swaps DAI for USDC
contract TestUniswap {
    address constant private usdc = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
    address constant private dai = address(0x6B175474E89094C44Da98b954EedeAC495271d0F);

    address constant private uniswap = address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
    address constant private weth = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);

    function swap() external {
        uint daiBal = IERC20(dai).balanceOf(address(this));
        IERC20(dai).approve(uniswap, daiBal);

        address[] memory path = new address[](3);
        path[0] = dai;
        path[1] = weth;
        path[2] = usdc;

        Uni(uniswap).swapExactTokensForTokens(
            daiBal, uint(0), path, address(this), now + 1800
        );
    }
}

Here is the test
def test_uniswap(accounts, testUniswap, dai, stable_coin_holder):
    dai_amount = 10 * 10 ** 18

    # check dai balance
    stable_coin_holder_bal = dai.balanceOf(stable_coin_holder)
    assert stable_coin_holder_bal >= dai_amount

    # transfer DAI to testUniswap
    dai.transfer(testUniswap, dai_amount, {'from': stable_coin_holder})
    assert dai.balanceOf(testUniswap) == dai_amount

    testUniswap.swap()
    testUniswap.swap()


texts: Truffle test not working when I add migration.js

texts:
I have written javascript tests that run fine with truffle test ./test/Token.js

However, when I have the following:

var UTO = artifacts.require("./uto.sol");

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

Then I get the following error:

  UTO contract constructor expected 6 arguments, received 0

The error itself is fine, it needs arguments. However, I am wondering why this is happening, because my test script sets these arguments:

before(async function() {

      // deploy contract with parameters for testing
      contract = await C.new(company, _token_eth, _name, _symbol, _decimals, _percentToHold);
  });

I can comment out the deployer and everything works fine.. so why is the truffle command triggering the deploy outside of the test script?

Thanks


texts: Is there a step by step tutorial on how to use EtherDelta exchange?

texts: Totally new to using the etherdelta exchange. Is there a well written up step by step tutorial on how to use etherdelta exchange to make a trade?


texts: Why are these high fee transactions not being mined?

texts:
Looking at the state of pending transactions on Etherscan I noticed two transactions that have a gas price much higher than that of the average network fee, yet they are not being mined.
The transaction belong to the following Account

At the time of writing, the asking gas price  is ~40GWei, these two transactions offer 220GWei and 550Gwei respectively. Yet they are pending for about an hour.

Is there a reason for a miner not to include these transactions? The address seems quite "fresh" so censorship does not make sense. Is this a bug of Etherscan?
It is also strange that both transactions have the same nonce (1)


texts: Why does mining stop when a lot of transactions come in to my geth?

texts:
For testing, I'm running a private chain on my laptop. I've loaded a contract and I'm simulating a heavy load on my geth instance by submitting 500 transactions. All the transactions are submitted over ~15 mins or so but while the transactions are coming in mining grinds to a halt and no new blocks are created. It doesn't seem to matter if I'm using miner.start(1) in the geth javascript console or ethminer -C -t 1 to start ethminer in a different process.

All the transactions are happening under the same address so it's not like the miner has a hard decision when it comes to picking what transactions go in the next block. It just has to handle the nonces in order. Eventually mining picks back up again but that can take 20 mins before it happens.

If it matters, I start geth v1.7.1 with the following flags:

geth --networkid 3141 --rpc --rpcapi "db,eth,net,web3,miner" --rpcport "8545" --rpccorsdomain "*" --datadir "~/eth/data" --port "30303" --nat "any" --identity "MyNode-1" --rpcaddr "0.0.0.0" --gasprice 0

geth doesn't print out any errors. Why does mining stop while a large number of transactions are being received?