texts:
I'm working to understand ERC-20 tokens. I believe that I'm confused on a detail based on a previous SO question. Please allow me to use the Basic Attention Token (BAT) as an example.

I have a Ledger Nano. On that Ledger Nano, I have $1.00 worth of Ether for the purpose of learning how this works. I know I can send and receive Ether via the Ether wallet app. I'm interested in converting that $1.00 of Ether to BAT.

To do, I thought I would use ShapeShift. My question is, where am I sending the Ether to? From my understanding of a previous SO question, you don't have a wallet address for ERC-20 tokens. In other words, someone doesn't formally have a BAT wallet. Instead, the BAT contract manages that for you. At this point, I don't know if I'm misunderstanding something about ERC-20 tokens / wallets, or if ShapeShift just has a confusing UI.

In ShapeShift, you choose what you want to convert from (ETH) and what you want to convert to (BAT). You then say how much (ETH) you want to convert. It then asks you for "your Basic Attention Token address" and "Your Ether Refund address". I was expecting that since I already selected BAT, that the contract address would already be selected. Then the "Ether Refund address" would just be my public Ethereum address.

Do I need to setup a new wallet via MyEtherWallet that is specific for my BAT tokens? I then assume I could use that wallet's public address as the "Basic Attention Token address" in ShapeShift. This seems correct. However, it seems like it contradicts how I thought tokens worked.

Thank you for helping me understand this.


texts: Is there a way to listen to log events via websocket with web3py

texts:
i am trying to listen to log events via my node's websocket server but i can't seem to find a way to do that using the web3Py lib. the asynchronous implementation of the docs is basically a threaded loop that queries the node every amount of time. this would work if i have a single contract or even to look at but when having multiple filters to look at individually, this can be very resource consuming.
is there a way to implement the websocket log filtering with web3py, considering it is available in the web3js implementation?


texts:
I have a web application which has DynamoDB as the database. I want to store some SCORE in a DynamoDB table.

How can I restrict this SCORE to only some set of people in my web application can modify by using blockchain?

Users in my application enters some items, With some logic in application we are giving a SCORE. So whenever the user modifies the items the SCORE is changing. By using blockchain can i include SCORE in blockchain?

Thanks in advance!


texts: Where can I find the source code for selfdestruct()?

texts: I'm trying to look into the Ethereum repository but I can't find a file for the functions. I want to know how selfdestruct() is implemented, but I also would like to look at other functions.


texts: How to transfer the Ethereum blockchain to another user session?

texts:
My client was not syncing at all. I have installed a new wallet in another user session with new wallet addresses.

Wallet 2 for user 2 on the same Windows 10 machine has downloaded the entire blockchain but Wallet 1 for user 1 is three months late.

Is there a way to copy the blockchain from one user session to another one to go faster in Windows 10?


texts: Is it possible to retrieve an event log from a reverted transaction?

texts: I know there is an upcoming change to solidity which will allow the returning of require() calls with a string error message. But I'm wondering if it's possible to do something like this now. Since each node has to run the code up to the revert point to know that the code reverts, doesn't this mean that the event will get stored in the history still? And if we're operating a node couldn't we see that the event was fired off even inside of a reverted transaction? I'm not an expert on the EVM so maybe I'm missing something crucial but it seems like something like this should be possible.


texts:
I want to store JSON input in my Smart Contract. Like

  { "name":"John" }

First I thought i could just handle it like a String, but it is not working because of the double quotes. Remix says, that there is an SyntaxError, because of an unhandled Token.

Example Code:

pragma solidity 0.5.0;

function tester(string memory x) public{
    string memory y=x;
}

Any suggestions?


texts: Recovering funds in ETH wrongly sent between exchanges to address without contract

texts:
I sent some funds in ETH from bitstamp to another exchange and missread the warnings on the receiving end telling me not to send from smart contract addresses, the transaction left and its confirmed but it hasnt made its way to the receiving address, how can I recover the funds?

Thanks for any help


texts: I have created my own private blockchain network in LAN.I am using admin.peer() function for adding a new peer to network,for this  admin.peer function to work I need an IP address.So my question is that When I create a DApps in my own private blockchain network.How others can access DApps publicly?


texts: Looking for good guide on how to deploy and verify source code of Smart Contract using Truffle/Remix

texts:
Can't really find good guides on how to deploy and verify smart contracts to testnetwork Ropsten. Would like to deploy multifile smart contracts including libraries.
Are there any good HowTos already? Would highly appreciate guides for truffle and also for Remix.


texts: Best practices to use a node as multiuser node

texts:
At the moment I am trying to set up a webservice encapsulating ethereum behind an easy webinterface and do stuff like:

create, manage accounts
deploy contract
...

Mining is not neccessary.

I don't know if it is secure to use one node for all users / accounts.
That would mean the node knows all accounts and all accounts are unlocked all the time.

But the other way around (setting up a node fore every user of the service) would be a big resource problem. Every node downloading the whole blockchain locally...

Is it possible at all to use a single node in a multi-ethereum-user scenario?
I am talking about 1k users per node.


texts: `Synchronous requests are not supported.` in truffle 4.0

texts:
The following code in truffle (v4.0-beta) is failing:

.then(() => web3.eth.sendTransaction(
        {from: accounts[0], to: swt.address, value: 1e10}))

Error: Synchronous requests are not supported.

Is there a way to send ETH using asynchronous transaction?


texts: how can I store a data in quorum smart contract that no one can see it

texts: I want to store a number in smart contract that blockchain nodes should guess that number and send it to smart contract and then smart contract should compare it with data stored in it, and if they are the same give a reward to that node.. so smart contract should be hidden and nodes should not see that number... is there any way to do that? can quorum do it?


texts: "Error encoding arguments: Error: Assertion failed" when calling function on deployed contract 0xf75056aedfeef65ca4889c2f053bfd3158c131f2 (ROPSTEN)

texts:
"Error encoding arguments: Error: Assertion failed" when calling function on deployed contract https://ropsten.etherscan.io/address/0xf75056aedfeef65ca4889c2f053bfd3158c131f2 (ROPSTEN)

I have verified the contract code here: https://ropsten.etherscan.io/address/0xf75056aedfeef65ca4889c2f053bfd3158c131f2#code

This is the error I get when I try to withdraw 100000000000000000 wei

I am using MetaMask to access web3.. hmmm...

What am I doing wrong? :)


texts: If contracts can be proxied to other contracts, how can a user trust them?

texts:
Based on the upgradeable smart contract pattern, a smart contract author can create a contract x that proxies to contract y. Let's say the contract is an ERC20 token where Alice buys 100 tokens.
How can Alice now trust that the developer of the contract will not simply proxy x -> z which contains a new version of transfer() is called, it redirects the tokens to someone else?
If there is no guarantee of not changing, what makes it different to trusting any other third party like a bank or facebook who can change access at any time?


texts:
I am trying to pass a struct as an argument while calling the function of another contract:

pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;

library Test {
  struct TStruct {
    int x;
    int y;
  }
}

contract A {

  function SetStruct (Test.TStruct sin) public returns (int) {
    data = 10;
    Test.TStruct memory s;
    s.x = sin.x;
    s.y = sin.y;
    return s.x;
  }
}

contract B {
  address public BAddr;

  function TalkToA () public {
    BAddr = new A();
    Test.TStruct memory sin = Test.TStruct(10, 5);
    BAddr.call(bytes4(keccak256("SetStruct((int256,int256))")), sin);
  }
}

Invoking SetStruct directly from Remix causes it to correctly execute. However, when I deploy contract B, the call to SetStruct does not go through. What is the correct way of passing a struct as a parameter in a call invocation?


texts: Error: invalid address when I want send transaction

texts:
Trying to execute a contract function with web3 1.2.1. I have an Erc20 standard token.

mintCoin: function(amount, sender, callback) {

    console.log(contractInstance.options.address); //all good
    console.log(sender);

    contractInstance.methods.mint(amount, sender).send({from:sender})
        .then(() => callback("202"))
        .catch(function(e) {
            console.log(e);
            callback("400 " + e);
        });
}

  Error: invalid address (arg="account", coderType="address", value="50000")
      at Object.throwError ...

I think I'm mistaken in the syntax... any help?


texts:
From Design Rationale:

  One weakness of the account paradigm is that in order to prevent replay attacks, every transaction must have a "nonce", such that the account keeps track of the nonces used and only accepts a transaction if its nonce is 1 after the last nonce used.

There have been some questions on this site about transactions nonces that are too low. What happens when a transaction nonce is too high?


texts: Account that was unlockable is now locked

texts:
I've got the dreaded "Could not unlock signer account" with the latest geth on a wallet.

It was an offline wallet but I made sure it was unlockable before sending funds to it, by trying it offline, on a private net. I wrote every step that was needed to get back the funds. It was working on 2015-09-18 when I created the wallet and I was able to move funds on a private net (with my own genesys block). So I know the wallet's file is correct. I'm 100% sure my password is correct. This is the kind of thing I quadruple-checked.

If I now start geth 1.3.5 using geth console, here's what I get:

> personal.unlockAccount(eth.coinbase)
Please unlock account ef..............
Passphrase:
false

Or this:

