texts: How to get meaningful error msg from truffle unit test?

texts:
I am writing unit tests in truffle. No matter it's solidity unit tests or js unit tests, all of the error msg I can get is:

Error: VM Exception while processing transaction: revert
at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/errors.js:38:1)
at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:86:1
at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-provider/wrapper.js:134:1
at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/httpprovider.js:128:1)
at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:64:1)
at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:354:1)
at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:509:1)
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:469:1)
at IncomingMessage.emit (events.js:185:15)
at endReadableNT (_stream_readable.js:1101:12)
at process._tickCallback (internal/process/next_tick.js:114:19)

Is there anyway to get more informative error msg?


texts: solc producing different contract binary depending on OS

texts:
I have a Linux, and another person has a Mac. We have the same solc compiler version, except for the OS extension (I have 0.4.24+commit.e67f0147.Linux.g++, they have 0.4.24+commit.e67f0147.Darwin.appleclang). When we compile a list of contracts with solc --combined-json abi,bin ./*.sol, the resulting bytecode is different for each contract, in the few bytes at the end. When we compile one contract with just --bin, the bytecode is the same.

Why? Is anything about the EVM bytecode actually dependent on the OS? How could this make sense, given that it's uploaded to ethereum which runs on any machine? Do we need to use some solc flags to get the same output?


texts: Chain reorganisation: How often one confirmation transactions do not end up to the first block the wallet thinks

texts:
Currently web3.js wallets like MetaMask work so that they return the transaction receipt to the dApp as soon as the Ethereum node, connected internally by the wallet itself, sees one confirmation for the transaction.

However, there might be chain reorganisations in the Ethereum blockchain. This block was not the heaviest tip of the chain and the transaction later ends up in some other block, not one the wallet originally thought.

How often this happens? How often transactions are reorganised in another block? Where could I track such stats?

Asking this because sometimes this is a usability issue in dApps. Assuming the wallet tells the transaction went through, you query the blockchain and you find out that the state change did not actually happen yet because the blockchain was reorganised.

I know the solution is to wait more block confirmations, but that is not what I am asking here.


texts: Is it possible to see the execution cost of a function before it is executed?

texts:
I would like to assert the cost of an execution within a Solidity (5.x) function before executing it. To the best of my knowledge, this sounds like an incomputable problem, but I would like to check whether this can be done before making any assumptions.

I am aware that computing the cost can be done after the computation(s) has/have ended, but I would like to see the cost before wasting any gas. The gas price for seeing the price of a computation is acceptable, as long as it is less than a price of executing the computation.


texts: Is it possible to use a smart contract without connecting to a wallet?

texts:
I've a web application where I have some structure with ids and a function to get prices by an id from an smart contract, and I've payable functions.
I'm not able to show prices for each item if I don't click "connect to wallet" first. So, I'd like to know a way to use the deployed contract and get the prices without clicking "connect to wallet"
I have a button that says "connect to wallet" and this will trigger the web3 function in order to connect with metamask.
connect to wallet fn:
   let web3 = window.web3;
    console.log(web3)
    if (!web3) rej('MetaMask not available');
    web3 = new Web3(web3.currentProvider);
    res(web3);

I'm  using truffle:
import Contract from '../../build/contracts/Contract.json';
import contract from 'truffle-contract';
export default async function(provider: any): Promise<any> {
  const _contract = contract(Contract);
  _contract.setProvider(provider);
  const instance = await _contract.deployed();
  return instance;
}

executing the contract and saving it globally
const handleDeployedSmartContract = async(): Promise<void> => {
    const m = await contractProvider(window.web3.currentProvider);
    window.contracts = {
      ...window.contracts,
      m
    };
    dispatch({ type: types.ui.contractLoaded, payload: true });
    dispatch({ type: types.ui.handleWalletModal, payload: false});
  }

and If I  execute handleDeployedSmartContract without the web3 connection, I'm not able to get the contract :/ I want to show the prices without even clicking "connect to a wallet" and the prices comes from the smart contract function


texts: Does geth say when the blockchain is completely updated?

texts:
I am using geth to download the entire blockchain via the command:

geth --fast --cache=1024 --jitvm

Everything appears to be going fine so far.

I was wondering if there will be a notification when the blockchain is up to date?

Any idea how long I can expect the process to take?


texts: "Normalized odd number of arguments by adding nil " when unmarshalling data in geth client

texts:
I use json.marshal api encoding a struct and then send the marshalled data to geth.  It's oK to unmarshal the data locally, but geth returns a error when unmarshalling it. I don't why, please give me some advice, thanks.

When i specify this error, it returns a message "err="json: cannot unmarshal non-string into Go struct field Filterinput.ContractAddress of type common.Address". it's log15 error in geth, but i can't figure out what the log15 is used for


texts: web3.eth.sendSignedTransaction is not returning promise or promised event emiter

texts:
I am testing whether transactions that I'm signing offline are accepted by the Kovan network. I'm submitting the transactions using Web3.js (web3@1.20) as follows:
I connect to my Open Ethereum 3.0.1 node, and then use web3.eth.sendSignedTransaction. According to the documentation, this should return a PromiEvent. However, the events emitted by the submission are not captured and the promise never resolves. The transaction is submitted to the network nonetheless and is valid (it's a simple transaction sending funds from one non-contract account to another). One can find it in any blockexplorer, like for instance etherscan.
The code below does not behave as expected:
function sendTrans(_rawData,_txHash) {
    try {

            console.log("Before Asynch call");

              web3.eth.sendSignedTransaction(_rawData)
                .once('transactionHash', function(hash){ console.log("txHash", hash) })
                .once('receipt', function(receipt){ console.log("receipt", receipt) })
                .on('confirmation', function(confNumber, receipt){ console.log("confNumber",confNumber,"receipt",receipt) })
                .on('error', function(error){ console.log("error", error) })
                .then(function(receipt){
                    console.log("trasaction mined!", receipt);
                });

          console.log("After Asynch Call");
         }
    catch (error) {

      console.log("Error Sending Transaction", error.message);

    }
      return { response: "OK", transHash: _txHash };
  }

// result: the code does not trigger any emitter event. No logging to the console is made.
The code above just hangs, because the promise returned by sendSignedTransaction is never resolved. No event is received either, so the .on('receipt') is never triggered. However the transaction is successfully submitted to the network and mined.
So the problem is not with the submission, but rather with the PromiEvent that web3.eth.sendSignedTransaction returns.
Anyone has any idea of why this behavior is happening?


texts: My contract deploys but I cannot see the funds I sent

texts:
I have deployed the following contract without any problem. When I try and run the function addFunds it seems to execute but the variable funds is not changed. Also if I enter the number 1 as a parameter it says sending 1 ether, but I thought 1 ether was 1 plus 18 zeros? Regardless of what number I use funds remains at 0.

pragma solidity ^0.4.18;

contract mortal{

    address public owner;

    function mortal() public {

        owner = msg.sender;
    }

    modifier onlyOwner{

        if(msg.sender == owner) {
            revert();
        }else{
            _;
        }
    }

    function kill() onlyOwner public {

        selfdestruct(owner);
    }
}

contract Borrower is mortal {
    string  public borrowerName;
    uint256 public funds;

    function Borrower(string _name) payable public {
        borrowerName     = _name;
    }

    function addFunds() onlyOwner payable public {
        // Incoming funds
        funds += msg.value;
    }
} // Borrower

What am I doing wrong?


texts: Not enough data error when deploying a smart contract using Python ethereum package

texts:
To deploy a contract to the network, we have more than one method, you can choose to use the mist or you can use the rpc interface. I choose the rpc interface in python. I deploy the contract like this:

contract_tx = c.create_contract(c.eth_coinbase(), compiled_code, gas = 3000000)

(I use the eth_compilesolidity command to get the compiled code). But after that when I test the contract with its inquiry function something is going wrong. The error message is shown below in the picture

Can somebody help me correct it?

And by contrast I deploy the same contract with mist, after getting the address I also use the rpc interface in python to do the inquiry with that mist-deployed contract and this time it works, why?

    p_attach=Popen("\Users\wzy20\Desktop\geth attach",shell=True,stdin=PIPE,stdout=PIPE,stderr=PIPE)
p_attach.communicate(input="admin.setSolc(\"C:\\\Program Files\\\Ethereum\\\solc.exe\")")
c=EthJsonRpc('127.0.0.1',8545)
f=open(r'C:\\Users\\wzy20\\Desktop\\blackjack\\contract.txt','r')
contract_source=f.read()
compiled_code=c.eth_compileSolidity(contract_source)[unicode("blackjack")][unicode("code")]
passwd=getpass.getpass("password:")
print "unlocking and deploying the game contract"
try:
    p_attach=Popen("\Users\wzy20\Desktop\geth attach",shell=True,stdin=PIPE,stdout=PIPE,stderr=PIPE)
    p_attach.communicate(input="personal.unlockAccount(eth.coinbase,\"%s\")"%passwd)
    time.sleep(5)
    contract_tx = c.create_contract(c.eth_coinbase(), compiled_code, gas = 3000000)
    p_attach=Popen("\Users\wzy20\Desktop\geth attach",shell=True,stdin=PIPE,stdout=PIPE,stderr=PIPE)
    p_attach.communicate(input="personal.lockAccount(eth.coinbase)")
except:
    print "wrong password"
    os._exit(0)
for x in range(100):
    try:
        contract_addr=c.get_contract_address(contract_tx)
        print 'contract_address: '+contract_addr
        break
    except:
        x+=1
        print str(x*3) + 's' + "waiting to be mined!"


texts: It is possible to get bytecode from the evm in golang?

texts:
Imagine this scenario, I have a contract that has a function where I call with runtime.Call().

But this function returns an address of a newly created contract, but not the bytecode as runtime.Create does.

How would I access that bytecode?

Thanks!!


texts: How do i add to a nested array within a struct

texts:
I am unable to add elements to a array within the struct
struct D {
        string name;
        address key;
    }
    struct Aone {
        string aid;
        B[] blist;
       D[] dlist;
    }
    struct B{
        string bdesc;
        bool bstatus;
        C[] clist;
    }

struct C{
    uint createTime;
    string cdesc;
    bool rstatus;
    string ctype;
}

mapping(string => Aone) A;

I am need to add  items to struct c based on aid provided
function rptC(string _aid, string _c) public {
        B[] storage bhist = A[_aid].blist;

        if(bhist.length > 0 && bhist[bhist.length-1].bstatus==false) {
            bhist[bhist.length-1].clist.push(C(now,_c,false,""));
        } else if(bhist[bhist.length-1].bstatus==true) {
            bhist[bhist.length].clist.push(C(now,_c,false,""));
        } else {
            bhist[0].clist.push(C(now,_c,false,""));
        }
}

I keep getting a invalid json rpc error.
I am new to Solidity and need help

Thank you


texts: DeployError: Provided address is invalid,the capitalization checksum test failed,or its an indrect IBAN address which can't be converted

texts:
I have the following code:

var account = web3.utils.toChecksumAddress("0x249eb..")
const accounts = await web3.eth.getAccounts();

let Contr = new web3.eth.Contract(abi, {from: account, gas: 47000, data: bytecode})

await  Contr.deploy({ data: bytecode }).send({ from: account, gas: '1500000', gasPrice: '30000000000000'})
    .then(function(newContractInstance){ console.log(newContractInstance) });

And I am getting the following error when I try to deploy().send() the contract:

Script failed: Error: Provided address "[object Object]" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.

The provided address is the same one than the one used for getting the contract Contr by new web3.eth.Contract but, in this case, I dont get any error and the output is correct.

I have been checking another questions related with this error and I didnt get any solution.

I tried with account, accounts[0], and the address directly '0x249..'. I am using web3 1.0.0. Any idea how to solve this?


texts: Is it possible to use domain names in place of IP addresses for peer nodes (static nodes) or bootnotes in the configuration for starting a geth node?

texts:
I've searched quite a bit not been able to find any examples using domain names or indeed any reason why it can't be used.

e.g. to start a node with bootnodes, the format is as below using ip addresses

geth --bootnodes enode://pubkey1@ip1:port1

I'm interested because for a private network I'm looking to build static IP addresses aren't really an option.

Is it possible to do:

geth --bootnodes enode://pubkey1@mydomain.com:port1

This would allow dynamic IPs for nodes.

Is this a security risk?

Many thanks


texts:
I am new to ethereum. I read about ERC20 standard. For example there is a balanceOf() function that is required to be implemented. But in some contracts that claim to be ERC20 compliant, instead of a function, a mapping is used:

mapping (address => uint256) public balanceOf;

And then it is used in the following way, for example:

balanceOf[msg.sender] = initialSupply;

My question is, is the above way conforms to ERC20, or not?


texts: Clarification of "256 bit word" semantics

texts:
EVM has "256bit words". Some cases treat strings shorter than 32 bytes (256 bits) as left-justified ascii (packed into the most significant bytes of the word).

Does this mean that the word value of the string '*' is equivalent to: 42 << 148 ?

Note that the RLP encoding of the single ASCII character '*' is two bytes, whereas the RLP encoding of 42 << 148 is different. Are there important edge cases for security and correctness where the EVM word semantics and RLP encodings don't quite match up?


texts: Which interface for GETH is the most ideal to learn? How do they differ?

texts:
In trying to learn Ethereum and its inner working, i came a crossed https://www.ethereum.org/cli .

It states...

"Geth and Eth are multipurpose command line tools that run a full Ethereum node. They offer multiple interfaces: the command line subcommands and options, a JSON-RPC server and an interactive console."

Seems like there would be 3 ways to communicate with GETH

Command line subcommands and options
JSON-RPC server
Interactive console

Which interface is best to learn in order for full functionality? Do they all accomplish the same things but in different methods/languages?

Hopefully i can receive clarification on this.


texts: ENS Domains and new receive addresses for privacy

texts:
Currently I use a new receive addresses every time I receive ETH - Ledger Live creates new receive addresses by default when an address has been 'used' as this is good practice in terms of privacy.

I'm looking at getting an ENS domain to make it easier for people to transfer ETH to me. What are the privacy implications when using ENS domains and are there any best practices? Currently I'm assuming the typical use case is to point the domain at a single receive address and share the domain so privacy would be sacrificed for usability. Even if I were to update the receive address after every transaction, I believe the addresses would still be linked.


texts: Web3: current best practice to connect Metamask to Chrome?

texts:
I am currently trying to connect my React front-end to Metamask on Chrome.
When using the following method, I get that ethereum.enable() is deprecated:
if (window.ethereum) {
    window.web3 = new Web3(window.ethereum);
    window.ethereum.enable();
}

To be more accurate, the complete warning is:
MetaMask: 'ethereum.enable()' is deprecated and may be removed in the future. Please use the 'eth_requestAccounts' RPC method instead.
For more information, see: https://eips.ethereum.org/EIPS/eip-1102

So I when to the documentation and updated that code to:
if (window.ethereum) {
    try {
        // Request account access if needed
        const accounts = await window.ethereum.send(
            "eth_requestAccounts"
        );
        setError(null);
    } catch (error) {
        setError("Unable to connect to Metamask");
    }
}

This way, I get the following warning:
MetaMask: 'ethereum.send(...)' is deprecated and may be removed in the future. Please use 'ethereum.sendAsync(...)' or 'ethereum.request(...)' instead.
For more information, see: https://eips.ethereum.org/EIPS/eip-1193

Subsidiary question: I still don't really understand why I need to set this async function call in a variable (accounts), so... If someone has an explanation, I'm taking it!

Anyway: after this warning, I went to the doc again and I saw that sendAsync is supposed to be deprecated as well... And I didn't find anything about ethereum.request.
TLDR: what is the current best practice to connect Metamask to a front-end, right now? Thanks!


texts: Private Net: Miners not mining pending transaction

texts:
I am running a private network. I send a lot of transactions to geth with miner on (with 10 threads).

I could see my transactions getting mined properly for some time. And then I checked length of pending transactions (4142).

I stopped to send further transactions and run miner to clear this list of pending transactions. But the length of pending transactions is same even running miner for half an hour.

The blocks are getting mined but no tx is added to the blocks. I get empty object when I check transactions in any block (exculding first 42 blocks).

Why the miner is not including ant transaction in blocks?

Edit 1:

I have set set gas price 0 in my transactions. I have miner.setGasPrice to 0. The min gas price in genesis file to be 0. So I think this should not be realated to gas price.


texts: What is better to use when querying a large but fixed number of structs - an array or a mapping?

texts:
In general, it seems as though mappings generally result in cheaper operations. What about when the number of elements are fixed (say, 20K) and setting the elements only ever occur once?
Would a mapping still prove cheaper? What if iteration is necessary?


texts: Who knows a payment slab for ethereum similar to bitpay?

texts: It is necessary that the contract would accept payments in different currencies (usd eur etc.) and then pull out tokens. Can this be done as a payment gateway? How is this best done?


texts: Can you interrupt the initial sync of geth?

texts: I have ran the geth -rpc and it started syncing. Any idea on how long that should take? And if I interrupt it, will it start again or pick up where it was stopped? Also will the DAG stay always synced by itself or is there some management necessary once I begin mining?


texts:
I'm currently doing a smart contracts short course and we got the code below but I've swapped out the event for emit. Now I am getting the following error:
ParseError: Expected ';' but got '(' emit sent(_from, _to, _value);^
Why would there be a semi-colon before the open bracket after sent? My code is as follows:
pragma solidity ^0.4.0;

contract Coin{

  address public minter;
  mapping (address => uint) public balances;

  emit sent(_from, _to, _value);

  constructor () public{
      minter = msg.sender;
  }

  function mint(address receiver, uint amount) public {
      if(msg.sender != minter) return;
      balances[receiver] += amount;
  }

  function send(address receiver, uint amount) public {
      if (balances[msg.sender] < amount) return;
      balances[msg.sender] -=amount;
      balances[receiver] +=amount;
      sent(msg.sender,receiver,amount);
  }
}

Thanks so much, I really appreciate any help.


texts: I call buy function but another user pay token on behalf of me

texts:
Please help me make following process feasible

situation:
A user wants to buy service(or product) at certain dapp but A has no token(even ETH) in his account so asks B for paying on behalf of.

B call approve A to spend amount of price
A call transferfrom B to Xcontract
Xcontract delegatecall buy function in dapp contract
dapp contract gives ownership of service to A

I put Xcontract here because dapp contract may check balance of msg.sender so X need to return as following to avoid revert:

msg.sender=A,
balance is equal or greater than price

I am stucked here. If Xcontract does delegatecall then it returns msg.sender=A but 0 for balance(A has no token) right? eventually, dapp will revert. Is there any solution to return both msg.sender as A and enough balance in this case?

How can I do? is it absolutely impossible?
token in this case is just erc20


texts:
I'm starting to read the Ethereum ressources and started with this article.
I'm struggling to understand what the fallback will do in the following contract:

pragma solidity ^0.6.4;

contract MyContract {
  event Log(address addr);

  fallback() external payable{
    emit Log(address(this));
  }

  function add(uint256 a, uint256 b) public pure returns (uint256) {
    return a + b;
  }
}

I understand what an event is. From the documentation:"this(current contract’s type):the current contract, explicitly convertible to Address".
My understanding is that the fallback will always log the same address (the address of MyContract). Is it correct ?


texts: Timestamp is giving wrong time in smart contract

texts:
Today is June 17. but when I execute my function and store the following arguments.

WriterModel(owner,postID, _postContent, now);

"now", It returns the July 20 timestamp.

It perfectly working fine in remix IDE which returns the today timestamp but in my local (Angular+Truffle + smart contract ) it returns July 20.

Can you please give me where I were Wrong.?


texts: Send fee tokens to non-zero address SOLIDITY

texts:
I have a fee on any transaction of my ERC20 token and I want to redistribute a percent of that amount to all addresses that have a non-zero balance equally. I have used mapping in order to associate a balance to each address. Also, I can't seem to be able to find the total amount of addresses that hold my token. Is there any way to find that number as well in order to easily divide the total amount equally? Thanks!
 mapping (address => uint) balances;


texts: Want users to decide what organisations an acces their data

texts:
Im working on a concept where users can allow certain organisations to see their data. I want to store the permission on a private ethereum blockchain. I thought smart contracts would be the way to go but I can't really wrap my head around it.
Would I need te create a contract for each user in which they say which organisations should get acces to their data?
Can users change which organisations have acces to their data if I use contracts, say for instance the user wants to change to another organisation?
Can I add more organisations to already existing contracts?
If contracts aren't the way to go here, could somebody give me a point in the right direction?
Image of the intended flow (simplified top more in depth bottom):

EDIT:
I made a start on a contract probably incorrect but lets see it as pseudo code:
pragma solidity >=0.5.0;

contract UserPermissions {
    string private notpermitted;

    mapping(address => mapping(bytes32 => mapping(address => bool))) permissions;

    constructor() public {
        notpermitted = "You do not have permission to view this users data";
    }

    function setPermissions(address they, bytes topic, bool allowed) external {
        permissions[msg.sender][topic][they] = allowed;
    }

    function getPermitted(address they, bytes topic){
        if (permissions[they][topic][msg.sender] = true) {
            //if permission is granted return this
            return permissions[they][topic][msg.sender];
        } else {
            return notpermitted;
        };
    }

    function getOwnPermitted(){
        //returns list of all permissions this acount has granted
    }
}


texts: Where should the LES (light ethereum subprotocol) capability be sent and what is it's id?

texts:
Is the LES subprotocol a wire protocol like (ETH, SHH) or is it an ETH subprotocol?

If it is an ETH subprotocol, it is not mentioned in https://github.com/ethereum/wiki/wiki/Ethereum-Wire-Protocol as a subprotocol. What is the correct number to be used?


texts: how to generate mnemonics from randombytes

texts:
I am able to get the randombytes using react-native-crypto-js
      const words = CryptoJS.lib.WordArray.random(32);
Is that possible to generate mnemonics using random bytes.


texts: What are the identities of the Ethereum/DAO white hat hackers?

texts:
Who are the Ethereum/DAO white hat hackers?

How can the community be assured that they can be trusted? Are they using the same exploit as the black hat hacker used? What prevents the white hat hackers from turning black hat and keeping the ETH they were able to recover?


texts: Transaction Gas limit vs gas used vs start gas

texts: I was inspecting one of my transactions on ropsten and I noticed something was off. The gas limit and gas spent as shown on etherscan and in metamask are 45666 and 29034 respectively so far so good. Now if I go to etherscan and open up the geth transaction tracer or load the transaction into the remix debugger. The gas left before execution starts is 24462. Somehow before code execution even starts 21204 gas is used. Where is this coming from?


texts: How to check token transactions with geth

texts:
I'm new to smart contracts, my apologies if this is a wrong approach.

I want to monitor incoming (confirmed, not caring about pending) token transactions to my wallet (using geth). I found out how to check the token balance (using eth_call), but actually I want it separated as single transactions (preferably having the possibility to check certain block-ranges). I need to do this by using JSON-RPC (IPC).


texts: How Solidity field variable update is happening?

texts: I am curious to know about, how the updation of field variables in solidity is happening ?. Whether world state is maintaining for each variable in the contract as like account balance?. And one more thing, As ethereum is immutable, can we get the value of the variable at particular time or block Number in past?.


texts: How to connect a dapp on private ethereum network

texts:
I created a private ethereum network with 3 nodes kai i have also created a dapp. How i can connect my dapp with my private network?

Thank you!


texts: What is nonce in Ethereum? How does it prevent double spending?

texts:
recently I got fascinated by blockchain, and started learning Ethereum. I came across the concept of the nonce in Ethereum.

After researching I found out that nonce is used for two purposes.

a. To keep transaction related to an account in order.
    i.e if there is a transaction with nonce 3 related to some account in the txpool and some transaction will nonce 4 arrived then that transaction won't be mined until and unless transaction with nonce 3 is mined.

I understand this.

But I have some question that I am not able to find?

i) nonce value is related to an address, right? So two address can have same nonce at the same time i.e. account with Address A can have the latest nonce 2 similarly account with address B can also have latest nonce 2.

ii) Do all nodes in the network will have same latest nonce value for all accounts available in the network?

That is, if there are three accounts and 2 miners then and nonce value for three accounts are 1,2,3 respectively, then both miner will have the same nonce.

Assumption: Both miners are in sync

b) how is nonce used to prevent a double spend?


texts: How to deploy smart contract with visible source code (etherscan)?

texts:
I'm trying to deploy a contract to the rinkeby (hope that thats the network to use for beta testing).
Deploying worked with the command truffle migrate --reset -f 2 --network rinkeby.

Unfortunately, I tried to access the contract through etherscan and I only can see the bytecode. How should I add the source code to etherscan so that it is possible to interact with the contract on etherscan? Is there a way to do it automatically?

Thanks a lot for any hint!


texts:
I must have missed something about deploying contracts, but to be sure:

I'm using Truffle,
Does deploying a contract mean it will overwrite the last instance? Since I see that it gets a new address each time I deploy it. But at the same time, calling the contract in the webUI will always go to only one specific contract.

Does this depend on which user I am? Do I have to be the one that deployed it, or at least have access to it? And if so, how do you best define access to a contract in soldity?


texts: eth.sendTransaction submits, but doesn't add to contract balance or trigger fallback function

texts:
I have tried sending 0.06 Ether to a contract as follows:

eth.sendTransaction({from: eth.accounts[0], to: "0x76E15697E36a66BF977D35de3C488F10B8014e65", value: web3.toWei(0.06, "ether")})

I've also tried sending 0.03 to the same contract address via MetaMask. However, although sending ether via eth.sendTransaction() through the geth command line submits, and on Etherscan no problems are shown, it doesn't add to a contract balance or trigger the fallback function (unlike sending Ether through MetaMask).

The contract in question is https://rinkeby.etherscan.io/address/0x76e15697e36a66bf977d35de3c488f10b8014e65

I'm trying this on the Rinkeby test network (not sure if it's a bug with this).


texts: Where is the wallet location after save with web3?

texts:
I want to create a wallet similar to Metamask with Web3.js library. So far I have been playing around with some of the commands.

The point is after I create my wallet with web3.eth.accounts.wallet.create() I would like it to persist over time so I saw there is a web3.eth.accounts.wallet.save() that apparently allows you to save your wallet in encrypted form so that you can later retrieve it with web3.eth.accounts.wallet.load().

So my questions are:

Where is the saving done?
Do I need to have geth, parity or some other Ethereum client running for the saving to be done on my disk?

I tried the saving and loading commands in the javascript console but what if I close it and reopen it?


texts:
I've got this snippet of code within a contract:

struct Brick {
    uint256 length;
    uint256 width;
    uint256 height;
}

struct Garage {
    uint256 length;
    uint256 width;
    uint256 height;
}

struct House {
    Brick[] bricks;
    Garage garage;
    bytes32 street;
    bytes32 city;
}

mapping(uint256 => House) public houses;

Without setting pragma experimental ABIEncoderV2, I get the following error when I'm trying to read any value from the houses mapping:

error: Failed to decode output: Error: insufficient data for bytes32 type (arg="", coderType="bytes32", value="0x")

However, if I make the Garage struct an array, everything's fine:

0: bytes32: street 0x0000000000000000000000000000000000000000000000000000000000000000
1: bytes32: city 0x0000000000000000000000000000000000000000000000000000000000000000

This is not a question about the ABIEncoderV2. I know that when that comes, we'll have much more flexibility as structs are concerned.

Why does it work when the property is an array and not when it's simply an instance?


texts: Implementing function to transact with other ERC-20 tokens in smart contract?

texts:
A while back I saw an example contract which allowed users to send any ERC-20 tokens through one of its functions, but I can't seem to find anything about this anywhere anymore. So, what is the simplest way to implement:

a) A function in a smart contract that allows the contract to handle transactions between another (specific) token contract?

b) A function allowing for any ERC-20 token to be used (probably through the user specifying the token contract)?

Thanks.


texts: Let say I have a code that print "Hello World". I deploy it to the blockchain and pay 1000 gas for it. Will my code keep running for every subsequent block till it runs out of gas? Or will it only run when other user interact with it?


texts: Questions about Truffle console and Truffle develop

texts:
When I inputted truffle console, it showed the error:
➜  via-issuer-master truffle console --network interaction
truffle(interaction)> var cash = aw
/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/websocket/lib/WebSocketConnection.js:773
    if (Buffer.isBuffer(binaryPayload) && binaryPayload.length > 125) {
^
TypeError: Buffer.isBuffer is not a function
    at WebSocketConnection.pong (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/websocket/lib/WebSocketConnection.js:773:1)
    at WebSocketConnection.processFrame (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/websocket/lib/WebSocketConnection.js:643:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/node_modules/websocket/lib/WebSocketConnection.js:323:34
    at processTicksAndRejections (internal/process/task_queues.js:79:11)

When I inputted truffle develop, it showed the error:
Error: The network id specified in the truffle config (5777) does not match the one returned by the network (1596182475756).  Ensure that both the network and the provider are properly configured.
    at Object.detectAndSetNetworkId (/usr/local/lib/node_modules/truffle/build/webpack:/packages/environment/environment.js:97:1)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at Object.detect (/usr/local/lib/node_modules/truffle/build/webpack:/packages/environment/environment.js:24:1)
    at Object.develop (/usr/local/lib/node_modules/truffle/build/webpack:/packages/environment/environment.js:74:1)
Truffle v5.1.35 (core: 5.1.35)
Node v12.18.2

Here is my configuration in truffle-config.js:
        development: {
            host: "127.0.0.1", // Localhost (default: none)
            port: 8545, // Standard Ethereum port (default: none)
            network_id: "*", // Any network (default: none)
            websockets: true
        },
        interaction: {
            host: "127.0.0.1",
            port: 9545,
        }

Why they happened and what should I do?


texts: What if millions of records to be fetched from blockchain?

texts:
This is just a hypothetical scenario. Let's suppose someone saved million of information in blockchain with huge gas consumption so far.
As for reading data in ethereum smart-contract cost no gas. Despite the fact that fetching information from blockchain is not an easy job that's why we have different protocols for that. Is it free to fetch millions of data from the block-chain?
Are there any hidden costs?
I created a scenario and saved 100s of information in an array of struct and it didn't cost a single gas but is it the same for millions of records?


texts: How to select a network id or is there a list of network ids?

texts:
We're starting a new open network based on the Ethereum protocol. The question is how to allocate a network id for the new network. In Ethereum we have main net, four test networks, classic with test network etc.

Is there a list of network ids? If not, let's create one.


texts: What is it that allows Ethereum process a larger amount of transctions per second than Bitcoin?

texts:
From a point of view of a developer: what is it that allows Ethereum process a larger amount of transactions per second than Bitcoin can? Is it more optimized polished code? Is it something on a more fundamental level that doesn't have to do with code but with architecture of the blockchain?
The question is about both versions 1.0 and 2.0


texts: Solidity: using low level call function on an EOA

texts:
Say I have a contract with a method that does a low level call on an address _addr assuming the target address is a contract with a certain method isValid():

contract Dummy {
    function doCall(address _addr) public returns (bool) {
        return _addr.call(abi.encodeWithSignature("isValid()");
    }
}

What happens if the address _addr is not a contract but an EOA? Trying it in Remix indicates that the call returns true when _addr is an EOA.

If this is indeed the case can someone explains or point me to the part of the documentation where this is exlained?

Thanks in advance!


texts:
My downloaded UTC file not opened due to not support any program for view or open. this file is without extension name.
How to open this file and please suggest in which extension will support.
without support of UTC file I will transfer fund/ETH to another wallet or not? please Help me.


texts: What is the difference between ICO and Crowdsale?

texts:
I'm confused a bit between ICO and Crowfunding sale. ICO also used to collect funds from investors like Crowdsale. Ethereum provide both options run an ICO or Crowdsale, then what is the difference between two?

Please help me to understand the difference.


texts:
How trustless and secure are Events? They are part of the consensus as they are generated out of a smart contract code. so in theory they are trustless and secure. But they are not stored on chain or in the state trie, and you would have to sync it again to find the event.

In my mind they are as secure as state, do you confirm?

New evidence: transaction receipt have their own merkle trie in a block https://ethereum.stackexchange.com/a/757/264
Means logs can be found in the recipe tree and is as verifiable as state.


texts: Why aren't block hashes a reliable source of randomness?

texts: I just saw this answer that informed me that block hashes were not a reliable source of randomness. In what situation are block hashes not a reliable way to obtain randomness?


texts:
We're looking to do an airdrop to all Ethereum wallets with a balance of .1 ETH or greater, but are having a hard time capturing the balances of every wallet in a quick fashion. We're trying to use the JavaScript API to calculate balances but it's going very slow (will take many years at the current rate).

We have already downloaded the entire blockchain onto our local environment, and have extracted the list of addresses (27 million).

We are now thinking the best way to move quickly is to parse the blockchain files and save it into MS SQL so we can conduct rapid balance calculations.

Have anyone conducted an airdrop like this, or parsed the blockchain --  and have any advice?


texts: Creating new account from web3 showing error

texts:
while creating new account from angular using web3

personal.newAccount function() undefined

import {
Injectable } from
'@angular/core';

import {
User } from
'./login/user';

const Web3=require('web3');

declare let
require: any;

declare let
window: any;

let tokenAbi =
require('./tokenContract.json');

@Injectable()

export class
ContractService {

private contAbi=require('./tokenContract.json');

private contAddr='0xadd2b6f750e0a05b25840ac9037365ce79f6a475';

web3:any;

private contract:any;

constructor() {

if (typeof
this.web3 !==
'undefined') {

this.web3 =
new Web3(this.web3.currentProvider);

} else {

this.web3 =
new Web3(new
Web3.providers.HttpProvider("http://localhost:8545"));

}

console.log(this.web3._provider);

this.web3.eth.getAccounts((err,
accs) => {

if (err !=
null) {

alert('There was an error fetching your accounts.');

return;

}

if (accs.length ===
0) {

alert('Couldn\'t get any accounts! Make sure your Ethereum client is configured correctly.');

return;

}

console.log(accs[0]);

this.web3.eth.defaultAccount =
accs[0];

});

this.contract=new
this.web3.eth.Contract(this.contAbi,this.contAddr);

// console.log(this.contract.methods.greet().call({from:this.web3.eth.defaultAccount,gas:0x27100},function(error,result){

// console.log(error);

// console.log(result);

// }));

}

public register(user:User){

user.address=this.web3.personal.newAccount(user.password);

}

}


texts: Remix issue - Uncaught JavaScript exception: abort("NO_DYNAMIC_EXECUTION was set, cannot eval

texts:
The remix browser was working before.
I was getting "Origin http://localhost is not allowed by Access-Control-Allow-Origin.". SO, I added Allow-Control-Allow-Origin: * Chrome Extension.
But the remix stopped working then. Not sure, if this is related.

I have now, removed the extension and cleared the application storage. Still the issue persists.


texts:
contract TripHistory {
       struct Trip {
           string lat;
           string lon;
       }
        mapping(string => Trip[]) trips;

        function getTrip(string _trip_id) public view returns (Trip[]) {
            return trips[_trip_id];
        }
        function storeTrip(string _trip_id, string _lat, string _lon) public  {
           trips[_trip_id].push(Trip(_lat, _lon));
        }

}

This is my contract code. Here I'm trying to store the coordinates of a particular trip. While storing the information contract executing fine. But When I retrieve the data, It should give the array of coordinates. But it is throwing an error.

  reason: 'insufficient data for uint256 type'

What I'm missing here. Is there any other way to achieve what I'm trying here. Kindly help me out.

P.S: I'm new to solidity.


texts:
I can't figure out how can I get event. I was trying with "contract.NewVoting().watch{}" but it says that watch is not a function.

I found out that watch has been removed and there is EventEmitter instead.

Here is a part of my not working yet code:

Solidity:

contract AddNewVotingBuilder is BaseBuilder
{
    function build()
        external
    {
        emit NewVoting(address(new AddNewVoting()));
    }
}

Truffle:

console.log("building add voting contract...");
await deployer.deploy(AddNewVotingBuilder);
let builder = await BaseBuilder.at(AddNewVotingBuilder.address);
await builder.build(); // doesn't work even without await
await builder.NewVoting()
    .on('data', event => console.log(event));

It completely ignores the code and doesn't show the event.

How can I make it working?


texts: Some characters in Ether addresses have changed to capitals after upgrading Mist

texts: I recently upgraded Mist from 0.3.9 to 0.5.0.  I have noticed that the capitalisation of some of the characters in my public address have changed. Is this normal?


texts:
I have implemented the code which is creating new wallet but I am not able to get the private key of that wallet. Can anyone tell me like what is the proper way in which I can create new wallet which can provide me the private key as well using node.

my code:-

web3.personal.newAccount(name, function (err, res) {
        if (err) {
            next(err,null);
        } else {
            next(null , res);
        }
    });


texts: Error: VM Exception while processing transaction: out of gas - How to save gas?

texts:
I have a contract that has about ~1.000 lines. But when I try to deploy it, it does not work because of an "out of gas error". I already tried with a limit of the maximum, of 6 million and even 8 million gas, still the same error.

I am working with Remix and would like to know how I can solve it. Due to privacy I cannot post the contract. But I am wondering, why can I deploy for example the CryptoKitties Contract which has 2x the amount of lines than what I have? and how can I see how much gas the contract needs? I tried in JavascriptVM with even a gaslimit of 100.000.000 but still not possible. Also in the testnet I use, I tried to limit up the gas limit to 15.000.000, still not possible.

And let's say my contract has 2 parts:
contract Token {}
contract Project {}

What would happen when I deploy only contract "Project" without the "is Token"? Could I still access Token somehow?

EDIT: When I enable the "Enable Optimization" option in Remix, the deploying works. Why? What is that option?


texts: Is there any flaw in my solidity contract?

texts:
Imagine a simple contract that collects Eth. Is there any way to manipulate this such that after users send funds, this.balance =/= max_val? Can this be gamed in a way that will allow isFinished() to never be able to get past the require statement?

uint max_val = 3 * 10** 18; // Can send up to 3 ETH
bool finished = false; // Not finished

// Function to send ETH
function sendEth() payable {
    require(!finished); // Cannot be over
    require(this.balance <= max_val);  // Contribution must be less than or equal to contribution max
}

// Function to finish sending
function isFinished() {
    require(!finished); // Cannot be finished. Cannot be called twice.
    require(this.balance == max_val);  // Must have collected max ETH
    finished = true;
}


texts: Unit testing a Solidity Library function with a struct memory argument

texts:
I am trying to unit test a Solidity Library contract function using truffle and web3. My simplified Library contract looks like this:

pragma solidity >=0.5.16;
pragma experimental ABIEncoderV2;

library BrickLib {
    struct ECSignature {
        uint8 v;
    }

    function checkSig(ECSignature memory sig)
    public pure returns(bool) {
        return true;
    }
}

I am attempting to call that function using web3/truffle in my unit test as follows:

const v = 1
await brickLib.checkSig.call({ v })

When this call is made, I get the following error:

Error: Returned error: VM Exception while processing transaction: revert

The same error also appears in the remix UI when I try to call the checkSig method from the user interface by deploying the library contract and entering "[1]" in the parameter. The exact error in Remix is:

call to BrickLib.checkSig errored: VM error: revert.
revert  The transaction has been reverted to the initial state.
Note: The called function should be payable if you send value and the value you send should be less than your current balance.  Debug the transaction to get more information.

However, any of the following modifications to the contract rectify the issue:

Changing the contract from a library to a contract.
Removing the memory parameter completely, even if there are other non-memory parameters present.
Calling the checkSig function from within another contract that is importing the library contract.
Changing the data type of the memory parameter from a struct to a standard type such as bytes memory.

I suspect this all has to do with how Solidity calls library methods and that the call method changes when memory arguments are introduced, but it is not exactly clear what is happening. Maybe I need to use a delegatecall instead of a regular call?

As I am writing unit tests for my contract library in Javascript, I would prefer not to have to deploy a second contract using the library in order to test it. I would also prefer to write my tests in Javascript and not Solidity. I'd rather also maintain the use of a struct, as my real code is more complex and structs assist in maintainability.


texts: Not able to access Geth node from External Server

texts:
I have hosted a geth node in a AWS machine using the below command

nohup  geth --networkid 12345 --verbosity 3 --ipcdisable --rpc --port 30301 --rpcport 8545 --rpcaddr 0.0.0.0 --rpccorsdomain "*" &

The node is working fine in the AWS machine. But i am unable to access the node externally from my localhost or any other computer outside the network. Even if when  i access the node from the external computer browser it does not give error instead gives a blank page. Not sure what's going wrong. In my local machine when i run the geth node and access it through browser it gives json output as

"{"jsonrpc":"2.0","error":{"code":-32600,"message":"EOF"}}"

I tried the below command  to check weather the node is running or not on AWS

curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' http://xx.xxx.xxx.x:8545

This curl commands returns proper result.

I also tried with different configuration such as -rpcaddr "0.0.0.0" --rpccorsdomain "*"  but it did not work.

Any suggestion why the node is not accessible outside the network. AM i missing any step. I want my geth node to be hosted on one AWS machine  and my application will access the node remotely.

Appreciate any suggestion. Thank you


texts: Call another contract 's function in contract 's constructor failed

texts:
I wrote two contract, the first Contract1 have a simple function, and the second Contract2 's constructor receive a Contract1 address and call the simple function.

I create Contract1 address, then use this address to create Contract2.

I found I can create Contract2 's address right in remix javascript vm, but fail in private net.

pragma solidity ^0.4.18;

contract Contract1{
    function simple() external view returns (bool) {
        return true;
    }
}

contract Contract2{
    bool public result;
    constructor(address contract1Address) public {
        Contract1 contract1 = Contract1(contract1Address);
        result = contract1.simple();
    }
}


texts: How to include an other contract from a different folder while unit-testing with truffle?

texts:
The folder structure is as follows:

Examples
  |
  +- Multiply
  |        +- Solidity
  |                 +- contracts
  |                           +- MultiplyContract.sol
  |
  +- UUIDProvider
               +- Solidity
                        +- contracts
                                  +- UUIDProviderContract.sol

And I want to test the (main) contract : MultiplyContract.sol

The migrations\2_deploy_contracts.js file looks like this:

var UUIDProviderContract = artifacts.require("../../UUIDProvider/Solidity/contracts/UUIDProviderContract.sol");
var MultiplyContract = artifacts.require("MultiplyContract");

module.exports = function (deployer) {
    deployer.deploy(UUIDProviderContract);

    var multiplier = 4;
    deployer.deploy(MultiplyContract, multiplier);
};

However when running truffle test, I get this error:

Compiling .\contracts\Migrations.sol...
Compiling .\contracts\MultiplyContract.sol...
Compiling .\test\TestMultiplyContract.sol...
Compiling truffle/Assert.sol...
Compiling truffle/DeployedAddresses.sol...
C:\SmartContracts\Examples\Multiply\Solidity\node_modules\truffle\build\cli.bundled.js:63556
  throw new Error("Could not find artifacts for " + import_path + " from any sources");

So how to include the UUIDProviderContract.sol ?

Or is this not possible and should I copy this to the same location as MultiplyContract.sol?


texts: Will the proof of stake in ether require you to have the wallet open to continue to stake?

texts: Will the proof of stake in ether require you to have the wallet open to continue to stake like stratis does?


texts: How can I import accounts created by quorumwallet into Ethereum Wallet Mist?

texts: I created an Ethereum address using quorumwallet.com. How can I manually import it to Mist Wallet so I can transact using Mist?


texts: Is there a case in which selfdestruct is more "powerful" than throw or revert?

texts:
Example in this scenario I guess selfdestruct will never get called (also: contract A isn't so important by the way just focus on B onward):

in Contract A:

address contractb = 0x....;

function sending() {
    contractb.call.value(1 ether)();
}

in Contract B:

address contractc = 0x...;

function () public payable {
    if (!contractc.send(msg.value)) {
        throw;
    }
    if (!contractc.send(0)) {
        throw;
    }
}

in Contract C:

address someone = 0x...;

function () public payable {
    selfdestruct(someone);
}

In short:

Contract A sends ether to B using call to have lots of gas...
B forwards the money further to C, the first time it tries it succeeds but C selfdestructs; The 2nd time it fails since C is selfdestructed...
throw should revert to a state without changes, but how can it revert a selfdesctructed contract?

I guess (and I am 99% sure what will happen...about to test now on Ropsten...): nothing will ever reach C since before any execution revert will check if anything can fail and if it can it reverts - speaking of which how can revert be so sure? What if transaction simply lacks gas to be mined say like 3 gas in call.gas(3).value(1)() - surely this will not get mined and maybe revert will prevent anything until mining happens? Thanx!


texts: [question deleted because not relevant anymore]


texts:
The web3.js (1.0) docs helpfully list the return values from a contract event subscription. I've noticed that there is an additional return value id that isn't listed there but is returned with the rest of the log data. An example of one is log_6b4f6cdd.

I'm looking for something that can help me uniquely identify a particular event even within a single tx or block. Is the id unique at least within a given contract?


texts: Metamask always show '0' for gas price and value

texts:
I tried to deploy and execute some transactions on multiple contracts but Metamask keeps showing 0 for the gas price and value field. I am on Ropsten test network. It is not specific to any contract, it is occurring on almost all contracts. Does anyone know the fix or the cause?

See screenshot, the below transaction is actually asking for 0.002 ethers from the account but it shows 0 here.


texts:
I am trying to import this contract from the swarm node and need to use the functions in this contract but I could'nt import it from swarm using this code

  pragma solidity ^0.4.8;

  import {KITTOKEN} from
  "bzzr://e0368ff5ab815ac687baeecc9261c317ea38117cb46d872cb295ae69500b6c00";

  contract KitToken is KITTOKEN{

  }


texts: Deploying Smart Contract into Ethereum testnet

texts:
I have followed this guide https://ethereum.stackexchange.com/a/2787/2426 (or equivalently https://www.ethereum.org/greeter ) when trying to deploy a simple Smart Contract into Ethereum testnet. I am using geth CLI on testnet. Everything works except final step, uploading code at blockchain. This is what I did:

GETH SECOND INSTANCE:

geth --testnet --unlock 0 attach ipc:.ethereum/testnet/geth.ipc
    instance: Geth/v1.4.10-stable-5f55d95a/linux/go1.6.2
    coinbase: 0x47978a69f410d0f61850c92acdb0d4c464d70937
    at block: 1697809 (Mon, 26 Sep 2016 07:10:20 UTC)
     datadir: .ethereum/testnet
     modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

> web3.fromWei(eth.getBalance(eth.accounts[0]).toNumber(), "ether")
"5.024681313417504"

COMPILE:

> var greeterSource = 'contract mortal { address owner; function mortal() { owner = msg.sender; } function kill() { if (msg.sender == owner) suicide(owner); } } contract greeter is mortal { string greeting; function greeter(string _greeting) public { greeting = _greeting; } function greet() constant returns (string) { return greeting; } }'

> var greeterCompiled = web3.eth.compile.solidity(greeterSource)

INSERT THE CONTRACT CODE INTO THE BLOCKCHAIN:

> var _greeting = "Good Morning, Smart Contract!"

> var greeterContract = web3.eth.contract(greeterCompiled.greeter.info.abiDefinition);

> var greeter = greeterContract.new(_greeting, {from: eth.accounts[0], data: greeterCompiled.greeter.code, gas: 4000000}, function(e, contract) { if (!e) { if (!contract.address) { console.log("Contract transaction send: TransactionHash: " + contract.transactionHash + " waiting to be mined..."); } else { console.log("Contract mined! Address: " + contract.address); console.log(contract); } } })

> debug.verbosity(4)

When exploring greeter, this is the output:

> greeter
    {
      abi: [{
          constant: false,
          inputs: [],
          name: "kill",
          outputs: [],
          payable: false,
          type: "function"
      }, {
          constant: true,
          inputs: [],
          name: "greet",
          outputs: [{...}],
          payable: false,
          type: "function"
      }, {
          inputs: [{...}],
          type: "constructor"
      }],
      address: undefined,
      transactionHash: null
    }

> greeter.greet();
    TypeError: 'greet' is not a function
        at <anonymous>:1:1

I wait a minute and got no message like this:

Contract mined! address: 0x...

So, contract seems to be properly compiled but I cannot obtain nor address, nor txHash after uploading into blockchain. Maybe it's not been uploaded, or mined. How can I figure it out? Did I miss something important?

Edit: Right after trying to deploy log is reporting a lot of messages like this one:

I0926 10:31:13.097817 core/state/state_object.go:160] 47978a69f410d0f61850c92acdb0d4c464d70937: #1048576 631783523629846744286 (+ 420000000000000)

Being 0x47978a69f410d0f61850c92acdb0d4c464d70937 the coinbase address of the geth node.


texts: Help with Error generated creating Token. I posted a screenshot of error

texts:
I took a screenshot of the error that was generated.  Someone please help me resolve this.  Thank you.

Code:
1 pragma solidity ^0.8.0;
2
3 import "https://github.com/OpenZeppelin/openzeppelin-
4 contracts/blob/master/contracts/token/ERC20/ERC20.sol";
5 contract MEEBA is ERC20 {
6    constructor(uint256 initialSupply) public     ERC20 ("MEEBA", "MEEBA"){
7        _mint(msg.sender,initialSupply);
8    }
9 }


texts: I want the full list of ethereum smart‑contracts whose balances increased by 1000 Ethers above the past week

texts:
How to make this kind of query using my 200kb/s second Internet connection speed ?

With such speed, there’s no possibility to run an archival node (except maybe with a service allowing to download only recent blocks without the previous ones).


texts: Which cryptographic hash function does Ethereum use?

texts: Many sources refer to the use of the "SHA3" cryptographic hash function within Ethereum, but the Ethereum project began before the SHA3 standard was finalised, and there was some confusion/controversy around the final parameters selected for the standard.  Which function specifically did Ethereum actually end up with?  Is it the same as the actual SHA3 standard, or one of the variants within the standard?  Or is it a parameterisation of Keccak that doesn't match any of the variants?


texts: I am designing a system where some data needs to be hidden and the idea is to store it in an encrypted file. How can you allow nodes to interact with it through a smart contract without revealing the encryption key?


texts: Why would you use MEW if you have Metamask?

texts: I see that I can login to my MEW using meta mask. But how does that make any sense? I can do all the functions of MEW in meta mask add-on. Am I missing something here?


texts: How to user SafeERC20 from zeppelin-solidity

texts:
I am trying to utilize the  SafeERC20 library from zeppelin-solidity.
However the instructions for using the library are not sufficient for a novice like me .
Please help me in understanding .
   /**
   * @title SafeERC20
   * @dev Wrappers around ERC20 operations that throw on failure.
 + * To use this library you can add a using SafeERC20 for ERC20; statement to your contract,
 + * which allows you to call the safe operations as token.safeTransfer(...), etc.*/    when I utilize it in my Contract token program , How shall I use it ?
