texts:
I have run a private chain in my computer.
I use the command
eth --networkid 606 --nodiscover --allow-insecure-unlock --rpc --syncmode "full" --rpcapi "eth,net,web3" --datadir /root/privateNetwork/chainData console

After
ctrl + c
how could I restart it?


texts: Send(deposit) ether from my wallet(msg.sender) to contract(this)

texts:
I want to make a function for depositing ether in the contract. I made a simple test contract:

pragma solidity ^0.4.24;

contract depo {
    function depo() public {

    }

    function () payable public {

    }

    function deposit() payable public {
        this.transfer(1 ether);
    }
}

After I deploy the contract and I run the deposit function, an error occurs.

Thank you!


texts:
I'm just starting to learn about writing code for my own ICOs but had a few questions on which addresses to use when deploying my code in Remix.
Token Code
pragma solidity ^0.5.0;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.0/contracts/token/ERC20/ERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.0/contracts/token/ERC20/ERC20Detailed.sol";

contract LCOErc20 is ERC20, ERC20Detailed {
    constructor(uint256 initialSupply)
        public
        ERC20Detailed("Lending Coin", "LCO", 18)
    {
        _mint(msg.sender, initialSupply);
    }
}

Crowdsale code
pragma solidity ^0.5.0;

import "./LCOErc20.sol";

contract LCOCrowdsale {
    LCOErc20 token;
    uint rate;

    constructor(LCOErc20 _token, uint _rate) public {
        token = _token;
        rate = _rate;
    }

    function buyToken() public payable {
        uint numTokenBits = msg.value * rate;
        token.transfer(msg.sender, numTokenBits);
    }
}

All I'm trying to do for now is to successfully call the buyToken function in my crowdsale.
Steps I've tried:

Compile and deploy ERC20 token code.
Deploy Crowdsale code.  I passed in the address of my ERC20 token contract to the Crowdsale's constructor.
Try calling buyToken using one of the addresses provided by Remix.

Step 3 produces this error
transact to LCOCrowdsale.buyToken errored: VM error: revert. revert The transaction has been reverted to the initial state. Reason provided by the contract: "ERC20: transfer amount exceeds balance". Debug the transaction to get more information.

I'm confused as I'm not sure which addresses I should be using to avoid this error.  It looks like on initializing the ERC20 token, the whole supply goes to the balance of the address that deployed the ERC20 token contract.  I've verified this by calling the token's getBalance method.  However, when I call buyToken in Crowdsale.sol, the sending address is now the address of the token contract, which has a 0 balance hence throwing the above error.
Thanks in advance.


texts: How to check if struct belongs to address?

texts:
I am trying to create a smart contract that will allow the creator of the contract to add asset properties and allocate it to an address. Once that's done, the receiving address can now send it to another address, only if it is the current owner.

I tried to allocate a struct 'Asset' by mapping an address to the assetId which is the count of assets being created.

