texts: when syncing state trie of an Ethereum node, why not start from a recent block to reduce syncing time

texts:
as explained in this issue: https://github.com/ethereum/go-ethereum/issues/16218#issuecomment-371454280

when we are syncing an eth node, firstly it downloads the blocks, then the states, the first part take way less time than the second, so that's why when we are syncing, if we see syncing info like this, we probably still have to wait for a long time before the node finish syncing:

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "currentBlock": "0x7b9f62",
        "highestBlock": "0x7b9fc5",
        "knownStates": "0xbdc375b",
        "pulledStates": "0xbdc331d",
        "startingBlock": "0x0"
    }
}

In my case, downloading the block took me roughly 2 days, and for the states trie, 1 week has passed, and it's still syncing.

there are 2 things I am wondering:

why there isn't a progress bar showing the progress of the downloading of state trie?
why not start download a state trie from recent block, and then updating the trie based on that, it would save a lot of time.


texts: How to confirm transaction as a receiver in metamask?

texts:
My question is simple
If I want to send some ether to someone in remix like

contract Sender {
  function send(address _receiver) payable {
    _receiver.send(msg.value);
  }
}

Metamask asks me as a sender to confirm the transaction and thus
simply send the amount to receiver without even asking him/her.

How can I make receiver accept the transaction ?


texts: Use multiple version of truffle in linux

texts:
Can we use multiple version of truffle in linux just like python ?
If yes then how can we use specific version ?


texts: MetaMask and Access Ethereum Private Chain from other PC in the same network (for test)

texts:
My goal: To simulate the Ethereum blockchain with different clients. So, they create their own accounts, i.e. public/private keys, and store them locally. So all are for testing.

Assume, I have set up a private chain on computer A. Can I install MetaMask on computer B, and connect to computer A's private chain?

If YES, how can I do that?

If NO, how can I connect two nodes (each on a different machine and having the regular IP address, not a static one) so they can connect to the private chain with a minimal setup?


texts: Is there api way to get Token transfer data of exact token?

texts:
What I need

I need all information of tab "Token Transfers" in token info at etherscan. Exactly in format at the site. For example I want to get all Token Transfers from here https://etherscan.io/token/Decentraland.
And question is: How to get this data through api?

What I tried to do

For local solution I got it manually downloading CSV through interface on Etherscan, but I need update data regularly and manual solution is a pain.
I found this answer Obtain token transfer data from an address and it seemed to me as very useful but it didn't give me a token quantity information. Actually, it gave me transactionHash and I tried to get desired result through transactions api-methods (where is used these params module=account&action=txlist), but it didn't get me valid quantity (0.5 eth were showed like value=500000).

Moreover, I think it could be more simplier way to get this info — that's why I'm here.

A bit of code

The python code I used to get transaction info

import requests
url = 'https://api.etherscan.io/api?module=logs&action=getLogs\
&fromBlock=0\
&toBlock=latest\
&address=0x0f5d2fb29fb7d3cfee444a200298f468908cc942\
&apikey='+apikey
request = requests.get(url)
results = request.json()


texts: Called a smart contract function(web3py), signed the txn. it executed successfully, but the block wasnt mined and the txn hash was empty. How do fix?

texts:
def addPatientDetailOld(request, name, location, phone, nin, email, dob, lga, state):
private_key = request.session["key"]
address = request.session["address"]
transaction = contract.functions.addPatientDetail((name), str(location), str(phone), str(nin), str(email), str(dob), str(lga), str(state)).buildTransaction()

transaction.update({ 'gas' : 40000 })
transaction.update({ 'nonce' : web3.eth.get_transaction_count(address) })

signed_tx = web3.eth.account.sign_transaction(transaction, private_key)

txn_hash = web3.eth.send_raw_transaction(signed_tx.rawTransaction)
txn_receipt = web3.eth.waitForTransactionReceipt(txn_hash)


texts: Is there a way to setup my network of private chain nodes so that only approved systems can query a node for the data on the chain?  The RPC port has to be open so I can run web3 commands but I don't want anyone who can find the available port to be able to get the data.


texts:
I have using eth --private "customChain" --genesis-json genesis.json --db-path data" to create a private chain.
and when I into ethconsole it shows:

Connecting to node at \\.\pipe\geth.ipc
Connection successful.
Current block number: 0
Entering interactive mode.

I think I need to initialize my chain, but I'm not should what code I should do to initialize it.
So anyone have any ideas?


texts:
How can I convert a string to a bytes32? Does anyone has a magic function or library which does it?

For example: This works since as input I gave 32-bits. But it won't work with "> 32-bit" chars.

set_txn_hash = a.transact().set("QmVoGzRDscx61k3RHHkLYaMFtxYZi3ps");#32-bit char

-

function get() returns (stringc value){
    return list.get_head_data();
}

But if I need to give more character for example contains 48-bit string this won't work. [Q] How could I make this work?


texts: How to extract or create a message with web3.js to sign with an external hardware device?

texts:
I'm using the Web3 library. I want to extract a signature hash from a Web3 transaction to send to an external hardware device, sign it there, then use the signature I get from there to broadcast my transaction on Ropsten.

On their GitHub page I found a test example:

https://github.com/ethereum/web3.js/blob/2.x/packages/web3-eth/tests/src/signers/TransactionSignerTest.js

