texts: `eth_getTransactionReceipt` returns the transaction hash not the receipt

texts:
I use sol-coverage in a truffle project. Ganache is my development blockchain. I have a lot of tests which end up doing more than a few thousand JSON RPC calls.

Due to unbeknownst reasons, the eth_getTransactionReceipt command fails to return the receipt object after ~1,000 calls. Instead I get the transaction hash, which breaks sol-coverage, because the expected result is either "null" or an object (as per the official docs).

Here's the function from the @0x codebase where the issue occurs:

public async getTransactionReceiptIfExistsAsync(txHash: string): Promise<TransactionReceipt | undefined> {
    assert.isHexString('txHash', txHash);
    const transactionReceiptRpc = await this.sendRawPayloadAsync<TransactionReceiptRPC>({
        method: 'eth_getTransactionReceipt',
        params: [txHash],
    });
    // HACK Parity can return a pending transaction receipt. We check for a non null
    // block number before continuing with returning a fully realised receipt.
    // ref: https://github.com/paritytech/parity-ethereum/issues/1180
    if (transactionReceiptRpc !== null && transactionReceiptRpc.blockNumber !== null) {
        transactionReceiptRpc.status = Web3Wrapper._normalizeTxReceiptStatus(transactionReceiptRpc.status);
        const transactionReceipt = marshaller.unmarshalTransactionReceipt(transactionReceiptRpc);
        return transactionReceipt;
    } else {
        return undefined;
    }
}

And my environment:

ganache-cli 6.6.0
sol-coverage 3.0.10
truffle 5.0.34

It this a bug with ganache?


texts: web3 detect/listen to events if someone send ether to addresses

texts: I need to constantly keep running some code to detect if someone has in the past minute sent some ether/token to a lot of addresses, is there better way to do than https://ethereum.stackexchange.com/a/3478/39163 that gets all transcations to one address and then somehow compare the current time with transaction time to determine if its just happened?


texts: Is it safe to generate an account with 256 coin flips?

texts:
Suppose one generates an account with the following procedure:

Flip a coin 256 times;
On a paper, write each heads as 1 and each tails as 0;
Convert the 256-bit string to hex by mapping each 4-bit sequence to a char from 0 to F;
Save that 64-character hex string to a file (say, echo 'ABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCD' > priv.txt);
Import that private key using geth account import;
Remove the file: rm priv.txt;
Store the private key in a safe place, offline.

Is to know if this procedure is safe or if is there any potential issue with it.


texts: Can I get the timestamp for a transaction added to mempool?

texts:
Can I get the time stamp on when a transaction was added to the mempool and when it was successfully added to a block?

Is there an API to do this?


texts:
I have a complex structure of various contracts using various interfaces in solidity.

When I want to deploy the contract that runs all the others; I have the following error appearing in remix IDE:

This contract does not implement all functions and thus cannot be created.

I have been banging my head against my code for two days now; reviewing each functions, where they were used and how they were used. But I can't manage to find the specific function(s) not being implemented.

If you could please take a look at my code:
https://github.com/mGrossSRT/ERC777Issue

EDIT: I know it might seem like a beginner's mistake, but I have deployed tons of contracts for my application and those contracts have been used; SO, it's really an issue I have on a specific set of contracts and not just a noobs mistake.

Thank you in advance.

Mikael


texts: Etherscan Yellow Exclamation Sign - Compiler Specific Version Warning

texts:
I just noticed that my contract 0xa150Db9b1Fa65b44799d4dD949D922c0a33Ee606 has the warning on Etherscan (yellow exclamation). This is in the Contract section and the contract has been successfully verified. Could you please advise if this is a serious issue?
Compiler specific version warnings:
The compiled contract might be susceptible to ImplicitConstructorCallvalueCheck (very low-severity), TupleAssignmentMultiStackSlotComponents (very low-severity), MemoryArrayCreationOverflow (low-severity), privateCanBeOverridden (low-severity), SignedArrayStorageCopy (low/medium-severity), ABIEncoderV2StorageArrayWithMultiSlotElement (low-severity), DynamicConstructorArgumentsClippedABIV2 (very low-severity) Solidity Compiler Bugs.


texts:
I'm trying to write a contract that :

