texts: How to fix the "Incorrect usage" error when using the Embark framework with geth

texts:
I'm starting to use Embark framework and at some point, when I try to run an Ethereum node with the following command:

geth --datadir="/tmp/embark" --logfile="/tmp/embark.log"   \
  --port 30303 --rpc --rpcport 8101 --rpcaddr localhost    \
  --networkid 75725 --rpccorsdomain "*" --minerthreads "1" \
  --genesis="config/genesis/dev_genesis.json"              \
  --rpcapi "eth,web3" --maxpeers 4                         \
  --password config/password account list

an error is generated saying Incorrect usage.

This command is generated by the Embark framework.

I don't understand what is triggering the error...
I'm following these insructions: https://github.com/iurimatias/embark-framework/blob/1.0.2/README.md

Geth version - 1.5.0-unstable


texts: Call Smart Contract At Unpredictable Time

texts:
Is there a call scheduling service that lets you schedule a call at a time in the future not predictable by someone with access to contract code and transaction details?
The scheduling services I've heard are Ethereum Alarm Clock, Oraclize, and Aion.
Oraclize does offer random number generation as a service as well as function call scheduling, but I don't see how the two can be combined.
One solution I thought of is to have the call happen with higher frequency than desired, and only do actual execution if some random conditions are met, but that loses a lot of unpredictability, and is also very wasteful with gas.


texts:
I am planning to buy Antminer S9 13 for ETH mining. This mining machine produces the hash rate of 13 TH/s. Which is incredible.
Some questions are raising in my mind.

1) According to cost and profit calculators on the web, the income is going to be ridiculously high even if keeping power cost double.

For instance, on this website minergate.com it is giving profit per day $970402.48. Even if keeping electricity cost triple.

How be the real calculation calculated?

2) Other than difficulty level, on which factor the earning depends?

Any kind of information is highly appreciated.


texts: What is the proper method of detecting the network inside of a Truffle test file?

texts: Ropsten, Mainnet, or Ganache for example.


texts: How does web3.py cope with constant getter functions?

texts:
I've build a smart contract and now I'm testing it using the python interface of web3.py. In my contract, I declared some private variables and I created getter functions with modifiers to return these private variables. However, if I'm calling the getter function, the private variable is returned, no matter which account is unlocked at that moment. When testing in Remix, the value is not returned if accessed from the same account. Does someone know if this is a web3.py bug or has it something to do with the contract logic?

pragma solidity ^0.4.16;

contract exampleContract {
    uint256 private value;
    address public owner;

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

    function exampleContract(uint256 _value) public {
        owner = msg.sender;
        value = _value;
    }

    function viewValue() onlyOwner public returns(uint256) {
        return(value);
    }
}

Edit:

I think it has something to do with the Concise Contract class of   web3.py. Using the  web3.py function call(), what is the default send address if none is provided via a transact dictionary?

from web3 import Web3, IPCProvider
from web3.contract import ConciseContract

ipc_path = '/path/to/geth.ipc'
web3 = Web3(IPCProvider(ipc_path)
contract = web3.eth.contract(abi = abi, address = address, ContractFactoryClass = ConciseContract)
contract.viewValue() #Who is the sender when unlocking of an account is not required?


texts:
deployed a Contract. Wanted to verify the contract on BSC Scan but got the following error:

Contract Adress is 0x709e26c4f1bb25d25b63a930e7cda6b3ed4a841b
As I see, the ByteCode BSCScan is looking for is identical to "What we got" at Point 1). Any ideas? Some additional info needed to give feedback?
Contract was built with Remix and consists of 4 Files. All of them have been uploaded verification also Compiler Version is correct and double-checked.
Really appreciate your feedback and input.
Thanks a lot in advance.
Best
Pierre


texts:
I am trying to understand about how mappings / struct arrays work compared to each other. I don't know currently how exactly the structs work but a little bit more about mappings.
I am trying to make a set of user attributes for testing reasons.

struct User {
    uint age;
    string name;
    string email; // This is a platform based mail. Spam will not be possible.
}
User[] public users;

or

mapping(address => uint) Age;
mapping(address => string) Name;
mapping(address => string) Email;

What would be the difference and what is better/cheaper?
Thank you for answers! :-)


texts: Can we use secp256r1 to generate valid Ethereum address instead of secp256k1?

texts: We interact with HSM via Graphene to generate EC public/private key for Ethereum blockchain, many tutorials say secp256k1 to generate valid Eth address, however the Graphene supports only secp256r1


texts: I am working on a dapp based on hotel bookings. I have a refund function in my smart contract. The smart contract can receive transactions from a single EOA of a component (contract manager) in the backend that collects all booking requests from the frontend. Can the contract manager send the customer id and the booking payment (no ether) to the smart contract? Can the payment be saved on the blockchain? Does this make sense?


texts:
i cant seem to find this in the docs - i want to run a geth full archive node. I have the NVME space for the current data but i need a new drive for the historical data.
is there a flag or setting for the location of the archive data? i did not see it here https://geth.ethereum.org/docs/interface/command-line-options
edit: is it --datadir.ancient ??
thanks


texts: About Ethereum testnet 61 (Ethereum Classic)

texts:
I know that Ethereum was forked 2 chains due to DAO hacking. so Ethereum Classic was borned at that time but 2 chains are equal technically.
Network number is different between Ethereum(number is 1) and Ethereum Classic(number is 61).

Is different group of miner between Ethereum and Ethereum Classic?
If a end-user generate a transaction with Eth, this transaction should be delivered into the Ethereum network not Ethereum Classic. what happens if a miner in Ethereum network braodcast a transaction to miner that resides in Ethereum Classic?
Ethereum has diverse testnet, so how Ethereum network can distinguish the diverse network?

Sorry for my English


texts: Geth and qtminer: 0 balance after 2 days with 3.2MH/s

texts:
I'm using Geth + QtMiner:

qtminer.exe -s asia1.ethpool.org:3333 -u 0x37830e9f76198f82cdb81821a7a380c82e24b4f9.maplerichie -G --opencl-platform 1

My average hashrate is just around 3.2MH/s but benchmark can go up to 10MH/s, is there any problem with my syntax or configuration?

After two day mining, the balance return at geth console is still zero (0), check with command web3.fromWei(eth.getBalance(eth.coinbase), "ether"), is this normal?

From the calculation, I should already get 0.05 ETH if hashrate is 3.2MH/s.
Will the mining speed affected by broadband speed? I have a 30Mbps connection only.

Windows 10, with GTX960 GPU.

Thanks


texts:
I am trying to implement the following exercise "Santa's list": Build a system for tracking who is on their nice list and who is on their naughty list.
Furthermore, I do not want duplicates in my list (even though I will input common names).
Just focusing on adding people to the list I wrote the following:
pragma solidity 0.8.1;

contract SantasList {

mapping (string => uint) naughtyList;
mapping (string => uint) niceList;
mapping (string => bool) addedOrNot;
string[] addedPeople;

function addToList(string memory _name, bool _isnice) public returns(string memory _alreadyadded){
    if (addedOrNot[_name] == false){
        if (_isnice == true){
            addedPeople.push(_name);
            niceList[_name] = addedPeople.length+1;
        } else {
            addedPeople.push(_name);
            naughtyList[_name] = addedPeople.length+1;
        }
    return ("added");
    } else {
    return ("alreadyAdded");
    }
    }
}

Would you have any other better way to implement this? what can I improve?
Please note I am trying to avoid iteration to be efficient on Gas.


texts:
I have downloaded and built the latest alethzero client. I have Qt5.5 installed. Running on Ubuntu 14.04

qt.network.ssl: QSslSocket: cannot resolve SSLv2_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv2_server_method
QObject::connect: No such signal dev::aleth::Aleth::knownAddressesChanged(AccountNamer*)
QObject::connect:  (receiver name: 'Main')
QObject::connect: No such signal dev::aleth::Aleth::addressNamesChanged(AccountNamer*)
QObject::connect:  (receiver name: 'Main')
QOpenGLWidget: Failed to make context current
QOpenGLWidget: Failed to make context current
QOpenGLWidget: Failed to make context current
Remote debugging server started successfully. Try pointing a Chromium-based browser to http://127.0.0.1:14633
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed
composeAndFlush: makeCurrent() failed


texts: Why Does Ethereum Not Support A Native (Non Smart Contract) Form Of Multi-Sig?

texts:
After becoming a victim of exchange fraud and witnessing how it negatively impacted the lives of hundreds of others, I'm currently undergoing a study of all the past cryptocurrency exchange hack/fraud events that I can find, in an effort to establish a set of regulations/policies that would prevent this happening to anyone else, hopefully with minimal impact to the robust industry.

Given that almost all past hack and fraud events I could find so far involve the exploitation of a single point of failure, or one person making off with the funds, one of the most powerful (and practically free) tools available to protect investors and traders in bitcoin is the multi-signature wallet, which is supported natively in the protocol. This provides a fool-proof and secure way to ensure that multiple relevant parties have signed off on each transaction. In the entire history of all fraud I've read so far, it's always been one single person mismanaging or making off with the funds, and it's ridiculous to place such trust in one person no matter who they are.

There are some smart contract multi-sig solutions for Ethereum, however smart contracts are also notoriously hackable, being responsible for many billions of dollars worth of losses, such as the famous DAO event that resulted in the Ethereum Classic/Ethereum split. Many of these "secure" multi-sig smart contracts made by very smart people have already been hacked. In addition to the theft of funds, significant amounts of money have been locked up in broken smart contracts, unable to be accessed.

I'm certain that eventually a working smart contract for multi-sig will be developed, however in the process it also seems like many more millions of dollars of people's hard-earned money will be lost, and due to the complexity and challenges inherent in building this, many organizations will simply have to trust a third party to provide them with this solution. This places it further from the reach of individuals who want to protect their own funds, and exposes everyone to additional risk of a fraudulent/negligent actor providing them with a faulty solution. The final end result will be an expensive and inefficient way to do what is the most common use case for any organization and many individuals - simply storing value securely such that there isn't one point of failure.

Given that these are real sums of money that often mean a lot to the people storing them and have a real impact on their lives, and those funds in the hands of bad actors directly negatively impacts even more lives, this seems to me like a very important issue. However, I'm not seeing a lot of outrage over this. In fact, there doesn't seem to be a lot of discussion at all in this direction. So I'm curious to understand the other side of this argument. Other than the implementation effort, why does it not make sense to make it as simple and secure as possible for individuals and organizations to store their Ethereum and ERC20 funds by having support for a native multi-signature wallet?

Not looking to have a debate - just hoping that someone can just summarize any arguments that may exist for the other side so I can better understand.