On lines 26-37 I checked how it's signed:

    const tx = {
        chainId: '0x11',
        data: '0x',
        gas: '0x7530',
        gasPrice: '0x3b9aca00',
        nonce: '0x3',
        to: '0xb414031Aa4838A69e27Cb2AE31E709Bcd674F0Cb',
        value: '0x64'
    };

    await expect(
        transactionSigner.sign(tx, '3a0ce9a362c73439adb38c595e739539be1e34d19c5e9f04962c101c86bd7616')

Apparently transactionSigner does the signing:

https://github.com/ethereum/web3.js/blob/aaf26c8806bc9fb60cf6dcb6658104963c6c7fc7/packages/web3-eth/src/signers/TransactionSigner.js

In that class, at lines 62-63:

    const ethTx = new EthereumTx(transaction);
    ethTx.sign(Buffer.from(privateKey, 'hex'));

So they're actually using another library, ehtereumjs-tx:

https://github.com/ethereumjs/ethereumjs-tx/blob/master/src/transaction.ts

At lines 269-270 we find:

const msgHash = this.hash(false)
const sig = ecsign(msgHash, privateKey)

This is what I want, the "msgHash" variable. How can I get to it without needing to butcher half the library and rewrite it manually? Or is there a simple way for me to construct it myself, and if so, how exactly?

For example, in bitcoinlib-js, there is a SignerAsync object, which you can construct yourself and simply assign its "sign(hash: Buffer)" property your own custom signing function. Bitcoinlib automatically throws in this "hash" thing that I need into the sign(hash: Buffer) and I simply pass it to my external Hardware device. Is there anything similar in Web3?


texts: Does using a very high gas limit somehow get your transactions executed slower?

texts:
I'm executing transactions on mainnet with a NodeJS script:

async function send(web3, transaction, destAddr, gasPrice, privateKey) {
    const options = {
        data    : transaction.encodeABI(),
        to      : destAddr,
        gasPrice: gasPrice,
        gas     : (await web3.eth.getBlock("latest")).gasLimit
    };
    const signed  = await web3.eth.accounts.signTransaction(options, privateKey);
    const receipt = await web3.eth.sendSignedTransaction(signed.rawTransaction);
    return receipt;
}

Every transaction takes ages to complete.

I keep raising the gas-price, but no improvement.

I've finally tried to reduce the gas-limit, and instead of taking the max gas-limit per block, I just wrote "500000", which is far less than the block gas-limit, but far more than the actual gas required for each transaction.

All of the sudden, the network has started to process my transactions much faster.

It feels as if a high gas-limit "scares off" miners or something.

I've tried using await transaction.estimateGas() but it's been giving me a "gas required exceeds allowance or always failing transaction" error every time.

I believe that this is possibly because this function underestimates the actual gas required for the transaction, so I am somewhat reluctant to use it.

Would anyone here be able to shed some light on this?

Thank you!


texts:
Installed Parity 1.11.7 from the official website on Windows 10, then synced it, got the expected result:

Then rebooted the PC, tried to launch Parity using the shortcut in Start menu (which points to C:\Program Files\Parity Technologies\Parity\ptray.exe), got this:

Error message

THE PARITY UI HAS BEEN SPLIT OFF INTO A STANDALONE PROJECT.
GET THE STANDALONE PARITY UI FROM HERE

Tries to force me to install something from

https://github.com/Parity-JS/shell/releases

but I obviously want just to move things back to the state before the reboot.

What should I do?


texts:
I am a newbie to Ethereum and I would like to run some simple smart contract code written in Solidity locally with my ethereumj virtual machine.

I am aware of how to use EVM and aleth-vm to run some compiled Solidity binary code. But so far still have no idea how to directly use the ethereumj locally. Could anyone shed some lights on it? Thanks.


texts: How to find the value of erc20 token sent out using transaction hash

texts:
How can i find the value of erc20 token in a transaction using the hash generated?
I can't seem to find answers anywhere.

Edit:I found that it is possible to use w.eth.getTransactionReceipt('0xxxxxHashValue') and then  int('0x0000000000000000000000000000000000000000000000000000000000000050',0) from the log value of the result to get the amount of token sent.

However, i am still confused as to how to achieve this using PHP.


texts: Error in msg.value during online contract compilation

texts:
I am getting this error while a contract compilation using online solidity compiler :

  Untitled:23:19: Error: Member "value" not found or not visible after argument-dependent lookup in string storage pointer - did you
  forget the "payable" modifier?
        var amount = msg.value;
                     ^-------^

Contract code is like this :

function transfer(address user) payable {
        var amount = msg.value;
        var sender = msg.sender;

What wrong i am doing ?


texts: Could blockchain be distributed over torrent (DHT)?

texts:
I look at the scaleability discussion where one of the problems is the blockchain grows in size too much so that specialized storage systems will be needed which will lead towards centralization.

I wonder whether the blockchain cold be distributed between the nodes in a way that Torrent works (Distributed Hash Table) so that every node would not need to store whole blockchain but could ask its peers for the parts it does not have. I know this would assume some level of trust between the nodes but it is the same as when a node downloads the blockchain for the first time today.

Every node may only store blockhashes (and check they are valid from the genesis block) and after it receives the block wanted via torrent just check for hash again to see the block contents are correct.


texts: How to effectively use the metadata of ERC721

texts: When you store a URL as the metadata of ERC721, does that defeat the purpose of the immutability aspect of a blockchain, since the content that URL is pointing to can be modified? How do I effectively use the metadata of ERC721 without storing everything on the blockchain? I know IPFS is a popular choice, but could I use a conventional URL endpoint and still have it align with the purpose of ERC721?


texts: What happens when two nodes have conflicting transaction nonce?

texts: Let's say I have two geth nodes which run on two distant networks with slow connections between them, and I use the same newly created address (private key) to send two different transactions with the two geth nodes. Since for each node it's a new address, both transactions have nonce set to 0 and enter the pending state and are broadcast to the network. So what happens when the two pending transaction broadcasts reach each other? How will the transaction pool handle the two different transactions from the same address with the same nonce?


texts: How can I check the current state of a token I made?

texts:
How can I check what coins have gone where using the standard coin contract? I know how to check the balance of an address, but I'd like to see something like a ledger of all the current coin balances. Optionally I would accept a log of all coin transfers as well (because I can parse this info to build a ledger).

I mostly want to see where/how my coins are moving to ensure a healthy ecosystem.


texts: Why are timestamps stored in a uint (256 bit) when they would fit in a uint64?

texts:
A (signed) 64 bit timestamp can store a date much larger than the age of the universe.

On many platforms this would be a micro-optimization, but in the context of Ethereum, we want to squeeze every drop of gas out, don't we?


texts: Updating a feed fails: Signer address does not match the update request

texts:
This is what I run (0x65686c6c0a is "hello" in hex)

swarm --verbosity 2 --bzzaccount `cat Alice` --passsword Pass &
swarm --bzzaccount `<Alice` --password Pass feed create --name neverchanges > FeedHash
swarm --bzzaccount `<Alice` --password Pass feed update --manifest `cat FeedHash` 0x65686c6c0a

I'd expect swarm to update the feed, but I get Fatal: Signer address does not match the update request instead.


texts:
can I have the meaning of the word Nonce  explained please
the question is rejected .. you people really do not wish there to be normal understanding by normal every day members of the public


texts:
Not having issues compiling project. When I truffle migrate I receive this error:

Using network 'development'.

Running migration: 1_initial_migration.js
  Replacing Migrations...
  Migrations: 0x60fff93824e024bc3ae45e548138a01e1faa125f
Saving successful migration to network...
Saving artifacts...
Running migration: 2_deploy_contracts.js
  Deploying ConvertLib...
  ConvertLib: 0x50b2d957e2bb477053b362e6d179297c037f53ff
  Linking ConvertLib to MetaCoin
  Deploying MetaCoin...
  MetaCoin: 0xc5bf0d8abb18763eb3be5a5ff5dbe976fb3acff8
  Deploying Node...
Error encountered, bailing. Network state unknown. Review successful         transactions manually.
Error: Node contains unresolved libraries. You must deploy and link the following libraries before you can deploy a new version of Node: ConvertLib
at /usr/local/lib/node_modules/truffle/node_modules/truffle-contract/contract.js:345:17
at process._tickCallback (internal/process/next_tick.js:109:7)

Here is my Node contract (MetaCoin is Ownable):

pragma solidity ^0.4.4;
import "./Relay.sol";
import "./MetaCoin.sol";

contract Node is MetaCoin {

uint public fee;
address public owner;
address[] public publicRelays;

  function Node() {
    owner = msg.sender;
    fee = 10;
  }

  function createRelay () returns (address){
    address relay = new Relay();
    publicRelays.push(relay);
    return relay;
  }
}

Not sure what the issue is. Any help in the right direction would be great. Using Truffle v3.2.1.

Thank you.


texts:
I'm looking for any tutorials on how to create my own token wallet.

Example:

Create token for website purchases
I implement my own wallet for token and allow ppl to buy with token and redeem prizes with it.

Just out of curiosity I'm trying to see the difficulty in this. I'm not to good with code but will be determined to do it. And I have time to learn.

So if anyone has info about this. Or can point me into the right direction it would be helpful. Maybe some links


texts: How to run ethereum wallet on a light mode linux

texts:
I just installed ethereum wallet and run from command line. After wallet started it began to download all blocks. Do I really need all that blocks to just use coins (not mining)? How can I use wallet on a lightweight mode?

PS I am running ubuntu 16.04 and wallet v0.8.10.

man ethereumwallet command does nothing


texts: Is there a way to prevent transactions becoming too expensive

texts: As the price of ethereum has goes up, the cost of making transactions increases as well. What methods are there to prevent making transactions from becoming unaffordable?


texts: Is there an iOS equivalent for the Android web3j (json-rpc) library?

texts: This question (Ethereum library for iOS/Android?) showed me the way to web3j, but I also need a similar solution for iOS.  Does anyone know of such a project?


texts: What are good offline editors for solidity in windows?

texts: I want to use a editor which shows some highlights while writing a solidity code. Please suggest a good editor for writing smart contracts solidity codes for windows. Like gedit for c language.


texts: Just sent the whitehat address .33 some odd ETH by accident

texts:
I'm positive this is a dumb question.
tx 0x88d4c8eb40d05d7f99f57ce54fa170a59919b6920e5cc4ec9e125f8518c747a2
to address 0x1dba1131000664b884a1ba238464159892252d3a

I had the multisig whitehat address up, and i was making a bittrex withdrawl. Copied the wrong address.

This isn't coming back to me is it.


texts: Quorum Tessera Private/Public Keys vs Quorum (Ethereum) Keystore - Difference and Keys Management

texts:
Understand that Quorum Tessera is for encryption, decryption, and distribution of private transactions while Quorum Keystore is for normal transaction signing. Can both be collapsed into one set of public/private keys?

Understand that Tessera can integrate with key vaults to secure the keys. Can Quorum keystores be protected in a similar way as well?

Nathan Aw


texts: How do you provide a GasPrice and GasLimit to overcome the "low tx nonce or out of funds" log message

texts:
I am getting the following logged by my private chain geth node when running a test in truffle:

removed tx (
    TX(ff8ec4f713e64fb25df07d153607e29629c9276b57e0b7e331f17b5a3c31fdd1)
    Contract: false
    From:     d90b704c738b49ff50741bd887334e49d8f277f1
    To:       [contract creation]
    Nonce:    520
    GasPrice: 18000000010
    GasLimit  3200000
    Value:    0
    Data:     0x606060405..........
    V:        0x1b
    R:        0x5b......
    S:        0xe09017.......
    Hex:      f901c3.......
) from pool: low tx nonce or out of funds

The test code is as follows:

contract('MyContract', function (accounts) {

    it("should be able to set a value", function (done) {

        var myContract = MyContract.deployed();

        myContract.setValue("aStringValue", 2, {from: accounts[0],gas: 3200000, gasPrice: 18000000010}).then(
            function (tx_id) {
                return zone.isValueSet.call("aStringValue");
            }).then(
            function (_bool) {
                assert.isTrue(_bool, "value not set");
                done();
            }).catch(done);
    });

});

I have confirmed that the GasPrice and the GasLimit reflect those provided in the test and that providing them in an object, as the last arg to the contract function, is correct.

There are sufficient funds in accounts[0] so I do not know why this is happening.


texts: Identifying ERC-721, ERC-777, & ERC-223 Contracts in the EVM via eth.getTransactionReceipts(), etc

texts:
Is there any specific way of identifying ERC-721, ERC-777, & ERC-223 contract events under the EVM, specifically under the eth.getTransactionReceipt() function?
I know there's a way for ERC-20 tokens by filtering for the Transfer keccak-256 hash:
0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef

A brute-force example I could use for CryptoKitties is also filtering for the 'DepositKittyAndMintToken' hash, yet obviously there are many more ERC-721 token events than just CryptoKitties:
0x999fa95b06ad12b3436bab902713e383705707923f9d7c75f5432b28a6487010

I'm running a program that runs two loops: through each transactionHash under each block, and trying to separate all ERC-20, ERC-721, ERC-777, and ERC-223 token events, yet only have it working for ERC-20's.
Any help would be greatly appreciated, thanks!


texts: Infura not broadcasting contract deployment transaction

texts:
I am attempting to deploy a contract via an Infura node, and I am the point where a txhash is generated from the sendSignedTransaction() web3 function. However, after the txhash is generated nothing happens. It just hangs forever, and etherscan never recognizes that txhash. I have tried Ropsten and Rinkeby, and I have sufficient funds in all accounts that are sending the tx.

Why would the transaction not be broadcasted by Infura? The gas price and limit both seem to be correct and within a reasonable range. Increasing the gas price doesn't change the issue, I've tried that a few times. All of the relevant code below:

const Web3 = require('web3');
const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/PROJECT_ID"));
const config = require('./contractInterface')

function deployContract() {
    var privateKey = 'PRIVATE_KEY_HERE'
    var address = 'ADDRESS_HERE'
    var abi = config.contractInterface.abi;
    var bytecode = config.contractInterface.bytecode

    // Construct the raw transaction
    let gasPriceHex = web3.utils.toHex(1700000000);
    let gasLimitHex = web3.utils.toHex(200000);
    let block = web3.eth.getBlock("latest");
    let nonce = web3.eth.getTransactionCount(address);
    let nonceHex = web3.utils.toHex(nonce);

    // Contract object
    const contract = new web3.eth.Contract(abi);

    // Get contract data
    const contractData = contract.deploy({
        data: bytecode,
    }).encodeABI();

    //estimate gas and log to console
    contract.deploy({
        data: bytecode,
    }).estimateGas().then(data => console.log("estimated gas: ",data));

    const rawTx = {
        nonce: nonceHex,
        gasPrice: gasPriceHex,
        gasLimit: gasLimitHex,
        data: contractData,
        from: address,
        chainId:web3.utils.toHex(3)
    };

    console.log(rawTx);

    web3.eth.accounts.signTransaction(rawTx, privateKey, function (error, signedTx) {
        if (error) {
            //do stuff
        } else {
            web3.eth.sendSignedTransaction(signedTx.rawTransaction)
                .on('transactionHash', function (hash) {
                    console.log("txhash: ", hash);
                })
                .on('receipt', function (receipt) {
                    console.log("receipt: ", receipt);
                })
                .on('confirmation', function (number) {
                    console.log("block number: ", number);
                })
                .on('error',console.log)
        }
    })
}

deployContract();

EDIT: As per request below, auto-generated the address from the private key and checked balance programmatically to ensure funds, however, issue still exists.

var privateKey = '0xREDACTED';
var account = web3.eth.accounts.privateKeyToAccount(privateKey);
var address = account.address;

web3.eth.getBalance(address).then(data => console.log("balance: ",data))

Result:

    balance:  35493192886000000000


texts: How can empty accounts with a nonce of zero appear on the blockchain?

texts:
Recently I have heard about zero balance accounts with a nonce of zero appearing on the blockchain.

My understanding is that any account that has been used in a transaction must have a nonce greater than zero. This would include zero balance addresses that have received funds and were later emptied.

How can accounts with a nonce of zero appear on the blockchain?


texts: Stellar operator types compatibility issue

texts:
I have an issue creating a calculation based smart contract which performs some calculation based on some formula. Here is the function as bellows:

 function financialReputation( ufixed xb , ufixed xs) returns (uint vb , ufixed vs) {
//uint128 exp = 2.718;
vb = - (1 / 2**(uint(xb / 5) )) +1;
vs = - (1 / ufixed(2.7182818285)**(ufixed(xs / 2000)) ) +1;
// xi = (1 / (1+ 2**(- 0.005 * xi - 4) ) )** 50;
return (vb,vs);
}

Error will be as :

TypeError: Operator ** not compatible with types ufixed128x18 and
ufixed128x18
vs = - (1 / ufixed(2.7182818285)**(ufixed(xs / 2000)) ) +1;
        ^---------------------------------------^

Please help me how i can convert ufixed to a compatibal type for exponent operator(**). Any suggestion or recommendation will be requested.


texts: syncing finished but stuck returning zeros

texts:
in the process of deploying a smart contract I've run into problems on both Ropsten and Mainnet.

I've run

geth --rpc --rpcapi eth,net,web3,personal --rpcport 8545 --testnet

in one terminal window until the blockchain is finished syncing.

$ geth --testnet attach
Welcome to the Geth JavaScript console!

instance: Geth/v1.8.1-stable/darwin-amd64/go1.10
coinbase: 0xc4f4d7ef579df808b8bd201345bbe30efa8a59c5
at block: 0 (Wed, 31 Dec 1969 19:00:00 EST)
 datadir: /Users/asdf/Library/Ethereum/testnet
 modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

> eth.syncing
{
  currentBlock: 2737469,
  highestBlock: 2737534,
  knownStates: 16511,
  pulledStates: 14936,
  startingBlock: 2737424
}
> eth.syncing
false
> eth.blockNumber
0

everything else I check comes back with zeros.  getBalance for any account I can find also returns 0.

I have replicated this on OSX and Linux.


texts: Just a random thought and a question. Can a smart contract written in solidity be inherited and if so, How?


texts: I'm working with blockchain ethereum private network with several miners. I already successfully send and stamp a transaction from (example) one minerA to minerB using web3 library in python language. I want to ask, is it possible to make a withdraw function (without SC) that minerB will send back ether to minerA? But it happened as a request from minerA (minerB is not directly make a transaction to send ether to minerA). So what i want to make is minerA trigger minerB to send a transaction but still using blockchain architecture. Please tell me if it's possible or not, and correct me if my understanding about the transaction is wrong. Thank you


texts: What would it take to make ICAP addresses available to banks transfers that use IBAN?

texts: How could we implement a way that ICAP addresses can be used in the IBAN field when making a normal bank transfer? What risks would it bring?


texts: How can i sign a message using my private key and later recover my account address from that signature to validate my account?

texts:
I am using ganache blockchain, I want to verify that this is the key of a specific address.

  Address : 0x24Ff3B7cacCcd9D05353dFB0Ff5b22062A13FbE0
  Key : c28b71d6d57239ae0a575c5f5f4e7837092238c73eaaaa5e2b5e01c42714a1ed

I want to recover my address using this key to check that the key belongs to that particular address.


texts: Ethereum Windows wallet - stuck downloading - possible lost initial bitcoin deposit

texts:
I downloaded the Ethereum wallet from https://www.ethereum.org/, and got to the stage when it started downloading. I entered a password to create an "account", and it suggested I add funds via bitcoin. I sent some funds into the account using bitcoin, but there was no notification of the funds received, even after 6 confirmations on bitcoin network.  By this point I noticed that Ethereum had stopped downloading its blockchain. Upon clicking around on Ethereum it got to a state where it asked me again to create an account, and enter a new password..  So what happens to the funds deposited in BTC automatically through shapeshift? If I eventually find a way to download the Ethereum blockchain, what happens to the Ethereum wallet? All that shows is

  Ethereum node needs to sync, please wait...

Should I still expect to have access to these funds?.  I am now left with possibly lost BTC and an Ethereum Wallet that does nothing, with only minimal of the ETH blockchain downloaded. Can I can download the blockchain myself via torrent (if that works)?  Now I realised I am creating a full node, I would never have used this wallet. Is there a simple to use no hassle Windows wallet I can use if I somehow get my funds back?


texts: How to generate a vanity address for a smart contract to be deployed on?

texts:
I am aware of the possibility to generate vanity addresses for normal accounts. However, how is possible to generate vanity addresses for external owned accounts (which host smart contracts)?
I'm asking because the Ethereum Name Service (ENS) was deployed on 0x112234455c3a32fd11230c42e7bccd4a84e02010 (Ropsten).


texts: cURL error [0]: Failed to connect to 127.0.0.1 port 8545: Connection refused

texts:
I am using laravel for transfer erc20 token, but get this error. Here is my example code
// Instantiate Ethereum RPC lib with your server credentials (i.e. Ethereum-Go)
    // This example assumes Ethereum RPC server running on standard port 8545 on localhost
    $geth = new EthereumRPC('127.0.0.1', 8545);

    // Instantiate ERC20 lib by passing Instance of EthereumRPC lib as constructor argument
    $erc20 = new ERC20($geth);

    $contract = $request->erc20_contact_address; // ERC20 contract address
    $payer = $request->payer_address; // Sender's Ethereum account
    $payee = $request->receipt_ethereum_address; // Recipient's Ethereum account
    $amount = $request->amount; // Amount of tokens to transfer

    // Grab instance of ERC20_Token class
    $token = $erc20->token($contract);

    // First argument is payee/recipient of this transfer
    // Second argument is the amount of tokens that will be sent
    $data = $token->encodedTransferData($payee, $amount);

    $transaction = $geth->personal()->transaction($payer, $contract) // from $payer to $contract address
    ->amount("0") // Amount should be ZERO
    ->data($data); // Our encoded ERC20 token transfer data from previous step

I am using laravel(furqansiddiqui/erc20-php) package for integrate


texts: Generate Ethereum address using Bitwasp/BIP32 library

texts:
I am new in cryptocurrencies.
I am using PHP library Bitwasp/Bitcoin-lib (https://github.com/Bit-Wasp/bitcoin-lib-php) to generate addresses for bitcoin. I am validating my outputs here. I was successful to generate Bitcoin, Litecoin and Dogecoin addresses which the BIP32 class in the library supports. iancoleman is generating ethereum addresses too with BIP32 protocol. How can I do that? I have debuged the code and I found that there are some lines on the top of BIP32.php file which shows the coins that this class supports.

// Bitcoin
public static $bitcoin_mainnet_public = '0488b21e';
public static $bitcoin_mainnet_private = '0488ade4';
public static $bitcoin_mainnet_version = '00';
public static $bitcoin_testnet_public = '043587cf';
public static $bitcoin_testnet_private = '04358394';
public static $bitcoin_testnet_version = '6f';

// Dogecoin
public static $dogecoin_mainnet_public = '02facafd';
public static $dogecoin_mainnet_private = '02fac398';
public static $dogecoin_mainnet_version = '1e';
public static $dogecoin_testnet_public = '0432a9a8';
public static $dogecoin_testnet_private = '0432a243';
public static $dogecoin_testnet_version = '71';

// Litecoin
public static $litecoin_mainnet_public = '019da462';
public static $litecoin_mainnet_private = '019d9cfe';
public static $litecoin_mainnet_version = '30';
public static $litecoin_testnet_public = '0436f6e1';
public static $litecoin_testnet_private = '0436ef7d';
public static $litecoin_testnet_version = '6f';

I know these are magic bytes. What are these values for ethereum or other coins like Bitcoin-cash? How can I find these values?
I found that It is possible to generate ethereum address using BIP32 here. But I don't know how?


texts:
I'm trying to understand What happens in case another block is mined over an uncle block (giving us an uncle chain) - is the first uncle still rewarded or only the latter?

The blue blocks are the main chain, whereas the orange ones are those who were mined separately, and the red arrow is the interaction I'm interested about - which blocks would be acknowledged by B4 and how?

References to code / blog would be much appreciated.


texts: Are there any functional programming languages for Ethereum smart contracts?

texts: Are there any functional programming languages for Ethereum smart contracts in development or production?


texts: Why does web3.eth.getAccounts() return only 1 account?

texts:
I would expect this to return 10 accounts but I get only 1.

const provider = new HDWalletProvider(mnemonic, "https://rinkeby.infura.io/ll2k3jdlKDl")
    web3 = new Web3(provider)
    Promise.promisifyAll(web3.eth)
    let accounts = await web3.eth.getAccountsAsync()

Can anyone explain why? or how I can get more accounts on there.
My understanding is that the other 9 accounts should be derived from my mnemonic. Is Infura not doing that for some reason?


texts:
As per my knowledge,there are no custom exceptions in solidity. The only exception is Out of Gas. Wherever we write throw in contract code, it throws out-of-gas exception.
But, is there any way I can catch that exception? I mean if I can execute a piece of code whenever an exception occurs? Even on working with geth console, I didn't get any notification that whether any exception occurred. I think it's pretty possible to catch such exception, because Mist is able to display Intrinsic gas too low error message, whenever an exception occurred, so it must have handled that exception somewhere.
Edit:
Basically the question is:

  How can we know, before sending the transaction, that this
  transaction will consume all the provided gas?

I am not asking on How can I provide sufficient gas for my transaction but How can I know that my transaction will run out of gas.
One way of doing so is to send the transaction, let it be mined and then check for gasUsed=gasSend, of if there is thow use debug.traceTransaction.
But I want to know whether my transaction will go through or not without sending the transaction. In Mist whenever I try to send  a transaction that will encounter a throw statement, It displays Intrinsic gas too low before sending the transaction. I want to do the same from geth.


texts: Swap Eth for exact tokens gets reverted. Remix complains about gas requirement being more than the block gas limit

texts:
I'm trying to implement a swap using Uniswap on Remix. here is the code:
pragma solidity >=0.5.16;

interface IUniswapV2Router02 {
    function WETH() external pure returns (address);
    function swapExactETHForTokens(
        uint256 amountIn,
        address to,
        uint256 deadline
    ) external payable returns (uint256[] memory amounts);
}

interface IERC20 {
    function approve(address spender, uint256 amount) external returns (bool);

    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);
}

contract Arbitrage {

    IUniswapV2Router02 uniswap;
    address public owner;

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

    constructor(address _uniswap) public {
        owner = msg.sender;
        uniswap = IUniswapV2Router02(_uniswap);
    }

    // Allow contract to receive Ether
    function() external payable {}

    function swapETHForTokens(
        uint256 amountIn,
        address token_out,
        uint256 deadline
    ) external {
        IERC20(uniswap.WETH()).transferFrom(
            msg.sender,
            address(this),
            amountIn
        );
        address[] memory path = new address[](2);
        path[0] = uniswap.WETH();
        path[1] = token_out;
        IERC20(uniswap.WETH()).approve(address(uniswap), amountIn);
        uniswap.swapExactETHForTokens(amountIn, token_out, deadline);
    }
}

The contract has been deployed on Rinkeby using Uniswap RouterO2 address. When I try to execute a swap on remix it warns about the insufficient gas and upon execution the transaction gets reverted.
Where did I go wrong?
I'm new to solidity programming and DEXes, can you please point me in the right direction?


texts: What is "w", the permission to make modifications?

texts:
As per chapter 9 of the yellow paper:

However, I find it vaguely defined.

Who gives this permission? Is it dependent on each machine or is there an objective algo to follow?
What is the type of "w"? In the paper, it seems to always take the value of an opcode (e.g. REVERT), but I'm not fully sure.

I know about this answer but it simply pasted snapshots from the yellow paper and it's not descriptive enough + I'm not sure it's correct, it seems "w" is not a boolean.


texts: remix - gas limit exceeded, but contract is running on blockchain

texts:
i studying remix and ethereum, and create my local blockchain.

and create contract with remix.the contract just print simple word.

pragma solidity ^0.4.8;

contract HelloWorld{
    string public greeting;
    function HelloWorld(string _greeting){
        greeting = _greeting;
    }

    function setGreeting(string _greeting){
        greeting = _greeting;
    }

    function say() constant returns(string){
        return greeting;
    }
}

and i set gas limit 300,000, set _greeting to Hola!

contract working well, and there is no error on this contract.

and i see the block that this contract is contained.

{
  difficulty: 182546,
  extraData: "0xda83010815846765746888676f312e31312e348777696e646f7773",
  gasLimit: 7770496,
  gasUsed: 370469,
  hash: "0x16b515fcb7fc23220de291e9432fc039897cf46ee17577cb4eb251a989b10511",
  logsBloom: "0x000000000....0000",
  miner: "0x6b169bf30ca51fcb3034a8d161698b0f4e7bd168",
  mixHash: "0xf6f531bbe531cf83cbb7bcd278ddcec9e2220d69605f6cebe4ac33c992862eaf",
  nonce: "0x3dbb8a68d74d72a0",
  number: 1341,
  parentHash: "0x22a5d086704d663d56dca62dfe08f06e5e71bd26fb0275b918770d01c87381e8",
  receiptsRoot: "0xa655c0137e500bcdafa23d9ab58f0067945700cfef1e158dd3d9b9d9e4cab059",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 2039,
  stateRoot: "0xe81510bb99242c3fe03a45f55a8d7822b5cb95ed5cfda58becfb676a2501928c",
  timestamp: 1551674879,
  totalDifficulty: 221589793,
  transactions: ["0xf662dbbc8012dc97588d911efc63f9163b16f9aa373bd3627df395ba2c683065"],
  transactionsRoot: "0xeb61642c2d5880b38d97ba98213e50db4921b7aec9e28852f89c9ac88f69bc84",
  uncles: []
}

  gasUsed: 370469,

it say the gas used over 300,000.

As a result, there is no error. but it doesn't make sense. l learn when gas limit is over, the contract will not execute.


texts: Unable to interact with DApp deployed on quorum

texts:
I am unable to interact with contract using Dapp deployed on Quorum blockchain (using metamask).
I am following "https://truffleframework.com/tutorials/building-dapps-for-quorum-private-enterprise-blockchains". I have successfully set up Quorum 7node blockchain
then I created a simple set and get Dapp for the same contract given in the above link.
I have managed to import coinbase of each node to metamask. I have created 3 custom RPC http://127.0.0.1:22000, 22003 and 22006 and imported respective coinbase to metamask(following "How to import account form geth console to metamask (private blockchain)").
I have created a simple app.js similar to truffle pet shop tutorial,

App.js file

I have deployed contract with privateFor tag in migration and for set function same as shown in truffle quorum 7node example.

But when I try to change the value of storage data from dapp, I am unable to change it (it reflect the same constant value).
whereas from geth node I am able to change value of storage data. Even from sampletx.js(using truffle exec sampletx.js) i am able to change storage data value .


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

texts:
Instead of transferring my BPT token to my wallet, I accidentally sent it to the contract itself.
I sent 99,546.988023218400325838 BPT to the address 0x471eb7dcf6647abaf838a5aad94940ce6932198c
The link below takes you to the etherscan contract with my BPT sitting in the address.
https://etherscan.io/token/0x471eb7dcf6647abaf838a5aad94940ce6932198c?a=0x471eb7dcf6647abaf838a5aad94940ce6932198c
Would the contract creator be able to send it back to me?


texts:
I have tested soliditySha3 function with web3js.

var msg = web3Infura.utils.soliditySha3("transferPreSigned", mainContractAddress, recepientAddress, tokenAmountWei, transferFee, randomNounce);

I want to use it with web3py. How can I use it?

web3.soliditySha3() ?????


texts: "Bitcoins are only divisible down to 8 decimal places If there is a need for them, additional decimal places can be added with hard fork."


texts: Since Smart Contracts can call multiple contracts, is there a chance that smart contracts enter a gridlock situation?


texts: Doesn't having a centralised front end pose a huge security risk to an Ethereum app?

texts:
My understanding is that the typical architecture for an Ethereum app is to have a smart contract acting as a backend to a centralized, stateless front end which runs on a single server.

Doesn't this pose a rather glaring security risk? If the front end app is hijacked, all of the users' actions can be misdirected to whatever the attacker wants (ie, instead of sending ether to a useful smart contract, it gets sent to the attacker's wallet).

Is there any way to host a front end app in a decentralised way?


texts: How to use sendRawTransaction of web3.py?

texts:
I read the web3.eth.API carefully and I typed the code in my project.

    signed_txn = self.web3.eth.account.signTransaction(
        {
            'nonce': self.web3.eth.getTransactionCount(Web3.toChecksumAddress(self.address)),
            'gasPrice': Web3.toWei(21, 'gwei'),
            'from': Web3.toChecksumAddress(self.address),
            'gas': 21000,
            'to': recipient,
            # 'chainId': 1,
            'value': Web3.toWei(amount, 'ether')
        },
        private_key
    )

This code doesn't run.
Here what I can't understand is as follow.

  chainId: What value is this?
  private_key: I can't get this value. I created ethereum wallet using pywallet.

Wallet to be created using pywallet is HD Wallet.
If anyone know about this, plz help me.


texts: If we put all 35 million active address into one MPT tree (Merkle Patricia Tree), how many bytes is the MPT?

texts:
As we all know, the more address there are, the more bytes the MPT tree (Merkle Patricia Tree) saves and there may be 35 million active address in Ethereum.

If we put all 35 million active address into one MPT tree, how many bytes is the MPT?

Recently, I am working on my graduation thesis, can you give me more details, thanks a lot.


texts: how to calculate the message part for pedersen hash in solidity

texts: I am trying to implement pedersen hash using solidity. Is it possible to implement and how to split the message according to the conditions of pedersen hash.


texts: map cryptotoken on other BlockChain to ERC20 token on ethereum

texts:
I am new to cryptotoken world. wanted to test some concept.

I want to create cryptotoken on Hyperledger blockchain say "HyperToken" and want to map/integrate with ERC20 token on ethereum blockchain. so when user buys a token through smartcontract on ethereum through ether,  he gets "Hypertoken" with following value

1 ERC20 token = 0.5 hypertoken.

Can anyone advice on how this can be achieved or any reference material to understand the flow.

Thanks and regards
Sal


texts: What are the differences (and relationship) between the steps used to (1) validate a transaction and (2) confirm a block?

texts: On the Ethereum blockchain, what is the difference (and relationship between) (1) the process used to validate a transaction and (2) the process used to confirm a block? It seems that these processes are pretty autonomous since some blocks get confirmed with zero transactions. But a block can only get confirmed if all the transactions within it have been validated, right? I would love more clarity about similarities and differences between these two processes.


texts: Discrepancy in Solidity compiler output for Remix and offline (same version, same code)


texts: I´m new to Ethereum and Solidity, ¿can anyone help me?. Thank you!

texts:
I have to:
Write a Contract Constructor that will store the addresses at each of the member variables you declared in the previous stage.
The arbiter and beneficiary will be arguments to the constructor (in that order respectfully) and the depositor will be the address calling the function.

And i have this:

pragma solidity ^0.4.19; // TODO: declare version ^0.4.19

contract EscrowContract {
    // TODO: create member variables
    address public depositor;
    address public beneficiary;
    address public arbiter;
    function EscrowContract (address _abiter, address _beneficiary) public {
    // your code here

    }
}

And i get this:

contracts/escrow.sol:8:27: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
    function EscrowContract (address _abiter, address _beneficiary) public {
                             ^-------------^

contracts/escrow.sol:8:44: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
    function EscrowContract (address _abiter, address _beneficiary) public {
                                              ^------------------^

I DONT KNOW HOW TO REMOVE OR COMMENT OUT THE VARIABLE NAME.

Thank you for your help.


texts: Can I `eth_call` a non constant function from javascript?

texts:
I know that I can't get the return value from a transaction (How to get values returned by non constant transaction functions?), and non-constant functions have return value because they can be called from another contract (What's the point of returning a value in a non-constant function?).

For example in the following contract the function getUserData is non-constant because it modifies array allData in contract storage:

pragma solidity ^0.4.15;

contract Storage {
  mapping (uint => uint) public users;
  uint[] public allData;

  event SetUserData(uint userId, uint data);

  function setUserData(uint userId, uint data) public {
    require(users[userId] == 0);
    // Stores user data
    users[userId] = data;
    // Stores user id
    allData.push(userId);
    SetUserData(userId, data);
  }

  function getUserData(uint userId) public returns (uint[] data) {
    if (users[userId] != 0) {
      // Will return user data but modifies contract storage
      allData.length = 0; // Ignore previous data
      allData.push(users[userId]);
      return allData;
    } else {
      return data;
    }
  }
}

But when I call a non-contant function from javascript I do not get an error, instead I got the expected return value.

Testing in a private network with geth v1.7.1 this test passes, but with testrpc v4.1.3 it fails.

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

contract('Storage', function(accounts) {
  let storage;
  before(async () => {
    storage = await Storage.deployed();
  });
  it("Set user data", async () => {
    // Stores user data
    await storage.setUserData(4321, 7890);
    // Get user data
    const data = await storage.getUserData.call(4321);
    assert.equal(data[0], 7890, 'Return user data');
    // Check contract storage is not modified
    const allData = await storage.allData.call(0);
    assert.equal(allData, 4321, 'Return userId');
  });
});

Is is defined behavior to eth_call a non-constant function from javascript or it is an implementation detail of geth?

I'd like it to be defined behavior, but I understand that an implementation can return an error if I call non-constant function.

One minor difference is that in a constant function I can allocate arrays in memory, but I cannot dynamically grow them. But if I can use arrays in storage I can use push to grow them dynamically.


texts: Max possible ERC20 Tokens allowed with 18 decimals?

texts: I would like my token to have the maximum possible amount of tokens issued as a novelty. I would like to use 18 decimals standard ERC20 token, what value can I put in to get the maximum amount of tokens possible?


texts: Truffle's npm run build doesn't give me any .html and .js files in /build directory

texts:
I successfully deployed my contract with the truffle console. Then I wrote my DApp with the files index.html and app.js in the /app folder.

I attempted to build my codes for production by running the command

sudo npm run build

I went into my build folder but only see /contracts. From all my previous attempts, I would have seen the production versions of index.html and app.js in this folder that I can now copy to my web server. It strange that it didn't appear this time.

I am on Truffle v4.1.14.

By the way when I run

sudo npm run dev

I could see that index.html and app.js on localhost:8080.

Any help is appreciated!


texts: Recover myetherwallet account with json but without password

texts:
I have lost my usb stick which contained password for access to my myetherwallet.
Are there any ways to recover that, only thing I have is .json file, can I get from it private key or is there any way to recover password?

Thanks


texts: Is it possible to trace a function call hitting revert?

texts:
It is possible to trace a transaction with debug_traceTransaction. But it needs the transaction hash, requiring it to be a transaction in first place.

I'm debugging a function call that generates a revert, and I want to recover the parameter passed in the revert opcode.


texts:
I'm following cryptozombies solidity tutorial.
In lesson 2, chapter 11 it explains how to create an interface for CryptoKitties as follows:

contract KittyInterface {
  function getKitty(uint256 _id) external view returns (
    bool isGestating,
    bool isReady,
    uint256 cooldownIndex,
    uint256 nextActionAt,
    uint256 siringWithId,
    uint256 birthTime,
    uint256 matronId,
    uint256 sireId,
    uint256 generation,
    uint256 genes
  );
}

then it initializes it in a contract:

contract ZombieFeeding is ZombieFactory {

  address ckAddress = 0x06012c8cf97BEaD5deAe237070F9587f8E7A266d;
  KittyInterface kittyContract = KittyInterface(ckAddress); // this initialization is what I don't get

  function feedAndMultiply(uint _zombieId, uint _targetDna) public {
    require(msg.sender == zombieToOwner[_zombieId]);
    Zombie storage myZombie = zombies[_zombieId];
    _targetDna = _targetDna % dnaModulus;
    uint newDna = (myZombie.dna + _targetDna) / 2;
    _createZombie("NoName", newDna);
  }
}

I don't get how the interface can be initialized using when no constructor is defined in KittyInterface.

I saw that usually the keyword interface is used to define interfaces (instead of contract) and I was thinking maybe the compiler knows that an interface can be initialized using an adress, but that's is not the case here.

If someone could explain how this works, it would be wonderful.


texts: I want to know that how can I transfer Nodejs API call response to Html, where for every call or response gas will be consumed by help of Solidity from the Ganache Ethereum account.


texts: IPFS conditional access control through ethereum smart contracts

texts:
This question is about combining IPFS with Ethereum smart contracts to check conditions and encryption to restrict access.

One-on-one file sharing with a known recipient is not an issue. The 'sender' would encrypt the file with the recipient pubkey, upload it to IPFS send the hash to the recipient. The recipient could then decrypt the file with his privkey.

My issue occurs when dealing with (multiple) unknown parties.
If we combine IPFS hashes with Ethereum we could for example transfer the IPFS hash to a recipient that wants to access it and decrypt it once certain conditions have been met eg. a payment has been made.
These recipients are thus not known beforehand, we can not encrypt the file with the pubkey of the recipient.

We can not simply store the decryption key on the ethereum blockchain, this key would be visible to anyone and thus people would be able to access the encrypted file on IPFS without eg. payment.

One solution is to save the decryption keys that belong to their assets on a seperate centralized datastore, making a single point of failure for our dApp yet again possible.

So I'm wondering if there are any solutions to solve this problem like safely storing the decryption keys on-chain.

Many thanks.


texts: Push to an array created inside a function

texts:
I want to create a temporary array that is returned from a function. I declare it in the function and use the memory tag but I am unable to push to it.

function getAllLandForSale() external returns(uint256[]){

        uint[] memory propertiesForSaleArray;

        // Get the total number of properties created
        uint256 totalNumberOfProperties = baseContract.getLandArrayLength();

        for(uint i = 0; i < totalNumberOfProperties; ++i) {

           address currentOwner = baseContract.getLandOwner(i);

           if(currentOwner == address(0)){

               propertiesForSaleArray.push(i);

           }

        }
    }

I am getting the following error.


texts: Increment a uint variable results in unexpected value

texts:
I have the function resolveProject() in my contract, which iterates over a list of Task, let's say 2, both with status 3.

function resolveProject() {
    // ...

    uint closedTask;
    uint totalPayout;

    for(uint i=0; i<taskIds.length; i++){
        if(tasks[taskIds[i]].status == 3) {
            // Issue here
            closedTask = closedTask + 1;
            totalPayout += tasks[taskIds[i]].compensationOracle;
        }
    }
    // ...
}

After one iteration, the line closedTask = closedTask + 1 assign 1000000000000000000 to the variable, where my intention would be to set it to 1. I tried also using closedTask++ with the same result.

1000000000000000000 gwei is 1 eth, is this some sort of implicit conversion happening? I get this when running on Remix JavaScript VM.

Edit 1

The Solidity code works actually fine, but I think there might be a bug in the debug panel of Remix

at line 146 there is a comparison between closedTask and taskIds.length. The latter has 3 items, as you can see on the right, but closedTask in debug panel shows 3000000000000000000. Still that comparison returns true when runs, I can confirm the projectStatus set to 2.

Edit 2
I created a bug in remix-ide' github, it has been tagged as bug so I assume this confirms there is a minor bug with Remix debug console.

https://github.com/ethereum/remix-ide/issues/1599


texts: Event filter of a contract doesn't filter light client

texts:
hello  i use the env is  android  go ethereum  light client not  web3j  not web3j
i init geth  code

        FilterQuery selfFQ = Geth.newFilterQuery();
        selfFQ.setTopics(Geth.newTopicsEmpty());
        selfFQ.setAddresses(Geth.newAddressesEmpty());
        Topics tps = selfFQ.getTopics();
        String strFunction = "ReturnValue(address,int256)";
        String HashStr = Sha3.hash(strFunction);
        List<String> topics = new ArrayList<>();
        topics.add("0x" + HashStr);
        tps.append(fromListToHashes(topics));
        selfFQ.setTopics(tps);
        node.getEthereumClient().subscribeFilterLogs(Geth.newContext(),selfFQ,new MyFilterLogsHandler(),16L);

  then i  receiver the log in bellow

    public void  onFilterLogs(org.ethereum.geth.Log var1){
    try{
        byte[] topics = var1.getTopics().get(0).getBytes();
        byte[] args = var1.getTopics().get(1).getBytes();
    }catch (Exception e){
        Log.d("111","onFilterLogs getTopics " + var1.toString());
    }
}

then  i don't know how to parse the event and param ...... anybody can told me  thanks


texts:
I was going through following  example in Solidity and came across this contract and I am confused if its a datatype like uint string as it is mentioned in comments as contract type what contract types are and why they are not recommended to create contracts

contract OwnedToken {
// TokenCreator is a contract type that is defined below.
// It is fine to reference it as long as it is not used
// to create a new contract.
TokenCreator creator;
address owner;
bytes32 name;


texts:
In our platform, we reward users with ERC20 tokens based on the fixed formula.

  number of articles user wrote * 0.01828 = number of tokens to be rewarded

So let's say a user wrote 5 articles (5 * 0.01828), they get 0.3656 tokens.

How do I convert that to uint256 so EVM can accept it?

p.s. I set my decimals places to 18.


texts: Disguise the input from msg.sender of a function call

texts:
is it possible to disguise the input from msg.sender of a function call?

e.g. If we assume I have a smart contract which includes a mapping of registered inmates, and a user-group called prison officers. Now, I could restrict the lookup of registered inmates to only be accepted from the prison officers user-group.   However, this could still be gamed because they still need to be added to the mapping which requires an input, someone could just go through the single transactions and their input variables to accumulate a list og registered inmates. Is it possible to disguise this input?


texts: Why is ethereum's mining function is safe as bitcoin's proof of work?

texts: bitcoin's mining time is about 15 minutes while ethereum's mining time is 10 seconds. Is not it bad for ethereum's mining time to be too short? (from security aspect). Why is it so important for ethereum's proof of work to be ASIC resistant function?


texts: Could you please explain, what happens when the collateral price goes down(but doesn't hit the liquidation ratio) and the user neither doesn't deposit extra collateral nor doesn't possess enough dai in his/her account to get charged in order to recover the initial ratio? Thanks!!


texts: Will the tx fees of old contracts be greater or smaller than those of new contracts in ETH 2.0?

texts:
Will contracts that currently exist cost more or less to interact with after the ETH 2.0 upgrade? What about old contracts that call a new contract, or new contracts that call an old contract?
Will the difference (if any) be due to the amount of gas consumed, or due to economic reasons? (e.g. the shard with the old chain may have a greater transaction volume and therefore a higher average gas price)


texts: GetPastEvents and string topic - Error: invalid argument 0: hex has invalid length 160 after decoding; expected 32 for topic

texts:
Being "token" below a contract instance, i do:
token.getPastEvents('OperationEvent', {fromBlock:68000000, filter: {productId: '0xe69cc33407fbe7f7d9bcc423d83da743843bcae7e19a7d20bfd38170f30f53f0'}})

Getting:
Error: invalid argument 0: hex has invalid length 160 after decoding; expected 32 for topic

The hex string sent is the result of "web3.utils.sha3()" for the original string topic. If i request all events from that contract i can see that the topic reported in the event i'm looking for perfectly matches the hex string i'm sending.
I suppose i'm just generating the topic the wrong way, but can't find anything in the docs or googling. ¿Any clue on how to get this right (filtering past events of a contract by an string topic)?


texts: Where can I start learning to develop Decenteralized apps?

texts:
I have been trying to understand this development process of making DaPPs using ehtereum from various sources, some of them are outdated because this technology is evolving pretty fast as of now.
Currently, I am following this tutorial https://medium.com/@mvmurthy/full-stack-hello-world-voting-ethereum-dapp-tutorial-part-2-30b3d335aa1f but It is using testnet for syncing blockchain and I am confused because, I have found people refering an alternate for this using metamask. I am a begginer therefore there is lot of confusions. Please suggest some latest resource to follow in order to understand dApps better.


texts:
Taken a smart contract like the following:

contract A {
    address public beneficiary;

    function A(address _beneficiary) public {
         beneficiary = _beneficiary;
    }

    function () public payable {
         beneficiary.transfer(msg.value);
    }
}

How would you write it in inline assembly? No problem for me with the constructor, but got stuck with the fallback function, since I don't know how to translate the transfer()


texts: Printing Paper wallet for my Ether in Ledger Nano S

texts:
I have my ETH in my ledger nano S. I need to take a backup of the private key in the form of paper wallet using myetherwallet.com.

I am unable to understand the procedure for it. Can anyone throw some light / steps for it ?


texts: Issue with failing to detect peers via Bootnode on Local Network

texts:
I am attempting to connect various nodes to my private blockchain on my local network using a bootnode to discover peers. Connecting the peers on the local machine running the bootnode is possible, but when attempting to connect a peer from another machine, it does not work.
The following command is used to start the bootnode:
bootnode -nodekey boot.key -verbosity 9 -addr 192.168.254.85:30310

I am using this command to connect to the network via the bootnode:
geth --datadir node2/ --syncmode 'full' --port 30312 --rpc -rpcaddr 'localhost' --rpcport 8502 --rpcapi 'personal,db,eth,net,web3,txpool,miner' --bootnodes 'enode://4502006cbeb7c4f6a7bef61235f70c12406ed2b9f70dbab48202ab82e9f22367b685d7370ab864000406d3d5b1e8627c9ec2cd21720c366112663bede7cd27d4@192.168.254.85:0?discport=30310' --networkid 40152 --gasprice '0' --unlock '0x0888dBFf4Ac86aBE76963c7F2C339a6475CcAd2A' --password node2/password.txt --mine --allow-insecure-unlock console

Occasionally when running the bootnode the following error will occur (Invalid IP in response record)

It successfully executes, but once the geth command line appears, it continues to look for peers without finding any. We've opened UDP and the necessary ports.
What could be the issue?


texts: How to check if element of struct array has been deleted?

texts:
So let's say that I have struct A and an array A[] of struct A's I then fill 3 first indexes of A[] with some A's. I then delete second index of A[] and and want to test if it has been deleted.

In other words:

A memory a = A({index: 1});
A memory a = A({index: 1});
A memory a = A({index: 1});
A[] arr;
arr.push(a);
arr.push(b);
arr.push(c);
delete arr[1];
//how do I check if arr[1] is deleted? looking for something like: if(arr[1] == null)


texts: is this the right way to simulate having a negative number?

texts:
I needed a number which could go negative but since there is no negative number in solidity this is how I'm doing it:

// using safe Math

uint pool = 0; // this is my number
bool positivePool = true; // to know if the pool number is negative or positive

function updatePool(uint _amount, bool _positive) public {
    if (positivePool) {
        if (_positive {
            pool = pool.add(_amount);
        }
        else {
            if (_amount > pool) {
                pool = _amount.sub(pool);
                positivePool = false;
            } else {
                pool = pool.sub(_amount);
            }
        }
    } else {
        if (_positive) {
            if (_amount > pool) {
                pool = _amount.sub(pool);
                positivePool = true;
            } else {
                pool = pool.sub(_amount);
            }
        }
        else {
            pool = pool.add(_amount);
        }
    }
}

now this is the simplest way that i could think of.
my question is if this is the right way or not? it feels like there should be an easier way.

is there anything wrong with this code?


texts: how does eth-lightwallet manage transaction nonces?

texts:
I am using eth-lightwallet 2.4.3. I found some of my transactions never got mined. Using txpool.status I noticed I was getting a number in queued.

txpool.status

{
 pending: 0,
 queued: 2
}

I understand that transactions in queued are there because they have a nonce that is out of sequence.

This problem doesn't always happen. Sometimes everything works ok.

How and where in the code does eth-lightwallet manage the nonce? I presume it must have a technique for knowing what the next nonce value will be for each transaction.

I should mention I am using eth-lightwallet with the hooked-web3-provider and use the web3 api.


texts: How to Start solidity programming after installing plugin in Intellij idea

texts: I installed plug-in 'Intellij-Solidity' in Intellij Idea. But I did not found any new project option to create . Is there any environment setup for solidity programming. I use Ubuntu 16.04 LTS .


texts: How to convert big number to normal number?

texts:
I am new to testing and I want to know how to convert a big number to a real number.

I use bignumber in the following command:

console.log(await this.crowdsale.rate());

This is what gets printed in the terminal:

BigNumber { s: 1, e: 2, c: [ 500 ] }


texts: address(this) in solidity is returning wrong contract address

texts:
This is my cantract code which I was using in truffle

pragma solidity 0.5.16;

contract Test {
    function getAdd() public view returns(address){
        address add = address(this);
        return add;
    }
}

This is my js Test code

const Test = artifacts.require('../contracts/Test.sol');

contract('Test',(accounts)=>{

    it('Testing Testing',async()=>{
        let ins =await Test.deployed();
        let ans =await ins.getAdd.call();
        console.log(ans)
    })
})

and I am using ganache for my local blockchain

when I run truffle test command it gives me the result
0x4cB6949669C8631fb2f99Bbe890B99B7DbF64685

but in ganache contract section the deployed contract address is
0xc48Cda939749b1Da32E6853184D595a30c5accCf

I don't know what is going wrong here as address(this) should have return my contract address but it is not working as expected

Steps I have done are:-

truffle init
wrote the contract
wrote migration file

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

module.exports = function(deployer) {
deployer.deploy(Test);
};

truffle compile
5. truffle migrate
6. truffle test

I dont know why I am getting wrong address in that but when i tried it on remix it was working please help!!


texts: Is it possible Refund the ETH within ERC20 Contracts?

texts:
if user sent the 1.5 ETH then accepted the 1 ETH, but 0.5 ETH should be refunded to sender.
I tried like msg.sender.transfer(0.5)

and tried like msg.sender.transfer(500000000000000000)

but nothing happened.  I am not sure about that msg.sender.transfer is a right function.

is it possible do such way in Contracts?


texts:
I started my first code in solidity . when i was implemented getter and setter i have face some error .

The Following code,

pragma solidity ^0.5.0;

contract MyFirstContract{
    string private name;
    uint private age;

    function setName(string newName) public{
        name=newName;
    }
    function getName()public view returns(string){
        return name;
    }

    function setAge(uint newAge) public{
        age=newAge;
    }
    function getAge()public view returns(uint){
        return age;
    }

}

Error 1:

browser/MyFirstContract.sol:7:22: TypeError: Data location must be "memory" for parameter in function, but none was given.
    function setName(string newName) public{
                     ^------------^

Error 2:

browser/MyFirstContract.sol:10:43: TypeError: Data location must be "memory" for return parameter in function, but none was given.
    function getName()public view returns(string){
                                          ^----^


texts: Who keeps the Ether when a transaction triggers an exception?

texts:
An audit had

"Strong Recommendation: We recommend that exceptions cause all value to be returned to the sender, not the recipient."

What were the technical reasons for not implementing this recommendation?  What other parts or behaviors of Ethereum would have been affected if this was "fixed"?


texts: How do i keep a contract's value changed by another one constant?

texts:
There are 3 contracts; A, B, and C. C has a state variable with a default value. A changes that state variable to Yerevan. After that, B sees that variable. Evaluating by A is successful but B sees the default value again. It appears that B cannot call a updated smart contract. How can i change a state variable by an other smart contract permanently? is there any related work? please guide a beginner man. Thank you.
C:
pragma solidity ^0.5.12;

contract C{
   bytes public name;
   function rep(bytes memory pseudonym)  public returns(string memory){
       name=pseudonym;
       return string(name);
   }
   }

A:
pragma solidity ^0.5.12;
import "./C.sol";
contract A{
   bytes public fname="Yerevan";
   function naming() public returns(string memory){
      return C(0x8fcECc5B8d42EcF099E1cF032B1F505fbDA230A3).rep(fname);
  }
  }

B:
pragma solidity ^0.5.12;
import "./C.sol";
contract B{
   function rep() public returns(string memory){
      return string(C(0x8fcECc5B8d42EcF099E1cF032B1F505fbDA230A3).name());
   }
   }


texts: multiply every number in an array and writing to new array

texts:
how to do that?
i've been trying something like this
    uint[] public numbers = [1, 2, 3];
    uint[] public numbers2;

    function multiplyArray(uint a) public {
        uint b = numbers.length;
        uint counter = 0;
        for (uint i = 1; i <= b; i++)
        {
        numbers2[i] = numbers[i] * a;
        counter++;
        }
    }


texts: How to create different structs through an array argument

texts:
I am trying to create different structs by passing the necessary components of the struct through an array in the arguments. So far, the compiler does not complain but when i execute the transaction, it doesn't show that the structs have been created. This is how the code looks. Any way I can create different structs with one call by passing the necessary components of the struct in the arguments?
 struct Schedule {
        uint releaseTime;
        bool signed;
    }

    struct Beneficiary {
        bool isAuthorized;
        uint percentage;
        uint received;
    }

    mapping(address => Beneficiary) private _beneficiaries;

    mapping(address => uint) internal rewards;

    address[] internal _beneficiariesList;

    mapping(uint => Schedule) private _schedules;
    Schedule[] internal _schedulesList;

constructor(address[] memory beneficiaries, uint[] memory _percentages, uint[] memory schedules) public {
        require(beneficiaries.length == _percentages.length, 'Beneficiary and percentage arrays must have the same length');
        for(uint i = 0; i < _beneficiariesList.length; i++) {
            _beneficiariesList.push(beneficiaries[i]);
            _beneficiaries[_beneficiariesList[i]].isAuthorized = true;
            _beneficiaries[_beneficiariesList[i]].percentage = _percentages[i];
            uint _totalPercentage = 0;
            _totalPercentage = _totalPercentage.add(_beneficiaries[_beneficiariesList[i]].percentage);
            require(_totalPercentage == 100, 'Percentages must sum up to 100');
        }
        for(uint s = 0; s < _schedulesList.length; s++) {
            _schedulesList[s].releaseTime = now + schedules[s];
            _schedulesList.push(_schedulesList[s]);
        }
    }


texts: How to construct a raw Ethereum transaction from transaction data

texts:
Let's say I have the following transaction information:
{
  "jsonrpc":"2.0"
  "id":0
  "result":{
    "blockHash":"0x43dd926aa138a58d3f4740dae387bcff3c7bc525db2d0a449f323f8b8f92a229"
    "blockNumber":"0xa4f285"
    "from":"0xea8a7ef30f894bce23b42314613458d13f9d43ea"
    "gas":"0x30d40"
    "gasPrice":"0x2e90edd000"
    "hash":"0x72ee43a3784cc6749f64fad1ecf0bbd51a54dd6892ae0573f211566809e0d511"
    "input":"0x"
    "nonce":"0x1e7"
    "to":"0xbd064928cdd4fd67fb99917c880e6560978d7ca1"
    "transactionIndex":"0x0"
    "value":"0xde0b6b3a7640000"
    "v":"0x25"
    "r":"0x7e833413ead52b8c538001b12ab5a85bac88db0b34b61251bb0fc81573ca093f"
    "s":"0x49634f1e439e3760265888434a2f9782928362412030db1429458ddc9dcee995"
  }
}

Along with anything else you may need about the network broadly (such as chain_id).
Is it possible to construct an analogous raw transaction from this information without knowing the private key of the sender?
Feel free to use your favorite Web3 SDK.


texts: Why does syncing the blockchain continually evict the DAG?

texts:
During a long blockchain update, there are messages such as "Evicting DAG for epoch X in favor of DAG for epoch X+3."

My understanding is that a DAG is not required until actually mining, so the only DAG required should be for the current epoch, no?

(FYI - blockchain has been updating for 2 days - currently up to #577208 )


texts: Contract uniswap check liquidity is added

texts: How can i check in contract a liquidity is added to some pair and then exchange it?


texts:
My code on Solidity is:

contract Recoverable is Ownable {

  /// @dev Empty constructor (for now)
  function Recoverable() public {
  }

  /// @dev This will be invoked by the owner, when owner wants to rescue tokens
  /// @param token Token which will we rescue to the owner from the contract
  function recoverTokens(ERC20Basic token) onlyOwner public {
    token.transfer(owner, tokensToBeReturned(token));
  }

  /// @dev Interface function, can be overwritten by the superclass
  /// @param token Token which balance we will check and return
  /// @return The amount of tokens (in smallest denominator) the contract owns
  function tokensToBeReturned(ERC20Basic token) public returns (uint) {
    return token.balanceOf(this);
  }
}

And I get next error: Function state mutability can be restricted to view
  function tokensToBeReturned(ERC20Basic token) public returns (uint) {
  ^ (Relevant source part starts here and spans across multiple lines).

I take this example from GitHub, and when I try куdeclare a function as internal pure, then get the next error:

function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
    return token.balanceOf(this);
                           ^--^

P.S. Help me, I really don`t understand.


texts: ERC721 Contract vs. Auction Contract - Architectural Approach

texts:
I'm working on a new ERC721 Crypto-Collectible project, which also means creating an Auction and Marketplace functionalities into the whole thing.

Should I just start with a basic ERC721 Contract - using the open-zeppelin library, and then write all this other functionality into it? Or is there some logistical/practical reason to keep the ERC721 Collectable contract separate from the Auction/Marketplace contract?

Here's my starting point:

contract MyCollectable is ERC721Full {

constructor (string memory _name, string memory _symbol) public
    ERC721Full(_name, _symbol) {
}

/**
* Custom accessor to create a unique token
*/
function mintUniqueTokenTo(address _to, uint256 _tokenId, string memory _tokenURI)
    public {
        super._mint(_to, _tokenId);
        super._setTokenURI(_tokenId, _tokenURI);
    }
}


texts: i got error in if statement while i using the solidity version 0.5.0;

texts:
pragma solidity ^0.5.0;

...

function SearchByTenderId(string memory a) public view returns(string){
    string memory Id=a;
    if(keccak256(TenderId) == keccak256(Id)){
        return "TenderId is already existing,\n We con't Reapply";
    }
    else{
        return "We can apply for tender";
    }


texts: How to execute Owner only methods in a contract from Web3 JS

texts:
Assuming there is a contract deployed at 0x332a5fbdfd0b3ba6dd1d35e4e3c86562024f737d whose Owner is 0x0136d0ccac4464f920eeab664e847f4e69bd5fcf. The contract has a ownerOnly method named incrementNumber(), how should we go about executing this method from a standalone Node.js server?

I'm using testrpc in mac for testing this - I have access to the private keys (not sure what the password of the accounts are in Testrpc)


texts: how to return uint256 from solidity to javascript?

texts:
I have a function in Solidity:

address[] contracts;

function getContractsCount() constant returns (uint256) {
      return contracts.length;
}

in Remix it's work perfect. I get 1, it's right, but when I call the function from javascript:

import FactoryContract from '../build/contracts/Factory.json';

const selectContractInstance = (contractBuild) => {
  return new Promise(res => {
    const myContract = contract(contractBuild);
    myContract.setProvider(provider);
    myContract
      .deployed()
      .then(instance => res(instance));
  })
}

var factoryContract = await selectContractInstance(FactoryContract);

var contractCount = await factoryContract.getContractsCount.call().toNumber();

I get wrong number - 0.

How to return uint from Solidity to JavaScript from contract function

[UPDATE]
---------

Solidity Code

address[] public contracts;
 TokenFactory public newContract;

function createContract(uint _totalSupply, string _name, string _symbol, uint _decimal) payable returns(uint256 t) {
  newContract = new TokenFactory(_totalSupply, _name, _symbol, _decimal);
  contracts.push(newContract);
  return (contracts.length);
} //return 1, it's right

function getContractsCount() constant returns (uint256 length) {
  return (contracts.length);
} // after that the function return 0, it's wrong!

JavaScript Code not change


texts: How to approve an transfer with safeERC from OpenZepplelin

texts:
My contract does like this;
pragma solidity 0.6.2;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./IDTToken.sol";

contract Stacking is Ownable{

    using SafeMath for uint256;
    using SafeERC20 for IERC20;
    IDTToken stk = new IDTToken();
    mapping(uint256 => mapping(address => uint256)) public stackers;
    mapping(address => uint256) public poolBalance;

    event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
    event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);

    struct PoolInfo {
        IERC20 tokenStack;
        uint256 allocPoint;
        uint256 lastRewardBlock;
        uint256 accIDTPerShare;
        }

    function deposit(uint256 _amount, uint256 _id) public payable {
        PoolInfo storage pool = poolInfo[_id];
        updatePool(_id);
        stackers[_id][msg.sender] = stackers[_id][msg.sender].add(_amount);
        pool.tokenStack.safeTransferFrom(address(msg.sender), address(this), _amount);
        emit Deposit(msg.sender, _id, _amount);
         }

    function getERCapprove(IERC20 _token, address _spender, uint256 _value) public returns (bool){

        return _token.approve(_spender, _value);
        }
}

In the front end;
export const stackToken = async (stacking, token, account, amount, id, web3) => {
amount = web3.utils.toWei(amount, 'ether')
await stacking.methods.getERCapprove(token, stacking.options.address, amount).send({ from: account
}).on('transactionHash',(hash) => {
  console.log(hash)
  stacking.methods.deposit(amount,id).send({from : account})
  })
}

So when I approve the token it seams to be working. I receive a transaction hash from that call.
But the call for the transfer is causing an error.
If I make the deposit with a token that is not using safeERC, just a plain erc20 standard.
I get the following error;
VM Exception while processing transaction: revert SafeERC20: low-level call failed

If I make the call to a token that uses safeERC
I get the following error;
VM Exception while processing transaction: revert ERC20: transfer amount exceeds allowance

So I'm not sure if it's the approval or the transfer that isn't working


texts: What is the difference between Swarm and IPFS?

texts: IPFS seems a little slow on existing dapps.  will Swarm load content more quickly? Also- is there a roadmap for swarm?


texts: What is the criteria to resync chain using proof of stake?

texts:
In PoW, nodes always resync their own chain to the longest chain in the network in order to respect the work the miners have done. In PoS, as I understand in its simplest form, the miner with the highest stake in the system produces a legitimate block.
Then, what are the criteria to resync the chain in PoS when there might be a fork or difference?
Thanks!


texts: How do gas fees work in UniSwap / other decentralized exchanges?

texts:
So, lately i've been doing research about gas fees and how they work. I got the most part but there's something I don't yet understand.
The theory of gas fees in ETH is that whenever you do a transaction, the miner that includes the transaction in the block and creates it, gets the transaction fee as a reward. Great.
However, in DEXs like uniswap, it only says that it charges a 0.30% fee that goes to the liquidity providers. Does that mean that instead of going to the miners, the fee goes to the liquidity providers? Or is this 0.30% an additional fee on top of the miners fees? I can't find the answer anywhere. So if anyone knows how this works, i would really appreciate it.


texts: Transaction out of gas - where are my ethers?

texts: I sent 2 ethers to indahash for an ico and the Transaction ran out of gas. Indahash say they dont have them, they are not in my wallet and this happened 18 days ago.I'd like to get the ethers either to indahash or back to my wallet.


texts:
I am trying to swap some tokens for ETH in my smart contract. The tokens is already contained by the contract. Here is my code.
function approve(address token, uint amount) external {
        require(IERC20(token).approve(address(uniswap), amount), 'Smart contract approval failed');
    }

    function swapTokenForEth(address token, uint amountIn) external payable returns (bool) {

        //require(IERC20(token).transferFrom(msg.sender, address(this), amountIn), 'Transfer from wallet to contract failed');

        address[] memory path = new address[](2);
        uint deadline = block.timestamp + 600;

        path[0] = token;
        path[1] = WETH;

        //require(IERC20(token).approve(address(uniswap), (amountIn + 10000)), 'Uniswap approval failed');
        uniswap.swapExactTokensForETH(
            amountIn,
            1, //MIN FIXED TO 1 FOR TESTING
            path,
            address(this),
            deadline
        );

        return true;

    }

I first run the approve function and then the swapTokenForEth function, but the latter transaction reverts.
Thanks for the help


texts: How can I see all transferFrom events for ERC20 token using etherscan api?

texts: Is there a way to see all transferFrom() calls/transactions that happen for an ERC20 token using the etherscan api?


texts: Do I absolutely have to do mining to make transactions done on testnet?

texts:
As I know, we don't have to mine to make transactions done in Bitcoin testnet, but in ethereum testnet, we need to mine to make them done.
Are there any ways to make them done without mining?


texts: Call few contract methods from another contract consistently

texts:
Can I call a few contract methods from another contract consistently in one block? The order of methods calls is important!
if (contract.method1.value(msg.value)()) {
   contract.method2(someValue);
}


texts: Can we change truffle to use ether.js instead of web3?

texts: I have been trying to pass string arrays to my .sol function but it is not possible with Web3j. Can i Change Truffle to use ethers.js instead of Web3.


texts: Ethereum and Ledger Size Denial of Service

texts:
Correct me if I am wrong, but if a malicious user keeps creating smart contracts and deploying them onto Ethereum, they would grow the size of Ethereum's ledger. Eventually, people may run out of hard disk space to store the ledger. As people run out of disk space, they drop from the network and the strength of the network diminishes, possibly leading to the system's collapse, thus it is in every user's best interest to keep ETH price point relatively high in order to make deploying a smart contract fairly costly. Is that correct?

Is there a cost associated with the size of the contract you are trying to deploy?


texts: I'm using a Macbook Pro OS X Version 10.9.5 and am unable to get through the syncing phase. "Ethereum node needs to sync, please wait..." is exactly what is prompt but regardless of the time I wait, it's unable to sync. I have the option to skip peer search and start the application but it then isn't synced to my wallet, thus showing 0 Ether in my main account. I downloaded the app 20 days ago and am just getting around to posting for help. Any insight would be greatly appreciated.


texts: Why are my contracts showing as not deployed in Truffle?

texts:
I'm trying to use Truffle to test some contracts by following their docs. As specified, I have installed truffle, testrpc, created the migration contract and worked fine.

Ran truffle compile

$ truffle compile
Compiling ./contracts/User1.sol...
Compiling ./contracts/User2.sol...
Compiling ./contracts/Registry.sol...

Writing artifacts to ./build/contracts

and truffle migrate

$ truffle migrate
Using network 'development'.

Network up to date.

and both seemed ok.

The problem was running trying to interact with a contract using truffe console

$ truffle console
Unexpected error: Cannot provision contracts while instantiating the console.
: Unexpected end of JSON input
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:213724:27
    at tryToString (fs.js:456:3)
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:443:12)
truffle(development)> User1.deployed()
ReferenceError: User1 is not defined

If it helps, the structure of the dir is

├── build
│   ├── Icon\r
│   └── contracts
│       ├── ConvertLib.json
│       ├── User1.json
│       ├── Icon\r
│       ├── MetaCoin.json
│       ├── Migrations.json
│       ├── User2.json
│       ├── Registry.json
│       ├── Storage.json
├── contracts
│   ├── User1.sol
│   ├── Migrations.sol
│   ├── User2.sol
│   ├── Registry.sol
├── migrations
│   ├── 1_initial_migration.js
│   ├── 2_user1_migration.sol
│   ├── 3_user2_migration.sol
│   ├── 4_registry_migration.sol
│   └── Icon\r
├── test
│   ├── Icon\r
│   ├── TestMetacoin.sol
│   └── metacoin.js
└── truffle.js

How can I fix this?


texts: Storing private data off-chain with a sharing feature upon request

texts:
My question is not very technical from an implementation point of view, but I am looking for advice to achieve a specific use case using blockchain tech. I would greatly appreciate any insights or advice!

UserA saves an encrypted file to some off-chain blob storage
A URI and hash of the encrypted file is stored on chain as proof of existence
The fact (through some means) that UserA has saved this information is public
Some other user (i.e. UserB) requests access to UserA's file (potentially in exchange for a payment)
UserA gives UserB permission to access this file

The problem is that the file is encrypted with UserA's private key. The only way for UserB to gain access to UserA's value after a request and payment has been made is to wait for UserA to become active, see the request, download the file, decrypt it and send it directly to UserB through some other channel.

Is there any way have the file be stored securely, but also accessible to any other user immediately after a payment has been made without UserA's intervention?


texts:
I am going through some code and I have seen:
const message = Web3.utils.soliditySha3(
      {t: 'address', v: recipient.address},
      {t: 'uint256', v: recipient.totalAllocation.toString()}
    ).toString('hex');
// see t and v above
const web3 = new Web3('');
const { signature } = web3.eth.accounts.sign(
    message,
    process.env.PRIVATE_KEY
);

What are "t" and "v" in web3.utils.soliditySha3()? What do they do? What do they mean?
I have gone through the web3 docs but they do not say much.


texts:
I am confused why the following code is not working. Any help would be greatly appreciated.

pragma solidity >=0.4.22 <0.6.0

contract InsuranceClaimFactory{
    address public claimer;
    address[] public deployedInsuranceClaim;
    function createInsuranceClaim () public {
        address newInsuranceClaim = new InsuranceClaim(msg.sender);
        deployedInsuranceClaim.push(newInsuranceClaim);
    }

    function getDeployedInsuranceClaims () public view returns (address[] memory){
        return deployedInsuranceClaim;
    }
}

The constructor for InsuranceClaim is

constructor (address creator) public {
claimer=creator;
}

The error is

  TypeError: Type contract InsuranceClaim is not implicitly convertible
  to expected type address


texts: Miner and Validator, who can validate a contract?

texts:
I am still confused with the process from creation to validation of transaction or contract verification. Actually the terminology makes me confused such as voter, validation, miner, honest node, fraud node, peers who are related with validation and so on.

What is a validation and verification of transaction? I have tried to find any information of them, but it is not a clear information.

My question is that after mining, who will verify and/or validate this transaction and if so, who can be a validator. Is a validator a honest node?
Who can decide a honest node or fraud node.
Thank you.


texts:
I want to build a trading website based on ethereum and Web3. What I should take care of while building such platform ?.how will my transactions update ethereum?

Please advice.

thanks in advance


texts: How many contract are currently deployed on the Ethereum blockchain?

texts:
I was recently asked what percentage of transactions represent smart contract deployments on Ethereum, and had no immediate answer.

It is probably easier to ask how many contracts are currently deployed on Ethereum - I had a look around at Etherscan but couldn't find any statistics of direct relevance. I am aware of this answer, but ether.camp appears to only show a real-time list of contract deployments and no summary stats.

Are there any estimates on the number of contracts deployed, and if so, what sources are available to monitor such developments?


texts:
I am trying to build a decentralised eCommerce application prototype for a university project and my background in programming languages such as Java is not so great. I am trying to use Ethereum and ERC20 to enable users of this Dapp to trade with one another directly similar to eBay or Amazon but a server-less system using the power of distributed ledger and blockchain. can anyone give me some advise where to start from as there are not much material online to learn from. this prototype however, will be used to demonstrate it to a real client and investors which I already manage to secure. If anyone is interested to join me please get in touch!

Many Thanks
Mays


texts: Are there identifiers for smart contracts?

texts:
Say I want to reference another smart contract in my smart contract.

Do smart contracts have an identifier (like a number 0xjdjdjdjdjjddj etc.)? And if they don't, how would you reference a particular smart contract.


texts: Generate keystore file from raw private key (using geth)?

texts:
I have my public & private key (generated with MyEtherWallet), however, I forgot to create a keystore file, which would make my online access to the wallet a bit safer if I'm correct.

I got to install geth.exe on my offline computer, and

geth account import e:\rawprivatekey.txt

works, but only returns the public address. I can't seem to get it to regenerate a keystore file! Does anyone know how to do that?


texts: What is the best way to use uniswap without router?

texts:
I just bought a scam token. The liquidity pool is still there but I couldn't sell because I couldn't approve the token in Uniswap. When I try to approve, the error "execution reverted: ERC20: approve from the zero address" appears on the javascript console. There may be something shady in the approve function. However, I found that a front-running bot was able to sell the token without approval. It seems the bot just calls the swap function and transfers the tokens.
The sell transaction is this.
Can I do the same with Etherscan's writeContract?
Or can I do that with javascript SDK? Or should I deploy a contract like the front-running bot?
Any input would be greatly appreciated.


texts: The transaction failed because of low gas but my eth was not refunded on mew

texts:
I used mew to swap eth for btc to send them to an ico. The transaction failed because of low gas but I did not get my eth back and my balance is showing as zero.

TxHash:0x65d0f371cdf394943b98efb1b697bb591ea6ac3d9a081937b90d4105f3ad4959

How will I get my eth back?


texts:
I'm using node library with web3.js, big number, and ethereumjs-tx, and I can get the "buy" orders that use either solidity function ethToTokenSwapOutput or tokenToEthSwapOutput to work great. But I can't figure out what I'm doing wrong with the "sell" orders - where you are selling a certain amount of eth or tokens and your inputs are the minimum tokens or min eth to receive in return.

this is one of the solidity functions I'm trying to solve for but always reverts;

function tokenToEthSwapInput(uint256 tokens_sold, uint256 min_eth, uint256 deadline) external returns (uint256  eth_bought);

this is the JS code i'm using (and the public key is already added to the exchange ERC20 contract as approved

//converts ETH to TOKEN
async function calcEthSell(inputAmt, address) {
    let outputReserve = await getERCBal(address); //token pool size of exchange - separate function in above code
    let inputReserve = await getEthBal(address); //eth pool size  of exchange - separate function from above code
    let numerator = inputAmt * outputReserve * 997;
    let denominator = (inputReserve * 1000) + (inputAmt * 997);
    let output = numerator / denominator;
    //output is amount of tokens bought using input Eth
    return output;
};

//sell a set amount of ETH to purchase unknown amount of ERC
async function sell_input_ETH_output_ERC(input) {
    const price = await calcEthSell(input, exchangeAddress);
    const soldEth = input * (10 ** 18);
    const minTokens = Math.round(price * (10 ** 18) * .98); //2% out of market as minimum
    console.log(soldEth);
    console.log(minTokens);
    let deadline = new Date(Date() + 300 * 60000) / 1000;
    const encodedEthABI = await exchangeContract.methods.ethToTokenSwapInput(BigNumber(minTokens), deadline).encodeABI();
    const transactionNonce = await web3.eth.getTransactionCount(fromAddress, "pending");
    const transactionObject = {
        nonce: web3.utils.toHex(transactionNonce),
        gasLimit: web3.utils.toHex(90000),
        gasPrice: web3.utils.toHex(3 * (10 ** 9)), //' gwei
        to: toAddress,
        from: fromAddress,
        data: encodedEthABI,
        value: web3.utils.toHex(soldEth)
    };
    const tx = new Tx(transactionObject, {'chain': 'mainnet'});
    tx.sign(privateKey);
    const serializedEthTx = tx.serialize();
    web3.eth.sendSignedTransaction('0x' + serializedEthTx.toString('hex')).on('transactionHash', console.log)
    .catch(console.log);
}

//sell .1 eth as example
sell_input_ETH_output_ERC(.1);

this always reverts back for some reason


texts: How Do I Compile a Smart Contract from GitHub?

texts:
Our Smart Contract developer has provided our smart contract repo via GitHub
The GitHub repo has the following folders:
-keys
-scripts
-src
And these files:
-.gitignore
-Disclaimer.md
-LICENSE
-README.md
-terms.md

In my Mist wallet (v 0.9.2) I have a section to paste my solidity code but the folders have many files

How do I compile and deploy my smart contract?


texts: Is there a way to cancel a transaction without having to pay a gas fee?

texts:
Is there a way a cancel a stuck transaction without having a pay a gay fee?
Or does any successful transaction, except the ones sent from the same account with the same nonce, requires paying gas fees?


texts: Calling a payable contract function from truffle console

texts:
Let's say I have this function is a contract, that should enable users to deposit ETH into the contract, and have the contract manage their deposits

function deposit() payable public {
    balances[msg.sender] = balances[msg.sender].add(msg.value);
    totalBalances.add(msg.value);
}

Now that I have the contract deployed, how do I call this function from the truffle console? That is, with ETH attached.


texts: CLI wallet where I can pass in a Private Key and send out ETH and then delete this key?

texts: Is there a CLI command where I can pass in an ethereum private key and send some coins to another address? I'm trying to build out a reoccurring payment system where a user can send 1 eth to another address every week. But I'm looking for a wallet via the command line that can pass in a private key to do the send out. What are the best options?


texts: Why the DAO contract have two reward accounts?

texts:
I read in the DAO source code ( https://github.com/slockit/DAO ) that there are two managedAccounts for rewards called: rewardAccount and DAOrewardAccount.

I see that the first one is to pay to any rewardToken holder and the second one is to pay to other DAOs that also holds rewardTokens.

I would like to know what are the differences of this two accounts? What are the motivation of having this two accounts? In what situations will be used one and in what situations will be used the other?

EDIT:

After studying the code, I wrote this post about the DAO accounting. I just put the link here for reference:

Understanding the DAO accounting


texts: size of blockchain on hard disk for ethereum light clients

texts:
whats the size of block headers ( minified blockchain) that ethereum light clients are using?
how much is the size of the blockchain data required for the light clients to do a transaction and veryfy the data in contract?


texts: How can I transfer tokens of my ERC20 automatically from the server?

texts:
I deployed an ERC20 contract. I want to send tokens to other addresses without my manual sign.
How can I transfer tokens from my wallet automatically from the server? (via php for example)
Thanks.


texts: Does Rinkeby have a faucet where I can fill a wallet with DAI?

texts: I'm looking to use a testnet to test an application. I know I can get ether, but is there an easy way I could convert it to Dai? Thanks