> eth.sendTransaction({from:eth.accounts[0],to:"0x........",value:web3.toWei(4000,"ether"),gas:30000})
Unlock account ef.....
Passphrase:
could not unlock signer account
    at InvalidResponse (<anonymous>:

This is very worrying.

I'm 100% sure my password is correct: it's not only written down, there are also explanation (like "name of my cat, 7 lowercase letters).

And, once again, I did try this wallet on a private network back in august and I could unlock it. The file ain't corrupted: it gives the correct shasum (which I also wrote down).

Basically I'm the paranoid type and I know I quadruple-checked this, I even wrote the date at which I've send ETH on a private chain using this wallet (by mining blocks myself I had ETH in that wallet on my private network).

Are my 40 K USD lost?


texts: How to call a function of a smart contract

texts:
I'm totally new to solidity I have a contract that I have to compile and deploy. Now, I have to interact with it (specifically with one of its functions) but I don't know how to do that and I feel that all the threads I found are much more advanced.

Here's the specific function that I have to call:


texts: Can GASTokens be used in decentralized exchanges to reduce the GAS used in transactions?


texts: Transaction api question for using remote Node such as infura

texts:
I want to have a function to send eth to another address by php program, and I do not want to run a local node on my server. Can I use infura as the web3 provider and use the API to send eth to another address?
That means, can I use infura as the node, not using my own local node. I heard that I must sign the message offline? can I directly call infura API to sign? or any easy PHP script for sign and send transaction without running a local node?
Thanks


texts: How to access to txpool within a web3 script?

texts:
I run a testnet Ropsten (revival) ethereum node. I would like to get the content of txpool. With a geth console, I can access the variable txpool.

My question is how can I access this variable within a web3 script ?

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

Someting like the following:

pendingTx = web3.txpool ?

pendingTx = web3.eth.txpool ?

they are all undefined...


texts: Mapping not updating after function is called

texts:
After calling this function:

  function WithdrawDividend(uint256 value) public {
    require(value <= _balances[msg.sender]);

    if (_RestrictedFromDividend[address(msg.sender)] <= 0) {
        _SavedDividend[msg.sender] = _balances[address(this)].mul(value).div(100000000);
        uint256 DividendsToBurn = _SavedDividend[msg.sender].mul(10).div(10000);
        uint256 DividendstoDividend = _SavedDividend[msg.sender].sub(DividendsToBurn);

        _balances[address(this)] = _balances[address(this)].sub(DividendstoDividend).sub(DividendsToBurn);
        _balances[msg.sender] = _balances[msg.sender].add(DividendstoDividend);
        _balances[address(0)] = _balances[address(0)].add(DividendsToBurn);

        _totalSupply = _totalSupply.sub(DividendsToBurn);

        emit Transfer(address(this), msg.sender, DividendstoDividend);
        emit Transfer(address(this), address(0), DividendsToBurn);

        _RestrictedFromDividend[address(msg.sender)] = 1;
        ClaimTime[address(msg.sender)] = now;

    } else {
        emit Transfer(address(this), msg.sender, 0);
    }

 }

Everything successfully works - the balances are updated and the transactions are sent. However, the _RestrictedFromDividend never changes to 1 and I don't understand why. How can I make sure it changes to 1 after this has happened?


texts: Contract factory deploys a contract - how to interact the contract from the factory

texts:
say I have a contract that is a factory, using truffle in order to interact with it I go for:

ContractName.deployed().then(function(instance) {app = instance;})

now, the factory has got a function that deploys new contracts which i simply invoke by:

app.functionNameForCreatingNewContract({from: web3.accounts[1]})

and the above creates a new contract.

Now the 'big question' is how to create an instance of that newly created contract so I could interact with it?


texts: field "to" in deploy contract transaction

texts:
I'm trying to deploy a contract using MEW toward Ganache.

When deploying a contract should the "to" field be included?
if the answer is yes, what value should it contain?

is there an official documentation that defines this behavior?

Thank you


texts: How to convert Postgres BYTEA format to Ethereum string address (PYTHON)?

texts:
Bytea (hex) is format of PSQL. It is used by many explorers/dapps/apps to store ethereum address. how to convert this format to Python String?

By default it is read as a memory view.

More on Bytea: https://www.postgresql.org/docs/9.0/datatype-binary.html


texts: Why wouldn't EIP 999 require altering every subsequent block hash?

texts:
EIP 999 proposed to update parity's walletLibrary contract. Doesn't altering the bytecode also mean altering the blockhash, in which case, due to merkel chaining, don't all subsequent block-hashes need to be altered as well for the chain to be valid, or am I missing something?

https://github.com/ethereum/EIPs/blob/master/EIPS/eip-999.md


texts: I have a question relating to the Ethereum transaction

texts:
The amount of I had was transferred to another wallet I didn't know.

https://etherscan.io/address/0xcf487d1a303b42bb419f06717209ef5358294759

I have a few questions about why this could happen.

Can I still send Ethereum to another wallet even if my account is locked?
Do any "geth" console commands allow you to view your account and password information?
Is there a way to find it even if I lose my Ethereum wallet password?
What should I do to prevent this from happening in the future?


texts: plug our own consensus in any one of ethereum client?

texts:
Actually i try to add new consensus and will through  modifying some consensus to see its effect on transaction throughput.
so what platform should i use that provide me this facility or should i use clique platform to plug new consensus.


texts: Cannot deploy contract in new Remix layout

texts:
I cannot get a contract to deploy in the new layout but when I go back to the old format it works fine. The deployment parameters are as follows:

and here is the error that I get:

However, when I go back to the old format it deploys without any problem.

Does anyone have an idea what is going on?

Thanks!


texts:
I am unable to find the correct API call format to download the input data field from the event log of each transaction - is there a way to use API key to download this information?

I am referring to downloading the data of this input data field:


texts: Creating unreasonably large amounts of money as a result of integer underflow in smart contracts?

texts:
So, according to this article: https://blockgeeks.com/guides/underflow-attacks-smart-contracts/

  "Imagine a situation where a token holder has only X tokens. Suppose
  he tries to spend X+1 tokens. If the program doesn’t even check for
  that, there is a chance that an attacker will end up with more tokens
  than what they actually have and get a maxed out balance.

  Because of this condition, a hacker can actually own more funds than
  what they actually own and max out their balance. E.g. if the hacker
  owns 100 tokens and tries to own 101 tokens, they will end up with
  100-101 tokens, which gives him 2^256-1 tokens as a result of
  underflow!"

Therefore, my question is this : is it true that a malicious hacker, by exploiting integer underflow in smart contracts, produce ridiculously large amounts (2^256-1) of tokens for himself? Wouldn't this be akin to creating money out of thin air?

EDIT: I found a similar case, in which someone exploited integer underflow/overflow to create unreasonably large amounts of BEC (BeautyChain) tokens for himself. This caused a lot of chaos back in 2018.


texts: Explicitly conversion of addres and payable

texts:
i can't understand this
Explicit conversions to and from address are permitted for integers, integer literals, contact types and bytes20. However, Solidity prevents the conversions of address payable(x).

The address(x) can be converted to address payable in cases when x is of integer, fixed bytes type, or a literal or a contract that has a payable fallback function. When x is a contract without the payable fallback function, the address(x) is of type address.


texts: How to use cacheSend of drizzle library when the method needs two parameters

texts:
Should it be like the example below(2,2 as two different parametres)
Ex: const stackId = drizzle.contracts.SimpleStorage.methods.set.cacheSend(2,2, {from: '0x3f...'})


texts: Sign a transaction hash using JavaScript

texts: Which JavaScript library should I use to sign a transaction hash? I don’t want to sign a transaction object. I simply want to sign the hash so I'll have a signature, not a signed transaction object.


texts: Is it possible to send a smart contract to an address wallet?

texts:
As explained here, a smart contract is deployed on the blockchain via a transaction, with the following code:

var primaryAddress = eth.accounts[0]
var abi = [{ constant: false, inputs: { name: 'a', type: 'uint256' } }]
var MyContract = eth.contract(abi)
var contract = MyContract.new(arg1, arg2, ..., {from: primaryAddress, data: evmByteCodeFromPreviousSection})

But is it also possible to send it to someone if I know his address wallet? Because he will be the principal user of this smart contract.

Or should the smart contract send a transaction to him with its address once it is mined?

eth.sendTransaction({from:eth.accounts[0],to:eth.accounts[1],value:web3.toWei(1,"ether"),data:web3.toHex(smartcontract.address)})

In this case, can the user can have access to the smart contract since he is not the owner?

Thanks


texts: web3j.ethCall returns null when retrieven contract variable

texts:
Environment:

Geth node Geth/v1.9.0-unstable/windows-amd64/go1.12

Commands used to start the node to mine:

geth --datadir "." --networkid 101 -verbosity 6 --port 30301 --rpcport 8101 --nodiscover
-rpc --rpcapi "db,eth,net,web3,personal" --vmdebug --mine console 2>>"node01.log"
miner.start(2)
personal.unlockAccount(eth.accounts[0])

HelloWorld.sol contract:

pragma solidity ^0.5;
contract HelloWorld {
    uint256 counter = 5;

    function add() public {  //increases counter by 1
        counter++;
    }
    function subtract() public { //decreases counter by 1
        counter--;
    }
    function getCounter() public view returns (uint256) {
        return counter;
    }
}

Java Wrapper Class of the contract

The generated function is:

public RemoteCall<BigInteger> getCounter() {
    final Function function = new Function(FUNC_GETCOUNTER,
            Arrays.<Type>asList(),
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    return executeRemoteCallSingleValueReturn(function, BigInteger.class);
}

Command used to generate the java class:

web3j truffle generate HelloWorld.json
      -o java/classes -p com.web3j

Java interaction with the contract

HelloWorld contract = HelloWorld.load(
                    contractAddress,
                    web3j,
                    credentials,
                    GAS_PRICE,
                    GAS_LIMIT);

        System.out.println("Valid: " + contract.isValid());

       // call method getCounter which retrieves contract data
        Function function = new Function(
                "getCounter",
                Arrays.asList(),
                Arrays.asList(new TypeReference<Uint256>() {})
        );

        String encodedFunction = FunctionEncoder.encode(function);

        //unlock account
        PersonalUnlockAccount personalUnlockAccount = admin.personalUnlockAccount(account,password).send();
        if (personalUnlockAccount.accountUnlocked()) {
            System.out.println("Account " + account + " is UNLOCKED.");
        }

        EthCall ethCall = web3j.ethCall(
                Transaction.createEthCallTransaction(credentials.getAddress(), contractAddress, encodedFunction),
                DefaultBlockParameterName.LATEST)
                .sendAsync().get();

        String value = ethCall.getValue();
        List<Type> list = FunctionReturnDecoder.decode(value, function.getOutputParameters());

        System.out.println(list.size());

Error:

I have tried both with contract deployed with truffle, and with the contract deployed in web3j with .deploy(). In both cases the contract gets deployed and I can check the transaction hash on the geth private note created by me. But in both cases I cannot successfully call the getCounter() function.
The deployed / loaded contract is valid.
I called the method add() with Transaction.createFunctionCallTransactionand I managed to mine the transaction and obtain the transaction hash.
When I call the getCounter() method in the debugger ethCall.result = "0x".

Additional Question:

I have read that this method call should also work because it only retrieves contract data:

contract.getCounter().send();

But it throws the exception:

org.web3j.tx.exceptions.ContractCallException: Empty value (0x) returned from contract

Please help with any hints related to what I might be doing wrong. Thank you.


texts: Sending ether to my smart contract: function payable keyword or fallback function,

texts: Between the two options to send ether to my smart contract, which is best to use or are they same


texts: What is the point of using Smart Contracts instead of spinning up an EC2 instance and running the same code without blockchain?

texts:
I'm trying to do a deep dive on Smart Contracts and Ethereum. I came across a very intriguing article on use cases of Smart Contracts in a Chain Link blog post. However, I still don't have a strong intuition for why there is so much enthusiasm for Smart Contracts. I don't understand what benefit they offer as opposed to spinning up an EC2 instance in AWS and writting the same program logic but using Stripe and a real fiat currency. Here are a couple of examples that are confusing to me:
My best intuition for the "promise" of Smart Contracts is:

Compared to using Stripe and a fiat currency, Ethereum can issue micropayments and has smaller transition fees.
Cryptocurrencies seem to be (potentially) more developer-friendly compared to using Stripe and a fiat currency for finance-related software/scripts. For Stripe, there is overhead to signing up and their API isn't the most intuitive whereas Solidity is a pretty pleasant programming language.
Compared to having to rely on the legal system to enforce a contract between two parties, which may be slower and more expensive, if all parties agree to a Smart Contract equivalent of the contract this is more efficient.

Things I am still confused on would like clarity on:

I have heard of a Decentralized Autonomous Organization that uses an Ethereum smart contract to implement a revenue-sharing agreement between its stakeholders (i.e. as people pay for the service with Etherium, the smart contract pays 33% to Person A, 33% to Person B, and 33% to Person C). Why could you not do the same thing using Stripe and an EC2 instance? Why get Etherium involved at all?
I have heard a lot of enthusiasm for how a lot of Internet of Things applications will have use cases for blockchain. For example, IoT sensors can be used to ensure that products in transit are properly maintained throughout the supply chain journey and connecting these IoT sensors to smart contracts that trigger payouts and issue fines depending on whether or not the IoT data confirms quality control standards were adhered to. Even for something as intriguing as this, what is the role of a Smart Contract here. Couldn't a third-party company offer these services and never need to get a Smart Contract involved?

Any intuition to point me in the right direction would be greatly appreciated.


texts: Referring to this post, the value stored in variables of smart contract, can someone (not authorized) read it. Say I store "secret code" for each user on a map. Contract needs this value for whatever reason, though don't want anyone else to see it. Since this data is stored in level db, do you think anyone will be able to see this value. I have not read the ethereum yellow paper, not sure whether this data is encrypted? Appreciate any help.


texts: Which accounts contributed to The DAO's extraBalance account?

texts:
Anyone who bought DAOs in the last two weeks of The DAO crowdfunding phase paid more than 1 ether (ETH) per 100 The DAO tokens (DAO). The ETH amount in excess of 1 ETH per 100 DAOs was stored in The DAO's extraBalance account. The balance of the extraBalance account has now been transferred into the curator's multisig wallet.

Accounts that contributed to the extraBalance account may be eligible for a refund for the portion in excess of the 1 ETH = 100 DAOs paid to purchase The DAO tokens.

How do I find out which accounts contributed to The DAO's extraBalance account?

See also:

How do I convert my The DAO tokens into ethers using the withdrawal contract after the hard fork?
How do I get a refund for the amount I paid in excess of 1 ether to 100 The DAO tokens
How do I get a refund for my The DAO tokens that was split into a child DAO?


texts:
My very much appreciated and valued Conor Svensson -who creates web3j- gave me a very simple task so that we can reproduce the issue https://github.com/web3j/web3j/issues/105#issuecomment-309186331.

"Please can you try running the code using Geth or Parity?" I am new, with all this Etherium stuff and now Conor expects me to do something that I completely fail to understand.

I am puzzled but willing to take the challenge. The problem arises when web3j tries to connect to TestRpc which is "is a Node.js based Ethereum client for testing and development".

Then he wants me to connect with Geth or Parity. I opt for Parity. "Parity's goal is to be the fastest, lightest, and most secure Ethereum client."

So we have two clients that Conor wants me to connect. Please provide me the wisdom to solve Conors puzzle.


texts: Different Values for v, r, s? What am I doing wrong?

texts:
lets assume I have this private key (test account on ropsten, no need to worry):

785cdcd731a1b2438ec4511a25d04efbdc499ed350df612364af1aa6f4fd6abd

When I use Pyethereum to run

v, r, s = ecsign(tx['hash'], normalize_key(private_key))

then v, r, s = (28, 70432465444433342622726730664370509023990924819271715983647847605365849029795, 7960080711554037742197166599216482712965266632510536462814358773930726674178)

When I compare this with the actual transaction:

{'blockHash': HexBytes('0x47b8f62c1400dae65105d2f8e03824bfc58481c0b32f45788ad3378fbc05e9f6'),
'blockNumber': 4156209,
'from': '0x4e5C95B38bd0B18B83f130a1ffae58cFC58961DE',
'gas': 21000,
'gasPrice': 8000000000,
'hash': HexBytes('0x8ec420a3ba331f2a967ecdaf69b78bbb604ebbb2554a8c635142b7b306defaae'),
'input': '0x',
'nonce': 0,
'r': HexBytes('0xe298a05754cc5a24790bb8c21ecb60fd93f2d096146af7397440697a338dff46'),
's': HexBytes('0x5999f680f17e505c979c43a3a9e7707c817efde705f967681d8a5066b49e5352'),
'to': '0xED6CA7d908f897d0B0D5f9B9E7Aa470698E10b1b',
'transactionIndex': 27,
'v': 42,
'value': 1000000000000000000}

The Values for r,s,v are very different. (Event when I convert them with bytes.from_hex(tx['r']))

Q1: Dose anyone know what I am doing Wrong?

Just to make sure: The transaction was made with metamask and then the key was exported from metamask, so there is no chance that the key to sign the transaction was different.

Q2: Is there a better way to do this?

Thanks in advance :)


texts: Is there a table of EVM instructions and their gas costs?

texts: The EVM instructions are in the yellow paper, or they are summed up in this answer. But their gas costs are not there. Where can I find a list of all instructions with their associated gas costs?


texts: If I import an openzeppelin Interface using @openzeppelin/contracts/token/ERC721/IERC721.sol, do I still need to declare the functions I wish to use found in the Interface, or the import statement is sufficient to use all the functions defined within the said Interface without having to declare them in my smart contract? Will my smart contract be compliant with the ERC721 standard if I do not declare the functions?


texts: Incorrect Uniswap Liquidity Calculations. What could be wrong?

texts:
Looking though a uniswap address: https://info.uniswap.org/account/0xd62317c76E626D53C900088Fb07539b829B564B2
This address shows that it added $30k+ worth of liquidity, and none of it is removed. Why is the liquidity total on top only showing $23k. Is this a uniswap bug or an ethereum bug? And how can this be resolved?


texts: smart contract use case: secure validator

texts:
I have almost no experience with blockchains & smart contracts, but quite much in coding generally.

Solving a data verification problem for new product we're developing.

The question is quite abstract:
Suppose, we have incoming data from multiple external internet devices signed by their private keys. We need to:

verify the data by using the respective public key
sign the data by additional private key (one for all)
send the data further (outside of blockchain)

Does it make sense to use smart contracts for it, or having our secure dedicated verification server is a better option?


texts: What is the expected Ether issuance schedule after transition to PoS?

texts: Is there anywhere I can read the latest Ether issuance schedule plan? I understand what it is now (5 eth / block plus uncle rewards), but what will it be after proof of stake? I've read conflicting things about that and am confused.


texts: Truffle migrate/deploy does not maintain state when the same contract is deployed again, correct?

texts: I thought that the allure of using truffle lies in the ability to upgrade a contract that is live and already has state. I now realize that the only way to maintain state while "upgrading" a contract is with the method shown here . What is the purpose of using truffle deploy in a development scenario where my contract may already have state and don't want to deploy an entirely new contract and lose that state?


texts: Private chain: Maximum size of "data" field in an Ethereum transaction?

texts: The data field can be used to send arbitrary data in a transaction. I am aware that the amount of gas required increases with the increase in size of data, but, is there a limit to the size that's allowed? According to this post, the transaction size is limited by the block gas limit in Ethereum. But, what if I'm running a private blockchain with no block gas limits (Is this possible?). Does it mean that I can transfer any amount of data between accounts and all of this gets stored in the private blockchain forever?


texts: What if a malicious validator denies to sign a new block in a shard committee in Ethereum 2.0?

texts:
In Ethereum 2.0 (Sharding Blockchain), a new block requires to be signed by all the validators as members of a committee, where blockchain has been sharded in smaller parts for supporting parallel transaction processing to enhance transaction throughput.

This way, a new block created in a time slot by a proposer, needs to be signed by all the committee's members. All the signatures then will be aggregated using BLS Multi-Signatures With Public-Key Aggregation.

The question is:

What if a malicious validator denies to sign a new block in a shard committee in Ethereum 2.0 ?


texts: when I fllow this document step by step enter link description here,I have something wrong with my truffle build,and I delete truffle.js ,this is photo, please help thx!!


texts:
My transaction failed due to running out of gas. Can I recoup this money?

I was trying to send to Monaco card via my token wallet. Below is the transaction id. For some reason, it charged me £159 for sending £99 dollars. Could someone please help me out, as i am clueless as to what to do.

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


texts: I've transferred ownership of my token to my crowdsale, how do I transfer it back?

texts:
I've seen 2 solutions here and they worked for others but they aren't working for me. I have no problem transferring ownership to the crowdsale, but how do I code it to be able to transfer the ownership of the token back to my main account?

I've created a function for it, and it gives me no errors, it even executes with no problem, but it never changes the ownership. Here's the partial code of my crowdsale:

pragma solidity ^0.4.16;

/**
 * @title Owned
 * @dev The Owned contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
contract Owned {
  address public owner;

  event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
  event TokenOwnershipTransferred(address indexed _newOwner, address indexed _previousOwner);

  /**
   * @dev The Owned constructor sets the original `owner` of the contract to the sender
   * account.
   */
  function Owned() public {
    owner = msg.sender;
  }

  /**
   * @dev Throws if called by any account other than the owner.
   */
  modifier onlyOwner() {
    require(msg.sender == owner);
    _;
  }

  /**
   * @dev Allows the current owner to transfer control of the contract to a newOwner.
   * @param newOwner The address to transfer ownership to.
   */
  function transferOwnership(address newOwner) public onlyOwner {
    require(newOwner != address(0));
    emit OwnershipTransferred(owner, newOwner);
    owner = newOwner;
}

    function transferTokenOwnership(address _newOwner) public onlyOwner {
    require(_newOwner != address(0));
     emit TokenOwnershipTransferred(owner, _newOwner);
     owner = _newOwner;

}
}

interface token {
    function mint(address receiver, uint amount) external;

}

library SafeMath {

  /**
  * @dev Multiplies two numbers, throws on overflow.
  */
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    if (a == 0) {
      return 0;
    }
    uint256 c = a * b;
    assert(c / a == b);
    return c;
  }

  /**
  * @dev Integer division of two numbers, truncating the quotient.
  */
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    // assert(b > 0); // Solidity automatically throws when dividing by 0
    uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold
    return c;
  }

  /**
  * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
  */
  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    assert(b <= a);
    return a - b;
  }

  /**
  * @dev Adds two numbers, throws on overflow.
  */
  function add(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a + b;
    assert(c >= a);
    return c;
  }
}