I am not really sure if its the right approach to do it. Also kinda confused on how I can check the current owner based on the AssetId (since there is no where clause like in c#/LINQ.) And what would be the right way to assign an asset from current owner to next owner.

pragma solidity ^0.4.2;

contract AssetDistribution {
address public issuer;
uint public assetCount;

event AllocationDetails(address from, address to, string description);

function AssetDistribution() {
    issuer = msg.sender;
    //ContractorDetails(issuer);
}

struct Asset {
    uint assetId;
    address currentOwner;
    string description;
    uint cost;
}
mapping (address=> mapping(uint=>Asset)) private owners;
//mapping(address=> mapping(uint=>bool)) private ownerPropertyCheck;

//creates an asset and allocates it to an address at the same time.

function setCreateAsset(address newOwner, string description, uint cost)
    returns(string) {
    if (msg.sender == issuer) {
    assetCount++;
    Asset memory myAsset = Asset(assetCount,newOwner,description,cost);
    owners[newOwner][assetCount] = myAsset;
    AllocationDetails(msg.sender,newOwner,description);
    return "created By: government";
    //return strConcat("created By: ","test");
    } else {
        return "This is not the creator";
    }
}

function getassetCount() constant returns(uint) {
    return assetCount;
}

function getOwner(uint id) returns(address) {
   //return
}

}

In C# I would have mostly created a class with asset properties and would have changed the currentOwner when a transfer is done. Here I am having trouble approaching in a similar way.Should I even use struct for this?

Edit One - Solution for me

  mapping the assetId to ownerAddress & mapping addresses + assetId to
  structs solved the dilemma I was having

mapping(uint=>address) assetAddress;
mapping(address=>mapping(uint=>Asset)) ownerAssets ;

  returns the current owner address of asset

function getCurrentOwner(uint assetId) constant public returns (address) {
    return assetAddress[assetId];
}

  checks if the assetId (Id of struct) belongs to address

function isOwnerOfAsset(address userId, uint assetId) private constant returns(bool) {
    return assetAddress[assetId] == userId? true:false;
}

P.S I have mostly coded in C#/Backend, jumping to solidity is confusing me a bit. If you know any good resources to refer, feel free to share.


texts: When creating a contract getting the error "Error: The contract code couldn't be stored, please check your gas amount"

texts:
I wrote the following contract :

contract EndowmentRetriever {

    address creator;
    uint contract_creation_value;

    function EndowmentRetriever() public payable {
        creator = msg.sender;
        contract_creation_value = msg.value;
    }

    function getContractCreationValue() constant returns (uint) {
        return contract_creation_value;
    }

    function sendOneEtherHome() public {
        creator.send(1000000000000000000);
    }

    function kill() {
        if (msg.sender == creator) {
            suicide(creator);
        }
    }
}

When I am creating a new contract using the following transaction

var EdRet = edRetContract.new({from:web3.eth.accounts[0], data: edRetCompiled.EdRetriever.code, gas: 1000000, value: 3000000000000000000}, function(e, contract){
    if(!e) {
        if(!contract.address) {
            console.log("Contract transaction send: TransactionHash: " + contract.transactionHash + " waiting to be mined..."); }
        else {
            console.log("Contract mined! Address: " + contract.address);
            console.log(contract); }
        }
    else {
        console.log(e); }
    })

I am getting the following error message :

Error: The contract code couldn't be stored, please check your gas amount.

If I remove the value parameter in the transaction(i.e. the initial endowment to the contract),  then the contract got mined. What could be the possible reason.


texts:
I'm trying to validate signed data with ecrecover.
The message is signed like this on the FE:

return this.web3.eth.personal.sign( `${nonce}`, publicAddress ).then( ( signature ) => {
            return signature;
        } )

After the signature is seemingly well generate it is sent to the BE along with the public address for verification.

const user = await User.findOne( { publicAddress: req.body.publicAddress } );
const msg = `${user.nonce}`;

const msgBuffer = ethUtil.toBuffer( msg );
const msgHash = ethUtil.hashPersonalMessage( msgBuffer );
const signatureBuffer = ethUtil.toBuffer( req.body.signature );
const signatureParams = ethUtil.fromRpcSig( signatureBuffer );
const publicKey = ethUtil.ecrecover(
    msgHash,
    signatureParams.v,
    signatureParams.r,
    signatureParams.s
);
const addressBuffer = ethUtil.publicToAddress( publicKey );
const address = ethUtil.bufferToHex( addressBuffer );

if ( address.toLowerCase() === req.body.publicAddress.toLowerCase() ) {
    res.status( 200 ).send( { message: 'Signature ok' } );
} else {
    res.status(401).send( { error: 'Signature verification failed' } );
}

However I always get back a completely different public address then the original. I read somewhere that I might need to append a prefix along with the message length, but that didn't help either.

Thanks


texts: TruffleContract At() function with Drizzle

texts:
I am learning the Drizzle framework after I did a project using TruffleContract abstractions in Javascript (DApp).

I have multiple instances of a contract and I am not able to access at the instances "older" than the last deployed one. With TruffleContract I have the at(address) function that (slowly) retrieves the contract with address address.

For example:

I deploy 3 contracts "MyContract" c1, c2, c3, each one with a different storage variables. Then with TruffleContract I can call these functions:

const getContract = require('truffle-contract')
const contractJSON = require('./MyContract.json')

const contract = getContract(contractJSON)
contract.setProvider(web3.currentProvider)

const instance_c3 = await contract.deployed() // returns the last deployed, c3
const instance_c2 = await contract.at(address_c2) // retrieve c2

How does it work with Drizzle?

Thanks


texts:
I'm quite new with ethereum development and I'm wondering how to monitor new transactions on the txpool in realtime with the least delay possible. Do I have to run a full geth node or are there other alternatives? I would like something that uses low resources and is fast.
I've tried with Infura websocket but seems limited and doesn't display info until the tx is already in a block.
Any info is welcome.


texts: When I'm working with 18 decimals. I have to convert the token inside of a function, for instance, one user want to transfer 20 token... I must operate that amount inside transfer function: amount*10^18? because I'm performing also transaction fees... And I don't know how to express the amount of fees: 1 or 1*10^18. The wallets always convert the amounts automatically when they see a global public variable decimals? Because I am doing tests on truffle, and when I´m working out transactions... the contract only send 50 tokens (not 50*10^18), so I have to perform web3.toWei in the entrance parameter.....


texts: How do you multi-sign a piece of data with multiple keys?

texts: I'm aware how one can sign a message with a single key using web3.eth.sign or helpeth. How can multiple keys sign the same message? (preferably with an example using web3)


texts: Extracting blockchain state at a specific block number to interact with deployed contracts

texts:
I want to extract main net state at a specific block number using geth or parity. Then using the extracted state I want to interact with contracts deployed during that time using ethers js.
Can someone please point me to the easiest way to achieve that?


texts: Smart Contract Token Creation (How to set total supply?)

texts:
totalSupply = initialSupply  *  10  ** uint256(decimals);

Why can't I just put totalSupply = initialSupply?.

I want my address to get all of the tokens and totalSupply to be equal to 1 million.

times 10 and uint256 is just confusing.

If I really need to have that, what should initialSupply be set to in order to have 1 million total supply?

I'm using code from https://ethereum.org/token#the-code  (advanced version)


texts: How to select the next author of block in Proof-of-Stake?

texts:
There is a common (but not precise) opinion that the block's author selection is random in Proof-of-Stake.
I therefore posted a question here: Proof-of-Stake: How to prevent someone from being always selected as an author of block? to know that how to prevent a node from being always selected as the author of the next block, since the system is not centralized and the entire selection process is done via a client code installed on each machine in the network. (I have not yet gotten a response for the above question ...)
I would like to bring now this question to know what is the process of selecting the author of the next block in each round in Proof-of-Stake?
Is the block' header hash affect selecting the block's author? And if yes, how?
Meanwhile, is only a single block's author selected in each round? And if so, logically, there should not be any fork in PoS.
Related question: Fork in Proof-of-Stake?


texts: What is operator approval in context of ERC-1155?

texts:
https://github.com/enjin/erc-1155/blob/master/contracts/ERC1155.sol says something about "operator approval".

What is an operator and what is operator approval?


texts: Add and compare items of struct in Solidity (dealing with struct in Solidity)

texts:
How can I know the whole entityData of the struct and add a new entity only if it didn't exist before (ensure no replicated data)?
struct EntityStruct {
   uint entityData;
   bool isEntity;
   bool iscontent;
   uint vote;
   uint predata;
}

mapping(address => EntityStruct) public entityStructs; address[] public entityList;

function newEntity(address entityAddress, uint entityDataa) public payable returns() {

entityStructs[entityAddress].entityData = entityDataa;
entityStructs[entityAddress].isEntity = true;
entityList.push(entityAddress) - 1;

}


texts: how to call constructor with arguments in REMIX (Solidity IDE ) from web3

texts:
so i made a contract named "Voting" with Remix IDE and a constructor with arguments for this contract

i called the contract by doing this :

var Contractabi = web3.eth.contract(contract Abi from Remix)
 var vote = Contractabi.at(Smart contract @ in REMIX );

so until now everything works fine ! but now i need to call the smart with it constructor with arguments

i found few methods like this one :

    var MyContract = web3.eth.contract(abiArray);

// deploy new contract
var contractInstance = MyContract.new([constructorParam1] [, constructorParam2], {data: '0x12345...', from: myAccount, gas: 1000000});

but it did not work for me ! How could i call My smart contract constructor with arguments in REMIX from my web3.eth.contract ! Thanks :D

Thanks :D


texts: Signing text with special UTF8 characters browser vs node web3js

texts:
I am attempting to get consistent signatures / recovery for text containing special characters.
For example, the bitcoin symbol U+20BF, ₿
Junk address and private key:
0xd60595Bef7F106a42792D5075Fb5f8eA819D4446
0x6f88aa12e42d2973e0e71cacb9212608231d438018bdd72335df404c87247188

Sign in .js file with node:
const Web3 = require('web3');
let web3 =  new Web3(myprovider);
web3.version; //1.2.4
...

sig = await web3.eth.accounts.sign(`₿`,"0x6f88aa12e42d2973e0e71cacb9212608231d438018bdd72335df404c87247188")
console.log(sig.signature)
//0x3b7bf2e1be49aef293d2838fc90d0b39dc677df18197e598ed6aa0e6f60276c44e79c055ba9a0033b41c2ac629acf8cd15dfe0f8c14e89c829f9f932f15c568d1c

Recover in browser:
// expect to recover address 0xf509D7437cA9A804331478187c5AE5dCC81e2e77, but doesn't :-(
web3.version; //1.2.9
await web3.eth.accounts.recover('₿','0x3b7bf2e1be49aef293d2838fc90d0b39dc677df18197e598ed6aa0e6f60276c44e79c055ba9a0033b41c2ac629acf8cd15dfe0f8c14e89c829f9f932f15c568d1c',false);
//0xd60595Bef7F106a42792D5075Fb5f8eA819D4446
await web3.eth.accounts.recover('₿','0x3b7bf2e1be49aef293d2838fc90d0b39dc677df18197e598ed6aa0e6f60276c44e79c055ba9a0033b41c2ac629acf8cd15dfe0f8c14e89c829f9f932f15c568d1c',true);
//0x3B37B414621766b255d62898a2aEb2Fd0893B8ea

Test signature in browser:
  // not a good idea to handle private keys in browser js code imho. This is just for illustration of error
   await web3.eth.accounts.sign('₿','0x6f88aa12e42d2973e0e71cacb9212608231d438018bdd72335df404c87247188')
   // gives different signature:
   // 0xb0144eacbb08217276945e98127e1fe7230cb843604d5ac4feb5a0e45e1da85b21e1e19bb40c872a037c2c83e38e882db67eb01c3d05171fc5ef8302d8ea3bc11b

Note the above approach works with plain ascii.
What is the best way to encode special characters to ensure consistent signatures?
Is there something obvious I'm doing wrong here?
EDIT - Updated browser web3 to v1.2.11 and it produce consistent, but incorrect, recover outputs.
web3.version //1.2.11
await web3.eth.accounts.recover('₿','0x3b7bf2e1be49aef293d2838fc90d0b39dc677df18197e598ed6aa0e6f60276c44e79c055ba9a0033b41c2ac629acf8cd15dfe0f8c14e89c829f9f932f15c568d1c',false)
"0xd60595Bef7F106a42792D5075Fb5f8eA819D4446"

EDIT 2 - Post update doesn't work for some characters (e.g. §, utf8 hex 0xC2 0xA7)
*EDIT 3 - Updating both web3 versions to 1.2.11 works (for all the chars I checked) , again I would accept an answer that states what the issue was with web3js... *


texts: Mining with geth on private network hangs indefinitely

texts:
I've got a private test network running as per this article.  In particular my difficulty is set to 0x400; the entire genesis file I'm using can be seen here.

Mining with geth does not seem to work at all.

Here's what I've tried to do.  First a fresh blockchain and account:

vagrant@debian-jessie:~$ mkdir stackexchange-example-chain
vagrant@debian-jessie:~$ geth --genesis local_genesis.json \
  --datadir stackexchange-example-chain \
  --networkid 9991 --nodiscover --maxpeers 0 account new

Then after dealing with that, booting up the console:

vagrant@debian-jessie:~$ geth --genesis local_genesis.json \
  --datadir stackexchange-example-chain \
  --networkid 9991 --nodiscover --maxpeers 0 console

And then what I understand to be the standard mining setup:

> eth.accounts
["0x699ec6d49641e59f65ba4bf72c52628059301e64"]
> var foo = eth.accounts[0];
undefined
> miner.setEtherbase(foo);
true
> miner.start(2);
true

The logs report that generating the DAG for epoch 0 finishes in ~1 second, and then the miner seems to hang.  The longest I've let it run is about 15 minutes, but at the difficulty I've specified I understand that I should be mining plenty in far less time than that.  If I check miner.hashrate at any point I just get a bizarre new BigNumber() not a number: [object Object] error.

I've also tried wiping the .ethash directory and generating a new DAG from scratch.  Same result.

After stopping with miner.stop(2), a getBalance call verifies that no ether have been mined:

> eth.getBalance(foo);
0

If I call eth.getBlock('pending', true) I receive the following information (you can see the entire log/console session output in this gist):

{
  difficulty: 131072,
  extraData: "0xd783010400844765746887676f312e352e31856c696e7578",
  gasLimit: 268173313,
  gasUsed: 0,
  hash: null,
  logsBloom: null,
  miner: null,
  nonce: null,
  number: 1,
  parentHash: "0x522fe03765d5834422cd7cfc88c435f33bcd13d7a4c71cd8eaf321a8b3dd8ea3",
  receiptRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 536,
  stateRoot: "0x2fa7b359e63faf5af52846537e67053ffd96d2fd33877704192c9c3e6e6266b9",
  timestamp: 1455530923,
  totalDifficulty: 0,
  transactions: [],
  transactionsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  uncles: []
}

Notice that the reported difficulty is much higher than what I've specified in my genesis file; 131072, whereas I assume it would be 1024.  Maybe this isn't representing the same difficulty, though.  Later on the totalDifficulty is reported as 0, perplexingly.

Does anyone have any insight into what could be going wrong here?

It seems like this is the same problem encountered in this question.


texts: How to transfer coins from Super Contract back to account

texts:
Some funds were mistakenly transferred to an ethereum based smart contract address instead to a personal address.

Is there any way anyone (coin developers maybe) can transfer coins from this smart contract address back to my personal address or are they simply gone forever?

Help much appreciated


texts: linking form submission to smart contract

texts:
I have a smart contract that sends x ether to an address.
I have an html page that has a form for the address, and the amount to be sent. Theoretically it should interface with the smart contract.
Nothing happens when i submit the form. It doesn't work on remix or ganache.
On my form, do i have to specify a form action as i would in html? Would the contract not do that?

The html file is similar to https://github.com/dappuniversity/20_minute_dapp/blob/master/index.html
but the forms/variables are changed and all the css and formatting is removed.

my sol

pragma solidity ^0.5.11;

contract ReceiveEther {

uint256 public count;

function () external payable {
    require(count < 2);
    count++;
}

function getBalance() public view returns (uint) {
    return address(this).balance;

}
}

contract SendEther {
    function sendViaCall (address payable _to) public payable {
        (bool sent, bytes memory data) = _to.call.value(msg.value)("");
        require (sent, "failed to send ether");
    }
}

My html

<!DOCTYPE html>

send ___ ether to ___

          <form role="form">
            Receiver:

            <input type="text" id="receiver" name="receiver" >

            amount in eth:

            <input type="text" id="amount" name="amount" >
            <input type="submit" value="Submit"
          </form>

I feel the issue is related to the submission, but what do I know.
Thank you for any guidance


texts:
I have read the Oraclize documentation: https://docs.oraclize.it/#home

and similar topic like: How do oracle services work under the hood

But is still have a question, take this example:
I have a simple smart contract that makes a Oraclize call (or an API call) to a data source.
Every miner that need to run the smart contract for reach consesus, so every of them will do the Oraclize call? or the call will always be done one time?
If every of them do the call it's possibile that the result of call is different, for example if the call is to a financial data source.


texts: Cannot Deploy to Rinkeby using Truffle, Infura, and Node

texts:
I am trying to deploy a contract to Rinkeby using Node and Truffle but I get a lengthy error:
Truncated Error:
    Attempting to deploy from account 'MYACCOUNT#'
    [object Object]
    [object Object]
    //... error body is too long to fit

    ^
    RuntimeError: abort([object Object]).Build with - s ASSERTIONS = 1
for more info.
at process.abort(/Users/ntg / Desktop / Inbox / node_modules / solc / soljson.js: 1: 13939)
at process.emit(events.js: 314: 20)
at process.emit(/Users/ntg / Desktop / Inbox / node_modules / source - map - support / source - map - support.js: 495: 21)
at processPromiseRejections(internal / process / promises.js: 245: 33)
at processTicksAndRejections(internal / process / task_queues.js: 94: 32)
at runNextTicks(internal / process / task_queues.js: 62: 3)
at listOnTimeout(internal / timers.js: 520: 9)
at processTimers(internal / timers.js: 494: 7)

Package.JSON
{
  "name": "inbox",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "mocha"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@truffle/hdwallet-provider": "^1.2.1",
    "ganache-cli": "^6.12.1",
    "mocha": "^8.2.1",
    "solc": "^0.8.0",
    "web3": "^1.3.1"
  }
}

Deploy.js
const HDWalletProvider = require("@truffle/hdwallet-provider");
const Web3 = require('web3');
const {abi, bytecode} = require('./compile');

const provider = new HDWalletProvider(
    'my mnemonic phrase',
    'https://rinkeby.infura.io/v3/myKey'
);

// instantiate with hdwallet
const web3 = new Web3(provider);

