texts: How do I burn the exact ETH gas amount within a Solidity function?

texts:
What I am trying to do is simply increase the gas costs of running a solidity function, making sure that the right amount of gwei is spent/burned.

Any good, simple, and a clean way of doing this ?
-Solidity version is 5.x

Note: a different approach can be this (also a question I asked)
How to send ETH to address(0) from msg.sender address using a token's contract, Solidity 5.x?


texts:
pragma solidity ^ "0.4.24";

contract Origin {

struct OriginInfo
{
    string airportName;
    uint32 checkInTime; //In timestamp
    uint8 bagWeight;
    address clientAddress;
    bool itsHere;
}
mapping (uint256 => OriginInfo) origins;
uint256 public originNonce;

constructor() public
{
    originNonce = 1;
}

function insertOrigin(string _airportName, uint32 _checkInTime, uint8 _bagWeight)
    external
{
    origins[originNonce] = OriginInfo(_airportName, _checkInTime, _bagWeight, msg.sender, true);
    originNonce += 1;

    recoverOrigin(originNonce);
}

function recoverOrigin(uint256 _originId)
    private view //cambiar a private
    returns (string, uint32, uint8, address, bool)
{
    OriginInfo memory origin = origins[_originId];
    return (
        origin.airportName,
        origin.checkInTime,
        origin.bagWeight,
        origin.clientAddress,
        origin.itsHere
    );
}
}

pragma solidity ^ "0.4.24";

import "./TraceabilityProcedures/Origin.sol";

contract Travel is Origin{

struct TravelInfo {

    Origin origin;
}

mapping(uint => Travel) travels;
uint public travelsRegistryCount;

function addOrigin (string _airportName, uint32 _checkInTime, uint8 _bagWeight){
    insertOrigin(_airportName, _checkInTime, _bagWeight);

}

}

I have this files and I not able to declare de identifier because I dont now what is the problem. The problema appear here:

  insertOrigin(_airportName, _checkInTime, _bagWeight);

Any help??

EDIT:

pragma solidity ^ "0.4.24";

contract Origin {

struct OriginInfo
{
    string airportName;
    uint32 checkInTime; //In timestamp
    uint8 bagWeight;
    address clientAddress;
    bool itsHere;
}
mapping (uint256 => OriginInfo) origins;
uint256 public originNonce;

constructor() public
{
    originNonce = 1;
}

function insertOrigin(string _airportName, uint32 _checkInTime, uint8 _bagWeight)
    public
{
    origins[originNonce] = OriginInfo(_airportName, _checkInTime, _bagWeight, msg.sender, true);
    originNonce += 1;

    recoverOrigin(originNonce);
}

function recoverOrigin(uint256 _originId)
    private view //cambiar a private
    returns (string, uint32, uint8, address, bool)
{
    OriginInfo memory origin = origins[_originId];
    return (
        origin.airportName,
        origin.checkInTime,
        origin.bagWeight,
        origin.clientAddress,
        origin.itsHere
    );
}
}

pragma solidity ^ "0.4.24";

import "./TraceabilityProcedures/Origin.sol";
import "./TraceabilityProcedures/Tape.sol";
import "./TraceabilityProcedures/Plane.sol";
import "./TraceabilityProcedures/Destiny.sol";

contract Travel{

struct TravelInfo {
    uint test;
    //Origin origin;
}

mapping(uint => Travel) travels;
uint public travelsRegistryCount;

function addOrigin (string _airportName, uint32 _checkInTime, uint8 _bagWeight) public {
    insertOrigin(_airportName, _checkInTime, _bagWeight);

}
}


texts: Call contract from another account using web3.js

texts:
I have a contract with which 2 accounts should interact.

The accounts are in the same node in web3.eth.accounts.

The contract was created by accounts[0].

How can I call that contract from accounts[1] from web3.js?


texts:
When I deploy my truffle smart contract on test networks like Ropsten and Kovan, can I interact with it using multiple PCs at once simultaneously?
And will the data updated from one PC be visible on another?


texts: What is the wallet path for credentials in web3j?

texts:
I am using the readme guide https://github.com/web3j/web3j. What I am interested is developing smart contracts from my host with java + web3j to private ethereum network which runs on my virtual machine. There are such lines:

Web3j web3 = Web3j.build(new HttpService());  // defaults to http://localhost:8545/
Credentials credentials = WalletUtils.loadCredentials("password", "/path/to/walletfile");

So the question is - how should I create this wallet? Should I generate account on my VM and then copy wallet.json file to my host?


texts: What will happen to my ETH share when POS goes live?

texts:
I have been seeing that ETH will be moving to a PoS validation framework. These validators will be paid in ETH. It seems to me that this means if I do not stake, my ETH portion will be continuously diluted; whether EIP 1559 results in deflationary supply change, net zero, or otherwise, it seems that those with the largest ownerships will continuously absorb new ETH and increase their percentage ownership, while mine will constantly go down. Does this mean, to secure a steady/increasing ownership percentage, I MUST stake?
The reason I ask this is because of taxes. If I am forced to stake to secure my percentage ownership, this means I will constantly be 'paid' in ETH, which will (in the current tax structure) incur taxable gains. While this isn't necessarily bad, what happens if I am paid at high ETH prices, but when taxes come due ETH has dropped? That would be a horrible feeling for me.


texts:
How can I implement a meta transaction using ethers.js library.

My transaction is to transfer 100 tokens from 0xAccountA to 0xAccountB.

The transaction will be signed by 0xAccountA but the gas should be payed by some other 0xAccountC.


texts: Minimal wallet application for a cold storage

texts:
I wonder if there are some convenient set of tools (or a wallet application itself) to work on a cold storage.