contract FCCCrowdsale is Owned{
    using SafeMath for uint256;

    address public beneficiary;
    uint256 public fundingGoal;
    uint256 public amountRaised;
    uint256 public openingTime;
    uint256 public closingTime;
    uint256 public initialRate;
    uint256 public finalRate;
    token public tokenReward;

    mapping(address => uint256) public balanceOf;

    bool fundingGoalReached = false;
    bool crowdsaleClosed = false;

    event GoalReached(address recipient, uint totalAmountRaised);
    event FundTransfer(address backer, uint amount, bool isContribution);

      event Closed();


texts: Is it possible to create an erc-20 compliant token with a built-in timed release escrow?

texts:
I would like to build a smart token that can readily be used with existing wallets. The objective is a seamless UX for buyers and sellers without complex data input requirements. Transactions by those who use the token are automatically guaranteed.

My token would hold the funds transferred by the buyer and the same amount from the seller in escrow until either released by the buyer (full satisfaction with product/service) or after one month (default). The seller may release all funds without transfer (if the merchandise is defective, &c). The buyer may submit a second payment that s/he feels is more appropriate (similarly held), which if accepted by the seller, would release the original escrow. If escrow release is halted by the buyer before the specified time period, a third party, selected by both parties (via a linked arbitration contract) would be authorized to release funds or complete the payment transfer.

How much of this functionality is possible in a coin (without a custom wallet)?


texts:
I'm using the Etherscan API to pull transactions logs for specific wallets, but I'm having a hard time trying to format the value correctly.

This is the url I'm working with Transaction Log

One of the transactions has a value of 206933340464 which in the etherscan site it looks like 0.00000020693334 if I use

web3.fromWei(206933340464,'ether')

I get 2.0693334. How can I format this value correctly?, or could it be that etherscan is providing wrong values?.

Cheers.


texts: Why is the average block time 17 seconds?

texts:
The network stats show a constant average blocktime of around 17 seconds. Whenever you check it is around 16~18 seconds.

Reading the blog post by vitalik buterin it states the block time should be 12 seconds on average. (Update: Ok, more recent resources state a 15 second target time.)

Why is the average block time constantly at around 17 seconds?


texts: Understand the trending of newly-uploaded smart contracts that is considered as vulnerable

texts:
We tried to use Oyente to analyze some online contracts and drawed a diagram regarding the potentially vulnerable smart contracts ("reentrancy" bug) with respect to their creation time.

So the y-axis is calculated by compute the following percentage:

# of vulnerable contracts / 300

we randomly select 300 contracts within each period.

The overall trending keeps decreasing, which indicates people's awareness of reentrancy bug and are using more secure design strategies when writing new smart contracts. This makes a lot of sense to us.

However, as you can see, at 2016-10 and 2017-11, the number of "vulnerable" smart contracts have a big drop. This is something we cannot interpret. We are aware that the infamous DAO bug is reported in 2016-07, then potentially make developers more cautious during that period? But why 2016-11 and 2016-12 seems to have a much higher percentage of vulnerable contracts?


texts: My question is about forks in general. If I have a portion of a coin do I get the exact portion of that new coin?

texts: my question is about forks in general. If I have a portion of coins and it gets forked do I get the exact amount of the new forked coin?


texts: How exactly do testnet faucets work? I understand they have a preloaded budget. Is this correct? If so, if i wanted to make a testnet faucet where would this come from?


texts: Geth - reading addresses inside mappings from a contract

texts:
This answer shows that we can return all the addresses (from address[] public) as a single array of addresses:

function getAddresses() constant returns (address[]){
    return MemberAddresses;
}

Instead of address[] public MemberAddresses; if we have  mapping(address => uint) MemberAddresses;

contract AddressList {
    mapping(address => uint) MemberAddresses;

    function registerAddress(uint var) {
        MemberAddresses[msg.sender] = var;
    }
}

[Q] Can we return all the addresses inside mapping, as a single array of addresses?

Thank you for your valuable time and help.


texts: How to properly set nonce in a web3 contract invocation?

texts:
I have this code, which works:

MyToken.airdrop(wallets,amounts,{
  gas: 1267051,
  gasPrice: 2000000000,
},function(err,tx){
  console.log('err is %s',err)
  console.log('tx is %s',tx)
  callback(err,tx)
})

Now Let's say I want to control the nonce myself (reason here) so I do:

MyToken.airdrop(wallets,amounts,{
  gas: 1267051,
  gasPrice: 2000000000,
  nonce: 432 // = web3.eth.getTransactionCount() + 1
},function(err,tx){
  console.log('err is %s',err)
  console.log('tx is %s',tx)
  callback(err,tx)
})

I get a tx hash as output, not an error, yet the transaction can't be found on the appropriate etherscan, it seems to never get sent to the network. Tried on Rinkeby, Ropsten, and Kovan.

What could be the problem with specifying nonce myself or the way I'm doing it?

Note: I'm using infura as the "node".


texts: Mist main wallet address changed after instalation

texts:
During the instalation of mist on a mac I get to the following screen:

I then have to wait for synching to complete. During this time I can deposit ether into my wallet using Bitcoin or just use the address displayed and make a straight transfer from another ether wallet to this one. I copied the address down and then just waited for the synching to complete.

The next morning I found that mist had closed on my laptop so I opened it back up and discovered that the main account address had changed.

I checked the keystore folder and there was only one keystore saved there with an address that matched the one in mist.

What happen to the other address. I searched for it on my laptop and it is only in the text file I copied it to. If I had sent ether to this now missing address, I would have been screwed. This has got me spooked. Why did the address change ? My next step is to scan for malware. And yes, I did check the SHA256 hash against the downloaded mist application file before I installed it.

Any help will be appreciated. I am NOT going to use this wallet until I have an answer.

Thanks,

Warren

These images are not screenshots of my wallet


texts: web3.js: call event handler after N confirmations

texts: web3.js seems to call the event handler of an event directly upon confirmation. I would like to know if it is possible to call an event handler only after e.g. 5 confirmations using web3.js. Is that currently possible?


texts: Truffle artifacts (json files) - where are they?

texts:
When truffle compiles a contract, it creates a json file instead of a pair of abi and bin files.

These json files are called artifacts, and they should reside in a known location.

It is briefly explained here and here.

In the past, I used to see them after running truffle compile or truffle test.

Now, I am no longer able to see them anywhere.

Here is my truffle-config.js file:

// See <http://truffleframework.com/docs/advanced/configuration>
module.exports = {
    contracts_build_directory: "./build/contracts",
    networks: {
        development: {
            host: "127.0.0.1",
            port: 8545,
            network_id: "*", // Match any network id
            gas: 4712388, // Gas limit used for deploys
            gasPrice: 100000000000, // Gas price used for deploys
        },
    },
    solc: {
        optimizer: {
            enabled: true,
            runs: 5000000,
        },
    },
};

Does anybody know where to find these artifacts?

Thank you!


texts: How to compile solidity in the browser without using browser-solc?

texts:
I am thinking of implementing an API call to compile some source code entered by a user and then return the bytecode for deployment using metamask.

I have tried browser-solc but it had some errors and I want to try and alternative approach.

Did anyone have sample code to compile source on the server using node for example?


texts:
This may be a dumb question, but I'm trying to understand is there a difference re: byte-wise or gas-wise in between using calldata and explicitly mentioning arguments. For example, for this struct:
struct Book {
    string: title;
    uint256: pages;
}

There is a makeBook function. Now, is there any difference in the following ways of writing the function?
/// Using calldata
function makeBook(Book calldata book) external {
    newBook = Book(book.title, book.pages);
}

/// Mentioning arguments
function makeBook(string title, uint256 pages) external {
    newBook = Book(title, pages);
}


texts: How can I get my dapp interface to work on Mist? I'm using truffle framework and it works with Metamask

texts:
I can't get my interface to work on Mist using truffle contract abstraction.
After building and testing successfully with Metamask I thought I'd test it on Mist as well and, surprise, it doesn't work. I did some digging and "cut down some trees" to see where the problem is and concluded there is a conflict when using web3.eth.filter and MyContract.deployed() together.

I would be grateful if someone could test the following code to see I'm not the only one with the problem. My setup is truffle v3.4.7 + geth v1.6.6 with rpc.

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

    web3 = new Web3(web3.currentProvider);
    var filter = web3.eth.filter("latest");
    filter.watch(function(error, result) {
        if (error != null) {
            console.log(error);
            return;
        }
        console.log('new block');
    });

    MyContract.setProvider(web3.currentProvider);
    MyContract.deployed().then(function (value) {
        console.log('contract found!');
    }).catch(function (e) {
        console.log(e);
    });

}

