texts: Ethereum blockchain node & block terminology

texts:
I was studying about the basic blockchain terminology and got confused the point of node & block. In some links, both seem similar whereas in some both explained differently. I don't exactly know about the node or block. Following are my concerns -

What is node & block? Both are different or can we use both terms interchangeably?
Can we able to create one node in blockchain? If so, then how we can proceed?
As per my assumption, Whenever a new transaction has created, it will spread all over the blockchain nodes. here what term should be used either node or block? (transaction spreading through block or node)
how does the nonce bit is defined? When I went through some links I found that it is defined after the mining has done. There are certain problems which are solved by miners and one block is generated. Is my assumption correct? If so, As per this case, If the new transaction has inserted in the block then the nonce bit updated or not?
How the new transaction inserted all over the blockchain nodes or blocks?
How does block difficulty define?


texts: What is the extra gas used during this storage transaction?

texts:
I'm using this contract to emit events about the gas a function uses:

contract GasDebug {
     event LogGas(uint256 gas);

     modifier debugGasUsed() {
         uint256 startGas = gasleft();
         _;
         uint256 endGas = gasleft();
        LogGas(startGas - endGas);
     }
}

And I'm testing the storage of a uint256 like so:

contract TestGasDebug is GasDebug {

    uint256 store;

    function test_1(uint256 _a)
        debugGasUsed
    {
        store = _a;
    }
}

Which I would expect to give me the result of 20000 but instead the event gives the value of 20021. Where is the extra 21 units of gas coming from?


texts: Is there a token standard that allows the owner of an address to move the tokens in any account under certain conditions?

texts:
I am wondering if there exists a token standard (much like ERC-20) that allows for the owner of an address to transfer the tokens out of any address when certain conditions are met?

For example, address A holds 10 tokens. Is it possible for a smart contract to reduce his balance to 9 if he does not call a doNotDrain() function on the contract?


texts: What exactly is an Ethereum client and what clients are there?

texts:
What exactly is an Ethereum client? Is it a full network node that can post transactions to the blockchain (if that is the correct lingo?) or could it also be a light JS client that connects from a browser to a full node?

Could someone please shed some light on what clients there currently are and what roles they fulfill?


texts: Offline signed contract throws 'exceeds block gas limit'. Why can't I deploy?

texts:
I'm trying to deploy a smart contract onto the Ethereum blockchain by signing the transaction on an offline computer and then transferring the byte code to an online system for deployment.  Because of this, I am not able to query what the current gas price and gas limits are in real time.

I am getting an 'Error: Returned error: exceeds block gas limit'.

I believe the price for deploying a contract is based more on how many functions are run and resources used and so the size might be too crude of a measurement to tell what's going on, but mine is: 3984 bytes.

I currently have my gas limit set to 1,200,000 (1.2 million) and my gas price set to 2Gwei (2,000,000,000 or 2 billion).  Note:  I just tried it and it fails using a gas limit of 500,000!  WTF??

I don't understand how I'm exceeding the block limit when https://ethstats.net/ consistently reports a block limit of around 8,000,000 (8 million).

I am using multiple solidity source files which I read into the sol_input_array, and then target the main file which draws on the dependent's functions with the parent_file_and_object string.

There seems to be more questions than answers on the internet concerning this particular error, so perhaps we could collaborate on an exhaustive list so this error won't be so perplexing when we run into it!

~$ geth version
Geth
Version: 1.8.2-stable
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.10
Operating System: darwin
GOPATH=
GOROOT=/usr/local/opt/go/libexec

Project version data:

Node:             v9.10.0
web3:             web3@1.0.0-beta.33
file-system (fs): mac:fs@0.0.1-security  linux: file-system@2.2.2
solc:             solc@0.4.21
ethereumjs-tx:    ethereumjs-tx@1.3.4

Here is my contract signing function:

function compile_and_sign_transaction_offline (p_key, address, gasPriceHex, parent_file_and_object){

    var privateKey = new Buffer(p_key, 'hex')

    const compiled_contract = solc.compile({sources: sol_input_array}, 1);
    const bytecode = compiled_contract.contracts[parent_file_and_object].bytecode;
    const contractData = '0x' + bytecode;

    //I have currently have been testing gas prices of 1.2-3 Gwei
    const gasLimitHex = '0x124F80';     //1,200,000 gas

    const rawTx = {
        nonce: 0x00,
        gasPrice: gasPriceHex,
        gasLimit: gasLimitHex,
        data: contractData,
        from: address
    };

    const tx = new Tx(rawTx);
    tx.sign(privateKey);

    const serializedTx = tx.serialize();
    const signed_transaction = serializedTx.toString('hex');
    fs.writeFileSync("signed_tx", signed_transaction);
}


texts: Ethereum wallet sync stucks only 100 blocks left

texts:
I have problem with finishing sync of my Ethereum wallet. It stucks 100 blocks before the end, it´s trying to download long chain structure, but it stops every time at some point - on screen it stoped at 683391 of 687160. After restart, it runs again and it stops at some point again.

I haven´t find same problem in troubleshooting, so I hope this is not repost.

I´ll be very grateful for any advice.

Best regards,

Kuba


texts: Solidity smart contract interacting with deployed smartcontract

texts:
Below are the steps (take note, no issues when I test this on remix, it works absolutely fine)

Two smart contracts, Usermapping.sol and CoffeeNetworking.sol

in truffle "2_deploy_contract.js" enable Usermapping.sol inorder to deploy Usermapping.sol contract
Then get the address of the Usermapping.sol of deployed contract.
Go to etherscan and convert the address to upper case.(if i dont do this step truffle compiler throws an error on invalid checksum address)
Update the newly converted address in to CoffeeNetworking.sol.
Then update truffle file "2_deploy_contract.js" to disbale Usermapping.sol deploy configuration and update with CoffeeNetowking.sol.
Then finally truffle migrate for CoffeeNetworking.sol, no issues on deployment.