As I can understand (correct me if I'm wrong) to work with a cold storage I only need to have abilities to:

generate a private key of a new wallet
get the public key and the address of the wallet from the private key
sign transactions generated by other apps (watch-only wallets) with the private key

Is there are some apps that support all the basic tools that one need on a cold storage computer to work with an Ethereum wallet?

OS: Linux or Windows.


texts: Local geth node for Ropsten keeps crashing and lost data

texts:
I am creating a local geth node participating in Ropsten to test my smart contract with other smart contracts such as ENS and Oraclize.

Somehow I keep running into problem of geth crashing and losing all the synchronised data.

The stacktrace of the crash is too long to post it here. So I will just post the beginning and end of the crash.

...

This is the truffle console output when I run eth.isSyncing() last night before I go to bed and this morning.

In the background, I also ran command to deploy my smart contract to the local ropsten geth node. When I ran command last night, it sort of hang there and I assume it is because my local geth is not in-sync thus it is queuing and will be completed when the node is in-sync. Here is the screenshot.

The command I used to start geth is as follows:

geth --mine --testnet --datadir "~/github/ethereum_r/hello_world/testnet_data" --rpc --rpcapi eth,net,web3,personal --etherbase 0 --unlock 0 --password ~/github/ethereum_r/hello_world/password

I noticed Ropsten network is mining block at a rate of about 1 block per minute. I am wondering is that the reason why my node crash.

I turned on the mining so that I can observe my transaction being mined and confirmed. Is it required? I am suspecting perhaps it the mining that causes the crash.


texts: arguments of the sha256 function in Solidity

texts:
In Solidity, I find that the sha256 function can be used like this a = sha256(uint b, string c, bool d, ......) (the arguments can be a combination of different types, and the other types can also be included.)

What does sha256 do with the arguments of different types?


texts: Can't send ETC using Ledger with MyEtherWallet

texts: I have an address that has both ETH and ETC. They are in Ledger Nano S. I transferred ETH to the address and it works fine. Then I transferred ETC to the same address. Now I tried to use MyEtherWallet to transfer ETC and it gives an error "invalid network id". I didn't use the ETC in the Chrome App earlier and didn't realize there was a different address (legacy). How do I get my ETC from there to my legacy address in the ETC chain?


texts: If I am pulling in data from SQL and sending it to a contract using web3.eth, can the data be manipulated in anyway, between the SQL->Arrival at Ethereum contract bridge?


texts: Create unique address per user and get notification of incoming transaction

texts:
With bitcoin I can getnewaddress for a specific user, and then receive a notification when a transfer comes in, which I can use to match to that particular user.  I was wondering how I would go about doing something similar with ethereum.  I'd prefer to use the RPC if possible for as much as it as I can.

Thanks.


texts: Using ethminer on linux (ubuntu) using integrated intel GPU

texts:
To give ethereum mining a try, I'd like to run ethminer on my laptop's intel integrated graphics.
To do this I have installed the intel-opencl-icd package, however, when I run ./ethminer -P eu1.ethermine.org, I get the following error:
ethminer 0.18.0
Build: linux/release/gnu

Unrecognized platform Intel(R) OpenCL HD Graphics
CUDA Error : No CUDA driver found
Error: No usable mining devices found

I've tried several "recent" version of ethminer and always got the same error.
Is there a version of ethminer that works with integrated intel graphics?


texts: This type is only supported in the new experimental ABI encoder - why?

texts:
I have the following struct and the contract stores an array of it:

struct Issuer {
    address id;
    bytes32 name;
    IssuerStatus status;
    uint index;
}

I also have a function that returns Issuer by its index in the array:

function getIssuerAtIndex(uint index) public view returns (Issuer) {
    return issuers[issuersIndex[index]];
}

I use solidity 0.4.21. VS Code highlights red Issuer as the return type in the function and displays the error:

TypeError: This type is only supported in the new experimental ABI encoder. Use "pragma experimental ABIEncoderV2;" to enable the feature.
function getIssuerAtIndex(uint index) public view returns (Issuer) {
                                                          ^-------^

I can't figure out why is that type not supported as return type. Any ideas?


texts: Any understandable cryptography book/article/lecture to introduce to signatures, hashes, ECDSA etc..?

texts:
It's a long time I'm searching for cryptography lectures related to ethereum inside mechanisms, and everything I found has a high mathematical level. I'm an engineer, not a mathematics, so any article or lecture recommended with an acceptable mathematical level?

Thanks!!


texts: Is it possible to generate a priv key from scratch?

texts:
I'm just figuring out how to create my personal keypair in an isolated computer.
By this way all the solutions that I've found are installing software from third parties. Even if I choose to use geth, you would need an inet connection to install it in your computer.

So:

1.- Is there a way to make this keypair by myself? for example through gpg or openssl
2.- What are the structure of these keypairs? I suppose that there is much more than a 64 hex string to take into account in order to generate one priv key.

Thanks in advance!!


texts: How do I fix Javascript stack overflows when compiling very large file with solc?

texts:
If I compile a very large file with solc the stack overflows.  This will happen most commonly in node because the default stack is only 984kbytes, which is strangely what you would expect for a 1990s era program, except node isn't 1990s.

This is the error you get:  not ok 1 RangeError: Maximum call stack size exceeded

It is likely that the the javascript wrapper solc is using has an O(n) stack behavior, e.g. recursive function.


texts: Calling view functions when user does not have a web3 provider

texts:
I am building a React App. I built it using a truffle box. The first thing the app does is try and get Web3, I understand that this allows the app to communicate with the blockchain. This works well as long as the user has a browser extension (let's say Metamask) allowing to get web3.
What I would like to know is how can I give access to the app to users that do not have Metamask? I guess that I could re-write a different render without any blockchain-based information for these users, but that is not what I want. I would like to still display information that does not need their signature (basically call view/pure functions). Is this even possible? How do the other apps deal with this?
Thank you
Edit: here is my getweb3 function
import Web3 from "web3";

const getWeb3 = () =>
  new Promise((resolve, reject) => {
    // Wait for loading completion to avoid race conditions with web3 injection timing.
    window.addEventListener("load", async () => {
      // Modern dapp browsers...
      if (window.ethereum) {
        const web3 = new Web3(window.ethereum);
        try {
          // Request account access if needed
          await window.ethereum.enable();
          // Acccounts now exposed
          resolve(web3);
        } catch (error) {
          reject(error);
        }
      }
      // Legacy dapp browsers...
      else if (window.web3) {
        // Use Mist/MetaMask's provider.
        const web3 = window.web3;
        console.log("Injected web3 detected.");
        resolve(web3);
      }
      // Fallback to localhost; use dev console port by default...
      else {
        const provider = new Web3.providers.HttpProvider(
          "http://127.0.0.1:8545"
        );
        const web3 = new Web3(provider);
        console.log("No web3 instance injected, using Local web3.");
        resolve(web3);
      }
    });
  });

export default getWeb3;


texts: Can a Coin be liquid during its ICO period?

texts: I am planning to run a Coin's ICO for several years, not interested in the gains to be made from selling out ICO in 3 days NO, but interested in using the COin to end Global Poverty as i deem fit. So a lenghty ICO is one solution. That said I want to know if its possible for the coin to be liquid during the ICO of like 2-4 years. If it is possible for its liquidity then suggest how that can be done please.


texts: How to increase the number of test accounts?

texts:
I have encountered a problem where I need a large number of test accounts.
How can I increase the number of test accounts from 10. Remix and ganache only give 10 accounts. I require more than that.


texts: accessing truffle contract abstractions from external JS script

texts:
When writing tests in truffle (v3.2.1) I can forget about things like a contract's ABI and address and just use ContractName.deployed() to interact with a contract on my testrpc chain. How can I mimic this behavior in my external Javascript code, that is, not by using truffle's built-in console or truffle test? Is there a library I need to import in my script or do I need to manually get the ABI and deployment address of the contract as if I was not using Truffle?

I'd be also fine if I could use those contract abstraction by running my JS code through truffle, but I'm not sure of how would I do that.

Thanks!


texts: Blocktime zero (period:0) with clique in permissioned blockchain

texts:
I am considering to set the blocktime to zero (clique.period:0) in a permissioned private blockchain with known but untrusted nodes. The reason to do this is

having a minimum transaction process time
sparing disk space
having a minimum time to synchronize new nodes due to less blocks

I have some questions about this:

Is this setup then more or less like hyperledger fabric behaves concerning transactions and blocks?
What are the security concerns around this approach in the given use case (permissioned/known nodes)?
Is this approach the correct one to reach my three goals (see above)?


texts:
I have been testing with evm and I am not getting any output.

Code -

pragma solidity ^0.4.18;

contract d8 {

    function myBalance() pure public returns (uint) {
        return 880;
    }

}

My asm is from here -

solc --asm d8.sol > d8.asm

Then I tried -

evm compile d8.asm

Not much happens (output is a blank line).

I tried various options and adding "run" at the end but nothing produced any output.

Has anyone any suggestions?


texts: Signature in Ethereum: Are all a transaction fields signed?

texts:
Assume a transaction is tx. My question is that

Question 1: Does a sender sign all fields in a transaction and put the signature in the transaction?, so does it send  to the network?

Question 2: Is there anything in a transaction not signed by the sender?


texts: Are uncle blocks unnecessary overhead on blockchain?

texts:
I have been learning about ethereum but now am stuck with conflicting thoughts about block times and stale blocks. Here is what I understood, please correct me if I am wrong.

Block time for bitcoin - 10 minutes -
Which is kept so that the probability of wasted computed hashes are around 10%, which claimed are manageable.

Block time for ethereum - 15 to 19 seconds - Now, even though stale blocks occur in this time period, they are demarcated as uncle blocks which can be accepted uptil seven generations.

So, for bitcoin, only the first accepted block gets rewarded and all the rest stale blocks are then discarded.

However, for ethereum, I am not able to wrap my head around this. Even if stale blocks are added every 15 seconds, doesn't this add unnecessary non functional blocks to the blockchain? Hereby, hampering it's performance in any way? Or are these uncle blocks do provide some functionality?

For example if 5 blocks are added, and every block has 7 generations of uncles, doesn't this mean 5*( 7 generations ) quantity of stale blocks. Isn't this bad?

Are the thoughts correct?


texts:
I am trying to create a dividend function for my token. This is in the first part of the contract for my coin:

mapping (address => uint256) private _SavedDividend;

Here is the constructor code:

constructor() public payable ERC20Detailed(tokenName, tokenSymbol, tokenDecimals) {
  _mint(msg.sender, _totalSupply);
  _SavedDividend = 0;
}

Here is my view and withdraw dividend function:

function ViewDividend(address staker) public view returns (uint256) {
require(msg.sender != (address(0)));

  _SavedDividend = _balances[this].div(_totalSupply).mul(_balances[msg.sender]);
  return _SavedDividend;
}

function WithdrawDividend() public {

  emit Transfer(address(this), msg.sender, _SavedDividend[msg.sender]);
  _balances[this] = _balances[this].sub(_SavedDividend[msg.sender]);
  _SavedDividend[msg.sender] = 0;
}

I get a multitude of errors with these including:

  TypeError: Mappings cannot be assigned to.
      _SavedDividend = 0;

  TypeError: Type int_const 0 is not implicitly convertible to expected type mapping(address => uint256).
      _SavedDividend = 0;

  TypeError: Mappings cannot be assigned to.
      _SavedDividend = _balances[this].div(_totalSupply).mul(_balances[msg.sender]);

  TypeError: Type contract Miasma is not implicitly convertible to expected type address.
      _SavedDividend = _balances[this].div(_totalSupply).mul(_balances[msg.sender]);

  TypeError: Type uint256 is not implicitly convertible to expected type mapping(address => uint256).
      _SavedDividend = _balances[this].div(_totalSupply).mul(_balances[msg.sender]);

  TypeError: Return argument type mapping(address => uint256) is not implicitly convertible to expected type (type of first return variable) uint256.
      return _SavedDividend;

I don't understand what these mean. How do I fix this?


texts: convert bytes to uint8[8] using mstore()

texts:
I know how to convert bytes to uint8[8] using mload but mstore seemed like it could be more gas efficient.

Is something like this possible?

function bytesToUintArray(bytes input) returns (uint8[8])) {
    uint8[8] result;
    assembly {
        mstore(result, add(input, 32))
    }
    return result;
}


texts: How does metamask know a contract is for ropsten or for main network?

texts:
Im using this code to detect for metamask.

Now im using ropsten but i want to know how does metamsk know that my contract only works with ropsten?

window.addEventListener('load', async () => {
    // Modern dapp browsers...
    if (window.ethereum) {
        window.web3 = new Web3(ethereum);
        try {
            await ethereum.enable();
            var accounts= await web3.eth.getAccounts();
            var option={from: accounts[0] };
            var contract = new web3.eth.Contract(abi,address);
            const agiContract = new web3.eth.Contract(agiabi,agiContractAddress);

            const balance = await contract.methods.balanceOf(accounts[0]).call();
            const myDivs = await contract.methods.dividendsOf(accounts[0]).call();

            var supply = await contract.methods.totalSupply().call();
            var agiBalance = await contract.methods.totalAgiBalance().call();

            const agiAccountBalance = await agiContract.methods.balanceOf(accounts[0]).call();

            document.getElementById('agiAvailable').innerHTML = agiAccountBalance/100000000;
            document.getElementById('agiContractBalance').innerHTML = agiBalance/100000000 + ' AGI';
            document.getElementById('contractBalanceSnet').innerHTML = supply/100000000 + ' SNET';
            document.getElementById('snet-holding').innerHTML = balance/100000000;
            document.getElementById('myDividends').innerHTML = myDivs/100000000;
            document.getElementById('wallet').innerHTML = accounts;

            ethereum.on('accountsChanged', async (accounts) => {
              await ethereum.enable();
              var accounts= await web3.eth.getAccounts();
              var option={from: accounts[0] };
              var contract = new web3.eth.Contract(abi,address);
              const agiContract = new web3.eth.Contract(agiabi,agiContractAddress);

              const balance = await contract.methods.balanceOf(accounts[0]).call();
              const myDivs = await contract.methods.dividendsOf(accounts[0]).call();

              var supply = await contract.methods.totalSupply().call();
              var agiBalance = await contract.methods.totalAgiBalance().call();

              const agiAccountBalance = await agiContract.methods.balanceOf(accounts[0]).call();

              document.getElementById('agiAvailable').innerHTML = agiAccountBalance/100000000;
              document.getElementById('agiContractBalance').innerHTML = agiBalance/100000000;
              document.getElementById('contractBalanceSnet').innerHTML = supply/100000000;
              document.getElementById('snet-holding').innerHTML = balance/100000000;
              document.getElementById('myDividends').innerHTML = myDivs/100000000;
              document.getElementById('wallet').innerHTML = accounts;
            })
        } catch (error) {
            // User denied account access...
            console.log(error)
        }
    }
    // Legacy dapp browsers...
    else if (window.web3) {
        window.web3 = new Web3(web3.currentProvider);
        // Acccounts always exposed
        web3.eth.sendTransaction({/* ... */});
    }
    // Non-dapp browsers...
    else {
        document.getElementById('wallet').innerHTML = "Use Metamask on a Desktop or use TrustWallet on a mobile";
        document.getElementById('agiAvailable').innerHTML = "BUY ";
    }
});


texts: Can anyone suggest mobile wallets (both IOS and Andriod) that supports testnet Eth? Jaxx used to (or at least the IOS version used to), but doesn't look as though it does now.


texts: function overriding is quite working when called with web3.js

texts:
function getDetails(address publicKey) public view returns (Organization memory) {
    return s.getOrg(publicKey);
}

function getDetails(string calldata orgID) external view returns (Organization memory) {
    return s.getOrg(orgID);
}

so when i call this  function from remix it works like charm but when i try to call it from my DAPP with web3 it shows error

  invalid address (arg="publicKey", coderType="address", value="653e4140-da2205-13331e9-d44495f4-53a781aaaa1a23")


texts: I am trying to setup multi channel network, every thing was working fine except my  Orderer was getting  exited immediately. As there is no Orderer I could not  proceed further. My setup consists of 3 ORGs and 1 peer for each ORG. So there should be 5 docker container processes including Orderer and cli where as when I was checking with docler ps command there were only 4 containers, docker ps -a was showing orderer Exited. Then I removed 3rd ORG from the setup and this issue got fixed. But now when I am trying other steps like creating channels, updating anchors, joining the channel etc. in between the cli is getting exited (but not immediately like orderer).  I thought this could be RAM issue and so I removed the 3rd ORG. Just wanted to confirm is this issue related to memory (RAM)? I am setting up this on ubuntu VM with 8 GB  total RAM. this is the error


texts:
pragma solidity >0.6.2 <0.7.0;

contract D {
    uint public x;
    constructor(uint a) public payable {
        x = a;
    }
}

contract C {

    address[] public addresses;
    address[] public predictedAddresses;
    // D d = new D(4); // will be executed as part of C's constructor

    function createD(uint arg) public {
        D newD = new D(arg);
        newD.x();
        addresses.push(address(newD));
    }

    function createAndEndowD(uint arg, uint amount) public payable {
        // Send ether along with the creation
        D newD = new D{value: amount}(arg);
        newD.x();
    }

    function createSalted(bytes32 salt, uint arg) public {

        address predictedAddress = address(bytes20(keccak256(abi.encodePacked(
            byte(0xff),
            address(this),
            salt,
            keccak256(abi.encodePacked(
                        type(D).creationCode,
                        arg
                        ))

        ))));

        D d = new D{salt: salt}(arg);
        require (address(d) == predictedAddress);

        predictedAddresses.push(predictedAddress);

    }

}

Couldnt execute this transaction on Remix,
Failed with this error

transact to C.createSalted pending ...
[vm]from:0x7a0...9e160to:C.createSalted(bytes32,uint256) 0x9a6...ed3f2value:1332 weidata:0x611...00020logs:0hash:0x377...81188
transact to C.createSalted errored: VM error: revert.
revert  The transaction has been reverted to the initial state.
Note: The called function should be payable if you send value and the value you send should be less than your current balance.  Debug the transaction to get more information.


texts: How to run Chainlink Project using eth-brownie python

texts:
I had installed eth-brownie using command
pip install eth-brownie

after  Brownie installed.I had bake existing Brownie project into a new directory.
mkdir MyChainlinkProject
cd MyChainlinkProject/
brownie bake chainlink-mix
cd chainlink-mix

then export infura.io project id and kovan network private key
export WEB3_INFURA_PROJECT_ID='d1f95888fba84a42adasaa37803d4b5118ee'
export PRIVATE_KEY='0x5FE9bE1eC79dFE85b2748F6fEdasd60f811a8Ee997D9'

And at the end tried this command
brownie run scripts/price_feed_scripts/deploy_price_consumer_v3.py --network kovan

which returns with error
ChainlinkProject is the active project.
  File "brownie/_cli/run.py", line 50, in main
    args["<filename>"], method_name=args["<function>"] or "main", _include_frame=True
  File "brownie/project/scripts.py", line 53, in run
    module = _import_from_path(script)
  File "brownie/project/scripts.py", line 149, in _import_from_path
    _import_cache[import_str] = importlib.import_module(import_str)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
  File "<frozen, line line, in in
ModuleNotFoundError: No module named 'Users.casper'

So anyone has idea about it. Thanks


texts: Is the DAO hardfork technically a 51% attack?

texts:
Can the DAO hardfork be viewed as a (a publicly planned) 51% attack on the network?

Motivation / ethics / justice aside, I'm asking this from a purely technical point of view.

If not, what specifically differentiates it from a "typical" 51% attack?

If so, is this the first ever successful 51% attack on a major blockchain / cryptocurrency? By "successful" I guess I mean having a notable impact, in the short term at least.


texts:
I'm confused about 'contracts' in Ethereum. When do I need a 'contract'?

For the scope of my app: I want user to be able to generate ETH address, receive and send out ETHER and I should be able to get my wallet balance.

For this kind of scope, do I need a contract? Kindly explain to a noob.

What prompted me to ask this question is that I want to use blockcypher to create address, send wei and recieve. But I can't find a method where I can check the balance of the ETH wallet.

What am I missing?


texts: How can I access data of transaction topic?

texts:
I need to access the data from topic 2 below (see image):

With this code I can render the topic hash, but not the topic data:
contract
  .getPastEvents('allEvents', {
    fromBlock: START_BLOCK,
    toBlock: END_BLOCK, // You can also specify 'latest'
  })
  // .then((events) => console.log(events))
  .then((events) => alert(JSON.stringify(events[0].raw.topics[2])))
  .catch((err) => console.error(err));

Do you know how to render it?


texts:
In the case where you wish to use a library that someone else has written for your own contract, is it generally best practice to link to the developer's own deployment of their library? Or should you deploy their code and then link to your own deployment?

I'm interested in using this library, but they have not included an address in the readme. How would one find the address, and addresses for deployed libraries in general?

Same goes for deploying on a public test network. Is it best to use the dev's address, and if so, how do you get it?

Finally -- are deployed libraries immutable? I think I read somewhere that libraries can be upgraded. If my contracts depend on a specific library, would I then have to worry about an update to said library breaking my code?


texts: web3.js - cannot interact with smart contract

texts:
I want to write a simple js script. I follow many tutorial available from Youtube, forums and website but i seem that i cannot interact from the smart contract. i can interact it from remix. btw the smart contract is deployed on my private network.

Web3 = require('web3');

console.log("Hi blinkExample")
const web3 = new Web3(new Web3.providers.HttpProvider('http://192.168.100.130:8043'));

web3.eth.getAccounts()
.then(console.log);
web3.eth.defaultAccount = web3.eth.accounts[0];
var coinbase = web3.eth.coinbase;
var contractAddress = '0x6b9781fe8b355965a7ce99f58b918f711ab5fe1e';
var abi = [
    {
        "constant": false,
        "inputs": [
            {
                "name": "theData",
                "type": "uint256"
            }
        ],
        "name": "setData",
        "outputs": [],
        "payable": false,
        "stateMutability": "nonpayable",
        "type": "function"
    },
    {
        "anonymous": false,
        "inputs": [
            {
                "indexed": false,
                "name": "data",
                "type": "uint256"
            }
        ],
        "name": "blinkEvent",
        "type": "event"
    },
    {
        "constant": true,
        "inputs": [],
        "name": "getData",
        "outputs": [
            {
                "name": "retData",
                "type": "uint256"
            }
        ],
        "payable": false,
        "stateMutability": "view",
        "type": "function"
    },
    {
        "constant": true,
        "inputs": [],
        "name": "myData",
        "outputs": [
            {
                "name": "",
                "type": "uint256"
            }
        ],
        "payable": false,
        "stateMutability": "view",
        "type": "function"
    }
];

var blinkContract = web3.eth.Contract(abi, contractAddress);
var data = blinkContract.getData;
console.log('value is' + data);

var event2 = blinkContract.blinkEvent(function(error, result){
    if (!error){
        console.log(result);
    }
});

the console will show account list just fine but displays "value is undefined" then crash for the blinkEvent with typeError: blinkContract.blinkEvent is not a function. The value should be 12 which I set using remix.


texts: How can one contract fetch array state of the other contract?

texts:
I have two contracts, Token and Voter. I'd like to initiate a DAO, such that first someone initializes a token and distributes some shares to whoever it wants.

In Vote contract, only the token-holders are allowed to vote for something (e.g. certain project should receive some funding).

I'm using remix IDE to compile my contracts, but I don't know how Vote contract is supposed to call Vote contract. Therefore, I've put both in the same place.

Token contract stores an array of addresses belonging to whoever receives the tokens. Now, Vote contract should be able to get the array and check if the person who votes and calls Vote contract is in the array (kept by Token).

contract Token {
address [] publick voters;
//... some functions that assings values to the array...
}

contract Vote{
 // people first vote... Assume they've already done that.
 //Below we want to check which of them have tokens.

Token token= new Token();
address valid_voters = token.voters();// Here an error shows up

// then check
}

Question 1: How an array variable in one contract can be accessed by the other one? (e.g. voters in the above example)

Question 2: In remix how one contract can call the other one? and where to put the first one? (e.g. where to put Token contract and how Vote can call it)?


texts: How to convert bytes to uint in Solidity

texts: Hey is there a way to convert bytes to uint in Solidity?


texts:
Can an application retrieve what RPC URL is the user using in Metamask?
Using the window.ethereum API I can recover the net_version and confirm that it is the expected one. But can I also retrieve the RPC URL in order to read the data from the same URL?


texts: Out-of-gas error on very simple contract function with lots of gas sent along

texts:
My intention is to make a contract with a single function that takes a list of addresses van amounts and then transfers the amounts to the addresses.

I wanted to start simple and (using Remix) I have successfully compiled and deployed the following simple (right?) contract:

pragma solidity ^0.4.23;

contract Router
{

  function funRcv (address addr) public payable
  {
    if (addr != 0x0)
    {
        addr.transfer(msg.value);
    }
  }
}

I use Ganache as provider running locally.

I transferred 3 finney to it by executing (in the "Run" tab of Remix) the call to funRcv with the 0x00... address, which worked.

Then I set the value of the transaction to 2 finney, the gas limit to 3000000000 (!) and as argument to the funRvc function, I copy-pasted the address of my second default account from Ganache.

I expected the contract to transfer 2 finney from my first to my second default account, however, I get an "out of gas" error:

transact to Router.funRcv pending ...
transact to Router.funRcv errored: VM Exception while processing transaction: out of gas

Question: What am I missing here, is my approach valid at all?

Update: I added the screenshot below to show what I mean, Remix issues the warning (bottom right) that it cannot estimate the gas and it gives me the "out of gas" error. Deploying the contract works, but calling funRcv (as described above) gives the "out of gas" error (even with so much gas sent along) ... ?!


texts:
I have a large amount of contracts which I'm testing after applying changes. I'd like to add solidity functions which will be compiled only for testing, but not on mainnet nor ropsten. Is this even possible?

The reason I'm doing this is that I need to write a lot of JS code with adding votings, voting out from accounts and some more to get tokens which I would like to avoid and simply add a single test-only function like testOnlyMint(uint pAmount).


texts: How to retrieve stored data from blockchain?

texts:
I built a dapp integrating IPFS and Ethereum, in which the blockchain will store (in transaction) the links of every file uploaded to IPFS. But I want to display the IPFS links of all the files I uploaded to IPFS. Is there a way I could do that rather than setting up a DB for storing the links?

I am using embark framework, which will make adding files to IPFS easy,and I also tried to save the links to a file and display it on the web page using 'fs' module in node, but I cannot create an object of the 'fs' module in the dapp;

Is there a way I could display the links in a web page?


texts: What are the downsides of using vyper and truffle together

texts:
Recently I read an article Vyper+Truffle and wanted to build a token deployer using vyper contracts.

I was wondering if anyone knew the current downsides of using Vyper and truffle together?

Is it better to simply write and deploy vyper smart contracts and then interact with them from the front-end?


texts:
How should a qr-code be formated with an amount in it?

The npm package ethereum-qr-code uses the following format according to EIP-67:

ethereum:0x7cB57B5A97eAbe94205C07890BE4c1aD31E486A8?gas=42000&value=10

But this format will not be recognized by every wallet on the market. Many wallets uses the "?amount=10" parameter from the bitcoin BIP21.

What format should be used, to cover most of the wallets?

In wich format is the value in EIP67 formatted? In Wei or Ether?

Is a hyprid version possible with value and amount parameter? e.g:

ethereum:0x7cB57B5A97eAbe94205C07890BE4c1aD31E486A8?gas=42000&value=10&amount=0.0001


texts: ERC721 "Digibles": different than Bitcoin colored coin concept?

texts: As I understand ERC721 contracts, in particular Cryptokitties, a cryptokitty is not associated with a piece of ETH but rather is just some storage associated with the Cryptokitty smart contract. Is this correct? That is to say, while a cryptokitty is a token on the Ethereum blockchain, it is not a token in the sense that ETH is a token/coin?


texts: Web3.py - how to use abi in python when solc doesn't work

texts:
I have a smart contract that I deployed to the Ropsten test network with truffle (using Javascript).  I want to be able to send transactions to it from my server, which is written in Python.  I've been trying to follow: http://web3py.readthedocs.io/en/stable/web3.eth.html#web3.eth.Eth.contract

from web3 import Web3, HTTPProvider
import json

provider = HTTPProvider('https://ropsten.infura.io/<Redacted Key>')
w3 = Web3(provider)
assert w3.isConnected()

pdb.set_trace()
abi = str(<Here I am pasting my abi in.  How should I do this, since I didn't build the contract in Python?>
escrow = w3.eth.contract(address='0x8850259566e9d03a1524e35687db2c78d4003409', abi=abi)

... When I get to this line, the program crashes:

File "/usr/local/lib/python3.6/dist-packages/web3/eth.py", line 351, in contract
    ContractFactory = ContractFactoryClass.factory(self.web3, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/web3/contract.py", line 225, in factory
    normalizers=normalizers)
  File "/usr/local/lib/python3.6/dist-packages/web3/utils/datatypes.py", line 36, in __new__
    namespace)
  File "cytoolz/functoolz.pyx", line 236, in cytoolz.functoolz.curry.__call__
  File "cytoolz/functoolz.pyx", line 232, in cytoolz.functoolz.curry.__call__
  File "/usr/local/lib/python3.6/dist-packages/eth_utils/functional.py", line 22, in inner
    return callback(fn(*args, **kwargs))
  File "/usr/local/lib/python3.6/dist-packages/web3/utils/formatters.py", line 69, in apply_formatters_to_dict
    raise type(exc)("Could not format value %r as field %r" % (item, key)) from exc
TypeError: __init__() missing 2 required positional arguments: 'doc' and 'pos'


texts: code to activate Eth amount from Ropsten network to Main network

texts:
I have 2 issues with my Ethereum at Metamask.

I received 1 Eth from someone in Africa, sent to Metamask, but he sent to Ropsten network, not to Main network. He asked me to send Dagcoins first and then he will send me a code to activate the 1 Eth to be able to move to Main network. Is this true? that special code will be able to move to Main network?

Can I just move balance on my Ropsten network to Main network by myself, without any code or special assistance?

Hope to get a helpful information.
Warm regards from Bali, Indonesia.
Adrian


texts:
I'm just wondering what would happen if I don't put a selfdestrut() method in my smart contract.

As I read from the Solidity documentation (Self-destruct):

  Even if a contract’s code does not contain a call to selfdestruct, it can still perform that operation using delegatecall or callcode.

But... does it mean that anyone could call selfdestruct() to any contract?


texts:
I have a function as follows :

/// @notice send `_value` token to `_to` from `msg.sender`
  /// @notice send `Pl_value` token to `_to` from `msg.sender`
  /// @param _to The address of the recipient
  /// @param _value The amount of token to be transferred
  /// @param Pl_value The payload to be transferred
  /// @return Whether the transfer was successful or not
  function transfer(address _from, address _to, uint256 _value, string Pl_value) public returns (bool) {
    require(_to != address(0));

    // SafeMath.sub will throw if there is not enough balance.
    balances[_from] = balances[_from].sub(_value);
    balances[_to] = balances[_to].add(_value);

    Payload[_to] = Pl_value;

    return true;
  }

}

And I create an instance from my contract as follows :

var contractInstance = new web3.eth.Contract(abi, 'address-of-contract');

How can I call this function via :

contractInstance.methods.

What is its syntax exactly ?
(I do it via command prompt and terminal)

Here is the entire .sol file :

import './SafeMath.sol';

contract BasicToken {

  // Using safe math library for all uint256 operations
  using SafeMath for uint256;

  // Total supply of token
  uint256 public totalSupply;

  // Balances for each account
  mapping(address => uint256) balances;

  mapping(address => string) Payload;

  /// @param _owner The address from which the balance will be retrieved
  /// @return The balance
  function balanceOf(address _owner) constant returns (uint256 balance) {
    return balances[_owner];
  }

  /// @param _owner The address from which the balance will be retrieved
  /// @return The payload
  function PayloadOf(address _owner) constant returns (string payload) {
    return Payload[_owner];
  }

  /// @notice send `_value` token to `_to` from `msg.sender`
  /// @notice send `Pl_value` token to `_to` from `msg.sender`
  /// @param _to The address of the recipient
  /// @param _value The amount of token to be transferred
  /// @param Pl_value The payload to be transferred
  /// @return Whether the transfer was successful or not
  function transfer(address _from, address _to, uint256 _value, string Pl_value) public returns (bool) {
    require(_to != address(0));

    // SafeMath.sub will throw if there is not enough balance.
    balances[_from] = balances[_from].sub(_value);
    balances[_to] = balances[_to].add(_value);

    Payload[_to] = Pl_value;

    return true;
  }

}


texts: Two out of three rigs having hard freezes

texts:
I'm a newbee.. Please pardon if I've missed any critical detail in this question.

I have three ASUS Z270 AR motherboards and 21 Asus dual RX 580 GPUs. Out of these, one rig with 7 GPUs work really well. I'm having problems with the other two. Whenever I connect more than one GPU to any of the other two motherboards, only one card hashes while the other does 0 hashing and in a minute, the whole Windows 10 desktop freezes and i have to reboot. I even tried with ETHOS it has the same issue.

Ive done the bios mods on the motherboard for the pch gen2. The computer works just fine and shows all the 7 cards in the device manager correctly. Only when i start the claymore dual miner, that's when it crashes in a minute.

When i try to connect one single GPU - one by one on every PCI-E slot, all the slots works just fine independently they hash at 27mhs.

When i try to connect one GPU at a time to its appropriate PCI-E slot, every GPU hashes just fine at 24 to 27 mhs.

I'm using a 450W gold power supply for each rig along with two HP DPS1200 power supplies.

Any guidance you could provide on how to fix/troubleshoot would be of great help.


texts: Mining not working in ethereum private net

texts:
I was trying to enable mining over my private network but it won't start.

My Understanding so far about mining

Mining is used to mine new block , to confirm transaction and also to generate new coins into the network. Mining continues even if there are no transaction in order to add new layer of difficulty for future consensus(that how POW works).

But whenever i call miner.start(1) it just displays the message below .

INFO [01-22|19:05:53] Updated mining threads                   threads=10
INFO [01-22|19:05:53] Transaction pool price threshold updated price=18000000000
INFO [01-22|19:05:53] Starting mining operation
INFO [01-22|19:05:53] Commit new mining work                   number=1 txs=0 uncles=0 elapsed=296.569µs

And thats it.It won't generate new blocks and no reward is transfered to my etherbase. sometimes it do start but after a long pause after calling miner.start(1) (approx 15-20 minutes and then it keep generating new blocks)

My Genesis.json file is

     {
       "config": {
      "chainId": 0,
      "homesteadBlock": 0,
      "eip155Block": 0,
      "eip158Block": 0
  },
"alloc"      : {},
"coinbase"   : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x20000",
"extraData"  : "",
"gasLimit"   : "0x2fefd8",
"nonce"      : "0x0000000000000042",

  "mixhash":    "0x0000000000000000000000000000000000000000000000000000000000000000",
  "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
 "timestamp"  : "0x00"
 }

I do not have any idea what is happening ,am i missing something that i should be aware of?

Please help.


texts: Geth server syncs itself very slow on SSD storage

texts:
This is the second time I've lunched a Geth server with full mode on a server with the resources below:

4Core CPU
16GB RAM
400GB SSD

But server keeps staying arount half of highestBlock and its synchronization is very slow. It's the second day that I'm checking this server and the current status is:

> eth.syncing
{
  currentBlock: 4185982,
  highestBlock: 10042734,
  knownStates: 0,
  pulledStates: 0,
  startingBlock: 0
}

May you tell me what is the problem? Aren't the resources enough? Or I had some other mistakes?
This is the command I used to run geth:

geth --rpc --rpcport 1555 --rpcapi personal,eth,web3,txpool,net

I also tested --cache 8192 in this command, but nothing did not change.


texts: How many UTF-8 chars can you fit in a 256 bit hex word?

texts:
In Ethereum transactions, you can use the Data field to send text. Here's an example testnet transaction.
https://ropsten.etherscan.io/tx/0x19e4921d572e7f513954c9dada66d7e4fb01d91b5c09be840b235c9fae73401e
If I understand correctly, the gas cost increases incrementally for each 256 bit hex word.
How many UTF-8 characters can you fit in each 256 bit hex word?


texts: How load out data from blockchain when it occupies too much space?

texts:
If the blockchain working long enough it fills the memory of the mining device, how to load out the data and then rerun the system?
and why does my mining device has different miner address every time I access it?
Thanks


texts: While using Mist Browser(Test Network), am I also Mining blocks?

texts:
My laptop heats up whenever I use Mist Browser application and my BDLDaemon(Bitdefender in Mac) is going crazy, taking up 4.15 GB of RAM.
So my question arises, Am I mining the blocks too?
 Which might be causing the heating issue.


texts:
Is there a way to verify the identity of the sender of the transaction in ethereum?
Like we have certificates issued by certificate authority do we have similar thing for the accounts on blockchain


texts: does the command `evm --debug --code OPCODES` still work?

texts:
I've been trying to run this command evm --debug --code 600580600b6000396000f36005600401, and some associated permutations of it, such as:

evm --debug --code 366020036101000a600035045b6001900380600c57 --input 0101

However, all I ever see as a result is the help menu, i.e.

Has this command been deprecated, or am I doing something wrong?


texts:
i trying transfer tokens ERC20, but all my transactions failed - Reverted.

Example "0x4fe5b29d3fabaac6bc7b82574ab7f2a6d024134ca927fa9315e824c74c3d1364"

But i trying with "MetaMask" and transaction success

"0x4e9295875fa4488062fbbf8d0f14f5a5dbea2672cc8c248900c5d9610417c55f"

I think it is because price of gas and fee.

But i not choose these prices.

In my node i execute only

tcm.transferFrom(eth.accounts[0], '0x36A0e64b6c5a875f859E72eF4471c30d78ab4D1e', 1000000000000000000);

How i change price of gas and/or fee price?


texts: How do I unlock the `geth --dev` developer account?

texts: when I use "geth --dev",I find it already exist a account.But I don't know the password.How can I unlock this account.


texts: Web3.js eth.subscribe: on('changed', function(event){}) doesn't work with Metamask?

texts:
I write a demo DApp website with this javascript

    const web3 = new Web3(ethereum);
    const contractAddr = "0x0Aa27e4B13D5c08A8767B36a0ACb76ED4549B7EA";
    const abi = ...;

    let inst = new web3.eth.Contract(abi, contractAddr);
    web3.eth.subscribe('logs', {
        address: contractAddr,
    }, function (error, result) {
        if (!error)
            console.log(result);
        else
            console.log("default:", error);
    })
        .on("connected", function (subscriptionId) {
            console.log(subscriptionId);
        })
        .on("data", function (log) {
            console.log("data:", log);
        })
        .on("changed", function (log) {
            console.log("changed:", log)
        }).on("error", function (log) {
            console.log("err:", log);
        });

In the code I use ethereum (which is window.ethereum provided by MetaMask) as the Provider for Web3.js.

My MetaMask is connected to a private blockchain called node1 using Geth on localhost:8545. In the meantime I have another Geth node called node2.

At the beginning, node1 and node2 were not connected. I sent and mined a transaction to node1 to the contract at contractAddress which would emit events and I indeed got console logs in the browser as a result of my subscription to 'logs'.

Then I let node2 mine more blocks than node1 and after that, I connected them. This will trigger node1 chain reorganization. After reorg, the reverted transaction was left in the txPool and I didn't mine any more blocks.

As is specified in web3.js documentation, I expected console.log（"changed:", log) to be executed but it didn't.