The above gives this error:

Error: MyContract has not been deployed to detected network (network/artifact mismatch)

Did some digging on this and it appears that network_id gets corrupted for a while with some random value like "0x6197b6fe01d72d08b3ddfce26f9fe409" before it takes the right value, like "4" (Rinkeby).

I ended up finding that invoking web3.version.getNetwork before all the code above takes care of this problem but many other errors take its place. I think went a little to far trying to find workarounds for days and I need your help in solving this the right way. Can you think of anything? Thanks.


texts: How to estimate gas at contract creation/deployment to private ethereum blockchain

texts:
What I have done
a) When I use web3.eth.estimateGas to estimate the cost of a contract creation constructor with no parameters, the estimate is correct.

b) If the contract is already  deployed then estimating the gas cost of a contract function with parameters, it works fine. (contract.myMethod.estimateGas() using the web3 api )

Issue
a) When I estimate gas in a contract on contract creation time (contractObject.new) with a parameterized constructor then it gives an incorrect estimation of gas cost. (web3.eth.estimateGas of web3 api)

What I want
a) When I estimate gas with multiple parameter constructor of contract then it should estimate correct gas.
 (contractObject.new for calling constructor)

b) Browser-soldity gives right gas estimation of contract with parametrized constructor --> before contract create/deploy (like transaction cost or execution cost, how can I use their algorithm with web3 api to estimate gas correct way?)


texts: Why does sync eat up all RAM and hang my computer?