Show current value
investor can buy share before sale start (contract is sealed when it starts), and each investor get his own equity
As the profit grows during sale, the dividend should based on unchangeable equity.(investor's equity * profit)
(*optional) During sale, if investor withdraw his equity, others get his equity equally

That's what I want to achieve in my contract, anyone here to give me some idea about this? like contract struct, variables you should use....anything could be helpful!

Appreciate and waiting

For your help. Thanks!


texts: .new() does not work in jQuery click handler

texts:
I am using truffle as my Dapp development platform together with testrpc. When I attempt to create a new instance of the my contract using the .new() method, I am having an issue with printing out the contract details of this new contract instance to the console.log in the JS console of the browser. Specifically, I am triggering the invocation of the .new() method by using an jquery click() method which takes in the values of the contract constructor parameters in the browser. The code I am using is contained in an app.js file that is referenced in the index.html file and is set out below:

$("#clickButton").click(function() {

    var accounts = web3.eth.accounts;
    var Param1 = parseInt($("input#param1").val());
    var Param2 = parseInt($("input#param2").val());
    var Param3 = parseInt($("input#param3").val());

    console.log(Param1,Param2,Param3)

    var myContractInstance=myContract.new(Param1,Param2,Param3,{ from: accounts[0]});

    console.log(myContractInstance);

    myContractInstance
    .then(function(contract) {
    console.log('Contract created', contract)
    })
    .catch(function(err) {
    console.log('Error', err)
    });

The print out that I get in the JS console is as follows (note: that I have input values of 1111,222 and 3333 for my values for Param1, Param2 and Param3:

  1111
  222
  3333
  Promise {_bitField: 0, _fulfillmentHandler0: undefined, _rejectionHandler0: undefined, _promise0: undefined, _receiver0: undefined…}
  Error Error: Invalid JSON RPC response: ""(…)

It is clear that the values are being consumed properly (as they are being printed out). Also, it is clear that promise object is being created (as this has also correctly printed out). It seems to be erroring thereafter.

However, if I copy and paste the exact same code above into the browser JS console then I do not get the error above i.e. the contract is printed out in the console.log as expected with no issue. I am baffled as to why I get an error if I use the jquery click() method but I do not get an error if I punch the code directly into the JS console. Any help is much appreciated.


texts: What is the difference between an abstract contract and an interface?

texts:
I have seen in countless places the terms treated synonymously. I have coded this example below which all works and I can see why this approach is useful. But is this an interface or an abstract contract?

Why do we even need interfaces?

 pragma solidity ^0.4.16;

contract d7 {
    function getBalance(address addr) pure public returns (uint) {
        d8 bg = d8(addr);
    return bg.myBalance();
    }
}

contract d8 {
    function myBalance() pure  returns (uint);

}

Then d8 -

pragma solidity ^0.4.18;

contract d8 {

    function myBalance() pure public returns (uint) {
        return 880;
    }

}

Hence I can leave d7 unchanged and redeploy d8 and then supply the new address to d7. This sounds a good idea to me. But I am unsure of the terminology to describe this contract and also why the interface keyword is used.


texts: Is there any solidity function that can return the type of the variable passed to it? I know I can find out the variable type by reading the code, but I just wonder if there is such a function.


texts: Running a truffle app outside of localhost?

texts:
I have deployed a contract to the ropsten test network with Truffle and can interact with the app at http://localhost:8080 (after running npm run dev and with geth connected to ropsten). However, if I wanted to host the app on a normal webserver for example, how should it be done? copying the files from the /build folder (including the /contracts folder in that) and viewing index.html (as is loaded in localhost) gives the following error:

  MyContract has not been deployed to detected network (network/artifact
  mismatch)


texts: Where can I find my pending transactions?

texts: I wanted to know where I can find the current pending transaction for an account which isnt committed. Is it even possible? How can I get transaction hashes for transactions which are pending? Any API for this purpose?


texts: How to add available accounts at infura HttpProvider

texts:
I launch web3 at nodejs server,not in explorer(no MetaMask).

const END_POINT = 'http://localhost:8545';
web3 = new Web3(new Web3.providers.HttpProvider(END_POINT));
web3.eth.getAccounts()
.then((accounts)=>{console.log})

I can get accounts from localhost:8085.

const END_POINT = 'https://ropsten.infura.io/v3/XXXXXXXXXXXXXXXXXX';
web3 = new Web3(new Web3.providers.HttpProvider(END_POINT));
web3.eth.getAccounts()
.then((accounts)=>{console.log})

But I can't get accounts from infura,return array is 0 length.
If no accounts that I will get error like "Specified signerAddress 0x4897b54979b9bf339f13dd461628476430cf0ea5 isn't available through the supplied web3 provider".

How to add available accounts?


texts: How to transfer ethereum keys and blockchain to another computer (parity)

texts: I synced the blockchain, using both parity ang ethereum wallet(parity --geth) on an external vps(digital ocean) Now I would like to download everything to a local computer with scp. I found instructions for geth, but not parity. Is this possible? Ubuntu 16.04 on the server and the machine I am transferring to.


texts: Any way to execute a Windows/Linux command from geth?

texts:
I am watching an event from a contract in geth, using the callback function, such as:

MyEvent.watch(function(err,result),{...})

Once the event is detected, I would like to execute an external command (such as save details of the event to a file on my computer). Is there a way to do it in geth?

If not, how else can I watch contracts and trigger execution of an non-Ethereum command?


texts: Ethers.js: Call constant method with await does not work

texts:
If I try to get the result of a constant function call with:

let gameCountAwait = await contract.getGameEntry(0);

it fails with:

  Uncaught SyntaxError: await is only valid in async function

Whereas if using .then it works:

let gameCount = contract.getGameEntry(0).then(function(res,err){console.log(res[2]);});

Ethers.js Version: 4.0.39
Provider: Metamask
Network: Ropsten

Here is the whole code in case that matters:

const ethers = require('ethers');
// The Contract interface
let abi = [
  "event GameResult(bool won)",
  "function lottery(uint8 guess) returns (bool value)",
  "function getGameCount() view returns (uint value)",
  "function getGameEntry(uint index) public view returns(address addr, uint amountBet, uint8 guess, bool winner, uint ethInJackpot)"
];

// Connect to the network
const provider = new ethers.providers.Web3Provider(web3.currentProvider);
let contractAddress = "0x7f8b9483b79f735C34820497A1a7f9FB82C9224b";

let contract = new ethers.Contract(contractAddress, abi, provider);
let gameCount = contract.getGameEntry(0).then(function(res,err){console.log(res[2]);}); //Works!
// let gameCountAwait = await contract.getGameEntry(0); //Does NOT work!
console.log(gameCount);

First time ever playing around with Ethers.js. Hope it is a valid alternative to web3.js. Thanks for your support!


texts: Sending string as address to smartcontract

texts:
I have trouble sending an address to a deployed contract, my function looks like this:

function addNote(uint _value, address _owner) public {
...
}

and when I'm sending the parameters:

contract.deployed().then(function(instance) {
    return instance.addNote(value,"0x092f90acAbb3b23Aded64D59FB6f6Be97615476b");
})
.then(function(result) {
    console.log(result);
})
.catch(function(error) {
    console.log(error);
});

I'm getting this error:

Error: invalid address
at inputAddressFormatter (/Desktop/Server/node_modules/truffle-contract/node_modules/web3/lib/web3/formatters.js:274:11)

Also when I'm adding the last parameter:

{
    from: "0x092f90acAbb3b23Aded64D59FB6f6Be97615476b",
    gas: 1000000
}

then the error is:

TypeError: Cannot read property 'constructor' of undefined
at /Desktop/Server/node_modules/truffle-contract/contract.js:96:1

What's the problem?


texts: How to check my geth current configuration?

texts:
I have a geth node.
I wanted to chagne txpool.lifetime to "24h0m0s".
So I made the configuration file using --txpool.lifetime="24h0m0s"
That file has the configuation like below.

[Eth.TxPool]
Locals = []
NoLocals = false
Journal = "transactions.rlp"
Rejournal = 3600000000000
PriceLimit = 1
PriceBump = 10
AccountSlots = 16
GlobalSlots = 4096
AccountQueue = 64
GlobalQueue = 1024
Lifetime = **86400000000000**

I had launched my geth using that configuration file.

Now I want to check current configuration of running geth.

Is there a way to check the configuration of running geth?

Thank you in advance.


texts: Is it possible to get both address of the user and the contract when delegate call is used?

texts:
When the user calls the delegatecallSetN function of contract D below, the msg.sender in contract E is the address of the user (as shown in this example).

contract D {
  uint public n;
  address public sender;

  function delegatecallSetN(address _e, uint _n) {
    _e.delegatecall(bytes4(sha3("setN(uint256)")), _n); // D's storage is set, E is not modified
  }
}

contract E {
  uint public n;
  address public sender;
  function setN(uint _n) {
    n = _n;
    sender = msg.sender;
  }
}

My question is:
How can we check in contract E that the call was done through contract D and not directly through the user?


texts: Why is the jump address calculation so complex in compiled Solidity code?

texts:
I have the following simple Solidity contract:

pragma solidity ^0.4.0;
contract Test {

   function Test() {
       intfunc(5);
   }

   uint8 store;

   function intfunc (uint8 a) internal {
       store = a * 9;
   }
}

I am compiling it using Remix, and I'm getting bytecode that I can't explain between addresses 0x11 and 0x1E (I'm including hex addresses on the left for convenience):

//Standard preamble:
0x00: PUSH1 0x60 PUSH1 0x40 MSTORE CALLVALUE ISZERO PUSH1 0xB JUMPI INVALID

//Beginning of Test() constructor:
0x0B: JUMPDEST JUMPDEST PUSH1 0x20 PUSH1 0x5

//Here's the really strange code:
0x11: PUSH5 0x100000000
0x17: PUSH1 0x7
0x19: PUSH1 0x25
0x1B: DUP3
0x1C: MUL
0x1D: OR
0x1E: DIV

//Here we jump to the intfunc() function
0x1F: JUMP

//Here we come back from intfunc() and jump to rest of the Test() constructor
0x20: JUMPDEST JUMPDEST PUSH1 0x3B JUMP

//intfunc() itself:
0x25: JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0xFF NOT AND PUSH1 0x9 DUP4 MUL PUSH1 0xFF AND OR SWAP1 SSTORE JUMPDEST POP JUMP

//The rest of the Test() constructor and the rest of the code is here...
0x3B: JUMPDEST ...
//(The rest isn't really relevant to this question)

What is the deal with the code between 0x11 and 0x1E - why is it so cumbersome? Can't it just be replaced by a simple "PUSH1 0x25"? Isn't it just a waste of gas to go through all these strange steps just to compute the 0x25 value?

Moreover, where is the number 7 in the 0x17 instruction coming from? It seems completely pointless.

Note that I'm getting similar code for both "optimized" and "unoptimized" Remix modes.

Any insight would be appreciated!


texts:
I'm trying to configure some protocols in Solidity (4.4 or olders) but I'm struggling right now an issue with the [thirdPartyAddress]. The code is the following:
function transfer(address _to, uint256 _value) {
require(_value%100 == 0);
uint fee = _value/100;
require (balanceOf[msg.sender] > _value);
require (balanceOf[_to] + _value > balanceOf[_to]);
balanceOf[msg.sender] -= _value;
balanceOf[_to] += (_value-fee);
balanceOf[thirdPartyAddress] += _value;
}

Error message is: DeclarationError: Undeclared identifier. balanceOf[thirdPartyAddress] += _value;
Is there some suggestion to solve this issue?
Thanks in advance!


texts: don't know why my mainnet txpool is empty

texts:
My geth node is sync'd but in the console, I don't see any pending transactions. Wanting to find a way to peek at pending transactions that other nodes have shared with my node.

Perhaps it is because my node has not fully sync'd yet. Not sure how to confirm if that's the case.

> eth.getBlock('pending', true).transactions
[]
>
> eth.getBlock('pending', true).transactions
[]
> txpool.content
{
  pending: {},
  queued: {}
}
> txpool.status
{
  pending: 0,
  queued: 0
}


texts: I get error couldn't find module 'ethereumjs-wallet/hdkey'

texts:
I was running this code deploy.js

const HDWalletProvider = require('truffle-hdwallet-provider');
const Web3 = require('web3');
const { interface, bytecode } = require('./compile');

const provider = new HDWalletProvider(
    '***** ****** ********* ********************* ***********',
    'https://rinkeby.infura.io/v3/*****************'
);

const web3 = new Web3(provider);

const deploy = async () => {
  const accounts = await web3.eth.getAccounts();

  console.log('Attempting to deploy from account', accounts[0]);

  const result = await new web3.eth.Contract(JSON.parse(interface))
    .deploy({ data: bytecode, arguments: ['Hi there!'] })
    .send({ gas: '1000000', from: accounts[0] });

  console.log('Contract deployed to', result.options.address);
};
deploy();

and I got this below given out.

node deploy.js
module.js:549
    throw err;
    ^

Error: Cannot find module 'ethereumjs-wallet/hdkey'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Users\Saurabh\inbox\node_modules\truffle-hdwallet-provider\index.js:2:13)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

I am pretty sure that I have not done any typo. This some packaging issue. Does anyone have the idea how to resolve?


texts: How to transfer ERC20 token to another contract and calling contracts function

texts:
I need to send an ERC20 Token from a contract to another contract and calling a function of the other contract at the same time.
I know how to transfer an ERC20 Token from solidity to another contract, but how do I call a payable function of the recipient contract at the same time, to use the ERC20 Token I just sent?


texts: Why is Ethereum licensed under the LGPLv3 license?

texts:
Simple question, which I cannot answer myself.
Why Ethereum have an LGPLv3 license?
Bitcoin has MIT license.

Thank you.


texts: How to convert MEW signature to go-ethereum acceptable signature for verification

texts:
NOTE: Sorry in advance, some links are without https:// and have sign / turned to \ because I don't have enough reputation to post more than 2 links)

I want to verify the signature made on MEW (link) site with go language.

I looked into go-ethereum repo (link) and at MEW repo (github.com\kvhnuke\etherwallet).

I found a way to sign and verify message in both, but not for verifying message in go which was signed with MEW.

If I just go to the page and sign the message I get a signature which looks sth like this 0x8ef34c3b243c72b52b6bfec185f153088cafa9f0111ed258e528599ba4fc99391178794b2afea7db32d7c92063b704bcc22b1bcf9c70b8527cb8c87da01975e81c

(I do know that they also hash the message before calculating signature)
and on go side I use this for getting the public key from msg and signature secp256k1.RecoverPubkey(msg, sig) and then I can derive the address from it and ...

Problem is that this signature that MEW gives does not "comply" with what go-ethereum thing expects.

At the beginning of public key recovery the following function is called:

func checkSignature(sig []byte) error {
    if len(sig) != 65 {
        return ErrInvalidSignatureLen
    }
    if sig[64] >= 4 {
        return ErrInvalidRecoveryID
    }
    return nil
}

and that MEW signature fails it for any signature I generated on MEW so far.

Here is the code for creating signature with MEW (github.com\kvhnuke\etherwallet\blob\2a5bc0db1c65906b14d8c33ce9101788c70d3774\app\scripts\controllers\signMsgCtrl.js#L95)
and here is the code that creates a signature with go-ethereum (github.com\ethereum/go-ethereum\blob\master\crypto\secp256k1\secp256.go#L68)

In a nutshell, what I'd like to do is convert that MEW signature into sth that will be liked by go-ethereum, or find any other lib for go that can verify it. (I don't want to call some API).


texts:
https://solidity.readthedocs.io/en/latest/solidity-by-example.html#simple-open-auction

pragma solidity ^0.4.22;
contract SimpleAuction {
    address payable public beneficiary;

What exactly does payable mean here? Are there non-payable addresses? Should one always explicitly declare state variables of type address like so?


texts:
I'm building Dapp on Ethereum. Imagine I have companies to register in my dapp, I will provide them with their own smart contract and public and private key pair, which they will use to just unlock their account and perform some kind of changes in their smart contract.

So how should this account unlock happen? I just want to make it simple. Maybe I will provide them with ethereum account and just use this account's public and private key?

I Don't want to use Metamask, but I want to make Login system like MyEtherWallet without any chrome extention. What's the best way of doing so?

should I use centralized Database? because I think Dapp won't be decentralized anymore.


texts:
On Win10 I downloaded and installed truffle and trying to do their recent "pet-shop" tutorial. At the Dapp stage, didn't manage to work with Metamask as suggested and tried Mist instead. I have testRPC running and am launching Mist with --rpc http://localhost:8545. I get:

[2017-07-30 12:40:23.725] [INFO] main - Running in production mode: true
[2017-07-30 12:40:23.728] [WARN] main - CONNECTING TO A NODE VIA HTTP INSTEAD OF IPCMAIN. THIS IS LESS SECURE!!!!
[2017-07-30 12:40:23.993] [INFO] main - Starting in Mist mode
[2017-07-30 12:40:26.240] [INFO] Db - Loading db: C:\Users\Sorin\AppData\Roaming\Mist\mist.lokidb
[2017-07-30 12:40:26.258] [INFO] Windows - Creating commonly-used windows
[2017-07-30 12:40:26.259] [INFO] Windows - Create secondary window: loading, owner: notset
[2017-07-30 12:40:26.312] [INFO] updateChecker - Check for update...
[2017-07-30 12:40:28.440] [INFO] Windows - Create primary window: main, owner: notset
[2017-07-30 12:40:28.480] [INFO] Windows - Create primary window: splash, owner: notset
[2017-07-30 12:40:29.066] [INFO] ipcCommunicator - Backend language set to:  fr
[2017-07-30 12:40:29.393] [INFO] updateChecker - App is up-to-date.
[2017-07-30 12:40:29.923] [INFO] (ui: splashscreen) - Web3 already initialized, re-using provider.
[2017-07-30 12:40:29.998] [INFO] (ui: splashscreen) - Meteor starting up...
[2017-07-30 12:40:30.061] [INFO] ClientBinaryManager - Initializing...
[2017-07-30 12:40:30.069] [INFO] ClientBinaryManager - Resolving path to Eth client binary ...
[2017-07-30 12:40:30.071] [INFO] ClientBinaryManager - Eth client binary path: C:\Program Files\Mist\nodes\eth\win-x64\eth.exe
[2017-07-30 12:40:30.074] [INFO] ClientBinaryManager - Checking for new client binaries config from: https://raw.githubusercontent.com/ethereum/mist/master/clientBinaries.json
[2017-07-30 12:40:30.136] [INFO] ClientBinaryManager - No "skippedNodeVersion.json" found.
[2017-07-30 12:40:30.139] [INFO] ClientBinaryManager - Initializing...
[2017-07-30 12:40:30.139] [INFO] ClientBinaryManager - Resolving platform...
[2017-07-30 12:40:30.143] [INFO] ClientBinaryManager - Calculating possible clients...
[2017-07-30 12:40:30.146] [INFO] ClientBinaryManager - 1 possible clients.
[2017-07-30 12:40:30.146] [INFO] ClientBinaryManager - Verifying status of all 1 possible clients...
[2017-07-30 12:40:30.148] [INFO] ClientBinaryManager - Verify Geth status ...
[2017-07-30 12:40:30.283] [INFO] ClientBinaryManager - Checking for Geth sanity check ...
[2017-07-30 12:40:30.284] [INFO] ClientBinaryManager - Checking sanity for Geth ...
[2017-07-30 12:40:30.369] [INFO] Sockets/node-ipc - Connect to {"hostPort":"http://localhost:8545"}
[2017-07-30 12:40:30.391] [INFO] Sockets/node-ipc - Connected!
[2017-07-30 12:40:30.393] [INFO] NodeSync - Ethereum node connected, re-start sync
[2017-07-30 12:40:30.395] [INFO] NodeSync - Starting sync loop
[2017-07-30 12:40:30.398] [INFO] Sockets/3 - Connect to {"hostPort":"http://localhost:8545"}
[2017-07-30 12:40:30.412] [INFO] Sockets/3 - Connected!
[2017-07-30 12:40:30.435] [INFO] (ui: splashscreen) - Network is privatenet
[2017-07-30 12:40:30.438] [INFO] (ui: splashscreen) - Network is privatenet
[2017-07-30 12:40:51.958] [ERROR] main - Error starting up node and/or syncing Error: Couldn't start swarm process.
    at Timeout.error [as _onTimeout] (C:\Program Files\Mist\resources\app.asar\node_modules\swarm-js\lib\swarm.js:420:21)
    at tryOnTimeout (timers.js:232:11)
    at Timer.listOnTimeout (timers.js:202:5)
[2017-07-30 12:41:28.671] [INFO] NodeSync - Sync has been skipped
[2017-07-30 12:41:28.674] [INFO] NodeSync - Sync loop ended

There is another question with the same error but it has no answer yet


texts: Why ethers.js sign function not working?

texts:
I am using the ethers.js library, and am trying to code a transaction. Here is a snippet where I connect a wallet to a provider, connect to a contract I want to call a function in, and try to call the transfer function in the target contract, using the promise generated to sign the transaction with my wallet:

let mywallet =wallet.connect(providers)
let contract=new ethers.Contract(contractadd,abi,mywallet)
contract.functions.transfer(address2,amount).then(function(tx){
let signpromise=mywallet.sign(tx)
});

When I try to execute this, I get the following error:

invalid object key v

Why isn't the sign function working? Thanks.


texts: How to obtain pulledStates from Geth when syncing is false?


texts:
I'm trying to sync my RPi 2 with the blockchain.

geth import runs quite slowly, as well as syncing from scratch.

What would be the problem in just copying the .ethereum/chaindata folder from another fully synced ethereum node?


texts: I noticed that Mist disables "import account" once it connects to a private net or testnet or rinkeby. Why?


texts: Cannot send token - The ERC-20 Token Transfer might have Failed (ErrCode: unable to locate corresponding Transfer event log), check with sender

texts:
I would send a token from MEW to another. The transaction is "success", but it didn't. The caution says, "The ERC-20 Token Transfer might have Failed (ErrCode: unable to locate corresponding Transfer event log), check with sender."

After reading some articles on web, I tried on other nodes, but it was "fail".

The token can be confirmed as N/A token on Ethplorer. I "add custom token", and tried above procedure. The results were as wrote.

Could anyone have the idea of the resolution?

TXHash: 0x17bda5e1c97fd688d4bf3d720fccb046f9df5845e7eabea76ff4a0161d61df87


texts: Trying to Deploy a contract Factory on Truffle

texts:
I am trying to deploy a contract factory that creates multiple other contracts.

The problem is they are both in the same solidity file.

When migrating and deploying I can only access the Factory contract through truffle.

I tried accessing one of the created contracts through .at(theContractsAddress), but it doesn't have an instance of the created contract to reference, even though it has correct address.

Any suggestions? Also, does anyone think it would be easier to split the contract into two files? Or will that mess up now they are linked to each other


texts: Is http://zrx.plus a legit site to claim my 0x exchange tokens?

texts: Is http://zrx.plus/ a legit site to claim my 0x coins? What are some precautions to have before claiming my air drop?


texts: Can't deploy any contracts in Main Net using Remix

texts:
I've been having trouble for a day now deploying a token in Main Net using Remix. Both Kovan and Rinkeby worked well and instantly but Main net would fail without any error messages.

Now I tried deploying a simple dummy example code found in Ethereum docs:

pragma solidity ^0.4.0;

contract SimpleStorage {
    uint storedData;

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

    function get() public view returns (uint) {
        return storedData;
    }
}

Tried deploying using Remix, worked perfectly in Kovan and Rinkeby (using remix + metamask) but to my surprise, the same error occured on Main Net.

Remix stays frozen in this "Pending" message. Transaction address returns: "Sorry, we are unable to locate this Transaction Hash"

Tried increasing gas prices and quantity. No change.

Pulling hair out here. Wtf is going on?


texts: How to make Information automatically update when account is changed?

texts:
To get the account address of the contract that is currently logged in with Metamask I use this

web3.eth.getAccounts(function(error, accounts) {
    document.getElementById('account-address').innerHTML = accounts;
});

How can i make it so address updates on UI when i change the account/ address in metamask, without having to refresh the website?


texts:
I am using BouncyCastle to generate .NET core packet signatures. I want to be able to get the v value for the Ethereum signature.

To these ends, and with my understanding of the meaning of the v value, my aim is to take the source for ECDSASigner, modify it to a custom local version, and return the correct v value on the basis of the discovered X coordinate in that code.

What I don't know though is which of the values 27..30 (27..28 in Ethereum yellow paper), correspond to which of the possible outputs. Is eg: 27==positive Y for given X?

Also, btw where is this stuff documented? YellowPaper.io refers to "The Literature" but where?


texts: Is it safe to call revert() instead of returning a value?

texts:
I have the following piece of code:

function func() public returns (bool) {
    if (some condition on msg.sender) {
        do some stuff
        return true;
    }
    revert();
}

The compiler (0.4.24) does not issue any warning about this, even though not all execution paths return a value.

Of course, I could call revert() right at the beginning (with an opposite condition) and avoid this issue, but for internal coding-style considerations, I prefer it as shown above.

Now, I know that in C++ for example, a function can throw an exception instead of returning a value and everything remains "in tact". So I suppose that it might be the same here, but I still want to be sure that there is no potential for stack-corruption or something similar (due to the fact that nothing is pushed into the stack when the function terminates).

According to the docs, the revert opcode actually does return something.

But I'm not sure if the revert function does, and even if yes, it wouldn't necessarily be of the same type as in my function (bool in this case).

So... do I have anything to worry about here, or does the thrown exception "take care" of the returned value?

Thank you!


texts:
I have created nodes in private network and started the nodes with ethstats. My server started to take the data from the nodes and displayed on the UI
However, my server is stopped and after few days I restated the server. But the nodes did not show up on the UI till I restart the chains with the ethstats command.
How long will the geth keep pushing the data to server from ethstats after the ethstats server is stopped. Or it is like,how soon I need to start my server so that the nodes are visible on UI with out restarting the chains in the nodes.
Regards,
Manoj


texts: What is a replacement for Metamask in React App?

texts:
I have an app on react that works great with Metamask but in the real world nobody has to install Metamask and I don't know how to create transaction without Metamask.

is there any way to create a transaction in-app without Metamask?


texts: Was really excited about the prospects of working on Ethereum with its python implementation but learnt that it's getting deprecated...why has this happened and can we hope for any other python wrappers?


texts: Geth Sent the Transaction to the Wrong Address?

texts:
I just followed the guide, and I made the same mistake as someone else, found here.

Essentially if you use the syntax to:eth.accounts[0xXXXXXX....] instead of to:"0xXXXXXX....", Geth will create its own, random address, and sent it to there. It would be nice if this was explicitly mentioned in the guide.

Is there a fix for this? I did not type in the address that the transaction was sent to.


texts: Why isn't the value written to the block in my very basic example?

texts:
Sorry for the wide headline, but my problem seems almost silly to me. I'm trying to get into solidity and it looks very basic to me.

Essentially that I have two funcs (and I tested it exactly like this):

... more contract here

  mapping(address => address) ownerToDataProvider;

  function foo(address _account) external {
    ownerToDataProvider[msg.sender] = _account;
  }

  function bar() external view returns(address) {
    return ownerToDataProvider[msg.sender];
  }

... more contract here

And this test:

// contract is the deployed contract and dp is some address, so is user
console.log(dp)
await contract.foo(dp, {from: user})
const result = await contract.bar()
console.log(result)

The logged output is

0xf17f52151ebef6c7334fad080c5704d77216b732
0x0000000000000000000000000000000000000000

These should be equal, right? Why aren't they?

I use latest truffle and ganache.


texts: nethereum - transactions are ignored or disappearing?

texts:
I'm trying to create a transaction with Nethereum as below but I cant see the result anywhere. I've checked the wallet and queried from custom client.

var proposalsFunction = contract.GetFunction("newProposal");
var transactionOfProposal = await proposalsFunction.SendTransactionAsync( addressFrom,p.Recipient,p.Amount,p.Description,true);

This is the contract method I'm trying to execute. (For some reason it wants bool as the last parameter)

 function newProposal(
    address beneficiary,
    uint etherAmount,
    string JobDescription,
    bytes transactionBytecode
)
    onlyMembers
    returns (uint proposalID)
{
...
}

This is how it looks in geth primary node. I can see the tx in sub nodes as well. So the tx is there somewhere but what happened?


texts:
Do I need to open BOTH TCP and UDP 30303 on my router? Or only TCP?

EDIT: I am also unclear if the UDP protocol should be opened on Port 30301 instead (as discussed on this page: https://github.com/ethereum/wiki/wiki/enode-url-format).

EDIT: I am really just looking for settings for a default Wallet running to support the network. What protocols and what ports need to be permitted through my firewall to be running a full node fully supporting the Ethereum network?

EDIT: I was able to get a clear answer from the Devs on which ports and protocol should be opened if you want to run a full-node:

"Peer discovery is UDP only. This means that on 30303 you are using both TCP (ETH and LES protocols) and UDP (old peer discovery for finding ETH peers), on 30304 only UDP is used."

What this means is that these ports need to be opened on your firewall:

-- Port 30303 (TCP and UDP)

-- Port 30304 (UDP)


texts: How does one contract send ether to another contract with more than 2300 gas?

texts:
I want one contract to collect a certain amount of finney before sending it to another contract, but I can't simply send in with C2.send(thisMuch).

function() {
    Dividend m = Dividend(dividendAddr);
    if (this.balance >= 70 finney) {
        uint sendProfit = this.balance;
    }
    m.Enter.send(sendProfit);
}

This is what I have so far, but I'm completely lost when it comes to sending finney from one contract to the next. How can I do that?

I have made two contracts on how I think it should work.
Contract one sends it to contract two.

contract one {

    address public deployer;
    address public targetAddress;

    modifier execute {
        if (msg.sender == deployer) {
            _
        }
    }

    function one(address _targetAddress) {
        deployer = msg.sender;
        targetAddress = _targetAddress;
    }

    function forward() {
        two m = two(targetAddress);
        m.pay();
        targetAddress.send(this.balance);
    }

    function() {
        forward();
    }

    function sendBack() execute {
        deployer.send(this.balance);
    }

}

Contract two sends it back to me.

contract two {

    address public deployer;

    function two() {
        deployer = msg.sender;
    }

    function pay() {
        deployer.send(this.balance);
    }

    function() {
        pay();
    }

}

Is this how it should work?


texts:
Is there any procedure to make the accounts usable only on a single node? For example, I’m running an Ethereum node on device: A. I have two accounts. If I start the geth instance in another device: B and copy the keystore contents of device: A to device: B, I can use those accounts if I know the passwords. Is there any way to make these accounts unique to a device i.e., these accounts should be unusable on other devices. Can I link enode URI to account address so that I can identify the device with the account name?

P.S: I'm running on a private blockchain


texts: Local database to every node in the network

texts:
I'm developing blockchain based application related to the vehicle industry. Application will be running in a private network. As I know it is expensive to store lot of data on blockchain.

Is it possible to setup a local database to every node in the network and just save the hash of the data in transactions ? So they can easily access the data or check the validity of the data.

Any suggestions would be appreciated.


texts: Contracts receiving multiple identical transactions

texts:
Assume a smart contract is used to add potatoes. Every time a person gets a new potato they send a transaction to the smart contract which adds 1 to the total potato count.

Let's assume, within a single block, a person accidentally sends two transactions to add to the potato count when they only meant to send one. Considering they are being processed in the same block, is there any way to ensure that only one adds to the global potato count?

How can you tell miners to only include one transaction of a specific type per address per block?


texts: Why do enum declaration statements not compile when ending in a semicolon?

texts:
From the docs:

contract test {
    enum ActionChoices { GoLeft, GoRight, GoStraight, SitStill }
    ActionChoices choice;
    ...

Line 2 deliberately omits a ;.

Attempting to compile the snippet but with a ; gives the following error:

ParserError: Function, variable, struct or modifier declaration expected.

Why is it that these enum declaration statements require there to not have a semicolon?


texts: Truffle test is failling with transferFrom.call

texts:
When I run tests with the following code, I get the following error:
Error
Error: Returned error: VM Exception while processing transaction: revert

Tests
  it('Handles delegated token transfers', () => {
    return DappToken.deployed().then(instance => {
      tokenInstance = instance
      fromAccount = accounts[2]
      toAccount = accounts[3]
      spendingAccount = accounts[4]
      return tokenInstance.transfer(fromAccount, 100, { from: accounts[0] })
    }).then(receipt => {
      // Approve spendingAccount to spend 10 tokens to fromAccount
      return tokenInstance.approve(spendingAccount, 10, { from: accounts[0] })
    }).then(receipt => {
      // Try transferrin something larger than the sender´s balance
      return tokenInstance.transferFrom(fromAccount, toAccount, 9999, { from: spendingAccount })
    }).then(assert.fail).catch(error => {
      assert(error.message.indexOf('revert') >= 0, 'Cannot transfer value larger than balance')
      // Try transfering something larger than the approved amount
      return tokenInstance.transferFrom(fromAccount, toAccount, 20, { from: spendingAccount }) // larger than 10 smaller than 100
    }).then(assert.fail).catch(error => {
      assert(error.message.indexOf('revert') >= 0, 'Cannot transfer value larger than approved amount')

      // ================ Fail from here ======================
      return tokenInstance.transferFrom.call(fromAccount, toAccount, 6, { from: spendingAccount })
    }).then(success => {
      assert.equal(success, true, 'it returns true')
    })
  })

Lines that produce error
If I delete the last lines the tests works:
      ... // THIS CODE PRODUCE THE ERROR
      return tokenInstance.transferFrom.call(fromAccount, toAccount, 6, { from: spendingAccount })
    }).then(success => {
      assert.equal(success, true, 'it returns true')
    })

TransferFrom code in solidity
This is my function in solidity it´s very simple
  function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
    require(_value <= balanceOf[_from]);
    require(_value <= allowance[_from][msg.sender]);

    return true;
  }

I have been looking for a while but I can't find how I can solve it, thank you very much in advance.


texts: How to programmatically deploy a solidity contract dynamically using Metamask?

texts:
I want to deploy a contract to Ethereum using Metamask and via a custom made UI. I have a problem with async calls and Metamask. I have attempted the code below which fails. Has anyone any sample code to deploy a contract using Metamask?

var contractCompiled;
    web3.eth.compile.solidity(contractstring, function (err, res) {
      //do stuff
      if(!error) {
          contractCompiled=result;
          console.log(result)
        }
      else
          console.error(error);
      });

//var contractCompiled = web3.eth.compile.solidity(contractstring);
var code = contractCompiled.code;
var abi = contractCompiled.info.abiDefinition;
var contract = web3.eth.contract(abi);
contract.new(
   {
     from: web3.eth.accounts[0],
     data: code,
     gas: '4700000'
   }, function (e, contract){
      console.log(e, contract);
      if (typeof contract.address !== 'undefined') {
         console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
       }
});

The error is that it fails to run the compiler and also the running sequence is not correct because the compiler tries to run after the other statements.status("compiling");

EDIT

    document.getElementById("compile-output").value = "";
    var result = compiler.compile(getSourceCode(), optimize);
    var stringResult = JSON.stringify(result);
    document.getElementById("compile-output").value = stringResult;

    var bytecode = result.contracts.greeter.bytecode;
    var abi = result.contracts.greeter.interface;

    web3 = new Web3(web3.currentProvider);

    // Our future code here..
     web3.eth.defaultAccount = web3.eth.accounts[0];

    var contract = web3.eth.contract(abi);
    contract.new(
       {
         from: web3.eth.accounts[0],
         data: bytecode,
         gas: '4700000'
       }, function (e, contract){
          console.log(e, contract);
          if (typeof contract.address !== 'undefined') {
             console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
           }
    });

The above code works to the point of the contract being defined but it seems Metamask does not deploy it. I checked Metamask and it looks OK. I checked the console and that all looks fine too. Any ideas what this could be?

p {eth: n, abi: "[{"constant":true,"inputs":[],"name":"greet","outp…"string"}],"payable":false,"type":"constructor"}]", new: ƒ}
abi
:
"[{"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"inputs":[{"name":"_greeting","type":"string"}],"payable":false,"type":"constructor"}]"
eth
:
n {_requestManager: s, getBalance: ƒ, getStorageAt: ƒ, getCode: ƒ, getBlock: ƒ, …}
new
:
ƒ ()
__proto__
:
Object


