texts: how to get contract address after its been mined with web3.js

texts:
I have tried to deploy a SmartContract from web3.js node library, I am getting a transaction hash from it but how would I get the contract address after It's been mined by a miner?
here is my code

const Web3 = require('web3');
const Tx = require('ethereumjs-tx');
const provider = new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/<Api key>");
const web3 = new Web3(provider);

const account1 = '<acc address>';
web3.eth.defaultAccount = account1;

const privateKey1 = Buffer.from('<private key here>', 'hex');

const myData = "<data here>"

web3.eth.getTransactionCount(account1, (err, txCount) => {
// Build the transaction
  const txObject = {
    nonce:    web3.utils.toHex(txCount),
    gasLimit: web3.utils.toHex(4700000),
    gasPrice: web3.utils.toHex(web3.utils.toWei('10', 'gwei')),
    data: myData
  }
    // Sign the transaction
    const tx = new Tx(txObject);
    tx.sign(privateKey1);

    const serializedTx = tx.serialize();
    const raw = '0x' + serializedTx.toString('hex');

    // Broadcast the transaction
   web3.eth.sendSignedTransaction(raw, (err, tx) => {
        console.log(tx);
    })
});


texts:
I have a question about the Metamask UI.

Is it possible to set custom transaction method name for metamask history to make it more user-friendly? I want to rename "Bid" (default method name) to "Made bids for cake". I can't find any docs about it, anyone knows how does it works?

UPDATED

I've tried to test new contract with a few different functions,
all of them named as "Unknown function" inside Metamask ext UI history (when I expected to see "Set Test Value"). Even for set function its unknown result.

How should I name function for Metamask UI correctly?

contract NamingTest {
    uint256 test;

    function set_test_value(uint256 _value) external payable {
        test = _value;
    }

    function setTestValue(uint256 _value) external payable {
        test = _value;
    }

    function settestvalue(uint256 _value) external payable {
        test = _value;
    }

    function set(uint256 _value) external payable {
        test = _value;
    }

    function getTest() external view returns (uint256) {
        return test;
    }
}


texts:
I have read a lot of informations about ERC20 tokens.
What i want to know is : Does it exists some ERC20 tokens which works with another blockchain than Ethereum ?
Or ERC20 is a specific Ethereum only technology ?
Thanks


texts: How can I withdraw my ICE token balance from Metamask?

texts:
I have transferred my ICE tokens from myetherwallet to Metamask , It does show my balance in metamask but I am unable to send them ??

I do not get any option to send them..

Please help me find out a way to transfer this ICE to any trading platform.


texts: Default gas value in eth.sendTransaction

texts:
Here's the link to the docs.

Here's an example I have some problems with:

 // compiled solidity source code using https://chriseth.github.io/cpp-ethereum/
  var code = "603d80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463c6888fa18114602d57005b6007600435028060005260206000f3";

 web3.eth.sendTransaction({data: code}, function(err, address) {
     if (!err)
     console.log(address); // "0x7f9fade1c0d57a7af66ab4ead7c2eb7b11a91385"
 });

What I can't understand is:

How much gas will be spent by this transaction?
Are there any other resources that provide any additional information on the topic?


texts:
I am reading the Solidity by example voting example. I am interested in the vote contract function:

function vote(uint proposal) {
    Voter sender = voters[msg.sender];
    require(!sender.voted);
    sender.voted = true;
    sender.vote = proposal;

    // If `proposal` is out of the range of the array,
    // this will throw automatically and revert all
    // changes.
    proposals[proposal].voteCount += sender.weight;
}

What happens if a transaction runs out of gas after the line sender.voted = true; but before the line proposals[proposal].voteCount += sender.weight;. In this case, it seems like the vote will be counted as made, but actually the voteCount will not be updated. Because of the require(!sender.voted); line, the voter cannot attempt to revote with a higher gas limit.

How are such out of gas situations handled in practice to guarantee atomicity of setting sender.voted and incrementing proposals[proposal].voteCount?


texts: How to transform method name and arguments into the "data" for a call? (Ethers)

texts: Having a method name and its parameters (in JavaScript objects format), need to calculate the "DATA" argument for ADDRESS.call(DATA) Solidity construct. Need to do it using Ethers.js.


texts: FATAL ERROR: Rebalance Allocation failed - process out of memory

texts:
So while running truffle compile for my contracts on AWS Ubuntu server I got the following error:

<--- Last few GCs --->

[17055:0x3985730]    11958 ms: Scavenge 511.7 (553.4) -> 506.9 (553.4) MB, 71.4 / 5.0 ms  allocation failure
[17055:0x3985730]    12164 ms: Scavenge 518.3 (557.3) -> 515.9 (557.8) MB, 83.0 / 4.9 ms  allocation failure

<--- JS stacktrace --->

Cannot get stack trace in GC.
FATAL ERROR: NewSpace::Rebalance Allocation failed - process out of memory
 1: node::Abort() [node]
 2: 0x8ccf9c [node]
 3: v8::Utils::ReportOOMFailure(char const*, bool) [node]
 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
 5: 0xa6552b [node]
 6: v8::internal::MarkCompactCollector::Evacuate() [node]
 7: v8::internal::MarkCompactCollector::CollectGarbage() [node]
 8: v8::internal::Heap::MarkCompact() [node]
 9: v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]
10: v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
11: v8::internal::Factory::NewUninitializedFixedArray(int) [node]
12: 0xd81903 [node]
13: v8::internal::Runtime_GrowArrayElements(int, v8::internal::Object**, v8::internal::Isolate*) [node]
14: 0x3bd2fb1042fd
Aborted (core dumped)

Can someone please help resolve this?