texts:
I have installed the Wallet v0.9.1 but have not been able to reach sync. It starts at good speed (1000 blocks/sec), but after 1 hour and 3.5Mblocks it slows down and I notice my 8GB RAM is taken. There is space on my SSD. OS is Windows7 Pro.

I tried removing the chaindata folder and run geth --fast --cache=2048, but it is the same story. Memory is eaten, computer slows down and finally hangs. It helps to restart the Wallet but after a minute, RAM usage grows.

I tried to sync the testnet instead, but end up in the same situation. Frustrating to be 100 blocks from sync and not getting all the way.

Is there anyone who can help me out of this?
Thank's


texts: Why are coins at risk when honestly staking?

texts:
It has been repeatedly written that staking nodes should buy DDoS protection or be at risk of losing their coins.

Can someone explain why an honest staker is at risk of losing his coins in case it gets hit by a DDoS (*)?  And what happens to the "lost" coins?


texts:
99% of my ERC20 tokens have all been taken out of Exodus

Please someone help me!

After one day of registering with myetherwallet my tokens went missing...

I bought 10 differnt ERC20 tokens in etherDelta and withdrew them to MyEtherWallet.com. I double checked my wallet at that time and everything was fine - all tokens showed.

The next morning (13 hours later) I looked in 'MyEtherWallet.com" and they were gone. I thin went to Exodus and my etherium was gone from there also.

I can see 10 of my tokens in some one elses wallet. There are 3 others in there that arent mine.

They havent been moved or sold in the past 5 days, which if taken on purpose I believe they would have been by now

A few things sorted:
1. The myetherwallet.com webpage wasn't a fake one - so I can rule that out. I was aware of this before going into page of hoax ones.

I didnt recieve any hoax emails between buying them and transfering them to myehterwallet.

When pulling over the tokens I didnt have etherium my account - is this a concern??

Could there be a place where tokens are held if no etherium in my account. I have now placed Etherium in my account..still no coins back.

Im running on MAC OS. Sierra

myetherwallet address: 0x31ED4777B2EDBd3a4F859Bf91f34C6C2324FCd35

You can view the tokens at https://etherscan.io/address/0x85b9d9cd19441642b730a94f4c496eb909828dd8#tokentxns

Only the DataCoin and INS Promo are not mine - everything else is mine.

Please, can anyone give me advice in what I can do to get them back.


texts:
function getRandomNumber() public payable {
    require(msg.value >= 0.000175 ether); // 175,000 gas * 1 Gwei = 0.000175 ETH

   bytes32 queryId = oraclize_query("URL", "json(https://jsonplaceholder.typicode.com/posts).title", "{title: 'foo',body: 'bar',userId: 1}");

//   oraclize_query(
//       "nested",
//       "[URL] ['json(https://api.random.org/json-rpc/1/invoke).result.random[\"data\"]', '\\n{\"jsonrpc\": \"2.0\", \"method\": \"generateSignedIntegers\", \"params\": { \"apiKey\": \"00000000-0000-0000-0000-000000000000\", \"n\": 1, \"min\": 1, \"max\": 1000, \"replacement\": true, \"base\": 10 }, \"id\": 14215 }']"
//     );

    LogOraclizeQuery("Oraclize query was sent, standing by for the answer..");

    validIds[queryId] = true;
}

When I try to use the first query it doesn't work and the result is not updated but the commented one works just fine. I don't know whats wrong with it.

This the callback function

    function __callback(bytes32 queryId, string result, bytes proof) public {
        require(msg.sender == oraclize_cbAddress());

        require(validIds[queryId]);

        // randomNumber = parseInt(result);

        title = result;

        LogResultReceived(result);

        validIds[queryId] = false;
}


texts: Remix IDE: How to debug a contract having a function with a argument & for Loop

texts:
I am trying to debug a contract on Remix IDE:

pragma solidity ^0.5.1;
contract DebuggerSampleContract{
   int counter = 10;
   function LoopCounter(int _input) public view returns (int) {
      int returnValue;
      for(; _input <counter; _input++)
      {
         returnValue += _input;
       }
       returnValue;
   }
}

I selected following steps:
1. Solidity Compiler, 2. Compile DebuggerSampleContract.sol, 3. Deployand Run Transactions, 4. Deploy, 5. Clicked arrow to see the function, 6. Debug, 7. Step over (whole contract got selected), 8. step Over, only the value 10 selected, 9. Step Over, It did not enter the function, instead it went to pragma statement.

@goodvibration
Based upon the comments, I changed the contract to:

contract DebuggerSampleContract{
   int counter = 10;
   constructor(int _input)  public{
      int returnValue;
      for(; _input <counter; _input++)
      {
         returnValue += _input;
       }
       //returnValue;
   }
}

I started debugging and put the constructor argument to 6. When I pressed debug, it showed me machine language instructions i.e. EVM bytecode. I pressed "Step forward" but I don't know how to keep track of the local variables and state variables through bytecode.

Somebody please guide me.

Zulfi.


texts: Issue interfacing smart contract with the front end

texts:
I'm actually trying to write a simple smart contract with front end that takes a value from the user and saves that in the variable in the smart contract. The index.html part of my project is
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Example</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

  <form method="POST">

<input id= "message" name = "message" type= "text">

      <button type="button" id="register">Register</button>

  </form>

And app.js is
App = {
  web3Provider: null,
  contracts: {},
  account: '0x0',

  init: function() {
    return App.initWeb3();
  },

  initWeb3: function() {
    if (typeof web3 !== 'undefined') {
      // If a web3 instance is already provided by Meta Mask.
      App.web3Provider = web3.currentProvider;
      web3 = new Web3(web3.currentProvider);
    } else {
      // Specify default instance if no web3 instance provided
      App.web3Provider = new Web3.providers.HttpProvider('http://localhost:7545');
      web3 = new Web3(App.web3Provider);
    }
    return App.initContract();
  },

  initContract: function() {
    $.getJSON("HelloWorld.json", function(hello) {
      // Instantiate a new truffle contract from the artifact
      App.contracts.HelloWorld = TruffleContract(hello);
      // Connect provider to interact with contract
      App.contracts.HelloWorld.setProvider(App.web3Provider);

      return App.bindEvents();
    });
  },
bindEvents: function() {
    $(document).on('click', '#register', function(){ var msg = $('#message').val(); App.handleMessage(msg);   });
  },

handleMessage: function(msg){

    var hwinstance;
    App.contracts.HelloWorld.deployed().then(function(instance) {
      hwinstance = instance;
      return hwinstance.setMessage(msg);
    }).then( function(result){
      if(result.receipt.status == '0x01')
        alert("successfully")
      else
        alert("failed due to revert")
    }).catch( function(err){
      alert("failed")
    })
  }
  };

  $(function() {
  $(window).load(function() {
    App.init();
    console.log('starting app.js');
  });
});

The smart contract code that I've written is
pragma solidity 0.5.16;

