texts: Issues getting a simple oraclize example to work, callback never executed

texts:
I have been trying to deploy and test the basic "SimpleDice" smart contract provided as an example from Oraclize.

I have had to adjust it to work with solidity 0.4.2 a bit, but maybe I am missing something, maybe Oraclize is bugging out.

The smart contract can be found here: https://testnet.etherscan.io/address/0xe1b0d1eecc126b96f94cf55e6cf525ccae4bf0d8

EDIT: I have also deployed a second contract at https://testnet.etherscan.io/address/0xe25229cc19b5044f7cbe0c20abf9972c77b1e36c with more balance, this fixes the invalid jumps however I STILL see no callbacks being executed

I have the following code (note, usingOraclize.sol is the file located at https://github.com/oraclize/ethereum-api/blob/master/oraclizeAPI_0.4.sol ):

pragma solidity ^0.4.2;

import "usingOraclize.sol";

contract SimpleDice is usingOraclize {
    address owner;
    mapping (bytes32 => address) bets;

    function SimpleDice(){
        owner = msg.sender;
    }

    function() payable {
        if (msg.sender != owner) throw;
    }

    function __callback(bytes32 myid, string result) {
        if (msg.sender != oraclize_cbAddress()) throw;
        if (uint(bytes(result)[0]) - 48 > 3) {
            if (bets[myid].send(2 wei)) {
                log0("winner");
            }
        }
    }

    function bet() payable {
        rollDice();
    }

    function rollDice() {
        bytes32 myid = oraclize_query("WolframAlpha", "random number between 1 and 6");
        bets[myid] = msg.sender;
    }

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

This code compiles and deploys just fine. However notice the following issues:

1) The first time I call bet() it seems to work fine. HOWEVER as you may see, Oraclize never executed what it was supposed to and/or never called my __callback function

2) The subsequent times I call bet, the transaction fails with an "invalid jump destination"

3) The subsequent calls cost a lot of gas which is completely lost every time.

Does anyone have any idea what the heck is going on? thanks a lot!


texts: Reading Ledger from etherscan API vs Emitting Events

texts:
Consider the following function from a solidity Contract:

function createProduct(uint _price, string memory _desc) public payable{
   emit UserLedgerUpdated(_desc, -1*int(msg.value));
}

I want my Dapp to show a simple ledger like the following:

Created Shoes priced at 100 Wei for a Total Cost of 2345 Wei

I have two choices here:

Catch the UserLedgerUpdated Event in the Dapp
Use the etherscan API to obtain the txn details

My questions are:

a) If I go for choice 2 (ie, reading txn details), then I can avoid emitting events. Since Events get logged and occupy space, they'd cost gas, and hence will be more expensive than reading txn details for free. Is my understanding correct?

b) While reading the ethscan API, I get the input to the function as hex. I can use web3.toAscii to convert it to string, but notice that the first argument to the function is actually a number. Hence, when I convert
Input Data in Sample Transaction, I get {@Shoes instead of 123Shoes. Is there a way to properly cast the hex data we are getting from ethrscan API?


texts: What are the benefits of ethereum 'archive' sync mode and who should use it?

texts:
We have set up a private Ethereum node for our blockchain application connected to the mainnet. The node runs on a server with 2TB SSD, 4 CPU and 6GB memory. It's been syncing for about a week and is currently at block ~5,000,000 (around 900GB of disk space).

Since it's taking quite a long time to sync compared to the fast sync mode - which also takes less disk space - I wonder if there's any obvious benefits to running it in the archive mode and if we could potentially run into problems if we were to switch to the fast mode.


texts: Private chain: Extracting the "data" from an account?

texts:
I have initiated and mined a transaction between two accounts. I also included a data field in this transaction. This is just random hex data. Here is the command:

eth.sendTransaction({from:eth.accounts[0],to:eth.accounts[1],value:web3.toWei(1,"ether"),data:"4e4f"})

Now, from the transaction hash, I can get this data (It's in the input field):

eth.getTransaction("<transaction hash>")
{
  blockHash: "0xfa62730b0f9e310cd07d615b78857e338e845b9098c26f861e2713c5f690497d",
  blockNumber: 15,
  from: "0x37e5a459dbd48d4d9874e13cc334dab30373cece",
  gas: 90000,
  gasPrice: 20000000000,
  hash: "0x2beef248d7d690d95cd1da22c8bf12937d323b197430e5a384cf4259db290bef",
  input: "0x4e4f",
  nonce: 2,
  to: "0xe1e09a6f9504d42e2e63e1b21447f4410159cf24",
  transactionIndex: 0,
  value: 1000000000000000000
}

But, I want to retrieve this data using the recipient account address

  0xe1e09a6f9504d42e2e63e1b21447f4410159cf24

We can get the balance of this account using eth.getBalance(account_address). Along with the ether, I am also sending the data to this account (Is this not how it works?). So, is there an eth.getData/eth.getInput function similar to this to find the data received by an account?
Where is this data actually being stored in my private blockchain?


texts: Ethereum storage implementation at the database level - how is it stored

texts:
I have read the yellow paper many times as well as various articles, I suppose if I cannot find the answer here - I will look into the code.

My understanding is that each contract account contains a storage root. and you can retrieve the root from the level db.

But what is the value in the leveldb?

Here are some of my questions:

LevelDB is key-value, so if we are able to use the storage root to get storage of a contract, then what is the value?
I am going to take a wild guess, that the value is the patrica tree?
If 2 is true, then isn't it extremely inefficient any time we want to execute the contract - we have to grab the storage of the entire contract.. ? If a contract has a lot of storage, then its potentially extremely slow to do so?
Last question - my understanding that all ERC20 token balance information is stored in the storage, then this means if I ICO to 5 million accounts - this means I now have a huge storage that is extremely slow to retrieve? - Given that the entire contract's storage is retrieved all at once.


texts: Is it important to save the transaction ID in ethereum?

texts:
In Bitcoin, the data that you want to keep in the blockchain resides in the transactions so it is important to keep the transaction ID. Is it the same in Ethereum? Or is the data saved in smart contracts?
I need to know because I want to understand how a client can connect to Ethereum in order to privately verify a performed operation. For example, the customer must be able to verify that there is a reservation within the smart contract.


texts: MetaMask no longer working on my Chrome browser

texts: I have learned that MetaMask no longer automatically links up to Web3 sites. Every time I now try to use my MetaMask to transfer fund from MyEtherWallet, I see that it is not connected to whatever site I'm trying to connect to and get this message: "MetaMask is not connected this site. To connect to a web3 site, find the connect button on their site." To put it simply, I have not been able to find any such button nor do I understand the complex (to me) coding advice I'm finding in my research on how to correct this problem. I am not a coder nor a sophisticated user. Is there any simpler way a non-coder can get this to work or should I disable MetaMask and go back to the old school way of making transfers directly from MyEtherWallet?


texts: Which browsers can automatically browse .eth domains?

texts: Ethereum Name Service (ENS) sells .eth domains, but browsers might require a gateway to view them. Which browsers can browse .eth domains automatically without gateway (e.g. Chrome, Firefox, Brave, Edge, etc)? And can we foresee browsers incorporating automatic access to them in their future versions? Is wider adoption amongst surfers (browsing, not registering) likely in the near-term?


texts: How to get the smart contract name given the address

texts:
I've been trying to get a smart contract name given the contract address.
Not a smart contract in particular, but I wanted the process to be able to get the name of any contract by the address.
I've been using web3js and infura but without any luck.
Can anyone point me towards the right method to use?


texts:
Kovan's network faucet is inactive. I have only found a few "faucets" that give me 0.01 or 0.1 test Ether every 24 hours...
https://faucet.kovan.network
This is the Kovan Token contract. Its Off since 21 days ago
What is happening?
Someone could fund me some Ethers for still working..? (please and thanks)
0xdF6e07E4D432638CE80B73cFaF127678eF4D7E6E


texts: Dapp SDK - Hardcoded ABIs vs Dynamic ABIs

texts:
I am developing a Javascript SDK to allow for integration of external services with our Dapp. The SDK calls the smart contracts' methods and therefore needs to know contracts addresses and ABIs.

Some contracts are upgradable so their addresses and ABIs may change in the future.

What would be the best solution?
1) Hardcode addresses and ABI inside the SDK (in a json file) and release a new version of the SDK every time a contract is updated
2) Let the SDK fetch addresses and ABI's from the server (this would require an async initialization of the sdk)


texts:
Tokens from a ERC20 ICO don't need to be mined correct? Only gas needs to be paid for the smart contract transaction to happen and the token to be created?

So every time somebody buys into an ICO, gas needs to be paid to create tokens for them?


texts: An example on using "zk-SNARK" in "smart contract"?

texts:
I read this article: https://media.consensys.net/introduction-to-zksnarks-with-examples-3283b554fc3b

However, it's not clear to me a function such as zksnarkverify has been already implemented in Ethereum Solidity? Or we need to implement it by our self?

Is there an API or library to use zk-SNARK algorithms ? such as:

public keys generator G(program C, secret lambda) -> (prover public key, verifier public key),

or

prover algorithm P(prover public key, public x, secret w) -> proof

or

verifier algorithm V(verifier public key, public x, proof) -> true ?

where program C is C(public x, secret w).


texts: txList.length returns different value for different Solidity versions

texts:
I have RLPReader smart contract, took it from here.

And I have a function untouched for a while:

function deposit(bytes txBytes) public pure returns (uint) {
    RLP.RLPItem[] memory txList = txBytes.toRLPItem().toList();
    require(txList.length == 15);
    //...
}

Everything worked fine until I changed pragma solidity ^0.4.18; to pragma solidity ^0.4.24. I just change this one line and my test fails now.
I found that code fails on this line require(txList.length == 15); because previously txList.length was BigNumber { s: 1, e: 1, c: [ 15 ] }, but after upgrade to ^0.4.24 it's BigNumber { s: 1, e: 0, c: [ 4 ] } and I can't find why. Does anybody know what changes can affect on this code?


texts: Unable to find outgoing transactions transactions on Etherscan?

texts:
I am creating an application which aims to visualize ethereum transactions, so far getting data from geth I have noticed that there are never outgoing transactions from a contract account, and whenever i look at etherscan i cannot find any outgoing transactions either, why is this the case?

I noticed that some contract execution created further contracts as internal transaction, does that mean these new contracts are deleted once the execution of the contract is finished, if not then why are they not recorded as a new transaction from the creating contract? one such contract is https://etherscan.io/address/0xf0160428a8552ac9bb7e050d90eeade4ddd52843 (DigixCrowdSale).

If possible can someone please give an example of a contract issuing a transaction which is recorded on the blockchain, since i have been unable to find any.


texts: How to build a decentralised Voting Website without using any 3rd party extensions like Metamask, or IDEs like Remix?