texts: How to give an array in storage value from an array from a function's input parameters

texts:
Below is the code that I have:
struct Cow{
    uint age;
    uint name;
}

Cow[] cows;

// this is the code I am trying below.
function createCows(Cow[] memory _cows) public {
    cows =_cows;
}

When I try the code above I get an error:

UnimplementedFeatureError: Copying of type struct Test.Cow memory[]
memory to storage not yet supported.

Is it possible to achieve what I am trying to achieve without using a loop?


texts: Correct way to calculate Gas Price and Gas Limit using offline mode in ethereumj

texts:
Please help me to understand the correct way to compute Gas Price and Gas Limit using offline mode in ethereumj.

I have been using EtherScan's API eth_gasPrice and eth_estimateGas as of now. Just wanted to understand if there is a better way of doing this.

Thanks in advance.


texts: Source file requires different compiler version (nightly builds issue) - solidity

texts:
SyntaxError: Source file requires different compiler version (current compiler is 0.4.19+commit.c4cbbb05.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity 0.4.15;
^---------------------^


texts: Sending .send requests in loop only sets the last value of the loop i amount of times

texts:
setCountries (e){

    Object.keys(countries).forEach((key) => {
        const country = countries[key];
        const attDef = Math.round(countryProps.POP_EST / 1000);
        const price = countryProps.POP_EST;

        this.contract.methods.createCountry(country.name, attDef, attDef, this.account).send(this.contractObject, (err, res) => {
            if (err) {
                throw err;
            } else {
                console.log(res)
            }
        });
    });
}

When I log a country like the following:

getCountryPrice = (id) => {
    this.contract.methods.getCountryPrice(id).call(this.contractObject, (err, res) => {
        if (err) {
            throw err;
        } else {
            console.log(res);
        }
    });
}

I know it's not the smart contract that is the problem since i tested it thoroughly in Remix and with seperate country pushes. I use web3 and Metamask.

If this is the countries object :

    {
"AL":{"name":"AL","id":0,"worldId":4},
"AX":{"name":"AX","id":1,"worldId":5},
"AD":{"name":"AD","id":2,"worldId":6}
}

all values in solidity seemed to be set to AD


texts: Is there a way to auto-compile contracts with truffle?

texts: Say you have a contract and you want it to watch for changes and run truffle compile --reset. Is there a way to do this?


texts: Unable to reproduce Keccak256 "hello world" hash within EVM

texts:
My toy program contains the following lines:

(seq
  (def 'hash 0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad)
  (def 'result 0x0aef6cc8d178ff0f7950a7d02a6f9061ede19bc359fb1f777e7f20a5c729bf77)
  (lit 0 "\x19Ethereum Signed Message:\n32")
  (mstore 28 hash)
  (if (eq (sha3 0 60) result) (stop) (invalid)))

hash is output from web3.sha3("hello world")

result is output from web3.sha3(web3.toHex("\x19Ethereum Signed Message:\n32")+"47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad")

Why does this program evaluate to invalid? If I remove the signed message prefix  and just compare hashes of hello world then it works.


texts: Synchronous call of external contract function in Solidity

texts:
I have two Solidity contracts, where contract Caller depends on a second contract Callee. Contract Callee provides a public view function which checks the validity of a string (e.g. an password), according to some internal rules. Caller needs to check a string in its own function by calling Callee, before he can further process. Furthermore Caller needs to call the function of Callee by using delegatecall, because the internal validity check considers the calling address.

contract Caller {

  function doSomething(string _text, address _callee) public {
     bool valid = bool(_callee.delegatecall(
                          bytes4(keccak256("check(string _text)")), _text)
                  );

     require(valid == true);
     /* further process if text is valid */
  }
}

contract Callee {

  function check(string _text) public view returns(bool){
    /* validity check */
    return true;
  }
}

The problem with this code is, that the call of function check seems to be asynchronous and therefore the require statement in function doSomething will always fail. Is this a problem of delegatecall? Is there a way to call the external function synchronously?


texts: What is the "right" way to send Ether to multiple addresses?

texts:
I have seen this discussed here but didn't get a satisfactory answer.
What is the recommended way to send ether to multiple recipients?

One way that I have thought of is follows:

Deploy a smart contract that accepts ether from any account along with a list of recipient addresses+amounts.

The contract splits the funds to the various accounts.
However, I have some concerns:

What if the recipient is a contract that has some weird code in its fallback function? There may be other security issues too.

What is the best way to do this? Is there a well tested smart contract that takes care of the border cases that I can reuse?

If it helps, I am using Web3j and Ethereumj to interact with the blockchain.

EDIT: An alternate way is to send multiple transactions and not use a contract at all. Is there any economical benefit of the contract? It seems that even via a contract, Ethers are sent to multiple addresses and would incur linearly increasing cost. Is this correct? Are the costs similar?


texts: Mining with different generations of Nvidia cards

texts:
I've got one 1070, one 2070 Super and just recieved a 3060.
Is is possible to mine with all three in the same rig?
And is it good enough having one 750 W PSU?
My 1070 is doing around 140 Watts and 2070 S is around 120 watts.


texts: How To Handle Minting & Transactions On NFT Marketplace

texts:
I am looking to create an NFT martketplace. I do not need any direction regarding a smart contract and minting ERC-721's. I've already created and am able to deploy that on a local blockchain. What I'm confused about is how I should best setup the payment and fulfillment process.
I've taken the open source E-Commerce platform, NopCommerce, and modified it so that the following process takes place:

Vendor creates digital product and uploads the file which is to be linked to an NFT
User goes through checkout process
The user is prompted to sign in via a wallet/provider like MetaMask to retrieve their address
The user pays through Crypto.com (mainly because NopCommerce already had a plugin to establish a Crypto.com payment gateway. I can also create custom payment gateways via the ability to create my own plugins)
At checkout, an NFT is minted, using my address. This NFT is then transferred to the users address which we retrieved in step 3

The downside to this system, is obviously because the transaction to mint the NFT is being made from my address, I am incurring the gas cost and will not replenish this expense until I transfer ether back into my account from Crypto.com
What I've noticed looking at other NFT marketplaces like OpenSea, they charge the vendor to mint the NFT prior to putting it for sale. I'm trying to create a first-hand only marketplace, though.
I'm wondering if the approach I've taken is feasible.


texts: Is latest block returned by eth.getBlockNumber fully processed

texts:
According to web3 docs, web3.eth.getBlockNumber returns the number of the most recent block.

My question is simple.

Is it safe to assume block's transactions and events are already in the node or can they appear a bit later? Can I, for instance, search for events inside that latest block?

In other words, what is the order of node's actions:

process transactions
update blockNumber

OR

update blockNumber
process transactions


texts: How to reset private blockchain (Parity) and delete contracts?

texts:
I have a private blockchain where I'm testing a contract and I want to re-deploy a very-slightly modified version.  I need to delete the old one first.  I control all of the nodes, so I can do this.

But I don't know how?

I tried deleting the ~/.parity/chains config dapps directories, but the contract is still out there.

Do I have to delete these directories on every node?  Do I have to delete the "network" directory also?


texts: Can I instantiate a struct with a member struct without supplying a member struct?

texts:
I have a struct containing another struct. The member struct does not yet exist when instantiating the containing struct. Is there a default for a struct (for address, int, etc' I would initialize with default values (0))? I would like to avoid setting every basic type in the member struct to a default value to save gas, if possible.

struct MemberItem {
    uint value1;
    ...
    uint value10;
}

struct Item {
    MemberItem memberItem;
    uint itemId;
}

item = Item({memberItem:0}, itemId:0);

or, do I have to do the folowing?

item = Item({memberItem:MemberItem({value1:0,...,value10:0}, itemId:0);


texts: solidity transaction returns "unknown transaction" error in truffle console

texts:
I'm using ropsten test network to deploy my contracts. Contracts are deployed successfully but when i make a transaction in truffle console it returns:

Error: unknown transaction
at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/errors.js:38:1)
at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:86:1
at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-provider/wrapper.js:134:1
at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/httpprovider.js:128:1)
at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:64:1)
at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:354:1)
at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:509:1)
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:469:1)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:186:7)