At the same time, I also used low-level Json-rpc method eth_getFilterChanges and did get a log with "removed": true field, which means the transaction was indeed reverted.

I think web3.js should have notice this and execute on('changed') callback. But why does web3.js not work here? Since web3.js cannot subscribe logs directly using HTTP ethereum provider, and MetaMask uses HTTP connection to ethereum, does this problem have something to do with MetaMask?

BTW: I'm using web3.js v1.2.6


texts: I am getting Error: Project ID is required deploying to ropsten in truffle

texts:
I am getting the following error:
Error: PollingBlockTracker -
encountered an error while attempting to update latest block:
Error: project ID is required
at C:\Users\myuser\Code Projects\sdfsd\node_modules@trufflesuite\web3-provider-engine\subproviders\provider.js:18:36
ropsten: {
  provider: new HDWalletProvider(mnemonic, "https://ropsten.infura.io/2d26d6e3bafb42bfa4fa8cc248350d00"),
  network_id: 3,
  gas: 4000000
}


texts: Making sure a string (input/output) is less then 64 characters

texts:
I'm working though some basic solidity tutorials using remix. I'm having trouble with the concept that there is no way to edit a string built into the language. In other programing languages I would have different ways to manipulate a string and arrays of letters but it seems like the only way to do that is by importing some custom github string code or by converting it to a byte array, both of which I don't fully understand.
I understand that there is a cost to store data and a cost to do computations on the eth blockchain.
I want to store info, how can I make sure that the information is limited to 64 characters (to save on storage) and that any checking or manipulation of that 64 characters is done as cheaply as possible (to save on computations).
Are there any patterns for working with strings in solidity that I don't know about?
Is big-O notion used to determine the gas cost? Can it? How can I determine how much gas this simple contract will take?