For interaction, truffle console --network dev
When i execute below function in truffle console, transaction goes through, CoffeeNetworking.at('0xfd95F4AF776ba4F0E6D13fEc18763cA59336494c').then(function(instance){ return instance.addValue(25)}).then(function(result){ console.log("Result", result) })
In order to get the set value of above funciton, i execute below function, but could nt see the value of 25 result. (no issues if i use directly Usermapping.at(usermappingaddress) to execute the same funciton CoffeeNetworking.at('0xfd95F4AF776ba4F0E6D13fEc18763cA59336494c').then(function(instance){ return instance.getValue()}).then(function(result){ console.log("Result", result) })

//Usermapping.sol

pragma solidity ^0.4.23;
        contract Usermapping {
            uint256 public value;
            bytes32 public name;
            function addValue(uint a) public returns (bool)
            {
                value = a;
                return true;
            }
            function getValue() public view returns(uint256)
            {
                return value;
            }
            function setName(bytes32 nameSet) public returns(bool){
                name = nameSet;
                return true;
            }
             function getName() public view returns(bytes32){
                return name;
            }
        }

        var B = artifacts.require("./Usermapping.sol");
          module.exports = function(deployer){
        deployer.deploy(B)
       }

//CoffeeNetowkring.sol

pragma solidity ^0.4.23;

contract CoffeeNetworking{
    Usermapping u  = Usermapping(0x9B3a12cF7D8560DCd3d5D148cDCBCb9E1617D06F);
    uint256 public version =1;
    // address add = 0x9B3a12cF7D8560DCd3d5D148cDCBCb9E1617D06F;

    constructor () public {
    //   u = Usermapping(0xE1D685Fb942903986A9639da688d62E463BFC0DB);
    }

    function addValue(uint a) public returns (bool){
        // Usermapping u = Usermapping(add);
        return u.addValue(a);
    }

    function getValue() public view returns (uint256){
        // Usermapping u = Usermapping(add);
        return u.getValue();
    }

    function setName(bytes32 name) public returns(bool){
        // Usermapping u = Usermapping(add);
        return u.setName(name);
    }

     function getName() public view returns(bytes32){
        // Usermapping u = Usermapping(add);
        return u.getName();
    }

}

contract Usermapping {
    uint256 public value;
    bytes32 public name;
    function addValue(uint a) public returns (bool);
    function getValue() public view returns(uint256);
    function setName(bytes32 nameSet) public returns(bool);
    function getName() public view returns(bytes32);
}


texts: What's the role of blockTimestampLast in determining price?

texts:
I am looking up getReserves result of a pair contract.
It produces the following result:
Result {
  _reserve0: '3219645034999541693795',
  _reserve1: '86735629384854886759666',
  _blockTimestampLast: '1621295406'
}

This specific pair contract establishes CAKE/BUSD price, i.e. It tells us that 1 CAKE buys USD 26.94 (86735629384854886759666/3219645034999541693795=26.94).
As far as I understand, this is the spot price (current price in the marketplace), and it will not (cannot ?) change until the next block.
Assuming that I am right about everything else, what is _blockTimestampLast for?


texts:
I'm trying to get a better understanding of arbitrary bytes parameters, so I wrote a one-function smart contract that accepts a bytes argument, decodes it, and returns the response. I am having trouble calling the contract from a script using ethers.js - I get the correct response, but the script never ends. I have to add process.exit() - I'd like to know why the script isn't ending even though the promise is resolved, and how I should appropriately be handling events;

Here's my Solidity code:

pragma solidity ^0.5.0;
contract Byt {
  event bytDone (uint256 a, uint256 b);
  function takeByt(bytes memory byt) public returns (uint256, uint256) {
    (uint256 a, uint256 b) = abi.decode (
      byt,
      (uint256, uint256));
    emit bytDone(a, b);
    return (a, b);
  }
}

and here's where I'm trying to call the function from javascript with test values of 10 and 15:

let num1 = 10;
let num2 = 15;
let byt = ethers.utils.defaultAbiCoder.encode(
  ['uint256', 'uint256'],
  [num1, num2]
);
bytesTest(byt);
async function bytesTest(byt){
  try{
    let c = await bytesContract.takeByt(byt, {gasLimit: 100000});
    let r = await bytesContract.on("bytDone", (res1, res2) => {
      console.log(res1);
      console.log(res2);
    });
  }catch(err){
    console.log(err);
  }
}

The output is:

BigNumber { _hex: '0x0a' }
BigNumber { _hex: '0x0f' }

These are the appropriate hex encodings of 10 and 15 respectively, meaning I've picked up the event after correctly calling the solidity function. This is supposed to be the "await" part of my javascript code. The problem is, the script doesn't end - after console.logging res1 and res2 - it seems to just be waiting for something else. If anyone could explain why the script isn't ending, and what I should do to appropriately handle the emitted event from my solidity contract, I'd be forever grateful. Thanks in advance for your help!


texts: How big is the Geth Fast Node Currently?

texts:
I am trying to embark on getting all the contract addresses pulled from the Ethereum blockchain. From what I read, a fast node is all that is required for this (getting blocks->txns->contractAddress using web3 on an IPC node).

The problem is, I have a computer with only 149.9 GB available. Etherscan puts it at 132 GB as of Feb 2019. Does anyone have a more recent statistic?


texts: how to validate and execute an ethereum transaction

texts:
I'm confused about how to validate a transaction in Ethereum.
In fact, according to my simple knowledge, I know that the transaction row is signed and then the signature of the transaction is broadcast to the network so:

How the transaction is validated while only the signature (without the transaction row) is published in the network?
can anyone corrects or answers me?


texts: How come Blockchain Voting is decentralised and secure if it's controlled by ethereum network?

texts: I'm building a voting Dapp using ethereum blockchain but I have a doubt. The best thing about blockchain is that it's decentralized, transparent and secure i.e. no middleman or centralized server controls it. But if it's on ethereum, isn't it controlled by ethereum? If someone hacks it or tampers it, we go back to recentralise it, isn't it?


texts: How can I write a script to move ETH from many wallets associated with a mnemonic to a single wallet?

texts: Would be grateful to be pointed to any resources that would allow me to do this.  Thanks!


texts: How to reset private ethereum blockchain (Geth)?

texts:
I am running private ethereum blockchain using ethereum and now I want to reset the chain and delete all the contracts, transactions and logs and restart everything from block 0.
What is the best way to do that?


texts: Initialize an array of struct within a struct

texts:
I am working on a use case of "Purchase Order" wherein there will be multiple Products listed/ordered under one Purchase Order(PO) by a buyer.

1 PO : N Products

struct Product{
    bytes32 product_code;
    bytes32 product_name;
    uint quantity;
    uint unit_price;
}

struct PurchaseOrder{
    bytes32 po_number;
    string po_creation_date;
    // next line is the question
    mapping( bytes32 => Product[]) products;  // or Products[] products
}

//mapping to store Purchase Orders
mapping(uint => PurchaseOrder) purchaseOrders;

uint po_number = 100;

function createPO(string memory po_creation_date,bytes32[] memory products) public returns(bool){

    require(msg.sender == buyerAddress);
    po_number++;
    purchaseOrders[po_number].po_creation_date = po_creation_date;

    for (uint256 i = 0; i < products.length; i++) {
        bytes32[] memory arr=new bytes32[](products.length);
        arr[0]= products[i];
        //bytes32 product_code = arr[0].product_code;
        purchaseOrders[po_number].products[product_code].push(Product(arr)); // how do i need to proceed ??
    }

}

parameter bytes32[] memory products  comes from nodejs app and as a array of objects.

I must also be able to retrieve all the products under a PO for particular buyer.

Improve this code or if this code does not make sense and can be rewritten to achieve same, please feel free to do so or guide me.

TiA


texts: Web3js: Looping through a web3js function

texts:
By using the Truffle Console and Ganache test node, I am calling this function:

Contract.deployed().then(function(instance) {return instance.createListing("1", 3, {from: address})})

When this will be deployed to the Mainnet, I will need to call this function 200 times. Figured, that a for loop should be used, however, can't understand how to get together one and how to run it on the Mainnet (geth?).

What would be the best way of repeating this setter 200 times on the Mainnet? Also, I guess a delay in between the calls needs to be considered when on Mainnet.


texts: Should governance and token smart contracts be "unstoppable" or upgradeable?

texts:
Selfdestruct (aka suicide) functions stop contracts from functioning and clean up data on the blockchain. They can be used in upgrading contracts.

Selfdestructing and upgradable contracts using a contract registry allows the execution of potentially arbitrary new code by a contract account owner. This is precisely the type of opaque centralized control Ethereum is designed to remove.

On the other hand, there will be smart contract bugs, even Satoshi made mistakes, Bitcoin is upgraded regularly, human legal contexts change constantly, and the solidity language isn't fully specified yet. So there is a strong case for providing smart contract upgrade paths.


texts: How Geth and Parity resolve timestamps when validating block headers?

texts:
Geth and Parity nodes differ in a fundamental way when they validate block headers.

Background

According to the yellow paper

  4.3 timestamp: A scalar value equal to the reasonable output of Unix's time() at this block's inception; formally Hs
  4.4 Hs is the timestamp of block H and must fulfil the
  relation: Hs > P(H)

Both implementations require that the machine running the node to resolve it's NTP protocol to pool.ntp.org for no more than 10 seconds

Conclusion

But, they differ when it comes time to validate the block. Geth and parity will check if that timestamp is greater than the parent's timestamp, but geth will outright reject any block that has its current time set in the future

Question

Given the fact that parity allows for a looser interpretation of timestamp validity, how do these protocols resolve on different blocks being proposed, does the stricter protocol win in the end? Additionally, is there a way to quantify this variation of timestamps?


texts: Call contract methods with web3 from newly created account

texts:
I need to call methods from my contract in Ethereum without using MetaMask. I use Infura API and try to call my methods from account, recently created with web3.eth.create() method. This method returns object like this:

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

I also using infura provider:

 const web3 = new Web3(new Web3.providers.HttpProvider(
    "https://rinkeby.infura.io/5555666777888"
  ))

So, when I try to write smth like that:

contract.methods.contribute().send({
          from: '0xb8CE9ab6943e0eCED004cG5834Hfn7d', // here I paste recently created address
          value: web3.utils.toWei("0.5", "ether")
        });

I have this error:

  Error: No "from" address specified in neither the given options, nor
  the default options.

How it could be no from address if I write it in from option??

P.S. With Metamask my application works fine. But when I logout from MetaMask and try to create new account with web3.eth.create() method and use it, I have that issue.


texts: Ethereum as a private network is possible?

texts:
can i deploy a private network like the way it does other private blockchains  with Ethereum ?
and the test networks in Ethereum only work for public right or can i deploy it there  ?


texts: Using jsonrpc to get eth data but the result is null

texts:
I use this command to get data from eth network, but get null return

The command is

  curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}' localhost:8545 -H 'content-type: application/json'

The output is

  {"jsonrpc":"2.0","id":83,"result":"0x0"}


texts: How can we trace history of transactions in smart contracts?

texts:
Once the contract is mined, i receive an address. Several transactions take place on that contract address, for which a unique transaction hash is generated for each transaction. These transactions change the state and force certain parameters to change.

Is there a way to trace those transactions/ state change using the contract address in smart contracts?


texts: What is cheapest way of creating clone of existing smart contract's

texts:
I do need to deploy a lot of similar smart contracts. With Solidity it's quite easy, but expensive :(

I'm doing:

contract One {
 ...
}

contract Builder {
    function create(uint8 amount) public returns (address[]) {
        uint8 i = 0;
        address[] contracts;
        while (i++ < amount) {
           address[i] = new One();
        }
        return contracts;
    }
}

This approach works, but costs almost same amount of gas as it would creating via separate transactions. It looks like that EVM is just cloning code into new place in storage and we have anyway pay for gas for such duplicated code.

Is there any way to have pointers in new accounts into place in storage where code is stored instead of duplicating same bytecode into own storage?


texts: How to deploy and get address of smart contract in same javascript program

texts:
I want to deploy a smart contract (provided in .json file) and need its address (on testnet blockchain) and then try to send some transactions to it. All these should be done through javascript. Here is my code which i have tried to deploy, but could not run it. Also , I am confused that why here we are not used our private Key for signing during deployment of contract.
UPDATED:

var Tx = require('ethereumjs-tx').Transaction
const Web3 = require('web3');
const provider = new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/7f....90b30dd22f0");
const web3 = new Web3(provider);
const account1 = '0xd458d3B03A3D4025Ae3DD5a3358afDa832c7507e'
const privateKey1 = Buffer.from('8005F9FE6F1......','hex')
var compiledContract = require('./build/MyContract.json')

(async () => {

const deployedContract = await new web3.eth.Contract(compiledContract.abi)
    .deploy({
        data: '0x' + compiledContract.bytecode,
        arguments: [account1]
    })
    .send({
        from: account1,
        gas: '2000000'
    });

console.log(
    `Contract deployed at address: ${deployedContract.options.address}`
);

provider.engine.stop();

})();
here is my output:

(async () => {
^
TypeError: Buffer.from(...) is not a function
    at Object.<anonymous> (C:\Users\aa\MyProject\deploy.js:62:1)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)


texts:
I read through the just released EEA Stack and Specification accessible at https://entethalliance.org/wp-content/uploads/2018/05/EEA-Architecture-Stack-Spring-2018.pdf

It is a great first step in the right direction in the delineation of responsibilities in achieving separation of concerns -- Network, Core Blockchain, Application.

However, it is only one page. Thought if someone could share if best practices, specifications, security (privacy) and scalability would be addressed in the same document in the future or this document is the final copy?

Enterprise Ethereum Alliance - Enterprise Ethereum Architecture Stack (EEAS)


texts: web3js - Promises - web3.eth.getAccounts()

texts:
Objective: Assign a global variable to the first indexed address returned in web3.eth.getAccounts(). I want this so I can use it in the rest of my code and simply reference a variable.

Problem: Promises. There's something I'm not getting.

Two ways I've tried this:

1) async + await

var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'));
const getAccounts = async () => {
   const accounts = await web3.eth.getAccounts();
   return accounts;
};
let acct = getAccount()[0];
console.log('The first account is: ' + acct);

2) .then()

    var Web3 = require('web3');
    var web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'));
    let acct = web3.eth.getAccounts().then(data => {return data[0];});
    console.log('The first account is: ' + acct);

Neither seem to be working for me, and must be doing something wrong. Best I can return is "Promise { pending }"

Can anyone help explain how I can use the result of a promise elsewhere in my code?


texts: Brownie: Hypothesis given() is not resetting chain for each function call

texts:
I have the following test code snippet in my brownie project:

from hypothesis import settings, given, strategies as st
from brownie import *
import brownie

st_buy_amount_eth = st.integers(min_value=int(Wei("1 gwei")), max_value=int(Wei("10 ether")))