texts:
I've gone through various Blockchain Tutorials but everywhere it's one or the other same thing. Download truffle/ganache, from 10 free testrpc account, use one, use metamask, Remix IDE etc, and Voila!Your Voting application is complete.

Please tell me how do I start? I need to build a website that creates a blockchain that stores Voters Details fetched from website, mines votes based on some authentication parameters, build my own blockchain network and not just relying on any APIs kinda stuff, and access those blocks, but can't change it.

How to start programming for blockchain?

http://www.dappuniversity.com/articles/the-ultimate-ethereum-dapp-tutorial
https://itnext.io/build-your-first-blockchain-application-in-5-quick-steps-89ebb96adbfe
https://medium.com/@mvmurthy/full-stack-hello-world-voting-ethereum-dapp-tutorial-part-1-40d2d0d807c2
etc.

P.S.
I've gone through these websites for tutorials, so please don't ask to refer them.


texts:
Scenario:

Import json file and decrypt it
Use account to sign the messsage

I can do this with web3(Web3.providers.HttpProvider) or with web3-provider-engine. What is major difference between using web3 or web3-provider engine?
When should i use web3 provider engine?


texts: How do I limit the number of ERC721 NFTs per account?

texts:
I would like to restrict the number of NFTs any one address can own. How would you implement this in a Solidity smart contract? Say I have an ERC721 NFT contract, Square.sol:
      import "../node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol";

      contract Square is ERC721 {

        constructor() ERC721("Square", "SQUARE") public {}

        string[] public squares;
        mapping (address => uint) public ownerSquareCount;

        function mint(string memory _colour) public {

          // No one should own more than one square
          require(ownerSquareCount[msg.sender] == 0, 'Each address may only own one square');

          squares.push(_colour);
          uint id = squares.length;
          ownerSquareCount[msg.sender]++;

          //Open Zeppelin ERC721 _safeMint function
          _safeMint(msg.sender, id);

          }
      }

I have tested the above code, but it still allows a single account to mint more than one Square NFT.
(I recognize that anyone can simply create multiple addresses as a work-around, but I'm hoping the effort of having to manage lots of addresses will limit the extent to which this would occur)
EDIT
I have found the solution. For some reason, the ownerSquareCount mapping does not work. Instead, you can use the balanceOf function, which is part of the ERC721 standard. If you change line 10 to:
require(balanceOf(msg.sender) == 0, 'Each address may only own one square');

It works like a charm, throwing an error if an account tries to mint more than one token.
I am only a beginner, but one piece of advice I can share: if you are building smart contracts off a standard (like ERC721 or ERC20), dig deep into those existing contracts. A lot of the functionality you are about to code is probably already done there. I found myself tidying up my NFT smart contract by simply deleting my functions and using the built-in ones.


texts:
I need to call function from my contract.
I got:
Uncaught (in promise) TypeError: contract.getBadgeOwner is not a function
async function a() {
    let contract = await tronWeb.contract().at(".......")
//  console.log(contract);
    let currentValue = await contract.getBadgeOwner('withdraw').call();
    console.log(currentValue);
    alert(currentValue);
}

This function is for withdraw.
Thanks


texts: onlyOwner / onlyProvable with oracle functions using Provable

texts:
Is it possible to make a function onyOwner, since one of them must obviously be called by Provable's server? Or is there an equivalent modifier to it, such as onlyProvable?
If not, would there be a way to code one?

More generally, what about making functions internal or private?


texts: How to use 'geth' to find a smart contract in the ropsten testnet

texts:
I try to connect with web3.php to a smart contract, published in the ropsten test network via metamask. I used the following web3.php library: (https://github.com/sc0Vu/web3.php). To create an rpc server, I used ethereum go and run the following commands:

geth --testnet removedb
geth --testnet --rpc

Which should make a test node, connected to the ropsten test net. Now I run the following code in php, but the result i get back is always "error", which means, it does not find the smart contract. Has anyone an idea, why it does not find the contract in the ropsten test network? I think somehow I'm not connected to it with ethereum-go. I also published the smart contract on a local testrpc, where it works fine.

<?php

require('vendor/autoload.php');

use Web3\Web3;
use Web3\Contract;
use Web3\Providers\HttpProvider;
use Web3\RequestManagers\HttpRequestManager;

$abi='[
    {
        "constant": true,
        "inputs": [],
        "name": "value",
        "outputs": [
            {
                "name": "",
                "type": "uint256"
            }
        ],
        "payable": false,
        "stateMutability": "view",
        "type": "function"
    },
    {
        "constant": true,
        "inputs": [],
        "name": "getValue",
        "outputs": [
            {
                "name": "",
                "type": "uint256"
            }
        ],
        "payable": false,
        "stateMutability": "view",
        "type": "function"
    },
    {
        "inputs": [],
        "payable": false,
        "stateMutability": "nonpayable",
        "type": "constructor"
    }
]';

$web3 = new Web3(new HttpProvider(new HttpRequestManager('http://localhost:8545')));

$contract = new Contract($web3->provider, $abi);
$contractAddress='0x3ed9bd43bb425c0acc202421f54e8de72b8d91f9';
$functionName='getValue';

$contract->at($contractAddress)->call($functionName, function ($err, $result) use ($contract) {
    if ($err !== null) {
        echo "error";
        throw $err;
    }

    if ($result) {
        echo $result;
    }
});

When I start my node, i get the following command output:

Edit: eth.getBlock('latest')


texts: What is the return value when you call a non-existent function and the call goes through to the fallback?

texts:
Say I am expecting a result to be returned. What will happen to the return value when the call will go through to the fallback since the fallback does not return anything?

  uint a = otherContract.bar();

where I expect bar to return uint but otherContract does not actually implement it

  function bar () returns (uint);

Will a take a value? will the cal throw?


texts: Understanding the ERC20 transferFrom default implementation - why is it working?

texts:
I'm having trouble to understand where the allowance is checked in the "transferFrom" function - IMHO the allowed amount is deducted but never checked weather it is sufficient to allow the transactions - what am I getting wrong here?

function transferFrom(address from, address to, uint tokens) public returns (bool success) {

    balances[from] = balances[from].sub(tokens);

    allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);

    balances[to] = balances[to].add(tokens);

    Transfer(from, to, tokens);

    return true;

}


texts:
Do contracts also have a nonce and if so how is it calculated? Usual accounts have a nonce that is increased with every transaction. However, contracts can't make transactions, they can only make calls that are triggered by transactions.

But contracts still can create other contracts and for the newly generated contract the nonce of the sender is relevant. So it seems that contracts also have nonces. Is this nonce increased every time they call another contract or only if they create another contract?


texts:
Is there a simple way to convert a bytes32, e.g. 0xca35b7d915458ef540ade6068dfe2f44e8fa733c, to an address?

bytes32 data = "0xca35b7d915458ef540ade6068dfe2f44e8fa733c";

I tried casting it with address(data) but that didn't work. I've also seen this solution here but that only works with bytes and not bytes32.

Here's the function I need in solidity:

function bytes32ToAddress(bytes32 input) public pure returns(address){
   // convert input to address
   return ...;
}


texts: sha512 in Solidity or assembly, does it exist?

texts: Is it possible to do sha512 within a smart contract? Or, not?


texts: How can I verify that two specific wallet addresses were involved in a transaction?

texts:
Given I have and know WalletAddress A (sender), WalletAddress B (receiver), the Transaction Hash and the amount ETH sent. How can I verify that those values were indeed involved in the given transaction?

I checked a couple (of my own) transactions. And I know I sent some ETH from a wallet address to another wallet address. But when I check the transaction via an online explorer, the ‘sender’
 or ‘recipient’ are not always equal to my (from/to) wallet addresses.

My initial thought was to check via an online explorer the transaction by the transaction hash, and compare the ‘sender’ field and the ‘recipient’ field with WalletAddress A and WalletAddress B. But I don’t think this is a solid solution.

Summary; I want to check if a sender indeed sent a specific amount to a receiver at a specific time. But I don’t know how to approach this issue. I thought this could be accomplished when I know the transaction hash. How can I do this? And preferably with an online API and without running a (local) node.

Thank you in advance!

Edit:

This is an extreme example, but maybe the most simple one;
I have a Coinbase account (with a 'personal' ETH address). I have a Binance account (with a 'personal' address). When I send from Coinbase to Binance, and check the transaction, I see my 'personal' Coinbase ETH address in the transaction, but the receiver is the 'global' Binance address. And not my 'personal' Binance address. So, I have all the values (transaction hash, to address, from address and amount), but how can I check (via an explorer) that it indeed was received at my 'personal' Binance address?


texts: How to get a call graph for the binary code of a contract?

texts:
I need a call graph generator for the assembler level of smart contract code in order to analyse solidity compiler bugs.

In that way, porosity is excatly what I need !
However there are too much bugs : for examples, it doesn’t stop the call graph at STOP and REVERT instructions and doesn’t treat STATICALL as call instructions. It only recognize JUMPI as jump instruction and thus ignore JUMP instructions. I tried to fix the code for those errors, and the problems got worst.

What’s the alternative way to get what I’m needing ?


texts: How to get "Contract creation code" when it's not verified yet?

texts:
Is there any possibility to get the "creation bytecode" of the contract when it's not yet verified?
I have a token smart contract: https://ropsten.etherscan.io/address/0xae78b6e1231e7a852af60047a2ab16a40cefafb3#code
It's not verified by the owner, and the current bytecode as I understand is the "Runtime Bytecode". Because I want to verify the source code of this deployed smart contract matches with
my local one.


texts: Useful resources to help understand go-ethereum source code

texts:
I am new to ethereum community and I want to study the implementation of Ethereum (e.g. geth) and contribute to the  go-ethereum project.

However, I find the source code hard to understand by only looking at the project source code. I have read the white paper and yellow paper of Ethereum, but these are still high-level ideas of Ethereum protocol and contain very little information of the structure and functionality of every module in go-ethereum project. Although the source code is accompanied by a bunch of comments, it is still difficult for beginners (like me) to understand.

So, are there any resources or reading materials that explain the module structure and implementation details of go-ethereum project?

Thanks very much in advance.


texts: do users should be aware of smart contract of the dApp they are using?

texts: So dApps are frontend + contract. Users interact with smart contracts via frontend. Do users i.e. people should be aware of how the contract is designed while using any dApp? are their any risks of giving or not giving users the details about smart contract of their dApp?


texts: Can a contract be deployed through a node which is not owned by the contract owner?

texts:
I want to create a private network, and allow anyone to deploy a contract via an RPC call.

Is it possible to allow someone to deploy a contract via a node that they do not own?


texts: Difference and relationship (if any) between ERC and EIP

texts:
Understand that ERC stands for Ethereum Request for Comments while EIP stands for Ethereum Improvement Proposal.

