texts: Uniswap - cancelled transactions and lost ETH

texts:
I started a swap on Uniswap and while it was processing, I started 2 more swaps.
The first swap got stuck for hours so I first tried increasing the gas fee and then eventually, I tried to cancel it.  I also tried to cancel the 2 later swaps.
Once things finally got cleared out, it seems that i have lost the ETH for all three swaps.
Please can someone let me know if (1) I am right, and (2) is there anything I can do about it?!
Many thanks in advance!!
Wallet: 0x92fc173569EFa83cD810C018f497B59854D110dB
Let me know if you need any more info to help!!
Thanks all


texts: Are all Accounts available in every node in the network?

texts:
In the context of building DApps, Can a DApp have access to any account across the network (any given node)? Or just the accounts created for the Node it "points" to?

I guess this is another way of asking if accounts are global? For example, when I create a new account using Geth, is that Account replicated across the entire network?

I appreciate all the answers, I'm kind of confused as a beginner that I still in the world of Ethereum.

Cheers!


texts:
how are you doing! I would like to know what happens if from a ethereum seed I derive a wallet using BIP49, BIP84 derivation path and then send ethereum from another wallet which is BIP32 or BIP44, what will happen ?

because BIP49 starts with 3, and BIP84 with bc1,
I know they are related paths to BTC but in etherum It will work then?

thanks a lot


texts: web3 - call a variable, wait, get variable, wait, loop, get vars in loop, wait and do action

texts:
In my contract there are 2 functions, the first one returns an array size and other one returns data from the array with index passed as a parameter.

In my web3 script I'm trying to read array size and when done, perform loop, put data into the array, sort data from highest to lowest value and display it on the screen.

The problem is data is asynchronous, for now it displays data before finishing the loop. I need to wait until the loop is complete. How can I change this code to make it working?

The following code is inside async function:

const total = await promisify(cb => platform.getArraySize(cb));
items = [];
for(let i = 0; i < total; i++)
{
    // wait??
    platform.getData(i, function(error, result)
    {
        items[i] = [result[0].toNumber(), result[1].toNumber()];
        items = items.sort(function(a, b)
        {
            return b[1] - a[1]
        });
    });
}
for(let i = 0; i < items.length; i++)
{
    $("#container").append("
a: " + items[i][0] + ", b: " + items[i][1] + "
");
}


texts: How to store user private keys and details

texts:
I am creating an android DApp and have used go-ethereum to create wallets for users when they create an account. This stores the private key on their device. I want to also keep all of their details on something else so their name, email, keys and hashed password are kept together. How would I go about doing this so they are all secure? Is it as simple as storing them in a database? And would I even have to do that? Is there a better way?

Thanks!


texts: How do you get a json file (ABI) from a known contract address?

texts:
I want to watch a Solidity contract using the Mist browser. I know how to do that and it needs the address and the json. I have the address, but I don't have the json. I do have the source code.

Can I generate the json from the source code and/or the Ethereum address?


texts:
const ipfsClient = require('ipfs-http-client')
const ipfs = ipfsClient({ host: 'ipfs.infura.io', port: 5001, protocol: 'https' })

uploadAsset = (cost) => {
    console.log("Submitting file to ipfs...")
    ipfs.add(this.state.buffer, (error, result) => {
      console.log('Ipfs result', result)
      if(error) {
        console.error(error)
        return
      }
    console.log("no error")
      this.setState({ loading: true })
      this.state.dstock.methods.uploadAsset(result[0].hash, cost).send({ from: this.state.account }).on('transactionHash', (hash) => {
        this.setState({ loading: false })
      })
    })

The function uploadAsset is being called by a child component which passes the cost.
I am unable to get the resut and the below mentioned thing comes on chrome console


texts: If I need to implement a smart contract with a function that should be automatically executed each 1 hour (for example). Any suggestions for how to implement such a smart contract?


texts:
I am trying to go to ground 0 in my Ethereum PoA network but my mining node is constantly generating some "DAG" forever. When I run it first time it didn't happen.

Why and how to avoid it?

What I did to reset to ground zero:

geth removedb
rm -rf .ethash .ethereum
rm -rf node1/geth node1/geth.ipc

bootnode -nodekey boot.key -verbosity 9 -addr :30310
geth --datadir node1/ --syncmode 'full' --port 30311 --rpc --rpcaddr '$HOST' --rpcport 8501 --rpcapi 'personal,db,eth,net,web3,txpool,miner' --bootnodes 'enode://longnumber@127.0.0.1:30310' -unlock '0x$ACCOUT_ADDRESS' --password node1/password.txt --mine

Result, never ending DAG epoch generation:

INFO [03-05|18:00:40] Starting mining operation
INFO [03-05|18:00:40] Commit new mining work                   number=1 txs=0 uncles=0 elapsed=326.442µs

INFO [03-05|18:04:05] Generating DAG in progress               epoch=0 percentage=27 elapsed=3m23.916s
INFO [03-05|18:04:12] Generating DAG in progress               epoch=0 percentage=28 elapsed=3m31.173s
INFO [03-05|18:04:19] Generating DAG in progress               epoch=0 percentage=29 elapsed=3m38.177s
INFO [03-05|18:04:26] Generating DAG in progress               epoch=0 percentage=30 elapsed=3m44.764s
INFO [03-05|18:04:33] Generating DAG in progress               epoch=0 percentage=31 elapsed=3m51.474s
INFO [03-05|18:04:40] Generating DAG in progress               epoch=0 percentage=32 elapsed=3m58.865s
INFO [03-05|18:04:47] Generating DAG in progress               epoch=0 percentage=33 elapsed=4m6.189s
INFO [03-05|18:04:54] Generating DAG in progress               epoch=0 percentage=34 elapsed=4m12.615s
INFO [03-05|18:05:01] Generating DAG in progress               epoch=0 percentage=35 elapsed=4m19.675s
INFO [03-05|18:05:09] Generating DAG in progress               epoch=0 percentage=36 elapsed=4m27.605s
INFO [03-05|18:05:16] Generating DAG in progress               epoch=0 percentage=37 elapsed=4m34.935s


texts: i Tryed lowering My GAS fees and now my Transaction is stuck >?

texts:
i Tryed sending some DENT out from my exodus wallet and i Lowered the ETH gas Fees to the point where that little Dot indicator in the Exodus wallet  turned orange ( red being the slowest ) Orange was implying it will be slow, i know it would take time but the first attempt failed and said " Dropped " so i tryed again and now its been about 4 hours and it hasn't been " Dropped " yet and is instead just stuck it seems ?
Ether scan also has not made any progress
The Transaction ID is 0x8d49e713b5b66b183c6095474976f5cf5d00bb550110631c87ed8f487ec92701 if a mod can help , i also have sent in email but no reply
is my tokens gone ? what if 20+ more hours pass and it still not returned back to my wallet?  what if it is glitched in a never ending loop


texts: Syncing events on Database - Dealing with blockchain reorganization

texts:
My Dapp relies on live events synchronization on a centralized database. There is always a server side script polling the blockchain for new events, parsing then and do the corresponding operations on the database.
Blockchain reorganization is a game breaking. As a common practice, I know it is suggested to wait for 12 confirmation blocks before syncing.

However, I'm testing on ropsten and I'm get reorganizations spanning 200 blocks!!! After a week of researches I'm stuck.
Does it happen only on testnet? Is there a more realible testnet where I can trust 12 confirmations? How can I deal with this and realize live sync on the database?


texts: Latest block number and its transactions from etherchain.org

texts:
I am trying to get the latest block information such as latest block number and all its transactions details such as Tx hash, gas price, gas used, timestamp etc., from etherchain.org. I know Etherscan has their API for such things, but I also need to see whether Etherchain have those.
Is there such etherchain api to get these information? Etherchain has https://etherchain.org/api/basic_stats to get some stats, and https://www.etherchain.org/api/gasPriceOracle to get gas price but none of them provides the latest block  and its information.
Anyone have any idea on this? Or any other suggestions is appreciated.


texts: Returning all struct data of msg.sender in solidity

texts:
here is my code:

contract Notes {
    struct notes {
        string id;
        string content;
        address owner;
        bool isCreated;
        bool isDeleted;
        uint256 timestamp;
    }

    mapping(address => mapping(string =>notes)) private userNotes;

    function addNote(string memory _content, string memory _noteId) public {
        require(!userNotes[msg.sender][_noteId].isCreated,"a Note is already Created With This Id");
        userNotes[msg.sender][_noteId] =notes(_noteId, _content,msg.sender, true, false, now);
    }
}

So, above function addNote add data into struct notes with address indexing and string key. So, is there any way to return all struct data of msg.sender?
everytime that function called by particular msg.sender, a new note is stored on struct right? i wanted to return all the notes ever created by msg.sender. not a single note.


texts: Error: Invalid JSON RPC response: "" from web3

texts:
I run:

geth --rinkeby --rpc --rpcport=8545 --rpcaddr=192.168.1.37

It works in console:

 geth attach http://192.168.1.37:8545

> eth.syncing
false
> eth.accounts
["0xb4e4634e9eebb5a741b6c6beb7afb7746c09cbfc"]

Truffle migrate also works with

module.exports = {
  networks: {
    "geth": {
      network_id: "*",
      host: "192.168.1.37",
      port: 8545
    },
  }
};

But when I run:

Web3 = require('web3')
web3 = new Web3(new Web3.providers.HttpProvider("http://192.168.1.37:8545"));

console.log(web3.currentProvider);
web3.eth.getAccounts().then(e => console.log(e));

I takes a couple of minutes and I get:

Error: Invalid JSON RPC response: ""

When I use --rpcaddress=localhost it works but of course only from localhost

I doesn't matter what version I use. Currently using:

geth: 1.9.6-stable

web3: 1.2.1

Truffle v5.0.38

Any ideas? Please!


texts:
I would really appreciate if someone could help me with my concerns: Let's say we are a bank consortium and we own a permissioned/private blockchain. Is this possible for us to open our blockchain through API or SDK so that external innovators can develop applications on top of our blockchain without harming the privacy of the data stored on our blockchain?

I am not a technical guy but interested in innovation topic. If possible, please answer in layman's terms.


texts: Is there any website for provide APIs for making transaction to different blockchain such as Ethereum, Litecoin, BTC, Neo etc

texts: I want build a wallet which manages multiple coins and I'm looking for a website which provides APIs for transacting to different blockchains.


texts: geth and mist: Error starting protocol stack: datadir already used by another process

texts:
I am runing the mist wallet app.

In Terminal (macos), I also want to start a miner process geth --etherbase 1 --mine  --port 0

But geth --mine failed with this error message:

  Fatal: Error starting protocol stack: datadir already used by another
  process

Is there anyway I can have both programs to run concurrently?


texts: Compiler Warning: Modifier-style base constructor call without arguments

texts:
I get this compilation warning for the following contract:

pragma solidity ^0.4.24;

contract TestCalls {

    uint public lastMsgDataLength;
    uint public lastMsgValue;

    modifier setMsgFields {
        lastMsgDataLength = msg.data.length;
        lastMsgValue = msg.value;
        _;
    }

    constructor() setMsgFields public {
    }
}

I think that the compiler somehow misinterprets the modifier call as a base-constructor call.

Of course, there is no base constructor here, since the contract does not inherit anything.

How can I resolve this compilation warning?

P.S.: This code is taken directly from Gnosis GitHub Repository.

I have updated it from ^0.4.15 to ^0.4.24, so perhaps this is the source of the problem.

Thank you!


texts: Is it possible to trigger an ERC777 receiver hook by receiving ERC20 tokens?

texts:
I noticed that the callTokensReceived hook is called when using a few of the ERC777 functions but I am wondering how this could be triggered if an ERC20 token was sent to it?
Example (pseudo code):

Users runs erc20.transfer(erc777.address)
erc777receiverHook triggers someFunction() which references the erc20 token and its sender

Would the ERC777 contract have to be approved/given an allowance and then the ERC777 can use the transferFrom function to withdraw tokens to the contract which would trigger the callTokensReceived?
I can't imagine that would be the approach because a big advantage in using ERC777 is to remove this two step approve/transferFrom method.


texts:
I'm currently trying to set the token price of my ERC-20 token.The problem I'm having is trying to set the price to ETH(0.01) per token, but the closest value I keep getting to is ETH(0.001) per token when making a transaction to buy.

// Denominations example
// ether = 1,000,000,000,000,000,000
var tokenPrice = 1000000000000;
deployer.deploy(DappTokenSale, DappToken.address, tokenPrice);

I've tried passing in  different values with no effect in getting ETH(0.01), and well tried just setting the value in the contract without passing in this large number.


texts: On Solidity, calling event from modifier seems to fail

texts:
Two modifiers on a contract throw an "Exception during execution. (invalid opcode)." error when not being satisfied as expected. Both of them are calling an event when the condition they check is not met. So I guess the exception comes from calling the event on the modifier. Is that correct?

The event log is this one:

event Error(string error);

And the modifiers are the following:

modifier onlyOwner() {
    if (msg.sender != owner) {
    Error('Mortal: onlyOwner function called by user that is not owner'); throw;
    }
    _;
}

modifier onlyIssuer() {
    if (!issuers[phoneNumbers[msg.sender]]) {
    Error('Mobile: onlyIssuer function called by user that is not an authorized issuer'); throw;
    }
    _;
}

The full source code of the contract is available at https://gist.github.com/computerphysicslab/f362383f9d3fed26becba48b934bbcfc

So, if modifiers cannot call events, is not possible to log somehow a function that fails because its modifiers weren't met?

Thanks!


texts: How can you cheaply choose from a dynamic array randomly, with an oracle generated seed number, in Solidity?

texts:
In JS you could use this and call it a day.
let randomArrayEntry = myArray[Math.floor(Math.random() * myArray.length)];
However, in Solidity everything is deterministic unless you call an outside function for a random number. Easy in theory, but the problem is that it is not currently practical with available services to choose a number matching your array length.
If my array length is 23, and the oracle spits out 1823792836199027320224 as the seed we can reduce it down to the last two numbers % 10**2. Now we have the number 24 and we now have a range from 0-99 of possible numbers. How can we then choose fairly from the array using this number without spending a bunch of gas iterating over it?
The first solution I came up with is to check for the first two numbers in a row less than 24, and then that becomes the answer. The problem is that the randomly generated number might not have any two numbers in a row less than our array length. This becomes much more likely if our number is 2 or 3. The transaction would have to revert or fetch another random number as a fallback. This seems like a poor plan.
Edit 1:
The current solution (found after) is to just take the remainder.
uint256 randomArrayEntry = (randomNumber + myArray.length + 10) % myArray.length;
You multiply the random number by 10 so you don't divide zero or less than the array length (no remainder).


texts: how to uninstall mist permanently for Mac

texts: my mist is not syncing in private network and it did not show the ethers. so I need to uninstall Mist permanently and  again I want to install .But when I install the mist it shows the older mist .


texts: Can not verify source code on Etherscan (ERC721 contract)?

texts:
pragma solidity ^0.7.0;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.4/contracts/token/ERC721/ERC721.sol";

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.4/contracts/utils/Counters.sol";

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.4/contracts/access/Ownable.sol";

contract DigitalIdentity is ERC721, Ownable {
    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;
    string private _fullname;
    uint256 private _age;

    constructor() ERC721("Digital-Identity", "DID") {}

    function uint2str(uint256 _i)
    internal pure returns (string memory str) {
        if (_i == 0)
        {
            return "0";
        }
        uint256 j = _i;
        uint256 length;
        while (j != 0)
        {
            length++;
            j /= 10;
        }
        bytes memory bstr = new bytes(length);
        uint256 k = length;
        j = _i;
        while (j != 0)
        {
            bstr[--k] = bytes1(uint8(48 + j % 10));
            j /= 10;
        }
        str = string(bstr);
    }

    function append(string memory a, string memory b, string memory c,
    string memory d, string memory e) internal pure returns
    (string memory) {

        return string(abi.encodePacked(a, b, c, d, e));
    }

    function readId() external view returns(string memory) {
        // anyone can call this readId()
        string memory idstring = append(uint2str(_tokenIds.current()),"_",
        _fullname,"_", uint2str(_age));
        return idstring;
    }

    function generateNft(address receiver, string memory tokenURI,
                         string memory fullname, uint256 age)
                         external onlyOwner returns (uint256) {
        _tokenIds.increment();

        uint256 newNftTokenId = _tokenIds.current();
        _mint(receiver, newNftTokenId);
        _setTokenURI(newNftTokenId, tokenURI);
        _fullname = fullname;
        _age = age;

        return newNftTokenId;
    }
}


texts: Do I need to update my ethereum token if proof of stake finally come and proof of work no longer in use?

texts: Do I need to update my ethereum token if proof of stake finally comes and proof of work no longer in use?


texts: Is it possible to delete files in SWARM?

texts: If not what are some similar protocols to IPFS and SWARM that allow you to delete files?


texts: Generating cache from block_number and seed using Python

texts:
I'm trying to run Ethash algorithm from the Python-code provided over here:
https://eth.wiki/concepts/ethash/ethash, and have some troubles comparing the produced cache-file with the actual cache-file from the real network, running by geth.
As the first step, I'm generating a cache file from the given block_number and the seed. The algorithm for cache-generation is described in the corresponding mkcache(cache_size, seed) function from the link above.
After running the function, I'm ending up with 16x995326 list, with 32-bit integer in every element. After the serialization of this list into a binary file (using Python struct module), I'm getting a 61-megabyte file.
Now, the question is: How can I verify that the generated cache-file is actually correct and it is intact with the current Ethereum network? Do you guys have any thoughts on that?
The way I'm doing this verification now is by comparing my cache-file with the cache-file from the actual ethereum-node running by geth.
For example:

let's take a block number: 10757149
for this block number, we can get the corresponding seed (please, check if the seed is correct):
0xf7f6e04564e6b37fb9017324dc2577bd24cd25977037cfe8cd95b590009e2391
from the fully-synced ethereum node running geth, I can find the actual cache file, located in .ethereum/geth/ethash/cache-R23-f7f6e04564e6b37f
executing md5sum on that cache-file, I'm getting the following checksum:
d767fc7d317c78c6ac2e8b0a111d5dc0
(btw, if you're running fully-synced geth, you should get the identical md5hash for the R23-f7f6e04564e6b37f cache)

Now, given the block_number and the seed, I'm executing a Python-script from the example in the link above, and the md5sum on my cache-file is different!
On that point, I'm really stuck and have no idea how to check the cache-file correctness so far. Some other questions are coming up to my head, maybe you could clarify something:

Are the algorithms from eth.wiki/concepts/ethash/ethash actually followed by the official go-implementation of Ethereum (geth)?

Looking at the source-code of geth, I suspect that the cache-generation algorithm is different. I'm not good at parsing the go-syntax, so maybe some of you could check the Python-version of the mkcache function from here: eth.wiki/concepts/ethash/ethash, and the corresponding function from geth over here: github.com/ethereum/go-ethereum/blob/master/consensus/ethash/algorithm.go#L139. Would be very glad if someone could see the actual differences in the algorithms (if they exist).

Could it be due to a difference in cache serialization (when the generated array is being written to a file)?

Would really appreciate any hints on that topic. You may find the Python2.7 script I'm using over here: github.com/dugdmitry/ethash_python/blob/master/run_miner.py
Thank you!


texts:
I have this code to show the erc20 token balance of an account

   var tokenAddress = '0xb97E9bBB6fd49865709d3F1576e8506ad640a13B';
var walletAddress = '0x62f28320f688A7A4e0021c55d7ffD1acd770A133';

    function getERC20TokenBalance() {

      let minABI = [
        // balanceOf
        {
          "constant":true,
          "inputs":[{"name":"_owner","type":"address"}],
          "name":"balanceOf",
          "outputs":[{"name":"balance","type":"uint256"}],
          "type":"function"
        },
        // decimals
        {
          "constant":true,
          "inputs":[],
          "name":"decimals",
          "outputs":[{"name":"","type":"uint8"}],
          "type":"function"
        }
      ];

      let contract2 = web3.eth.contract(minABI).at(tokenAddress);

      web3.eth.getAccounts(function (error, walletAddress) {
          contract2.balanceOf(walletAddress, function(err, result) {
              if(err) {
                  console.log(err, 'err');
              } else {
                console.log(result);
                  document.getElementById('agiAvailable').innerHTML = result + ' AGI';

              }
          });
      });
    }
    getERC20TokenBalance();

    function onAddressChange(e) {

      if(tokenAddress != "" && walletAddress != "") {
        getERC20TokenBalance(tokenAddress, walletAddress, (balance) => {
          console.log(balance.toString());
        });
      }
    }

But that output is 0, which is not the correct balance


texts: Why won't rest of the PCI-e slots get detected after installing a graphic card in the x4 slot?

texts:
I am setting up a mining rig comprising of 5 graphic cards using this mainboard, Gigabyte P35-DS3P. It has the following number of PCI-e slots, as seen in the Gigabyte link:

1x x16 PCI-e slot
3x x1 PCI-e slots
1x x4 PIC-e slot

I have been able to plug in 4 graphic cards using powered PCI-e risers/extenders, in the following order and they work fine:

3x R9 280x cards in each of the x1 slot.
1x R9 280x card in the x16 slot using x1 riser cable.

Now when I plug in the 5th card in x4 slot, only 1 card would get detected in Windows's 'device manager' section, i.e. the one plugged in the x4 slot. I have tried installing it with and without the risers but same results.
Can someone suggest some workaround for this? Thanks!
EDIT: I don't understand the mindless decision of mods to put this question on hold. If you don't know the answer or not have the ability to troubleshoot it, it doesn't make it off-topic.
If you cannot tolerate mining questions, please do yourself a favor and remove the 'mining' and 'hardware' tags from the channel.


texts:
My below code is working fine

Web3 = Require('web3');
const walletAddress = '0x8690F1feff62008A396B31c2C3f380bD0Ca6d8b8';
const web3 = new Web3(new Web3.providers.HttpProvider(testnet));
var balance = web3.eth.getBalance(walletAddress); //Will give value in.
balance = web3.toDecimal(balance);

But when I run:

web3.utils.fromWei(balance,'ether')

It throws an error:

"TypeError: Cannot read property 'fromWei' of undefined"

I am using Web3 0.19.1 and node 10.15.1.


texts: Easiest way to deploy contracts from Trezor/ Ledger?

texts:
I know about Remix and that you can connect your hardware wallet with MetaMask, but, as of Nov 2019, I get this error many times:

  creation of Contract errored: Error: TransportError: Failed to sign with Ledger device: U2F DEVICE_INELIGIBLE

Any other option?


texts:
I wanted to make my first transaction between my wallets (geth to ledger), so I put my ledger into USB and enter the pin.
Geth was able to see my ledger (eth.accounts[1]), and I tried just a small amount of money to see, if it works.
(I removed some sensitive information, because I don't know if my problem is now in a state, where somebody can get my "lost" money)

> eth.sendTransaction({from:eth.coinbase, to:eth.accounts[1], value: web3.toWei(<small_amount>, "ether")})
"0xblalbla"

Everything went fine.
So I made a larger transaction:

> eth.sendTransaction({from:eth.coinbase, to:eth.accounts[1], value: web3.toWei(<larger_amount>, "ether")})
"0xblalbla2"

But then I realised, that the eth.accounts[1] did not get any value (somehow lost the ledger, but wasn't in sleep mode, it was still in Ethereum app).

> web3.fromWei(eth.getBalance(eth.accounts[1]));
Error: invalid address
    at web3.js:3930:15
    at web3.js:5025:28
    at map (<native code>)
    at web3.js:5024:12
    at web3.js:5050:18
    at web3.js:5075:23
    at <anonymous>:1:14

I disconnected, and connected again.
Tried to make a new transaction. (now I know I should have been cancel my actual Pending transaction)

> eth.sendTransaction({from:eth.coinbase, to:eth.accounts[1], value: web3.toWei(<larger_amount>, "ether")})
"0xblalbla3"

Now I have seen, that there are already 2 pending Transactions

> eth.pendingTransactions [{
    blockHash: null,
    blockNumber: null,
    from: <geth_account>,
    gas: 90000,
    gasPrice: 50000000000,
    hash: "0xblalbla2",
    input: "0x",
    nonce: 1,
    r: "xx",
    s: "xx",
    to: null,
    transactionIndex: 0,
    v: "0x25",
    value: <larger_amount> },
{
    blockHash: null,
    blockNumber: null,
    from: <geth_account>,
    gas: 90000,
    gasPrice: 52000000000,
    hash: "0xblalbla3",
    input: "0x",
    nonce: 2,
    r: "xx",
    s: "xx",
    to: <ledger_account>,
    transactionIndex: 0,
    v: "0x26",
    value: <larger_amount> }]

So I looked for a solution on the internet, and tried to get rid of the Pending transactions.

> eth.sendTransaction({from:eth.coinbase, to:eth.accounts[1], value: 0, gasPrice: 57720000000, gasLimit: 24000, nonce: 2});
"0xblabla4"

I successfully removed the nonce 2, but in the meantime the nonce 1 became success.
It was sent to null, and that created a contract.

How can I get the money back to my wallet address, if there is a way?
If there is no sensitive information, then I can put all the information here, if it is needed to recover my eth.

Thank you in advance!


texts: Need help getting ETH back after BSC transfer

texts:
I have tried to transfer ETH from Binance to Trust Wallet using BSC. The funds went to C.R.E.A.M. Finance, which is accessible through Trust Wallet's DApp. It seems like there is no option to withdraw the funds out of the "contract". I did not want to make a smart contract with C.R.E.A.M., they just took me ETH. So please help me getting the ETH back.
TXid:
0x925c0f0e3bddf8e4d7482f2c5a7dd7852bca49cfb0d30669eb8171b9ea997866
Sender address (on binance wallet):
0x5c28a5bdbb7dca55135e3b380da6e1f1da988118
Receiving address on TRUST WALLET:
0x1424F6bB109f24F1A5c6a7Ebe1Abda7C1209e88f
Best regards,
Daniel


texts: VM Exception while processing transaction: invalid opcode

texts:
I am trying to save string into a contract and hit this error.
My contract is

pragma solidity ^0.4.18;

contract MyRecord {
    address owner;
    address guest;
    string note;

    modifier onlyOwner() {
        require(msg.sender == owner);
        _;
    }

    modifier onlyGuest() {
        require(msg.sender == guest);
        _;
    }

    function MyRecord() public {
        owner = msg.sender;
    }

    function grandPermission(address myGuest) public onlyOwner {
        guest = myGuest;
    }

    function revokePermission() public onlyOwner {
        guest = 0x0;
    }

    function setNote(string newNote) public onlyGuest {
        note = newNote;
    }
}

And calling setNote() using below

 let myContract = this.state.web3.eth.contract(this.state.abi).at(this.state.selected_deployadd);
        let trans = myContract.setNote(this.state.value, {from: this.state.address}, function(error, results){
            if(error) {
                console.log('setNote error ', error);
            }
            else {
                console.log('setNote success ', results);
            }
        });

I use Ganache as my testrpc, everything looks fine even value been set into note and transaction been generated(identified by Ganache as "CONTRACT CREATION" instead of "CONTRACT CALL" which confuse me). Besides, "invalid opcode" been returned without any further information. BTW, is there a way I can debug my contract?

I am new to solidity, could someone help.

UPDATE: I tried my contract on Remix and it works fine, still struggle with Ganache and need help.


texts: I have created a node in my laptop. Now I want my friend (from his home) to connect to the node I created. We are part of two different networks. How can these two nodes be connected in ethereum. What are the geth commands that I should use?


texts: org.web3j.protocol.exceptions.ClientConnectionException: Invalid response received on web3j on Android

texts:
I am trying to execute transactions by calling my RegisterNewUser function in the deployed smart contract through Android and I am using Infura. However, when I run, there is an error as seen below :
org.web3j.protocol.exceptions.ClientConnectionException: Invalid response received: okhttp3.internal.http.RealResponseBody@75f0732
and I am not sure what this error means and how to solve it.
Here is my code :
package com.example.myapplication

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.widget.Button
import org.web3j.crypto.Credentials
import org.web3j.protocol.Web3jFactory
import org.web3j.protocol.core.methods.response.TransactionReceipt
import org.web3j.protocol.infura.InfuraHttpService
import java.math.BigInteger
import java.util.concurrent.Future

class MainActivity : AppCompatActivity() {
    private val TAG = javaClass.name

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        val contractAddress = "0xcc7bbfe74095a18a77f178332e43bb29fec55d9a"
        val url = "https://ropsten.infura.io/v3/a5160b4fb30f49b48161ea7d6de80cf6"
        val web3j = Web3jFactory.build(InfuraHttpService(url))
        val gasLimit: BigInteger = BigInteger.valueOf(3000000)
        val gasPrice: BigInteger = BigInteger.valueOf(10000)
        val credentials = Credentials.create("MY_PRIVATE_KEY")

        val greeter = UserAccountFactory.load(contractAddress, web3j, credentials, gasPrice, gasLimit)

        val button: Button = findViewById(R.id.fab)
        button.setOnClickListener { _ ->
            val thread = Thread(Runnable {
                try {
                    val transactionReceipt1: Future<TransactionReceipt>? = greeter.registerNewUser("abc@mail.com","777888","Customer").sendAsync()
                    val result1 = "Successful transaction. Gas used: ${transactionReceipt1?.get()?.blockNumber}  ${transactionReceipt1?.get()?.gasUsed}"
                    Log.d(TAG, result1)

                } catch (e: Exception) {
                    e.printStackTrace()
                    Log.d(TAG, "error accessing contract: " + e.message)
                }
            })
            thread.start()
        }
    }
}

Is there anything that I have done wrong?


texts: Does The Test Blockchain Get Reset/Cleared?

texts:
hi i am working with solidity and blockchain and i wanted to find out about how often the ropsten-testnet gets reset.

i cant find what i'm looking for so maybe it doesn't get reset, but if it doesn't get reset, then it seems too good to be true that the ethereum testnets will provide unlimited storage and data space for free? (because you can withdraw as much as you want from things like faucet.metamask.io)


texts: can a gas comission be paid by the owner?

texts: I want to create a token but, I want people to send the tokens without them paying for the gas, is there any command to do this


texts: How to save data using multiple structures and arrays in solidity?

texts:
How can i use multiple arrays please?

e.g: I have this contract:

pragma solidity >=0.4.21 <0.6.0;

contract SessionManagement {

    struct ChargeProfileSegment{
        uint startDateTimeSeg;
        uint power;
    }

    struct Session{
        address userWalletAddr;
        uint stationId;
        uint startDateTime;
        uint endDateTime;
        ChargeProfileSegment[] chargeProfileSegments;
    }

    mapping (address => Session[]) sessionList;
    Session[] public sessions;
    ChargeProfileSegment[] public chargeProfileSegments;

}

Now i want to create a function to save a list[] of Sessions, and in each Session i want to save a list[] of ChargeProfileSegment.

Your healp will please me.


texts: Why does ecrecover() take signature parameters (v,r,s) instead of the full signature?

texts:
Is there any reason ecrecover() takes the (v, r, s) signature parameters instead of the full signature, given that these can be easily computed inside the function itself?

I am asking because developers usually need to compute these parameters from the full signature each time they need to use ecrecover(), which seems like an unnecessary repetitive process that could've been mitigated had ecrecover() took the full signature instead.


texts:
Newbie here. I've been reading through the (excellent) Ethereum whitepaper and had the following question:

If gas is used every time the program is executed, and the program is executed on multiple nodes (presumably, simultaneously) — what's to prevent all of the gas from getting consumed each time (i.e. gas consumed = STARTGAS every time)?


texts: Do you know any good code sample of Web3j with Android?

texts:
Do you have any good code sample of Web3j with Android?
There is an example in the official docs, but I don't think it is not well self explanatory.
I'd like to see an example of wallet generating or smart contracts integration using Web3j & Android.

Thanks in advance!


texts: I have been trying to sync an ethereum node with geth for quite a while. Therefore I am evaluating alternative node clients to install on my server. I’ve read that nethermind is faster as it does not store and process receipts and block headers. I was wondering what were the trade offs of not storing such pieces of data. Thanks for the help


texts:
function enter() payable {
     if (msg.value < 10 finney) {
         msg.sender.send(msg.value);
         return;
     }

I am getting return value from low-level calls in Mist wallet. Solidity version: 0.4.8+commit.60cc1668 .. T_T please help. ty


texts:
I found this endpoint is to obtain the token balance from Ethereum blockchain, however, I noticed that this function doesn't work on Rospten network.
Please advise

https://api.etherscan.io/api?module=account&action=tokenbalance&contractaddress=0x6bb495e358d7aab0540d9b38996e715fcc4f1ba2&address=0x63a5f2232a519321237e31d0a79f6c20e0e652d3&tag=latest&apikey=JKXR76EA1NK9XSKES1T2BNYBZ41T3BJ2JH

Possible I could have the same function works on Ropsten network?


texts: How Private Ethereum network store my input data in mined block


texts: Should I move ERC Tokens off of MyEther Wallet or can I store them there?


texts: What does MetaMask mean by stop injecting web3.js?

texts:
MetaMask announced that they will stop injecting web3.js here. I know previously MetaMask will add a global variable in browser window.web3 and this global lowercase web3 variable will be deprecated soon. But in my DApp, I use MetaMask as a provider to the original Web3.js library (i.e. captical Web3). Will my usage be affected by MetaMask stopping injecting web3.js?

I also posted another question here, where I find web3.js cannot listen to on("changed") events in smart contract using MetaMask offered provider ethereum. If I still want to use MetaMask and Web3.js in my DApp, how can I get notified when events emitted in smart contracts are removed due to chain reorganization?

Thanks in advance.


texts:
https://photos.app.goo.gl/FaXwaKw2hH1wNuYy5enter link description here

This is a transaction How can I transfer money to my wallet?


texts:
uint number = uint(keccak256(abi.encodePacked(now))
Split each number. For example, if the value of number is 1562, I need to be able to extract the result as: uint a = 1, uint b = 5 , uint c = 6, uint d = 2.
What should I do?


texts: How long should mining take on the testnet?

texts:
I've been following the excellent tutorials by Jordan from Decipher, and am now really keen to publish something to testnet.

I've got a geth node running on an AWS small instance, and it's been mining for around 18 hours and still my balance hasn't gone above 0. I've also tried using faucet here: http://faucet.ropsten.be:3001/, which has returned successfully, but the ETH hasn't arrived in my account.

I think I'm on ropsten, but don't really know how to check

admin says this:

protocols: {
  eth: {
    difficulty: 861947972271291,
    genesis: "0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d",
    head: "0x66dbb58f9ed28c35a3725639daf07a6deddd63aa0224cc697e74eb6ae712b371",
    network: 3
  }
}

And my logs say:

INFO [07-09|09:13:56] Imported new chain segment blocks=1 txs=1 mgas=0.021 elapsed=247.402ms mgasps=0.085 number=1267059 hash=61c0e4…d41039
INFO [07-09|09:14:03] Imported new chain segment blocks=1 txs=0 mgas=0.000 elapsed=3.634ms mgasps=0.000 number=1267063 hash=c60743…6d8949
INFO [07-09|09:14:03] Commit new mining work number=1267064 txs=0 uncles=1 elapsed=344.975µs

Any ideas?

Cheers!


texts:
I am a beginner and learning Ethereum. Can somebody please tell me if my understanding is correct?

Q) There could be just 1 node running, but multiple accounts?


texts: Unable to verify contract on Etherscan Rinkeby Testnet

texts:
I am unable to verify the smart contract on Rinkeby testnet. I have deployed the code through truffle and developed using open-zeppelin. I have tried to look for solutions on this platform and I tried various ways mentioned but it is not helping me out.

I used oracles-combines-solidity to flatten the sol file and pasted the code in etherscan's solidity code but everytime I get the message below. Please help.

Edit:
Following are the details:

TCRToken:0xf1608c8aead4d4feae7afe9dd9c657d27349d615,
TCRSale:0x3bd1d8004fbd68b085d9b582729b9ad22698c813

Rinkeby URL:
https://rinkeby.etherscan.io/token/0xf1608c8aead4d4feae7afe9dd9c657d27349d615

Source: https://github.com/parth5049/transboundary-credit-rating


texts: How Can I use my Metamask accouns to deploy a contract using Truffle

texts:
I have the full geth node on my machine and want to deploy my smart contract on ropsten using truffle.
In truffle.js fileI have connected to the node as the following:
ropsten: {

 host: "Localhost",     // Localhost (default: none)
 port: 8545 ,           // Standard Ethereum port (default: none)
 network_id: "*",       // Any network (default: none)
 // from: "",      // Ropsten's id
  // gas: 5500000,        // Ropsten has a lower block limit than mainnet
  // confirmations: 2,    // # of confs to wait between deployments. (default: 0)
  // timeoutBlocks: 200,  // # of blocks before a deployment times out  (minimum/default: 50)
  // skipDryRun: true     // Skip dry run before migrations? (default: false for public nets )
},

In the terminal, I run the node by the following command:
geth --syncmode "fast" --cache=1048 --ropsten --rpc --rpcapi "eth,net,web3" --rpccorsdomain '*' --rpcaddr localhost --rpcport 8545 console

How can I use the funds that in my accounts in Metamask to deploy the contract on truffle?
When I check my accounts balances in geth console, it returns 0 where it has some ether in Metamask Chorome extension
Any help is much appreciated.
Thanks


texts: Augur: Getting this error: “Error: eth_call returned no data (0x)” when I try to run any transaction APIs. Does anyone know what is going on here?

texts:
The address owns ETH as well as REP according to dev. I'm connected to Rinkeby .

This happens when I run the folling code:

const owner = require('./.pvt.js').ADDRESS;
const daiAddress = require('./.pvt').DAIADDRESS;
const privateKey = require('./.pvt').PVT_KEY;

const init = require('./init');

var _extraInfo = {
  "test": "test",
  "2": [ "test1", "test" ],
  "test3": ""
};

const createMarket = (async () => {
    const { augur, connectionInfo } = await init();
    const { Universe } = connectionInfo.ethereumNode.contracts;

    augur.createMarket.createYesNoMarket({
        universe: Universe,
        _endTime: 1556300799,
        _feePerEthInWei: 1,
        _denominationToken: daiAddress,
        _designatedReporterAddress: owner,
        _topic: "stocks",
        _description: "hmm?",
        _extraInfo: JSON.stringify(_extraInfo),
        meta: {
            accountType: "privateKey",
            address: owner,
            signer: new Buffer.from(privateKey, 'hex'),
        },
        onSent: function (result) { console.log("sent", result); },
        onSuccess: function (result) { console.log("success", result); },
        onFailed: function (result) { console.log("failed", result); }
    });
})();


texts: What would be needed to store the blockchain as a IPFS object?

texts:
In Christian Lundkvists blog post about possible uses for IPFS, he suggests that storing the Ethereum blockchain as an IPFS object could potentially decrease the size of the chain:

  We see the deduplication we gain when putting the state database on
  IPFS - between two blocks only the state entries that have been
  changed need to be explicitly stored.

What would be needed to implement this in practice?
 I can imagine that converting each block into an IPFS object manually could already be done if you want to save some space when importing/exporting a chain between trusted parties, but what about making this the standard way in which the blockchain is stored and distributed among the nodes?


texts: Display the user object array in react app using drizzle

texts:
I have been trying to do a simple use case where we return all the user details
please find my code
myComponent.js

JurStatus

          Get Status:
          <ContractData
            drizzle={drizzle}
            drizzleState={drizzleState}
            contract="JurStatus"
            method="getUser"
          />

contract file
function getUser(address _address) public view returns(string memory name, string memory surname, uint age) {
         //if(users[_address].age == 0) throw;
        return (users[_address].name, users[_address].surname, users[_address].age);
    }

In my browser im getting this error

Why is it showing fetching . What am i doing wrong here .
Thanks


texts: Where does Ether come from on a private network

texts:
When I initialize a new blockchain, add a base account, and start a mining thread, Ether starts to accumulate into the base account.  Generally I think of Ether transferred from one account to another account.

If there is no from account, where is the Ether coming from?
If the answer is that "it's reaping fees for mining transactions," then what are these "transactions"?

The second question vexes me because the miner seems really busy earning Ether mining transactions that no one is sending.


texts: How do I work with the latest version of solidity?

texts:
A new version of Solidity was added fairly recently, and one of the feature it adds is messages on require.

I would like to use them but I'm not sure how I can do that. I'm using Ganache and truffle, and I test my contracts with Remix.

Am I right to assume that Ganache does the compilation and execution of the code, and thus works with a specific version of Solidity? Or does it work with any version? If so, where does the new code come from? (It does everything locally)

Would it work with just changing the pragma or do I need to wait for a release of Ganache that supports the new version?


texts: How come I could spend 1.5 WETH, even though I only wrapped 1 ETH?

texts:
On opensea, I converted (wrapped) 1 ETH to 1 WETH, which is equal to 2 x 0.5 WETH = 1 WETH.
I then spent 0.5 WETH on 3 items = 1.5 WETH, which is greater than the amount I had.
how is this even possible, and where is the WETH balance even kept, in my MetaMask wallet (i don't see it there) or in my opensea account?


texts:
I have done up the scripts on Remix and managed to generate Tokens successfully on Ropsten Network.

However, when using the exact contract script on actual main network, the status remain as "pending contract creation" .

Anyone can give a guidance here? Appreciate it!


texts: How do you apply an interest rate on an ERC20 token without making new transactions?

texts:
I'm trying to develop an ERC20 token that mints new tokens to holders over time, however I would like to do this in a way that does not require me to make new transactions each time a users balance increases since this would be prohibitively expensive in terms of gas.

I figured that the balanceOf() function could query something to show an increased balance.

Does anyone have any idea about best practices for this?


texts: Why does having multiple functions with events prevent proper execution?

texts:
I am relatively new to Ethereum, so I apologize if there is an obvious answer to this question.

I am running a private blockchain to test contracts on. I have a very simple one, where there is one member variable and one event defined. Then there are 2 functions, where each one calls the event with a single argument. With only these two functions, the events work properly. When I call "sendTransaction" on either function, there is a event log in the Transaction Receipt.

However, when I add a 3rd function, that is just as simple (all it does is call the event on a single argument), then all 3 functions stop working properly. They no longer show up in the Transaction Receipt.

I have even tried giving the transaction more gas, but it uses up all the gas I supply and still no even appears in the receipt.

Does any know why this happens?

Contact Code:

pragma solidity ^0.4.0;
contract SetADT{
    struct VoterLog {
        address senderAccount;
        uint256 time;
        uint blockNumber;
    }
    mapping(uint => VoterLog) voterStatus;
    mapping(uint => uint128) voterKeys;
    uint voterIndex;

    mapping(address => bool) validNodes;

    mapping(uint => bool) contractSet;
    event Print(bool);
    event PrintAddr(address);

    function setTrue(uint key) external {
        if(contractSet[key] == false) {
            contractSet[key] = true;
        }
        Print(contractSet[key]);
    }

    function getValue(uint key) external {
        Print(contractSet[key]);
    }
}

When I add the following function as the third function in the contract, the events stop working (showing up in the transaction receipt).

function setAddr() {
    validNodes[msg.sender] = true;
    Print(validNodes[msg.sender]);
}

I have also test each individual function on their own in a separate contract, and they work fine. This leads me to believe that there is no error in the function code.

Thank you in advanced for any help!


texts: Truffle Compile Error (Could not find zeppelin)

texts:
Truffle compile fails with error:

Error: Could not find zeppelin-solidity/contracts/token/MintableToken from any sources; imported from /home/mike/Desktop/test/contracts/TestCoin.sol
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:69147:23
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:165637:16
at next (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:178009:18)
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:69135:7
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:202146:5
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:177914:16
at replenish (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:165607:25)
at iterateeCallback (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:165597:17)
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:165637:16
at ReadFileContext.callback (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:202142:14)

There is blocks with imports:

pragma solidity ^0.4.18;

import "zeppelin-solidity/contracts/crowdsale/Crowdsale.sol";
import "zeppelin-solidity/contracts/token/MintableToken";
import "./TestCoin.sol";

contract TestCoinCrowdsale is Crowdsale {

Anybody knows how to fix it? Thanks!


texts:
I am trying to send ether from one contract to another by getting the input address. Here A has a balance of 100 ether.

1) contract B is created first and I have the address
2) contract A is created next
3) invoking fundTransfer() function with B's address and 50 ether as amount.

Transfer isn't happening. what am i missing here. Sorry if it is a basic question.

pragma solidity ^0.4.8;

contract A {

    function A () payable {

    }

    event balanc(uint a);

    function fundTransfer(address b,uint amt) {
       bool ret = b.send(amt);
    }

    function getBalance() {
        balanc(this.balance);
    }
}

contract B {

    event balanc(uint a);

    function getBalance() {
        balanc(this.balance);
    }
}


texts: A newbie blockchain programming question, just trying to get my head around the big picture via code, my background is web based CRUD systems. If we essentially have a database and code within a smart contract, how can that be immutable, in a sense, isn't the smart contract a trojan horse? Is the initial state of the contract immutable, but when we can change the data later in the contract, its essentially not immutable anymore. Plus I'm assuming on some platforms we can create a contract and then call a method on the contract with a snippet of code, something like 'eval("do more evil")'.


texts: How to get a function to call another function

texts:
this is a part of my code , so far it retrieves the price of eth at the current time and then the price of eth after 60 seconds .

function test() payable{
    Log("Contract created.");
    update();
    update2();
}

 function getInitialPrice() constant returns (uint) {
   return initialPrice;
}

function getFinalPrice() constant returns (uint) {
    return finalPrice;
}

function __callback(bytes32 _myid, string _result) {
    require (msg.sender == oraclize_cbAddress());
    Log(_result);
    initialPrice = parseInt(_result, 2);

}

 function __callback2(bytes32 _myid, string _result) {
   require (msg.sender == oraclize_cbAddress());
   Log(_result);
   finalPrice = parseInt(_result, 2);
}

function update() payable {
    Log("Oraclize query was sent, waiting for the answer..");
    oraclize_query("URL","json(https://min-api.cryptocompare.com/data/price?
fsym=ETH&tsyms=USD).USD");
}

function update2() payable {
Log("Oraclize query was sent, waiting for the answer..");
oraclize_query(60 , "URL","json(https://min-
api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD).USD");
}

at the moment in remix I can call the function update and update2 and it will display the eth price etc , but what I want to do is make a function that when called , automatically calls the update and update2 function , im not sure how to do it ? there might be an easy answer , im just a beginner


texts:
Is it possible to run concurrent tasks using web3.js and an Ethereum client?

For example, say we have the following code to iterate through a number of blocks:

var startBlockNumber = 0;
var endBlockNumber = 1000;

for (var i = startBlockNumber; i <= endBlockNumber; i++) {
        var block = web3.eth.getBlock(i, true);
        if (block != null && block.transactions != null) {
          block.transactions.forEach( function(e) {
                do_something(e);
          }})
        }
}

Is it possible to run the do_something() function concurrently so that the code doesn't wait for each transaction to be processed sequentially?

Edit:

I want to process each transaction concurrently in a private block chain using a function which may have a high cost in time.


texts: Solidity can't modify block.timestamp due to lvalue xpression

texts:
I have a problem regarding modifying block.timestamp. I would like to modify timestamp in my network and change
block.timestamp to unix timestamp, but I got an error at modification:

  TypeError: Expression has to be an lvalue.

block.timestamp = 1577836800;

Is any solution to go through this obstacle? Am I even able to modify block.timestamp in that way?


texts: Make function payable for a specific ERC20 token?

texts:
a method can be payable and then it's possible to send ether to the contract while calling it, and the function can check the ammount sent through msg.value.

How can I make a function receive something else than ether, for example an ERC20 token?


texts: Does connecting Mist/Ethereum Wallet to parity update chaindata for geth?

texts: I cannot get Mist or rather geth to sync the last few blocks.  It's been days now and all recommendations and the try, try again approach that worked in the past continue to fail.  So, I'm trying parity.  I see that parity can somehow work with geth and the Mist browser can then connect to that.   I don't fully understand all that, but I think it has something to do with IPC.  What I really want to know, is when parity is run in such a way to work with geth, does the geth chaindata get updated or parity chaindata?  What I want to avoid is having two very large chunks of data, two separate chains to keep in sync with the network, yet at the same time still be able to use Mist (nice interface for quickly purchasing coins, and ability to experiment with Swarm).


texts: signing transaction in web3 is not returning msgHash

texts:
I am trying to write provble_transfer where owner can pay gas fee for the transaction. Below is the code for signing transaction to my test contact.

let rawTransaction = {
        'from': fromAddress,
        'gasPrice': web3js.utils.toHex(20 * 1e9),
        'gasLimit': web3js.utils.toHex(3000000),
        'to': contractAddress,
        'value': "0x0",
        'data': contract.methods.transfer(toAddress, amount).encodeABI(),
        'nonce': web3js.utils.toHex(count),
        "chainId": 4
    };

    let privateKey = Buffer.from(requestPrivateKey, 'hex');
    let transaction = new Tx(rawTransaction, {'chain': parameters.ethereum.network});
    transaction.sign(privateKey)
    res.status(constants.HTTP_OK).json({
            data: {
                'transaction_hash': transaction,
                'amount':amount
            },
            status: 'success',
            message: 'Everything went well.'
        });

Signed transaction has following data

"transaction_hash": {
        "nonce": "0x02b6",
        "gasPrice": "0x04a817c800",
        "gasLimit": "0x2dc6c0",
        "to": "0xdd..,
        "value": "0x",
        "data": "0xa9059cbb00000000000000000000..",
        "v": "0x2c",
        "r": "0x9ee5dddddd",
        "s": "0x50c34909511f1e...."
    }

and getSigner function in my contract is

function getSigner(
    bytes32[3] data,
    uint8 v
) private returns (address)
{

    address signer = ecrecover(
        keccak256("\x19Ethereum Signed Message:\n32", data[0]),
        v,
        data[1],
        data[2]
    );

    return signer;
}

So question is, getSigner needs an array of three bytes32 values in first param but I have two in above transaction, How can I get msgHash or 1st value for array from the above transaction.


texts: Is there any way to decode to_address from getTransaction(hash).input of a token transfer?

texts:
Here is my code,

web3.eth.getTransaction(txns.transactionHash,function (err,res){
  console.log(res.to); // consoles contract address
  var input = res.input,erc20=input.slice(0,10);
  if(erc20 == '0xa9059cbb'){
    var amount= web3.utils.hexToNumberString(input.slice(74,138));
    amount = web3.utils.fromWei(amount);
    var to_address = web3.utils.hexToString(input.slice(10,74)); // Cannot get/decode to_address
    console.log(amount,to_address);
  }
})

Also, res.to consoles contract address instead of exact to_address. So that I'm trying to get it from input hash.


texts: Create broadcastable TX offline on Windows

texts:
I made a tool which created 500 transactions that I need to have broadcasted on the network.

The data, nonce and other information is all available. The only thing I need is a way to create the transaction and sign it with my private key.

What would be the easiest way that won't give me a headache? I don't think you even need a copy of the chain for this as its just signing. (I do not need it broadcasted to the network right now)

Please no Web3 or anything else with NodeJS, because every single time I use javascript/NodeJS it takes me hours to fight through the errors NPM shoots at me. I'm probably hospitalized because of high blood pressure before the libraries even finished installing so please think of my health

Anyways I've been searching for quite a while so if someone could save me out of the fire, I'd be grateful!


texts: Ethereum 2.0 - Isn't there a risk that Shards will be abandoned by Miners?

texts:
I've read in an Article (https://www.coindesk.com/beacon-chain-contracts-a-new-way-to-deploy-dapps-on-ethereum-2-0) about the new Shards (aka beacon chain contracts) coming with Ethereum 2.0 and that every shard more or less represents its own Blockchain running within the Ethereum Ecosystem.

  In other words, these beacon chain contracts would specify all the
  rules for computation and smart contract execution including
  transaction fees, associated gas costs, and more.

Also with that, it's possible to let run the Shards parallel and therefore every Shard has its own 'EVM'.

  Instead of having one giant machine run transactions one at a time…we
  can split it up across tons of machines across the world and run them
  in parallel,” Jordan explained to CoinDesk.

But if the Shards are running parallel, doesn't this also mean that Miners can choose which EVM they are supporting and which not? Which might lead to the situation that complete Shards can be abandoned? Or does every miner support all shards and takes blindly transactions into his next block?


texts: I'm trying to write a program in Go to watch pending transactions, using a geth full node that I'm connected to over websockets. I'm pretty sure I have to use the github.com/ethereum/go-ethereum/eth/filters package to create a new event system, on which I can then call SubscribePendingTxs, but I don't know what I should use as the backend.


texts: Emit event while require statement fails

texts:
I would like to be able to log a result of a condition:

if(time > 5) {
    emit Result("time is larger than 5");
} else {
    emit Result("time is less than 5");
}

This will work just fine, but when using a require statement:

  require(time > 5);
  emit Result("time is larger than 5");

I can only log the event in case the require succeeds.

In case the require appears in a modifier:

modifier OnlyLargerThan5() {
  require(time > 5);
  emit Result("time is larger than 5");
  _;
}

Is there a way to log both cases (Larger > 5 > Less) other then the if..else statements?


texts: Creating a new contract from a already deployed contract

texts:
I've been using this technique to create new contracts.

contract Factory {
bytes32[] Names;
address[] newContracts;

function createContract (bytes32 name) {
    address newContract = new Contract(name);
    newContracts.push(newContract);
}

function getName (uint i) {
    Contract con = Contract(newContracts[i]);
    Names[i] = con.Name();
}
}

contract Contract {
bytes32 public Name;

function Contract (bytes32 name) {
    Name = name;
}
}

But This doesn't work for my current contract. It exceeds the gaslimit on ropsten if deployed together. How can I create contracts by using their contract address or abi? It must be possible to create larger contracts somehow right?

Edit:
It's also so strange that the created contract is much bigger than the "Factory" contract. And the created contract can be deployed fine on its own, whereas the factory is not possible. Why? Does a factory take much more code?

Here is the code (I have very little comments):
https://gist.github.com/anonymous/91dbd8614331b57c1d1bf371195dc9d3


texts: Access to a private blockchain controlled by one entity

texts: How can I be the unique authority that can grant access to my private blockchain to only my users and forbid that users to grant access to others?


texts: is gas cost affection on remix account's ethereum balance same as the real?

texts:
most of functions that i execute in remix affects a cost in my test ethereum's balance.
Is this reduced amount equal to the actual cost in the real?


texts: Limiting operator transactions in ERC-1155

texts:
ERC-1155 has an API for somebody other to be allowed to transfer somebody's funds.
Is there any "standard" extension of ERC-1155 allowing to limit which tokens and in which amounts can be transferred by this "somebody other"?
Moreover, is there a way to check if this API is or isn't available for a given contract?


texts: Where are the source codes of contracts developed in Parity saved?

texts:
I programmed a few contracts through the browser on my local Parity node. They have all disappeared. This is obviously very annoying, and I want them back. (I have a backup, but it's outdated and missing some additions and changes I made)

I am on Windows 10.

I have checked the Parity folders in AppData and Program Files, but I can't find anything there.


texts: How to continuesly fork mainnet on latest block

texts:
How do I keep the fork mainnet use the latest block using web3?
I need to fork mainnet to latest block before I send the transaction
What originally i do is just run the ganache fork command which only have the state the block the time i ran it and use
// at some conditions
const localWeb3 = new Web3( // connect to forked net
    new Web3.providers.WebsocketProvider('ws://localhost:8546') // port of forked mainnet ganache
)
// do the transaction

What I tried
// at some conditions
const localWeb3 = new Web3( // connect to forked net
    ganache.provider( {fork: "myalchemyprovider"} )
// do the transaction

or with
    ganache.provider( {fork: web3.currentProvider} ) // no good since i dont have archive mode of eth node

what is the correct way to do this?


texts: How to view where the ETH went to from a smart contract? (rinkeby network)

texts:
Below is a smart contract address: https://rinkeby.etherscan.io/address/0x5f340edfd1c7b6a7f282f29f3fb0fda51df28af9

It shows that 2.55 ETH has been received. And then 3 function calls have been made. The final balance shows up as 0.00975. How do I find out where the smart contract sent the ETH to?


texts: Why does the creationCode of this contract change if a change is made in the importing contract?

texts:
For the following:
pragma solidity >=0.5.0;

contract Include {
    uint z = 1;
}

contract CreationCode {
    uint k = 1;
    function get() external returns (bytes32) {
        return keccak256(type(Include).creationCode);
    }
}

why does creationCode for Include.sol change when changing k, which is not a variable in Include.sol?


texts: Can I use create2 to deploy minimal proxies in solidity, without using assembly?

texts: Solidity 0.6.2 allows the creation of contracts with the create2 opcode via the new keyword and passing a salt in addition to any args. This is adequate for creating standard contracts, but what if I want to deploy minimal proxies as per eip-1167? I can't see a way to pass in the creation bytecode for the proxy, with the template's address included. I know how I can do this with inline assembly, but it would be nice if I didn't have to!


texts: What is and how to calculate 'cumulative gas used'?

texts:
When I see transactions in Etherscan (e.g., 0x7eb9a7454f9cd2f39a7ea7c6212833673165b35f352127ffb337df866897eb73), I see the field Cumulative Gas Used which isn't present in web3 response.

In general, it is equal to Gas Used but I wonder if it could be different and in case it could be, how it should be calculated.


texts: logically centralized but physically decentralized contract

texts:
Reading https://uport.me/library/pdf/whitepaper.pdf it states :

The uPort Registry Contract acts as a logically centralized but physically decentralized registry or lookup
table mapping each uPort identitifier to an IPFS hash linking to a structure containing the user’s attributes,
profile data and attestations (see below for more information on attestations).

From this statement are my interpretation correct :

The Registry contract is physically decentralized as it exists all ethereum mining node within their blockchain ?

The Registry contract is logically centralized as all logic is contained within a centralized location ?


texts: Call functions in Truffle as different account

texts: I'm trying to create some unit tests in Truffle to call functions in a contract as a different account, so I can properly test the contract. I can do this in javascript with { from: account } but I'd like to keep my tests in Solidity. How can I do it?


texts: How to call a payble function in embark? When I am trying it is showing gas limit exceeds

texts:
when I am trying to call payble function in embark it is showing gas limit exceeds. Please tell me where I am wrong?
  /////////////////      Index.js:
        $('#buy button').click(function() {
        var buyAmount = $('#buy .amountBuy').val();
        console.log(add);
        currentToken.buy({value:buyAmount}).then(function() {
        $('#buy .result').html('Done!');
      });;
    })                                                                                ////////////////index.html:

                    Buy Tokens

Enter Details Close

                        <input class="amountBuy" placeholder="enter amount to buy in wei" />

                        <button class="form-group-btn">Buy</button>

////////////////////    solidity fnq:                                                                                /// @notice Buy tokens from contract by sending ether
    function buy() payable public {
        require(msg.value!=0);
        require(buyPrice!=0);
        uint exceededEthers;
        uint amount = msg.value;                                // msg.value will be in wei.
        (amount, exceededEthers) = calculateTokens(amount, buyPrice, decimals);
        require(amount!=0);
        _transfer(this, msg.sender, amount);              // makes the transfers.
        msg.sender.transfer(exceededEthers);// sends exceeded ether to the seller.

   // addUsers(msg.sender);

    if (users.length>0){
            uint count=0;
        for (uint a=0;a<users.length;a++)
        {
        if (users[a]==msg.sender){
        count=count+1;
        }
        }
        if (count==0){
            users.push(msg.sender);
        }

    }
    else{
        users.push(msg.sender);
    }

}


texts: How do you get the JSON request while sending a transaction on Ethereum smart contract?

texts:
While sending a transaction on testing a smart contract in Remix IDE, I am getting this error:

transact to Escrow.deposit errored: Error encoding arguments: SyntaxError: Unexpected token x in JSON at position 47


texts:
Simple question.
I know that state trie is stored in each node's drive. but they are not stored on actual state.
Question 1) What about receipt tree ? do they get stored separately too from the chain in node's drive ?
Question 2) do receipt tree also store invalid transactions or only the valid ones ?


texts: debug_traceTransaction says tx failed, etherscan says passed

texts:
I was running debug_traceTransaction on the transactions in the first 100,000 blocks, and I came across 25 that were flagged as failed, but etherscan.io says they are fine.  The gas used is below gas, and there are no bad opcodes or jumps, so I would also say they are fine.  Here are a few of them (blocknum:txindex):
49170:0
54213:2
78902:0

The only thing the 25 have in common is that they are all contract creations. Why are they flagged as failed?


texts: OpenZeppelin default FixedSupply contract not sending balance to sender

texts:
I'm deploying a very standard openzeppelin ERC20 contract with the following code:

pragma solidity ^0.6.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract ERC20FixedSupply is ERC20 {
    constructor() public ERC20("Fixed", "FIX") {
        _mint(msg.sender, 1000);
    }
}

This code is present at openzeppelin's own documentation here: https://docs.openzeppelin.com/contracts/3.x/erc20-supply

My steps: installed truffle, installed openzeppelin, created the file with the above code, flattened with truffle flattener and deployed using remix with metamask (Kovan network). Deployment successful and I get the contract address fine, but when I try to check the sender address wallet for the token, it's empty.

Here's what I see on metamask after adding the token:

Token page shows this: https://kovan.etherscan.io/tokens?q=0x87B62aAcEc6d304c26d4514ccD9Cb4F6Bc3bc114

What am I missing?


texts: How to get Logo instead of ERC20 TOKEN on transfer page?

texts:
How to change this:

to this:

on etherscan token detail page?


texts:
I'm following this tutorial and when I'm using truffle test to test my React app, I keep getting the following exception error thrown:

TypeError: event.watch is not a function
I am sure the event is present in IPFSInboxTests.js. Here is IPFSInboxTests.js looks like:

And this is how IPFSInbox.sol code looks like:

pragma solidity ^0.5.0;
contract IPFSInbox {

mapping (address => string) ipfsInbox;

event ipfsSent(string _ipfsHash, address _address);
event inboxResponse(string response);

modifier notFull (string memory _string) {bytes memory stringTest = bytes(_string); require (stringTest.length == 0); _;}

constructor() public {
}

function sendIPFS(address _address, string memory _ipfsHash)
    notFull(ipfsInbox[_address])
    public
{
   ipfsInbox[_address] = _ipfsHash;
   emit ipfsSent(_ipfsHash, _address);
}

function checkInbox() public
{
    string memory ipfs_hash = ipfsInbox[msg.sender];
    if(bytes(ipfs_hash).length == 0) {
        emit inboxResponse("Empty Inbox");
    } else {
        ipfsInbox[msg.sender] = "";
        emit inboxResponse(ipfs_hash);
    }
}}

after I do truffle migrate

C:\Users\ASUS\Desktop\ipfs-ethereum-tutorial>truffle migrate

Compiling your contracts...
===========================
> Compiling .\contracts\IPFSInbox.sol
> Artifacts written to C:\Users\ASUS\Desktop\ipfs-ethereum-tutorial\build\contracts
> Compiled successfully using:
   - solc: 0.5.0+commit.1d4f565a.Emscripten.clang

Network up to date.

the error I get after do truffle test looks like:

C:\Users\ASUS\Desktop\ipfs-ethereum-tutorial>truffle test
Using network 'development'.

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

  Contract: IPFSInbox
    1) ...should emit an event when you send an IPFS address.
    > No events were emitted

  0 passing (88ms)
  1 failing

  1) Contract: IPFSInbox
       ...should emit an event when you send an IPFS address.:
     TypeError: event.watch is not a function
      at Context.it (test\ IPFSInboxTests.js:9:21)
      at process._tickCallback (internal/process/next_tick.js:68:7)

I can't figure it out. Can someone please help?


texts:
Somehow i cannot get any result from my backend solidity.
i have asimple dapp that takes firstName from input field save in blockchain and then fetch it back and display it on the screen.

state={

fName:"",
firstName:"",

}

handleSubmit = async (event)=>{
    event.preventDefault();
    await this.simpleStorageInstance.set(this.state.fName, { from: this.state.account });
    //let name = this.simpleStorageInstance.get.call(this.state.account);

    this.simpleStorageInstance.get({ from: this.state.account }, function (error, result) {
        var name = result;
        this.setState({ firstName: name });

    })

doChange = (e)=>{
this.setState({fName:e.target.value});

}

render(
 <form onSubmit={this.handleSubmit}>

<input type="text" name="firsName" onChange={this.doChange}/>
<input type="submit"/></form>

{this.state.firstName}

);

pragma solidity 0.4.24;

contract SimpleStorage {
    string firstName;

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

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

I get also this error:

  Uncaught (in promise) Error: Invalid number of arguments to Solidity function
      at Object.InvalidNumberOfSolidityArgs (errors.js:25)
      at SolidityFunction../node_modules/web3/lib/web3/function.js.SolidityFunction.validateArgs (function.js:74)
      at SolidityFunction../node_modules/web3/lib/web3/function.js.SolidityFunction.toPayload (function.js:90)
      at SolidityFunction../node_modules/web3/lib/web3/function.js.SolidityFunction.call (function.js:131)
      at contract.js:135
      at new Promise ()
      at contract.js:126


texts:
I am trying to find out if each transaction hash created by a wallet has some similarity or if every hash is "random".

I suppose my original question leads into whether or not a transaction hash  be used to identify the wallet it came from?


texts: What is the recommended way to interact with smart contracts in Meteor?

texts: I have a meteor web application and want to interact with my smart contracts. Most of the data are stored in the Meteor MongoDB. I only store a hash of the data on the blockchain. Where should I the write to the contract? Is it recommended to do it on the server or on the client side?


texts: Is it possible for start and auction and bid for multiple names(ENS) in a single transaction?

texts:
For example if I want to register three TLD domains:

example1.eth

example2.eth

example3.eth

Can I make one startAuctionAndBid transaction for all three?


texts: When does 'truffle deploy' yield a different output every time?

texts:
truffle deploy (aka truffle migrate) is documented here.

I'm doing the following sequence:

Starting a local Ganache node
Running truffle deploy

I'd expect this sequence to yield the exact same output (i.e., same contract addresses, same transaction hashes, and same gas costs) every time it is executed.

However, I clearly see a different output every time I execute it.

My question is - why? Is there some sort of randomness used by truffle deploy?

Here is my relevant configuration:

ganache-cli --port=8545 --gasLimit=0xfffffffffff
truffle deploy --network=production

The production network is configured in file truffle-config.js as follows:

module.exports = {
    networks: {
        production: {
            host:       "127.0.0.1",
            port:       8545,
            network_id: "*",          // Match any network id
            gasPrice:   100000000000, // Gas price used for deploys
            gas:        6721975,      // Gas limit used for deploys
        }
    }
};

Thank you!


texts: Why is geth always returning a 0 balance?

texts:
I installed geth on a remote server (Ubuntu 14.04) and created an account.  I transferred 0.01 eth to the account.  From my local machine (OS X), I can view the transaction and account balance correctly with web3.

However, if I log into the server and try to get the balance, it returns 0.  In fact, trying to check the balance, or get info on anything returns 0.  It's almost like my node is not connected, by it says I have 8 peers (and I've listed them and they look legit).

To recap, running the following on my home computer returns "0.01":

web3.fromWei(web3.eth.getBalance('0x7cacf18f931259c30a7194fa96ab3a44c38b3535'),'ether').toString(10)

As of this writing, that is correct.

However, running the same command, or even web3.eth.getBalance(web3.eth.coinbase) always returns 0 on my server.  In fact, trying to get info on anything on the public chain fails (including contracts).

I'm trying to get a simple Dapp deployed, but getting a node up and running is driving me crazy!

For reference, I have ethereum/geth v. 1.3.3 installed.  I've also tried 1.4-unstable.  I've tried a variety of methods to start geth, and have no idea why it can't get info from the public chain.


texts: How to validate ERC-20 payments into a contract?

texts:
I'm writing a smart contract that will do something as long as the user requesting that feature has paid the correct amount. If the amount is in ETH, I can easily do that with a simple require statement like this:

function doSomething() public payable {
    require(msg.value == 1 ether);  // make sure they paid
    // if they paid, proceed with the action
}

However, if I want to accept other ERC-20 tokens instead of ETH, I am not sure how I would be able to do that inside my contract (i.e. without running my own separate server listening to the blockchain and teasing out individual transactions).

Since all ERC-20 token transfers happen inside the contract for the specific token (and not inside the methods of my smart contracts), how would my contract know or validate that:

The correct amount has been transferred.
The amount was transferred from address A.
The amount was transferred to address B.

Where A is my smart contract, and B is the user.


texts: Etherscan for Ropsten not showing tx events anymore

texts:
Since today 2018-04-11 etherscan on Ropsten testnet does not show anymore the events related to a given transaction. It is very important for the testing and debugging of Smart Contract to view the events produced by a transaction.

So, my question is, do you know if the event view functionality is just temporarily disabled on etherscan or removed for ever? Thanks!


texts: Event tracking and decoding from ethereumj

texts:
I have an event in the contract , and upon the event fires I could able to see by a java listener as below

public void onTransactionExecuted(TransactionExecutionSummary summary) {
  List<LogInfo> listLogs= summary.getLogs();// This gives you list of log info
 // now Iterate and print the details
}

upon printing the loginfo object I get something like LogInfo{address=cd5805d60bbf9afe69a394c2bda10f6dae2c39af, topics=[37637aa70af5cd14eda4054cc4323408c237c26de60d49064db916e476c29e2e 67fad3bfa1e0321bd021ca805ce14876e50acac8ca8532eda8cbf924da565160 ], data=000000000000000000000000cd2a3d9f938e13cd947ec05abc7fe734df8dd826}.

I know it is some sort of abi encoded or serialized, but I want to decode what are the information I have in the logs.


texts:
I already run test apps online on a rinkeby test network and have a good understanding of how to dev and publish my apps on this particular blockchain.

HOWEVER, I have been in trouble understanding the basics of the real blockchain use, and have therefore a few questions.

If I want to publish a smart contract to the ethereum blockchain, I need to do it via a server that has a node running on it? or will truffle be enough to deploy it?

When running a Dapp that uses ethereum blockchain, would that be enough if my users use metamask without a local node running on my server? Or would I still need a local ethereum node locally?


texts:
Sending Address has over 1 Eth in current Balance.

Using the Geth console, I can send many transactions of any amount less than .033

eth.sendTransaction({to:'0x8B9da75fda99bAd680154050Ba386523CA3AD112',
from:'0x62396567241bC92Ee3D082AC3C4144511Ec6c773',
value:web3.toWei(.033,'ether'),gas:30000})

"0x113dd5b9c8bb6d48fe2b3ef16576905f6e46aa4ed6cd080120a2aaf54113e7b4"

If I try to send .034 ETH or greater, then I always get this error.

  eth.sendTransaction({to:'0x8B9da75fda99bAd680154050Ba386523CA3AD112', from:'0x62396567241bC92Ee3D082AC3C4144511Ec6c773',value:web3.toWei(.034,'ether'),gas:30000}) Insufficient funds for gas * price + value
  at web3.js:3119:20
  at web3.js:6023:15
  at web3.js:4995:36
  at :1:1


texts: See in geth if a smart contract (ICO) was never executed

texts:
If I send ether to a smart contract, how can I see in geth, that it was rejected?
I want to see which of my transfers were accepted by an ICO and which were not.
I don't see any such field in getTransaction.


texts: Truffle Console 'from' Parameter Ignored

texts:
I have this payable fallback function in a contract code:

function() is_live() payable {
        if (msg.value == 0) throw;
        if (isFinalized) throw;

        uint256 tokens = safeMult(msg.value, tokenExchangeRate);   // calculate num of tokens purchased
        uint256 checkedSupply = safeAdd(totalSupply, tokens);      // calculate total supply if purchased

        if (maxCap < checkedSupply) throw;                         // if exceeding token max, cancel order

        totalSupply = checkedSupply;                               // update totalSupply
        balances[msg.sender] += tokens;                            // update token balance for payer
        MPYCreation(msg.sender, tokens);                           // logs token creation event
    }

In truffle console I execute the command:

Token.send(500, {from: web3.eth.accounts[1]})

(Where Token refers to the contract instance)

But then I check web3.eth.accounts[0] and web3.eth.accounts[1] balances and 0 has paid the weis, while 1 has a balance of 10 ether.

How is this possible?

Thanks


texts: What do the response values of a Parity `trace_transaction` call actually represent?

texts:
Parity implements a really useful trace module for deep diving into blocks and transactions.

One particular method trace_transaction allows you to investigate the EVM execution paths of a transaction.

It is not however clear in the documentation what the various response values represent.

Most of the values are (I believe) fairly obvious.
The ones that are confusing me are gas within the action property of the result, and gasUsed within the result property.

I assume that they represent the maximum gas available at that given step, and the amount of gas used by that step respectively BUT a the initial gas value does not equal that sent with the transaction and a summation of the gasUsed values does not equal the value for gasUsed returned by a call to getTransactionReceipt.

An example.

This (random) transaction on the Ropsten testnet.

The first call has a gas value of 576552 whereas the transaction was submitted with a gas limit of 600000.

The summation of gasUsed values is 102979 whereas a call to getTransactionReceipt returns a total gas used of 93518.

The Geth debug modules also shown a difference of 93518 between the first and last EVM commands.

Can anyone clear up what these values actually represent?


texts: What are the balances of The DAO and it's child DAOs on the Ethereum Classic chain?

texts:
At the hard-fork block #1,920,000, the ETH balance from The DAO and it's child DAOs (which includes the balance from the extraBalance account) were transferred into the Withdrawal contract.

What are the current The DAO and child DAO balances on the Ethereum Classic chain that did not undergo the hard-fork?


texts: Performance Analysis of Ethereum Clients Geth and Parity

texts:
I want to do performance analysis of Geth and Parity.

I want to run 1000 transactions serially on each client and want to get transaction processing time for each transaction.

How can i get these metrics? Can i get it from the logs or is there any script i need to run?


texts: Autorefill isn't working on Improved Coin code

texts:
I've been trying to write a token contract with the autorefill function, but perhaps the code for the token example on the ethereum website is somewhat outdated, because it isn't working.

Did anybody get Autorefill working? Could someone with Solidity experience simply copy and paste the "Improved Coin" code and include the Autorefill?

There's 2 types of Autorefill, the first one I've managed to include and compile successfully, but it doesn't seems to work on transactions, and the second one, which the fee is paid forward to the receiver, I couldn't get to compile at all.

I'm testing on a exact copy of "Improved Coin" on Rinkeby testnet.
And i'm aware that the function is triggered when the sender's balance gets below a threshold defined by "minBalanceAccount", which I set as 5 finney, and that it takes away Ether from the contract's balance. Still, it never gets triggered.

Here are the steps i've tried:

After creating contract and wallets, transfer 1 token from owner to contract
Set buy and sell price to 1000000000000000000 wei (1 ETH)
Buy the 1 token back from the contract, which now receives 1 ETH
Set minimum balance to 5 finney (0.005 ETH)
Transfered a few tokens to several test wallets, which some have more ether than the set minimum (e.g: 0.1 ether), some with the exact minimum, some with below minimum (e.g: 0.004 ether)
Tried some transactions between them, Autorefill never got triggered, even when the conditions are met


texts:
I am trying to transfer a token from a token contract. the control reaches till the point where I have the transfer statement later it fails. I do not understand why it is failing. I made sure the account in which I have logged in have sufficient tokens. Could you please assist me to correct the code ?

Code

pragma solidity ^0.4.24;

/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
contract Ownable {
  address public owner;

  /**
   * @dev The Ownable constructor sets the original `owner` of the contract to the sender
   * account.
   */
  constructor() public {
    owner = 0xca35b7d915458ef540ade6068dfe2f44e8fa733c;
  }

  /**
   * @dev Throws if called by any account other than the owner.
   */
  modifier onlyOwner() {
    if (msg.sender != owner) {
      throw;
    }
    _;
  }

  /**
   * @dev Allows the current owner to transfer control of the contract to a newOwner.
   * @param newOwner The address to transfer ownership to.
   */
  function transferOwnership(address newOwner) public onlyOwner {
    if (newOwner != address(0)) {
      owner = newOwner;
    }
  }

}

contract Token{
  function transfer(address to, uint value) public returns (bool);
}

contract Airdrop1 is Ownable {

    function multisend(address _tokenAddr, address[] _to, uint256[] _value) public
    returns (bool _success) {
        assert(_to.length == _value.length);
        assert(_to.length <= 150);
        // loop through to addresses and send value
        for (uint8 i = 0; i < _to.length; i++) {
                assert((Token(_tokenAddr).transfer(_to[i], _value[i])) == true);
            }
            return true;
        }
}


texts: How to see Smart contract address and it’s transactions, and have multiple addresses in a smart contract

texts: How can I see a smart contract address &  know which addresses sent ether to my smart contract? And Can a smart contract have multiple receiving addresses.... like for example if I am selling e-books can every e-book have its own address so that the sales of each book is transparent or do I have to have multiple smart contracts “talking” to each other for this to happen?


texts: What is meant by on-chain randomness? What is the difference between on-chain and off-chain operations in the context of randomness?

texts:
I want to understand on-chain and off-chain operations in the context of randomness. Kindly provide me an example so that its clear to me.

I got one post here:

What are offchain and onchain Transactions?

but they did not discuss off-chain and on-chain in the context of randomness.

One example of off-chain is:

  We saw some of the pitfalls of bad randomness on Ethereum, but what
  can one do to produce truly random numbers? A standard recommendation
  is to go off-chain and employ external sources. These are typically
  either an outside “oracle” service (e.g., Oraclize), or hashed inputs
  by multiple users with competitive interests.

What is meant by the outside "oracle" service (e.g Oraclize)? What is a hashed input (is it a random id?) ? If you could tell me about an inside oracle that would be useful too.

For on-chain, I got the following:

  To summarize, our recommendation for on-chain random number generation
  is to follow a pattern such as: • Accept a bet, with payment, register
  the block number of the bet transaction. •    The bettor has to not only
  place the bet but also invoke the contract in a future transaction
  (within the next 256 blocks). The contract will compute the blockhash
  of the earlier-registered block number, and use it to determine the
  success of the bet.

What I understand is that for on-chain we have to use some sort of blockchain variable. Am I right?

Zulfi.


texts: How to pre-allocate ether to new account created in ethereum private network?

texts:
Not by genesis file to be clear
when we create new account through geth console it should create new account with some pre-defined balance


texts: What is Solidity revert code "-32000" when interacting with contracts via Remix IDE?

texts: I wonder if the error "VM Exception while processing transaction: revert", "code": -32000" thrown by the Remix IDE indicates the 0x32 Solidity panic exception happening when you access array out-of-bounds?


texts:
Is it possible to change params of one contract from another? I mean:

contract One {
  address public addr;
}

contract Two {
  function test(address oneAdd) public {
     One one = One(oneAdd);
     one.addr = address(0);
  }
}


texts: Runtime out of memory on RPi with ethereum node

texts:
I have a private network of ethereum with 2 miners on my PC and a node on RPi, after syncing it says:
Fatal: runtime: out of memory

The sd card is 16Gb and it should have plenty of free space, is RAM the problem?

What can I do?
Thanks


texts:
After deploying ERC20 tokens on testnet I realize I need a buyToken function in the Smart Contract in order to give tokenholders a way to buy the tokens. Another alternative would be to transfer all the tokens to the contract owner and then the owner can send them to the tokenholders, one by one. But in the ICO scenario I guess it is more appropiate to have a buy function to acquire new tokens and paying with Ethers, right?

Well, the point of the question is about after-ICO actually. Once all tokens have been issued and given to final tokenholders and ICO is finished, how can anyone trade with the tokens?

I mean, how can they buy new ones or sell theirs? What about the token price? Must it be fixed by contract owner or could it be dynamic depending upon the Law Of Supply And Demand?

Or do I need an exchange to take care of the trading process somehow?

Any hint about all these concepts will be very helpful. Thanks!


texts: Run geth in light mode on Rinkeby and Raspberry

texts:
I am trying to run geth --light --cache 64 --rinkeby but it stucks on

INFO [02-12|08:58:16] IPC endpoint opened: /home/pi/.ethereum/rinkeby/geth.ipc.

I am using geth on a Raspberry.

The full output is:

geth --light --cache 64 --rinkeby
INFO [02-12|08:58:16] Starting peer-to-peer node               instance=Geth/v1.7.3-stable-4bb3c89d/linux-arm/go1.7.4
INFO [02-12|08:58:16] Allocated cache and file handles         database=/home/pi/.ethereum/rinkeby/geth/lightchaindata cache=64 handles=1024
INFO [02-12|08:58:16] Initialised chain configuration          config="{ChainID: 4 Homestead: 1 DAO: <nil> DAOSupport: true EIP150: 2 EIP155: 3 EIP158: 3 Byzantium: 1035301 Engine: clique}"
INFO [02-12|08:58:16] Loaded most recent local header          number=10815 hash=d783a3…2cb71d td=21429
INFO [02-12|08:58:16] Starting P2P networking
INFO [02-12|08:58:16] RLPx listener up                         self="enode://b8f1470420a00d38eef1d248c81fa6339af942bf2eaeb62b46ba26f3db6a0f1435b23486b741e5d998a681213e7cf467f3b1096497af10267499ac7b0f9099df@[::]:30303?discport=0"
WARN [02-12|08:58:16] Light client mode is an experimental feature
ERROR[02-12|08:58:16] Failed to retrieve current release       err="can't fetch trie key ff59dc520c6c214bf3711461287c619f740a46852d93cc5a8e998966582e7cf3: no suitable peers available"
INFO [02-12|08:58:16] IPC endpoint opened: /home/pi/.ethereum/rinkeby/geth.ipc

I tried the same command on my macOS Mojave and it works fine, after opening IPC endpoint it continues importing blocks and states.

Should I assume it's a problem with the machine on which the geth is running?


texts:
I know of three ways to get the nonce for an account.

MyEtherWallet under the Offline Transactions tab.
At the command line with Geth
Manually count the number of outgoing transactions for an account using Etherscan. Oddly, Etherscan counts the number of transactions for an account and displays this value on the account page but does not display the number of outgoing transactions (the nonce).

My question is: does anyone know of any other quick methods of getting the nonce for an account?

Thanks, John


texts: Smart contract not updated with Go and NewSimulatedBackend

texts:
I'm using the smart contract SimpleStorage and try to change the value with a Go script and NewSimulatedBackend to simulate the blockchain.

After deploying and execute the smart contract, the value doesn't change and is still 0.
What did I miss ?

simplestorage.sol

pragma solidity ^0.4.0;

contract SimpleStorage {
    uint storedData;

    function set(uint x) {
        storedData = x;
    }

    function get() constant returns (uint) {
        return storedData;
    }
}

main.go

package main

import (
    "fmt"
    "log"
    "math/big"

    "github.com/ethereum/go-ethereum/accounts/abi/bind"
    "github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
    "github.com/ethereum/go-ethereum/core"
    "github.com/ethereum/go-ethereum/crypto"
)

func main() {
    key, _ := crypto.GenerateKey()
    auth := bind.NewKeyedTransactor(key)

    alloc := make(core.GenesisAlloc)
    alloc[auth.From] = core.GenesisAccount{Balance: big.NewInt(133700000)}
    sim := backends.NewSimulatedBackend(alloc)

    // deploy contract
    addr, _, contract, err := DeploySimpleStorage(auth, sim)
    if err != nil {
        log.Fatalf("could not deploy contract: %v", err)
    }

    // interact with contract
    fmt.Printf("Contract deployed to %s\n", addr.String())

    fmt.Println("Mining...")
    sim.Commit()

    fmt.Println("Adding new value...")
    contract.Set(&bind.TransactOpts{
        From:     auth.From,
        Signer:   auth.Signer,
        GasLimit: big.NewInt(2381623),
        Value:    big.NewInt(10),
    }, big.NewInt(42))

    fmt.Println("Mining...")
    sim.Commit()

    info, _ := contract.Get(nil)
    fmt.Printf("Get data: %d\n", info)

    fmt.Println("Mining...")
    sim.Commit()

    // Get contract
    contract2, err := NewSimpleStorage(addr, sim)

    data2, _ := contract2.Get(nil)
    fmt.Printf("Get data 2: %d\n", data2)
}

Results

Contract deployed to 0xac3a4f57cd4686ddf90a882e29357034ff368a2e
Mining...
Adding new value...
Mining...
Get data: 0
Mining...
Get data 2: 0

Thanks,