contract HelloWorld {
    string private message = "hello world";

    function getMessage() public view returns(string memory) {
        return message;
    }

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

When I ran the commands truffle compile and truffle migrate, it showed no errors but when I ran npm run dev the page says "Cannot GET /".
I'm not able to understand where the mistake is. Please help!
Is there any other way of interfacing the frontend to the smart contract?


texts: Who is the gas payer while using transferFrom?

texts:
In my project, I craeted separate Ethereum accounts for each customer on my Geth server (I have not access to private key in this way normally). Now, customer needs to send out ERC-20 token, whereas he has not any deposited ETH for gas.
After some researches, I found out one way is to use approve() and transferFrom() as I can provide the enough ETH as gas for transactions. But there are two questions here:

Using these methods, who will be the final gas payer? Customer itself, or me as the exchange?
When I transfer token on behalf of customer, I have to move the token to my own account. Does it need a new transaction and a new gas?


texts: mapping data is not returned from SmartContract during the first time add operation

texts:
I have the below given SmartContract and the test. Please note that, when i try to execute the test, only after the second call to the grantAccess method, I am able to get the mapped value.

pragma solidity ^0.4.24;
pragma experimental ABIEncoderV2;

contract AccessControlListContract {
    mapping(address => mapping(string=> mapping(address => string[]))) _userAccessGrants;
    mapping(address => mapping(address => mapping(string => string[]))) _targetAccessGrants;

    /*
    * A transaction function does not return any values, it instead returns the transaction object as such for mining.
    * Hence, no return statements here....
    */
    function grantAccess(address userAddress, string documentHash, address targetUserAddress, string permission) public {
        _userAccessGrants[userAddress][documentHash][targetUserAddress].push(permission);
        _targetAccessGrants[targetUserAddress][userAddress][documentHash].push(permission);
    }

    function checkAccess(address requestorAddress, address userAddress, string documentHash) public view returns (string[]) {
        return _targetAccessGrants[requestorAddress][userAddress][documentHash];
    }
}

Unit Tests

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

contract("AccessControlListContract", async (accounts) => {
    // let constants = require('./constants.js')(accounts);
    let acl;
    let constants = {
        patient1Address: accounts[0],
        patient2Address: accounts[2],
        ViewDocumentPermission: "view_document",
        doctor1Address: accounts[1],
        pharma1Address: accounts[3],
        provider1Address: accounts[4],
        ECG_DOC_HASH: "ECG-DOC-HASH",
        ECHO_DOC_HASH: "ECHO-DOC-HASH",
        BLOOD_TEST_DOC_HASH: "BLOOD-TEST-DOC-HASH",
        NON_EXISTENT_USER_ADDRESS: 0x13579
    };

    before(async () => {
        acl = await AccessControlListContract.deployed();
    });

    it("should succeed always", async () => {
      assert.equal(true, true);
    });

    it('should add a new mapping for a patient and a doctor', async () =>{
        await acl.grantAccess(constants.patient1Address, constants.ECG_DOC_HASH, constants.doctor1Address, constants.ViewDocumentPermission);
        // await acl.grantAccess(constants.patient1Address, constants.ECG_DOC_HASH, constants.doctor1Address, constants.ViewDocumentPermission);
        console.log(await acl.checkAccess(constants.doctor1Address, constants.patient1Address, constants.ECG_DOC_HASH));
        assert.equal(true, true);
    });
}

Please let me know what is going wrong. I am following the steps given in the truffle suite for performing the testing with the async and await keywords.

Tried to use the old system without the async / await method, still the patient2 permissions are not returned from the smart contract

it('non-async test', () => {
    let meta;
    return AccessControlListContract.deployed().then(function (instance) {
        meta = instance;
        return meta.grantAccess(constants.patient1Address, constants.ECG_DOC_HASH, constants.doctor1Address, constants.ViewDocumentPermission);
    }).then(function () {
        return meta.grantAccess(constants.patient2Address, constants.ECG_DOC_HASH, constants.doctor1Address, constants.ViewDocumentPermission);
    }).then(function () {
        return meta.checkAccess(constants.doctor1Address, constants.patient1Address, constants.ECG_DOC_HASH);
    }).then(function(result){
        console.log('patient 1 permissions: ',result);
    }).then(function(){
        return meta.checkAccess(constants.doctor1Address, constants.patient2Address, constants.ECG_DOC_HASH);
    }).then(function(result2){
        console.log('patient 2 permissions: ',result2);
    })
});


texts: Account and/or Balance not found in Geth for Smart Contract Deployment

texts:
Error

  'Error: Account does not exist or account balance too low'

Overview

I'm trying to deploy the greeter smart contract in the ethereum.org/greeter tutorial.
I downloaded/validated the blockchain history. Etherscan shows there's 0.05 ETH in my account but when I check the balance in geth console using the steps below it says 0 ETH.

Account with .05 ETH https://etherscan.io/address/0xf074d2b114e8c15e19503288f4ce5fd641bc0fdd
Transaction 0xeebffdaceef818dcc37d59757d707cc7ddc3d1f9cb84965842f1fdb6c379638e
Block 4058263

Terminal1:

Show that my account in my ethereum geth node doesn't have a balance:

  geth --rpc --rpcaddr "127.0.0.1" --rpcport "8545" --fast --cache=2048 console
  > personal.unlockAccount("f074d2b114e8c15e19503288f4ce5fd641bc0fdd", "my_password")
  true
  > web3.eth.getBalance("f074d2b114e8c15e19503288f4ce5fd641bc0fdd");
  0

But the array that this command outputs contains my transaction

  > web3.eth.getBlock(4058263).transactions
  [huge array of transactions, including 0xeebffdaceef818dcc37d59757d707cc7ddc3d1f9cb84965842f1fdb6c379638e]

So my local history shows that this transaction took place right? I wonder why the account balance isn't updated when I run the above commands. Its almost as if I need an account update command (I found one but its only for resetting password) that says, "Check the history to see if anyone sent me ether".

Terminal2:

node myFirstSolidityContract.js

  Error: Account does not exist or account balance too low
     at Object.InvalidResponse (/Users/WillsHome/Projects/node_modules/web3/lib/web3/errors.js:38:16)
     at /Users/WillsHome/Projects/node_modules/web3/lib/web3/requestmanager.js:86:36
     at XMLHttpRequest.request.onreadystatechange (/Users/WillsHome/Projects/node_modules/web3/lib/web3/httpprovider.js:118:13)
     at XMLHttpRequestEventTarget.dispatchEvent (/Users/WillsHome/Projects/node_modules/xhr2/lib/xhr2.js:64:18)
     at XMLHttpRequest._setReadyState (/Users/WillsHome/Projects/node_modules/xhr2/lib/xhr2.js:354:12)
     at XMLHttpRequest._onHttpResponseEnd (/Users/WillsHome/Projects/node_modules/xhr2/lib/xhr2.js:509:12)
     at IncomingMessage. (/Users/WillsHome/Projects/node_modules/xhr2/lib/xhr2.js:469:24)
     at emitNone (events.js:91:20)
     at IncomingMessage.emit (events.js:185:7)
     at endReadableNT (_stream_readable.js:974:12)

myFirstSolidityContract.js Code

var Web3 = require('web3')
web3 = new Web3();
web3.setProvider(new
web3.providers.HttpProvider("http://localhost:8545"));
var solc = require('solc');

var greeterSource = 'contract mortal { address owner; function mortal()
{
 owner = msg.sender; } function kill() { if (msg.sender == owner)
 selfdestruct(owner); } } contract greeter is mortal { string greeting;

 function greeter(string _greeting) public { greeting = _greeting; }
 function greet() constant returns (string) { return greeting; }
}'

console.log('\n ===== my account ========', web3.eth.accounts[3])
// f074d2b114e8c15e19503288f4ce5fd641bc0fdd

var greeterCompiled = web3.eth.compile.solidity(greeterSource)
var _greeting = "Hello World!"
var greeterContract =
web3.eth.contract(greeterCompiled.greeter.info.abiDefinition);

console.log('\n ====== going to deploy ======') // last thing that logs

// throws error 'Account does not exist or account balance too low'
var greeter = greeterContract.new(_greeting,{from:web3.eth.accounts[3],
data: greeterCompiled.greeter.code, gas: 300000}, function(e, contract)
{
console.log('\n ==== deployed? ====') // does not log
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);
  }

} else {
  console.log('\n ====== error ====== \n', e)
}
})


texts: Ethereum Price - Transaction cost relation

texts:
The average transaction cost is around 0.0005ETH which is around 0.06$ right now.
Does it mean that the transaction fee decreases whenever the price of Ethereum drops?
Isn’t the price closely related to the global adoption of Ethereum?
I find it weird that the more Ethereum gets popular, the more its price rises, and the more the transaction fee costs. Is that the main scalability issue of ethereum?


texts: App for Ethereum address accessible for multiple people

texts: I'm looking for a way for two people to easily access an ethereum address without having to use the seedphrase. Preferably an app. I've been looking into multi-sig contracts but the deployment is pretty juicy right now. Practically just an app that I could use simultaneously on two different devices. Does anyone have any ideas?


texts: Is this laptop suitable for Ethereum mining?

texts: I have a laptop with 4 GB of RAM, 1 TB HDD and an i3 processor running Windows 10 and Intel HD Graphics 520. Is there any chance I can mine Ethereum or Litecoin using this setup? If yes please someone tell me how to get started or post a link.


texts: Does air gapped tx generation guarantee that funds are never stolen?

texts:
I think air gap does not guarantee that funds are never stolen.

The reason is that you don't know what is inside generated transaction bytes that you copy&paste to an online computer to broadcast. Potentially if myetherwallet site is hacked and you downloaded hacked version, it can attach your private key and password to transaction data. Since your are encoding it and do not know what is inside, you will gladly copy&paste your transaction to online computer and send it, thus giving control to your wallet to everybody.

I wonder if there is any solution to that risk, like inspecting transaction bytes to make sure the size is not greater than certain number, so that no extra data can be fit. Or may be creating restricted wallet contract that can only send ether without any attached data.

And then good broadcasting software like myetherwallet should inspect length of tx bytes and warn user if it's too long for just sending funds.


texts:
I have a smart contract which contains some article data stored inside a struct, which is mapped with an id which uniquely identifies it with a mapping, like this:

struct Foo {
    string a;
    string b;
}

mapping (uint64 => Foo) public articles;

(Obviously the above code is simplied, but the structure is the same, although the real struct has 7 variables instead of 2).

Now I have to be able to search using any of the 7 attributes. The blockchain is going to be private, so gas usage is not a concern.

My first solution was to add a search method to the smart contract and, within it, traverse the entire mapping and check which items satisfy the condition. Obviously this is O(n) and it was taking around 8 seconds for 2000 elements, which although isn't bad, I hope for a better solution.

Then I thought about having 7 more mappings which would act as search indexes, mapping each attribute value to the index of the article that satisfies it, such as:

mapping (string => uint64) public searchIndex;