I start truffle console with:

truffle console --network ropsten

and for transaction:

game.createPlayer("0x35f5164d941de22942288808C1E6e406ec148336", {from: "0x35f5164d941de22942288808C1E6e406ec148336"}).then(function(res){console.log(res)})


texts:
I am running loads of transactions in a private POA network, even a few per seconds. The nonces are being managed by a specific service.
The issue I encountered was that one sealer somehow didn't manage to mine a transaction (it wasn't reverted) and the next 40-50 transactions were staying in pending tx pool, due to the nonce gap.
My question is what would web3.eth.getTransactionCount(sender_address, 'pending') return in this case? The nonce of the unprocessed transaction or NUMBER_OF_MINED_TX_FOR_SENDER + PENDING_TX_COUNT_FOR_SENDER? Or something else?
Thanks in advance


texts: Using EthersJS how do I run "txpool_inspect" command?

texts: As the title says, I'm attempting to execute "txpool_inspect" Json RPC command against my node but am having trouble finding any API hooks to handle this.  Is it possible?


texts: How to retrieve data form a smart contract?

texts:
Following is the contract that I want to call, and retrieve the string in node.js. But I want have a require that allows only some specific address to have this data.

pragma solidity ^ 0.4 .4;

contract sample{
    function returnsData() returns(string){

        require(msg.sender==<some specific address>)
        return "SSJK";
    }
}