texts:
I am currently experimenting with Geth on ios. I've imported Geth using cocoapods and trying to run the (light) node.

Config:

Geth version: 1.6.5 (but I have tried 1.6.1, 1.6.2, 1.6.3, 1.6.4 and 1.6.6-unstable)

OS & Version: OSX Sierra 10.12.5 / Xcode 8.3.2 (8E2002)

Language: Swift 3

Simply adding "import Geth" to my ViewController file crashes the LLBD RPC server on the simulator (or the app on a device). On the simulator it messes up the debugging tools of Xcode (break points, etc).

On the simulator the node seem to start but does not establish a connection with peers and does not synch.

The relevant code is as follows:

    let bootstrap = GethNewEnodes(2)
    do {
        try bootstrap?.set(0,enode: GethNewEnode("enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303", &error))
        try bootstrap?.set(1, enode: GethNewEnode("enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303"
, &error))
    } catch let ee {
        print(ee.localizedDescription)
        }

    // configuration of the nodes
    let config = GethNewNodeConfig()
    config?.setEthereumGenesis(GethTestnetGenesis())
    config?.setEthereumNetworkID(3)
    config?.setBootstrapNodes(bootstrap)
    config?.setEthereumEnabled(true)
    config?.setMaxPeers(25)
    config?.setWhisperEnabled(false)

    // create new node
    node = GethNewNode(nodeDir.path, config, &error)

        do {
            try node?.start()
        } catch let err {
            print("error: \(err.localizedDescription)")
        }

