texts: Web3 transaction to a contract fails with revert. Same transaction works from truffle console

texts:
I have a simple contract transaction that creates another contract. This transaction when called from Node.js using Web3 and truffle-contract throws a revert.

ContractFactory.deployed().then(function(instance) {
    return instance.createStore({from: accounts[0]});
});

Result:

2018-05-14T07:34:58.260Z develop:testrpc   Transaction: 0xc93859052bea36bd76c80ab21d30c90a3002303ec7eb1e3ea6d08cd002990d74
2018-05-14T07:34:58.261Z develop:testrpc   Gas usage: 89462
2018-05-14T07:34:58.261Z develop:testrpc   Block Number: 39
2018-05-14T07:34:58.261Z develop:testrpc   Block Time: Mon May 14 2018 13:04:58 GMT+0530 (India Standard Time)
2018-05-14T07:34:58.261Z develop:testrpc   Runtime Error: revert

When I call the same transaction from truffle console or truffle develop the transaction succeeds.

truffle (develop) > ContractFactory.deployed().then(function (instance) { return instance.createStore() });

Result:

2018-05-14T07:30:33.789Z develop:testrpc   Transaction: 0xbdc51bb74de2b59e98ad1b8f38ed4367c2d975a77340d778e44ee2ced969e5b9
2018-05-14T07:30:33.789Z develop:testrpc   Gas usage: 135843
2018-05-14T07:30:33.789Z develop:testrpc   Block Number: 38
2018-05-14T07:30:33.789Z develop:testrpc   Block Time: Mon May 14 2018 13:00:33 GMT+0530 (India Standard Time)
2018-05-14T07:30:33.789Z develop:testrpc
2018-05-14T07:30:33.791Z develop:testrpc eth_getTransactionReceipt

I've been trying to get truffle debug to work but it fails to debug transactions that create another contract.

My initial guess was that my Web3 transaction is running out of set gas limit, but would that throw a revert? I've tried setting gas limit to a very high value but with no better results.

ContractFactory.defaults({
  gasLimit: "100000000000000000"
});

Contract Code:

pragma solidity ^0.4.16;

contract SimpleStore {
    uint public value;
    function SimpleStore (uint num) public {
        value = num;
    }

    function setValue (uint num) public {
        value = num;
    }
}

contract ContractFactory {

    address public store;

    function ContractFactory () public {

    }

    function createStore () public {
        store = new SimpleStore(12);
    }
}

Note: Other transactions and calls work very well with the Web3 setup. This problem is common for all transactions that create a contract.


texts: web3 - Contract deployment has been reverted by the EVM

texts:
I want to deploy a contract but my transaction gets reverted. This only happens with Web3, while it works fine with Remix.I can assure the ABI and Bytecode are correct because I pasted them from Remix, I also debugged the transaction and it doesn't get rejected because of a faulty require statements. Since the issue occours when using Web3, I wonder whether I'm doing anything wrong with the code, but I followed the docs so it should be fine.

web3.eth.personal.unlockAccount("0x57...8c6b", "myPassword", 10000000).then(function() {
    let abi = [...]; // Pasted from Remix
    let bytecode = "0x..."; // Pasted from Remix
    let sender = "0x577...8c6b";

    let newContract = new web3.eth.Contract(abi);
    newContract.options.data = bytecode;

    newContract.deploy({
        args: ""
    }).send({
        from: sender,
        gas: 3000000,
        gasPrice: '30000000000000'
    }).on('error', (error) => {
        console.log("Error: ", error);
    }).on('transactionHash', (transactionHash) => {
        console.log("TxHash: ", transactionHash);
    }).on('receipt', (receipt) => {
       console.log("Address: ", receipt.contractAddress)
    }).then((newContractInstance) => {
        console.log(newContractInstance);
    }).catch(function(error) {
        console.log(error);
    });
});

I also tried ignoring the args parameter in deploy but the result is the same:

Error: Error: Transaction has been reverted by the EVM:
{
  "blockHash": "0x0038dfdb8cfd6504d247c9463ad13a43418c15235c625663be4cffee52fe5d61",
  "blockNumber": 387165,
  "contractAddress": "0xf6c8bA6fe06d7F1266bE90A2618faa9E172c0ee6",
  "cumulativeGasUsed": 3000000,
  "from": "0x577ed03fb404fab176c5ca39543def8fd3308c6b",
  "gasUsed": 3000000,
  "logs": [],
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "status": false,
  "to": null,
  "transactionHash": "0x4e6c1ebb28770bd702d37f41b442a05b66beba3653a8f1c237e6e18be42b707c",
  "transactionIndex": 0
}

By debugging the transaction I can see that it fails when 2097504 gas is left, whereas Web3's output says the transaction used them all. What I want to understand is whether I'm doing anything wrong with Web3, because the code should be fine considering I can deploy it via Remix.

N.B: I'm using a private chain.


texts:
I have a problem with raw Transaction.
Using this code to send tokens to another contract, something does not work.
The transaction is signed correctly, everything is sent to the network but it does not work.

   let gasCost = await tokenContract.transfer['address,uint256,bytes'].estimateGas(tradecenterAddress,web3.toWei(
                                            this.uint256,"ether"),
                                            web3.fromAscii(this.bytes),
                                            {from:this.creator});
        console.log(gasCost);

        let count = web3.eth.getTransactionCount(this.creator);

        var rawTransaction = {

            "from":this.creator,
            "nonce":"0x"+count.toString(16),
            "gasPrice":web3.eth.gasPrice.c[0],
            "gasLimit":gasCost,
            "to":SafeCoinAddress,
            "value":"0x0",
            "data:":tokenContract.transfer['address,uint256,bytes'].getData(tradecenterAddress,this.uint256,web3.fromAscii(this.bytes),{from:this.creator}),
            "chainId":1994
        };

        let tx = new window.ethereumjs.Tx(rawTransaction);
        let privateKey = window.keythereum.recover(this.password,fileOb);
        privateKey = privateKey.toString('hex');
        let buf = Buffer.Buffer.from(privateKey,'hex');
        console.log(privateKey);
        console.log(buf);
        tx.sign(buf);
        let serializedTx = tx.serialize();
        let recipt = await web3.eth.sendRawTransaction('0x'+serializedTx.toString('hex'));
        console.log(recipt);

Doing the same in this way everything works.

   let gasCost =  tokenContract.transfer['address,uint256,bytes'].estimateGas(tradecenterAddress,web3.toWei(44,"ether"),web3.fromAscii("fd"));
      console.log(gasCost);
       let hashT =   tokenContract.transfer['address,uint256,bytes'].sendTransaction(tradecenterAddress,web3.toWei(44,"ether"),web3.fromAsci

i("fd"),{from:account0,gas:gasCost});


texts: Is there anyway to reverse an ether transaction on binance or etherscan?

texts: Help please! I sent all my ether to a fraud website about an hour ago. I tried contacting the email that was on website, but it said it was invalid.I need to cancel it ASAP.