So how can I use web3 to sign a transaction and make a call to "returnsData" function. I want my code to sign the transaction using one of the allowed address.


texts:
After I purchased PPT on etherdelta and my PPT was in my wallet, I pressed the wrong tab in order to exit etherdelta back to MEW. I realized my mistake and was able to export MEW out of etherdelta with my 28 tokens along with it. But  I did receive  this:

  Error encountered during contract execution [Bad jump destination]

I have not encountered this error warning since that exchange....Should I be concerned about this transaction? If so, what should I do about it?


texts: Accessing older blocks from Geth: Returned error: missing trie node 94d34

texts:
When my Nodejs script uses web3 to query a geth node running in a private Ethereum network for an older block, I encounter the error

  UnhandledPromiseRejectionWarning: Error: Returned error: missing trie node 94d3409b537ed93710c0b20e3f116e953c8284d251219f6a60de0da03207b0b8 (path )

geth Geth/v1.8.13-unstable-2e0391ea/linux-amd64/go1.10.3 has been started using the syncmode="full" parameter and it can be seen synchronizing all the blocks from the very first block

  --networkid 1366 --cache 512 --syncmode="full" --port 30303 --maxpeers 50 --rpc --rpcaddr "0.0.0.0" --rpcapi "eth,personal,web3,net" --bootnodes enode://id@ip:port

Question: Is this because --trie-cache-gens is set to it's default value of 120?

What is a trie node generations?

If we need to access the entire blockchain history, what value should we set it to? Or is there another setting to adjust to allow this?


texts: How to solve Mist wallet error - The procedure entry point SHGetPropertyStoreForWindow could not be located in the dynamic link library SHELL32.dll

texts:
I am running windows vista on a 64-bit operating system.
I can download mist wallet for windows fine and extract it. But once I try to start ethereum wallet I get the error: The procedure entry point SHGetPropertyStoreForWindow could not be located in the dynamic link library SHELL32.dll.
Is mist not compatible with vista? If it's not what are the best ethereum wallets with smart contract functionality? Is there any way to fix this error?


texts: web3, nodejs - How to put decimals values into the toBn function

texts:
I want the amount of tokens to be a decimal number.
but i heard that toBn is not supported decimals number.

When I put in a decimal number, I faced the following error:
while converting number 0.15 to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance

How can I send a decimals amount of tokens to my wallet?
I am a beginner and save me.
plz help!

i used code:

const val = 0.15; // this guy
let decimals = web3.utils.toBN(info.decimal);
let amount   =  web3.utils.toHex(web3.utils.toBN(val).mul(web3.utils.toBN(10).pow(decimals)));


texts: When to use nonfungible tokens and possibility to interchange tokens with different standards

texts:
I'm little bit familiar with Blockchain and ERC-20 standard. Now I started learning about ERC-721 and having a lot of confusion.

Let's take an example of music artist token platform. Any music artist can register with the platform and create their own tokens with defining some properties like name, symbol, etc. A music fan can purchase those tokens from an artist and trade later on.

Now the questions are

1) Can we transfer nonfungible tokens from one wallet to another wallet?
2) Why we should use nonfungible token here?
3) Is it possible to interchange ERC20 and ERC721 tokens?
4) Can nonfungible token price change after its creation?
5) Do we need ERC20 tokens to create a ERC721 tokens?


texts: How to make connection between two different smart contract address

texts:
e.g. "ABC" contract will use "XYZ" properties and methods
Both contract owner is same.

Thanks


texts: Fail with error 'UniswapV2Library: ZERO_ADDRESS' when trying to implement a swap