Run the following command at root: sudo du -sh ./*

Result:

15M     ./bin
69M     ./boot
0       ./dev
5.4M    ./etc
280M    ./home
0       ./initrd.img
0       ./initrd.img.old
166M    ./lib
4.0K    ./lib64
16K     ./lost+found
4.0K    ./media
4.0K    ./mnt
4.0K    ./opt
du: cannot access './proc/17290/task/17290/fd/4': No such file or directory
du: cannot access './proc/17290/task/17290/fdinfo/4': No such file or directory
du: cannot access './proc/17290/fd/3': No such file or directory
du: cannot access './proc/17290/fdinfo/3': No such file or directory
0       ./proc
56K     ./root
776K    ./run
15M     ./sbin
672M    ./snap
4.0K    ./srv
0       ./sys
56K     ./tmp
1.2G    ./usr
520M    ./var
0       ./vmlinuz
0       ./vmlinuz.old


texts: how to get latest block number using web3j java APIs

texts: I ask the network for current balance of the address i want to keep track. after that i want to detect/listen incoming deposits starting at the latest block number at the start of my program/server. now the problem is how to find the latest block number at that time? it looks like there is an API in web3js (java script) but not in web3j (java). I am connected to rinkeby testnet via infura node.


texts:
When selecting the controller/resolver address of vitalik.eth, what does the list of .eth addresses on this page mean?
https://app.ens.domains/address/0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41/controller


texts:
A best practice question:

Is it better to create a fixed amount of tokens at the beginning of an ICO and release parts of it via crowdsales until reaching the total amount or is it better to mint amounts while creating crowdsales?

Is there any best practices regarding this?

A quick representation:

One of the obvious problems for case 2 is that funders might be irritated by the fact that we can mint token.


texts: How to have two geth full nodes communicate over ssh tunnel

texts:
I have a VPN separating two nodes, one which can access internet at large, one which cannot. I can VPN from the internet-accessing node (here called nodeA) through an intermediary server (here called nodeB) to nodeC which I would like to run another geth full node on.

I can currently do things like VNC forwarding by running a command like:

ssh -v -N -L 5900:nodeC:5900 user@nodeB

From what I understand, this connects from nodeA to nodeB and then sets up a relay between 5900 on nodeA targeted to nodeC's 5900 such that when I run vnc on nodeA and target it to localhost:5900, I get a connection.

What do I need to do to get nodeC able to run a geth node which talks to nodeA's running and operational full node?

Thank you.


texts:
I noticed that ethermine revenues change with eth's price.
I expected that revenue were to chage with difficulty's increase, what wrong? It's normal?


texts: How to send some ether to contract when trying to change the price of token?

texts:
I made an Ethereum smart contract in Solidity where a user can buy/sell/transfer tokens. In the contract, the admin can change the token price using changePrice(uint256 price) function. I want to make sure that the contract has sufficient ethers when executing this function because contracts might lack ethers to send to users when they want to sell their tokens to contract.
I wrote the following code. It changes the price of token but fails to suffice the balance of contract. I am sure the number of tokens sold (tokensSold) are being tracked correctly.
What part should I repair?
Thanks in advance.
  function changePrice(uint256 price) public payable returns (bool success) {
      require(msg.sender == admin, "Only the admin is authorised to change the price of Token.");

      if (address(this).balance < price.mul(tokensSold)) {
        uint256 fundsNeeded = (price.mul(tokensSold)).sub(address(this).balance);
        require(msg.sender.balance >= fundsNeeded, "Can't change price: your balance seems insufficient to send funds to the contract.");
        address(this).transfer(fundsNeeded);
      }

      require(address(this).balance >= price.mul(tokensSold), "Contract has insufficient funds for the price to be changed.");

      tokenPrice = price;

      emit Price(price);

      return true;
  }


texts: Why I cannot loop through array backwards in Solidity?

texts:
The reverseLoop function below threw VM error: invalid opcode. Why is that?

contract ArrayTest {
  uint[2] a;

  event ReverseLoop(uint n);
  event NormalLoop(uint n);

  constructor() public {
    a[0] = 1;
    a[1] = 2;
  }

  function reverseLoop() external {
    for (uint i = a.length-1; i >= 0; i--) {
        emit ReverseLoop(a[i]);
    }
  }

  function normalLoop() external {
    for (uint i = 0; i < a.length; i++) {
        emit NormalLoop(a[i]);
    }
  }
}


texts: Passing bytes into proxy contract instead of bytes calldata

texts:
It's possible to pass bytes memory data instead of bytes calldata data into a proxy contract?
function callProxy(bytes memory _data, uint256 _value) private {
    (bool success, ) = proxyContract.call{ value: _value }(_data);
}

vs.
function callProxy(bytes calldata _data, uint256 _value) private {
    (bool success, ) = proxyContract.call{ value: _value }(_data);
}


texts:
In persuit to understand blockhain decentralization:
If I am not wrong, it helps prevent control with one entity.
Consider a hypothetical example of a service which takes a string and returns a digitally signed (using its private key) string.
Can this service be decentralized? What is the meaning of decentralization here? Does it mean it can be run by any miner node? But without access to private key, how would they run? Does it mean, such kind of service cannot be decentralized? What is the meaning of decentralization?


texts: Invalid Gas Used and Missing trie node when starting a mining geth node

texts: When leaving my rig mining off for a couple days and starting geth again, sometimes I get this an "Invalid Gas Used" error and "Missing trie node". What does this mean? Any ideas on what could be causing it? I've had to redownload the chain when I get stuck.


texts: How to create a password file for the keystore

texts:
I would like to run raiden manually on top of geth unfortunately this requires a password file for your keystore which you can find here on linux ```~/.ethereum/keystore````How do i create a password file for my keystore?
this is what raiden requires
raiden /
--address $YOUR-ETHEREUM-ADDRESS /
--keystore-path $PATH-TO-YOUR-KEYSTORE-FILE /
--password-file $PASSWORD-FILE-FOR-KEYSTORE-FILE /
--eth-rpc-endpoint $YOUR-ETHEREUM-NODE


texts: How etherscan.io is able to track ERC721 tokens on the blockchain

texts:
My question can be rephrased as: how does https://etherscan.io/tokens-nft work?

Does they analyze every transaction data?

The NFT tokens listed there doesn't implement the exact same ABI, is there a way to dig "generic" information in the transaction data?


texts: Does the private and public keys determine each other uniquely?

texts:
I wonder whether for each private/public key there correspond a unique public/private key?

Of course, it must be computationally infeasible to compute the private key from the public key, but does this hold for the other direction?

Could someone answer whether two users on the Ethereum blockchain could share the same private key, although they could not share the same public key (address of the EOA)?

In particular, what randomness goes into key generation such that two users does not end up with the same public key?


texts: Smart contract execution without making transaction on ethereum blockchain

texts:
If I as a user of a smart contract ,call a function which does a heavy computation but doesn't change anything except the function variables which live only during function execution and then thrown away, does that make a transaction on ethereum blockchain? If it doesn't then how the fee for the miner is paid?
I know for a code to be executed certain gas is used but if there is no transaction  who gives the fee for the execution?


texts: How to convert ERC crypto art NFTs into a Cardano NFT?

texts:
This is being asked two days before native tokens and multi-asset support hits the Cardano blockchain, but, given that Cardano has created an ERC-20 token converter that converts ERC-20 tokens to Cardano native tokens by migrating them to the Cardano blockchain, will it be possible to convert crypto art NFTs (ERC-721 or ERC-1155 tokens) to the Cardano blockchain as well?
Currently the crypto art platforms are dominated by Ethereum works and there doesn't seem to be any Rarible or Opensea being developed for Cardano NFTs from what I know. Or could it be that platforms like Rarible and Opensea will quickly add the Cardano "format" to their roster in no time?


texts:
when i am doing truffle migrate.i am able to deploy my crowdsale contract but my token contract is getting deployed but not the crowdsale contract.

var Sportist = artifacts.require("./Sportist.sol");
var SportistCrowdsale = artifacts.require("./SportistCrowdsale.sol");

module.exports = async function (deployer) {
    let rate = 1;
    let wallet = "0x300c7b7198a772C2154e4f2a47C0d89407a95A8A";
    let token;
    let openingTime = Math.floor((new Date()).getTime()/1000);
    let closingTime = openingTime + 1 * 60 * 60 * 24;
    let cap = 500000;
    let goal = 50000;
    let tokenWallet = "0x300c7b7198a772C2154e4f2a47C0d89407a95A8A";

let a  = await deployer.deploy(Sportist, "Sportist", "S", 6, 2000000000)
 console.log("asdasdasdasdasdasdasdasdasdasd");
token = await Sportist.deployed().then(instance=>instance.address)

await deployer.deploy(SportistCrowdsale,
    rate, wallet, token,
    openingTime, closingTime,
    cap,
    goal,
    tokenWallet)

    const crowdsale = await DappTokenCrowdsale.deployed();

console.log("after deployement ");

};

in the console it is showing that

Using network 'development'.

Running migration: 2_deploy.js
  Replacing Sportist...
  ... 0x211c7f7e0678bacec29a7d8032ae8949faca2cc381586b8b541f5faf3804c1f9
  Sportist: 0x2fb7fa517002ca3a7af45deea0479f287d5089fb
Saving successful migration to network...
asdasdasdasdasdasdasdasdasdasd
  ... 0x760538642ffd049748b5bf3ff5624b0065e6b0e3bbbb1aaf99ad341de2bc99f1
  Deploying SportistCrowdsale...
Saving artifacts...

and the crowdsale contract is

pragma solidity ^0.4.24;

import "./crowdsale/distribution/RefundableCrowdsale.sol";
import "./crowdsale/distribution/PostDeliveryCrowdsale.sol";
import "./crowdsale/validation/CappedCrowdsale.sol";
import "./crowdsale/emission/AllowanceCrowdsale.sol";
import "./crowdsale/emission/StagedCrowsale.sol";

contract SportistCrowdsale is RefundableCrowdsale, CappedCrowdsale, PostDeliveryCrowdsale, AllowanceCrowdsale, StagedCrowsale {
    constructor(
        uint256 rate, address wallet, IERC20 token,
        uint256 openingTime, uint256 closingTime,
        uint cap,
        uint256 goal,
        address tokenWallet)
        Crowdsale(rate, wallet, token)
        TimedCrowdsale(openingTime, closingTime)
        CappedCrowdsale(cap)
        RefundableCrowdsale(goal)
        AllowanceCrowdsale(tokenWallet)
        StagedCrowsale()
    public {}

    function() external payable {
        buyTokens(msg.sender);
    }
}


texts:
I am querying a mapping via a web3 call like this:

var Web3 = require('web3');
const web3 = new Web3(new Web3.providers.HttpProvider('https://kovan.infura.io/key...'));
var contractABI = new web3.eth.Contract([...abi...], contractAddress);
var orderValue = '15';
contractABI.methods.orders(web3.utils.toHex(orderValue)).call(function(err, result) {
        if (!err) {
            callback(result);
        } else {
            callback(err);
        }
    });

If orderValue is > 15 then I get the following error:

  Error: Couldn't decode bytes32 from ABI: 0x The size doesn't match.

If orderValue is <= 15 (e.g. 10) then I get the following error:

  throw new Error('Given parameter bytes has an invalid length: "'+
  value + '"');

  Error: Given parameter bytes has an invalid length: "0xa"

the mapping in the smart contract looks as follows:

struct Order {
    bytes32 orderId;
    uint32 orderAmount;
}
mapping(bytes32 => Order) public orders;

If if query orders with Parity I am getting some values back. What am I doing wrong?


texts: Why ethereum nodes needs to sync in private net?

texts: I getting geth up and running with: geth --datadir data --rpc. and Mist up and running with: /Applications/Mist.app/Contents/MacOS/Mist --rpc http://localhost:8545. So mist is running in private net, so there won't be any blocks to download right? then why mist is still showing ethereum nodes needs to sync, looking for peers and it takes forever to finish.


texts: Does Geth and Parity store blockchain in level db in same format?

texts:
If not, what are the diffrences?, for example geth db format is:

var databaseVerisionKey = new Buffer("DatabaseVersion"); // databaseVerisionKey tracks the current database version.
var headHeaderKey = new Buffer("LastHeader"); // headHeaderKey tracks the latest know header's hash.
var headBlockKey = new Buffer("LastBlock"); // headBlockKey tracks the latest know full block's hash.
var headFastBlockKey = new Buffer("LastFast"); // headFastBlockKey tracks the latest known incomplete block's hash duirng fast sync.
var fastTrieProgressKey = new Buffer("TrieSync"); // fastTrieProgressKey tracks the number of trie entries imported during fast sync.

// Data item prefixes (use single byte to avoid mixing data types, avoid `i`, used for indexes).
var headerPrefix = new Buffer("h"); // headerPrefix + num (uint64 big endian) + hash -> header
var headerTDSuffix = new Buffer("t"); // headerPrefix + num (uint64 big endian) + hash + headerTDSuffix -> td
var headerHashSuffix = new Buffer("n"); // headerPrefix + num (uint64 big endian) + headerHashSuffix -> hash
var headerNumberPrefix = new Buffer("H"); // headerNumberPrefix + hash -> num (uint64 big endian)
var blockBodyPrefix = new Buffer("b"); // blockBodyPrefix + num (uint64 big endian) + hash -> block body
var blockReceiptsPrefix = new Buffer("r"); // blockReceiptsPrefix + num (uint64 big endian) + hash -> block receipts
var txLookupPrefix = new Buffer("l"); // txLookupPrefix + hash -> transaction/receipt lookup metadata
var bloomBitsPrefix = new Buffer("B"); // bloomBitsPrefix + bit (uint16 big endian) + section (uint64 big endian) + hash -> bloom bits
var preimagePrefix = new Buffer("secure-key-");      // preimagePrefix + hash -> preimage
var configPrefix = new Buffer("ethereum-config-"); // config prefix for the db
var BloomBitsIndexPrefix = new Buffer("iB"); // BloomBitsIndexPrefix is the data table of a chain indexer to track its progress // Chain index prefixes (use `i` + single byte to avoid mixing data types).

```


texts: Is S of the signature(R,S) invalid when it is larger than N/2 in Ethereum?

texts:
In ECDSA, both signature(r,s) and (r,-s) are valid. However, in Bitcoin, it seems that the signature fails to be verified when s-part in the signature is bigger than half of the group order from this post https://bitcoin.stackexchange.com/questions/85946/low-s-value-in-bitcoin-signature
I am wondering that if Ethereum is the same as Bitcoin. If yes, what is the reason that s needs to be a low-value?


texts: Is it possible to transfer token from other address if I have private key from it?

texts:
I know that if someone owns tokens he can simply call transfer method of contract to send money. I also know that for ERC20 contract owner of tokens can call approve for my account, and then I can call transferFrom to send his money. But I don't know if it's possible for me to transfer money from someone's account if I know his key without him calling approve before. In other words, is it possible to make transaction with transfer call to contract where transaction "from" field and "from" in a parameter to contract are different? I want to have the ability to make a lot of transactions from specific account to contract, such that they will transfer money from other accounts that I have keys to. It would be convinient, because in this case I can pay fee in eth only from one account and I don't need eth on all other accounts. With approve/transferFrom scheme I still need to call approve from all these accounts (and pay for fee) before every transferFrom which makes the whole idea useless.

If this helps, I want to interact with a specific token -- USDT


texts: how to fix "txHash: undefined" error using web3.js

texts:
anyone can fix this??

i always got output "txHash: undefined"

var Tx = require('ethereumjs-tx')

const Web3 = require('web3')
const web3 = newWeb3('https://mainet.infura.io/')

const account1 = '0x9c56de05d7e27bc8.....................'

const account2 = '0xb2269135b0388b6..........................'

const account3 = '0x7717d106658c2................................'

const account4 = '0xb7060b6.............................'

const addresses = [account2, account3, account4];

var i
for (i =1; i < addresses.length; i++) {
  }

const privateKey1 = Buffer.from('4987f2720bcf5e57ad20c60241fcfe1fc1...........', 'hex')

web3.eth.getTransactionCount(account1, (err, txCount) => {

    // Build the transaction
    const txObject = {
      nonce: web3.utils.toHex(txCount),
      to: addresses[i],
      value: web3.utils.toHex(web3.utils.toWei('1.2', 'ether')),
      gasLimit: web3.utils.toHex(21000),
      gasPrice: web3.utils.toHex(web3.utils.toWei('10', 'gwei'))
    }

    // Sign the transaction
    const tx = new Tx(txObject)
    tx.sign(privateKey1)

    const serializedTx = tx.serialize()
    const raw = '0x' + serializedTx.toString('hex')

    // Broadcast the transaction
    web3.eth.sendSignedTransaction(raw, (err, txHash) => {
      console.log('txHash:', txHash)
      // Now go check etherscan to see the transaction!
    })
  })


texts: How does a token know which smart contract to call?

texts:
Lets say a smart contract is launched for token "A".

I then want to send 10 units of token "A" to another wallet.

The ethereum smart contract "transfer" function will be called, an example of the contract would be here. https://www.ethereum.org/token

But how ethereum know to call this smart contract? Why wouldn't it call the transfer function of token "B" instead? Does each "token" of the currency contain data housing the contract address for which it was made?

Thanks!


texts: Why MetaMask always asking high gas price? which one can i use alternative to metamask for token distribution?

texts:
While i am distributing tokens i am using a special contract to airdrop the               tokens to multiple addresses at a time but metamask is demanding high gas prices which costs me huge am always checking in ethgasstation.info there safe low gas price showing 2 and at the same time metamask is demanding 8 gas price why is this much?

can anyone suggest me alternative to metamask to perform airdrop with safe low gas price.

please help.


texts: Getting top transactions and storing in an array (considering ties and count is only increasing)

texts:
completely new to solidity and trying to grasp the new pattern of preventing loops. I would like to store the top 5 transactions by storing them in an array. My problem is how can I optimize the array if all of the transaction count would start with 1 and possibilities of having ties. What is the most efficient way to do this?
struct Transaction{
 address id;
 uint transactionCount;
}
mapping(address => Transaction) transactions;
address [] transactionsIndex;
address [] topTransactions;
uint transactionCount = 0;

function deposit() {
  //logic to track top transaction count by address
}


texts: Is there any Ropsten (or any other testnet) node with whisper enabled?

texts: I am trying the embark framework which has whisper integration. I wanted to deploy the dapp and test it live. If there is one could you let me know the endpoint and port. Thanks :)


texts: format transfered value with contracts decimals

texts:
I have the amount of transfered tokens converted from a transactionreceipts log data.
for example USDT the value I got is 500000000 , USDT has 6 decimals. The actual transfered value is only 500 USDT, how can I convert that using web3 or javascript to use the contracts decimals and output the correct value?
Would amount / math.pow(10, tokendecimals) be the correct way to do this?
Regards


texts: can i get returned value from contracts that changes state in javascript

texts:
pragma solidity >= 0.5.0;
uint x;
function getX() public returns(uint){
x = 6;
return x;
}


texts: Deriving the v value from an ECDSA signature without web3j

texts:
I am currently signing with a the ECDSASignature spec in java however I noticed that getting a v value from the signature is a custom spec for ethereum.

My code:

public static void main(String[] args) throws Exception
{
    byte[] offer = {
            0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,
            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01
    };
    System.out.print(getAgreementFromAdmin(offer));
}

//TODO port to android
//TODO get v value
private static JSONObject getAgreementFromAdmin(byte[] offer) throws Exception
{
    //no need for address, from ecrecover you can take the token.
    System.out.println("offer: " +  offer.length);
    // sign() returns r, s but not v
    // org.web3j.crypto.ECDSASignature
    ECDSASignature signature = TransactionQueue.getAdminKeyPair().sign(offer);
    BigInteger r = signature.r;
    BigInteger s = signature.s;
    int v = 27; // minimum value of v, if not working try with 28
    JSONObject agreementJSON = new JSONObject();
    agreementJSON.put("offer", "0x" + bytesToHex(offer));
    agreementJSON.put("v", v);
    agreementJSON.put("r", r);
    agreementJSON.put("s", s);

    return agreementJSON;
}

The sign method is defined as:

public ECDSASignature sign(byte[] transactionHash) {
    ECDSASigner signer = new ECDSASigner(new HMacDSAKCalculator(new SHA256Digest()));

    ECPrivateKeyParameters privKey = new ECPrivateKeyParameters(privateKey, Sign.CURVE);
    signer.init(true, privKey);
    BigInteger[] components = signer.generateSignature(transactionHash);

    return new ECDSASignature(components[0], components[1]).toCanonicalised();
}


texts: TRANSFER_FROM_FAILED when swapping token for eth with uniswap api

texts:
when calling uniswap.swapExactTokensForEth, I get the following error on etherscan:
Fail with error: TransferHelper: TRANSFER_FROM_FAILED
I see previous posts with this error, though they seem related to not approving the token for selling.
I've already done that though manually, and have manually sold the token, but for some reason using the uniswap API, it fails.
Any ideas?


texts: Sending value to smart contract failed on Testnet Rinkeby, Ropsten via MetaMask

texts:
I'm facing an issue with sending value to my smart contract. I created a very simple smart contract and deployed it using MetaMask & Remix to Ropsten Testnet. Contract created successfully.

Now I'm trying to send some value to my contract address and its continuously failing. I have tried this on different Testnets too e.g Rinkeby but same error.

  "Value transfer did not complete, most likely as a result of REVERT opcode "

Contract code

pragma solidity ^0.4.18;

contract HelloWorld {
    event log_string(bytes32 log); // Event

    function () public { // Fallback Function
        log_string("Hello World!");
    }
}

Transaction for contract creation
Transaction for sending value


texts: Metamask (Chrome extension) web3.js console: ETH transaction issue (synchronous methods) + web3.version

texts:
I am playing around with Metamask and the web3.js API using the Google Chrome console.
However, I have two issues:

1) I am trying to send a simple transaction using Ganache GUI (localhost 7545) and I am entering the code below:

> ethereum.enable()

> web3.currentProvider.selectedAddress

<."0xb8662b66584ae08a88341df0d2b3fa7a65eb158c"

> var transaction = {
    from: web3.currentProvider.selectedAddress,
    to: "0xA8b62F503181D9A56683129de1B98ea4Bf143a40",
    value: web3.toWei("1", "ether")
}

> web3.eth.sendTransaction(transaction)

Then I am getting the error message below:

> Uncaught Error: The MetaMask Web3 object does not support synchronous methods like eth_sendTransaction without a callback parameter. See https://github.com/MetaMask/faq/blob/master/DEVELOPERS.md#dizzy-all-async---think-of-metamask-as-a-light-client for details.
    at MetamaskInpageProvider._sendSync (inpage.js:1)
    at MetamaskInpageProvider.send (inpage.js:1)
    at Proxy.t.send (inpage.js:1)
    at a.send (inpage.js:1)
    at w.e [as sendTransaction] (inpage.js:1)
    at <anonymous>:1:10

2) Also note that the web3.version seems to be 0.20.7 whereas when I check this website https://web3js.readthedocs.io/en/v1.2.4/, the new version of the web3.js API seem to be 1.2.4. Is there a way to update the web3.js API version in the chrome console while using the Metamask extension?
Note that I have tried to enter this in the console web3 = new Web3(web3.currentProvider) but the web3.version remains 0.20.7.

In terms of priority 1) is more critical I believe.

Could you please assist.

Thank you


texts: Ecrecover: does passing the hash and checking it adds any security?

texts:
I have seen quite a few examples where both the data and the hash of the data is passed.

The signature is verified using ecrecover which is fine.

The passed hash is also verified against the calculated hash. I do not see what that second verifications adds in terms of message integrity and checking the originator. If the calculated hash is used to verify the signature and it is wrong, the signature verification should fail. Am I missing something ?

function Check(string data, bytes32 hash, bytes32 r, bytes32 s, uint8 v) public returns (bool) {

    var calculatedHash = keccak256(this, data);

    // do we need this ?
    assert(hash == calculatedHash);

    // should not this one be sufficient ?
    assert(msg.sender == ecrecover(calculatedHash, v, r, s));

}


texts: Wallet password with special unicode character

texts:
I created a new wallet address with a password containing a unicode special character like � (REPLACEMENT CHARACTER).
See http://www.fileformat.info/info/unicode/char/fffd/index.htm

The wallet could be created in Ethereum Wallet / Mist and the password confirmation dialogue apparently worked out as well.

Now when I am trying to send some ether to another wallet, the password dialogue tells me that the password is wrong. Are there any known issues with unicode characters in passwords, or do I need to "escape" / mask those characters in a special way?

Means for example: the character � with "\uFFFD" or Alt +FFFD
see http://www.fileformat.info/info/unicode/char/fffd/index.htm

Any help / hint is greatly appreciated

Cheers
Stefan


texts: Once PoS and Casper is reached, what stops block times from dropping into the millisecond range?

texts:
After reading through Vlad's Casper Post, I am under the impression that Casper consensus will be reached when the validators all agree on a bit (more or less). If this is the case, why can the 'voting' not be done every 1 second or less? Given global information transfer times, we can include 250ms latency for intercontinental data transfer (being very lenient).From what I understand, consensus will go as follows:

@1ms - "Everyone agree on 1 (as opposed to 0)?"

@250ms - "Yes."

@500ms - "Consensus reached. Start over."

With this model, it takes 0.5s to reach consensus.

I read here that it will drop to 2-7.5s, not millisecond range. Given my statements above, how is it not faster?


texts: Quorum failure - Failed to decode message from payload

texts:
We use in our project -JP Morgan Quorum (Ethereum based) bloackchain - with istanbul voting mode. We have 4 nodes (3 of them are validators - hard coded, nonchangable)

And from time to time (unpredictable - but approximately once per several hours) - and the less nodes we use - the more rare the failure occurs. (for 7 nodes - once per two days). Also quorum node may consume up to 1Gb of memory after sending a Transaction to a contract, deployed on Quorum. (Transaction just sets two uint storage variables)

Log looks like this:

INFO [05-07|10:14:12] Successfully sealed new block lock number=254599 hash=a0f9f2…c10589
INFO [05-07|10:14:12] :hammer: mined potential block n number=254599 hash=a0f9f2…c10589
INFO [05-047|10:14:12] Commit new mining work deduped=254600 txs=0 uncles=0 elapsed=2.774ms
ERROR[05-07|10:18:42] Failed to decode message from payload address=0xd8Dba507e85F116b1f7e231cA8525fC9008A6966 e
rr="unauthorized address"

And I have two questions:
 1. Did somebody have the same issue and how resolved it?
 2. Did somebody use Quorum in production, or it is not stable enough
    for that purpose?
 3. Have somebody guess or idea about such kind of failure?
 4. Is it normal for Quorum to consume a lot of memory

I know, questions are "common and abstract". But I need, besides tha issue solution, to have your opinion and view on Quorum.

And our genesis.json file, if it helps (all the nodes listed there, we, of course, have configured and launched)

{
    "alloc": {
     "0xed9d02e382b34818e88b88a309c7fe71e65f419d": {
        "balance": "1000000000000000000000000000"
      },
      "0xca843569e3427144cead5e4d5999a3d0ccf92b8e": {
        "balance": "1000000000000000000000000000"
      },
      "0x0fbdc686b912d7722dc86510934589e0aaf3b55a": {
        "balance": "1000000000000000000000000000"
      },
      "0x9186eb3d20cbd1f5f992a950d808c4495153abd5": {
        "balance": "1000000000000000000000000000"
      },
      "0x0638e1574728b6d862dd5d3a3e0942c3be47d996": {
        "balance": "1000000000000000000000000000"
      }
    },
    "coinbase": "0x0000000000000000000000000000000000000000",
    "config": {
      "homesteadBlock": 1,
        "eip150Block": 2,
        "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "eip155Block": 3,
        "eip158Block": 3,
      "istanbul": {
        "epoch": 30000,
        "policy": 0
      },
      "isQuorum": true
    },
    "extraData": "0xd783010702846765746887676f312e392e33856c696e75780000000000000000f8c9f83f948157d4437104e3b8df4451a85f7b2438ef6699ff94b912de287f9b047b$
    "gasLimit": "0xFFFFFFFFFFFFFFF0",
    "difficulty": "0x1",
    "mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
    "nonce": "0x0",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "timestamp": "0x00"
  }


texts: Infinite Gas Requirement: Compiling a simple contract on Remix

texts:
I am trying to compile a simple contract on Remix but I am getting following 3 warnings:

  Gas requirement of function Greeter.hello() high: infinite. If the gas
  requirement of a function is higher than the block gas limit, it
  cannot be executed. Please avoid loops in your functions or actions
  that modify large areas of storage (this includes clearing or copying
  arrays in storage)
  Gas requirement of function Greeter.set(string) high: infinite. If the gas requirement of a function is higher than the block gas limit,
  it cannot be executed. Please avoid loops in your functions or actions
  that modify large areas of storage (this includes clearing or copying
  arrays in storage)
  Gas requirement of function Greeter.yourName() high: infinite. If the gas requirement of a function is higher than the block gas limit,
  it cannot be executed. Please avoid loops in your functions or actions
  that modify large areas of storage (this includes clearing or copying
  arrays in storage)

The contract is given below:

pragma solidity ^0.4.22;

contract Greeter {
   string public yourName;
   constructor() public{
      yourName = "World";
   }
   function (string name) public {
      yourName = name;
   }
   function hello( ) public constant returns (string) {
      return yourName;
   }
}

Some body please guide me how to remove the above warnings.

Zulfi.


texts:
I have deployed ERC20 with reference to
// File: openzeppelin- zos/contracts/token/ERC20/DetailedMintableToken.sol
I called the initialized function with owner, name, symbol and decimal value. Everything went fine as I verified the parameters after deploying in Rinkeby Network.
But when I checked the contract in  Explorer it just showed as a normal contract, I was expecting it to show as an ERC20 contract. for eg:
this is the contract I deployed ,without explorer detecting it as erc

and this is what i was expecting my contract to be displayed like

reference Rinkeby address1: 0x5238fFeAEdfc9481bd635B6E0e5eF3b05b19762a
reference Rinkeby address2: 0x6e00e5bd453a6a5cf6eaa9d91f29de981730edfc


texts: Parity crashes after not closing cleanly

texts:
If Parity doesn't close properly, I get the following error and have to resynch the entire chain again...

  thread '' panicked at 'Error opening state db: Failed to create
  rocksdb directory: Error { repr: Os { code: 17, message: "File exists"
  } }', util/src/journaldb/archivedb.rs:49 note: Run with
  RUST_BACKTRACE=1 for a backtrace.

Has anyone got a better solution to recover in these instances?


texts: testrpc 2.0.0 - cannot find module 'memdown'

texts:
Trying to get testrpc (2.0.0) working on an ubuntu virtualbox, and getting this error when I run it:

mowliv@u4:~$ testrpc
module.js:341
    throw err;
    ^

Error: Cannot find module 'memdown'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/usr/lib/node_modules/ethereumjs-testrpc/node_modules/merkle-patricia-tree/baseTrie.js:3:17)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)

Have tried npm update -g and sudo npm install -g memdown but those didn't help. Maybe I'm being bitten by a major new (2.0.0) release?


texts: ERC 1155 for creating token holding multiple child token?

texts:
I would like to create a contract with a "master token" and be able to create (post-deployement) "child token" without deploying again a contract each time I create a child token. My "child token" price should be ("master token" price * x)
I'm pretty new to this, but I far as I know I think ERC 1155 could match my needs.
My goal is to achieve this with the best ratio "child token" created / gas


texts: Did the ripemd precompiled contract get deleted?

texts:
A bug "caused account 0000000000000000000000000000000000000003 to be deleted in block 2675119, even though the deletion should have been reverted due to an out of gas error."  Source

Did account 0..3 get deleted?
Did it get restored (on the blockchain) by this 1 wei transaction?
Pre-EIP161, would sending 0 wei to 0..3 been sufficient to restore 0..3 on the blockchain?  What would happen if 0 wei was sent?


texts: Is the entire blockchain (including the genesis block) stored forever?

texts: Quick question: Is the complete blockchain for Ethereum stored for as long as the currency exists? If not, then what determines the amount of time the binary for a contract can exist to be called? If yes, then would that present a scalability issue as the currency ages?


texts:
Can someone help me and  tell me where in my code is the problem. How to fix this ?

https://ropsten.etherscan.io/tx/0xbd2079c12f90bb9396d79e7aeb5b5914472dd25c9e62ce36ffa85f6e88d7b594

Is there any obvious error ?
Help is more than appreciate.Robert


texts: What's the status of Ethereum Light Client?

texts:
Is there any stable Ethereum Light Client? Which one is production ready? What's the status and the roadmap?
Moreover, I'm looking for some metrics related to a Light Client:

Runtime resources usage (memory, cpu)
How much time it takes to sync (from genesis) on a mid level-mobile device (let's say we have max 300MB RAM available)?
How much time it takes to re-sync after 1 week break?


texts: Are there actual peers with IPv6 addresses?

texts:
geth has IPv6 support and listens on IPv6 as well. But I find, on my geth node, no IPv6 traffic. I tested both with lsof -n -i | grep geth (shows no IPv6 address) and tcpdump -n ip6. IPv6 works fine for other programs. Here, inside-generated (from the Ethereum node):

% ping6 -n -c 3 www.nic.fr
PING www.nic.fr(2001:67c:2218:30::5) 56 data bytes
64 bytes from 2001:67c:2218:30::5: icmp_seq=1 ttl=58 time=7.60 ms
64 bytes from 2001:67c:2218:30::5: icmp_seq=2 ttl=58 time=7.31 ms
64 bytes from 2001:67c:2218:30::5: icmp_seq=3 ttl=58 time=7.28 ms

--- www.nic.fr ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 7.281/7.401/7.605/0.145 ms

And also outside-generated (I can ssh into the node with ssh -6 from the outside).

I cannot believe I'm the only one running an Ethereum node with IPv6 (but can I find somewhere authoritative info about that? In peer-to-peer networks, you cannot easily analyze all the nodes).

Is there a limit in the peer discovery protocol? Or some bug/bias that prevent IPv6 addresses to be selected?


texts:
It seems that etherscan's kovan tesnet has some problems?
the block of etherscan fell behind others!!

Is there another kovan testnet browser??


texts: How get public address from State Root leaf node (code inside)?

texts:
In article "Understanding the ethereum trie"is written that:

  For the state trie, the keys are ethereum addresses.

So i obtain State Trie and in that trie I got Merkle Leaf node:

['9:', ' LEAF      ']
    Node place in DB (raw) : �|\n���0�)�6ed��/���}5�<�+P�-��
    Node place in DB (hash): f87c0a7fa396f130d62912c4366564efc72f94fa937d35b13cbc2b50b92df5d0
    Node data  in DB (raw) : �q� "�cA]{�C����u��^b-�3j}��Q;�d_�N�L��\rඳ�d�V��U���E���n[H��l��b/��c�!���F��#<�~}������Sʂ';{��]��p
    Node data  in DB (data): [' "\xfdcA]{\xc4C\x9e\x96\x91\xb0u\x0e\xce\x04\xb1^b-\xc53j}\xff\xf6Q;\xdad_', "\xf8L\x80\x88\r\xe0\xb6\xb3\xa7d\x00\x00\xa0V\xe8\x1f\x17\x1b\xccU\xa6\xff\x83E\xe6\x92\xc0\xf8n[H\xe0\x1b\x99l\xad\xc0\x01b/\xb5\xe3c\xb4!\xa0\xc5\xd2F\x01\x86\xf7#<\x92~}\xb2\xdc\xc7\x03\xc0\xe5\x00\xb6S\xca\x82';{\xfa\xd8\x04]\x85\xa4p"]

        Unpacking merkle tree node from DB data:
        Key    : 2022fd63415d7bc4439e9691b0750ece04b15e622dc5336a7dfff6513bda645f (this is wallet?)
        Data 0 :
        Data 1 : 0de0b6b3a7640000 (250 Eth)
        Data 2 : 56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421
        Data 3 : c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470

When i open my local private blockchain in Geth, i really see that address

  0x234132b22de7037e50b9fc4ebd7476315647869e

has

  250 Eth

So i thing, that output key in my code:

  2022fd63415d7bc4439e9691b0750ece04b15e622dc5336a7dfff6513bda645f

is that address

  0x234132b22de7037e50b9fc4ebd7476315647869e

But i din't know how to get from 2022fd6... hash 0x23413... wallet.
How to do that?


texts: Metamask Unable to send transactions to Ethereum private network


texts: Storing an address in nested mapping does not work

texts:
Why doesn't this work?

contract NameRegistry {

  function NameRegistry() {
    // names["users"]["stefreak"] = 0x123;
  }

  function register(address record, string namespace, string name) returns (bool success) {
    if (names[namespace][name] > 0) {
      return false;
    }

    names[namespace][name] = record;
    return true;
  }

  function lookup(string namespace, string name) returns (address record) {
    return names[namespace][name];
  }

  // namespace => name => address
  mapping(string => mapping(string => address)) names;
}

When uncommenting the line in the constructor, lookup works.
When using register with the same parameters (0x123, "users", "stefreak") it does not work. I don't see why.

Here are my tests:

contract('NameRegistry', function(accounts) {
  it("can be used to register names.", function(done) {
    var registry = NameRegistry.deployed();

    registry.register.call(accounts[0], "users", "stefreak").then(function(registered) {
      assert.equal(registered.valueOf(), true, "register name was not successfull")

      return registry.lookup.call("users", "stefreak")
    }).then(function(address){
      assert.equal(address.valueOf(), accounts[0], "lookup did not give back the registered address")
    }).then(done).catch(done);
  });
});


texts: Invalid Address Error when interacting with a smart contract & Why it works with metacoin

texts:
I solved the error accroding to Invalid Address solution

  PriceContract.web3.eth.defaultAccount=PriceContract.web3.eth.coinbase

The contract I run was a very simple set-get variable which I adapted according to the truffle metacoin sample.

My question is: why metacoin runs ok and my contract needs to assign the defaultAccount?

In both cases I run the contract against a local geth node.


texts:
In solidity do i return an array or structs in bytes.

This is not a duplicate of this question because that solution always returns the error: new BigNumber() not a number: [object Object]

pragma solidity ^0.4.2;
contract Something {
    mapping (address => Ton[]) allTons;

    struct Ton {
        uint id;
        string name;
        bool access;
    }

    function Something() public {
        allTons[msg.sender].push(Ton({
            id: 1,
            name: "CoolDude",
            access: true
        }));
        allTons[msg.sender].push(Ton({
            id: 2,
            name: "NotCoolDude",
            access: false
        }));
    }

    function GiveBytes() public constant returns(bytes){
        // unsure

    }

}


texts: How to read values of Struct in Solidity contract?

texts:
I have developed the following smart contract and try to test it via the truffle js console:

pragma solidity ^0.4.2;

contract AddressRatings {

struct Rating {
    mapping ( address => uint8 ) ratings;
    uint256 amtOfRatings;
    uint256 sumOfRatings;
    uint8 average;
}

mapping ( address => Rating ) public ratings;

function rateAddress (address _addr, uint8 _rating) external {
    require(_rating > 0 && _rating < 6); // only ratings from 1 to 5 are allowed
    require(ratings[_addr].ratings[msg.sender] == 0); // a sender can rate someone else only once
    ratings[_addr].ratings[msg.sender] = _rating;
    ratings[_addr].amtOfRatings++;
    ratings[_addr].sumOfRatings += _rating;
    ratings[_addr].average = uint8(ratings[_addr].sumOfRatings/ratings[_addr].amtOfRatings);
}

}

I'm able to get an instance of the contract and call the method rateAddress. Also I can retrieve an object of ratings mapping. However, I don't know how to read the attributes of the returned Rating struct.

Whatever I try returns undefined e.g. ratingsObj1,  ratingsObj['average'],  ratingsObj.average

Also, it seems that the mapping within the struct does not to work, although it compiles...

Any hint is appreciated!

P.S.: Suggestions how to make this contract more efficient are very welcome.


texts:
Basically I followed the code and full code tutorials to create tokens on TESTNET. Contracts show as created but no tokens exist.

First I increased all gas, then I tried following prior errors here:
Following token tutorial on ethereum.org, get error message "No data is deployed on the contract address"

I've tried with or without mods in  this fix done last year but no difference.

Heres a hash error message.

https://testnet.etherscan.io/tx/0x0b714025a02eca2763f2a5c43364da07f7484ed04cd83947e31324e57e3199dd

Really trying to adopt this ETH proof of concept but seem to hit a wall

Heres the code I'm using. http://ethereum.org/token#the-code its from the "The code" tutorial section of Ethereum's Creating your own cryptocurrency page. Had links before but as a noob was limited to 2 links per post. The constructor parameters are Supply: 10000 Name:EATEST Symbol: ETR2 Decimals:2 code starts with

pragma solidity ^0.4.2;

    contract tokenRecipient {

    function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData);

    }
}

I click Deploy button,sign and after creation, it displays the red "No data is deployed.."


texts:
In the original github issue  for geth --fast feature karalabe writes:

  After a node managed to successfully sync with the network, fast sync is forever disabled.

Is there a way to circumvent this? I don't want to run the full node all the time, I want to check my wallet every other few weeks and the full sync takes forever.


texts: Contract execution fails with Web3 but works with Remix

texts:
I am dealing with a very simple smart contract:

contract MyRegistry {

    struct MyEvent {
        string date; // yyyy/mm/dd
        string desc; // potentially long string
        uint count;  // <= 10000
        bool recorded;
    }

    event Record(bytes32 hash, string desc, uint count);

    function record(bytes32 hash, string date, string desc, uint count) external {
        if (registry[hash].recorded)
            throw;
        registry[hash] = MyEvent(date, desc, count, true);
    }

    mapping (bytes32 => MyEvent) public registry;
}

Now, when trying to call record method from Remix (using MetaMask), everything is ok, contract execution is successful, using the following input:

"10f2e5c1bacf028b41415d0868d5892218df0a4398f0f3ac729e0ac3ac6ed11a", "2016/03/21", "my long description of at least 30 chars", 9876

While, using web3 always fails:

var EthTX = require('ethereumjs-tx')
[...]
var calldata = Registry.record.getData(hash, date, desc, count)
[...]
var transaction = new EthTX({
    to: registry_address,
    gasLimit: 4000000,
    gasPrice: +web3.toWei(10, 'gwei'),
    nonce: myNonce, // previously fetched, problem is not here
    data: calldata,
})

NOTE[0]: I voluntarily omitted the JS code used to sign and send the transaction because the problem is not there. The transaction gets submitted and mined successfully. The problem is during contract execution.

NOTE[1]: I've already tried using bytes instead of string for storing date and desc, but no luck, still the same: works on Remix, does not work with Web3. Also, cannot be lack of gas, otherwise the same tx would fail on Remix too.

Here is the env:

Ubuntu 16.04
Node 7.6.0
web3 0.18.4
ethereumjs-tx 1.3.0
ethereumjs-util 5.1.1
I must generate and sign txs with ethereumjs-tx

Any help is appreciated, thanks.


texts: How to get v,r,s parameters from transaction receipt in remix ide?

texts:
I am trying to get v,r,s parameters of a transaction so that I can use them to verify the signature.
I am not sure but I think previously remix used to give these parameters in transaction receipt.
I don't want to go for any js script to get the parameters. I want to use only remix.

Can I use remix console to get these parameters?
I tried web3 in browser console using metamask but it is giving error as Invalid JSON RPC.
Thanks for any help!


texts: Can't send out transactions with Mist wallet

texts:
All of a sudden on Sunday I started having problems sending ETH out of my Mist wallet. I'm still confirming transactions coming in, and it appears synced just fine.

The transactions never confirm, and I dont get charged for them either. They don't show up on Etherscan either. Here's an example.

After a bit (like 20 minutes?), the pending transaction dissappears, with the message that The transaction from Main account (Etherbase) to 0xA3c55cDEF38319E613F7B0593b224448944A9B1d couldn't be successfully executed.

Seems to happen when choosing any amount, with any fees/gas, and any address I send it to. I saw another post that reccomended to sync my time with NIST, which I did. Didn't seem to help.

Thanks for any help you can provide.


texts:
I am using solidity extension by Juan Blanco.

pragma solidity ^0.4.17;

contract Inbox
{
    string public message;

    constructor(string initialMessage) public {
        message = initialMessage;
    }

    function setMessage(string newMessage) public {
        message = newMessage;
    }
}

I get the error message "Source file requires different compiler version (current compiler is 0.7.4+commit.3f05b770.Emscripten.clang) - note that nightly builds are considered to be strictly less than the released version"
I am getting too many error messages / warnings if I do pragma solidity >=0.4.17; so I prefer 0.4.17.


texts: Get list of tokens balances from wallet address via web3?

texts:
I'm using web3 to get the balance of a single token/contract address within my wallet address.
If I have an array of tokens eg
[
    "0x2a9718deff471f3bb91fa0eceab14154f150a385",
    "0xad90c05bc51672eedfee36e58b3ff1a78bbc146d",
    "0x33a3d962955a3862c8093d1273344719f03ca17c",
    "0x85102c0062aa918cb9e26d94a284aafca602df13"
]

Is there a possibility to pass that array into a single call that retrieves the balance for each? Or would we need to iterate through the list one by one?


texts:
pragma solidity ^0.4.19;
contract Test {
    address one;

function Test(address _one) public {
    one = _one;
}

function send1() public payable {
    one.transfer(10);
}

function send2() public payable {
    require(msg.value > 0);
    one.transfer(msg.value);
}

function get() public view returns (address) {
    return one;
}

}

I'm trying do a simple smart contract in remix to transfer a fixed value of ether to the address 'one'. The funcion send2() is working but the function send1 is not.
Thanks


texts: How to fix Your transaction may be frontrun on Uniswap?

texts: What does it means for a transaction to get frontrun? It appears when i set my slippage to 10%


texts: how to test overloaded function in truffle?

texts:
I recently upgraded truffle to the newest version. Now it does not automatically detect overloaded functions anymore. Before, I could just do the following:

await contract.function({
  from: accounts[0],
  value: web3.utils.toWei("0.5", "Ether")
});

await contract.function(param1, param2, {
  from: accounts[0],
  value: web3.utils.toWei("0.5", "Ether")
});

Now it seems that I have to specify the parameters in a syntax like the following:

await contract.function['uint256', 'uint256'](param1, param2, {
  from: accounts[0],
  value: web3.utils.toWei("0.5", "Ether")
});

But how can I declare the first function version without parameters? Doing this: contract.function[''](...) produces the error contract.function is not a function. Not declaring anything via [] produces the same error as well.

Also the parameters for the overloaded functions are two arrays. One address[] array and one uint256[] array. I already tried:

contract.function["address[]", "uint256[]"](addressList, uintList, {...})

which doesn't work. It produces the same error.

I also didn't find any information about this in the truffle documentation.


texts: Revealing bid for .eth domain doesn't work

texts:
I placed a bid on an .eth domain and now the revealing period started. I revealed my bid according to this documentation:

https://docs.ens.domains/en/latest/userguide.html#revealing-your-bid

with the following command:

ethRegistrar.unsealBid(web3.sha3('name'), web3.toWei(1, 'ether'), web3.sha3('mypassword'), {from: eth.accounts[0], gas: 500000});

After I executed the command in geth I got a hash. When I enter the hash in etherscan.io I don't see any transaction there. If I check the domain on registrar.ens.domains the Current highest bidder is still 0.

What am I doing wrong here?


texts: getting Error: Invalid JSON RPC response: "" when calling getBalance from web3 js library

texts:
I'm exploring web3 following instructions from the docs and running the code below. The function throws with the error message being: Error: Invalid JSON RPC response: ""
For context the code below works when running a local node script, but gives me the error when running in a Node 8 environment hosted by firebase.
What am I doing wrong and can anyone explain what it means?
const web3 = new Web3(new Web3.providers.HttpProvider("https://mainnet.infura.io/v3/<project ID>"))
const weiBalance = await web3.eth.getBalance("0x52bc44d5378309EE2abF1539BF71dE1b7d7bE3b5")
console.log(weiBalance)


texts: Strict Balance Equality (Security Issue)

texts:
Research Paper, Page-5(Strict Balance Equality)I have read that attacker can use Selfdestruct() and forcibly send ethers to  the contracts.
My questions are:
If Selfdestruct is meant for owner of smart contract only, how can the attacker use Selfdestruct()?
How greater than or less than preventing the attacker from misusing the Selfdestruct?


texts: In a rental agreement payRent function is not working or not updating on MIST!

texts:
I want to implement a Car rental agreement.

In Customer contract there in stract with 4 field. And a registerToProvider function. In Provider contract there are two function to set rent and registration fee. All these are working fine. If a customer register to provider service, and provider set some rent and registration fee it works and in MIST it shows.

But when customer call the payRent or payRegistration fee these are not working and no update on MIST. can u please check my code and say what is the problem.

contract CarRentalServiceCustomer is GeneralAccount{
    string public customerName;
    string public postalAddress;
    string public phoneNumber;
    string public emailAddress;

    mapping(address=>CarRentService) public rentCar;

    struct CarRentService{
        bool active;
        uint lastUpdate;
        uint registrationFee;
        uint rent;
    }

    function CarRentalServiceCustomer(string _name,string _postalAddress,string _phoneNumber,string _emailAddress){
        customerName  = _name;
        postalAddress = _postalAddress;
        phoneNumber   = _phoneNumber;
        emailAddress  = _emailAddress;
    }

    function registerToCarRentalServiceProvider(address _providerAddress) onlyOwner {

        rentCar[_providerAddress] = CarRentService({
                                    active: true,
                                    lastUpdate: now,
                                    registrationFee: 0,
                                    rent: 0
                                    });
    }

    function setRegistrationFee(uint _registrationFee) {
        if(rentCar[msg.sender].active){
            rentCar[msg.sender].lastUpdate      = now;
            rentCar[msg.sender].registrationFee = _registrationFee;
        }
        else{
            throw;
        }
    }

    function setCarRent(uint _rent) {
        if(rentCar[msg.sender].active){
            rentCar[msg.sender].lastUpdate = now;
            rentCar[msg.sender].rent       = _rent;
        }
        else{
            throw;
        }
    }

    function payRegistrationFeeToCarRentalServiceProvider(address _providerAddress) returns (bool){

        bool regFeeStatus = true;
        if(_providerAddress.send(rentCar[_providerAddress].registrationFee))
        {
            rentCar[_providerAddress].registrationFee = 0;
            return regFeeStatus;
        }
        else{
            return !regFeeStatus;
        }
    }

    function payRentToCarRentalServiceProvider(address _providerAddress) returns (bool){

        bool payStatus = true;
        if(_providerAddress.send(rentCar[_providerAddress].rent))
        {
            rentCar[_providerAddress].rent = 0;
            return payStatus;
        }
        else{
            return !payStatus;
        }
    }

    function unsubscribeFromCarRentalService(address _providerAddress){
        if(rentCar[_providerAddress].active = false && rentCar[_providerAddress].rent == 0
        && rentCar[_providerAddress].registrationFee == 0 ){
            rentCar[_providerAddress].active = false;
        } else {
            throw;
        }
    }
}

when i call these function the transaction works properly but status is not changing. Kindly see the below image. I want after sending the rent both rent and registration fee will be 0.


texts: How to prevent a replay attack between two competing chains?

texts:
After the recent hardfork we have a winning chain and a much shorter losing chain left. However, if you are pro or agains the fork, you could still mine and use one chain or the other.

Now, there is an issue. Let's assume I'm on the non-fork chain and create a transaction, sign it and broadcast it to the non-fork network. Vitalik warned users to be aware of replay attacks:

  If any users continue to be interested in following the non-fork chain, they should still update, but run with the --oppose-dao-fork flag enabled, though they should beware of transaction replay attacks and take appropriate steps to guard against them; users with no interest in the non-fork chain do not need to worry about transaction replay attack concerns.

Now I understand the transaction would be valid on both chains. How do I prevent the transaction from being broadcasted on the pro-fork network. And how do I prevent the transaction to be valid on the pro-fork chain?


texts:
I'm trying to test a simple payment contract according to the truffle tutorial, but not able to get it working. Would appreciate your guidance on how to get account balances (that seems to be the broken step here)?

Pay.sol

pragma solidity ^0.4.17;

/// @title Pay - Facilitates payments.
contract Pay {
    event Payment(
        address _from,
        address _to,
        uint amount
    );

    /// @dev Makes a payment.
    /// @param _to Address to pay to.
    function pay(address _to) public payable {
        require(msg.value > 0);
        // Does this transfer the right amount of ether (msg.value measured in wei)?
        _to.transfer(msg.value);
        Payment(msg.sender, _to, msg.value);
    }
}

2_pay_migration.js

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

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

pay.js

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

contract('Pay', function(accounts) {
    it("should put 10000 wei in the first account", function() {
        return Pay.deployed().then(function(instance) {
            pay = instance;
            //console.log(pay.estimateGas());
            return pay.getBalance.call(accounts[0]);
        }).then(function(balance){
            startingBalance = balance;
            return pay.pay(accounts[1], 2500, {from: accounts[0]});
        }).then(function() {
            return pay.getBalance.call(accounts[0]);
        }).then(function(balance) {
            assert.equal(startingBalance, balance);
        })
    });
});

When running truffle test, the code breaks with the following error:

  1) Contract: Pay should put 10000 wei in the first account:
     TypeError: Cannot read property 'call' of undefined
      at test/pay.js:8:35
      at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:118:7)


texts: How I can to change path for blockchain data for Parity wallet on linux mint 18.2?

texts: I'm the newbie on Linux and blockhain.  I'm have installed Linux on the small piece of my hard drive (50 GB), so I want to know how to change the directory for blockchain data on my external hard drive.  I use Linux Mint 18.2.


texts: How to differentiate a smart contract from a common wallet?

texts:
Having an Ethereum address, I need to check whether it is a wallet or a token (ERC-20 contract).

How to check? (I need to implement it with Web3js.)

Ideally, it should also reject contracts which are not ERC-20.


texts: 405 Method Not Allowed with websocket geth RPC

texts:
curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: XXXXXXX" -H "Origin: https://XXXXXXX/" -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' https://XXXXXXX/
HTTP/2 405
server: nginx/1.18.0
date: Fri, 26 Feb 2021 13:56:20 GMT
content-type: text/plain; charset=utf-8
content-length: 19
sec-websocket-version: 13
x-content-type-options: nosniff

Method Not Allowed

geth is running with websockets enabled with the following settings: --ws --ws.port 8546 --ws.api eth,net,web3 --ws.origins '*' --ws.addr 0.0.0.0 and is behind an nginx reverse proxy:
    location / {
        proxy_http_version 1.1;
        proxy_set_header Upgrade "websocket"; # $http_upgrade;
        proxy_set_header Connection "upgrade"; # $connection_upgrade;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://XXXXXX;
    }

I have also tried eth version command, same result. Same error when I connect to the websocket directly, not through nginx.


texts: Is it possible to use ganache blockchain when I deploy my web app in heroku? or should I deploy the contract first to a test network?

texts:
const web3 = new Web3(
  new Web3.providers.HttpProvider(
    "https://kovan.infura.io/v3/INFURA_KEY"
  )
);
const abi = JSON.parse(
  '[ { "constant": false, "inputs": [ { "internalType": "string", "name": "_patientId", "type": "string" }, { "internalType": "string", "name": "_medicalHistoryId", "type": "string" }, { "internalType": "string", "name": "_medicalHistory", "type": "string" } ], "name": "insertMedicalHistory", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "internalType": "string", "name": "_patientId", "type": "string" }, { "internalType": "string", "name": "_recordId", "type": "string" }, { "internalType": "string", "name": "_record", "type": "string" } ], "name": "insertRecord", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [ { "internalType": "string", "name": "_patientId", "type": "string" }, { "internalType": "string", "name": "_medicalHistoryId", "type": "string" } ], "name": "getMedicalHistory", "outputs": [ { "internalType": "string", "name": "", "type": "string" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "internalType": "string", "name": "_patientId", "type": "string" }, { "internalType": "uint256", "name": "_dataIndex", "type": "uint256" } ], "name": "getMedicalHistoryId", "outputs": [ { "internalType": "string", "name": "", "type": "string" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "internalType": "string", "name": "_patientId", "type": "string" }, { "internalType": "string", "name": "_recordId", "type": "string" } ], "name": "getRecord", "outputs": [ { "internalType": "string", "name": "", "type": "string" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "internalType": "string", "name": "_patientId", "type": "string" }, { "internalType": "uint256", "name": "_dataIndex", "type": "uint256" } ], "name": "getRecordId", "outputs": [ { "internalType": "string", "name": "", "type": "string" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "internalType": "string", "name": "_patientId", "type": "string" } ], "name": "totalMedHis", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "internalType": "string", "name": "_patientId", "type": "string" } ], "name": "totalRecord", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" } ]'
);
const contractInstance = new web3.eth.Contract(
  abi,
  "0x6De8Ec028eb57417Db911AdcE4b6D96a5A2bBF57"
);

//SAMPLE INSTANCE IN MY REST API

     contractInstance.methods
        .insertMedicalHistory(req.params.id, medHisId, ciphertext.toString())
        .send({
          from: "0xE9Ca8E74b607234AbF2040b5711b4F218cA84b40",
          gas: 6721975
        });

I deployed my contract in kovan, is this correct? are there any mistakes? then I will use that instance to send something in the blockchain. However, when I tried it. It was not inserted in the blockchain.


texts: Get logs for contracts with specific abi

texts: I only want logs on contracts that implement the ERC-20 ABI. That means, no logs can come from ERC-721 or any other type. How can this be done? I am using the eth_logs function but am open to using something else if need be.


texts: Interacting with trade/order function which require sha3 hash

texts:
I'm currently building a dapp that use both of theses functions :

function order(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce) {
    bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
    orders[msg.sender][hash] = true;
    Order(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, msg.sender);
  }

  function trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount) {
    //amount is in amountGet terms
    bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
    if (!(
      (orders[user][hash] || ecrecover(sha3("\x19Ethereum Signed Message:\n32", hash),v,r,s) == user) &&
      block.number <= expires &&
      safeAdd(orderFills[user][hash], amount) <= amountGet
    )) throw;
    tradeBalances(tokenGet, amountGet, tokenGive, amountGive, user, amount);
    orderFills[user][hash] = safeAdd(orderFills[user][hash], amount);
    Trade(tokenGet, amount, tokenGive, amountGive * amount / amountGet, user, msg.sender);
  }

I'm able to list the multiple events arguments in Order, but I'm not able to generate the data let's say for checking if order exist.

Is that the correct what to generate the hash? I suppose this (bytes32 hash = sha256(this)) is the sender address?

var orderhash = web3.sha3(user, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);

EDIT: I understood that web3.sha3 don't act as the sha3 from solidity. Still, I'm not able to get it work the correct way and I can't install node module


texts: Rubix vs Blockapps vs others, what are the differences in private Ethereum platforms?

texts: What are the major differences between the different private Ethereum platforms? The main two that I am aware of are Rubix and Blockapps, what are the primary differences?


texts: Is it possible to deduct token amount from wallet 1 day after tx confirmation?

texts:
I am lately confirming many of transactions and contract interactions through metamask using ledger, doing some swaps through different services. I am worried because I don't know what exactly I confirmed in the past.
So I am wondering if something bad could happen, this would happen only when transaction is confirmed and I would already know, correct? Or can somebody empty my wallet also afterwards (days after I signed transaction) if I signed some contract?


texts: Error in external function parameter defination for an interface

texts:
Dear community members,

I have come across an error while defining an interface (just using the standard one interface ERC721TokenReceiver)

this interface is mentioned in this link https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md

I was receving below error (Please find the screenshot)
Data location must be "calldata" for parameter in external function, but none was given.

the strange part was when I have changed bytes to bytes32 then error had gone. But I m in doubt

1) What was the reason for error

2) should i deviate  from std guideline for defining the interface

Br
Dev


texts:
I would like to get something similar to solidity

block.number - 1

using Nethereum

BlockParameter.CreateLatest()

Is latest here mean the Last BlockNumber been mined? Or do I need to minus 1?


texts: Greeter Contract - deploy command results in "undefined"

texts:
I am trying to deploy the Greeter contract on a private test chain following this guide (Deploying the Greeter contract via the geth CLI is not registering in my private blockchain)

When I get to the "var greeter =" command pasted below, it runs but only ever returns "undefined", it does not look like the contract ever deploys.

Can anyone point me in the right direction please

thanks,
P

var greeter = greeterContract.new(_greeting, {from: eth.accounts[0], data: greeterCompiled["<stdin>:greeter"].code, gas:20000000000}, function(e, contract) {
  if (!e) {
   if (!contract.address) {
     console.log("Contract transaction send: TransactionHash: " + contract.transactionHash + " waiting to be mined...");
   } else {
     console.log("Contract mined! Address: " + contract.address); console.log(contract);
   }
  }
})


texts: why are return values only True or False

texts: Return values from functions which create transactions,  can only be true or false, at least when you check them post transaction (e.g., with web3 through receipt). However, when functions call each other on the EVM, even through external function calls, multiple non-boolean return values can be passed on from function to function. Why is that?


texts:
Which exchanges are currently the best and easiest to list ERC-20 tokens on?

Hello,

I am issuing ERC-20 tokens at the moment.

Which exchanges are the best and easiest to list tokens on at the moment? Preferably in just one or a few steps.

Vesa


texts: Creation of a whitelist in a private network with Rinkeby Clique PoA?

texts:
I'd like to create a private network where I would limit the creation of smart contracts to a whitelist of accounts.
Is there any option for this?


texts: I just want to make sure I understand things correctly. On remixed I have a contract A with a pure function f. When I tried to call it the cost is non-zero with the explanation "(Cost only applies when called by a contract)". Does it mean that when a contract calls a pure/view function  (either from inside the contract or from some other contract) it would still have to pay for gas? Thanks.


texts:
I try to send from ERC-20 to other ERC-20 via interledger in ganache , but get this error:

     {
 <     "id": 3451,
 <     "jsonrpc": "2.0",
 <     "error": {
 <       "message": "VM Exception while processing transaction: revert ERC20: transfer amount exceeds balance",
 <       "code": -32000,
 <       "data": {
 <         "stack": "c: VM Exception while processing transaction: revert ERC20: transfer amount exceeds balance\n    at Function.c.fromResults (/app/ganache-core.docker.cli.js:2:257479)\n    at e.exports (/app/ganache-core.docker.cli.js:53:1406305)",
 <         "name": "c"
 <       }
 <     }
 <   }

(but Im shure that balances are full I cheked them by truffle)


texts: Migrating a token from Counterparty to Ethereum

texts:
I am having a token in Counterparty blockchain and I'd like to migrate it over to Ethereum. The token is currently being traded on some of exchanges.

What strategies there are to take here? Are there any past examples?

I was thinking

Taking a blockchain snapshot and crediting Ethereum tokens to users to an address with a matching public key on Ethereum chain
Having a special address where Counterparty tokens are send to be burned, then have a bot to read the transactions and issue corresponding tokens to a given public address on Ethereum chain


texts: Block an account in a permissioned blockchain environment

texts:
We are developing a permissioned blockchain environment with Ethermint.
Companies have to apply to join the blockchain environment, we create and give them their Ethereum account.

One of the main concerns is how to remove or block an account from the environment if it turns out this company isn't playing nice.

We thought of flagging the organization contract, or destroying it, but then you would have to put a modifier on almost every method AND they can still commit transactions with their Ethereum account.

I'm not sure it is even possible to block such account from a permissioned blockchain environment, because, well, that is what decentralisation is about obviously :-)
But maybe there is a work around, or a "pattern" to use here.


texts:
I am generating transactions in a contract I deployed in the Rinkeby network and the first 300 or 400 transactions had no errors and I received the txHash, but when I continued I got this following error. My application is developed with web3j and java

java.lang.RuntimeException: Error processing transaction request: replacement transaction underpriced Output from Server


texts: is not a function at HTMLInputElement.onclick error

texts:
I have this error  > App.validate is not a function
    at HTMLInputElement.onclick

The code is here :

i get error in the last ( >) input type="submit" name="submit" onclick="App.validate()"


texts: OpenZeppelin - deploy crowdsale from Remix - wallet address

texts:
I am deploying a basic crowdsale using:
// SPDX-License-Identifier: MIT
pragma solidity ^0.4.18;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v1.6.0/contracts/crowdsale/Crowdsale.sol";

I have no idea which address to deploy as a wallet, as below.  Any help is greatly appreciated.


texts:
I am trying to access my Geth node (specifically a smart contract at a particular address) running on a remote server from my UI (Angular JS)

It works perfectly when using localhost or the ipv4 address on the same machine.

When trying to run the same code using the public IP address (ports are open), I am getting an error:

Error: CONNECTION ERROR: Couldn't connect to node http://xxx.xxx.xxx.xx:8585.

My code is as follow:

var Web3 = require('web3'); var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider('http://x.x.x.x:8888'));

I have tried the following:

1) tried with local host or ipv4 at x.x.x.x
2) tried with 0.0.0.0 at x.x.x.x
3) public ip at x.x.x.x

My Geth command is:

geth  --rpccorsdomain "*" --rpc --rpcport "8585" --rpcaddr 0.0.0.0 --datadir="myChain" --port "30302"  --autodag --networkid 65535 --nat=none -
-rpcapi="db,eth,net,web3,personal,web3"  --nodiscover -verbosity 5 --maxpeers 3
console

Any suggestions?
Thanks in advance.


texts: There are multiple default accounts that are provided by the online Solidity IDE (remix). If I want to store those addresses in a variable, which data type can I use?


texts: How do I create a passphrase for Ethereum account on Alchemy/Infura?

texts:
I want to run a livepeer node and for that I have to run a command:
livepeer -network mainnet -ethUrl https://eth-mainnet.alchemyapi.io/v2/<project_id> -transcoder
When I run the above command, replacing my project id with the placeholder, it asks me the following:
Please enter the passphrase to unlock Ethereum account <eth_account>
I created a free version from Alchemy and have not created any passphrase for my ETH account.
Exactly the same issue arose with Infura.
How to create a passphrase for ETH account or how to bypass this in order to run livepeer?


texts: Can one read the contents of a private variable in a contract outside the contract?

texts:
Can one view (externally) the contents of a private variable defined in a contract? Or, the only way one can view (externally) is by declaring the variable public or having an external function returning its value?
Asking because I know that even if a variable is declared private it still resides on the public blockchain so wanted to confirm if there are any other ways to read the variable like via eth.getStorageAt() API or something.
If the answer to this question is 'Yes' then please also tell me how can I do it.
I have seen elsewhere on this site people mentioning it's possible but nowhere it's described how. It's also mentioned that it can be seen outside the contract in a blockchain explorer like etherscan.io etc. but I haven't been successful so far.
For example, I have the below solidity contract:
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.7.4;

contract Test {

    uint private balance;

    string public name;

    constructor() payable{
        balance = 22;
        name = "Ross";
    }

    function updateBalance(uint _balance) external {
        balance = _balance;
    }

    function updateName(string calldata _name) external {
        name = _name;
    }
}

deployed on Kovan test network here:  https://kovan.etherscan.io/tx/0x44084a920eb995ba66c91b9f54b03096a9403c7519b35619a4d9650c64d2533b but I am not able to figure how to read the value of balance on etherscan.


texts: I have created a node in quorum-maker using my ip address but that node is not starting.If i create a node using local ip(127.0.0.1), node starts.why?


texts: web3.py event listener functionality doesn't catch events

texts:
I want is to listen to the event "IPFSHash" defined in a Solidity contract in a python module using web3.py (with blockchain created by ganache-cli, transactions triggered through Remix IDE also connected through Web3 Provider). I tried using this construct:

event_filter = my_contract.events.IpfsHash.createFilter(fromBlock='latest')
while{True}:
    event_filter.get_new_entries()

However, I don't get any new entries in the filter when triggering the event through Remix. I can however call the getHash function to confirm that the value of "hash" is changed in the contract and the event has been emitted (full code below).

Thanks!!!

Web3.py code:

import json
from web3.providers.rpc import HTTPProvider
from web3 import Web3
import time

w3 = Web3(HTTPProvider('http://localhost:8545'))
contract_address =
Web3.toChecksumAddress("0xa293277dcd6f2e98ba63583fb81ed72f7555c8ef")

with open('contract_abi.json', 'r', encoding='utf-8') as abi_file:
    contract_abi = json.loads(abi_file.read())

my_contract = w3.eth.contract(address=contract_address, abi=contract_abi)

event_filter = my_contract.events.IpfsHash.createFilter(fromBlock='latest')

poll_interval = 2

def handle_event(event):
    print("Event triggered")

while True:
   print("New entries: ", len(event_filter.get_new_entries()))
   for event in event_filter.get_new_entries():
       handle_event(event)
   print("Get Hash:", contract.functions.getHash().call())
   time.sleep(poll_interval)

Solidity contract code:

pragma solidity ^0.4.21;
contract HashEventTest{
    bytes public hash;

    event IpfsHash(
        bytes ipfs_hash,
        address sender
     );

    function HashEventTest(bytes _hash) public {
        hash = _hash;
    }

    function setHash(bytes _hash) public {
        hash = _hash;
        emit IpfsHash(hash, msg.sender);
    }

    function getHash() public constant returns (bytes){
        return hash;
    }
}


texts: Parity create testing transactions and blocks

texts:
For test purposes, I would like to make test blocks including test transactions against main net.

For example I would like to make a transaction that sends one ether from 0x1234567... to 0x99999999... Assume for a minute that 0x1234567... does actually on main net have one ether plus gas fees available to send.

I would like to:

Disconnect from network syncing
Prepare this send transaction
Sign it (using a bogus private key)
Mine a block on my client including that transaction (using a difficulty=0 proof of work)

This would require to temporarily disable two security features of Parity to make this work:

Transaction signature checking
Block proof of work difficulty checking

Is it possible to perform testing in this way?


texts: Switch between accounts to run smart contracts

texts: I'm using truffle develop to test my smart contracts. I've tried to switch between different accounts using web3.eth.defaultAccount = web3.eth.accounts[1] but had no success. How do I accomplish that?


texts:
I'm new to the mining business and am just trying to calculate some profitability as an exercise.
I'm looking at this Bitmain S17 Pro mining rig: https://shop.bitmain.com/promote/antminer_s17pro/specification
In it's specifications, it says it 50 TH/s hash rate with a power consumption of 2250W.

Plugging this into a ETH mining profitability calculator, I get:

Seems I can make $100M+ per month??
Obviously I'm missing something here. Can anyone help me understand why my calculations are incorrect?


texts: Synchronisation failed, dropping peer valid and Impossible reorg

texts:
I'm working on a project called Rubykube Workbench. But the "ethereum/client-go:Stable" container gives error.

System information

Geth version: 1.8.23-stable-c9427004 (docker container)
OS & Version: Ubuntu 14.04 (Hyper - V)
Project-Commit : (RubyKube Workbench - 658c806`)

Expected behaviour

Actual behaviour

It doesn't look ethereum here. (0)

ethereum/client-go:Stable log

Thank You :)


texts: Can you emit events in a contract constructor?

texts: I have a constructor that is emitting an event, but cannot seem to see/catch/filter that event after deployment.


texts: What's the advantage of EthOS over Ubuntu or Windows mining?

texts:
What exactly is the EthOs Distro? As far as I understand it's an ethereum-dedicated linux. Why should someone want to use it?

What's the advantage of EthOS over Ubuntu or Windows? What are the features? Better mining?


texts: Creating a new wallet mobile application for newly created crypto currency

texts:
I am doing as a Intern in Apogee Tech Global in Bangalore on Blockchain for three months.
My commitments is to learn solidity language, build smart contracts, learn Ethereum and Hyperledger.
I learnt solidity language. I haven't yet practised more on solidity. Just learnt.
By using ERC20, I have created a new crypto currency in ropsten test network and also verified in ether scan.
I can also create real crypto currency in main ethereum network if ethers are available.

But, here the company employee told me to practise on solidity more. Also learn UI develpment part parallelly.
To do UI part, they said to learn Javascript.
I learnt javascript in codecademy. Now I am going through React.js.

Now, based on above criteria. Please suggest me the best path and suggestions to learn the required technologies to develop a crypto wallet and to build UI in prior time.


texts: TypeError: Data location must be "storage" or "memory" for parameter in function, but none was given

texts:
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
    internal
    returns (uint transactionId)
{
    transactionId = transactionCount;
    transactions[transactionId] = Transaction({
        destination: destination,
        value: value,
        data: data,
        executed: false
    });
    transactionCount += 1;
    Submission(transactionId);
}

In In  function addTransaction(address destination, uint value, bytes data)

With underlined  the byte data parameter


texts: How dangerous is this: number of contracts contain a function like "approveandcall" which lets anyone call any contract (some thoughts?)

texts:
The most common implementation is as follows:

function approveAndCall(address _spender, uint256 _value, bytes _extraData)  public returns (bool success) {
    tokenRecipient spender = tokenRecipient(_spender);
    if (approve(_spender, _value)) {
        _spender.receiveApproval(msg.sender, _value, this, _extraData);
        ApproveAndCall(_spender, _value, _extraData );
        return true;
    }
}

From what I can see it's obligatory that the receiving contract has "Receiveapproval" function, meaning a hacker can't really call anything...on another thought:

If a receiving contract has receiveapproval function with delegatecall inside and the delegatecall calls back the sender, it will achieve a little but still something? Why? Because while delegatecall doesn't change storage of receiver it preserves the message sender, so:

Contract A calls B via approveandcall
B has a.delegatecall to any function of A
A will receive the call from B looking as if it's from A but it will never change any storage on A.

Basically this can only be problem if A contains a very perverted function something like:

function allow_withdrawals_for_anyone() public
{
require(msg.sender = address(this));
// you see the point
}

Or this will work too:
function allowwithdrawals() internal
{

// internal modifier should pass in this case
}

This is just my understanding that while delegatecall doesn't change variables it at least registers a msg.sender which in this case is A, again I may be wrong but I see no other way of A knowing who the msg.sender is unless a function gets fully executed with a call.

If my reasoning is correct then I'd be happy to see cases of functions where this can be dangerous really.


texts: Is the Uniswap v2 0.03% trading fee calculated wrong?

texts:
I am digging into the details of how the token swapping fee is calculated and I cannot get a formula that reproduces the expected 0.3% fee.
Let's say there's a USDT-ETH pool with:

1000 USDT
10 ETH
k = 1000*10 = 10,000

Now let's imagine you swap 300 USDT for ETH.
If there was no fee, then you should get ETH 2.3076923077 (300/1300 * 10).
If we add 0.3% fee, then you'll get ETH 2.3007692308 (0.997 * 2.3076923077)
However, in the Uniswap way, they actually get the amount out assuming only 99.7% of 300 = 299.1 USDT is deposited in (this can be seen here).
Using this method, user gets 299.1/1299.1 * 10 = 2.3023631745 ETH.
And this amount is actually 2.3023631745/2.3076923077 * 100 = 99.769% of the amount if no swap fee is applied.
Which means the swap fee amounts to 0.23% instead.
Am I applying the correct logic to determine the token swapping fee?


texts:
If I create a smart contract and coin, can I for example some day close the contract and these coins are useless or can not be used for example?
Is it possible or not?


texts: How can I find all contracts that support a particular ABI?

texts:
I'm trying to find an easy way to scan the blockchain for contracts that support a particular ABI. Take ERC20 as an example: What is the easiest way to find all the ERC20 supporting contracts on the public Ethereum blockchain?

I know I need to search for the function signatures from the ABI in the blockchain contract bytecode. Is there any way to do this without writing some custom code and if it requires custom code, are there any examples available?

I'm using Geth currently to run my node.


texts: Problems with Geth after installing Parity

texts: I used to run a node on my Mac by simply typing geth console on the cli. However, I had to stop running geth about a month ago when the DOS attacks started. Last week though, I downloaded and installed Parity and I run it by typing parity --geth on the cli. But now, when I try to run geth using the old way (i.e. by typing geth console), I get an error message. When I go into my Mist folder, I don't see geth in there anymore. There is a geth in the Parity folder though. So I downloaded the latest version of geth and it's sitting in my Application folder, and I can't seem to run it from the cli like before. Could you please let me know what I need to do so that I can run geth exactly as I had before and where I should move the geth executable file to as it is sitting in my Applications folder?


texts: Can I make recursive calls using Ethereum Alarm Clock Scheduler?

texts:
Answer given here does not provide full solution.

Can some one please suggest me if it is practically feasible to execute a method in my smart contract every 24 hours using Ethereum Alarm Clock? You may refer the example given in the post linked above.

According to this doc, it is not possible to execute same call again after 255 block time (see gracePeriod parameter)

Kindly verify if my understanding is correct.


texts:
Like it seems almost everyone else recently, I've sent transactions with too low a gas price, and they're currently spinning pending after a day.

Is there a time-out after which the transaction will die? Is this determined by the gas I provided with the transaction, a time limit, or some other factor? If not, I need to try and cancel/resend the transactions (but I'm OK with waiting a day or two so long as I know that waiting is adequate).

As is described in this question, transactions only currenly show pending for up to about an hour, before they disappear from etherscan, only to re-appear with a new timestamp a while later. The question here has no answer about any livelock prevention, which is what I'm asking here.

Edit: The assumption here is that my transaction like all other transactions, and not being deliberately avoided.


texts: How to backup private TestNet to a certain block or transaction

texts:
I've created a private test net and can successfully connect to it from any machine. I can start mining there: miner.start() and eth.sendTransaction() from one account to another too. I can see, that last transactions belong to 2000th block.

So here comes first question:
I propose, that all these blocks are stored in geth/chaindata/*.ldb files, right? I want to be able to revert net state to a certain block(or transaction better), so all the nodes will accept this backup.

(I thought the first solution could be deleting certain .ldb files on each node)

Second question: is kind of curiosity - what is being mined, when i do miner.start() and do not generate transactions??


texts: My node keep giving checking DAG (ethash dir: /root/.ethash) error

texts:
I have my private ethereum network. The way I started my geth:

geth --networkid 23422 --nodiscover --nat none --datadir="$datapath" --rpccorsdomain '*' --rpc --rpcaddr "localhost" --rpccorsdomain="*" --rpcport="8545"  --nodiscover --maxpeers=6 --bootnodes enode://$id@<ip>:<port> --autodag=false
echo 'miner.stopAutoDAG()'   | geth --datadir "$datapath" attach ipc:$datapath/geth.ipc console

My node does not do mining but it is connected the network. Blockchain is stop incrementing and halt on a number. My node gives following error:

I0314 09:32:13.387846 eth/backend.go:461] checking DAG (ethash dir: /root/.ethash)
I0314 19:32:13.388103 eth/backend.go:461] checking DAG (ethash dir: /root/.ethash)
I0315 05:32:13.388391 eth/backend.go:461] checking DAG (ethash dir: /root/.ethash)
I0315 15:32:13.388641 eth/backend.go:461] checking DAG (ethash dir: /root/.ethash)
I0316 01:32:13.388951 eth/backend.go:461] checking DAG (ethash dir: /root/.ethash)
I0316 11:32:13.389214 eth/backend.go:461] checking DAG (ethash dir: /root/.ethash)
I0316 21:32:13.389467 eth/backend.go:461] checking DAG (ethash dir: /root/.ethash)
I0317 07:32:13.389720 eth/backend.go:461] checking DAG (ethash dir: /root/.ethash)

I have to do sudo killall geth and restart my server. Then then node's blockchain sync with the original chain and everything is back to normal.

[Q] I have to check my node daily. How can I prevent this problem from happening? Could this problem related with --autodag=false flag?

Thank you for your valuable time and help.


texts: Compatibility between Solidity language and Web3j library

texts: What is the compatibility between solidity and web3j. I don't find any resource about it. Suppose if I generate my java wrapper class of smart contract written in Solidity ^0.4.17 version and taking the help of web3j of version ^3.4.0 for wrapper class generation. Will it work perfectly?


texts: Call a view function of an Ethereum Smart Contract using a program written in C

texts:
my attempt is to call a view function to reatrieve some data from a contract on the Blockchain using a C program. I do have the interface of the contract.

I think i need to performe two things in order to accomplish this task:

First of all the program needs to connect to a node running the EVM. Usually easy using Metamask and web3.js. I don't thinks it's so easy even in this case. Is it possibile to connect to a node without using Metamask? What would you do to do this? What do you think will be the biggest problem of this task?
Second i need to create a raw transaction to send to the node and by raw i mean real raw. Anyway once i've a connection this shouldn't be impossible. Since i just need to call one function i was thinking of making one call using remix or truffle then inspect the data sent and try to replicate it the connection opened from the C program. Do you think it's possible to do such a thing? What part does it seems impossibile to you?

Of course i also ask you if you know of any project or any people who have done something like this, even in other languages, i'll really appreciate if you post it.