The node logs are:

WARN [06-14|11:33:30] Failed to start Ledger hub, disabling: unsupported platform
INFO [06-14|11:33:30] Starting peer-to-peer node               instance=iGeth/v1.6.6-unstable/darwin-amd64/go1.8.3
INFO [06-14|11:33:30] Allocated cache and file handles         database=/Users/XXXX/Library/Developer/CoreSimulator/Devices/D1F71E22-095A-4B7B-8007-012A38A136CB/data/Containers/Data/Application/7871D2F6-1A0E-45D9-A48E-4170DF187020/Documents/ethereum/iGeth/lightchaindata cache=16 handles=16
INFO [06-14|11:33:30] Initialised chain configuration          config="{ChainID: 3 Homestead: 0 DAO: <nil> DAOSupport: true EIP150: 0 EIP155: 10 EIP158: 10 Metropolis: 9223372036854775807 Engine: ethash}"
INFO [06-14|11:33:30] Disk storage enabled for ethash caches   dir=/Users/XXXX/Library/Developer/CoreSimulator/Devices/D1F71E22-095A-4B7B-8007-012A38A136CB/data/Containers/Data/Application/7871D2F6-1A0E-45D9-A48E-4170DF187020/Documents/ethereum/iGeth/ethash count=3
INFO [06-14|11:33:30] Disk storage enabled for ethash DAGs     dir=/Users/XXXX/Library/Developer/CoreSimulator/Devices/D1F71E22-095A-4B7B-8007-012A38A136CB/data/Containers/Data/Application/7871D2F6-1A0E-45D9-A48E-4170DF187020/.ethash                         count=2
INFO [06-14|11:33:30] Loaded most recent local header          number=0 hash=419410…ca4a2d td=1048576
INFO [06-14|11:33:30] Starting P2P networking
WARN [06-14|11:33:30] Light client mode is an experimental feature
INFO [06-14|11:33:30] RLPx listener up                         self="enode://d390f94b00eb9326089e903799607d4445472e0bb96fca4488c66a5dfeaa8b195b0681a3d867ad33c067303b29ee4296dee95e499dfe5a286dff1152328a2801@[::]:49771?discport=0"

Am I doing something wrong (in particular with the configuration of the node)?

Any help would be greatly appreciated.


texts: Key-value immutable storage: on-chain vs IPFS

texts:
I'm currently working on a D-App for a client. It's basically a temper-proof immutable storage of 'objects', each object being defined with 8 key-value pairs (strings) and a collection of pictures.

The client asked explicitly to have everything on-chain. I convinced them to store the pictures on IPFS and store their addresses on-chain. I thought the 8 strings wouldn't be an issue, but I find myself struggling with it because of the stack-to-deep exception, as the record of a new contract should ideally be done in one transaction. Related code:

function addProject(
bytes32[] pictures,
string a,
string b,
string c,
string d,
string e,
string f,
string g,
string h) external payable returns(bytes32) {
  if(msg.sender != owner()) {
    require(msg.value < price, "received insufficient value");

    owner().transfer(msg.value);
  }

  return registery.addProject(
    msg.sender,
    pictures,
    a,b,c,d,e,f,g,h
    );
}

Registery is a wrapper to an eternal storage pattern modified to be immutable. This function doesn't compile because of the stack-to-deep exception.

My question is: does it make sense to store those 8 key-value pairs on-chain, considering they are just records and don't have any functional value in the smart contract ? Should I spend time trying to find a work around (serialization, etc.) or is it a design issue ?

Thanks a lot !


texts: Event log history is not getting generated ropsten test network

texts:
I want to view event log history in my html screen. But I am getting below error in console. Can any one please look into this. I am new in blockchain and this is the first blockchain code I am executing. Not sure where it got stuck.

Error Log:

app_device.js:109 Error: Gateway timeout. The request took too long to process. This can happen when querying logs over too wide a block range.
    at Object.InvalidResponse (inpage.js:8198)
    at inpage.js:8198
    at inpage.js:174
    at inpage.js:8175

HTML File

<button id="handleAllMintCoinEventButton" onclick='handleAllMintCoinEvent()'> Fetch All Events</label</button>

JS File:

function handleAllMintCoinEvent(){
    var AddForFetchinEvents = document.getElementById('AddForFetchinEvents').value;

    //var allEvents = myContractInstance.CoinMinted({to:AddForFetchinEvents},{fromBlock: 0, toBlock: 'latest'},function(error, result) {
    if(AddForFetchinEvents!=''){
    console.log(AddForFetchinEvents);
    var allEvents = myContractInstance.Sent({from:AddForFetchinEvents},{fromBlock: 0, toBlock: 'latest'},function(error, result) {
              if (!error) {
                  //var msg = result.args.to +" received " + (result.args.amount) + " fresh new coins " ;
                    document.getElementById('MintCoinEvents').innerHTML += "
"+result;
//                  op.push(msg)
                    console.log(result);
              }
              else {
                  console.error(error);
              }
        });
    } else {
        console.log("pulling all the events");
        var allEvents = myContractInstance.Sent({},{fromBlock: 1577465, toBlock: 1577565},function(error, result) {
              if (!error) {
                  //var msg = result.args.to +" received " + (result.args.amount) + " fresh new coins " ;
                    document.getElementById('MintCoinEvents').innerHTML += "
"+result;
//                  op.push(msg)
                    console.log(result);
              }
              else {
                  console.error(error);
              }
        });
    }
    allEvents.stopWatching();

}