texts:
I am trying to implement a Ropsten Testnet swap via contract. This contract swaps Testnet DAI for a token I have created. Liquidity is added and swapping via the UI works.
IUniswapV2Router02 private router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
Token public token; //address passed via constructor
ERC20 public stablecoin = ERC20(0xaD6D458402F60fD3Bd25163575031ACDce07538D); //DAI
address[] paths = [address(stablecoin), address(token)];

unction swapper (uint buyValue, uint minAmount, uint time) public {
        require(msg.sender==owner, "only contract owner");
        router.swapExactTokensForTokens(buyValue, minAmount, paths, address(this), time);
    }

When I run the swapper function, it returns Fail with error 'UniswapV2Library: ZERO_ADDRESS'. What is wrong?


texts: Should I use smart contract for storing huge data and real-time updates?

texts:
Scenario :
Lets say I have DApp on ethereum which has two parties or two types of users
, User A will update his status (uptime or storage or ip address...etc).
User B will be able to browse a marketplace of all these users(A) with their status.

There will be thousands of users and thousands of updates per hour , so it will cost a lot of gas for setting values and storage usage for these values , How to solve this issue ? should I use centralized databases here that I have control of ? or should I use a smart contract that will write to external databases ?  what is the best practice for this issue ?
If I concern for the speed of the status updates ,then using smart contract is not a good solution because every update for a status means triggeing a transaction so it needs mining which depends on how much fees you pay ....am I right ?


texts:
I'm having difficulties verifying a contract on etherscan which has been deployed through the means of using another contract. The issue is in regards to match the input creation byte code with what I'm pasting into the code form on etherscan.

If contract C who inherits contract A and contract B, and then internally creates a contract D, how many of those contracts are than used for input bytecode creation of contract D?


texts: Explain working of address.send function in solidity

texts: I have been trying to get documentation for address.send() function, but i am unable to do so. Can someone please explain how address.send() function works, and how it can be used to send currency from one account to other?


texts:
Is it possible to adjust the mining frequency or resource usage in go-ethereum. I want to minimise the resource usage by adjusting the difficulty or something.

This is for the private testnet


texts: cant find my address from MEW when i want to connect my ledger nano s, I see a lot of addresses but not mine and all of the adresses have 0 ETH


texts: Function input is contract - How to interact

texts:
I'm going through Maker's OTC contract and they have this:

function isTokenPairWhitelisted(
    ERC20 baseToken,
    ERC20 quoteToken
)
    public
    constant
    returns (bool)
{
    return (_menu[keccak256(baseToken, quoteToken)] || _menu[keccak256(quoteToken, baseToken)]);
}

I'm trying to interact with it in truffle, but this isn't working:

  test1 = await ERC20.new();
  test2 = await ERC20.new();
  await oasisDex.isTokenPairWhitelisted(test1,test2);

I get the 'Invalid number of arguments to Solidity function'.  Any idea?


texts: Threat Model Question - Code Injection / ROP possible in Ethereum Smart Contracts?

texts: I am trying to understand a basic threat model for Ethereum Smart Contracts, to perform some research on how existing attacks techniques may be applied here as well. Is there a risk of a contract with a public function, which when malicious data is passed, may allow the program control flow jump to private functions (violating the private indentifier), or inject bytecode which would ever be executed?


texts:
This is my code to send payment from my wallet to another wallet

var web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'));
var addr = "0x...........................";
var pass = "thePassword#";
web3.eth.personal.unlockAccount(addr, pass);
const toAddress = withdrawalAddress; //address of the recipient
const amountToSend = 0000001233489520;//wei;
console.log("Amount in toWei : ", amountToSend);
var send = web3.eth.sendTransaction({from:addr,to:toAddress, value:amountToSend});

This code works fine and make payment successfully. But sometimes it give me error Error: Returned error: authentication needed: password or unlock

Since it works fine with same code and gives error with same code. Why this?


texts:
So I've customized this handleTransfer function from truffle tutorial,

I receive an error

Error: [ethjs-rpc] rpc error with payload
{"id":200574...blablabla,"jsonrpc":"2.0","params":
["0xf86f8...blablabla"],"method":"eth_sendRawTransaction"} Error: VM Exception
while processing transaction: revert

I don't know why. Does someone has an idea.

    handleTransfer: function(event) {
    event.preventDefault();

    var amount = parseInt($('#TTTransferAmount').val());
    var toAddress = $('#TTTransferAddress').val();
    var price = parseInt($('#TTPrice').val())

    console.log('Transfer ' + amount + ' TT to ' + toAddress);

    var tutorialTokenInstance;

    web3.eth.getAccounts(function(error, accounts) {
      if (error) {
        console.log(error);
      }

      var account = accounts[0];

      App.contracts.TutorialToken.deployed().then(function(instance) {
        tutorialTokenInstance = instance;
        var value = web3.toWei(price);
        var owner = tutorialTokenInstance.owner.call().then(console.log);

        return tutorialTokenInstance.sendTransaction({
          from: account,
          to: owner,
          value: value
})
.then(function(receipt){
    return tutorialTokenInstance.transfer(account, amount, {from: owner});
});
      }).then(function(result) {
        alert('Transfer Successful!');
        return App.getBalances();
      }).catch(function(err) {
        console.log(err.message);
      });
    });
  },

If you need some more info let me know

Here comes the contract

pragma solidity ^0.4.17;

import 'zeppelin-solidity/contracts/token/StandardToken.sol';
import 'zeppelin-solidity/contracts/ownership/Ownable.sol';

    contract TutorialToken is StandardToken, Ownable {

        string public name = 'TutorialToken';
        string public symbol = 'TT';
        uint8 public decimals = 2;
        uint public INITIAL_SUPPLY = 12000;

        function TutorialToken() public {
        totalSupply = INITIAL_SUPPLY;
        balances[msg.sender] = INITIAL_SUPPLY;
        owner = msg.sender;
    }

    }


texts: I am running a private network and one node seems to have stopped updating its chain. It is stuck at block 264 while the others are hundreds past it. It is still connected to the network, but it has stopped logging altogether. I can still interact with it from the console.


texts: Does Ethereum provide any mailing mechanism when a transaction is completed?

texts:
For example, when we are using SLURM, there is a mailing mechanism that when a submitted job is completed it sends a mail to e-mail address(defined by the job submitter) that telling the submitted job is completed.

Is there any similar mechanism for Ethereum (public and/or private chain), or any tool that is developed for that which will send email to msg.sender's email address when their submitted transaction is deployed, passed, completed etc.


texts: Ethereum Wallet will show error message if transaction has error before send. How to do like that using rpc api.


texts: Cost-effective way to calculate final user balance based on variable events

texts:
Apologies for the title. I'm not sure what would be a more descriptive way to name this question.

Assume there is a contract which has 3 potential parties. Buyers, sellers and shareholders. Buyers/sellers trade with the contract and shareholders earn 1% fees on such trades.

Let's say I bought 100 shares in the contract which then sells $1000 worth of tokens to someone. I now have a claim to $10 (1000*0.01) which were accounted for as fees.

Sound simple. But the problem is that anyone after me can purchase shares as well which will dilute my ownership.

Given the following scenario:

If I buy 100 shares in the contract
The contract sells to someone tokens for $1,000
I now have a claim to $10 (1000*0.01)
Someone else buys an additional 100 shares, diluting my ownership to just 50%
The contract sells more tokens for another $1,000. But out of this sale, I only have a claim to $5.
My final claim is now $10 + $5.

So the question is: since my ownership percentage can be different on each trade, how can the contract calculate my final balance after say 10,000 different trades in all of which I could have had a different ownership percentage?

There could be tens of thousands of shareholders and hundreds of thousands of trades. So updating balances for each shareholder on each trade event would be too costly.

Is there a cost-effective way to calculate my final balance? Or is the entire logic flawed and something like this is not possible?


texts:
I've read the following document describing mining on the Ethereum network:

https://github.com/ethereum/wiki/wiki/Mining

Now, the successful PoW miner of the winning block receives 5 ether. Conversely, uncles are rewarded significantly less.

Are two mined blocks with the same parent block both rewarded 5 ether? Or will one of the blocks be an uncle?


texts: Is an Account in MetaMask the same as an Ethereum Account (EOA)?

texts:
First, my setup: I use the Azure Ethereum Consortium Template, which creates one transaction node and two mining nodes in my configuration. I use MetaMask Chrome plugin to accept transactions, which I initiate via Solidity Browser.

Question:

MetaMask is no full blockchain client, but connects to one (e.g. to a geth client), right? What are the "accounts" in MetaMask UI (and their addresses)? This is not Externally Owned Accounts (EOA) then, right? What is it?

For example, I created two accounts in my MetaMask Chrome Plugin. I use their addresses to send Ether from one to the other (via their addresses). However, I cannot see these accounts if I connect to the geth client and do "personal.listAccounts". Here, I only see one single account address (I assume this is the pre-allocated Ethereum account on this Azure Transaction Node / geth client).
However, if it is just one EOA Ethereum Account, why is the Ether then moving between these different accounts via MetaMask?

Can someone please explain the relation of MetaMask accounts and Ethereum (EOA) accounts?

Thank you.


texts: X.509 certificate verification in Solidity

