texts: How to calculate current DAI Savings Rate

texts:
I have read the documentation on the topic but still don't get how I can calculate the current DAI Savings Rate myself.

The current dsr value is stored in the pot contract. At time of this writing it amounts to 1000000000000000000000000000. I think I have to divide this value by the RAY, which is a 1 followed by 27 zeroes (1000000000000000000000000000). So the dsr and RAY are equal at the moment.

Next, I have to take the result of this operation (which is 1) and power it to the number of seconds per year (31536000). Obviously this equals to 1 again. So does this mean the current rate is set to 1 percent? It should really amount to zero at the moment.

Another problem I have with this calculation is that once the dsr changes to a weird value, then taking the power of seconds per year might take a really long time to calculate.

Where is my mistake here?


texts: Web3: new BigNumber() not a number: [object Object]

texts:
I have the following Solidity code:

uint public roundNumber;

struct Lottery {
        uint256 ticketsSold;
        uint256 winningTicket;
    }

mapping (uint => Lottery) public lotteries;

And want to call for example lotteries[roundNumber].ticketsSold in Web3.

I have the following javascript code (using Web3):

var roundNumber;

contractInstance.roundNumber.call().then(function (result) {
              roundNumber = Number(result);
              console.log(result + ' is the result'); // returns "0 is the result"
          })

contractInstance.lotteries.call(roundNumber).then(function (result) {
              console.log(result[0].toString()); // tickets sold
              console.log(result[1].toString()); // winning ticket
          })

This results in the following error:

  new BigNumber() not a number: [object Object]

If instead of contractInstance.lotteries.call(roundNumber) above I just do contractInstance.lotteries.call(0) there's no error, so there's an issue with the roundNumber variable (even though I've verified it is 0 and is of type Number).


texts:
function transfer(address to, uint tokens) public returns (bool success) ;
     uint256 public max_contribution = 50 ether;
    uint256 public min_contribution = 0.1 ether;
    require (msg.value >= min_contribution);
    require (msg.value <= max_contribution);
    balances[msg.sender] = safeSub(balances[msg.sender], tokens);
    balances[to] = safeAdd(balances[to], tokens);
    emit Transfer(msg.sender, to, tokens);
    return true;
}

  ParserError: Expected identifier, got 'LParen'
          require (msg.value >= min_contribution);

Which identifier should i put after "require"?


texts: Reading values from a contract: When do I need transactions?

texts:
Since reading on the Blockchain does not need performance of other nodes, I wonder how I can get values from a Smart Contract without any transactions. I have created a little example contract:

contract Test {
    uint x;

    function Test() { //to init the contract I definitely need a transaction
        x = 0;
    }

    function inc() returns (uint) { //here I need a transaction too since I change the value
        x = x + 1;
        return x;
    }

    function get() returns (uint) { //I am not sure what is about this function
        return x;
    }
}

I want to check my understanding and have some questions:

Which functions need a transaction to trigger?
Do I even need a function to get a value from a smart Contract when I am a full node? Couldn't I just read it?
What happens when inc() is called with a transaction but not inserted
in a Block and I read an old value? Is this an important point or can
it be ignored?
When do I get a/the return value? Instantly or when the transaction in placed in a block?

I appreciate any answers :)


texts: I have ERC20 fixed amount token, And I want to deploy pre-ICO crowdsale and later ICO crowdsale contracts.  How do I make sure that no one else deploy crowdsale on my token except me?


texts: Why is web3.eth.subscribe not a function?

texts:
From the web3 documentation I use this code sample:

var subscription = web3.eth.subscribe('logs', {
    address: '0x123456..',
    topics: ['0x12345...'] }, function(error, result){
    if (!error)
        console.log(log);
});

and I got this error:

TypeError: web3.eth.subscribe is not a function

is "subscribe" deprecated ? Is there a replacement for it ?


texts: Why do Solidity examples use bytes32 type instead of string?

texts:
In many Solidity examples I read that use strings for parameters or return values, I see they are typed as bytes32 although there's a string type. What is the real reason for that?
Thanks.


texts: Why do some empty blocks have rewards more than 5ETH?

texts: I'm mining on the testnet and I noticed that the reward is more than 5 (near to 5.2) Ethers for some empty blocks I mined. I thought the reward was 5 + tx. fees. How can an empty block have a reward more than 5 Ether?


texts: DAG size (Win 10) vastly larger than expected