code is available here                  https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/ERC20/SafeERC20.sol

below is the code .
https://gist.github.com/bhattnaval/2eea6398fab22e64140bef930243bacd


texts: Can't find a way to log when revert()'ing in remix

texts:
This is my first time working with Solidity and I soon ran into an issue.

When an address doesn't have enough balance or doesn't have the authority to add coins I want to log an error, when these exceptions happen the script does what it's supposed to do which is return. The issue is that I can't seem to find my logs anywhere.

This is the code:

pragma solidity ^0.4.0;

contract Testcoin {
    address public creator;
    mapping (address => uint) public balances;

    event Delivered(address from, address to, uint amount);
    event StringLogger(string message);

    function TestCoin() {
        creator = msg.sender;
    }

    function create(address receiver, uint amount) {
        if (msg.sender != creator){
            emit StringLogger('This Account is not allowed too create tokens.');
            revert();
        }
        balances[receiver] += amount;
    }

    function transfer(address receiver, uint amount) {
        if (balances[msg.sender] < amount){
            emit StringLogger('Not enough balance');
            revert();
        }
        balances[msg.sender] -= amount;
        balances[receiver] += amount;
        emit Delivered(msg.sender, receiver, amount);
    }

}

When for example the sender has 3000 balance and tries to send 4000 to x address I receive a log that the transaction was mined but failed but the output and logs are empty.

