texts:
I have a contract that I am trying to deploy using Web3PY that is failing with:
VM Exception while processing transaction: out of gas.
It deploys with no errors when using Web3 on node.

I am running the blockchain on Ganache.

Can someone help me understand what I am doing wrong?

Here is my contract:

pragma solidity ^0.6.4;
// We have to specify what version of compiler this code will compile with

contract Voting {
  /* mapping field below is equivalent to an associative array or hash.
  The key of the mapping is candidate name stored as type bytes32 and value is
  an unsigned integer to store the vote count
  */

  mapping (bytes32 => uint256) public votesReceived;

  /* Solidity doesn't let you pass in an array of strings in the constructor (yet).
  We will use an array of bytes32 instead to store the list of candidates
  */

  bytes32[] public candidateList;

  /* This is the constructor which will be called once when you
  deploy the contract to the blockchain. When we deploy the contract,
  we will pass an array of candidates who will be contesting in the election
  */
  constructor(bytes32[] memory candidateNames) public {
    candidateList = candidateNames;
  }

  // This function returns the total votes a candidate has received so far
  function totalVotesFor(bytes32 candidate) view public returns (uint256) {
    require(validCandidate(candidate));
    return votesReceived[candidate];
  }

  // This function increments the vote count for the specified candidate. This
  // is equivalent to casting a vote
  function voteForCandidate(bytes32 candidate) public {
    require(validCandidate(candidate));
    votesReceived[candidate] += 1;
  }

  function validCandidate(bytes32 candidate) view public returns (bool) {
    for(uint i = 0; i < candidateList.length; i++) {
      if (candidateList[i] == candidate) {
        return true;
      }
    }
    return false;
  }
}

Here is my python web3 script:

import json

# web3 is needed to interact with eth contracts
from web3 import Web3, HTTPProvider

VOTING_CANDIDATES = [b'Rama', b'Nick', b'Jose']

# open a connection to the local ethereum node
http_provider = HTTPProvider('http://localhost:7545')
eth_provider = Web3(http_provider).eth

default_account = eth_provider.accounts[0]
transaction_details = {
    'from': default_account,
    'gas':150000,
    'gasPrice': Web3.toWei('0.00003', 'ether')
}

contract_bytecode = open('output/Voting.bin','rb')
contract_bytecode = contract_bytecode.readlines()[0]
contract_abi =open('output/Voting.abi','r')
contract_abi = contract_abi.readlines()[0]

contract_factory = eth_provider.contract(
    abi=contract_abi,
    bytecode=contract_bytecode,
)

contract_constructor = contract_factory.constructor(VOTING_CANDIDATES)

balance = eth_provider.getBalance(default_account)
print(balance)
#FAILS HERE
transaction_hash = contract_constructor.transact(transaction_details)

# transaction_receipt = eth_provider.getTransactionReceipt(transaction_hash)
contract_address = transaction_receipt['contractAddress']

failing message:

  ValueError: {'message': 'VM Exception while processing transaction: out of gas', 'code': -32000, 'data': {'0x4afc82be02e9d6958a34676d95c40739744ab2ad492e9158031a597be1af9da9': {'error': 'out of gas', 'program_counter': 24, 'return': '0x'}, 'stack': 'RuntimeError: VM Exception while processing transaction: out of gas\n    at Function.RuntimeError.fromResults (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)\n    at BlockchainDouble.processBlock (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/blockchain_double.js:632:24)\n    at runMicrotasks ()\n    at processTicksAndRejections (internal/process/task_queues.js:93:5)', 'name': 'RuntimeError'}}


texts: Geth - synced block header number is higher than actual number of blocks

texts:
I'm trying to sync my geth node with geth --networkid=4 --fast --cache=512 --datadir="/Users/myname/Library/Ethereum/rinkeby/", which appears to be working. However, my node is apparently syncing way past the number of actual blocks on rinkeby, which leads me to believe I'm not on the right network. My last line of output is

count=2048 elapsed=561.414ms number=1578304 hash=1ff9ed…3df3b8 ignored=0,

but rinkeby only has about 1150000 on the chain right now. I haven't seen in the docs where anything else needs to be configured and I've started with a fresh chaindata directory.

EDIT:
Console outputs:

> eth.blockNumber
0

> eth.syncing
{
  currentBlock: 1272698,
  highestBlock: 1935572,
  knownStates: 2246772,
  pulledStates: 2244979,
  startingBlock: 0
}


texts: Parity mining on --chain dev for truffle migrate

texts:
I am using Parity to create a custom app and so I am using it locally on --dev.  "$ truffle migrate" fails, I think because there is no balance in the account.  It says:

Error: Insufficient funds. The account you tried to send transaction from does not
have enough funds. Required 471238800000000000 and got: 0.

But using --dev, this shouldn't be a problem, right?  The transactions should work without being mined first?  Or something like that?

I tried running genoil but (a) I don't think I need to on --dev and (b) it won't run on a VPS with no GPU anyway.

I tried attaching to Parity with geth attach and it connects (because eth.coinbase returns the correct address) but that user has 0 balance.  Also, miner.start() says:

ReferenceError: 'miner' is not defined
    at :1:1

I am invoking parity with:

$ /path/to/parity --geth --chain dev --dapps-hosts="all" --dapps-apis-all --jsonrpc-hosts="all" --unlock 0x... --password DevUserPass.txt --author ...

I have tried the "--author" flag with 0x as well, with the same result.

So I have a few related questions:

1 - What is your understanding of how the --chain dev option means you do NOT have to mine with parity?  The docs aren't really clear.

2 - If I do need to mine (like I use another testnet), how can I do that on a VPS?

3 - Is it possible that truffle needs to be told to use the --chain dev mining technique?  Like, it behaves different from a normal balance so has to be stated somewhere?


texts: How to auto-execute smart contract's function by Aion or other method in the private chain?

texts:
I was a little bit confused about Aion scheduling system, because I want to do it on the private chain, in the example https://github.com/ETH-Pantheon/Aion, they have both smart contract Aion and MyContract, for this line of code [aion = Aion(0xFcFB45679539667f7ed55FA59A15c8Cad73d9a4E);], they have already deployed Aion in MainNet or Ropsten network. In my case, how do I deploy Aion in my private chain, then I can get the address to complete this line of code[aion = Aion(address);], or if my concept is incorrect please correct me thanks.
Or there are better solution to auto-execute smart contract's function in the private chain please tell me, because I know it can use node schedule to do it, but I didn't find any example about that, if there are any example, please tell me thanks.


texts: Solidity: uint parameter not being set properly

texts:
Testing my contract locally with truffle. I have a function with the signature:

function purchase(address buyer, address seller, bytes16 bookId, uint tokens) public onlyOwner returns(bool success)

In truffle console I call this function as:

  BookStore.deployed().then(function(instance){return instance.purchase(
'0xab67c3985384f5f4dc2fa828662f1f0601f81e62', //buyer
'0xd74ea687cc995cbbc1af6cf81106b31e32b4aa4f', //seller
[108, 120, 118, 13, 168, 153, 70, 225, 139, 168, 108, 184, 185, 58, 173, 17], //id
 5) //tokens
;}).then(function(result){return result;});

When I debug the transaction I see that tokens has the value 2.316897056402557e+76! But I'm passing 5.. what is happening?


texts: How does the process of executing code and consensus not yield thousands of the same transaction?

texts:
If execution is performed by every node on the network, how do you not end up with thousands of transactions transferring money (say a wager contract) multiple times?  How does the network go from ALL running the code to only having it execute once?

Looking to understand the concept and not the detailed technicals at this point.


texts: Recursive struct triggers Uncaught JavaScript exception in browser-solidity

texts:
I am trying to implement a recursive data structure. The following code does not compile in browser-solidity:

pragma solidity ^0.4.4;
contract TestContract {
    struct Item {
        uint someUint;
        Item[] internalItems;
    }
    Item[] items;
    function TestContract() {}
    function test() {
        Item memory item;
        items.push(item);
    }
}

I realize that recursion is discouraged in blockchain environments, but in this particular case the item is essentially empty, thus I did not expect any infinite recursion to occur. I am getting different errors in Chromium and Firefox (both in Ubuntu 16.04).

Chromium 53.0.2785.143 says:

Uncaught JavaScript exception:
RangeError: Maximum call stack size exceeded

(and sometimes it even loads a CPU core to 100% and freezes)

Firefox 49.0.2 says:

Uncaught JavaScript exception:
InternalError: too much recursion

A have two questions:

Does browser-solidity fully implement the Solidity compiler spec? If so, how can the error message depend on which browser I am using? If not, what is the reference compiler implementation?
Is there a way to implement recursive data structures in Solidity? Something like a tree, a linked list, etc.


texts: Validating a contract before sending ethers to it

texts:
This is a partially philosophical question, by an Ethereum newbie.

When calling a contract, you send ethers to it. Before that, you checked of course that the contract does something interesting/useful for you and is worth of your cryptomoney. You typically do so on the basis of the written documentation of the contract.

But the author of the contract may deceive you, or may simply be wrong. If you're serious and knowledgeable, you check the source code of the contract. (And, if it not available, you simply never send your ethers to it.) Not only it is difficult, but it is not a proof that the compiled contract in the blockchain matches the source code you got.

It seems to me that there are only three solutions, none very satisfying:

Compiling the source code yourself and see if it matches the binary. If it does, OK, if it doesn't, it may simply means you do not have the same version of the compiler... (If you do not have a compiler locally, you can use  https://etherscan.io/verifyContract )
Checking the binary, using techniques similar to what the reversers are doing when they analyze malware. Obviously very complicated.
Running the contract in a local blockchain and test it as a "black box". Does not require you to understand the source code. But testing all the cases is difficult.

Is there a better solution? It seems to me that, without a safe and simple way to check contracts, it will be difficult to convince people to send money.


texts: Remix: Gas required exceeds allowance or always failing transaction

texts:
I have a contract which has transferFrom function

    mapping(address => uint) balances;

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

    mapping (address => bool) public frozenAccount;

   // Transfer token from spender account to receiver account
    function transferFrom(address from, address to, uint tokens) public returns (bool success) {
        require(!transactionLock);         // Check for transaction lock
        require(!frozenAccount[from]);     // Check if sender is frozen
        require(!frozenAccount[to]);       // Check if recipient is frozen
        balances[from] = balances[from].sub(tokens);
        allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
        balances[to] = balances[to].add(tokens);
        emit Transfer(from, to, tokens);
        return true;
    }

When i execute this function i am getting error :

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

  gas required exceeds allowance or always failing transaction

I have read many answers in StackOverflow . No solution work for me


texts: Why doesn't the ENS public resolver support IP address resolution?