Is there a plan / EIP for native multi-signature transactions? - Found this but it only suggests support through more smart contracts. It seems to suggest that there isn't a plan, but I am specifically interested in why not. For example - Are there significant specific technical challenges in the implementation that would provide barriers? Are there functional or security disadvantages when a protocol supports multi-signature that I may not have considered? Are there cultural differences between the ethereum and bitcoin community or in general that make this less desirable or less likely to gain traction?


texts: What are possible ways to find a startup to join remotely?

texts:
I was wondering which ways there would be to find remote work for an Ethereum or Ethereum Classic based startup. Or some other crypto, who knows.

My goal is to co-found a startup so I can get crypto assets and even fiat money for the compensation of my work.

My skills include many programming languages and business skills. I have a university degree in computer science if that matters.

And the most important thing is that I believe in this crypto stuff.

So, where to find like minded people to join forces with?


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

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

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

My question is, what does this number represent? From what I've gathered, it means set the target such that there's a 1/1024 chance in finding a hash that meets the target.


texts: How to fund Ethereum address relatively anonymously? (breaking a link with an already established address)

texts:
I want to deploy smart contract.

I just don't want people inspecting the code on Etherscan to see what crappy ICOs I've sent my ETH back in 2017...

Some options coming to mind:

use Shapeshift
withdraw ETH from an exchange with high volume
use a mixer: https://www.privcoin.io/ethereum/
use faucet, solve some captchas, get "free" ETH, any amount should be sufficient to deploy the contract (set very low gas price)

Via: https://www.bloomberg.com/features/2017-the-ether-thief/

  But where did the original money to fund the attack come from? To interact with the ethereum blockchain, every contract must be funded by an amount of ether. This attack contract was funded by two addresses, but tracing it further back becomes tricky. That’s because the second address used an exchange called ShapeShift to send 52 ether into its account on June 14. ShapeShift doesn’t collect any information on its users and says it turns one virtual currency, such as bitcoin, into another, like ether, in less than 10 seconds. While there are valid reasons for using ShapeShift, it’s also a great way to launder digital assets and cover your tracks.

Chances are I'll send some Monero (XMR) to ShapeShift. Any better ideas?


texts: Where can I find ERC20 token faucets for testing?

texts:
I want to use the Ethereum test network to test token transfers and such, but I can't find any token faucet or anything like it so I can't try out things. Google didn't show anything, only Ethereum faucets.

If anyone can point me in the right direction I will be very grateful.

Thanks


texts: Cannot load pre-sale Ethereum into Wallet

texts:
I purchased pre-sale Ether and stayed on the sidelines until today. I downloaded the Win64 wallet installer from GitHub and installed on Windows 10.  It's running and syncing to the network.

It has a drop-box for the pre-sale ether wallet .json file.  I drop it there - enter the password, the import starts, the logo goes through cool graphics - then the wallet just crashes - disappears.  No process left.

Any thoughts?

Thanks


texts: How often Geth/Parity access the archive chain files? Can I store remote?

texts:
I'm running a full archive node to receive and send funds (ETH & other tokens also). The size of the blockchain is very large, so I'm thinking about storing it remotely and mount as an sshfs network drive. (mounting a Sia storage with repertory hmmm, will be very sexy)
Is it fast enough, or that's a very bad idea? Parity? Geth? What's about other coins (for example Bitcoin)?


texts: Geth --dev mode; define reward account for mining

texts:
If I set up a development testnet on geth and start mining, what account number gets the rewards?

What command can I use to define the mining account?

Console1:

geth --dev

Console2:

geth --dev attach
> miner.start()
true
>

In console 1 I get messages like:

I0930 11:14:56.732449 miner/worker.go:339] ??  Mined block (#10 / 4486bfb7). Wait 5 blocks for confirmation

Should the ?? be an address? What command can I use to define the mining account?


texts:
While trying to configure parity using the toml file (Tom's Obvious, Minimal Language), I stumbled on this error -

$ parity --config /data/parity/node.toml
Loading config file from /data/parity/node.toml
There was an error reading your config file at: /data/parity/node.toml
stream did not contain valid UTF-8


texts: Why is Infura showing less total transactions than it has currently?

texts:
I am using Infura for Mainnet/Testnet and connect web3.js API from browser. The problem is that Infura is showing around 10 transactions less than what I see in etherscan. I want to know total transaction to calculate nonce.
Now, I am aware that there might be syncing issue in Infura temporarily. But, It seems it has latest block as Etherscan

I am using web3.eth.getTransactionCount() function to get Total Transactions of an address.
Any thoughts on this will be appreciated.


texts: How can there be a balance for an ERC721 contract?

texts:
Look at this implementation, I can see that ERC721 contracts keep track of an owner (identified by its address) for each single token (identified by its token ID, a 256 bit number):

mapping (uint256 => address) internal tokenOwner;

So when there's a transfer, from, to AND a token ID have to be provided. So far so good.

What I don't understand is the semantics of the balance operation.

  /**
   * @dev Returns the number of NFTs owned by `_owner`. NFTs assigned to the zero address are
   * considered invalid, and this function throws for queries about the     zero address.
   * @param _owner Address for whom to query the balance.
   */
  function balanceOf(
    address _owner
  )
    external
    view
    returns (uint256)
  {
    require(_owner != address(0));
    return ownerToNFTokenCount[_owner];
  }

If each token is non-fungible and therefore by definition unique, then how can there be more than one of each?   I.e. what does it mean when the balance function returns more than 1?


texts: "truffle init" not working after installing

texts:
After I install truffle with:

$ npm install -g truffle

And get:

/usr/local/Cellar/node/12.5.0/bin/truffle -> /usr/local/Cellar/node/12.5.0/lib/node_modules/truffle/build/cli.bundled.js
truffle@5.0.26 postinstall /usr/local/Cellar/node/12.5.0/lib/node_modules/truffle
node ./scripts/postinstall.js
-Fetching solc version list from solc-bin. Attempt #1
+truffle@5.0.26
updated 1 package in 4.593s

I then can't run "truffle init", this is the error I get:

-bash: truffle: command not found

I am running Node v.12.5.0 and Npm v.6.9.0
What do I need to do to be able to run "truffle init"? I have been searching to no avail.


texts: How to trace the line where a tx failed in truffle tests?

texts:
I know about 0x's sol-compiler and sol-trace. I used them before and they do exactly what I'm looking for, but these modules bring significant overhead when used with truffle. Check out this file to see why.
Is there a native way to do this with truffle?


texts: how do i fix Expected primary expression error

texts:
Expected primary expression.
            j* = 10;
               ^

$ truffle migrate
Error parsing C:\Users\Welcome\Downloads\ethereum-dapp\contracts\Integers.sol: ParsedContract.sol:29:16: ParserError: Expected primary expression.
            j* = 10;
               ^
Compilation failed. See above.


texts:
I am trying to send transaction to a contract, but my transactions is not getting mined. For troubleshooting, I tried various gas prices, with same nonce:

25 wei (0.000000025 Gwei)
22 wei (0.000000022 Gwei)
20 wei (0.00000002 Gwei)
10 wei (0.00000001 Gwei)

But none of them are getting mined. I am expecting transaction to return a status, either success or a failure, but they remain pending.


texts: I need to understand a line of code inside a contract => startTime: _startTime == 0 ? currentTime() : _startTime

texts:
I am reading a contract from this location :
https://gist.github.com/rstormsf/7cfb0c6b7a835c0c67b4a394b4fd9383
I am not able to understand the logic in the code line 72
startTime: _startTime == 0 ? currentTime() : _startTime,

Can somebody please explain ?
Thanks


texts:
I have simple smart contract

pragma solidity ^0.4.17;

contract Inbox {
    string public message;

    constructor()  public payable {
        message = "Hi there!";
    }

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

I've deployed it to my local py-evm instance. I tried to execute message() method. I com do following:

vm = chain.get_vm()

nonce = vm.state.account_db.get_nonce(SENDER)

vm_tx = vm.create_unsigned_transaction(
         nonce=nonce,
         gas_price=gasprice,
         gas=startgas,
         to=decode_hex('febb9c06ccc7d378059c03f0c50f848c39d96fb6'),
         value=value,
         data=payload,
     )
signed_tx = vm_tx.as_signed_transaction(SENDER_PRIVATE_KEY)
new_block, receipt, computation = chain.apply_transaction(signed_tx)

and in computation.output I got:
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\tHi there!\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'

I can see "Hi there!" but why there are extra bytes? How to get clean output?


texts: Remix always throws the error: exceeds block gas limit

texts:
Dear Ethereum developers.

I started to learn Solidity this week and am trying to deploy a contract via Remix, but this doesn't really work.

Running environment is set as Web3 Provider.

(Because the book I am currently reading for studying Solidity asks me to do so, so I can learn about web3.js as well)

Here is my code:

pragma solidity ^0.4.24;
contract MyToken {
    string public name;
    string public symbol;
    uint8 public decimals;

    mapping (address => uint256) public balanceOf;
    event Transfer(address _from, address _to, uint _value);

    constructor(string tokenName, string tokenSymbol, uint8 decimalUnits, uint256 initialSupply) public {
        name = tokenName;
        symbol = tokenSymbol;
        decimals = decimalUnits;
        balanceOf[msg.sender] = initialSupply;
        }

    function transfer(address _to, uint256 _value) public {
        require(_value <= balanceOf[msg.sender]);
        require(balanceOf[_to] + _value >= balanceOf[_to]);
        balanceOf[msg.sender] -= _value;
        balanceOf[_to] += _value;
        emit Transfer(msg.sender, _to, _value);
    }
}

This is the whole code of my contract, and when I deploy this onto Remix then it keeps returning an error saying "it exceeds block gas limit".

I have adjusted the value of gas limit hundreds times and retried but it still doesn't work.

I also searched similar questions from this site and on the other sites too but nothing really helped.

One of my friends found that this contract can be deployed on Metamask with gas limit 404941 with value 1 gwei, so I have tried the same on Remix but it doesn't work.

Any help I can use?

Thanks in advance!


texts: Convert array with hex datatype to readable format using truffle console

texts:
I am new to ethereum. I am using truffle to develop, deploy and interact with my solidity contract.I have a function in my contract which is as follows:

  function getResult(bytes32 name) public view returns (bytes32, bytes32,uint) {
        return (name,nameArray[name].pName,pCount[name]);
    }

Using truffle console I accessed it as follows:

var result = poe.getResult('QWERTY');

**poe: is the contract instance

the output of the function is:

[ '0x5157455254590000000000000000000000000000000000000000000000000000',
  '0x456c656331000000000000000000000000000000000000000000000000000000',
  BigNumber { s: 1, e: 0, c: [ 1 ] } ]

Can anyone help me in converting the output to a readable format(hex to string and bignumber to integer)

Any leads would be appreciated.
Thank you!!


texts: Sending token from and to smart contract

texts:
I created smart contract where I send token from contract to senders wallet.
I also want contract to receive tokens and send back ETH. In what way can I find out how much tokens sender sends to smart contract?


texts: Is better to use a single smart contract or one for each bet?

texts: Let's suppose I want to create a Virtual Coin in a "bet on everithing" ecosystem. An use can bet some coin on some events, some other user can counter bet, a mechanism for solve the bet suppose it is in place. My question is ( really newbie here ), should I create a smart contract just for the coin in this ecosystem, and each bet should I deploy a new contract, or can each bet and counterbet, resolution mechanism etc be in a single smart contract?


texts:
From my brief exposure to the concept, zkSNARKs seems to be a form of zero-knowledge cryptography.

  What can zkSNARKs bring to the table for Ethereum?

I have looked at projects like this but still fail to grasp it's applicability to the platform.


texts: What are my blockchain options when I have terabytes of data to access?

texts:
I have several terabytes of relatively simple data, not much more complicated than the ledger storing ids, timestamps, simple metadata.

I understand ETH storage costs are rather expensive.

What are my options for storing as much data as possible off-chain to minimize costs, but still getting distributed, and fault-tolerant benefits of being on-chain, using on-chain for smart contracting on the data?  How do I search for and understand strategies for doing this?

If my metadata is rather sparse, say not much more than integers and a couple other ids, and still terabytes in size, is this even possible, or is a blockchain solution a bad fit?


texts: Connecting to a blockchain started with ganache-cli with Ganache GUI

texts:
I start a blockchain with ganache-cli, then I create a workspace in Ganache GUI the same seed phrase and port, but I keep getting this error in Ganache:

I get and error

  this port is being used by another application

Is it possible to connect with the GUI to a running blockchain, if so how do I do this?


texts: What is the fastest way to check the sign of an int256 in Solidity?

texts:
Given an int256 number n, I want to get the sign of n:

If n is positive, get 1
If n is negative, get -1
If n is 0, get 0

I know that I can do:
function foo(int256 x) external {
    if (x > 0) {
        // ...
    } else if (x < 0) {
        // ...
    } else {
        // ...
    }
}

But this introduces three logical branches in my code, which means gas.
Is there a faster approach? Maybe via some sort of bit manipulation?


texts: Variadic / optional function params in solidity ?

texts:
I didn't find a way to have optional arguments in the solidity docs so i'm wondering if anyone has found a working around to this ?

All i can think of are internal functions with " empty " params  but that's going to be ugly very fast.

As anyone found a working around to this ?


texts: Lost my private keys and Json or keystore file

texts: I made an account on Ether wallet and I lost my private keys and Json or keystore file. I only have Public keys. Is there any ways to recover my account?


texts:
Try to run my contract in remix JavaScriptVM and faced with error.
Contract code:

...
/**
 * @title Burnable Token
 * @dev Token that can be irreversibly burned (destroyed).
 */
contract BurnableToken is Standard223Token {

    /**
     * @dev Burns a specific amount of tokens.
     * @param _value The amount of token to be burned.
     */
    function burn(uint _value) public {
        require(_value > 0);
        require(_value <= balances[msg.sender]);
        address burner = msg.sender;
        balances[burner] = balances[burner].sub(_value);
        totalSupply = totalSupply.sub(_value);
        Burn(burner, _value);
    }

    function burnAll() public {
        address burner = msg.sender;
        totalSupply = totalSupply.sub(balances[burner]);
        Burn(burner, balances[burner]);
        balances[burner] = 0;
    }

    event Burn(address indexed burner, uint indexed value);

}

contract MFC_Token is BurnableToken {

    string public constant name = "MFC Coin Token";

    string public constant symbol = "MFC";

    uint32 public constant decimals = 18;

    uint256 public constant INITIAL_SUPPLY = 500000000000000000000000000;

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

}

contract ICO_controller is Ownable, ERC223Receiver {

    using SafeMath for uint256;
    // The token being sold
    MFC_Token public token = new MFC_Token();
    ...
}

I don't cite all the code contracts here because it's very large.
In my opinion - the main thing here is that the token standard ERC223, and the error is obtained on the line, which I last cited in the contract ICO_controller. The error occurs after the token constructor is executed.
Opcode which indicates the debugger before the revert happens:

00025 DUP1
00026 ISZERO
00027 ISZERO
00028 PUSH3 000025
00032 JUMPI
00033 PUSH1 00
00035 DUP1
00036 REVERT

To be honest, I don't really understand how to use debagger Remix correctly, maybe the error is obvious, but I don't see it.
Tell me, what's wrong?

If I can still recommend good materials on using the debugger Remix, I would be very grateful.

If you do not have some data - write, I will add.


texts:
So Solidity is contract-oriented, which is similar to OOP. However, there are some differences I'm realizing now. My problem is such that I have a contract called Agorum, which represents contracts of type Agorum. I have another contract called Payroll. An Agorum contract has a Payroll. While programming this, I was thinking in an OOP paradigm, so I thought, this is just a case of composition. So in my code for Agorum.sol I have:
contract Agorum {
  string public name;
  Payroll public payroll;
}

Payroll then has it's own state variables and functions and whatnot. However, when I tried deploying the contracts, it said that the deployment expected parameters for the constructor, which it was missing (the payroll contract has a constructor accepting 5 args). However, this wouldn't make sense since the arguments are passed by the user.
My question is, what' the best way to avoid this error? Should I remove the constructor and have a different way to instantiate a contract? Or should I stop thinking about "composition", and instead just have a struct Payroll within Agorum.sol as another state variable?
Additionally, what does type Payroll really represent, e.g. if I returned it? Is the address of the contract?


texts:
I CHANGE THIS:

modifier onlyOwner() {
    if (msg.sender != owner) {
      throw;
    }
    _;
  }

TO THIS:

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

And i receive this error in REMIX:
Parsererror : expected identifier but got ";"

_;

Please help help

thanks


texts: Blocking an application untill metamask shows the transaction is complete

texts: I’m creating a DAPP where I’m using Metamask for submitting the transaction. I have a requirement where when a user accepts/submits the transaction, a modal needs to appear on the page, blocking the application(so that the user can’t perform any other transaction) untill the transaction is complete/mined. I know about the modal part, but how can I block the application till the transaction is complete?


texts: Could I update Geth without stopping running Geth? And how could I update Geth without removing data?

texts: I'm using Geth version 1.8.17-stable on ubuntu server and syncing with "fast" mode. I want to upgrade Geth to v1.8.23 to sync blocks generated after the hard fork. But I couldn't find how to upgrade it like my question. I'm not sure that I have to stop running Geth or not. And if I have to stop Geth and update it, then how could I do it without removing synced data? I thought if I stop Geth, and run it again, I would have to delete the data because it crashes with the giving sort of message "Your database is not clean". (I'm not sure with the log message but it was like this by my memory.)


texts: Get order of magnitude of an integer in solidity

texts:
What is a way of getting the order of magnitude of an integer (or float) in a solidity contract?

e.g. such that

MyContract.getOrderMag(2564)   returns 3
MyContract.getOrderMag(987)   returns 2
MyContract.getOrderMag(2.3e76)   returns 76

Ideally in the least gas using way possible...

Here's what I have:

pragma solidity ^0.4.6;
contract Magger {
    function getOrderMag(int256 input) constant returns (int256){
        int counter=0;
        int temp = input;
        while((temp/10)>1){
            temp = temp/10;
            counter++;
        }
        return counter;
    }
}

This doesn't work with negative numbers or, as pointed out by @RichardHorrocks, when input is 10.


texts:
I'm testing my contract on Ropsten network.
For this i've launched geth in docker:

> command: --verbosity 4 -rpc --ipcdisable --rpcaddr "0.0.0.0" --rpccorsdomain "*"  --syncmode "fast"  --rpcapi="db,personal,eth,net,web3,admin" --cache=${CACHE_SIZE:-512} --testnet

I'm able to connect to it with:

  get attach http://127.0.0.1:8545

When trying to test my contract in Remix i've changed environment:

How can i set gas price to debug my smart contract calls?
Should i change my geth run arguments? Should i unlock my coinbase account before smart contract method calls?

BTW i've found that it working incorrectly. I loaded previously deployed in ropsten smart contract and i expect some specific result for method call (just reading current value). I have expected result with Metamask switched to Ropsten instead of geth. With geth i always get default value (0).


texts: Reset balance in truffle test accounts after each test

texts:
I am writing unit tests for a function where I am sending tokens from one address to other in exchange of ether. I ran these tests a few times and now I am left with 0 ether in one account. I tried searching online but couldn't find a way to reset the balances.

Is there a way to reset the balance back to 100 before and after running those tests.
I am using truffle js to write the tests! http://truffleframework.com/docs/getting_started/javascript-tests


texts: Is there anyway a smart contract creator can put a limit on the gasPrice(gwei) for a transaction?

texts: I am looking at the possibility of creating a custom token on the Ethereum network & wanted to know if there is a way if i can put an limit on the gasPrice in order to prevent the so called "gas wars" ?


texts:
According to my understanding ERC721 smart contracts hold a list a "NFTs/owners" the same way ERC20 smart contracts hold a list of "owners/token balance".
NFT are digital assets that can be uploaded to those contracts and "assigned" to a given owner, that can later re-assign them to another owner (selling the NFT).
What is then preventing someone from serializing the same NFT and uploading it multiple times into the same smart contract? or What is preventing someone from uploading the same NFT to multiple ERC721 smart contracts? or even worse, what is preventing someone from uploading the same NFT to different blokchains?
If that is indeed possible then there is no actual guarantee that NFTs are unique and ownership would not mean anything...
I am very probably missing something...


texts: TypeError: Web3.providers.WebsocketProvider is not a constructor?

texts:
Trying to connect to a geth machine over websocket?
JS code.

var Web3=require('web3');
var web3 = new Web3(new
Web3.providers.WebsocketProvider('ws://10.244.5.43:8546'));
console.log(web3.isConnected());

Not sure how to connect using WebSocket?


texts: constructor arguments require 'memory' as a data location but not uint?

texts:
Ok I am trying to figure out why Remix IDE is throwing an error saying the

  Data location 'memory' must be given.....

for a string argument but the uint arguments don't throw any error?

pragma solidity >=0.4.25 <0.6.0;

contract Monopoly {

string public player1;
uint32 public player2;
uint32 public player3;

    constructor(string memory _player1, uint32 _player2, uint32 _player3) public {
    player1 = _player1;
    player2 = _player2;
    player3 = _player3;
    }
}


texts: What effect does Nvidia hash rate limiting have on power efficiency?

texts:
NVidia is rate limiting some cards to 50% of possible hashrate. What effect does this have on power efficiency?
I can imagine it reducing power efficiency (same power, but lower hashrate). On the other hand I could imagine it increase power efficiency (by cutting voltage when it detects hashing, halving performance but doubling power efficiency). I haven't bought a card yet so I cannot test.


texts: Is it possible to do vote and participate in crowd-sale using Forwarder address?

texts:
Currently, I am using Metamask (Ropsten TestNet).
And I want to implement one voting cum crowd-sale process, the scenario is given below:

Want to make the voting process in this if Voter is voted to one choice it has to transfer one token from own address to voting destination address which is predefined.
Right now I am assigning few tokens to that voter(forwarder / external address). But the problem is, to vote successfully I have to make that voter my msg.sender which is not applicable for metamask, because forwarder is created by Multisig wallet, not by metamask.


texts: Are there still uncles with proof-of-stake?

texts: As I understand, with PoS the selected validator is determined within predictable time windows. Does this mean that uncles will be gone for PoS?


texts: how to parse the value returned by truffle ?

texts:
I need the value of string. Also, what is the significance of s , e , c .

truffle(development)> x.then(function(result) {
     console.log(result[4]);});}});
    undefined
    truffle(development)>
{ [String: '100000000000000000000'] s: 1, e: 20, c: [ 1000000 ] }