@given(buy_amount=st_buy_amount_eth)
@settings(max_examples=20)
def test_buy_lgt_atleast_for(lgt, accounts, buy_amount):
    print(web3.eth.blockNumber)
    token_amount = buy_amount_to_tokens(buy_amount)  # hard-coded function to verify the math
    if token_amount >= 1:
        tx = lgt.buyLgtAtLeastFor(1, 99999999999, accounts[3], {'from': accounts[2], 'value': buy_amount})
        assert tx.return_value == token_amount
        assert lgt.balanceOf(accounts[3]) == token_amount
    else:
        with brownie.reverts("dev: not enough eth to buy tokens"):
            liquidLgt.buyLgtAtLeast(1, 99999999999, {'from': accounts[2], 'value': buy_amount})

When running the tests with brownie test -s the print output I get is one block higher for each example with hypothesis and I get inconsistent results errors from hypothesis.

Is there a way to set it up so hypothesis will properly reset the chain for each example? That would be awesome, I really hope to get hypothesis to work with brownie!


texts: Saving String with Decimal Number from JSON as Number(Uint) without Losing Decimals

texts: Hey Im trying to use an exchange rate gathered from json as a string to create a uint variable similar to the rate, but I need a way to capture the information after the decimal. For instance I want "1.45" to end up as "145" or something similar. Is this possible?


texts: How to open Parity database from javascript (how to open column families)?

texts:
I am trying to connect to Parity database at var dbPath = 'C:\\Users\\username\\AppData\\Local\\Parity\\Ethereum\\chains\\ethereum\\db\\906a34e69aec8c0d\\overlayrecent\\db' form javascript using npm module level-rocksdb in this way:

var level = require('level-rocksdb');
var db = level(databasePath);

But I am getting error:

(node:22916) UnhandledPromiseRejectionWarning: OpenError: Invalid argument: You have to open all column families. Column families not opened: col0, col1, col2, col3, col4, col5, col6, col7
    at C:...project\node_modules\levelup\lib\levelup.js:87:23
    at C:...project\node_modules\abstract-leveldown\abstract-leveldown.js:41:14
    at C:...project\node_modules\deferred-leveldown\deferred-leveldown.js:20:21
    at C:...project\node_modules\abstract-leveldown\abstract-leveldown.js:41:14
    at C:...project\node_modules\abstract-leveldown\abstract-leveldown.js:41:14
(node:22916) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:22916) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

How should I pass options to level constructor to open column families? Function signature is const db = level(location[, options[, callback]]).


texts: Source "" not found: File outside of allowed directories. [solidity/solc]

texts:
I'm using vim with the syntastic plugin.

I'm getting this message:

Source "zeppelin-solidity/contracts/token/StandardToken.sol" not found: File outside of allowed directories. [solidity/solc]

when editing a .sol file in <prj-root>/contracts (as per truffle init)

zeppelin-solidity was installed by yarn add into <prj-root>/node_modules.

I tried creating a symlink in the contracts directory and running vim from the same directory, and still get the same warning.

I also tried running vim inside the node_modules directory so that the path wouldn't involve a symlink:

$ pwd
/home/ravi/repo/erc20/coin/node_modules
$ ls
zeppelin-solidity
$ vim ../contracts/CapitalCoin.sol

How can I silence this error?


texts: Creating an automatically ordered pledge list. Can I do better in terms of gas?

texts:
Inspired by What's the best way to return top X values in a mapping? and Are there well-solved and simple storage patterns for Solidity?, I've created a data structure that automatically orders itself based on an "opt-in" amount. Unfortunately, there a few loops in here consuming a fair bit of gas, and so I'm wondering if anyone has any suggestions of where I can improve my code.

It has three main methods: delete, remove and update. remove currently uses quite a bit of gas.

pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
pragma experimental "v0.5.0";

import "./LibOptIn.sol";

library LibOptInList {
    using LibOptIn for LibOptIn.OptIn;

    struct OptInList {
        mapping (address => uint256) balances;
        LibOptIn.OptIn[50] optIns;
    }

    // TODO (julian): can probably do some optimization for when there are zero addresses initially.
    function insert(
        OptInList storage self,
        address addr,
        uint256 value
    )
    internal
    returns (LibOptIn.OptIn)
    {
        LibOptIn.OptIn memory displacedOptIn;
        uint256 i = 0;
        // get the index of the current element one higher than `value`
        for (i; i < self.optIns.length; i++) {
            if (self.optIns[i].balance < value) {
                break;
            }
        }

        // Check if the value is high enough to be inserted.
        if (i == 0 && value < self.optIns[0].balance) {
            revert("Value is not high enough");
        }

        if (self.optIns[self.optIns.length-1].addr != address(0)) {
            displacedOptIn = self.optIns[self.optIns.length-1];
        }

        // shift the array of position (getting rid of the last element)
        for (uint256 j = self.optIns.length - 1; j > i; j--) {
            self.optIns[j].balance = self.optIns[j - 1].balance;
            self.optIns[j].addr = self.optIns[j - 1].addr;
        }

        // update the new ith highest element
        self.optIns[i].balance = value;
        self.optIns[i].addr = addr;

        // update mapping
        self.balances[addr] = value;

        // return displaced value and delete from balances mapping, might be empty
        delete self.balances[displacedOptIn.addr];
        return displacedOptIn;
    }

    function remove(OptInList storage self, address addr) internal {
        uint256 i = 0;

        // get the index of the addr element
        for (i; i < self.optIns.length; i++) {
            if (self.optIns[i].addr == addr) {
                break;
            }
        }

        // check if this address is in the opt-in list
        if (i == 0 && self.optIns[0].addr != addr) {
            revert("Address not in opt-in list.");
        }

        // move elements up one
        for (uint256 j = i; j < self.optIns.length - 1; j++) {
            self.optIns[j].balance = self.optIns[j+1].balance;
            self.optIns[j].addr = self.optIns[j+1].addr;
        }

        // kill last element
        delete self.optIns[self.optIns.length - 1];

        // remove from mapping
        delete self.balances[addr];
    }

    function update(
        OptInList storage self,
        address addr,
        uint256 newVal
    )
    internal
    returns (LibOptIn.OptIn)
    {
        remove(self, addr);
        return insert(self, addr, newVal);
    }
}

The OptIn struct is very simple, it's just:

struct OptIn {
    uint256 balance;
    address addr;
}

Thank you for your help!


texts:
I have something like:
   contract example{
            uint endBlock;
            constructor(uint _elitism) public {
                endBlock= block.number + 40; // 10 min of time
            }

            modifier onlyBeforeEnd() {
                require(block.number  > endBlock, "Auction already ended.");
                _;
            }

            function getBalance() onlyBeforeEnd public view returns(uint){
                return msg.sender.balance;
            }

    }

if I try to execute getBalance() fuction, everytime it get: "Auction already ended." But, why? The auction is supposed to last 10 minutes.

could anybody help me, please?


texts: Return multiple values from diferent smart Contracts

texts:
I have two contracts. The first contract has a function called get() that returns this values:
uint _value1
address _value2
address _value3
string memory _value4
string memory _value5
uint _value6
string memory _value7
address _value8

What I want is to call the function get() (Smartcontract 1) from the second contract.
This is the function of the second SmartContract.
function getValues() public view
        returns(uint _value1,
                address _value2,
                address _value3,
                string memory _value4,
                string memory _value5,
                uint _value6,
                string memory _value7,
                address _value8,
                address _value9
                )
    {
        return (contract1.get(), address(contract1));
    }

The problem is that I get an error that says:
"TypeError: Different number of arguments in return statement than in returns declaration."
I have also tried this:
{
        (_value1,_value2,_value3,_value4,_value5,_value6,_value7,_value8) = contract1.get();
        return (_value1,_value2,_value3,_value4,_value5,_value6,_value7,_value8, address(contract1));
}

But in this case i get the classic error: "CompilerError: Stack too deep, try removing local variables."
Is there any way to solve this problem?? I know i could call different functions to make it working.
{
       return (contract1.getValue1(),
               contract1.getValue2(),
               contract1.getValue3(),
               contract1.getValue4(),
               contract1.getValue5(),
               contract1.getValue6(),
               contract1.getValue7(),
               contract1.getValue8(),
               address(contract1));
}

This will work but i want to call contract1 only one time. Is there any way?
I am working with the compiler version 0.6.10
Thank you in advance


texts: Uncaught (in promise) Error: Invalid JSON RPC response: ""

texts:
How to solve this error that show in the picture of chrome browser below?

Bundle.js

var contractABI = [];
var contractAddress = '0x9B69fA769D70728d14a70A4F10E7078032FF1632';
var web3 = new Web3('http://localhost:9545');
var simpleSmartContract = new web3.eth.Contract(contractABI, contractAddress);

console.log(simpleSmartContract);

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

truffle-config.js

module.exports = {
  networks: {
    development: {
      host: "127.0.0.1",     // Localhost (default: none)
      port: 8545,            // Standard Ethereum port (default: none)
      network_id: "*",       // Any network (default: none)
    },
  },
  mocha: {
  },
  compilers: {
    solc: {
    }
  }
}


texts:
I followed this guide to set up aws to mine ethereum with an instance that has GPUs. After set up, I let the miner go for a day without any pay in the smallest denomination of Ethereum. I researched and found that, at this point, you should be mining with a pool. I searched around, but found no instructions of how to mine in a pool with Geth.

Can someone help me find out the right way to join a mining pool using geth?

Thank You


texts: Puzzling "Warning: "this" used in constructor." thrown by Remix static analysis

texts:
For the following code:

pragma solidity ^0.4.17;

contract someContract {
  function someContract(address _someAddress) public {
    uint someNumber = 1;
    if (_someAddress != 0x0000000000000000000000000000000000000000) {
      someContract dCA = someContract(_someAddress);
      if (dCA.getOne() != someNumber || dCA.getTwo() != 2) {
        revert();
      }
    }
  }

  function getOne() public pure returns (uint) {
      return 1;
  }

  function getTwo() public pure returns (uint) {
      return 2;
  }
}