texts:
I wondered if there are any well-considered reasons behind the decision to not support a standardized record for IP addresses (e.g. A/AAAA records by IETF) through the public resolver and the offical dApp, even though mentioned in the orignal EIP 137.

Suspicion: Is it because of a vision for the web3 where resources are usually accessed by their hash?


texts: Transferring tokens from account using web3

texts:
I created a contract token using the sample solidity code tutorial. It has a function called transfer to send tokens between accounts:

function transfer(address _to, uint256 _value)

I need to now connect to this contract using web3, and then send a certain number of tokens generated to another account. I've been struggling with how to do this for quite some time and hoping this community could help. Here is what I have thus far...

const Web3 = require("web3");
const web3 = new Web3();
web3.setProvider(new
web3.providers.HttpProvider("https://ropsten.infura.io"));
var abi = [ {} ]

var account = web3.eth.accounts.privateKeyToAccount("0x12312312312323132312")

var contract = new web3.eth.Contract(abi).at("0x282828288282828282")
contract.transferFrom('0xa121111211', '0xabbb2b2bb2', 100);

I know I am missing some piece of this. I am relatively new to solidity & web3 so apologies in advance for my ignorance regarding this matter. Any help would be greatly appreciated!


texts: how I want use a new contract sending a deployed ERC20 token from one to another

texts:
A address send eth to my contract And I will pay A another token

tha's my function code ,but do not work.Where am I wrong ?

pragma solidity ^0.4.16;
contract ICOProxy  {
address tokenaddr;
function () payable public{
 uint256 amount = msg.value* 10 ;
    address se=msg.sender;
    bytes4 methodId  =bytes4(keccak256("transferFrom(address,address,uint256)"));
    tokenaddr.call(methodId,owner,se, amount);
}
}


texts:
My answer would be: On-chain smart contracts -- A set of rules as a transaction committed to the blockchain and then called by subsequent transactions. With on-chain smart contracts, the code that defines the set of rules becomes part of the ledger.

Doubts: I have an idea about committing transactions to the blockchain. But i need to know more about the calling a subsequent transactions. What does on chain smart contract do an how does it work in blockchain?

Please anyone explain me!


texts: How I can check request status with provable.xyz?

texts:
Simple question but I failed to find the answer.
Before Oraclize became provable, there was an api endpoint for checking the status of a specific request id. This for example helped to determine if an empty callback made by Oraclize was the result of a parsing error or a connection problem by using something like https://api.oraclize.it/v1/query/eth_mainnet_684c58f66467b51e48a9559ee5becf6bd03ef2bc0028ee0fe584bd041a6a3641/status?_pretty=1.
Which of course no longer works. What happened to the http api? I m meaning, what’s the new endpoint?


texts: How can I store big files on the blockchain?

texts:
I can hardly create transactions larger than 100kiB. I am wondering, is it possible to store huge files (several MiB or GiB) on the blockchain?

If so, how?


texts: Zero Trust vs Zero Knowledge -- Difference

texts: What is the difference between Zero Trust and Zero Knowledge?


texts: Error in Declaring a Sized Array: Generating no gas Exception

texts:
I have created a fixed size array:

pragma solidity ^0.5.1;
contract Underflow1 {
    uint8 arr[256];
    uint8 i= 0;
    function testf2() public returns (uint8){
      for(i=0; i<arr.length; ++i);
      if(i==256)
        return true;
      else
        return false;
    }
}

I am getting following compilation error while running my code on remix ide:

  browser/UF8Var.sol:3:13: ParserError: Expected ';' but got '[' uint
  arr[256]; ^

I want to see that the code generates the gas error. Because at i==256, overflow would occur so it would start again and ultimately I would get a no-gas exception


texts:
I am designing a protocol where a user A sends a time-locked deposit to user that if the user B within time t provide a proof that he exists in a location x (this may be obtained by third party like Google), user B can get the deposit of A. Otherwise, A can get his money back.
Any help of how to do that using cryptography or two-way secure computations?


texts:
Imagine I create a new account on lets say KuCoin. I create a ether/erc20 address and I send an amount in ERC20 tokens to that address.

KuCoin then sends that to their mainwallet. How do they do that if there is no ETH on that address.

Thanks!


texts: Transaction "Failed", but it says "Although one or more errors occured [Out of gas] contract execution completed"

texts:
I sent ETH with MetaMask and it seems that the transaction ran out of gas. However, the ETH is gone. They don't show up in my wallet anymore. The receiving party says, that they did not get it either.

Can anyone help me finding out, where the ETH is?

https://etherscan.io/tx/0x02280316497855dd69c8e0713e6bff61cf43d906431efb5364346058424adfc5

Thanks a lot!