I refer to ERC20.

Are these request for comments (erc) translated to improvement proposals (eip) down the road?


texts:
I am using Windows 10.
** When I run "truffle develop" commend is give me an error:**
 λ truffle develop
user@DESKTOP-V44IVRJ MINGW64 ~

$ truffle develop

ExtendableError: Could not find suitable configuration file.

at Function.detect (C:\Users\user\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\config\dist\index.js:148:1)

at Object.run (C:\Users\user\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\develop.js:53:1)

at Command.run (C:\Users\user\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\command.js:136:1)

at Object.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\cli.js:56:1)

at __webpack_require__ (C:\Users\user\AppData\Roaming\npm\node_modules\truffle\build\webpack:\webpack\bootstrap:19:1)

at C:\Users\user\AppData\Roaming\npm\node_modules\truffle\build\webpack:\webpack\bootstrap:83:1

at Object.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:89:10)

at Module._compile (internal/modules/cjs/loader.js:971:30)

at Object.Module._extensions..js (internal/modules/cjs/loader.js:1011:10)

at Module.load (internal/modules/cjs/loader.js:822:32)

at Function.Module._load (internal/modules/cjs/loader.js:730:14)

at Function.Module.runMain (internal/modules/cjs/loader.js:1051:12)

at internal/main/run_main_module.js:16:11

Truffle v5.1.46 (core: 5.1.46)

Node v13.0.1


texts: How to remove contracts and tokens from wallet.ethereum.org

texts: After adding several contracts from the Ropsten testnet to WATCH CONTRACT and tokens to WATCH TOKEN, I'd like to remove the contracts from displaying on wallet.ethereum.org.  Is there a way?


texts:
When I run "truffle migrate" I wait for few seconds than the geth node fall down and I got this truffle error : "Error encountered, bailing. Network state unknown. Review successful transactions manually."

geth console show something like this:

   goroutine 38 [select, 3 minutes]:
    github.com/ethereum/go-ethereum/vendor/github.com/syndtr/goleveldb/leveldb.(*DB).tCompaction(0xc420030b60)

+0x144
created by github.com/ethereum/
        /build/ethereum-cdyJWd/
+0x430

rax    0x0
rbx    0x7f74a38c7700
rcx    0x7f74a3537428
rdx    0x6
rdi    0x76a
rsi    0x76b
rbp    0x1121082
rsp    0x7f74a3500928
r8     0x7f74a38c8770
r9     0x7f74a3501700
r10    0x8
r11    0x206
r12    0x7f748c0008c0
r13    0xf1
r14    0x11
r15    0x0
rip    0x7f74a3537428
rflags 0x206
cs     0x33
fs     0x0
gs     0x0

EDIT: geth v1.8, sol 0.4.23.

I run geth with this command :

geth --datadir node1/ --syncmode 'full' --port 30304 --rpc --rpcaddr 'localhost' --rpcport 8504 --rpcapi 'personal,db,eth,net,web3,txpool,miner' --bootnodes 'enode://be6dfb42d374e9262cbb557314eeb60b2531396ed04b10512d03f6108fd99f13585d5efffb5cbc8582dbdfb07af3bf8daabd89d9ec322c6cb86b10fcccfd7468@10.2.1.158:30310' --networkid 1515 -unlock '0x6747efc15a7209763e840c8bbf381b721aeababd' --password node1/password.txt --mine


texts:
I am able to add liquidity and remove liquidity on uniswap, but I am having trouble calculating the min values for the token pairs.
For removing liquidity I am trying to get the amount of each token by doing the following:
const pathA = [liquidityToken.address, tokenA.address];
  const amountsA = await uniswap.getAmountsOut(liquidityAmount, pathA);
  const desiredAmtA = amountsA[1];

  const pathB = [liquidityToken.address, tokenB.address];
  const amountsB = await uniswap.getAmountsOut(liquidityAmount, pathA);
  const desiredAmtB = amountsB[1];

This is throwing an error, but I'm not sure how to get the amount of tokena/b that my liquidity token represents. And consequently, I"m trying to calculate the min from it like this. I don't understand how these slippage tolerances get calculated.
const minAmtA = desiredAmtA.mul(BigNumber.from(9)).div(BigNumber.from(10));
const minAmtB = desiredAmtB.mul(BigNumber.from(9)).div(BigNumber.from(10));

It works when I put 0, but obviously I don't want 100% slippage
    tokenA.address,
    tokenB.address,
    liquidityAmount,
    BigNumber.from(0), // don't know how to calculate this
    BigNumber.from(0), // don't know how to calculate this
    wallet.address,
    deadline,
    {
      gasLimit: process.env.GAS_LIMIT,
      gasPrice: 20e9,
    }
  );


texts:
I've got some questions regarding coonecting 2 ethereum nodes (geth) between two different networks: e.g. company A and company B.

First, I've already connected two different nodes within the same network (via enode info, adding the enode info to a static nodes json file together with each IP address, etc...).

Is there any guideline for the steps neccessary to connect two nodes which are in different networks?

Can anybody tell me in detail what steps are neccessary to go through when thinking about networking these different nodes?

Are there any aspects which are crucial for a secure private network?

Further questions:

What happens when a node has a dynamic IP?

Do I have to define bootstrap nodes within this company network?

What about firewall settings?

Are there any other interesting aspects I missed out so far?

Maybe someone already went through all these steps and could help me out here. Would be awesome to find some people to work through all these problems!

Thanks


texts: Can the total supply of a token be increased after deployment?

texts:
Non-developer here. I have just read Pundi X's blog post about their proposed forthcoming token split and I am curious about how they could implement this:

https://medium.com/pundix/rc-request-for-comment-pxs-token-split-f43c77b77a0b

They plan to give token holders an additional 999 PXS for every 1 PXS they already hold. However the current total supply of 36,104,947.59 PXS would not be nearly enough to cover the number of additional tokens required:

https://etherscan.io/token/0x358d12436080a01a16f711014610f8a4c2c2d233

I can't imagine that it would be possible for them to retroactively increase the total supply of an ERC20 token. Is this possible or would they have to create a second token with 1000x supply and airdrop this on a 1000:1 ratio to current token holders instead?

Many thanks


texts: Wallets that sign transactions using true random numbers

texts:
From https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm:

  Another way ECDSA signature may leak private keys is when 'k' is
  generated by a faulty random number generator.

It would be nice if a wallet instead of forcing you to blindly trust a specific PRNG would let you increase the randomness of 'k', for instance by moving your mouse around (as in https://www.bitaddress.org) each time you're about to make a transaction.

Is there any Ethereum or Bitcoin wallet that allows for such a thing? If not, is there a technical reason behind it?


texts: Why would Oraclize fail when a normal post doesn't?

texts:
I'm using the Oraclize test query to confirm my oraclize response is empty. Here's a link to the exact test query, which contains the following:

URL  ["json(https://mainnet.infura.io/).result","{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}"]
_

When this same endpoint is queried with the same POST params from Postman like here I get a correct response.

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x421283"
}

Why does Oraclize return an empty response instead?


texts: How can I pack and access multiple uint8 values into one bigger uint?

texts:
I currently have a situation where I have variables like this:

uint8 _variable1 = 4;
uint8 _variable2 = 2;
uint8 _variable3 = 99;
uint8 _variable4 = 1;
uint8 _variable5 = 0;
uint8 _variable6 = 2;
uint8 _variable7 = 1;
uint8 _variable8 = 34;