How could I get to see the logs so I can see exactly what happened?


texts: Like an ERC20 interface, do we have any interface or a smart contract that supports creating and transferring Ether on Ethereum?

texts:
To create a token on Ethereum, we use ERC20 token interface to design our token smart contract that captures functions required like mint(), tranfer(), balanceOf(), etc.

Similarly, do we have any smart contract or interface that captures all these functions for Ether on Ethereum?

How different is this compared to Bitcoin?

Thank you for your help and time!


texts: What's the vulnerability in my contract?

texts:
I've got a contract deployed at 0xe559835D7979dAe994331DEfaEc2FBA057E56C27
on the mainnet.

Every time I go to call the payable function, which is solve, a bot beats me to it.  My transaction gets rejected and theirs goes through.

pragma solidity >=0.4.21 <0.6.0;

// deployed at
// 0xe559835d7979dae994331defaec2fba057e56c27

contract EqHunt {

  struct Equation {
    string repr;
    int answer;
    bool exists;
  }

  mapping(string => Equation) equations;
  mapping(string => address[]) public solvers;
  address payable private owner;

  uint256 public lastSolveTime;

  uint256 private delay;

  constructor() public payable {
    owner = msg.sender;
    lastSolveTime = now;
    delay = 10 minutes;
  }

  function locked() public view returns(bool) {
    if(now - lastSolveTime <= delay) {
      return true;
    } else {
      return false;
    }
  }

  function create(string memory _id, string memory _repr, int _answer) public {

    require(msg.sender == owner);

    require(!equations[_id].exists);

    Equation memory e = Equation(_repr, _answer, true);

    equations[_id] = e;

  }

  function getEquation(string memory _id) public view returns(string memory) {
    return equations[_id].repr;
  }

  function check(string memory _id, int _answer) internal view returns(bool) {

    require(equations[_id].exists);

    if(equations[_id].answer == _answer) {
      return true;
    } else {
      return false;
    }
  }

  function rand() internal view returns(uint256) {
    return uint256(uint256(keccak256(abi.encode(block.timestamp)))%10) + 1;
  }

  function payout() internal view returns(uint256) {
    return 40000000000000000/rand();
  }

  function reward(address payable _payee) internal {

    uint256 r = payout();

    require(address(this).balance>=r);

    require(now - lastSolveTime > delay);

    _payee.transfer(r);

    lastSolveTime = now;

  }

  function solve(string memory _id, int256 _answer) public payable {
    require(!hasSolved(_id));
    bool correct = check(_id, _answer);
    require(correct);
    if(correct) {
      addSolver(_id);
      reward(msg.sender);
    }
  }

  function addSolver(string memory _id) internal {
    solvers[_id].push(msg.sender);
  }

  function hasSolved(string memory _id) internal view returns(bool) {
    address[] memory _solvers = solvers[_id];
    for(uint256 i=0; i<_solvers.length; i++) {
      if(_solvers[i] == msg.sender) {
        return true;
      }
    }
    return false;
  }

  function getNumSolvers(string memory _id) public view returns(uint256) {
    address[] memory _solvers = solvers[_id];
    return _solvers.length;
  }

  function getSolvers(string memory _id) public view returns(address[] memory) {
    return solvers[_id];
  }

  function withdraw() public payable {
    require(msg.sender == owner);
    owner.transfer(address(this).balance);
  }

  function() payable external {}

  // // TEST CODE
  //
  // function testRand() public view returns(uint256) {
  //   return rand();
  // }
  //
  // function testPayout() public view returns(uint256) {
  //   return payout();
  // }
  //
  // function testReward(address payable _payee) public {
  //   lastSolveTime -= 10 minutes;
  //   reward(_payee);
  // }
  //
  // function getBalance() public view returns (uint256) {
  //   return address(this).balance;
  // }
  //
  // function testHasSolved(string memory _id) public view returns(bool) {
  //   return hasSolved(_id);
  // }
  //
  // function testCheck(string memory _id, int _answer) public view returns(bool) {
  //   return check(_id, _answer);
  // }

}