(Note that right now it isn't required to check substrings, only equality)

And finally, I was thinking about if it would be good to do keep these indexes on Elastic Search rather than on the blockchain itself, although I would prefer a pure blockchain-based solution if possible.

So, what of these options (of any other better you know) do you think is more adequate?

Thank you.


texts: Note: The called function should be payable if you send value and the value you send should be less than your current balance

texts:
interface ERC20Interface {
     // function transfer(address _to, uint256 _value) external;
     function transfer(address _to, uint256 _value)  returns (bool success);
     function transferFrom(address _from, address _to, uint256 _value)
     returns (bool success);
  }
 interface RegisterInterface {
    function isLogin(address _userAddr) public returns(bool);
 }

contract RentBasic {
HouseState defaultState = HouseState.ReleaseRent;
struct HouseInfo {
        uint8    landRate;
        uint8    ratingIndex;
        uint8    huxing;
        string   houseAddress;
        bytes32  houseId;
        string   descibe;
        string   landlordInfo;
        string   hopeYou;
        address  landlord;
}
struct HouseReleaseInfo {
    HouseState    state;
    uint32        tenancy;
    uint256       rent;
    uint          releaseTime;
    uint          updateTime;
    uint          dealineTime;
    bool          existed;
}
// RentToken token;
ERC20Interface token;
TenancyAgreement tenancyContract;
RegisterInterface userRegister;

modifier onlyLogin() {
    require(userRegister.isLogin(msg.sender));
    _;
}
function releaseHouse(string _houseAddr,uint8 _huxing,string _describe, string _info, uint32 _tenancy, uint256 _rent, string _hopeYou) public onlyLogin returns (bytes32) {
    uint256 nowTimes = now;
    uint256 deadTime = nowTimes + 7 days;
    address houseOwer = msg.sender;
    // releaser should hold not less than 500 BLT
    // token.transferFrom(houseOwer, receiverPromiseMoney, promiseAmount);
    require(token.transferFrom(houseOwer, receiverPromiseMoney, promiseAmount),"Release_Balance is not enough");
    addrMoney[houseOwer] = promiseAmount;
    bytes32 houseIds = keccak256(abi.encodePacked(houseOwer, nowTimes, deadTime));
    hsInformation = HouseInfo({
        landRate: 2
    });
    houseInfos[houseIds] = hsInformation;
    hsReleaseInfos[houseIds] = HouseReleaseInfo({
        state: defaultState
    });
    // releations[houseId].leaser = houseOwer;
    ReleaseBasic(houseIds, 2, _houseAddr, _huxing, _describe, _info, _hopeYou, houseOwer);
    ReleaseInfo(houseIds, defaultState, _tenancy,_rent,nowTimes,deadTime,true);
    return houseIds;
}

}

It happend in the onlyLogin, Is there anyone know why?


texts: Can you copy or fork someone else's smart contract? Is it open source code?

texts: Is it possible to just copy someone else's smart contract? Say if someone has a profitable smart contract, what stops someone from just copying it to get a piece of the profit pie?


texts: How to deploy a dapp which uses multiple blockchain

texts:
I am a newbie and started learning dapp on ethereum.
Up till now, I
wrote smart contracts;
created frontend with html, css and js;
deployed smart dapp on either private network(geth, ganache) or rinkeby testnet. I connected directly to blockchain via (frontend)js which is loaded by html pages.

Now,

I want to write a dapp that is deployed on two blockchain one private and one public i.e., certain data will be stored on private and rest will be stored on a public chain. The dapp should connect to these blockchain from backend Not from frontend.
I have looked on the internet and found some sample of connecting a dapp from backend(nodejs) but I cannot find anything related with multi blockchain dapp. As far as i know, we configure our smart contract deployment configuration in "truffle-config.js" file. Now i need one group of contracts to be deployed on private chain and another group of contracts to be deployed on a public chain. Note that both groups are part of same dapp. What I want to know is:

How should i design this(please explain folder structure and truffle-config.js for multi deployment) ?

Will there be two web3 objects in backend(nodejs) ?

Is there any open source dapp that uses multiple blockchain?


texts: What are the risks of using tokens that appear to have ERC20 standard?

texts:
Say someone sends some ERC20 (supposedly) tokens to my ETH address. I then use transfer() function to send these tokens to some other address. The question is - by using a "transfer" function do I risk losing my ethers or other tokens on the same address as I sending tokens from? Or even do I risk losing my ethers or tokens on the same keystore?
The reason that I'm asking is this:

Do I have to be an expert in solidity and do smartcontract code
review every time I am dealing with a new supposedly ERC20 token?
What are the risks if I'm not an expart in solidity and don't want to
review solidity code of a ERC20 contract that I'm about to use?


texts: Calling web3.eth.getAccounts() does nothing - no errors

texts:
I am trying to get all accounts using web3@1.3.3 and @truffle/hdwallet-provider@1.2.2. I am using HDWalletProvider with Infura. I am running this code on backend (Node.js v14.15.5). This is the code that I have currently:
const HDWalletProvider = require('@truffle/hdwallet-provider');
const Web3 = require('web3');

const provider = new HDWalletProvider({
  mnemonic: {
    phrase: '... 12 words ...'
  },
  providerOrUrl: 'https://rinkeby.infura.io/v3/PROJECT_ID'
});

const web3 = new Web3(provider.engine);

const deploy = async (contractName) => {
  try {
    console.log('checkpoint 1');
    web3.eth.getAccounts().then(function(e) {
      console.log('checkpoint 2');
    })
    .catch(function(err) {
      console.log('checkpoint 3');
    });
  } catch (err) {
    console.log('Checkpoint 4');
  }
};

deploy('myContract');

When I run the code, the only thing printed into console is checkpoint 1. There is no error or exception, no indication that something wrong. Can somebody give me a hint what I am doing wrong? Why is getAccounts not working?
EDIT
I also tried the following code (as per smarteasy suggestion), but it doesn't work either. It only prints checkpoint 1:
const deploy = async (contractName) => {
  try {
    console.log('checkpoint 1');
    const accounts = await web3.eth.getAccounts();
    console.log('checkpoint 2');
  } catch (err) {
    console.log('checkpoint 3');
  }
};


texts: How can I be notified when an address receives ethereum?

texts:
I want to be notified when a specific account receives eth.
Currently, I subscribe to ERC20 contract logs:

  web3.eth
    .subscribe(
      "logs",
      {
        address: [
          "0xabcd..." // ERC20 contract address
        ],
      },
      (err, res) => {
        if (err) console.log(err);
        if (res) console.log(res);
      }
    )
    .on("data", function (transaction) {
      console.log(transaction);
    });

which works for token transfers but not for sending eth, the callback does not get called when addresses contains my account for example.

I can subscribe to pending transactions which works when sending eth:

  web3.eth
    .subscribe("pendingTransactions", (err, hash) => {
      if (err) console.log(err);
    })
    .on("data", function (txHash) {
      return web3.eth.getTransaction(txHash, (err, returnedValue) => {
        if (err) {
          // error handling
        }
        if (
          returnedValue && returnedValue.to === accountAddress)
        ) {
          console.log(`TransactionHash: ${returnedValue.hash}`);
        }
      });
    });

however I don't know how to tell when this transaction completes, would I need another subscribe for the pending transaction hash?

Looking for a simple solution to know when a specific account receives eth using web3js, appreciate any help thanks.


texts: How do you implement a "Micropayment Channel" in a Dapp?

texts:
I've come acrossed an article, Signing and Verifying Messages in Ethereum, where it says that you can pay for other user's gas transactions but so far I haven't seen any implementation or tutorial on how to use it on a Dapp.

My primary use of this smart contract is to pay transaction fees with my address for the user in my Dapp. Is there an example of how to use the smart contract for a dapp?

Example: A simple ethereum dapp that writes a text on the blockchain but the creator of the contract pays for the transaction fees for a user that owns 0 ETH.

I really hope this is possible.


texts: How can I programmatically get a sales history of CryptoKitties?

texts:
The pages http://www.kittyexplorer.com/prices/ and https://kittysales.herokuapp.com/ show sales with prices and the IDs of the cats sold. How could I implement such a functionality programmatically?

I've already searched GitHub but the code there does not allow to access such a sales history. I've also looked at the transaction details at https://etherscan.io/ but I do not get information about the cat ID there.


texts: How do transactions know how to behave based on the genesis block?

texts:
Say I am a miner, and my genesis block on the mainnet has configuration X. A transaction comes in for me to mine. How does my Ethereum client confirm that transaction adheres to all the standards set in my genesis block?

It's my understanding that the genesis block of the transaction sender and that of the miner have to be identical for the transaction to be validated. How can I tell just from the transaction what the genesis block of the sender is? A technical explanation of this entire protocol would be excellent.


texts:
I downloaded AKASHA and started the binary, after the quick setup I always get the message:

  Synchronization was stopped

  Your machine is currently synchronizing with the Ethereum world computer network. You will be able to log in and enjoy the full AKASHA experience as soon as the sync is complete.

And the following logs:

SGE01I0117 15:28:11.384307 ethdb/database.go:83] Allotted 2048MB cache and 1024 file handles to /home/user/.ethereum/geth/chaindata Fatal: Could not open database: resource temporarily unavailable
SGE01geth: exited with code: 1
SGE01geth connection timeout

It seems AKASHA tries to launch it's own geth node instance from somewhere. I am wondering why? Isn't it possible to just connect AKASHA to my already running geth node? Do I always have to stop my own node to run AKASHA?


texts:
How do you save the "base58-decoded IPFS multihash" returned by Oraclize (in the proof parameter)?

function __callback(bytes32 myid, string result, bytes proof)

Can you safely convert proof to bytes32, and save that in the contract?

From the documentation:

If instead oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS) is used, then Oraclize will return only the base58-decoded IPFS multihash as the proof argument. To obtain the IPFS multihash, the bytes must be encoded to base58.


texts:
We know that an Oraclize based contract can communicate with the internet sites.
We know than Oraclize source is built by Solidity language.
We know that there is no command in solidity that can interact with the outer environment.
We know that there is no way in solidity to simulate async functions as Oraclize does.
So:
1- How (by what commands) Oraclize can interact with internet sites?
2- How (by what commands) Oraclize can call functions asynchronously?


texts: Is there any way to store my data into blockchain without smart contract

texts: I am trying to store customer data (name,address,dob,age etc) into blockchain. Is there any way of storing these values without smart contract ?


texts: What would happen if EVM didn't exist in Ethereum?

texts: It's not clear to me the importance of the Ethereum Virtual Machine and why it is used. So it is natural to ask what would happen if EVM didn't exist? or Ethereum didn't use it.


texts: DApp on Node2 accessing smart contract deployed by Node1

texts:
Node 1(Desktop) deployed a contract on private blockchain. From node2(Laptop),I want to interact with the contract.

But I failed at 'web3.version.getNetwork(err, netId)' function.This function throws json-rpc server error.

I am getting Network id value as undefined.But when i tried this on Node1 itself, it is working. To access json-rpc server from Node2, Do I have to configure anything on My Node2?


texts:
In solidity there is the keccak256 function which hashes its arguments.
I use the keccak256 to compute and use the result to check if some entries exist in my array.

I want to compute the same value in javascript and check if the entry exists on the blockchain, although the web3.sha gives different value than the keccak256.

How can I compute the same value for the same arguments?

In console I run this:

web3.sha3("test1");

and my contract:

function hashVal(bytes32 val) public returns(bytes32) {
     return keccak256(val);
 }


texts:
Is there a data type similar to "object" in C# that any solidity data type could rely on?
I currently have a struct with multiple fields and I would need one of them to be either a string, a boolean,... depending on the situation. Is there a "clean" way to do that?


texts:
I am trying to understand the difference between these terms  :

Wallet
private key
address

in the ethereum ecosystem, and who contains ( sort of one to many or one to one relationships between classes )


texts:
can some please explain what is event in solidium...what we can do with event in our contract...it will be nice if you kindly explain with some code....u can use the following code to explain with adding one or two events...

contract CarRentalServiceCustomer is GeneralAccount{
    string public customerName;
    string public postalAddress;
    string public phoneNumber;
    string public emailAddress;

    mapping(address=>CarRentService) public rentCar;

    struct CarRentService{
        bool active;
        uint lastUpdate;
        uint registrationFee;   // e.g. To register DriveNow or Car2GO, you have to pay approx 25 Euro
        uint256 rent;              // youtube video suggest it to uint256, then have to provide 18 digit number
    }

    function CarRentalServiceCustomer(string _name,string _postalAddress,
                                    string _phoneNumber,string _emailAddress) payable {
        customerName  = _name;
        postalAddress = _postalAddress;
        phoneNumber   = _phoneNumber;
        emailAddress  = _emailAddress;
    }

    function registerToCarRentalServiceProvider(address _providerAddress) onlyOwner {

        rentCar[_providerAddress] = CarRentService({
                                    active: true,
                                    lastUpdate: now,
                                    registrationFee: 0,
                                    rent: 0
                                    });
    }

    function setRegistrationFee(uint256 _registrationFee) {
        if(rentCar[msg.sender].active){
            rentCar[msg.sender].lastUpdate      = now;
            rentCar[msg.sender].registrationFee = _registrationFee;
        }
        else{
            throw;
        }
    }

    function setCarRent(uint256 _rent) {
        if(rentCar[msg.sender].active){
            rentCar[msg.sender].lastUpdate = now;
            rentCar[msg.sender].rent       = _rent;
        }
        else{
            throw;
        }
    }

    function payRegistrationFeeToCarRentalServiceProvider(address _providerAddress) returns (bool){
        if(_providerAddress.send(rentCar[_providerAddress].registrationFee))
        {
            rentCar[_providerAddress].registrationFee = 0;
            return true;
        }
        else{
            return false;
        }
    }

    function payRentToCarRentalServiceProvider(address _providerAddress) returns (bool){
        if(_providerAddress.send(rentCar[_providerAddress].rent))
        {
            rentCar[_providerAddress].rent = 0;
            return true;
        }
        else{
            return false;
        }
    }

    function unsubscribeFromCarRentalService(address _providerAddress){
        if(rentCar[_providerAddress].active = false && rentCar[_providerAddress].rent == 0
        && rentCar[_providerAddress].registrationFee == 0 ){
            rentCar[_providerAddress].active = false;
        } else {
            throw;
        }
    }

    function payTestFunds() payable{
        //This is a do nothing function
    }
}