const deploy = async () => {

      // get list of all accounts
      const accounts = await web3.eth.getAccounts();

      console.log('Attempting to deploy from account', accounts[0]);

      const result = await new web3.eth.Contract(abi)
     .deploy({data: '0x' + bytecode, arguments: ['Hi there!']})
     .send({from: accounts[0]});

     console.log('Contract deployed to', result.options.address);
};

deploy();

Compile.js
const path = require('path');
const fs = require('fs');
const solc = require('solc');

const inboxPath = path.resolve(__dirname, 'contracts', 'inbox.sol');

const source = fs.readFileSync(inboxPath, 'utf-8');

var input = {
    language: 'Solidity',
    sources: {
        'inbox.sol' : {
            content: source
        }
    },
    settings: {
        outputSelection: {
            '*': {
                '*': [ '*' ]
            }
        }
    }
};

// parses solidity to English and strings
var output = JSON.parse(solc.compile(JSON.stringify(input)));

var outputContracts = output.contracts['inbox.sol']['Inbox']

// spits out ABI interface
exports.abi = outputContracts.abi;

// exports bytecode from smart contract
exports.bytecode = outputContracts.evm.bytecode.object;

Contract - inbox.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

contract Inbox {
    string public message;

    constructor (string memory initialMessage) {
        message = initialMessage;
    }

    function setMessage(string memory newMessage) public {
        message = newMessage;
    }

}


texts:
I've an instance with a 40GB hard drive and I'm having difficulties to synchronize with parity.

I've used --pruning auto --pruning-history 3 but around block 4200000 I run out of space, the folder with the chain data has a size around 35GB.

Does anyone know if it is possible to synchronize parity with this space limitation?


texts:
contract permission{
struct transaction {
        address payable sender;
        address receiver;
        string datatype;
        Status status;
    }

function getTransactionCount() public view returns(uint256 cnt) {
        uint256 len = transactions.length;
        return(len);
    }
}

the above solidty code returns the count of transactions in a contract.
The data insertion(or transaction creation works fine). I get the transactionhash, as it verified but when I call the function to use the above function the contractInstance.methods.getTransactionCount().call();
returns null not default 0, even after inserting and using async/await procedure the problem still persists.
Please help
I have attached the test code for clarity

var Web3 = require('web3')

const web3 = new Web3('http://127.0.0.1:8545')

json = require('./../../../build/contracts/permission.json');

const interface = json['abi'];
const bytecode = json['bytecode'];

async function setup(){
    var contract =  new web3.eth.Contract(interface,'0xBcf2D22144C11C20B31A7Aa84875414B252a92DB');
    const accounts = await  web3.eth.getAccounts().then(res=>{return res;})
    const admin = accounts[9];
    var receiver = accounts[1];
    var sender = accounts[3];
    const xl = contract.deploy({ data: bytecode })
    const bb = xl.send({from: admin,gas: 4712388,gasPrice: 100000000000},(error,transactionHash)=>{console.log('w',error,transactionHash);}).then(inst=>{return inst}).catch(err=>{console.log});
    const bl = contract.methods.newTransact(receiver, 'dob').send({from: sender},(error,transactionHash)=>{console.log('e',error,transactionHash);});
    const br = await contract.methods.getTransactionCount().call().then(rlt=>{console.log(rlt)})
    const bt = contract.methods.newTransact(receiver, 'aadhar').send({from: sender},(error,transactionHash)=>{console.log('r',error,transactionHash)}).then(con=>{console.log});
    const by = await contract.methods.getTransactionCount().call().then(rlt=>{console.log(rlt)});

     console.log(br.cnt,by.cnt);
}
setup();

Still returns null,null as the output.

If await is not used then the code just waits endlessly

the  following is a sample code that has the same issue as my smart contract(it is just too long for publishing here) but here too the same issue occurs.

var Web3 = require('web3')

const web3 = new Web3('http://127.0.0.1:8545')

json = require('./build/contracts/test.json');

const abi = json['abi'];
const bytecode = json['bytecode'];

async function setup(){
    const contract =  new web3.eth.Contract(abi);
    const accounts = await  web3.eth.getAccounts();
    const admin = accounts[9];
    const receiver = accounts[1];
    const sender = accounts[3];

    const deployedContract = await contract.deploy({ data: bytecode }).send({from: admin,gas: 4712388,gasPrice: 100000000000});
    const receipt =  await deployedContract.methods.setData('dob').send({from: sender});

    const data = await deployedContract.methods.getData.call();
    console.log(data);
}
setup();

the solidity code the same is :

pragma solidity >=0.4.22 <0.6.0;
pragma experimental ABIEncoderV2;

contract test{
    string data;
    function getData() view external returns(string memory){
    return data;
    }
    function setData(string calldata _data) external{
    data = _data;
    }
}


texts: What are LLL_codes in Vyper and how do I define those for built-in functions?

texts:
I need to create a custom compiler for Vyper with only one addition - set of new built-in functions. How can one do that? I have managed to find file containing all of them, yet I had no luck to find any documentation.
(The hardest part for me here is understanding what LLL-codes should I return from build_LLL method)


texts:
I want to choose a consensus algorithm for permissioned blockchain in healthcare. I know PoA and PBFT are good choices, but I want to know which one is better?
Thanks...


texts: Why is it so expensive to trade on Uniswap with MetaMask? ($50 fee)

texts:
The best quote that the Uniswap fox found for swapping 1 ETH for UNI token right now has a $50+ estimated transaction fee (max $80) inclusive of a 0.875% MetaMask fee. Even if I change the swap to a different token like 1Inch, the quoted fee remains unchanged.
Why is it so expensive to trade on a decentralized exchange? Centralized exchanges would be nowhere near this level


texts: How the precision (number of digits after the dot) for a ERC-1155 token is determined?


texts:
So I'm using Remix and have the following code:

pragma solidity ^0.4.11;

contract Negs {

  event Print(string _name, uint _value);

  function Test() {
    var startValue = 1000;
    var endValue = 800;
    Print ("Change1 - ", endValue / startValue);
    Print ("Change2 - ", 10*endValue / startValue);
    Print ("Change3 - ", 100*endValue / startValue);
    Print ("Change4 - ", 1000*endValue / startValue);
  }

}

And then looking at the events in the little box to the right once starting Test, I get the following values:

Change 1 - 0
Change 2 - 8
Change 3 - 14
Change 4 - 13

I know that Change 1 should be zero as there's no decimals, got that..but what about the other ones?  Why wouldn't Change3 be 80 and change4 800?


texts: Difficulty growing exponentially with block chain length?

texts:
The Ethereum Yellow Paper includes on page 6 in equation (44) a term  which contributes to the difficulty of a block. This term is added to the difficulty in equation (39).

 is an exponential function which depends on the length of the block chain only. The longer the chain up to the current block , the higher  and  is growing exponentially.

This looks very strange. It would mean that the longer the chain, the higher the difficulty and the more difficult and costly it becomes to mine a new block. This is counter intuitive.

Does  really depend on the length of the block chain? Or is this a typo on in the paper and should it actually depend on something else, i.e. the gas limit  instead of the chain length ?


texts: Ethereum & ERC20 Tokens Integration in exchange

texts: I'm a part on an exchange development and we want to integrate Ethereum, Ethereum Classic and all ERC20 tokens in that exchange. Which wallet will be compatible for these requirements, Is there any official library for the integration of Ethereum, Ethereum Classic and all ERC20 tokens?


texts: Using assembly to create a fallback function with a return value?

texts:
Is it possible to use Solidity assembly to create a fallback function that makes a DELEGATECALL to another contract, and then uses assembly to correctly store the return value of the DELEGATECALL in the appropriate registers, so that the fallback function effectively returns this value?

This is useful so that I can make a contract that behaves exactly like another contract, while maintaining the clones interoperability with solidity features.

-- EDIT --

Ok I've done some more research, and it seems like it should be possible to use assembly to push to the returndata of the EVM stack, but I can't find any particularly good documentation for the Ethereum VM that has the info I need. Where is the returndata in memory? What is the best way to write to it? Etc.


texts: How to change blockreward to 100 cake tokens in pancakeswap

texts:
Does anyone know how we can set the block reward to 100 cake tokens in pancakeswap. I don't understand which variable will be changed. These are the variables in the migrations file
const INITIAL_MINT = '25000';
const BLOCKS_PER_HOUR = (3600 / 3) // 3sec Block Time
const TOKENS_PER_BLOCK = '10';
const BLOCKS_PER_DAY = 24 * BLOCKS_PER_HOUR
const TIMELOCK_DELAY_SECS = (3600 * 6);
const STARTING_BLOCK = 4853714;
const REWARDS_START = String(STARTING_BLOCK + (BLOCKS_PER_HOUR * 6))
const FARM_FEE_ACCOUNT = myaddress

and this is how I deploy the masterchef
 console.log(`Deploying _masterchef on Testnet`)
       // const rew = BigNumber.from(TOKENS_PER_BLOCK).mul(BigNumber.from(String(10 ** 18)));

        console.log('Current block reward ',rew);
        return deployer.deploy(_masterchef,
            CakeToken.address,
            SyrupBar.address,
            myaddress,
            BigNumber.from(TOKENS_PER_BLOCK).mul(BigNumber.from(String(10 ** 18))),
            0,

        )

On running the code the rew variable returns
BigNumber { _hex: '0x8ac7230489e80000', _isBigNumber: true }
which I dont know how to read. So what do I have to change to make it 100, only the tokens per block?


texts: Understand the `call` opcode in this contract

texts:
Hello, I am posting a quick question regarding the functionality this contract:
https://etherscan.io/address/6b63ea3612dde97082aab468157950f927618d31#code
From the source code, I am not even able to find a call (send, transfer, and so on) statement.

But to my surprise, this contract seems to have plenty of call opcode in its opcode sequence. Actually I tried one smart contract bug detector and the detector treats this contract as under "re-entrancy attack".

Could anyone shed some lights on the mismatch here? Thanks a lot!


texts: How to access contract data without getter functions via web3

texts:
My contract is reaching beyond the gas limit and I cannot deploy it on the main net as is. I can reduce the gas cost by removing all the constant functions whose only purpose it to give access to the underlying data in a nice way.

This actually reduce the gas cost by more than 30 % and should allow me to deploy my contract on the mainnet.

Since that raw data is theoretically accessible anyway. I was wondering if there is a nice way to replicate such constant functions on the web3 / js side ?

By the way, I know that I could break my contract in several sub contract via DELEGATECALL. But I am here specifically interested in the ability to reduce gas cost by removing the need of constant functions.


texts:
I have web3.js working on my Windows machine, I need to access web3 library called coder.js, according to this answer the location of that library is web3/lib/solidity/coder.js

But I cannot find these libraries, does anyone know what is the location on web3 libraries on Windows 7?


texts:
I am following the tutorial on http://truffleframework.com/tutorials/pet-shop