texts:
I'm trying to build a parser for Solidity, and it would help if I could build a working version off of the existing parser. I've tried looking at the source code on the official git, but I haven't worked on a project of this magnitude before and it's confusing. Could some one tell me how I could isolate the parsing and AST modules so I can read a script and build an AST from it?
(I understand the scope might be a little too broad for this question, but I'd really appreciate any pointers)


texts: Is it possible to avoid sync in Ethereumj, but still register a listener?

texts:
I'm attempting to create an contract analysis application using Ethereumj. I don't need to participate as an Ethereum node on the network and thus I'm trying to avoid having to sync the entire blockchain history. I'm curious if it is possible to register a listener in a purely passive mode.

I tried the following with no success:

SystemProperties.getDefault().setSyncEnabled(false);

val ethereum = EthereumFactory.createEthereum();
ethereum.addListener(new EthereumListenerAdapter() {
    @Override
    public void onTransactionExecuted(TransactionExecutionSummary summary) {
        log.info("Summary: {}", summary);
        super.onTransactionExecuted(summary);
    }
});

However, no callback is triggered.


texts: Snapshot syncing proceeds but block number is still zero

texts:
I use OpenEthereum(v3.0.0) on warp sync.
OS is ubuntu server 20.04.
But its snapshot syncing is proceeding but block number is still zero(#0).
Please see the following image.

Is this proper condition?
Or do it need to resync from scratch?
I would like to any information about above problem.


texts: Unable to retrieve value from Web3j sendFunds Future

texts:
I have been trying to send funds from one ethereum account to another using web3j to test that it works on Android. I am using an Infura cloud instance.

First, it appears I need to send it async because Android requires that you do so. In the code down below I have tried to do so - but it fails on the last step, when I try to get from the Future. If I do not try to get the value then there is no exception, but I obviously cannot do anything with the value that I want to do.

        final String FROM_ADDRESS = "0x6861B070f43842FC16eAD07854eE5D91B9D27C13";
    final String TO_ADDRESS = "0x31B98D14007bDEe637298086988A0bBd31184523";

    //Credentials credentials = obtainCredentials(WALLET_DIRECTORY);

    Callable<TransactionReceipt> task = new Callable<TransactionReceipt>() {
        @Override
        public TransactionReceipt call() throws Exception {
            Web3j web3 = Web3jFactory.build(
                    new HttpService("https://rinkeby.infura.io/SxLC8uFzMPfzwnlXHqx9")
            );
            Log.d(TAG, web3.ethGasPrice().getJsonrpc());

            ClientTransactionManager clientTransactionManager =
                    new ClientTransactionManager(web3, FROM_ADDRESS);
            Log.d(TAG, clientTransactionManager.getFromAddress());

            org.web3j.tx.Transfer tran = new org.web3j.tx.Transfer(web3, clientTransactionManager);
            Log.d(TAG, String.valueOf(tran.getSyncThreshold()));

            RemoteCall<TransactionReceipt> rc = tran.sendFunds(
                    TO_ADDRESS,
                    BigDecimal.valueOf(1.0),
                    Convert.Unit.ETHER
            );
            Log.d(TAG, String.valueOf(rc.toString()));
            return rc.send();
        }
    };
    Future<TransactionReceipt> future = Async.run(task);
    return future.get();

It comes with this exception:

11-19 12:49:03.418 32442-32442/com.example.graeme.beamitup W/System.err: java.util.concurrent.ExecutionException: org.web3j.protocol.exceptions.ClientConnectionException: Invalid response received: okhttp3.internal.http.RealResponseBody@3c286ab
11-19 12:49:03.418 32442-32442/com.example.graeme.beamitup W/System.err:     at java.util.concurrent.FutureTask.report(FutureTask.java:94)
11-19 12:49:03.419 32442-32442/com.example.graeme.beamitup W/System.err:     at java.util.concurrent.FutureTask.get(FutureTask.java:164)
11-19 12:49:03.419 32442-32442/com.example.graeme.beamitup W/System.err:     at com.example.graeme.beamitup.Transfer.sendTransfer(Transfer.java:183)
11-19 12:49:03.419 32442-32442/com.example.graeme.beamitup W/System.err:     at com.example.graeme.beamitup.MainActivity.onCreate(MainActivity.java:26)
11-19 12:49:03.419 32442-32442/com.example.graeme.beamitup W/System.err:     at android.app.Activity.performCreate(Activity.java:6272)

It points out an invalid response from the HTTP transfer - but shouldn't this be happening even without trying the Future.get? The code executes either way, correct? What have I done wrong to create this error?


texts:
Is it possible the call a method of a smart contract every 5 seconds? Lets say i want to call a webservice or an other smart contract in order to get the actual value?

That is not possible or? In this case on every node in the world this piece of code will run every 5 seconds  - with this mehtod i could crash every node or?


texts: How does Smart-contract's storage works?

texts: I keep hearing that for each contract there is a storage as contiguous array (to have constant O(1) lookup) with 2^256 slots, 32 byte each, available. But it cannot physically be true. How is it really implemented in practice? Thanks.


texts: Why does ip address value differ in the enode url from the info output of a geth node instance to running admin.nodeInfo.enode in the js console?

texts:
I'm in the process of creating a private Ethereum network.  I am able to successfully connect nodes on my local machine but unable to connect nodes in my LAN or outside my network.
When I run a geth node for example
geth --datadir data/node-1 --networkid 8572054696  --rpc --rpcaddr "0.0.0.0" --rpccorsdomain "*"  --port 30303 --rpcapi admin,debug,eth,miner,net,personal,txpool,web3 --ipcdisable --nodiscover --allow-insecure-unlock

One of the output fields will be
INFO [09-03|12:18:47.132] Started P2P networking                   self="enode://294ea3783e96cb2b17de38fb1d574dab85246b63a949bcc5fc291d7b4df2a4a16b1f55fd4e14656e8bb337116c43e86a8e71db4d36b7856106f205ea342cf90b@127.0.0.1:30301?discport=0"

Notice the ip address is my localhost 127.0.0.1
However when I attach a geth node instance in a difference command tab and run
admin.nodeInfo.enode

I get the same node url with my public ip address
enode://294ea3783e96cb2b17de38fb1d574dab85246b63a949bcc5fc291d7b4df2a4a16b1f55fd4e14656e8bb337116c43e86a8e71db4d36b7856106f205ea342cf90b@{publiIP}:30301?discport=0

When I run a different node on the same machine and then open up a geth instance and run
admin.addPeer("enode://294ea3783e96cb2b17de38fb1d574dab85246b63a949bcc5fc291d7b4df2a4a16b1f55fd4e14656e8bb337116c43e86a8e71db4d36b7856106f205ea342cf90b@127.0.0.1:30301?discport=0")

It successfully adds the peer when using the localhost ip not my public ip and now I have a peer count of 2
Why are the ip addresses different?  How can I successfully add peers within my local home network and also outside my home network.
If I try adding a peer on another machine inside my network with same genesis file it returns true but actually doesn't add the peer.
Are there any good resources out there that explain how to configure your router or network settings so other nodes can join your network using addPeer()?
I've seen plenty of tutorials on how to create a private network using your localhost/same machine but nothing with comprehensive information setting up a network using only geth and having it publicly available.  Again any info is appreciated.


texts: HardHat deploy script works on testnet but not on forked hardhat network

texts:
The error that I am getting when running this is:
Error: Invalid RpcBlockWithTransactions or null

I have a contract called PriceConsumerV3 and it makes a view function call on a contract. I am attempting to use hardhats forking functionality, but whenever I run this script from the forked version, (or even just the regular hardhat runtime environment) I get the error above.
However, when I use the kovan network as defined in my hardhat.config.js which uses an RPC_URL the script deploys and works fine.
async function main() {
    const PriceConsumerV3 = await ethers.getContractFactory("PriceConsumerV3")
    const priceConsumerV3 = await PriceConsumerV3.deploy()
    await priceConsumerV3.deployed()
    console.log("priceConsumerV3 deployed to: ", priceConsumerV3.address)
    ethPrice = await priceConsumerV3.getLatestPrice()
    console.log("Price data for ETH: ", ethPrice.toString())
}

Any thoughts?


texts: The "from" field has been defined when sending a transaction, but the error still occurs

texts:
Problem
I am following this tutorial on how to make a donate button on my React app. The tutorial is in HTML, however, so below is my attempt at converting it to ReactJS.
Code
App.jsx
donate = () => {
  const donationAddress = "0x...";

  web3.eth.sendTransaction({
    to: donationAddress,
    value: web3.utils.toWei("1", "ether")
  }, (err, transactionId) => {
    if (err) {
      console.log("Donation failed", err);
      alert("Donation failed.");
    } else {
      console.log("Donation successful", transactionId);
      alert("Donation successful!");
    }
  })
}

render() {
  return (

Donate

      <button onClick={this.donate}>Donate 1 wei</button>

  );
}

I commented out the two lines of code above from the tutorial because I had received this error: TypeError: web3__WEBPACK_IMPORTED_MODULE_3__.default.toWei is not a function.
Output
Initially, I don't receive an error on the page until I click the button. Then I receive this error: The send transactions "from" field must be defined!.
It highlights this line as the error: web3.eth.sendTransaction({.
How do I fix this? Thank you!


texts:
I would like to know that I have a PC with 6 graphic cards installed, but while mining ethereum, there is only 1 worker online.
So basically I would like to know that can I have more than 1 worker on the same PC?
Thanks for your attention !


texts: Data that can be accessed only when a payable function is executed

texts:
I have a contract that includes post(string memory title, data content) that will store the data to IPFS, returns an IPFS hash and a postId. postId and hash will be linked by a mapping.
reveal(uint256 postId) that is payable and returns the hash associated to the postId.
My question is: can you keep the postId to hash mapping private so that it is known only by addresses that used the reveal() function? I think this is not possible using ethereum only so then what tools do I need to use?
And it is probably not a good idea to send the data of the posts via the eth blockchain (it can be text, images, videos...) How do I send it to IPFS without going through ethereum but somehow record that this specific data has been uploaded?


texts: Is Mining with hashrate 100 KH/s on my computer same as 100 KH/s on cloud mining?

texts:
I'm new to mining. I just started yesterday with a software: MinerGate. It shows that my computer is mining at about 100 KH/s. Contrary to the other guy Does my mining situation sound normal? I can mine. So my question is rather about if my mining result can compare to the cloud mining below which offers same KH as me.

After about half a day it only mines 0.001 Ether.

This is very low: is it normal ?

I saw cloud mining offer of 100KH for 3.5$ does it mean this cloud mining will give me about the same low mining return?


texts: Can sending msg.value to owner be dangerous?

texts:
I have an erc721 token with a payable function added to it. It just needs to mint the token and then owner.transfer(msg.value).
Assuming owner is my own address which I used to deploy the contract.


texts: Geth bug when working with address arrays?

texts:
I have the following contract that handles address arrays:

contract C {

    address[] goodAddr;
    address[] badAddr;

    function initAddr() constant {

        if(goodAddr.length == 0) {
            goodAddr.push(0x029ddf2082bc96d321c9769ec8e27e10b3cb16ee);
        }

        if(badAddr.length == 0) {
            badAddr.push(0x115744603fedb255e5ab4765cc1dc6c832639fd5);
        }

        if(goodAddr.length == 1 && badAddr.length == 1) {
            return;
        }

        for(uint256 i = 0; i < goodAddr.length; i++) {
            if(goodAddr[i] == 0x029ddf2082bc96d321c9769ec8e27e10b3cb16ee)
                return;
        }

        for(i = 0; i < badAddr.length; i++) {
            if(badAddr[i] == 0x115744603fedb255e5ab4765cc1dc6c832639fd5)
                return;
        }

        goodAddr.push(0x029ddf2082bc96d321c9769ec8e27e10b3cb16ee);
        badAddr.push(0x115744603fedb255e5ab4765cc1dc6c832639fd5);
    }

    function getGoodAddr(uint256 i) constant returns (address) {
        if(i < 0 || i >= goodAddr.length) {
            return 0x0000000000000000000000000000000000000000;
        } else {
            return goodAddr[i];
        }
    }

    function getBadAddr(uint256 i) constant returns (address) {
        if(i < 0 || i >= badAddr.length) {
            return 0x0000000000000000000000000000000000000000;
        } else {
            return badAddr[i];
        }
    }
}

The code runs fine on browser solidity but fails to initialize the address arrays when run locally (on a private test net):

    > eth.accounts
["0x029ddf2082bc96d321c9769ec8e27e10b3cb16ee", "0x115744603fedb255e5ab4765cc1dc6c832639fd5"]
    > checkAllBalances();
  eth.accounts[0]: 0x029ddf2082bc96d321c9769ec8e27e10b3cb16ee   balance: 55922.95 ether
  eth.accounts[1]: 0x115744603fedb255e5ab4765cc1dc6c832639fd5   balance: 1337 ether
undefined
    > var c = cContract.new(
    ..    {
    ......      from: web3.eth.accounts[0],
    ...... {0600101610568565b5090565b5b5050509190906000526020600020900160005b73115744603fedb255e5ab4765cc1dc6c832639fd5909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff02191690830217905550505b5056',
    ......      gas: 4700000
    ......    }, function (e, contract){
    ......     console.log(e, contract);
    ......     if (typeof contract.address !== 'undefined') {
    ..........          console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
    ..........     }
    ......  });
    Unlock account 029ddf2082bc96d321c9769ec8e27e10b3cb16ee
    Passphrase:
    null [object Object]
    undefined
    > null [object Object]
    Contract mined! address: 0xb43c8d6c6ee366358f170553602f2a0fc8ebe1d6 transactionHash: 0x8741c2ccae448a1cc647bdc03883e9136dadcec7adf942832f46bdcbe02e2eae

    > c
    {
      address: "0xb43c8d6c6ee366358f170553602f2a0fc8ebe1d6",
      transactionHash: "0x8741c2ccae448a1cc647bdc03883e9136dadcec7adf942832f46bdcbe02e2eae",
      allEvents: function(),
      getBadAddr: function(),
      getGoodAddr: function(),
      initAddr: function()
    }
    > c.initAddr.call();
    []
    > c.getBadAddr(0);
    "0x0000000000000000000000000000000000000000"
    > c.getGoodAddr(0);
    "0x0000000000000000000000000000000000000000"
    >

Is this a bug in geth? I'm using version 1.3.5.

I've updated to version 1.4 but now all command line arguments are not valid. When I run the following instance:

 geth --datadir "./datadir" --networkid 13 --rpcapi eth,web3,personal --rpc --maxpeers 0 init "gen.json" --etherbase "0x0000000000000000000000000000000000000000" --mine --minerthreads 2

I get the error:

Incorrect Usage.

init [arguments...]

The init command initialises a new genesis block and definition for the network.
This is a destructive action and changes the network in which you will be
participating.

flag provided but not defined: -etherbase

Edit:

Any particular reason for the downvote?


texts: Are these numbers right? + 3rd card doesn't mine

texts:
I have been using Nicehash to mine for a few months until they were hacked(ran off with the cash)

Now I have moved to ethminer.exe. I have a couple of questions tho:

1st I am getting 7.6mh/s out of 4 1080ti? That seems low to me with nicehash they were getting 2500sol/s.

2nd My third card is not doing anything. the numbers from the software are as follows:
gpu/0 2.20 gpu/1 2.27 gpu/2 0.87 gpu/3 2.19

The third gpu is sitting at idle while the orhter three are pegged at 2100mhz according to MSI afrterburner. How do I remedy this??

Thanks

PS. I know 1080tis arent the most logical choice for mining , I just happened to get aweseome deals om them (300$ a pop)


texts: Is there a solidity library to create msgHash?

texts: Messages are hashed with a “\x19Ethereum Signed Message” for some reason. I'm writing a smart contract that authenticates a message to a signature, and it needs to be able to generate msgHash to do that. Is there a library for that?


texts:
I'm new in solidity programming so for learning purpose I'm developing e-voting system using ethereum blockchain. Code mentioned below,

pragma solidity 0.4.25;

contract RegisterCandidate {
    // Address Structure
    struct Address {
        string addressLine;
        string district;
        string state;
        uint pincode;
    }

    // Candidate Structure
    struct Candidate {
        uint id;
        string name;
        Address addr;
        uint voteCount;
        uint age;
    }
    // Candidate mapping with candidate id
    mapping(uint => Candidate) public candidates;
    mapping(uint => Address) public addresses;
    // Store Candidates Count
    uint public candidatesCount;

    function addCandidate (string _name,uint _age,string _address,string _district,string _state,uint _pincode) public {
        candidatesCount ++;
        addresses[candidatesCount] = Address(_address,_district,_state,_pincode);
        candidates[candidatesCount] = Candidate(candidatesCount, _name,addresses[candidatesCount], 0, _age);
    }

}

I'm adding a candidate by using these commands,

RegisterCandidate.deployed().then(function(instance){app = instance})
app.addCandidate("Name",22,"Street","District","State",123456)

and to read the candidate,

app.candidates(1)

but whenever I try to read the candidate it is showing "Overflow" error.  As here solidity provides build in geter function for public data members I'am unable to fetch the data.

On other hand I'm able to read address struct from addresses mapping

please help me to solve this issue


texts: Unit testing with chai-as-promised: how to test for two possible errors with rejectedWith()?

texts:
I am new to asking questions here and I am sorry if my question is not correctly asked!

I am currently testing some smart contracts with truffle and have some problems with testing for exceptions. At the beginning I have used only mocha and chai, but I found chai-as-promised and I thought the tests are going to be more readable after extending them with chai-as-promised.
In my case I have implemented the method:

function testForThrow(error) {   return error.toString().indexOf("out of gas") != -1 || error.toString().indexOf("invalid opcode") != -1; }

because the possible error messages are two – “out of gas” or “invalid opcode”. And one test look like this:

}).catch(function(error) {
      assert(testForThrow(error), "expecting throw");
});

So my problem: chai- as-promised provides the function rejectedWith() but with this function we can test only one possible output, and I can’t come up with solution, because there is no OR in mocha and chai..

Current state of the test declaration with chai-as-promised:

.should.be.rejectedWith("invalid opcode");

Have someone idea how can I do this or the first version is the only possible way?


texts:
I have a Geth server on light mode, and implemented sending transactions based on web3.php project. Everything works well, except sending transactions.
The code I am using sends from, to, and value and other options like nonce, gas, and gasPrice left as their defaults and are not set. Transaction happens and I receive the TX hash, but when I explore it, there is not anything about it on the Ethereum blockchain.
This is an example:

https://etherscan.io/tx/0x46d52b2d8dea9cf2a98095324905bef8db7cd6556776d1d8a04c53a9a39c59b0

And this is the output in etherscan:

On the other hand, nothing happened on the sender address whereas I have received TX hash!

I'm sure that the sender address has enough fund to send and provide gas price.  I'm really confused and cannot know what is the problem.


texts: Where can I find the specific contract implementation for the part __unstable__ERC20Owned?

texts:
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/90ed1af972299070f51bf4665a85da56ac4d355e/contracts/GSN/GSNRecipientERC20Fee.sol
Where can I find the specific contract implementation for the part _unstable__ERC20Owned where "" " token = new __unstable__ERC20Owned (name, symbol);" "" in the above url?
There should be a file defined as a type because it is used for "using".
If this (__unstable__ERC20Owned) is not a contract, where can I find its concrete implementation?
Or there is no concrete implementation Is it?


texts:
I created the new 2 accounts with web3 like this. web3.eth.personal.newAccount(password)

When I send a ether to other address, I need to unlock first.

But other exchange sites like Binance doesn't request the password for withdraw. How can I understand it?


texts: Infura-Like caching layer to store all Events in local nodes for fast retrieve

texts:
Anyone who has tried to use a local Ethereum node to run any complex DApp will have realized that it is impossible to do so because there is a huge problem of slowness in the retrievement of large amounts of Event data via the eth_getLogs call. It was therefore natural for everyone to think that Infura, which does not suffer from this problem, has implemented an ad-hoc solution to solve it brilliantly, and in fact, a few minutes ago I came across one of their blog posts that talks about this.
https://blog.infura.io/faster-logs-and-events-e43e2fa13773/
They write "We hope to share more details about the implementation of this caching layer in a later post", but everything on the net about Ferryman, the codename of their call routing layer and load, is really poor and is even at least two years earlier than the article itself (which is still from April 2019).
I've read that there are alternative caching solutions like the ones found here
Local caching database for fast retrieval
and here
https://medium.com/coinmonks/caching-ethereum-events-with-mysql-18bfa3558355
but they are extremely specific and above all involve the use of custom APIs compared to the classic eth_getLogs used by all present and future DApps.
So I was wondering if there was already an open-source layer that you can install in front of/next to your local node for the caching of Events and for wrapping called eth_getLogs of the real node which implements all the search specifications and can therefore help to obtain even locally, the same performance as the centralized services.
Or, what would be the steps to make one that works this way?
I firmly believe that the road to mass-adoption of true decentralization passes through this detail that seems insignificant, but which in reality is vital.


texts:
I've been looking for a way to hook up Angular with Truffle for a demo dApp I'm thinking of building but I'm unsure as to how to setup the development environment that would allow me to work with both frameworks.

Would really appreciate if someone could help me set it up. Cheers!

Edit:

I'd like to bring to everyone's attention that there's now an official TruffleBox for Angular integration:
http://truffleframework.com/boxes/angular-truffle-box


texts: unable to send ether from solidity contract

texts:
i have a contract which has a function that sends ether to an account address. here is the contract code

pragma solidity ^0.4.8;

contract Rental {
    struct PaidRent {
        uint id;
        uint value;
    }
    PaidRent[] public paidrents;
    event RentPaid(bool Status);
    uint public createdTimestamp;
    uint public rent;
    uint public security_deposit;
    string public house;
    address public owner;
    address public tenant;

    enum State {Created, Started, Terminated}
    State public state;
    function Rental(uint _rent, uint _security_deposit, string _house, address _owner, address _tenant) {
        createdTimestamp = block.timestamp;
        rent = _rent;
        security_deposit = _security_deposit;
        house = _house;
        owner = _owner;
        tenant = _tenant;
    }
    modifier require(bool _condition) {
        if(!_condition) throw;
        _;
    }
    modifier ownerOnly() {
        if(msg.sender != owner) throw;
        _;
    }
    modifier TenantOnly() {
        if(msg.sender != tenant) throw;
        _;
    }
    modifier inState(State _state){
        if(_state != state) throw;
        _;
    }

    function getPaidRents() internal returns (PaidRent[]) {
        return paidrents;
    }

      function getHouse() constant returns (string) {
        return house;
    }
    function getowner() constant returns (address) {
        return owner;
    }
    function getTenant() constant returns (address) {
        return tenant;
    }
    function getRent() constant returns (uint) {
        return rent;
    }
    function getDeposit() constant returns (uint) {
        return security_deposit;
    }
    function getContractCreated() constant returns (uint) {
        return createdTimestamp;
    }
    function getContractAddress() constant returns (address) {
        return this;
    }
    function getState() returns (State) {
        return state;
    }
    function CollectEth() payable  {}

    function payRent(uint _rent) public payable returns(bool status) {
        if(owner.send(_rent)){
          RentPaid(true);
          return true;
        } else {
          return false;
        }
    }

    function terminateContract(address deposit_to) inState(State.Started) require(this.balance == security_deposit) {
        deposit_to.transfer(security_deposit);
        state = State.Terminated;
    }

}

and in my angular's service i am first transferring some amount to contract address and then calling this function in following way

paymyRent(contractInstance, rent) {
    this.contractevent = contractInstance.RentPaid();
    this.contractevent.watch(function (error, result) {
      if (!error) {
        console.log(result.args);
      } else {
        console.log(error);
      }
    });
    console.log(contractInstance.getowner());
    contractInstance.payRent(rent, {from: this.web3.eth.accounts[0],
      gas:1000000, value: this.web3.toWei(0.01, "ether")});
  }

but this function nevers sends the ether to owner's address and neither it emits the event. Other functions of contract such as getowner(), getTenant(), getHouse() are working fine except this payRent() function.

EDIT


texts: How does Truffle work without a web3 provider?

texts:
I have a question about the init project with Truffle.

I can't understand how - in app.js - they use the deployed contract without a web3 provider, like this:

var provider = new Web3.providers.HttpProvider("http://localhost:8545");
var contract = require("truffle-contract");

var MyContract = contract({
  abi: ...,
  unlinked_binary: ...,
  address: ..., // optional
  // many more
})
MyContract.setProvider(provider);


texts: i'm studying both Bitcoin and Ethereum from how it is implemented and how it's used because I'm gonna be making a thesis project out of this. Would you please explain to me the difference of these two or are they even related? I know that digital signatures are a way to know that the transaction is legit using the private key in Bitcoin. How does that happen in Ethereum? Thank you in advance!


texts: how to avoid re-entrancy vulnerability warning?

texts:
Transfer amount to any address always showing the re-entrancy vulnerability warning. How to avoid this warning?

function completeChallenge(address _challengerAddress,address _challengeAddress,uint _index) internal returns(bool) {
   _challengerAddress.transfer(safeMul(challengeList[_challengerAddress][_challengeAddress][_index].challengeChargeAmountWei,2));
   return true;
}


texts: Risks of smart-contract code metadata caching in Ethereum node

texts:
When checking implementation and performance profile of Besu node, I have noticed that certain metadata about contract code under given address is not cached - on every execution of the contract, it is analysed as a completely new entity.
There are techniques which would be used to speed things up by caching that data (and possibly doing other things, like jit compiling contracts etc). My question is if there is any real downside to that?
I understand that with a lot of contracts, this might be not cost effective (time spent on optimizing infrequently used contracts and extra memory usage). But, outside of resource issues, is there any security risk around that? Can something be replaced or changed in the way that past analysis wouldn't be correct anymore and thus pose some attack possibility?
This is not Besu-specific question (even if I originally observed it in the Besu codebase), but rather general Ethereum/smart contract query.


texts:
first of all really nice to find this forum, I'm starting coding Solidity.

Here the problem I get compiling a template of crowdsale smart contract ExampleTokenCrowdsale.sol, from this tutorial.

The screenshots:

TypeError: Invalid type for argument in modifier invocation. Invalid implicit conversion from address to address payable requested.
    Crowdsale(_rate, _wallet, _token)

code:

    pragma solidity ^0.5.0;

    import "openzeppelin-solidity/contracts/crowdsale/Crowdsale.sol";
    import "openzeppelin-solidity/contracts/crowdsale/emission/MintedCrowdsale.sol";
    import "openzeppelin-solidity/contracts/crowdsale/validation/CappedCrowdsale.sol";

    contract ExampleTokenCrowdsale is Crowdsale, MintedCrowdsale, CappedCrowdsale{

    //minimum investor Contribution - 20000000000000000000
    //minimum investor Contribution - 50000000000000000000
    uint256 public investorMinCap = 20000000000000000000;
    uint256 public investorHardCap = 50000000000000000000;

    mapping(address => uint256) public contributions;

    constructor(uint256 _rate,
      address _wallet,
      ERC20 _token,
      uint256 _cap)
    Crowdsale(_rate, _wallet, _token)
    CappedCrowdsale(_cap)
    public{
    }

    function _preValidatePurchase(
    address _beneficiary,
    uint256 _weiAmount
     )
    internal view
    {
    super._preValidatePurchase(_beneficiary, _weiAmount);
    uint256 _existingContribution = contributions[_beneficiary];
    uint256 _newContribution = _existingContribution.add(_weiAmount);
    require(_newContribution >= investorMinCap && _newContribution <= investorHardCap);
    contributions[_beneficiary] = _newContribution;
   }

   }

thanks!

[edited]:


texts: How Merkle Tree obtain root node hash (example from 'Understanding the ethereum trie')?

texts:
I read Understanding the ethereum trie and try to do examples from that article. Now i am at ex1.py - first exaple. Look at code from that example:

import sys
sys.path.append('src')
import trie, utils, rlp

#initialize trie
state = trie.Trie('triedb', trie.BLANK_ROOT)
state.update('\x01\x01\x02', rlp.encode(['hello']))
print 'root hash', state.root_hash.encode('hex')
k, v = state.root_node
print 'root node:', [k, v]
print 'hp encoded key, in hex:', k.encode('hex')

after work around line:

state.update('\x01\x01\x02', rlp.encode(['hello']))

I saw how code create state.root_hash, in example it is:

  15da97c42b7ed2e1c0c8dab6a6d7e3d9dc0a75580bbc4f1f29c33996d1415dcc

I obtain another, but not understood how get it. Can anyone explain me?

So we has:

key = pack_nibbles(with_terminator('\x01\x01\x02')
value = rlp.encode(['hello'])

How from that we got state.root_hash?


texts:
I have installed the new ethereum wallet and Geth with it. The Wallet is now 0.8.3 and geth 1.5. Yet, the wallet application and geth started in the terminal still have the same issue, they simply cannot sync 2283415.

I also tried Parity, which was supposed to be completely unaffected. It has synced the entire blockchain synched by not, but is ALSO STUCK on 2283415.

Help! Whats going on? I thought this problem had been fixed. Why is now parity also broken?

Max


texts: At Quorum network, we can submit public transactions within Quorum nodes. Are we able to connect Quorum nodes to Ethereum and allow those public transactions go to public?


texts: Call function with less numbers of arguments than function needs

texts:
I tried to call function from first contract:

someClass.tokenFallback(msg.sender, _value)

tokenFallback contains with realiztion in second contract:

function tokenFallback(address _from, uint _value, bytes _data)

I got transaction revert.
I tried to call function tokenFallback with 2 arguments on second contract:

function tokenFallback(address _from, uint _value)

I got normal transaction and transfer.
How to call functions that have different numbers of argument?
Is it realy?


texts: How to make a snapshot of ERC-721 (NFT) token holders

texts:
What is the best way to create a snapshot of ERC-721 token holders? Maybe there is a tool for this purpose?
I need to take a snapshot of holders of tokens for this NFT contract - https://etherscan.io/address/0xd07dc4262bcdbf85190c01c996b4c06a461d2430


texts: Ethereum adoption in Enterprise without tokens/Ethers

texts:
from an enterprise perspective, we may not need to deal with tokens/ethers.
Can an enterprise use ethereum at the same time decide not to use tokens/ethers (for example not supplying gas for every transaction)?
such financial arrangements could be made outside of the transactions by participating organizations.


texts:
Based on this answer: https://ethereum.stackexchange.com/a/37419/24310

How does interest work with casper? Is it correct to describe what the validators receive as interest?


texts: Is there any way to find code coverage and cyclomatic complexity for test cases in dapple , similar to the tool we have in java which give every aspect of our code


texts: If I want to create a Blockchain Explorer, would be enough just use Infura? Or is it essential to run a full node?

texts:
I want to create a Blockchain Explorer and I am wondering if using Infura for that would be enough, or if it would be necessary to run a private node on Ethereum.
I am not sure about Infura speed to show the data and how it would behave with a lot of users making requests at the same time.


texts: why the zero-account used by smart contracts?

texts:
The zero-acount 0x0 is used by some smart contracts to store tokens (valued at 1B$ : https://etherscan.io/address/0x0000000000000000000000000000000000000000)

It is used by smart contracts because there are inputs and outputs of tokens from it. So why this particular address ?


texts: Decentralized Access Control in permissioned Blockchain

texts:
For a business use case I am conceptualizing for my master's thesis, which is based on a Blockchain system, I need to understand impacts on decentralization/trustlessness.

Many people argue that private instances are utter nonsense, and you might as well use centralized databases because you need some kind of access control to let parties join the network and therefore and central entity controls it all. In my case, a consortium of three companies would set up a private Blockchain for confidentiality reasons.

Question: How to implement access to permissioned/private/consortium Blockchains in a decentralized or at least democratic manner?

If the nodes and their respective network addresses are defined contractually, let's say each stakeholder sets up 3 nodes, I don't see the need need for a central gate keeper. A befriended ethcore dev told me that still anybody could join the network an compromise it, yet I don't know how and why.
Alternatively, I could imagine staking as Sybil-control where each member gets an equal share.


texts: Error: gas required exceeds allowance or always failing transaction when trying to estimate gas

texts:
I am trying to run estimateGas function on mainnet like the following to send erc721 cryptokitties from one account to another:

data.from = <my address>
data.to = <destination address>
data.token = 0x06012c8cf97bead5deae237070f9587f8e7a266d (cryptokitties contract address)
data.tokenId = 1148166

var getDataForERC721 = function(from, to, contractAddress, tokenId){
    var abi = <myerc721abi>;
    var contract = web3.eth.contract(abi).at(contractAddress);
    var data = contract.safeTransferFrom.getData(from, to, tokenId);
    return data;
}

var txdata = getDataForERC721(data.from, data.to, data.token, data.tokenId;

getEstimateGas = async function(from, to, data, value){
    var self = this;
    return new Promise((resolve, reject) => {
        web3.eth.estimateGas({
            'from': from,
            'to': to,
            'data': data,
            'value': value
        }, function(err, tx){
            console.log("errror is -> " + err);
            if( err ) resolve(null);
            else resolve(tx);
        });
    });

getEstimateGas(data.from, data.to , txdata, 0x00);

I get this error Error: gas required exceeds allowance or always failing transaction. This function works well on Ropsten network, but gives the above error on mainnet.

I am using web3 version ^0.20.6

EDIT

I have made sure that contract.ownerOf(tokenId) returns the correct address.
I have also tried replacing contract.safeTransferFrom.getData(from, to, tokenId) with contract.transferFrom.getData(from, to, tokenId).
However, I still get the same error.

console.log(contract.transferFrom.getData(from, to, tokenId)) prints the following:

0x23b872dd00000000000000000000000057e7674b1c58a0edce5a62af228ab34f09c00fca000000000000000000000000ae08cf4e3678843bbeb39d0608029b1daa4d51210000000000000000000000000000000000000000000000000000000000118506

The data that I am now passing to getEstimateGas is as follows:

{ from: '0x57E7674B1c58A0edce5a62AF228ab34f09C00Fca',
  to: '0x06012c8cf97bead5deae237070f9587f8e7a266d',
  data:    '0x23b872dd00000000000000000000000057e7674b1c58a0edce5a62af228ab34f09c00fca000000000000000000000000ae08cf4e3678843bbeb39d0608029b1daa4d51210000000000000000000000000000000000000000000000000000000000118506',
  value: '0x00' }

Here from is the address which contains the token, to is the contract address (cryptokitties)
and data is the data returned from contract.transferFrom.getData function.

Here the from address is also the owner of the token. So, I guess I don't need to use the approve function.

I gained this token with this transaction https://etherscan.io/tx/0x5119c2d5eae0fdc4a0e000b84231cfb5db075efd30fcca3fabe91d2bbfdc9006


texts:
I am totally new to Ethereum and I'm more familiar to the Bitcoin blockchain.

Is there a way to group transactions?

Suppose I want transactions of multiple users to get grouped together and validated in one time; the transactions being triggered when I have enough transactions in the queue.

Is there a way to do that through some smart contract ?


texts: Code for contract interaction works on Kovan but not on Ropsten

texts:
we deployed (via remix) the code below where one contract can influence a state variable in the other. For some reason if I deploy the contracts on Ropsten it doesn't work and if I deploy them on Kovan, this works just fine. Anyone any idea?

pragma solidity ^0.4.13;

contract A {

    uint public counter ;
    function increment(uint add) {
       counter = counter + add;
    }
}

contract B {

    function delegateIncrement(uint add) {
        A("here the address for contract A").increment(add) ;
    }
}


texts:
This web3js event listener is part of a Voting Dapp. The listener listens for a transactions and re-renders the page to show updates.

listenForEvents: function() {
App.contracts.Election.deployed().then(function(instance) {

  instance.votedEvent({}, {
    fromBlock: 0,
    toBlock: 'latest'

  }).watch(function(error, event) {
    console.log("event triggered", event)
    // Reload when a new vote is recorded
    App.render();
  });
});
},

Even after a lot of searches,i cannot find an explanation for the part

{
    fromBlock: 0,
    toBlock: 'latest'
}

I think this part is causing to render the app in loop.
Event declaration is like

event votedEvent (uint indexed _candidateId);

The statement that calls the event is

votedEvent(_candidateId);

Any links or topics to search for will be helpfull.Thanks in advance :-)


texts: Remix: ParserError: Expected pragma. import directive, or contract/library/interface definition

texts:
I'm trying to use Remix to interact with a suite of contracts. One of the contracts being used is OpenZeppelin's Ownable contract. I copied from the link above, and pasted it into Remix, with a few changes to take out the OpenGSN stuff, and also dropping the Solidity version (due to requirements elsewhere in the suite):
pragma solidity ^0.5.0;

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable {
    address private _owner;
    ....

This yields the following error:
ParserError: Expected pragma. import directive, or contract/library/interface definition
abstract contract Ownable {
^-------^

I've tried all kind of things. Via a comment here I've tried retyping the first line by hand, along with the first line of the contract code. I've tried taking out the abstract (update: I made a mistake with this, see the answers), I tried making up an import, removing the caret (^) from the Solidity version, and general monkeying around with the code to make it work. Nothing has gotten rid of this error.
There are a number of other questions with this precise error, though I have not been able to extrapolate from any of the ones I've seen why this error would be appearing here.
Why am I getting this error?


texts:
As per this contract can some explain about the what input the user will provide and explain about the transporter type when he select option 1 then what input should we give. please explain about the each option in transporter type.

function loadConsingment(
        address pid, //Package or Batch ID
        uint transportertype,
        address cid
        ) public {
        require(
            UsersDetails[msg.sender].role == roles.transporter,
            "Only Transporter can call this function"
        );
        require(
            transportertype > 0,
            "Transporter Type must be define"
        );

        if(transportertype == 1) {  // Supplier to Manufacturer
            RawMatrials(pid).pickPackage(msg.sender);
        } else if(transportertype == 2) {   // Manufacturer to Wholesaler OR Manufacturer to Distributer
            Madicine(pid).pickPac kage(msg.sender);
        } else if(transportertype == 3) {   // Wholesaler to Distributer
            MadicineW_D(cid).pickWD(pid,msg.sender);
        } else if(transportertype == 4) {   // Distrubuter to Pharma
            MadicineD_P(cid).pickDP(pid,msg.sender);
        }
    }


texts: Are there any public APIs for ENS lookup?

texts:
I want to add ENS support to an app I am building, and I am looking for a lightweight API which supports ENS to Ethereum address conversion.

All the documentation shows how you can do this on the blockchain, and it appears like Web3.js will work, but I am wondering if there is anything more lightweight than this, like a public GET API which returns JSON.


texts: Send tokens using approve and transferFrom vs only transfer

texts:
We can send tokens using below ERC20 contract methods

approve() and transferFrom()
transfer()

Here if i use 2nd option the tokens are directly transferred, while if i use 1st option its a two step process

I am new to this and i want to understand the difference between the two ways?


texts: Can modifiers use events while still throwing errors afterwards?

texts:
I'm wondering if a modifier function can use events while still throwing afterwards?

I'm looking for a way to have a "catch error" events that would trigger if it fails for X or Z modifier.

Anyone knows a way to do this ?


texts: web3 ens library - purpose of setText, getText against ENS name

texts: I am looking at web3.eth.ens library, I can see methods setText and getText, which allows you to set and get key value pairs against an ENS name. What is the purpose of this? Also is there a way to find all the keys against an ENS name?


texts: how to transfer less than 1 eth using geth

texts:
I'd like to transfer .24 eth

Using this site to convert .24 to hex I get 0.3D70A3D70A3D70A3D70A

Then using this command

eth.sendTransaction({from: "0xeadbcdf21ccd3b1d8437e6dc32509e68f638a0bc", to: "0x45c6bD2F15FDD9763dfCfAb5100829DeC5C8fbc2", value: "0x0.3D70A3D70A3D70A3D70A"})

I get this error:

Error: invalid argument 0: hex number has leading zero digits after 0x
    at web3.js:3104:20
    at web3.js:6191:15
    at web3.js:5004:36
    at <anonymous>:1:1

Is it possible to send less than 1 eth or am I doing something wrong?


texts: will the gas to execute my function increase if the array of object get bigger in the future?

texts:
From the contract below, if the logs get bigger and bigger (let's say it contains 1M items).

The cost for calling set will be increase or not?

I think that the cost for calling when the array size is 10 and 1M should be the same because the operation in set function is not different.

But I am not sure, so that I post this question.

pragma solidity ^0.5.0;

contract Storage {
    struct Log {
        string fname;
        string lname;
        string dob;
    }
    mapping (uint => Log) logs;

    function set(uint memory index, string memory fname, string memory lname, string memory dob) public returns (uint) {
        index++;
        logs[index] = Log(fname, lname, dob);
        return (index);
    }

    function get(uint idx) public view returns (string memory, string memory, string memory) {
        return (logs[idx].fname, logs[idx].lname, logs[idx].dob);
    }
}


texts: How to cancel a pending transaction from command line?

texts:
I have a private key. I need to cancel a pending transaction sent from its address.
How to do this from command line?
Also: I need to do the exactly same thing if there are several such pending transactions, don't I?


texts:
I am trying to install the ethereum-lightwallet on my system.  I am experiencing a problem with npm.  When I run npm install eth-lightwallet I get a message:

 └─┬ eth-lightwallet@2.5.2
  ├── bignumber.js@2.0.7  (git://github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2)
  └─┬ web3@0.15.3
    └── bignumber.js@2.0.7  (git+https://github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2)

npm WARN enoent ENOENT: no such file or directory, open '/home/m/package.json'
npm WARN m No description
npm WARN m No repository field.
npm WARN m No README data
npm WARN m No license field.

Then if I try creating a package.json file in the directory I want to install the lightwallet I get a message that:

    npm ERR! Linux 3.19.0-69-generic
    npm ERR! argv "/home/m/.nvm/versions/node/v6.3.0/bin/node"      "/home/m/.nvm/versions/node/v6.3.0/bin/npm" "install" "eth-lightwallet"
    npm ERR! node v6.3.0
    npm ERR! npm  v3.10.6
    npm ERR! code ENOSELF

    npm ERR! Refusing to install eth-lightwallet as a dependency of itself

Does anyone know what I have to do to install the lightwallet?  I've also tried npm init but I'm not sure what variables to add to create the package.json file.


texts:
How can I execute a function on a smart contract from a web-app backend? (Laravel / PHP)

My smart contracts holds X tokens.

In my MySQL database, users are owed X tokens. I have their wallet addresses.

How can I securely send X tokens to N addresses, and automate it so its not a manual process?

Eg -> run cron job every night
   -> smart contract gets list of addresses & values
   .... how can I do this securely?


texts: Ethers are withdrawn using send from source contract but not received in account

texts:
I am trying to send ethers using the following code:

//check if confirmed by both the owners
if(tr.confirmedByUbuntu && tr.confirmedByWindows) {
    bool withdrawal = tr.to.send(tr.value); //Send the ethers
    if(withdrawal) {
        ConfirmedTransaction(_confirmationHash, tr.to, tr.value, tr.data);
        delete pendingTransactions[_confirmationHash];  //Free up the storage on EVM
    } else {
        TransactionConfirmationFailed(_confirmationHash, tr.to, tr.value, tr.data);
    }
}

The line where I am sending ethers, does withdraw ethers from the source contract but does not deposit in target account. I am doing it on a private network. In what scenarios can this happen? In case of send failure we should we would get the withdrawal result as false but I get that as true.

Full source code is at: https://gist.github.com/anonymous/e4fdac24643c7146a04bd9b3d96fbb4c


texts: Truffle test does nothing but compile work

texts:
I just started seeing solidity and truffle. I created a new project with the truffle init command and try this test code to verify the deployment of a contract.
const GreeterContract = artifacts.require("Greeter");

contract("Greeter", () => {
  it("has been deployed successfully", async () => {
    const greeter = await GreeterContract.deployed();
    assert(greeter, "contract was not deployed");
  });
});

But the truffle test command does nothing and the terminal stands still as if waiting for something.
Instead truffle compile command works.
The anomaly occurs on both linux and windows. I also tried other test codes from the net or to write whatever, always the same result. Is it a bug?
Truffle version installed at the moment is the latest, 5.1.44
EDIT
This is the folder structure created by truffle init.The Greeter contract is missing to fail the test. However, I also tried to add it and nothing changes.


texts:
I have some idea of a smart contract, that based on private user tokens which stored in contract state. Every user can set his token by sending transaction to contract. But it is not secure if every user on network has access to all transactions data.

Is there way to store private user data in contract store?


texts: What is use of absolute Path on Json file of a Smart Contract?

texts:
What is the use of absolutePath on JSON artifact of a Smart Contract?
Does this mean we need the .sol file on the same server where web3.js apis are running?

{
    "absolutePath": "/home/hashcode01/HashCode/Github Project/AegisCoinGitHub/contracts/BusinessAcc.sol",
    "file": "./BusinessAcc.sol",
    "id": 9,
    "nodeType": "ImportDirective",
    "scope": 720,
    "sourceUnit": 793,
    "src": "367:27:0",
    "symbolAliases": [],
    "unitAlias": ""
},


texts:
I'm trying to make a lottery.

pragma solidity ^0.4.23;

contract Lottery {

struct Ticket {
    uint id;
    address name;
    uint winCount;
}

uint public winFirstPercent = 60;
uint public prizeMoney = 0;
address public winner;
uint public priz;

uint public lastWinNumber = 0;

uint public ticketCount = 10;
uint public ticketPrice = 1 ether;
// Testnet
address public walletMoney = 0xca35b7d915458ef540ade6068dfe2f44e8fa733c;

mapping (uint => Ticket) public tickets;

event buyTicket (uint ticketNum, address adrr);
event winAddress (uint ticketWin, address winAddress, uint priz, uint prizeMoney);

constructor () public {
    clearTickets();
}

function clearTickets() public {
    for (uint i = 0; i < ticketCount; i++){
        tickets[i] = Ticket(i,0,0);
    }
}

function buyTickets (uint _ticketNum) public payable returns (bool success) {
    require ((_ticketNum > 0) && (_ticketNum < ticketCount));
    require (tickets[_ticketNum].name == 0);
    require (msg.value == ticketPrice);
    walletMoney.transfer(msg.value);
    prizeMoney += msg.value;
    tickets[_ticketNum] = Ticket(_ticketNum, msg.sender, 0);
    emit buyTicket(_ticketNum, msg.sender);
    return true;
}

function playGame () public {
    //lastWinNumber = uint(block.blockhash(block.number-1))%ticketCount;
    lastWinNumber = 1;
    if (tickets[lastWinNumber].name != 0) {
        winner = tickets[lastWinNumber].name;
        priz = prizeMoney*winFirstPercent/100;
        winner.transfer(priz);
    }
    emit winAddress(lastWinNumber, winner, priz, prizeMoney);
}
}

Buying tickets works correctly!

But when I start to run the function playGame (), I get an error

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

P.S. I specially for the tests of the application left the winning number a fixed ticket - 1

Tests do in remix


texts: Transaction hash as contract method parameter

texts: How to send the generated transaction hash as the solidity contract parameter through JSON RPC API call to the blockchain.


texts:
Where is the folder on Mac OSX where Ethereum put raw blockchain data? I find only *.ldb files, but as I understand it is only the index of full database.

For example, in Bitcoin there is blk*.dat files. Is there something like this in Ethereum? And if yes, where this stored?


texts: How to differentiate between different logs in ethclient

texts:
I have events like this in my .sol file

event userActivated(address owner, address contractAddr);
event userDeactivated(address owner, address contractAddr);

And I am using ethclient Go module to parse events.
here is the code

func listEvents() string{
    var tempEvents Event
    client, err := ethclient.Dial(RpcPath)
    if err!=nil{
        glog.Fatal("Client error",err)
    }
    query := ethereum.FilterQuery{
        FromBlock: nil,
        ToBlock:   nil,
        Addresses: []common.Address{},
   }
   logs, err := client.FilterLogs(context.Background(), query)
   if err != nil {
      glog.Fatal(err)
   }
   //get ABI for parsing data
   contractAbi, err :=
   abi.JSON(strings.NewReader(string(contracts.NewUserABI)))
   if err != nil {
      glog.Fatal("ABI error",err)
   }
   for _, vLog := range logs {
       //fmt.Println(string(vLog))
       err := contractAbi.Unpack(&tempEvents, "userActivated", vLog.Data)
      if err != nil {
            glog.Fatal(err)
      }
      fmt.Println(tempEvents.ContractAddr.Hex(),tempEvents.Owner.Hex())
   }
  if err!=nil{
      glog.Fatal(err.Error())
  }
return ""

}

My event structure is here

type Event struct {
    Owner common.Address
    ContractAddr common.Address
}

But it lists both events, userActivated and userDeactivated even if I gave unPack parameter as "userActivated"

Is there any way to check event name in log data?


texts: What happens to Transactions in the pool of a non-mining node?

texts: Both incoming and local transactions are validated and added to the transaction pool.  A mining node pulls from the Tx pool to build blocks. What does a non-mining node do with the transactions in the pool?


texts: After deployment, interaction with functions not giving desired output using Web3, Truffle

texts:
The set of contract-functions give expected behaviour when tested on Remix. But when the same functions are deployed on TestRPC using Truffle & Web3 and accessed using a Web Interface, it doesn't give the required logical output.

The Structures are as follow:

struct ProofEntry {
bytes32 owner;
bytes32 privateKey;
bytes32 previousTrackingId;}

struct registerEntry{
bytes32 owner;
bytes32 privateKey;}

The Mappings required are as follows:

mapping (bytes32 => ProofEntry) proofs; // trackingId to ownerBlock

mapping (string => bytes32) items;  // productId to trackingId

mapping (bytes32 => registerEntry) register; // ownerHash to registerEntry

Please consider the following functions: 1] addProduct

function addProduct(string password, string productId) public returns(bool){
    if(hasEntry(productId))
      return false;
    else {
    bytes32 owner = keccak256(bytes32ToString(keccak256(password)));
    bytes32 privateKey =  keccak256(password);
    bytes32 previousTrackingId = keccak256("root");
    bytes32 trackingId = keccak256(productId);
    proofs[trackingId] = ProofEntry(owner, privateKey, previousTrackingId);
    register[owner] = registerEntry(owner , privateKey);
    items[productId] = trackingId;
    productAdded(password,owner,productId);
    return true;
  }
}

2] getOwner

function getOwner(string productId) constant returns(bytes32) {
 bytes32 trackingId = items[productId];
 ProofEntry memory record = proofs[trackingId];
 return (record.owner);}

Now when I test these functions on Remix,ie by giving a password & productId for addproduct() and giving the productId in getOwner, I get the corresponding Hash of the owner.

But When I deploy it on testRPC using Truffle,Web3 and access it using a WebUI, addproduct() returns true indicating that it has added the product but when I pass the same productId to getOwner(), it returns default value of bytes32 and not the OwnerHash, which indicates that the values have not been reflected in the mappings in the blockchain which i cannot understand why. Need help Urgently!!!!!


texts: How get Constructor Arguments ABI-encoded?

texts:
Im trying to verify an ETH contract, but I complete the etherscan form to and i receive this message:

"Error! Unable to verify source code
Missing Constructor Arguments for function JL(uint256 initialSupply, string tokenName, string tokenSymbol)"

My contract was created using https://remix.ethereum.org/ On this link are my smart contract code
- JLC.json
- JLC.sol
 https://gist.github.com/5067bbba4b0640e5679d85f8625c198e

Im new on this and im just testing how smart contracts work.

I hope your support guys.

Thanks.


texts: Is anyone building a Lightning-like network on Ethereum?

texts: Is anyone building a Lightning-like network on Ethereum, offering cheap microtransactions and secure 0-confs?


texts:
pragma solidity ^0.5.16;

contract mycontract{
    uint256 public a;

    function foo(string calldata _name) external {
        string memory names;
        names = _name;
        getname(names);
    }

    function getname(string memory nameget) internal view returns(string memory){
        return nameget;

    }

    function setinteger(uint256 _a) public{
        a = _a;
    }
}

What's the issue with above code? When foo is called it should return the string but it does not.


texts:
When we use web3.eth.getPastLogs it returns topic and data properties together with rest data. Does it possible to retrieve event args parsing just data and topic as filter? Without to make additional request to node like myContract.getPastEvents?

The reason to use such approach is to avoid additional requests to remote Ethereum node. So the goal to fetch events from multiple contracts by one request.

For example

web3.eth.getPastLogs({
    fromBlock: 'latest',
    toBlock: 'latest',
    address: [
        "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe",
        "0xEA13ff054fF3fAb986442A29121A32803f1dAf7D",
        ... // multiple contract addresses here
    ],
    topics:[
         web3.utils.sha3('Transfer(address,address,uint256)') // or uint ?
    ]
})

So how to parse returned result where data property converts to human readable event args format?


texts: Is it possible to use a modifier so that certain functions can only be executed by the contract, itself?

texts:
How can you program a contract so certain functions can only be called by other functions within the contract? Would you use a modifier? In the example below I'd want a user to have to call metaAwesomeness() to access awesomeness(), which would otherwise be inaccessible via superDuperOnly():

contract superDuper {
    modifier superDuperOnly() {if (msg.sender != address(this)) throw; _};
    function awesomeness() superDuperOnly {};
    function metaAwesomeness() {awesomeness()};
}

Taking it one step further, I'd also be interested to use this modifier on another contract, so only superDuper functions can call kindaCool's nifty():

import "./superDuper.sol";
contract kindaCool {
    function nifty() superDuperOnly {};
}

EDIT: for solution (Pt 1):

The first contract, superDuper, would look like:

contract superDuper {
    function awesomeness() internal {};
    function metaAwesomeness() {awesomeness()};
}


texts:
when going on to the remix IDE, i get the error
No injected Web3 provider found. Make sure your provider (e.g. MetaMask) is active and running (when recently activated you may have to reload the page).
after trying to switch the environment on Remix IDE from JavaScript VM to injected web3. I tried using a http connection as well and it didnt work. I am trying to inject web3 into remix IDE using MetaMask and I cannot switch my environment to injected web3 because of the error I mentioned above. All help is appreacited, thank you.
ANSWER:
Once I switched to FireFox the web3 was injected. The web3 only worked on firefox


texts: .gas(gas_limit)(target_account_address) 0xProtocol Solidity Syntax

texts:
Hi I got this code from 0xProject Exchange.sol

https://0xproject.com/wiki#Deployed-Addresses:

Quote: "TokenContract(contract_address).balanceOf.gas(gas_limit)(target_account_address); // Limit gas to prevent reentrancy"

Could you explain what syntax this is:
".gas(gas_limit)(target_account_address)" ?

Thank you


texts: Where does Metamask mobile for Android store private keys?

texts:
I currently have a problem with metamask on android mobile.
I can no longer access my account, when I enter my password, I have this error:
Syntax error: Unexpected token r in JSON at position 0

I specify that I entered a large number of passwords before finding the correct one, can that explain the problem ?...
So I try to get my private key, I suppose it is store in Android keystore, do you know how can I access it ?
Thanks


texts:
I have downloaded geth and ethminer, and started running a testnet with 2 nodes - 1 mining and the other not. Here's my (noobish) problems:

If I submit a txn to my non-mining node, it won't get processed by
the mining node even though both nodes are peers. Does it mean that
only txns that are submitted to a mining node will be propagated to
other mining nodes and get settled?
I tried to hook up my ethminer (1.4.x) to one of the nodes and
    perform gpu mining, but it either crashes my nvidia card (with 2MB
    mem) or just mine with 0 H/s. thoughout the trial the node seemed to
    recognize that something is trying to mine for it (eth.mining ==
    true and it says the next block is committed to be mined). Why does
    the ethminer instance keep producing 0 hashrate (I am actually
    ignoring the gpu crashing issue since it gets 0 H/s even with cpu
    mining)?


texts: Downloading Epirus and Java In Git Bash Terminal - Error Message "Unable to Access Jar File" (I'm Using Windows 7)

texts:
I tried downloading the web3j/epirus command line tool as stated on your website:
https://github.com/syscoin/sysethereum-contracts
But I keep getting the error message 'Unable to access jar file'
It also seems like Windows 7 must use Java version 1.7.
(I've tried version 1.8 but Windows can't open it.)
Is there a workaround for this?


texts: Bundling two assets in a contract and issuing shares for them

texts:
Say you are tasked with coding a smart contract with the following features:

Users can deposit token A and receive liquidity shares in return.
The contract starts selling token A for token B depending on some arbitrary rules. Every time there is a trade, all users receive a pro rata share of token B.
Users can redeem their liquidity shares in exchange for both token A and token B.
Other users can deposit token A and receive liquidity shares, but they are not eligible to withdraw token B earned by previous users.

In an ideal world, the protocol would do a multisender.app-style distribution of token B, but this is impossible because of block gas limits. Hence I must issue shares and let users retroactively claim their rewards.
Is there a framework or a protocol that I could use to implement this?
I looked at Set Protocol, but their Rebalancing Sets are out of scope for my use case - they depend on auctions to rebalance the composition of the Set.
I also looked at Balancer, which gets close, but their pooled model breaks feature no. 4 from above. Users who deposit late should not be eligible to withdraw tokens B that had been earned by previous depositors.
Is this smart contract design even possible? I personally can't see a way for the contract to selectively distribute token A and token B to users, on a pro-rata basis, while taking into account the times at which users deposited token A.


texts: Accessing the last function parameter from msg.data

texts: I have a fallback (unnamed) function in my contract and I know that the last parameter (or first, does not matter) passed is always an uint. Is it possible to somehow access it though the msg.data?


texts: Using ethereum to fund distributed cloud computations?

texts:
Okay, so assume there's a Web API that offers some kind of service / computation at a given cost. This API itself relies on calling another API that also has a cost.

Would it be possible to set up payment in such a way that, the first API gets an ethereum contract whereby it will be awarded some amount of ether once it delivers the result successfully. And the first API creates a contract with the second API, whereby it will pay out the second API a percentage / fixed part of the funding it gets automatically when the first contract is paid out?

And if it is possible, how high do the costs have to be to justify the transaction fee? Transaction fee at the moment appears to be prohibitively high (0.21USD if I understand everything right). Are there plans to get transaction fees down significantly, or are Ethereum contracts just not supposed to be used for low value transactions?


texts: Connect dApp hosted on cloud with Geth running locally

texts:
I've my dApp running on AWS and Geth running locally. How am I supposed to connect my hosted dApp with the Geth?

I'm connecting my web3(using web3.py) using my computer's(Windows OS) IP address.

web3 = Web3(Web3.HTTPProvider("http://xx.xx.xx.xx:8545"))

Port 8545 has been also opened via Firewall port.

Running my Geth node using

geth --datadir ./Doc-Nodes --networkid 4780 --rpc --rpcapi "db,personal,eth,net,web3,debug,admin" --rpccorsdomain="*" --rpcaddr="0.0.0.0" --rpcport 8545 --allow-insecure-unlock console

But I'm always getting the error while sending the request to dApp.

  requests.exceptions.ConnectTimeout:
  HTTPConnectionPool(host='xx.xx.xx.xx', port=8545): Max retries
  exceeded with url: / (Caused by
  ConnectTimeoutError(urllib3.connection.HTTPConnection object at)

How am I supposed to connect both? I'm confused about what IP should be provided in the web3 connection as well as rpc address.

Thanks.


texts: Silence visibility warning, state mutability can be restricted to pure

texts:
Suppose I have an interface:
pragma solidity 0.7.6;

interface Foo {
  function foo() public view returns(bool);
}

And a simplistic implementation like a mock:
contract Bar is Foo {

  function foo() public view returns(bool} {
    this; // silence state mutability warning
    return true;
  }
}

This part:
this;

... sort of works. See here: Function overriding versus Solidity Compiler Warning: Function state mutability can be restricted to pure
It seems clean enough with truffle compile and hardhat compile but solidity-coverage still complains about it:
state mutability can be restricted to pure

Sure, but this is a false positive. We don't want to change any code. The perfectionist in me doesn't want to see alarming warnings where no issue exists.
Is there a better way to silence the warning?
Thanks :-)


texts: Recommended 64-bit OS for ETH 2.0 node on Raspberry Pi 4B

texts:
I would like to participate in one of the current ETH 2.0 testnet with my Raspberry Pi 4B (ARM64 processor, 4GB RAM) and 500 GB USB 3.1 SSD.
Performance-wise, this is possible and I run an ETH 1.0 full node on it myself.

All ETH 2.0 clients I tried (even Nimbus) don't work in the 32-bit userland that comes with Raspbian Buster, the native OS for the Raspberry Pi.
It is unclear, when a new Raspbian version with 64-bit support will be released.

My question is, if anybody is doing this already and which OS you would recommend.

Besides the obvious choice of Ubuntu Server 20.04, which is currently in beta and supports Raspberry Pi 4, I also thought about balenaOS.
balenaOS is  64-bit and allows for running containers on large variety of different single board computers. Did anyone try this? Heterogenity of devices and ease of use would be a big plus - releying on their cloud service a big minus.


texts:
I am working on making my own crypto currency. In the tutorial https://www.ethereum.org/token there is a section titled "AUTOMATIC SELLING AND BUYING" which gives an example with the following function as well as a buy and sell function.

uint256 public sellPrice;
uint256 public buyPrice;

function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner {
    sellPrice = newSellPrice;
    buyPrice = newBuyPrice;
}

This is great, but can someone tell me how I would actually calculate the buy and sell price? Could it be something like:

C = Current Price of Ether USD

A = Total ether

H = Total Number of My Coins

C * A / H = Buy Price

However, the problem with the above is updating the current price of Ether. That would cost me gas every time..


texts: How to implement user deposits for tokens for an exchange

texts:
If we generate new deposit addresses for every user we face following problems:
- we need to transfer tokens from individual wallets to our exchange wallets
- we need to fund the wallets with ether to be able to pay gas for the transfer above

How do other exchanges solve this? If we say the users should all deposits to one address or smart contract we run in other usability issues and will need other mechanisms to connect deposits to users


texts: I accidentally sent a token to a token contract. Can I get it back? $YFI

texts:
Instead of transferring my ERC20 token to my wallet, I accidentally sent it to the contract itself(Here is source code https://etherscan.io/address/0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e#code)
Would the contract creator be able to send it back to me?


texts: How do consensus vulnerabilities occur when parity nodes do not mien?

texts: While familiarizing myself with Ethereum, I found multiple security alerts referring to consensus issues, most notable those that arose because the geth and the parity client handled certain edge cases differently. However, I also noted that parity nodes do not mine transaction them-self. So when a parity client for example accepts an invalid transaction, why would that cause a fork of the blockchain since the nodes do not really mine themselves (But rather for example ethminer). Or is it that ethminer does not validate the blocks, but the parity client does?


texts:
I'm creating an ethereum wallet and I'm a bit confused with the concept of public key vs address. I understand that the Address is a hashed version of the public key, but when I'm generating a new wallet, I have 3 data fields: private key (used to sign a transaction), Address (used to receive a transaction), Public Key (???)

What is the practical use of the public key?


texts: Bad Block Error: Insufficient balance to pay for gas

texts:
I was syncing on full mode on my Ubuntu OS but when I was approaching the nearest latest block, I was shown this error:

########## BAD BLOCK #########
Chain config: {ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000 Byzantium: 4370000 Engine: ethash}

Number: 4977759
Hash: 0xfa2a09bd5687c428597c275d62b1c479e2548e2f783de138f4d986d121c37240

Error: insufficient balance to pay for gas
##############################

It's just showing me that over and over. I restarted by Geth, I also used debug.setHead() and reset the head way back to 40 or 50 previous blocks and all. I did that twice, but still, nothing happened. Does this mean that the DB is corrupted? Is there any way to fix this cause I was syncing this for days and idk why this happened all of a sudden?


texts:
I want to create ethereum address from seed.

Please help me to create ethereum address from seed.


texts: What is the distinction between a full node and a miner?

texts:
I know that in the Ethereum network miners have to be full nodes, and I know that a full node somehow runs the entirety of the protocol. But what does that mean, precisely?

The whitepaper says miners have to store the full blockchain so they can verify any randomly chosen prior transactions, but full nodes only have to store the state. Do full nodes only verify the most recent block? Why would anyone do this without the incentive of mining?


texts: How can I find the block where a user enacted a certain event on a contract?

texts:
I'm trying to build a web3.py program to take in a given user's address, and return the amount of ETH traded since they added liquidity to a Uniswap exchange. Uniswap is a smart contract on the Ethereum platform.

The Uniswap contract has a method 'AddLiquidity' that allows users to add funds, and I want to find when a given user did this.

I looked through the documentation for how to do this. I'm accessing the blockchain via an infura node, and the docs seemed to say that on infura you can't use a filter.

On the contract documentation, it seemed like I could do this via the events object, but couldnt't get this to work. Think the eventslog may be important but as I say have struggled to get any of it to do what I was hoping.

Please let me know if you need any further info to help me and thanks!


texts:
I'm trying to store records in a contract that are supposed to have an arbitrary number of fields. For example, one record would have "bitrate", another "ISBN" etc., in addition to a number of fixed fields. It is natural to store these fields as a string => string mapping.
Now, the question is, how do I pass these fields to the contract, and how do I get them back? Even the latest version of Solidity, v0.8, doesn't permit using mappings in public contract functions. I'm thinking of sending strings and parsing them inside the contract, but surely there is a more "native" Solidity way using low-level functions?


texts: Private transaction validation in quorum

texts:
I was going through the quorum documentation and stumbled upon how private transactions are validated in quorum. Take the following example where there are four nodes - Node A, Node B, Node C and Node D.Consider the following steps -

1.Node A does a private transaction(assume TX1) with Node B. At this point Node A and Node B have their private tries updated to reflect the private transaction.
2. Node B uses the output of TX1 and does a private transaction with Node C. Since Node C was unaware of the TX1 in the first place how does it validate that TX1 is an actual valid transaction?

Does Node B send the un-encrypted payload of TX1 to Node C so that it can validate the transaction?If yes, then isn't Node A's identity revealed in this scenario? If not, then Node B can dupe Node C by sending using the output of TX1 to first send it to Node D and then doing a double spend and sending it to Node C after it has been sent to Node D. In essence how is a chain of private transactions validated?


texts: How to check for valid contract address using web3?

texts:
I am simply trying to avoid the error:

  Error: invalid address

web3 throws this error when the address to a contract is not valid.
Is there a way to catch this error ? I am using web3 in a nodejs app.


texts: How to build the seamless bridge between two blockchain platform?

texts:
How to build the bridge between two different consensus blockchain platform?

use case:

1.we need to ensure visibility of the transaction in both platforms to assure its integrity

When a smart contract is established on one platform, that contract can be referred to, transacted and transferred to the other platform easily and securely
The bridge should be able to leverage the one platform and other platforms depending upon the transaction type and the TPS requirement. If it requires a faster TPS, then one consensus framework or else normal mining framework of another consensus


texts: What's the difference between Accounts and Wallets in Mist?

texts: In Mist, there are some addresses listed as accounts, and some listed as wallets. What's the difference? Which should I use? And why do I need Ether to create a Wallet?


texts: Let's say I forgot first 2 words of the seed, how could I find an account with ether in it?

texts: Let's say I forgot first 2 words of the seed. I want to write a program that brute-forces all possible bip-39 word combinations for the first 2 words, generate private/public keys, addresses, and go through first 10 addresses to check if there's ether stored in there, and in that case, get a notification. How could I achieve it? I guess I must download the whole Ethereum blockchain, what else?


texts: How to generate unique ETH deposit address for ecommerce or payment processor?

texts:
Example of a payment processor or an ecommerce website.
I would like to generate unique ETH address for each transaction.
I'm genuinely curious what is the the best way of doing it?
Potential solution
Generate 10000 addresses from a mnemonic, keep them on the backend. Front-end making API call to fetch a new one.
Screenshot from "Mastering Bitcoin" by Andreas:

You can assume I'll be able to sweep addresses when the gas prices are low.
Or maybe there is a better option?


texts: Parity - export private key for cold storage

texts:
I'm trying to store some Eth I have in Parity into cold storage. Since I have no guarantee that Parity will continue being supported several years/decades in the future, or that the seed passphrase and/or key encryption algorithms won't change, I want my cold storage backup to also include my account's unencrypted private key, so that I can load that into any Ethereum wallet being used at the time and have access to my funds, without having to rely on potentially obsolete software.

Looking for this functionality in Parity, all I could find so far is the Export feature, which doesn't seem to include any keys, encrypted or otherwise, and the keystore located at \AppData\Roaming\Parity\Ethereum\keys\ethereum, which is encrypted from what I understand. How do I get my private key decrypted?


texts: ETH 2.0 but I have yet to claim my ETH from presale

texts: Had to deal with life and lost track of ETH after the crash. I have yet to claim my ETH presale and wanted to know with all the forks and now ETH 2.0, can someone go over the best way to claim my ETH but also receive any fork coins? Appreciate any help with this.


texts: Overriding function of a deployed contract

texts: Suppose I have token contract which is already deployed into the network. I want to make change one of its function without redeploying it. How to do this? Is it possible to override its function?


texts: How do I do get the text from a failed `require` in Javascript?

texts:
I have a function in my smart contract that has several require clauses. I'm using etheres.js to call the it from React. When it fails, all I get in the JS Error object is the message "the execution failed due to an exception" and "Internal JSON-RPC error".
How can i get the text of the actual requirement that failed?