texts:
As I know that there is no competition for mining new blocks in POA blockchain as each node mines new block at its given time slot.
I have a parity PoA blockchain setup with 5 nodes.
While examining the blockchain, I can see some blocks with Uncle blocks.

Why are there uncle blocks in PoA blockchain?


texts:
using below to mine

ethminer --farm-recheck 200 -G -S asia1.ethpool.org:3333 -FS us1.ethpool.org:3333 -O a9a777fc5cfc9589e413635b0b878ae4061fda2

but it said

  'Invalid argument: -S'

Any suggestion, thanks


texts: Apply fees when sending an NFT to another wallet

texts:
I want to create a NFT with solidity. There are builtins functions in ERC721 which allows me to transfer a NFT to another wallet.
Here is what i want to do: I want to apply Ethereum fees when an NFT is transfered. This fees should be transfered to the contract's wallet.
Is it possible to do that ?
Thanks


texts: What are the best practices to allow user signup and login for a dapp?

texts:
From what I have researched, it seems that all of the methods for allowing a user to signup and login for an Ethereum dapp are very cumbersome for the user to use. What are the best practices to allow signup and login that match the following criteria:

The method for signup and login should not be cumbersome; ie: simple
as normal methods of username/password or facebook and google oauth.
The method for signup should not charge the user any ethereum (gas)
    - taking someone's money just to signup would put off most people.
The method of signup and login should not make the user jump through
hoops such as,
    a) entering email
    b) downloading a mobile app
    c) entering a wallet address
    d) waiting for authentication confirmation
    e)entering a code back on the signup screen, etc.
Extra software like MetaMask or Mist should not be required. (Maybe this is not possible?)

The goal here is to remove as many hurdles as possible to get users to the dapp.


texts: Why is this a potential violation of Checks-Effects-Interaction pattern?

texts:
That's what Remix is telling me. Now when I look at the documentation as to what this means it seems to be talking about, as I understand it, recursively entering a control flow (if):

  Ether transfer can always include code execution, so the recipient
  could be a contract that calls back into withdraw

Looking at my code I cannot see how this could be exploited, I don't even add the tokens to the receiving account until the end, after requirements, the only thing I can see is that could then go wrong or be exploited is that they wouldn't get their change:

/*
 * Allows a user to buy tokens for Ether.
 */
function buy() public payable {
    // check that the amount of ether sent is greater than 0
    require(msg.value > 0);
    // check the amount sent is enough for at least one token
    require(msg.value >= tokenPriceInWei);

    // NOTE: balance is automatically updated by the payable modifier

    // calculate tokens to be distributed as integer
    uint numToDistribute = msg.value / tokenPriceInWei;
    // calculate remainder to be refunded, e.g. 7.1eth sent, 1.1eth to be refunded
    uint refundableRemainderInWei = msg.value - (toWei(numToDistribute));

    // distribute token to sender
    distribute(msg.sender, numToDistribute);
    // refund the remainder
    msg.sender.transfer(refundableRemainderInWei);

    Bought(msg.sender, numToDistribute);
}

/*
 * Distribute tokens from distributor to a receiver.
 */
function distribute(address _receiver, uint _amount) private {
    // check for at least one token, if not something went wrong
    require(_amount > 0);
    // check for balance overflow, causing incorrect balances value
    require(balances[_receiver] + _amount > balances[_receiver]);

    // decrement from distributor and increment receiver
    balances[distributor] -= _amount;
    balances[_receiver] += _amount;
}

Additionally if anyone can tell me why the gas cost for this method is high to infinite and why it says the same when I try to deploy the contract through Mist and cannot deploy, that'd really make my day!

Thankyou if you read this far and for any advice you can give to this budding smart contract engineer!


texts:
I have a matrix in solidity like that
string x[][]
I'm trying to write functions to return rows and colums
The following code works well:
// SPDX-License-Identifier: unlicensed
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;

contract test {

    string[][] x ;

    function setx () public {
        x.push(["1","2","3"]);
        x.push(["4","5","6"]);
        x.push(["7","8","9"]);
    }

    function getrow(uint256 i) public view returns (string[] memory) {
        return x[i];
    }

    function getcolumn(uint256 j) public view returns (string[3] memory) {

        string[3] memory ret;

        for (uint256 i=0; i < 3 ; i++) {
            ret[i] = x[i][j];
        }

        return ret;
    }
}

Now the real life example is more complex, because the matrix can grow dynamically and the size of the matrix is written in storage variables (size).
// SPDX-License-Identifier: unlicensed
pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;

contract test {

    string[][] x ;
    uint256 size = 3;

    function setx () public {
        x.push(["1","2","3"]);
        x.push(["4","5","6"]);
        x.push(["7","8","9"]);
    }

    function getrow(uint256 i) public view returns (string[] memory) {
        return x[i];
    }

    function getcolumn(uint256 j) public view returns (string[size] memory) { /error here

        string[size] memory ret; //error here

        for (uint256 i=0; i < size ; i++) {
            ret[i] = x[i][j];
        }

        return ret;
    }
}

Here I'm not able to compile. I get the error "Invalid array length. Expected integer literal or constant expression". Is there a simple way to fix this issue?
Thanks
Nicola


texts:
I'm trying to create a map whose key is composed of two bytes32 keys.

I've tried with tuples-keys and struct-keys but both are rejected by the compiler.

I'm also thinking about "hashing" both keys but not sure how to do it.

Any code reference around?

Update

"Digging around" It looks to me that a function like bytes32 hashOfMultiKey = keccak256(abi.encodePacked(i1,i2)); will be "enough" for most purposes, but I'm losing info about the original keys. I'm wondering whether there will be a simpler alternative that keeps all the original info about the input multi-keys.


texts: I'm using Ethereum Wallet with Testnet Ropsten, and the blocks appear to be synced. The "Start Mining" option appears to be greyed out (same in Mist). Any ideas on how to fix this?


texts: Cannot use Metamask with my smart contract

texts:
I am unable to call my smart contract in Metamask over Ganache.

These were the steps I took:

developed the contract
tested it successfully using truffle test
set up a Ganache network and migrated the contract to the network
in Metamask, connected to the private Ganache network and one of the accounts via private key
Then proceeded to make a payment from the account of 5 eth and using another account as the "transaction data" in Metamask (see below - the pay contract expects a single address as an argument)

This is the error I'm getting:

This is how I called the contract:

Pay.sol

pragma solidity ^0.4.17;

/// @title Pay - Facilitates payments.
contract Pay {
    event Payment(
        address _from,
        address _to,
        uint amount
    );

    /// @dev Makes a payment.
    /// @param _to Address to pay to.
    function pay(address _to) public payable {
        require(msg.value > 0);
        _to.transfer(msg.value);
        Payment(msg.sender, _to, msg.value);
    }
}

2_pay_migration.js

var Pay = artifacts.require("Pay");

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


texts: Modify block number when testing with Hardhat

texts:
I see that is it is possible to define the timestamp of the next block (see here) in this way:
await network.provider.send("evm_setNextBlockTimestamp", [1625097600]);
await network.provider.send("evm_mine");

but what about setting the block number?
My contracts use block.number to perform operations and I need to verify that they act correctly by mining a block with a greater height.


texts: Implementation of Oraclize API connector

texts:
Can someone explain to me how, where, and when is the
https://github.com/oraclize/ethereum-api/blob/master/connectors/oraclizeConnector.sol
deployed to ethereum blockchain ?
This is the implementation of doing the queries.
The user only imports the OraclizeAPI https://github.com/oraclize/ethereum-api/blob/master/oraclizeAPI_0.4.sol
in his own contract.
Where does reside the connector implementation? it's not specified in the OraclizeAPI.
Thanks.


texts: Cannot destructure property `interface` of 'undefined' or 'null'. How to solve this?

texts:
const assert = require('assert');
const ganache = require('ganache-cli');
const Web3 = require('web3');

const provider = ganache.provider();
const web3 = new Web3(provider);

const { interface, bytecode } = require('../compile');

let accounts;
let inbox;

beforeEach(async () => {
  // Get a list of all accounts
  accounts = await web3.eth.getAccounts();
  // Use one of those accounts to deploy the contract
  inbox = await new web3.eth.Contract(JSON.parse(interface))
    .deploy({ data: bytecode, arguments: ['Hi there!'] })
    .send({ from: accounts[0], gas: '1000000' });

  inbox.setProvider(provider);
});

describe('inbox', () => {
  it('deploys a contract', () => {
    assert.ok(inbox.options.address);
  });
  it('has a default message', async () => {
    const message = await inbox.methods.message().call();
    assert.equal(message, 'Hi there!');
  });
});


texts: Solidity contract - can the contract check what blockchain it is running on?

texts:
Is it possible for me to add code to my contract to check the blockchain it is running on?

This is for security reasons as I only want to be running on the official Ethereum blockchain.


texts:
Good Time

I'm trying to test a smart contract in local ethereum wallet with connecting to the ganache-cli but when I try to create a wallet contract it gives me an error:

  method personal_signTransaction not supported

I tried both 11.1 and 11.0 version of wallet

help me please


texts: Which semantics are used for old contracts executed now?

texts:
Suppose an old contract is called now that contains an opcode that was invalid then but has some meaning now. What happens when this opcode is executed during a recent transaction: Will execution fail or will the opcode be executed according to the current semantics?
In other words: Are contracts executed with the semantics valid at the time of deployment or with the semantics valid at the time of contract invocation?


texts: Revert()/throw/invalid are so powerful they can even put back an already self-destructed contract, but is there a way to surpass such limitation?

texts:
I know this sounds confusing so let me explain:

In this case below a transaction will succeed and a contract will be first destroyed and then re-initialized on the same address (yes, I didn't think it was possible...but apparently it is):

contract A
{
  address contractb = // some address here
  function first() public
  {
    contractb.call.value(1 ether)();
  }
}

contract B
{
  address contractc = //all addresses should be known beforehand btw.
  function () public payable
  {
    if(contractc.value(msg.value)())
    {
      assembly { invalid } // in fact just "throw;" should do the trick...
    }
  }
}

contract C
{
  function () public payable
  {
    selfdestruct(msg.sender);
  }
}

What I thought will happen:

A calls B, sending 1 ether
B forwards this 1 ether to C via yet another call
Upon receiving from B, C selfdestructs and sends all ether it has to B
B calls back A and 'claims' transaction failed.

what really happened:

A called B
B forwarded to C
Now B sends to C which selfdestructs...however then B re-creates the contract on the same address with same transaction history except...nothing was sent so "invalid" in assembly seems the same as revert(). I thought self-destruct can't be undone but here B had to check if transfer succeeds and if it does it sends all steps back to the very beginning so B even changed destroyed contract(C) to be re-initialized (I am getting this from both etherscan and on remix off-chain - yes, before a block is being written...it's all one transaction having several internal transactions).