I am using Ganache for testing, where i am also deploying the tutorial contract.

  1) TestAdoption "before all" hook: prepare suite:
     Error: VM Exception while processing transaction: out of gas
      at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/errors.js:38:1)
      at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:86:1
      at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-provider/wrapper.js:134:1
      at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/httpprovider.js:128:1)
      at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:64:1)
      at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:354:1)
      at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:509:1)
      at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:469:1)
      at endReadableNT (_stream_readable.js:1101:12)

What does this mean?
The tests are simple, the contract doesn't do much.
Where is the gas limit set?

I started ganache with

ganache-cli -l 500000000

Is there something i am missing?


texts: Can't get length of array? (not querying for property)

texts:
mapping(uint256 => address) public userList;

function getUserCount() public constant returns(uint userCount) {
 return userList.length;
}

function newUser(address _address) internal returns(bool success) {
    userList.push(_address);
    return true;
  }

function getUser(uint256 _userId) public constant returns(address){
      return(userList[_userId]);
  }

throws error "member length can not be found" - can somebody explain to me why this doesn't work? i've looked at the storage patterns list and saw that they would add an additional array to have a user count - i was really trying to avoid that so that on high demand two users would not get the same id, by setting their id to length - was just planning to push the new users without setting an id manually


texts: Is there any embedded wallet library available for Ethereum I can use for the IoT devices (Raspberry Pi, Arduino etc)? I want something similar to MetaMask but, instead of holding the wallet addresses, public keys and private keys in the web broswer I want to hold them directly to the device and be able to make transactions.


texts: The fastest way to send multiples transactions

texts:
I want to send multiple transactions from differents address at the same time with Infura and Web3.py
Currently my code look like this :
for i in range (n):
   tx= ... (build transaction for adresse i)
   signed_tx = w3.eth.account.sign_transaction(tx, key[i])
   w3.eth.sendRawTransaction(signed_tx.rawTransaction)

Is this the best way to do it ? Because it only send 3 tx each secondes.
Can it be caused by slow internet connexion or slow computer ? How to speed it ?
EDIT : I did some tests and build each transaction need 0.15s, send it 0.30s more, only 0.001s to sign
EDIT2 : I tried with faster internet and computer, it doesn't change anything
Thank you


texts: How do I watch multiple solidity events from the same JS file?

texts:
I am unable to watch multiple solidity events from the same JS file. I know the problem is not with either one of the events because they work individually, just not when several watch() functions are present. Here is my code:

...

function solidityEventListener() {
 let solidityEvent1;
 let solidityEvent2;
 Contract.deployed().then(function(i) {
  solidityEvent1 = i.productCreated({fromBlock: 0, toBlock: 'latest'});
  solidityEvent2 = i.productPurchased({fromBlock: 0, toBlock: 'latest'});

  solidityEvent1.watch(function(err, result) {
   if (err) {
    console.log(err)
    return;
   }
   createProduct(result.args);
  });

  solidityEvent2.watch(function(err, result) {
   if (err) {
    console.log(err)
    return;
   }
   updateProduct(result.args);
  });
 })
}

Only solidityEvent1 will fire if both watch() functions are present. Thank you in advance for your assistance.


texts: Comprehensive guide to mining testnet ether

texts:
So my usual faucet, Zerogox, is currently down. I'm writing documentation on a projet that needs a LOT of testing, and I can't possibly write something like "to start and get some testnet ether, go ask someone on reddit".

I don't need thousands of ether, I think even 1 to 5 a week would be enough, but I need a reliable,  source. Since I can't rely on faucets (that are pretty hard to find right now), I need to mine testnet ether. Like I said, I could do with 1 ether a week.

But I don't understand how mining works, I didn't need it before. What gas price should I use to get fraction of ether easily?

The github page only gives theory, I have no idea of what real values I should use. It's also outdated (I assume), because for example miner.hashrate doesn't exist on the version of geth I'm using (which was released after the latest edit of the page).

It's hard to keep track of how much ether I've mined, and if I'm being successful, miner has almost 0 info, only functions (start, stop, and set stuff).

How do I efficiently mine testnet ether? Why can't I find a comprehensive guide about it? Most posts end with "Give me your address, I'll send you some" which is not at all what I want, I need to be independent.

I want to clarify a few things:

I cannot use a private testnet. I need to use the public one.
I'm only using geth. Mist and Ethereum Wallet are out of the picture.
I'm not looking for a small-time fix for my problem in particular, I'm asking for a comprehensive guide that I think could benefit to many people. Either it already exists, or we could start a wiki post with instructions and tips on what gas price gives best results, how to keep track of performances, etc.


texts:
Is there a simple way that I can be notified (or check easily) when my address (an EOA) is approved by some other address (EOA, not contract) for an allowance of x amount of any ERC-20 token? It seems that etherscan only shows the owner account interacting with the token contract and calling approve. It will come up in the transaction lists for both of those addresses but not in the spender's transaction list.
If the format I'm expecting most traffic (and thus approvals) to flow through is a website can I use web3/javascript listeners for the Approval event on the blockchain? What would that look like? I'm internediate with Solidity but still earning javascript.
Is there possibly even an easy way I could manually check which allowances an address holds? I've been able to find sites which show approvals an address has granted, but no source of all allowances an address holds as the spender for others.


texts:
I am trying to initialize this struct and I can't figure out how to pass in a dynamically sized empty array..

      uint8[] id;
  users[msg.sender] = User( true, msg.sender, _username, block.timestamp, block.number, 0, id, 0);


texts: Accessing testrpc addresses from solidity tests

texts:
I'm consulting truffle's docs on how to test contracts directly in solidity.

http://truffleframework.com/docs/getting_started/solidity-tests

I'd like to figure out a way to refer to existing testrpc accounts in my tests. Something like:

pragma solidity ^0.4.11;

import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/BAToken.sol";

contract TestBAToken {
  function testNewBATokenNotFinalized() {
    address companyFundAddress = addresses[1];  // <-- I'd like this to be a predefined testrpc account
    address userFundAddress = addresses[2];
    uint256 startBlock = block.number - 100;
    uint256 endBlock = block.number + 100;
    BAToken ba = new BAToken(companyFundAddress, userFundAddress, startBlock, endBlock);
    Assert.equal(ba.isFinalized, false, "Token sale shouldn't be finalized upon initialization.");
  }
}

Is this possible? If not, anyone have any good recommendations for how to refer to existing accounts during testing?


texts: How to get smart contract assertion message thorugh web3.js?

texts:
I revert a transaction in my smart contract when a specific condition is met. For instance:
function doMoneyLaundering(uint256 millionsOfDollars) public {
   ...
   require(US_IS_THE_BIGGEST_SUPPORTER_OF_HUMAN_RIGHTS, "Are you kidding me?!");// an always wrong assertion, only for the test!
   ...
}

Now I need to get assertion error in my JS code:
await dangerousContractInstance.methods.doMoneyLaundering(aVeryBigDealOfMoney).send({from: accounts[0]}).catch(console.log);

But it just throws a nonsense exception:
Error: VM execution error.
    at Object.callback (/home/dangerousUser/IdeaProjects/dangerousProject/node_modules/truffle-hdwallet-provider/dist/index.js:15:632675)
    at /home/dangerousUser/IdeaProjects/dangerousProject/node_modules/web3-providers-ws/lib/index.js:114:45
    at Array.forEach (<anonymous>)
    at WebsocketProvider._onMessage (/home/dangerousUser/IdeaProjects/dangerousProject/node_modules/web3-providers-ws/lib/index.js:102:69)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (/home/dangerousUser/IdeaProjects/dangerousProject/node_modules/yaeti/lib/EventTarget.js:115:12)
    at W3CWebSocket.onMessage (/home/dangerousUser/IdeaProjects/dangerousProject/node_modules/websocket/lib/W3CWebSocket.js:234:14)
    at WebSocketConnection.<anonymous> (/home/dangerousUser/IdeaProjects/dangerousProject/node_modules/websocket/lib/W3CWebSocket.js:205:19)
    at WebSocketConnection.emit (events.js:198:13)
    at WebSocketConnection.processFrame (/home/dangerousUser/IdeaProjects/dangerousProject/node_modules/websocket/lib/WebSocketConnection.js:554:26)
    at /home/dangerousUser/IdeaProjects/dangerousProject/node_modules/websocket/lib/WebSocketConnection.js:323:40
    at process._tickCallback (internal/process/next_tick.js:61:11)

Does anybody know how can I get the correct message? By the way, I'm testing on kovan and Infura.


texts: Contract deploy timeout - web3py & Parity

texts:
I'm trying to deploy a contract but it seems like I'm going through a minefield...

When I try to deploy the contract I always get timeout error.

I wrote the contract on remix, and tried both remix compiler aswell as solcjs compiler, but to no avail.

Here is the relevant part of my code

from web3 import Web3, HTTPProvider
rpcc = Web3(HTTPProvider('myserver'))
rpcc.personal.unlockAccount(myaddress, 'password')
abi = json.load(open('mycontract.abi')) # [{"constant":true..."type":"event"}]
bytecode = open('mycontract.bin').read() # 60606040523...4406e0029
contract = rpcc.eth.contract(address=myaddress, abi=abi, bytecode=bytecode)
contract.deploy()

And I always get this error

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

Even thought it was just slow, but I gave it 600s (10 minutes) timeout and still got the same error...

I searched all over the internet and got nothing useful

Any ideas?


texts: How many parallel read/write request single contract can handle each second

texts: I need this reply for a large user base prospective, where each second too many request going to that particular contract , so the question is what is write per second limit and what is read per second limit.


texts: How to execute contract methods without metamask confirmations?

texts:
I would like to know if there is a way to execute my contract methods without requiring the confirmation of metamask.

I found something web3.eth.sendSignedTransaction but can't seem to figure out how to use it and what to send in it.

New here! Any suggestions would be appreciated! Thanks


texts: Do services such as exchanges offer the participation in mining pools?

texts:
I am studying the structure of mining pools and their participants with on-chain data from GBQ. I noticed that several mining pools use proxy addresses (by combining and filtering for different figures) that forward the mined ether to the participating miners (EOAs).
However, some addresses, that are not proxy addresses according to my heuristic, seem to exhibit a similar behaviour: they send their Ether to many different EOAs and the value of Ether in each transaction is similar to that of proxy address transactions. Is there any other way how people can get money from mining pools without directly being related to that pool?
These are the addresses I was talking about (Some of them even receive Ether from two different Pools, so they cannot be proxy addresses specific to a mining pool):
0x3598ac8dffa22994f0b18087035647c7a09fc389,
0xe8c8e1291ed1949da844b38ff1860a6a4c96e459, 0x57efa1377ef6c0363327ee6cffe46926e5fb682b,
0x1670f6ceaea120fe4e72c9edba3883ae7941401c,
0x7f01921af6dbcf81086c5cf88aa7c93f665278