When I have to pass or return these values (since Solidity doesn't report Structs as parameters or return values) I keep running into this issue:

CompilerError: Stack too deep, try removing local variables.

The usage of the function to retrieve these values looks like this:

uint8 _variable1;
uint8 _variable2;
uint8 _variable3;
uint8 _variable4;
uint8 _variable5;
uint8 _variable6;
uint8 _variable7;
uint8 _variable8;

(_variable1, _variable2, _variable3, _variable4, _variable5, _variable6) = dataContract.getData(_id);

What I would like to do instead is store a single variable such as uint64 data = 0402990100020134

How would I correctly define that in solidity?

If I wanted to get the value of variable 6, how would I do that?


texts: keccak256 output is different on ruby vs javascript...?


texts:
I am trying to figure out the best ways of benchmarking Solidity contracts. As with normal benchmarking, I presume one would basically want to measure computational effort and storage overhead:

gas cost can be used as an easy indicator of computational complexity. Mist & Mix both estimate this before sending a transaction, though this usually differs slightly to the real cost when run (correct?). So you would want to measure both- estimation presumably can be done by importing one of the core platform libraries; real can be tracked via the contract globals.
storage overhead would depend on a few things: the compiled bytecode size and size of the contract's storage memory space. The former is again estimated by the tools, the latter I am not so sure how to quantify without reading through the details on how the EVM allocates memory and writing some low-level tool to parse the AST or source and compute the details.

Look forward to seeing if anyone has any pointers on this (:


texts: Parity: with 'warp' sync enabled by default, is there still any advantage in using fast pruning?

texts:
From Parity Ethereum Documentation:

  Warp Sync is an extension to the Ethereum Wire protocol, which involves sending snapshots over the network to get the full state at a given block extremely quickly, and then filling in the blocks between the genesis and the snapshot in the background.

When I run parity --help for Parity v1.11.4, the bullet about warp says:

--warp
    Does nothing; warp sync is enabled by default.

That said, is there any advantage left in setting pruning=fast or pruning=light?

To my understanding, their purpose is to allow for a fast (but incomplete) sync.

But then, as mentioned above, warp seems to do that already.

So when exactly should I be using pruning to anything other than archive?

Thank you!


texts:
I have this code :

function finish(address _teamFund, address _ecosystemFund, address _bountyFund) public onlyOwner {

      require(!isFinalized);
      uint256 alreadyMinted = token.totalSupply();
      require(alreadyMinted < maxTokens);

      uint256 unsoldTokens = totalTokensForSale - alreadyMinted;
      if (unsoldTokens > 0) {
        tokensForEcosystem = tokensForEcosystem + unsoldTokens;
      }

      token.mint(_teamFund,tokensForTeam);
      token.mint(_ecosystemFund,tokensForEcosystem);
      token.mint(_bountyFund,tokensForBounty);
      finalize();
  }

Remix giving warning

: Could potentially lead to re-entrancy vulnerability.
Note: Modifiers are currently not considered by this static analysis.

for these 3 lines :

uint256 unsoldTokens = totalTokensForSale - alreadyMinted;
          if (unsoldTokens > 0) {
            tokensForEcosystem = tokensForEcosystem + unsoldTokens;
          }

I tried with safemath also , but didn't get any success.

uint256 unsoldTokens = totalTokensForSale.sub(alreadyMinted);
    if (unsoldTokens > 0) {
      tokensForEcosystem = tokensForEcosystem.add(unsoldTokens);
    }


texts: Difference between the assembly code generated for uint and uint32?

texts:
I wrote a simple contract with a single state variable with type uint and the generated assembly code is quite straight forward. But when I changed the type to uint32 the generated assembly becomes different altogether. Also for uint32 if I check the 'Enable Optimizer' option the generated assembly code gets changed.

Questions:

In case of uint32 why the generated assembly is getting changed? Also if you can please explain the generated assembly itself.
The assembly codes for uint32 with optimizer on and off are different. Why is it so? I understand that the optimizer is optimizing the performance that is why the assembly instructions are getting smaller but my question is how?

For your reference I am providing the contract along with the generated assembly code segment.

Contract

pragma solidity ^0.4.0;

contract Test
{
   uint32 value = 10;
}

Generated assembly with optimizer off

PUSH1 0x60
PUSH1 0x40
MSTORE
PUSH1 0xA
PUSH1 0x0
PUSH1 0x0
PUSH2 0x100
EXP
DUP2
SLOAD
DUP2
PUSH4 0xFFFFFFFF
MUL
NOT
AND
SWAP1
DUP4
PUSH4 0xFFFFFFFF
AND
MUL
OR
SWAP1
SSTORE
POP
CALLVALUE
PUSH1 0x0
JUMPI

Generated assembly with optimizer on

PUSH1 0x60
PUSH1 0x40
MSTORE
PUSH1 0x0
DUP1
SLOAD
PUSH4 0xFFFFFFFF
NOT
AND
PUSH1 0xA
OR
SWAP1
SSTORE
CALLVALUE
PUSH1 0x0
JUMPI

Thanks,
Shamik.


texts:
There has been something bothering me about LP tokens and I can’t seem to find the answer.
Say I make my own token and raise $1000 in ETH in presales (less gas fees). Then say I want to add my remaining tokens + the ETH I raised to an LP on uniswap. In so doing I get LP tokens, so far so good.
Now however say I want to
1-effectively disown my ability to ever retrieve my addition of liquidity and
2-remove the LP tokens from collecting a portion of the .3% fees.
That is, I want to be as if the tokens never existed.
I see a lot of coins that claim they simply “burned” their LP tokens, but does that just mean they sent it to a dead wallet? Wouldn’t those tokens still be collecting .3% fees, thus incurring deflation?
Please advise!


texts: How to delete contract records in mist wallet

texts: I deploy too many contracts, so how to delete all contract records in mist wallet using one operation?


texts: Does an ethereum address exist on all networks when created?

texts:
When you create a wallet file,  can you use the same address on both  main net and test net? I understand the same address will have different funds on each network, but does the address exist on both?

Ive been looking into web3j, and Im not sure how the create wallet functionality works without a web3j parameter to connect to the network


texts: Does price of smart contract execution raise with price of ethereum

texts:
I can't determine properly whether higher price of ETH means smart contracts will also cost higher(in fiat not eth) and is it reciprocal, like if we have a SC deployed and eth price raises 10x, will execution of this SC also be 10x higher?

I know about opcodes and that each has some price in gas, I am not sure I understand is there some mechanics between that will mitigate this (maybe I dont understand clearly eth/gas relationship) or is it just 1:1?


texts:
This is a question regarding to computer networks and high availability with remote nodes but it relates directly to Proof-of-stake so I think this would be the place to ask instead of superuser, serverfault or stackoverflow.

My question relates to setting up an Ethereum staking node in the future. As we know staking nodes must be connected to the Ethereum network at all times and guarantee (ideally) an uptime of 100%.

Many issues were raised on this Reddit thread the main one being:

  If the computer you use for staking goes down or offline, you will be penalized by losing some of your stake. You only should go into this if you are serious about it and can afford super reliable equipment.

My solution to this issue was using redundant computers located in different places. So I would like to server A be the main one connected to Ethereum's network and connect server B to the Ethereum network (and possibly server C in case B is not online) as a replacement in case A goes offline for unforeseen circumstances.

Since Ethereum PoS software is not yet available I've been experimenting with Nxt and getting ready. But I still haven't found a reliable way to use server B in case server A is down. I am looking for a more generic unix way to use server B as a replacement.

What is a good way to achieve this?


texts:
Most programming languages have tools to format source code according to convention: for example, Python has autopep8 and yapf, and Go has gofmt.

Does a similar tool exist for Solidity source code, ideally according to the Solidity Style Guide?


texts: How can I view with web3.js all the ETH transfers to an ethereum address?

texts:
How could I list with Web3.js all the ETH transactions to an address?
Thank you


texts:
How can a smart contract receive data (strings or int) from an html page?
I would like to receive some information that a user con insert in a web page, in order to save them in the blockchain (for example the height and length of an object, together with the timestamp of that action).

Is there any function or something that allows to import those informations?

Thank you.


texts: how do we have random nonces in a deterministic system

texts:
From consensus/ethash/ethash.go

// Mining related fields
rand     *rand.Rand    // Properly seeded random source for nonces
threads  int           // Number of threads to mine on if mining
update   chan struct{} // Notification channel to update mining parameters
hashrate metrics.Meter // Meter tracking the average hashrate

How can we have this random function in a deterministic system?

Is it that this comes from the miner's machine and that's what create entropy in the system, why the block generation process is stochastic?


texts:
When trying to test a smart contract that uses

 sha256(abi.encodePacked(_myargument))

I don't get the same hash on truffle !
I tried both

web3.utils.keccak256('_myargument')
web3.utils.sha3('_myargument')

but both gave a hash different from what I get within the smart contract function.

So I thought it was because of abi.encodePacked, thus I tried

web3.utils.sha3(web3.eth.abi.encodeParameter('string', _myargument))

but the hash is still not the one expected.

Do you know why and how to get the same hash ? I don't understand why in general people use abi.encodePacked before hashing the argument with sha256(). If abi.encodePacked is involved, is it really necessary to keep it or can I safely remove it to just use  sha256(_myargument) instead of  sha256(abi.encodePacked(_myargument))  inside the smart contract ?

Best regards


texts: How to check if the newly mined block contains a contract deployment using infura sdk?

texts:
I am trying to implement following scenario.

Get a notification every time a new block is mined.
Loop through/filter all the transactions in the newly created block.
Check if the any transaction contains a newly deployed erc20 or
erc721 token.

I am using infura`s websocket, but I am not sure how to identify if the transaction was new contract deployment.


texts: Save array to text file from geth command line

texts:
I have an array myArray on the geth command line of 1000 elements. When I type myArray on the geth console, it prints to screen. I'd like to pipe this to a text file. My development setup uses testrpc and go-ethereum with analysis of post-scripts in Python.

At the moment I'm cutting and pasting from geth. I sense there may be a much better way of doing it, but can't seem to find an example on searching.

Is there a simple way to save an array to file from the go-ethereum javascript command line?


texts: Two different internet queries in a contract with Oraclize creates problems

texts:
I notice that oraclize prints this when querying the internet

  [2017-12-11T02:43:40.019Z] INFO new HTTP query created, id:
  dd4c63869cbd9581ec7f3528e9a6056ebee0994c506e8b9c22d14122304e85f1
  [2017-12-11T02:43:40.020Z] INFO checking HTTP query
  dd4c63869cbd9581ec7f3528e9a6056ebee0994c506e8b9c22d14122304e85f1
  status in 0 seconds [2017-12-11T02:43:40.021Z] INFO checking HTTP
  query dd4c63869cbd9581ec7f3528e9a6056ebee0994c506e8b9c22d14122304e85f1
  status every 5 seconds...

Wonder what this means?

I am trying to call the internet twice with different queries based on a condition. I have two services, test1 and test2. I wish to get the value from test1 and then call test2.

pragma solidity ^0.4.0;
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
import "github.com/Arachnid/solidity-stringutils/strings.sol";

contract TwoQueries is usingOraclize {
  using strings for *;
  /* variable for saving */
  uint public myresult;
  string public sentresult;
  string fileaddress;
  string hexdigest;
  string filename;
  string client;
  string password;
  string public query;
  string public query2;
  string ipfsloc;
  string hashval;
  bool public initial;

  event newOraclizeQuery(string description);
  event queryValue(string queryDescripion);

  function TwoQueries() public {
    client = "client";
    password = "password";
    filename = "QmYrg4Fjsav174qqAMqgfAZr4nhDqkcPE24cyUW1DJHNxi";
    hexdigest = "45022f343cf02c957c304c1038b87a8e690a758f8fbe9f16d2beab2e093cb073";
    initial = true;
    query = "http://<ipconfig>:9000/test1?ipfs=".toSlice().concat(filename.toSlice()).toSlice().concat("&digest=".toSlice()).toSlice().concat(hexdigest.toSlice()).toSlice().concat("&key=".toSlice()).toSlice().concat(password.toSlice());
    query2 = "http://<ipconfig>:9001/test2?client=".toSlice().concat(client.toSlice()).toSlice().concat("&password=".toSlice()).toSlice().concat(password.toSlice()).toSlice().concat("&addfile=".toSlice()).toSlice().concat("/home/test/blockchain/analysis/file.txt".toSlice());
    update();
  }

  function __callback(bytes32 myid, string result) {
    if (msg.sender != oraclize_cbAddress()) throw;
    if (initial == true) {
      initial = false;
      myresult = parseInt(result, 4); // 4 digits
      query = query2;
      update();
    }
  }

  function update() payable {
    newOraclizeQuery("Oraclize query was sent, standing by for the answer..");
    queryValue(query);
    oraclize_query("URL", query);
  }
}

Any suggestions on how to handle this? It should update the myresult variable only once. If I remove the update() in the callback, it works fine.


texts: Get value by calling a function from External Smart contract

texts:
There are 2 smart contract

contract A {
function abc(string _a) public returns (address) {
    return new B(_a);
 }
}
contract B {
  function xyz(string _a) {
  A a = A(contact address); // interface
  a.abc(_a);
  }
}

How can i get the value of function abc() when i am making a call from function xyz() of contract B which DOES NOT have a return.
Especially in Remix and also through web3.js
please guide.


texts: When I recreate an Account using a Mnemonic, will it also bring back its private key?

texts:
I guess my Question is straight-forward, I would like to know if using a Mnemonic to recreate or import an Ethereum (external) Account will actually make or "bring back" the whole KeyPair (public and private keys)?

Or, just the public Key (address)?

Regards,

-Jose


texts: Can you store and query time series data on ethereum network?

texts:
I am interested in facilitated decentralised ownership of smart meter data by putting it on a blockchain of some description. Would it be possible to do this through the ETH network? Obviously it would not be viable to be putting millions of data points per second on the current proof of work network but when it switches to proof of stake this might be feasible? I saw this question about storing GPS data where the answer said it would cost 2 cents per datapoint. It would need to be ~10k times cheaper than this to make smart meter data storage viable.

That then brings up the next question: how would you query time series data? Let's say I want to get access to my consumption data between July 2017 and August 2017. Is there an efficient way to perform this query (via indexing) or would I literally have to step through the entire transaction tree?


texts: How to prevent a token from being exchanged freely

texts:
Let's say that I have created a token and this is distributed through a smart contract. Let's assume that this token is not on any exchange and whenever a transaction is executed using this token a specific algorithm in the smart contract is executed as well. I think this algorithm can be specified inside the transfer function in the ERC-20 smart contract.

Now, someone could try to put the token on an exchange anyways and start trading it. Could that prevent the algorithm in the smart contract to be executed? If so, is there  a way to avoid this situation? That is, can you force the token to run that algorithm specified in the transfer function even when it is traded on an exchange?

Alternatively, can you prevent a token from being traded on any exchanges?


texts: Automatically tax transaction and distribute to all holder (Metamask, TrustWallet)

texts:
I was wondering if I e.g. use balanceOf(account[1]) += tax if the amount will also updated on Metamask and TrustWallet?
Here is an example code which I found where the addresses will be in mapping and the dividends will be incremented. But not sure if I need to do something else to update the values at Metamask and other Wallets?
pragma solidity 0.8.2;

contract TaxedToken {

    mapping(address => uint) internal balances;
    mapping(address => bool) internal isTokenHolder;
    uint totalTaxedAmount = 0;
    uint totalUniqueUsers = 0;
    uint tax = 10;
    address public owner;

    constructor() {
        owner = msg.sender;
        balances[owner] = 100;
        totalUniqueUsers = 1;
    }

    function balanceOf(address account) public view returns (uint) {
        return balances[account] + (totalTaxedAmount / totalUniqueUsers);
    }

    function transfer(address _to, uint _value) public {
        require(balanceOf(msg.sender) >= _value, "Insuficient funds");
        balances[msg.sender] =  balances[msg.sender] - _value;
        balances[_to] = balances[_to]  + _value - tax;
        if(!isTokenHolder[_to]) {
            isTokenHolder[_to] =  true;
            totalUniqueUsers++;
        }
        totalTaxedAmount += tax;
    }
}


texts: How to communicate with the JSON RPC server programmatically using Go?

texts:
Is there a way to interact with the JSON RPC server directly in Go?

I tried the following:

Starting the RPC Server with "geth --rpc"
Running the following code:

package main

import (
    "fmt"

    "github.com/ethereum/go-ethereum/rpc"
    "github.com/ethereum/go-ethereum/rpc/comms"
)

func main() {

    client, err := comms.ClientFromEndpoint("rpc:127.0.0.1", 0)
    if err != nil {
        panic(err)
    }

    xeth := rpc.NewXeth(client)

    type p interface {
    }

    response := make(map[string]interface{}, 0)
    var params []interface{}
    response, err = xeth.Call("eth_gasPrice", params)

    if err != nil {
        panic(err)
    }

    fmt.Println(response)
}

The connection seems to work, but I get the following error:

panic: interface conversion: interface {} is string, not map[string]interface {}

goroutine 1 [running]:
panic(0x48c3d00, 0xc820098380)
    /usr/local/go/src/runtime/panic.go:481 +0x3e6
github.com/ethereum/go-ethereum/rpc.(*Xeth).Call(0xc8201bdc80, 0x49ee5f0, 0xc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    /Users/tim/Documents/go_workspace/src/github.com/ethereum/go-ethereum/rpc/xeth.go:72 +0x4dc
main.main()
    /Users/tim/Documents/go_workspace/src/eth_test/main.go:23 +0x12e
exit status 2

If I change the "Call" method here: https://github.com/ethereum/go-ethereum/blob/master/rpc/xeth.go, I can change the type assertion to the right type and I get the correct result back.

Apart from that, the comments in the linked file (xeth.go) tell that it is an interface to a remote node, I however want an interface to a local node.

I figured that it must be possible to first start the RPC server (that is otherwise started with "geth --rpc" on the console) purely programmatically since the console command will call Go methods after all and second it should be possible to send RPC requests using GO.

What am I doing wrong here?


texts:
As far as I know, there are roughly two kinds of contract calls on Ethereum. One kind is intended to change the global state of blockchain (i.e. change some storage values or transfer money). The other one is just to get data from blockchain without any modification.

The transaction of the first kind will be broadcast on the Ethereum network, but the second one only goes to the node that you have RPC connection with.

My question is: although the first kind of contract call can be secured thanks to blockchain consensus algorithm, how about the second kind? What if the node you are connected is cheating and gives dApps wrong data?
Is there any ways to prevent such cases of cheating nodes from happening?


texts: C++ library for Ethereum client documentation

texts: I am looking for documentation for C++ Eth client. So it will be really helpful if you could share few useful links to understand how Eth client command works.


texts: How are rewards commonly distributed to token holders without requiring too much gas?

texts: There are various platforms and tokens which distributes some sort of reward either via staking or interest to token holders proportionally to their token holdings on a regular basis, what are general approaches for doing this without requiring a lot of gas? I assume that protocols don't simply iterate through all the token holders calculating their fair share since that would cost a lot of gas.


texts: Are there any virtual IoT simulators that facilitate the connection with Ethereum Blockchain?

texts:
I already built a smart contract for Ethereum Blockchain by using truffle; Now, I'm looking to connect my smart contract with the IoT environment.

So are there any IoT simulators (platform, framework, etc.) that facilitate the connection with the Ethereum Blockchain without using physical material?


texts: getTransactionCount return different response

texts:
geth version 1.8.27

The pending nonce is 8 at first, then I send a transaction and use eth.getTransactionCount to get the next pending nonce.

> eth.getTransactionCount("0xdc34f16b577032c49dddf0b0c44455fc29dbcf3e","pending")
8
> eth.getTransactionCount("0xdc34f16b577032c49dddf0b0c44455fc29dbcf3e","pending")
8
> eth.getTransactionCount("0xdc34f16b577032c49dddf0b0c44455fc29dbcf3e","pending")
8
> eth.getTransactionCount("0xdc34f16b577032c49dddf0b0c44455fc29dbcf3e","pending")
9
> eth.getTransactionCount("0xdc34f16b577032c49dddf0b0c44455fc29dbcf3e","pending")
8
> eth.getTransactionCount("0xdc34f16b577032c49dddf0b0c44455fc29dbcf3e","pending")
9
> eth.getTransactionCount("0xdc34f16b577032c49dddf0b0c44455fc29dbcf3e","pending")
9
> eth.getTransactionCount("0xdc34f16b577032c49dddf0b0c44455fc29dbcf3e","pending")
9
> eth.getTransactionCount("0xdc34f16b577032c49dddf0b0c44455fc29dbcf3e","pending")
9

I have two questions:
1. I use txpool.content.pending and see there's a tx in the pending list(nonce=8). But eth.getTransactionCount still return 8 and after a while, it return 9.

Why eth.getTransactionCount still return a 8 when it returned 9 last time?
(shown in the log above)


texts: Who confirms Ropsten and Rinkeby transactions?

texts:
Basic or more like "fundamental" question I guess:

So if I got that right, each time someone runs Geth/Parity or other software they all become part of the EVM (ethereum virtual machine). However once you run this on port 8545 it's all mainnet...or maybe not?

Which still leads to my question: who confirms transactions on say Ropsten? Currrently I am sending many "succesfull" transaction to Ropsten contracts and I wait a few seconds for confirmation as if this is a real transfer occuring on the blockchain (mainnnet) but I am curious is this really done by miners using Geth or is it just fake time-waiting to appear as if someone really confirms those? Thanks!


texts:
I have installed solC module with command:

npm install solc

How can I use this module in Geth?

When I execute var solc = require("solc") in Geth's console, interpreter throws:

Error: Cannot find module 'solc'
at s (web3.js:1:160)
at s (web3.js:1:122)
at <anonymous>:1:12


texts: Storing a truffle contract interface in version control

texts:
What I'm doing

When I compile and deploy a contract using Truffle, I get a .json build artifact that contains information about where the contract is deployed on the network (its address).

So far I have just been checking this file into version control in order to distribute the interface to my contract, but this is less than ideal since the artifact file contains the compiled binary of the contract.

Why it's bad

Since git is not meant to handle binaries, changes to a binary make the repo unnecessarily large, and diffs become extremely noisy.

My question is this:

How can I distribute an interface to my deployed contract without checking a binary into version control?

"Solutions" I can think of

I am aware of git-annex and similar solutions, but they seem like overkill.
I've also thought about doing something like:
truffle networks > networks.txt
but this is hacky and requires consumers to create their own interface with the contract addresses I distribute.


texts:
From my understanding, one Ethereum node can have many accounts and only one of the account can perform mining in each node. So, my question will be what are the usage of other accounts in the node then? If an account deployed a contract, can other accounts call function of that contract even they are from the same node?

*Please correct me if my understanding are wrong. Thanks.


texts:
How can I create mineable cryptocurrency using ERC20 token? Do I need to code it using smart contact or need to do something else.

Also I want my personal node where will be running my Ethereum node for mining?


texts:
When we use built-in library in solidity smart contract, why we need to use @dev and @title annotation?

My code is like below:

/**

*@title SafeMath

*@dev Math operations with safety checks that throw on error

 */

library SafeMath {

  /**

  *@dev Multiplies two numbers, throws on overflow.

  */

  function mul(uint256 a, uint256 b) internal pure returns (uint256) {

        if (a == 0) {

            return 0;
        }


texts: Ethereum private chain with Puppeth - ChainId is '0' from web3 code

texts:
I am creating a private network with Ethereum following instructions from here . I managed to run the network but my problem is when try to deploy a contract following error comes:
{'code':-320000, 'message':'invalid sender'}
After research on forums, I understand this is an unauthroized key error or may be chainId is invalid. So I checked the .json file which was generated at the time of network creation and through which I initialised the network. In this file, the chainId is correct that is 58343 but when I try to print this chainId from web3 code , it is giving me  chainId 0 that is mainnet. I have also setted up chain from transaction and sending contract transactions like this:
contract_data = contract_.constructor().buildTransactions({ 'from: acct.address', 'gas':1732233', 'gasPrice': web3.toWei('21','gwei'), 'chainId':58343})
Note:
Above is the working code which I used to deploy several contracts on Ethereum Ropsten Testnet, for this project only added chainId after reading on forums.
Your help is much appreciated.


texts: How to generate ERC-20/xxx token addresses?

texts: How to generate ERC-20/xxx token addresses, from which I can receive/send corresponding tokens? How can I do this using web3j?


texts: If two keystore files have the same password, can it be figured out?

texts:
If two different keystore files have the same password, can it be figured out?

Suppose I publish to the internet two keystore files corresponding to two different addresses. The files have the same password. Given some amount of transactions on each one, can the password be uncovered?


texts: Ethereum crowdsale tutorial code doesn't work on remix

texts:
I took the crowdsale code from the tutorial, copied the whole contract code and pasted it to remix (with Rinkeby testnet), and I'm getting straight an error:

browser/contract.sol:52:25: ParserError: Expected token Semicolon got 'LParen'
       emit FundTransfer(msg.sender, amount, true);
                        ^

What am I doing wrong?


texts: Bittrex using smart contract address to get funds [ ERC-20] deposit

texts:
This question is not Just specific to bittrex, but i wanna know it in general that can any exchange ask its user to deposit tokens to a smart contract?
I have been using ETH since a long time, i have also happened to deposit Tokens to big exchanges but never got a address which is a contract address to get my funds deposit.

Is it possible?


texts:
My geth testnode somehow always killed itself after a while. What happened and how can I make it continue running?

Here are the screenshots

...skipped some in-between synchronization lines...

Here is the synchronisation status of my node, somehow my current block is always 659842 (it was last evening when it is killed and same this morning).

I run my geth in a docker container through a script, the script is as below

geth --testnet --datadir /root/.ethereum/ --rpc --rpcport "8545" --port "30303" --rpcaddr 0.0.0.0 --rpccorsdomain "*" --nat "any" --rpcapi eth,web3,personal,net --etherbase 0 --unlock "$(cat /root/.ethereum/geth/security/coinbase)" --password /root/.ethereum/geth/security/password.sec

As this is a dev / testr instance, I didn't secure any port. Is my instance "killed" by some external party? Is there some sort of housekeeping protocol imposed by ropsten on participating nodes?


texts: SyntaxError: await is only valid in async functions and async generators in web3js

texts:
Below is my code snippet. I wish to wait for the transaction hash value so that I can return my Javascript function with the hash value.

But I get the error "SyntaxError: await is only valid in async functions and async generators" in Firefox console. I'm using web3js 1.0 at https://cdn.jsdelivr.net/gh/ethereum/web3.js@1.0.0-beta.34/dist/web3.min.js'

web3.eth.accounts.signTransaction(tx, privateKey).then(signed => {
  const tran = await web3.eth
    .sendSignedTransaction(signed.rawTransaction)
    .on('confirmation', (confirmationNumber, receipt) => {
      console.log('=> confirmation: ' + confirmationNumber);
    })
    .on('transactionHash', hash => {
      console.log('=> hash');
      console.log(hash);
      //console.log("HASH: ", hash);
      transHash = hash;
    })
    .on('receipt', receipt => {
      console.log('=> reciept');
      console.log(receipt);
    })
    .on('error', console.error);
});


texts:
Consensus Logic with an example

  Person A generates a transaction to pass some ether to person B
  The transaction is submitted on the node
  Node then passes that unconfirmed transaction to the whole connected network
  The miners pickup the unconfirmed transaction
  They start trying to randomly generate the nonce to find the correct hash
  So one of the miners finds the correct nonce to generate the block
  Now this miner sends this block to peer who then further send to the next peers and gradually everyone receives the block
  Everyone verifies the work whether it is meeting the criteria
  Once satisfied they include that block in their ledger
  Miner gets rewarded
  B's balance gets updated
  Thus A's payment is now confirmed
  Just like A think multiple transactions of passing ether were invoked at the same time
  Lets say from C->D, E->F, G-H etc.

Questions:

In Ethereum how does a miner determine how many transactions to be
included in the block?
Is it based on total count of transactions or total price or total size?
Is there a concept of wait time also applied i.e. if there are less unconfirmed transactions the miners will wait for certain time and then group all the available transactions to generate a block?


texts:
From what I understand, the gas required for a ethereum contract is based on the computation it requires. So given two very similar transactions, the gas required should be very similar right?
However, I'm looking at two transactions. These two look pretty similar but have vastly different gas costs.
https://etherscan.io/tx/0xda234098b51fc78f670e111aff049289d2fecebda68ea26a359f65eac47c5eff
This one is 26k gas cost
https://etherscan.io/tx/0x598d73cbfa1a4d93595ed33a852f1536b225ef4476ca8aabe79959107b590e66
This one is 41k
https://etherscan.io/tx/0x9310e289b369e5a50752e7cbceee9e406235274ddb0f2c26e8c7ddc8f25d9bb1
This one is 56k
How are all of this calculated?
Here is a copy of the contract code https://gist.github.com/plutoegg/e852a3fc51efea550eadcb162080c7f6


texts: Python and Solidity keccak256 function gives different results

texts:
I am working on implementing a smart contract application in which, on and off chain calculations will exist. I will have to calculate the Hash Function of multiple integers with Python and Solidity. But Solidity and Python give different results respectively as shown bellow.

The Output for (a=1, b=2, c=3) is: 49776295142305522338649292811956300178326541500117443588869412604416814650524

The Output for (a=1, b=2, c=3) is: 45637690538541992090000098772847886457082422231295691457910964509567538102535

I need to understand how Solidity encodes the input integers and pass them to the hash function, How this could be done in Python?


texts: How does the BTC Relay validate Bitcoin blocks?

texts: How can the BTC Relay contract verify that relayers are providing valid blocks from the Bitcoin blockchain?


texts: Let's say we have a SmartContract that require a huge amount of iterations to reach a certain state, when something interesting happens. Creating a test for proving the contract behave correctly will require a lot of time and a lot of simulated addresses. So an idea could be having that threshold to a smaller value just in test environment: I think a function callable just in test to lower that threshold value, that cannot be called in production, because otherwise could be interpreted as a potential fraud  method. Is this possible? Any alternatives?


texts:
If I have one block from bitcoin blockchain. I can check that block is valid without having the previous blocks. (solo block verification)
Imagine I have one block from Ethereum blokchain. Can I check that block is valid without  having the previous block?


texts: How many transactions are submitted to transaction pool per second?

texts:
As the title, is there any statistics about how many transactions are submitted to the transaction pool per second?
Note that this is different from the number of transactions processed by Ethereum.


texts: How can I collect the tokens inside smart contract that people will send accidentally?

texts: I have an ERC20 token XYZ smart contract created. People will send certain amount of tokens back to the contract address to initiate certain functions. I just want to know that what will happen if someone send other tokens to my contract? May be token ABC, UUY, etc, like any token other than my own "XYZ" token. I want to grab those tokens in my other wallet and dont want to initiate any functions based on those. I think any functionality that can check address of the tokens sent can be beneficial, but I am open to suggestions.


texts: Ethereum with Nvidia Jetson TX1 - test graphics chip's mining capabilities

texts:
I want to just test if my Nvidia Jetson TX1 board can do ETH mining. I do not intent to use it for ETH mining, but still want to explore if it's possible or not.

Here are Nvidia Jetson TX1 hardware specs details:
http://www.nvidia.com/object/jetson-tx1-module.html

I was trying to setup development environment to compile geth and when I tried running ARM version of go library it was giving me error of no such executable binary found etc.

https://storage.googleapis.com/golang/go1.6.2.linux-armv6l.tar.gz

I just want to test if this boards's Graphics chip can do mining of any Crypto coin. So, I just picked ETH to give it a try with.

Thanks for help.


texts: Unable to deploy contract to rinkeby test network using truffle

texts:
These are the steps I took in order to deploy my contracts to rinkeby network:

Created a .rinkeby folder.
Downloaded genesis json for rinkeby from here
Ran this command :

geth --datadir=$HOME/.rinkeby --light init rinkeby.json
Ran this command :

geth --networkid=4 --datadir=$HOME/.rinkeby --syncmode=light --bootnodes=enode://a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf@52.169.42.101:30303?discport=30304 --rpc --rpcapi db,eth,net,web3,personal --rpcport 8545 --rpcaddr 127.0.0.1 --rpccorsdomain "*"
After I had geth connected to the network, I used truffle with the following code & command to deploy the contract:

Code:

module.exports = {
  networks: {
    rinkeby: {
      network_id: 4,
      host: '127.0.0.1',
      port: 8545,
      gas: 4000000
    },
  },
  rpc: {
    // Use the default host and port when not using rinkeby
    host: 'localhost',
    port: 8080,
  },
};

Command:

truffle compile; truffle migrate --network rinkeby

This is the error I am getting :

Using network 'rinkeby'.

/usr/lib/node_modules/truffle/build/cli.bundled.js:23538
        throw new Error("Expected parameter '" + key + "' not passed to function.");
        ^

Error: Expected parameter 'from' not passed to function.
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:23538:15
    at Array.forEach (native)
    at Object.options (/usr/lib/node_modules/truffle/build/cli.bundled.js:23536:19)
    at Object.run (/usr/lib/node_modules/truffle/build/cli.bundled.js:66868:12)
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:88946:23
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:67033:9
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:66861:7
    at done (/usr/lib/node_modules/truffle/build/cli.bundled.js:155469:5)
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:155526:11
    at FSReqWrap.oncomplete (fs.js:153:5)

What is incorrect in the process that I followed? I cant understand why this error is coming and how to remove it.


texts: Account/Contract address of people responsible for Ethereum Attacks?

texts:
I believe there has been a hard fork following the DAO attack; I guess it's not possible to get the contract/account address for the person responsible, unless I am wrong and there is a way, please let me know. However, I am also aware there that there was a DDOS attack in late 2016 and there were talks for another hard fork, I am not sure whether that has happened yet or not. I am running a Geth client with full node sync, and every time it excruciating slows down around 2,400,000 blocks, which tell me the hard fork hasn't happened. If possible can someone please tell me what contract and normal account address were used for the attack?

I am writing a transaction visualisation web app for Ethereum; it will be very useful to know who the perpetrators were so I could identify them in my visualisation. Or please tell me a way to find out the attackers' contract and account addresses.

If I don't know about any other attack, it will be much appreciated if I was informed.


texts: how to call one contract function into another contract

texts:
contract xyz {
    mapping(address => bool) Users;
    function add(address userAddress) {
            require(userAddress != 0x0 && !Users[userAddress]);
            Users[userAddress] = true;
    }
    function pass(address passAddress) returns (bool) {
        return Users[passAddress];
    }
}

contract SaveData {
    address[] addrs;
    string[] hashSet;
    xyz asd = xyz();
    function Save(address PubAddress) {
        require(asd.pass(PubAddress)==true);
        addrs.push(PubAddress);    //saving public addresses

    }
//function to save hash
    function saveHash(string hashStr) {
        hashSet.push(hashStr);
    }
}

I am new to solidity, i am creating a simple user reg and checking and saving it using another contract.
Contract xyz is working fine, but now i want to call it into SaveData Contract and check address using pass function that if address is whitelisted then only it will save the address.

thanks in advance


texts: Web3.js to decode encrypted data using my private key

texts:
It's very similar to this question: How to decrypt an encrypted message using metamask? who was put one year ago.

As user, I would like to store data safely on the blockchain, data that I want to retrieve easily and decode locally. It seems that such feature was planned on web3.js 1.0 but I did not see anything on it.....


texts: My smart smart contract won't send to multiple addresses

texts:
I have experienced some difficulties in getting deployed multisend/airdrop smart contract to distribute tokens to multiple addresses by interacting with the main contract. Each time it failed.

Kindly Note:
The smart contract which initially owns the tokens does not have the multisend function. Please find the code it here. (https://ropsten.etherscan.io/address/0x259059f137cb9b8f60ae27bd199d97abb69e539b)

I deployed a multisend ownable contract from the same owner who deployed the one above here (https://ropsten.etherscan.io/address/0xb608a6c42afe7d9f5bcdda2276e351ec65dfa93f). Normally this new contract should seamlessly interact with the former to send out tokens, but each time I did, the transaction failed with an error (https://ropsten.etherscan.io/tx/0xf959ddc55c2e551b82a8448ad267601dfddc4785e1236bbc52f46b2389b500f1) (please find attached pic).

Before attempting to send tokens with multisend contract, I sent the required tokens from the parent smart contract to the multisend contract.

Kindly I have to seek for advice from experts here.
Help review my code and correct me where necessary. I would be super grateful. Thank you.


texts: On which node smart contract get executed

texts:
I have a general question in my mind please do correct me if i am thinking wrong .

Suppose if i deploy the smart contract on the ethereum blockchain having a functionality to pay some tokens at particular timestamp. Then on which node's evm that smart contract get executed how it get decided ? and my node is not any more connected to the network at the same time . Is this node selected by network randomly or their is any other algorithm or paradigm exists for this process.

Thanks


texts: All signed txs get reverted when interacting with testnet

texts:
I'm trying to call a contract deployed on Rinkeby. When I'm deploying it with truffle and interacting with any function it works, but with web3 I always get a revert. I use the following code:

var web3 = await getWeb3(network, "http");

var nonce = await web3.eth.getTransactionCount(pubKey);

const txParams = {
  "from": pubKey,
  "to": instance.address,
  "data": instance.methods
          .swapEtherToToken(token, amount, customer)
          .encodeABI(),
  "value": "0x0",
  "gas": DEFAULT_GAS_LIMIT,
  "nonce": nonce,
  "chainId": 4,
  "gasPrice": DEFAULT_GAS_PRICE
};

  var transaction = new EthereumTx(txParams);

  const privateKeyBuffer = Buffer.from(privateKey, 'hex');

  //signing transaction with private key
  await transaction.sign(privateKeyBuffer);

  //sending transaction via web3js
  web3.eth
  .sendSignedTransaction('0x' + signedTx.serialize().toString('hex'))
  .on('receipt', (receipt) => {

    console.log("Swapped ether to " + token + " for " + customer);

  })
  .on('error', (error) => {console.log(error)})

I followed multiple articles but all of them used approximately the same technique.

What do I do wrong?


texts:
Let's say I have a private network with a few nodes, then all of them stop mining for a day. What happens during that day? What happens the day after when they start mining again?

Will the blockchain continue from yesterday's last mined block, will there be problems due to big difference in adjacent blocks' timestamps?


texts: What exactly is included in the bloom filters?

texts:
Exactly which addresses are included in the transaction receipts bloom filters? I know that each 'address' in the logs of the receipt are include (as are the event signature and the indexed event parameters).

I'm confident (but curious if I'm correct) that the to and from addresses from the transaction are not in the receipt's bloom filter.

I'm also confident (but again curious) that any address into which the transaction may have 'called' are included in the bloom filter (on Parity--not sure about geth).

I don't know either way if the 'contractAddress' field is include on contract creation, nor if the winning miner's address is included.

Is there definitive documentation somewhere (other than the brutally difficult one paragraph yellow paper description of the bloom filters) that explains exactly which addresses are and are not in the bloom?


texts: I've been mining eth for a little while now and I've got .4 eth in my address. I want to be sure that I remember my password and validate that the eth is in my wallet on my computer. The thing is I don't know where or how to validate my password using geth or how to see how much if any eth is actually stored in my wallet on my computer. Any ideas? Thanks.


texts: I read about Ethereum’s Layer 2 Scaling Solutions. Understood that layer 1 is the base consensus layer of ethereum protocol, changes typically require a hard fork. Is it true that layer 2 here refers to all smart contracts that deployed on the network. In that sense, to perform transaction on Raiden Network we are actually utilizing a smart contract deployed by the Raiden team?


texts: Should ethminer continue mining the same PoWhash even after a solution is found?

texts:
Is it normal for ethminer to find a solution to a problem, and even after submitting it upstream, it still continues to hash the same problem?

Here is an example:  (Genoil's ethminer in stratum mode)

  m  12:22:43|ethminer  Mining on PoWhash #c936d2df : 0.00MH/s [A37+0:R0+0:F0]
  ℹ  12:22:44|openclminer0  Solution found; Submitting to stratum-server ...
  ℹ  12:22:44|openclminer0    Nonce: 0x501061248666b5d5
  ℹ  12:22:44|stratum  B-) Submitted and accepted.
  m  12:22:44|ethminer  Mining on PoWhash #c936d2df : 29.36MH/s [A38+0:R0+0:F0]
  m  12:22:45|ethminer  Mining on PoWhash #c936d2df : 37.75MH/s [A38+0:R0+0:F0]
  m  12:22:46|ethminer  Mining on PoWhash #c936d2df : 37.75MH/s [A38+0:R0+0:F0]
  m  12:22:47|ethminer  Mining on PoWhash #c936d2df : 33.55MH/s [A38+0:R0+0:F0]
  m  12:22:48|ethminer  Mining on PoWhash #c936d2df : 41.94MH/s [A38+0:R0+0:F0]
  m  12:22:49|ethminer  Mining on PoWhash #c936d2df : 33.55MH/s [A38+0:R0+0:F0]
  m  12:22:50|ethminer  Mining on PoWhash #c936d2df : 41.94MH/s [A38+0:R0+0:F0]
  m  12:22:51|ethminer  Mining on PoWhash #c936d2df : 33.55MH/s [A38+0:R0+0:F0]
  m  12:22:52|ethminer  Mining on PoWhash #c936d2df : 41.94MH/s [A38+0:R0+0:F0]
  m  12:22:53|ethminer  Mining on PoWhash #c936d2df : 33.55MH/s [A38+0:R0+0:F0]

Notice that even after the solution is submitted and accepted upstream, the miner continues to mine the same PoWhash #c936d2df for which it found a solution.

I inspected the network traffic and found that the problem (if there is one) is the upstream stratum pool, which accepts the request and then takes a very long time to give me another job to work on.

So the question - is the mining pool bugged?  Shouldn't it be giving me new work immediately after I find a solution?

Or is it expected that there may be multiple solutions to the same problem, and it's OK for ethminer to keep crunching numbers after finding a solution?

EDIT: This has been observed while using multiple upstream stratum pools.


texts:
As per the title, I haven't found anywhere (neither in Truffle Docs nor googling) how to use solc with Truffle (I am on Ubuntu 16.04).

For example, let's say I wanna use new require and assert features of Solidity 0.4.10, how can I use those directives within Truffle? Is it even possible?

Thanks.


texts:
I just started playing with Ethereum mining on a Linux box. I lost a considerable amount of time installing Parity (https://www.parity.io/ethereum/) on the machine.
Then I created an account using W3, installed EthMiner, I connected to a pool (first one that I found in Google, which was cruxpool.com) then I started mining.
Do I need Parity at all? Why would anybody go to the trouble of installing Parity in the first place? Looks like you can mine quite fine without it. Someone can pls explain what is the added value with Parity?
Thank you


texts:
I deployed a sol file in the remix,where can i find the event？
please help me...
pragma solidity >=0.7.0 <0.8.0;
contract con1{
uint public x;
event e1 (uint);
function f()public{
    x=5;
    emit e1(x);
  }
}


texts:
Here is my basic understanding about how Ethereum stores transactions

A hash is generated for each transaction
Then pairs are selected and a hash is generated for each pair
This way the last remaining hash becomes the root
Block header contains three Merkle trees

To maintain the state
To maintain the transactions
To maintain the receipts

Each block refers to its previous block's hash
I am attaching the very common diagram showing this structure

Questions:
 1. The state root of Block 180994 is pointing to Block 180993's first left child
 of the state root. What does it mean and why is it needed?
 2. Lets take an example
 - First block 180993 is having a transaction where Account 98 is
   passing 30 ethers ether to Account 100
 - Second block 180994 is
   having a transaction where Account 99 is passing 20 ethers to Account
   100

How this will be reflected in the tree? Will there be similar kind of cross mapping of Merkle trees like shown in the diagram? Please explain

  Added more Detail


texts:
I'm using Blockcypher's API (https://dev.blockcypher.com/eth/#generate-address-endpoint )to generate Ethereum addresses. One such address that has been generated is :-

Public Address (bb46f25f6b5199dda7829aa09bd59a798f844a6)

However, when I try to use services like myetherswallet(https://www.myetherwallet.com/#send-transaction) to send funds to this address, it says address is invalid. Is my address correct?


texts:
I've implemented bitcoin accepting on my web service by generating many addresses on my local machine and uploading them to the database for associating with each new order. After that payment script just check the address balance every few minutes and delivers order if success.
Is there a similar way to accept ether payments? (without using external services) Can I pregenerate many pairs (private key / address) and check balances with blockchain explorer? What problems has this approach? Is it easy to sweep all these account's ether into one?
Thanks!


texts: Not able to export to csv all transfer events of a specific contract on Ethplorer.io

texts:
I'm able to use the Export to csv function, but it's only giving me the most recent 1000 events. Any suggestions on how to get ALL (2100+) of the events in a csv file?

https://ethplorer.io/address/0x2c2391f793f4f81475d87fffe366458ce5380a13#


texts:
Original post:

Sorry I just found out this way it actually works. But the problem is when I trying to look up address manually, not by msg.sender.

Code:

mapping (address => uint) count;

function set() public{
    count[address(0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe)] = 3;
}

function get(address _address) public view returns(uint){
    return count[_address];
}

I called set function and when I pasted the same address into get function the result was 0.

Debug:


texts: Possible ERC-20 improvement: Token-specific ENS equivalent

texts:
With ENS still providing quite a difficult user experience for the average user, I'm wondering why standards like ERC-20 don't implement a simple mapping allowing people to set names equivalent to their addresses for that specific token contract.

I have a couple of ENS addresses, and barely ever use them, partly because even those who know a lot about Ethereum might not know about ENS properly. So then I thought, why have I not seen tokens (they might exist, I just haven't seen them), implemented this functionality to provide a better user experience? In talking about this, the arguments came up that "wallets would have to adapt for this" and "it is very limited since it is token-specific", which are very valid points indeed. However, I wonder if it is not worth considering this approach while ENS is still not widely-adopted?

See below for a simple implementation of this on an ERC-20 token contract, as an example, but without much thought having been given to the functionalities:

pragma solidity^0.4.25;

contract TestToken {

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

mapping (address => uint256) public balanceOf;
mapping (string => address) names;
mapping (string => uint) nameValue;

string public name = "Test Token";
string public symbol = "TTT";
uint8 public decimals = 18;
uint price;

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

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

address owner;

constructor() public {
    owner = msg.sender;
    balanceOf[owner] = totalSupply;
    emit Transfer(address(0), msg.sender, totalSupply);
    price = 1 ether;
}

function setName(string _name) public payable {
    require (msg.value >= price);
    require (names[_name] == address(0));
    names[_name] = msg.sender;
    nameValue[_name] = msg.value;
}

function sellName(string _name) public {
    require (names[_name] == msg.sender);
    names[_name] = address(0);
    uint value = nameValue[_name];
    nameValue[_name] = 0;
    msg.sender.transfer(value);
}

function getAddress(string _name) public view returns (address) {
    return names[_name];
}

function transfer(address _to, string _name, uint256 value) public returns (bool success) {
    require(balanceOf[msg.sender] >= value);
    address to;
    if (bytes(_name).length > 0) {
        to = names[_name];
    }
    else {
        to = _to;
    }
    balanceOf[msg.sender] -= value;
    balanceOf[to] += value;
    emit Transfer(msg.sender, to, value);
    return true;
}

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

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

function approve(address _spender, string _name, uint256 value)
    public
    returns (bool success)
{
    address spender;
    if (bytes(_name).length > 0) {
        spender = names[_name];
    }
    else {
        spender = _spender;
    }
    allowance[msg.sender][spender] = value;
    emit Approval(msg.sender, spender, value);
    return true;
}

function transferFrom(address from, address _to, string _name, uint256 value)
    public
    returns (bool success)
{
    require(value <= balanceOf[from]);
    require(value <= allowance[from][msg.sender]);
    address to;
    if (bytes(_name).length > 0) {
        to = names[_name];
    }
    else {
        to = _to;
    }
    balanceOf[from] -= value;
    balanceOf[to] += value;
    allowance[from][msg.sender] -= value;
    emit Transfer(from, to, value);
    return true;
}

function burnFrom(address _burned, string _name, uint _tokens) public onlyOwner {
    address burned;
    if (bytes(_name).length > 0) {
        burned = names[_name];
    }
    else {
        burned = _burned;
    }
    balanceOf[burned] -= _tokens;
}

function nameBalance(string _name) public view returns(uint) {
    return balanceOf[names[_name]];
}
}

Let me know what you think, I'm interested in a discussion about the pros and cons of this.


texts: Why Ropsten Testnet has Total Ether Supply < the biggest ether holder balance?

texts:
Let's see two below image that I cropped them from ropsten.etherscan.io.
Can someone tell me why Total Ether Supply < the first address balance?


texts: PoA private net keeps mining blocks at high rate with no transactions

texts:
I am creating a private network based on Clique (PoA) and I have a certain problem with the amount of blocks mined by my two nodes.
The number of blocks is very high I quickly reached hundreds of blocks even if there is no transactions being sent throughout the network.

I know this is probably due to specifying BlockTime to 1 in the genesis file, but can't we stop the mining if no transactions are present ?

having a million empty block is not appropriate.


texts: Is it possible to pass struct as a parameter of function in Solidity without using Libraries?

texts:
Isnt it possible to do something like following in Solidity?
ps: i am taking example of "C" thinking it is somewhat similar to solidity. Correct me if i am wrong

#include <stdio.h>
struct student
{
    char name[50];
    int roll;
};

void display(struct student stu);
// function prototype should be below to the structure declaration otherwise compiler shows error

int main()
{
    struct student stud;
    printf("Enter student's name: ");
    scanf("%s", &stud.name);
    printf("Enter roll number:");
    scanf("%d", &stud.roll);
    display(stud);   // passing structure variable stud as argument
    return 0;
}
void display(struct student stu){
  printf("Output\nName: %s",stu.name);
  printf("\nRoll: %d",stu.roll);
}


texts: How to transfer DAO from MyEtherWallet to Kraken? (DAOs transfer method)

texts:
Related:

Transfer DAO's from Myetherwallet to Kraken
How to withdraw Ether from The DAO?

MyEtherWallet screenshot:

The balance is low because all Ether was invested in DAO.

Here is the Kraken interface:

  use the DAOs transfer method (or transferWithoutReward) with your deposit address as destination to deposit tokens into your Kraken account

Is there a way to conduct DAOs transfer method directly from MyEtherWallet?

(I only hope that I didn't accidentally published my private key alongside with screenshots)


texts:
Awaiting the resolution of calls to a node works for me, like this example:

describe('some contract', async function () {

    ...

    it('data should be written correctly', async function () {
        let expectedResult = 1;
        let actualResult = await instance.getSomeData(param1);
        assert(actualResult == expectedResult);
    })

What gives me weird behaviour - a timeout to be specific, is when I try to assert inside the callback of a promise like this:

describe('some contract', async function () {

    ...

    it('data should be written correctly', async function () {
        let expectedResult = 1;
        instance.getSomeData(param1).then(result => {
            assert(result == expectedResult);
        })
    })

Is there any way to do this, or is the only way to await the result and then assert?


texts: How do you use geth console commands on an ubuntu server

texts: I followed these instructions to install a geth node on an ubuntu vps. If I try a command via ssh it says geth: command not found. Do I need to be in a specific folder to run the commands?


texts: Different block information for the same block number at different times

texts:
On web3.eth.subscribe('newBlockHeaders') I get notification and trying to get last block via saved block number earlier. It was happen with 9559839 block number on mainnet. First, I was get data with 197 transactions, a little bit later with 41 transactions (as it should be). And among these 41 transactions 33 was included in the block that I received earlier.

geth was launched on fast sync mode


texts: How to interact with a contract from Truffle console without compiling and deploying?

texts:
I am looking for a solution that does not require having the contract solidiity code compiled and deployed.
For example, if I want to send approve on WETH on live network from the console, without downloading the Solidity code, compiling it, and deploying it. Since the contract is already deployed, it would make sense to be able to interact with it directly.
The idea is that I can get either the abi code (using getCode(contract_address)), or the json (from etherscan API). And using the abi or json, and the contract_address, I assume I should be able to interact with the contract. But how?
Here is what I tried to do (in Truffle console):
# get json from contract
https://api.etherscan.io/api?module=contract&action=getabi&address=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&apikey=xxx

Saved it as ./build/contracts/WETH9.json in my truffle project
var weth_contract = require("./build/contracts/WETH9.json")
# seems to work

var wethContract= new web3.eth.Contract(JSON.parse(weth_contract.result), "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2");

wethContract.totalSupply()
# fails
# Uncaught TypeError: wethContract.totalSupply is not a function

wethContract.methods.totalSupply()
# returns lots of stuffs, but I am not sure if this is helping...

I am stuck at this point.
How can I check totalSupply, or send approve on WETH from the truffle console?
(I am using web3.version '1.2.1'.)


texts: Why can I only use the `Web3 Provider` option to connect to `geth` when using a local instance of the Remix Solidity Compiler?

texts:
Why can I only use the Web3 Provider option to connect to geth when using a local instance of the Remix Solidity Compiler?

When starting geth, I use the following command-line:

geth --rinkeby --datadir=.rinkeby --cache=512 --bootnodes=enode://a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf@52.169.42.101:30303 --rpc --rpcaddr "localhost" --rpcport 8545 --rpccorsdomain "*"

Trying to connect to geth from the online Remix Solidity Compiler on port 8545 (Web3 Provider), I get the error: "Invalid JSON RPC response: ".

However, if I use my local (downloaded) version of the Remix Solidity Compiler, then everything works flawless. Why is that?


texts: transferFrom(address _from, address _to, uint256 value) throws up error with status 0

texts:
I wanted to transfer funds between two accounts in Ethereum(Rinkeby TestNetwork) so as per ERC Token implemention I used transferFrom() function and called it.But got this following error in truffle console

 Error: Transaction: 0xad9c1f2e748f026497b2ea89857076ee4837239dbae8aeedafae665711beeac4 exited with an error (status 0).

    Please check that the transaction:

        - satisfies all conditions set by Solidity `require` statements.

        - does not trigger a Solidity `revert` statement.
 at StatusError.ExtendableError (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-error/index.js:10:1)
    at new StatusError (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-contract/statuserror.js:29:1)
    at Object.callback (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-contract/contract.js:181:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/method.js:142:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:89:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-provider/wrapper.js:134:1
    at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/httpprovider.js:128:1)
    at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:64:1)
    at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:354:1)
    at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:509:1)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:469:1)
    at IncomingMessage.emit (events.js:185:15)
    at IncomingMessage.emit (domain.js:439:23)
    at endReadableNT (_stream_readable.js:1101:12)
    at process._tickCallback (internal/process/next_tick.js:114:19)

Here is the initial code I used.

*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
    require(_value <= allowance[_from][msg.sender]);     // Check allowance
    allowance[_from][msg.sender] -= _value;
    _transfer(_from, _to, _value);
    return true;
}

/**
 * Set allowance for other address
 *
 * Allows `_spender` to spend no more than `_value` tokens in your behalf
 *
 * @param _spender The address authorized to spend
 * @param _value the max amount they can spend
 */
function approve(address _spender, uint256 _value) public
    returns (bool success) {
    allowance[msg.sender][_spender] = _value;
    emit Approval(msg.sender, _spender, _value);
    return true;
}

In the truffle console, I called the contract like this

MyAdvancedToken.deployed().then(t => token = t)

where MyAdvancedToken is the contract name.
Since token is the object for the contract I used transferFrom() like this.

token.transferFrom(web3.eth.accounts[0],web3.eth.accounts[1],60)


texts: How do I update Geth when using Ethereum Wallet on a windows 10?

texts:
How do I update Geth to the latest version(1.8.10) when I am using Ethereum Wallet on a Windows 10?

It is not prompting me for an update to Geth as I skipped it the first time Ethereum Wallet was opened after an update.


texts: Where are my ethers? Error encountered during contract execution [Reverted]

texts:
https://etherscan.io/tx/0x7eec9ecbba2ff45016d09e27bbb22ca206e6ec51386436c90ae937b563131066

Hello. That transaction was fail. It was send by an Exchange to another wallet.
The error messagge is:

Warning! Error encountered during contract execution [Reverted]

So do that means that the funds will return to the original exchange?

I want my ETH back :-/