Sol file:

event Sent(address indexed from, address indexed to, uint indexed deviceCode,string deviceType,string deviceDesc,string devManDate,string devManCompany,uint256 deviceCost,string remarks);


texts: Is a decentralized exchange basically a smart contract that includes all the exchange functionality? Where is the engine?


texts: Detect new smart contracts deployed to the Ethereum Mainnet

texts:
Is there a way (perhaps using a combo of Node + Web3 + Infura) to detect the deployment of new smart contracts to the Ethereum mainnet?
If not using that combo, is there another way please? Maybe a paid service is available?
Many Thanks


texts: how to calculate Ethereum inflation per each block?

texts:
I've run Ethereum node so I can access blockchain info via rpc api provided from the node.

What I want to do is calculate Ether inflation per each block. For that, I've read many documents and I want to get confirmation whether my understanding is correct or not.

There are three categories which inflate new Ethers per each block.

mining rewards : 2 Ether (currently)
uncle inclusion rewards : 2 / 32 = 0.0625 Ether if the block includes (an) uncle block(s)
uncle rewards : (uncle_block_number + 8 - block_number) * 2 / 8

For example,

At the block number 7280016,

(https://etherscan.io/block/7280016), inflated Ethers are 2 + 0.0625 + 1.75 = 3.8125 Ether

I didn't include transaction fees, 0.03198144598868195, into inflated Ethers because they are not newly created but spent from already existing Ethers.

At the block number 8279967,

(https://etherscan.io/block/8279967), inflated Ethers are 2 Ether because there are no uncle(s) in this block

Is my understanding correct?

Thank you in advance~!


texts: The amount of Video Cards a motherboard can support (if using powered risers) is only limited by the number of PCI-E slots, correct? I've found a board (MSI - B250 GAMING M3 ATX LGA1151 Motherboard) that has 2 PCI-E 16x and 4 PCI-E 1x. If I use powered risers there should be no issue right?


texts:
I am trying to run this code

from web3 import Web3, HTTPProvider
import json
import pprint
import requests
from random import randint

# Debug flags
debug_transaction = False
debug_CALL_transactions = False

# Geth node parameters
rpcport = '4000'

# Experiment parameters
numBuckets = 50

# Instantiate web3
web3 = Web3(HTTPProvider('http://localhost:' + rpcport))
# Instantiate HTTP connection to Geth JSONRPC
session = requests.Session()

# Iterate over blocks and print transactions
latest = web3.eth.getBlock('latest').number

print (latest)

But i keep getting this error

Traceback (most recent call last):
  File "python", line 23, in <module>
  File "cytoolz/functoolz.pyx", line 232, in cytoolz.functoolz.curry.__call__
  File "cytoolz/functoolz.pyx", line 232, in cytoolz.functoolz.curry.__call__
  File "cytoolz/functoolz.pyx", line 232, in cytoolz.functoolz.curry.__call__
  File "cytoolz/functoolz.pyx", line 232, in cytoolz.functoolz.curry.__call__
  File "cytoolz/functoolz.pyx", line 232, in cytoolz.functoolz.curry.__call__
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=4000): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fcaeb556f98>: Failed to establish a new connection: [Errno 111] Connection refused',))

I am new to all of this. Can someone please tell me what I am doing wrong? I am trying to run the code on repl.it


texts:
I would like to crawl an Ethereum-like network completely and find out the list of their node IP addresses and clients they have, in a format like this:

Geth/v1.7.2-stable/linux-amd64/go1.8.3    10.24.173.89
Geth/v1.7.2-stable/darwin-amd64/go1.9.2   189.34.1.168

Something similar that happens in web, when a web crawler crawls the web and collects all the information about pages. Does something like this exist for Ethereum? I mean, some software I could download and run?


texts:
Even though Ethereum does not directly use GHOST, stale blocks can be included as uncles for a reward.
How can uncle blocks remain valid, as I suppose state transitions must be non-conflicting? The design rationale says that these "uncles have to be valid headers, not valid blocks" yet they could be.
I suppose if there is a single interaction with the same element in the state trie of e.g uncle block U and current child C and/or parent A, then U cannot be valid anymore. Which I would assume happens quite often now with AMM pools and complex, composable transactions.
So is it correct to assume that most uncles receive a reward, but they do not change the actual state of the longest chain?


texts: Data storage : mapping vs sub contract deployment

texts:
I read over few website, tutorials and answered question here on SE. There is a huge warning about deploying new contract just to store datas.
i.e. :
bad
  uint256 public amount;
  bool public isAdmin;
  function User(uint256 _amount, bool _isAdmin) {
    amount = _amount;
    isAdmin = _isAdmin;
  }
}

good
  mapping(address => uint256) amount;
  mapping(address => bool) isAdmin;
}

In my case I need to store much more complex data more fields and dedicated methods.
Is it better to go through new contract deployment (and the need to propagate the original sender) or to use several mappings and functions with new parameter "hash" ?
i.e.
Contract style
contract myObject {

address owner;
uint4 stage;
uint256 someOtherData;
mapping(address => uint4) someUserInteraction;

constructor(address user) {
owner=user;
stage=0;
}

function interact(address user, uint4 data)
external
...

function changeStage(uint4 new stage)
external
....

}

contract myContract {
...
address[] objects

function createObject(someData) {
myObject o = myObject(msg.sender,someData);
objects.push(o);
}

function interact (address object, uint4 interaction)
{
myObject o = Object(object);
myObject.interact(msg.sender,interaction);
}
//now we can get the myObject through its address and interact by calling its methods

}

Mapping Style