texts: Can I call a library function from a payable function?

texts:
I seem to get a revert each time I try this. I'm unable to get any useful revert message from truffle, so any assistance there might also help solve this.

I have a library:

library LibInterface {
  ...
  mine(address who){
     ...
  }
  ...
}

which I call

contract MyContract {
  ...
  function mine(address who) public payable{
    s.mine(who);
  }
  ...
}

Removing the payable flag or simply not sending funds via truffle test will stop the revert. Removing the library call or simple calling another non-library contract also succeeds.

Any ideas? Is this disallowed? Why?


texts: mishandled exception: can't understand research paper content

texts:
What is the meaning of following paragraph in the context of ISZERO & mishandled exception.
I found an article at:
enter link description here
It says that:

  Detecting a mishandled exception is straightforward. Recall that if a
  callee yields an exception, it pushes 0 to the caller’s operand stack.
  Thus we only need to check if the contract executes the ISZERO
  instruction (which checks if the top value of the stack is 0) after
  every call. If it does not, any exception occurred in the callee is
  ignored. Thus, we flags such contract as a contract that mishandles
  exceptions.

I have broken down it into small sentences and specified what I understood from it. Text uses pronouns which is making it difficult for me to understand it.

  "1. Detecting a mishandled exception is straightforward. Recall that
  if a callee yields an exception, it pushes 0 to the caller's operand
  stack.”

Means that if callee is not handling exception, it pushes 0 onto the caller’s operand stack. But can the callee access caller’s stack if they are in different contracts? Also is this not a security violation?

  “2. Thus we only need to check if the contract executes the ISZERO
  instruction (which checks if the top value of the stack is 0) after
  every call.”

Which contract? caller or callee?

  “3. If it does not, any exception occurred in the callee is ignored.”

I think it depends upon the transfer mechanism ‘call’, ‘send’ or ‘transfer’. If the caller is using ‘transfer’, then the exception if it occurs in the callee’s contract would be propagated to the caller’s contract. Caller can’t ignore it. I am not able to understand it clearly.

  "Thus, we flag such contract as a contract that mishandles
  exceptions."

Some body please guide me

Zulfi.


texts: How do I add an icon to this token code?

texts:
I’ve taken an interest in Ethereum and it’s smart contracts and in my free time I’ve been experimenting around a bit, however I’m very new to it so keep that in mind as you answer this question.

So I found a code for a token creation on the internet and I’ve been picking around at it. I was able to create customized token on the testnet, but I haven't figured out how to give it an icon like a lot of other real tokens have. I have a link to the code below, what steps would I need to take to give it an icon?

https://docs.google.com/document/d/1VZH9dFTxR1igbouyPcUSZWH8QETp8eZozbNmm74mBLY/edit?usp=sharing


texts: CMake Error: Error processing file: cmake\scripts\install_deps.cmake WINDOWS

texts:
I am trying to set up my ethereum c++ client on Windows.

I already ran this command line

git clone --recursive https://github.com/ethereum/cpp-ethereum.git
which successfully worked.
Now, in the second step, I opened my command prompt, and I went into the directory that contains the scripts folder in the cpp-ethereum directory, and typed install_deps.bat
where I found this error

CMake Error: Error processing file: cmake\scripts\install_deps.cmake

What am I doing wrong? I never used cmake before, so I have no clue..


texts:
I am following a tutorial (hosted by dappuniversity) on youtube regarding DApps using IPFS. I have done exactly everything as mentioned in the tutorial but i get this errors:

GET https://ipfs.io/ipfs/ 400 () ipfs.io/:1

App.js:87 Uncaught TypeError: Cannot read property 'set' of undefined
    at App.js:87
    at f (once.js:25)
    at ConcatStream (add.js:42)
    at ConcatStream.<anonymous> (index.js:37)
    at ConcatStream.EventEmitter.emit (events.js:96)
    at finishMaybe (_stream_writable.js:630)
    at endWritable (_stream_writable.js:638)
    at ConcatStream.Writable.end (_stream_writable.js:594)
    at Duplex.onend (_stream_readable.js:577)
    at Duplex.g (events.js:165)

I use MetaMask and it is linked to Ganache.

I installed IPFS  and compiled and migrated the contracted using.

npm install ipfs --save
npm install --save ipfs-api
truffle compile
truffle migrate --reset

Here is the smart contract

pragma solidity 0.4.24;

contract SimpleStorage {
  string ipfsHash;

  function set(string x) public {
    ipfsHash = x;
  }

  function get() public view returns (string) {
    return ipfsHash;
  }
}

Main code on github App.js


texts: get accounts's transactions details in solidity

texts:
I want get transactions of a account and get the details of it(such as time and etc.) in solidity.
How can i do this? Is there any way?


texts: Contract creating other contract doesn't show resulting transaction details on etherescan

texts:
Looking for help with a successful transaction not showing the details on etherescan.

Having a deployed factory contract like so (simplified):

contract EntityFactory  {

    event EntityCreated(address entity);

    function createEntity (string _hash) public returns (Entity entity) {
        Entity ent = new Entity(_hash);

        EntityCreated(ent);
        return ent;
    }
}

contract Entity {
    string private hash;

    function Entity (string _hash) public {
        hash = _hash;
    }

    function getHash() public returns(string) {
        return hash;
    }
}

I called EntityFactory.createEntity(...) successfully and the transaction got mined etc

On etherscan I see the transaction of calling EntityFactory.createEntity(...) as well as the emitted events. In the linked event log it is the second event. The first piece of data of the event is the address for the created Entity.

However, the address of Entity can't be found on etherscan. When I take the same address and use truffle console to call Entity.at('<address>') the correct data is found and I can interact with the Entity at that address.

My understanding is that the EntityFactory would have created a new contract by calling new and that Contract should also be visible on etherscan.

Where am I thinking wrong about this?

Is there a way to see the resulting contract that came from the call to EntityFactory.createEntity(...) somewhere on etherescan?


texts: Importing accounts into geth from metamask

texts:
I Have entered into my geth console

geth

eth.accounts
["0xf844f0d7acb0d01bf66ffd81809fb96b2236abce", "0xc8d94cb87173fc94c4b165e44a5fc0b047618044", "0x6a0ef1a429c3570cb342963d309dd5aaa9e49cd4", "0x21c4910f85842cd6dc2ecb50fc2612b2b0c9e703"]

But i coudn't see my metamask account which  metamask gave me first

0xC2a7b0DD8e7728C77712EB196fDcF375C3632fA8

Address of the metamask given account

I tried to request ether by fosset for test it gave me  3 ether but I can't see it in my console

 eth.getBalance(eth.accounts[0])

MY metamask test network is having 3 ether so I tried to check the balance in terminal still it gave me 0

> eth.getBalance('0xC2a7b0DD8e7728C77712EB196fDcF375C3632fA8')
0

1)How to import the metamask account into geth so we can interact with  geth  console

2) Why balance is showing me zero when typing the command even if the balance is present


texts: When would it make sense to use node server for an application using smart contracts?

texts:
I am wondering if there are example cases where it would make sense to use a typical Node.js client-server app where the blockchain node would be running on the server. At first glance, this would bring back the problems of centralisation related to trusting the server if it's the server itself running the node. However, I was wondering if there are real cases where this would be appropriate (there are questions here of people which seem to be doing this - this, this for example).

For further clarification: I read this post which claims the tools needed for Dapp development are not yet gathered. As such, I was wondering thinking of alternatives which could still leverage the blockchain's features of reliability etc but running in a client-server framework.


texts:
I have wrote a smartcontract which will be called by a mobile device.
This device will be outside. It embbed a software wallet (private key). But this wallet will own 0 ether because the device can be stolen.
So the device won’t be able to spend any gas.
What i want to do is to put some ether on the smartcontract address.
I want to know if it is possible to do this: when the mobile device calls a smartcontract function : the gas should be payed by the contract himself.
Of course i will add a logic which will only allow my device to call the function.
Thanks


texts: Do ethereum contracts stay active if it has to wait for a condition to happen? How is the TIME element factored into smart contracts?

texts:
I haven't written any contract yet, but would like to know if this is something that can be done. Lets say I write a smart contract to pay someone if his ethereum address goes below a certain amount say less than 1 ether.

I understand the smart contract can detect the amount of funds it has in the account, but the question is does the contract have to continually run/check the addresses balance?

What if I tell the contract to check the balance every 1 day for 365 days? That's 365 gas fee right? And if I pay this fee, doesnt this mean the contract is always on for an entire year? What if I didn't want to check an ether address, but a bitcoin address?

I'm just curious to how ethereum deals with TIME based contracts that requires a condition to be met in the future. I don't understand how this can scale if there are 1000 contracts waiting for a condition to happen. Someone please explain.


texts:
According to solidity.readthedocs.io (Link) here is the definition of Self-destruct:

  "Definition: The only way to remove code from the blockchain is
  when a contract at that address performs the Selfdestruct operation.
  The remaining Ether stored at that address is sent to a designated
  target and then the storage and code is removed from the state."

While this definition sounds allowing possibility of erasure feature (that is one of the main challenges of incompatibility of GDPR (General Data Protection Regulation) with the blockchain. (Link to Right to erasure in GDPR)); however after definition of Self-destruct , there are following Note and Warning:

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

  "Warning: Even if a contract is removed by Selfdestruct, it is
  still part of the history of the blockchain and probably retained by
  most Ethereum nodes. So using Selfdestruct is not the same as
  deleting data from a hard disk."

What does exactly Self-destruct give us and how can it help us ?


texts: Calling smart contracts with value using web3js and galanche

