texts: Get latest update time-stamp of contract variable

texts:
Is it possible to get latest update time of contract variable without preserving the transaction hash,

contract Demo{
uint numb;

  function setNumb(uint var1){
    numb=var1
  }
}

in above contract whenever the numb is updated using setNumb(uint), transaction is fired and was saved in some block,  if I want to know the time stamp of block in which the transaction is stored I can get the block by using Transaction hash and easily get the block time stamp,

  But what if I don't know the transaction hash

Is it possible to get the latest transaction time(ie. block time stamp) which updates numb,
Is there any way to get the block/blocks which stores transactions related to numb


texts: The method does not exist/is not available

texts:
web3py 5.15.0

i tried
w3.geth.personal.new_account('pass-phrase')

then get
{'code': -32601, 'message': 'The method personal_newAccount does not exist/is not available'}

then figured out that i need to allow interacting with API's and did in terminal
geth --http.addr https://mainnet.infura.io/v3/<#######> --http.api personal,eth,net,web3,admin,txpool

but still have the same error, what i did wrong? thank you


texts:
I'm a seasoned engineer, but quite new to blockchain technologies.

I'm trying to grasp the "why" and the real "value" of immutable contracts.

Never seen or heard of pieces of software being released & written perfectly at first try.

In my mind, a piece of code/logic that can't evolve, shouldn't be called "smart" contract...

I know that you can have a contract that references another contract and updating that reference to a new contract address kind of gives you an "update" flow.

