texts:
Im trying to import a contract and call its primary function via another contract. This seems to work in most cases but in this case i get the following error.

localhost/tokenmarket/SecurityToken.sol:8:25: TypeError: Invalid type for argument in modifier invocation. Invalid implicit conversion from address to contract UpgradeableToken requested.
    TestMigrationTarget(_oldToken) {
                        ^-------^

Code of the contract im getting this issue with.

pragma solidity ^0.4.18;
import "./test/TestMigrationTarget.sol";

contract UpgraderToken is TestMigrationTarget {
 function UpgraderToken(address _oldToken)
    TestMigrationTarget(_oldToken) {
}
}

Code of Contract TestMigrationTarget which it is importing which deploys fine on its own.

pragma solidity ^0.4.18;

import "../SafeMathLib.sol";
import "../UpgradeableToken.sol";
import "../MintableToken.sol";

contract TestMigrationTarget is StandardTokenExt, UpgradeAgent {

  using SafeMathLib for uint;

  UpgradeableToken public oldToken;

  uint public originalSupply;

  function TestMigrationTarget(UpgradeableToken _oldToken) {

    oldToken = _oldToken;

    // Let's not set bad old token
    if(address(oldToken) == 0) {
      throw;
    }

    // Let's make sure we have something to migrate
    originalSupply = _oldToken.totalSupply();
    if(originalSupply == 0) {
      throw;
    }
  }

  function upgradeFrom(address _from, uint256 _value) public {
    if (msg.sender != address(oldToken)) throw; // only upgrade from oldToken

    // Mint new tokens to the migrator
    totalSupply_ = totalSupply_.plus(_value);
    balances[_from] = balances[_from].plus(_value);
    Transfer(0, _from, _value);
  }

  function() public payable {
    throw;
  }

}

Another case where import and calling functions works just fine.

pragma solidity ^0.4.18;

import "./BurnableCrowdsaleToken.sol";

contract MyToken is BurnableCrowdsaleToken {
    function MyToken(string _name, string _symbol, uint _initialSupply, uint _decimals, bool _mintable)
    CrowdsaleToken(_name, _symbol, _initialSupply, _decimals, _mintable) {
  }
}

What am i doing wrong in step 1 and how can it be addressed ?

Thanks for reading and your help.


texts: how to use multiple modofier to form combinations of boolean conditions?

texts:
I have read this article and this SO. And I understand the functionality of modifier. When modifiers are placed on a function with a spacing they will be evaluated in the order of placing thus creating an And condition. However, I would to understand how multiple modifiers can be placed so that combination of other Boolean conditions such as OR be evaluated?

For Instance,

modifier modA {
  // verify something
  _;
  // verify something
  _;
}
modifier modB {
  // verify something
  _;
  // verify something
  _;
}
function Fun() modA modB {
  // Do something
}

In this case, modA AND modB will be the execution. But is it possible to use them to form OR condition?


texts: truffle migrate restarts from first migration after restarting testrpc

texts: I’m trying to create sort of private chain on testrpc so i use testrpc -u 0 -d --db /path/to/db to start testrpc each time. The thing is that if I restart testrpc (kill it and start it again) truffle migrate restarts migration process from the beginning (1_*) although testrpc uses old chain database. Is there a way around this or is this an issue?


texts:
I've been trying to download the blockchain for days now...

My chaindata folder is currently at 12.5 GB...just how large is this blockchain?


texts:
Let's say I have a struct.
struct test {
  uint x;
}

test[] all;
mappings(uint => test) map;

function bla(){
   test memory structTest = test(5);
   all.push(structTest);
   map[10] = structTest;
}

After the code, will structTest be saved in one place and then my array and map will save the references to it or it will be stored separately in map and array ?
If the latter, how can I create struct and store it in mapping and array so that I don't waste space ?


texts: Search function being called in a contract

texts: Is it possible to find if a function was ever called in a contract? Etherscan provides the Method being called on a transaction for a smart contract so is there any way to filter for a specific Method? The etherscan API provides the Get a list of 'Normal' Transactions By Address but that does not include the Method.


texts: why does web3 have 2 different account creation method

texts:
I am trying to create an account in the blockchain for a new User who will be using my dapp.

I am using the web3 1.x version so it has a method web3.eth.accounts.create()
which returns somehting like this :

{
    address: "0xb8CE9ab6943e0eCED004cDe8e3bBed6568B2Fa01",
    privateKey: "0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709",
    signTransaction: function(tx){...},
    sign: function(data){...},
    encrypt: function(password){...}
}

Also web3 has the method web3.personal.newAccount() which only returns an account address.

Now i want to know why there are two and what difference they have between each other ?


texts:
I am planning to do a POC on blockchain for uploading and verifying documents. I was wondering if I can store a complete document in blockchain. After some research on net most of the example, I found keep the hash of the document in blockchain because of 1 MB size limitation.
So, the question here is -
Is it possible to store large file - doc/pdf/audio in the blockchain?

Thanks in Advance.


texts: Is there a way to programmatically verify contracts in Matic/Polygon via api like in HECO or Binance?

texts: It is only way to verify contracts using UI on their site but it is a long process.


texts: Why do pending transactions appear to have a 3 hour cycle? (according to Etherscan data)

texts:
See: https://etherscan.io/chart/pendingtx
There's clearly a 3 hour periodicity of txn volume.
Now, I'm aware that Geth nodes have a parameter --txpool.lifetime which is set default to 3 hours. But this doesn't entirely explain the pattern. If each txn has a lifetime of 3 hours, we should see a smooth pattern in the chart (assuming there's a relatively uniform distribution re: txn creation).
I can't think of a good reason for the sharp drop-off every ~3 hours. It seems reasonable to think it's somehow related to the Geth txpool lifetime parameter, but beyond that I'm stumped.
Anyone have any good guesses?


texts: Is it safe to have a locally running Ethereum node exposing personal RPC API?

texts:
I am developing a REST API currently running off a node.js server. The API allows ethereum account creation, making a transaction etc.

The API interacts with a locally running ethereum node to execute these requests over RPC. I have set the provider to "127.0.0.1/8545" I use the web3.eth.personal RPC API for many of these requests. Is it safe to expose the personal API?

If not how could I unlock an account without web3.eth.personal.unlockAccount?


texts: I have been unable to find a way to make an ETH transaction from a temporary TAILS device since the usual wallets such as MyCrypto does not seem to run there.


texts:
Newbie question.  Can someone walk me through the steps I have to take to extend the date to my smart contract from May 2, 2018 to August 2, 2018?

Like to try without asking my programmers for help.  Thanks.

Smart Contract is on etherscan.io and active.

TIA


texts:
I try to send Token based on Erc20.

and I can send Ether and something function
but i dont know how to use transfer function in javascript like that.

 function transfer(address _to, uint256 _value) public returns (bool success) {
        _transfer(msg.sender, _to, _value);
        return true;
    }

i did
first.

const TokenInstance = new web3.eth.Contract(mhToken.abi, '0xC632ecfBBcee37b8061E59fcA11d9cB80DE08612')
this.setState({ web3: web3 , MhTokenInstance:MhTokenInstance})

second.

using web3 instance i want to send custom token.
plz help me how to use transfer function!


texts: Are Monolithic Smart Contracts Better than Those That Are Decoupled?

texts:
The smart contract app I am writing follows what I consider good practice - it is decoupled so that a controller contract calls a logic contract which calls a storage contract. So Contract A calls Contract B calls Contract C.

However, I'm wondering if, because of security, such decoupling is a good idea for smart contracts. That's because I need the onlyOwner modifier to tie down who calls my functions (as describe here: https://github.com/ethereum/wiki/wiki/Solidity-Features). To my mind, it would be great if I could do something like this:

import "Owned.sol";

contract A is Owned {

   B private b;

   function A(address B) {
       b = B(b);
   }

   function myInterface() public onlyOwner {
       a.doStuff({from: msg.sender});
   }
}

contract B is Owned {

   C private c;

   function B(address c) {
       c = C(c);
   }

   function doStuff() public onlyOwner {
       c.store(42,{from: msg.sender});
   }
}

contract C is Owned {

   int private theAnswer;

   function store(int value) public onlyOwner {
       theAnswer = value
   }
}

However, I believe I can't send msg.sender that way. Hence, would I be better bundling Contract A, Contract B and Contract C into a single monolithic contract where msg.sender is valid?


texts:
What's the best way to calculate with dates in solidity, in particular, getting the total number of days between the start date and end date?

Also

What's the best way to get the current date/time in solidity?

Much appreciated.


texts: Deploying the Greeter contract via the geth CLI is not registering in my private blockchain

texts:
I am running a local private Ethereum blockchain using:

geth --networkid 60098 --genesis CustomGenesis.json --nodiscover --maxpeers 0 --rpc --rpccorsdomain "http://localhost:3000" --datadir "./data" console

It runs fine. I can mine some coins to fill the coinbase account and see a balance in it.

My problem is that my contract deployment transaction does not record into the blockchain. I tried the Greeter tutorial from the docs at GitHub wiki.

Relevant statements that I ran from that article are:

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

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

Compiles fine, and then I used this command to deploy the contract:

var _greeting = "Hello World!"

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

var practice_acct = '0x0ff4e0dfc7f4b94b4ab6a83e922fe1ac9ac1a625'; //verified to have sufficient coins

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

Then I get this back after entering my passphrase and trying to output the greeter:

  Unlock account 85b1a00f429811eed0f56ceff9ae19de047ab9fe
  Passphrase:
  undefined
  greeter
  {
    address: undefined
  }

I even tried directly pasting the ‘Web3 deploy’ code from the online Solidity compiler using the tutorial source. Still no address returning.

Any ideas where my problem might be?


texts: How to make my tx broadcasted faster to a miner node?

texts: Is there any way to config my Go-Ethereum node so that it can send my tx directly to a miner node, which makes the transaction faster to be included into a block.


texts:
I've recently started learning about smart contracts and came across this example.
Bob and Alice make a bet on the weather tomorrow. The smart contract gets the weather data the next day and automatically pays the winner.
My question is what if the loser's wallet is empty? How does the winner get their money?


texts:
Is there any fee other than network fee that QuikNode charge while creating a new account or sending a new transaction?

Also, is it on production network or testnet?


texts: Can I see an example that shows the use of .arrays and push(unint x) method in solidity 0.6?

texts:
I'm having problem to understand  why the method push() does't work on Remix using Solidity 0.6.

I have read the documentation about arrays fixed size and dynamic size
doc reference

for example in this code:

pragma solidity ^0.6.0;

contract Prova
{

   function prova() public{

      uint[] memory array;
      array.push(4);

   }
}

I always get the error: :

  TypeError: Member "push" is not available in uint256[] memory outside
  of storage.

Someone can show me sole example about arrays in solidity.
I'm learning.
Thanks a lot.


texts: Tx stuck even after using gasestimation for gas limit

texts:
I am trying to sign a manual transaction using ethereumjs-tx to interact with a smart contract.
This is how I am getting my gaslimit, nounce and data for the params
 var GAS = await cont.methods.withdraw("100000000000000000").estimateGas({from: address},
 function(error, estimatedGas) {
      console.log(estimatedGas);
    });
    console.log("gas limit is"+GAS);

    var nonce = await web3.eth.getTransactionCount(address);
    console.log(nonce);

    var hexData = await cont.methods.withdraw("100000000000000000").encodeABI();
    console.log(hexData);

And this is how I am declaring the params for ethTx object :
  const params = {
            nonce: nonce,
            to: contractAddress, //address of the receiver
            value: '0x000', // value in hexa format
            gasPrice: web3.utils.toHex('100'),
            gasLimit: GAS,
            chainId: 42, // 1 for main ethereum chain
            data: hexData
          };

This is the txHash for the code after running the script txhash.
I am not sure what I am doing wrong. Please help me get into the right path. Thanks!


texts: Contract deploy error with web3.py: Incorrect argument count

texts:
I am trying to deploy ERC20 based token with web3.py. I successfully compiled the solidity contract, but get an error when I deploy. The exception is raised in this line:

tx_hash = contract.deploy(transaction={'from': w3.eth.accounts[2], 'gas': 410000})

The full deployment script:

   import json
    from web3 import Web3, HTTPProvider,TestRPCProvider
    from solc import compile_source, compile_files
    from web3.contract import ConciseContract

    compiled_sol = compile_files(["DappToken.sol"])
    # print(compiled_sol.keys())
    contract_interface = compiled_sol['DappToken.sol:DappToken']
    # print(contract_interface['bin'])
    # print(contract_interface)

    # web3.py instance
    w3 = Web3(Web3.HTTPProvider("http://127.0.0.1:7545"))
    # print(contract_interface['abi'])
    # Instantiate and deploy contract
    contract = w3.eth.contract(abi=contract_interface['abi'], bytecode=contract_interface['bin'])
    print(contract)
    # Get transaction hash from deployed contract
    # candidates = 'hello world'
    print(w3.eth.accounts[2])
    tx_hash = contract.deploy(transaction={'from': w3.eth.accounts[2], 'gas': 410000})
    # print(tx_hash)
    # Get tx receipt to get contract address
    tx_receipt = w3.eth.getTransactionReceipt(tx_hash)
    print(tx_receipt)
    contract_address = tx_receipt['contractAddress']

    # Contract instance in concise mode
    abi = contract_interface['abi']
    contract_instance = w3.eth.contract(address=contract_address, abi=abi, ContractFactoryClass=ConciseContract)

    contract_instance.functions.transfer({'to': w3.eth.accounts[1]}, 250000, {'form': w3.eth.accounts[0]})

The exception:

Traceback (most recent call last):
  File "/home/anupam/Documents/workspace/Ethereum_Blockchain/py_intregreat_sol/py_intregrate_sol.py", line 21, in <module>
    tx_hash = contract.deploy(transaction={'from': w3.eth.accounts[2], 'gas': 410000})
  File "/home/anupam/Documents/workspace/Ethereum_Blockchain/py_intregreat_sol/py_eth/lib/python3.6/site-packages/web3/utils/decorators.py", line 57, in wrapper
    return to_wrap(*args, **kwargs)
  File "/home/anupam/Documents/workspace/Ethereum_Blockchain/py_intregreat_sol/py_eth/lib/python3.6/site-packages/web3/contract.py", line 323, in deploy
    deploy_transaction['data'] = cls._encode_constructor_data(args, kwargs)
  File "/home/anupam/Documents/workspace/Ethereum_Blockchain/py_intregreat_sol/py_eth/lib/python3.6/site-packages/web3/utils/decorators.py", line 16, in _wrapper
    return self.method(objtype, *args, **kwargs)
  File "/home/anupam/Documents/workspace/Ethereum_Blockchain/py_intregreat_sol/py_eth/lib/python3.6/site-packages/web3/contract.py", line 763, in _encode_constructor_data
    arguments = merge_args_and_kwargs(constructor_abi, args, kwargs)
  File "/home/anupam/Documents/workspace/Ethereum_Blockchain/py_intregreat_sol/py_eth/lib/python3.6/site-packages/web3/utils/abi.py", line 182, in merge_args_and_kwargs
    len(args) + len(kwargs),
TypeError: Incorrect argument count.  Expected '1'.  Got '0'

Why do I get this error?
Where are the mistakes in the code?


texts: Expected identifier but got reserved keyword 'reference' Product public reference; ^-------^

texts:
hello guys I am a beginner.
I would like to make a function for create a contract.

I found a example on the internet  but gives me an error so I dont know what should I do.

Anyone can help me ?

pragma solidity ^0.5.0;

contract Product {
    Factory public factory;
    Product public reference;//**here's the error**
function Product(Product _reference, Factory _factory){
    reference = _reference;
    factory = _factory;
}

function haveFactoryCreateProductWithReferenceToThis() public {
    emit ProductCreated(factory.createNewProduct(this));
}

event ProductCreated(Product indexed product);
}

contract Factory{
    function createNewProduct(Product _reference) public returns (Product) {
        Product p = new Product(_reference, this);
        return p;
    }
}


texts: how to include transations in genesis block

texts:
can one please advise how to include transactions in the genesis block of private ethereum network ?

can it be done via genesis.json similarly to contract using code: parameter ?


texts: Is it logical to use "Proof-of-Authority" for a "public" blockchain?

texts:
According parity.io website:

  Proof-of-Authority is a replacement for Proof-of-Work, which can be
  used for private chain setups.

And also:

  The chain has to be signed off by the majority of authorities, in
  which case it becomes a part of the permanent record. This makes it
  easier to maintain a private chain and keep the block issuers
  accountable.

And also:

  PoA networks are well-suited to regulated industries where entities
  responsible for maintaining the network (authorities) need to be
  known, rather than remain anonymous as in mining-based chains like
  Bitcoin and Ethereum.

It is underlined to use Proof-of-Authority for a private chain.

What is the reason? And Is it logical to use "Proof-of-Authority" for a "public" blockchain, in sense of keeping decentralization?


texts: One-to-many Token Transfer with address specific values

texts: I'm trying to figure out a way to transfer some tokens from my address to multiple other addresses which all must receive a specific value associated with the specific address, how would I go about this instead of transferring one by one?


texts: Connecting with existing ganache core server

texts:
I have a ganache-core server running at port 18545 (part of an npm app)
How can I attach to it and see the transactions/blocks in that. I tried running ganache GUI and setting port number as 18545 in settings. But it doesn't show any transactions when actions are performed in the npm app


texts: Is it possible to preload contracts in the genesis block?

texts:
Here's the setup I'm trying to use:

A genesis.json with the alloc field set to include code.

"alloc": {
    "0000000000000000000000000000000000000001": {
      "code": "6060604052608f8060106000396000f360606040526000357c0100000000000000000000000000000000000000000000000000000000900480634e70b1dc14604157806360fe47b114606257603f565b005b604c60048050506078565b6040518082815260200191505060405180910390f35b607660048080359060200190919050506081565b005b60006000505481565b806000600050819055505b5056"
    }
}

Then running geth and entering (with a default account set, unlocked, and loaded): var getAndSetContract = eth.contract([{"constant":true,"inputs":[],"name":"num","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"val","type":"uint256"}],"name":"set","outputs":[],"type":"function"}])
var getAndSet = getAndSetContract.at("0000000000000000000000000000000000000001")
getAndSet.set(2, {gas: 1000000})
miner.start()
// a few blocks quickly roll in given this is on a private testing blockchain
miner.stop()
getAndSet.num()

Results in a final returned value of 3.054357634959941643970700719428062453954541146150392020568168920432276498019e+75 versus the desired 2

Here's the contract source:

contract getAndSet {
    uint public num;
    function set(uint val){
        num = val;
    }
}

This whole adventure started after coming across this line in the geth source: https://github.com/ethereum/go-ethereum/blob/290e851f57f5d27a1d5f0f7ad784c836e017c337/core/genesis.go#L56 I think I saw something about preloading contracts in the past, though I haven't been able to dig anything up. AFAIK I could be on a wild goose chase trying to make use of a half-implemented feature.


texts: Gas cost difference between uint[] and mapping(uint => uint)

texts:
When mapping for example a large integer to some integer,

uint[] index;
index.length = 1000000;
index[600001] = 4;

is it cheaper to use

mapping(uint => uint) index;
index[600001] = 4;

? one benefit of using uint[] is that it can be deleted, happens to be useful in a dApp I work on.


texts: Oraclize : Ethereum-bridge on my local private chain

texts:
I can work with oraclize only using a private chain created with testrpc.
If I try to use the ethereum-bridge over my locally created private chain it doesn't answer, nether I get message in the ethereum-bridge console.

Actually is it a supported feature or is it only possible to work with private chain created with testrpc?


texts: Getting async/await to work in truffle JS tests

texts:
I see many examples are happily using async/await in their JS tests, but it looks like mine doesn't seem to be using ES8? I'm not sure how to check.

I installed truffle using "npm install truffle" yesterday.

tests/MyToken.js:

...

beforeEach(async function() {
  instance = await MyToken.new();
});

...

Test output:

$ truffle test
Using network 'development'.

/Users/.../truffle/test/MyToken.js:13
  beforeEach(async function() {
             ^^^^^

SyntaxError: missing ) after argument list
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at /Users/.../node_modules/mocha/lib/mocha.js:231:27


texts: Calling contract from another on testrpc using web3js

texts: I want to call method of another contract. But web3js does not support from .sol so I have to hard code the source in a string. How do I deploy two contracts separately but still call the contract inside the other?


texts:
I'd like to build ETH2.0 blockchain on my computer.
And I want to know how to become a validator using that.
I read many documents but I can't get this way.
(I think that Geth is for ETH1.0. Is this right?)
Please let me know what do I have to?
Thanks.


texts: Parity Trace Issue: TraceDB resync required

texts:
I am trying to use the trace functionality included in the parity node (https://github.com/paritytech/parity/wiki/JSONRPC-trace-module) but I am having trouble configuring my node.

I have tried to run my parity node using

parity --tracing on --pruning archive

But I get the following issue:

TraceDB resync required

I have tried to reset my database by doing parity db kill and rerunning the first command but I get the same issue. Can anyone help me set up the TraceDB?

I am running parity through home-brew, version v1.8.2-beta


texts: Can I name my token or smart contract after another token?

texts: Can I name my token, for example, FakeGolem and put its symbol as FGNT? Is it "legal" if I make profit with it?


texts: Do I need a fully synced Mist wallet in order to deploy a contract?

texts: The syncing takes ages and I'm wondering if it's possible to deploy a smartcontract in Mist while its not fully synced.


texts:
If BOB have  1 Ether and Send it to alice, and at the same time send 1 lip to Eve , because the first transaction not mined yet

How  i can make sure that BOB can't send double transaction after confirme the first yet ?


texts: Pushing address to another contract's array returns TypeError: Member "push" not found or not visible after argument-dependent lookup in function

texts:
Contract User.sol has a function requestValidation which interacts with another contract. Its purpose is to push the address of the User.sol's contract owner into array pendingRequests, stored at the other contract (TrustEntity.sol).

Contract User.sol

pragma solidity ^0.4.11;
import "browser/TrustEntity.sol";

contract User {
    // State variables
    // The contract address for the TrustEntity
    TrustEntity trustEntity;
    address owner = msg.sender;
    bool verified = false;
    uint creationTime = now;
    uint level = 0;

    // Set trustEntity's deployed contract address
    function User(address _trustEntity) {
        trustEntity = TrustEntity(_trustEntity);
    }

    function requestValidation() {
        trustEntity.pendingRequests.push(owner);
    }
}

Contract TrustEntity.sol

pragma solidity ^0.4.11;
import "browser/User.sol";

contract TrustEntity {
    address owner;
    address registry;
    address[] public pendingRequests;

    function verifyUsers() {
        /*
        Whenever a user requests verification, his
        address should be pushed to the pendingRequests
        array, so it can then be fetched to verify or
        reject
        */
    }
}

Remix gives me the following error message:

browser/User.sol:19:6: TypeError: Member "push" not found or not visible after argument-dependent lookup in function (uint256) constant external returns (address)
        trustEntity.pendingRequests.push(owner);
        ^------------------------------^

I've tried to push into an array stored in the contract, which works. Like so

pragma solidity ^0.4.11;
import "browser/TrustEntity.sol";

contract User {
    // State variables
    // The contract address for the TrustEntity
    TrustEntity trustEntity;
    address owner = msg.sender;
    bool verified = false;
    uint creationTime = now;
    uint level = 0;
    address[] public pendingRequests;

    // Set trustEntity's deployed contract address
    function User(address _trustEntity) {
        trustEntity = TrustEntity(_trustEntity);
    }

    function requestValidation() {
        pendingRequests.push(owner);
    }
}

so I don't understand why it wouldn't work for another contract. Is it related to having ETH to pay for a transaction, since it's a state-altering function?


texts: ganache test returns characters instead of numbers

texts:
mapping(uint256 => uint256) public amount;

 function saveAmount(uint256 _id, uint256 _amount) public {
    amount[_id] = _amount;
 }

I have a function that saves amount in mapping. When I test this using ganache, I get a weird character values.
For example,

instance.saveAmount(1, 100000, {from: account[1]})

then, to see the amount,

instance.amount(1) which yields

  BN: 186a0

Why is it not showing 100000?


texts:
I use solidity with web3.js and know that we actually cannot return the whole struct array, but I would like to know if it is possible to return only a type in the struct as an array.

Lets say i have the following struct:

struct aStruct {
    bytes8 a;
    bytes8 b;
}

aStruct[10000] aStr;

Can I now make a function, where I return aStr.a, the whole "a" as an array?


texts:
I was trying to deploy the default truffle project following this guide: https://steemit.com/ethereum/@brennanhm/ethereum-smart-contract-testing-installing-truffle-and-testrpc

I am running the sample test project (truffle test) However, an error that keeps appearing is this:

Any help please?


texts: How do I find out what compiler version was used to deploy with MyEtherWallet

texts: If I deploy a contract on MyEtherWallet.com how can I find out what compiler version was used, for verifying the code on etherscan, etc.?


texts: How to use truffle HDWalletProvider to get more then 10 addresses with funds for test purpose

texts:
How do I need to call HDWalletProvider to get for example 50 addresses with funds?
The networks part in my truffle.js configuration file looks like this:
networks: {
    development: {
      provider: function() {
        return new HDWalletProvider(mnemonic, "http://127.0.0.1:8545/", 0, 50);
      },
      network_id: '*'
    }
  }

With this, I have 50 addresses but it looks like only the first 10 have funds.
I am trying this with the following versions:
Ganache CLI v6.12.2 (ganache-core: 2.13.2)
Truffle v5.3.2 - a development framework for Ethereum


texts: What are you "buying" when you purchase an ethereum in Coinbase?

texts: Just bought 2 ethereums on coinbase recently. What exactly did I purchase? I want to understand what the intrinsic value of an ethereum is in the long run...probably will hold on to them until the value increases significantly and then sell. But just wanted to know what is it that's being "bought" & "sold" on coinbase


texts: Select from array / struct by not using the index

texts:
Here is the code on how to grab from and array:

struct Collection {
    uint collectionId;
    uint collectionType;
    address collectionOwnerAddress;
    uint value;
}

Collection[] public collections;

function getCollection (uint _collectionId) view public returns (uint) {
     return collections[_collectionId].value;
}

My question is: I'm curious if I can grab the collection by the collection owners address. Something like this? Can I select by both msg.sender and collectionType?

function getCollection (uint _collectionType) view public returns (uint) {
     // select by _collectionType and msg.sender here
     return collections[msg.sender].value;
}

I'm trying to incrementally increase the value. So during addCollection if the array doesn't exist with that member then it creates a new array.push row. But, if the user already has an index in the array it collections[_collectionId].value++ instead of adding another array index row for that user. This above question relates because I cant loop through the whole collections array to see if that member already started a collection.


texts: Why is shared mutable state on the ETH network considered problematic?

texts: I understand shared mutable state as describing a situation in which two or more parties control the same data. If their lifetimes or execution periods overlap, this can cause an issue. But in the context of ETH, why is this an issue as long as transactions are ordered in  first-in first-out basis?


texts: web3js: what's the difference between web3 and Web3 object?

texts:
I am new with Ethereum technology. I am studying web3js javascript library from the official documentation(https://github.com/ethereum/wiki/wiki/JavaScript-API#web3) and i don't understand the difference between web3 and Web3 object. Why can i not use directly web3 for example in this code (in my html file):

var web3istance= new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); ...

Why Web3 if the object is web3? (Sorry for my bad english)


texts: Error while buying test ether from https://faucet.metamask.io/ - Mastering Ethereum

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

When requesting 1 ether from faucet I get the following error:

{"error":"[ethjs-query] while formatting outputs from RPC '{\"value\":{\"message\":\"Internal error\",\"code\":-32603}}'"}

The wallet seems to have plenty of ether available so I'm not sure what the exact issue is. Can someone please provide guidance? Thanks.


texts: In web3, how can I fetch a range of block timestamps most efficiently?

texts: Given a range of block numbers, how can I most efficiently fetch the timestamps for those blocks?  I couldn't find a simple call to fetch the timestamp at a certain height other than fetching the full blocks.  Is there a more efficient way?


texts: How are Tokens issued to Bitcoin investors for ICO based on Ethereum

texts:
I was looking to know how an Ether based ICO can Accept & Reward Tokens to its Bitcoin donors. I understand that ether can be tracked & reward can be issued to the Donor's ether address automatically but lots of successful ICOs have accepted multiple Crypto currencies like BTC, DASH, LITE. What would be the way to go about this?

There is very little hands-on information available, would be great if someone who has done an ICO could demystify the process.


texts: What are best practices for submitting multiple sequenced transactions with web3?

texts:
I have a dapp that, as part of one logical user operation, must issue an approve() call on a token contract followed by a call to another contract that will use the funds. Since these each require user-authorization I have to issue them at about the same time.  Some options that I can see include:

Submitting both sequentially but as fast as possible (the nonce will keep them ordered).
Chaining (waiting) on the approve tx until I get its transaction hash and then submitting the transfer tx.
Chaining as in #2 but introducing a short artificial delay between submissions.
Using the batch API?

I am currently doing #2 (chaining).  The effect that I see is that normally the user gets two popups to confirm and it is fine.  (I have seen Metamask combine them into one dialog sometimes but I don’t know what triggered this - timing related?). The problem is that occasionally this just seems to fail and one of the transactions is never presented to the user.  I’ve had reports of this happening on multiple platforms and in multiple wallets.

Is this what #4 (the batch API) is for?  I did some experiments with it but it appeared to me that no one was using this API and it was a bit dated.  I was concerned about how well supported it was in various wallets and I wasn’t sure it actually helped the issue.

EDIT: Another issue that may rule out the batch API is that it does not appear to provide a way to get the transaction hashes for the submitted transactions, making it impossible to monitor them properly.

Thanks!


texts:
I am trying to deploy Solidity contract in Remix for my study purpose.

However, I failed to deploy SmartMesh contract in Remix (below, I attach the link for the code):
https://etherscan.io/address/0x55f93985431fc9304077687a35a1ba103dc1e081#code

After some trials, I found that the contract can be deployed if I remove the transferProxy function from the contract. But I don't know the reason.

Could you help me how can I deploy this contract including transferProxy function?


texts: Why would one borrow Dai instead of buying from exchange ? if i have $150 worth ether i can borrow $100 worth Dai. With 8% stability fee basically at 8% interest rate. On the other hand i can just exchange ether for Dai and get $150 worth Dai without any interest. what is the logic here


texts: What is the differenc between Person and Account variables

texts:
What is the difference between Person and Account?

struct Account {
    address addr ;
    uint balance ;
}

Account[ ] public accounts;

function applyInterest () public returns ( uint ) {
    for ( uint i = 0; i < accounts . length ; i++) {
        // apply 5 percent interest
        accounts [i]. balance = accounts [i]. balance * 105 / 100;

& Person is:

Person[] public people;

uint256 public peopleCount;

struct Person {
    string _firstName;
    string _lastName;
}

function addPerson(string memory _firstName, string memory _lastName) public {
    people.push(Person(_firstName, _lastName));
    peopleCount += 1;
}

If I use:
People[0] .push(…..), I am getting syntax error on Remix IDE.

Somebody please guide me.

Zulfi.


texts: Web3- Sending data to Ganache and then loading a new page to retrieve the same data back

texts:
JAVASCRIPT
const address = '0x2537155193458a51c99d840e3dBc1f60E004aA85';
var contract = new web3.eth.Contract(abi,address);
console.log(contract);
$('#invoice-btn').click(function(){
contract.methods.genInvoice($('#invoice').val(),$('#productName').val(),$('#date').val(),$('#prodQuantity').val(),$('#unitPrice').val(),$('#gst').val()).send({from:"0x6F43d25a062e2cb48bF83dB76afC797210321945", gas:300000})});
  });

I sent this form data to the smart contract on a click event. Now what i want is that as soon as the data is sent,a new page loads and i get this data on that new page.
JAVASCRPT
Following is the code which i have written to get data back from the smart contract. This script will run when the new page is loaded. The data returned will be injected in the specific portions of the html document.
contract.methods.getPriceDetails(invoiceNo).call().then(price=>{console.log(price)});
contract.methods.getProductDetails(invoiceNo).call().then(prod=>console.log(prod));

Someone please suggest me a way to achieve this. Should i put an anchor tag around the button and then render a new page. I am using express server on localhost:3000


texts: Is it possible to create functions with specific addresses?

texts:
I want to do functions involving a few specific addresses. They are defined as such at the top of the contract :

 address lockaddress = 0x36667BCBBE6574520fba783410beB6C0AfDE5043; //replace with real lockaddress
address companyaddress = 0x49CcAF0ca6afd79Be35b908b34431b553cF21e9b; //replace with real companyaddress
address team1 = 0xdE6B5637C4533a50a9c38D97CDCBDEe129fd966D; //replace with jeffs address or whoever deploys the contract

They are then called in this function.

function UnlockLocked () public {
 if (LockTime1 + 730 days <= now) {
   if (address(msg.sender) == team1) {
       _balances(address(lockaddress)) =
       _balances(address(lockaddress)).sub(_balances(address(lockaddress)));
       _balances(address(team1)) = _balances(address(team1)).add(45000000000000000000000000);
       emit Transfer (address(lockaddress), team1, 45000000000000000000000000);
   }
   else {

   }
  }
  else {

  }
}

The error seems to revolve around _balances, which is defined as such

  mapping (address => uint256) private _balances;

I get errors such as :

TypeError: Type is not callable
TypeError: Expression has to be an lvalue.

Is it actually possible to create functions using specific set addresses? If so, how can I fix these errors?


texts:
I am quite confusued on how users should select the account they want to use with dapps. Before version 0.9.0 of mist I could just use web3.eth.accounts[0] and let users select what account they want to use via the identity chooser of mist.

This seems quite hacky to me, but at least it worked.

However since the release of version 0.9.0 this approach is broken. I guess it doesn't work anymore, because mist does not ship with it's own version of web3 anymore?

So what is the proper way to let users choose the account the want to use in general and especially with mist version 0.9.0?


texts: What '--cache, --maxpeers' settings should I use for geth nodes?

texts:
I start my geth nodes with --cache=2048 --maxpeers=50 parameters, but I'm not sure about it.

What should I use for servers with 8/16/32G RAM?

Can the higher amount of --maxpeers increase the speed of broadcasting my transactions?


texts: Where are the best places to buy ether with the least resistance and lowest fees?  Is there something like local bitcoin, but for ether?


texts: I did my first transaction to wallet and now i'm waiting for confirmation completed. How long does it usually take to complete? As you can see, i'm waiting for about 3 hours and still not even one confirmation


texts: How to use Smart contract which was successfully mined through Nodejs

texts:
I am able to successfully mine one simple contract through NodeJs. But don't know how to use that contract mined address in another nodeJs file or geth server.
Below Steps I have followed

1) started the geth server as
geth --dev --rpc --rpcaddr "10.203.60.97" --rpcport "8046" --rpccorsdomain "*" --datadir "./data_2" --port "30303" --maxpeers 4  --unlock "0" --ipcpath "C:\\Block_Chain\\Eth_2\\data_2\\geth.ipc" console

Contract:

contract Test {
    uint testVal;
   function Test(uint testValue){
       testVal=testValue;
   }
   function multiply(uint a) returns(uint d) {
       return a * 7 *testVal;
   }
}

2) created the node js file ethereum.js file

var Web3 = require('web3');
var web3 = new Web3();
var solc = require('solc');
web3.setProvider(new web3.providers.HttpProvider('http://10.203.60.97:8046/'));

var input = 'contract TestMultiply { uint testVal; function Test(uint testValue){ testVal=testValue;}function multiply(uint a) returns(uint d) { return a * 7 *testVal; } }';

var output = solc.compile(input, 1);

for (var contractName in output.contracts) {
    var byteCode = output.contracts[contractName].bytecode;
    var abi =  JSON.parse(output.contracts[contractName].interface);
    var myContract = web3.eth.contract(abi);
    var testValue = 30 ;
    var multiplyContract = myContract.new(
   testValue,
   {
     from: web3.eth.accounts[0],
     data: byteCode,
     gas: 4700000
   },function(e, contract){
    if(!e) {
      if(!contract.address) {
        console.log("Contract transaction send: TransactionHash: " + contract.transactionHash + " waiting to be mined...");
      } else {
        console.log("Contract mined! Address: " + contract.address);
       console.log(multiplyContract);
       console.log('Multiply Val  ' + multiplyContract.multiply.call(10));
}
    }
  else{
  console.log("Error Occured");
  console.log(e);
  }
});
console.log("Print Contract : " + multiplyContract );
}

3) executed the js file in node js

C:\Block_Chain\Node_js>node ethereum.js
Print Contract : [object Object]
Contract transaction send: TransactionHash: 0x852d568a21fbea5f7e09e96d1b5a2fd977a3ea91bf5d9f2709899d7247e90e4f waiting to be mined...
Contract mined! Address: 0xf98c996940904c994694df2bc7a5810d455a519a

4) trying to use contract in geth server it is giving the error

multiplyContract.multiply.call(10))
ReferenceError : multiplyContract is not defined

And if I am trying to use this contract using another js file it is returning 0 value instead of 2100 as per my contract function.

Test.js:

var Web3 = require('web3');
var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider('http://10.203.60.97:8046/'));
var mylTest= web3.eth.contract([{"constant":false,"inputs":[{"name":"testValue","type":"uint256"}],"name":"Test","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"a","type":"uint256"}],"name":"multiply","outputs":[{"name":"d","type":"uint256"}],"type":"function"}]).at('0xf98c996940904c994694df2bc7a5810d455a519a');

console.log('Multiply Val  ' + mylTest.multiply.call(10));  --> returning 0

Could you please look into the issue and help

Any help will be highly appreciated.
What I am doing wrong.


texts: Need OpenCL library for cpp-ethereum on Alpine

texts: I am trying to build cpp-ethereum on Alpine, and I quickly discovered that I don't have quite the same set of libraries available via apk that I have on Ubuntu via apt-get.  I have built leveldb, cryptopp, libjson-rpc-cpp, and miniupmpc from source without any problem.  However, I've run into a problem with OpenCL sources.  There is a sweet little installation script that usually does everything I need, but the script depends on ldconfig working the same way on Alpine as it does on Ubuntu/Debian.  There is no ldconfig -p on Alpine, ldconfig requires a target, and the default target on Ubuntu doesn't even exist on Alpine.  Has anyone resolved this successfully and built cpp-ethereum on Alpine?


texts: Is there an official and public pool of miners/"stakers" participating in the Ethereum blockchain?

texts:
With the last discussion about PoW vs PoS, Ethereum planning migrating to pure PoS (Casper), new actors in the scene (EOS)...I have digged into this PoS, pros and cons against PoW.

One of the things that I could not find is a list/pie of validators, as I can find for the Bitcoin blockchain (https://www.blockchain.com/pools).

Does exist such a thing?

Thanks in advance.


texts: How to set token holder's address without duplication?

texts:
In following code I've implemented two functions to set and get Token holders.

 function setTokenHolders(address _to)internal returns(bool){
    for(uint i = 0; i<= tokenHolders.length; i++){
        if(_to != tokenHolders[i]){
            tokenHolders.push(_to);
            return true;
        }
        else{
            require(_to == tokenHolders[i],"Redundant token holder addresses.");
        }
    }
}
function getTokenHolders()public view returns(address[] memory){
    return tokenHolders;
}

My array's 0th element is initialized with my msg.sender.
The logic of if is not worked as assumed.


texts: Is there a way to get event signature using web3.js?

texts:
I have abi of a contract and I am using it to construct Contract instance of web3js:
const pairContract = new web3.eth.Contract(ABI_JSON);

Reading the documentation, I see that there is a contract.events property, which should give me access to computed signature, e.g.
pairContract.events;

{
  Sync: [Function: bound ],
  '0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1': [Function: bound ],
}

I want to get signature for the Sync event. How do I do this?
To be clear, I know that I can calculate the signature myself if I know the event name and parameter names, e.g.
web3.utils.sha3('Sync(uint112,uint112)')

The question is only if web3js provides a convenient way to get event signature just by knowing the event name.


texts:
I don't like using safemath as this is my first conntract and this is getting a bit complicated for me so:

function withdraw(uint xyz) public {
    require(balanceOf[msg.sender] >= xyz);
    balanceOf[msg.sender] -= xyz;
    msg.sender.transfer(xyz);
    Withdrawal(msg.sender, xyz);
}

Basically will "require" do the job here? Can someone send the request from account with 0 causing underflow somehow or not? thanks!


texts: Is there a specific command to know which version of web3.js has been installed on our machine ?


texts: Find a lost private key in text files on Mac

texts:
I have been developing a web app and used many autogenerated ETH addresses. I stored all of them into one folder in the next format:

/storage
  123456789/
    mainnet.eth.privateKey:
      "0xdeadbeefdeadbeef...deadbeef"
    mainnet.btc.privateKey
      "Kw123123123...AbCDeF"
  .../

Where the dir is always some generated number, and it stores raw private keys (WIF for bitcoin).

During development, I have used a few addresses to store real ETH. But unfortunately, I haven't keep track of the IDs for those addresses. And one of this addresses now has some amount of ETH which would be nice to get back.

However, the amount of directories is overwhelming (over 100 at least), because they've been autogenerating for each launch if not provided.

Still, I am pretty sure it sits on one of the machines I have been developing on. Of course, Now I can go through them manually, checking one by one, but that would be too long, in the end, there is no millions locked.

So the question is if there is any utility that automatically searches a private key and matches address to given address or a tool that just checks a balance for any string that looks like private key?

Maybe there exists a command line snippet to check balance for found private-keys-alike string?


texts:
I don't know why I'm getting this error while deploying 2 of my contracts.

  creation of Hourglass errored: transaction execution failed

while code compiles successfully no issues there.
Duringdebugging TX it highlights on pragma solidity ^0.4.23 which means it is not going next to this statement. and in console i get this error:
creation of Hourglass errored: transaction execution failed.

`

pragma solidity ^0.4.23

contract Hourglass {

    mapping(address => bool) public administrators;

    /*=======================================
    =            PUBLIC FUNCTIONS            =
    =======================================*/
    /*
    * -- APPLICATION ENTRY POINTS --
    */
    constructor() public    {
        // add administrators here
        administrators[msg.sender] = true;
    }


texts: Confusion over RLP encoding for byte array > 55 bytes

texts:
I am reading through the wiki on RLP (https://github.com/ethereum/wiki/wiki/RLP) and think I am missing something fundamental.

For byte arrays (not lists) greater than 55 bytes, the RLP encoding is 0xb7 plus the length in bytes of the byte array in binary form, plus the length of the byte array plus the byte array.

Is there a difference between the length in binary form and the length in general?  I would assume they are the same?  Is this a typo, or am I missing something fundamental?

The wiki actually uses the term string instead of byte array, but since they are interchangable I though it more suitable.


texts:
I sent a large amount of UTK to Coinbase (stupidly).
The Hash is 0xdc3e9a82c4aac374cc8ee76c840401cdaee2b0677d9d54ac86bbd820af2bfc7f.
The new holder's address is 0xae14f2ebb89b14ac6e98876516a884ebbc77a1ae.
I appreciate you are all busy but I am new to this and just need to know is it lost or is there any hope?
Thanks.
MJC


texts: Cross Origin Blocked? Setting up Infura provider

texts:
useEffect(() => {
    const loadWeb3 = async () => {
      const web3 = new Web3(
        new Web3.providers.HttpProvider("https://mainnet.infura.io/censored")
      );

      let n = await web3.eth.getBlockNumber();
      setBN(n);
    };

    loadWeb3();
  }, []);

here's is the snippet from my react app...

console says Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://mainnet.infura.io/censored (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘https://localhost:8100’).


texts: Reading events of the inner Solidity contract with Web3

texts:
Let's say I've got

contract A {
    event E();

    function a() public {
        emit E();
    }
}

contract B {
    A private a;

    function b() public {
        a();
    }
}

Now my Dapp is calling the method b:

const contractB = new web3.eth.Contract(BAbi, address)
const receipt = await contractB.methods.B().send({ /* options */ })
const {events, logs} = receipt

events will contain one encoded event. The event will not have an event name and not decoded arguments (in the returnValues field). Thinking of it this makes sense cause the event description wasn't put into the ABI of contract B but into the ABI of A. So the event description wasn't event supplied to a contract.


texts: How are transactions on large data done in a smart contract?

texts:
I am presently working on a project involving read and write operations on a huge database. The database is structured in such a way that there is a key, and for the key there is a corresponding set of data. Now, I would like to consider each of these operations as transactions in a smart contract. There are two ways of doing this:

Construct a struct that would contain the key as well as the set of data corresponding to the key.
Simply store the keys and a pointer to the set of data stored in an external database. I was thinking of using Oraclize for accessing the database.

If the first option is considered, it is definitely not a practical choice as storing such large data directly on a blockchain is not possible. But if the second option is considered, then isn't the external database prone to tampering, thus having no point to build it on a blockchain.

Effectively, I am looking for building a blockchain based application that deals with Big data keeping the security of the data in mind.


texts:
I want to only limited users(addresses) can do a transaction.
For example, in a Lottery pool, an only limited user can join it.


texts: How to calculate the assigned txHash of a transaction?

texts: Solidity does not support txHash variable yet, but it has been requested at EIP 901 https://github.com/ethereum/EIPs/issues/901 . Meanwhile how could I calculate the txHash of a transaction using Solidity code in the Smart Contract? I guess txHash is built upon some keccak hashing of the msg.sender and probably the nonce of the request, right? Is there a canonical formula for the Ethereum txHash calculation? Thx!


texts: How to claim Simoleon Token using Parity

texts:
This morning, I found 10,000 Simoleon in my parity wallet.  I found this Reddit Post which helped me to understand that this is an airdrop token from EA games for use in the SIMs.

One post says that you can claim your token by transferring them. How do I activate / claim these tokens using Parity?

and

Where am I supposed to transfer them to?


texts: What programming languages was Uniswap's open-source code written in?

texts:
Uniswap is a decentralized exchange that is actually a decentralized app where people can trade ERC-20 tokens without a middleman.
Uniswap's code is open-source:

https://github.com/Uniswap

Was the Uniswap code written purely in solidity, given the high number of .sol filename extensions? What other programming languages were involved?
Separate from the underlying architecture, how about the Uniswap interface, which I assume is the GUI that we interact with in our web browser when actually trading/swapping tokens. What language was it written in?


texts: When MetaMask removes the Cancel button for a transaction?

texts:
When I start a transaction, MetaMask shows it with Cancel button.
When does this Cancel button disappear? Maybe after one confirmation? After N (what is N?) confirmations?


texts: How to change the state mutability of a function in solidity?

texts:
I'm a newbie in solidity coding, so please forgive me for my ignorance.

I'm trying to create a token based on openzeppline and while using the HasNoTokens.sol contract, I'm receiving the following warning in remix:

browser/mytoken.sol:446:3: Warning: Function state mutability can be restricted to pure. function tokenFallback(address from_, uint256 value_, bytes data_) external {^Spanning multiple lines.

I reckon I've to change the way tokenFallback() function behaves. I'd greatful if someone could explain what is wrong here and how to fix this.


texts: Where can I download the Mist browser? (NOT the Ethereum wallet)

texts:
I want to download the Mist browser (as opposed to the Ethereum Wallet accessible via ethereum.org) but can't find a link.

The Github repo (https://github.com/ethereum/mist) and latest release page has a link for the Ethereum Wallet but not for the full Mist browser as far as I can see.

Can anyone point me in the right direction?

Thanks


texts: Trying to use eth_call to contract function which takes an address as it's argument

texts:
I'm trying to call a function on my smart contract that's deployed on the main Ethereum network.

The function signature is balanceOf(address).

So far I've followed the instructions of doing the SHA3 hash of this so I get: 0x70a08231.

Now I want to send the address there, in the instructions it says to pad the parameters to 32 bytes. As I understand it, Ethereum addresses are 20 bytes like so: 0x4Ef58B0097A47fb07e9e10e4da92ed27DF36aFFF. Does this mean I should do something like 0000000000000000000000004Ef58B0097A47fb07e9e10e4da92ed27DF36aFFF?

Could someone help me to create the 'params' part for a eth_call. I've followed this tutorial here: How to call a contract method using the eth_call JSON-RPC API. And I understand how to do it if the parameters were an int for example. But how to do it for the address above?

An ideal answer would show the data that I need to send and explain the steps :)

So far I have the data part as this:

[{"to": "0x722180f08646A73f744f33eD66fD3C990DC6a78B", "data": "0x70a08231000000000000000000000000E676c814EaD2Ae27f706fC3067015a75eb4A94A5"}]

The error I currently get is "Invalid method parameters - missing value for required argument 1".

Thanks


texts: Do I have to set pruning to archive for supportive full node

texts:
I run a parity node on a server of mine (with a lot of resources and bandwidth) for the sole reason of supporting the network. I don't have any accounts there since my funds are on another machine.

Currently I use the default settings for everything but would like to know if I should change anything, for example set --pruning to archive to make the node more usefull for others


texts:
Let's suppose here are 2 EOA(A and B) and 1 contract.
A has no token, B has 10token(erc20).

A approve B to spend 10token(do not consider gas)
B execute 2 functions in turn following via contract in single TX

transfer 10token to A
transferfrom A to B 10token

Is this logic possible? If not, how can I make it? The point is step2 should be made in single TX.


texts: Transaction dropped and replaced but token didnt come back

texts:
Need your expert help.
I had few SNX tokens in my MEW. I tried to send them to my binance wallet. Being a foolish, I set a low gas.
Original transaction - https://etherscan.io/tx/0xe34d75435b843e791c0914b6ab2f29fe444dafbc2c9cdddf733bbf7ecb983b1c
I waited 9-10 days and seeing that it is still pending i followed instruction to send 0 eth tran to myself with same nonce. it was successful but the token didn't come back.
https://etherscan.io/tx/0xfd7384664c55dfb32ac8681b7d5ad3262557e66d686f59be192d0dd2c74968bf
please advice


texts: How to retrieve from mapping type ( I would like to retrieve struct elements from mapping)

texts:
pragma solidity ^0.4.8;

contract A {

    event trace(address a);

    struct details { string name; uint roll ;}

    mapping (address => details) public testMap;

    function set (string name, uint roll) {

        Student instance = new Student(name, roll);
        testMap[instance] = details(name,roll);

    }

    function get (address a) {

        testMap[a];

        // Here , from the mapping of address - I am trying to retrieve the struct and the corresponsing elements
    }
}

contract Student {

    function Student(string name, uint roll) {

    }

}


texts:
I want to execute signed Ethereum transactions from a NodeJS program. I am creating a web3_provider like this

var contract = require("truffle-contract");

var provider = new HDWalletProvider("nemonic", "https://rinkeby.infura.io/xxxxx");
// if I change the above line to: var provider = new Web3.providers.HttpProvider("https://rinkeby.infura.io/xxxxx");
// Everything works fine
var web3 = new Web3(provider);

var myContract = contract(myABI);
myContract.setProvider(web3.currentProvider);

When I try to execute transactions w/ HDWalletProvider, I get the error: "Account not found". Has anyone been able to use HDWalletProvider to successfully execute signed transactions? Or am I using it incorrectly?


texts:
Can some body please guide me how to install Oyente on Windows 10? I have found Oyente for Linux but not for windows on github. Some body please guide me.

Zulfi.


texts:
I'm currently struggling to interact with my smart contract, I don't if it comes from the way I call the function or the way I connect to my smart contract. Here is the code

const contractAddress = '0xf85fe12e1eb30844422e95252b68bb1fbbbe7fc6';

const Web3 = require('web3');

window.addEventListener('load', async function () {
    if (typeof web3 !== 'undefined') {
        console.log('Web3 Detected! ' + web3.currentProvider.constructor.name)
        window.web3 = new Web3(web3.currentProvider);

        await ethereum.enable();
        console.log('address: ' + web3.eth.accounts[0])

        web3.eth.getBalance(web3.eth.accounts[0], (err, wei) => {

          console.log('le balance est ' + web3.fromWei(wei, 'ether'))
        });

        var contract = new web3.eth.contract(ABI).at(contractAddress);//, contractAddress);
        //console.log(contract);
        console.log(await contract.isOpen.call());
        // console.log(await contract.methods.isOpen.call());
        //console.log(await contract.methods.isOpen());

    }
    else {
        document.getElementById('output').innerHtml = 'Please download and install Metamask: https://metamask.io/'
    }
})

here, the error in the browser

  index.js:482 Uncaught (in promise) TypeError: Cannot read property
  'isOpen' of undefined

at index.js:482

I have no problem with it on server side with nodejs and infura, but on client side using metamask, web3 functions looks like different, no?

Thanks for you helps


texts: I'm wondering whether governments will be able to compel ISPs to block access to blockchains or blockchain-based applications. Any thoughts?


texts: Federated Decentralized Identities Across multiple public blockchains (bitcoin, ethereum, etc) through interledger

texts:
are Federated Decentralized Identities across multiple public blockchains (bitcoin, ethereum, etc) through interledger possible?

I.e., ones identity can be synced across different blockchains

This will create multiple overlays of decentralized identities thereby allowing one to consume services on different blockchains and a significant improvement in resiliency -- decentralized identities of identities.


texts: Restore wallet in Exodus using JSON file

texts:
I've a wallet file in the JSON format with address, cipher, ciphertext, salt, etc (version 3).

How can I restore it into Exodus wallet?

In Developer menu I can only see Restore from 12-word phrase....

I'm using Exodus desktop app (v1.51.0) on macOS.


texts:
I'm following the tutorial here: https://medium.com/@mvmurthy/full-stack-hello-world-voting-ethereum-dapp-tutorial-part-1-40d2d0d807c2

First, I got the error "Error: Invalid JSON RPC response". Then I search for answers and I found that I didn't run testrpc ( very "fullstack" tutorial, really, like the all other "complete" tutorials about ethereum...

Anyway, I found a solution here, open another terminal and run geth console and type:

admin.startRPC("127.0.0.1", 8545, "*", "web3,db,net,eth")

This time I got an "empty" list for web3.eth.accounts. I tried to add manually but I couldn't do it also.

Is there any possible solution for this?


texts: Is the EVM memory model a word array or byte array?


texts: How can I read/write ethereum as a database by python code?

texts: I am a startup in this domain. I see some article about Ethereum could save data as a contract. But they are too complex to me. If I already have an Ethereum account with some ETH. Is there some python code could just simply write some data to ethereum & read it back when needed with this account? This data (or contract) no need to interactive with other account or contract on Ethereum, for example like greeting function, just only record data. Thanks a lot for any reply


texts: Getting complete state of a smart contract

texts:
From the yellow paper, I figured out that a contract has 4 components
1. nonce, 2. balance, 3. code, 4. storage. To know about the current state of a smart contract we need to know the all these components of a smart contract.

If I am using a geth client to get the state of smart contract, I can use

1.eth.getBalance(address) to get the balance of a contract

2.eth.getCode(address) to get the code of a contract

3.eth.getTransactionCount(address) for nonce

4.And similarly, eth.getStorageAt(address, index) to fetch the storage at a particular index.

I could neither find a way to download the complete storage at once nor a way to download the complete state of the contract directly.

  So are there any way to get the full state of a contract?

Question regarding complete state has been asked here but the answers are not very helpful.


texts:
I used Geth.aar library for ethereum and it's running completely on same device.

But when I changed device and restore wallet from seed at that time new address is generated instead of previous address.

Because Geth.aar runs on file and in different device it creates new file and according to that file it creates new address.

Is there any way in Geth.aar to generate same address every time on any device?


texts:
I am trying to build a docker image using open zepplin libraries. It works until it has to import the zepellin library, for which it can't seem to find.

Here is what my docker image looks like :

FROM node:10-alpine

WORKDIR /usr/src/app

ENV UV_THREADPOOL_SIZE 64

COPY cdp-contracts/ ./rpc
COPY cdp-platform/  ./backend

RUN rm -rf backend/node_modules
RUN rm -rf rpc/node_modules

RUN apk add --no-cache --virtual .gyp \
    autoconf \
    automake \
    g++ \
    libpng-dev \
    libtool \
    make \
    nasm \
    python \
    git \
  && npm i -g wait-on concurrently truffle npm@latest \
  && concurrently 'cd rpc;  npm init -y ; npm install --save-exact openzeppelin-solidity; npm init -y ; npm i npm@latest -g ' 'cd backend; npm i npm@latest -g ; npm rebuild bcrypt --build-from-source' \
  && apk del .gyp

WORKDIR /usr/src/app/rpc

RUN truffle compile --all

WORKDIR /usr/src/app/backend

RUN mkdir -p build/
RUN ln -sf ../../rpc/build/contracts build/contracts

WORKDIR /usr/src/app/backend

EXPOSE 3001

CMD [ "npm", "run", "middleware" ]

Here is the import line from my contract :

import "../node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";

  Note: From the documentation:

  After that, you'll get all the library's contracts in the
  node_modules/openzeppelin-solidity/contracts folder. Because Truffle
  and other Ethereum development toolkits understand node_modules, you
  can use the contracts in the library like so

import 'openzeppelin-solidity/contracts/ownership/Ownable.sol';

contract MyContract is Ownable {
  ...
}

Reference: https://openzeppelin.org/api/docs/get-started.html

When I try to reference the node module, or call it import it as above, I keep running into this error:

  Error: Could not find
  /usr/src/app/rpc/node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
  from any sources; imported from
  /usr/src/app/rpc/contracts/CarbonToken.sol
      at /usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-resolver/index.js:76:1

I will appreciate any guidance on this


texts:
For the following stripped down version of my code.

pragma solidity ^0.4.17;

contract Managers{

    struct Manager{
        uint index;
        bool isHead;
        bool isManager;
    }

    mapping(address => Manager) managerAddresses;
    address[] public managerAddressesArr;

    modifier isHead(address sender){
        require(managerAddresses[sender].isHead);
        _;
    }

    modifier isManager(address sender){
        require(managerAddresses[sender].isManager);
        _;
    }

    constructor(address[] _managerAddresses) public{
        for(uint i=0;i<_managerAddresses.length;i++){
            managerAddresses[_managerAddresses[i]] = Manager(i,false,true);
        }
        managerAddresses[msg.sender] = Manager(managerAddressesArr.length,true,false);
        managerAddressesArr = _managerAddresses;
        managerAddressesArr.push(msg.sender);
    }

}

contract UploadFactory is Managers{

}

I am unable to deploy the uploadFactory contract using remix. I keep getting the error

  This contract does not implement all functions and thus cannot be
  created.

When I deploy the uploadFactory contract.

If you want to see the full code you can find it here but the problem is the same.

https://ethfiddle.com/cFVgjmQJwW


texts:
Ethereum 2.0 nodes communicate through a libp2p network. Two indicators of talking to "correct" nodes on the same network are the "fork digest" and the "fork version" parameters.
How can I easily get the Ethereum 2.0 network's fork digest and fork version?


texts: Difference between Account Extended Private Key and BIP32 Extended Private Key

texts:
I was using this this useful tool to verify that my wallet generation process was accurate, however when I thought I was generating an Account Extended Private Key, I realized I was actually generating a BIP32 Extended Private Key.

What is the difference? Can I derive an Account Extended Private Key from a BIP32 Extended Private Key or have I done something wrong?

EDIT: I see on the page there's a small explanation next to each field.

Account Extended Private Key: The account extended keys can be used for importing to most BIP44 compatible wallets, such as mycelium or electrum.

BIP32 Extended Private Key: The BIP32 derivation path and extended keys are the basis for the derived addresses.

Can I have a more detailed explanation for the differences on how to derive these?


texts: How to replace on going mainnet deployment?

texts: I'm using truffle to deploy my contracts on mainnet. I need to replace a deployment transaction by manually setting nonce. I couldn't find a way to use nonce on truffle deployer. Is there any method , so that i can replace ongoing migration ?


texts: Is etherDElta exchange decentralized or semi-decentralized?

texts: Is etherDelta truely decentralized that lives on the blockchain itself or is it prone to a single point of failure? Obviously the website itself is centralized, but what if I wanted to fire up my own local instance of etherdelta to interact with the decentralized exchange. Is this possible and how?


texts: How do I switch from geth only to using geth + Mist, or parity + Mist?

texts:
I was using geth (have quite a few accounts in here too) from the command line only on a different computer. I moved the files in keystore over to this computer I have now.

With the bug, all my balances show up as 0 on my other computer. The 1.4.12 hotfix seemed to only fix the crashing.

I want to switch over to something else for now at least and start using this computer for Ethereum management. When I open up Mist, accounts aren't automatically added from the keystore folder. Not sure how this program works yet.

What do I do with the files in my AppData\Roaming\Ethereum\keystore that I copied from the other computer folder to import it into Mist? Hopefully the geth bug gets fixed soon.


texts: Can a smart contract see the blockchain history?

texts: Is it possible for smart contract to view past transactions done on it, in other words would it be possible for a smart contract to see who has sent it Ether since its inception?


texts: Are Ethereum accounts multi-tenanted (multi-coined?)

texts:
There are many ERC20 tokens/coins

If you know an ethereum account number, e.g. 0x6D6E8411B0507dA903D1E9f32E6cc42951F3C17f (pulled at random from etherscan)

Can this account be used to transfer/hold multiple coins?  E.g. Ethereum and TRX and BNB etc?

I.e. when you look at the transaction history for an account, you cant tell what coin the transaction is for (many transactions haven a value of 0 Ether, presumably because they are transferring something other than ether)?


texts: Private PoA deployment leads to 'invalid gas used' error

texts:
I'm trying to deploy a contract to a private clique chain running on two devices (laptop and raspi). Deploying the contract when running multiple nodes on a single device worked fine as per usual, both via truffle migrate when directly deploying from the js console inside Geth (PC: 1.9.19, PI: 1.8.27). The nodes happily mine away, however, when I try to deploy the contract to the multi-device chain, it repeatedly throws the following error:
########## BAD BLOCK #########

Chain config: {ChainID: 12345 Homestead: 0 DAO: <nil> DAOSupport: false EIP150: 0 EIP155: 0 EIP158: 0 Byzantium: 0 Constantinople: 0 ConstantinopleFix: 0 Engine: clique}

Number: 301

Hash: 0xea47e7c5b1200e51752ff7575e08fc1b0f8f96cf2074f7db4b9dabe8933b9394

 0: cumulative: 406318 gas: 406318 contract: 0x2d34066AA9FCbb0aD41889F97A84008d0975B3C2 status: 1 tx: 0x7963ddc11b391ffca9a8fcfe55b8daeafe87c3dd9b57118f99ce1763230f3f13 logs: \[\] bloom: 0... state:
Error: invalid gas used (remote: 342202 local: 406318)

##############################

I have no clue where this difference in gas used comes from.
Things I've tried so far:

deploy from signing node

deploy from non-signing node

deploy via truffle migrate

deploy manually via bytecode

Any clues on why this occurs and how it can be fixed?


texts:
I'm new to all this and I'm trying to code a bot.
The bot is picking up new listings on uniswap but when it goes to put through a transaction I'm getting a gas error.
I'm getting..
(node:7820) UnhandledPromiseRejectionWarning: Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={"reason":"cannot estimate gas; transaction may fail or may require manual gas limit","code":"UNPREDICTABLE_GAS_LIMIT","error":{"code":3,"response":"{\"jsonrpc\":\"2.0\",\"id\":6,\"error\":{\"code\":3,\"data\":
Can anyone shed light on how I set the gas or gas limit?
I've tried lots of different things but it keeps erroring.
Thanks in advance..


texts: Value error: Calling 1inch contract with web3.py but having problems with the ABI

texts:
i am trying to get the quote from 1inch regarding the Ethereum/DAI price. I am new to Web3.py and need some additional help regarding the following problem.
My code:
import json
from web3 import Web3

w3 = Web3(Web3.HTTPProvider('https://mainnet.infura.io/v3/<My Infura ID>'))

one_inch_split_abi = json.load(open('abi/one_inch_split.json', 'r'))
mcd_abi = json.load(open('abi/mcd_join.json', 'r'))

base_account = "0xA5E421c63b2314ae93c20D5f6021De44DF650b56"

def one_inch_get_quote(_from_token, _to_token, _amount):
    '''
    Get quote data from one inch split contract using on-chain call
    '''
    # load our contract
    one_inch_join = w3.eth.contract(
        address=one_inch_split_contract, abi=one_inch_split_abi)

    # make call request to contract on the Ethereum blockchain
    contract_response = one_inch_join.functions.getExpectedReturn(
        _from_token, _to_token, _amount, 100, 0).call({'from': base_account})

    # logger.info("contract response: {0}".format(contract_response))
    return contract_response

mcd_contract_address = w3.toChecksumAddress('0x6b175474e89094c44da98b954eedeac495271d0f')  # DAI Token contract address

ethereum = w3.toChecksumAddress('0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE') # Ethereum address

one_inch_split_contract = w3.toChecksumAddress('0xC586BeF4a0992C495Cf22e1aeEE4E446CECDee0E') # 1inch address

ethereum_price = one_inch_get_quote(ethereum, mcd_contract_address, w3.toWei(1, 'ether'))

print(ethereum_price)

With this code in python i get the following error message:
ValueError: Could not format value {"Here is the code within the 1inch ABI"}


texts: Problem with implementing ERC-20 interface in Solidity contract

texts:
I'm trying to implement contract which interacts with ERC-20 via interface. Code of interface was taken from openzeppelin github.
The problem is that it fails any transaction which triggers contract func.
What have I done wrong? :(
Example: Following func checks if sender has enough tokens of ERC-20 and sender allowed to spend tokens earlier. If conditions are success it transfers tokens from sender to custom contract address.
    function deposit(uint256 amount) public {
        require(tokenContract.balanceOf(msg.sender) >= amount, "Sender has not enough balance");
        require(tokenContract.allowance(msg.sender, address(this)) >= amount, "Contract is not allowed to transfer tokens");
        require(tokenContract.transferFrom(msg.sender, address(this), amount) == true, "Could not send tokens from the buyer");
    }

Extra info:

sender has enough tokens to spend
sender has approved custom contract before transaction

Failed transaction url: https://rinkeby.etherscan.io/tx/0x8df7513a0da10645ce3e300399e73bb58d28dcb8bddb92bddf40945751ae69fc
Sample contract code url: https://rinkeby.etherscan.io/address/0x479a28cff2194a67ccb95ddb960d09fcbb127462#code
ERC-20 (USDT) contract code url: https://rinkeby.etherscan.io/address/0x75cb130d6bbd3d915b34573dc3dd3fb45184f12f#code


texts: What is the computing power of the Ethereum network in FLOPS?

texts:
The aproximate computing power of current Bitcoin network in terms of FLOPS (FP32) has been estimated at about ~80,000 exaFLOPS and being aware of the limits of the analogy because of the widespread use of ASICs in Bitcoin mining. I was wondering the computing power of the main Ethereum network, which is currently running on ~8900 nodes and using Keccak256 as its main hash function, which is one that could be GPU accelerated biased toward using traditional GPUs rather than ASICs, peaks now at ~242 TH/s.
A very rough estimate would be for example:

A Nvidia 1070 Ti graphics card has a hashrate of ~31 MH/s (7.5 teraFLOPS)
Current hashrate is about ~242 TH/s
242 (TH/s) / 31 (MH/s) = 7,834,101 (~58 exaFLOPS)

So, current ETH computing power is about 58 times bigger than the current world faster supercomputer Fugaku which peaks at ~1 exaFLOPS.
Is it possible to know the actual computing power (in FLOPS) of the ETH network or sum of the underlying hardware? If we're building a peer-to-peer general purpose worldwide computer, wouldn't be nice to know current power instead of just hashing rate?


texts: How can I read UTXO's for specific accounts?

texts: With bitcoin, I'd use the JSON-RPC and keep track of transactions in blocks and have to build the UTXO database myself. Is it the same with ethereum?


texts: How does the blockchain handle consistency of miner-provided values?

texts:
Some values - e.g. block.timestamp - are provided by the miner. This means that they might not be consistent between different miners. How does the blockchain handle that?

My understanding is that every block is deterministic, so that two miners who mine the same block with the same transactions will always get the same result, that anyone can reproduce. But, if the outcome of a transaction depends on a miner provided value, how can it guarantee consistency? What happens when two miners provide different values?


texts: Is there any limitation for the number of the return values from Solidity functions?

texts:
Answer of this question (https://ethereum.stackexchange.com/a/3590/4575) says that: "I am not allowed to return dynamic arrays from Solidity functions yet."

On the other hand, Solidity supports functions with multiple return values. How can I return multiple strings from a contract function?

[Q] Is there any limitation for the number of the return values in one function call. Such as, could I return N (for example N=1000) number of values or even more in one function call?

function getData() constant returns (bytes32, bytes32, bytes32, bytes32,
                                     bytes32, bytes32, bytes32, ...) {
    bytes32 a = "a";
    bytes32 b = "b";
    bytes32 c = "c";
    bytes32 d = "d";
    bytes32 e = "e";
    bytes32 f = "f";
    bytes32 g = "g";
    return (a, b, c, d, e, f, g, ...);
}

Thank you for your valuable time and help.


texts: Static difficulty in 1.8.27 for local network

texts:
I am having trouble getting geth 1.8.27 to have a static difficulty on a private network. I followed the instructions from here. But when I test it, the difficulty still increases.

I tried again, changed both intstances of CalcDifficulty, then diffed the built binary with the installed one from apt to verify they were different, then manually removed the installed one from apt, and replaced it with the one I built. Deleted the existing chains, started over, and difficulty still increased.

Am I missing something? Or did 1.8 change how it checks difficulty? Or is the make script just pulling from github and ignoring my code changes?

Thanks for any help.


texts: DAPP - Data Storage for Complex application

texts:
I am learning solidity & web3js and am able to make a decent DAPP with it using ReactJS as front end. Most of the online tutorials, online blogs etc - they all show very simple DAPP like this which are easy to explain. But in real life applications should be very complex in nature.

For ex: Lets assume I am creating a dapp in which I am interested in storing user's demographic information as well + additional info.I do not think ethereum is the right place for that.

How to handle such cases?


texts: What address deploys a contract in truffle test

texts:
I have a contract called AccessControl, in which the owner of the contract is set when it is deployed.

I want to test that the method on it setCEO updates correctly, but in order to do this the request must come from the owner of the contract.

contract AccessControl {

    address public ceoAddress;

    modifier onlyCEO() {
        require(msg.sender == ceoAddress);
        _;
    }

    function setCEO(address _newCEO) external onlyCEO {
        require(_newCEO != address(0));

        ceoAddress = _newCEO;
    }
}

When I console.log in the tests the current ceoAddress like so:

const paymentPipe = await PaymentPipe.deployed();
console.log(await paymentPipe.ceoAddress());

I see that the address is 0x0000000000000000000000000000000000000000.

When I try to call setCEO in my tests from that account like so:

await paymentPipe.setCEO(bob, {from: contractAddress});

Truffle complains:

  Error: sender account not recognized

If I try with any other account in the truffle test suite (i.e. accounts[x]) I get:

  Error: VM Exception while processing transaction: revert

Implying that the method did not pass the require statement because the calling address was not the one set as CEO.

What address are contracts deployed from in the truffle test suite? And why, if I can see an address in my contract as 0x0000000000000000000000000000000000000000 can I not use this address to call functions?


texts: Problem in compiling v0.5.0 smart contract in browser

texts: Why may be the possible reason(s) that neither Ethfiddle nor the Remix are able to compile smart contract supporting the latest Solidity version 0.5.0?


texts: Push large number of items in mapping with constructor or other methods

texts:
I would like to push large number of items into mapping. Prototype looks like this
mapping (uint => string) ipfs_hashes;
constructor() ERC721("GameItem", "ITM") public {
    ipfs_hashes[0] = "455434544345777";
    ipfs_hashes[1] = "43454d354353445";
    ipfs_hashes[2] = "687678768768786";
    ......
}

But this is just an example. I would like to put 2000 of them, so first I am not sure if contract can be that long and would it break at some point (and at which) and if there is a limit how to achive that. I could make an setter function but then I would need 2000 transaction and this would be very expensive so this is what I want to avoid. Was also thinking that maybe using some sidechain to set state like xDai could work for that. Looking for suggestions and solutions.


texts: How to remove "0" from array and readjust the size of the array?

texts:
This function works but returns zeros when condition not met.
For instance if limit is 10 it will return: 2, 3, 0, 5, 0, 7, 0, 0, 0, 0
But instead I want it to return: 2, 3, 5, 7.
Also is there a way to do so without specifying the length of primeswithoutzeros ?
I can't figure out how to solve the problem...

function sieveOfEratosthenes(uint256 limit) constant returns (uint256[] memory primeswithoutzeros){
    uint256[] memory primes = new uint256[](limit + 1);
    primeswithoutzeros = new uint256[](limit);
    for (uint256 i = 2; i < limit; i++){
        primes[i] = i;
    }
    i = 2;
    while(i**2 <= limit){
         if (primes[i] != 0){
            for (uint256 j = 2; j < limit; j++){
                if (primes[i] * j > limit){
                    break;
                }
                else {
                   delete primes[primes[i] * j];
                }
            }
         }
        i++;
    }
    for (i = 2; i <= limit; i++){
        if (primes[i] != 0){
            primeswithoutzeros[i - 2] = primes[i];
        }
    }
}

Thank you


texts: How to add Peers in Quorum Single Member Blockchain Network in Azure?

texts:
I'm using the QSMBN(Quorum Single Member Blockchain Network) provided by Azure, and I'm trying to connect one external node to the quorum network, but when I try to add peer displays this message "Request to add peer is sent", but nothing happens,
Anyone have any idea of what do I have to do?


texts:
I have a cold storage where I installed BTC-Electrum and LTC-Electrum wallets. So I have took extended master public keys and have generating addresses in my online service. Now I want to generate addresses for Ethereum but how can I understood the electrum core doesnt give xpub. So I need to use any wallets like MetaMask or MyEtherWallet. But I can not found how can I took xpub from those wallets.Can somebody help me to solve this problem?
Thanks!


texts: Two legal questions on Ethereum and Smart Contracts

texts:
1- Who answers before the judicial instances by any problem in the platform of Ethereum?

2- How does the decentralized platform of Ethereum to annul and render ineffective any smart contracts on which falls a judicial sentence of nullity?


texts:
From the Docs, how does this operation create a new "memory end"?

mstore(0x40, add(o_code, and(add(add(size, 0x20), 0x1f), not(0x1f)))

Context:

library GetCode {
function at(address _addr) public view returns (bytes memory o_code) {
    assembly {
        // retrieve the size of the code, this needs assembly
        let size := extcodesize(_addr)
        // allocate output byte array - this could also be done without assembly
        // by using o_code = new bytes(size)
        o_code := mload(0x40)
        // new "memory end" including padding
        **mstore(0x40, add(o_code, and(add(add(size, 0x20), 0x1f), not(0x1f))))**

I can follow the operators and parse the hexadecimal, however I'm never sure if I should be performing these on underlying values or the memory address values themselves (eg. 0x20 + 0x40 = 0x60).


texts: Deploying a smart contract using transaction manager in web3j

texts:
I am new to web3j and smart contract deployment.

Consider a scenario where a user is too scared to give his wallet credential file or username/password or private key in a piece of code(the code is not visible to him and he fears his credentials may be used in a way he does not intend). The user also has an offline computer(not connected to the internet) and an online computer(connected to the internet).

I have read about rawTransaction and TransactionEncoder.signMessage and if the user would have wanted to just transfer ethers, he could do both of these steps in an offline computer and then provide this signedMessage on an online computer to proceed with the transfer of funds.

Is there something similar he can do while deploying the smart contract?
Have I understood it all correctly or am I thinking of doing something which does not make sense?


texts:
Created new --bare Meteor project (release 1.8).

Used meteor npm install --save web3 to add web3 to the project from npmjs.org.

In code server.js use:

Web3 = require('web3')
console.log(Web3) // returns '{}'

Nothing else added to Meteor project. Client side use is as expected.

Toolkit: MacOS, Ganache, Truffle, Web3 version 1

I did of course discover that this can be a consequence of recursion in package dependencies

Is this a known issue? Is it a bug? What would be the best direction to go in determining the root cause of this issue?

Related SO Questions/Threads:

Meteor server side contract event watch error

Problem with meteor server side call to Ethereum node

Cannot find module 'web3' meteor

How do you connect to a node from the server side of a meteor app

Update:

After seeing many unresolved questions/issues on this, I've bumped an existing github issue for tracking. Additionally there is a Meteor Forums post, and I've created a post on the Ethereum Forums


texts: What ETH blockchain explorers do you use and what features are missing?

texts:
(It is not a duplicate. We want to get the feedback about missing features. Thank you)

There are different ETH blockchain explorers:

etherscan.io
etherchain.org
ether.fund
ether.camp
...

We (http://chain.cloud) are interested in building ETH explorer that will be simpler and will have some cool features. That is good for whole crypto-community and industry.

Do you feel that these explorers (above) have some features missing?

What do you want us to implement?


texts: What's the best way to make mass eth transfers programmatically?

texts: I am working on an issue where I need to make a mass transfer of ETH to different accounts. I do not wish to do it manually. What's the best way to make such transfers programmatically without human interference?


texts:
I found how to deploy a contract onto MEW, but I do not understand, partially due to meta references and missing/assumed knowledge.  I'm just looking from help on a walk through.  I'm including the instructions (from medium.com) with my questions

Compiling on remix.  I have an import, do need both the compiled import file or just the byteCode from the file that imported that file

I assume I should save the byteCode to one file and abi to another.  Can I edit any of the files first to bypass the passing argument?  Also do I (linux user with actual geth, not MM), type in "geth console " (then each of these):

var abi = abi_provided_by_remix;
var rowByteCode = "byte_code_provided_by_remix";

(these two are where I am asking about copying to files above)

var myContract = eth.contract(abi);

(is this  meta-reference, or explicit?)

var byteCodeWithParam = myContract.new.getData(param1,param2,{data: rowByteCode});

A few questions about the last line:
Do I have to go through the code and type in every parameter?
How do I know I didn't miss anything?
How are these separated from exercised functions performed after compile, like transfer?
What about values defined later in the contract?

Last question about the last command, is "data: rowByteCode" a meta-reference or explicit?)

Finally where is the output to copy to MEW deploy contract box?

Please don't tell me, "It's easier if you use (insert software here)."  For one reason or another, it really isn't; sorry.  For example, I only have eth in one account, but I don't have json/utc files for it, making other tools not an option


texts: Trying to run a truffle test after successful compile I have this Error: Invalid number of parameters for "undefined". Got 0 expected 1!

texts:
Here is my deploy hello js file
const hello = artifacts.require('./HelloWorld');

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

And here is the contract code
pragma solidity^0.5.16;

contract HelloWorld {

    string private name;
    mapping (address => uint256) public balance;

    constructor(string memory _name) public {
      name = _name;
      balance[msg.sender] = 1000;
    }

    function getName() public view returns (string memory) {
      return name;
    }

    function setName(string memory _name) public {
      name = _name;
    }
}


texts:
Somethings I need BN library for correct balanceOf assertion with 1e18 decimals, somettimes expectRevert. I see the different projects use it differently:
const { constants, time, ether, expectRevert } = require('@openzeppelin/test-helpers');

or
const { BN, constants, expectEvent, expectRevert } = require('openzeppelin-test-helpers');

is there any difference?


texts: Is the Solidity specification still its compiler?

texts:
I'm currently reading some literature about verification of smart contracts. One of the papers I read is Defining the Ethereum Virtual Machine
for Interactive Theorem Provers by Hirai (pirapira). In the considerations around solidity (Section 2.1) he states that:

  Solidity has a reach syntax but no specification. The only definition of Solidity is the Solidity compiler implementation.

I am wondering if it is still so or something has changed in the meantime.

P.S. I see that the team of kframework has begun to define the semantics of solidity with K Framework


texts: From what I understand, blockchains are not optimised for searching for past transactions. Does Etherscan download the data into another database for more performant querying? If so, how can it download the data and what does it use the query it?


texts: Codes works in MIST and Remix but not in Parity & MEW

texts:
uint private mySecret;

 function checkMySecret() constant returns (uint) {
  if (owner == msg.sender){
   return mySecret;
  }
 }

MIST and Remix works.
MEW and Parity does not work.


texts: How to extract function signature from msg.data

texts:
In Solidity function signatures are 4 bytes long and the formula to generate it is to hash it with the keccak256 function, like so:

bytes4(keccak256("setA(uint256)"))

The first 4 bytes of msg.data are the method signature.
How can I extract those 4 bytes from `msg.data (using Solidity of course)?


texts: Ethereum send transaction by connecting geth in another server using Javascript API

texts:
I started using Geth. and make a shell script which will end txn to another ETH address.

Step 1: Run command 'geth --fast --cache=1024' in one terminal and wait for full blockchain update.
Step 2: Run below code as send.sh in another shell.
 Command: sh send.sh 'ETH address to send ETH' 'Amount'

Code for send.sh:
    #!/bin/sh

geth attach << EOF | grep "RESULT:" | sed "s/RESULT: //"
personal.unlockAccount("My ETH Address", "password")
var txnid = web3.eth.sendTransaction({from: "My ETH Address", to: "$1", value: web3.toWei($2, "ether")});
console.log("RESULT: " + txnid);

EOF

Output: Txn id [This works perfectly, no issues but want to send transaction from another server using javascript API by connecting this server geth]

All looks fine to me. But I want to use same functionality in https://github.com/ethereum/wiki/wiki/JavaScript-API

when I try to connect localhost:8545 not working and run Javascript API call.
Not sure how to convert this code to Javascript. I am new hers any help will be great to my start up with Ethereum Javascript API.


texts: How does prefixing work exactly when signing messages?

texts:
Here's a message I've signed using web3 :

> web3.eth.sign(web3.utils.soliditySha3("xyz"), "0x00a329c0648769A73afAc7F9381E08FB43dBEA72", "testing").then(console.log);
Promise {
  _bitField: 0,
  _fulfillmentHandler0: undefined,
  _rejectionHandler0: undefined,
  _promise0: undefined,
  _receiver0: undefined }
> 0xbddd506ff736e03c1c25eaefbc7d73ead76c34135bd7d2f0c626735a7246ac612ed1b71915e8e9131ef7b0711ac2cfef62cbef2e22d4c1cce8f273fd285240cb1b

If one tries to verify it using etherscan with:

[Step 1] Address: 0x00a329c0648769A73afAc7F9381E08FB43dBEA72
[Step 2] Message Signature Hash: 0xbddd506ff736e03c1c25eaefbc7d73ead76c34135bd7d2f0c626735a7246ac612ed1b71915e8e9131ef7b0711ac2cfef62cbef2e22d4c1cce8f273fd285240cb1b
[Step 3] Enter the original Message that was signed: xyz

Result would be Message Signature (with Geth Prefix) Verified. Pass!

But etherchain is giving Invalid signature! which I suppose is because of the prefix.

I've tried these as Message but none works :

\x19Ethereum Signed Message:\n32xyz
\x19Ethereum Signed Message:\n320x9dd2c369a187b4e6b9c402f030e50743e619301ea62aa4c0737d4ef7e10a3d49
\x19Ethereum Signed Message:\n329dd2c369a187b4e6b9c402f030e50743e619301ea62aa4c0737d4ef7e10a3d49
\x19Ethereum Signed Message:\n32ÒÃi¡´æ¹Äð0åCæ0¦*¤Às}N÷á
=I

What is the right Message?

Back to web3

> web3.eth.accounts.sign("xyz","0x177be4516179d50d87ed895505f84ea95189d8a74b59a54adac0466cfc436aaa")
{ message: 'xyz',
  messageHash:
'0x47c659bdb805bd39452735d0acd70fafc43394fccbcd22897f98e58fd97c32f4',
  v: '0x1b',
  r: '0x...',
  s: '0x...',
  signature: '0x...' }

messageHash stays the same for every key, which is

> web3.utils.sha3("\x19Ethereum Signed Message:\n3xyz")
'0x47c659bdb805bd39452735d0acd70fafc43394fccbcd22897f98e58fd97c32f4'

Question 1: In solidity the prefix has to be \n32 instead of \n3 for ecrecover to work. Why?

Question 2: Why I am getting a wrong public address when:

> web3.eth.accounts.recover("0x47c659bdb805bd39452735d0acd70fafc43394fccbcd22897f98e58fd97c32f4", "0x1b", "0xbddd506ff736e03c1c25eaefbc7d73ead76c34135bd7d2f0c626735a7246ac61", "0x2ed1b71915e8e9131ef7b0711ac2cfef62cbef2e22d4c1cce8f273fd285240cb")
'0xf70Ec3f5A4eeDDc0fce9Ebe244CaBD22B5A49C95' !!!!!


texts: Purpose of the function with the contract's name?

texts: What is the purpose of the WithdrawalContract function in this case? If becomeRichest doing exactly same but with a certain condition and adding a pending withdrawal to the pendingWithdrawals.


texts:
Update!
I have my node running with geth --rpcapi txpool --rpc

var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider('http://127.0.0.1:8545'));
console.log(web3.txpool);

I still receive

undefined

With

web3.eth.extend({   property: 'txpool',   methods: [{
    name: 'content',
    call: 'txpool_content'   },{
    name: 'inspect',
    call: 'txpool_inspect'   },{
    name: 'status',
    call: 'txpool_status'   }] });
web3.eth.txpool.content().then(console.log).catch(console.error)

I am still getting only { pending: '0x0', queued: '0x0' }

How can this be? I'd expected hundreds of transactions.


texts: Why is Ethereum's key generation so much faster than GPG's?

texts:
Ethereum uses asymmetric public/private key pairs to generate its accounts. So does GPG.

GPG key generation takes ages and needs lots of time/entropy. Ethereum doesn't. Why the big difference?