I am able to fetch result[4].s or result[4].e

Sorry if this is a simple question. I am very new to javascript environment.


texts: Sending an ethereum transaction with ethers.js and metamask

texts:
I've tried two different ways, and have looked through ethers.js documentation, and I just haven't been able to figure it out.  Does anyone have any suggestions?  This is in a browser.

trans(web3,ethers);

async function trans(web3,ethers,provider){
    if (typeof web3 !== 'undefined') {
        var web3Provider = new ethers.providers.Web3Provider(web3.currentProvider);
        var signer = web3Provider.getSigner();

        const parameters = [
            {
              gasLimit: "0x2710",
              gasPrice: ethers.utils.parseUnits("1.0", "gwei").toHexString(),

              from: this.state.provider._web3Provider.selectedAddress,
              to: this.state.provider._web3Provider.selectedAddress,
              value: 0,
              data: "0x1"
            }
          ];

          const payload = {
            method: "eth_sendTransaction",
            params: parameters,
            from: this.state.provider._web3Provider.selectedAddress
          };

          this.state.provider._web3Provider.sendAsync(payload, function(
            err,
            response
          ) {
            if (err) {
              console.log(err);
            } else {
              console.log(response.result);
            }
          });

and this way...

trans(web3,ethers);

async function trans(web3,ethers,provider){
    if (typeof web3 !== 'undefined') {
        var web3Provider = new ethers.providers.Web3Provider(web3.currentProvider);
        var signer = web3Provider.getSigner();
        let tx = await signer.sendTransaction({
                to: 0xC046B25B3B5F960E1D7004499FBd8dc4C1BDe2f4,
                value: 1000,
        });
        let signature = await signer.signMessage("Hello world");
        // web3Provider.getBalance("0x9Ff548c1B3eA3dd123AFE39C759dDA548009B6C8").then(function(balance) {
        //   var etherString = ethers.utils.formatEther(balance);
        //   console.log("Balance: " + etherString);
        // });
      }
}


texts: Ethereum node stuck on Imported new state entries

texts:
I setup a full ethereum node using the following command geth --syncmode fast --datadir /mnt --ws, it looks like it's done downloading the chain but i noticed that i can't perform some requests using web3. Here is the output of the node:
INFO [03-04|20:56:45.124] Imported new state entries count=768 elapsed=8.657ms processed=158411848 pending=357045 trieretry=0 coderetry=0 duplicate=2061 unexpected=11956

I think it means that the node is still syncing. How long should it take?


texts: Do my outgoing gas fees of a single transaction increase if my sending wallet contains ETH made up of many small transactions?

texts:
I'm still learning about how ethereum calculates fees, and I wondered if I would have to pay more to send ethereum from my wallet if my wallet received smaller transactions as opposed to a single large transaction.
For example, if I received 100 payments of 0.01 ETH, my wallet would contain 1 ETH. If I sent that single ETH to another wallet, would my single transaction be relatively large since it would have to reference 100 previous transactions? Would the fee be significantly less if my wallet had instead received a single payment of 1 ETH, which I then used to send to another wallet?
I'm mainly asking because I realize I can define a minimum payment threshold from my mining pool. Assuming that the pool transaction fee is a standard percentage (ie there isn't a static fee), it wouldn't matter whether I was paid every day or once every few weeks, as my main wallet would end up with the same amount regardless.
However, if I then had to pay more in gas when I wanted to actually use those funds, I would be better off receiving larger chunks of ETH so that my later transactions would have fewer references, making a smaller byte-size transaction.
Is this at all accurate to how transactions work on the ethereum network? And if so, are the sizes of the transactions in those two scenarios significantly different, or miniscule enough to ignore?


texts: Is there a solution to implement this scenario?

texts:
Suppose a user1 in a network wants to change data in a smart contract function, but before this transaction is pushed to the chain the other participants of the network receives a notification saying that user1 has made changes to the function and after the other participants verify this changes only then the transaction will be pushed to the chain.
Can someone help me with this. I'm a beginner in blockchain tech.


texts: What is the state of the contract programming language LLL (Lisp-Like Language)? Is it still used and supported?


texts: got response data to nonsencical eth_call request. What is that response?


texts:
Hi i have a few questions about ETH or any other Crypto currency for that matter but maily ETH as im unsure as to the methods available.

I will address this in the most likley Situation..

I make a Paper wallet myself on lets say EthWallet , online...

I print out my Paper wallet and seal it in a laminator.

Later on in Life ETH Price rockets up and my paper wallet is now worth a Cool 5k

So i decide that i will withdraw my ETH.

I get my Paper wallet and everything is fine. Iv got the Keys.

So i go online to find the EthWallet website.

To my Horror, the website is no longer active...

Now what do i do.

How can i withdraw my ETH now the website where i made the Wallets has gone...

I still have the KEYS though so presumibly i can goto any other ETH withdrawel method ot withdraw it...

(What Are My Options)

I am hoping that as long as i have my Keys (The wallet) i will be able to find any ETH app or platform or wallet and transfare my coin into that wallet from my paper wallet using the private keys.. (am i correct in thinking this) or is there something i am missing...

Thanks for any replys guys...


texts: What happens when a payable function throws

texts:
Using Solidity 0.4.18. If I send ether to a payable function, and the function does some of its stuff, and then throws (via require), what happens to the ether that was sent to it? Does the ether stay in the contract?

Edit: I know that "throw" reverts transactions - I wanted to know whether "require" does the same.


texts:
Here's an example:

  return (sha3(newOwner) & 0xff) == (bytes20(tokenAddress) & 0xff);

I know how & works on bits:

1111
&
0101
----
0101

What does it evaluates to here:

0xb794f5ea0ba39494ce839613fffba74279579268
&
0xff
----
????


texts: Getting my ETH back after Sending transaction

texts:
I took the plunge and bought some ETH without really knowing how it really worked. I like to learn while doing!
I reached a point where I tried to send ETH from my Exodus Wallet into Ethernet Wallet (which I was told it was named MIST, a name I never saw), but when accessing my EW, it starts to Sync (I assume that it needs to be synced in order to see my transaction in it).
The thing is that it takes a million years to sync, and takes a lot of space in the disk. I want to go back to where I started (i.e. get the ETH back to Exodus).
1) Is this possible? How can I retrieve the ETH?
2) Do all the wallets take this long to sync? Or is it just a precautionary (?) meassure to make EW more secure?
Thanks in advance!
Julio


texts: Is data inputted as a parameter for a smart contract function visible?

texts:
Let's say I have something like this:

bytes32 person;

function registerPerson(address _person) public {
   bytes32 x;
   x = sha256(abi.encodePacked(_person));
   person = x;
}

For privacy reasons, I want to store that "_person" element as a hash, so that people don't know what address it is. I know that the bytes32 value can be viewed, but now I'm wondering if there is any way people can see the raw "_person" input?

In my opinion, the answer is a no, but using Remix, it shows the inputs made to a function, and now I'm wondering if that's just the compiler's functionality for debugging or if raw input is actually visible somewhere.

Thanks a lot.


texts: How to get all tokens amount separately held on Ethereum address

texts:
I am working on a blockchain project related to Ethereum, Binance Network, etc.
The front end is React.js.
I need to get the total balance of user's wallet address (all tokens in that wallet address).
I know that I can get the balance of a specific token with that token address.
But if I don't know which tokens are in user's wallet, how can I get total amount?
Etherscan displays a list of tokens  held by  every addresses as a dropdown. But how to get that list in my app?


texts: Is it possible to reduce the amount of gas for transferring ether to multi accounts via smart contract?

texts:
I want to transfer the same amount of ether to 100 different addresses.
I'd like to reduce the amount of gas for it.

I tried to do it with such contract:

contract MultiTransfer {

  function transferEther(uint amount, address[] users) public payable {
    require(amount * users.length == msg.value);
    for (uint i = 0; i < users.length; i++) {
      users[i].transfer(amount);
    }
  }

}

As result, it requires 3422830 gas for tx with 100 addresses. ~ 34K gas per 1 address.
But it costs only 21K if transfer ether directly without contracts.

So smart contracts can't help to reduce gas for this task?


texts: (network/artifact mismatch) error when running truffle's react repo

texts: I used truffle unbox react to download the starter repo on my Windows 10 pc. I can run testrpc, truffle compile, and truffle migrate without any compilation errors. When I run the code in my browser a number value doesn't change (which it should if the contracts are working) and I get a console error: "Uncaught (in promise) Error: SimpleStorage has not been deployed to detected network (network/artifact mismatch)". Truffle test seems to work fine.


texts: Remix IDE : Passing array of address and array of uint

texts:
Working on the remix IDE, i cant seem to pass an array of addresses along with an array of uint as parameter to a function. It runs just fine on ethfiddle though and behaves exactly how i expected it to.

It keeps saying on remix, syntax error unexpected token at JSON position 3.

How do I call and test the function set with an array of address and array of value.

here's the code snippet and I am using solidity version 0.5.1 :

contract SimpleStore {
  uint public value;
  address public addr;

  function set(address[] _addr , uint[] _value) public {
    value = _value[0];
    addr = _addr[0];
  }
  function get() public constant returns (uint) {
    return value;
  }
}