texts: Creating contract from another contract - remix issue

texts:
UPDATE: This works fine on the testnet/mainnet.  For some reason the JavascriptVM in remix doesn't like it.  If anyone from remix sees this and could lend a hand though!

I wrote some a contract factory code and I'm trying to test it out in the remix browser.  I keep getting an invalid opcode error when I run the createContract bit.

contract test{

    function test(address OAddress, bytes32 _name,address _cpty1, address _creator) {

    }

}

contract Factory {
    address[] public newContracts;
    address public creator;
    address public ID;
    bytes32 public Name;
    modifier onlyOwner{require(msg.sender == creator); _;}
    event Print(address _name, address _value);

    function Factory (bytes32 _Name, address _ID){
        creator = msg.sender;
        Name = _Name;
        ID = _ID;
    }

    function createContract () payable returns (address){
        address newContract = new test(ID,Name,msg.sender,creator);
        newContracts.push(newContract);
        Print(msg.sender,newContract);
        return newContract;
    }
    function withdrawFee() onlyOwner {
        creator.transfer(this.balance);
    }
}

It was working last week, but for some reason I get this error now.  Any help would be much appreciated.


texts: Say I want to trigger a function within my smart contract upon receiving a specific token (e.g. BAT), is there any way I can verify that it's an actual BAT token?


texts: Is it possible to call Ethereum API from a Software Application without running an ETH node?

texts:
I was wondering if it's possible to make a call to Ethereum blockchain from a software application on my computer without having to run an ethereum node ?

for example, I want to make calls from a normal software application such as a java program to send messages/transactions to a smart contract on the ethereum blockchain which returns something. Is that possible ?

or do I have to run an ethereum node through geth or mist to be able to make those calls?


texts: ERC20 Token convert unit256 format depending on decimal

texts:
Hello i am trying to convert unit256 format depending on the decimal value of each token address.
Decimal 9 and 18 ı did converted. they work fine as seen in the code below
but I don't know what to do for decimal 8 and 4. Can you help me with this?
exports.gweiToEth = (val, dec) => {
if (dec === "9") {
    return converter.convert(val, "gwei", "ether")
}
else if (dec === "18") {
    return converter.convert(val, "wei", "ether")
}
return val }

I would appreciate it if you share it by updating my code, thank you very much in advance


texts: Retrieving contracts from contract address

texts:
I am trying the sample voting contract given in the Solidity docs
https://solidity.readthedocs.io/en/latest/solidity-by-example.html.

I managed to deploy the voting contract to the blockchain.

Once the contract is deployed, how do I access the different methods of the contract later from web3?

The functionality I need is:

new user signs up to a service
address of this new user should get added to the list of voters using the giveRightToVote method in the contract
After a fixed time,all the voters should cast their votes using the vote method
Get the results of the voting using winningProposal method

How do I achieve this functionality using just the contract address in web3?


texts:
In geth I can unlock my account via:

personal.unlockAccount(address, password, seconds)

in the web3js v1.0 I cannot find a similar function in the documentation.

How can I unlock my account with webjs v1.0?


texts: Which one should we use ERC-20 or ERC-223

texts:
we know that there is new update for ERC20 that is ERC-223
now wich one should we use ?


texts:
I am following this link to make private Ethereum Chain.But running

geth --identity "Prashant" --genesis CustomGenesis.json --rpc --rpcport "8000" --rpccorsdomain "*" --datadir "chaindata" --port "30303" --nodiscover --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --rpcapi "db,eth,net,web3" --autodag --networkid 1900 --nat "any" console

gives Incorrect Usage.

I am using stable version of geth 1.4.10.

What's the possible reasons for the issue?


texts: Imported account from privatenode shows loose and 0 balance

texts:
I have created my private node with the following config:

{
    "config": {
        "chainId": 65536,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },
    "difficulty": "20000",
    "gasLimit": "210000",
    "alloc": {
    "c8Caa71C16299B40B8579742a27EE53162886040": { "balance": "1000000000" },
    "60fDF758ed3549D550A52f2044B43aadf782aA4E": { "balance": "2000000000" }
    }
}

After that import the accounts in Geth using:

web3.personal.importRawKey("7c7f89b68b7a549a45856ae569997f98c4fba8f3272e90df1cf010f093d655e6", "abcd1234")
web3.personal.importRawKey("6a684c74467fb7b1d551968bf96eee7c1638a2537631372ca8c5c88837a50e8d", "abcd1234")

(the passphrase is correct)

Get balance shows the correct value;

> eth.getBalance("0x60fDF758ed3549D550A52f2044B43aadf782aA4E")
2000000000
> eth.getBalance("0xc8Caa71C16299B40B8579742a27EE53162886040")
1000000000

When I try to import the above accounts again using Metamask with their private keys (shown above).

Metamask shows that the accounts are loose, and with 0 balance.

Can anyone explain what I had did wrongly? Thanks


texts: Problem sending MetaCoin from one account to another using unit test

texts:
In Truffle; I am trying to modify the already existing MetaCoin sample unit test in order to better understand how everything works. Below is the unit test they provide which transfers 10 coins from account[0] to account[1] which passes.

  it("should send coin correctly", function() {
    var meta;

    //    Get initial balances of first and second account.
    var account_one = accounts[0];
    var account_two = accounts[1];

    var account_one_starting_balance;
    var account_two_starting_balance;
    var account_one_ending_balance;
    var account_two_ending_balance;

    var amount = 10;

    return MetaCoin.deployed().then(function(instance) {
      meta = instance;
      return meta.getBalance.call(account_one);
    }).then(function(balance) {
      account_one_starting_balance = balance.toNumber();
      return meta.getBalance.call(account_two);
    }).then(function(balance) {
      account_two_starting_balance = balance.toNumber();
      return meta.sendCoin(account_two, amount, {from: account_one});
    }).then(function() {
      return meta.getBalance.call(account_one);
    }).then(function(balance) {
      account_one_ending_balance = balance.toNumber();
      return meta.getBalance.call(account_two);
    }).then(function(balance) {
      account_two_ending_balance = balance.toNumber();

      assert.equal(account_one_ending_balance, account_one_starting_balance - amount, "Amount wasn't correctly taken from the sender");
      assert.equal(account_two_ending_balance, 10, "Amount wasn't correctly taken from the sender");
    });
  });

I created a second unit test; where I wanted to transfer 5 coins out of account[1] and transfer it to account[2]; however, my test always returns 0.

  it("should send some more coins!", function() {
      var amount = 5;
      var meta;
      var account_two = accounts[1];
      var account_three = accounts[2];

      return MetaCoin.deployed().then(function(instance) {
        meta = instance;
        return instance.sendCoin.call(account_three, amount, {from: account_two});
    }).then(function(balance) {
      return meta.getBalance.call(account_three);
    }).then(function(balance) {
      assert.equal(balance.toNumber(), amount, "Amount equaled 5 as expected");
    });
  })

When I run it; the unit test results are this:

Contract: MetaCoin
    √ should put 10000 MetaCoin in the first account
    √ should call a function that depends on a linked library (68ms)
    √ should send coin correctly (156ms)
    1) should send some more coins!

3 passing (390ms)
  1 failing

1) Contract: MetaCoin should send some more coins!:
     AssertionError: Amount equaled 5 as expected: expected 0 to equal 5
      at C:/Dev/Blockchain/test/metacoin.js:92:14
      at process._tickCallback (internal/process/next_tick.js:103:7)


texts: Can a contract know sender's address creation date?

texts: My contract should have a function that reads the creation date of the sender address. Possible?


texts: So, I understand all contracts inherit from address. Can you override the send method present in the address type?


texts: Doubts regarding transactions broadcasting and concept of tx pool

texts:
This is going to be a long and some questions may sound dumb. But let's go ahead with this.

As per my understanding, once we send a transaction to blockchain, it goes to transaction pool with other transactions. Once the transaction is picked by any miner and included in a block, the transaction is removed from the transaction pool (mempool, bitcoin analogy).

Is the transaction pool (or mempool or queue pool) specific to a ethereum node or the ethereum-client (geth,prity)?
What is the difference between tx pool of geth and tx pool of my node (if they are different, I am not sure of this)?
How can I know if the transaction is in tx pool? Can we assume all the transactions that are not mined are in tx pool?
If by any way transaction is not in tx pool and not mined, can we assume that this transaction can never make it to a block?
or  When can I be sure that my transaction is dropped completely and won't be mined.
I can see a lot of pending/queued transaction on my node.
   Are these transactions send from my node only?
  What happens to these transactions when:
      a) I stop geth node for some time and restart
    b) I remove db, update geth and resync using light/fast sync
Suppose the ethereum network is under heavy load. What are the cases where my transaction will never be included in a block (assuming transaction doesn't run out of gas and sufficient gas price is provided).
How can I be sure that the transaction is successfully broadcasted to network,if I am unable to see it on block explorers like etherscan (not even in Pending transaction pool).


texts:
enter link description hereI send a transaction with contract. I use unlock account to account it. It can skip the first confirm. Which is asked to confirm deploy. But it can't skip the second confirm, the function execution. Just as the picture show.

I search the JSONRPC of Parity. And found a JSONRPC named confirmRequest, I think it's maybe useful. But when I call it, it returns "Method not found"...

So how to confirm this request? Thanks a lot! :)


texts: Where does ethminer mining reward go ? No option to provide wallet address

texts: I did a count on this forum, and seems like most people there mine with ethminer. I've always been using claymore miner which has the -ewal option to provide my ether address, but there's no equivalent option in ethminer program. So where does my mining reward go to ?


texts:
Given I want to return a mapping from a function, which is impossible, therefore I return each of the mapping's item in a function by a corresponding ID, like this answer suggests :
How to return a mapping type?

Given I want to iterate over all existing IDs in a mapping in order to retrieve all user assets, how long does it take to call a single iteration ?


texts: How to prove existence of a function with estimategas

texts:
How can I prove the existence of a function in a smart contract with the EstimateGas ?
Thanks.