I want real people interacting with the contract, not bots - I thought using a 4 character ID would prevent that.


texts: Can paritytech/parity be used as a library the same way that go-ethereum can be used in Go?

texts:
The go-ethereum project is divided into a set of standalone libraries that can be used in any Go project (e.g. smart contract interaction, keystore management, common cryptography and hex utils)

Can the same be done using the paritytech/parity project code or is it not structured in such a way that it can be easily used for external projects?

P.S. Are there any other projects/libraries that someone interested in both Rust and Ethereum should know about?


texts: Error: Cannot create instance of X; no code at address

texts:
Having a little issue. I have deployed a Mock ERC20 contract on development network like so:

const ERC20Mock = artifacts.require("ERC20Mock");

module.exports = async function(deployer, network, accounts) {
    if (network === "development") {
        console.log("Deploying MockDAI on Development at: ", accounts[5]);
        await deployer.deploy(ERC20Mock, accounts[5], 100*(10**6), {from: accounts[5]});
    }
}

And trying to interact with truffle test:

contract("Erc20Teller", function([_, adminRole, user ]) {
  let daiAddress;
  beforeEach(async function() {
    daiAddress = (await web3.eth.getAccounts())[5];
    this.daiToken = await ERC20Mock.at(daiAddress);
  });

However, I am receiving  Error: Cannot create instance of ERC20Mock; no code at address 0x7F39C89Ed1954AB82361C23f6c02b420DF65b3D0 even though the same address is clearly being used in my migrations and in the unit test. What could the problem be?


texts: Are failed transactions included in the blockchain?

texts: When a transaction that executes a smart contract fails (maybe for an exception or require rule), is the transaction propagated to the network and included in the blockchain? If yes, what would be the reason for that?


texts: Calculating difficulty and verifying a hash as a solution

texts:
I have a scheme right now where individuals are committing to a contract a solution to a problem similar to Bitcoin's proof-of-work protocol. Here's the basic flow...the contract calculates a seed hash and individuals are trying to hash it (off-chain just using their own equipment) while incrementing a nonce until they find a solution within a certain subset of the 256 bit range (0 to 2^256 - 1). I am trying to figure out (1) what difficulty there should be if I want someone with a hash power of 1 MH/s to have a 95% chance of solving within a week and (2) the proper way to check if the submitted solution satisfies the requirement of being within the pre-specified range.

For (1) here is how I am calculating the difficulty D:

1 - ((D - 1) / D) ^ H = 0.95

So D can be thought of as representing the number of sides on a dice. The first "1" represents 100% of the possibilities, the "((D - 1) / D)" represents the subset of outcomes which are incorrect, and H represents the number of times the dice is rolled. So for example if I want to calculate the odds that I will roll a 1 within 4 rolls I have 6/6 - (5/6)^4 = 671/1296 = ~51.7%.

I'm trying to extrapolate this to hashing. In that case D represents how many pieces of pie the 2^256 range is sliced into and H represents the number of hashes performed. 1 week @ 1MH/s = 604.8 gigahashes. Solving for D gets me ~201,887,199,781 pieces of pie. My first question is do these calculations make sense? Will it take someone with 1 MH/s about a week to find a solution within one slice of pie?

For (2) I am writing an ETH contract which needs to calculate whether a submitted solution falls within the specified range given that difficulty. Here is how I am calculating that:

if (uint(sha3(finalSeed, _nonce)) <  2 ** 256 / difficulty )

So I am taking the entire 2^256 range and dividing it by the number of pie slices to arrive at how many numbers fit inside a single slice. The range the solution has to be in then is zero to the size of a slice of pie minus 1. Does this make sense? Is it necessary to convert to uint to perform this? Am I wasting a ton of resources with the "2 ** 256 / difficulty" calculation? Is there an easier way to accomplish all of this?

Any help would be greatly appreciated.


texts: Creating a token that allows the owner to take a proportion as fee?

texts:
I want to create a token for my company, that when ever there is a transaction on chain, a 0.1% of the transaction will send to the company private wallet.

How am I suppose to achieve this?

Thank you


texts: how to create multiple owners : Solidity

texts:
I am creating a contract in which i want is like multiple owners have the rights to whitelist the user.

contract Whitelist {

    mapping(address => bool) Users;
    address private owner;
    address private otherOwner;

    function Whitelist() {
        owner = msg.sender;
    }
//Modifier for owner access
    modifier onlyOwner() {
        require(owner == msg.sender);
            _;
    }
//Function to add users
    function userAdd(address userAddress) onlyOwner {
            require(userAddress != 0x0 && !Users[userAddress]);
            Users[userAddress] = true;

    }
//Checking the user is whitelist
    function isWhitelisted(address passAddress) external returns (bool) {
        return Users[passAddress];
    }

i am not getting idea about how to do that.
need help.
thanks in advance.


texts: Gas Consuption: Deploying contracts from within a contract

texts:
I have a contract A that does nothing other than allowing to deploy contracts B and C in functions. Deployment of A exceeds gas limit. Seperate deployment of B and C work fine.

So my naive assumption seems to be wrong: it is much cheaper to provide the functions to A (which arent actually executed on deployment of A) instead of actually deploying B abd C e.g. in the constructor.

Can someone correct me/ give me the background? And maybe give me a hint on how to best deploy tree structures of contracts that depend on previously created ones?

Thanks in adance


texts: I have been reading recently about the DeFi space. I have noticed (admittedly, pretty late) quite a bit of buzz regarding WBTC and its applications in Ethereum. I have read about the Compound dapp and how it allows users to put assets like WBTC into a liquidity pool and earn extremely high interest rates (>5%!). Is this legit? I currently have $X in a US money market account, but given the federal interest rate, this MM account is yielding <1%. As a result, it seems to make financial sense for me to move $X to buy Y amount of BTC, transfer that Y amount of BTC to Y amount of WBTC (via something like CoinList), and then put this Y WBTC into the liquidity pool on Compound and earn >5% annual interest. While complex (at least in comparison to what I as a 'classic' investor might normally do), it seems relatively easy to do. But it just seems... I don't know, too good to be true? I just convert my FIAT->BTC->WBTC and earn >5x what I am earning in the highest yield MM I can find? Am I misunderstanding some part of the process? Is there some hidden tax or fee structure that makes the return dramatically lower? I guess there is risk of depreciation of the WBTC while it is sitting in the liquidity pool, and that would lower my absolute return. Is that the only negative? 5% just seems fantastical as a guaranteed rate.


texts: Web3 call should return different result based on time passed

texts:
I am experiencing a weird issue. I am building a DApp where I want the new season of the game to start every 5 minutes (for testing purposes). However, web3 call returns old data, seems that it cached it and didn't refresh unless I send a tx. Here is a code snippet, smart contract:

uint public constant SEASON_DURATION = 5 minutes;

uint public start;

constructor() public {
    start = now;
}

function getCurrentSeason() public view returns (uint) {
    return (uint) ((now - start) / SEASON_DURATION);
}

React frontend:

const season = await myContract.methods.getCurrentSeason().call({from: activeAccount});

After 5 minutes pass, it still returns 0 even if I refresh the page. If I do a transaction (invoke any function in a smart contract), then getCurrentSeason() returns the correct value. What could be the solution?

I am using:

web3 ^1.2.6
Solidity v0.5.16
Ganache (GUI version) v2.1.2
Truffle v5.1.9
Node v10.15.3
Metamask wallet


texts: How do i get a smart contract to interact with a website?

texts:
I have a site, let's say a user solves a game, i want that user to be stored in a database that represents users who solved the game, users stored in this database will then be able to redeem tokens.

How do i establish the connection that the user solved the game and is now eligible to be stored in this database?


texts: Geth --rpc frozen after using geth --rpc --fast

texts: For some reason it froze. Midway through the syncronization I stopped and re-entered geth rpc --fast Now for some reason it's super slow! At this rate it will be done in maybe a couple years or so. (On block 4055210)


texts:
How can I get from value from RLP Txn. Or How can I get signed user using R & S value. Currently I am using go ethereum.
Please help me.


texts:
The ethereum wiki has a specification of basic, direct and indirect ICAP addresses. Where the basic and the direct are well explained here and here, I have trouble to understand how indirect ICAP addresses work?

Can you generate an indirect ICAP address from a raw hex ethereum key? If so, how does that work out?

Or is it meant to be calculated reverse? Like you have the address first and calculate the hex backwards? But how is associated private key generated that way? Is that even possible?


texts: When developing my smart contract, how can I debug it? Are there any debugging, testing tools or simulators that I can use to examine my code?


texts:
I am trying to deploy the contract using web3.js@1.2.6
i have mentioned the error and code that i have typed i m stuck in line 10


texts: Need Some Basic Information related Ethereum

texts:
I'm newbie to block chaining and need help related truffle and related tools....
Q. Whats difference between truffle and ganache?
Q1. Is truffle/Ganache(Don't know difference) is server side EVM, I mean if I'm developing android Dapp then do I connect to it? Like if you are creating web app then it is easy as I have seen tutorials but I couldn't find any on android Dapp (which cover basics).
Q2.Whats use of meta Mask as I have seen it on youtube there were using it? what if do not use it.
THANKS IN ADVANCE ;) and please don't mind my silly questions, As I'm totally new to this stu


texts: SSL Certificate for remix-ide environment

texts: I have installed remix-ide in my azure vm.Through http:/publicip:8080 i can able to access the remix-ide environment but i dont know how to make it as a https and where to mentioned the ssl certificate path.Please help me to do this


texts: how to get code for already deployed contract in ethereum network

texts: Let's say peer A is deployed a contract and exposes contract ABI. Peer B wants to join the same network.He have the ABI with him.But he wants to see the real contract code before joining the network.How peer B will be able to see that.


texts: Monitoring events from multiple contracts

texts:
I'm working on a project that allows users to automatically deploy a specific contract that I created.
It's important for the system to be able to listen to specific events (for example, new transaction) on ALL deployed contracts.

Note: I'm using nodejs through web3 json rpc to monitor events.

One possible solution I thought of is to use a wrapper contract that tunnels all transaction requests and sends the events itself.
This will allow to only listen to events from a single contract but I don't find that solution very elegant.

Is there an efficient and scalable way to accomplish that without creating a listener on each specific contract?


texts:
I am planning an airdrop of an ERC20 mintable token created through a crowdsale contract based on Open Zeppelin.

Now what I am wondering, is what would be the cost effective way of adding an airdrop functionality. Here's what I could think of:

Send all tokens reserved for the airdrop to the crowdsale's owner wallet on contract creation and then write a small Node.js + Web3 + ethereumjs-tx app that simply loops through the list of airdrop wallets and sends to each one of them some tokens (wallet to wallet) using sendSignedTransaction.
Add an airdrop method to the Crowdsale contract that will receive the array of wallet addresses and loop through those, mint()ing and transferring the tokens to each of them. Then call that method through Node.js + Web3 passing it the list of addresses?

Is there a better way that I am missing?

What would be cheapest way to do this?


texts: Testing ethereum smart-contracts that work with oraclize

texts:
I'm new in Ethereum and I have a smart-contract that receive exchange rate from API through oraclize. But I have problems with testing my smart-contract. For testing I use truffle + ganache.
Could anybody give me some examples or advice how to do this?!
Thanks in advance!!!


texts: MetaMask Calling Child Contract Methods?

texts:
I had created a contract(Organisation.sol)  that create other contracts(Session.sol). When I call any method from(Organisation.sol) using web3js it work well. But If I ever tried to call any method from (Session.sol) metamask will give me this error

ALERT: Trying to call a function on a non-contract address.

Solidity Code

pragma solidity 0.5.0;
//Session

contract Session {

      address public creator;  // The address of parent Organization

      string sessionName;
      string description;
      uint startTime;
      uint endTime;
      address[] lecturer;
      address[] attendes;

      int[] result;
      mapping(address => int) public attendes_feedback; //institution boardMembers
      modifier onTime(uint _startTime){
            require(now < _startTime);
            _;
      }
      constructor (string memory _sessionName, string memory _description, uint _startTime,uint _endTime,address[] memory   _lecturer,address[] memory  _attendes) public onTime(_startTime){

              sessionName =  _sessionName;
              description = _description;
              startTime = _startTime;
              endTime = _endTime;
              attendes = _attendes;
              lecturer = _lecturer;
              initAttendes(attendes);
      }

    function initAttendes(address[] memory _attendes) private{
           for(uint i=0 ; i < _attendes.length ; i++){
            attendes_feedback[_attendes[i]] = -1;
        }
    }

    function Time() public view returns (bool){
       return (now >=  startTime  && now <= endTime);
     }

    modifier checkTime(){
        require(Time());
        _;
      }
    function take_feedback(address _voter,uint8 _feedback)  public checkTime {
          require(attendes_feedback[_voter] != 0);
          attendes_feedback[_voter] = _feedback;
          result[_feedback]++;
    }

  function seeResult() public view returns(int[] memory){
          return result;
  }

 }

contract Organization {

     address creator;
     event sessionnCreated(string name,address sessionAddress ,address creator);

     /*  modifier onlyCreator(){
        require(msg.sender == creator);
        _;
    } */
     function createdSession(
      string memory _sessionName,
      string memory _description,
      uint _startTime,
      uint _endTime,
      address[] memory _lecturer,
      address[] memory _attendes
     ) public   returns(address) {

        Session sessionAddress = new Session(_sessionName , _description , _startTime , _endTime, _lecturer,_attendes );
        emit sessionnCreated(_sessionName,address(sessionAddress),creator);
        return address(sessionAddress);
     }
}

Session Contract initialization:

 var sessionContract = web3.eth.contract(SessionArtifact.abi).at(sessionAddress);

Then I tried to initialize contract in a different way.

var sessionContract = web3.eth.contract(SessionArtifact.abi, sessionAddress);

Then Calling Session Contract Method

sessionContract.take_feedback('0xa8ff46045fa2c6a0af361819b62126e1b0ec8909', 5).call().send({ from: this.account });

Then I tried calling function in a different way.

sessionContract.take_feedback('0xa8ff46045fa2c6a0af361819b62126e1b0ec8909', 5, function(error, result) {
               if (!error) {
                   console.log(result);
               } else
                   console.error(error);
           });

But all my attempts  give me the same error in metamask:

ALERT: Trying to call a function on a non-contract address.

Edit:
How I got the address

createdSession: async function(_sessionName, _description, _startTime, _endTime, _lecturer, _attendes) {
var sessionAddress;
const { createdSession } = this.meta.methods;
await createdSession(_sessionName, _description, _startTime, _endTime, _lecturer, _attendes).send({ from: this.account }); sessionAddress = await createdSession(_sessionName, _description, _startTime, _endTime, _lecturer, _attendes).call(); alert("Contract created successfully contact addresss is " + sessionAddress);
},


texts: How can I parse internal transactions with light node?

texts: is that possible to receive all transactions from new block with light node and parse all and even internal transactions with the help of its api?


texts: Is struct data returned from web3 guaranteed to be in the correct order?

texts:
I have this solidity struct

struct Prices {
    uint sell_price;        // wei
    uint target_price;      // primary
    uint penalty_price;     // wei
}
Prices public prices

In truffle when I do contract.prices() I retrieve an array [sell_price, target_price, penalty_price] , the order which they are listed in the struct. I wanted to know if this order is guaranteed?


texts: Extra incentives for miners in smart contracts

texts: I am thinking to create a smart contract where miners are not only incetivized by gas price but where basically the miner can get other assets like erc20 tokens if he/she mine my transaction in the next block. This would look like the tx fees in Bitcoin where the unassigned money is in the hands of the miners. I'd like to have a formal address argument in my contract which can be assigned at mining time with the actual address of the miner. I've never seen anything along these lines but I wonder if it is possible today or will be anytime soon.


texts: Casting Object to BigNumber in Meteor DAPPs

texts:
Web3 incorporates the BigNumber library in order to handle 256bit numbers.

I'm finding this problematic in Meteor as most of Meteor's reactive storage schemes such as Session, ReactiveDict and collections render BigNumber objects as simple JSON objects, thereby losing all the BigNumber functionality.  ReactiveVar has no such problem and preserves type.

Meteor can preserve object types as EJSON but requires that the object have a custom toEJSON() function and a factory function added to the EJSON module for the custom type.

I haven't seen such coding for EJSON in the few DAPP examples around and am wondering how others are getting around such problems with BigNumber reactivity and storage?

For example, how does one display BigNumber from blockchain events which get stored in a Meteor collection as simple Objects?

amount: Object
c: Array[1]
e: 3
s: 1


texts: How much data can be stored in a bytes type in a smart contract?

texts:
What are some estimates of how much data can be stored in a bytes type in a smart contract?

contract test {
    bytes data;
    function storeData(bytes _data) {
        data = _data;
    }
}


texts: How can I do it Erc20 Token Address Subscription

texts:
API listening to the transaction at the router address in the code below In addition, can I add the any token address on this router address for subscription?
 wss.on('connection', function connection(ws) {
    let txChecker = new TransactionChecker(process.env.WEB_SOCKET_PROVIDER_URL, process.env.HTTP_PROVIDER_URL, '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D');
    txChecker.subscribe('pendingTransactions');
    txChecker.watchTransactions(ws);
});


texts: Sent a small amount of ETH from GDAX to a hex at Bittrex exchange. Coinbase receipt on Etherscan says "success," and the hex is right but no ETH arrived at Bittrex exchange. What gives? It's been 2.5 days.


texts: Invoking events without "emit" prefix is deprecated in Transfer(msg.sender, _to, _value);

texts:
I'm following this page instructions to create my own crypto-currency with Ethereum. Here is my code:

pragma solidity ^0.4.18;

contract MyToken {
  string public name;
  string public symbol;
  uint8 public decimals;

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

  /* This creates an array with all balances */
  mapping (address => uint256) public balanceOf;

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

  /* Send coins */
  function transfer(address _to, uint256 _value) public {
    /* Check if the sender has balance and for overflows */
    require(balanceOf[msg.sender] >= _value && balanceOf[_to] + _value >= balanceOf[_to]);

    /* Add and subtract new balances */
    balanceOf[msg.sender] -= _value;
    balanceOf[_to] += _value;

    /* Notify anyone listening that this transfer took place */
    Transfer(msg.sender, _to, _value);
  }
}

Right now I'm stuck in the line Transfer(msg.sender, _to, _value); because of this error:

Invoking events without "emit" prefix is deprecated.
    Transfer(msg.sender, _to, _value);
    ^-------------------------------^

I'm still new in Ethereum platform so I'm not sure what that error means.


texts:
In the MIST wallet (0.5.2) I somehow managed to create a Watch Token contract which was not correct and then it showed up like this: the one in the middle.
It is greyed out and I want to delete it, but unable to do so.
As you may be aware you can delete the other 2 (red and green ones shown here) when hovering the cursor over the icon which then turns into a recycle bin and you can then click and delete/remove it.
But the middle one is simply dead, nothing happens when moving over it.
How can I get it removed from there?
BTW that UNICORNS token, I have no idea where that one came from? I did not create it, it popped there all by it's own :( ?? "scratching the top of my skull in confusion"


texts: Accessing a 3rd party contract's functions using Truffle

texts:
I'm trying to build a basic dashboard that will allow me to track the status of any given ICO (assuming the token is ERC20).

Right now, I managed to deploy a simple Crowdsale + Coin contract based on OpenZeppelin and Truffle and I am able to access the state variables and functions on an Angular 2 frontend I built.

The next thing I did, which is also working fine, is using web3 (without Truffle) to access another deployed Token, for example BAT and read its public state variables. This was achieved with this code:

  var abi = [...] ;
  // Copied ABI from Etherscan https://etherscan.io/address/0x0d8775f648430679a709e98d2b0cb6250d2887ef#code

  var MyContract = this.web3.eth.contract(abi);

  // initiate contract for an address
  var myContractInstance = MyContract.at('0x0D8775F648430679A709E98d2b0Cb6250d2887EF'); //Address to which BAT token is deployed.

  // call constant function (synchronous way)
  //var owner = myContractInstance .owner.call();

  console.log(myContractInstance);

  myContractInstance.totalSupply.call({from: this.account},
    function(error, result){
      console.log(result.toString(10))
  });

This effectively allowed me to access totalSupply of BAT from my own frontend.

Now, I'm having a hard time figuring out how I could replicate this code, but using Truffle instead of web3 calls.

I'm currently accessing my own deployed contracts like this:

//Contracts have been built with Truffle here:
const crowdsaleArtifacts = require('../../build/contracts/PabloCoinCrowdsale.json');
const coinArtifacts = require('../../build/contracts/PabloCoin.json');

Crowdsale = contract(crowdsaleArtifacts);
Coin = contract(coinArtifacts);

//Bootstrap abstraction for use.
this.Crowdsale.setProvider(this.web3.currentProvider);
this.Coin.setProvider(this.web3.currentProvider);

//Once everything is loaded, for example, get totalSupply of Coin
this.getCoinInstance();

getCoinInstance(){
    this.Crowdsale
    .deployed()
    .then(instance =>{
      //Set the ref for the contract and look up it's associated token
      this.crowdsaleInstance = instance;
      this.crowdsaleInstance.token()
      .then(addr => {
        this.Coin.at(addr)
        .then(instance2 =>{
          // set the ref for the token and get totalSupply.
          this.coinInstance = instance2;
          this.totalSupply();
        })
      })
    })
    .catch(e => {
      console.log("ERR",e);
    });
  }

totalSupply(){
    this.coinInstance.totalSupply({
      from: this.account
    })
    .then(value =>{
      console.log("Total Supply:",this.web3.fromWei(value, "ether").toString(10));
    })
    .catch(e => {
      console.log(e);
    });
  }


texts: "Augur" : Is it an "Oracle" or "data-source" ? which one?

texts:
If we define following three entities (as defined HERE):

(1) data-source

(2) query

(3) the oracle/oracle network

Then, as this article says, is "Augur" a data-source ? Or it is an "Oracle" ?


texts:
So, I was working on my own mining client which it works on some ubiq pools, now im trying to make it work with Ethereum on ethermine.org pool which uses stratum, how do I handle the data recieved on the mining.notify message from the stratum protocol?

This is what I am currently getting:

{
"id":6,"jsonrpc":"2.0","method":"mining.notify","params":["1bb26087406b1884f19115d6ca0c5847f4ac4163159977225a92d873daae14d1",
"1bb26087406b1884f19115d6ca0c5847f4ac4163159977225a92d873daae14d1",
"cfa3e37c459ebd9b4138bd2141a52d89f6f8f671ecf91456f5a29176eb132fc0",
"0000000112e0be826d694b2e62d01511f12a6061fbaec8bc02357593e70e52ba",
false]}

On the pool that I started to work with the result from GetWork calls were three parameters, HeaderHash, SeedHash and Boundary which allowed me to build my Block header object like:

    public BlockHeader(string header, string seed, string boundary)
    {
        this.HeaderString = header;
        this.BoundaryString = boundary;
        this.SeedString = seed;
        this.HeaderHash = BlockHeader.StringToByteArray(header.Replace("0x", string.Empty));
        this.SeedBytes = BlockHeader.StringToByteArray(seed.Replace("0x", string.Empty));
        this.BoundaryBytes = BlockHeader.StringToByteArray(boundary.Replace("0x", string.Empty));
    }

How do I get headerhash, seedhash and boundary from the stratum resposne which has 5 elements?


texts: Collecting crypto art from multiple NFT platforms in the same wallet

texts:
Is it bad practice to collect several pieces of crypto art (NFTs) from multiple platforms (Rarible, Makersplace, Opensea, Gemini Nifty Gateway, Async art, etc) all into the same Ethereum wallet?
And would I be able to display my art collection across all these platforms where I set up my profile on, even though each NFT was minted at only one unique platform?
For example, if I buy the "Mona Wisa" on Rarible, which was minted on Rarible, will that piece of art also appear in my gallery collection at Makersplace, Opensea, etc? I ask because it seems to me that wherever a piece of crypto art is obtained/purchased, seems to be the only place it can be (allowed to be) displayed, other than of course appearing on the blockchain in my wallet.
Finally, if I lose the seed phrase for this wallet, will all the original art purchased on the wallet be completely lost? Imagine how even the artist would feel


texts:
I'm trying to understand the logic of Consensys' MultiSigWallet and being stuck with the understanding that onlyWallet can call addOwner() or removeOwner() or replaceOwner().

There are no such function-calls in the contract. It looks like it is for externals (human) calls.

On the other hand, the onlyWallet() modifier that will "revert() if the caller != contract itself" and prevent such calls.

How does it work?
Who can actually call these functions and how exactly?


texts: Manage accounts in Remix Web3 Provider env connected to a TestRPC client node

texts:
When I run the TestRPC client (ganache-cli), it provides me with 10 different accounts and private keys along with a local server at localhost:8545

  Available Accounts

  (0) 0x6b499615fb839b33ffd9cea1380727a7ee0c39b1

  ...

  (9) 0x8ff593ecc3f4068ff15bffe4481ec627e7cd8247

  Private Keys

  (0) cb7eba4cef5a7a1ad16b30e7b380b38a1d23fc52aaebed77d5c53d4b7133cd6c

  ...

  (9) 9a64d0bbadbf1873657ecf02b7c0b926cef1fdde34283478ef7973473f339537

  HD Wallet

  Mnemonic:      ordinary husband nation coast above benefit hamster kitchen fantasy check notice hobby Base HD Path:
  m/44'/60'/0'/0/{account_index}

  Listening on localhost:8545

Now, in Remix when I change the environment to Web3 Provider and connect to localhost:8545, the box Account gets emptied and I'm forced to create a new account assigning a passphrase to it. It does not let me choose any of the above accounts created automatically by TestRPC.

The problem is that this new account created by Remix has a balance of 0 so it doesn't let me deploy a smart contract or do anything else.

How can I pick in Remix one from the 10 accounts created by TestRPC or how can I transfer some ether from one of these accounts to the account created by Remix in order to deploy a smart contract and make other transactions?

Thanks in advance.


texts:
Please give an example how to use EtherEx API from both JavaScript and Python programs.

Where should I connect before sending a method call?

I am especially interested in add_market method.


texts: Remix IDE: Infinite gas problem with withdraw(...) method

texts:
I am trying to compile the following contract. I am using Remix IDE. It is giving me infinite error in the Withdraw method.

    pragma solidity ^0.4.24;

     contract financialContracts4{

     address issuer; constructor() public{    issuer = msg.sender; }
     modifier ifIssuer(){    if(issuer != msg.sender){
           revert();    }else {
             _;//underscore    } }
function receiveFunds( )public payable{
         }
function getValue() public view returns(uint) {   address myAddress = this; return myAddress.balance; }
function withdrawFunds(uint funds) ifIssuer{   issuer.transfer(funds); } }

The error message is:

  Gas requirement of function financialContracts4.withdrawFunds(uint256)
  high: infinite. If the gas requirement of a  function is higher than
  the block gas limit, it cannot be executed. Please avoid loops in your
  functions or actions  that modify large areas of storage (this
  includes clearing or copying arrays in storage) is:

Some body please guide me.

Zulfi.


texts: Is Gas consumed in boolean operations that do not change contract state?

texts:
Imagine I've created a voting contract, and I'm the owner of this contract.
I'm going to deploy it and create a front end to interact with it.

Within my contract i've everything secured to add authorized voters and possible winning candidates.

With all set, after the deployement, I don't want that my voters actually pay to vote in someone, so as owner I want also take care of all transaction fees.

Here's the first question:
Is it possible a scenario like this? As contract deployer/owner, also handle all fees that are used to do contract state changes?

Next question:
Imagine that an unauthorized voter is trying to bypass this authorization and spam my vote function. As the owner of the contract and handler of all fees, i dont want to be charged if something like this occur. So summary, do "requires" actually consume gas if no change in the contract state occurs?