I have tried, with quotes without quotes with square brackets without square bracks :( -thanks in advance.


texts: Smart Contract Deposits From Multiple Users

texts:
I want to create a smart contract which will allow multiple users to deposit / withdraw funds. My first approach was to simply have one contract address which will store the funds of all users and a mapping which will track individual balances of each of the users, however this would prevent me from being able to identify deposits for particular users, as they would all be depositing to the same address.

In order to overcome this, I want the smart contract to generate a child contract for each user to which that user can deposit funds to. The problem is that deploying this child contract will cost gas. I don't want the user to pay this gas cost, however if I have the parent contract refund the users gas costs, a potential attack arises when someone can create multiple accounts in order to have the contract spend it's whole balance on this task. How can I overcome this?


texts: Can a Smart Contract write on the blockchain a transaction containing not only value but also data between two EOAs?

texts: I need to implement one (or more if necessary) smart contract(s) that store the information of a pending transaction (sleeping transaction) between two EOAs and generate (wake up) the transaction when a particular action happens. Is this operation possible with solidity? I prefer not to demand the computation to an app (until it is possible)


texts:
Is it possible to have a struct inside a struct?
I am not sure about the data type internals, but I was basically trying to do something like (pseudo-code):

library IpfsUtils {

  struct IpfsHash {
    bytes32 hash;
    uint8 hashFunction;
    uint8 hashSize;
  }

  function insert(bytes _hash) {}
  function combine() {}
}

contract Members {

  struct Member {
     IpfsUtils.IpfsHash profile;
     uint id;
  }
  mapping (address => Member) public members;

  function addMember(uint id, bytes profileHash) {
    Member m = members[msg.sender];
    m.id = id;
    m.profile.insert(profileHash);
  }
}

I'm trying to store an IPFS hash with fixed length data types and I thought about extracting the storage of the ipfs hash function, size and the actual bytes32 hash into its own struct.

Can someone point me somewhere to learn more about the internals?

EDIT:
nested structs are possible. BUT the the mapping (here members) can not be public causing the following error: TypeError: Internal type is not allowed for public state variable


texts: Why estimateGas return 21001 instead 21000?

texts:
For example

  web3.eth.estimateGas({from: eth.coinbase, to: eth.accounts[1], amount: web3.toWei(1, "ether")})

return 21001, but not 21000, so why?


texts:
I am absolutely new to this stuff, please help on below error, shall be thankful

ubuntu@ip-172-31-18-75:~$ geth --testnet

  I1025 10:12:44.731831 ethdb/database.go:83] Alloted 128MB cache and
  1024 file handles to /home/ubuntu/.ethereum/testnet/chaindata Fatal:
  Could not open database: write
  /home/ubuntu/.ethereum/testnet/chaindata/111615.ldb: no space left on
  device


texts: How to decode event log info from contract?

texts:
I have structure of event in my Solidity code like event test(address investor, uint256 priceinWei).

I make a request to etherscan to get all logs from contract on specific addres and get

{
   'address':'...',
   'topics':[
      '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
      '0x0000000000000000000000001111111111111111111111111111111111111111',
      '0x000000000000000000000000409fefe0212a75d8c117ac834123d462bce9635c'
   ],
   'data':'0x000000000000000000000000000000000000000000000012f94bfef30bf32b8d',
   'blockNumber':'...',
   'timeStamp':'....',
   'gasPrice':'0x4a817c800',
   'gasUsed':'0x182b7',
   'logIndex':'0x8',
   'transactionHash':'...',
   'transactionIndex':'0xc'
}

Question: How can I get address and price from it. Should I decode "data"? Instead ... I of course got values, just don't want to show it.


texts:
My ETH transaction is stuck.  Etherscan is showing PENDING. MetaMask is showing FAILED.  I tried to cancel it multiple times using MyEtherWallet but when I click on Generate Transaction, I don't see any Signed string to copy.
PENDING TX
https://etherscan.io/tx/0x95750627fb8293dfad20146783329aef29138ae07a626027e54450fb683ede80


texts: Ethereum Wallet (Mist) on Win7: connect via http proxy to JSON RPC Endpoint in Internet

texts:
I have the Ethereum Wallet (Mist) running on a Win7 client. The access to internet is only allowed via the corporate's http proxy server. Is it possible to configure Mist to use the http proxy for Internet connections?

I tried setting the environment variable http_proxy, but it didn't help.


texts: How to avoid fluctuating value of a token against currency

texts: How can you use a smart contract to account for currency-originated payments (e.g. mortgage) without asking the homeowner to risk the fluctuating value of a token by holding it?  I know Everex has the principle of currency to currency exchange so your token is only held for the transaction only, which seems ideal, are there other ways around the token valuation problem for recurring payments?


texts: Does verification of a world state require downloading the whole ethereum blockchain?

texts:
Lets say I'm a new node on the Ethereum network, I download a world state of 500 blocks ago and I download the blockchain from that point to present (500 blocks).
Can I verify that the world state I've downloaded is accurate/untampered?
To give a small comparison with Bitcoin: in Bitcoin this is impossible. To verify a downloaded UTXO-state, one NEEDS the full chain starting with the genesis block (initial block download).
I would like to know why it cannot be verified or why it can be verified.
Please also say whether your answer is about Ethereum 1.0 or Ethereum 2.0


texts: What is the proper use of inline assembly revert, and how do I retrieve returndata passed to it?

texts:
I stumbled on this EIP which describes the revert opcode that looks like it allows you to "throw" more specific errors by passing a memory pointer with the opcode (also described briefly in the docs). Note in the docs that return and revert receive the same input format.

So far, I have this function as an example:

function throwError(bytes _error) constant returns (bytes32) {
    assembly {
        calldatacopy(0xff, 0, calldatasize)
        return(add(0xff, 68), 32)
    }
}

It works as expected, copying the string passed as function parameter and returning it. However, when I change return to revert like this:

function throwError(bytes _error) constant returns (bytes32) {
    assembly {
        calldatacopy(0xff, 0, calldatasize)
        revert(add(0xff, 68), 32)
    }
}

All I get back is a normal invalid opcode error from web3, truffle, and remix when testing with testrpc. I don't see any reason why this wouldn't work; is there something I'm missing here?


texts:
I'm curious about the origin of the RLPx protocol suite's name and the ÐΞV's name, but I cannot find information in the official documentation and RLPx documentation.

RLPx

I read in a blog (not an official one without source, therefore I ask) that RLPx stand for Recursive Lenght Prefix eXtended.


texts: Transfer erc721 token to another address

texts:
I'm currently using transferFrom / safeTransferFrom to transfer the token to another address but I encounter this error.

Error:

Error: invalid address (arg="to", coderType="address", value="0x0Dxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", version=4.0.30)

Upon checking the solidity code of openzeppelin's ERC721.sol the inputs for safeTransferFrom is from, to, tokenId.

 function safeTransferFrom(address from, address to, uint256 tokenId) public {
        safeTransferFrom(from, to, tokenId, "");
    }

Here's the part of code where I perform the transfer web3

const nonce = await web3.eth.getTransactionCount(source)
const contract = new web3.eth.Contract(abi, contractAddress);

const data = await contract.methods.safeTransferFrom(source, destination, 1).encodeABI();

const gasPriceGwei = 3;
const gasLimit = 3000000;
const chainId = 3;
const privateKey = new Buffer.from(addressKey, 'hex')

const rawTransaction = {
  'nonce': `0x${nonce.toString(16)}`,
  'gasPrice': web3.utils.toHex(gasPriceGwei * 1e9),
  'gasLimit': web3.utils.toHex(gasLimit),
  'to': contractAddress,
  'value': '0x00',
  'data': data,
  'chainId': chainId
}

Additional info, when I change the destination address to contract address it is successfully transferred, but transferred to itself.


texts: How do Ethereum clients cope with future blocks?

texts:
According to the Yellow Paper, the restrictions on block timestamps, Hs, are,