Back to my original question: is it possible to prevent the full revert since even selfdestruct can't? What if B deploys new contract from within the code? Thanx!


texts:
I have 0.20.0 installing but not the default 1.0.0. I have Ubuntu 18.04 installed.

Is any special config needed for Ubuntu 18.04 when installing web3 (1.0.0)?

trevor@bridge2:~$ sudo npm install web3
npm WARN deprecated fs-promise@2.0.3: Use mz or fs-extra^3.0 with Promise Support
npm WARN deprecated tar.gz@1.0.7: ⚠  WARNING ⚠ tar.gz module has been deprecated and your application is vulnerable. Please use tar module instead: https://npmjs.com/tar

> scrypt@6.0.3 preinstall /home/trevor/node_modules/scrypt
> node node-scrypt-preinstall.js

Error: Error: Command failed: ./configure
configure: error: in `/home/trevor/node_modules/scrypt/scrypt/scrypt-1.2.0':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

> scrypt@6.0.3 install /home/trevor/node_modules/scrypt
> node-gyp rebuild

gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/trevor/node_modules/scrypt/build'
gyp ERR! System Linux 4.15.0-38-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/trevor/node_modules/scrypt
gyp ERR! node -v v10.14.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN package.json@1.0.0 No description
npm WARN package.json@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scrypt@6.0.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scrypt@6.0.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/trevor/.npm/_logs/2018-11-30T11_32_53_368Z-debug.log
trevor@bridge2:~$ sudo npm install web3@0.20.0
npm WARN package.json@1.0.0 No description
npm WARN package.json@1.0.0 No repository field.

+ web3@0.20.0
added 4 packages from 6 contributors, removed 276 packages, updated 1 package and audited 127 packages in 4.686s
found 0 vulnerabilities


texts: Passing data between two Ethereum networks

texts:
I have some IoT(Internet of things) nodes sharing the received data from sensors with each others. I partitioned them to 2 permissioned networks:
Network 1 includes: X,Y,Z nodes trusting each other,for example,.
Network 2 includes: M,N,O nodes trusting each other.
In addition to overall smart contract for each network 1 and 2,

Can I write an individual contract which is special for each node of network( a smart contract for each node)  for doing particular act in special time, such as sending data to the another node of another network in special time?
Regards,
Siamak


texts: light-weight clients and private blockchain?

texts:
I am well aware of the utility of light-weight clients on a ethereum.

Yet, for a private blockchain, which contains a limited number of users, I find it wrong.

Let's say we have a private blockchain of 30 accounts, in which only 2 or 3 have downloaded the entire blockchain, and the rest are light-weight clients. Won't that be against the basics of blockchain and decentrilized apps which states that a copy of the ledger should be replicated to all nodes ?


texts: Error: A "infuraKey" or a "rpc" object with a parameter of 1 must be included in the WalletConnect initialization object

texts:
I'm starting to develop https://pooltogether.com/ in docker environment. I cloned their repo https://github.com/pooltogether/pooltogether-pool-builder-ui and follow the readme instructions.
In .envrc file I added 2 keys; the NEXT_JS_INFURA_ID and ALCHEMY_API_KEY. I can open the npx hardhat node --fork https://eth-mainnet.alchemyapi.io/v2/$ALCHEMY_API_KEY, and run npx cypress open successfully.
So I go straight to yarn dev, I can access the ui, but when I click connect wallet I got this error as titled. I looked everywhere for the file that calls and will be consuming the infuraKey but still not sure how to supply the key if not with .envrc file. or is it anything to do with the parameter of 1?
from the call stack node_modules/@pooltogether/bnc-onboard/dist/esm/wallet-connect-ee7f8113.js (28:0)
Is it this var walletConnectIcon that I have to find how to supply values for options object?
    function walletConnect(options) {
    var _options$mobile;

    var infuraKey = options.infuraKey,
      rpc = options.rpc,
      bridge = options.bridge,
      preferred = options.preferred,
      label = options.label,
      iconSrc = options.iconSrc,
      svg = options.svg,
      networkId = options.networkId;

Any help is appreciated. Thanks!


texts: Why does the contract deployment code of a specific contract saves an address to storage?

texts:
The contract in question can be found on the mainnet at https://etherscan.io/address/0x61dc347d7fA0f6e34c3112fAF83a2e468D681F68#code.

This looks too good to be true, free money, so something must be up.

The (current) storage looks like:

getStorageAt(address, 0) = 0x00000000000000000000000060da28631ec462cad5b9f30fc9fb58e13ebfcdd8
getStorageAt(address, 1) = 0xb09982f0abd48c53f7be8cc09b2fb3e0b81936246a6d5c0c60cb7a85544e1414

The value at offset 1 is set by a transaction, but I do not understand where the value at offset 0 comes from. Note that this value is equal to the from-address of the contract creation transaction.

After compiling the code using Remix and double checking the bytecode it seems to be all correct (the fact the source is verified already suggested this of course).

One of the opcodes in the contract deployment code is:

0005 PUSH20 60da28631ec462cad5b9f30fc9fb58e13ebfcdd8

This is exactly the address that ends up in storage.

My questions are:

Why does this address pop up in the bytecode to start with?
How can it be that apparently someone has control over this address? (See https://etherscan.io/address/0x60da28631ec462cad5b9f30fc9fb58e13ebfcdd8)

I might be missing something trivial, but it is kind of bothering me.


texts:
I've downloaded mix for OS X from here:
https://github.com/ethereum/webthree-umbrella/releases

but every time I try to open it, it stops, and I get the error "mix quit unexpectedly"

I've tried downloading different versions, but the same thing happens every time.

How do I fix this?


texts: Need only sign transaction feature (not send transaction)

texts:
I am developing an online store BNB as a payment. Customers will sign transactions using Metamask and then frontend code(js) need to post call to our backend server with the txHash, and then we will broadcast the transaction to the network using our backend service.
But I am not able to find it using web3.js( web.eth.account.signTransaction() will not work in my case as we don't customer private keys).
I Need to know how to with web3 or with Metamask js library, any example of code will be helpful.


texts:
I'm tinkering with Ethereum tokens to & their associated contracts. I'm getting my head around  all but want to clarify my understanding with you (posting here in the view that it will also be of use to someone else):

1- you create a token (i.E: mrt token) which can be either fixed supply or minted (along with other controls such as freezing & seizing, etc).

You can at this stage trade mrt tokens between accounts but cannot exchange them for say Ether.

2- set up a democratic association (or undemocratic depending on your requirement). This defines the rules to which the token operates.

3- create a crowdsale - this sets the framework for your token to be converted into other currency such as ether

I've got a feeling I'm 95% right but I'm missing something somewhere?


texts: Does Etherscan store all the events and transaction history?

texts:
To get the history of a transactions for an account, we have to traverse the whole chain everytime, but etherscan provides the entire history of all the accounts instantly.

Similarly it does the same thing for smart contracts, it gives all erc20 transaction history by giving us the whole 'Transfer' event log.

I was exploring Etherscan and was trying to implement these functionalities for a private network and was trying to find if these are some build-in functionalities to achieve this but it seems like it isn't.

There are several of these ether chain explorers and they are showing all the tokens in any particular wallet, hence keeping track of all token transfers from all public contracts. Now that is a lot of data tracking.

Also I couldn't find out how they are monetizing this service.

So, Is my assumption true?? How they do it. For the usage of similar features in private network, do I have to save and keep track of everything too?


texts:
I'm having troubles when estimating the gas to call to one of the methods of my contract deployed in kaleido.

I've successfully deployed the contract through Remix. Also from Remix I can call all my methods and they are working ok. From web3js I've instantiated it, and I can check the balance of my accounts from within web3js (1.0.0-beta.47), but when estimating the gas to call one of the methods of my contract I am getting the error "The method eth_chainId does not exist/is not available".

The code:

const provider = new Web3.providers.HttpProvider("https://<USER>:<PASS>@<NODE RPC ENDPOINT>");
const web3 = new Web3(provider);
const deploy = web3.eth.accounts.privateKeyToAccount(<ACCOUNT PRIVATE KEY>);
const contract = new web3.eth.Contract(contractAbi, contractAddress, { gasPrice: 1, gas: 4500000 });
var estimatedGas = await contract.methods.myMethod().estimateGas({ from: deploy.address });

The error:

Error: Node error: {"code":-32601,"message":"The method eth_chainId does not exist/is not available"}

Any idea what's is wrong?


texts: Make Hyperledger Besu sync faster during DOS blocks

texts:
I am attempting to sync a full node using Hyperledger Besu and it has slowed down considerably when hitting about block 2,300,000.
Geth and Parity can be made faster as this link details to sync these as detailed her:
Why did the Fast sync stop at 2.4 million blocks when updating my Geth?
What are the best settings for Besu?


texts: Create a Signed Transaction(ERC20) does not work in Objective-C

texts:
I have implemented swift Library in my Objective-C code.
Here is the code which I have implemented to send ERC20 tokens.

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSError *error;

// Setting your node address
NSURL *nodeURL = [[NSURL alloc] initWithString: @"https://ropsten.infura.io/v3/key"];
W3Web3 *node = [[W3Web3 alloc] initWithUrl: nodeURL];
[W3Web3 setDefault: node];
W3Web3 *web3 = [W3Web3 default];
web3 = [web3 initWithInfura:W3NetworkId.ropsten];
//NetworkId.ropsten.objc
NSString *password = @"";

NSData *privateKey = fromHex(@"private key");
W3EthereumKeystoreV3 *keystore = [[W3EthereumKeystoreV3 alloc] initWithPrivateKey:privateKey password:password aesMode:@"aes-128-cbc" error:&error];

W3KeystoreManager *keystoreManager = [[W3KeystoreManager alloc] initWithEthereumKeystores:@[keystore]];

// Getting your address
//W3Address *yourAddress = [[keystore addresses] firstObject];
W3Address *yourAddress = keystore.addresses.firstObject;
NSLog(@"%@",[yourAddress description]);

// Adding keystore to the default provider
[web3 setKeystoreManager: keystoreManager];

// ERC20 abi. Contains information about its functions
NSString *erc20Abi = @"erc20Abi";

W3Address *contractAddress = [[W3Address alloc] initWithString:@"Contract address" type:W3AddressTypeNormal];

W3Contract *contract = [[W3Contract alloc] init:erc20Abi at:contractAddress error:&error];
NSLog(@"%@ %@",[error description], [contract description]);

// Setting sending options
// You can also customize gasPrice and gasLimit here
W3Options *options = [W3Options default];
W3UInt *gasPrice = [[W3UInt alloc] init: @"3" units: W3UnitsGwei];
W3UInt *maxGasPrice = [[W3UInt alloc] init: @"200000" units: W3UnitsGwei];
//W3UInt *nonce = []
options.from = yourAddress;
options.gasPrice = gasPrice;
options.gasLimit = maxGasPrice;

NSString *recipient = @"from address";
NSString *amount = @"1";

// Creating transaction
W3EthereumTransaction *transaction = [contract method:@"transfer" parameters:@[recipient, amount] extraData:nil options:options error:&error];
[transaction UNSAFE_setChainID:W3NetworkId.ropsten];
NSLog(@"%@ %@",error.localizedDescription, transaction.description);

// Signing transaction
[[web3 wallet] signWithTransaction:transaction account:yourAddress password:password error:&error];

// Sending transaction
W3TransactionSendingResult *result = [[web3 eth] sendTransaction:transaction options:options password:password error:&error];

//W3TransactionSendingResult *result1 = [[web3 eth] sendRawTransaction:transaction error:&error];

    NSLog(@"%@ %@", [result description], [error description]);
}

I get below Transaction details when I put log for W3EthereumTransaction

  019-01-07 16:04:09.875093+0530 Test[685:127019] (null) Transaction
  Nonce: 0
  Gas price: 3000000000
  Gas limit: 200000000000000
  To: to 0X0X
  Value: 0
  Data: a9059cbb000000000000000000000000data0000000000000000000000000000000000000000000000000000000000000001
  v: 1
  r: 0
  s: 0
  Intrinsic chainID: Optional(ropsten)
  Infered chainID: Optional(mainnet)
  sender: nil
  hash: Optional(32 bytes)

So here are my questions :
1) How to change Transaction Nonce?
2) To address is wrong in to address it shows contract address
3) Why Value is 0?
4) chainID I need to use ropsten not mainnet right now it shows both.
5) Why Seder is nil?

Thanks in advance,


texts: How to call js command via solidity contract?

texts:
we are clear that in geth console we can add another peer with addpeer command such as

admin.addPeer("enode://41bd7d2fe91b344f0ca4ac89c217d688ef90a3616927acec428adddbc69dd2ac5470a489fd2beb67719cbd481436b98284ef9eac50efa49f55fe33e804818520@10.0.50.91:30303")

so, my question is how to add another peer in solidity contract or how to call the js command via solidity contract?
The solution maybe via modifying the source codes ,but how to modify the codes ? I need a hand to solve the problem.thank you.


texts:
How can I get truffle to compile contracts over my local testrpc setup without an internet connection for test purposes.

I do not have the privilege of internet access at home, but I prefer working at home. When deploying a contract via truffle with internet connection everything works fine.

Running "truffle deploy" without internet connection gives me the following error.

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

So I run "testrpc" then on a separate console I navigate to my project folder and run "truffle depoly". This works with internet connection, but gives error, when not connected to an internet connection.

truffle.js

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

How can I deploy contracts without internet connection on my local testrpc?

Update on System information:

OS: Windows 7 Profession Service Pack 1
Truffle v4.0.0 (core: 4.0.0)
Solidity v0.4.18 (solc-js)


texts: swapExactTokensForTokens ignore amountOutMin parameter

texts:
In the token swap I am receiving less amount of the output token than that indicated in the parameter "amountOutMin". This is expected, because the token that I am swaping has a tax of 9%. What is not expected is that the transaction occurs. The transaction had to fail with "INSUFFICIENT_OUTPUT_AMOUNT". Since I am receiving less amount of tokens than the one indicated in the parameter "amountOutMin".
The token has 18 decimals (https://bscscan.com/token/0xf7469bad4e3da85b15b02a0dcfadb2c2d219a4b7)
Transaction: https://bscscan.com/tx/0xf8c1af25b432892f7c87ce57beacb938300ce7d6563cf17574ad8ec5e091ab85
Received: 3271.126023249240379059 tokens
amountOutMinParam: 3594640386952184892933 (18 decimal: 3594.640386952184892933)
The transaction has occurred even when the amount of output is less than amountOutMin. It seems that there is something important that I am not understanding.


texts: how to parse values returned by one contract into another?

texts:
I've two contracts deployed one is UserRegistration and another is Exam

I've getUser(uint id) method to fetch data of particular user using users mapping,

function getUser(uint _id) public constant returns(uint,string,string,uint,uint) {

  User memory c = users[_id];

  return(
  c.id,
  c.name,
  c.class,
  c.age,
  c.pincode);
}

Now, I've another contract Exam in which I want to call getUser() function from UserRegistration contract so, I've done it like this,

pragma solidity 0.4.25;

contract UserRegistration
{
    function getUserCount() public returns(uint);
    function getUser(uint) public returns(uint,string,string,uint,uint);
}

contract Exam
{
    address private addrUsr;
    uint public count;
    UserRegistration r;
    constructor(address _addrUsr)
    {
        addrUsr=_addrUsr;
        r = UserRegistration(addrUsr);
    }

    function updateCount() public {

        count=r.getUserCount();
    }

    function getUserData(uint _id) public
    {
        //WHAT to do HERE//;
    }

}

But, how to parse the values returned by getUser() function into getUserData() so that if I call getUserData() function it should return all the values returned by getUser(), and as the values returned by getUser() function are of different data type I can't store them in an array.

Please help me


texts:
Some Ethereum ICO's have you sign up, log in and give all the members a different ETH address to deposit to.

But with no equivalent bitcoin-cli 'move' function to internally move bitcoin within your own node for free then does that mean these ICO's have to pay gas just to move the ETH around in their own ETH node? Note: The bitcoin move function instantly moves the BTC around your own node for free.

-- side note: I do know some ICO's just have one address that uses the smart contract to automatically send out the tokens to the ETH wallet which sent the ETH.

Any thoughts on this?


texts: How growing contract storage increases the gas spending?

texts:
I have some further questions about this and this threads.

For simplicity, let's imagine that I want to create a cryptocurrency on top of ethereum.

The contract that "handles" this cryptocurrency will have a mapping that will associate addresses to balances.

Now, let's imagine that this turns out as a very popular currency, used by millions of people around the world, making billions of transactions per year.

As more and more people starts "registering" to use this coin, the storage use of the contract grows indefinetly.

Questions:

How much of the storage needs to be loaded in memory in order to make
the contract execute?
Does the size of storage influence the amount of memory needed to execute it?
Is all this data always stored in the chain data? Or some of it goes to the state data?
How exactly an increasing contract storage also increases gas spending?


texts:
this might sound stupid for some, maybe even hilarious, have a laugh but please be kind when replying:
the question: is there a way to contact or send a message to an ETH-address?
my issue: I only just recently noticed, that I managed to send my ETH balance to a wrong address. Yup, I actually did that. I checked on etherscan.io and the balance is still there, so I guess the address has no idea that it received ETH coins... Any ideas on how to contact creator of the addresses?
You might ask why: well at best to get my ETH back (yes I actually think that to be a possibility) and at least to let the person know about the balance...
cheers


texts: How to make miner to mine only when there are Pending Transactions?

texts:
As of now the geth miner running on my system mines even empty blocks.
All i wanted is miner should mine only when there are Transactions to mine, after mining the miner should immediately sleep.

How to achieve this?


texts: What Is Done In The Signing And Posting In An Ethereum Transaction?

texts:
If I sign an ethereum transaction, what am I signing? Am I signing something like {send: 123456, to: deadbeef2345}, or something else? What is it? At the same time, what do I do to my signed transaction? What exactly do I send?

I would like a detailed explanation for a programmer, or a link to one. Thank you.


texts: abigen error : Failed to generate ABI binding: unsupported arg type: tuple

texts:
Hello I 'am trying to generate Go ethereum binding for a smart contract in which I have a function that takes a struct as argument.
It seems that abigen doesn'tsupport this argument.

struct Device
{
    bytes16 UUID;
    bytes16 hardware_UUID;
    string phone_Number;
}

function SaveDevice(Device memory device) public returns (bool)

{
    Device_Table[device.UUID]=device;
    Device_HardTable[device.hardware_UUID]=device;
}

Is there any ssolution for this problem?


texts: How to check if blockchain is downloading correctly or not?

texts:
I've few questions:

1) How to check Eth chain is downloading or not?

2) Does chaindata folder contain the whole blockchain?

3) How to check if blockchain downloading is completed?

4) After blockchain is downloaded, How to keep it synced on server all the time?


texts: How can I use truffle to deploy my contract to a local testnet (not testrpc)?

texts:
I followed the steps in the following link to create a local Ethereum testnet, but now I want to deploy a contract to "MyTestNetNode":

https://medium.com/@WWWillems/how-to-set-up-a-private-ethereum-testnet-blockchain-using-geth-and-homebrew-1106a27e8e1e

testrpc wasn't a good option because test rpc doesn't save the state when you stop the daemon. I need to create a testnet with geth which I have already done and I would like to deploy a contract to it using Truffle without getting errors. Can anyone help me?


texts: timed commitment using ethereum blockchain

texts:
I read this paper: https://eprint.iacr.org/2013/784.pdf

that introduces the idea of Bitcoin-based time commitment scheme. In which if the commiter does not open his commitment before a specific time t, the other party can fine him some bitcoins so the committer is enforced to open the commitment before time t. Is that kind of time commitment is available using etherum smart contacts?

This article speaks about commit and reveal on etherum https://medium.com/gitcoin/commit-reveal-scheme-on-ethereum-25d1d1a25428


texts: API node js with call and send to a contract without metamask

texts:
I am new in Solidity. I'm trying to create a API in node js, which can be use without a navigator like chrome with MetaMask. I would like to test it with postman.
But i have some problems with web to get accounts. Actually it returns me en empty array. And I show you my code, if you have some better way to create my api, like good practice i take it.

this is my web3.js :

var Web3 = require('web3');

let web3;

if (typeof window !== 'undefined' && typeof window.web3 !== 'undefined') {
    web3 = new Web3(window.web3.currentProvider);
} else {
    const provider = new Web3.providers.HttpProvider(
        'https://rinkeby.infura.io/v3/913ea7dd990444a58cc903fb97acc4a8'
    );
    web3 = new Web3(provider);
}

module.exports = web3;

and this is my server.js api

var express = require("express");
var app = express();
const factory =  require('./ethereum/factory.js');
const web3 = require('./ethereum/web3');
const contract = factory.contract;
const { check, validationResult } = require('express-validator');

var bodyParser = require('body-parser');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));

app.listen(3000, () => {
    console.log("Server running on port 3000");
});

app.post("/mandat", [
    check('firstname').isLength({ min: 1 }).isAlphanumeric(),
    check('lastname').isLength({ min: 1 }).isAlphanumeric(),
    check('hash').isAlphanumeric(),
    check('budget').isInt(),
    check('located').isLength({ min: 1 }).isAlphanumeric(),
  ], async (req, res) => {

    const errors = validationResult(req)
    if (!errors.isEmpty()) {
        return res.status(422).json({ errors: errors.array() })
    }
    const firstname  = req.body.firstname;
    const lastname = req.body.lastname;
    const hash = req.body.hash;
    const budget = req.body.budget;
    const located = req.body.located;
    const signedDate = req.body.signedDate;

    const accounts = await web3.eth.getAccounts();
    console.log(accounts[0]);
    try {
        await contract.methods.createMandat(lastname, firstname, hash, "fefe", located, "fsfsfs", "a").send({
            from: accounts[0]
        });
    } catch (err) {
        res.json({message : "La creation du mandat a echouer avec l'erreur suivante : '" + err.message + "'"})
    }

    res.json({message : "Creation d'un mandat reussie, la cle pour obtenir l'adresse est " + "a"});
});

app.get("/mandat", async (req, res) => {
    const index = req.query.index;
    try {
        const result = await contract.methods.getOneDeployedMandat(index).call();

    } catch (err) {
        res.json({message : "La recuperation des donnes du mandat a echouer avec l'erreur suivante : '" + err.message + "'"})
    }
});

In my first route in post, getAccounts return me an empty array.

In my second routes in get, the method in contract return 6 variables, but i don't know how to get them.

Thanks you for your help and sorry for my bad english


texts: Does a smart contract have a private key?

texts: Does a smart contract have a private key ? Can it send the result of exucuting his code to the other nodes ?


texts: How to translate Timestamp to readable format? E.g. 1525344824207849500

texts:
How to translate Timestamp to something readable? E.g. 1525344824207849500

var blocknumber = web3.eth.blockNumber;
var blockHash = web3.eth.getBlock(blocknumber).hash;
var timestamp = web3.eth.getBlock(blocknumber).timestamp;

Nathan Aw


texts:
I have a Ropsten test node up and running.

When I check the block height on etherscan.io, it's different from the block number on my node.

How is this possible?
Please help.


texts: Is it possible to have indexed bytes32 argument in an event?

texts:
I have an event with two indexed arguments orderId and status. Filtering works fine when I filter the event on orderId which is uint.

I am not able to filter the events on the second argument (status) which is bytes32

event StatusChange( uint indexed orderId ,bytes32 indexed status );

I try to filter the StatusChange event

On executing the below code I get all the StatusChange events . I want to get only those events where the status is "New"

myContractInstance.StatusChange({status:"New"}, { fromBlock: 0, toBlock: 'latest' }).get( function (error, log) {
    if (error)
        console.log('Error in myEvent event handler: ' + error);
    else
        console.log('myEvent: ' + log);
});

Please help me know what am I doing wrong here.


texts: My private ethereum block gas limit decrease when mining

texts:
I set 'genesis.json' like this.

...
"gasLimit":"0x30479e80",
...

It's 810,000,000 at decimal.
But when I run the blockchain and start mining,
the block gas limit decrease.

I'm using
Geth/v1.9.7-unstable-a73f3f45-20191003/linux-amd64/go1.13.1

I can't find such kind of error examples. Do you know why and how can I fix it?


texts: call another contract in remix browser does not work as expected

texts:
I am not expert in Solidity. I am trying to call a function to another contract so that it updates values but it does not. I am using online Remix Browser.
The contract to be called is Supreme. I can see that getter and setter values are working as expected. The caller contract is Hack. If Sneak function from Contract Hack sends 1 ether more than the value of cost then  the sender becomes big . For example, if Sneak calls function Supreme with Cost = 2 ether then Cost becomes 2 sender replaces takes the position of 'big'.
When I pass address from first contract to Caller contract and give 2 ethers in value. Click on setter, then I check cost, it remains 1 ether. I tried so many ways but I am not able to move forward.

contract Supreme {
    address public big;
    uint256 public cost;

    function Supreme()
      public
    {
        big = msg.sender;
        cost = 3 ether;
    }

    function Road()
      external
      payable
    {
        require(msg.value >= cost);
        big.transfer(msg.value);
        big = msg.sender;

        cost += 1 ether;
    }
}

This is caller contract

    import "browser/Supreme.sol";
contract Hack{
Supreme public sup;

Supreme s;
function Hack(Supreme _sup){
    sup = _sup;
}
function sneak(address addr) public payable{
 s.Road.value(msg.value)();
  }
   function() payable{
   s.Road();
   }
}


texts: How to add gas to a Truffle generated account imported to MetaMask

texts:
I am a beginner and was building a dapp using truffle unbox react. In my app, I was just taking input of a string and printting it using a simple contract.

Everything is working fine. But, when i give input and set my string. Metamask tab opens and asks for gas payment. I have imported the first one of the 10 private keys generated by truffle in matamask.

But, it has 0 gas. shouldn't it have 100 gas or something ?


texts: How to produce a hash from a very long seed on ether.camp?

texts:
If the seed on ether.camp is more than 64 chars then I get:

[Error] Error: Invalid hex string
hexWrite (eth-utils.js:17402)
write (eth-utils.js:17477)
fromString (eth-utils.js:17010)
Buffer (eth-utils.js:16980)
toAddress (eth-utils.js:12946)
setPrivateKey (rlpBuilder.js:100)
setSeedPhrase (rlpBuilder.js:95)
setSecretKey (rlpBuilder.js:108)
(anonymous function) (balanceTxDialog.js:76)
dispatch (jquery.min.js:3:8555)
handle (jquery.min.js:3:5258)

I tried to TX with seed with Web Inspector which says:

// must be an even number of digits
var strLen = string.length
if (strLen % 2 !== 0)
   throw new Error('Invalid hex string')
if (length > strLen / 2) {
    length = strLen / 2
}
for (var i = 0; i < length; i++) {
    var parsed = parseInt(string.substr(i * 2, 2), 16)
    if (isNaN(parsed))
        throw new Error('Invalid hex string')
    buf[offset + i] = parsed
}
return i

The error is permanent in both Safari and Firefox.

Furthermore that limit depends on what chars you put in the Transfer form and can be lower (e.g for !@#$%^^ its only 63).

I tried with another account with much shorter seed <40 chars and everything works fine.

My question is how to produce a hash from my very long seed?


texts: Why is browser taking so long to read blockchain data?

texts:
I have a dAPP and I use reactjs for the frontend. The application returns data from a smart contract (the balance) on the homepage. The main problem that I notice is that everytime I or any other users access it, it takes like 2-3 seconds for data to be read from the blockchain. Until data is displayed, the balance is shown as '0' rather than the real value.

Furthermore, if a user with MetaMask changes their network (let's say from Eth MAINNET to Rinkeby), no data is displayed but 0.

Do you have this problem as well and if yes, how do you handle it? Is there a way to improve the time it takes to read data from Blockchain or is it a limitation of technology?

  Some must know information about the general structure of the dAPP:

I have the web3.js file which imports web3 and sets up provider either through MetaMask or through Infura.
I have a deploy.js which enables me to deploy the smart contract. This file connects to rinkeby with menemonic and link provided by infura. In output I get the interface and bytecode
I have another javascript file which is structured as following:

List item

import web3 from './web3';

const address = 'the address provided by the deploy file';

const abi = ['the abi provided by the deploy file'];

export default new web3.eth.Contract(abi,address)

EDIT: Found out that the more operations I have in ComponentDidMount (fetching balance, addresses, etc.), the more time it takes


texts: How can I detect change in account in Metamask?

texts:
When a user changes to a different account in metamask, is there a way to detect it asynchronously in code?

I currently use

this.web3.eth.getAccounts((err, accs) => {
  this.account = accs[0];
});

but when the account is changed, it still picks up the previous one.
Refreshing the page is not a way to go. Did anyone face this and has a solution?


texts: How can I get the number of confirmations for specific transaction hash?

texts:
everyone!
I have faced with one problem.
I can find the transaction hash once transaction is created.
Because I am watching the blocks with newBlockHeader event.
At the moment, I want to check and update the confirmation number of this transaction.
I tried with this

web3.eth.blockNumber-web3.eth.getTransaction(<txhash>).blockNumber.

But it returns NaN.
How can I do?


texts:
If the contract issuer wants to have a way to upgrade the contract code, so that account data and other things carry over, can Ethereum provide this? Also can this be done without changing the contract address or does one always need to deploy a new contract?

Do "annex" mechanisms exist to add some new functionality to a contract without a total rewrite?


texts:
I have a contract method which emits events but ganache seems not to catch any events. I say this because when I deploy my contract on ropsten the events are being caught fine but only in ganache I have this problem. Also I am using web3 js to watch for the events.

This is my solidity contract which emits events:

pragma solidity ^0.5.0;

contract Marketplace {
    string public name;
    address owner;
    uint public fileCount = 0;
    mapping(uint => File) public files;

    struct File
    {
        uint id;
        string name;
        address owner;
        address sharedWith;
    }

    event FileViewed(
        uint id,
        string name,
        address owner,
        address sharedWith
    );

    constructor() public {
        name = "File Sharing System";
        owner = msg.sender;
    }

    function viewFile(uint _id) public
    {
        File memory _file = files[_id];
        require(msg.sender==_file.sharedWith || msg.sender==owner ,"Not shared with you!!");
        emit FileViewed(fileCount, _file.name, owner, _file.sharedWith);
    }
}

This is my App.js in which I am watching for events:

import React, { Component } from 'react';
import Web3 from 'web3';
import './App.css';
import Navbar from './Navbar';
import Main from './Main';
import Marketplace from '../abis/Marketplace.json';

class App extends Component {
  //const marketplace

  async componentWillMount()
  {
    await this.loadWeb3()
    await this.loadBlockChainData()
  }

  async loadWeb3()
  {
    if(window.ethereum)
    {
      window.web3 = new Web3(window.ethereum);
      await window.ethereum.enable();
    }
    else if (window.web3)
    {
      window.web3 = new Web3(window.web3.currentProvider);
      await window.ethereum.enable();
    }
    else{
      window.alert("Non ethereum browser detected!!!!");
    }
  }

  async loadBlockChainData()
  {
    const web3 = window.web3;
    //load Account
    const accounts = await web3.eth.getAccounts();
    this.setState({account: accounts[0]});
    const networkId = await web3.eth.net.getId();
    const networkData = Marketplace.networks[networkId];
    if(networkData)
    {
      const marketplace = web3.eth.Contract(Marketplace.abi, networkData.address);
      this.setState({marketplace});

      const fileCount = await marketplace.methods.fileCount().call();
      for(var i=1;i<=fileCount;i++)
      {
        const file = await marketplace.methods.files(i).call();
        this.setState({
          files: [...this.state.files, file]
        });
      }
    }
    else
    {
      window.alert('Marketplace contract not deployed to detected network.');
    }

  }

  constructor(props)
  {
    super(props);
    this.state =
    {
      account: '',
      fileCount: 0,
      files: [],
      loading: false
    };

    this.viewFile = this.viewFile.bind(this);
  }

  viewFile(id)
  {
    this.setState({loading: true});
    this.state.marketplace.methods.viewFile(id).send({from: this.state.account})

    this.state.marketplace.events.FileViewed({
      fromBlock: 0
    }, function(error, event)
    {
      if(error)
      {
        window.alert("Error: ", error);
      }
      else
      {
        console.log(event);
      }
    })

  }

Note: I don't want to use ropsten network because it takes time to record my transactions.

Help would be appreciated and new here any suggestions would be appreciated.


texts: How to fix a web3.py HTTPConnectionPool read timeout error

texts:
I have a web3.py program running and everything was seemingly working. I was connecting to my local server via the automatic connection offered in web3.py.

I am now getting the following error:

requests.exceptions.ReadTimeout: HTTPConnectionPool(host='localhost', port=8545): Read timed out. (read timeout=10)

This only happens when I am trying to send a transaction. I can read the nonce from the server, but when I attempt to send a transaction with web3.py, I get this timeout.

I have seen this comment 20 days ago which offers a potential solution. My problem here is that I do not know if it is possible to change the HTTPProvider timeout when automatically connecting. Is this a solution? If so, how can you change the timeout when auto-connecting to the node?


texts:
Solidity compiler and Deploy & run transactions buttons are missing in Remix.
I tried many times to refresh with no result.


texts: How to use "etherscan" to push a raw transaction without running a node?

texts: According to this answer, how to use etherscan to push a raw transaction without running a node? In this case, do not we need to install Parity or geth or any Ethereum client ?


texts: Run automated tests against `truffle develop` client?

texts:
So when I start truffle develop in my MacBook Pro it starts listening on port 9545 (even though I don't have any mention of this port in truffle.js...):

$ truffle develop
Truffle Develop started at http://localhost:9545/

Accounts:
(0) 0x627306090abab3a6e1400e9345bc60c78a8bef57
(1) 0xf17f52151ebef6c7334fad080c5704d77216b732
(2) 0xc5fdf4076b8f3a5357c5e395ab970b5b54098fef
(3) 0x821aea9a577a9b44299b9c15c88cf3087f3b5544
(4) 0x0d1d4e623d10f9fba5db95830f7d3839406c6af2
(5) 0x2932b7a2355d6fecc4b5c0b6bd44cc31df247a2e
(6) 0x2191ef87e392377ec08e7c08eb105ef5448eced5
(7) 0x0f4f2ac550a1b4e2280d04c21cea7ebd822934b5
(8) 0x6330a553fc93768f612722bb8c2ec78ac90b3bbc
(9) 0x5aeda56215b167893e80b4fe645ba6d5bab767de

Mnemonic: candy maple cake sugar pudding cream honey rich smooth crumble sweet treat

truffle(develop)>

And I can certify this because if I run this in another terminal tab I can see the port open:

$ lsof -i TCP | grep 9545
node      61830 andres   12u  IPv6 0x8a6b4ab0cefab415      0t0  TCP *:9545 (LISTEN)

However, strangely enough, if I send the process to the background, either by truffle develop & or nohup truffle develop &, then lsof doesn't return any TCP occurrence! Why doesn't truffle develop bind to the TCP port when running on the background?

NOTE: The purpose of running it on the background is so that I can instruct my CI to run it before trying to run my tests via truffle test --network network_config_for9545.


texts: Recommended Gas Limit for Single Transaction

texts:
Current mainnet gas limit per block is 8M (7.99), that of Ropsten is 9M (which is actually rather surprising as it was 4.7M two months ago and I did complain about it...).

Given the above, what's the recommended best-practice gas limit for a single transaction? Would 6M be too high and risk not being picked by the miners if I'm aiming for median gas price? How about 4.7M?

After all, is there any statistics on the distribution of the gas used by mainnet transactions?

Edit: It seems I've not made myself clear enough. I'm referring to the transaction from my contract function. The function does something iteratively, and it's up to me to decide how many iterations to process within one transaction. My question is basically trying to gauge the maximum amount of gas "safe" to use with a reasonable gas price.


texts:
I am looking to create web wallets compatible with ethereum token standards, similar to this: https://wallet.callisto.network/

Can someone guide me to tutorials or guides as how to create this on my website?

Thanks


texts:
Just the opposite of this question How to import a plain private key into geth or Mist? I would like to know how can I obtain the private keys of the accounts created with geth in this way:

$ geth --testnet account new

I've been looking for private key files on ~/.ethereum/keystore but there is only one file for coinbase account. No files for the rest of accounts created.

How can I obtain those missing files? Why are they missing? Thx!

I've already seen How can I import geth accounts into eth? but problem is in my system keystore files don't even exist for most of the geth accounts created, except coinbase.


texts:
I am building a blockchain application that allows investors purchase ICOs using ETH on the Stellar network. I use Bifrost to connect my application to stellar network. But when I startEthereum on Bifrost, I receive a network failed error.  Here's my code:

var params = {
            network: 'test',
            horizonURL: 'https://13.65.197.217:11626',
            bifrostURL: 'http://13.65.197.217:8000',
            assetCode: 'TOKE',
            price: '1',
            issuingPublicKey:'JIYUTBYTFHIUCHYCFTY6758398NUYRPWZ4WL4KZUXDMHLVZWPOQ',
            preSaleMode: false,

            };

    var session = new Bifrost.Session(params);

        session.startEthereum(onEvent).then(params => {
            setStatus("Waiting for a transaction...", 10);

            document.getElementsById("address").innerText = params.address;

            keypair = params.keypair;
        })
            .catch(err => {
                setStatus("Error", 0);
                console.error(err);
            });
    }

after the line session.startEthereum, the code throws a Network Error.

Here's the configuration on the linux server:

[ethereum] master_public_key = "tpubD6HjUbkrYhZ4YiWwEHKPdFUTcPXZ3f3QXuqbdPVmgwUHvp7tkEmM44toHjXGLrWWdSDaDWM5KgiMkCQu7jJRamThZNztFOn8c5SHePyngGQ"
rpc_server = "https://geth.ethereum.org"
network_id = "3"
minimum_value_eth = "0.1"


texts:
I'm totally new when it comes to Ethereum and have a few questions when it comes to gas costs (I know of the 1.0 table but it doesn't really help me to find out what I need)

If I simply want to create a smart contract that stores a list of names (8 byte each name) and an according list of Ethereum adresses, each connected to a certain name. How much gas would it cost to

Create such a smart contract (first with only 1 name + address)
Add a new new name+address in this list
Finding the name to an according address and retrieve the name from the blockchain

I hope the provided information is enough to give an estimate gas cost for these actions. Would be very grateful for some help with this!


texts:
I have a simple meteor app that is running on a local node on a private chain. I am attempting to send some ether from one test account to another, and I get the following error, from inside the getR() function. Any insight would be greatly appreciated!

Error: common: unmarshalJSON failed: hash must be exactly 32 bytes(…)?

here is the getR() function, please see full code snippet below for context:

var getR = function() {
    console.log(window.transactionHash);
web3.eth.getTransactionReceipt(window.transactionHash, function(err, receipt){
    console.log(err);
    console.log(receipt);
    // document.getElementById("response2").innerHTML = receipt.transactionHash;
});

};

* inside of the this function err returns the error stated in the title, and the receipt object is null.

Account

Account Balance

 ether
    <button id="sendEther" onclick="sendSomeEther()">Send 1 Ether</button>

    <button id="getR" onclick="getR()">What Happened!</button>


texts: Can the blockchain's transactions be encrypted?

texts: Is it possible to implement ethereum/bitcoin while its transactions are encrypted?


texts: Can I add extra data to an oraclize query so that I can use it in the callback function?

texts:
I would like to be able to use certain data in the callback of an oraclize query that I want to pass in when creating the oraclize query.

Say I have the following function in a contract:

function updateExchangeRate(uint delay, uint userId){
    oraclize_query(delay, "URL", "json(https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD).USD");
    // have the userId value be usable in the oraclize callback function
  }

Is it possible to add data to that query than can be used in the callback function? I want to pass in a userId every time I make an oraclize query that I can then use in the callback function.

Is that possible?


texts:
A common concern for dapps using public blockchains is to check that a submitted transaction was included in a block after some time. And, if not, try to resubmit the same transaction (I mean, using the same nonce, perhaps with a higher gas price).
Does anyone have recommendations/existing code to solve this issue? Ideally in Angular or React.


texts:
I'm trying some examples from the wiki, nothing is working:

var web3 = new Web3(Web3.givenProvider || "https://mainnet.infura.io/v3/5d4d4f7190b94eb4893ef4dbdc782255"); web3.eth.getBalance("0x407d73d8a49eeb85d32cf465507dd71d507100c1").then(console.log);

throws:

Uncaught TypeError: this.provider.send is not a function
at s.send (web3.min.js:1)
at _.e [as getBalance] (web3.min.js:1)
at script.js:7

And this:

web3.eth.getBlockNumber().then(console.log);

throws this:

Uncaught TypeError: this.provider.sendAsync is not a function
at s.sendAsync (web3.min.js:1)
at _.e [as getBlockNumber] (web3.min.js:1)
at :1:10

This isn't the only fuctions that don't work, none of the ones I used worked so far. Directly from the wiki. I'm importing:


texts: How are decentralised leverage platforms like dydx able to provide leverage to the traders?

texts:
I just started getting along the fundamentals of DeFi and was planning to make a basic decentralised leverage trading platform. I have the confusion as to how the existing platforms(like dydx, DDEX etc) able to provide the leveraged amount to the margin position holders? Like what is their iniitial source of income which they are able to further use to provide leverage to the traders.
Also, if I am to make a decentralised leverage trading platform with bare minimum functionalities, how would I be able to provide the leverage to the traders, if initially the platform starts from ground zero?


texts: How to call the contract function after a specified interval

texts:
There is a function in contract that should call every month. Can this be implemented with the help of Solidity?

For example:

  I have made an order for 1 month. A month later the status of the
  order was changed automatically.

  Or every month, the contract variable must increase by 1


texts: How long to wait for pending transactions?

texts:
Is there any timeout for pending transactions? How long to wait before re-sending the transaction.

I am sending multiple transactions and need to track the status of all those transactions.  But I am observing sometimes, some transactions are not mined and remain in the pending mode.

How do I track whether pending transactions will no longer be mined and trigger re-send transaction?


texts: why does this contract ask to increase gas limit?

texts:
string test;
    function assemblyStorage() public payable returns (string memory a){
     test = "good";
     assembly {
         a:=sload(0)
     }
    }

I am trying to return the string which should be stored in the first slot alongside the length of the string as stated in the docs. But calling assemblyStorage function results : increase gas limit . Whatever I increase it too, it doesn't matter. What Really causes this error is the assembly code. no idea why.


texts:
Is there any way i can send rpc request in batch way using pyethapp? If exists, whether it can help to increase the request efficiency?

Thanks a lot.


texts: My fallback function can not get msg.value from a sent transaction

texts:
There is a mapping in my code as mapping(address => uint) private Payment;. This mapping is used to see who send some ether and how much the sent value is.  Its key is an address that stores address of sender and its value is uint that stores the sent value. I need this mapping's records be evaluated in fallback function. So, i write the followed fallback:
function() external payable{
        Payment[msg.sender]=msg.value;
    }

But, whenever i pay some ethers to the contract with Metamask, the transaction will be failed. What should i do?


texts: specify and run *particular* version of geth (goethe) on my machine, with more than one source

texts:
At the moment I'm playing around with- or rather "conducting some experiments"- with JPM's quorum.

On my machine I have multiple versions of geth (i.e. goethe) installed.

I'm fairly confident that when I issue the following terminal command:

geth --testnet --rpc --mine

what is executed is the version of goethe that lives in my $GOPATH, i.e.:

/Users/s.matthew.english/go/src/github.com/ethereum/go-ethereum

(sub-question: Is the above conjecture accurate?)

However...

What I want to do is run the JPM quorum version of goethe, that lives in a different directory, namely:

/Users/s.matthew.english/clients/quorum/0.0_quorum/quorum

Is it possible to specify on start-up which version of goethe is executed?

Edit

Even though I was in the quorum directory, the output of which geth was the one on my $GOPATH


texts: Having issue with Infura mainnet web3 connection and getting info

texts:
I have been looking at a tutorial from DappUniversity about Web3... on the introductory video, I have completed all stages fine, but when getting to retriving account balance information from the mainnet ( i picked a random account from the Etherscan.io) it doesn't retrieve it.

I get an error like this when looking at the balance on its own  ---|>  web3.eth.getBalance(address, (err, bal) => { balance = bal })
the respond is 'undefined' and does not return a account value in Wei...

I tried getting to read the balance error through --|>  web3.eth.getBalance(address)

that returns the following: >>>

> web3.eth.getBalance(address)
Promise {
  <pending>,
  domain:
   Domain {
     domain: null,
     _events: { error: [Function: debugDomainError] },
     _eventsCount: 1,
     _maxListeners: undefined,
     members: [] } }
> (node:9060) UnhandledPromiseRejectionWarning: Error: Invalid JSON RPC response: ""
    at Object.InvalidResponse (C:\Users\User\node_modules\web3-core-helpers\src\errors.js:42:16)
    at XMLHttpRequest.request.onreadystatechange (C:\Users\User\node_modules\web3-providers-http\src\index.js:87:32)
    at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\User\node_modules\xhr2-cookies\dist\xml-http-request-event-target.js:34:22)
    at XMLHttpRequest._setReadyState (C:\Users\User\node_modules\xhr2-cookies\dist\xml-http-request.js:208:14)
    at XMLHttpRequest._onHttpResponseEnd (C:\Users\User\node_modules\xhr2-cookies\dist\xml-http-request.js:318:14)
    at IncomingMessage.<anonymous> (C:\Users\User\node_modules\xhr2-cookies\dist\xml-http-request.js:289:61)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)
(node:9060) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:9060) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

what can i do to solve this issue!


texts:
I  have an UTC file from https://classicetherwallet.com this site .
But website is not reachable . how to recover my ETC COIN .


texts: Why does PUSH1 0x60 PUSH1 x40 MSTORE store 0x60 at memory location 0x50 (and not 0x40)?


texts: How to prevent to change coinbase address for geth?

texts:
I am trying to get test ether on ropsten testnet, so I set coinbase address like

miner.setEtherbase("0xxxxxxxxxxxxxx")

and started to mine from my node,

miner.start(4);

But someone changed the coinbase address of my node, after few days later, the address is

https://ropsten.etherscan.io/address/0xd9ee4d08a86b430544254ff95e32aa6fcc1d3163

But I have to open my RPC end point to use for other team members. So is there any other way to prevent to change my node coinbase address??


texts:
How can modifiers be shown in a Solidity UML-Diagram, next to the access modifier -+#~. Do you know to visualize this kind of modifier?

modifier onlyProducer(){
        if(msg.sender != producer){
             throw;
        }
        _;
}


texts: TypeError: tests is not a function Error in Truffle

texts:
I am following an online tutorial, doing almost exactly like the instructor.

I have the following error every time I try to run 'truffle test'

my truffle-config file:

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // to customize your Truffle configuration!
  contracts_build_directory: path.join(__dirname, "client/src/contracts"),
  networks: {
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*", // match any network
      websockets: true
    }
  },
  contracts_directory: "./client/src/contracts/",
  contracts_build_directory: "./client/src/abis/"
};

I tried migrate with --reset.


texts:
As of now whenever I try to perform any operation by invoking any of the methods of a contract it expects to unlock the account. Now the account which is used to perform the transaction, has to pay the price to perform the transaction.

So in a live environment want to understand how it works.

Lets say have a Book Lending DApp where one user can lend books by invoking a method of DApp. Hoping that the web interface of the DApp will be hosted on a server and the contracts are deployed on the block chain. The contract instances are initialized and the addresses are used internally in the DApp.

We know that the host name and port of the blockchain node is configured in the web app.

Questions:
 1. So want to understand how will that single instance of the DApp will be used to be invoked by each node in the blockchain network?
 2. In the web interface how to determine current user's address dynamically?
 3. Is the user expected to keep his/her account unlocked while performing activities on the DApp otherwise every time when performing any transaction unlock it manually?

Am sure missing something pretty obvious.


texts: How to access Truffle deployed contracts with app's javascript code?

texts: I have some smart contracts deployed with Truffle on the local Ganache network, but I don't know how to access it with the app's javascript in order to make function calls to the contract. How would I be able to access it?


texts: How are the account "pictures" used in Mist generated?

texts: In mist, all accounts have a colourful pixelated "profile picture" used to identify them. For instance, in this screenshot from the Mist releases page, the Dogecoin Bounty DAO is given a purple profile pic. How are these generated?


texts: subscribe to address (wallet) and get transaction info including receiving token name (if token)

texts:
I just started playing arround with blockchain development and the use of web3 so I have more questions than my fingers are able to type, hope some of you are able to answer the first one I have.
What I want to archieve is following:
Subscribe to an address (wallet) and then stream all transactions going out- or going in for this address.
I also want to know for example, if the wallet makes an outgoing transaction to another address, what Token had been sent. I hope this makes sense or is even possible.
Like I want to know if wallet A sends funds to wallet B and what kind of token had been sent.
This is what I got so far, need help to get in the right direction for the rest of what I am trying to do.
var subscription1 = web3.eth.subscribe('logs', {
    address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'
}, function (error, result) {
})
.on("data", function (log) {
    //console.log(log);
    web3.eth.getTransaction(log.transactionHash)
        .then(function (transaction) {
            console.log(transaction)
            if (transaction.value > 0) {
                console.log("Ether sent from " + transaction.from + " to " + transaction.to)
            }
        })
})

I am also unclear about, why the subscription outputs a console.log at the very beginning containing an transaction array and other information, as I expected to only receive data in the "on data" event.
Thank you for reading, hoping someone has the patient to help me out stepping into the topic.
Regards


texts: "Intrinsic gas too low" error when deploying the crypto recipe from Ethereum.org

texts:
Using the latest version of Mist on Mac OSX, I'm simply trying to deploy the crypto coin recipe straight from the Ethereum website and deploy on the Mist test net.

The code compiles with no errors before deployment, but halts with an "Intrinsic gas too low" error, despite my making no amendments to the code example.

Based on other questions on the same topic, this is about the intrinsic being set too low - but that value is hard coded and cannot be changed in the UI. Another answer given on the forum suggests inserting "Payable" in the contract's functions, after the arguments. Alas, this did not allow me to deploy.

I'm wondering if this is something i'm missing from the tutorial, or a problem with my wallet, or a bug in the code that is not immediately obvious.

https://www.ethereum.org/token


texts: How to parse the node information in the nodes directory by leveldb?

texts:
I want to get all the node IP addresses of ETH, so I need to parse the geth/nodes directory, but I can't find the specific data format and cannot parse it.
I found a same problem, but there is no solution:
Format of LevelDB files in nodes directory? Trouble pulling contents with python leveldb API
My code:
import leveldb
import rlp

db = leveldb.LevelDB("../nodes")
for k in db.RangeIter():
    print(k)
    print(rlp.decode(k[0]))
    break

Result:
(bytearray(b'local:\xc6\x83\x00\xb8LX\xcc+\xcd\x98CDd\x96\x89R\x92\x1a\xaeV\xe1\x93\xfeV\x95)\t~$e\xfa|:seq'), bytearray(b'\x97\x08'))
Traceback (most recent call last):
  File "temp.py", line 7, in <module>
    print(rlp.decode(k[0]))
  File "PATH/.local/lib/python3.6/site-packages/rlp/codec.py", line 235, in decode
    raise DecodingError(msg, rlp)
rlp.exceptions.DecodingError: RLP string ends with 41 superfluous bytes

I searched a lot of information and found that rlp.sedes needs to be specified when decoding. I can't determine which kind of sedes it is. I am a newcomer to ETH and I need help. Examples of parsing in other programming languages are also available.
Thank you.


texts: Can Ethereum be pruned to the extent that it could be run from a Raspberry Pi?

texts: What are the limits to how much the ETH blockchain can be pruned. Will ETH ever be practical on devices with limited resources such as a Raspberry Pi, Android or iOS wallet?


texts: What is Geth's "fast" sync, and why is it faster?

texts:
One of the answers to this question suggested using Geth's --fast flag to help quickly synchronise the block data.

How does the flag work, and how does using it speed up the synchronisation? Are we syncing less data, or are we in some way performing fewer checks on its integrity or source?

Edit:

As of Geth version 1.6.0, the --fast flag has become --syncmode=fast (though --fast is also still usable for now).


texts: Can i transfer ETH from coinbase to my etherhwallet?

texts: I have ETH in my coinbase acct, can I transfer them to my etherwallet acct? How can I do it?


texts:
Can someone explain the exact differences between the three?

I'm most familiar with the fork, where the rules of generating blocks change creating a fork where miners can choose to follow the old rules or the new rules.

An airdrop is simply taking the balances of an existing blockchain to distribute a token on a new independent blockchain.

What is the spoon? I've read some introductions to it and it sounds like a sort of hybrid but I don't quite get it. An ELI5 approach would be greatly appreciated!


texts: How much ETH will be minted per block (or epoch) after the docking/merge?

texts: I don't know if this has been decided already, but I can't find it anywhere. Simply put I'm looking for the number of ETH created per block (or any other timeframe) once Ethereum is fully POS.


texts: Can someone tell me how it is possible to implement the generation of unique erc20 addresses for registered users?


texts:
ERC20 token interface has the approve function
approve(address spender, uint amount)
Is there any function, where the contract itself can approve its tokens for another address?
Something like this
approveFrom(address thisContract, address spender, uint amount)


texts:
I have written a contract Transfer and the functions defined in the contract Transfer is used in another contract SecondTransfer.I have defined a constructor in the contract Transfer and initialized values in that constructor.

pragma solidity ^0.4.2;

contract Transfer {

        address public userA;
        address public user;
        mapping (address => uint) balances;
        uint value2;

       // constructor

       function Transfer() {
              userA=msg.sender;
              balances[userA]=1000;
       }

      function sendEther(address user,uint value)returns (bool success){

             if(balances[userA]< value){
                      return false;
             }
             else {
                      balances[userA] -= value;
                      balances[user] += value;
              return true;
             }
   }
   function sendAddressToAddress(address fromuser,address touser)returns      (bool success){
            uint value=balances[fromuser];
            if(value < 0){
                return false;
            }
            else {
                balances[fromuser] -= value;
                balances[touser] += value;
                return true;
            }
  }
  function getBalance(address user) returns (uint _balance){
           return balances[user];
  }
}

 contract SecondTransfer {

 function sendEtherCall(address contractaddr,address user,uint value) returns (bool success) {
      Transfer transfer=Transfer(contractaddr);
      return transfer.sendEther(user,value);
}
function sendAddressToAddressCall(address contractaddr,address fromuser,address touser) returns (bool success) {
      Transfer transfer=Transfer(contractaddr);
      return transfer.sendAddressToAddress(fromuser,touser);
}
function getBalanceCall(address contractaddr,address user) returns (uint _balance) {
      Transfer transfer=Transfer(contractaddr);
      return transfer.getBalance(user);
  }

 }

I have tried to run this contract using browser-solidity. I have passed the address of the contract Transfer as parameter to the contract Second Transfer. But the function getBalanceCall returns a VMException error.

Please do help me to rectify the issues. Is there any issues regarding constructor initialization in contract Transfer?

I am also trying to create a DApp using Truffle with this contract. In this case how can I pass the address of Transfer contract as parameter to SecondTransfer contract?


texts: What is the best way to show contract data on a website

texts:
The data needed to be available through the website is a list of links (1000+), which may be updated (or not) at the rate of 100 links a day. And a list of usernames which starts from 0 and new users may be appended to the list at the rate of say 10 000 a day.

As far as I understand the contract needs to fire events everytime a change is made. But the rest I can't understand)).

Is there a very light php or python "web-server-side" ethereum client which doesn't need to download chaindata?
Or do I need to use some blockchain explorer API to get information?
Or I better send updates to website DB from my local machine (win 8.1)?

What is the simpliest reliable solution here?


texts: How do I pass enode URI's to --reserved-peers?

texts:
So I know I have to type in terminal:

  parity -j --reserved-peers

But I do not know what to type after --reserved-peers, The actual peers I want to add are listed here. But I do not know if I am supposed to type them into the terminal after --reserved-peers with some kind of notation, like commas separating them, or if I am supposed to put them in a file somehow and type the file name.


texts: truffle-contract: Contract has not been deployed to detected network (network/artifact mismatch)

texts:
I am running a private network and would like to use truffle-contract to interact with the contracts. Unfortunately it gives me this error:

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

I am using truffle-contract@3.0.7 and here is how I set up my code:

const Web3 = require('web3-quorum');
const truffleContract = require('truffle-contract');

const web3 = new Web3(new Web3.providers.HttpProvider('http://127.0.0.1:22000'));

const ContractJSON = require('./build/contracts/Contract.json');

var MyContract = truffleContract({
    abi: ContractJSON.abi,
    unlinked_binary: ContractJSON.bin,
    address: ContractJSON.address
});
MyContract.setProvider(web3.currentProvider);

MyContract.deployed().then(function(instance) {
    return instance.myMethod(
        web3.utils.toHex('31ad646cf39d485d8df7'),
        Number(100),
        Number(12345));
}).then(function(result) {
    console.log(result);
}).catch(err => { console.log(err); });

I also tried MyContract.setNetwork(10);, whereby 10 matches net.version output (geth console) or also chainId in the genesis.json. Unfortunately without luck.


texts: Can someone provide some DApp examples where the transferFrom pattern has been implemented and does an at least 'decent' job of providing a good user experience. If not, what is then a convenient way to achieve this?


texts:
Im learning Solidity and I found an ERC721 contract that seems to have a very dangerous minting process. Am I correct in assuming that if User_a tries to mint 20 at the exact same time as User_b tries to mint 20, one of the transactions could fail if there was a price increase caused by the other user's successful transactions?
How do you combat this type of issue?
   function adoptChubby(uint256 numChubbies) public payable {
    require(totalSupply() < MAX_CHUBBIES, "Sale has already ended");
    require(numChubbies > 0 && numChubbies <= 20, "You can adopt minimum 1, maximum 20 chubbies");
    require(totalSupply().add(numChubbies) <= MAX_CHUBBIES, "Exceeds MAX_CHUBBIES");
    require(msg.value >= calculatePrice().mul(numChubbies), "Ether value sent is below the price");

    for (uint i = 0; i < numChubbies; i++) {
        uint mintIndex = totalSupply();
        _safeMint(msg.sender, mintIndex);
    }
}


texts: DEVP2P character encoding - please clarify 'ASCII'

texts: Please can someone clarify if DEVP2P wire protocol specifies byte-sized 7 bit encoding when it refers to 'ASCII'? i.e. 3 bytes


texts: Can ERC721Enumerable.sol provide an address's total set of NFT assets?

texts:
Intro:
I am trying to use ERC721Enumerable in my NFT contract so I can get the set of all NFTs owned by a particular address.
Research:
The ERC721Enumerable contract was implemented to enumerate unique NFTs, to make them discoverable. The way to discover them is by iterating through the enumerated NFT ids using the following function:
function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256);

I presume the best way to get an entire set of an address's assets is to query this function multiple times, while incrementing the _index variable from 0 -> n, until no such NFT exists - then you will end up with all of the assets of that contract owned by the particular address. But that seems hacky to me.
Question:
I'm wondering if the ERC721Enumerable contract has a better way to tell me the entire list of an address's owned NFTs.


texts: socket.timeout timed out when connecting to a remote server with web3.py

texts:
I use Web3 to connect to my remote server.

10.xxx.xxx.xxxis ip address of a remote server.

First I start the server with this command :
parity --chain frontier.json --rpcapi="eth,net,web3,personal,web3" --rpc --rpcaddr 10.xxx.xxx.xxx --rpcport 8545 --rpccorsdomain "*" --author 0x...

And after I run a python script :

from web3 import Web3, KeepAliveRPCProvider
web3 = Web3(KeepAliveRPCProvider(host="163.xxx.xxx.xxx", port="8545"))
web3.eth.coinbase

But I've this error : ValueError: No JSON object could be decoded

If I remplace host by 10.xxx.xxx.xxx I've socket.timeout: timed out error

Moreover, if I install python and web3 on the remote server and run this command :

from web3 import Web3, KeepAliveRPCProvider
web3 = Web3(KeepAliveRPCProvider(host="10.xxx.xxx.xxx", port="8545"))
web3.eth.syncing
I don't have any error

But if I run this command on an other server I've the same error : socket.timeout: timed out

How can I resolve this error?


texts: I have a contract holding a mapping like this: mapping (address => User) users. How can I get the contract to automatically fire a transaction/event when a certain condition is met? For example, when the user's expiration timestamp reaches a certain value.


texts: Where does blockchain data come from if there are no peers?

texts:
I'm still having problems syncing.  I've kept my client up-to-date, I'm using an SSD, and I have 1Gbps/1Gbps internet service.  It just hangs with 270 blocks remaining forever.   The logs say:
INFO [12-04|07:02:48] Imported new state entries               count=927  elapsed=2.955ms   processed=180886 pending=11412 retry=504 duplicate=119 unexpected=1210

Anyhow, it's very frustrating for a lot of reasons.  Primarily and at this instant, I can't perform any transactions to handle my money.  I'm stuck.

To investigate further, I've setup the latest Ethereum Wallet on a fresh system and it does the same thing.  Hangs at around 200 blocks remaining.  Oh, and I noticed something interesting to me.  Initially, it connects to a dozen peers and downloads very fast.  When it hangs, it's obvious it will no longer download so I restart.   On restart, it connects to no peers, but if some time (a day or so) has gone by, there are enough blocks that it starts downloading again; however, it downloads blocks when there are no listed peers.

Where is it downloading blockchain data from when it has not connected to any peers?


texts:
What is DeFi? What are its core components? How to think about or picture "it"?

Some of the parts are tokens, stablecoins (tokens with specific properties to reduce its volatility), and exchanges, but there must be more and this simply seems to miss the bigger picture.

To help with scoping, maybe some explanations could be like
How would I explain Ethereum to a non-technical friend?


texts: Where should I store GPS data on Ethereum?

texts: Where should I store GPS (or other frequently changing, content searchable data on Ethereum)? Blockchain is not the best place for this kind of data, because it is expensive, but swarm is not searchable (as I know). So, if I would like to write an Uber like service on Ethereum, where I have to find the nearest points near real time, what would the best storage option?


texts: Does the ETH blockchain have fundamentally more branching than BTC?

texts:
Intuitively speaking, ETH seemed to have simply increased the average block generation rate from one every 10 min in BTC to 1 every 15 seconds. There doesn't seem to be any other protection against excessive branching.

So does ETH fundamentally have a lot more branches, and a lot more orphaned transactions than BTC does? Thanks!


texts: Are smart contracts' functions names visible?

texts:
If I deploy a smart contract (for private use) on the Ethereum blockchain, can other people see the names of the functions it contains? Assuming the abi.json file is not published.
If not, how does calling a specific external function work? How is the function distinguished from other functions in the same contract?
If yes, does the name length impacts the gas price?


texts: Scraping ethereum blockchain in human readable format (csv)

texts:
I wanted to scrape the whole ethereum blockchain in csv format. For this I reverse engineered and extended this code by vitalik: https://github.com/ethereum/research/blob/master/uncle_regressions/block_datadump_generator.py

My version is here:
https://github.com/ankitchiplunkar/analyzeEthereum

The problem is that I can download the blockchain till block 2,675,000 (EIP 155 hardfork) but after that I get the following error:

>>> tempTxDictionary = tempTx.to_dict()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/******/anaconda2/envs/pyethapp/lib/python2.7/site-packages/ethereum/transactions.py",
line 155, in to_dict
    d['sender'] = self.sender
  File "/home/******/anaconda2/envs/pyethapp/lib/python2.7/site-packages/ethereum/transactions.py",
line 81, in sender
    raise InvalidTransaction("Invalid signature values!")
ethereum.exceptions.InvalidTransaction: Invalid signature values!

On a closer look I can see that

tempTx.v = 37 or 38

The yellow paper says that "v" should be either 27 or 28 (equation 211).
There is something different in how pyethereum/transactions.py is reading the block after EIP155.

What should I do to fix this?

PS: here is a simpler method to recreate the error

import rlp
from ethereum.blocks import BlockHeader
from ethereum.transactions import Transaction
from ethereum import utils
import csv
gethDumpFileName = 'geth.dump'
f = open(gethDumpFileName)
pos = 3561286829 # position of block 2,675,002
f.seek(pos)
prefix = f.read(10)
_typ, _len, _pos = rlp.codec.consume_length_prefix(prefix, 0)
blkdata = prefix + f.read(_pos + _len - 10)
header = rlp.decode(rlp.descend(blkdata, 0), BlockHeader)
headerDictionary = header.to_dict()
i = 0
tempTx = rlp.decode(rlp.descend(blkdata, 1, i), Transaction)
tempTx.v = tempTx.v -10
tempTxDictionary = tempTx.to_dict()


texts: Why is Geth's "fast" sync now the default, whereas before it wasn't?

texts:
As of version 1.6.0, the default method used by Geth for syncing the chaindata is "fast":

  The default sync mode is --syncmode=fast, for full sync please use
  --syncmode=full.

Previously, the default was "full", with the user having to explicitly pass the --fast flag to bring about a "fast" sync.

In answer to a previous question, Why isn't fast sync the default?, it was stated that:

  ...Fast sync indeed has one additional weakness compared to full sync.
  As long as an attacker can keep you isolated from the main chain (e.g.
  infect your router), it may construct an arbitrary state that your
  node will believe

Is this weakness no longer the case, and if so, why not?


texts: I need help to understand why a function call reverted without any reason

texts:
I have a Registry contract, which holds addresses of different smart contracts. The registry has getter for every contract address it holds.

In other contract at some point I need to retrieve one of the addresses.

When I call the getter function at the beginning of function it works properly.

When I call it after two computed hashes, it just reverts without any reason provided.

There is still a lot of gas left, so not out of gas problem for sure.

Don’t know if it’s  about stack overflow , because stack frames are pushed for every function call.

Update for @RickPark questions

Computated hashes is 2 times calculation of

hash = keccak256(
  abi.encodePacked(
    abi.encodePacked(...someParams),
    abi.encodePacked(...moreParams)
  )
)

Getters works like this

contract Registry is Ownable {
  address core;

  function setCore(address _core) external onlyOwner {
    core = _core;
  }

  function getCore() public view returns (address) {
    return core;
  }
}

and called as

Core(registry.getCore()).doSomething()

My function basically gets 3 structs (experimental ABI v2) and makes those 2 hashes and few more validations.
So part of some validations are exactly calling the Core, but before we need to get its address.

If I get address before hashes, it works, after hashes it reverts without any reason.

Update 2 for @RickPark questions

contract LoosingHope is LibOrder, LibSomeStruct, Ownable {
  Registry internal registry;

  function setRegistry(address _registry) external onlyOwner {
    registry = Registry(_registry);
  }

  function create(Order memory _buyOrder, Order memory _sellOrder, SomeStruct memory _someStruct) public {
      require(
          _buyOrder.something == _sellOrder.something &&
          _sellOrder.something == 0,
          "MATCH:NOT_CREATION"
      );

      // Validate taker if set
      validateTakerAddress(_buyOrder, _sellOrder);
      validateTakerAddress(_sellOrder, _buyOrder);

      // Validate sender if set
      validateSenderAddress(_buyOrder);
      validateSenderAddress(_sellOrder);

      // Validate expiration if set
      validateExpiration(_buyOrder);
      validateExpiration(_sellOrder);

      // Validate if was canceled
      // orderHashes[0] - buyOrderHash
      // orderHashes[1] - sellOrderHash
      bytes32[2] orderHashes;
      orderHashes[0] = hashOrder(_buyOrder);
      validateCanceled(orderHashes[0]);

      // registry.getCore(); <------------ doesn't reverts here

      orderHashes[1] = hashOrder(_sellOrder);

      registry.getCore(); <------------ reverts here

      validateCanceled(orderHashes[1]);
  }
}

Update 3 for @RickPark questions

Registry is simple Ownable contract with setter and getter of Core address. Setting the address is following by onlyOwner modifier, getting is public for anyone. It's initialised by me as well, I use it as Registry for addresses, so contracts are able to communicate with each other.

Update 4 for @RickPark questions

Environment

OS: MacOs
Solc: v0.4.24

Networks:
all of them fail

Truffle JSONRPC
Ganache - all latest versions
Rinkeby
Kovan


texts:
I am stuck between "out of gas" and "exceed block gas limit" when try deploying my contract onto Test RPC in my mocha test file.

I wonder

Can I manually increase block gas limit on my test RPC (I am not using truffle)? how?
Is this gonna be a problem when I deploy to main net?

Below is my test.js

const assert = require('assert');
const ganache = require('ganache-cli');
const Web3 = require('web3');
const web3 = new Web3(ganache.provider({"total_accounts":20, "debug":true}));

const compiledFactory = require('../build/SyndicateFactory.json');

let accounts;
let factory;
let syndciateAddress;
let syndicate;
let DeployICO1;
let ICO1;
let exchangeAddress;

beforeEach(async()=> {
    accounts = await web3.eth.getAccounts();
    syndicateFeeTimes1000 = 10;
    exchangeAddress = accounts[5];

    factory = await new web3.eth.Contract(JSON.parse(compiledFactory.interface)).deploy({data: compiledFactory.bytecode}).send({from:accounts[0], gas:'7000000'});

});


texts: Minimum Gas limit and how can it be reduced?

texts:
Why does this minimum exist and what can we do to to reduce it further. This line of thought was spurred by this tweet from Vitalik:

  "And there are layer 2's without data availability tradeoffs or liveness requirements, eg. tx mass-validation via ZK-SNARKs can reduce costs to < 1000 gas per tx if done well. That's ~500 tx/sec on-chain with all the security guarantees of on-chain."

I did a quick search through the yellow paper and there is no break down of the contributing factors to this. just

Gtransaction 21000 Paid for every transaction.


texts: Error installing mix in LinuxMint Rosa 17.03

texts:
I followed the instructions here:
https://gavofyork.gitbooks.io/turboethereum/content/chapter1.html

For installing mix on my machine. The last step threw some errors saying I have some unmet dependencies (sudo apt-get install mix). I read in a thread in stackexchange that for ubuntu this has been changed to

sudo apt-get install mix-ide

Running that, the installation worked. But now it shows this error:

  mix-ide: error while loading shared libraries: libsolidity.so: cannot open shared object file: No such file or directory

What could be the issue?


texts: Is payable fallback function not always invoked?

texts:
In the recommendations for smart contract security I read the following:

"
Remember that Ether can be forcibly sent to an account
Beware of coding an invariant that strictly checks the balance of a contract.

An attacker can forcibly send wei to any account and this cannot be prevented (not even with a fallback function that does a revert()).

The attacker can do this by creating a contract, funding it with 1 wei, and invoking selfdestruct(victimAddress). No code is invoked in victimAddress, so it cannot be prevented.
"

Does that mean that the fallback function can't do a revert() or does that mean that the fallback function is not invoked if ether is sent to a contract in that manner?


texts: How do you deploy a smart contract to GoQuorum?

texts:
I have a set of smart contracts that I have compiled and deployed to rinkeby test network. I now need to deploy the to a private goquorum blockchain that runs on the IBFT consensus. The blockchain was built with quorum-wizard. It starts when I run ./start.sh
when I'm in the root of my truffle project I run sudo truffle deploy --reset --network quorum
I get the following error.
> Everything is up to date, there is nothing to compile.

/root/dapp1/Dapp/node_modules/web3-core-helpers/src/errors.js:42
        return new Error(message);
               ^
Error: PollingBlockTracker - encountered an error while attempting to update latest block:
Error: Invalid JSON RPC response: ""
    at Object.InvalidResponse (/root/dapp1/Dapp/node_modules/web3-core-helpers/src/errors.js:42:16)
    at XMLHttpRequest.request.onreadystatechange (/root/dapp1/Dapp/node_modules/web3-providers-http/src/index.js:92:32)
    at XMLHttpRequestEventTarget.dispatchEvent (/root/dapp1/Dapp/node_modules/xhr2-cookies/xml-http-request-event-target.ts:44:13)
    at XMLHttpRequest._setReadyState (/root/dapp1/Dapp/node_modules/xhr2-cookies/xml-http-request.ts:219:8)
    at XMLHttpRequest._onHttpRequestError (/root/dapp1/Dapp/node_modules/xhr2-cookies/xml-http-request.ts:379:8)
    at ClientRequest.<anonymous> (/root/dapp1/Dapp/node_modules/xhr2-cookies/xml-http-request.ts:266:37)
    at ClientRequest.emit (events.js:315:20)
    at Socket.socketOnEnd (_http_client.js:493:9)
    at Socket.emit (events.js:327:22)
    at endReadableNT (internal/streams/readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
    at PollingBlockTracker._performSync (/root/dapp1/Dapp/node_modules/eth-block-tracker/src/polling.js:51:24)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

This is my truffle-config.js
const HDWalletProvider = require("@truffle/hdwallet-provider");
const mnemonic = "not my real mn emon ic words this is pl cfff was";

module.exports = {
  networks: {
  rinkeby: {
    provider: function() {
      return new HDWalletProvider(mnemonic, "https://rinkeby.infura.io/v3/2342342342344345344343434");
    },
    network_id: '*',
    timeoutBlocks: 100000,
    networkCheckTimeout:2000000
  },
// https://www.trufflesuite.com/docs/truffle/distributed-ledger-support/working-with-quorum
   quorum: {
    provider: function() {
      return new HDWalletProvider(mnemonic, "http://127.0.0.1:21000/");
    },
    network_id: '*',
    type: "quorum",
    timeoutBlocks: 1000000,
    networkCheckTimeout:20000000
  }
  },
  compilers: {
    solc: {
      version: "0.5.0",
      settings: {
        optimizer: {
          enabled: true, // Default: false
          runs: 1000     // Default: 200
        },
        evmVersion: "homestead"  // Default: "byzantium"
      }
    }
  }
};

I am using
Node v14.16.1
Ubuntu 18.04 (64 Bit)
Quorum 21.1.0
Web3.js v1.3.5
Truffle v5.3.4 (core: 5.3.4)
solidity v0.5.0


texts: What is the utilisation level on the Ethereum blockchain?

texts: How many transactions are currently executed on the Ethereum blockchain and how does this compare to other blockchains?


texts: Why isn't Polka Dot listed for trading on Uniswap?

texts: Uniswap is the leading decentralized exchange for many ERC20 tokens. DOT is an example of such a token I'm guessing since it's a self-declared complementary extension of the Ethereum ecosystem, so why doesn't DOT appear in the Uniswap App for trading against Ether? It's tradeable on Kraken (centralized exchange), yet not on Uniswap (decentralized exchange), but there's no point in buying DeFi coins like DOT on centralized exchanges now is there