texts:
I'm thinking about writing an X.509 certificate verification contract (which henceforth I'll call CVC) in Solidity. The idea is that given a certificate (for the sake of example, let's suppose the raw DER-encoded bytes of the cert) passed to some contract A, the contract A can call CVC with the certificate as input, and CVC will return whether or not the bytes represent an X.509 certificate with a valid signature.

In order to do this, CVC will likely need to do the following:

Parse the certificate to determine the TBSCertificate field and signature algorithm
Call code to hash the TBSCertificate field according to the correct algorithm (could be included in the code of the next step)
Call code to verify the TBSCertificate according to the correct signature algorithm

It may also be useful to write a general contract to parse an X.509 certificate to extract relevant fields. This can then be used to create, for example, a decentralized escrow service for purchasing certificates from a CA (a site pays funds into contract A, the CA sends the signed certificate to contract A, and contract A ensures using CVC that the certificate is valid and contains the correct public key of the site before releasing the funds to the CA).

Since I've done almost no programming in Solidity thus far, I'd like to get some opinions on whether or not this design makes sense. In particular it seems like it'd be quite expensive to do all of this processing in the EVM. If possible, I'd like to avoid relying on an external service to do this verification, but that would depend on the difference in price (i.e. if it's way more expensive to verify a cert using a contract, it may be worth giving up decentralized certificate verification).

Thanks in advance for your help.


texts: Ethereum Solidity Contracts w/ Fiat Money

texts:
Is there anyway to fix a price for a ERC20 token? It seems like a major problem with blockchain and crypto is all of the volatility, which is why I am hesitant to use it for applications even though smart contracts are the perfect solution to the problem.

This may seem like a dumb question but just curious, just getting into blockchain and super interesting in all of the crypto stuff going on. Background as a web developer but think blockchain will start to play a big role in that realm and don't want to be left behind.

Thanks for your help in advance!


texts: Is it possible to get contract messages from Geth?

texts:
When I use the etherchain.org API to get all the transactions in a block, it also returns contract messages.  For example for block 911516, this call returns 7 transactions:

https://etherchain.org/api/block/911516/tx

However when I use this query in Geth for the same block, it reports only one transaction:

web3.eth.getBlockTransactionCount(911516)

Apparently etherchain.org includes contract-to-contract messages in addition to transactions.  Is there a way to obtain these messages in Geth?


texts: HELP I want a REFUND for my ethereum that has been sent

texts: Yesterday I sent token and made a contract with Live edu ICO from MEW with an amount of 16.35+ ETH, the transaction status is success but the tokens was not shown in ICO due to the finished contribution that I didn't knew when I send my money. I need to cancel this transaction now.


texts: Could you explain what this require conditions means in this smart contract

texts:
I would like to know what exactly this require condition do in this smart contract:

function placeBet(uint betMask, uint modulo, uint commitLastBlock, uint commit, uint8 v, bytes32 r, bytes32 s) external payable {
        // Check that the bet is in 'clean' state.
        Bet storage bet = bets[commit];
        require (bet.gambler == address(0), "Bet should be in a 'clean' state.");

        // Validate input data ranges.
        uint amount = msg.value;
        require (modulo > 1 && modulo <= MAX_MODULO, "Modulo should be within range.");
        require (amount >= MIN_BET && amount <= MAX_AMOUNT, "Amount should be within range.");
        require (betMask > 0 && betMask < MAX_BET_MASK, "Mask should be within range.");

        // Check that commit is valid - it has not expired and its signature is valid.
        require (block.number <= commitLastBlock, "Commit has expired.");
        require (verifySignature(commitLastBlock, commit, v, r, s), "ECDSA signature is not valid.");
        uint rollUnder;
        uint mask;

        if (modulo <= MAX_MASK_MODULO) {

            rollUnder = ((betMask * POPCNT_MULT) & POPCNT_MASK) % POPCNT_MODULO;
            mask = betMask;
        } else {
            // Larger modulos specify the right edge of half-open interval of
            // winning bet outcomes.
            require (betMask > 0 && betMask <= modulo, "High modulo range, betMask larger than modulo.");
            rollUnder = betMask;
        }

        // Winning amount and jackpot increase.
        uint possibleWinAmount;
        uint jackpotFee;

        (possibleWinAmount, jackpotFee) = getDiceWinAmount(amount, modulo, rollUnder);

        // Enforce max profit limit.
        require (possibleWinAmount <= amount + maxProfit, "maxProfit limit violation.");

        // Lock funds.
        lockedInBets += uint128(possibleWinAmount);
        jackpotSize += uint128(jackpotFee);

        // Check whether contract has enough funds to process this bet.
        require (jackpotSize + lockedInBets <= address(this).balance, "Cannot afford to lose this bet.");

        // Store bet parameters on blockchain.
        bet.amount = amount;
        bet.modulo = uint8(modulo);
        bet.rollUnder = uint8(rollUnder);
        bet.placeBlockNumber = uint40(block.number);
        bet.mask = uint40(mask);
        bet.gambler = msg.sender;

        //Record bet in logs.
       emit OnCommit(commit);
       emit BetPlaced(commit, bet.gambler, bet.amount, bet.mask, bet.modulo);
    }

I would like to know the meaning of the below require condition:

  require (bet.gambler == address(0), "Bet should be in a 'clean' state.");

These are my doubts:
How is it possible to obtain the bet.gambler from the blockchain, before the event emitted?

Kindly advice, Thanks


texts: Cryptocurrency is not viable for mass-market application?

texts:
The Idea
I am new to cryptocurrency. I am writing an app/game that has its own marketplace for digital items. I have an established userbase of around 120,000 users of which 6,000 are paying customers currently.  I expect this to grow 10x with a new feature and marketplace. These users are laymen to crypto.
Historically, apps would just make their own fake virtual currency (non-crypto) that could only be used in-game only. Users would trade fiat money for this virtual currency to purchase in-game virtual items.
My idea allows for people to sell virtual items in-game and I want to allow them to take the earnings they made in-game and be able to trade it back to fiat-money. Either through my website (via an API) or through popular exchanges. To make the process easier for the laymen I would offer a built-in wallet on my site tied to their account.
I prefer to defer all the tax ramifications to the users, and the buying and selling of the coin to a third party. I am not looking to profit off them exchanging fiat for currency (or vice versa), and I prefer as hands-off as possible. I want them to own their money (fiat or virtual) and have no say in it.
I prefer a stablecoin because then people won't be concerned (as much) about instability compared to fiat.
What are my options?

My research
It seems the best choice for a stable coin is "DAI" but the transaction time is high and the gas fee is too high. There is "xDAI" but it seems to really complicate the process of buying and it would be very painful to get customers new to crypto to be able to manage a wallet and have to learn how to bridge.
In terms of a platform, enjin.io meets my needs perfectly. I really wish it was based on a stablecoin though.
Is there any coin based on ERC-1155 that is also stable?  if not, is there a way to make a ERC-1155 coin that is stable? Ideally I'd want to use jumpnet as soon as I could too.

Breakdown
There are 6 wants for a currency;

Limited KYC (know-your-customer) required to purchase with less than 2% fee
Stablecoin tied to fiat money
Protocol supports fungible (selling copies of 1 thing) and non-fungible (unique copy)
Smart contracts  (if someone re-sells the asset then a % goes back to the original content creator automatically, etc)
Low gas fees
Easy to transfer to bank or back to fiat

DAI meets  2, 3, 4, 6
xDAI meets 2, 3, 4, 5
enjin meets 3, 4, 6
enjin (with jumpnet) meets 3, 4, 5
I think number 1 is a lost cause when it comes to crypto, unless I mitigate the risk myself and become a minter or an exchange myself. This could be feasible in bulk but I'd prefer not to.

Conclusion
Is cryptocurrency really not a viable option yet (legally, laymen abstraction) for a company to start a virtual marketplace and have their users own their money?
I feel like my best option is to go with a fake currency and then have to manage sending out form w-9 to everyone who wants to exchange back to fiat, rather than users managing their own money.


texts:
Besides mining, is there any other way for user to earn ether coin?
For example, if userA deploy a contract and userB wants to use this contract,
should userB pay ether to userA?

I'm a newbie to ethereum, please help me.


texts: How blocks are verified in a private blockchain?

texts: I have created a private blockchain in my machine and deployed a smart contract in the same. Then I have created a UI using web3. I could add peers to that network and all the peers could get the data from that deployed smart contract but they cant execute any functions in that contract. Whenever I tried to execute a function then the metamask will ask me whether to submit or reject that transaction and when I submit the same it will cause an error that says "rpc error with payload". But it works well in my machine(the machine in which private blockchain was created and smart contract was deployed), the issue is only in the machines which were added as a peer to that private blockchain. So I doubt whether the issue is because no one in the network is verifying that transaction, initiated by the peer machine. Can anyone help me with this??


texts: Calling a function in external contract: "type bool is not implicitly convertible to uint256"

texts:
I have an ERC20 token contract (say at address 0x0a6ebb3690b7983e470D3aBFB86636cf64925B98) with the totalSupply() function:

function totalSupply() constant returns (uint256) {
           return _totalSupply;
}

I want to call this function from another contract and assign the value of _totalSupply that is returned to a totalSupplyTest variable, eg:

uint256 public totalSupplyTest

totalSupplyTest = 0x0a6ebb3690b7983e470D3aBFB86636cf64925B98.call(bytes4(keccak256("totalSupply(uint256)")),"");

This results in the error:

  Type bool is not implicitly convertible to expected type uint256

There must be something wrong in the syntax I am using - in this case how should the totalSupply() function in the external contract be called?


texts: Debugging smart contract with source trace

texts:
I am currently able to debug a tx with source trace in remix if I use my local geth node as rpc provider.

The problem is that keeping a local node in sync is time and resource consuming.

I am asking here if there is a way to use an external provider enabling debugging with source trace.

I have tried the combination remix + metamask (as injected web3) but, while it works for deploying/interacting with a contract, it does not allow debugging (one of the metamask devs confirmed me debugging is not supported)

So I tried etherscan that has a "remix debugger" option on the TX. It works but there is no source trace, when I explore the various fields it says "no source has been specified". How do I specify the source? The contract I am debugging has source verified on etherscan, I don't know what I could do more than that, debugging without source is impossible, you can't follow the contract logic...

So I am stuck without any other option that going back to the local node.

If anyone can suggest how to enable sources on etherscan or any rpc provider enabling debugging from my remix ide that would be greatly appreciated.


texts: So can I simply send ether to a contract as if it's a regular wallet, even without payable function?

texts: Are contracts really that different? I guess in theory every contract should have a private key somewhere + it should be possible to send ether to it? Unless geth/parity and other parts of the evm don't have functions specifically checking if every blockchain transfer is wallet vs contract and hence rejecting ether if it's send to contract without payable functions?


texts: How to measure size of stored data in the blockchain?

texts: I know that remix can measure the execution cost and transaction cost. I want to measure the storage overhead ( Size of data in Bytes) on creating a contract on the etherum blockchain or calling a function on the contract


texts: declaration error identifier not found or not unique

texts:
pragma solidity 0.7.4;

 contract MyToken {
    address public minter;

    mapping (address => uint) public balances;

    constructor(){
        minter = msg.sender;
    }

    function mint(address receiver, unit amount) public {
        require(msg.sender == minter);
        balances[receiver] += amount;
    }
}

oKAY this should be a simple piece of code that works that I watched from this video
https://www.youtube.com/watch?v=1kMUPj5cP-0
as I'm learning how to deploy contracts (c# and c++ background) Its not making sense how this simple code isn't working. Please help me understand
I get the error
"TestContract2.sol:12:37: DeclarationError: Identifier not found or not unique. function mint (address receiver, unit amount) public {
^--^
"


texts:
I am trying to compile a simple contract in a private blockchain

simpleContract.sol

pragma solidity ^0.4.0;

contract SimpleStorage {
  uint storedData;

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

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

I get compiled version using

$echo "var simpleOutput=`solc --optimize --combined-json abi,bin,interface simpleContract.sol`" > simpleStorage.js

Starting a private geth console with an open account, I run

>loadScript("simpleStorage.js")

After verifying simpleOutput, I run

>var simpleStorageContract = web3.eth.contract([{"constant":false,"inputs":[{"name":"x","type":"uint256"}],"name":"set","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"}]);

followed by

>var simpleStorage = simpleStorageContract.new(   {     from: web3.eth.accounts[0],      data: "0x" + simpleOutput.contracts["simpleContract.sol:SimpleStorage"].bin,      gas: '47000'   }, function (e, contract){    console.log(e, contract);    if (typeof contract.address !== 'undefined') {         console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);    } })

I ran the miner with

>miner.start()

When I check simpleStorage, I get

> simpleStorage
{
  abi: [{
      constant: false,
      inputs: [{...}],
      name: "set",
      outputs: [],
      payable: false,
      type: "function"
  }, {
      constant: true,
      inputs: [],
      name: "get",
      outputs: [{...}],
      payable: false,
      type: "function"
  }],
  address: undefined,
  transactionHash: "0xabce95ae8e0b4f5422b58acd02ab28e18aa0b6cf0a7e94da07e11128e53ae719"
}

However, when I try

>simpleStorage.get()

I get

  TypeError: 'get' is not a function
      at :1:1

How do I know that the miner has mined the contract?

What is the way around this?


texts: I'm trying to download the network in a different drive of my computer, not my C drive, because I don't have much space left on that one. I change the directory, H drive, while in the command prompt  and write geth --rpc and it would start to download . But towards my C drive not the H drive where I want it to.  Also I can't find the file where it downloaded and I only have 5 Gb left. Any help?


texts: Can you filter and watch for a contracts state changing method in web3.js?

texts:
Let's say I have a very simple contract:

 contract basicStorage {
     uint storedData;

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

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

I would like to watch for changes on set() which I believe changes the contracts state, is it possible using filter/watch in web3.js?


texts:
While using Web3j websocket connection faced connection closed issue. After some time the connection was established and served few requests abruptly the connection closes.

Request you to share the way to reconnect WebSocket or any other better way to handle it.

Additionally, is it really required to explicitly invoke the connect() method of WebSocketService object?

  Implementation

WebSocketService ws = new WebSocketService("http://localhost:7081", false);
ws.connect();
Admin web3Admin = web3Admin = Admin.build(ws);

  Logs

[ctReadThread-18] o.w.protocol.websocket.WebSocketClient   : Closed WebSocket connection to http://localhost:7082, because of reason: ''.Connection closed remotely: true

org.java_websocket.exceptions.WebsocketNotConnectedException: null
    at org.java_websocket.WebSocketImpl.send(WebSocketImpl.java:608) ~[Java-WebSocket-1.3.8.jar:na]
    at org.java_websocket.WebSocketImpl.send(WebSocketImpl.java:585) ~[Java-WebSocket-1.3.8.jar:na]
    at org.java_websocket.client.WebSocketClient.send(WebSocketClient.java:309) ~[Java-WebSocket-1.3.8.jar:na]
    at org.web3j.protocol.websocket.WebSocketService.sendRequest(WebSocketService.java:165) ~[core-4.1.1.jar:na]
    at org.web3j.protocol.websocket.WebSocketService.sendAsync(WebSocketService.java:154) ~[core-4.1.1.jar:na]


texts: Do I need ETH in my exchange account to send out ERC-20 tokens to an external wallet?

texts: I'm new into ERC-20 tokens. Let's say I buy an ERC-20 token in an exchange with USD. When I want to transfer that token to my own external wallet (say Nano S), do I need some ETH in the exchange (source) to pay for gas fee? Does the exchange actually have a wallet for me and send the token from my exchange wallet to my external wallet?


texts: Using mstore to copy bytes32 does not work, why?

texts:
Why does mstore(c, p) not copy p to c?

function test()returns (bytes32) {
    bytes32 c;
    bytes32 p = 0xFF;
    assembly {
        mstore(c, p)
    }
    return c;
}


texts: Can't connect to EC2 Ethereum node from AWS Lambda

texts:
I tried to continue the discussion on this similar question: Connection Error - Couldn't connect to ethereum node on AWS at http://xx.xxx.xx.xxx:8545. Mods told me to create a new one so here goes.

I have an EC2 instance running an Ethereum node (Parity in my case). The instance is public to the world. I can run some simple code on my local machine at home and connect to the AWS instance:

const Web3 = require('web3')
let web3 = new Web3(
  new Web3.providers.HttpProvider('http://<EC2_PUBLIC_IP>:8545')
)
console.log(web3.eth.blockNumber)

This works fine from any computer that can connect to the internet.

I want to set up a Lambda function that can set up a web3 connection to this node. I've tried a simple function like this:

const Web3 = require('web3')

module.exports.hello = (event, context, callback) => {
  let web3 = new Web3(
    new Web3.providers.HttpProvider(
      'http://<EC2_PUBLIC_IP>:8545'
    )
  )
  callback(
    null,
    success({
      blockNumber: web3.eth.blockNumber
    })
  )
}

When I run this, I always get the error:

Error: CONNECTION ERROR: Couldn't connect to node http://<EC2_PUBLIC_IP>:8545.

I have tried everything and verified that the Lambda can talk to the EC2 by serving an HTTP request (they are in the same VPC). I tried to use the private IP instead of public, DNS instead of IP address, everything.

I've read that people have been able to have Lambda functions call contracts, so I think this has to be possible.

Any ideas on what we can try?


texts:
I am looking at the docs, but cannot really understand what CREATE opcode does. I can tell that CREATE does create a new smart contract from a memory chunk, pass the gas value to this new contract, then returns. But before returning, does it execute the new contract?

This confuses me because looking at the disassembly code of the smart contract bytecode, after CREATE, I cannot see any call to CALL after that, but then I still see a call to RETURNDATASIZE, which I suppose only happen after CALL. Without CALL, where it get returned data from?

Any enlighten, please?


texts: web3.admin api doesn't work in external JavaScript code

texts:
I'm trying to interact with a private blockchain from a JavaScript code, for that i've provided an RPC address to each node and extended multiple apis using -rpcapi . Now if I'm using geth attach http://127.0.0.1:8546 I'm able to use admin apis in new console, but when I use a web3 object with same address, it doesn't recognize admin api.

    var Web3 = require('web3');
    console.log(Web3);
    web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8546"));
    console.log(web3.eth.accounts);
    document.getElementById("acs").innerHTML = web3.eth.accounts[1];
    console.log(web3.admin);
    console.log(web3.net);
    console.log(web3.personal);

It gives perfect response for everything except web3.admin for which it shows undefined, am I missing anything? or is it not accessible JavaScript but only in geth attach console.


texts: How do zero fee USD to USDC transfers work?

texts:
I believe that Coinbase allows zero fee USD to USDC when you use certain payment methods like bank transfer. It also has zero fee USDC transfer among CB wallets.

How is it economically viable for them to allow zero fee creation and removal of USD vs USDC?
How can a private party go about creating a zero fee stable coin for use in a private network? (ie. exchanging USD for the token, and then using the token to move around USD value for no additional fee within the closed network)

Since USDC is an ERC20 token, I thought it would fit here. I hope that is correct.


texts:
After looking around, I didn't find another question exactly like this, though 4001 could be related but it was lacking in detail.

I'm trying to deploy a contract on a private chain.  Everything seems fine from the client-side(geth console in this case) and the transaction and receipt show no sign of an issue(that I'm seeing).

{
  blockHash: "0x6efd7c9912987a1928548529b6037f36930cbb797c66d60b0bdad4cf0b5f8674",
  blockNumber: 3140,
  contractAddress: "0x87ab8526e28a3e8358ba34aef0c03ef0e2b26ea6",
  cumulativeGasUsed: 191997,
  from: "0x75c4....5638",
  gasUsed: 191997,
  logs: [],
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  root: "0xbc4ac0a19a818b64e37ec4b47e74c8c21125879dd485d3c75a5fa1bc800fb8df",
  to: null,
  transactionHash: "0xe3e69ce4f3de843c748d0e024a8b3359d2168bb225a66e5b09343a17d8c20aaa",
  transactionIndex: 0
}

Gas for the deploy transaction was set to 450000, and according to that receipt, that gas limit was not hit. solc's estimate for construction was 415295 gas and I've tried 500000 gas as well.  That said, I have geth on verbisoity 5 and one of the messages that showed during contract deploy was contract creation code storage out of gas.

I dug into geth's code to try and figure out exactly what its problem was.  It appears to be triggered in Create in the EVM code.  The maximum size here was set to 24576(bytes?).  Perhaps EIP170 is related but I'm still not sure how my code could be considered 23KB in any case, so perhaps it isn't related.

The size of the bytecode hex string was 3770.  My constructor sets 2 addresses and a boolean and does nothing else.  So I guess I'm really confused as to what's actually causing this issue.

Could someone explain a bit better about what this error is?  I wasn't able to find much documentation on MaxCodeSize.  Maybe it's just late and I'm missing something obvious?


texts:
If I have a contract that consist of a mapping and I want to interact with this mapping in another contract, which is inheriting the previous contract.

Should I then make sure to mark the mapping as 'internal' or don't give it any visibility at all?

I often see following mapping being inherited and interacted with by another contract but it never has any visibility specified.

mapping(address => uint256) balances;

Shouldn't it be

mapping(address => uint256) internal balances;

Thanks!


texts: How do ICOs with token price linked to fiat currency prices work?

texts:
So when I see most Crowdsale contracts the price is set to x ETH and you receive the tokens based on that, if ETH price is down you get more tokens/$ and when  ETH price is up, you get less/$. That's just the volatility of crypto. But some tokens are linked to fiat prices directly. $1 gets 1 token so if I send 1 ETH I get however many tokens are determined by the price of ETH.

How is this accomplished?


texts: How to send ether to an account instead of creating a smart contract using ethers.js

texts:
I would like to send some ether to an account in ropsten testnet. I'm using the following code and the library https://docs.ethers.io/ethers.js/html/. However, instead of sending the ether to the to account, it is creating a contract. What am I doing wrong?

const wallet = new Wallet(config.privateKey);
wallet.provider = ethers.providers.getDefaultProvider('ropsten');

const transaction = {
    nonce: 0,
    gasLimit: config.gasLimit,
    gasPrice: gasPrice,
    to: to,
    value: ethers.utils.parseEther(amount),
    // data: "0x",
    // This ensures the transaction cannot be replayed on different networks
    chainId: 3 // ropsten
};

const signedTransaction = wallet.sign(transaction);

return new Promise((resolve, reject) => {
    wallet.sendTransaction(signedTransaction)
        .then(function(hash) {
            logTransaction(hash, config.sourceAddress, to, amount, gasPrice);
            resolve(hash);
        }).catch(function(err) {
            reject(err);
        });
});

This is an example transaction created by running the code above:

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

EDIT: the problem comes from signing the transaction. If I do not sign the transaction, sendTransaction(transaction) works as expected and funds are transferred to to. If I sign the transaction and do sendTransaction(signedTransaction) it creates the mentioned contracts. What is the purpose of signing it, and why is it making the transaction to "fail"?