texts:
I know state is mutable but changes are held in the chaindata as leveldb data. How can we actually read the chaindata history? Are there some utilities for this?

if I have this code -

pragma solidity ^0.4.18;

contract RegisterContract {

    uint public contractWeight;

    mapping(bytes32=>string) public contracts;
    bytes32[] public myHashes;

    function addContract ( string jsonInput, bytes32 hashKey) public {
        contracts[hashKey] = jsonInput;
        myHashes.push(hashKey);
     }

    function addWeight (uint weight) public {
        contractWeight = weight;
    }

    function () payable public {
    }

}

And I want to check all the history of the hashes when they were added (and new code could delete them), then how would I do that?


texts: Does Ethereum offer encrypted peer to peer communication applications?

texts:
I am wondering if Ethereum can be used for encrypted peer to peer communication like delivering encrypted short messages or encrypted data in bulk between two or multiple parties.

Are there any examples or applications that I can review?


texts: What is the difference between the "legitimately remaining gas" and the "total gas that remains"?

texts:
So, first we're told that g' is the "legitimately" remaining gas. But then we're told that g*, where g* >= g', is "the total gas that remains". If g' is the remaining gas, how do we add to it to arrive at the "total gas that remains"? What is the difference between the "legitimately remaining gas" and the "total gas remaining"? Is g* not greater than or equal to the amount of gas actually remaining? And who's meant to make up this potential difference, the miner?
Additionally, what is the significance of the (Tg-g')/2? Is this halving just arbitrary? Quite confused by this equation.


texts: How to "legalize" Ethers in the real world? Successfully pass any regulations, blocks and taxes

texts:
For example I have collected 160000 ether using crowdfunding Ethereum contract.
And now I want to buy commercial real estate to take a rent and pay back to my token holders.

So questions, how to actually do that?
In which country to create real company and open bank account?
In which jurisdictions company will fall into?
How to proof legal origin of capital to legal instances?
How to pay taxes only from revenue?
Some other things to consider?


texts:
I am using testrpc. While running truffle migrate I get the following error:

/usr/local/lib/node_modules/truffle/node_modules/truffle-contract/contract.js:671
        throw new Error(this.contract_name + " has no network configuration for its current network id (" + network_id + ").");
        ^

Error: XXXTokenFactory has no network configuration for its current network id (1497979617513).

My truffle.js as the following content

// Allows us to use ES6 in our migrations and tests.
require('babel-register')

module.exports = {
  networks: {
    development: {
      host: 'localhost',
      port: 8545,
      network_id: '*' // Match any network id
    }
  }
}

What am I missing? Would appreciate any help I get. Thanks


texts:
I have a question on setting prices for the cards in the card game I'm working on.

Right now, I have 2 cards available but there will be more (maybe a couple dozen).

I store each card as a struct with its attributes and when a person "collects" it a function makes a copy of it in a new array, mints it to the person collecting it and sets the tokenURI.

My question is how could I set the prices for the cards, being that some will be more rare/collectible than others? Maybe set a cardPrice as part of the struct for each card, then have the payable function check to make sure the value being sent by msg.sender matches the cardPrice for that card?

If something like that would work, I'd also want to add a function to update the cardPrice if needed.

Would that approach work or have any of you done anything like that where you have a single payable function that would need to be paid different fees depending on a given situation?

Here are the two structs & arrays. Card is the master version and Warrior is the one collected by the person.

struct Card {
string cardName;
uint16 cardImage;
uint256 cardAttributes;
uint16 cardIssued;
uint16 cardMax;
}
Card[] public cards;

struct Warrior {
string warName;
uint16 warImage;
uint16 warNumber;
uint256 warAttributes;
uint16 warIssued;
uint16 warMax;
}
Warrior[] public warriors;

Here's the bit that copies a Card into a Warrior:

function dupCard(uint256 id, string memory _tokenURI, address _to) public
returns (
string memory _warName,
uint16 _warImage,
uint16 _warNumber,
uint256 _warAttributes,
uint16 _warIssued,
uint16 _warMax
) {
Card storage Crd = cards[id];
_warName = string(Crd.cardName);
_warImage = uint16(Crd.cardImage);
_warNumber = uint16(id);
_warAttributes = uint256(Crd.cardAttributes);
_warIssued = uint16(Crd.cardIssued);
_warMax = uint16(Crd.cardMax);

createWarrior(_warName, _warImage, _warNumber, _warAttributes, _warIssued, _warMax, _tokenURI, _to);
incrementIssued(id);
}

function createWarrior(string memory _warName, uint16 _warImage, uint16 _warNumber, uint256 _warAttributes, uint16 _warIssued, uint16 _warMax, string memory _tokenURI, address _to) public {
uint256 id = warriors.length;
warriors.push(Warrior(_warName, _warImage, _warNumber, _warAttributes, _warIssued, _warMax));
_mint(_to, id);
_setTokenURI(id, _tokenURI);
warriorToOwner[id] = _to;
ownerWarriorCount[_to]++;
}

function incrementIssued(uint256 id) internal {
cards[id].cardIssued++;
}


texts: getting reserve data of a pair of tokens in pancakeswap pools

texts:
I am trying to find the current and past reserves for a coin pair of a certain pool from the pancakeswap smart contract. I can't seem to find any smart contract that can return that. (can't get find them on google though)
I searched in the code for the masterChef smart contract (0x73feaa1eE314F8c655E354234017bE2193C9E24E) and the cakeToken smart contract (0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82) but to no use.
Where do I find this kind of data ? event logs? of which contract and which event?
I would like to get the same data that I can get from this API


texts:
So today, A  vulnerability found within the Parity walletLibrary which resulted in freezings of potentially hundreds of millions of dollars from wallets using parity multi-sig.
Can someone technically explain how this was abused?

Here is link to the vulnerable code


texts:
I tried to install the Geth for windows from the downloading page of go-ethereum https://geth.ethereum.org/downloads/. However, the page stays pending "Retrieving packages from release server..."
then it displays "Failed to load releases!"
How can I solve this problem or can I get the Geth from another source?


texts: Why does a function in a contract, that creates a transaction, returns a transaction hash in return, even though I have written return bool?

texts:
Here is the sample code:

 function myFunc(string name) public returns(bool,bytes32)
{
    bytes32 hash= sha256(name);
    names[hash] = true;
    return (true,hash);
}

Here names is mapping, I am trying to store names in blockchain. I have returned (true,hash), but when I call the function from frontend i receive the transaction hash. How can I get what i want to return?


texts: How to monitor a large set of ethereum address for balance?

texts:
I am planning to build a system where users will get notified through an email and app notification if there was any change in their ether balance.
I was confused how to monitor a large set of ethereum address for 24/7 to check the balance and to trigger an event based on that. Does web3.js provides any function for monitoring a large set of ethereum address?


texts: Cross-posted from Stack-Overflow: Using Google Cloud Key Management Service to sign an Ethereum transaction

texts:
Cross-posted from question