contract myContract{

uint256[] objects
mapping (uint256 => uint4) objectStage
mapping (uint256 => mapping(address => uint4)) objectInteraction
mapping (uint256 => uint256) objectData
mapping (uint256 => address) objectOwner

function createObject(uint256 data)
external
{
uint256 newObjectIndex = objects.length;
objects.push(newObjectIndex );
objectOwner[newObjectIndex ]=msg.send;
objectData[newObjectIndex ]=data;
}

function interactWithObject(uint256 index, uint4 data)
external
{
objectInteraction[index][msg.sender]=data;
}

//I must always be aware of the index of my Object to interact with it but I don't need another contract

All my objects have some properties and some methods to interact through an independant lifeCycle.
To be less abstract let's imagine myContract is a groupOfPeople and my Object is a decision to be made.
A decision have a stage (New, Reviewed, PendingApproval, Approved or Canceled), a description, an impact, a price, etc.
Each member of the groupOfPeople, can create a new Decision then submit to other for approval.
Other user can review, suggest changes or votes.
the author of the decision request can change it, stop vote, etc.
Does each decision should be a contract or just a bunch of mapping known by a key (index or hash of something).
Thanks for your help, advice and experience feedbacks.
Regards


texts: Solidity: Send a new contract ether in constructor

texts:
I tried doing

address NewContract = new SomeTest.value(1 ether)();

But this yields a syntax error.

I try to call the payable constructor of a new contract with ether. What is the syntax for this?


texts:
what I did:

Created account (address1) on pc1 and another account (address2) on pc2.

I have a wallet for ether on coinbase.com (address3).

I have another wallet jaxx on pc (address4).

On pc1 and pc2 I started geth --etherbase "0xaccount1"

I mined and got ether on pc2. pc1 has 0 ether

Now I want to send the ether to coinbase.com.

I tried on pc2:

eth.sendTransaction({from:"0xaddress1", to:"0xaddress2", value: web3.toWei(0.05023575, "ether")})
-> Error unknown account

eth.sendTransaction({from:"0xaddress1", to:"0xaddress3", value: web3.toWei(0.05023575, "ether")})
-> Error unknown account

eth.sendTransaction({from:"0xaddress1", to:"0xaddress4", value: web3.toWei(0.05023575, "ether")})
-> Error unknown acco unt

What should I do? Can I create a new account with address1 and how?


texts: Question on token systems example in ethereum whitepaper

texts:
I am novice blockchain developer. I was going through ethereum whitepaper and I am struck on some questions. This is one of them.

I couldnt get my head around the token systems application mentioned in the paper. So its mentioned that ethereum has ability to pay transaction feeds directly in the meta currencies or token currency. I couldnt understand the process exaplained for this.

Any one help me understand this please?


texts: Historical hourly or minute prices (API or bulk)

texts:
Questions to find ETH or other cryptocurrency historical prices have been asked and answered here or there. But I'm looking for hourly prices, or even less, for every minute, and for at least the past 4 weeks.

All APIs I have looked at offer either daily quotes, or fine-grained quotes but limited to the last 24 hours max.

So for the moment I'm collecting quotes from one of those APIs by running a cron job a few times a day, and I've collected 4-5 days worth of data, but this is cumbersome (need to aggregate them), unreliable (raspberry Pi 1B ain't high availability server) and, well, I have to wait to collect enough data.

Question: where could I find fine-grained quotes (1 per minute) for the last month, either REST API or a plain old internet link? Format does not matter.

Note: I consider republishing the info I'm collecting but I have to check first if this is compliant with the T&C - and it's probably not but worth a shot if the community finds it useful.


texts: Is there a way to read a data structure(eg:mapping) of a smart contract?

texts:
Ethereum's smart contract's data should be stored at Merkle Patricia tree, which is available on every full node.
So is there a way to read a data structure(eg:mapping) of a smart contract.

More specially, I want to access ens smart contract's records mapping.
https://github.com/ethereum/ens/blob/master/contracts/ENS.sol line 15, in order
to get all the name registered.


texts:
This contract should return the sender's address:

contract SimpleExample {
    function getSender() constant returns (address) {
        return msg.sender;
    }
}

The following Javascript calls that contract:

var abi = [{"constant":true,"inputs":[],"name":"getSender","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}]
var MyContract = web3.eth.contract(abi);
var myContractInstance = MyContract.at('0x46E286cb00c5e7D5949D18e767447E513d001BBA');

myContractInstance.getSender.call(function(error, result){
    if(!error) {
        console.log("##" + result + "##")
    } else {
        console.error("Error:" + error);
    }
})

Instead of returning the sender's address, it returns 0x0000000000000000000000000000000000000000.


texts: Measuring energy usage of smart contract execution

texts: Looking into measuring the energy consumption to me of executing particular smart contracts when mining, any tips on how to go about this?


texts: Truffle "TypeError: Cannot read property 'legacyAST' of undefined"

texts:
I had just finished editing what seems like the last of my error in my contracts because truffle will get to the last contract I have to compile, hangs for a second and the does this:

Compiling ./pathTo/x.sol...
Compiling ./pathTo/x.sol...
Compiling ./pathTo/x.sol...
/usr/lib/node_modules/truffle/build/cli.bundled.js:90035
    ast: standardOutput.sources[source_path].legacyAST,

TypeError: Cannot read property 'legacyAST' of undefined
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:90035:49
    at Array.forEach (native)
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:90026:34
    at Array.forEach (native)
    at compile (/usr/lib/node_modules/truffle/build/cli.bundled.js:90023:26)
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:90157:5
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:59075:7
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:59169:7
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:91073:16
    at next (/usr/lib/node_modules/truffle/build/cli.bundled.js:95365:18)

My truffle and solc versions are:

Truffle v3.4.9 (core: 3.4.8)
Solidity v0.4.15 (solc-js)

I have never seen 'legacyAST' referred to nor has searching it returned any results. Has any else experienced this or knows what may be the cause?


texts: How fast and scalable is a Dapp build on ethereum?

texts:
I am a beginner to Dapps on ethereum and smart contracts but I wanted to ask three questions on building on top of ethereum.

Firstly, how fast would an Dapp with a token will the transactions per second and the time of a smart contract to be executed the same as the ethereum blockchain.

Secondly, I hear ethereum uses IPFS, like AWS S3, for storage but what will cost to storage data and how fast will can it be uploaded and downloaded, if it was 1 Mb?

Lastly, do need to download the whole ethereum blockchain to be able use a Dapp built on top of ethereum?

I know, there alot of questions but I am just curious and Thank you, in advance, for answering my questions.


texts: Query multiple derived contracts from contract factory

texts:
Say a contract factory is used to spawn multiple child contracts, each with associated data within them. The contract factor stores all addresses of the derived contracts along with a unique name of each contract. Is there an easy, efficient way to query information across all the child contracts?

For example, say the child contracts represent people; is it possible to write a query to return all child contracts that have a particular age, name and location of birth (where these properties are member variables on the child contracts). This is in effect running a SQL query over all the child contracts.

Clearly, the naive solution is to iterate over all child contracts from the map within the factory. This is not ideal in any way. Alternatively, an offchain solution could be built where a linking table is made offchain with the associated contract addresses. This solution really is not ideal as I'd like to keep to an on-chain solution. This also results in duplication of data on chain, making the blockchain redundant.

In simple terms: is there a way to build an efficient query structure in order to search for contracts, if the contract addresses are known. This sounds very much like a relational database but running on-chain. IPFS wont help in this context as you are effectively stuck with the same query problem; how to search effectively through all records for particular sub information within entries.


texts: What is the value of "address(this)" when delegate calling?

texts:
Suppose that you have an upgradeable proxy "Foo" that calls an implementation contract "Bar" via DELEGATECALL.
In "Bar", there is a function that uses the Solidity syntax address(this) to retrieve the address of the current contract.
What is the "current" contract when the call is made via the upgradeable proxy "Foo"?


texts: How to change Parity's TCP and UDP port to run an Ethereum node?

texts:
As far as I am aware the ports 30303/TCP and 30303/UDP, 30301/UDP have to be accessible from the internet in order to run an Ethereum node.

I am running Parity and am sitting behind a firewall which only opens a small set of ports for me.

Is it possible and if yes how to change the ports using Parity?


texts: How to call super in fallback payable function?

texts:
My contract is derived from another contract. And I wish to call the fallback payable function in the super class. May I know how can I do that?

For example:

function () public payable
{
    // Do something...

    super();   // Doesn't compile
}


texts: Can I see an example of a payable function in practical use?

texts:
I would like to see an example of a function modified as payable in practice.
I would like for it to accept payment and hold the ether.

I would like to read another function in the same contract that can send the held ether to a specific address.


texts:
i'm here to ask if my project is doable or not.

I'm actually reading "Mastering Ethereum" by Andreas M. Antonopoulos, so i have some basic solidity knowledge.

I have a project:

I have a building, with floors and rooms for each floor.

My idea is to "tokenize" each element of the building in order to send it (idea similar to renting), For example:

i have 4 rooms in a single floor assigned to 2 different persons (each owns 2 rooms) and after some time someone comes and asks for the entire floor.

So the 4 tokens (room) should merge into a single token (floor) of the building (another token).

Another example:

i have an entire floor and i want to give 3 rooms (out of 5) to someone, so i have to split the floor token into the 5 rooms token.

So i have 3 kinds of token: building, floors and rooms.

I'm struggling to find some kind of solution to this problem, my idea was to manipulate the building as a single token with a struct and to create an "Authorized" contract in order to not changing the original owner of the token.

It's kinda hard to figure out how to do it with 3 different tokens (non fungible,  i was thinking of erc721).

Thanks to anyone who will answer me :)


texts: how can i make multiple users having different addresses when they register to my contract?

texts: I want to create a register page where i want users to register and after registration they should get different addresses so that i can fetch their details by address.


texts: Private blockchain: Overwrite a transaction or Delete a block?

texts:
Let's say I am on a private net, with control over 50% of the hashpower, is there a way to cancel a block ? Could I get rid of a transaction ? If yes, how quickly would this "cancelation" take to propagate.
Would it not be best to instead of cancelling a block, write an another block that would invalidate the first one ?

Thanks


texts: What triggers the Ethereum Contracts to execute ? Do miners always execute it regardless the transactions?

texts:
As a newbie, I am a bit confused...

I understand that a contract is a set of conditions the certain parties agreed upon, and that some actions may/should follow as a part of an agreement.

What I do not understand is whether the miners always execute the contract when they encounter it, or whether there is some kind of a trigger that tells the miners whether to execute the contract or not?
What if contracts become outdated and obsolete, and do not apply to a real-world anymore but can be executed regardless... wouldn't that be a waste of resources, and how is this situation handled ?
What if contract executes to do something stupid such as sending the spam or access the certain website to initiate a DoS attack... It cannot be deleted, it is decentralized, miners have no clue, etc. How is this prevented ?

If there is some kind of a trigger that tells the miners whether to execute it:

Could there be a sort of a null-trigger that tells the miners to always execute the contract ?
What is the set of conditions that miners process before processing the contract, and where is this programmed (if inside of a contract, then it must be a separate section of a code that acts as an execution trigger only, otherwise a contradiction) ?
Does the trigger need to be the money/ETH or can we use something else (for example, data from a weather station instead of ETH transactions) ?


texts:
ORIGINAL POST (EDITED POST BELOW):
I keep getting the following error in my ERC721 Contract:
“ERC721: transfer caller is not owner nor approved”

This happens when I’m trying to buy a Token that has already been minted and transferred by this same contract to another address.
Luckily I’ve discovered that this error message actually comes directly from the require statement embedded in the standard ERC721 Contract’s  transferFrom  function, as seen here:
function transferFrom(address from, address to, uint256 tokenId) public virtual override {
   require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
   _transfer(from, to, tokenId);
}

So obviously there’s some kind of permissions/approval business that I need to take care of in order to fix this problem.
The ERC721 Contract provides us with both the approve()  and  setApprovalForAll() functions -  both of which facilitate approvals to either specific or ALL addresses (I think), but after reading the docs. I’m actually more confused than ever on how and where exactly I'm supposed to use these functions.
Is it upon the OWNER of a particular Token to call  approve() on their own Token? And if so, when exactly should they be calling that? When they’re minting the Token?
Or is it upon the CONTRACT itself to call  setApprovalForAll - passing in it’s own address during that call, so that it can then be able to facilitate the transfer of Tokens to the various addresses that interact with it?
Just who is supposed to be doing the approving - and when?
======================================
PART 2 - UPDATE:
I should have made this update earlier because I discovered the true source of the problem: it's actually in the first require statement written in the ERC721 contract's _transfer() function - which goes like this:
function _transfer(address from, address to, uint256 tokenId) internal virtual {
   require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own!");
   require(to != address(0), "ERC721: transfer to the zero address");

   ...

What's problematic about that first require() statement is that even if you successfully call approve() or setApprovalForAll (and I did so by calling the latter, passing my own contract's address into it, meaning IT was made the operator by and for every address that owned any Tokens created by it,) well any attempts you'd later make to actually transfer() any of these tokens would immediately fail as they'd be scuttled by that require() statement.
And that's because it explicitly requires the transferrer to be the owner of the Token in question. As-in, merely being the operator is apparently not good enough. At least not the way the contract is currently written by Open-Zeppelin.
Which of course is quite puzzling.
I mean what good does it do us to make another address be an operator if at the end of the day this role does not allow it to actually do any transferring of tokens?
I suppose it's a security issue?
Can't quite tell - at least not yet (and please chime in if you have any insights into this.)
I ended up solving this issue by tweaking that require statement so that it suits my specific needs.
Whether or not doing so compromises the security of my contract in any manner remains to be seen, but I saw/see no other way around it.
Ultimately my original question - or at least my reason for asking it, which is an inquiry into the contract's failure to let us name an operator - either via approve() or setApprovalForAll() - and then have that operator actually and successfully be able to transact tokens on our behalf, remains.
The way that pesky require statement is written out of the box scuttles and therefore completely contradicts the very notion of having operators, and that just doesn't make any sense to me.
If anyone can shed some light on this it'd be great!


texts: Is it safe to publish a raw signed transaction in etherscan?

texts:
I'm making a flow of creating a transaction offline, and publish it using external node (etherscan.io).
So the flow will go from here:

I will use this code to generate a signed raw tx

var { Transaction } = require('@ethereumjs/tx');
var web3utils = require("web3-utils");

const txParams = {
  from: '0x0000000000000000000000000000000000000000',
  to: '0x0000000000000000000000000000000000000000',
  nonce: web3utils.toHex(0),
  gasPrice: web3utils.toHex(1000000000),
  gasLimit: web3utils.toHex(50000),
  value: web3utils.toHex(
    web3utils.toWei("0.1", "ether"),
  ),
}
const tx = Transaction.fromTxData(txParams)
const privateKey = Buffer.from(
  'e331b6d69882b4cb4........67688d3dcffdd2270c0fd109',
  'hex',
)
const signedTx = tx.sign(privateKey)
const serializedTx = signedTx.serialize();
const rawTx = serializedTx.toString("hex");
console.log(rawTx); //f86b808432c35......67904d240

I will copy and paste the rawTx (f86b808432c35......67904d240) to https://etherscan.io/pushTx

Is it possible to get my private key from the rawTX by decoding it somehow? or is it safe to make the rawTx public?
Thank you


texts: Can I get geth.ipc if I use ganache-cli to deploy a default private test ethereum env

texts:
When I test my golang code which subscribes/filter/parse log from a local ethereum test env built by myself, The way I communicate with eth is by using geth.ipc.

But another test env is based on ganache with which I am not familiar, therefore I can not find the geth.ipc to connect. I know I can still talk to ethereum via the HTTP port. But there came an err message like subscription is not supported by HTTP.

I just wonder if I can find that ipc file in ganache test env to keep using my code, or I should adopt to HTTP RPC connection by change the communication way a little bit.

Thanks in adv.


texts: Can you pass an array parameter to a contract function during truffle migrate?

texts:
Testing on TestRPC, when trying to pass an array parameter to a contract function during

truffle migrate --reset

I've been getting the following error:

Unhandled promise rejection (rejection id: 2): Error: Invalid number of arguments to Solidity function

In an attempt to hunt down the culprit I have made a toy example, amending the original /contracts/MetaCoin.sol example by removing any ConvertLib reference and adding an initialize function which accepts a uint[] parameter:

contract MetaCoin {
   mapping (address => uint) balances;
   uint testArraySum;

   event Transfer(address indexed _from, address indexed _to, uint256 _value);

   function MetaCoin() {
       balances[tx.origin] = 10000;

   }

   function initialize(uint[] _test_array) returns(bool){
      for(uint i = 0; i < _test_array.length; i++) {
         testArraySum += _test_array[i];
      }
      return true;
   }

   function sendCoin(address receiver, uint amount) returns(bool sufficient) {
       if (balances[msg.sender] < amount) return false;
       balances[msg.sender] -= amount;
       balances[receiver] += amount;
       Transfer(msg.sender, receiver, amount);
       return true;
   }
   function getBalance(address addr) returns(uint) {
       return balances[addr];
   }
}

The above has been successfully compiled with

truffle compile

For simplicity, I have also removed the migrations contract and written the following deployment script in /migrations/2_deploy_contracts.js:

   var MetaCoin = artifacts.require("./MetaCoin.sol");
   module.exports = function(deployer, network) {
     var metaCoin;

     if (network == 'development') {
       metaCoin = {
         address : '0xa8e055d89579a74b0110728a740e18e80c44e211',
         test_array : [web3.toBigNumber(3).valueOf(), web3.toBigNumber(3).valueOf(), web3.toBigNumber(3).valueOf()]
       };
     } else if (network == "ropsten") { // ropsten testnet
     } else if (network == "rinkeby") { // rinkeby testnet
     } else if (network == "live") {
       throw "error: deployment for live network is not yet supported";
     }

     var mPromise = MetaCoin.at(metaCoin.address).then(function (exiM) {
       console.log('Found existing MetaCoin contract at ' + exiM.address);
       return Promise.resolve(exiM);
     });

     mPromise.then(function (m) {
       console.log('MetaCoin contract at ' + m.address);
       return m.initialize(metaCoin.test_array);
     }).catch(function (err) {
       if (err.message && err.message.includes('Cannot create instance of')) {
         console.log('Deploying new MetaCoin contract');
         MetaCoin.new().then(function (newM) {
           console.log('Deployed new MetaCoin contract at ' + newM.address);
           console.log(JSON.stringify(metaCoin.test_array));
           return newM.initialize(metaCoin.test_array);
         });
       } else {
         console.error(err);
         return Promise.resolve(null);
       }
     });
  };

Yet, even in this simplest of examples the error still persists no matter how I declare the test array or format the fields.

Continuing my search I ran across this related issue on github:
https://github.com/trufflesuite/truffle/issues/526
Where they conclude that this is an issue of web3 as of v0.19

Version Information -

  MacOS Sierra v10.12.6

  Truffle v3.4.9

  Solidity v0.4.15

  EthereumJS TestRPC v4.1.1

  Web3js v0.20.1

  Node v6.11.2

Any workaround or solution would be greatly appreciated!


texts: Derive additional accounts from private key

texts:
Im building a dApp and during account creation I can generate an address as well as private/public (extended) keys.

What i want is to be able to generate further accounts after the seed is no longer available, the only object available to the user is web3 secret storage from which i can get the users private key, if I am not mistaken the only time i can get the extended private key is during the account creation or when the user supplies their seed.

Is it not possible to create further derived addresses from a private key ?


texts: Contract Security - When to include modifiers

texts:
Just some pretty high level questions here.

When is it best to include modifiers?
Are there any safeties needed to be placed on the initial contract creation function?
In the last function of my sample contract, the one that sends me money...should I have an onlyCreator modifier? (why should I care if other people pay the gas?)

contract factory {
address[] public newContracts;
address public creator;

function factory (){
    creator = msg.sender;
}

function create () payable returns (address){
    require(msg.value >= 1 * 1000000000000000000);
    newContracts.push(msg.sender);
    return newContract;
}

function withdrawFee() {
    creator.transfer(this.balance);
}
}


texts: If I buy a Ledger Nano S, does it come with a built-in address? Does it create an address for me?


texts: How to recover/find metamask wallet file

texts:
So I had foolishly kept my metamask passphrase only on StickyNotes. This meant when my computer crashed, I had to reinstall all my programs, but all my files remained. For some reason my stickynotes program updated and my previous stickynotes disappeared from the program. I had an older version of the notes but these did not contain the pass phrase.

My question is where I should look for the metamask file? Since my browsers were reinstalled, I cant find any metamask related files under chrome extensions in the appdata/local folders.
I followed the advice here:Where does metamask store the wallet seed? (file path)
But my 0003 file was almost empty due to the reinstallation of chrome and the removal of any extensions I had.

Is there anything else I can try? Either to recover the stickynotes files somehow or find a metamask file? I have the password but dont know where to look for a pass phrase.

Thanks.


texts: web3.js not able to interact with smart contract

texts:
web3.js and general ethereum noob here.
I have a smart contract written in solidity with a bunch of getter methods, for example:
contract mycontract {
    uint XYZ = 2;
...
...
...

    function getXYZ() public view returns (uint){
        return XYZ;
    }
}

I have deployed this smart contract on a private chain and started a provider using geth.
Using web3.py in python, the following code works:
w3 = Web3(Web3.HTTPProvider("http://127.0.0.1:8545/"))
contract = w3.eth.contract(address=contract_address, abi=abi)
contract.functions.getXYZ().call()

However, the following equivalent code does not work in the browser or nodejs using web3.js-1.3.4
let w3 = new Web3("http://127.0.0.1:8545");
contract = new w3.eth.Contract(abi, contract_address);
contract.methods.getXYZ().call();

The error I get is Error: execution reverted both in the browser console/node js script without any stacktrace.

Is there something obviously wrong that I am doing? I have also tried to get this work with a web-socket provider instead of a http-provider, since the web3.js documentation indicates that the http provider is deprecated. However, I run into the same issue there as well.
Edit with some more information:

I am using a custom geth executable of geth Version: 1.9.26-unstable
https://github.com/ethereum/go-ethereum/blob/master/consensus/ethash/consensus.go at Git Commit: 2e5d14170846ae72adc47467a1129e41d6800349
. Only change that was made was the function CalcDifficulty in line 315 which was changed to always return 1 instead of performing the difficulty calculation.

Here is the bash script I am using to start my geth provider.

#!/bin/bash
nice -50 geth --datadir ~/.ethereum/myethereumnet --gasprice 0 --nodiscover --networkid 2020 console --maxpeers 0 --rpc --rpcport 8545 --rpcaddr "0.0.0.0" --rpccorsdomain "*" --rpcapi "eth,net,personal,debug,web3,miner" --preload "startmine.js" --allow-insecure-unlock --nousb console

Here is startmine.js. This is used because continuous mining is not desired for testing/development purposes.

var mining_threads = 1
var txBlock = 0

function checkWork() {
if (eth.getBlock("pending").transactions.length > 0) {
    txBlock = eth.getBlock("pending").number
    if (eth.mining) return;
    console.log("  Transactions pending. Mining...");
    miner.start(mining_threads)
    while (eth.getBlock("latest").number < txBlock + 12) {
      if (eth.getBlock("pending").transactions.length > 0) txBlock = eth.getBlock("pending").number;
        }
    console.log("  12 confirmations achieved; mining stopped.");

    miner.stop()
}
else {
    miner.stop()
     }
}

eth.filter("latest", function(err, block) { checkWork(); });
eth.filter("pending", function(err, block) { checkWork(); });

checkWork();

Edits 1, 2 and 3 were not mentioned before since I did not think they would be relevant since the python client worked.
Following this, I run miner.start(1) to start some mining.
Any advise to debug this issue would be much appreciated. Thanks.


texts: Ways to manage disk space? (e.g., running geth/Mist in "full," "fast" and/or "light")

texts:
Looking to manage my disk space needs, knowing that the blockchain is ~20GB as of June 2016 and growing. Have a few related noob questions about the "full," "fast," and "light" syncs for Mist/geth.

(1) What's the geth default blockchain sync type when installing via command line tools? Full?

(2) Do my settings for geth automatically transfer over to Mist -- and visa versa? (e.g., if I'm running geth -fast will Mist also refer to the same size blockchain?)

(3) Is it possible to run Mist in "light" mode? I saw from this answer that Mist can be in "full" or "fast" sync but didn't see "light". I tried it, and it looks like I'm not getting any errors yet, but curious if there are known issues.

(4) Is it possible to have multiple copies of the blockchain on my computer? For example, if I first set up geth using geth -full and then I run geth -light, will the light version overwrite the full version or will I need additional space to sync light?


texts: Getting accounts involved in internal transactions

texts:
I'm analyzing interactions between accounts in Ethereum. I started by external transactions (sent from accounts), but wanted to extend the analysis to external ones (resulting from smart contract execution). For instances, if there's a transaction invoking a smart contract function paying several accounts (from an internal contract list), I'd like to extract those accounts. E.g., in this contract, I'd like to extract the accounts being paid in transaction invoking payAll().
Following this thread, I set up Parity in archive mode (--pruning=archive) and tried to use traceReplayTransaction in different modes. However, I'm still not able to get the accounts from the output.
I've also tried ethereum-input-decoder, but it only provides me with accounts provided as as arguments to smart contract functions.
This paper suggests that I should extract CREATE, CALL, CALL-CODE, DELEGATE-CALL and SELFDESTRUCT EVM operations, but I'm not sure what's the easiest way to do that.
Any help will be highly appreciated!
EDIT:
Thank you for all the answers. To get the required information, I've set up parity in archive mode (--pruning archive) and called trace_replayTransaction in stateDiff mode on each transaction. This method should work on other clients as long as they implement the RPC call. An important note when running parity in dev mode is that, in my case, it was not showing the last submitted transaction, so make sure that you submit a new transaction after the one you want to observe.