Hs ∈ ℙ256 (Mathematical term #35) ― ①,
and Hs > P(H)Hs (Mathematical term #48 and #56) ― ②,

where P(H)Hs is the parent (previous) block's timestamp, and ℙ256 is a set of natural numbers less than 2256.

It seems the Yellow Paper allows future blocks (blocks that have a future timestamp) ― ③, as there's no restriction apart from ① and ②.

But how do Ethereum clients actually cope with them? Do they really accept any future blocks as the Yellow Paper allows?

I took a quick glance at the source code of geth and cpp-ethereum, and it seems ErrFutureBlock and "allowFutureBlocks" are relevant, but I couldn't fully understand what they are doing with them.

If there's something I missed or was wrong above, please let me know.


texts: How come the gas usage of an empty fallback function is not integer?

texts:
I am trying to compute the gas usage of an empty (i.e., the most basic) fallback function.

My on-chain code (compiled via Truffle 4.1.15):

pragma solidity 0.4.25;

contract MyContract {
    function() external payable {}
}

My off-chain code (executed via Truffle 4.1.15 and Ganache 6.2.5):

contract("MyContract", function(accounts) {
    it("Test", async function() {
        const myContract    = await artifacts.require("MyContract").new();
        const balanceBefore = await web3.eth.getBalance(accounts[0]);
        const response      = await web3.eth.sendTransaction({from: accounts[0], to: myContract.address, value: 1000000});
        const balanceAfter  = await web3.eth.getBalance(accounts[0]);
        const gasUsed       = balanceBefore.minus(balanceAfter).div(web3.eth.gasPrice);
        console.log("gasUsed =", gasUsed.toFixed());
    });
});

The result I get is gasUsed = 21018.00005.

I've made sure that web3.eth.gasPrice doesn't change throughout the execution (it remains 20000000000, as configured in my ganache-cli command line).

So what exactly am I missing here?

Thank you!


texts:
Assuming gas and hard drive space are not an issue, if you had a struct containing arrays how much data could you actually put into those arrays before the struct reaches its maximum size?  I am attempting to use mapping to a struct to keep track of some information and would like to understand how much I can give it before it cannot get any larger and what I can do to help keep the data record past that.
My current plan is to create a new struct that references the previous maps key once the struct is at its max size, but I don't know if that is an ideal situation yet.


texts:
I want to simulate sending multiple transactions at the same time to a smart contract and i'm wondering if, for example, sending 100 transactions from one address is the same as sending 1 transaction from 100 addresses in terms of the chance the transaction getting mined and time it would take.

I know that using only one address, the nonce will determine the order in which the transactions need to be mined. But they would all be in the transaction pool at the same time just as those singular transactions from the 100 addresses would?


texts: does it comply with ERC20 if transfer() reverts instead returning false?

texts:
As per ERC20 specification transfer returns bool:

function transfer(address _to, uint256 _value) returns (bool success);

I would prefer my token contract transfer() to revert on failure and return true on success. This way I would not have to worry that any of my contracts relying on my ERC20 is properly doing require(myToken.transfer(...))

Would this cause any issue for 3rd party contracts / applications ? Is there any which relies on a transfer which fails but they still want to perform something?

An alternative would be to create an additional safeTransfer function which calls transfer internally with require but it convolutes the tokenContract.


texts: How can I check the total gas used by a transaction?

texts:
I am trying to figure out the total gas used by a transaction. It appears gasUsed = cumulativeGasUsed but both values don't check out with the following check:

gasPrice = 100000000000
Number(currentBalance) == Number(previousBalance) + amount - (gasUsed * gasPrice)

In fact, it's off by 10000. My best guess is the internal .transfer call throws off the gasUsed value.


texts: Import accounts on Ethereum Wallet is disabled

texts:
The Import accounts option in File is disabled.
I am using the Ethereum-Wallet-linux64-0-11-1, latest version (now).
After I reinstalled the OS, I tried to import some accounts.
I copied the accounts files in /home/.ethereum/keystore.
How can I import them?
With the Wallet UI? Where can I see the commands available?
Also the wallet is stuck while synchronizing: "Waiting for blocks...".
Before it was stuck at 8 months ago so I deleted /home/.ethereum/geth to restart the synchronizing.
I kept the default Synch mode: Light.


texts:
When connecting a LES client to an Ethereum node and sending a GetProofsV2 request, I'm unable to get anything other then an empty ([]) response for the set of nodes.  I suspect I've configured my Ethereum node incorrectly.

How can I configure an Ethereum node to respond to GetProofsV2 (or GetProofs) requests?


texts: Is there any other signature mechanism like ECDSA to verify the signed message if its tampered or not?

texts:
I would like to know if there are other signature verification methods other than ECDSA, to verify the message (eg., string, number) signed by a signer.
Actually if there are alternative algorithms that can be implemented using solidity, that are most preferred than the ECDSA, to check if the sent message is correct or tampered by verifying the signer address, Which one will have the best performance based on the comparative analysis?

Could you please advice?


texts: trouble understanding the usage and calculation of INIT_HASH and precompiled contracts

texts:
I am working with pancakeswap and I was following a tutorial which just said that we need to calculated the INIT_HASH and that we can follow this link enter link description here for guidance. The link gives the following solution
import { INIT_CODE_HASH } from '../src/constants'

import { bytecode } from '@uniswap/v2-core/build/UniswapV2Pair.json'
import { keccak256 } from '@ethersproject/solidity'

const COMPUTED_INIT_CODE_HASH = keccak256(['bytes'], [`0x${bytecode}`])

which I do not understand because there is no ../src/constants folder in my truffle project. Secondly, the link also mentions pre-compiled smart contracts below which I totally do not understand as I am learning myself. So can someone guide as to what is init_hash, how will i calculate it, what is this src folder mentioned in the link, what and where are the precompiled contracts that are being mentioned and can I use the above solution in the same file where hash is needed/


texts: Who is msg.sender when calling a contract from a contract

texts: When I call a function in my contract which calls another function in another contract. In the second called contract function who is msg.sender? the contract calling the second contract or my account?


texts: transaction fails due to out of gas in mainnet

texts:
Transaction fails due to out of gas though gas used by transaction is 22.32 % . What might be the reason ? I have give enough gas : 203000 wei.

Here is the link of the transaction


texts: Can someone help me get my funds back in my possession from a contract?

texts:
So first off, buyer beware: do not mess around with gameswap.org it appears I made a mistake in doing so. Luckily I never invest more than I can stand to lose unless I really trust the project. So not too much is tied up in here but it's definitely an amount I'd put some effort in trying to get back to me.
If you take a look at the contract address for gameswap.org coin: GSWAP
https://etherscan.io/token/0xaac41EC512808d64625576EDdd580e7Ea40ef8B2
0xaac41EC512808d64625576EDdd580e7Ea40ef8B2 to search it yourself on etherscan.
You'll notice a bunch of "double" swap transfers that whenever someone unstakes their balancer pool tokens from the website a different function gets called and instead gets transfered to an account controlled by a Sablier Finance automated payout, so the second anything hits the account, it immediately gets transfered to another address. At first I thought I mightve been front runned, but after looking through a few transactions I noticed it looks like this person set it up purposefully as a scam.
Is there anyway I can interact with the contract to unstake or withdrawal my LP tokens and make sure it goes back into my possession? It looks like when I tried to unstake from the site it called Function: noRewardsWithdraw(uint256 _pid) you can see from my original transaction:
https://etherscan.io/tx/0x96e641e447080e3c3b54553ddda87c946343f93995209f26a5f3a054b1c3385e
Manual txn lookup:
0x96e641e447080e3c3b54553ddda87c946343f93995209f26a5f3a054b1c3385e
Let me know if I need to add more info, thank you in advance for any insight and knowledge of blockchain usage that I gain from this and hopefully my funds as well.


texts: ipfs {ls||cat||get}  halts, while gateway.ipfs shows the file right away

texts:
Please note that I am sorry if this question is based on ipfs, where I am using integrated to Ethereum but in a very basic manner.

In this following example: a client stores a ipfs hash value inside a contract at ethereum. Server would access to already stored ipfs hash value by using the same contract. When ipfs hash value is obtained at the server, server node could obtain the ipfs file by using ipfs {ls||cat||get}  < hash_value >. But when I use ipfs {ls||cat||get}  < hash_value > there may occur a halt.  Since I am doing all this process inside a script halt problem locks my script.

On the contrary I could obtain the files from ipfs.gateway(which uses public gateways) using wget (this process force gateways to cache the content till its garbage collector clear up the disk space).

[Q] Should I try to retrieve files using wget -r "https://ipfs.io/ipfs/< some_hash >" since its connection seems more reliable than using ipfs {cat||ls||get} < my_hash >? I am not questioning ipfs, I just want to learn what my cause this problem or where I made a mistake and come up with a solution. So far using wget through ipfs.gateway solved the halt problem I am facing with.

Please note that my server runs behind a firewall (on a university domain, so there has to be a firewall). On my case if my client on the same LAN behind the same firewall, there is not halt issue between my client and server. But if the client is outside of the LAN, it halts as I explained. The problem may arise because of the firewall, but the public gateways still could retrieve the added data via ipfs, from my server?

Explanation of this question as follows:

I have a client and server node. On both machines, on the background I am running the following command as guided on the ipfs tutorials:

ipfs daemon &

On my client machine, I have add a file into ipfs:

[~]$ ipfs add hello.c
added < my_hash > hello.c

After that on my server, I do try to retrieve the file:

[~]$ ipfs {cat||ls||get} < my_hash >
//HALTS.

Following error message showed up multiple times.

14:18:59.986 ERROR  dht: no addresses on peer being sent!
                    [local:<peer.ID UjQJqD>]
                    [sending:<peer.ID aYb9MJ>]
                    [remote:<peer.ID Z86ow1>] handlers.go:75

ipfs {cat||get||ls} < my_hash > halts and I do wait a long time but nothing happens, maybe after few hours it works (The system acting unreliably on my case). This situation is weird because same process was working before without any problem and suddenly it may stop working as it should be.

On the other hand, I can see the file right away at my browser after ipfs add is done: url:https://gateway.ipfs.io/ipfs/< some_hash > or could download the file using wget -r "https://ipfs.io/ipfs/< my_hash >"".

Please note that if a folder added into the ipfs add -r folder_name it could retrieved from folder's hash with the following command:

wget -nH --cut-dirs=2 --no-parent -r -l 0 -nc "https://ipfs.io/ipfs/< folders_hash >"

Thank you for your valuable time and help.


texts: How many percent of all nodes decided to hard fork

texts: Where can I see the actual number of nodes that joined the hard fork, in comparison to the others, which didn't? What does the difficulty tell me about that relation? i.e. 100% : 91% as here


texts: Solidity/Remix Error : The constructor should be payable if you send value?

texts:
Simple contract, but don't transfer ETH!

pragma solidity ^0.4.24;

contract Upper {
    uint public count;

    constructor() payable public {}

    function() payable public {
        count++;
    }
}

contract Caller {
    function run(address addr) payable public {
        addr.transfer(msg.value);
    }
}

I call run-function in Caller contract. Then run call fallback function return error Solidity/Remix Error : The constructor should be payable if you send value

But if I call fallback-runction in Upper contract - tx - success!


texts: Is either the whisper.sh messaging app or the "Open Whisper Systems" project related to the Ethereum whisper project?

texts:
There is the Whisper "anonymous messaging app", described in this Wikipedia article.

And then there is also something called "Open Whisper Systems", described in this other Wikipedia article.

Is either one of these somehow related to the Ethereum "whisper" messaging project, or are they completely separate things?


texts: Retrieving the first and latest transaction date of a contract

texts:
Etherscan offers a time series of ethereum transaction of a contract address. Is there a way to retrieve this data? For example the duration mentioned here https://etherscan.io/address/0x06012c8cf97bead5deae237070f9587f8e7a266d#analytics is **

Thu 23, Nov 2017 - Sun 8, Dec 2019

**

Basically I want the duration in which a certain contract was active.


texts: Why is zether needed in Quorum if transactions are private between nodes?

texts:
As you may know JPMorgan has released zether which allows to make anonymous transactions in Quorum using zkp technology.

But I have a question regarding why Quorum needs it.

Since transactions between nodes can only be seen by the sender and the addresses specified using privateFor why does Quorum even need zkp ?

Is there anything I am missing ?


texts: How to move DAO tokens in myetherwallet.com to Ethereum Wallet?

texts:
I'm new to Ethereum and trying to learn. I bought DAO tokens using myetherwallet.com, I can see them when I log in, but how do I move them to Ethereum Wallet in order to Watch the Contract and Vote?
Thanks


texts: "Deploy contract" dropdown menu not displaying in Ethereum Wallet

texts:
Why is the "deploy contract" dropdown menu not displaying in Ethereum Wallet for me?

I'm totally new to this. My new boss sent me info regarding the company launching an ICO soon and sent me a link to https://www.ethereum.org/token to read up on.

I am trying to follow the instructions but hitting a roadblock at the very beginning: Under the "Understanding the code section" on the linked tutorial there is a line that says

  Take a look at the right column besides the contract and you'll see a drop down, written pick a contract. Select the "MyToken" contract and you'll see that now it shows a section called Constructor parameters. These are changeable parameters for your token, so you can reuse the same code and only change these variables in the future.

And it shows this image: https://www.ethereum.org/images/tutorial/function-picker.png

However no such dropdown menu exists for me in Ethereum Wallet (I am using the newest version (Ethereum Wallet and Mist 0.9.3 "Cliente Ligero ") and it just shows this:
https://i.imgur.com/cQAPzYX.png

No dropdown but an "error":

 No visibility specified. Defaulting to "public".
function MyToken(){
^
Spanning multiple lines.

As you can see there is no dropdown and I have tried to change the visibility from default to public and it still shows an error but changes to:
    Could not compile source code.

 Function, variable, struct or modifier declaration expected.
    public function MyToken(){
    ^

I appreciate any help I can get from you. Thanks and I look forward to joining the community here.


texts:
I'm trying to build a function that, when called, returns a mapping as two different array.

The problem that I have a mapping (address => uint) content2view and I have to get this value outside solidity. So, I wrote a function

 mapping (address => uint) content2view;
 address[] contents;
 /* [...] */
 function getStatistics() external view returns (address[], uint[]){
    address[] memory resAddr;
    uint[] memory views;
    for(uint i = 0; i<contents.length; i++){
        resAddr[i] = contents[i];
        views[i] = content2view[contents[i]];
    }
    return (resAddr, views);
}

The problem is that, when I call it with remix, no value is returned and the transaction is aborted:

  VM error: invalid opcode.
  invalid opcode
The execution might have thrown.
Debug the transaction to get more information.

Of course, I don't see any error and I don't understand which invalid opcode is invalid... Any help?


texts: Server firewall is blocking the Web3.js connection in NODE

texts:
My Centos server has running the "ConfigServer Security & Firewall" and its blocking the Web3.js connection with Ethereum node. The functions calls returns: "Error: Invalid JSON RPC response:"
Any idea how could I avoid it?
Thank you


texts: why connect to local ganache doesn't need contract address

texts:
Here is my code:

$.getJSON('Adoption.json', function(data) {
    // Get the necessary contract artifact file and instantiate it with truffle-contract
    var AdoptionArtifact = data;
    App.contracts.Adoption = TruffleContract(AdoptionArtifact);

    // Set the provider for our contract
    App.contracts.Adoption.setProvider(App.web3Provider);

    // Use our contract to retrieve and mark the adopted pets
    return App.markAdopted();
});

my question is:

I am using web3, ganache. Adoption.json is generate from command truffle compile. Then I use truffle migrate, truffle deploy this contract to ganache network. But from the code above, I don't need to specific the contract address, WHY? How does web3 know the contract's address?

Another question is, when I want to switch to Ropsten network, why I need a specific contract address?


texts: Web3.js 1.0 sendSignedTransaction returns error: Invalid RLP

texts:
Running parity private PoA chain, using latest parity client + nodejs + web3.js 1.0

When I try to sign a transaction and then send it following web3.js 1.0 documentation (sendTransaction and sendSignedTransaction) I get the following error:

  Unhandled rejection Error: Returned error: Invalid RLP.
      at Object.ErrorResponse (/home/simoh/node_modules/web3-core-helpers/src/errors.js:29:16)
      at /home/simoh/node_modules/web3-core-requestmanager/src/index.js:137:36
      at XMLHttpRequest.request.onreadystatechange (/home/simoh/node_modules/web3-providers-http/src/index.js:64:13)
      at XMLHttpRequestEventTarget.dispatchEvent (/home/simoh/node_modules/xhr2/lib/xhr2.js:64:18)
      at XMLHttpRequest._setReadyState (/home/simoh/node_modules/xhr2/lib/xhr2.js:354:12)
      at XMLHttpRequest._onHttpResponseEnd (/home/simoh/node_modules/xhr2/lib/xhr2.js:509:12)
      at IncomingMessage. (/home/simoh/node_modules/xhr2/lib/xhr2.js:469:24)
      at emitNone (events.js:110:20)
      at IncomingMessage.emit (events.js:207:7)
      at endReadableNT (_stream_readable.js:1059:12)
      at _combinedTickCallback (internal/process/next_tick.js:138:11)
      at process._tickCallback (internal/process/next_tick.js:180:9)

This is my code:

web3.eth.accounts.signTransaction({
  nonce: 11377,
  gasPrice: '0x00',
  gasLimit: '0x2DC6C0',
  to: '0x00d4dc44dfbbcb7d8369ddcd261bdaad1872d652',
  from: account.address,
  value: '0x16345785D8A0000',
  data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057'
}, account.privateKey)
.then(function(result) {
  console.log("Results: ", result)

  web3.eth.sendSignedTransaction(result.rawTransaction)
    .on('receipt', console.log);
})

The account is defined in the following way:

var account = web3.eth.accounts.privateKeyToAccount(privateKey);

I cannot figure out what I am doing wrong.

In addition it is not very clear to me why as example for sendSignedTransaction, it is shown a method that uses 'ethereumjs-tx' which is different than the one proposed in the documentation. Using this second method with 'ethereumjs-tx' the same transaction as the code above is succesfully signed and sent.

var Tx = require('ethereumjs-tx');

var privateKey = new Buffer('private key', 'hex');

    var rawTx = {
          nonce: 11376,
          gasPrice: '0x00',
          gasLimit: '0x2DC6C0',
          to: '0x00d4dc44dfbbcb7d8369ddcd261bdaad1872d652',
          from: '0x0013a861865d784d97c57e70814b13ba94713d4e',
          value: '0x16345785D8A0000',
          data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057'
        }

    var tx = new Tx(rawTx);
    tx.sign(privateKey);
    var myString = "0x"
    var serializedTx = (tx.serialize()).toString('hex');
    myString += serializedTx
    console.log(myString);

    web3.eth.sendSignedTransaction(myString)
    .on('receipt', console.log);

Also when I use web3.eth.accounts.recoverTransaction(result.rawTransaction)
it is showing different public key than what's expected...


texts: How to send custom tokens without ether?

texts:
I would like my customers to send a custom token without thinking of a certain amount of ether for gas. So I've tried the standard-token at ethereum.org. There's a way described to auto refill the sender address:

Then, add this line to the transfer function so that the sender is refunded:

/* Send coins */
function transfer(address _to, uint256 _value) {
    ...
    if(msg.sender.balance<minBalanceForAccounts)
        sell((minBalanceForAccounts-msg.sender.balance)/sellPrice);
}

But that only works if the sender got ether at least once, as a zero amount of ether will prevent the first token tx.

Is there any way, that my customers don't need to care about ether when they exchange my Dentacoin token?

(I could add a contract, that sends ether to all addresses listed in the token address mapping, but that contract would be drained very soon, right?)

I appreciate any ideas!


texts: How to develop a new module in go-etherum like eth, admin, etc

texts:
For instance, the module is named "mymodule".
It can be used in geth console and web3 like mymodule.funcA(),web3.mymodule.funcA(),

Thanks


texts: Why do I see warning message in my remix browser ethereum

texts:
My code is here:

pragma solidity ^0.4.20;

contract Hello{

    string name;
    function Hello(){
        name = "Mike";
         }
}

However I see this warning :

  browser/Hello.sol:6:5: Warning: No visibility specified. Defaulting to
  "public".
      function Hello(){
      ^ Spanning multiple lines.


texts:
As many people have quite a hard time syncing their wallets to even get started with Ethereum I offer my chaindata folder as a regular dump (.tar.gz). Downloading a dump is in most cases way faster than syncing from scratch. I have heard of people waiting for a sync for two weeks straight.

Is this secure for me or do I expose secrets of my wallet doing this / do I risk being hacked?

(This should not be a debate about if you can trust my or other peoples chaindata dump.)

EDIT:

For the ones interested in downloading a recent copy of the Ethereum chain, feel free to grab a copy from https://dl.ender.io/eth-chain/

After downloading make sure to check the sha256 sum, stop geth / Ethereum wallet and replace your chaindata folder with the one from my archive. After that start geth / your Ethereum wallet again and let it sync the remaining blocks. This should be a lot faster than a clean sync.

(Please make a backup of your private keys first in case you delete something that's wrong!)

Who am I?

Just some German guy that wants to help people out by hosting current copies of the chain on a German server.

Can you talk to me?

Sure just write me here or send me a message!


texts:
I am writing simple program to reverse string using solidity ,everything looks ok but while executing the program am getting the error

"call to reverseString.reverseStr errored : VM exception while processing transaction Invalid opcode"

contract reverseString{

string a;

function setA(string memory x)public{
    a = x;
}

function reverseStr() public view returns(string memory){
    bytes memory entString = bytes(a);

    string memory revStrings =new  string(entString.length);

    bytes memory revString = bytes(revStrings);

    uint k=0;
    require(revString.length>0);

    for(uint i=revString.length;i>0 ;i--){
       revString[k++] = entString[i];
   }

    return string(revString);
}

}


texts: Recover Metamask from Ethereum address and password

texts:
I had installed Metamask with Chrome but I lost my Laptop and couldn't find my seed phrase.
I still have the 42-digit ethereum address and my metamask password.
Is there any way I can retrieve my Metamask account?
Thanks
Jeffrey


texts:
In the most of current sharded blockchains, there is a second chain required for the computation needed for the maintenance of the whole of the network and receiving updates of the shards and their snapshots. Such a chain has different names in variant protocols: Beacon chain (Ethereum 2.0), Relay chain (PolkaDot) etc.

So the second chain is used for keeping shards snapshots and maintenance of the network.

Is Beacon chain kept by all the validators in all the shards?

I mean is there a copy of the Beacon chain in all the shards such that all the validators has to maintain it?


texts: Is there any profit from using pure and view functions modifiers?

texts:
I have a function that does not read or modify contract's state:

contract C {

    function add(uint a, uint b) public returns (uint) {
        uint res = a + b;
        return res;
    }

}

Does it make sense to use pure/view modifier? I mean, will the function use less gas after that or what is the reason to use it?


texts: I see no way to obtain the return value of a non-view function (ethers.js)

texts:
In a Buidler test I have:
const { expect } = require("chai");

describe("SumOfTokens", function() {
  it("Checks correct transfers", async function() {
    const SumOfTokens = await ethers.getContractFactory("SumOfTokens");
    const sumOfTokens = await SumOfTokens.deploy();

    await sumOfTokens.deployed();

    console.log(await sumOfTokens.newToken());
  });
});

It prints some nonsense instead of the return value (that should be 1) of the external non-view function newToken.
How to obtain the return value of newToken after its call?


texts:
In my requirement I have list of whitelist domains(xyz.com, abc.com etc.) and I have to write smart contract to check the data is coming from one of our whitelisted domains...

Solution number one: Store comma separated whitelisted domains in a string and then
use a library like stringutils or solidity-util and check if my newdomain is available in my whitelisted domains.

Solution number two: Store whitelisted domains in string[] and loop through the array and if my newdomain is available in my whitelisted domains array.

I am wondering which solution is better for my scenario?

Also there is one more problem, how can I validate data like http://xyz.com, www.xyz.com, xyz.com etc all of them are valid domains


texts: Obtain transaction hash from event (ethersjs)

texts:
My goal is to detect a contract invocation as fast as humanly possible. To do this I am processing all the pending transactions I have access to (via provider.on("pending", async (tx) => {})).
To detect the contract invocation I am looking for, I scan the data field of the transaction for the method signature. However, I have seen that a contract can be invoked via a call to another contract which may in turn call the method of interest. In this case the data will only contain the method signature of the buffer contract, I don't think I can get further from this approach.
Another approach is to listen to contract events via targetContract.on("targetMethod", (**parameters) => {}), however this way I have only access to the method parameters, I would like to have access to the transaction hash (even better if its still pending). I understand accessing the pending transaction is not possible since for the event to be recorded, it has to have been already processed, right?
Is it possible to access the transaction hash this way? Is there any way to achieve my goal of detecting contract invocation even when done via proxy contract and placing a transaction that gets processed in the same block?
Thanks!


texts: What is the meaning of Ethereum mainnet genesis block extradata value?

texts:
Mainnet genesis bloc (see https://etherscan.io/block/0) has 0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa as extraData value.
It doesn't seem to convert to ascii and, as this field is free and can have any content, I wondered what does this value mean.

Anything geeky? Reference to a newspaper like in Bitcoin genesis?


texts: How were the private keys for addresses like 0x0000000000000000000000000000000000000001 generated in ethereum? Surely they weren't made at random? Please let me know. How is it valid?


texts: Solidity | Smart Contract (Ethereum) transaction tracker API

texts:
I am finding the way to detect the specified transaction. For example, I want to detect if someone calls a method in my smart contract by making a transaction then, I want to make the transaction failed.
So I'm looking for the API which can be monitoring the transactions or can be subscribing to the events. For instance, monitoring or tracking some special event. Do anyone know the great API?
I am not an expert so Please let me know someone has an idea. Thanks.


texts: Contract not getting deployed when event traces are added

texts:
I am not able to deploy the contract when event traces are added.
Please help me figure out what is going wrong here. When I remove trial event() , I can deploy the contract.

pragma solidity 0.4.8;

contract X {

    address owner;
    uint amount;

    event test(address value);
    event trial(uint val);

    function X() {
        owner = msg.sender;
        test(msg.sender);
    }

    function invoke() payable {
        test(msg.sender);

        trial(amount);
        amount = amount + msg.value;

        trial(amount);
    }
}


texts: Why 'throw' is a problem in this Solidity code?

texts:
I found this code at the following site:

Ethereum Griefing Wallets

for (uint i=0; i<investors.length; i++) {
  if (investors[i].invested == min_investment) {
    // Refund, and check for failure.
    // This code looks benign but will lock the entire contract
    // if attacked by a griefing wallet.
    if (!(investors[i].address.send(investors[i].dividendAmount)))
      {
        throw;
      }
    investors[i] = newInvestor;
  }
}

I understand that using a loop to send balance is dangerous because if one transaction fails then all transaction would fail. Why 'throw' is considered dangerous in this code? Just because it would revert and the owner would not get any money? How it would lock the contract? Because 'throw' consumes all the gas?

Somebody please guide me.


texts: Querying The Ledger And Filtering Results In Smart Contracts

texts:
I have a smart contract deployed that I use to store generic data. This generic data belongs to external parties and now they want to query the data which is easy given an ID for the array index and the right permissions. Amongst this, they now want to see all related transactions of said item in the array on the smart contract. I feel the structure of this simple implementation prevents me from doing what I require.

I require a way to search the blockchain for all transactions associated or related to a user id, a transaction id etc..

Questions,
To be able to provide a deep level of information based on data stored in a smart contract do I need to create multiple separate smart contracts? Or Store data in a traditional database and reference a transaction?

Basically, I want a way to say a change was made in this transaction and the data was inputted on this date and then I can display this on a UI to the customer.


texts:
This is my payable public method1 :
//Do sth
if (condition)
    method2();

and as you know, if method2 is called, the user should pay the gas fee for it as well.
How can call method2 from inside the contract in a way that the contract itself, pays for the gas fee?


texts: Preparing for a throw, when forwarding ether to another contract?

texts: If a contract has a payable function, which forwards ether to another contract, but the second contract throws, how can you properly prepare for a throw in the first contract? Will the throw leave the money in the first contract, and if so can you return this money to the initial msg.sender?


texts: Implementing Blockchain and Converting Web App to DApp

texts:
I have my web-application which is in Angular2 (Front end) and Rails (Back end-API), now I want to implement Blockchain to this Web application, so needs to make it DApp.

Here while making the DApp, do I need to remove all the Rails Back-end(API) and convert the business logic into the smart-contracts (Ethereum)?

This application is having more than 50 API's, so should I have to write the 50+ smart contract for each API? that means I need to remove the all Rails API code.

Do I need to require to choose the cloud storage platform like Storj, Decent for storing the data?

Please guide.

Please share any On-line material/blogs which can help me into this.

Thanks in Advance.


texts:
What happens when I send a transaction that exceeds the gas limit of 3,141,592?

Will the transaction be transmitted to the network but never confirmed?

If my gas cost is 4,141,592 for example can 3,141,592 be paid in one block and 1,000,000 more in the next?

Will the error message I receive (if any) depend on the ETH client I am using?


texts: What is the difference between eth.contract and eth.Contract?

texts:
I don't get it. I've seeing two ways from tutorials on how to instantiate web3.

One is..

eth = new Eth(web3.currentProvider)
token = eth.contract(abi).at(contract_address);

and another is..

web3 = new Web3(web3.currentProvider);
token = new web3.eth.Contract(abi, contractAddress);

How are they different? And I can't find info on https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html with the small "c" for contract.


texts:
Is the timestamp of a block referring to the time that block is created or when it's mined by a miner?
Suppose I subscribe to new incoming blocks using the following NodeJS code (with web3):
web3.eth.subscribe('newBlockHeaders', function(error, block){
    console.log(block.number);
    console.log(block.timestamp);
    console.log(...computer unix timestamp...);
}

the block number I'am printing is referring to the latest block that was mined?
If I am correct, why if I fetch that block Timestamp and I compare it with the current Unix Time they are different?
For example from the code above i get:
Mined Block number: 11263715
Mined Block timestamp: 1605460505
Unix current timestamp: 1605460537


texts:
I tried to initiate a sell order for EOSDAC on DDEX - however, i got stuck at the first hurdle in that the transaction from my address to DDEX has been pending for some time. I have enough gas for the transaction.

Here is the reference - 0x2f9d532cb164783c880668275e9c63a7b665037af06fa833fc6d730f57e43b0e

Would really appreciate it if someone could assist! let me know if you need more details. Thanks all


texts:
Is there a way to speed up initial sync process?

It is lasting for the 3rd week and seems to ever slowing down as I am close to 90% of blocks.

I am running full node on my server.

Funny thing is that even full bitcoin core sync on the same server took just 10 days while ethereum seems to stuck.

There is no eth bootstrap, am I right?

I have turned everything off, leaving geth to utilize whole server and bandwidth. It does sync occasionally, but most of the time it is looking for peers.

I have tried various geth options - no luck.

geth.exe --fast --cache 512 --maxpeers 100 --maxpendpeers 25 --v5disc --verbosity 5 console shows mostly these errors while looking for peers:

TRACE[05-20|12:28:41] << PONG/v4                               addr=x.x.x.x:30303  err=expired
TRACE[05-20|12:28:21] Failed proto handshake                   id=3f1d12044546b763 addr=x.x.x.x:30303  conn=dyndial err="too many peers"
TRACE[05-20|12:28:39] Skipping dial candidate                  id=78de8a0916848093 addr=x.x.x.x:30303 err="recently dialed"

Specs:

Mist 0.8.10 @ win 2016 server 8gb ram, RAID10 SAS 15K hdds; 1Gbit internet
Geth
Version: 1.6.0-stable
Git Commit: facc47cb5cec97b22c815a0a6118816a98f39876
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.8.1
Operating System: windows

Update: there were time sync errors; After syncing time on server I am getting other errors:

DEBUG[05-20|13:02:48] Ethereum handshake failed id=e0785eadc076b1ab conn=dyndial err="Genesis block mismatch 2720038ef46044a7 (!= d4e56740f876aef8)"
DEBUG[05-20|13:00:01] Ethereum handshake failed id=3c50be8974756f30 conn=dyndial err="Genesis block mismatch 406f1b7dd39fca54 (!= d4e56740f876aef8)"
DEBUG[05-20|13:03:30] Ethereum handshake failed id=17677980aa2fb04f conn=dyndial err="Genesis block mismatch 40cb5b4035ddab4b (!= d4e56740f876aef8)"
DEBUG[05-20|12:59:37] Ethereum handshake failed id=2507fb78c342d4c8 conn=dyndial err="Genesis block mismatch 41941023680923e0 (!= d4e56740f876aef8)"
DEBUG[05-20|13:01:06] Ethereum handshake failed id=1d612ac4de33ab58 conn=dyndial err="Genesis block mismatch 4a0055a7f3ddb050 (!= d4e56740f876aef8)"
DEBUG[05-20|12:59:14] Ethereum handshake failed id=799d0a8836e17ef7 conn=dyndial err="Genesis block mismatch 4fa57903dad05875 (!= d4e56740f876aef8)"
DEBUG[05-20|12:59:04] Ethereum handshake failed id=a3b861e2e4c0df30 conn=dyndial err="Genesis block mismatch 61ba9d21b32224a2 (!= d4e56740f876aef8)"
DEBUG[05-20|12:59:18] Ethereum handshake failed id=5bbc22cd4f3dd031 conn=dyndial err="Genesis block mismatch 6577484f58748da6 (!= d4e56740f876aef8)"
DEBUG[05-20|12:59:35] Ethereum handshake failed id=ba64dd01810cb970 conn=dyndial err="Genesis block mismatch 77b03ae0c86cc644 (!= d4e56740f876aef8)"
DEBUG[05-20|12:59:09] Ethereum handshake failed id=093900bf548eeb6e conn=dyndial err="Genesis block mismatch 8ce2489a3df8bc04 (!= d4e56740f876aef8)"
DEBUG[05-20|12:59:31] Ethereum handshake failed id=183bd38c75c213b4 conn=dyndial err="Genesis block mismatch 8ecbab5d2002f425 (!= d4e56740f876aef8)"
DEBUG[05-20|12:59:04] Ethereum handshake failed id=23a6298815a13486 conn=dyndial err="Genesis block mismatch a3c565fc15c74788 (!= d4e56740f876aef8)"
DEBUG[05-20|13:02:07] Ethereum handshake failed id=a59155da80d4db50 conn=dyndial err="Genesis block mismatch fbfd267771e132d0 (!= d4e56740f876aef8)"


texts: How to send ERC20 token to smart contract in constructor

texts:
When deploying a smart contract to a private network, how to send ERC20 token (on the same private network) in msg.value to the smart contract in constructor?
Here is the contract:
pragma ^0.7.0;

interface ERC20 {
  //standard ERC20 functions
}
contract MyContract () {
  address erc20Contract;
  uint256 value;

  constructor (address _erc20) {
    ERC20 token = ERC20(_erc20); //_erc20 is the deployed address of ERC20 token
    erc20Contract = _erc20;
    //need to transfer msg.value token to the contract
    value = msg.value; //<<==how to transfer msg.value to the contract with ERC20 function, such as token.transfer()?
  }
}