texts:
Last night, I updated to a much newer version of the Mist Ethereum wallet than when I last used it (0.2.6 to 0.8.9) about 1 year ago, and from everything I've read on DAG size, it's using far more space than it should be (which is why I was never able to run it off my SSD previously - it would eat 10+ GB and get too close to the 90% mark of my puny 128GB boot drive, and I'd have to cancel it).
Last night, I finally figured out 'mklink', and the DAG is happily syncing away, thinking it's in %appdata% when it's actually being pointed to a spot on my spinning disk drive.
The wallet app seems fine with this.  It recognized right where I was as far as the last time I synced the DAG, and proceeded from there (I had just under 1M blocks to go, as of 4 hours ago).  I made a note of how much free space I had when I began the sync process, so I'd know how much it was taking up.
Fast forward to now:   When I wrote it down, I had 360GB free on the HDD I'm using.  As of now (75.7% sync), I'm down to 337GB free, or around 23GB of DAG.  Accordingly, the 'chaindata' folder it is syncing to is exactly 30GB at time of writing (7GB having been downloaded 1 year or more ago).
This is the same behavior I was seeing before relocating the DAG using mklink, so I don't believe that has a anything to do with it - in fact, I haven't ever had a fully synced DAG on my PC (only my mining rig, over a year ago when it was much smaller), because it would never fit on my paltry remaining SSD space.
If it helps diagnostically, the 'chaindata' dir contains 16,060 items (and counting), each approx. 2MB, and starting chronologically with 047061.LDB (in 2016), up to the present 191120.LDB (quickly being usurped by newer files).
Any ideas?
Thanks very much,
-Aaron
Edit:  Sync now 86% complete, /chaindata up to 36GB
Edit2: Sync now 98% complete, /chaindata up to 43GB


texts: Preventing Ether getting trapped in Smart Contracts

texts:
Since contract code can possibly live forever once deployed, what are some best practices or patterns to use in Smart Contract development to prevent the potential for unintended loss of Ether or loss of owner control of the contract?

For example, should contract code always include a suicide call to return funds to the owner?


texts: ERC standard: possible to set upper price limit for NFT?

texts:
Let's say I want to create a non-fungible token which represents a ticket to a venue. And I don't want ticket scalpers to buy tickets and resell these tickets for a higher price. It should only be possible to resell the ticket for the same or a lower price.
Does an ERC standard exist where one can set the maximum reselling price?
If not, how could this be achieved?
The best way I can think of right now is to copy the ERC721 contract and modify the transfer function. But then I lose all the benefits from ERC721 compatibility...


texts: What is the ether-pudding / truffle-artifactor front end?

texts:
I am trying to figure out how to interact with a smart contract deployed through truffle. I am looking at the truffle documentation here.  They are describing how to call a function in a deployed contract, and they write:

  Now let's look at the Javascript object called MetaCoin provided for us by Truffle and Ether Pudding, made available within our frontend:

  Print the deployed version of MetaCoin

console.log(MetaCoin.deployed());

  outputs:

  Contract

  address: "0xa9f441a487754e6b27ba044a5a8eb2eec77f6b92"
  allEvents: ()
  getBalance: ()
  getBalanceInEth: ()
  sendCoin: ()

I have no idea how to recreate this, because I don't know what they mean by 'available within our frontend'. What frontend?


texts: Can I check for transactions in an Uncle Block?

texts: I am writing a script which will crawl through all the transactions in each block one by one, and identify deposits made to a specific address. My question is, should I be checking for transactions that might be included in uncle blocks as well?


texts:
when i compile a simple code ,i catch with "[solc] Expected primary expression."under the code

if (highestBidder != 0) {
          highestBidder.send((highestBid),
        }

.i know  that there is some wrong about the code format ,but i do not know how to modify it ?

pragma solidity ^0.4.4;
contract SimpleAuction {

  address public beneficiary;
  uint public auctionStart;
  uint public biddingTime;

  address public highestBidder;

  uint public highestBid;

  bool ended;

  event HighestBidIncreased(address bidder, uint amount);

  event AuctionEnded(address winner, uint amount);

  function SimpleAuction(uint _biddingTime, address _beneficiary) {
    beneficiary = _beneficiary;
    auctionStart = now;
    biddingTime = _biddingTime;
  }

  function bid() {

    require(condition, message); (now > auctionStart + biddingTime) ;

    require(condition, message); (msg.value <= highestBid);

    if (highestBidder != 0) {
      highestBidder.send((highestBid),
    }
    highestBidder = msg.sender;
    highestBid = msg.value;
    HighestBidIncreased(msg.sender, msg.value);
  }

  function auctionEnd() {
    require(condition, message); (now <= auctionStart + biddingTime);
    require(condition, message); (ended);
    AuctionEnded(highestBidder, highestBid);

    beneficiary.send(this.balance);
    ended = true;
  }

  function () {
    throw;
  }
}


texts: Truffle: Migrate to ropsten - fails silently

texts:
When I run the following command I receive no output whatsoever:

truffle migrate --network ropsten

This is just after creating a new project using truffle init and creating a single contract.

When I run truffle develop and run the migrate command from the console, everything works fine.

This is the contents of my truffle.js file:

var HDWalletProvider = require("truffle-hdwallet-provider");

var mnemonic = "my twelve word mnemonic......";

module.exports = {
  networks: {
    ropsten: {
      provider: function() {
        return new HDWalletProvider(mnemonic, "https://ropsten.infura.io/xxxxxxxxxxxxx")
      },
      network_id: 3
    },
    development: {
      host: "localhost",
      port: 8545,
      network_id: "*" // Match any network id
    }
  }
};

I'm on Ubuntu 16.04 and the latest version of truffle 4.1.8.

(and yes, I have funded my account on Ropsten with Ether from the faucet)


texts: Including contract-driven transactions in historical transaction script results

texts:
The goal is to create a .csv file of all ethereum transactions essentially a large table with these columns

blocknumber, timestamp, fromaddress, toaddress, value

I wrote this script to run in the REPL for go-ethereum 1.5.0-unstable, installed from the ubuntu package manager after adding the ethereum and ethereum-dev ppas :

function csv(){
    var i,l,block,j,k,trans;
    var s;
    for(i=0,l=web3.eth.blockNumber;i<l;i++){
        block = web3.eth.getBlock(i, true);
        if (block && block.miner)
            console.log([i,block.timestamp,'M',block.miner,5].join(","));
        if (block && block.transactions){
            for(j=0,k=block.transactions.length;j<k;j++){
                trans = block.transactions[j];
                console.log([i,block.timestamp,trans.from,trans.to,
                             +web3.fromWei(trans.value,'ether')].join(","));
            }
        }
    }
};

csv();

It captures block mining reward, and manual transactions, but is missing automated contract transactions. I am aware that the script is also missing the genesis block settings, the 5/32 uncle
rewards, and the gas payment to the miner, but what seems puzzling and a big source of inaccuracy at the moment are the missing automated "smart contract" transactions, which I was surprised do not appear in blocks along with ordinary transactions.

Example, for block 1965131 my script reports:

1965131,1469670959,M,0x2a65aca4d5fc5b5c859090a6c34d164135398226,5.0
1965131,1469670959,0xd6c9710363cdb12eb585e817f431d44cfa442dde,0xaa1a6e3e6ef20068f7f8d8c835d2d22fd5116444,31.0
1965131,1469670959,0xea674fdde714fd979de3edf0f56aa9716b898ec8,0x3d51978c7b14e486bc7c50c8629b7dc7be6bc405,1.00055988584149
1965131,1469670959,0x447ff4ac930acf585e439de1225fad61389c520e,0xd8e80673419acfbf15bf8eb0239cda90f232051f,32.8088
1965131,1469670959,0x999d1ce359692aebc26cd969a31d47d150128600,0xee48770b4d6fee448b29e2682135147fc059f794,62.219
1965131,1469670959,0x7e12d318239d70a532479b28baa47ec9c4bf83e6,0x556b5712c2a7cc5506fbfa785b52536fb8243765,4000.0
1965131,1469670959,0xf34005bd3186e3ef3ca3452cdd6bb4a7903b1917,0x86290290772671cbd13f1163225e624c67a4675a,10.0
1965131,1469670959,0xea674fdde714fd979de3edf0f56aa9716b898ec8,0x7c43f10e0ff4d33e36437b15b37c30f0d9407af3,0.242703566135995

but Etherchain for block 1965131 includes an additional transaction for 31 ether resulting from activation of a contract.

Over time this kind of omission from the script leads to some wild discrepancies when calculating balances from the data dump, primarily for those accounts that are recipients in smart contract generated transactions.

How can the script be fixed to include the missing smart-contract generated transactions?


texts: Do computations on polygon require less computing power?

texts:
My understanding of Ethereum, is that computing power is paid for in gas fees. I’m assuming a dapp like AAVE requires the same computing power to execute a transaction, regardless of what blockchain is being used. If not,  why not?  If so, why are people motivated to do the calculations on polygon if they make so much less money?
If that is not clear, I’m wondering why the same action can be so much cheaper on polygon mainnet than Ethereum mainnet.


texts: AssertionError: cannot transfer value larger than approved amount

texts:
I have followed the tutorials of Dapp University. Using Ganache and Metamask 127.0.0.1:7545 and did a truffle test or migrate it works perfectly.

Result:

Then, I change my network this is my truffle.js:

Then, I have geth setup with new genesis.json:

I created 2 accounts. Then started mining. account[0] now has 3000 ethereum, I added in metamask, its shows the same number. Then I added account1 in metamask with 0 ethereum, works great.

Then I run truffle migrate --reset --network kennetwork:

This is my DappToken.sol:

Then this is my DappToken.js the error is happening at line 97:


texts: Tracking transaction status using ethereum private chain

texts:
I am implementing an order management system using ethereum private block chain. Each order is a smart contract.
Each order will be acted upon by multiple actors. The status of the order will also be updated by these actors.
How do I get the current status of the order? Will need details like when the order was last processed and by whom, and its status.
I will also need the ability to find orders by status(ex: Completed, Failed etc).
Find orders that were processed within a date range etc.
Is it possible to retrieve such data from the blockchain itself?

If not, what should be the approach to implement such a system?


texts: Working with structure arrays in solidity

texts:
I have the following contract code example:

contract C {

    struct A {
        uint256 a;
        uint256 b;
    }

    struct B {
        A ax;
        uint256 c;
    }

    struct C {
        string name;
        B[] bs;
    }

    function init() {
        C memory c;
        B memory b;
        A memory a;

        a.a = 10;
        a.b = 20;

        b.ax = a;
        b.c = 30;

        c.name = "Test test test";
        c.bs[0] = b;
    }
}

Why can't I use push for the last statement

 c.bs[0] = b;

:

c.bs.push(b);

It throws the following error:

Untitled:30:9: Error: Member "push" is not available in struct B memory[] memory outside of storage.
        c.bs.push(b);
        ^-------^

but bs is an array of structures.


texts: How are DAO proposals encoded into smart contracts?

texts:
My understanding of a DAO is that members can create proposals which if they pass successfully become part of the rules of the DAO. How does that work for complex proposals?
For example, here's a proposal with a lot of detail. How does all that become a part of the new set of rules for the DAO?
Or this article it says "users have a say in what snacks it will order and how often should it be cleaned". If the initial smart contract contains code that lists snacks and has a variable for cleaning schedule, I see how that could be voted on, but isn't this limited to parameters that can be thought of in advance by the initial developer?
How can smart contracts for DAOs support complex proposals for new rules?


texts: How does Truffle Deployer translate arguments from JavaScript to Solidity?

texts:
I have a Truffle migration that looks something like this;

var MyContract = artifacts.require("./MyContract.sol");
module.exports = function(deployer) {
  deployer.deploy(MyContract,[
    {
      "title": "President",
      "choices": [
        {"name": "Mary", "votes": 10},
        {"name": "Maria", "votes": 10},
        {"name": "Maryam", "votes": 10}
      ]
    },
    {
      "title": "Vice President",
      "choices": [
        {"name": "John", "votes": 10},
        {"name": "Juan", "votes": 10},
        {"name": "Abdullah", "votes": 10}
      ]
    }
  ], {gas: 2900000});
};

And MyContract.sol looks like this;

contract MyContract {
  // Define some public variables here...
  function MyContract(bytes32[] myArray) { // Not sure this line is right
    // How do I access constructor arguments here?
  }
}

The problem is, I don't know what Truffle translates my constructor arguments to in Solidity. I know I need to tell the constructor what type of data to expect, but I don't know what that data will look like, or what syntax to use to access it. The deployer docs are on the Truffle website, but they only explain that you can pass the arguments, not how to access them in Solidity.

Edit: It looks like the JSON interface that truffle-contract uses might be a piece of the puzzle. interface.abi is an array that contains this element for the constructor;

{
  "inputs": [
    {
      "name": "myArray",
      "type": "bytes32[]"
    }
  ],
  "payable": false,
  "type": "constructor"
}


texts: gas required exceeds allowance or always failing transaction

texts:
I really need help with this error. I'm testing the contract by sending ETH to Crowdsale contract .(Ropsten, My ether wallet, Remix).
Full code is here: https://ropsten.etherscan.io/address/0x500c3ff2c1a561cd0fda1cf0c77fe0d17af5fda5
This function give me really problem;
function () payable public {
        buy();
    }

function buy () payable public whenNotPaused beforeDeadline afterStartTime saleNotClosed {
    require(msg.value >= minContribution);

    // Update the sender's balance of wei contributed and the amount raised
    uint amount = msg.value;
    uint currentBalance = balanceOf[msg.sender];
    balanceOf[msg.sender] = currentBalance.add(amount);
    amountRaised = amountRaised.add(amount);

    // Compute the number of tokens to be rewarded to the sender
    // Note: it's important for this calculation that both wei
    // and PDT have the same number of decimal places (18)
    uint numTokens = amount.mul(rate);

    // Transfer the tokens from the crowdsale supply to the sender
    if (tokenReward.transferFrom(tokenReward.owner(), msg.sender, numTokens)) {
        FundTransfer(msg.sender, amount, true);
        // Check if the funding goal or cap have been reached
        // TODO check impact on gas cost
        checkFundingGoal();
        checkFundingCap();
    }
    else {
        revert();
    }
}

I thing tokenReward is  not correctly defined.
Here works fine:
function () payable {
        buy();
    }

function buy ()
    payable public
    whenNotPaused
    beforeDeadline
    afterStartTime
    saleNotClosed
{
    require(msg.value >= minContribution);
    uint amount = msg.value;

    // Compute the number of tokens to be rewarded to the sender
    // Note: it's important for this calculation that both wei
    // and PDT have the same number of decimal places (18)
    uint numTokens = amount.mul(rate);

    // update the total amount raised
    amountRaised = amountRaised.add(amount);

    // update the sender's balance of wei contributed
    balanceOf[msg.sender] = balanceOf[msg.sender].add(amount);
    // add to the token balance of the sender
    tokenBalanceOf[msg.sender] = tokenBalanceOf[msg.sender].add(numTokens);

    FundTransfer(msg.sender, amount, true);
    // Check if the funding goal or cap have been reached
    checkFundingGoal();
    checkFundingCap();
}

Please for a real answer how to fix this problem.Robert


texts:
I need to deploy my smart contract to BSC Testnet
I always got this :
Error: PollingBlockTracker - encountered an error while attempting to update latest block:
Error: ETIMEDOUT
I tried to change the RPC specified here https://docs.binance.org/smart-chain/developer/rpc.html#rate-limit

All of them, yet still the same.
One thing is, I tried to deploy it to ropsten instead just for fun. And it is success. Is there any problem with BSC Testnet RPC nowadays ?
Here is my snip for truffle-config.js
        testnet: {
            provider: () => new HDWalletProvider(mnemonic, `https://data-seed-prebsc-1-s2.binance.org:8545`),
            network_id: 97, // 3 for ropsten, 97 for bsc test
            confirmations: 2,
            timeoutBlocks: 2000,
            skipDryRun: true,
            networkCheckTimeout: 1000000
        },

I searched, some people use websocket (wss), some change the RPC Url, some add the networkCheckTimeout. I tried all of them (except wss, since I don't see it is provided by BSC Testnet). But nothing work.
Any suggestion ? Thank you


texts: How to find the reserves of each coin pair on the pancakeswap coinPair smart contract

texts:
I am trying to calculate the reserves of each coin in the pool of a coin pair at a given time.
using the https://api.pancakeswap.info/api/v2/pairs API, I can't seem to find that value.
the API does return some good data but not the current reserve.
this is what the API returns :
{

    base_address: 0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82
    base_name: PancakeSwap Token
    base_symbol: Cake
    base_volume: 3742427.017298731802757169
    liquidity: 1624503535.402908378290691194641887
    liquidity_BNB: 2641659.327503843701997896
    pair_address: 0x0eD7e52944161450477ee417DE9Cd3a859b14fD0
    price: 0.06342180375934548959
    quote_address: 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c
    quote_name: Wrapped BNB
    quote_symbol: WBNB
    quote_volume: 245324.64910932273403908

}

can someone please tell me how to calculate the reserves of each Token ? is there a way to do that with the smart contract event logs like Sync, swap, and transfer?


texts:
Languages such as javascript and Perl have eval statement. Is it possible to have
some functionalty similar to eval in Solidity ?

In particular, this is what I want to do:
Suppose I deploy a contract A.  A should have a function that takes
address, function name and parameters of a contract that it can call.
When I deploy a different contract B sometime later, I want to be able
to call A's function and pass B's address, function name and parameters and
have A call it.

Please note that at the time of deployment of A, I do not know the name of
B's function and its signature. J


texts: What is the format for sending erc20 token to multiple address?

texts:
Code

  contract ERC20 {   function transfer(address _recipient, uint256
  _value) public returns (bool success); }

  contract Airdrop {   function drop(ERC20 token, address[] recipients,
  uint256[] values) public {
      for (uint256 i = 0; i < recipients.length; i++) {
        token.transfer(recipients[i], values[i]);
      }   } }

How to use.
Please can you tell me what is the format i have to put address and token value to send. I have tried many formats but not worked.
token send to multiple addresses in one transaction.

Please can you tell me what is the format i have to put address and token value. I have tried many formats but not worked.

Please


texts: Ethereum converting string & random string to private key

texts:
I am receiving as input a private key string and a random string. Goal is to get public key and address.

When I am receiving the string I do:

var hash = Crypto.util.hexToBytes(privStr);

this.priv = new BigInteger(hash);
A random string:

var hash = keccak256.array(suppliedKey);

this.priv = new BigInteger(hash);

On both randomly work, am I doing it correctly?

UPDATE
1. In first case my issue was I was not appending "0x" as prefix of the string.


texts: Is it possible to generate a keystore file from address and password

texts:
I think I already know the answer, but thought I would ask anyway. I have lost my keystore file while backing up an ETH wallet. I did not have the private key noted down anywhere else, so currently cannot access my funds. I know the wallet address and the password I used to encrypt the keystore file, so wondered if there is a way to reverse engineer this to generate a new keystore with my private key in there.
Thanks in advance


texts: Representing biometric data with solidity variables -- bytes 32 perhaps?

texts: would like to know which variable type comes closest to representing biometric binary data? Assuming computing storage and power grows exponentially and network latency can be further reduced, would it be possible to store one,s private key as biometric thereby enabling a web of decentralized identities?


texts: Error : Could not connect to your Ethereum client with the following parameters:

texts:
Im creating my dapp with following below tutorial.
http://www.dappuniversity.com/articles/the-ultimate-ethereum-dapp-tutorial

however Im facing an error when I run

truffle console

it shows

>truffle console

Could not connect to your Ethereum client with the following parameters:
    - host       > 127.0.0.1
    - port       > 7545
    - network_id > *

Please check that your Ethereum client:
    - is running
    - is accepting RPC connections (i.e., "--rpc" option is used in geth)
    - is accessible over the network
    - is properly configured in your Truffle configuration file (truffle-config.js)

Truffle v5.0.17 (core: 5.0.16)
Node v10.15.3

I have tried

truffle init

but my command prompt got stacked after it showed

>truffle init

This directory is non-empty...
? Proceed anyway? Yes
- Preparing to download

can anyone please advise me what needed to be changed.

FYI the code inside truffle-config.js is

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

Thank you


texts:
I have a geth node, and using truffle-hd-wallet. I am trying to create a transaction between coinbase and the account created by hd-wallet.Created a raw transaction and signed it with privatekey of coinbase. The transaction is stuck in txpool in pending state.
Transaction object created as:

{
        'from': <coinbase account>,
        'to': <acc created by hdwallet>,
        'value':1,
        'chainId': <net.getId()>,
        'gasPrice': <eth.getGasPrice>,
        'gasLimit': 2000000
    }

Signed with, web3I.eth.accounts.signTransaction(tx, privateKey)

web3.txpool.content shows below,

{
  pending: {
    0x0C0Df324C081fAF1c9fE6BF98379e0614181d254: {
      0: {
        blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
        blockNumber: null,
        from: "0x0c0df324c081faf1c9fe6bf98379e0614181d254",
        gas: "0x1e8480",
        gasPrice: "0x430e23400",
        hash: "0x6c525ad1ed8b128ba04e12e990e762697d9ac093c5342d7a4835318e74bb518f",
        input: "0x",
        nonce: "0x0",
        r: "0x346c40bd758c67f5082976d9e5523f0b171b397d53b30ff6183d31e3314b7ff1",
        s: "0x68bd289133fcf966f71d51fdbe282c176a6b7739f8532d347471183e056352e8",
        to: "0x74f59f7f123fa71a8d0b71d792a6d040bbdd2fdd",
        transactionIndex: "0x0",
        v: "0x9c7",
        value: "0x5"
      }
    }
  },
  queued: {}
}

I have tried even including nonce, increasing gasPrice, also using ethereumjs-tx, but same result


texts: For Ganache and BuidlerEVM I have different estimated gas

texts:
For Ganache and BuidlerEVM I have different (several times) estimated (by Ethers.js) gas for the same computation.
Is it a bug? Isn't the Ethereum standard specifying particular gas amount for every operation so that it could not be different on different implementations?
Whose bug is it?


texts:
I'm trying to reduce the storage size of my contracts by reducing the bytes required to store my int data types (among other things).

Can I get the best practice for adding int256 and other smaller int datatypes (i.e. int32)?  Can I just add them? Do I need to do some conversion? Is this just a bad idea?  Thanks.


texts: When would one want to use a linked library?

texts:
My understanding is that if a smart contract consumes a library that only has internal functions, then the compiler will embed the library into the contract bytecode. At the lowest level, there is no use of DELEGATECALL - a call to an internal function of a library is a simple JUMP statement.
Conversely, if the library does have public/ external functions, the library has to be deployed separately.
At first glance, it seems that most libraries only contain internal functions:

OpenZeppelin's SafeMath.sol
Uniswap v2's Library

What are the best use cases for a linked library?


texts:
My target is to send from the ERC20Wrapper.sol deployed contract BAT tokens to my hard coded address.

I've created ERC20 Interface:

pragma solidity 0.4.18;

interface ERC20 {
    function totalSupply() public view returns (uint supply);
    function balanceOf(address _owner) public view returns (uint balance);
    function transfer(address _to, uint _value) public returns (bool success);
    function transferFrom(address _from, address _to, uint _value) public returns (bool success);
    function approve(address _spender, uint _value) public returns (bool success);
    function allowance(address _owner, address _spender) public view returns (uint remaining);
    function decimals() public view returns(uint digits);
    event Approval(address indexed _owner, address indexed _spender, uint _value);
}

Then I Added ERC20Wrapper.sol:

pragma solidity ^0.4.18;

import "./ERC20Interface.sol";

contract ERC20Wrapper {
    ERC20 constant internal BAT_TOKEN_ADDRESS = ERC20(0xDb0040451F373949A4Be60dcd7b6B8D6E42658B6);
    address myAddress = address(0xAD53363200C71751FA325ED7bE483722256C3501);

    function BATSend(uint tokenAmount) public payable{
        ERC20(BAT_TOKEN_ADDRESS).transfer(myAddress,tokenAmount);
    }
}

Then I instantiate ERC20Wrapper.sol and got its address on Remix, sent to the newly created contract addrees 200 BAT tokens and tried to interact with BATSend by calling transfer on ERC20 interface and entered 20 in the tokenAmount parameter.

Expected output, my account will have +=tokenAmount and it didn't happened, tx was confirmed and account amount didn't changed.


texts: How to get details for an Ethereum transaction

texts: I am using EtherScan API for finding Ethererum Stats however I see no option to find details for a particular transaction. How can I do the same?


texts: How to estimate gas cost for contract method using geth

texts:
I want to estimate a contract method gas cost using geth. I understand there is no direct way using geth as in the web3 libs. But I don't understand what is the second argument needed and how I can get it.

The second argument is msg ethereum.CallMsg from here:
https://github.com/ethereum/go-ethereum/blob/69c52bde3f5e48a3b74264bf4854e9768ede75b2/ethclient/ethclient.go#L472

How can I get it, specifically using the Golang implementation?


texts: Solidity - struct initial mapping can be ignored

texts:
I found out that, in struct initialization, we can just ignore mapping type, for example:

pragma solidity ^0.4.0;

contract C{
  struct Person{
    string name;
    mapping(address=>int) map;
    string[] nickNames;
    int age;
  }

  function init() constant returns (string, int){
    string[] memory nickNames = new string[](1);
    nickNames[0] = "cat1099";

    Person memory p = Person("Jack", nickNames, 23);

    return (p.name, p.age);
  }
}

In the office document, I only found in a code note, says "We leave out the mapping type.",After search this site,here someone said that:

  Mappings can be seen as hashtables which are virtually initialized such that every possible key exists and is mapped to a value whose byte-representation is all zeros: a type’s default value. The similarity ends here, though: The key data is not actually stored in a mapping, only its keccak256 hash used to look up the value.

Did this mean, solidty can't initial a mapping in struct, so just ignore it.Could anyone make that more clear, since there isn't any official explanlation of this?


texts: Why was the Solidity compiler removed in geth 1.6.0? What is the procedure to deploy a contract in geth 1.6.0?


texts: How to add more logic to a payable function?

texts:
How can I add to a payable function the possibility for the buyer (a company, in my case) to add some details about itself at the moment of performing the payment (e.g. registered number and company name)?

Below is the code that I'd need to modify to add the above mentioned :

contract KYCPurchase {
  uint public price = 2 ether;
  address[] public buyer;

  function buy() public payable {
    require(msg.value >= price);

    // Keep a list of buyers who have transferred enough ether
    buyer.push(msg.sender);

  }

Thanks!


texts:
As soon as a function is called this other function should also be called!!

Example: As soon as ether is deposited it should transfer funds into employees wallet.

I already have functions deposit() and transferFunds() ready. Just need a way so that as soon as deposit is called transfer should also happen.

Not this though:::

I don't want to call one function inside other functions!!!!

deposit()

{

transferFunds();

}


texts:
I want to store ids in an array and attach them to an address.
For example:
There are 0 houses. User1 buys an house so id 0 gets added to the array userHouses[msg.sender]. User2 buys 2 houses so it 1 and 2 gets added to userHouses[msg.sender]. user1 buys another house, id 3 gets added to userHouses[msg.sender] and so on.
I could do

mapping(uint => address) houseOwner;

and

houseOwner[0] = msg.sender; // User1
houseOwner[1] = msg.sender; // User2
houseOwner[2] = msg.sender; // User2
houseOwner[3] = msg.sender; // User1

But when there are 1.000.000 houses of 10.000 users it gets too much.
So I want instead 10.000 arrays for each address and simply add the houses into that address (like houses[msg.address]). Also it's easier and cheaper to loop only houses of the user instead of looping all houses and check if the house owner is the user.

I know how to make an array (uint[] houses) but I don't know how to make arrays for each address (uint[] houses[msg.sender]?).


texts: Invalid number value when deploying contract using truffle? But how to fix it in code is the value or _amount variable ?i cannot figure it out

texts:
2_deploy_contracts.js

Replacing 'OraclizeTest'

  Error:  * Deployment Failed *

  "OraclizeTest" -- invalid number value (arg="_amount", coderType="uint256", value={"from":"0xb5Fb3E9BB73e742689F1001C519d6763a39A4Bc5","gas":6721975,"value":1000000000000000000}).

  at /root/.nvm/versions/node/v9.11.2/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:364:1
      at
      at process._tickCallback (internal/process/next_tick.js:182:7)
  Truffle v5.1.8 (core: 5.1.8)
  Node v9.11.2

var OraclizeTest = artifacts.require("./OraclizeTest.sol");

    module.exports = function(deployer, network, accounts) {
      // Deploys the OraclizeTest contract and funds it with 0.5 ETH
      // The contract needs a balance > 0 to communicate with Oraclize
      deployer.deploy(
        OraclizeTest,
        { from: accounts[9], gas:6721975, value: 1000000000000000000 });
    };

-

contract OraclizeTest is usingOraclize {

    using strings for *;        //strings import requirement
   // string public matchId;
    uint256 public amount;

//remove url traces
    address public homeBet;
    address public awayBet;

    //string public ETHUSD;

    event LogInfo(string description);      //getting from update function
//event LogPriceUpdate(string price);     //waiting for price in callback
    //then calling update function
    //event LogUpdate(address indexed _owner, uint indexed _balance);     //getting from constructor

    // Constructor
    function OraclizeTest (uint _amount) public {      //adding args and not matchid
        amount = _amount;

    //    emit LogUpdate(owner, address(this).balance); //owner was in original

        // Replace the next line with your version:
        OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475);

        oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
        update();
    }


texts:
I am new in mining, so here's my story:
I installed Linux, downloaded geth and Claymore DualMiner.
Then generated a wallet address with geth (I was asked a passphrase) and started mining ETH ...

Meanwhile tried overclocking without success and decided to install windows + MSI Afterburner.

So .. I have wallet and passphrase and lost keystore file.

What to do to get my 0,2 ETH ?
Is it worth get the missing info (keystore file) or just start from the beginning?
What is the extension of that file?
What is in that file (maybe I can extract it with foremost like here: https://www.rissmann.ch/2014/08/09/how-to-recover-lost-files/)

I already lost 2 days to get my data back (undelete, testdisk, foremost).
I found some very old partitions and data, but what I seek was overwritten.

Please help ...


texts: Ethereum cluster is providing HTTP_PROVIDER for ethereum classic. But I want to use events of solidity for which I need WEB PROVIDER. What is the WEB PROVIDER of ethereum classic?


texts: How can conditional deployment of a contract be done?

texts:
This might be a very basic query, but, I would like to know how I can restrict the deployment of contracts based on some condition. More specifically, assume that I have an "Admin" who can assign "Creator" roles to certain addresses. These creators should be able to deploy a "Creation" contract. Non-creators should be incapable of doing the same.

How can I impose a set of conditions which determine whether or not a contract will be deployed or not?


texts: When closing node (geth ropsten) I cannot save created accounts

texts:
I am pretty new to this. I downloaded the ropsten blockchain using a geth command line. Then, using Truffle, I created an account, but when I closed my node (ctrl - c on the geth command line) and then re-opened it I couldn't see my account in Truffle anymore.
How can I close my node and open it again and still keep the accounts I create?
Thank you


texts: Are HD wallets without MultiSig functionality safe?

texts:
I was reading a post Deterministic Wallets, Their Advantages and their Understated Flaws by Vitalik Buterin. There he mentions

  although you certainly can securely hand out child keys with no risk to the parent key, and you can hand out master public keys with no risk to the master private key, you cannot do both at the same time.

I could not understand all the technical functions he used to explain his words.But he considered a security threat.The cleaver way to overcome this was:

  making three hierarchical BIP32 wallets, with every address being a 2-of-3 multisignature address between the three wallets down some particular child key derivation path

So. are HD wallets without MultiSig functionality are risk to security in any case?


texts: My activity is erased from the Ropsten testnet

texts:
I am new to blockchain development, and I just deployed a Token creation contract yesterday to the Ropsten test network. After creation, the token showed up properly with the correct supply on the Etherscan explorer, and I also sent some tokens to a second address. Now, just one day later however, when I check the Token on Etherscan, there are 0 holders, the token supply is 0, and the Token contract code has also disappeared from Etherscan. Also, the address I deployed the contract with had some Ropsten testnet Ether, but both the balance and txcount of this address has ben zeroed out. First, I thought this was just some kind of bug on Etherscan's side, but when I read values with web3 through an Infura Ropsten node, I get the same values. It seems like as if all of my activity had been erased. What is happening? Why did my Tokens and my account balance disappear? It might be something that I am overlooking about how the testnet works, but from what I understand transaction history and data should not be erased like that on Ropsten.
Here is the token I created: https://ropsten.etherscan.io/token/0x76557dff3e2146146dfe6e86a17eb1134521ead1
Here is the account I used to create the token with: 0xa9670353E4c797c7a354bFa6Dd70cE19fa4eD22e
(now it has only the four incoming transactions because I had to re-request some testnet ether, after my balance had disappeared)


texts:
I tried to send a small amount to a second account  using mist however the transaction disappeared from my transaction list, and nothing showed up in my account.  I believe the small amount was still subtracted from my wallet.

subsequently i tried the same transaction using geth, and it worked. the funds even show in my wallets. Whats going on should i abandon mist?

Gracias
Windows 10 64bit Ethereum-Wallet-win64-0-7-5


texts: AntiVirus ruined my Ethereum DB for Mist?

texts:
Have been running Mist for a few months now and regularly installing the updates. On OSX. Currently on 0.7.2.

I had installed Avast AntiVirus and when I turned Mist on while this was downloading blocks, Avast saw them as a Virus. I stopped Mist and tried to tell it that these are OK. Ultimately, I removed Avast. I think however, I never put the quarantined blocks back and now when I start Mist I get errors like the below. What can I do? Or do I have to reinstall from scratch?

Fatal: blockchain db err: leveldb/table: corruption on table-footer (pos=1829964): bad magic number [file=170175.ldb]

and

...I0511 07:15:51.797087     621 database.go:71] Alloted 433MB cache to /Users/lukeollett/Library/Ethereum/chaindata
Fatal: blockchain db err: leveldb/table: corruption on table-footer (pos=1829964): bad magic number [file=170175.ldb]


texts: If I create a Smart Contract that pays users for sharing their data, how can I ever update this smart contract in the case it has an error, or perhaps I wish to change the amount paid for data sharing?  From what I understand, I basically must create a new smart contract at a new Ethereum address and somehow find a way to re-connect my users to this new contract.  If true, this tends to feel much like centralized systems again, where the smart contract writer can change the rules (payment rates) when they wish.  Obviously I am missing something here... can some please explain?  Thank you!


texts: if a miner sets its mining fee very high in ethereum network and no transaction in the block pays that amount

texts:
what would happen in that case
do the minner will mine an empty block.
all the transactions will get cancelled


texts: What is the size of byte code stored in the EVM?

texts:
Generally, what is the size of the bytecode stored in the EVM. I mean the approx average value of it or bytecode of a simple hello world program (setting and getting a  string).
On what factors this bytecode depends? and on how can i get this correct. i mean How can I know the correct value? is there any predefined keyword or command that gives this information.

Any relatable answer is appreciable !!


texts:
I have the following defined struct:

// A struct that holds all the data for a single plot of land
    struct Land {
        bytes32 geoPoint1;
        bytes32 geoPoint2;
        bytes32 geoPoint3;
        bytes32 geoPoint4;
        address owner;
    }

and I call it using the following

Land memory _land = Land({
                geoPoint1: _geoPoint1,
                geoPoint2: _geoPoint2,
                geoPoint3: _geoPoint3,
                geoPoint4: _geoPoint4
                owner: ?????
            });

            uint256 landID = landRegister.push(_land) - 1;

What do I put into the owner field because I want to leave that as "empty" i.e.

  0x0000000000000000000000000000000000000000

When someone purchases this item the field will be completed. If I leave it blank I get errors in Remix stating that there are not the expected number of fields for the struct.

Thanks


texts: Is transaction confidentiality achievable in Ethereum currently

texts: I have read about zk-SNARKs on different articles which is written in 2016. So I am wondering if the zk-SNARKs is implemented in Ethereum currently?


texts: Getting information from contract address?

texts:
pragma solidity ^0.5.0;
import 'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol';

contract SubToken{
    using SafeMath for uint;

    struct token{
        string  name;
        string   symbol;
        uint8  decimals;
        uint  totalSupply;
    }

    token public mytokens;

    mapping(address => token) Tokens;
    mapping(address => uint) balances;

    constructor(string memory _name,string memory _symbol,uint8 _decimals,uint256 _totalSupply)  public{
        mytokens = token(_name,_symbol,_decimals,_totalSupply);
        balances[msg.sender]=_totalSupply;
    }

    function getInformations(address contract_address) public view returns(string memory name,string memory symbol,uint8 decimals,uint totalSupply){
        return (Tokens[contract_address].name,Tokens[contract_address].symbol,Tokens[contract_address].decimals,Tokens[contract_address].totalSupply);
    }

    //function transferFrom(address from, address to, uint tokens) public returns (bool success);
    //function allowance(address tokenOwner, address spender) public view returns (uint remaining);
    //function transfer(address to, uint tokens) public returns (bool success) ;
    //function approve(address spender, uint tokens) public returns (bool success);
    //function transferFrom(address from, address to, uint tokens) public returns (bool success);

    event Transfer(address indexed from, address indexed to, uint tokens);
    event Approval(address indexed tokenOwner, address indexed spender, uint tokens);

}
contract MainContract {
    mapping(address => mapping(address=>uint)) balances;

    mapping(address => mapping(address => uint)) allowed;

    address[] public contracts;

    using SafeMath for uint;

    address contract_address;

    struct token{
        string  name;
        string   symbol;
        uint8  decimals;
        uint  totalSupply;
    }
    mapping(address => token) public tokens;

    function createNewContract(string memory _name,string memory _symbol,uint8 _decimals,uint256 _totalSupply) public returns(address youraddress){
        SubToken st = new SubToken(_name,_symbol,_decimals,_totalSupply);
        tokens[address(st)] = token(_name,_symbol,_decimals,_totalSupply);
        return(address(st));
    }

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

}

Hey guys I am a begginer of solidity so my question about contact address and get some information.

so i have 2 contract first one is sub second one is main. Inside my main contract i have create contract function for create for sub contract and its work well.

but in my sub contract i have get information function. this function take a contract address parameter and return informations. and problem at there
this function doesn’t work .

I check my code but i dont what I suppose to do
Anyone can help me please :)


texts: What is the proper way to check if msg.sender is the contract owner?

texts:
I'm trying to make a function that returns true if msg.sender is the owner.
This is my function;
function isAdmin() public view  returns (bool){
   require(admin == msg.sender);

    return true;

}

admin was given the value of msg.sender in the constructor.
Whenever I call this function it revert. From truffle or my app
truffle;
x = await contract.deployed()
x.isAdmin()

It revert!
My app;
await exchange.methods.isAdmin.call()

Also revert.
So what am I doing wrong?


texts:
I am creating a contract fabric program in which if a new user comes, i will deploy a child contract for that user. My parent contract is openzepplin upgradable contract. Checking whether i can upgrade the child contract as well. I dont want to upgrade 1000 child contract if i need to upgrade if it is necessary.
What i need is an upgradable parent and child contract in a cost effective way.


texts:
I'm setting a private blockchain using parity rust client.

In gethI can use admin.nodeInfo and get enode from there. But how can I get enode in parity client?


texts: To handle emitted events from solidity in javascript in truffle suite

texts:
The function I am accessing will emit events i need to use that event but the function is a transaction when i am accessing the event it turns as promise pending . So suggest me some methods. thanks!

Please find my code below

App.contracts.Sample.deployed().then(function(instance) {
    mainInstance = instance;
    instance.countPlayers().then(function(count) {
        console.log(count.valueOf()) // returning values
    })

    // to access events emitted
    instance.onlineCount({}, {
        fromBlock: 0,
        toBlock: 'latest'
    }).watch(function(error, event) {
       console.log("event---->", event) /// promise pending error
       App.render();
    })
});


texts: What bad things could happens if Geth RPC is public?

texts:
Geth does not ship with RPC support. By default Geth enables modules ["net", "web3", "eth", "shh"]. In case the RPC get compromised, what kind of bad things could happens?

Money lost will definitely be the first place

Assuming you have a wallet managed by Geth, people can freely sent any balance inside away.

Apart from money lost, is there any other things that may potential happens?

For example, if I just run the node as a block tracker and monitor if any money sent into my address. Does RPC has the ability to affect them as well?


texts: What should I input to these parameters in my MultiSigWallet Contract's function?

texts:
these are the parameters, included in function sendMultiSig() from contract multiSigWallet{}.

how can I input expireTime and signature? and who will be the toAddress? A msg.sender? a signer? or a non signer?

function sendMultiSig(
    address toAddress,
    uint value,
    uint expireTime,
    uint sequenceId,
    bytes signature
)
    onlysigner
    payable
{
    // Verify the other signer
    var operationHash = sha3("ETHER", toAddress, value, expireTime, sequenceId);

    var otherSigner = verifyMultiSig(toAddress, operationHash, signature, expireTime, sequenceId);
}

function verifyMultiSig(
    address toAddress,
    bytes32 operationHash,
    bytes signature,
    uint expireTime,
    uint sequenceId
)
    private
    returns (address)
{

    var otherSigner = recoverAddressFromSignature(operationHash, signature);

    // Verify if we are in safe mode. In safe mode, the wallet can only send to signers
    if (safeMode && !isSigner(toAddress)) {
        // We are in safe mode and the toAddress is not a signer. Disallow!
        revert();
    }
    // Verify that the transaction has not expired
    if (expireTime < block.timestamp) {
        // Transaction expired
        revert();
    }

    // Try to insert the sequence ID. Will throw if the sequence id was invalid
    tryInsertSequenceId(sequenceId);

    if (!isSigner(otherSigner)) {
    // Other signer not on this wallet or operation does not match arguments
        revert();
    }
    if (otherSigner == msg.sender) {
        // Cannot approve own transaction
        revert();
    }
    return otherSigner;
}

function recoverAddressFromSignature(
    bytes32 operationHash,
    bytes signature
)
    private
    returns (address)
{
    if (signature.length != 65) {
        revert();
    }
    // We need to unpack the signature, which is given as an array of 65 bytes (from eth.sign)
    bytes32 r;
    bytes32 s;
    uint8 v;
    assembly {
        r := mload(add(signature, 32))
        s := mload(add(signature, 64))
        v := and(mload(add(signature, 65)), 255)
    }
    if (v < 27) {
        v += 27; // Ethereum versions are 27 or 28 as opposed to 0 or 1 which is submitted by some signing libs
    }
    return ecrecover(operationHash, v, r, s);
}


texts: How to implement function() tokenFallback and decode the parameter bytes _extraData

texts:
I want to use the ERC223 approveAndCall() || ERC677 transferAndCall() functionality in a contract.

I can take the _extraData string

x="0xe359292df082828f595466de72062f2a1182b077",["0x3d4c4ecB5CAe14f20b916C2936a9d9A16acF14c9","0xBe227eE70d1AD43C4d1C9e173eD0f96AFDdB8a34"],["10","11"]

And convert it into a byte[] using y=byte(x)

0x307865333539323932646630383238323866353935343636646537323036326632613131383262303737

but in the returning tokenFallback() function I can't work out how to convert this back into an address and two arrays of address[], uint[].

Edit:  Maybe I shouldn't be starting from a string.  Is there a way to stick addresses, ints, uints, byte32 etc. together into a byte format, and extract (assuming you know how they were put together).


texts: How to change all the ethereum blocks from C drive to D drive -- question about the answer

texts:
I'm new here and have no idea if this is the right way to respond. So I duplicated the question a have a question about:

I've done the things written in the answer on the original question and I could see the text file. But the blocks start sync from scratch on the old location (C:Drive).
What could be the reason?
Hope you can shine some light on this.
Ite


texts:
I've seen a particular code style, where after any "critical" state modification operation, a check is done in order to assess the true good result of the operation.

Something like:

uint _count = currentStruct.count--;
assert(currentStruct.count == --_count);
// check and revert if something is strange

or

currentStruct.level = 0;
assert(currentStruct.level == 0);

or

currentStruct.level = externalContract.zerosCurrentLevel();
assert(currentStruct.level == 0);

where those operations are to be considered critical because either they are:

very costly in terms of possible manipulation;
depending on the results of some external contracts deployed elsewhere
and so on.

Is this a justified way of code, or it is simply redundant? And if it be justified, why and when?

==== after comments ====

After that both goodvibration and Rob constructively commented, I precise that, as far as I understood, the problem were not to check for overflow, but for proper EVM context execution of the operation to be checked. It was said to me that it is not clear today what will be an attack tomorrow and that checking whatever critical (for double spending for instance, or to avoid reentrancy attacks) can avoid future problems. In that sense even if today it is not clear why they are checking, tomorrow they should discover that their code in not attack-able by some new attack... this is the declared rationale.


texts: Metamask shows me 18 token sent, Etherscan shows 0 token sent

texts:
I'm lost...
Metamask show me :

While Etherscan shows me 0 SNX :

What am I doing wrong???


texts: When coins provide external service (e.g. Filecoin) how is the work done (e.g. storage) verified to earn the Ether?

texts:
I've seen a lot of talk about smart contracts that can facilitate distributed markets such as Filecoin. In the words of Protocol Labs:

Filecoin is a cryptocurrency powered storage network. Miners earn Filecoin by providing open hard-drive space to the network, while users spend Filecoin to store their files encrypted in the decentralized network.

In a bitcoin transaction the miner earns their bitcoin by doing computational tasks that are core to the bitcoin network. The completion of the tasks are inseperable from the assertion that they've been done and therefore the payment of Bitcoin for doing them. You literally can't claim the Bitcoin without doing the work required.
What happens when the work required to earn the contract fee isn't so intrinsically provable though?
How does Filecoin verify that a file really has been stored and really hasn't been deleted afterwards? What's to stop a node on the network announcing that it's stored a file but not doing so? Or has stored it but then deletes it?
How would even more decoupled marketplaces work?
I can see (at a stretch) how you could make filecoin transactions intrinsically coupled to the release of the Ether but what happens when it gets more abstract. If you wanted to create a decentralised energy marketplace and pay Ether for using electricity / earn Ether for producing it, how would the contract verify that the electricity really had been produced or the right quantity really had been consumed?


texts:
Why would a normal user want to launch a node in any mode other than "light" , does full or fast give any advantages in sending transactions ?

Is there any difference between transaction sent from full and light nodes ?


texts:
how to fix a fact that the recipient received the file so that the recipient could not dispute it? How to do this by a smart contract?

thanks in advance.


texts:
I am creating an ERC-1155 smart contract whereby I create a number of different tokens and also want to be able to create new tokens on the fly. The code is something like:
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";

contract MyVideos is ERC1155 {
    uint256 public constant Video1 = 0;
    uint256 public constant Video2 = 1;
    uint256 public constant Video3 = 2;

    constructor() public ERC1155("https://video/api/item/{id}.json") {
        _mint(msg.sender, Video1, 100, "IPFS hash");
        _mint(msg.sender, Video2, 1000, "IPFS hash");
        _mint(msg.sender, Video3, 1, "IPFS hash");
    }
}

function addNewVideo(uint VideoN, uint ntokens, bytes memory IPFS_hash) public {
    _mint(msg.sender, VideoN, ntokens, IPFS_hash);
}

My question is twofold:

Are ERC-1155 created tokens always atomic (i.e. not divisible into fractional parts)?
If not, how can I distinguish between the two?

Thanks!


texts: How to set the smart contract function argument in web3 object?

texts:
In Solidity, function arguments are usually byte, uint, string types. So when calling contract functions through web3 object, do we need to convert arguments into proper types? Or there are implicit type conversions in web3?
Can I just input string values in the javascript UI?


texts: How to sign transactions using Metamask and send the signed transaction to NodeJS so that it can be added on Ropsten Infura?

texts:
I have developed a secure file sharing application in NodeJS(v10.16.1) + Express(v4.17.1) + Truffle(v5.1.15) + Metamask(v7.7.8) which works perfectly on localhost. I am using @truffle/contract(v4.1.11) and interacting with the smart contract functions in NodeJS routes which then renders the front-end with the results. The NodeJS performs encryption, stores the file on IPFS(Infura API) and writes the returned hash to the smart contract.

Now, I want to integrate it with Ropsten(Infura API). However, Infura does not provide any method for signing transactions. It only has the eth_sendRawTransaction method which does not match with truffle's sendTransaction().

How can I sign the transaction using Metamask and then send it to NodeJS so as to add it on Infura's Ropsten Network?

One option is asking the user to enter PRIVATE_KEY from Metamask and sending it with the request. However, it is not a good option because of security issues.

Thanks in advance.


texts:
I am the owner of the old smart contract:
https://etherscan.io/token/0x73de68dxxxxxxx
Now I have created a new smart contract:
https://etherscan.io/address/0xd4c04exxxxxxx
How do I transfer a new token to all those who own the old token?
May everyone help me.


texts: ethers.js Recover public key from contract deployment via v,r,s values

texts:
I'm currently trying to get the public key of the user that deploys a contract. Unfortunately I can't make it work.

I am trying to achieve this solely by using ethers.js as I don't want to bloat my React build with other packages. I can easily get the public key from a given signature using the following code taken from this issue.

    let msg = "This is a normal string.";
    let sig = await signer.signMessage(msg);
    const msgHash = ethers.utils.hashMessage(msg);
    const msgHashBytes = ethers.utils.arrayify(msgHash);
    const recoveredPubKey = ethers.utils.recoverPublicKey(msgHashBytes, sig);
    const recoveredAddress = ethers.utils.recoverAddress(msgHashBytes, sig);

When deploying a contract I should be able to do the same thing by simply stitching together the r, s and v values taken from the deployTransaction. The example in the documentation is similar. Here's my code:

    const deployTx = contract.deployTransaction;
    const msgHash = ethers.utils.hashMessage(deployTx.raw);
    const dataBytes = ethers.utils.arrayify(msgHash);
    const expanded = {
      r: deployTx.r,
      s: deployTx.s,
      recoveryParam: 0,
      v: deployTx.v
    };
    const signature = ethers.utils.joinSignature(expanded);

    // now the signature should be correctly formatted
    const recoveredPubKey = ethers.utils.recoverPublicKey(dataBytes, signature);
    const recoveredAddress = ethers.utils.recoverAddress(dataBytes, signature);

This approach does not work. As far as I know the data that was signed during the deployment is in deployTransaction.raw. So this should work. But I tested it with deployTransaction.data as well.

To me it looks like the signature might be wrong. The joinSignature automatically converts the v value to either 27 or 28. According to EIP155 this doesn't make any sense?

Edit: To clarify, I think all I need is the true signing hash. How can I generate it? It's apparently not the hash of the raw deployment transaction.

Edit 2: After some research in the ethereum book I found this:

In Ethereum’s implementation of ECDSA, the "message" being signed is the transaction, or more accurately, the Keccak-256 hash of the RLP-encoded data from the transaction. The signing key is the EOA’s private key.

So I changed my code to the following:

    const deployTx = contract.deployTransaction;
    const msg = ethers.utils.RLP.encode(deployTx.data);
    const msgHash = ethers.utils.keccak256(msg);
    const msgBytes = ethers.utils.arrayify(msgHash);
    const expanded = {
      r: deployTx.r,
      s: deployTx.s,
      recoveryParam: 0,
      v: deployTx.v
    };
    const signature = ethers.utils.joinSignature(expanded);
    const recoveredPubKey = ethers.utils.recoverPublicKey(
      msgBytes,
      signature
    );
    const recoveredAddress = ethers.utils.recoverAddress(msgBytes, signature);

This still does not work unfortunately.


texts: Hello iam newbee in blockchain, i install ethereum wallet on my windows and create wallet in testnet network. Can i somehow get some eth for free for testing contract? I trying to mining but its not working yet.How many time i should to wait?


texts: Solidity: Save multiple data to bytes array and get it from there

texts:
I have 3 admins in my ethereum contract and voting system. Any admin can start a new voting, for example for changing admin addresses, allowing to transfer tokens from main wallet (by default they are locked), and few more. When 2 admins vote for yes, vote will proceed, if no, voting will be cancelled. If one admin will vote yes, other no, and third won't do anything, others can vote for cancel the current voting. There can be only one active voting at once (vote cancelling is an exception).

For now it's working, but it's, I guess, expensive. For each start voting I made a different function, for example:

function startVoteForChangeBuySellPrice(uint buyPrice, uint buyAddUnits, uint sellPrice, uint sellAddUnits, bool ignoreSecurityLimits) external onlyAdmin
{
    uint sellTotalPrice = sellAddUnits * sellPrice;
    require(voteType == VoteType.NONE);
    require(buyPrice >= sellPrice);
    require(sellTotalPrice <= weiFromExchange);
    voteType = VoteType.CHANGE_BUY_SELL_PRICE;
    voteReturnData[0].uintData = buyPrice;
    voteReturnData[1].uintData = buyAddUnits;
    voteReturnData[2].uintData = sellPrice;
    voteReturnData[3].uintData = sellAddUnits;
    voteReturnData[0].boolData = ignoreSecurityLimits;
    internalResetVotingData();
    voteId = voteId.add(1);
}

As you can see, for storing variables I made a mapping of increasing uint and struct, which holds uint, address, bool and string.

Later in the code, if voting is succeeded with 2/3, data is being read like this:

    else if(voteType == VoteType.CHANGE_BUY_SELL_PRICE)
    {
        internalChangeBuySellPrice(va.uintData, voteReturnData[1].uintData, voteReturnData[2].uintData, voteReturnData[3].uintData, voteReturnData[0].boolData);
    }

As I said, it's working as expected, but I want to make it more efficient with replacing VoteReturnData with single bytes array which will hold entire current voting data. How can I hold multiple types of multiple variables in one single bytes array and later, when I execute voting, get them from bytes array?


texts:
I converted some BTC to my ether mist wallet early this year.

I did it before Mist was fully synced. I have a old macbook, so I still can't have it fully sync until now.

On Etherscan, I can see my Ether there. This week I decided to use myetherwallet.com to transfer my ether to my other wallet.

I have the keystore file, was asked for my password. From my memory, I didn't type in any password in Mist.
My question is: Is it possible, I don't have password for my wallet? or I just forgot I did enter the password at the start? Thanks


texts: Trying to reference mortal.sol in standard ethereum library

texts:
I am trying to reference mortal.sol in the standard ethereum library. I have deployed mortal.sol under my main test account. However I get the error source not found. What I tried was:

import "https://github.com/ethereum/solidity/blob/develop/std/mortal.sol"

Then I have a contract set up like:

contract foo is mortal {

somestuff;
}

what do I need to do to reference a Mortal contract that is deployed already on the chain?

I have looked at some posts but cannot seem to figure out. Any ideas?

Thanks!


texts: How do I send a transaction to a smart contract?


texts: Removing LP from Uniswap/Pancake using seth and removeLiquidityWithPermit(). How is the correct hash for the permission signing calculated?

texts:
I'm trying to figure out how I can remove LPs from Uniswap/Pancakeswap using the function
  removeLiquidityWithPermit(address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s)

I want to do this on the command line so I'm using seth.
I managed so far the deposit, but now I'm facing an issue with the signing.
My major problem is how to calculate and obtain the values of uint8 v, bytes32 r, bytes32 s.
Uniswap function that checks the permission:
  function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
    require(deadline >= block.timestamp, 'UniswapV2: EXPIRED');
    bytes32 digest = keccak256(
        abi.encodePacked(
            '\x19\x01',
            DOMAIN_SEPARATOR,
            keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
        )
    );
    address recoveredAddress = ecrecover(digest, v, r, s);
    require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE');
    _approve(owner, spender, value);
}

I can't still figure out what and how to encode to get the right values.
I'm adding more code and experiments, I'm using that code in node to generate the hash that needs to be signed via seth sign later on, which is separated into v, r, s and attached to the send. Testing on BSC testnet and PancakeSwap
var Web3 = require('web3');
var web3 = new Web3('http://localhost:8545');

const PERMIT_TYPEHASH = '0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9'; //is taken from the Pancake Testnet contract,
const DOMAIN_SEPARATOR = '0x...'; // using the one assigned to the LPs from the LPs contract field!
const x19 = '\x19\x01';

//function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s)
var owner = '0x...'; // This is my address that is executing the send and also the owner of the LPs
var spender = '0x6725F303b657a9451d8BA641348b6761A6CC7a17' //Pancake swap
var value = '0'; //same like the submitted later on value
var nonce = '23'; // same like in the later on transaction containing the hashes
var deadline = '9632157400'; // same like in the later on submission with seth

var x = web3.utils.keccak256(web3.eth.abi.encodeParameters(['bytes32', 'address', 'address', 'uint256', 'uint256', 'uint256'],[PERMIT_TYPEHASH, owner, spender, value, nonce, deadline]));

var y = web3.utils.keccak256(web3.eth.abi.encodeParameters(['string','bytes32','bytes32'], [x19, DOMAIN_SEPARATOR, x]));

console.log(y) // this then gets signed with seth sign with the key form the sender.

Still I'm getting Fail with error 'Pancake: INVALID_SIGNATURE'. Am I doing something wrong here? Where should I look for a solution?
Thank you!


texts: Creating a 2D in-memory array in Solidity

texts:
I'm trying to work with 2D in-memory arrays in Solidity, in which the size is not known at compile time. I've noticed that if I define the array size as a constant, then I can use this syntax, which compiles and returns the expected 10x10 array:

uint256 constant size = 10;

function initArray() public view {
    uint256[size][size] memory arr;
    // ...
}

However, if I define the size using a variable, I get problems:

uint256 size = 10;

function initArray() public view {
    uint256[size][size] memory arr;
    // ...
}

Which leads to: TypeError: Invalid array length, expected integer literal or constant expression.

So I then try to use the new syntax, but I can't figure out how to use it for 2D arrays. First I try the simplest thing:

uint256 size = 10;

function initArray() public view {
    uint256[][] memory arr = new uint256[][](size)(size);
    // ...
}

This leads to an error: TypeError: Type is not callable, which makes sense. But then, how do I define the size of the inner arrays? I then tried:

uint256 size = 10;

function initArray() public view {
    uint256[][] memory arr = new uint256[][](size);
    for (uint i; i < size; i++) {
        arr[i] = new uint256[](size);
    }
    // ...
}

This compiles but creates some nonsense data structure. Can anyone provide some guidance? The fact that this is possible via constants leads me to think there's no fundamental barrier, I just can't figure out the syntax for passing size via a variable. Thank you!!


texts:
I'm trying to test a very simple example in Zokrates. so I used the very first example in the documentation, which is:
// This is an example from https://zokrates.github.io/gettingstarted.html
def main(private field a, field b) -> (field):
field result = if a * a == b then 1 else 0 fi
return result

And after deployment of verifier smart contract, I tried to test different number for proofing that. for example, a=2 and b=4 and I get this message 0:bool: r true correctly.
But the problem is, I get the same response for any wrong proof same as correct proofs. For example a=3 and b=19 I get  0:bool: r true again.
why wrong proofs have a true response?


texts: how to find total transaction volume in web3

texts: I need to find the sum of ETH value transacted to and from a contract address in web3, like in last 24 hours. I have no clue to find it through web3 api. I am using web3 version 1.0. Can anyone help me here.


texts: How to access an API from a solidity smart contract?

texts: I saw how this can be done using Oraclize. Is there any native way to access an API from a solidity smart contract? I understand there is a restriction on the solidity program to be able to call an API.


texts: How to connect my private ethereum network to ethereum android app?

texts: I want to access my smart contract through a mobile app, which is on my private network. There is ethereum android app, can I connect that app to my ethereum network or if there any other app through which I can access my smart contract on the private network.


texts: Contract Interaction and Batch Transaction with Web3

texts:
I've reviewed most all of the posts on this topic, but none of the answers are doing exactly what I need.
I have an application that allows users to submit their tokens from their contract into my "pool" at my own contract address. What I want to happen is that an outside address can request for my own contract to send them these new tokens after they pay an ETH fee. So the sequence is as follows, using random amounts for example:

User A (contract owner) sends 100 tokens from their contract address to my pool address (I already have this working)
User B (interested buyer) clicks a button on my application that will grant them 20 of these tokens from my pool address in exchange for ETH amount that is predetermined on the app.

I assume I will need to use a batch add function here to release the tokens and accept the ETH, but how do I get my pool address to approve the transaction automatically without my interference?

Note: My pool address can hold multiple tokens, so I would also need to specify which token is being sent during the transaction.


texts: Using node.js modules/code from the JavaScript console of geth

texts:
I have a JS filter which checks for the ether transferred in a recent transaction. I have loaded this script from the interactive JS console and it's working fine. Based on the ether in the transaction, I want to run external python scripts. For e.g.(Not actual code):

if (ether = 10){
  test1();
}

And the node.js code for these functions:

function test1() {
    var spawn = require("child_process").spawn;
    var pc1 = spawn("python",["/path/to/test1.py"]);
}

This code is working fine when I execute it separately. But when I include this in the JS snippet and reload it to the console(using loadScript()), I get the following error:

  err: cannot find module 'child_process'

child_process is a default node.js module. I understand that this is not a problem with the code but with the integration of node.js into geth client. Is this not possible at all or are there any workarounds?


texts: What is Ethereum's hash input data size?

texts:
I'm testing https://github.com/mjosaarinen/tiny_sha3 project on my machine with GPGPU features of https://github.com/tugrul512bit/Cekirdekler and it successfully hashes a single byte correctly in a single thread as same as in https://emn178.github.io/online-tools/sha3_512.html.

Now I need to test for speed to know how many hashes per second. What is the input data size? Single char as I just did? 32 bytes? 1kB? 100kB? 10x1kB? 32x10kB? NxM bytes? What are N and M?

I see everywhere that the metric is million hashes per second but with what size of input data?


texts: Where do I find the required information to create a new Ethereum implementation from scratch?

texts: There is the Yellow Paper, but I'm not sure it is complete (in the sense it includes everything one needs) and up-to-date (including all the recent changes). So, suppose one wants to create a new Ethereum client from scratch. How does one proceed with it?


texts: Calling a constant function with no arguments using async

texts:
Is there a way to call a contract with no arguments using async?
Contract code:

contract A {
     function test() constant returns(string s, address addr) {
        s = "Success!";
        addr = msg.sender;
    }
}

Here is the js code:

async.waterfall([
        function getResult(cb) {
      contractObject = web3.eth.contract(abi);
            contractInstance = contractObject.at(address);

      contractInstance.test.call(
  function(err,getOutput) {
       if(err) {console.log(err);}
       var gotOutput = getOutput;
       console.log('Test result received: ' + getOutput);
    return cb(null,gotOutput);
     });
        }
    ], function asyncComplete(err, getResult) {
        if (err) {console.log(err);}
        var result = [];
        result.push({ result: getResult[0], address: getResult[1]});
        console.log(result);
    })

The error I am currently seeing when I execute the above code against testrpc, is

  BigNumber Error: new BigNumber() not a base 16 number:

Any suggestions on how to get around this error?


texts: The term "Sybil Attack" comes up often when discussing network security with researchers. What is it? How much of a concern is it to the Ethereum network? What are some effective ways to prevent it?


texts: Smart contract function always returning transaction underpriced or exceeds block gas limit

texts: Was wondering if anyone has come across this before. I am using Ropsten through Infura and no matter what I set the gas to it will always return either transaction underpriced or exceeds block gas limit.


texts:
I have solc v0.5.2 on my system, but I have several contracts, that require solc < v0.5, so that I get errors:

  Error: Source file requires different compiler version

What is the best way to run and choose between multiple versions of solc?

Just download solc v0.4.25, rename it into e.g. solc04 and move it into /usr/bin/? Or is there something like virtual environments for solidity?


texts: Calling function of deployed contract and getting return value in matrix?

texts:
I am looking for some help here.

I would like to know how (using matrix) that I could call a function of an already deployed contract on the Ropsten net and get the return value. I have searched a lot and not found anything about how to do this.

I know the name of the function and the address of the contract.

contract Test2 {

    function Test2s() public{
        int t = test() ;
    }

    function test() public returns (int c){
        address addr = address(0xFbdCc***************************6 );
         bytes4 sig = bytes4(keccak256("function()")); //Function signature

         assembly {
        let x := mload(0x40)   //Find empty storage location using "free memory pointer"
        mstore(x,sig) //Place signature at begining of empty storage

        let success := call(
                            500000, //50k gas
                            addr, //To addr
                            0,    //No value
                            x,    //Inputs are stored at location x
                            0x00, //Inputs are 68 bytes long
                            x,    //Store output over input (saves space)
                            0x20) //Outputs are 32 bytes long

        c := mload(x) //Assign output value to c
        mstore(0x40,add(x,0x44)) // Set storage pointer to empty space
    }
    }
}

Ive managed to get htis on the network but I keep getting internal errors even though the contract concludes.
Any asistance would be so appreciated.

Thanks!


texts: Complete a transaction outside of Solidity

texts:
Example for my e-commerce site:

uint public PO;

function () {
    emit Purchase(PO++, msg.sender, msg.value, msg.data); // first param is indexed
}

The code above is for illustrative purpose only.

I have code listening to the Purchase event. May I know if the following possible?

the Indexed PO value skipped some numbers because some of the transaction are rejected by the block chain?
After receiving Purchase event at my listener, the transaction was rejected by blockchain?
The PO+ was received out of order because some transactions were outgassed

Thanks dude


texts: I've installed Truffle by npm, and running testrpc, but console.log is not working in Truffle console. A simple console.log('test'); do nothing. Any idea?


texts: Ethereum Smart Contract execution principle

texts:
I have a question that might sound really dumb, but its understanding is crucial for me.

Say, I have a Smart Contract, which has a public variable, and a setter to change that variable. If a Smart Contract is executed by 2 addresses simultaneously, how the Ethereum Blockchain behaves? Will it execute the first contract for the first address, and then execute it for the second one, or will it make a "copy" of the contract, to execute it for the second address? Can there be a case, when the setter function for the second address will fail to change the variable, since the variable will be already "in use" by the first address?


texts:
I am trying ito integrate EthereumJ within a OSGi based application. Has anyone succeeded doing so? I can't seem to get the dependencies/gradle.build right. Other that that, is it possible to have a node running as seperate process and remotely access this node via an API (Rest)?

thx


texts:
Does anyone have the 'somefunc' below to store bytes (specifically bytes4) as a string?  Ideally something to get method_s in the code below:

contract Test{
  bytes4 public method;
  string public method_s;

  function Test() {
    method = this.get_f.selector;
  }

  function makeString(){
   method_s = somefunc(method);
  }

}

So I need
method = 0x0cb9ef7a
and method_s = "0x0cb9ef7a"

Many thanks in advance


texts: How can i format SHA256 hash to bytes32 using ethers.js

texts:
I created a solidity function with bytes32 array

function addHashes(bytes32[] memory _hashes){

}

to store SHA256 strings into ethereum blockchain. initially, I used string[] in place of bytes32[] since string[] is an experimental feature. so I changed it to bytes32[].

to create sha256 hashes i am using crypto-js nodejs library.

var hash = CryptoJS.SHA256("Message");

hash.toString(CryptoJS.enc.Hex)
> "2f77668a9dfbf8d5848b9eeb4a7145ca94c6ed9236e4a773f6dcafa5132b2f91";

and to connect with blockchain and interact with deployed contract i am using ethers.js.

When i convert this hash to byte32. i am getting below error

> ethers.utils.formatBytes32String("2f77668a9dfbf8d5848b9eeb4a7145ca94c6ed9236e4a773f6dcafa5132b2f91")
Uncaught Error: bytes32 string must be less than 32 bytes
at Object.formatBytes32String (/home/node_modules/ethers/utils/utf8.js:164:15)

I know the error says the hash should be 32 length string. But SHA-256  is 256-bit (32-byte)


texts:
I have run geth --fast --cache=1024 for a week and I think I am almost complete: etherscan.io shows:

LAST BLOCK 4005552

and my eth.syncing shows:

{
  currentBlock: 4005449,
  highestBlock: 4005553,
  knownStates: 1157252,
  pulledStates: 1141319,
  startingBlock: 4005266
}

But geth --fast never change to normal and keep on getting new state only:

  INFO [07-11|09:20:49] Imported new state entries count=3
  flushed=4   elapsed=0s processed=1273621 pending=10500 retry=2
  duplicate=1200 unexpected=2461

What should I do? Can I just stop and run normal geth without --fast flag? Or can I try mining already?


texts: why the below error is thrown when doing transaction with metamask to the truffle

texts: the error is thrown is shown in the below picture.While doing the transaction an error stating ethjs-rpc with payload["id:761..,Jsonrpc:"2.0","params":"0xf8..]


texts: In geth code files, where is the implementation of generating a fixed enode id?

texts: The process of generating an enode id seems to be: "Generate private key -> Generate public key -> add the IP and port". If I restart the computer, the node id changes as well. How can I do if I want to fixed this node id (like the bootnode key), where is the implementation of this process?


texts: What is the maximum gas price that we can set in a transaction?

texts:
what is the maximum gas price can we set it in a transaction ?

I am always using '3000000' to avoid 'run out of gas exception' (poa network)

But when I got 'replacement transaction underpriced' I cant resolve it


texts: What value pass in argument of transfer function of ERC223 Token

texts:
I am implementing a ERC223 token.I successfully deployed ERC223 token on local block-chain network block-chain.

transfer function solidity  code is:-

function transfer(address _to, uint _value, bytes _data) {
        // Standard function transfer similar to ERC20 transfer with no _data .
        // Added due to backwards compatibility reasons .
        uint codeLength;

    assembly {
        // Retrieve the size of the code on target address, this needs assembly .
        codeLength := extcodesize(_to)
    }

    balances[msg.sender] = balances[msg.sender].sub(_value);
    balances[_to] = balances[_to].add(_value);
    if(codeLength>0) {
        ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
        receiver.tokenFallback(msg.sender, _value, _data);
    }
    emit Transfer(msg.sender, _to, _value, _data);
}

function transfer(address _to, uint _value) {
    uint codeLength;
    bytes memory empty;

    assembly {
        // Retrieve the size of the code on target address, this needs assembly .
        codeLength := extcodesize(_to)
    }

    balances[msg.sender] = balances[msg.sender].sub(_value);
    balances[_to] = balances[_to].add(_value);
    if(codeLength>0) {
        ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
        receiver.tokenFallback(msg.sender, _value, empty);
    }
    emit Transfer(msg.sender, _to, _value, empty);
}

One thing I can not understand.What value I passed in transfer function arguments. when I checked my ERC223 token working correctly or not??

1.What should be address _to value in transfer function?

2.What should be uint _value in transfer function?

3.What should be bytes data in transfer function?

4.what params should be given in place of _data?


texts: How would you optimise this iteration in a contract for gas usage?

texts:
We are two young devs that are starting to explore this amazing world.
As a starting project we wanted to make a funny, but real, project on Ethereum.
The project is inspired by DecentraLand (LAND) and is pretty simple:
We have a 1000x1000 area (representing a map) and we want to let the users to claim an arbitrary piece of this map, communicating a Starting XY and an Ending XY coordinates.
This will generate an unique token (ERC-271) that will represent this area of the map.
Our main problem is the algorithm that will check if an area is already claimed or not.
The more users will claim a piece of map the more we will have to iterate to know if a new order should fail or not, raising the gas fee to the roof.
The smart contract will be like:

Take the new order containing the start and the ending coordinates
Iterates for every previous area bought while checking if there is an overlap
Revert or Confirm the transaction

And this will get so much expensive in terms of gas when you have to check a lot of previuosly claimed areas.
Any suggestion?
Thank you a lot!


texts: How to calculate the gas cost of Solidity's 'transfer'?

texts:
I have read that the gas cost of transfer function is 2300Ether. I have got the following contract having a function, testFunc(…), only containing transfer method as shown below, because I want to calculate the cost of 'transfer' function:
pragma solidity ^0.5.1;
contract TransferCost{
   uint public testVal = 97 ether;
   function testFunc(address payable addr) public {
      addr.transfer(testVal);
         }
   function deposit() payable public{}
}

When I am estimating the cost of the testFunc() function using truffle console, I am not getting 2300 instead I am getting 32201.
Truffle(development)> TGC= await TransferCost.new()
undefined
:
:

truffle(development)>  balance = await web3.eth.getBalance(TGC.address)
undefined
truffle(development)>  web3.utils.fromWei(balance, "ether")
'194'

truffle(development)> await web3.eth.getGasPrice()
'20000000000'

truffle(development)> await TGC.testFunc.estimateGas('0x515f013CfC0B1beA8C4B95Baa438258EA1D81eeA')
32201

Somebody please guide me how can we calculate the cost of Solidit's 'transfer' function to be 2300 Ether?
Zulfi.


texts: How can I add an element to a mapping array (mapping[])?

texts:
Remix accepts the following code and allows me to deploy the contract:

pragma solidity 0.4.24;

contract bytes32array {

mapping(address => uint)[] balances;

    function addBalance(address _address, uint _index, uint _amount) public {
        balances[_index][_address] = _amount;

    }

    function getBalance(address _address, uint8 _index) public view returns(uint) {
          return balances[_index][_address];

    }

}

However, when I try to use the "addBalance" function, I just get an error (both in Javascript VM and through web3/testrpc).  I get the error "VM Exception while processing transaction: invalid opcode".  I can't figure out what I'm doing wrong, especially since the syntax is accepted.


texts: How do I install Mist from the pre-built binaries on 32-bit Linux?

texts:
I'm attempting to install Mist (i.e. the Wallet) on a fresh Linux install (Ubuntu 14.04). I've already got it running on other machines of different platforms.

Instead of following the CLI instructions, I'm being lazy and downloading the pre-built binary from the Releases page, with the idea being that I can just run the executable and it'll create me a node. (Which is what the documentation says should happen... )

After downloading the binary and running the Ethereum-wallet executable, it's giving me the following GUI pop-up:

("No Ethereum node binary found!")

Running from the command line instead, I get the following output:

~/Ethereum-Wallet-linux32-0-7-2$ sudo ./Ethereum-Wallet
[2016-04-30 19:11:12.406] [INFO] main - Starting in Wallet mode
[2016-04-30 19:11:12.742] [WARN] nodeConnector - NODECONNECTOR ERROR { [Error: connect ECONNREFUSED /home/richard/.ethereum/geth.ipc]
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '/home/richard/.ethereum/geth.ipc' }
Error: connect ECONNREFUSED /home/richard/.ethereum/geth.ipc
    at Object.exports._errnoException (util.js:856:11)
    at exports._exceptionWithHostPort (util.js:879:20)
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1063:14)
[2016-04-30 19:11:13.110] [INFO] ipcCommunicator - Backend language set to:  en
[2016-04-30 19:11:13.167] [WARN] nodeConnector - NODECONNECTOR ERROR { [Error: connect ECONNREFUSED /home/richard/.ethereum/geth.ipc]
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '/home/richard/.ethereum/geth.ipc' }
Error: connect ECONNREFUSED /home/richard/.ethereum/geth.ipc
    at Object.exports._errnoException (util.js:856:11)
    at exports._exceptionWithHostPort (util.js:879:20)
    at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1063:14)
[2016-04-30 19:11:14.091] [INFO] main - Node type:  geth
[2016-04-30 19:11:14.092] [INFO] main - Network:  main
[2016-04-30 19:11:14.094] [INFO] ethereumNodes - Start node from /home/richard/Ethereum-Wallet-linux32-0-7-2/resources/node/geth/geth
[2016-04-30 19:11:14.114] [INFO] ethereumNodes - Stopping nodes...
[2016-04-30 19:11:14.114] [INFO] ethereumNodes - Starting geth node...
[2016-04-30 19:11:14.130] [INFO] ethereumNodes - Stopping nodes...

What am I doing wrong? Was I wrong to assume the node would be set-up automatically, and that I have to do so first as a separate task?


texts: What mathematical concepts do I need to master in order to understand the Aztec Procotol?

texts:
What mathematical concepts do I need to master in order to understand how privacy in the Aztec Protocol works?

When I look at the white paper, I have no idea what is going on; however, I am confident in my ability to figure it out. The extent of my math knowledge is university level calculus.


texts: How do I find the token address as on line 11 in etherscan

texts:
How do I get the token address for a token as stated on line 11?
Got blocked out of Token.store by S.E.C. action having a U.S. IPS

I asked their support and they said the following:

If your account is with Metamask, go to https://etherscan.io/address/0x1cE7AE555139c5EF5A57CC8d814a867ee6Ee33D8#writeContract
and click "write contract"
and then use function 3 or 11 depending on if it's ETH or token


texts: Error: Provided address is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted?

texts:
Can anybody please help me fix this error? I do not know why it happens:

  Error: Provided address is invalid, the capitalization
  checksum test failed, or its an indrect IBAN address which can't be
  converted

I tried it on remix and it works


texts:
I need help understanding why the first push to a dynamic array is more gas consuming.
For example, executing the push endpoint in the following code:
pragma solidity >0.7.0 <0.8.0;

contract  PushTest{

    uint[] array;

    function push ( uint amount) external {

        array.push(amount);
    }
}

The first push consumes 41129 gas, while the second one only consumes 26129. I tried to debug the execution with Remix but apparently the same EVM instructions are being executed for the first and following pushes.


texts: Can I relay signed transactions from device to server to Ethereum?

texts:
I am trying to generate transactions from a device that will have a copy of my private key, send that over to my node server, which will then just send that over to ethereum.

Are transactions just like JSON blobs that I can relay like that? I just want my server to be a proxy that WRITES whatever transactions the device generates.


texts: Using different Ethereum network in Metamask in different tabs

texts: Is there any way to have Metamask use, for instance, the mainnet in one Chrome tab and Kovan in another? Thanks!


texts: Truffle Test Library - TypeError: Member not found or not visible after argument-dependent lookup in library

texts:
Can somebody confirm this behavior and provide a solution?
Using truffle test I get the error message Member "functionName" not found or not visible after argument-dependent lookup in library A. Is it because I am trying to write a test for a library?

A.sol

pragma solidity 0.4.21;
library A{
    function functionName(uint256 a, uint256 b) public pure returns(bool){
        return (a == b);
    }
}

TestA.sol

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

contract TestA {
  function test_functionName() {
    A a = A(DeployedAddresses.A());

    bool expected = false;
    Assert.equal(a.functionName(1, 0), expected, "Comparing: 1 is not 0");
  }
}

deploy_contracts.js

var A = artifacts.require("A");

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


texts: wanted to know if anyone has experimented with AMD's Firepro Gpu's for mining ether? if so what were there results? want to know if it is a practical investment or if regular gaming GPU's are the way to go?


texts: Request to http://localhost:8545 from https website

texts:
I am building a website that should interact (from the browser, not back-end) with custom Ethereum nodes, including local, something like MyEtherWallet.
I can connect to ganache http://localhost:8545 with no problems if the website itself is served via http.

If I switch website to https, then I get an error when trying to web3.eth.call for example

OPTIONS https://localhost:8545/ net::ERR_CONNECTION_CLOSED

Which seems strange for it reports https://localhost:8545/, not http.
I guess it relates to problems with https-to-http requests. But I am pretty sure there is a way to overcome this error as MyEtherWallet has no difficulties with connecting to my local http ganache.

What am I missing?


texts: Who, what or where is a contract executed on a call?

texts:
In most exaplanations of the essentials of Ethereum, I miss an important detail: "Who runs the computations of a smart contract?".

Say I make a call, add some gas, all of which allows me to, say, extract some tokens from a (solidity) contract.

Where is the code ran?

Reading a question about fees makes me believe it is a miner.

  If the Solidity is being executed in a transaction, the fee always goes to the miner of the block, even if there is an Out of Gas or execution error of any kind.

If that is the case, what miner will run the code? All of them? The winning one?

However, reading a question on the how- of executing contracts makes me beleive it is the node executing this. Would that be the node one is connected to? And when a node needs to call another contract as part of this contract-call, will it do so on itself, or delegate that to another node?

And if it is the nodes, do miners need to re-run a contract in order to decide whether it's outcome state was properly ran?

Another question covers the when: at what time are they ran. The answer there does cover some of the "who", but does not explain explicitely who is running it.


texts: Deriving Ethereum address from Bitcoin address

texts:
As far as I know Ethereum private keys are compatible with Bitcoin private keys, as described in Can I use the same private key for Ethereum and Bitcoin? .

HOWEVER

Can I derive an Ethereum public address from a Bitcoin public address? Without access to the private key. So that the same Bitcoin private key behind the address could be also used in Ethereum network.