I've been working on writing a signer service for an Ethereum transaction manager and I need to sign Ethereum transactions using Google KMS Golang APIs. I'll try and summarise the problems I'm facing below.

Ethereum requires compact RLP encoded 65-byte ECDSA signatures in R || S || V format. ECDSA signatures by Google KMS on the other hand have extra header components (R length, S length, etc) along with variable length R and S components. This makes these signatures incompatible for use with Ethereum transaction signing.

A way to get around this is parsing the R and S bytes from the ecdsa signature obtained from Google KMS, compute and add the V byte to the end and use this signature to get a signed Ethereum transaction. Something like this:

var parsedSig struct{ R, S *big.Int }
_, err = asn1.Unmarshal(body, &parsedSig)
if err != nil {
    logger.WithError(err).Error("failed to parse signature bytes")
    return err
}

However this would possibly fail due to one or more of the following reasons:

Creating compact ECDSA signatures of 65-byte length by parsing out the R and S components and adding the V component is possibly as distrustful as it sounds. R and S components as mentioned above are not always of 32 byte length for standard ECDSA signatures, which means that the ECDSA signature created by concatenating the components might not always result in 64 bytes.
Currently signed transactions in Ethereum are created from Keccak-256 digest hashes after RLP encoding transactions as shown below:

// from go-ethereum
func rlpHash(x interface{}) (h common.Hash) {
    hw := sha3.NewLegacyKeccak256()
    rlp.Encode(hw, x)
    hw.Sum(h[:0])
    return h
}

Asymmetric ECDSA key signing in Google KMS doesn’t have support for Keccak-256 SHA3 message digests. Would using a SHA-256 digest for ethereum transactions work? IMO this would fail since all transaction signature verification happens on RLP encoded Keccak hashes.
At this point I am not very sure how to compute the V component of the ECDSA signature after having checked the secp256k1 implementation of the secp256k1_ecdsa_sign_recoverable() function.

How do I go about solving these above issues to be able to create verifiable signed Ethereum transactions using asymmetric elliptic curve signing algorithm by Google KMS?


texts: Do you spend gas to sign a message and send it to another client?

texts:
Let's say that I want to send the hash of a key to an entity and I want the entity to be sure that the hash could have come only from me.

It is possible to create a message with the hash of the key and then send it signed to the other entity?

Will this cost any gas?

Will a transaction be generated and mined in a block in the blockchain?


texts:
The account nonce is the only element in the transaction structure that prevents replay attack (as explained in this very good answer). It essentially forces sequentialisation of an account's tranctions.

This usually doesn't cause problems when transactions are submitted through the web3 interface to an Ethereum node (e.g. Geth, Parity), which then does the signing. The sequentialisation is done internally by the node, and thus is transparent to the end-user.

This is not the case when transactions are created and signed by a user application (i.e. not Geth or Parity), before sent over to a node (e.g. through web3.eth.sendRawTransaction).

Constructing the raw transaction requires obtaining an account's nonce, which can be done by web3.eth.getTransactionCount, as explained in this question. This works fine when no concurrency is involved.

However, consider an end-user that has to sign multiple transactions in parallel. The transaction sequentialisation becomes a responsibility of the user application.

"web3.eth.getTransactionCount" returns confirmed transaction counts only (see this question). As a result, when transactions are signed in parallel, unless we manipulate the count in a smart way, only one of them will succeed.

My question is: what are some good patterns to handle this situation?

Candidate 1: multiple keys/accounts per user

This does allow concurrent transactions. However, it introduces extra complexity in the user application. Plus, it's not too scalable: consider if tens or hundreds of concurrent transactions are needed. Furthermore, given that Hierachical Deterministic wallet is not native in Ethereum (I am aware there is the LightWallet), this doesn't sound like an easy solution.

Candidate 2: Loop and retry

This makes a loop that checks transaction sending result. If the return result indicates duplicate nonce (e.g. Geth would return 'replacement transaction underpriced'), re-try with a new nonce.

This solution is not portable: different clients return different strings for the same error. In practice, I seem to have noticed Geth sometimes does not even return the above string, but silently drops the other transactions (not confirmed as I haven't found a reliable way to reproduce). As a result, the detection doesn't work reliably.

Candidate 3: a singleton 'nonce manager'

Each transaction construction involves "applying for" a nonce from a global "nonce manager". The singleton "nonce manager" can have some smart logic to hand out ascending nonce numbers. This exploits the behaviour discussed here.

Not only this introduces a singleton (arguable an anti-pattern), but also it doesn't sound easy to get it right: if a low nonce transaction fails somehow (e.g. doesn't even get sent out to the network), the rest of the transactions will become stuck indefinitely. In general, it's a poor solution that introduces more complexity and problems than trying to solve.

Candidate 4: delegate to a local Geth/Parity node

This is not really a solution. The most obvious issue is the extra dependency doesn't seem to be justifiable, if it's merely for the nonce field.

Also, if the user application already manages private keys, this introduces extra complexity: the private keys will need to be co-managed (or copied) by the Geth or Parity node. Again, the complexity (and potential vulnerability) doesn't appear justifiable if it's only for dealing with the nonce.

Off topic. It appears to me the account nonce is not the best design in Ethereum. It forces user applications to either handle low-level protocol details, or to introduce dependency on a node (Geth/Parity). Either way, it adds disproportional bulkiness to user applications.


texts:
I've been struggling on this for days, and been googling a bunch of things but still no luck. Here's my code for 2_deploy_contracts.js:

const CoinCrowdsale = artifacts.require("./CoinCrowdsale.sol")

module.exports = function(deployer, network, accounts) {
  return liveDeploy(deployer, accounts);
};

const duration = {
  seconds: function(val) { return val},
  minutes: function(val) { return val * this.seconds(60) },
  hours:   function(val) { return val * this.minutes(60) },
  days:    function(val) { return val * this.hours(24) },
  weeks:   function(val) { return val * this.days(7) },
  years:   function(val) { return val * this.days(365)}
};

function latestTime() {
  return web3.eth.getBlock('latest').timestamp;
}

async function liveDeploy(deployer, accounts) {
  const startTime = latestTime() + duration.seconds(1); // one second in the future
  const endTime = startTime + (86400 * 30); // 30 days
  const rate = new web3.BigNumber(1000);
  const wallet = accounts[0];

  return deployer.deploy(CoinCrowdsale, startTime, endTime, rate, wallet);
}

and here's the error message:

➜  COIN git:(master) ✗ truffle deploy --network ropsten --reset
Using network 'ropsten'.

Running migration: 1_initial_migration.js
  Replacing Migrations...
  ... 0x64f00774e5e7322d4a3d44dc0a1ef15962dc898750c7adbb2ebc3fe39872ee39
  Migrations: 0x10c30744d4860f3ca714d52b07e7c864d32f5e01
Saving successful migration to network...
  ... 0x12637ca8c8dc5dde86831594b4b1084dad776d080523b2551a0e142d9bd5bdf7