texts:
I'm fairly new to Ethereum smart contracts, so this might be a stupid question, but I need someone to help me out. I've set up Galanche on my machine (MacOS 11) and written a very simple currency smart contract (I don't intend to use it as an actual currency, I just want to learn about smart contracts) using truffle.
I've compiled the contract and deployed it to my Galanche blockchain successfully.
Now, I want to interact with it using web3.js. I have set up a nodejs project and installed web3. As a first test, I ran the following script:
const Web3 = require("web3");
const fs = require("fs");

const web3 = new Web3("http://192.168.178.49:7545");
const abi = JSON.parse(
  fs.readFileSync("path/to/compiled/MyCoin.json").toString()
).abi;

const MyCoin = new web3.eth.Contract(
  abi,
  // My contract's address
  "0x3265aA0A2c3ac15D0eDd67BC0fa62A446c112F98"
);

(async () => {
  console.log("Starting!");
  var coinCount = await MyCoin.methods
    .getTotalCoins()
    .call({ from: "0x2d0616BF48214513f70236D59000F1b4f395a2Fd" });
  console.log("Current registered MyCoin tokens:", coinCount);
})();

The address 0x2d0616BF48214513f70236D59000F1b4f395a2Fd is the first address displayed to me in  Galanche
It works as expected and returns the default amount of coins.
Now, I want to run a method called buyMyCoin which requires a payment. I tried running:
...

MyCoin
  .methods
  .buyMyCoin
  .send(
    {
      from: '0x2d0616BF48214513f70236D59000F1b4f395a2Fd',
      value: some_amount_of_wei
    }
  );

...

I'd expect that when I run this node.js script again, the first part would tell me that there are <n> total coins, but it doesn't. It just returns the same value as the last time.
Am I doing something wrong with web3.js or is this an issue with my contract?
BTW: I didn't see any funds leave the address 0x2d0616BF48214513f70236D59000F1b4f395a2Fd in Galanche, so I'm pretty sure it's not my contract...
I expect that somewhere I'd have to sign into this address using its public key, but I can't find anything about that in the web3.js docs that isn't very ambiguous...


texts: How do I update data for project using blockchain (Ethereum)?

texts:
I am very new to creating blockchain dapps, so some guidance would be appreciated. I am conceptualizing how to approach creating a private blockchain so that users can communicate about the status of a project that they are working on using Ethereum. For example, say there is a shared text file (this does not have to be a large .txt file) that has some instructions for a project (it could be any project) that each user is given access to as a team. Given this shared resource with instructions, users can make changes where needed, and then when they are finished, the timestamp and hashed identity of the user is recorded to show that their side of the project is completed. Everyone in the private blockchain would see this. My questions are as follows:

(1) How could Ethereum be used to approach this?

(2) I am used to writing code in Java, but I also code in C++ and JavaScript. Could Java be used to write smart contracts for something like this, or would another programming language be better?

(3) How could I eventually develop a frontend application that could be used by each user to track the status of each person's contribution? Since web servers are centralized, would I need to use something like IPFS? I do not understand how to create a user interface or if Ethereum provides this sort of thing.

I know that these are general questions, but I am just needing to be pointed in the right direction with some of these ideas and/or directed to some similar GitHub projects that are not overly difficult to use. Again, advice would be appreciated.


texts:
I am writing my own smart contract in Solidity and trying to test in Remix. The main Remix site appears to be down (https://remix.ethereum.org/). I found another site: https://ethereum.github.io/browser-solidity/#optimize=false&version=soljson-v0.4.24+commit.e67f0147.js and am trying to test there. I cannot even test example code from the documentation, leave alone my own contract. I don't see a place to call the methods from the example code. Here is the example code:

pragma solidity ^0.4.24;

contract Coin {
    // The keyword "public" makes those variables
    // readable from outside.
    address public minter;
    mapping (address => uint) public balances;

    // Events allow light clients to react on
    // changes efficiently.
    event Sent(address from, address to, uint amount);

    // This is the constructor whose code is
    // run only when the contract is created.
    constructor() public {
        minter = msg.sender;
    }

    function mint(address receiver, uint amount) public {
        if (msg.sender != minter) return;
        balances[receiver] += amount;
    }

    function send(address receiver, uint amount) public {
        if (balances[msg.sender] < amount) return;
        balances[msg.sender] -= amount;
        balances[receiver] += amount;
        emit Sent(msg.sender, receiver, amount);
    }
}

Can someone help me with testing this out? My main concern is being able to test my code. Once I can verify the example code works, I can test my own contract. Thank you very much in advance.


texts: ethereum wallet running a private net 0 peers 0 waiting for blocks

texts:
am using geth

VRSION:
   1.8.20-stable-24d727b6

and ethereum wallet Ethereum-Wallet-linux64-0-9-3 and i am using Ubuntu 18.04.1 LTS in the geth console i started the miner but either is not incrementing it stays at 0 and also on the wallet it shows 0 peers and 0 waiting for blocks  i stared to start and stop the minor several times with
miner.start(1); and miner.stop()
on the geth console it only says

INFO [12-14|18:34:31.542] Transaction pool price threshold updated price=1000000000
INFO [12-14|18:34:31.543] Commit new mining work                   number=1 sealhash=9091da…9b902a uncles=0 txs=0 gas=0 fees=0 elapsed=468.863µs

here is my genesis file

{
"config":{
        "chainId": 45,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0,
        "byzantiumBlock": 12
    },
"nonce": "0x0000000000000042",
"timestamp": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x",
"gasLimit": "0x8000000",
"difficulty": "0x200",
"config": {},
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x3333333333333333333333333333333333333333", "alloc": {}
}

the expected behavior is there should be either in  my main account continuously incrementing and numbers of blocks as well


texts:
pragma solidity 0.5.9;
contract Testing{

function participate()public  payable{
        uint winner = 9;
        require(msg.value == 0.1 ether);

        if ( winner==9)
        {

           require(msg.sender.call.value(this.balance)());

        }
    }
}

I am getting the following error message:

    solc testing8_2.sol testing8_2.sol:13:42: Error: Member "balance" not found or not visible after argument-dependent lookup in contract
    Testing. Use "address(this).balance" to access this address member.
               require(msg.sender.call.value(this.balance)());

But if I try:

if ( winner==9)
        {

           require(msg.sender.call.value(address(this).balance)());

        }

I get the following error message:

    solc testing8_2.sol testing8_2.sol:13:20: Error: Wrong argument count for function call: 0 arguments given but expected 1. This function
    requires a single bytes argument. Use "" as argument to provide empty
    calldata.
               require(msg.sender.call.value(address(this).balance)());
                       ^--------------------------------------------^ testing8_2.sol:13:12: Error: No matching declaration found after
    argument-dependent lookup.
               require(msg.sender.call.value(address(this).balance)());
               ^-----^

Somebody please guide me how to solve this problem:

Zulfi.


texts: Message Signing using MyCrypto and MyEtherWallet

texts: I am trying to update my Token information and it is asking me to sign the message using either MyCrypto and MyEther Wallet and proceed. Unfortunately tried both and both of them are not creating signatures. Can any one help or is there anyway I can write my own code to generate the signature?


texts: What would be optimal number of block confirmation for Ethereum PoA network?

texts:
There are answers related to the number of confirmations is considered secure in Ethereum.

@Waqar Lim

  To sum up, it always depends on your application and the attached
  value to consider which number of confirmations is considered to be
  secure.

How is it considered for Ethereum PoA network? Do we need to wait for 6 blocks confirmations considered to be secure for Ethereum PoA network?

Is there any possibility to have a fork?


texts: Cannot connect to ganache-cli with web3 and nodejs

texts:
from package.json:

"ganache-cli": "^6.3.0",
"web3": "^1.0.0-beta.41",

in my createContract.js

const Web3 = require("web3");
const ganache = require("ganache-cli");
console.log('ganache.provider :', JSON.stringify(ganache));
let web3 = new Web3(new Web3.providers.HttpProvider(ganache.provider()));

the result of the console log:

ganache.provider : {"_webpacked":true,"version":"2.4.0","to":{}}

my error:

.../node_modules/web3-providers/dist/web3-providers.cjs.js:99
    if (host.substring(0, 5) === 'https') {
             ^
TypeError: host.substring is not a function

any advice on this error ?


texts:
My contract deployed on address

 0x63788a3eace0d77c5573787e3f9c9515c246d0e6

Is not getting executed via Mist browser.

I have tried execute NewPoll function that requires 4 fields

text 32 bytes I passed 4d6172656b205369702020132046534520726573756c7473
options bytes32[] - passed [0x506173736564,0x4661696c6564]
voters bytes32[] - passed empty arraz []
deadline uint - passed 1464739199

However I cannot see any changes to the public object p in Mist browser

Contract code available at: https://github.com/mareksip/PureVote/blob/master/purevote.sol

Thank you for any prior assist.


texts: Unable to deposit ether from External Account to Contract

texts:
This is my first question on StackOverflow.

I am having trouble sending Ether from an account to the contract. The DApp I am creating is separated into a Data & App contract, where the Data contract is supposed to function as a database.

 pragma solidity ^0.5.8;

 import "./FlightSuretyData.sol";
 import "../node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol";

address private contractOwner;          // Account used to deploy contract

uint constant AIRLINE_REGISTRATION_FEE = 10 ether;

address payable public dataAddress;
FlightSuretyData data;

/**
* @dev Contract constructor
*
*/
constructor (address payable _data, address payable _firstAirline) payable public
{
    contractOwner = msg.sender;
    dataAddress = _data;
    data = FlightSuretyData(_data);

    data.registerAirline("Default", _firstAirline);

}

************************* PROBLEM AREA **********************************
*************************************************************************

/**
* @dev Deposit money to the smart contract
*
*/
function deposit(uint amount) public payable {
   require(msg.value == amount, "Amount not the same!");
   // nothing else to do!

 }

function fund() public payable {

  // make sure enough ether
  require (msg.value >= AIRLINE_REGISTRATION_FEE, "Not enough ether to deposit");

  // transfer money from caller of function to THIS contract
  // PROBLEM
  deposit(msg.value);

  // transfer money from THIS contract to DATA contract
  require(address(this).balance >= AIRLINE_REGISTRATION_FEE, "do not have enough to pay");

  dataAddress.transfer(msg.value);

  require(dataAddress.balance >= AIRLINE_REGISTRATION_FEE, "data contract did not get ether");

  data.fund();
}

  *************************************************************************

I have intentionally given minimal code so that the reader doesn't get sucked into the project details. Also after much debugging, I have figured out the problem is with the deposit function. It simply doesn't deposit (I checked this with the require statement right after).

Indeed, when I run the test below, I get Error: Returned error: VM Exception while processing transaction: revert :

    await config.flightSuretyApp.fund({from: accounts[3], value:
    web3.utils.toWei("10", "ether")});

Let me know if more code is needed!

function() external payable { fund(); }

flightSuretyData.fund() is: function fund () public { require (airlineDB[tx.origin].isRegistered, "Can only fund registered airlines"); airlineDB[msg.sender].isFunded = true; isAirline[msg.sender] = true; }


texts: How to create a multisg account on Geth server?

texts:
As you know, multisig wallets are more secure approach in financial cryptocurrency businesses. In my researches, I found out how can I create a multisig wallet in Bitcoin blockchain using this link. Now, I wonder to know how can I create such mechanism in a Geth server?
I've checked many web pages but couldn't find any appropriate article in this regard.


texts:
I am looking for a way to get substring of a String. I am looking for an equivalent of this Java method. I am ok to use libraries but did not find it in solidity-stringutils.

public String substring(int startIndex, int endIndex)


texts: Is there any specific configuration needed for Oraclize ethereum-bridge to support oraclize_newRandomDSQuery()?

texts:
I am using ganache-cli and ethereum-bridge in order to test oraclize locally. Other calls to oraclize, such as oraclize_query("URL","..."),
work just fine. I am only having trouble with oraclize_newRandomDSQuery().

So is there anything specific that needs to be done to use the oraclize_newRandomDSQuery()?

Thanks


texts: Get the list of pending transactions with Web3 for the given address/wallet

texts:
I'm trying to get information whether there are pending transactions for the given address. My code is as follows:

web3.eth.getTransactionCount(‘ADDRESS’, ‘pending’, function(error, result){
  if(!error)
      console.log(JSON.stringify(result));
  else
      console.error(error);
})

This works, however it returns the count of ALL of the transactions I see in Metamask, not just the ones in "pending" state.

Any clues how can I get only the pending ones?

Thanks!


texts: Can miners choose not to verify transactions in blocks broadcast by other nodes?

texts:
When we execute a function on a smart contract, the transaction will be verified by all miners in the entire network before being written to the blockchain. I want to know no matter how complicated the smart contract function called by this transaction is or the function needs to pay some fees, do miners have to execute this function for verification?
For example, the function on this smart contract needs to pay token to call the payment interface on chainlink.


texts: Trouble connecting to web3 1.0 through web browser using Infura.io

texts:
I am trying to connect to web3 1.0 through a web browser, I dont see much documentation for 1.0 though. This script says im connected but I think its the previous version as anytime I try and run a 1.0 function I get the function is undefined -

<script src="https://cdn.jsdelivr.net/gh/ethereum/web3.js@1.0.0-beta.34/dist/web3.min.js"></script>

<script>

function initweb3 () {
web3 = new Web3(new Web3.providers.HttpProvider("https://mainnet.infura.io/v3/My Api Key"));
}

window.addEventListener('load',initweb3);

if(web3.isConnected()) {
    alert("Web3 Connected!");
} else {
    alert("Web3 Not Conected");
}

var abi = JSON.parse('[{"MY ABI"}]')

var AK = new web3.eth.contract(abi);

// Set Contract Address
AK.options.address = "Contract Address";

AK.methods.balanceOf("Address to get balance of").call().then(function(balance) {
alert("Balance is " + balance.toString()) });

This Throws

 Uncaught TypeError: Cannot set property 'address' of undefined

It works fine when I run locally so I think its not connecting to version 1.0


texts: Gas cost call vs send for pure/view functions

texts:
I'm aware of the fact that pure/view functions cost no gas with a simple "call".
But what happens if i have a function that changes the contract state based on the pure/view function result. Do i have to pay gas for the pure/view functions looping if i do a "send"?

In my example I want to find a number in an array and return the index.

function indexOfUint(uint256[] _array, uint _value) public pure returns (uint256) {
    bool exist;
    for (uint i=0; i<_array.length;i++){
        if(_array[i] == _value){
            exist = true;
            return i;
        }
    }
    assert(exist == true);
}


texts: I am trying to set up a private blockchain for the first time with a Geth client.  After initializing my custom genesis json file, running the networkid in the console and setting up a couple of accounts to start off with I then attempt to begin mining via the miner.start() command to get a few ether to test in the private chain.  It looks like it's about to begin mining but then I get kicked out of the console and my screen looks like the attached screen shot.  I've tried multiple times and in different directories with no luck.  Can anyone explain why I am experiencing this issue?  Thanks.


texts: Extract all transactions for a specific token for Ethereum

texts:
I would like to extract all transactions for the DNT token using the ether scan API. Is there a way to do this without providing the address for the token API?
https://etherscan.io/token/0x0abdace70d3790235af448c88547603b945604ea


texts:
I'm an ethereum newbie and have installed ethereum on mac using commands :

brew tap ethereum/ethereum
brew install ethereum

referenced from https://ethereum.gitbooks.io/frontier-guide/content/installing_mac.html

Reading https://ethereum.gitbooks.io/frontier-guide/content/connecting.html

Where are the commands run from ?  For example the command > net.listening is executed from a cli ?


texts: Ethereum usage for financial transaction

texts:
I am new to ethereum blockchain, and i have following scenario of simple money exchange to be implemented:

Consider three account Sender(USD), Receiver(EURO) and Provider. Where provider is account from which the smart contract will be deployed.
We need to transfer fund from Sender account to Receiver account using the smart contract deployed taking into account the exchange rates.
For showcasing the same a simple UI for manipulating EXCHNG rates, for sending the amount from one to other and for displaying the balance of both the accounts will be created.

For doing this i used Mist wallet, whereas the smart contract cannot do a transaction which involves transfer of ether from one account to another.

What should be the approach if this has to be achieved using smart contracts?
Is there any other way the same can be achieved?
Anything will be helpful.


texts: How to get address balance after particular block was issued

texts:
How to get address balance if you know the block number?
In solidity you can call address.balance, but without specifying particular block.
Is there a way to do this in solidity or only py/js?


texts:
So I recently mistyped an ether payment address 0x6bEE6FCB3213146Aa38928B91eebEC6527B716E2
 as 0x6cEE6FCB3213146Aa38928B91eebEC6527B716E2
so I by mistake typed c instead of b.  My eyesight is bad and I struggle with this more and more recently. The transaction seems to have gone through (several confirmations) . I am guessing I have lost my money? I thought there was a checksum for detecting simple typos in the quoted addresses? Given that I can get the private key for the right address, would this allow me to more easily crack the private key for the wrong address that probably nobody has the private key for in any case?


texts: I was unable to find any relevant documentation for the now keyword within the Solidity documentation, other than its usage in examples. What exactly does the now keyword return, how is it determined and what are the associated gas costs? I assume it is similar to Unix time.


texts: Synchronizing test and web3 enabled nodejs service

texts:
I have a test suite running in truffle, and an external web3 connected node service running - both connected to a ganache-cli network.
My problem is: my tests are supposed to pick up an event triggered by the external service, BUT, the service only calls the blockchain (generating the event that tests are watching for) AFTER the tests complete.
(Notes: I obviously am looking for a solution altering the test not the service.
Please disregard the specific timing of the tests/events, I know the OZ test helper package I'm using does things under to the hood to advance blocks and time which I can drill down on to pass the test once I can grok the following)
only looking to solve: tests run, tests complete, service calls/transacts, service completes; want: tests run, service calls/transacts, service completes, tests complete)
Here is code for the service:
var currentBlock = 0;
web3.eth.getBlockNumber()
    .then((number)=>{
        currentBlock = number;
        console.log(currentBlock);
    });

setInterval(function(){
    web3.eth.getBlock('latest',async (err,block)=>{
        if(err){
            return;
        }
        if(currentBlock <= block.number){
            console.log(`New block received, Number: ${block.number}`);

            // Get scheduleCallEvent events and save
            var events = await aionContract.getPastEvents('ScheduleCallEvent', {fromBlock: currentBlock-reqConfirmations, toBlock: block.number-reqConfirmations})

            for(var i = 0; i < events.length; i++){
                console.log('Registering new request to the database...');
                await saveRequestedTxs(events[i],web3);
            }

            var events = await aionContract.getPastEvents('ExecutedCallEvent', {fromBlock: currentBlock-reqConfirmations,toBlock: block.number-reqConfirmations})
            for(var i = 0; i < events.length; i++){
                console.log('Registering successfully executed Tx...');
                await saveExecutedTxs(events[i],web3);
            }

            //Execute pending transactions if any, Block and time based schedules
            await executeRequestedTxs(block.number,false,web3,account,aionContract);
            await executeRequestedTxs(block.timestamp,true,web3,account,aionContract);

            // Save last processed block
            currentBlock = block.number+1;
        }
    })
},4000);

And the test:
  it('Aion contract calls returnBondsOnTimeOut()', async function() {

    await time.increase((await this.Escrow.suggestionDuration()).add(new BN ("1")));

    const executedCallEvents = await aionContract.getPastEvents("ExecutedCallEvent",
        {fromBlock: "latest", toBlock:"pending"})

    await expectEvent.inLogs(executedCallEvents, 'ExecutedCallEvent', {})
  })


texts:
I have my contract object and this has attributes like

contract.balanceOf
contract.myDividends
contract.totalSupply
contract.myTokens

I get an error this._eth.call is not a function when i try to call them like this

  contract.balanceOf(accounts, function ( error) {
        $('#account-balance').html = balance;
     });

contract.buy
contract.sell
contract.withdraw
contract.reinvest

For above calls i get this error

inpage.js:1 Uncaught Error: Invalid number of arguments to Solidity function
    at Object.InvalidNumberOfSolidityArgs (inpage.js:1)
    at u.validateArgs (inpage.js:1)
    at u.toPayload (inpage.js:1)
    at u.sendTransaction (inpage.js:1)
    at u.execute (inpage.js:1)

Please have a look at my code ond tell me what i do wrong
https://pastebin.com/wAsCeNTG


texts: Can an external account create a contract which can do anything the external account tells it to do?

texts:
Can an external account create a contract which can do anything the external account tells it to do, including calling arbitrary contracts and sending ether?

That is, the contract does not define specific methods, but can do anything an external account can do, so maybe it has one generic method, which only the owner address can use, which receives as arguments what the owner wants the contract to do (calling another contract, sending ether, etc).

Is it possible to implement a contract like this in Solidity?


texts: Copy chaindata from one device to another?

texts:
After trying to sync the ether wallet with my laptop without success (it took too long and I finally switched off the computer) I started the syncing process from a Raspberry Pi 3 through Geth.

The RPi is being syncing for three days now, chaindata is over 4.2 GB (I don't know how much is still left, is there someway to know?) and I wonder: can I copy that chaindata to my Windows laptop to use it also there with Mist or another wallet app?


texts: Is it possible to derive multiple public addresses for a smart contract to receive ERC-20 tokens?

texts:
I have a smart contract that deposits user's fund in the AAVE lending pool on behalf of users:
lendingPool.deposit(stableCoinAddress, amount, address(this), 0)
Users can deposit at different times with any arbitrary amount, since aTokens are transferring to the contract address, there is no way to calculate the total share of each user at any given time (and I don't tend to transfer them to users wallet). I need to know is there any way to derive a unique address for each user to transfer his aTokens into, but only the smart contract can withdraw from it?
address userSpecificAddress = deriveUniqueAddressForCurrentSmartContract(_msgSender());
lendingPool.deposit(stableCoinAddress, amount, userSpecificAddress, 0);
...
lendingPool.withdraw(stableCoinAddress, amount, withdrawer);


texts:
In a network of IoT devices like internet-connected Raspberry Pis which sends transactions to the Ethereum blockchain, the Pis need to be able to access their own Ethereum private keys in order to submit the transaction and pay the transaction gas.

Considering that these devices may be deployed out in the field, how do you avoid losing ETH when someone accesses the device and retrieves the private key?

Even if the private key is password protected, this password will need to be stored in plaintext for a program to sign an Ethereum transaction, so if the attacker reads through the code he will be able to find the password protecting the private key.

Is there a better way that storing the private key on these devices deployed in in the field?


texts:
I installed truffle globally. I'm trying to connect truffle to a localhost

truffle console
> migrate

It failed with Unknown network "development". See your Truffle configuration file for available networks..

truffle.js and truffle-config.js ( why there are two files  ? )

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


texts: Account Storage for non-Contract Accounts

texts: Is it possible to modify the account storage trie for non-contract accounts?  For example, if I want to prove that I have control of an account without having to send any ETH, could I generate a transaction that would put a given value in a given key of my account storage trie?  If so, how would you do this in the Geth console and show that it's done afterwards?


texts: What specifically is the "autonomous" component in the Paper Plasma: Scalable Autonomous Smart Contracts

texts:
The term "Autonomous" brings to mind Autonomous Driving / Driveless Car where cars drive on their own.

I read the paper Plasma: Scalable Autonomous Smart Contracts. I understood the Scalable part. However, the Autonomous part was a bit harder to understand. In total, autonomous was mentioned 8 times in the paper.

Question: What specifically does the term "autonomous" in the Paper Plasma: Scalable Autonomous Smart Contracts refer to?

Isn't smart contracts by its very nature autonomous? i.e., contracts which are self-enforcing (self-driving).

Would prefixing the term autonomous to Smart Contracts be unnecessary since Smart Contract by its very nature and design is autonomous? If autonomous is not an unnecessary prefix, in the context of the paper, what specifically then does the term autonomous refer to?

Thanks!


texts: Account is locked, after running Truffle migrate command

texts:
I am new to this technology and I am trying to Deploy the contract to Ropsten test network. I have my geth running in one terminal. In my truffle console I have an account with some ether. I unlock it, then straight after in another terminal I go to my project directory to run truffle compile, then truffle migrate.

I get this error:

Running migration: 1_initial_migration.js
  Deploying Migrations...
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: account is locked
    at Object.module.exports.InvalidResponse (/usr/local/lib/node_modules/truffle/node_modules/ether-pudding/node_modules/web3/lib/web3/errors.js:35:16)
    at /usr/local/lib/node_modules/truffle/node_modules/ether-pudding/node_modules/web3/lib/web3/requestmanager.js:86:36
    at null.request.onreadystatechange (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:114:13)
    at null.dispatchEvent (/usr/local/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:25)
    at setState (/usr/local/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:610:14)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:447:13)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:905:12)
    at doNTCallback2 (node.js:450:9)
    at process._tickDomainCallback (node.js:405:17)

I have changed my gas to different amounts but rolled it back, since that seems to not be the problem as I have enough ether.

I also googled the problem and it suggested I get the latest geth, I believe i do.

Can someone please help? I am totally new to this and completely lost and don't know what else to do. Perhaps I should use embark.

I appreciate any advice :) thank you beforehand


texts:
I copied the GNT, ZIL, GTO token code from mainnet and deployed each token to rinkeby.

GNT token contract : 0x861783a4B946026e3180FCA173261d937aa2fabF
ZIL token contract : 0x1dD42376F6902F812E03C3861Da3c8654462c267
GTO token contract : 0x8970fd3E01504D5b83d48faFbad92547AE9B6630

TestContract1 and TestContract2 and TestContract3 were distributed using Remix as shown below.

After depositing a token in each contract, I called the transfer() function

But,

TestContract1 : transaction success
TestContract2 : transaction fail
TestContract3 : transaction fail

TestContract2 and TestContract3 had an error (Gas estimation failed) in Remix, but it did send transaction.

I'm so frustrated because I can not figure out the cause of the failure, so I want to get expert advice.

pragma solidity ^0.4.21;

contract Token {
    function transfer(address _to, uint _value) public returns (bool success);
}

contract TestContract1 {

    function transfer(address _to, uint _amount) public returns (bool success) {
    // GNT token contract
        address tokenContract = 0x861783a4B946026e3180FCA173261d937aa2fabF;

        Token _tokenSomething = Token(tokenContract);

        _tokenSomething.transfer(_to, _amount);

        return true;
    }
}

contract TestContract2 {

    function transfer(address _to, uint _amount) public returns (bool success) {
    // ZIL token contract
        address tokenContract = 0x1dD42376F6902F812E03C3861Da3c8654462c267

        Token _tokenSomething = Token(tokenContract);

        _tokenSomething.transfer(_to, _amount);

        return true;
    }
}

contract TestContract3 {

    function transfer(address _to, uint _amount) public returns (bool success) {
    // GTO token contract
        address tokenContract = 0x8970fd3E01504D5b83d48faFbad92547AE9B6630

        Token _tokenSomething = Token(tokenContract);

        _tokenSomething.transfer(_to, _amount);

        return true;
    }
}

TestContract1 transaction result :
https://rinkeby.etherscan.io/tx/0xdef60351224e0b3ca298888878aefc975787a67cfea3d5428f94ba74759205df

TestContract2 transaction result :
https://rinkeby.etherscan.io/tx/0x9975ab7bb92447e865e0e34bbc670e3f2a34e8d31c40ecdac35185408abe2bd0


texts:
I am trying to create a contract for crowdsale using OpenZeppelin lib.
I have imported everything necessary to the contract and initialized everything properly, but when I am trying to deposit funds in the contract the transaction is unsuccessful.

I've traced the error back to the _forwordFunds() method, but now I am lost any help will be appreciated.

Following is my contract:

contract Crowdsale is RefundableCrowdsale, CappedCrowdsale, PostDeliveryCrowdsale, AllowanceCrowdsale, StagedCrowsale {
    constructor(
        uint256 rate, address wallet, IERC20 token,
        uint256 openingTime, uint256 closingTime,
        uint cap,
        uint256 goal,
        address tokenWallet)
        Crowdsale(rate, wallet, token)
        TimedCrowdsale(openingTime, closingTime)
        CappedCrowdsale(cap)
        RefundableCrowdsale(goal)
        AllowanceCrowdsale(tokenWallet)
        StagedCrowsale()
    public {}

    //Error: buyTokens() --> _forwardFunds
    function() external payable {
        buyTokens(msg.sender);
    }
}

.

contract RefundableCrowdsale is FinalizableCrowdsale {
        ⋮
    RefundEscrow private _escrow;
        ⋮
    constructor(uint256 goal) public {
        require(goal > 0, "Goal should be greater than zero.");
        _escrow = new RefundEscrow(wallet());
        _goal = goal;
    }
        ⋮
    function _forwardFunds() internal {
        _escrow.deposit.value(msg.value)(msg.sender); //What is this?
    }
}

Edit1:
So I have traced the error back to the deposit function, following line is throwing the error.
_deposits[payee] = _deposits[payee]+(amount);

function deposit(address payee) public onlyPrimary payable {
  uint256 amount = msg.value;
  require(payee!=address(0),"Invalid address");
  require(amount > 0,"Invalid amount");
  _deposits[payee] = _deposits[payee]+(amount);//Error
  emit Deposited(payee, amount);
}

OpenZeppelin
RefundableCrowdsal
RefundEscrow


texts: How do the Ethers in Ethereum Wallet increase?

texts:
I have created a private test net and an account in Ethereum Wallet by referring this link: https://souptacular.gitbooks.io/ethereum-tutorials-and-tips-by-hudson/content/private-chain.html

I have ethers in the etherbase account as well. I have deployed one smart contract and everything seems to work fine. The only concern that I have is how the ethers in the base account keep on increasing on their own?


texts: Smart contract function throwing error in remix

texts:
I am writing a PreICO Smart contract. I got a code snippet which I am trying to understand. I am stuck in function buyXYZTokens function which is throwing error. Here is the code snippet:

Contract XYZ is StandardToken, Ownable{
string public name = "XYZ";
string public symbol = "X";
string public standard = "X v1.0";
uint256 public decimals = 18;

modifier inActivePeriod() {
    require((preSaleStart < now && now <= preSaleEnd));
    _;
}
 function XYZ( uint256 _initialsupply, address _escrow, uint _preSaleStart, uint _preSaleEnd) {
    require(_escrow != 0x0);
    require(_preSaleStart < _preSaleEnd);
    escrow = _escrow;
    totalSupply_=_initialsupply;
    balances[escrow] = _initialsupply;
}
    function() inActivePeriod payable{
    buyXYZTokens(msg.sender);
}
function buyXYZTokens(address _sender) inActivePeriod payable{
    require(_sender!=0x0);
    require(msg.value>=minTransactionAmount);
    uint256 weiCount = msg.value;
    amountRaised = amountRaised.add(weiCount);
    uint256 tokens = weiCount.mul(rate);
    tokens += getBonus(tokens);
    tokenReserve(_sender, tokens);
    forwardFunds();
}
  function getBonus(uint256 _tokens) constant returns (uint256 bonus) {
        require(_tokens != 0);

        if (preSaleStart <= now && now < preSaleStart + 1 days) {
              return _tokens.div(2);
        } else if (preSaleStart + 1 days <= now && now < preSaleStart + 2 days ) {
              return _tokens.div(4);
        } else if (preSaleStart + 2 days <= now && now < preSaleStart + 3 days ) {
              return _tokens.div(10);
        }

        return 0;
    }

    function tokenReserve(address _to, uint256 _value) internal returns (bool) {
        balances[_to] = balances[_to].add(_value);
        Transfer(msg.sender, _to, _value);
        return true;
    }
    function forwardFunds() internal {
        escrow.transfer(msg.value);
    }

I got this error:
I am not getting what this fallback function used for and why buyXYZTokens function throwing me error?


texts: Gas requirement of function postrecord on retrunstring is high, anyone know how to bring it down?

texts:
pragma solidity ^0.4.0;

contract insure {
  address public doctor;

  function Person() private {
    doctor = msg.sender;
  }
  modifier onlyDoctor {
    require(msg.sender == doctor);
    _;
  }
}

contract postRecord is insure {
  string records;
  string patientRecords;

  struct patient {
      address client;
      bool consent;
      bytes32 name;
   }

  event Post(address doctor, string patientRecords);

  function modify() private onlyDoctor {
      records = patientRecords;
  }

  modifier rightPerson {
      if (msg.sender != doctor){
        throw;
      }else{
        _;
      }
  }
  function returnString()public payable{
     Post(doctor, patientRecords);
  }
}


texts: finding an address in a sharded ethereum

texts:
In the future, Ethereum shall be a network of blockchains, all joined by a common root. This will allow for performance improvements in addition to the use of the proof of stake consensus.

Having a lot of shards is nice, but it makes finding the destination address for transactions somewhat tricky. Will there be a chain prefix in each address or a special address repository?

In short: how will the address system work in a sharded ethereum?


texts: Not able to connect to private Ethereum Network with metamask

texts:
I am running a private Ethereum Network in a cloud VM. I started the node with these arguments:

  geth --datadir test --networkid 123 --rpc --rpccorsdomain "*" --rpcport 30308
      --rpcaddr "0.0.0.0" --rpcapi
      "admin,debug,miner,personal,ssh,txpool,db,eth,net,web3" console

I've opened the port 30308 in the firewall too.
I am able to interact with the node through another vm, also with postman.
But I am not able to connect to the network with the metamask plugin that I've installed in my browser.
What could probably be the issue? I just get this error in every retries

  Oops! Something went wrong.

The address I provide in my metamask is like:

  http://my_cloud_ip:30308