But, in light of recent events (DAO's contract exploit)...  Am I wrong to see the concept of immutable pieces of logic (contracts) flawed in its premise?

How can the platform be ever trusted by organizations, developers and it's users?


texts: A happy new year to you all. I am trying to make a decentralised application. Everything was going well until I came across a snag. Metamask does not show localhost "7545" which I need to connect the client facing application to the local network. I would be grateful for your guidance in this respect. Thank you.


texts: How can i get the Payable function to send the right amount to the owner address?

texts:
function () public payable {
    uint tokens;

    /// this math isnt safe
    tokens = msg.value * 10;

    /// this didnt give us the address we needed
    address tokenOwner;

    balances[msg.sender] = safeAdd(balances[msg.sender], tokens);
    _totalSupply = safeAdd(_totalSupply, tokens);
    emit Transfer(address(0), msg.sender, tokens);
    tokenOwner.transfer(msg.value);

    }

im trying to grok how to write a function where the contract takes ETH and gives tokens back to the sender of the ETH and send the ETH to the contract owner.
I have to problems

It sent the wrong amount - i sent .1 ETH to the contract and it send me like 10,000,000,000,000 coins or something.

The tokenOwner never got the .1 ETH sent -- neither did the contract.

Any ideas where I went wrong?


texts: Can I split the eth-deposit for running a eth2.0-validator to multiple transactions

texts:
For running a validator one need to deposit 32ETH to a specific deposit-contract on the ETH1.0 chain. My question is, is it possible to split this deposit to multiple transactions (e.g. 4x8ETH)? Furthermore is this possible from multiple addresses?

From my understanding the validator is bound to the deposit-data which need to be send with the deposit-transaction so I presume that a split is possible but maybe I'm missing something.


texts: When is the Receipt's identifier generated?

texts:
Like stated within the question.

When does Ethereum generate an identifier of a receipt which can be used to retrieve the transaction result. Is it generated instantly upon reception of the transaction by a full-node?


texts: Can you implement Sharding in a Blockchain with Proof of Work? And in a Blockchain with Proof of Stake? Thank you for clarification.


texts: With POW, the miners who finds the block chooses the order of transactions in that block. How will this work with POS?


texts:
I have two questions about gas price in Ethereum PoA

1.What if I set the gasPrice as 0 while starting the geth node? will it cause any problem in future.

2.What if I set the gasPrice as 1 while starting the geth node, as sealer nodes will not get any reward but the sealer node will have to pay some ethers for a transaction, so after some time the account will be short of ethers, so how to overcome this problem?


texts:
I have a function in my contract and it have bytes1[4] array parameter and returns.

function foo(bytes1[4] memory _mdata) public pure returns(bytes1[4]){
    bytes1[4] memory result;
    uint8 i;
    for(i=0 ; i<4 ; i++){
        result[i] = _mdata[i];
    }
    return result;
}

And in my truffle test javascript, it have something like..

var myData = [0x01, 0x02, 0x03, 0x1f];
it("test", async() => {
    let instant = await myArithmetic.deployed();
    let result = await instant.foo(myData);
    console.log(result);

I got [ '0x10', '0x20', '0x30', '0x1f' ] Is this because of different endian between javascript and solidty compiler? But why the last one returned correctly??


texts:
The following variables here, assuming solidity 4.24 or later.

mapping(something => something) private yourmapping;

bool private yourbool;

address private youraddress;

uint256 private yournumber;

function dosomething() private {
*do stuff*
}

I see quite a few questions about hiding stuff in solidity. I'm not interested in that. My understanding of private variables is that they do not allow any other contract to call or change those variables, meaning that only the scope within the current contract is allowed to call or modify those variables. Am I wrong?

Further, any links or other information regarding private variables would be highly useful. I have added a private function as well for bonus points. What variables are allowed to be private? What other items can be considered private?


texts:
I've been using this difficulty bomb script, but when I run it... it shows not too accurate predictions. I'm interested on the predictions about how would be the behaviour of the diff bomb since block 200,000 till now.

Any help to fully understand it? why is it taking the hashrate and diff from may 10, 2016?

And yes, obviously I'm a neophyte.


texts:
I am wondering if there is a way to detect forks that may happen to an Ethereum chain. I looked in web3 library, but couldn't find anything.

Any idea?


texts: this.contract.deployed() is not a function

texts:
I'm working on making a React frontend for my smart contract, but I'm having problems connecting it into my React code.

Here are the relevant portions of my code:

import TruffleContract from 'truffle-contract'

...

class App extends Component {
  constructor(props) {
    super(props);

    // Initialize MetaMask plugin
    this.web3 = new Web3();
    const isMetaMaskEnabled = () => !!window.web3;

    if (!isMetaMaskEnabled()) {
      alert('Add the Metamask pluging to your browser to continue');
      return;
    }

    if (window.ethereum) {
      window.web3 = new Web3(window.ethereum)
      try {
        // Request account access if needed
        window.ethereum.enable().then(() => {
          console.log("Accounts now exposed")
        }).catch((error) => {
          console.log(error)
        })
      } catch(error) {
        // User denied account access
        console.log(error).then(() => {
          console.log("unable to obtain MetaMask Account")
        })
      }
    } else if (window.web3) {
      window.web3 = new Web3(window.web3.currentProvider).then(() => {
        console.log("Accounts always exposed")
      }).catch((error) => {
        console.log(error)
      })
    } else {
      console.log("Non-Ethereum browser detected. You should consider trying MetaMask!")
    }

    this.web3.eth.net.getNetworkType()
    .then(function(netID) {
      while (netID !== 'main') {
        // alert('Select Main Ethereum Network in MetaMask')
      }
    });

    this.state = {
      ...
      uAddress: '0x0'
    }

    this.users = TruffleContract(Users);
    this.users.setProvider(window.web3.currentProvider)

    this.users = this.users.bind(this)
  }

  componentDidMount() {
    this.users.deployed().then((instance) => {
      this.setState( {uAddress: instance.address} )
    })
  }

When I try to call deployed() on this.users, I'm getting the error,

TypeError: this.users.deployed is not a function

I know there have been similar questions asked, but they create a contract instance using the abi and contract address, and not using the TruffleContract method. I want to know if it's possible to get this way to work.


texts: "being full node" vs."being sync" : Are they the same?

texts:
When we try to be sync using Parity or geth, Does it mean that we are trying to be a full node ?

And is it correct to say that:

being sync = being a full node = keeping the entire blockchain ?


texts: How to find the number of unconfirmed transactions?

texts: Bitcoin has a mempool with unconfirmed transactions. Where can I find statistics on the size of Ethereum's mempool of unconfirmed transactions?


texts: Get token standard type knowing the contract address and tokenId

texts:
How can I implement code that returns whether a token is in the ERC721 or ERC1155 standard, knowing both the contract address and the tokenId? What I tried is that I call a function that exists only on ERC1155 standard and if it fails then it's obviously an ERC721 token. But this is probably not the best solution.
Any tips?


texts: Deploying ERC20 Contract gives error code -32000: Transaction Underpriced

texts:
I'm trying to create an ERC20 token in solidity and upon hitting "Deploy" it prompts me to enter a Gas Price.
I'm entering 0 as I don't have any ETH in my metamask wallet and this is only for a school project.
Upon clicking deploy, I'm prompted with this error:
creation of SSUERC20 errored: Error: [ethjs-query] while formatting outputs from RPC '{"value":{"code":-32000,"message":"transaction underpriced"}}'
Is there any way to make an ERC20 token and deploy it for free?


texts: When can First Blood 1ST tokens be transferred?

texts: This question was prompted by the reddit question Why have all 1ST token transactions an error? and Error sending transaction to the First Blood crowd sale contract.


texts: Why does sign transaction pops up in cryptokitties?

texts:
I did some web3.js projects and also worked with MetaMask. But I've never seen this window popping up in MetaMask - as it does when signing up for cryptokitties.

Confirm Transaction
Sign Message

MESSAGE
Cryptokitties

What does this mean? Why is this pop up? What permissions do I grant?

Screenshot here:
https://i2.wp.com/blockchaindk.com/wp-content/uploads/2017/12/Cryptokitties-Sign-Message.png?w=346&ssl=1

source:
https://blockchaindk.com/2017/12/05/buy-cryptokitty-cryptokitties/


texts: ERC20 token transfer with a multisignature wallet

texts: I have a multisignature wallet(it is a different contract). I have some tokens to transfer to another address(token is an ERC20 and can transfer via (yourContract.methods.transfer(toAddress, amount)) Multisignature is done by contract similar to (https://github.com/ConsenSys/MultiSigWallet/blob/master/MultiSigWalletWithDailyLimit.sol). Can anyone help how to transfer token(Not ether) ?


texts:
I tried to start a private ethereum testnet on my laptop. Then created 2 accounts and did transaction from the 1st account to the 2nd one.But he balance is not updating in the 2nd account. Here are the following details:

myGenesis.json :

    {
   "config": {
      "chainId": 1998,
      "homesteadBlock": 0,
      "eip155Block": 0,
      "eip158Block": 0,
      "byzantiumBlock": 0
   },
   "difficulty": "400",
   "gasLimit": "200000000",
   "alloc": {
      "7b684d27167d208c66584ece7f09d8bc8f86ffff": {
          "balance": "100000000000000000000000"
      },
      "ae13d41d66af28380c7af6d825ab557eb271ffff": {
          "balance": "120000000000000000000000"
      }
   }
}

I did the following commands in sequence:

geth --datadir ./myDataDir init ./myGenesis.json
geth --nodiscover --rpc --rpccorsdomain "*" --datadir ./myDataDir --networkid 1111 console 2>> myEth.log
personal.newAccount()
eth.getBalance(eth.coinbase)
I got balance 0.
Then I did some mining.
miner.setEtherbase(web3.eth.accounts[0])
miner.start()
eth.getBalance(eth.coinbase)
This gave me 318000000000000000000
miner.stop()

Now I created another account

personal.newAccount()
eth.getBalance(eth.accounts[1])
I got balance 0.

My accounts are:
["0x72b04ad624b90739b68bbdbf0a1387738ef5d6d1", "0x520bb736d6340c4bb2279e6f6f6a2f74b90ac37c"]

Then I sent some ether from 1st account to 2nd one using the following:

var sender = "0x72b04ad624b90739b68bbdbf0a1387738ef5d6d1"
var receiver = "0x520bb736d6340c4bb2279e6f6f6a2f74b90ac37c"
var amount = web3.toWei(0.0000001, "ether")

I unlocked the 1st account:

personal.unlockAccount(web3.eth.accounts[0])

and then did the transaction:

eth.sendTransaction({ from:sender, to:receiver, value:amount });

It returned the transaction hash but the balance is still 0 in the 2nd account(0x520bb736d6340c4bb2279e6f6f6a2f74b90ac37c)

What am I missing here ? or the procedure is wrong ? Please help


texts: I made a transfer of 0.101, but only 0.09308715 arrived

texts:
Where did the missing ethereum go? I payed 0.00088378 in fees, making the total transfer 0.10188378.

So,
Wallet 1: -0.10188378
Fee: 0.00088378
Wallet 2: +0.09308715
Where did the remaining 0.00791285 ETH ~ $1.50USD go?


texts: Say a random node accidentally connects to a bootnote which only lists malicious parties. How is this scenario prevented?


texts: Unable to send ether from one ethereum account to another due to "unknown account" error

texts:
I want to send 1 ether from one account to another. In order to do so, I attach geth to my self hosted local node (that is running on rinkeby) and execute the following command:
> eth.sendTransaction({from: "<my created account with 3 ether>", to: "<the ethereum account that livepeer creates>", value:1000})

I get the following error:
Error: unknown account
    at web3.js:6347:37(47)
    at web3.js:5081:62(37)
    at <eval>:1:20(10)

But when I check the balance of both accounts, both of them exist:
> eth.getBalance("<a/c that livepeer node created on the ethereum>")
0
> eth.getBalance("<a/c with money>")
3000000000000000000


texts: I know we can create a token contract and also we can create a ico contract. Is it possible to create a contract include ICO and Token itself? any idea or example?


texts: Being a distributed computing platform, is Ethereum vulnerable to Meltdown and Spectre attacks?


texts: External functions calling other functions in Solidity

texts: Can External functions call the internal functions, private functions and the public function of the same contract in their body in Solidity?


texts: How to Handle Decimals and Percentages in Solidity

texts:
Decimals and Percentages in Solidity I'm making function about percentage

function setAddress(uint256 newValue) constant returns(uint256){
     // tokenAddress = newAddress;
    // de a = 0.5;
    // decimals b = 0.5;
     value = newValue - 0.06;
     // value = newValue;
     return value;
    }


texts: How can I see the attributes of my smart contract when an "object" is returned?

texts:
Let's suppose I have a simple smart contract defining a person with a couple of attributes (for instance Name and Age) and in another smart contract I have a population (with an array of people). I could have a function to return one person like:
function getPerson(uint _index) view returns(Person){
  return population[_index];
}

And I'll get something like: 0x9e0BC6DB02E5aF99b8868f0b732eb45c956B92dD (what is a Person' object). But, I'd like to see the attributes of that person. How can I do that? I could make a function like this one (I guess):
function getPersonName(uint _index) view returns(string){
  return population[_index].getName();
}

But I don't like this solution. I mean, is there any chance to see the attributes of my Person object having this address 0x9e0BC6DB02E5aF99b8868f0b732eb45c956B92dD?


texts: All My Transactions Since Friday Are Still Pending

texts:
I've been having a real bad time with Mist and the Ethereum Wallet as no transactions at all are getting confirmed are just pending.

My client is fully synced and displays the same block number as shown on Etherscan.

On Friday evening, I created a token contract. I paid a below average amount of gas and was prepared to wait. It's now Sunday and nothing.

On Saturday, I created some more contracts and paid the suggested amount of Wei as well as the highest amount to see if they went through. Today, they're still all pending.

I also tried sending Ether from one account to another several times, selecting different amounts of Gas to see if that works. Still nothing.

The funny thing is, when I sent a transaction from MyEtherWallet to my Waves Ether Wallet using the same account, that transaction went through.

So I know that my wallet can send transactions and that the Waves wallet works, but when I send some more Ether to Waves, but this time through my client, it just pends like everything else.

However when I send a transaction from MEW to another of my accounts on my computer, it just sits at pending indefinitely as well. Strange.

This is my main wallet address: https://etherscan.io/address/0x7b9b1355c33f38be4683a183c194ebb91a289978

You'll see all the pending transactions which I am talking about. Most of those have been like that for well over 24 hours now.

I am able to receive Ether though with no problems.

Any ideas? Should I be worried it will they eventually go through?


texts: How can I get the current user account selected in MetaMask with Web3 js?

texts:
I'm using the next function to get the first account from user's MetaMask:

var account = web3.eth.getAccounts((error,result) => {
        if (error) {
            console.log(error);
        } else {
            return result[0];
        }
    });

However the user could have selected any other account from his MM not just the first one, or switch the account anytime. How to get the current selected account?


texts: Cant send ether from one contract to another

texts:
I have 2 contract

contract A{

uint bidValue;

   address bidder;

   function bid() public payable{

   bidValue = msg.value;

   bidder = tx.origin;

   }

}

And contract B :

import A.sol;

contract B{

  function aBid() public payable{

    A a = A(address);

    a.bid.value(msg.sender);

  }

}

Some how when i call aBid() from contract B and send ether along with it contract A still get msg.value = 0 and tx.origin = address(0).
After checking balance of contract A and B seem like eth value stuck in contract B.

Edit : the problem is the "()" after a.bid.value(msg.sender) but when i add it to my contract the gas fee needed to call that function increase to near infinity. For now all i can do is set gasPrice to 1 so it work like normal :(


texts: What is the zero, empty or null value of a struct?

texts:
If I have a mapping of string => custom defined struct, how do I check if a value is defined in the mapping?

The docs state that "every possible key exists and is mapped to a value whose byte-representation is all zeros".

What is the zero-value of a custom defined struct such that one can conditionally check for its existence?


texts: How to use a variable with an Ether unit suffix

texts:
I have this code in my contract:

require(msg.value == 0.06 ether);

But I want to replace 0.06 with a variable.

So I tried this:

uint256 price = 0.06;
require(msg.value == price ether);

But this doesn't work.

So does anyone know how to combine variables with an Ether unit suffix?


texts: I tried to get Rinkeby test ethers from https://www.rinkeby.io/#faucet. But even though the request is accepted, I am not receiving the ethers in my account. Can anyone suggest some alternative? Is the site down?


texts: How do I access the properties of a contract xyz from an enclosing contract abc?

texts:
With respect to the following code:

pragma solidity ^0.4.23;

contract xyz {
   uint x = 0;

   function setX(uint pX) public {
       x = pX;
   }

   function getX() public view returns(uint){
       return x;
   }
}

contract abc{
    xyz public obj = new xyz();

    function getValueOfObj() public view returns(uint){
        return obj.getX();
    }

    function setValueOfObj(uint pX) public{
        obj.setX(pX);
    }
}

I am working in truffle console and I use:

var abcDeployed = abc.deployed().then((i) => {abcDeployed = i});
var xyzDeployed = xyz.deployed().then((i) => {xyzDeployed = i});
var contractXYZ = web3.eth.contract(xyzDeployed.abi, xyzDeployed.address);
var contractXYZInstance = contractXYZ.at(abcDeployed.obj());

And when I try to call:

contractXYZInstance.getX()
Error: invalid address

How do I access the properties of contract xyz from the contract abc in truffle console or using web3?


texts: Nethereum - Contract not storing passed variables when deployed

texts:
I know it's not a problem with the contract because when I deploy using Etherem Wallet, all the variables are stored as expected. I'm assuming it's how I pass in the parameters using Nethereum sdk.

.Net code:

transactionHash = await web3.Eth.DeployContract.SendRequestAsync(byteCode,senderAddress, new HexBigInteger(900000), new object[] { sd.docTitle,sd.datetimestamp, sd.author });

Through debugging I know the sd.docTitle, sd.datetimestamp, and sd.author is not null and is a type string when passing.

Constructor in contract:

/* this runs when the contract is executed */
function DocumentValidity(string _docTitle, string _dateTimeStamp,string _author) public {
    docTitle = _docTitle;
    DateTimeStamp = _dateTimeStamp;
    author=_author;
}

Any Ideas as to why this is happening?


texts: Web3js Contract deploy never get receipt?

texts:
I am trying to deploy a contract with web3js. The contract will be deployed but I never get to see the address, which should be returned from the promise. Instead I always get an error returned:

  Error: Failed to check for transaction receipt:

Down below my code. For debugging I introduced the event emitters .on:

contract.deploy({
    data: contractBin,
    arguments: [...]
}).send({
    from: ownerAddress,
    gas: 4000000,
    gasPrice: '30000000000000'
}).on('error', (error) => {
   console.log(`Error deploying contract ${error}`);
}).on('transactionHash', (transactionHash) => {
   console.log(`Successfully submitted contract creation. Transaction hash: ${transactionHash}`);
}).on('receipt', (receipt) => {
   console.log(`Receipt after mining with contract address: ${receipt.contractAddress}`);
   console.log(`Receipt after mining with events: ${JSON.stringify(receipt.events, null, 2)}`);
}).on('confirmation', (confirmationNumber, receipt) => {
    console.log(`Confirmation no. ${confirmationNumber} and receipt for contract deployment: `, receipt);
}).then((instance) => {
    console.log(instance);
    let address = instance.options.address;
}).catch((error) => {
    console.log(error);
});

Everytime I deploy a contract the transaction gets send:

  Successfully submitted contract creation. Transaction hash: 0xb87ee45a3249f2079635d987a51cad31adf5eb52f6afd987d07e84ae0d972d92

but in the next step the error of a failed check for transaction receipt appears. The contract gets even deployed as I can see from my geth node:

  INFO [03-09|16:51:12] Submitted contract creation              fullhash=0xb87ee45a3249f2079635d987a51cad31adf5eb52f6afd987d07e84ae0d972d92 contract=0xFEb009a6eB95bc46DEb3F35E0004D36b4b6BC6F9

And I can get the contract address from the transaction receipt:

web3.eth.getTransactionReceipt("0xb87ee45a3249f2079635d987a51cad31adf5eb52f6afd987d07e84ae0d972d92").then(console.log);
yields:

contractAddress : "0xFEb009a6eB95bc46DEb3F35E0004D36b4b6BC6F9"

What am I doing wrong while deploying a contract?


texts: How to attach geth to a local Parity RPC port 8545?

texts:
I'm running parity with the --jsonrpc flag which listens on port 8545 by default.
I'm trying to attach a geth instance, like described in the the docs:

Attach a console to a running geth instance. By default this happens over IPC on the default IPC endpoint but when necessary a custom endpoint could be specified:
geth attach                   # connect over IPC on default endpoint
geth attach ipc:/some/path    # connect over IPC on custom endpoint
geth attach http://host:8545  # connect over HTTP
geth attach ws://host:8546    # connect over websocket

But I get a fatal error:
Fatal: Unable to attach to geth node - Invalid endpoint

This is my tested commands:
 ~ $ geth attach http://127.0.0.1:8545
Fatal: Unable to attach to geth node - Invalid endpoint
 ~ $ geth attach http://localhost:8545
Fatal: Unable to attach to geth node - Invalid endpoint
 ~ $ geth attach ws://localhost:8545
Fatal: Unable to attach to geth node - Invalid endpoint

How to attach geth to a local RPC on port 8545?


texts: We are in the starting phase of Ethereum and Raspberry pi. I came to know from documentation that Ethereum supports Raspberry pi v2. I just wanted to know whether it supports Rasbperry pi v3 model B?


texts: What are the impacts of the Ethereum pre-sale, pyramidal wealth distribution, and mysterious lack of concern within a decentralized financial system?

texts:
As an Ethereum developer, one facet of it I have never understood is its unequal wealth distribution. Unequal wealth distribution makes fees more expensive for everyone because wealth is concentrated in the hands of a few, who can drive up fees for dApp developers. Even for a cryptocurrency, 72 million Eth were mined in its genesis block through a pre-sale -- that's nearly 80% of outstanding Eth, sold at around 40 cents per Ether.

Yet, on the Ethereum wikipedia page https://en.wikipedia.org/wiki/Ethereum, it says that only 13% of the total supply were mined in the initial pre-sale. Why do they say that, when it is on everyone's computers in the actual blockchain? https://etherscan.io/stat/supply. Additionally, I get the feeling that this facet of Ethereum's roots has been "whitewashed" from the internet and within Etherem's companies, because it looks bad on Ethereum and its founders have the wealth to do it. I have never seen an article describing the potential impact of such an uneven wealth distribution within the future of currency.

In my opinion, Ethereum is a great product but it's not suitable as a public currency. Ethereum, like most other cryptocurrencies, is way more pyramidal than any other financial system. Ethereum, in fact, is more pyramidal than other cryptocurrencies.

Imagine if 80% of all US dollars were controlled by less than 100 people, as happened in the pre-sale. Who would ever want to own a currency like that? Regardless of whether you think the pre-sale holders sold, I don't trust an anonymous currency that's price could crash at any time due to one of the founders selling off. Overrall, this is really bad for long-term adoption of Etherem, because people won't want to join an "old boy's club" of pre-existing wealth


texts: Is the range of a FilterQuery inclusive up to ToBlock?

texts:
I'm looking to use this function:

func (ec *Client) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)

but I'm unsure if the range of the FilterQuery is inclusive or exclusive of ToBlock:

type FilterQuery struct {
    FromBlock *big.Int         // beginning of the queried range, nil means genesis block
    ToBlock   *big.Int         // end of the range, nil means latest block
 ...
}

I'm unsure if "end of the range" is inclusive or exclusive.


texts: Writing to IPFS directly from solidity contract

texts: Does anyone know how to add a file to IPFS directly from a solidity contract?


texts: medalla testnet launchpad requires metamask or similar

texts: Following the official Medalla launchpad at https://medalla.launchpad.ethereum.org, at some point you need to connect to a wallet and the only options are MetaMask, Portis and Fortmatic. Why is this so? Why can't I use Geth or similar?


texts:
I need to setup PoS private network with Casper and I cant find any official manual how to do it.
There are only couple links which uses this git repo:
https://github.com/karlfloersch/docker-pyeth-dev

which contains already configured docker files with necessary files.
I would like to know how to do the same, but seems there still no info.

Please advice.


texts: web3js getPastLogs function returns error: query returned more than 10000 results

texts:
I have a local ethereum node and I am trying to filter an event for a contract address between a range of blocks. However it throws the following error:
node:15689) UnhandledPromiseRejectionWarning: Error: Returned error: query returned more than 10000 results
    at Object.ErrorResponse (/mnt/ssd/abi_extraction/node_modules/web3-core-helpers/src/errors.js:29:16)
    at /mnt/ssd/abi_extraction/node_modules/web3-core-requestmanager/src/index.js:170:36
    at XMLHttpRequest.request.onreadystatechange (/mnt/ssd/abi_extraction/node_modules/web3-providers-http/src/index.js:111:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/mnt/ssd/abi_extraction/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22)
    at XMLHttpRequest._setReadyState (/mnt/ssd/abi_extraction/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14)
    at XMLHttpRequest._onHttpResponseEnd (/mnt/ssd/abi_extraction/node_modules/xhr2-cookies/dist/xml-http-request.js:318:14)
    at IncomingMessage.<anonymous> (/mnt/ssd/abi_extraction/node_modules/xhr2-cookies/dist/xml-http-request.js:289:61)
    at IncomingMessage.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
(node:15689) 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:15689) [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.

This was when my toBlock was 9095563 and fromBlock was 8945008. Even when I reduced the block range by a mere 10 blocks, it was returning the same error. My code is below:
const Web3 = require('web3');
const fetch = require('node-fetch');

let infura_url = "https://mainnet.infura.io/v3/853346f695b740fe8bd7d8f583bcf55f"
let web3 = Web3(Web3.IPCProvider("./../.ethereum/geth.ipc"))

const params = {
    address: "0x0e3a2a1f2146d86a604adc220b4967a898d7fe07",
    topics: ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],
    fromBlock: 8945008,
    toBlock: 9095563
};

web3.eth.getPastLogs(params).then(response => {
    console.log(response);
});

Is there a way to bypass this so that I can get more than 10000 results:

For 10 block difference issue
For the range mentioned in the code.


texts: What's going on with the Ropsten network

texts:
What is going on with the Ropseten testnet? The last block(7752138) was mined at 07:24:17 AM +UTC which was, at the time of writing this, 23minutes ago.

https://ropsten.etherscan.io/block/7752138


texts: How to use initialize a bytes array with abi data?

texts:
To initialize a bytes array with the bool value True encoded as ABI data, I'm attempting to do it like this:

bytes memory arr = '0x0000000000000000000000000000000000000000000000000000000000000001';

I can't find anything online on how to do it, can anyone help?


texts: Promise not resolved for web3eth.sendSignedTransaction

texts:
I am testing whether transactions that I'm signing offline are accepted by the Ropsten network. I'm submitting the transactions using Web3.js (web3@1.0.0-beta.51) as follows:

I connect to an INFURA node, and then use web3.eth.sendSignedTransaction. According to the documentation, this should return a PromiEvent. However, the events emitted by the submission are not captured and the promise never resolves. The transaction is submitted to the network nonetheless and is valid (it's a simple transaction sending funds from one non-contract account to another). One can find it in any blockexplorer, like for instance etherscan.

The code in 1 does not behave as expected:

const Web3 = require('web3');
const Tx = require('ethereumjs-tx')

const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/my_Infura_key"));
;
const privateKey = new Buffer(a_private_key_controlling_an_account_with_say_more_than_1_ether, 'hex')

const rawTx = {
  nonce: '0x00', // adjust accordingly if it's not the first transaction by the account
  gasPrice: '0x09184e72a000',
  gasLimit: '0x2710',
  to: '0x0000000000000000000000000000000000000000',
  value: '0x00',
  data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057',
  chainId: 3
}

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

const serializedTx = tx.serialize();

web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex'))
.on('receipt', console.log);

// result: the code simply hangs without printing anything

The code above just hangs, because the promise returned by sendSignedTransaction is never resolved. No event is received either, so the .on('receipt') is never triggered. However the transaction is successfully submitted to the network, and the sender account is debited with around 0.21 ether (the price of the gas since there is no value transmitted). So the problem is not with the submission, but rather with the PromiEvent that web3.eth.sendSignedTransaction returns.

I suspect this problem could be related to an issue of INFURA nodes with events discussed somewhere else, but I don't know if that is the case. I can't check what would happen had web3 been instantiated through a local geth node. At any rate I haven't seen anywhere in the documentation 1 where they mention that PromiEvent only works with certain instances of Web3.

Anyone has any idea of why this behavior is happening?


texts: Neither Token name nor supply shown in etherscan, instead shown "() N/A"

texts:
Recently, I've created an ERC20 token on Etherscan and verify the source code but my token information such as token name and total supply not showing up..Instead  it shows balance: 0 N/a and supply also 0 N/A.Moreover I've done a first transaction of 15 usd..
I've attached the image below.

it's been 1 and half hour now..


texts:
from web3 import *

etherscan_provider = Web3.HTTPProvider( 'https://api.etherscan.io/api')
w3 = Web3(etherscan_provider)

signed_txn = w3.eth.account.signTransaction(dict(
    gas = 2000000,
    gasPrice= 234567897654321,
    nonce=0,
    to='0xABA024480E6B9e92B7e3332a2a3eb104F183D18C',
    value= 100000,
    chainId = 1
),
'0x2850d0xxxxxxxxxxxxxxxxxxxxxxxxxx')

w3.eth.sendRawTransaction(signed_txn.rawTransaction)

Return

File "/root/eth/lib/python3.6/site-packages/eth_utils/conversions.py", line 142, in hexstr_if_str
hexstr_or_primitive
ValueError: when sending a str, it must be a hex string. Got: 'Error! Missing Or invalid Module name'

What's the problem?


texts: Fallback function doesn't get called when sending eth

texts:
With this code, at the creation of the contract (sending some eth in tx), shouldn't the fallback function be called? Then the state variable feedback shouldn't be "Fallback function correctly called"? What am I missing out?
I'm running the contract on Javascript VM.

contract MyToken {

    mapping (address => uint256) public balanceOf;
    string name;
    string symbol;
    uint8 decimals;
    string fallback;

    function MyToken(uint256 initialSupply, string tokenName, string tokenSymbol) payable {
        balanceOf[msg.sender] = initialSupply;
        name = tokenName;
        symbol = tokenSymbol;
        decimals = 18;
        fallback = "Fallback not called!";
    }

    function feedBack() {
        fallback = "Fallback function correctly called!";
    }

    function getFeedback() constant returns(string) {
        return fallback;
    }

    function() payable {
        feedBack();
    }
}

Output of the contract's deployment:


texts:
I am using web socket to get event. sending transaction works fine. but event is not fired.

also I referred Web3 events not working

but it does not work, too.

I used eventemitter also. but it did not work, too. I think there is a problem '.on'. Is there any similar case to me ?

My solidity code is:

event MyEvent(...);

function MyFunction(...) public {
   ...
   emit MyEvent(...);
}

My node.js code is :

const events = require('events');
const WSS = 'ws://localhost:8881';
const provider = new Web3.providers.WebsocketProvider(WSS);
const web3 = new Web3(provider);
const eventEmitter = new events.EventEmitter();

myContract.events.MyEvent({
    //filter: {myIndexedParam: [20,23]},
    fromBlock: 0,
    toBlock: 'latest'
});

eventEmitter.on('data', e => {
    console.log(e.returnValues);
});

eventEmitter.on('error', e => {
    console.error(e);
});

// ...
// sending transaction
// ...


texts: EVM instruction to transfer value from one account to another

texts: When a normal transfer is done (not contracts) from one account (non-contract) to another (non-contract) , is the EVM executed? If so, what is the instruction code that is being run in the EVM at the time of transfer?


texts: Executing contract function from another contract using it's hash

texts:
I am playing arround with smart contracts.
I have 2 contracts: target and executer (don't mind the name, it's just testing stuff).

target has just a simple function to change a string:

contract target {
    string public value = "lol";
    event SetValue(string);

    function setValue(string v) public {
        value = v;
        emit SetValue(v);
    }
}

From executer, I have a function to execute the setValue of target using an abstract and another function to execute setValue using the function's hash.

contract target {
   function setValue(string v) public;
}

    contract executer {

        target public tc;
        address public ta;
        function exeWithAbi(string value) public {
            tc.setValue(value);
        }

        function setAddress(address a) public {
            tc = target(a);
            ta = a;
        }

        function exeWithoutAbi(string v) public {
            require(ta.call(bytes4(keccak256("setValue(string)")),v));
        }

The function exeWithAbi works fine, but the function exeWithoutAbi does not work properly. It changes the value of the string, but sets it to nothing (empty string I think). According to the information provided by Remix (the details tab), the string I pass (setValue(string)) is correct (it is the correct function hash)

Why is the value of my string not being set properly?


texts: distributed mining in ethereum. is it possible?

texts: is there a way to run mining on different nodes for the same network? say I have a network of 3 nodes and i want that three should run miner.start


texts:
I'm using a very simple crowdsale it just sells tokens in ratio 1ETH=10000 tokens

I would like to change this so every day token would be more expensive for example

Day1: 1ETH = 10 000 Tokens
Day2: 1ETH = 9 950 Tokens
Day3: 1ETH = 9 900 Tokens

and so on...

heres the code i use now

pragma solidity ^0.4.18;

interface token {
    function transfer(address receiver, uint amount) external;
}

contract Crowdsale {
    address public beneficiary;
    uint public amountRaised;
    uint public price;
    token public tokenReward;
    mapping(address => uint256) public balanceOf;

    event FundTransfer(address backer, uint amount, bool isContribution);

    /**
     * Constructor function
     *
     * Setup the owner
     */
    constructor(
        address ifSuccessfulSendTo,
        uint milietherCostOfEachToken,
        address addressOfTokenUsedAsReward
    ) public {
        beneficiary = ifSuccessfulSendTo;
        price = milietherCostOfEachToken * 0.0001 ether;
        tokenReward = token(addressOfTokenUsedAsReward);
    }

    function () payable public {

        uint amount = msg.value;
        balanceOf[msg.sender] += amount;
        amountRaised += amount;
        tokenReward.transfer(msg.sender, amount * 10**18 / price);
        emit FundTransfer(msg.sender, amount, true);

        // Forward funds immediately to beneficiary
        beneficiary.transfer(amount);
    }
}


texts:
I have an inquiry about etherscan.

I can check tokens' prices here using Token Tracker.
What I am wondering is how you manage to measure the prices of these tokens.
Where does it get price data and how does it manage to calculate it?

I'm really looking forward to your answers.


texts: Connecting to Ethereum Clients from C application

texts: web3.js is a great library to communicate with client node. I have tried using socket programming from C application to first reach nodejs web app in order to make use of web3.js services to reach a client node, it is not straight forward at all. I would like to simplify the process by looking for a equivalent lib like web3.js to integrate in C, is there any? If not, what is the best practice for C app to communicate with a node?


texts:
I purchase one ether coin and sent it to my wallet stored on my apple computer.  I bought a new computer and had them clone my hard drive and bring everything over to my new mac.

My wallet is on the new computer, but the coin doesn't show up in my wallet.

How do I retrieve this?


texts:
So, I've seen the code of this token:
https://bscscan.com/address/0xa5360c2070faecfc231fd6bd743fe88382f2991d#code
They charge a 10% fee for each tx, 5% of those go to all the people that hold that coin.
I dont understand how they're doing it if there not looping through all the available wallets?
How can that be accomplished without looping which would be very expensive.


texts: Limit Ethereum mining difficulty in a private blockchain

texts:
I am creating a private Ethereum blockchain for the sake of transactions management and storage. I don't care about the consensus part, so I changed the difficulty in the genesis file to 0x1.

I also edited the consensus.go file located under the consensus/ethash/ directory, and built a custom geth binary to limit the growth of difficulty but with no luck. Here's what I changed exactly, I changed the CalcDifficulty() method implementation with the following:

func (ethash *Ethash) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int {
  return big.NewInt(1)
}

The problem is that with every block, the difficulty is increased by one. I tried to change the return value to return big.NewInt(0) but I got an error saying panic: division by zero

I just want to limit the difficulty to 0x1 regardless of how many blocks the chain has.


texts: I have read a lot about Quorum blockchain. My goal is to run and test it. I have found many articles. Could anyone suggest me good start-up articles for setting-up the Quorum on a number of nodes and test it with smart contracts?


texts: Able to Produce Blocks but Still Balance is Zero

texts:
Kindly find the following results below from my Mac Terminal:

miner.start(1) -->
null

miner.stop() -->
null

eth.getBalance(eth.accounts[0]) -->
350000000000000000000

eth.syncing -->
false

eth.blockNumber -->
175

eth.hashrate -->
1232

web3.fromWei(eth.getBalance(eth.accounts[0]), "ether") -->
350

In Etherscan.io does shown the Block Number as per the screenshot but still Why it does not show the Balance of the Mining in this ETH Account? Anything I miss here? I need help again. Thanks.


texts: How to verify MetaMask account holder is the real owner of the address?

texts:
I'm making a dapp that will make calls to a Node.js server. I expect the user to have MetaMask installed and I want to verify that he is the real owner of the current address on MetaMask (i.e. accounts[0]).

This is the user flow I am trying to implement:

User loads up my dapp frontend in his browser.
The browser gets accounts[0] from Web3/MetaMask.
The frontend requests some data specific to accounts[0] from my Node.js API.
On the Node.js server, I need to verify that the request is coming from someone who actually owns the private keys to the address accounts[0]. If this is valid, then I respond with the specific data.

I spent a long time looking at different signing functions with Web3, and I ended up very confused. There is:

web3.eth.sign - there's no recover counterpart to this and MetaMask doesn't pop up asking the user to sign something.
web3.eth.personal.sign - this one requires a password, I don't want to ask the user to enter his password, shouldn't MetaMask do this?
web3.eth.accounts.sign - this seems more like a hashing function than what I need.

I have a feeling that none of the three above functions are what I need. Can someone provide some guidance on how to approach this?


texts: Load an HD (Hierarchical Deterministic) Wallet

texts:
I'm trying to find a way to programmatically generate Ethereum addresses based on an initial seed and then extract any funds that land in those addresses.

Here's what I've tried:

Generated a 24 word mnemonic and seed using Bitcoin::Trezor::Mnemonic.generate
Passed it to digix-geth HD Vault to generate an address: 0xf2D5286B51a8a3326CBC007477435EeC47722228
Sent 3 ether into it using the Rinkeby faucet
Loaded the wallet on MyEtherWallet.com using the seed and derivation path m/0'/0'/0'/0 (the same one that digix-eth uses by default) but the balance is showing as 0. (this gem seems to just be using money-tree underneath)
I've also tried using the derivation path m/44'/60'/0'/0 to match Trezor and setting chain_id = 4, no luck. The wallet addresses that MyEtherWallet offers don't match the ones that the Ruby library generates.

At this point I'm not sure if it's the Ruby library that is faulty, MyEtherWallet that is faulty or I'm just doing something wrong.

What can I try to extract the 3 ether now?

Edit: The addresses that this separate tool is generating match the ones MyEtherWallet are generating. So it's likely a fault of the Ruby library.


texts: Why do the example token contracts give the initial supply to the owner?

texts:
It almost seems necessary to give the tokens to the creater of a token contract all of the tokens.

For instance, in https://www.ethereum.org/token#central-mint

/* Initializes contract with initial supply tokens to the creator of the contract */
    function MyToken(
        uint256 initialSupply
        ) {
        balanceOf[msg.sender] = initialSupply; // Give creator all tokens
    }

I'm guessing the initiallySupply is later subtracted from this owner's balance, but why do this step at all?  Why not just create the initialSupply and leave it there?


texts:
I'm building a contract function that purchases and distributes complete sets of AugurShares for a specific market. (Testing on Rinkeby).

Version of Augur-core (node_modules/augur) used: https://github.com/AugurProject/augur-core

pragma solidity >=0.4.20;

import "./../node_modules/augur/source/contracts/trading/CompleteSets.sol";
import "./../node_modules/augur/source/contracts/reporting/IMarket.sol";

contract BuyCompleteAugurSets {
  CompleteSets completeSetsInstance

  function BuyCompleteAugurSets(address _completeSetsAddress)
  public
  {
    completeSetsInstance = CompleteSets(_completeSetsAddress);
  }

  function buyAugurShares (
    IMarket _market
  )
  public
  payable
  {
    uint256 amount = 10 ** 14;
    completeSetsInstance.publicBuyCompleteSets.value(1 ether)(_market, amount);
  }
}

I call this function through Truffle:

    var res = await contract.buyAugurShares(MARKET_ADDRESS, {value: toWei("1", "ether")});

I double checked and the market is valid. I am able to purchase the complete sets for the given market through Augur.js but I should be able to also purchase these complete sets through a contract function aimed at the CompeleteSets.sol contract. Any clue what might be going wrong?

Failing transactions: https://rinkeby.etherscan.io/address/0x824a064503ba92d54c6e498c0bab6413854fbd6f


texts:
const accounts = await web3.eth.getAccounts()
    //sets the state of the account as a part of the constructor.
console.log(accounts[0])

Id used the above code to display the account information of the user. I have tried with the Main Ethereum network and Ganache, using metamask. Unfortunately, it states the account is undefined. Please help.


texts: Can you use a private Ethereum blockchain network to deploy an actual application for the public?

texts: I am starting to do some research for my blockchain based project and I was wondering if it is possible that I can deploy my project on my very own private ethereum network for actual public use and non testing purpose or do I need to use the main ethereum network or one of the bigger test networks like "Rinkby" etc for deployment?


texts: Mining in private network not giving ether to coinbase account

texts:
I am relatively new to Ethereum. I was trying to set up a private test network. I used the following genesis file:

{
"config": {
"chainId": 15,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"difficulty": "20",
"gasLimit": "2100000",
"alloc": {
"7df9a875a174b3bc565e6424a0050ebc1b2d1d82":
    { "balance": "300000" },
"f41c74c9ae680c1aa78f42e5647a62f353b7bdde":
    { "balance": "400000" }
}
}

The following commands were used to initialise and start the network:

geth --datadir "C:\Users\Mahe\Desktop\Ethereum\data" init "Path_to_genesis"
geth --datadir "C:\Users\Mahe\Desktop\Ethereum\data" --nodiscover --networkid 65535 --port 60303 --rpc --rpccorsdomain "*" --rpcapi "web3,eth,personal,miner" console 2>Node2.log

The network started successfully, after which I created a new account and set it as coinbase. eth.coinbase is set and gives the address of the created account. However, there is no increase of ether in the created account upon mining(eth.getBalance(eth.accounts[0]) returns 0). Any help would be appreciated.


texts: Can't people be tricked into calling approve on an ERC token contract, and having their tokens stolen?

texts:
Most users of Ethereum and ERC tokens probably aren't aware of the existence of the approve and transferFrom functions.

Couldn't users unknowingly call approve on an ERC token contract, and afterwards have transferFrom called from the escrow contract without ever having to actually "send" tokens to anyone.

Users might believe the only way to transfer tokens is to directly send them by entering an amount and calling send, but by calling these functions (approve & transferFrom) the user could have funds taken unknowingly if the user fails to understand what functions they were calling and their purpose.

For examples of possible attacks using approve and transferFrom:

An attacker claims he's distributing an airdrop 1:1 with another ERC20 token, and they need you to send a transaction to the real ERC20 and after send another transaction to their airdrop contract. A victim would think it's a free airdrop, and it's safe because they're not actually ever directly sending coins to anyone, but then in reality the victim would be calling approve on the real ERC20 and tranferFrom from the attacker's smart contract.
If a popular website featuring an Ethereum tool gets hacked, wouldn't it be possible for the hackers to have the users call these two functions and effectively steal funds without the user ever seeing an amount rendered on their screen.


texts: Information/documentation about get data access from smart contract

texts:
I have been reading about giving data access from a smart contract, but I could not find good and precise documentation/information about that. I would like to make a smart contract where a user gives access to its data to another one.

Could anyone explain to me how it works?
Where can I find good information about that?
Is there any example of a smart contract which gives data access?


texts: How to deploying a contract address on the front-end?

texts:
So I'm using web3@0.26.0 to deploy my contract so I can get my contract address from it. And I used it from my backend too and it works. But when I want to implement it on my frontend, I've got an error which says

  (Uncaught TypeError: t.filter is not a function) for this line "let deployContractAddress = MyContract.new({ ... "

via my console on Chrome and also my metamask won't popup to signed the contract deploy. Here is my code :

function deployContract() {
        var r = confirm('Are you sure to deploy this contract?');
        if (r == true) {
            var contractABI = document.getElementById('abi').value;
            var contractBytecode = document.getElementById('bytecode').value;
            let web3 = new Web3();
            web3.setProvider(new web3.providers.HttpProvider(window.web3.currentProvider));

        //define default account[0]
        const address = web3.eth.getAccounts[0];

        let MyContract = web3.eth.contract(
            contractABI
        );

        let deployContractAddress = MyContract.new({
            from: address,
            data: '0x' + contractBytecode,
            gas: '4700000'
        }, function (e, contract) {
            // console.log(e, contract);
            if (!e) {
                console.log('Contract mined! address: ' + contract.address +
                    ' with transactionHash: ' + contract
                    .transactionHash);
                global.newContractAddress = contract.address;
                global.newContractTxHash = contract.transactionHash;
                console.log(
                    'SUCCESS!');
            } else {
                console.log(e);
            }
        });

    } else {
        alert('Contract deploy action has been canceled!');
        return false;
    };
};

So please help me, thank you~ :)


texts:
For infura node, whether the API support send transaction or support sending ERC20 token(this is calling contract actually)? supprt creating accounts also?
For Quiknode, whether the API will support creating accounts and send traction? even sending erc20 token? How to set to port? 8545?
What is the difference for geth node and parity node? Infura is what kind of node?


texts: Deploy multiple instances of same contract

texts:
I am developing a decentralised notary app, using truffle/web3/react. It need to deploy multiple instances of a same contract.

I managed to deploy multiple instances of a contract, MyContract via a registry,  MyContractRegistry.

  const contractRegistry = contract(MyContractRegistry);
  contractRegistry.setProvider(web3.currentProvider);

  contractRegistry.deployed().then(function(instance) {
    registryInstance = instance;

    myArray.map(function(){
        return registryInstance
          .createCertificate(
            params
            { from: issuer }
          )
    });

   });

The above code works, but if the myArray have 10 elements, then Metamask will popup 10 confirmation dialogs. Yes it should and as expected.

So, my question is what is the better approach to the problem above.


texts: Is there any geth -- fast equivalent for pyethapp?

texts: I tried to   " pyethapp run " but I am    " INFO:p2p.peermgr    waiting for bootstrap " for hours. Anything I could try to have the blockchain as fast as geth -- fast for pyethapp? Thanks


texts: voting based on tokens vested in smart contract

texts:
I am planning to build a smart contract and I have a general question about smart contracts before starting to program:

is it possible to build a smart contract that holds ERC-20 tokens where ownership of these tokens is linked to the address that deposited these tokens? I think this one should be possible and quite "easy" to programm
can I program my smart contract so that the owner of this token can use the (vested) token to participate in certain votings or does this always depend on how the other smart contract which would have to be called for voting is programmed? I somehow doubt this is possible

I just imagine how people can use their tokens which are stored in a contract for certain tasks.

Thanks in advance!


texts: Clarification about some scalability terminology

texts:
I am currently reading about the scalability of Ethereum but I cannot really understand the difference between some terms that occur often.

What is the relation between the terms:

Layer 1
Layer 2
on-chain
off-chain
Plama
Sharding


texts: Can transfer ether from a contract to an account, but not to another contract

texts:
Here are two contract functions. The first works fine, the second displays the following error: "Warning! Error encountered during contract execution [Bad instruction]"

function DoTransferToAccount() {
    address objAddress = 0xA7432011366d6b26b4604eD18282cB53F7E07D74;
    objAddress.transfer(.05 ether);
}

function DoTransferToContract() {
    address objAddress = 0x29662dA5D870FFb39201A8320214421eE9fE9D25;
    objAddress.transfer(.05 ether);
}

Here is the javascript that calls the two functions:

myContractInstance.DoTransferToAccount.sendTransaction({from:"0x3d86B4D6f28554428E5AF38490DD1977691A3082"},function(error, result){
    if(!error) {
        console.log("#" + result + "#")
    } else {
        console.error(error);
    }
})

myContractInstance.DoTransferToContract.sendTransaction({from:"0x3d86B4D6f28554428E5AF38490DD1977691A3082"},function(error, result){
    if(!error) {
        console.log("#" + result + "#")
    } else {
        console.error(error);
    }
})

The contract already has a balance, so the functions don't need to transfer ether to the contract.

Why does DoTransferToContract() fail, when it is virtually identical to DoTransferToAccount()?

Here you can see the test transactions that I ran:
https://ropsten.etherscan.io/address/0x272ff5b0ac9dfbbc37e19bf9430f88055f3013e1

This transaction worked:
https://ropsten.etherscan.io/tx/0xc0390a4b179187bb285935e81e447129d31c3f024f1bc1237000a23c1156d518

This transaction failed:
https://ropsten.etherscan.io/tx/0x6029f73b4a4e963e288707a1ce4fe32322ef2e4568b0a180bb99acdc41733352

I get the same error when I use the MetaMask interface to send ether to this contract. Does a contact need to have some special attribute to receive ether?


texts:
I am trying to use truffle along with a MongoDB database which means that I need multiple ports.

For local testing, I have been starting up my RPC, switching the port that the app is listening, and then running nodemon to launch my server for MongoDB. However, this means I have to visit two separate web pages with one running the Ethereum Blockchain side of things and the other only running the MongoDB side.

How can I use both Mongo and Truffle when deploying with AWS?


texts: Gas requirement is infinite for the function

texts:
pragma solidity ^0.5.9;

    contract kyc2{

        bool public isallowed;

        // Structure of customer

        struct customer{
            string custname;
            string custdata;
            bool status;
            uint256 downvote;
            uint256 upvote;
            address custbank;
        }

        mapping(address => customer) public customers;
        address[] public customerarray;

    function addcust(address addr,string memory _custname,string memory _custdata) public returns(bool){

        customer storage cust=customers[addr];

        cust.custname=_custname;
        cust.custdata=_custdata;

        customerarray.push(addr);

        return true;
      }
}

Getting warning as:
Gas costs:
Gas requirement of function kyc2.addcust is infinite: If the gas requirement of a function is higher than the block gas limit, it cannot be executed. Please avoid loops in your functions or actions that modify large areas of storage (this includes clearing or copying arrays in storage)
Pos: 21:4:


texts: Access control of the external resource sold using a DApp?

texts:
I'm trying to create a smart contract in Solidity that the accounts can access the digital content only after paid some tokens.

For example, assuming Account 1 is a buyer and Account 2 is a seller. Account 1 has some external web service to host the data and Account 2 has also some external web app to consume the data.

Account 1 pays some tokens to Account 2 to access some data (the data will be hosted in a Web service app externally, the URL can be stored in the smart contract.)
Account 2 uses Oracle to notify its external web app to encrypt the data using the public key of Account 1 and the private key of itself.
The user of Account 1 can download (maybe a web app) the encrypted data now and decrypted it using its private key and the public key of Account 2.

Is it the right way to do it? It seems cumbersome to encrypt/decrypt the data using public/private keys. And how to get keys if needed?


texts: How to change the state of a variable using a Meteor app and Metamask?

texts:
I try to develop a simple app with meteor and metamask.
I'm trying to change the state of the "name" variable of this contract throught my app :

contract demo{
    string public name = 'Etienne';

    function changeName(string _newName){
        name = _newName;
    }
}

I can read and display the name variable and use it in a helper with

const myContract = web3.eth.contract(AbiArray).at(contractAddress);

Template.home.helpers({
  name () {
    const template = Template.instance();

    myContract.name(function(err,res){
      TemplateVar.set(template, "name", res);
    })

But how do I use my changeName function ? Something like this nothing happens (change-name is linked to a button):

Template.home.events({
  'click .change-name'(){
    myContract.changeName('Pitouf');
},
})

If I exlpicitely say it is transaction, not a call, I get a transaction in metamask, but the name still reads the same :

Template.home.events({
  'click .change-name'(){
    myContract.changeName('Pitouf').sendTransaction();
},
})

I am pretty sure I am using the wrong arguments… but how?


texts: Unable to replicate short-address attack

texts:
I was reading about the short address attack and decided to replicate and test the possible solutions.

What I know about short address attack is if you skip n characters of your address, you end up supplying 68-(n/2) bytes to your transfer function and the evm appends zeros to makes if 68 bytes. And the end result is your value changes by n<<8. This was just a high-level overview.

Now I trid to test the same with a test toke (with decimal places =2) . The transfer function of the contract goes by:

 function transfer(address _to, uint256 _value) {
        require (balanceOf[msg.sender] > _value) ;
        require (balanceOf[_to] + _value > balanceOf[_to]);
        balanceOf[msg.sender] -= _value;
        balanceOf[_to] += _value;
        Transfer(msg.sender, _to, _value);
    }

I used remix connected to my private test-net to check for this attack.

I had an address 0x7ecd024742458287b9cd97015ff265d04a316f20. I called the transfer function of contract with arguments:

transfer("0x7ecd024742458287b9cd97015ff265d04a316f2", 1);

As per my understanding, I was expecting the supplied address will get 256 coins (if short address attack is replicated). But instead I got the error:

  transact to browser/TestShortAddAttack.sol:MyToken.transfer errored:
  Gas required exceeds block gas limit: 6000000.  An important gas
  estimation might also be the sign of a problem in the contract code.
  Please check loops and be sure you did not sent value to a non payable
  function (that's also the reason of strong gas estimation).

Why is the transaction consuming this much gas? Is this issue has been taken care by evm or we need to implement the check (Checking length of msg.data)?


texts: What does this sentence on smart contracts mean?

texts:
Currently reading an article on smart contracts, I came across the following sentences. I don't understand what the bold part means.

  Smart contracts are agreements between parties that do not need an
  intermediary that checks that conditions are met. They facilitate the
  elimination of a third party and the urgency of trust and transparency
  when underwriting legally binds obligations.

Does underwriting here mean signing?

Does the bold part mean smart contracts facilitate the elimination of the urgency of trust and transparency when ... ?

What confuses me most, is that, how come trust and transparency are urgent when underwriting makes obligations legally binding, compared to the case of a smart contract?


texts: What is the best type to store a signature on chain?

texts:
I'm signing a hash and getting a string with 130 bytes.  What is the best way to store this signature later in my smart contract?

Should I just go ahead and split it into r,s, and v and store it in four byte32 vars and one byte2 var or should I use bytes?  Or String?  Which is cheaper?


texts:
I am trying to mine Ether on an AWS spot instances. However I came across two problems.

AWS spot instances aren't persistent, meaning if the instance gets terminated the data inside will be gone.
Geth and ethminer need to be run immediately after startup because you don't want to be paying attention when an instance starts or gets terminated.

Regarding the first problem I followed the instructions from this question on serverfault and now I can make spot instances somewhat persistent, any improvement of this method is welcome.

So this question is focused on the second obstacle. How can I make Geth and ethminer run from from startup, that means every time a spot instance becomes available

What I've done so far is trying to run a shell script at startup by including this on /etc/init.d/ with the following contents:

#!/bin/sh
#NOTE: tmux is a tool similar to screen
#Create a tmux season for geth
tmux new-session -d -s Gethtest
#Create a tmux season for Ethminer
tmux new-session -d -s EthminerTest

#Execute the commands in tmux
#Geth (this starts geth)
tmux send-keys -t Gethtest 'geth --rpc console' C-m
#Make a short pause to let geth sync with the main network
sleep 90
#Ethminer (this starts ethminer)
tmux send-keys -t EthminerTest 'ethminer -G --opencl-device 0' C-m

This script was inspired by this answer posted on stackoverflow which includes more details. Typing the same commands in command line works as expected (first begin Geth and let it synchronize and then start ethminer each within a tmux session). But making it run alone at startup doesn't work as expected, and that means: the script doesn't start neither Geth nor ethminer automatically at startup.

Any help regarding how to simplify, fix and/or improve any of both problems is welcome. Suggesting alternative methods are welcome too.


texts: Sorting elements from mapping according to certain value?

texts:
I have created a function that receive some values from users an store them in a mapping. How to arrange the stored values in mapping according to a certain value ( Priority as in the shown example below)?

 pragma solidity ^0.4.24;

  contract Test {

// storage is packed based on how much data we actually want to store,
// to minimise the storage costs, we're going to use expected uint types
struct StudentType {
    uint8 bonus;        // 0 - 255
    uint16 value1;      // 0 - 65535
    uint16 value2;      // 0 - 65535
    uint16 Priority;    // 0 - 65535
}

mapping (address => StudentType) public studentsByAddress;
mapping (uint256 => address) public studentsByInsertId;
uint256 public studentCount = 0;

function saveNewRecord(address _address, uint8 _bonus, uint16 _value1, uint16 _value2) public {

    // instance of struct student and map it to students mapping;
    StudentType storage student = studentsByAddress[_address];
    student.bonus = _bonus;
    student.value1 = _value1;
    student.value2 = _value2;

    student.Priority = this.calculatePriority( _value1, _value2, _bonus);

    // map address to current insert id
    // ++uint makes our index start at 1 since the incrementation happens before
    // if you want it to start at 0, then do uint++
    studentsByInsertId[studentCount++] = _address;

}

/*

    depending on the precision you actually want the more "zeroes" you're going to use.
*/

function calculatePriority(uint16 _value1, uint16 _value2, uint8 _bonus) pure public returns ( uint16 ) {
    // store the calculation in a big enough value
    uint256 result = ( ( ( 50 * _value1 ) + ( 50 * _value2 ) ) / _bonus ) / 100;

    // convert result
    return uint16( result );
}

/*
    not really needed since you can use the "studentsByAddress" mapping method created by solidity
    unless you want to "hide" or manipulate some data
*/
function get_ESU(address ins) view public returns (uint, uint, uint) {
    return (
        studentsByAddress[ins].value1,
        studentsByAddress[ins].value2,
        studentsByAddress[ins].Priority
    );
}

 }


texts: Running Ethereum Exchange (including ERC 20)

texts:
Would it make sense to run the app server and an Ethereum node on the same machine considering how closely they interact? Or should they be on separate machines to not affect each other?

What is the best approach to assign a dedicated Ethereum address to each user and collect the deposit to a master wallet? We figured that we could not just generate unlimited vanity addresses for deposits like Bitcoin. We want to assign a unique address per user so that we can confirm the deposit is from THAT user,  like exchanges do. But when we follow this approach, the deposits would be scattered as they are not vanity addresses, but real separate wallets, which would result in a lot of fees in the future. Is the only solution deploying a new smart contract that forwards all the deposits automatically to the master wallet?

If you have any ideas, please do not hesitate to advise us.
Thank you.


texts:
It's my understanding that the block reward in Ethereum is 3 ETH, the uncle reward, and "ownership" of the bock. As the block owner, you keep the gas fees for any transactions that you include in your block. Is that correct? If so, how does block ownership work when mining in a pool? Which miner gets to own the mined block?

Thanks!


texts: I finally got my wallet to work. I am just wondering is there a way that I can test to ensure I remember the wallet password correctly? I mean the last thing that I want to send a large number of ethereum to my wallet that I don't remember the password to.


texts: Abigen doesn't create free data retrieval call for public state variable

texts:
I'm looking at an example contract using go-ethereum. In the book, when a go file is created in Store.sol through abigen, the code that automatically gets the Version() string is generated. However, although I tried to follow it as it is in my work environment, only the function that returns transactionOpts is created as follows, and the function that returns Version, which is the actual public variable, is not created. I can't get a sense of what's wrong.
https://github.com/miguelmota/ethereum-development-with-go-book/blob/master/code/contracts/Store.sol
pragma solidity ^0.4.24;

contract Store {
  event ItemSet(bytes32 key, bytes32 value);

  string public version;
  mapping (bytes32 => bytes32) public items;

  constructor(string _version) public {
    version = _version;
  }

  function setItem(bytes32 key, bytes32 value) external {
    items[key] = value;
    emit ItemSet(key, value);
  }
}

https://goethereumbook.org/smart-contract-read/
func main() {
    client, err := ethclient.Dial("https://rinkeby.infura.io")
    if err != nil {
        log.Fatal(err)
    }

    address := common.HexToAddress("0x147B8eb97fD247D06C4006D269c90C1908Fb5D54")
    instance, err := store.NewStore(address, client)
    if err != nil {
        log.Fatal(err)
    }

    version, err := instance.Version(nil) // RETURN String!!
    if err != nil {
        log.Fatal(err)
    }

    fmt.Println(version) // "1.0"
}

// Version is a free data retrieval call binding the contract method 0x54fd4d50.
//
// Solidity: function version() constant returns(string)
func (_Store *StoreSession) Version() (string, error) {
    return _Store.Contract.Version(&_Store.CallOpts)
}

In My Enviroment When i generate Store.go by using abigen
func main(){
    client, err := ethclient.Dial("http://127.0.0.1:8545")
    instance, err := store.NewStore(common.HexToAddress("0xDe5cbCb781AC84039f0317AE45Ac45D9945fc488"), client)
    if err != nil{
        log.Fatal(err)
    }
    log.Println("Instance Loaded Success")

    version, err := instance.Version(nil) // => this returns bind.TransactionOpts!
    if err != nil{
        log.Println(err)
    }
    fmt.Println(version)
}

My environment is as follows:

geth version : 1.9.0
abigen version : 1.9.0
solc version : 0.6.0

How can I get a free data retrieval call for public state variable like that book?


texts: How to return values from dynamic array push function?

texts:
How to fetch value from dynamic array push function? Below is the code of pushing function, but how will I fetching that array values?

contract PushStruct {

  struct MyStruct {
    uint field1;
    uint field2;
  }

  MyStruct[] public myStructs;

  function pushStruct()
    public

  {
    MyStruct memory m;
    m.field1 = 1;
    m.field2 = 2;
    myStructs.push(m);

  }
}

For Example:

function valuereturn() view public returns(uint){
    for(uint n=0;n<myStructs.length;n++){
        myStructs storage f = MyStruct[n];
        return (f.field2);
    }
}

When I am trying to run the above code, getting complilation error (Error : TypeError: Storage location can only be given for array or struct types..) Can you please explain how to figure out this issue? Help will be appreciated.


texts: Can my Ethereum Based Tokens / Coins be traded on a crypto currency exchange?

texts:
I am building my own Crypto based on Ethereum Blockchain. Is it possible for this newly created currency to be traded on any crypto currency exchange?

And secondly, will my new currency be compatible with any normal Ethereum Wallet?


texts: Cheap EC Operations on Unsupported Curves

texts:
I want to be able to verify signatures created by smart meters. Unfortunately, their signature algorithm doesn't use curve ALT_BN_128 but BrainpoolP256r1. I wrote this verification algorithm that requires an inversion, an addition of two curve points, and two scalar multiplications of curve points. The problem is especially the gas cost of the latter.

I wrote a contract for these operations where the scalar multiplication is implemented via a simple double-and-add algorithm. Unfortunately, a scalar multiplication using this method costs between 84'000 and 19'000'000 gas. Originally, I didn't want to write my own contract for that but the only Solidity implementation I was able to find was ECops.sol by orbs-network (https://github.com/orbs-network/elliptic-curve-solidity/blob/master/ECops.sol). Scalar multiplication using this contract is much cheaper (about 623'000 gas), but then there's the minor disadvantage that the results are wrong.

Is there a better solidity implementation out there where I can just plug the right curve parameters in?

I have asked this question on ethresear.ch but have yet to receive any answers.


texts:
I read a lot of sites and answers about uncle blocks in Ethereum, but I did not get it. I am coming from Bitcoin, it is completeley new for me.

Can anyone explain me uncle blocks using a concrete example please?
As far as I understood, uncle blocks are mined or put in blockchain for security reasons ?


texts: Tools for the application development using private blockchain

texts: What are tools/platforms available to develop a common public web application using private blockchain which should support smart contracts? And which one is the best from them?


texts: How to test if a struct state variable is set

texts:
I have the following struct defined as a state variable and conditionally set at runtime.

Transaction private tx;
struct Transaction {
    address to;
    uint value;
    bytes data;
}

I would like to check if the variable was set before executing a specific portion of my code.

if(tx == ??????){
    //do something
}

What's the best way to check if the struct is set?

Edit: It is important to note that here the struct is not stored in a mapping. Similar questions on this stackexchange are asking for structs in mapping, here this is not the case.


texts: How to create and compare a 32 byte hash of a string in solidity 0.5

texts:
I simply want to create a 32 byte hash of a string and compare equality to another one, but this is proving almost impossible for some reason. E.g:

hash("a") == hash("b")

My compiler throws errors if I try to use keccak256: TypeError: Invalid type for argument in function call. Invalid implicit conversion from string memory to bytes memory requested. This function requires a single bytes argument as this only seems to be able to take bytes memory. Hashes created by abi.encode are not comparable with == and are also not of a fixed length it seems so this also doesn't seem to be a solution.

I am new to programming in Solidity, so any help would be great; I am using solidity 0.5.0!


texts: Endless loop emptying an account with Contact Creations

texts:
I made various things with Ethereum and I probably left something strange: now, as soon as I add ether to the account 0x22e1472e3486dd72f4d65e1f6ca7b2f49205fc26 it is emptied automatically with Contact Creations (with an empty contract).

You can see it with any explorer. Here is my last attempt, as seen by Etherscan:

0x07b541ef53a5aa2d3e22cd8bc1a8cb4e2f982be0f76ed8f96dc7774de834cc84  1793620 22 secs ago 0x22e1472e3486dd72f4d65e1f6ca7b2f49205fc26  [Send]   Contract Creation  0 Ether 0.04400132
0x797986800b4a66516f675387952eab5e87be051b38019b6ac55216b4dcb1c6a4  1793620 22 secs ago 0x22e1472e3486dd72f4d65e1f6ca7b2f49205fc26  [Send]   Contract Creation  0 Ether 0.04400132
0xa63c1ce1d68c31e84f2107a5a5c6e936f0cfc45490e00676d675030ec931d5be  1793618 38 secs ago 0xc90cd1fa9940a4d4a07a37c53bb4f423fd286945  [Receive]   0x22e1472e3486dd72f4d65e1f6ca7b2f49205fc26  0.1 Ether   0.00042

When the account is empty, contract creation of course stops, and resumes a few seconds after I add ethers. I tried:

restarting geth
running geth with --cache "0"
checking with ps that no program was running on my machine, sending requests
it does not come from RPC, since it is not enabled

None of these changed anything.

The contract creations have stable characteristics: 2300000 gas units, empty contract, data 0x5b620186a05a131560135760016020526000565b600080601f600039601f565b6000f3 But I don't know how to use these to investigate.

So, I certainly made a stupid mistake but my question is which one? How to investigate such a problem? Where is the ghost?

% geth version
Geth
Version: 1.4.8-stable
Protocol Versions: [63 62 61]
Network Id: 1
Go Version: go1.6.2
OS: linux
GOPATH=
GOROOT=/usr/lib/go-1.6


texts: Sending OMG tokens fails with Bad Instruction

texts:
I'm trying to send OMG tokens using MyEtherWallet's offline transaction and getting an error just like this one: 0x084284cb471d3b413ebbbcc5373f1108e3c084e57529f2cfaf8c490117c1a9d1

The gas limit there was 300k, which should be plenty. I say it should be plenty, because here's what appears to be a transaction just like the above which has succeeded: 0xcbd89114d75a6246ed8060dbd2b042240acc4dd35ed2a0e3e894a30982133503. Its "Gas used by txn" is only 22k.

Is there some way to find out where it failed?

See Geth DebugTrace. This also suggests that it only consumed a tiny bit of gas during execution and then failed.

Also, if it fails with so much gas remaining, why is it charging me full gas up to my limit?


texts: Where to outsource smart contract developers, and how to manage them as start-up's CEO?

texts: If someone has an idea for a DApp, but needs to hire programming muscle, where online can reliable and innovative smart contract developers be found for hire and outsourcing? and what etiquette and guidance procedure should a budding CEO of a start-up be aware of when presenting ideas to these contracted contract developers? i.e. contract negotiation: how to put a price on the Help while not knowing how long it will take them to complete the project


texts: How to prevent callback event occur twice?

texts:
Hi this is my web3 code

events.watch(function (error,result){
            if (error) {
                console.log('Error:'+JSON.stringify(error));
                res.send({'status':0,'message':error});
            }else{
                console.log('Result:'+JSON.stringify(result));
                res.send({'status':1,'message':result});

            }
        });

Here when ever an event occurs it trigger the watch function. But the problem is, it callback the function, twice. How can I prevent this? In every discussion they just said I fixed and closed the thread. What is the solution to stop triggering twice? I'm using web3 0.20.0. Thank you.


texts: How does oraclize deal with chain reorg?

texts:
As title, does oraclize deal with the case where the query transaction and callback transaction are executed in different side chains?

I mean in this situation:

A-B
  \
   B'->C->D->....'        canonical

Can such case happen that the query transaction are executed in block B while the callback transaction are in block B' ?


texts: Why is my metamask transaction failing even if I set a high gas limit?

texts:
Below is a failed transaction. i set the gas limit to double of what it normally is, but it still failed. How can one figure out the correct gas limit, if the auto settings don't even work.

Why does this even happen?


texts: It might be a trivial detail, but whenever I succesfully mined a block the pickaxe symbol is replaced by '▯▯' in Windows 10 cmd. Why is this? And is there a way to fix it?


texts: How does Ethereum avoid mining pool centralization?

texts: As a proof-of-work (PoW) based blockchain, how does Ethereum combat mining pool centralization, which can lead to an entity controlling the majority of hashing power?


texts: How fast should be an internet connection to mine ETH?

texts:
How fast should be an internet connection to mine ethereum and don't have connection issues? What about ping?

And, how many GB of data would get downloaded over a month period? I have a 250GB limit.


texts: What various components are needed to trigger an Ethereum contract?

texts:
From what I understand, you must provide Ether so there's an incentive for miners to run the contract, but what else is provided?

Must you sign cryptographically (to make sure an unrelated party doesn't trigger it?)
Any other data or variables required?

Trying to understand from a process/business perspective rather than a technical one.


texts: Are tools like metamask putting decentralization in danger?

texts:
Does a tool like metamask, which connects your browser to a public ethereum node to simplify running DApps, put the basic idea of decentralization and trustless blockchain verification in danger?

Is a decentralized app running through metamask still to be considered decentalized?

How is the ethereum node chosen, which hosts the nodes and how can a user trust it?


texts:
Has there been any research on multi-party payment channels? That is: A payment channel between 3 or more people.

"any research" includes but is not limited to:

considerations of the concept of such payment channels existing
compilations of associated advantages and disadvantages
compilations of associated problems
considerations of routing through a network containing such payment channels
implementations of multi-party payment channels
implementations of routing through networks of multi-party payment channels


texts: Restoring a mnemonic seed with one missing word

texts:
I wrote my seed with one missing word (do not know exact position).
Do you know any tool for recovering ethereum wallet? I found this one, bus its for monero. https://github.com/amustafa/recovering-incomplete-monero-mnemonic (this one is for monero)
Next I found this checker. https://zengo-x.github.io/mnemonic-recovery/src/index.html
What do you think about that? Is it clear ?
Or is there any other way how to find one seed word? Checksum?


texts:
I know how to start mining and open ipc port seperately. First I unlocked my account using geth --datadir "ethereum/node1" --unlock ffc4136c8dd4ee4efb10ea954d65ad032ad86834 --password ethereum/password.txt

Now I have unlocked my account and I have some ether that I have mined previously, now I want to put it in testing. So when I try to open ipc using geth --datadir "ethereum/node1" --port 30301 --networkid 1234 --rpc --rpcport "8545" --rpccorsdomain "*" it always shows datadir already used by another process.

I want to open this port with unlocked account so I can using it. I don't want to use console commands because my server will time out after some time and it will close the console automatically.  How can I achieve this? Can some one help me in this? Thank you.


texts:
For some reason Event Names associated with transactions to my contracts aren't being shown in their Event Logs on Etherscan. Worth noting, this event in particular is not indexed.

Any thoughts as to why they aren't displaying like they are for this transaction?

Appreciate your help.


texts: Not able to run a github project related to blockchain

texts:
https://github.com/itsPiyushMaheshwari/SDV
please help me to run this Github, a blockchain-based data verification system, project.I am trying hard but facing problems. the functions are not working.


texts: Does a PoA based permissioned blockchain relies on cryptocurrency as tokens?

texts:
I am studying different categories of blockchain.

Since the validator nodes are pre defined in the PoA based blockchain, and also mining is not required to determine the next valid block.

Is it required to have a cryptocurrency as tokens in the PoA based blockchain? If yes, what is it's role?


texts: My ether was automatically sent to different address without my permission

texts:
My ethereum account is 0xfAd956B56be1298ee8ec1950cc305B46268d926f (generated by metamask) and the moment friend of mine sent me an ether, it was automatically directed to another account. This is the transaction hash

0xd451bee48418fff2e728d321e2c62a1bd2f38dd21788621395f72a7ad371de0f

What is the issue here? I am just utterly confused.


texts: Keep private data in contract and manage access

texts:
Is it possible to keep data in a contract, in a similar way that we can create wallet contract? Wondering if it would be possible to keep that and then manage the access to this 'hidden' data according to some other piece of code in the contract.

Higher level here is that I would to implement an mvp for an application where one would, be able to have a guarantee that the user it sends funds to has x or y piece of data in his wallet. Still unsure ethereum is best bet, but inquiring because of the facility of potentially implementing on test network with web3 on nodejs app.

Would appreciate ideas or places to get some more info!


texts: Assigning addresses while publishing contract in Solidity

texts:
I was recently viewing a DApp on GitHub. The following is a part of .sol
    address contractOwner;
    address withdrawWallet;

    function contractName(address _contractOwner, address _withdrawWallet) {
        require(_contractOwner != address(0));
        require(_withdrawWallet != address(0));

        contractOwner = _contractOwner;
        withdrawWallet = _withdrawWallet;
    }

When I publish the app, am I supposed to assign values to contractOwner, and withdrawWallet? Something like
address contractOwner = "0xc0f ... legit wallet address";
address withdrawWallet = "0x00010dB ... legit wallet address";
function contractName(address _contractOwner, address _withdrawWallet) {
    require(_contractOwner != address(0));
    require(_withdrawWallet != address(0));

    contractOwner = _contractOwner;
    withdrawWallet = _withdrawWallet;
 }

2_deploy_contract.js contains
  const owner = accounts[0];
  if (network == "live") {
    const withdrawWallet = "0x00010dB ... legit wallet address";
    deployer.deploy(contractName, owner, withdrawWallet);
    return;
  }

Thanks a ton.


texts: Input Parameter for callback function Web3

texts:
I want to send the parameter to the function in smart contract i tried different ways but it keeps giving me error.

My solidity file is

 pragma solidity ^0.4.18;

 import "./ConvertLib.sol";

 contract Check {
 function multiply(uint a) public pure returns(uint){
    return a*a;
 }
}

I connected to Web3 sucessfully and created the instance of contract as inst. When i try to execute the function

 console.log(inst.multiply.call()(function(err,result){console.log("r-->"+result);}));

it gives me error

Invalid number of arguments to Solidity function

and if i add argument like this

console.log(inst.multiply(2).call()(function(err,result){console.log("r-->"+result);}));

or like this

console.log(inst.multiply.call(2)(function(err,result){console.log("r-->"+result);}));

it gives me this error

Error: The MetaMask Web3 object does not support synchronous methods like eth_call without a callback parameter.

I am using Web3 version 0.20.3


texts: Installing ethereum node on Raspberry pi errors

texts:
I have been following the steps of this guide: http://raspnode.com/diyEthereumGeth.html

but i get stuck on the "make geth" command, where my RPI outputs this error:

build/env.sh go install -v -ldflags '-X main.gitCommit c541b38fb36587d23c60f5e2f2b9b3c8700ec489' ./cmd/geth
github.com/ethereum/go-ethereum/core/types
# github.com/ethereum/go-ethereum/core/types
build/_workspace/src/github.com/ethereum/go-ethereum/core/types/transaction.go:39: undefined: atomic.Value
build/_workspace/src/github.com/ethereum/go-ethereum/core/types/transaction.go:40: undefined: atomic.Value
build/_workspace/src/github.com/ethereum/go-ethereum/core/types/transaction.go:41: undefined: atomic.Value
Makefile:17: recipe for target 'geth' failed
make: *** [geth] Error 2

What could be wrong ?!

EDIT

after usign the updated git repo here is the erro i get:

build/_workspace/src/github.com/ethereum/go-ethereum/internal/build/azure.go:23:2: cannot find package "github.com/Azure/azure-sdk-for-go/storage" in any of:
        /usr/lib/go/src/pkg/github.com/Azure/azure-sdk-for-go/storage (from $GOROOT)
        /home/pi/bin/go-ethereum/build/_workspace/src/github.com/Azure/azure-sdk-for-go/storage (from $GOPATH)
build/_workspace/src/github.com/ethereum/go-ethereum/internal/build/pgp.go:27:2: cannot find package "golang.org/x/crypto/openpgp" in any of:
        /usr/lib/go/src/pkg/golang.org/x/crypto/openpgp (from $GOROOT)
        /home/pi/bin/go-ethereum/build/_workspace/src/golang.org/x/crypto/openpgp (from $GOPATH)
Makefile:15: recipe for target 'geth' failed
make: *** [geth] Error 1


texts: Is it possible to create a transaction without contract?

texts:
I have been requested to create a demo for sending transactions using Ethereum and nodeJS, I am new to this cryptocoins world so I have some doubts:

I need to do transactions without using contracts. Most information
I have found uses contracts. is that possible?

So far I have found web3js library to connect to a local node:

var web3 = require('web3');
var w3 = new web3(new web3.providers.HttpProvider("http://localhost:8545"));

I Also have found previous questions with examples to
sendTransactions but they use Contracts:

https://ethereum.stackexchange.com/questions/25839/how-to-make-transactions-using-private-key-in-web3

I need to estimate the fee to for the transaction. When working with Bitcoins, there were pages like: https://bitcoinfees.earn.com/api/v1/fees/recommended which give you a price per byte, then you got the amount of utxos to cover the transaction and used that for getting the transaction size which multiplied by the fee per byte gave you the estimated fee.

I read in ethereum you use a different currency for transactions than for fees (ether and gas) how to I calculate it? is there an api?

Thanks in advance for your help.


texts: converting string and int to bytes32 and vice versa doesn't return same value

texts:
I am trying to send a set of values, which contain 3 strings and 1 integer, as a bytes32 array to a function. The original values that I want to convert to bytes32 were
["maham",67,"Silven","first token", "image url"]
. I convert these to a 66 hexadecimal string and passed the following array instead
["0x6d6168616d000000000000000000000000000000000000000000000000000000","0x4300000000000000000000000000000000000000000000000000000000000000","0x53696c7665720000000000000000000000000000000000000000000000000000","0x666972737420746f6b656e000000000000000000000000000000000000000000","0x696d6167652075726c0000000000000000000000000000000000000000000000"]

Now I want to convert these hexadecimal strings back to string and my code is as follows:
function drawCard(string memory _tokenURI, bytes32[] memory params) public {
        uint _check  = uint(params[1]);
        entered_supply = _check;
        require(_check<total_supply,
        "Input supply is not less than total supply of cards.");
        _tokenIds.increment();
        uint256 newNftTokenId = _tokenIds.current();

        Cards memory c;
        c.name = string(abi.encodePacked(params[0]));
        check_name = c.name;
        c.supply = _check;
        c.cat = string(abi.encodePacked(params[2]));
        c.description = string(abi.encodePacked(params[3]));
        c.image_url= string(abi.encodePacked(params[4]));
        c.card_id = newNftTokenId;

however remix shows the following values after conversion back to string

Please tell me how can I convert the hexadecimal strings back to original strings and integer value.


texts: How to make installation of etherdelta smart contract

texts:
this is the following smart contract
https://github.com/gochainwallet/forkdelta.github.io/tree/master/smart_contract

The question is how to build and get the bytecode?
The other thing using .sol and remix i could build my own smart contract to receive the fees of coins?


texts:
I am really keen to buy some DAO before Saturday and I need to open an Ether Wallet.  The problem is (a) downloading it is taking days with little progress and (b) understanding it all is well HARD...Can someone please explain this to me very simply....

Cheers Stretch


texts: How to generate a seed for multi-currency wallet?

texts:
I am developing a mobile wallet that supports multiple currencies (including Ethereum). As of now, it only supports one currency. The RPC wallet creation  function for this currency returns a private key and public key for that currency wallet.

When I add more currencies (like Ethereum), I will have multiple private keys/public keys and would like all of them linked to a mnemonic/seed.

How would this be done? Can I create a custom seed and add private/public key pairs to it?

Or can I use my already existing private/public key pair to generate a seed?


texts:
I have created token also its live on BSCSCAN , how I can start trading on it.
I tried via pancakes but there I have to deposit BNB for LP is there any other way?


texts:
Does anyone know how long events can be retrieved for?

I have events on the Kovan contract at 0x86e5b6d7648b8b994886aeb98e2b4770675e608d and it appears I can no longer retrieve events older than 14 days?

The code I'm using is as follows. Both get and watch are not retrieving events that are older than 14 days. I don't have anything in between today and 14 days, so I don't know if it stopped retrieving events older than a few days, or if there's a limit.

Thanks in advance for any help.

UPDATE: Ok, it seems the issue was that Parity had a different meaning of "fully sync'd" than I thought. If you see a line such as

  2017-11-02 15:31:11    #4098136   23/25 peers    301 MiB chain   83
  MiB db  0 bytes queue   10 MiB sync  RPC:  1 conn,  3 req/s, 142 µs

in the console output, then what it means is that Parity hasn't fully downloaded all the logs yet, and it has only downloaded the logs for block 4098136 (in this case), even though you see

  2017-11-02 15:31:13  Imported #4569744 1c13…0e14 (0 txs, 0.00 Mgas,
  0.81 ms, 0.57 KiB)

let ContractAddr = "0x86E5b6D7648b8B994886aeB98E2B4770675e608D"; // on Kovan

    optionsShout = {
      fromBlock: 4289879,
      toBlock: 'latest',
      address: ContractAddr,
      topics: [web3.sha3('__Shout(string)')]
    }

    let filter, w;

    function getLogs() {
      var filter = web3.eth.filter(optionsShout);
      console.log("getLogs...");
      filter.get(function(error, event) {
        if (!error) {
          console.log("Event: " + event);
        } else
        {
          console.log("Error: " + error);
        }
      })
    }

    function startFilter() {
      console.log("Starting filter");
      filter = web3.eth.filter(optionsShout);

      filter.watch(function(error, event) {
        if (!error) {
          if (event.blockNumber > optionsShout.fromBlock) {
            optionsShout.fromBlock = event.blockNumber;
            displayEvent("event1", event);
          }
        } else
        {
          console.log("Error: "+error);

        }
      })
    }


texts: How can we use refunded GAS from a transaction in subsequent ETH transfers? In general, how is refunded GAS used? How can we check the status of the amount of refunded GAS?


texts:
I'm currently trying to reenact a random transaction and I've come across a weird call to 0x0000000000000000000000000000000000000002. Even weirder, this call seems to actually do something since the memory at address 0x60-0x7f is changed afterwards.

Can someone explain what is happening here?

Here's a link to the remix debug trace. It's instruction 2610.