Saving artifacts...
Running migration: 2_deploy_contracts.js
Saving successful migration to network...
(node:81173) UnhandledPromiseRejectionWarning: Error: Web3ProviderEngine does not support synchronous requests.
    at ProviderError.ExtendableError (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-error/index.js:10:1)
    at new ProviderError (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-provider/error.js:17:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-provider/wrapper.js:71:1
    at WalletProvider.send (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-provider/wrapper.js:109:1)
    at Object.send (/usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-migrate/index.js:209:1)
    at RequestManager.send (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:58:1)
    at Eth.send [as getBlock] (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/method.js:145:1)
    at latestTime (/Users/glaksmono/Documents/COIN/migrations/2_deploy_contracts.js:17:19)
    at liveDeploy (/Users/glaksmono/Documents/COIN/migrations/2_deploy_contracts.js:21:21)
    at module.exports (/Users/glaksmono/Documents/COIN/migrations/2_deploy_contracts.js:4:10)
(node:81173) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:81173) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  ... 0x1688c2faeb17b37432f524d18e125675234b5b68abde005b7245980e7c6d8f2a
Saving artifacts...
➜  COIN git:(master) ✗ truffle version
Truffle v4.0.6 (core: 4.0.6)
Solidity v0.4.19 (solc-js)

Thoughts?


texts: What is the method to unlock account (not personal)?

texts:
Background
There are 2 different ways in order to create accounts with web3.

1. web3.eth.personal.newAccount(password, [callback])
2. web3.eth.accounts.create([entropy]);

SEcond options returns object which contains private key of account which is great . But in order to unlock account I have to use