...Remix tells me:

  browser/Untitled1.sol:8:15: Warning: "this" used in constructor.
            if (dCA.getOne() != someNumber || dCA.getTwo() != 2) {
                ^--------^

  browser/Untitled1.sol:8:45: Warning: "this" used in constructor.
            if (dCA.getOne() != someNumber || dCA.getTwo() != 2) {
                                              ^--------^

...I've looked at the origin of this warning, but it seems to me that the static analysis is confusing the instantiation of another, existing contract with the current contract. Shouldn't the EVM be able to instantiate an existing contract without issues in the constructor or am I myself utterly confused?


texts: VM error: revert. The transaction has been reverted to the initial state

texts:
I have been trying for while for accessing functions of one contract in another one as shown below. I actually want to call the functions changeName() and receiveName() defined in the foreignContract{} from myContract{}. The transaction is getting mined but the execution is getting failed.

pragma solidity ^0.4.0;

contract myContract {
    foreignContract created;

    function myContract() {
        created = foreignContract(msg.sender);
    }

    function changeNameMycontract(string name) returns(bool, address) {
        return (created.changeName(name), msg.sender);
    }

    function ReturnName()returns(string) {
        return created.receiveName();
    }
}

contract foreignContract {
    string name;

    function changeName(string Name) returns(bool) {
        name = Name;
        return true;
    }

    function receiveName() returns(string) {
        return name;
    }
}

The error that I get is

  Transact to myContract.changeNameMycontract errored:VM error.reverted
  revert the transaction has been reverted to the initial state. Note:
  the constructor should be payable if you send value.

I'm new to this solidity and blockchain concepts - any help would be really appreciated


texts: how to configure block explorer securely?

texts:
There are many block explorers that offer this service publicly, they are based on this explorer:

github.com/etherparty/explorer

I tried to use it, but to make it work (so my users could explore blocks of our private net) I have to open RPC port for everyone using --rpccorsdomain "*", and bind RPC port to an external network interface. AFAIK this is very insecure, and exposing such a complex API may lead to a remote exploit somehow, probably. Setting up proxies from nginx and stuff like that also won't work, because the request to RPC is made from the browser of the client, and the client is located somewhere on the internet.

So my question is , how do this people configure their block explorer in a secure manner? I would also like to offer a public block explorer for my net but I don't want to be hacked.


texts: Etherlime Infura Rinkeby deployment causing ECONNREFUSED 127.0.0.1:443

texts:
I’m trying to deploy to Rinkeby using Infura (using Etherlime), but am getting a strange error:
'Error: connect ECONNREFUSED 127.0.0.1:443\n' +
    '    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1137:16)'

Prior I was getting a different error, but after shutting down a local web server (nginx, not that it matters) I started getting this one. It would seem to me that something in Infura is trying to listen on port 443, and that the issues stem from that, but I’m not at all certain that I’m diagnosing right. We’ve tried this on Linux, Mac, and Windows, and are all getting the same error (though triggered by different lines in net.js it seems).
One thought is that somehow changing the port that Infura is using would help. I've tried making the api call like so: https:/rinkeby.infura.io/v3/${process.env.INFURA_API_KEY_RINKEBY}:{NEW PORT NUMBER}, and even though it doesn't crash the api call, I get the same error with port 443. Maybe it's not Infura after all?
Any thoughts about what we can do to fix this?


texts: How to start Geth at boot (Raspberry) and interact with it

texts:
I want to use a raspberry for IoT. For this project I need to start Ethereum (Geth) at privat chain in the boot state.

When I have some data, I would like to make a transaction (contract) to store the data.

Is there anybody who can help me?


texts: What is the physical location of Blockchain?

texts:
Hello everyone i am new in this technology and i am confused please clear my few doubts. Thanks in advance.

Blockchain consist of Blocks but where these blocks are stored, i mean what is the physical location of Blocks.
As per my theoretical knowledge blockchain exist in network but in which network, do we need to create our own network or is there any third party those who provide network for our application.
Suppose i have to develop land registry application i need some space somewhere where i can store my blocks. if i store all block in my system itself then how it will behave like a decentralized.
Does Ethereum stored our blocks in his network?
Blockchain itself is a database but how we can manage the data.
Does BigchainDB stored our blocks or blockchain in his database?


texts: How does a contract know which library to query or know the library address?

texts:
How does a contract know which library to query? For Example in the code below (The code is from solidity docs: https://solidity.readthedocs.io/en/v0.4.24/contracts.html?highlight=library#libraries

pragma solidity ^0.4.22;

library Set {
  // We define a new struct datatype that will be used to
  // hold its data in the calling contract.
  struct Data { mapping(uint => bool) flags; }

  // Note that the first parameter is of type "storage
  // reference" and thus only its storage address and not
  // its contents is passed as part of the call.  This is a
  // special feature of library functions.  It is idiomatic
  // to call the first parameter `self`, if the function can
  // be seen as a method of that object.
  function insert(Data storage self, uint value)
      public
      returns (bool)
  {
      if (self.flags[value])
          return false; // already there
      self.flags[value] = true;
      return true;
  }

  function remove(Data storage self, uint value)
      public
      returns (bool)
  {
      if (!self.flags[value])
          return false; // not there
      self.flags[value] = false;
      return true;
  }

  function contains(Data storage self, uint value)
      public
      view
      returns (bool)
  {
      return self.flags[value];
  }
}

contract C {
    Set.Data knownValues;

    function register(uint value) public {
        // The library functions can be called without a
        // specific instance of the library, since the
        // "instance" will be the current contract.
        require(Set.insert(knownValues, value));
    }
    // In this contract, we can also directly access knownValues.flags, if we want.
}

How does Contract C know where the Set library is located and what if there are other libraries called Set?

Is there something missing in this code?


texts: why separate assignments are better than single?

texts:
I've read that:

It is more gas efficient to initialize a tightly packed struct with separate assignments instead of a single assignment. Separate assignments makes it easier for the optimizer to update all the variables at once.

So, they say:
this is better:
Point storage p = Point()
p.x = 0;
p.y = 0;

Than
Point storage p = Point(0, 0);

Any idea why ?


texts: Why should I use an ERC-721 token to store data instead of a Smart Contract

texts:
Taking CryptoKitties as example, I'm sure it's possible to achieve the same concept of Crypto Collectable creating new kitties as Smart Contracts instead of using Tokens. Which would be the consequences of doing so? I'm looking for a technical anwser :)

UPDATE from the future: when I asked this question my journey on Ethereum/Solidity was just starting. The question as asked is wrong. As obvious as it might sound ERC-721 is a standard for writing contracts, not a token itself (so "ERC-721 token" is just wrong). What you can do is store "tokens" (or NFTs) in this kind of contracts.
What I really wanted to ask was:
Why should I store a non fungible token (eg: a CryptoKittie) inside a contract that follows the ERC-721 standard instead of creating and deploying a contract of my own for each token (just a simple contract that describes the token and its functionality).
Nowadays the answer seems obvious: compatibility and cost efficiency.


texts: I've got a problem with the id search function and it displays the following error "Error: hex data is odd-length "

texts:
$("#searchBtn").click(function () {
        patienttdetailsContract.methods.readPatient(parseInt($("#p_search").val())).call(function (err, result) {
              console.log(parseInt($("#p_search").val()));
            if (!err) {

                let val ="";
                for (let key in result) {
                    val += `${result[key]} `;
                }
                $("#result").text(val)
            } else
                console.log(err);
        });
    }
);


texts: How exactly ethereum is a smart-contract platform

texts: I am new to Ehterum and Blockcain. I am using ehtereum smart contracts api web3.js for my front-end interaction. I am using solidity for writing contract using truffle. I want to automate the transaction on baisis of some condition such as time interval. I have posted this question on other forums such as gitter community and got answer that I can use Oraclize or Reality keys to achieve this? So I was wondering why It is called smart-contract if it is not smart enough to even execute an automated transaction? Can someone please explain that is it true that we cannot write such automated contract in ethereum or maybe I have wrong understanding of things?


texts: Constructor takes byte32 value. How send32 value, using web3.py or only python?


texts:
I would like to create a contract that can be used without ether.

Is it possible to create a function in a contract that pays for its own gas?

I am aware that this leaves the door open to abuse and that a troll will probably call the function until there is no ETH left.

But for the sake of argument: is it technically possible?


texts:
I'm an individual who is interested to ICOs which are selling ERC20 tokens.

My question is related to an issue that, for most of the ERC20 tokens, the dates of transactions do not fall within the ICO periods.

For example, Blockchain.io sold "BCIO" token during its ICO period which is between 27th Sep 2018 to 25th Oct 2018.

However, the initial transaction of BCIO in etherscan.io here starts from 23rd Nov 2018 which is after the ICO period. (See the last page in the link)

Could anyone please let me know why there are this kind of delays in nearly every transactions of ERC20 tokens? Is there a delay or is etherscan.io not an accurate explorer?

Thank you for your time.


texts: What is the best or recommended method for updating geth to include all my custom blockchain parameters?

texts:
I have a blockchain based on Ethereum, I will call it my testnet for now and I have a few nodes running and mining.  All seems well so far, I am currently starting geth with several parameters

If I use this examples with different values,

geth --identity "MyNodeName" --rpc --rpcport "8080" --rpccorsdomain "*" --datadir "C:\chains\TestChain1" --port "30303" --nodiscover --rpcapi "db,eth,net,web3" --networkid 1999 init /path/to/CustomGenesis.json

I want the users of my geth to not have to type all these parameters in at the command line & I would also like to package my version of geth with my version of Mist.  Infact I would rather not have the --nodiscover parameter there and let it find the other peers without the manual admin.addPeer("") being used.

Is there any example of this being done, if not can anyone point me to where I would embed these parameter values in the code so I can update the codebase and build a release.


texts:
I receive an error when sending raw transactions. I get the following error message.

        Error: Returned error: Transaction nonce is too low. Try incrementing the nonce.

I get my nonce this way:

    const nonce = web3.eth.getTransactionCount(account);

I have double-checked and can guarantee that it returns the correct nonce.

Another thing I tried is to increment the nonce like the error message says but I still get the error.

Anyone has an idea why this is the case?

additional details
network: Kovan

ethereum client: parity

error occurs after

web3.eth.sendSignedTransaction(rawTx)


texts:
I am trying to create asset based transfer Smart contract by solidity language. i'm using ethereum.

functions are

Create assets (land_id, land_size, land_price) with a ownership of  contract owner.
Transfer assets to other person.
getCurrentOwnership
Previous Owners list
getAsset details.

My Contract:

pragma solidity >=0.4.22 <0.6.0;

contract Asset {

uint256 public owners_count;
address public contract_owner;              // Manufacturer/owner
bytes32 public land_id;                   // land_id
bytes32 public land_sqrfeet;              // land_sqrfeet
bytes32 public land_created_date;         // Created date
mapping(uint => address) public owners;     // list of owners

function createland(bytes32 _land_id, bytes32 _land_sqrfeet, bytes32 _land_created_date) public returns (bool){
    setOwner(msg.sender);
    land_id = _land_id;
    land_sqrfeet = _land_sqrfeet;
    land_created_date = _land_created_date;
    return true;
}

//Modifier that only allows owner of the bag to Smart Contract AKA Good to use the function
modifier onlyOwner(){
    require(msg.sender == contract_owner);
    _;
}

//This function transfer ownership of contract from one entity to another
function transferOwnership(address _newOwner) public onlyOwner(){
    require(_newOwner != address(0));
    contract_owner = _newOwner;
}

//Get the previous owner in the mappings
function previousOwner() view public returns(address){
    if(owners_count != 0){
        uint256 previous_owner = owners_count - 1;
        return owners[previous_owner];
    }
}

function setOwner(address owner)public{
    owners_count += 1 ;
    owners[owners_count] = owner;
}

function getCurrentOwner() view public returns(address){
    return owners[owners_count] ;
}

function getOwnerCount() view public returns(uint256){
    return owners_count;
}}

but with this contract, i can able to get last created asset details. I can not get previous creation assets details.

Questions are:

Each Assets should be different contract address or one contract address?
If take one contract address for all assets, how can i get old transaction by contract function?


texts: can Ether(ETH) currency be controlled by reward instead of the difficulty?

texts:
There are lots of references to the time bomb in Ethereum which is supposed to happen in the near future and it is meant to control inflation of the currency, because it is growing too fast right now. Increasing difficulty will also increase the block time, which is not good for transactions.

My question is, why the difficulty has to be increased and not the reward
 per block lowered? Right now the reward is 5 ether. To control the rate of currency growth by factor of 2x you just have to decrease the reward to 2.5 ether. Why aren't the developers of Ethereum going this way? Is there some technical limitation?


texts: What is the difference between a protocol and a blockchain?

texts: Publica https://publica.com/ claims to be a protocol that is built on the Ethereum blockchain, what does this mean on a technical level? Will Gas be utilized to execute smart contracts on Publica protocol?


texts: web3.js Contract return null instead of string

texts:
Here is contract:

pragma solidity ^0.4.17;

contract Demo{

  string public data;

  function Demo()public{
    data = "Jiu Wei";
  }

  function getData() public view returns (string) {
      return data;
  }
}

Here is web3.js code:

var abi = /*abi*/

var address = "0x850e97f8692ffe27c867b1401244691736c021ee";

var myContractInstance = web3.eth.contract(abi).at(address);

myContractInstance.getData.call(function (result, error) {
  if(!error) {
      console.log(result);
  }
});

The question is it returns null all the time.

What should I do for the code?

Please give me some advice on how to handle a situation like this. Thank you in advance.


texts:
I'm trying to do some modification to a test contract and i want to do it valid until a period of time like defining

startingTime= 25/08/2017;
endingTime= 27/08/2017;

is this possible in some way and what type should i use? i already checked the block.timestamp thing and don't like much that function because of the miners influence on that.


texts: Realistically how big an array inside Ethereum smart contract can be?


texts: Can a smart contract be validated only by a specific selected node

texts:
Is it possible to direct a transaction to a validating node such that - while other nodes receive the broadcast, only the selected node can validate the transaction and the others simply ignore it?

Once validated the ledger of all other nodes are synced as usual.


texts: Storing, sending and receiving BTC using smart contracts?

texts: I know using BTCRelay provides a way of checking whether the funds are in the BTC address. However, I can't find anything about smart contracts sending and receiving BTC.


texts: How are function signature hashes calculated in serpent?

texts: We know in solidity it is something like this bytes4(keccak256("hello(string)") but what about serpent? In Theory we should be able to call serpent contract code from solidity using these signature hashes.


texts: Throughput and Latency of Private Ethereum Network

texts:
How do I calculate Throughput and Latency of a private Ethereum network that I have set up locally on my computer? I tried the solution given in Measuring transaction latency and throughput in a multi node local private network but did not help.
I am fine even if there is a way to manually calculate any performance metrics of Ethereum network


texts:
I've been trying to make my contract be callable by metamask (so a popup will occur telling the user to confirm) but it does not seem to work, heres what I have come up with so far. Can anyone give me tips or advice on how to proceed? Thanks!

  // Check if Web3 has been injected by the browser:
  if (typeof web3 !== 'undefined') {
    // You have a web3 browser! Continue below!
    startApp(web3);
  } else {
     // Warn the user that they need to get a web3 browser
     // Or install MetaMask, maybe with a nice graphic.
  }

})
const Eth = require('ethjs-query')
const EthContract = require('ethjs-contract')

function startApp(web3) {
  const eth = new Eth(web3.currentProvider)
  const contract = new EthContract(eth)
  initContract(contract)
}
const abi = [{
  "constant": false,
  "inputs": [
    [
            {
                "internalType": "address",
                "name": "_tokenTake",
                "type": "address"
            },
            {
                "internalType": "uint256",
                "name": "_amount",
                "type": "uint256"
            },
            {
                "internalType": "address",
                "name": "_tokenReturn",
                "type": "address"
            },
            {
                "internalType": "bytes",
                "name": "_userData",
                "type": "bytes"
      }
    ],
  ]
}]
const address = 'insert contract address'
function initContract (contract) {
}


texts:
After deploying a Smart Contract and knowing that:

address = 0x20e4ac9385ea45919b9709c2b38d3190efa42ee4
ABI = [{
        constant: false,
        inputs: [],
        name: "kill",
        outputs: [],
        payable: false,
        type: "function"
    }, {
        constant: true,
        inputs: [],
        name: "greet",
        outputs: [{...}],
        payable: false,
        type: "function"
    }, {
        inputs: [{...}],
        type: "constructor"
    }]

I want to call it, but first I need to instantiate it in a JS var like this:

var greeter = eth.contract([{ constant: false, inputs: [], name: "kill", outputs: [], payable: false, type: "function" }, { constant: true,inputs: [], name: "greet", outputs: [{...}], payable: false, type: "function" }, { inputs: [{...}], type: "constructor"}]).at("0x20e4ac9385ea45919b9709c2b38d3190efa42ee4");

but it throws this error:

(anonymous): Line 1:179 Unexpected token . (and 9 more errors)

It seems like a syntax error, maybe I missed something.


texts: Web3js - Internal Transaction Data (Event Logs): Token Transfers, Contract Creations, & Internal ETH Transfers

texts:
I'm currently recording transaction data via Web3js, while directly connected to a local Geth full archive node via IPC, and I was wondering if there was a more elegant way to record internal transaction data (aka 'Event Logs' according to Etherscan.io).

More specifically I'm looking to record ALL ERC-20 token transfers, internal contract creations, and internal transactions (for ex: ETH returned to addresses from Smart Contracts such as CEX / DEX wallets, Primablock, etc).

As of now I'm able to retrieve both ERC-20 token transfers & some internally created contracts using the code snippet posted towards the bottom of this post.

I wasn't entirely sure of three things:

Are all ERC-20 token transfers are listed with the "0xddf252..."
sha3 hash, and would the below code suffice for accurately capturing those transfers? Is there a separate function for new tokens minted, or is it safe to assume all newly minted tokens come from the '0x000000...' address?
Is there a specific sha3 hash associated with contract created internally?
    The 'contractInternalHash = 0xef4c86' value below is associated with
    new smart contract (new wallet) creations from the Bittrex exchange, however, I'm more
    specifically looking to log everything with a 'create_0' Type Trace
    Address as shown in the below Etherscan link:

https://etherscan.io/tx/0x1164ea62dc6ac087d9d4802a1a0fae6b366b292cd896ed69ec42f290418a7d2d#internal
Lastly, how do I record ETH transfers sent as Internal Transactions?
Two examples below: a DEX ETH transfer & a smart contract ETH
transfer, both have different 'Event Logs' according to Etherscan
yet have a similar 'call_0' format under the 'Internal Transactions'
tab.

DEX ETH transfer:
https://etherscan.io/tx/0x7ea52aad9bd16dd39353be31ffb532d7311c474d682ea2a7f378aa8afef5ad8c

Smart Contract ETH transfer:
https://etherscan.io/tx/0xf24b9c6de3f184bc729cf68193122b5d23f4517023824c049439d5e25d69fea6

Thanks

web3.eth.getTransactionFromBlock(i,j).then(function(v){
   web3.eth.getTransactionReceipt(v.hash).then(function(r){

      tokenTransferHash = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
      contractInternalHash = '0xef4c8685c12779a52dae7549eb7defa8523f67a054ad425b877a6b2da469a331'

         for (var k = 0; k < r.logs.length; k++) {
            if((r.logs[k].topics[0] == tokenTransferHash) && (r.logs[k].topics.length == 3)) {

               //Code to Process ERC-20 Token Transfer Data
            }

            if(r.logs[k].topics[0] == contractInternalHash) {

               //Code to Process Internal Contract Creations
            }
         }
   }).catch(function(e) {
        console.log(e);
   });
}).catch(function(e) {
     console.log(e);
});


texts: Will sending same transaction from multiple node increase its chances of going through?

texts:
Will a user have a better chance of winning this game if they send the same transactions from multiple nodes simultaneously  ?

function win( address player, unit bet ) constant returns(bool) {
    require( tx.gasprice <= 50000000000 wei );
    require( now > gameStartTime) ;
    require( endgame == false  );

    if( bet == theanswer )
    {
        endgame = true;
        return true;
    }
    else {
        return false;
    }
}

When testing from two different machines on 2 different networks geth sendTransaction to the contract address returned the same tx id. not sure how that could happen.


texts: How to recover public from tx signature(r,s) and verify signature?

texts:
My first question is how to verify signature using only r,s and elliptic curve paramete, and an address (which is hashed of public key, so cannot retrieve public key from the address)?

Next question is that, why ethereum (also bitcoin I think) uses hashed public key as an address instead of directly use public key as an address?


texts: How can I parse local Ethereum blockchain?

texts:
I need to parse live Ethereum blockchain to retrieve all transactions that belongs to particular smart contract's address.

So my general question is how can I do it properly?

My thought about it so far:

Need to download blockchain on my local machine
Loop thought all blockchain block-by-block and filter transactions against smart contract address that I'm interested in.
Store retrieved information in JSON file.

As far I know, Ethereum blockchain format is LevelDb and I guess it's doable.
Could please help me this my task and point to right direction?


texts: How to Keccak 256 hash in front end JavaScript before passing it to my smart contract

texts:
I would like to build a simple JavaScript (JS) front end that checks if a field submitted is the pre-image of a keccak256 hash I already know in my smart contract. I currently use the following:

Front end JS:

    <script src="https://cdn.jsdelivr.net/gh/emn178/js-sha3/build/sha3.min.js"></script>
    <script>keccak_ = keccak_256;</script>
    <script lang="javascript">
    .
    .
    $("a#call_preimage").click(function(){
                    var preimage = $("input#preimage").val();
                    var hash_ = keccack_(newNumber);
                    var hash__ = '0x'+ hash_;
                    var params = {from:web3.eth.accounts[0]}
                    contractInstance.checkPreimage(hash__, params, function(error, result){...

Solidity:

function checkPreimage(uint256 incoming) public {
 if (uint256(keccak256(abi.encodePacked(known_preimage))) == incoming){
 do_something(); }}
 // known_preimage is of type uint 256 as well

I can't seem to pass the if condition. I'm certain all other parts of the code work.


texts: Approve contract to withdraw funds from users's wallet

texts:
I want to achieve the following flow:

A user clicks a button allowing my contract to spend funds on the user's behalf
A user clicks a second button whereupon funds are transferred from the user's wallet to the contract.

From my understanding this needs to be split up into two transactions.

So i thought something like this would work:

Contract code:

function approve(uint amount) public {
  // Calling this function first from remix
  ERC20(Token_address).approve(address(this), amount)
}

function transferFrom(uint amount) public {
  // Then calling this function from remix
  ERC20(Token_address).transferFrom(msg.sender, address(this), amount)
}

But it gives me gas estimation failiure inside of remix. I suspect this is because i cannot have the contract call the approve() function. It needs to be called from the user whom is approving the contract to withdraw its funds. How can i achieve this if the user isn't a another smart contract but just a person with a metamask wallet?


texts: input argument structure for constructor in remix

texts:
how would the structure for an argument to the below constructor look like in remix?
constructor(
    uint256[5] memory _a,
    uint256[5] memory _b,
  ) public {...}


texts: Getting metamask's pendent transaction count

texts:
I am having problems to get the pending transaction counts on Metamask,

Do you know the method for the web3 API to get this?

I tried web3.eth.filter('pending') but it returns the pending transactions for the whole block and I only want the local instance.

It would be the number 2 on the top right corner:


texts: How does myetherwallet access theblockchain? (technically)

texts:
I am interested to reproduce some functions used in myetherwallet but not finance ones but to allow a user to access certain details based on a wallet.

I checked into the github for myetherwallet but I do not understand exactly how it works.

Does someone know how it can access the blockchain based on a private key? ie what is the query process in terms of blocks, headers, etc on the blockchain? Is there somekind of way to use an sql type of access eg

if walletaddress= "..." then return block-details.


texts:
In a Java project im testing the web3j library. there I have a method that generate a new account to the blockchain

public String url = "http://localhost:7545/";
public Admin admin = Admin.build(new HttpService(url));

NewAccountIdentifier newAccountIdentifier = admin.personalNewAccount(key).send();
String address = newAccountIdentifier.getAccountId();

        if (newAccountIdentifier.hasError()) {
            Error error = newAccountIdentifier.getError();
            int code = error.getCode();
            String message = error.getMessage();
            throw new IllegalStateException(code + ": " + message);
        }

When I generate the user I instantiate a deployed contract from Remix IDE to Ganache Blockchain.

UsersContract userContract = UsersContract.load("0xc85e6e4b979d05a9b5adbac3e0e7d68b632460d1", admin, credentials, new BigInteger("240000"), new BigInteger("2400000"));

TransactionReceipt transactionReceipt = userContract.addUser(address).send();

The account is generated(appear in the remix accounts field) and the Java code arrive to the deployed contract. because I have the following error:

  java.lang.RuntimeException: Error processing transaction request: sender doesn't have enough funds to send tx. The upfront cost is: 576000000000 and the sender's account only has: 0

So I create a method that from the first ganache account(with 100 eth) give to the new account a amount of ether. The method works fine

So the flow that i´m following is:

Create new account
Send eth from a pregenerated account with ether to the new account
Load the deployed contract with the address
When this line execute (TransactionReceipt transactionReceipt = userContract.addUser(address).send();) I get the exception

The main problem is that I can´t understand what´s happend. First I was thinking that the new user dont have ether so can´t complete the transaction. I make a method to give ether and the problem persist. So now im blocked. if I make the transaction without web3j and I call from he Remix IDE the transaction is done and the gas cost is 70853, and not the the 576.... number that return me the Java exception

Other question that I have is that when I load the contract the credential that I load is the new account credential. It has more sense to load always the account that set to default(default I mean the account that deployed the contract, because inside the the contract appear a onlyOwner modifier), or it has sense to load the credentilas of the new address?

Any help?


texts: error: Storage location can only be given for array or struct types

texts:
Getting the error "Storage location can only be given for array or struct types" in a setup function. The exact line is

uint memory _total = 0;

I'm confused by the error, because I'm not trying to use storage, I'm trying to use memory.


texts: Wallet providing seed money of an Ethereum address cannot be viewed on etherscan

texts:
On etherscan, what can be said about an Ethereum address that starts with a non-zero opening balance? we would expect there to always be a blockchain trail for all transactions.
For example, at this address, the first incoming transfer of funds in ETH comes from an UNLINKED address (we normally can click all addresses on etherscan by their link and view its ledger). how is this possible? please list the different ways. Is the source of funds being concealed somehow?


texts: How Do You Send Ether to Another Contract's Payable Function?

texts:
I am trying to send pay a dividend token contract Ether from another contract using the deposit() function in the contract below. I have found conflicting answers based on different compiler versions.

Below is the token contract that accepts deposits which are paid out as dividends:

pragma solidity ^0.4.19;

contract RobustDividendToken {

    string public name = "Robust Dividend Token";
    string public symbol = "DIV";
    uint8 public decimals = 18;

    uint256 public totalSupply = 1000000 * (uint256(10) ** decimals);

    mapping(address => uint256) public balanceOf;

    function RobustDividendToken() public {
        // Initially assign all tokens to the contract's creator.
        balanceOf[msg.sender] = totalSupply;
        Transfer(address(0), msg.sender, totalSupply);
    }

    uint256 public scaling = uint256(10) ** 8;

    mapping(address => uint256) public scaledDividendBalanceOf;

    uint256 public scaledDividendPerToken;

    mapping(address => uint256) public scaledDividendCreditedTo;

    function update(address account) internal {
        uint256 owed =
            scaledDividendPerToken - scaledDividendCreditedTo[account];
        scaledDividendBalanceOf[account] += balanceOf[account] * owed;
        scaledDividendCreditedTo[account] = scaledDividendPerToken;
    }

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);

    mapping(address => mapping(address => uint256)) public allowance;

    function transfer(address to, uint256 value) public returns (bool success) {
        require(balanceOf[msg.sender] >= value);

        update(msg.sender);
        update(to);

        balanceOf[msg.sender] -= value;
        balanceOf[to] += value;

        Transfer(msg.sender, to, value);
        return true;
    }

    function transferFrom(address from, address to, uint256 value)
        public
        returns (bool success)
    {
        require(value <= balanceOf[from]);
        require(value <= allowance[from][msg.sender]);

        update(from);
        update(to);

        balanceOf[from] -= value;
        balanceOf[to] += value;
        allowance[from][msg.sender] -= value;
        Transfer(from, to, value);
        return true;
    }

    uint256 public scaledRemainder = 0;

    function deposit() public payable {
        // scale the deposit and add the previous remainder
        uint256 available = (msg.value * scaling) + scaledRemainder;

        scaledDividendPerToken += available / totalSupply;

        // compute the new remainder
        scaledRemainder = available % totalSupply;
    }

    function withdraw() public {
        update(msg.sender);
        uint256 amount = scaledDividendBalanceOf[msg.sender] / scaling;
        scaledDividendBalanceOf[msg.sender] %= scaling;  // retain the remainder
        msg.sender.transfer(amount);
    }

    function approve(address spender, uint256 value)
        public
        returns (bool success)
    {
        allowance[msg.sender][spender] = value;
        Approval(msg.sender, spender, value);
        return true;
    }

}

My contract works except for this operation. If I were to simple send a random address with: randomaddr.transfer(this.balance); then we have no problems.

However, when I try  TokenContractAddress.call.value(this.balance)(); or I try TokenContractAddress.deposit.value(this.balance)(); the Tx fails.

I have tried importing the contract and some other syntax too, but I get the same error. What is the best way to make it work?


texts:
I am new to solidity and I am trying to implement a simple game involving two players each challenging the other to guess an n-letters word. The winner is the one that guesses the maximum number of letters correctly. Before the game starts each player submits a bid. The winner gets the total amount. Any suggestions on how to approach this scenario? Anyone aware of an existing contract that does something similar so that I can use it to learn from?
Thanks for your help!


texts: double mapping to an array only allows one item?

texts:
I have the following:

mapping (address => mapping (address => uint[])) public allowed;

function approve (address _to, uint256 tokenId) external {
   allowed [msg.sender][_to].push(tokenId);
}

So an address is mapped to an address, which then can bring back an array of uints. However, when testing this code it only seems to work the first time, so the uint array only ever has one item (whatever the tokenId parameter was the first time I called the approve function). No error is given on Etherscan. What could the issue be here?


texts: A smart contract has an enter() function where participants can send 1 Ethereum to enter a raffle. Is there an easy way to stop allowing the others calling this function while the winner is picked?


texts:
Fairly basic question on smart contracts for the community.

So smart contracts "live" on the blockchain at a certain address as EVM bytecode.

When they are invoked they execute a function which may or may not change the state of the blockchain on which they "live".

My question is do the functions of a smart contract only ever alter the state of the underlying blockchain or can they also perform some kind of external function?

A simple example would be a smart contract which transfers ether to a different account (blockchain state update) and then sends an email informing the recipient of the transaction (external function not related to the blockchain)?


texts: Can we determine gas price for a function without deploying it?

texts:
I want to store a document hash on an Ethereum network. I have two options. 1st one is to send the transaction directly through a node js application with input field as the document hash ie,

        const txObject = {
        nonce: web3.utils.toHex(count),
        to: toAccount,
        gasLimit: web3.utils.toHex(estimatedGas),
        gasPrice: web3.utils.toHex(web3.utils.toWei('9', 'gwei')),
        data: web3.utils.toHex(message)
    }`

2nd way is to send it by smart contract:

function notarizeHash(uint256 id, bytes32 documentHash) public onlyOwner noHashExistsYet(id) {
        hashesById[id] = documentHash;

I want to find how much is the gas difference. How can I find the gas required of function notarizeHash without actually deploying it in the main net?


texts: Why is the launch of homestead important?

texts: There seems to be an expectation that the launch of homestead will increase the value of ether and improve the network somehow? What changes are coming?


texts: easier way to debug a NPM truffle project?

texts:
I'm using open zepplin to try to code these forks and contracts and i cant seem to get NPM to configure correctly.
 I have tried all of these types of things.
1. Uninstall and global reinstall NPM and truffle.

Debug, but had no luck.

searched for related questions, on here and can't put my finger on it.

funded the packages,also read the log files.

is there any quick NPM i <example>to try to trouble shoot the issue?
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: webpack@undefined
npm WARN node_modules/react-scripts/node_modules/webpack
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer webpack@"^4.0.0" from file-loader@4.3.0
npm WARN node_modules/react-scripts/node_modules/file-loader
npm WARN   file-loader@"4.3.0" from react-scripts@3.4.4
npm WARN   node_modules/react-scripts
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: webpack@undefined
npm WARN node_modules/react-scripts/node_modules/webpack
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer webpack@"^4.0.0" from html-webpack-plugin@4.0.0-beta.11
npm WARN node_modules/react-scripts/node_modules/html-webpack-plugin
npm WARN   html-webpack-plugin@"4.0.0-beta.11" from react-scripts@3.4.4
npm WARN   node_modules/react-scripts
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: webpack@undefined
npm WARN node_modules/react-scripts/node_modules/webpack
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer webpack@"^4.4.0" from mini-css-extract-plugin@0.9.0
npm WARN node_modules/react-scripts/node_modules/mini-css-extract-plugin
npm WARN   mini-css-extract-plugin@"0.9.0" from react-scripts@3.4.4
npm WARN   node_modules/react-scripts
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: webpack@undefined
npm WARN node_modules/react-scripts/node_modules/webpack
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer webpack@"^4.0.0" from optimize-css-assets-webpack-plugin@5.0.3
npm WARN node_modules/react-scripts/node_modules/optimize-css-assets-webpack-plugin
npm WARN   optimize-css-assets-webpack-plugin@"5.0.3" from react-scripts@3.4.4
npm WARN   node_modules/react-scripts
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: webpack@undefined
npm WARN node_modules/react-scripts/node_modules/webpack
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer webpack@"^4.0.0" from url-loader@2.3.0
npm WARN node_modules/react-scripts/node_modules/url-loader
npm WARN   url-loader@"2.3.0" from react-scripts@3.4.4
npm WARN   node_modules/react-scripts
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: webpack@undefined
npm WARN node_modules/react-scripts/node_modules/webpack
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer webpack@"2 || 3 || 4" from webpack-manifest-plugin@2.2.0
npm WARN node_modules/react-scripts/node_modules/webpack-manifest-plugin
npm WARN   webpack-manifest-plugin@"2.2.0" from react-scripts@3.4.4
npm WARN   node_modules/react-scripts
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: webpack@undefined
npm WARN node_modules/react-scripts/node_modules/webpack
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer webpack@"^2.0.0 || ^3.0.0 || ^4.0.0" from workbox-webpack-plugin@4.3.1
npm WARN node_modules/react-scripts/node_modules/workbox-webpack-plugin
npm WARN   workbox-webpack-plugin@"4.3.1" from react-scripts@3.4.4
npm WARN   node_modules/react-scripts```


texts: Dual mining on phoenix reports higher hashrate, but actual hashrate on nanopool drops to 0

texts:
I just switched from claymore to phoenix, ETH-only mining without any problems (yay!). My setup is 4x RX 580 8GB cards on Ubuntu 16.04.
However, when I activate dual mining: the reported ETH hashrate goes up and the actual hashrate goes to zero.
Here you can see the reported rate from the local API is solid at 115 (up from 100 ETH-only). However the rate reported on nanopool drops to zero...
Here are the entries in the config.txt
-proto 3
-dcoin blake2s
-dpool blake2s.eu.nicehash.com:3361
-dwal 1234567890123456789012345678901234
-dpsw x

Is anyone making a return on any 2nd coin? Should I be bothered to get this to work?


texts: I'm working on an implementation of a blockchain reader that will be operating in a limited environment; as such, I can't use any of the regular implementations. I'm running into issues with implementing devp2p, since the current spec only goes up to version 3, but the major clients all implement version 4. I've found documentation detailing the differences between v4 and v5, but nothing detailing the differences between v3 and v4. Does anyone know if these changes are available anywhere? I'd rather not have to reverse-engineer a cryptographic protocol from its implementations...


texts:
Im running Debian 9. I have successful cloned go-ethereum from source on gitgub, and compiled it with the make geth command in go. I issued the /build/bin/geth command which successfully started the sync.

However, im confused where i would be entering the geth commands in order to create accounts? such as all the commands found here. https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options

How would i go about entering these commands?


texts: Why Can't transferFrom be an onlyOwner function?

texts: Not understanding why this can't and shouldn't be an onlyOwner function. If one had access to the contract, they could easily take tokens from anyone's wallet and transfer it to their own correct?


texts: Balance from ethereum accounts on geth disappears

texts:
I have geth private network with 3 accounts A, B and C.
each account has 100, 200 and 300 ether balance

I connected to this network from Metamask and Transferred the balance of 50 eth from account A to B "Successfully" and it shows in the completed transactions in Matamask. (Result is A: 50, B: 250 C: 300)

Now, when i disconnect from Metamask and stop my geth network AND reconnect again using the geth console, it does not give the expected balance (Result is A: 50, B: 250 C: 300)

However, when i keep the mining in running in background, it shows the expected balance. Can someone please explain why is this behavior.


texts:
I am trying to connect and interact with a local blockchain (using ganache-cli) through the web3js library. I have created a local website that uses web3js library but I keep getting the following error message in my browser console when I try to load the web page.

ReferenceError: require is not defined

web3.min.js:1:636

    <anonymous> https://cdn.jsdelivr.net/gh/ethereum/web3.js/dist/web3.min.js:1

ReferenceError: Web3 is not defined

I am using the following code

<script src="https://cdn.jsdelivr.net/gh/ethereum/web3.js/dist/web3.min.js"></script>


texts: Dealing with multiplying fractions in solidity

texts:
I'm trying to multiply fractions in solidity. Does anyone know of a library or standard contract that provides overflow protection?

I'm assuming that I would have to make the decimal into a fraction first?


texts: How to use solidity assembly to pull out a part of the msg.data?

texts:
I'm attempting to use a delegatecall as a fallback function like so:

function() public payable {
    if (msg.data.length > 0) {
        Log(msg.data);
        require(TRC.delegatecall(msg.data));
    } else {
        revert();
    }
}

However, the Log event here shows that my message data is 0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000044e417a98 when all I want are the last 4 bytes for the method signature, 0x4e417a98. I think I must have to use solidity assembly to pull out these last four bytes but I do not know where to start.


texts: I keep getting the error: "Uncaught (in promise) Error: Invalid number of arguments to Solidity function"

texts:
I have tested it in remix and the function does work, I also removed inputs just for testing purposes but it seems that it doesn't work anyway.

Here is the function:

struct Message{
    string Message;
    int Vote;
    uint timeSubmit;
    bool isImportant;
    uint senderId;
}
Message[] messageArr;
function getMessageString() public view returns(string memory){
        return messageArr[2].Message;
    }

I am calling it in web3.js like this:

  function getString() {
        messageInstance.getMessageString(function(error, result){
          if (error) {
              console.log(error)
          }
          else {
        console.log("yes")

      }})
    }

I am using truffle but it keeps giving me this error.


texts: How can I generate random seed for new account of web3js?

texts: I had created wallet account using web3.eth.accounts.wallet.create(). Now I want to generate random seed for that address. So which method of web3js will be helpful?


texts: How to use balanceOf function with Web3j for an android app

texts:
I am trying to use the balanceOf function after the generation of our smart contract (pakoin) function wrappers in Java with Web3j. Despite trying different ways, I get plenty of errors and I don't know how to solve them.

First of all, I tried doing this way:

BigInteger balance = pakoin.balanceOf(publicKeyUser).send();

result= balance.toString();

However, instead of printing the balance, the app suddenly closes and I have the following error on the console:

  12-30 10:47:55.215 29089-29105/com.daedasan.sgssi_pakos
  E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
  Process: com.daedasan.sgssi_pakos, PID: 29089
  java.lang.RuntimeException: An error occurred while executing
  doInBackground()
  at android.os.AsyncTask$3.done(AsyncTask.java:318)
  at
  java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
  at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
  at java.util.concurrent.FutureTask.run(FutureTask.java:242)
  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
  at
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
  at
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
  at java.lang.Thread.run(Thread.java:761)
  Caused by: java.lang.NoSuchMethodError: No interface method
  getTypeName()Ljava/lang/String; in class Ljava/lang/reflect/Type; or
  its super classes (declaration of 'java.lang.reflect.Type' appears in
  /system/framework/core-oj.jar)
  at org.web3j.abi.TypeReference.getClassType(TypeReference.java:54)
  at
  org.web3j.abi.FunctionReturnDecoder.build(FunctionReturnDecoder.java:99)
  at
  org.web3j.abi.FunctionReturnDecoder.decode(FunctionReturnDecoder.java:42)
  at org.web3j.tx.Contract.executeCall(Contract.java:159)
  at
  org.web3j.tx.Contract.executeCallSingleValueReturn(Contract.java:165)
  at
  org.web3j.tx.Contract.executeCallSingleValueReturn(Contract.java:176)
  at
  org.web3j.tx.Contract.lambda$executeRemoteCallSingleValueReturn$1$Contract(Contract.java:232)
  at org.web3j.tx.Contract$$Lambda$1.call(Unknown Source)
  at org.web3j.protocol.core.RemoteCall.send(RemoteCall.java:30)
  at
  com.daedasan.sgssi_pakos.MainActivity$ReadTask.doInBackground(MainActivity.java:199)
  at
  com.daedasan.sgssi_pakos.MainActivity$ReadTask.doInBackground(MainActivity.java:181)
  at android.os.AsyncTask$2.call(AsyncTask.java:304)
  at java.util.concurrent.FutureTask.run(FutureTask.java:237)
  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
  at
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
  at
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
  at java.lang.Thread.run(Thread.java:761)
  Enviado en:         11:49                                    Enviado
  en:     11:49

Afterwards, based on an example I found online, I tried this way:

BigInteger balance = pakoin.balanceOf(publicKeyUser).sendAsync().get();

result= balance.toString();

This doesn't work either. I get the following exception:

Q: Do you know how to solve this problem or another way to do it?
Thank you in advance!


texts: How can I extract a wallet address from event data?

texts:
I have a contract that returns event data including the sender's address:

event Result(
    address indexed _walletAddress,
    string _name,
    uint256 _amount
)

And in my Node.js app I try to capture the address:

const address = result[0].topics[1];

But for some reason the address contains extra "00000000000000000000000":

0x0000000000000000000000001fcda174c13691ef3c13fcee042e0251452c0f8s

How can I extract the address in the correct form?

0x1fcda174c13691ef3c13fcee042e0251452c0f8s

Any help is greatly appreciated


texts: I am trying to estimate how many of the pre-sale coins are in circulation. What fraction of pre-sale coins have been moved?


texts: Return a struct from a mapping in test truffle

texts:
I want the information stored in each struct inside the mapping.

This is my struct:

struct BurnApply {
    address applicant;
    uint amount;
    string btcAddress;
    uint8 flag;
    uint password;
}

These are the counter(to the mapping) and the mapping:

uint numRequest; //zero initialize value
mapping(uint => BurnApply) burnProcesses;

I want to obtain the values of each request inside the struct. For instance,burnProcesses[1] contain the request number 1 with all the information. How I have to call to the mapping in truffle? Because I´ve tried several ways in order to achieve that but without success. This is urgent... This is the error:

 TypeError: Cannot read property 'call' of undefined

Thanks a lot guys!


texts: How to deploy huge contracts using web3?

texts:
I have a huge contract (which exceeds the default contract code size set in Quorum). I have increased the Code size and Transaction size in the Genesis file to 128Mb. The contract works well when deployed using Remix Browser, but shows BigNumber error when tried to interact with the contract deployed using web3.

Error:

    ERROR BigNumber Error: new BigNumber() not a base 16 number:
    at raise (http://localhost:4602/vendor.js:279788:25)
    at http://localhost:4602/vendor.js:279776:33
    at new BigNumber (http://localhost:4602/vendor.js:278823:28)
    at SolidityTypeString.formatOutputString [as _outputFormatter] (http://localhost:4602/vendor.js:272577:19)
    at http://localhost:4602/vendor.js:273146:25
    at SolidityTypeString.push../node_modules/web3/lib/solidity/type.js.SolidityType.decode (http://localhost:4602/vendor.js:273147:11)
    at http://localhost:4602/vendor.js:272275:29
    at Array.map (<anonymous>)
    at SolidityCoder.push../node_modules/web3/lib/solidity/coder.js.SolidityCoder.decodeParams (http://localhost:4602/vendor.js:272274:26)
    at SolidityFunction.push../node_modules/web3/lib/web3/function.js.SolidityFunction.unpackOutput (http://localhost:4602/vendor.js:275757:24)

Can anyone please help me solve the issue.


texts: I have a thought about the smart contract. I would like to know when the smart contract sends a transaction (send ether to someone) did it sign the transaction if yes how it does? does it have a private key?


texts: Very simply: setProvider is not a function

texts:
I have a very simple contract already deployed to the kovan network

I want to create a very simple web3 interface, so I'm following the truffle webpack metacoin example with the following app.js

import "../stylesheets/app.css";
import { default as Web3} from 'web3';
import { default as contract } from 'truffle-contract'

var abi=[{"constant":false,"inputs":
[{"name":"_value","type":"uint256"}],"name":"setvalue","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"value","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"}]
var contractAddress = "0x8b5fe00cf3cb34caa9c3e968d5b4d96f927d3495"; //on Kovan
var simple = web3.eth.contract(contractAddress, abi);

window.App = {
  start: function() {
    var self = this;
    simple.setProvider(web3.currentProvider);
    self.refreshBalance();
  },

  refreshBalance: function() {
    var self = this;
    var meta;
    simple.deployed().then(function(instance) {
      meta = instance;
      return meta.value.call();
    }).then(function(value) {
      var balance_element = document.getElementById("balance");
      balance_element.innerHTML = value.valueOf();
    }).catch(function(e) {
      console.log(e);
    });
  },

  updateValue: function() {
    var self = this;
    var amount = parseInt(document.getElementById("value").value);
    this.setStatus("Initiating transaction... (please wait)");
    var meta;
    simple.deployed().then(function(instance) {
      meta = instance;
      return meta.setvalue(amount);
    }).then(function() {
      self.refreshBalance();
    }).catch(function(e) {
      console.log(e);
    });
  }
};

window.addEventListener('load', function() {
  // Checking if Web3 has been injected by the browser (Mist/MetaMask)
  if (typeof web3 !== 'undefined') {
    // Use Mist/MetaMask's provider
    window.web3 = new Web3(web3.currentProvider);
  } else {
    window.web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
  }
  App.start();
});

But I'm always getting the message

  simple.setProvider is not a function

and

  simple.deployed is not a function

Any help greatly appreciated.  I'm using truffle-init-webpack@0.0.2


texts: If I download Mist 0.8.1 to a new Windows machine, will it do a fast sync on geth automatically after I set the machine to connect to the ETC chain?

texts:
Alternatively, with Mist 0.8.1 on Windows, will I need to configure it a particular way to get it to do the faster initial sync of the blockchain?

Or will it fast sync automatically?


texts: Creating a transaction from a webform - invalid number of args

texts:
I have a HTML web page where I am feeding user entries into a smart contract that is designed to "store" the entries in transactions. I have most of the application working, but I'm having trouble with the transaction call. I keep getting "invalid number of arguments error" or a type mismatch.

Here is the webform code:

<form class="form-group" role="form">

        ID:
        <input type="number" class="form-control" id="id" placeholder="123">

        Name (First and Last:
        <input type="text" class="form-control" id="name" placeholder="John Stamos">

        Email Address:
        <input type="email" class="form-control" id="email" placeholder="blockchain@gmail.com">

        Comment:
        <textarea class="form-control" rows="5" id="comment" placeholder="I learned..."></textarea>

</form>

Here is the solidity contract code:

pragma solidity ^0.4.15;

contract simpleStorage {
    struct BizCard {
        uint id;
        bytes32 name;
        bytes32 email;
        string comment;
    }

    //sets counter of cards
    uint public count = 0;

    //creates a map of key values where key is an unsigned int and value is an instance of a card
    mapping (uint => BizCard) cards;

    //creates card object; adds data to the mapping and increments the shadow key count
    function createCard(uint id, bytes32 name, bytes32 email, string comment) {
        cards[count] = BizCard(id, name, email, comment);
        count++;
    }

    //constant method to get card information, does not cost gas or change contract state
    function getCard(uint index) constant returns (uint id, bytes32 name, bytes32 email, string comment) {
        id = cards[index].id;
        name = cards[index].name;
        email = cards[index].email;
        comment = cards[index].comment;
    }

    function getCardById(uint id) constant returns (uint idRet, bytes32 name, bytes32 email, string comment, uint status) {
        for (var i = 0; i < count; i++) {
            if (cards[i].id == id) {
                idRet = cards[i].id;
                name = cards[i].name;
                email = cards[i].email;
                comment = cards[i].comment;
                return;
            }
        }
    }
}

Here is the Javascript code via web3:

function createCard() {
    web3.personal.unlockAccount(web3.eth.accounts[0], 'scrubbed');
    var txn = contract_instance.createCard($("id").val(), $("name").val(), $("email").val(), $("comment").val(), { from: web3.eth.accounts[0], gas: 300000 }, function (error, result) {
        if (error) {
            console.log(error);
        } else {
            var txhash = result;
            console.log(result);
            console.log(txn);
        }
    });
}

I am 99% sure that one of the issues is that inputs from "name" and "email" are going in as string, but the contract is looking for bytes32. Not sure how syntactically to recode that. It is also possible that the Jquery I'm using to pull the data from the form isn't working, but I think it's coded correctly

Uncaught Error: Invalid number of arguments to Solidity function
at Object.InvalidNumberOfSolidityArgs (web3.min.js:1)
at c.validateArgs (web3.min.js:1)
at c.toPayload (web3.min.js:1)
at c.sendTransaction (web3.min.js:1)
at c.execute (web3.min.js:1)
at createCard ((index):52)
at HTMLButtonElement.onclick ((index):165)

InvalidNumberOfSolidityArgs @ web3.min.js:1
c.validateArgs @ web3.min.js:1
c.toPayload @ web3.min.js:1
c.sendTransaction @ web3.min.js:1
c.execute @ web3.min.js:1
createCard @ (index):52
onclick @ (index):165


texts: Web3.py cannot connect to geth --dev node via IPC

texts:
I've launched a geth client over IPC:

geth --dev --allow-insecure-unlock --ipcpath ipc://$HOME/Library/Ethereum/geth.ipc

And trying to connect using a Web3 IPC provider:

my_provider = Web3.IPCProvider('ipc://$HOME/Library/Ethereum/geth.ipc')

which doesn't work with the following error:

FileNotFoundError: [Errno 2] No such file or directory

Also I don't see a geth.ipc file in my Ethereum folder after the geth client is launched.


texts: This might be a very general question, though I'd like if someone could clarify on how to within a crowdsale contract use an already deployed token contract with a fixed supply. I know how to create a mintable token internally from the crowdsale contract but I've never played around with an existing token though. Thank you


texts:
I withdrew .22370372 eth from bitstamp to my ledger wallet and the transaction is appearing in "internal transaction". My address is: 0x3088C856fc2DF62839bA8E81d81026D3a36c01a5

What can I do to have these funds appear in my wallet? They have never made it to my wallet. Need immediate assistance please!


texts:
If you add the contract as a pre sale, that will generate the tokens on the network and I can still add the rest of the smart contract before I finalize it. Is this correct?

We want to start issuing the tokens, but the full contract is not done yet.

thanks


texts: Is there any possible method to track geographical location of blocks and transactions in ethereum?

texts: Is there any way I could find the location of the sender and receiver of a transaction through sender and receiver's ID (i.e 0x0000000103026f36d9f2ba6468d2816cd5dce83a) ?


texts: Does Eris Dapps end-users need an Ethereum enabled browser and and their own running node?

texts:
Recently I’ve been doing some research on blockchains and smart contracts. I came across the concept of public, access controled and private blockchains and smart contracts. Ethereum and Eris can be used to develop such kinds of Dapps. But I need some more explanation about this.

In Case of Ethereum, the user of Dapp should have an Ethereum enabled browser like Mist or a browser with Metamask and a local node to interact with Ethereum and the Dapp smart contracts.

So would a user need to run an Ethereum enabled browser and a local node with Eris based access controled Dapps deployed on cloud or only parties that are involved in operationg the Dapp would have to run a node ?

Thanks.


texts: Can we call two contracts in web3.eth.filter method?

texts:
I have two contract address and I want to check events on both in one call.
I mean, can we pass two contract address in one option param like i do below?

let web3 = new Web3();
web3.setProvider(web3Provider);
let options = {
  fromBlock:'latest',
  toBlock: 'latest',
  address: ADDRESS1,Address2
};
let filter = web3.eth.filter(options);
filter.watch(function(error, result){
  console.log(JSON.stringify(result));
});

Or there is any way to combine all events from both contract?