web3.eth.personal.unlockAccount(fromAccount,password).then(function (result) {

In Web3 docs website they say these methods are //TODO
getAccounts, unlockAccount, lockAccount, sendTransaction
My questions

How to unlockAccount created with 2 option (not personal)
How to get private key from 1 option (personal.newAccount)

Thanks you very much in advance


texts: Alright, it looks like everything in the terminals is running well. The contract looks to be deployed successfully. It seems like there's supposed to be an API or something I can access via looking up the port that's being listened to. Ganache-cli says Listening on 127.0.0.1:8080 but when I put this into my browser I get 40 bad request


texts:
I'm a first time user, reading a book and ready to try some experimentation.
I downloaded the wallet (Ethereum-Wallet-installer-0-8-10.exe), and it froze on the following screen for at 8 or more hours (I thought maybe it was downloading, but I don't think it ever got that far).

The circle image was animated, which implied to me it was doing something and I should wait. I think the above was the screen after I entered my password.

Also expected the "Checking Network..." in upper right corner to go away, or the "connecting to 2 peers" to change to some other text.


texts: Getting error while buying test ether from https://faucet.metamask.io/

texts:
I just tried to buy a test ether from https://faucet.metamask.io but the faucet address which is supposed to give 1 ether doesn't have enough balance.

Snapshot of the faucet address

And when i click on the button "request 1 ether from faucet" i get this this error:

  {"error":"[ethjs-rpc] rpc error with payload
  {\"id\":7622897729724,\"jsonrpc\":\"2.0\",\"params\":[{\"to\":\"0xb4b199e03506d505278aa0636790fcddaeb0afd3\",\"from\":\"0x81b7e08f65bdf5648606c89998a9cc8164397647\",\"value\":\"0xde0b6b3a7640000\",\"data\":\"0x\"}],\"method\":\"eth_sendTransaction\"}
  [object Object]"}

I am using Ethereum wallet MetaMask chrome extension and I am connected to Ropsten test network. I am following the instructions from the book Mastering Ethereum: Building Smart Contracts and DApps book by Andreas Antonopoulos and Gavin Wood.

Your help will be appreciated.

PS: Please bear any mistakes because this is my first post and I am not a native English speaker.


texts: Developer related changes to prepare for Ethereum hard fork - Constantinople

texts:
I am hosting my own ethereum node using geth and I have some simple dApps which make use of the web3.js library.

I went through various documentations related to the hard fork, more specifically this one https://blog.ethereum.org/2019/01/11/ethereum-constantinople-upgrade-announcement/

I understand that I have to upgrade my geth node to v1.8.20 https://github.com/ethereum/go-ethereum/releases

Apart from this, do I need to update anything else?


texts: Hyperledger Fabric and Ethereum Blockchain Integration

texts: How can I connect Hyperledger Fabric to the ethereum blockchain so as to make payments. I am recording the number of tokens to be alloted in the hyperledger system I want to access the data and then make payment through Ethereum ERC20 tokens. However I tried using REST API, but they are not providing much of the security. How can I do it the right secure way ?


texts: What is the correct truffle configuration to deploy DApp to the POA test network?

texts:
I am currently struggling to deploy my DApp to the POA testnet (https://sokol.poa.network).

I have a working DApp that I deployed to my local Ethereum testnet using truffle compile and truffle migrate.

Now I tried to run the DApp on the POA network instead.
I changed my truffle.js file and it looks like like this:

module.exports = {
  networks: {
    development: {
      host: "https://sokol.poa.network",
      network_id: "*" // Match any network id
    }
  }
};

Just as suggested in the POA network docs I installed parity and I can open and interact with the parity interface normally, I even run parity with the insecure flag to enable RPC calls:

parity --geth  --warp --config dev-insecure --reseal-min-period 0 --jsonrpc-cors http://localhost  --chain spec.json --reserved-peers bootnodes.txt ui

I can interact with the POA network and use my wallets with parity normally.

Unfortunately it seems like truffle and parity do not communicate well with each other in my configuration when I try to deploy my contract.

When I try to run the command truffle migrate --reset (to deploy the smart contracts to the POA network I get the following error:

Could not connect to your Ethereum client. Please check that your Ethereum client:
 - is running
 - is accepting RPC connections (i.e., –rpc option is used in geth)
 - is accessible over the network
 - is properly configured in your Truffle configuration file (truffle.js)

What could I be missing to make this work? Is truffle even able to communicate with my parity node?


texts: How can a Smart Contract pull an amount of Ether equal to its own balance from an External Account?

texts:
I'm writing a 2 Player Game. Rules:

Player 1 must place a bet (and send some ether to the contract).

Then, Player 2 must match the bet placed by Player 1, and send the same exact amount of ether to the contract as well.

Right now, my constructor works well. It allows Player 1 to send ether to my contract.
I know I can add a parameter to matchBet() and require that msg.value equals the contract balance.
But is there a way to make Player 2 match Player 1's bet, without any parameters?
I would like:

Player2 calls matchBet() without any parameters
matchBet() reads address(this).balance
matchBet() pulls address(this).balance from Player 2 to the Smart Contract.

    constructor() public payable {
        require(msg.value > 0, "Player 1 must bet a positive amount");
        assert(address(this).balance == msg.value); // Contract balance should == Player 1's bet
    }

    function matchBet() external payable {
        require(msg.sender != players[0].addr, "Player 1 can't match his own bet.");
        //require(msg.value == address(this).balance, "Player 2 must match Player 1's bet");
        address(this).transfer(address(this).balance);
    }

I found this: How is it possible for a contract to automatically charge an amount to an external account? but that question is a bit old.
Maybe in the meantime a solution was created?


texts: How to write truffle migration file for the contract that contains more than one contract

texts:
Suppose my contract named "B" look like :

contract A {
   function abc(){
   ...
   }
}
contract B is A {
   function bc(){
   ...
   }
}

then how will be the migration file look like.


texts: does EVM support pop() that returns the last element?

texts:
pop() that returns the last element is a method I have found would be good to have in smart contract development. Since v0.5.0 released a year ago, Solidity supports pop() for removing the last element of an array, but without returning it. Do other languages like Vyper support pop() (with last element returned), is there any plans for Solidity to support it, is the logic easily implemented in assembly?

edit: more or less pop() with assembly for 2 dimensional array.

function pop(uint _arraySlot, uint _idx) public returns (uint popped) {
    assembly {
        let arrayData:= keccak256(_arraySlot)
        let len := sub(sload(add(arrayData, _idx)), 1)
        popped := sload(add(keccak256(add(arrayData, _idx)), len))
        sstore(add(arrayData, _idx), len)
    }
}


texts: deploying simple contract on quorum 7nodes example

texts:
I am trying to deploy contract with privateFor tag in migration and for set function same as shown in truffle quorum 7node example.
started nodes with these commands

./raft-init.sh
./raft-start.sh

nodes started fine, but when I tried to deploy contract with truffle on localhost:22000, truffle showing an error:

Could not connect to your Ethereum client with the following parameters:
    - host       > 127.0.0.1
    - port       > 22000
    - network_id > *
Please check that your Ethereum client:
    - is running
    - is accepting RPC connections (i.e., "--rpc" option is used in geth)
    - is accessible over the network
    - is properly configured in your Truffle configuration file (truffle-config.js)

please let me know what seems to be the problem, Is there any step missing?

note :I thought there is a problem with rpc connection in geth. but I dont now how to troubleshoot.


texts: Sending Dynamic Arrays From One Contract To Another

texts:
I'm working on two contracts, one of which will contain an array of indeterminate size. The second contract wants to request a subset of this contract for its functions. My initial attempts seem to suggest that this is either difficult or impossible, at least without some sort of Rube-Goldberg-esque machinery. Does anyone have any suggestions? The code is here:

pragma solidity ^0.4.19;
contract EMWhiteList {
    /*This contract is meant to abstract out the whitelist functionality from the EMBallot contract so that the voting contracts can be
    reused more easily. IE we will be able to create a new EMBallot for each county and have a seperate whiteList for each.
    */
    address[] whiteList;
    struct Voter {
        address addr;
        string region;
    }
    Voter[] voters;
    address[] regionalVoters;

    function addToWhiteList (address voter){
        whiteList.push(voter);
    }

    function returnWhiteList () constant returns(address[]){
        return whiteList;
    }

    function addVoter(address key, string region){
        Voter memory newVoter = Voter (key, region);
        voters.push(newVoter);
    }

    function getRegion(string region) constant returns (address[]){
        for(uint8 i=0; i<voters.length; i++){
            if(keccak256(voters[i].region) == keccak256(region)){
                regionalVoters.push(voters[i].addr);
            }
        }
    }

    function getVoter(uint256 key) constant returns(address){
        return voters[key].addr;
    }
}

contract RegionalContract {
    address[] whiteList;

    function getList(string region, address whiteListAddress){
        EMWhiteList fullWL = EMWhiteList(whiteListAddress);
        whiteList = fullWL.getRegion(region);
    }

}


texts: Storing constants in Storage vs Creating a view function? (Solidity 0.5.17)

texts:
So, which would be gas efficient?
Reading a storage variable in a state-changing function?
OR
Reading from a pure function in a state-changing function?
Example:
contract Test {
    uint256 public a = 10;

    uint256 public b = 1;

    function aPure() public pure returns(uint256) {
        return 10;
    }

    function aFunc() public {
        b = a;
    }

    function aPureFunc() public {
        b = aPure();
    }
}

In the above, will aFunc() have lower gas cost or aPureFunc()?


texts: Explicitly refer to state variables instead of local variables with the same name

texts:
Is it possible to refer to state variables when a local variable has the same name?

The this keyword in Solidity does something else, and I haven't heard of any equivalent keyword.

For example:

pragma solidity ^0.4.18;

contract escrow {

  address seller;
  address buyer;
  address owner = msg.sender;

  function setup(address seller, address buyer){
    if(msg.sender == owner){
        this.seller = seller;
        this.buyer = buyer;
    }
  }

}

I found this GitHub issue but no answers to my specific question.


texts: is it possible to use a smart contract of an existing token in ganache for testing ?? that is, I don't have to create my smart contract


texts: How does the eth.getBalance() function work? Which file does it call exactly? How and where all parameters are passed? Please someone explain it to me.


texts: ethminer never seems to mine - repeated DAG generation

texts:
I've installed geth and ethminer to get started mining. I've got an Ubuntu 16.04 box with a couple Nvidia TitanX cards. When I fire up ethminer like so...

  ethminer --no-precompute -G --opencl-device 1

It spends about 10 minutes generating a DAG file, then spits out some quick messages about initializing the miner, but then goes right back into generating another DAG file (and repeat). Here's the output from between the DAG file generations.

  Creating DAG. 100% done...miner  01:42:25.948|ethminer  Got work package:
  miner  01:42:25.948|ethminer    Header-hash: 5179bc66dd92a61cc31cf9c0fb3460cb1c353dca87966cc2c9390fca61ecf233
  miner  01:42:25.948|ethminer    Seedhash: 0823bb39dee602fcd155d60fcd7d3c489623497a91ce0f79475ef7f09390a2c3
  miner  01:42:25.948|ethminer    Target: 000000000006bbd41383e0f5fbc3e27d35d69737ac3d585f83f0ec5b7c04f844
    ℹ  01:42:25.970|gpuminer0  workLoop 1 #cad4f4a9… #0823bb39…
    ℹ  01:42:25.970|gpuminer0  Initialising miner...
  [OPENCL]:Using platform: NVIDIA CUDA
  [OPENCL]:Using device: GeForce GTX TITAN X(OpenCL 1.2 CUDA)
  miner  01:42:26.470|ethminer  Mining on PoWhash #5179bc66… : 0 H/s = 0 hashes / 0.5 s
  miner  01:42:26.471|ethminer  Grabbing DAG for #c3ddddc8…
  [OPENCL]:Printing program log
  [OPENCL]:
  [OPENCL]:Creating one big buffer for the DAG
  [OPENCL]:Loading single big chunk kernels
  [OPENCL]:Mapping one big chunk.
  [OPENCL]:Creating buffer for header.
  [OPENCL]:Creating mining buffer 0
  [OPENCL]:Creating mining buffer 1
  DAG  01:42:33.455|ethminer  Generating DAG file. Progress: 0 %

I assume I should see mining and PoWhash messages (with a non-zero hashrate) once a DAG has been generated. Am I missing something?


texts:
I was just wondering, how would I get my token (lets say abcToken) to both, pair with ETH -> abcToken/ETH, & implement a swapping function for abcToken/ETH on Uniswap?
Will I need to implement this code in my own smart contracts or can I create this with the Uniswap functions when I deploy abcToken?


texts: Eth.pendingTransactions shows null, while txpool.status shows pending

texts:
apologies if this has been posted before, however I could not find a question similar to mine.
So, basically, I have managed to setup a local blockchain network using Geth and PoA (clique). It consist of 2 nodes (1 miner) which are successfully connected to each other.
I also managed to develop a web application that connects to my local network and is able to make transfers between the 2 connected nodes, interact with deployed smart contracts, as well as make transactions to and from external accounts (such as ones from Metamask).
I am able to monitor everything via geth attach to both nodes, and everything works perfectly fine, which is great.
However, whenever I make a transaction via my web application, if I run the command eth.pendingTransactions in the attached console, I get a null vector, while if I run txpool.status, I can see that the transaction is pending and waiting to be mined, as below.

So I am just wondering why I cannot see the pending transaction via eth.pendingTransactions, but via txpool.status it works?


texts: What are the benefits of using events over dedicated indexed variable?

texts:
Good day.

I'm trying to grasp the concept of events in the EVM and I just can't understand what is the incentive of using events. Why not just use a dedicated public index that will hold information? Isn't the event data just stored on the block chain like a regular variable?

As always, your help is appreciated.


texts: Truffle, EIP 170 - Contract Couldn't Be Stored Please Check Your Gas Amount

texts:
I have been developing my contracts using the truffle framework. Everything has been fine, but now when running tests for one of my contracts I am getting the error The contract code couldn't be stored, please check your gas amount. I'd like to reference EIP-170 as I haven't seen other questions regarding this error reference it.
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-170.md

There is in fact a hard limit on the size of contracts. How can I determine if my contract exceeds the size set forth in EIP 170, if it is a problem with truffle, or if it is a problem with my code.


texts: How to pass bool from one function to another?

texts:
I want two functions to be checked true or false in one contract, that is, I get true in the calculations and want something. The code below shows my idea, but it does not work, I do not know why.

function transfer_money(uint _Number) pure public returns (bool){
    //code
    return true;
}

function transfer_property(bool) private {

    InfoProperty storage Transfer_Property = propertys[num];

    if (transfer_money()){
       //code
    }
}


texts:
I have just stuck an old card that I had in my computer to see how much increase in mining speed I would get.

I had a PC with a GeForce GTX 1080Ti in and had a couple of GTX 970 cards lying around so I installed one in the computer.

Using the Claymore miner in single mode with just the 1080Ti I was getting around 30 Mh/s
With the new card installed I get around 34 - 35 Mh/s on the 1080i (weird that has got faster) but only 3 Mh/s on the 970.

According to this page the 970 should get around 15 Mh/s

Does anyone have any ideas as to why the second card is running so slow?

I am thinking that for only 3 Mh/s it's probably not worth the extra power and heat buildup.

Thanks


texts: If the World State only Stores Hashes of the Code, Where Is the Underlying Actual Code Stored?

texts:
Apologies in advance if it's a silly question.
I'm slowly making my way through the ethereum yellow paper.

Am I correct in saying that the ethereum world state does not contain any EVM code? It only contains hashes of the code, right?

My train of thought is the following:

1) The world state is an aggregate key-value mapping of address --> 4 elements

2) The 4 elements are: nonce, balance, storageRoot and codeHash

3) None of those 4 elements has any code, the closest is codeHash which contains just a hash of the code, but not the code itself

So if the world state database does not contain any contract code, where is the contract code stored? Or otherwise, which one of my statements is incorrect?

Thanks!


texts:
I have a piece of code that connects to the network and displays transaction data.

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/ethereum/go-ethereum/common"
    "github.com/ethereum/go-ethereum/ethclient"
)

func main() {
    conn, err := ethclient.Dial("https://mainnet.infura.io")
    if err != nil {
        log.Fatal("Whoops something went wrong!", err)
    }

    ctx := context.Background()
    tx, pending, _ := conn.TransactionByHash(ctx, common.HexToHash("0x30999361906753dbf60f39b32d3c8fadeb07d2c0f1188a32ba1849daac0385a8"))
    if !pending {
        fmt.Println(tx)
    }

}

I would like to get a code from a contract account , how can i get it by modifying this code, with only the address of this account.

I try do it

conn.CodeAt(address)

but the CodeAt method needs more parameters.


texts: How and Why other should buy and sell my ICO token?

texts: When I invest or create a token, I am hoping someone in the future will want to buy it at a higher price. Why would anyone buy my tokens to use the platform if the price of the token keeps increasing as I expect it to?


texts: In Bitcoin, the total supply is capped at 21 million BTC. Is the total supply of Ether capped? How much will be mined before the Proof of Stake (POS) transition, and how will POS affect the issuance model?


texts:
do smart contracts execute sequentially in each node or in parallel/simulteneously? across all nodes?

2nd question is - Does it execute on "ALL" nodes including Light nodes as well?


texts: Uncaught (in promise) Error: Please pass numbers as strings or BigNumber

texts:
I want to convert the allocation amount to BN, but I have no success.
Here is my code:
    const amount = web3.utils.toWei("1");

    const busdPAir = await panCakeRouter.methods.getAmountsOut(amount, [WBNB, BUSD]).call();
    const uniTotalOutputSell = await panCakeRouter.methods.getAmountsOut(amount, [WBNB, SAFE]).call();

    const totalSupply = await ssContract.methods.totalSupply().call();
    const deadBalance = await ssContract.methods.balanceOf("0x000000000000000000000000000000000000dead").call();

    const totalSupplyBN = web3.utils.toBN(totalSupply);
    const deadSupplyBN = web3.utils.toBN(deadBalance);
    const circSupply = totalSupplyBN.sub(deadSupplyBN);

    const circ = Math.round(web3.utils.fromWei(circSupply.toString(), 'nanoether'));
    const dead = Math.round(web3.utils.fromWei(deadBalance, 'nanoether'));
    const oneBNB = Math.round(web3.utils.fromWei(uniTotalOutputSell[1], 'nanoether'));

    const price1bnb = Math.round(web3.utils.fromWei(busdPAir[1], 'micro'));
    const priceFor1BNB = (price1bnb / oneBNB).toString();
    const priceFor1ss = priceFor1BNB.replace(".0", ".0000000");
    const shortPrice = priceFor1BNB.slice(0, 6);
    const shortCirc = Math.round(circ / 1000000);

    totalSupplyEl.innerHTML = "10,000,000,000,000,000";
    circSupplyEl.innerHTML = formatAmount(circ);
    burnedSupplyEl.innerHTML = formatAmount(dead);
    priceBNBEl.innerHTML = formatAmount(oneBNB);
    marketCapEl.innerHTML = "$" + formatAmount(Math.round(shortCirc * (shortPrice - 0)));
    priceSpotEl.innerHTML = "$" + shortPrice;
    priceSpot1El.innerHTML = '$' + priceFor1ss.slice(0, 12) + 'USD';

What is the best way to manage error?


texts: Finding the memory position of mapping(address => uint) using JavaScript

texts:
I am wanting to read data from internal mappings with the following structures:

mapping (uint256 => uint256) internal nums;
mapping (address => uint256) internal addrToInt;

Finding the memory location of the nums data simply requires uint256(keccak(a, b)), where a is the starting location of the array, and b is the index into the array. In JavaScript we can  get this by:

w3.utils.hexToNumberString(w3.utils.soliditySha3(1, 2))

I am finding that this is not the case with the addrToInt mapping. If I run the following Python code:

w3.toInt(w3.soliditySha3(['address', 'uint256'], [addr, idx]))

then the key leads to an empty storage cell. The same incorrect key is also given with JavaScript:

w3.utils.hexToNumberString(w3.utils.soliditySha3({t: "address", v: addr}, {t: "uint256", v: idx}))

However, this Python code returns the correct key:

w3.toInt(w3.soliditySha3(['address[]', 'uint256[]'], [[addr], [idx]]))

What exactly is going on here by passing the variables as arrays into the function? And I am reading that we cannot pass array types into the web3js soliditySha3 implementation, so is there any way to replicate the above Python code in JavaScript?


texts: Unable to Deploy Smart-contract to Ropsten from Truffle using Infura

texts:
I want to deploy my smart-contract on ropsten or rinkeby network from Truffle using Infura API, but face difficulty in deploying on any network.
I am using windows and my contract works well on ganache and also deployed ropsten and rinkeby usin Remix. Configure my truffle-configure.js for these network still its not working.


texts: Can someone help me figure out how to get my UNI from an old MCD vault?

texts:
So here's my problem:
My UNI drop was sent to and outdated instadapp mcd vault at contract address: 0xc653461d3D4c6AD53c16ebE16fa07f820e115139 which i am the owner of at address: 0x34A2860bbbA761ae27005799b02D3DbD8b4b5fEb can someone help me or tell me how i can transfer the uni to my wallet or anything i can do to get it in my possession?
please and thank you :)
EDIT:
sorry let me add a bit more info.
https://old.instadapp.io/makermcd/?vault=0
back in the good ol days right before the pandemic (february) instadapp and the maker vault i set up was qualified to receive 400 UNI from the drop a few months back. So I claimed the UNI via entering the address of the mcd vault smart contract address (0xc653461d3D4c6AD53c16ebE16fa07f820e115139) into the uniswap website and hit claim, which was all i could do. I was hoping it would show up on the instadapp and the balance would be seen and available in the maker vault. however it is not. So I have an ETH address on Metamask (0x34A2860bbbA761ae27005799b02D3DbD8b4b5fEb) which is the owner of the smart contract that contains the UNI. however i can't figure out how to get to it.
I will gladly compensate a portion of the UNI to whoever can help me figure this out and get possession of it, considering it's worth absolutely nothing in the state it's in now.
Hopefully that helps understand the situation a bit more and hopefully someone can help me find a solution to this.
LAST EDIT:
where should i post the code that you responded with? using npm?


texts: Any common library for Wallet and smart contract in android,IOS and Web?

texts:
Before post this question I researched about Ethereum wallet and smart contract.
I saw many of the libraries which support android & iOS in different protocol, but not in a same protocol. So, I am expecting the libraries from same protocol(ie., I need a common library for all three platforms).

Thanks in advance.


texts: How do i solve this gas out of limit issue?

texts:
From:        0x08393207d999c507670510ea5713d4842ecfc86e
To Contract: 0x9a4bdb797d957be02804410ec49cd6de4a831b9d
 Warning! Error encountered during contract execution [Out of gas]


texts: How to combine multiple single smart contract actions into a single transaction

texts:
Is it possible to batch multiple smart contract actions / function calls into a single transaction?
For example, I have n NFTs that I would like to call two functions on each. If I interact through Etherscan, I have to pay gas for 2 * n transactions, and would like to avoid this.

Is it possible to batch these together? My current thinking is no, given how the parameters are set up. But maybe (hopefully) I am incorrect and this is possible.

If it possible, do I need to deploy a new smart contract to do that? If I don't need to deploy a smart contract, what would the implementation look like? Do I use something like ethers.js to interact with the contract?

Will batching the actions actually save gas ?

Smart Contract:
https://etherscan.io/address/0xc2c747e0f7004f9e8817db2ca4997657a7746928#writeContract
Desired actions:
changeName and transferOwnership for x NFT's


texts: How long does it take to receive payouts on Minergate?

texts:
I've been mining ETH on Minergate for about 4hrs but I can't see anything adding up to my balance.

I have an NVidia GTX1070 producing an average of 27Mh/s.
Any idea if not seeing anything after a few hours is normal or there is something wrong?


texts: Is it a good practice to log an event every time I throw in Solidity?

texts:
In Solidity (0.3.2) I am aware that there is no way to throw specific exceptions. (Everything is an invalid JUMP error.) It seems beneficial to have a way to log specific errors. Does it make sense to create an Error event to be fired before any exception? Are there any downsides I am not thinking of?

event Error(string message);

...

if(msg.sender != owner) {
  Error("User not authorized");
  throw;
}

EDIT: It appears that the event does not get logged at all if the transaction fails. Can someone confirm?


texts: How to identify token transfers looking at a transaction?

texts:
Let's take this transaction as an example.
If I use web3js getTransaction method and decode the payload, it will give me information such as:
{
  blockHash: null,
  blockNumber: null,
  from: '0xB54eB0cc6457e9d74e20672D8961faD3CDE4511c',
  gas: 474186,
  gasPrice: '5000000000',
  hash: '0xcf95271d63836f17c0c3a7beda7df2ea7029ce9161dc6808da86f5f9ce740830',
  input: {
    method: 'swapExactETHForTokensSupportingFeeOnTransferTokens',
    names: [ 'amountOutMin', 'path', 'to', 'deadline' ]
    types: [ 'uint256', 'address[]', 'address', 'uint256' ],
    inputs: [
      '152321810000000000',
      [
        'bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c',
        'd7b729ef857aa773f47d37088a1181bb3fbf0099'
      ],
      'b54eb0cc6457e9d74e20672d8961fad3cde4511c',
      '16211723261200'
    ],
  },
  nonce: 9,
  to: '0x10ED43C718714eb63d5aA57B78B54704E256024E',
  transactionIndex: null,
  value: '5000000000000000',
  v: '0x94',
  r: '0x4bac2f3fd76aecc8a6df23add9dabdb897aed3a2114021f30164867ef6039feb',
  s: '0x6de74caad4ef39d5cd71cd79058675308f725f36184cdc0ce82fc259096c31a9'
}

This describes inputs of the transaction. However, if we look again at the BSCScan transaction, it also includes information about what tokens were transferred:
From PancakeSwap: Router v2
To 0xd423fde466315d45fb0da457df28d5eeb92be580
For 0.005 ($2.97) Wrapped BNB (WBNB)

From 0xd423fde466315d45fb0da457df28d5eeb92be580
To 0xb54eb0cc6457e9d74e20672d8961fad3cde4511c
For 0.154823285118196657 ($2.94) Bogged Finan... (BOG)

How is this information determined?


texts: Rinkeby.io faucet keeps returning Invalid User...Boom. I need testnet ether. Please

texts:
My Address is 0x6dcade1808756840da3d5ce49182d80517895f67

I have tried over and over with rinkeby.io faucet through gist.github.  The faucet keeps on saying "invalid user, boom".

I would like to test out contracts on testnet.  Can someone send me a few.  Greatly appreciated.  Thank you


texts: How can I deploy a smart contract via URL?

texts: I want to deploy a smart contract via curl and send parameters in the constructor, I found this example but he does not send parameters, thankyou!!


texts: What is the value range of the parameter optimize-runs when running the solidity compiler?

texts: I would like to know what the allowed value range of the parameter optimize-runs is when running the Solidity compiler. I didn't find the answer in the official document of Solidity.


texts:
Quick premise, I'm super new to blockchain and Solidity.

I've tried to figure out scalability implication of reading data from the blockchain. I understand that reading operations are free, but how do they work exactly? And what are the scalability limitations of reading data from a contract?

Say that I want to query information from some "objects" (is it the right term?) and I have a getter on a mapping, what's the best approach to request information about 10/100/1000 objects?

Edit: Oh wow I got downvoted (!)

Adding some example code:

contract TestContact {
    struct Object {
        uint id;
        uint price;
    }

    mapping (uint => Object) private objects; // this is in the 10/100ks range
    mapping (uint => address) private mapObjectToOwners; // this is in the 10/100ks range

    function getPrice(uint id) public view returns(uint price) {
        Object storage object = objects[id];
        return object.price;
    }
}

I'd like to get the prices of 100s of Objects at the time, but not sure what's the best way to go about it. I can query getPrice multiple times of course, but seems extremely unscaleable and I am not sure what's the best way to go about it.


texts: Initial sync taking well over half a week

texts:
I ran geth --fast --cache=1024 which was the recommended for faster syncing. It goes up to reach the maximum block once, then goes to the beginning and imports chain segments again. This second process is extremely slow and as it goes up it only gets slower.

I really don't want to delete the blockchain again and re-run the process as it has taken 4 days to get here number=1259407. I was under the assumption that with fast option this will be done in less than a day. Is there something I'm missing?

Also my real question is, is it possible to connect to a remote blockchain instead of downloading it? (like electrum for BTC), or a feasible way to get an Ether wallet.

Specs:

Ram: 16GB
CPU: Intel Core i7-3720QM @ 2.60 GHz
Network: Ethernet @ 36Mb

NOTE (for duplicate query) I have followed all options and instructions on the other questions relating to slow sync but none actually help.


texts:
I'm writing a crypto based system with PHP on Infura, and now I am coding a script to retrieve logs for a specific address. This is my code:

$ch = curl_init($my_server_url);

$data = array(
    'jsonrpc' => '2.0',
    'id' => 1,
    'method' => 'eth_getLogs',
    'params' => array(array('address'=>'0x7d8f5F4ACa6Ca7Eb857A9F36d46b0aA715a88849'))
);
$payload = json_encode($data);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
echo $result;

But nothing is returned at the end of execution whereas I had 2 transactions on this address. I receive this final result only:

{
   "jsonrpc": "2.0",
   "id": 1,
   "result": []
}

May you please tell me where is my mistake here?


texts: Transfer ETH and tokens to remote geth account not working

texts:
I have a remote geth node I stood up and pointed to Ropsten launched at command line by using:

geth --testnet --syncmode "fast" --rpc --rpcapi db,eth,net,web3,personal --cache=1024  --rpcport 8545 --rpcaddr 0.0.0.0 --rpccorsdomain "*"

I then checked that i had accounts, which I did. I copied the address to my meta mask wallet that was also pointed to the Ropsten network. I sent 1 ETH to my account generated on my geth node and the ETH never arrived.
Ropsten block explorer states it did https://ropsten.etherscan.io/tx/0xe1a3e0dc106a2cefe7a90bc7cadaf43e6c8c15e5a7a4b1e8dd02dc171c674859

When I check my balance using:

curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x54a25257aa677e944403a33974e296b11997a919", "latest"],"id":1}' http://127.0.0.1:8545

I get:

{"jsonrpc":"2.0","id":1,"result":"0x0"}

What am I doing wrong? and is the transfer and check for balance the same for tokens?


texts: Error in creating instance of deployed contract using truffle console

texts:
I deployed Token and Crowdsale contract in separate migration files. During Migration, there was no error. Migration logs are share:

  Running migration: 2_deploy_token.js Deploying DappToken... ...
  0xc1ed596e0249507186d75f2d42ba1c34e5b72697774baf9a283e0fb422214b70
  DappToken: 0x949e24c24a79f437bbf75d3da7b9ba50235c2a8a Saving
  successful migration to network... ...
  0x1c8bc4b87bfbfa40bb16aa3eb6cf0341efc79f444b1e293abd1f0db394881d55
  Saving artifacts... Running migration: 3_deploy_crowdsale.js Saving
  successful migration to network... Deploying DappTokenCrowdsale... ...
  0xdae8535756b9b7100af8d1a3bdf9d20b622c25dcb03aa40435b7f7019bfcdf7a
  Saving artifacts...

After this, when I tried to create an instance of Crowdsale using truffle console as

truffle(ganache)> DappTokenCrowdsale.deployed().then(ic => tokensale = ic)

I got the error:

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

Although i have successfully created the instance of DappToken contract. Related files are shared below:

DappTokenCrowdsale.sol

pragma solidity 0.4.24;

import "openzeppelin-solidity/contracts/crowdsale/Crowdsale.sol";

contract DappTokenCrowdsale is Crowdsale {

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

3_deploy_crowdsale.js

const DappToken = artifacts.require("./DappToken.sol");
const DappTokenCrowdsale = artifacts.require('DappTokenCrowdsale');

module.exports = async function(deployer, network, accounts) {
    const deployedToken = await DappToken.deployed();
    const _rate = 1000;
    const _wallet = accounts[1];
    const _token = deployedToken.address;

    await deployer.deploy(DappTokenCrowdsale, _rate, _wallet, _token);
};

2_deploy_token.js

const DappToken = artifacts.require("./DappToken.sol");

module.exports = async function(deployer, network, accounts) {
  const _name = "Dapp Token";
  const _symbol = "DAPP";
  const _decimals = 18;

  await deployer.deploy(DappToken, _name, _symbol, _decimals);
};