texts: Is there a way to cancel/stop an instance of `contract.once(...)` listening to events?

texts:
I have a function in my smart contract that fires an event, which i am listening for to react in my dapp:

 this.Worker.onmessage = function (msg) {
            var data = msg.data.transactionData;

config.smartContract.once(
                'DataProcessed',
                {
                    filter: {
                        sender: config.account,
                        data: data,
                    },
                    fromBlock: 0,
                },
                function (error, event) {
                    if (error == null) {
                        console.log(event);

                        alertify.success('Data stored on the blockchain was a success!');

                   } else {
                        console.log(error);
                        alertify.error('Something went wrong!');
                    }
                }
            );

 config.smartContract.methods
                .setData(data)
                .send({ from: config.account })
                .on('receipt', function (receipt) {
                    console.log('Got receipt data from transaction: ' + receipt);
                    alertify.success('Receipt '+receipt);
                })
                .on('confirmation', function (confirmationNumber, receipt) {
                    console.log('Got confirmation from transaction: ' + confirmationNumber + ' - ' + receipt);
                })
                .on('error', function (error) {
                    console.error(error);
                    if (error.message.indexOf('User denied') != -1) {
                        alertify.error('You rejected the transaction on Metamask!');
                    } else {
                        alertify.error('Sorry, the transaction failed: ' + error.name + ' - ' + error.message);
                    }
                });

As you can see this config.smartContract.once(...) event listener is setup inside a worker at the point the worker finishes processing the data, however if the user cancels the transaction and makes another one, the previously setup "once" is still active, waiting for the event (I see multiple instances of the logs/alertify messages when the transaction succeeds after rejecting a few times). How can i nullify/cancel any existing once(...) observers?


texts: Is there a widely-accepted convention for when to use a modifier and when to use a simple assertion?

texts:
I've read this answer, which is good in general, but it doesn't quite tell me when to use a modifier (at the function declaration) and when to use assert/require (inside the function).

I do understand that this is basically a semantic question, since both options will yield the exact same runtime impact (because modifier is essentially a syntactic sugar).

But because I wish to avoid comments when publishing my contracts, I would like to know whether or not there is a widely-accepted convention for when to use each one of the two options.

I have read somewhere that one should use modifiers only for state-verification and never for input-verification, but I'm not really sure that this is indeed the convention.

My current approach is to use modifiers only when it enhances readability, since they have no other impact whatsoever (in particularly no runtime impact). My thumb-rule for enhanced readability is when the overall code size in text becomes smaller (i.e., when the number of usages "justifies" the modifier implementation).

Thank you!!!


texts: What are the limitations to estimateGas and when would its estimate be considerably wrong?

texts:
web3.eth.estimateGas and JSON-RPC estimateGas can be used to see how much gas should be specified for a transaction, before crafting the transaction.

Since it is an estimate, are there any limitations to it?  What cases should its use be relied upon less as it may produce an estimate that is not meaningful or accurate?


texts: passing variables between different contract by solidity (0.5.0+ version)

texts:
I writed ERC20 contract and ICO contract for a test , but I meet a lot problem with compile problem.

My ERC20 contract have own constructor

but,I also need a ICO contract(a control)for passing variables.

this is ICO contract part , the first trying is by "constructor()public"

second trying is by "function"

but final test , I got the Error report

Got 0 expected 4! so , I think the problem is that ...

『
mTokenAddress = address(new ERC20(name, decimals, symbol, totalSupply));
』

mTokenAddress in ICO contract is address type , i reference the solution

(How to Call contract inside another contarct in solidity version 0.5.2?)

(https://stackoverflow.com/questions/54320320/how-to-call-contract-inside-another-contarct-in-solidity-version-0-5-2?fbclid=IwAR1_2fR0-j_WRJtSgyuOPVzacJBy929eWmUh0omoTN_MZovEE2GlwIilvaE)

I don't know what else I can fix now ,hope someone give some advice


texts: How to query a uint256 input contract function via Etherscan's API?

texts:
I'm trying to query a contract function that takes uint256 as input via Etherscan's API but I keep getting error messages. The format I've realized should be as follows based on this answer:
http://etherscan.io/api?module=proxy&action=eth_call&to=[address]&data=0x[function hash]000000000000000000000000[read input]
I got the function hash from remix but I can't find what should be added after it for a uint256 input.


texts: Why can smart contracts receive ETH but not other ERC-20 tokens?

texts:
From what I've gathered (and I'm new to Ethereum), smart contracts can receive ETH payments and hold them through the receive/fallback blocks, but cannot directly hold ERC-20 tokens, but rather they can utilise them if a user calls the allow function on the token's contract. If the above statement is even true, why is that?
Example through a random use case:
Say that there's a smart contract that converts certain ERC-20 tokens to ETH through an exchange. Users deposit their ERC-20 tokens and invoke the swap functions. Do the users have to allow the contract to manage the tokens or is there a simpler way to achieve the same effect?


texts: R3 Corda Integration/interoperability with Quorum -- other than JSON RPC

texts:
Am looking to integrate/interoperate Quorum with R3 Corda in a way that achieves atomicity e.g. 2 phase commit.

Understand that interledger focuses on interoperability and that could be a possibility.

Are there any other ways to integrate and inoperate the major blockchains?


texts: Why is storing via sstore more expensive than via events mechanism?

texts: I just do not understand why emit Event(...) is cheaper than a = b. The only difference I noted between events and storage variables is that event logs is not accessible from Solidity. But both of them are stored in blockchain and both of them are accessible from external applications. So why have etherium devs made SSTORE so expensive?


texts: What is the relationship between ERC-20 tokens and Ether?

texts:
I am trying to better understand the crypto currency space and am particularly drawn to Ethereum and some of the ERC-20 tokens coming out but I don't really understand what if any relationship they have to one another.

If more and more apps come out with ERC-20 tokens do those affect the value of Etherium? Are all tokens valued based on some difficulty of solving and is that readily available in non-programmer terms somewhere?

What I guess I'm trying to say is currently 1 Ether is $694.15 in USD. If there's a dApp (hope I'm using the right term) out there do they just randomly assign the value of their tokens or how is that price relationship determined?

I know today they're trying to make an ERC-20 app with tokens related to the USD. Do those tokens use 1/694 the power consumption of an Ether?


texts: Is Devcon conference the best place to learn about Ethereum?

texts: What's the benefits of going to Devcon2?


texts: Transaction fee restrictions with solidity

texts:
Can I restrict transaction fee (gas price) for the payable method of the crowdsale contract. And if I can, how?

And one more question, if I restrict fee and call revert() - this transaction will be declined in the memepool and will be not mined at all, or not?

Thanks!


texts: Why Remix IDE asks for CallData and what value we have to give?


texts:
If the Set function receives two inputs

1.["0xca35b7d915458ef540ade6068dfe2f44e8fa733c",50,"ROC","park"]

2.["0x14723a09acff6d2a60dcdf7aa4aff308fddc160c",60,"AU","school"]

How can I return all the time in the struct, because I want to use that time to do some if-else statement?

For example, I want to use the time to do some matching, if there are 40 users to input their time, location and position, the start function will use the time to do some matching(if-else), then send the matching result to the user.

pragma solidity ^0.5.1;

contract matching {

    struct User {
        uint time;
        string location;
        string position;
    }
    User[] people;

    mapping (address => User) user_mapping;
    address[] public userAccounts;

    function Set(address _address, uint _time, string memory _location, string memory _position) public {
        User storage users = user_mapping[_address];

        users.time = _time;
        users.location = _location;
        users.position = _position;

        userAccounts.push(_address) -1;
    }

    function getAccounts()public view returns(address[] memory) {
        return userAccounts;
    }

    function getInfo(address _address) view public returns (uint, string memory, string memory) {
        return (user_mapping[_address].time, user_mapping[_address].location, user_mapping[_address].position);
    }

    function countInfo() view public returns (uint) {
        return userAccounts.length;
    }
    function start() public{
     //Use the time that store in struct to do some matching
    }

}


texts: Gasless transactions - sending transaction instead of signing message. How does it work?

texts:
I'm following this tutorial:
https://docs.openzeppelin.com/learn/sending-gasless-transactions
But it doesn't really explain clearly how it works in details. A standard transaction is pretty simple to understand. An user signs a message, sends it, pays for it and it goes to blockchain.
If there is gasless transaction on mainnet or testnet like ropsten, user doesn't send transaction to the blockchain, instead he only signs it. What happens next? There must be something which grabs user's personal signed message (because as far as I know, this message is "private", it doesn't go to the global network) and puts it to the network and pays for it but how does exactly it work?
For a moment I was thinking that if I make a contract which extends GSNRecipient any user transaction will change into sign request and this contract will be making transactions to the network. So I recreated a simple Counter contract which extends GSNRecipientUpgradeSafe.
pragma solidity ^0.5.0;
import "./GSNRecipient.sol";
contract Counter is GSNRecipientUpgradeSafe
{
    int public value;

    function addValue()
        external
    {
        value++;
    }

    function start()
        external
    {
        __GSNRecipient_init();
    }

    function acceptRelayedCall(
        address relay,
        address from,
        bytes calldata encodedFunction,
        uint256 transactionFee,
        uint256 gasPrice,
        uint256 gasLimit,
        uint256 nonce,
        bytes calldata approvalData,
        uint256 maxPossibleCharge
    )
        external
        view
        returns (uint256, bytes memory)
    {
        return _approveRelayedCall();
    }

    function _preRelayedCall(bytes memory context) internal returns (bytes32)
    {

    }

    function _postRelayedCall(bytes memory context, bool success, uint256 actualCharge, bytes32 preRetVal) internal
    {

    }
}

I deployed it and called start()
I didn't want to use any react scripts. I decided to use a normal web3js library and very basic simple website.
COUNTER
<button onclick="getContract().methods.addValue().send({from:account})">click</button>

I have checked a gsn demo: https://metacoin.opengsn.org/
After clicking "send metacoin" I'm getting sign message request. In the source code there is normal contract.methods......send(). So I decided to recreate it.
But unfortunately:
<button onclick="getCounterContract().methods.addValue().send({from:account})">click</button>

This simply calls a normal transaction instead of sign request.
web3.version: "1.2.6"
I'm pretty sure I misunderstood something or didn't understand properly. How can I make this working? Maybe there is something better than OpenZeppelin's GSN network code?
I'm using metamask.


texts: Converting Solidity enum to Nethereum enum

texts:
Below is a snippet of code that I have extracted for illustrative purpose only.

I have an enum declared in Solidity and returns in a function.

enum State { start, end }
function Test() public view returns(uint, State) ....

In my Nethereum CSharp DTO, may I know how can I model the enum? And how do I know the value of start and end? Are they default to 0 and 1?

[Parameter("enum", 2)]
public int State { get; set; }

Note: This is not duplicate of the JavaScript question, and it is about the conversion from Solidity to Nethereum (in CSharp).


texts: why can I specify `memory` if function is internal?

texts:
In the latest compiler versions, we can do the following:
function balanceOf(uint[5] memory data) external view returns (uint256) {

Until some version of the compiler, i couldn't specify memory, because for external functions, copying wouldn't happen. Now, I can specify memory too in front of my parameter.
Can anyone explain why I'd ever, ever, ever do this ? Meaning why would I specify memory ? Doesn't make sense. They could just have this restriction of not specifying memory for external functions all the time, but they let us now do that too.
Also, if I specify calldata instead of memory, everything seems to work, but then I put the transaction hash in the debugger and when I do that, debugger just disappears completely.
Any good reason ?


texts: Non-existent import files in pancake-swap-periphery

texts:
I'm looking for someone to give me a basic understanding and direction regarding pancakeswap forking. I cloned pancake-swap's periphery repository from github and in its contracts it imports
"@uniswap/v2-core/contracts/interfaces/IPancakeFactory.sol" for example. When I install uniswap a tutorial on forking pancakeswap but it is very vague and doesn't seem to help me. Any help will be highly appreciated. Also why are there 2 router files instead of one.


texts:
In Truffle's pet-shop tutorial. Adoption.sol is --

pragma solidity ^0.4.19;

contract Adoption {
    address[16] public adopters;

    // Adopting a pet
    function adopt(uint petId) public returns (uint) {
        require(petId >= 0 && petId <= 15);

        adopters[petId] = msg.sender;

        return petId;
    }
}

TestAdoption.sol is --

pragma solidity ^0.4.19;

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

contract TestAdoption {
    Adoption adoption = Adoption(DeployedAddresses.Adoption());

    // Testing retrieval of a single pet's owner
    function testGetAdopterAddressByPetId() public {
        // Expected owner is this contract
        address expected = this;

        address adopter = adoption.adopters(8);

        Assert.equal(adopter, expected, "Owner of pet ID 8.");
    }
}

My question is on the line address adopter = adoption.adopters(8); in TestAdoption.sol I thought adoption.adopters is an array and its element should be accessed via [8] instead of (8).

However, Truffle's code is correct. In fact, changing (8) to [8] will result in Solidity compilation error --

TypeError: Indexed expression has to be a type, mapping or array (is function (uint256) view external returns (address))
        address adopter = adoption.adopters[8];
                          ^---------------^

What's the theory behind?


texts: My dApp can use Metamask accounts with givenProvider but not when setting Web3 object to Rinkeby provider URL?

texts:
Today is the first day I deployed to a test network (Rinkeby) and not my local Ganache client network.  I think I need clarification on accounts when it comes to Metamask and Rinkeby.

If I initialize the Web3 object on creation on the client side to the givenProvider property, I can access my Metamask accounts when I execute a getAccounts() method call from my web page Javascript code.  However, if I instead initialize the Web3 object using the Infura API decorated Rinkeby URL, I get an empty result when I make the call to getAccounts().  I'm guessing that this is because the accounts aren't "on Rinkeby" (not sure how else to say that) but are maintained by the Metamask wallet?

My overall objective is to be able to have the server specify the desired network instead of relying on Metamask to be set to the desired Ethereum network when my dApp's web page is run.

Also, does anybody know how to initialize the Web3 object without having the Infura API key visible to someone tracing the code in the browser debugger?

// This is how I get a valid accounts result.  Metamask is currently set to Rinkeby.
const Web3 = require('web3');
const localWeb3 = new Web3(Web3.givenProvider);

localWeb3.eth.getAccounts()
.then(function (result) {}

// This results in an empty accounts result.
const Web3 = require('web3');
const localWeb3 = new Web3("https://rinkeby.infura.io/<redacted>");

localWeb3.eth.getAccounts()
.then(function (result) {}


texts: Why doesn't Raiden release channel capacity immediately when routing fails?

texts:
In the current implementation of the Raiden protocol, when a payment routing fails after some transfers, the already made hash time locks are left there until they expire.  This consumed the channel capacity for quite some time.  (The situation doesn't change whether or not RefundTransfer messages are sent.)

I think it's possible to free the channel capacity immediately (e.g. by adding removed lockhashes in the other side of the channel state). Is there a reason behind the current design?


texts: What if I had the private key that had the public address of a contract?

texts:
Could I spend the money a contract owns if I had the private key that goes to the public address that a contract resides at? (I realize that I'd have a better chance of being struck by lightning several times in a row for years.) But if you forced it in code somehow as a test, would it actually allow you to spend the money a contract owns?

Or is the Ethereum core strict enough that it treats these as two separate things and it could never happen?


texts: web3.getPastEvents return events but can't subscribe to an event

texts:
I have a contract which has an event. The contract's code is pretty simple:
pragma solidity >=0.7.4;

import "./Crowdfunding.sol";

contract Factory {
    address[] public deployedCrowdfundings;

    event ContractDeployed(
        address crowdfundingAddress,
        address deployerAddress
    );

    function createCrowdfunding(uint256 minimumContribution) public {
        address newCrowdfunding =
            address(new Crowdfunding(minimumContribution, msg.sender));
        deployedCrowdfundings.push(newCrowdfunding);
        emit ContractDeployed(newCrowdfunding, msg.sender);
    }

    function getDeployedCrowdfundings() public view returns (address[] memory) {
        return deployedCrowdfundings;
    }
}

The problem I have is with the events. If I call the method getPastEvents it returns me all the events:
factory.getPastEvents('ContractDeployed', {
        fromBlock: 0,
        toBlock: 'latest'
    }, function(error, events){ console.log(events); })
    .then(function(events){
        console.log(events)
    });

But if I try to subscribe(I tried in 2 ways):
First way
factory.events.ContractDeployed({
    })
    .on("connected", function (subscriptionId){
        console.log(subscriptionId);
    })
    .on("data", function(data) {
        console.log(data);
    })

Second way:
let eventName = "ContractDeployed";
    const eventJsonInterface = web3.utils._.find(
        factory._jsonInterface,
        o => o.name === eventName && o.type === 'event',
    )

    const subscription = web3.eth.subscribe('logs', {
        address: factory.options.address,
        topics: [eventJsonInterface.signature]
    }, (error, result) => {
        if (!error) {
            const eventObj = web3.eth.abi.decodeLog(
                eventJsonInterface.inputs,
                result.data,
                result.topics.slice(1)
            )
            console.log(`New ${eventName}!`, eventObj)
        }
        if (error){
            console.log(error);
        }
    })

Both give me the following error:
Error: Returned error: Method not found
    at Object.ErrorResponse (E:\Solidity\Kickstarter\node_modules\web3-core-helpers\lib\errors.js:28:19)
    at Object.callback (E:\Solidity\Kickstarter\node_modules\web3-core-requestmanager\lib\index.js:303:36)
    at E:\Solidity\Kickstarter\node_modules\web3-providers-ws\lib\index.js:114:45
    at Array.forEach (<anonymous>)
    at WebsocketProvider._onMessage (E:\Solidity\Kickstarter\node_modules\web3-providers-ws\lib\index.js:102:69)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (E:\Solidity\Kickstarter\node_modules\yaeti\lib\EventTarget.js:115:12)
    at W3CWebSocket.onMessage (E:\Solidity\Kickstarter\node_modules\websocket\lib\W3CWebSocket.js:234:14)
    at WebSocketConnection.<anonymous> (E:\Solidity\Kickstarter\node_modules\websocket\lib\W3CWebSocket.js:205:19)
    at WebSocketConnection.emit (events.js:310:20)
    at WebSocketConnection.processFrame (E:\Solidity\Kickstarter\node_modules\websocket\lib\WebSocketConnection.js:554:26)
    at E:\Solidity\Kickstarter\node_modules\websocket\lib\WebSocketConnection.js:323:40
    at processTicksAndRejections (internal/process/task_queues.js:79:11) {
  data: null
}


texts: Implementing a timelock inside token contract

texts:
I am trying to learn how to make my own token.  I want to add a timelock so that tokens that are purchased can not be sold until a specific time.  How would I go about this?  I have very very little coding knowledge, so I am pretty lost.  I watched a video on youtube and got this code:
pragma solidity ^0.8.0;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";

contract J4RK0FF is ERC20 {
    constructor(uint256 initialSupply) public ERC20("J4RK0FF", "J4RK") {
        _mint(msg.sender, initialSupply);
    }

}

So if this works as a basic unmodified contract, how can I add a timelock feature to it?  Thanks in advance, sorry if I sound stupid, I have no idea what I am doing


texts: How to configure APIs to run with Ropsten addresses

texts:
I have my contracts deployed on Ropsten network. I deployed those contracts from my local machine using Truffle migrate.

Then I set up an AWS EC2 Ubuntu server to host my RESTful APIs. I installed web3js and node along with Node API code. At last I copied build folder to the server so that API can interact with the contracts.

I'm not able to configure my APIs to run with Ropsten contracts. How can I do that?

I'm actually looking for how and where do we give contract object reference in the code?


texts: Is it possible to delete a smart contract if selfdestruct() not implemented in it?

texts: Please explain how can i use delegatecall or callcode. Thanks !


texts: The solc is not generatig *.abi file with the option --abi and -o build

texts:
When I use the --abi option, the abi interface is generated:

$ solc Greeter.sol --abi

======= Greeter.sol:mortal =======
Contract JSON ABI
[{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"}]

But when I ask it to put it into the output folder, with -o build, the file is missing:

WHHA@NBVAL752 ~/dev/java-magazine-tutorial
$ solc Greeter.sol --abi -o build

WHHA@NBVAL752 ~/dev/java-magazine-tutorial
$ ls build/
Greeter.sol

WHHA@NBVAL752 ~/dev/java-magazine-tutorial
$ cat build/Greeter.sol

The only generated file is Greeter.sol which is emtpy.

The contract code is:

$ less Greeter.sol pragma solidity ^0.4.2;

contract mortal {  /* Define variable owner of the type address*/  address owner;  /* this function is executed at initialization  and sets the owner of the contract */ function mortal() { owner = msg.sender; }

/* Function to recover the funds on the  contract */  function kill() {  if (msg.sender == owner) suicide(owner);  } } Greeter.sol (END)

SOlc version is:

$ solc --version
solc, the solidity compiler commandline interface
Version: 0.4.9+commit.364da425.Windows.msvc

Any idea??


texts: Error in download full data with Geth ( transaction field in Block is empty)

texts:
I'm trying to download full data of ethereum block chain. But when I check the result, I found an error. From block 1 to 46146, field tx is empty,it means that there is no data for transaction.

Does anyone have same issue and know the reason for that?
Thanks.


texts: How are Metamask web wallets traceable to owner identity?

texts: When creating a Metamask wallet as a Chrome browser extension, what are all the different identifiers that match the wallet to its owner? Since it takes a password to log into the Metamask wallet, does this mean there is an e-mail associated with the account? Are there logs kept of the IP address where the Metamask was created? What are other identifying features are there?


texts: How exactly I can calculate difficulty for a given share

texts:
Let's say I have a share for ethereum

BlockNumber = 1155545,
hashNoNonce = ec31d253819762aaa186685e1eb743fc9b058b2e550539952e48abe63b0ad1c8
nonce = 4499658978045803798

What is the formula for difficulty?


texts: how can we know the address of the peers in Private ethereum block chain to send the transactions

texts: Hi iam new to private ethereum block chain and geth. Can anybody suggest me how can we know the receivers address to send the transaction using geth console on sender side?


texts:
I'm a newbie in NFT, ETH and I have a question.
Can I transfer NFT if the account was compromised?
More precisely, I mean two situations for example:

If I author of Digital Art and I sold it. I will get a royalty when the next buyer sells it too. How can I'm to save royalty if my account was compromised? How I understand compromised account write down in a smart contract. Is it possible to change it?

If I just buy NFT, I'm not the author. How can I save my assets and transfer them to a new account if my old account was compromised?


texts: Transaction is stuck pending but not available to be cancelled in MyEtherWallet

texts:
My transaction has been stuck pending for 4 days now, but I can't even cancel it on MyEtherWallet as it is showing up as "Transaction Not Found" on their check transaction page. https://etherscan.io/tx/0xc6948ac8972de3e676b0dc112151b8d1505c6fb86c50c289876ffa5ee4a183e9

It's blocking all of my Metamask (It has a 'Warning - There was a problem resubmitting this transaction' flag on it) and the rest of my funds are stuck as well as I can't even withdraw from it. I made a mistake and made the transaction send 1.2 Eth to myself when I only had 1.1 in the wallet. Is there any way to fix this or are all my funds stuck in limbo forever? Thanks for any input.


texts:
I've recently found out, that there's no convenient way to monitor transactions to 'externally owned account' generated by some contract.
I went to various forums and ethereum bugtrackers for an answer and saw lots of requests to add some API calls to list all transactions, normal and contract invoked. Some of the people described real situations when they've lost ETH because the exchange they used didn't support such internal transactions. But in all cases eth developers said the same - 'exchange developers don't understand ethereum basics, they should use contracts instead of EOAs'.

OK, I tried to realize, what they should've done.
Using EOA it's really simple - generate new account, give it to user and wait for some transactions.
As I see it, using simplest contracts you need to provide your user 2 entities - address of your contract and some encoded data, that will contain method signature and generated user id, and then you just listen to logs.
From user's perspective I see it quite inconvenient to operate with 2 instances if I just want to deposit money on my account - it becomes much more error prone. And I'm not sure, all users' contracts will support sending to such exchange contracts without additional coding.

Is there any obvious scenario, that I'm missing?

Sorry for the long question and possible duplicate, but I couldn't find any examples on how to do it right.

EDIT: Don't have enough reputation to comment Tjaden's answer (thanks for it, btw), so 'commenting' here.
Yes, I thought of this version too, but forgot to add it in original question.
Using fallback function is nice and easy, BUT - as I understand it - in that case you should create a contract for each user, which results in 2 problems:
- spending money each time (not much, but still - paying just for account creation doesn't seem very fair)
- you should send each contract to blockchain and then wait some time for it to be confirmed before providing a user with his address.

Does the majority of ethereum community think the same way as Tjaden?


texts: How did this project rug? Minting new tokens, I tried to find it but i'm unable to see how they did it

texts:
this is their contract:
https://bscscan.com/address/0x95d25105237ced24523bbc3880b2551248e90de2#code
I cannot find the minting function in the contract, also how would they be able to call it?
cheers!


texts: Issues with Parity's send transactions and deploying contracts

texts:
I am using the latest Parity client on Mac connected via WiFi (ping 25ms) on the Ropsten testnet. The chain is completely synced but my problem is that I can't post any transaction and also can't deploy any contracts. Pretty much everything that creates a transaction just isn't confirmed by the network. I am now waiting for more than ten minutes.

Any suggestions on what the problem might be? Is there a problem with the Ropsten testnet? The console output looks normal and I didn't have any problems to post transactions in the past.

Best regards,Lars


texts: w3.eth.filter returns multiple transaction with same transaction hash, block and transaction index


texts: what is the logic behind rewarding 5 ETH for mining a block?

texts: Is it in someway related to the transaction cost charged by ethereum for each transaction ?


texts:
I am running geth 1.6.1 and trying to sync to ropsten testnet. When I start geth, it seems to be downloading blocks and state entries. When I run web3.eth.syncing,  I get currentBlock: 986300 and is increasing every time I run. However, when I do web3.eth.getBlock('latest').number, it returns 0. All my account balances (web3.eth.getBalance) are also returning 0.

Command I use to start geth:

geth --testnet --rpc --rpcapi db,eth,net,web3,personal --cache=1024 --rpcport 8545 --rpcaddr 127.0.0.1 --rpccorsdomain "*" --bootnodes "enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303,enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303"


texts: Adding Wallet using web3.eth.accounts.wallet.add

texts:
On web3 0.20.1, I am using Infura to deploy a contract to Rinkeby. This probably requires me to add a wallet to web3.accounts to provide the gas needed.

When I ran the following nodejs code,

Web3 = require('web3')
var web3 = new Web3(new Web3.providers.HttpProvider("https://rinkeby.infura.io/nyxynyx-api-key"))
var privateKey = 'nyxynyx-private-key'
web3.eth.accounts.wallet.add("0x" + privateKey);

var contractCode = '60606-contract-code-here';
var abi = [{"constant":false,"inputs":[{"name":"givenNumber","type":"uint8"}],"name":"setNumber","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"givenNumber","type":"uint8"}],"name":"guessNumber","outputs":[{"name":"","type":"bool"}],"type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"from","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[],"name":"SetNumber","type":"event"}];
GuessNumber = web3.eth.contract(abi)
var contractInstance = GuessNumber.new({from: web3.eth.accounts[0], gas: 200000, data: '0x' + contractCode});

the following error is encountered:

web3.eth.accounts.wallet.add("0x" + privateKey);
                        ^

TypeError: Cannot read property 'add' of undefined

Is this because web3.eth.accounts.wallet.add is a web3 v1.0 function? If it is, what is the equivalent code needed in v0.20.1?


texts:
I found that ISZERO is an opcode but I can't find what is the purpose of ISZERO.

Can somebody please guide me what is the purpose of ISZERO?

Zulfi.


texts: is .eth a true TLD and belongs to DNS (Domain Name System)?

texts:
I am reading blog posts about auctions of Etereum domian names under .eth suffix (going sky high in bidding), and I wonder, is .eth a really supported TLD ?

Because nslookup fails to resolve an ".eth" TLD:

[niko@localhost ~]$ nslookup -q=NS com
Server:     192.168.1.1
Address:    192.168.1.1#53

Non-authoritative answer:
com nameserver = d.gtld-servers.net.
com nameserver = k.gtld-servers.net.
com nameserver = c.gtld-servers.net.
com nameserver = l.gtld-servers.net.
com nameserver = g.gtld-servers.net.
com nameserver = f.gtld-servers.net.
com nameserver = j.gtld-servers.net.
com nameserver = a.gtld-servers.net.
com nameserver = m.gtld-servers.net.
com nameserver = b.gtld-servers.net.
com nameserver = e.gtld-servers.net.
com nameserver = h.gtld-servers.net.
com nameserver = i.gtld-servers.net.

Authoritative answers can be found from:

[niko@localhost ~]$ nslookup -q=NS eth
Server:     192.168.1.1
Address:    192.168.1.1#53

** server can't find eth: NXDOMAIN

[niko@localhost ~]$


texts: Understanding Proof of Stake implementation

texts:
I am trying to understand Proof of Stake based on this implementation:
https://github.com/PoSToken/PoSToken/blob/master/contracts/PoSToken.sol

However, I am confused about a few sections and was hoping someone could clarify them:

Line 184: require(_to != address(0));

Why does this require exist? What problem is it preventing?

Lines 183 and 167 use `onlyPayloadSize` 2 ** 32 and 3 ** 32

I understand that onlyPayloadSize fixes an ERC20 short address attack however I don't understand why the two are different. Hopefully someone can explain why?


texts: Sweep tokens from a one-time address without available ether

texts:
I'm generating a one-time address for each order in my store, and the order is payed with an ERC-20 token.

Is there any way I could sweep the tokens from this address, without an additional transaction to deposit some ether first (that will later cover the gas required to transfer the tokens)?


texts: Value of msg.sender in call to inherited external function

texts:
I found this in the official solidity docs.

  The values of all members of msg, including msg.sender and msg.value can change for every external function call. This includes calls to library functions.

The "can change for every external function call" is too vague for me.

Does anyone know when it does change for an external function call?

My concrete example:

pragma solidity ^0.5.10;

contract A {
    function foo() external view returns(address payable) {return msg.sender;}
}

contract B is A {
    address payable public msgSender;

    function bar() external {
        // 3 ways of doing the same thing
        msgSender = A.foo();  // does this work and who will be msgSender?
        msgSender = this.foo();  // does this work and who will be msgSender?
        msgSender = super.foo();  // does this work and who will be msgSender?
    }
}

Please take all the code as is => in the 3 notations A.foo() this.foo() super.foo() I am NOT talking to another deployed contract instance. With all 3 ways I want to showcase 3 (different but same) ways of calling external functions (inherited ones in this case) on a contract from inside (internally) that same contract. The 3 ways basically just vary in their scope or explicitness I believe.

Back to my main question:
Who is the msg.sender emitted in the EmitMsgSender event emitted by the call to A/this/super.foo() in my example?
Is it contract B's address payable or is it the address that sent the tx to B.bar()?

By the way, it would make my life easier, if it were the original caller of the B.bar() function, and not B's address.

Thanks for your help!


texts: Deleting element from mapping exceeds gas limit

texts:
Deleting element from mapping exceeds block gas limit.
I tried to increase gas limit to 10 millions, but there is no results

There is mapping:

mapping(address => bool) isSomebody;

There is function for deleting:

function deleteSomebody(address _address) {
    delete isSomebody[_address];
}

I also tried this variant:

function deleteSomebody(address _address) {
    isSomebody[_address] = false;
}

The most interesting, if i try to set isSomebody[_address] = true it works

P.S I use Remix


texts: Is there any simplified flow for ETH transaction

texts:
I would like to know issue like:

When I make a web3 call, how can I know my transaction is succeeded or failed?
When my Smart Contract is executed without any problem, is that mean my transaction is succeeded? Or can it failed again later when double spending is detected? If yes, then what can I do?
How can I make sure the ETH that I have received is already confirmed?

Without a complete and simplified flow, I am having a hard time to figure out what to do next.

Thanks in advance


texts: Possible to change Etherscan verified source after initially verified?

texts:
Is it possible to change the comments in verified contract source on Etherscan once the contract source has already been verified?

It isn't the Solidity source itself that I'd like to change.  Just a comment.

I've tried verifying again, but receive the message:

The Contract Source code for 0x... has already been verified.

Thanks very much in advance.


texts:
I am new to solidity, truffle and i tried react-box from Truffle and i get the following error. I am using Macos.

Here is the basic steps

    npm install -g truffle
    truffle develop
    compile
    migrate

https://github.com/truffle-box/react-box

  Module not found: Can't resolve './contracts/SimpleStorage.json'


texts:
Running geth, it's easy to see what its implementation of JSON-RPC does on errors:

$ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_compileSolidity","params":["contract test { function multiply(uint a) returns(uint d) {   rxturn a * 7;   } }"],"id":1}' http://localhost:8545
{"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"solc: exit status 1\n\u003cstdin\u003e:1:72: Error: Expected token Semicolon got 'Mul'\ncontract test { function multiply(uint a) returns(uint d) {   rxturn a * 7;   } }\n                                                                       ^\n"}}

$ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x407d73d8a49eeb85d32cf465507dd71d507100c1", "lxtest"],"id":1}' http://localhost:8545
{"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"invalid blocknumber \"lxtest\""}}

$ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x407d73d8a49eeb85d32cf465507dd71d507100c1", "latest"]}' http://localhost:8545
{"jsonrpc":"2.0","error":{"code":-32700,"message":"missing request id"}}

We get a JSON response containing an error object rather than the expected output, where error includes an integer code and a descriptive message.

But (am I blind?) I can't seem to documentation of this behavior in the spec, or any information on the codes.

Is error behavior in JSON-RPC standard across implementations? Can one safely rely on the code/message response format, even if the codes have not been fully worked out?

Thanks, and apologies if, not unusually, I'm just not looking in obvious right places.


texts: If mining in a pool with claymore miner, can I turn off the miner and give my computer a break?

texts:
If I close the claymore mining window while it is mining in a pool, will I lose all the shares of work attributed to me up to that point?

I would like to give my computer a break for entertainment purposes at times and the miner does tend to slow down activities on my computer.

I'm using claymore dual miner and mining both Ethereum and Siacoin with nanopool.

This is an interesting experiment for me and the PC is not a dedicated mining rig.  It's more of a high powered gaming PC that I am using to learn a little bit more about cryptocurrency mining.  I suppose I am dipping my feet in the cryptocurrency mining waters so to speak.

Any information would be very helpful!


texts: How can I swap a token across different liquidity pools in a single transaction?

texts:
im pretty new to solidity, and i was wondering how you can 1 ERC token by another across different liquidity pools.
Example:
I have 1 DAI and I change it for eth in the ETH-DAI Uniswap pool
then I swap ETH by SUSHI in the SUHSI-ETH Sushiswap pool
so the tx looks like this
swap 1 dai for x eth
swap x eth for y sushi
I guess you cant do it directly and you need to deploy a smart contract that interacts with both contracts (Uniswap ETH-DAI  and Sushiswap SUSHI-ETH) and then you interact with your deployed smart contract.
Does this have a particular name? I saw that it exist something called atomic swaps but I guess its not the same


texts: Access incoming value of custom token in payable function

texts:
Can you attach a custom token as value in a smart contract function call? How would you unpack it and access that on the receiving end?
Broader question: How do you implement a smart-contract function that performs an action proportional to the amount of custom ERC-20 tokens transferred to it?


texts: Blank window problem when connecting Mist to `geth`

texts:
I used:
 - OS: Mac OS X El Capitan Version 10.11.1
 - geth:  1.5.7-stable-da2a22c3

I followed these installation instructions: https://github.com/ethereum/mist

When I try to run Mist, I get a blank window (see below). Please note that Mist was able to successfully connect into geth.ipc.

$ cd mist
$ electron .

Mist's blank window:

Error Message:

main - Running in production mode: false
Secp256k1 bindings are not compiled. Pure JS implementation will be used.
main - Starting in Mist mode
Db - Creating db: undefined
Db - Loading db: undefined
Windows - Creating commonly-used windows
Windows - Create secondary window: loading, owner: notset
updateChecker - Check for update...
Windows - Create primary window: main, owner: notset
Windows - Create primary window: splash, owner: notset
ipcCommunicator - Backend language set to:  en-US
ClientBinaryManager - Initializing...
ClientBinaryManager - Resolving path to Eth client binary ...
ClientBinaryManager - Eth client binary path: /Users/avatar/mist/nodes/eth/mac-x64/eth
lientBinaryManager - Checking for new client binaries config from: https://raw.githubusercontent.com/ethereum/mist/master/clientBinaries.json
updateChecker - App is up-to-date.
ClientBinaryManager - No "skippedNodeVersion.json" found.
ClientBinaryManager - Initializing...
ClientBinaryManager - Resolving platform...
ClientBinaryManager - Calculating possible clients...
ClientBinaryManager - 1 possible clients.
ClientBinaryManager - Verifying status of all 1 possible clients...
ClientBinaryManager - Verify Geth status ...
ClientBinaryManager - Checking for Geth sanity check ...
ClientBinaryManager - Checking for Geth sanity check ...
ClientBinaryManager - Checking sanity for Geth ...
ClientBinaryManager - Checking sanity for Geth ...
ClientBinaryManager - Sanity check failed for Geth Error: Unable to find "1.5.9" in Geth output
  at Promise.resolve.then.then.then (/Users/avatar/mist/node_modules/ethereum-client-binaries/src/index.js:635:17)
Sockets/node-ipc - Connect to {"path":"/Users/avatar/Library/MyEthereumEbloc/geth.ipc"}
Sockets/node-ipc - Connected!
NodeSync - Ethereum node connected, re-start sync
NodeSync - Starting sync loop
Sockets/3 - Connect to {"path":"/Users/avatar/Library/MyEthereumEbloc/geth.ipc"}
main - Connected via IPC to node.
Sockets/3 - Connected!
NodeSync - No more sync necessary
main - Loading Interface at http://localhost:3000
NodeSync - Sync loop ended
Sockets/2 - Connect to {"path":"/Users/avatar/Library/MyEthereumEbloc/geth.ipc"}
Sockets/2 - Connected!
Windows - All primary windows closed/invisible, so quitting app...
main - Defer quitting until sockets and node are shut down
Sockets - Destroy all sockets
Sockets/2 - Disconnecting...
Sockets/3 - Disconnecting...
Sockets/node-ipc - Disconnecting...
main - About to quit...
Windows - All primary windows closed/invisible, so quitting app...

Thank you for your valuable time and help.


texts: Whats the best way to sign and send a transaction?

texts:
Hey I want to send a transaction that has a message embedded in it. I want the most secure way to unlock the personal account. I have full node GETH installed and am using web3.I have a nodejs script running in the server that has the GETH node. I need to send transaction through this script. This script will be called by the other server. What would be the most secure way to decrypt using the private keys?
Is this a good way to unlock an account?

web3.personal.unlockAccount(addr,pass);

Or is the use of private key a better one?

tx.sign(privateKey1)
const serializedTransaction = tx.serialize()
const raw = '0x' + serializedTransaction.toString('hex')

I will be using to send the transaction in production server. So whats the best and most secure way to send the transaction?


texts: Need advice on backing up my entire parity directory

texts:
I'm developing a blockchain explorer and I want to backup my parity directory on Ubuntu. I've been pointed to directions on the Parity wiki for backing up but it only provides backup instructions for backing up my keys. I wish to backup my entire ".local/share/io.parity.ethereum" directory.
I'm thinking of just using rsync to backup that directory (after stopping parity with the command: "sudo systemctl stop io.parity.ethereum"). Has anyone done this to know if this should work well for copying over the entire parity directory? Any input would be greatly appreciated! Thanks in advance.


texts: Cannot query contract methods after upgrading to geth 1.9

texts:
We have been running a geth 1.8 based private PoA chain for a long time. We are trying to upgrade it to geth 1.9.

After changing the command line arguments to reflect the new API and remove deprecated switches, we managed to get everything back up and running - but something doesn't look right.

When running read-only queries against the chain (Eg calling a public view method on a contract from our Dapp), the chain responds with:

insufficient funds for gas * price + value

We havn't changed anything on our Dapp frontend, and we using the same version of Metamask that we're using against our 1.8 chain.

What could we be doing wrong?

EDIT: Note that when reading from the chain using tools like truffle, it works. Only Metamask seems to have trouble.


texts: Ethereum Wallet with private testnet not working: chaindata/LOCK:Permission Denied

texts:
Trying to connect Ethereum Wallet with the private test net, but facing issues.

Ran this command:

geth --genesis /home/cgen.json --datadir '/home/systemname/Desktop/node2/geth.ipc ~/.ethereum/geth.ipc' --networkid 12345 --nodiscover --port 30302 --verbosity 0 console

And then launched Ethereum Wallet.

I got the error ERROR: Could not open database open/home/systemname/.ethereum/chaindata/LOCK:Permission Denied

Running the above mentioned but getting error .


texts: What market sets the price for ethereum?

texts:
What specific markets set the "price" for Ethereum.  I'm assuming it's some type of open market model, but can't find any information on the standard used?  For instance, Coinbase displays a price when purchasing; where is this derived from?

Subsequently, what drives the (sometimes drastic) intraday price changes?  Supply can't possibly change that much in a short period of time.  Is it just "public sentiment" of a few of the more active traders?


texts: What Sequence Occurs 'Under the Hood' When an Ethereum Contract Function is Called?

texts:
It seems when a single function is called, the Ethereum Virtual Machine:

Does 'pre-call checks' for exceptions/errors.
Computes the amount of gas needed, checks that the accounts involved exist.
Gets the function parameters.
Creates a calldata buffer & returndata buffer in memory, as subtly depicted in py-evm code:

Consumes Gas and performs the compute via stack operations & opcodes. (SideQuestion: Are both stack operations & opcodes stored in the Virtual ROM EVM code?)
It seems the evm does a '1st pass' where the values & pointers are added to the stack [and to the stack's memory scratchpad as needed].
(Uncertain as to this ^ process?)
Then once the function completes/returns, the EVM discards memory (including the the 2 buffers) & stack frame data.

Main source: Ethereum's py-evm i.e. https://github.com/ethereum/py-evm/blob/0ff7bc0f820250d7f15e804bc09870776ea34eb5/eth/vm/logic/call.py

What am I missing here?

When I step through on Remix to view the stack, it seems the EVM does a '1st pass' where it loads what the function needs into the function's stack + memory, is this correct? Is this referred to as the function's call stack/call frame?

It seems many devs including myself are unclear on this 'under the hood' sequence.  Thank you.


texts:
I have a fairly complex contract that inherits from a bunch of other contracts, like the OpenZeppelin ERC20 libs and Oraclize libs.

When I go to deploy it onto testnet in Remix or Mist, it says that the gas required is 6.3 million, which exceeds the limit.  Is there a way that I can deploy it piecemeal, or do I simply have to make the contract less complex?

If I don't use Oraclize, gas required goes down to 4 million and I can deploy the contact successfully.


texts: Differences between local testrpc and Ropsten testnet

texts: I've noticed that smart-contracts will behave differently when deployed on Ropsten vs local testrpc. I was wondering what specifically changes when a contract gets deployed.


texts: geth + truffle-hd-wallet accounts not listed properly

texts:
I have setup a latest single node geth for my learning. I am also using truffle-hd-wallet in my app. While in my app i do not get the correct coinbase account on using 'web3.eth.getCoinbase()'; the same command in the geth cli gives me correct coinbase account.

In my app 'web3.eth.getCoinbase()' retunrs me the first account created by truffle-hd-wallet.


texts: Transaction created by non-miner node is not mined in private blockchain

texts:
I create a private chain, and setup two node, one is miner and the other one is not.
Block sync between two nodes is fine and send transaction through sendTransaction method is also fine.
But transactions sent by non-miner node with sendRawTransaction method or sendSignedTransaction method are always in pending statues and return null when using eth.getTransaction(hash) on miner node.
Here is response when i do txpool.


texts: Generating a React UI given a contract ABI

texts:
Is there a way to automatically generate a React input form as per a contract address and ABI input by a user? The user inputs a contract address and an ABI. Now, an input form is generated for him as per the contract functions. He can now input values and make transactions to that contract from this UI.
I have looked at https://github.com/hiddentao/ethereum-abi-ui but cant seem to figure out a React hooks implementation of it.
Please also mention any worthwhile smart contract UI development resources etc.
Would love to have your guidance in this regard.
(quite surprised how the post title rhymes)


texts: Synchronisation failed, dropping peer; err="retrieved hash chain is invalid"; message loop

texts:
I have clique private proof-of-authority chain.

I have updated all signer nodes' (currently I have 3 signer nodes) geth version to minimum Version: 1.8.16-stable. Also I have updated the other node that gives the error to v1.8.16.

The way I run my geth also tried without --syncmode fast flag.

geth --syncmode fast --cache=1024 --shh --datadir $DATADIR/private  --rpcaddr 127.0.0.1 --rpc --rpcport 8545 --rpccorsdomain="*" --networkid 12345 --rpcapi admin,eth,net,web3,debug,personal,shh

Error I am having on multiple nodes that are connected into the network.

########## BAD BLOCK #########
Chain config: {ChainID: 23422 Homestead: 1 DAO: <nil> DAOSupport: false EIP150: 2 EIP155: 3 EIP158: 3 Byzantium: 4 Constantinople: <nil> Engine: clique}

Number: 1260001
Hash: 0x659e96f35e1fa1c39fc3b8370a336f78787e482aef44e56bbe6dd9e10bb06bdc

Error: recently signed
##############################

WARN [10-05|15:49:57.694] Synchronisation failed, dropping peer    peer=ae57fcb24c19102e err="retrieved hash chain is invalid"
INFO [10-05|15:49:57.694] message loop                             peer=ae57fcb24c19102e err=EOF
ERROR[10-05|15:50:07.707]
########## BAD BLOCK #########
Chain config: {ChainID: 23422 Homestead: 1 DAO: <nil> DAOSupport: false EIP150: 2 EIP155: 3 EIP158: 3 Byzantium: 4 Constantinople: <nil> Engine: clique}

Number: 1260001
Hash: 0x659e96f35e1fa1c39fc3b8370a336f78787e482aef44e56bbe6dd9e10bb06bdc

I have reverted back the blockchain into some previous block number, debug.setHead("0x124F80") (1200000 th block) but it did not help.
Please note that I have to remove my chaindata geth removedb and sync from the start, which also didn't help.

Possible Solution:

Should I take back the signer nodes' blockchain data to point where error does not occurred using debug.setHead()? This could be a short-term solution where the same error could be occurred again.

=> Opened issue.


texts: What does State Trie save when pushing into array?

texts:
I'm interested/worried about the size of the State Trie over time

Lets suppose I have a contract with two vars:

uint myNumber;
uint[] myArray;

As far as I understand, If I change the value of "myNumber", a new copy of it will be added to the State Tree (thus taking more HDD space), which is fine and needed because if we ever want to rebuild data history from a previous state we need it (and maybe rewrite-performance reasons).

But, what about if I push (increase length and set value) a new uint into "myArray". Will the whole array be copied to the new State Tree? Or only the new "uint" will be added to the tree and the array will be rebuilt by iterating over the State Tree/DB?

I'm not asking about mappings because I assume they are just spread independent variables in the memory. Are arrays the same kind of "magic"?

Thanks!


texts:
I wanted to access (update/get) data from a mapping in another contract.   Is it possible to access the mapping variables without writing a function to read/write.  I looked at (here) but still little unclear on the approach.

I am getting an error "Indexed expression has to be a type, mapping, array at the line - "myData.contractsMap[_name].push(_value)"

Any suggestions?  Thanks,

pragma solidity ^0.4.15;

contract Data {

    mapping (bytes32 => uint[])  public contractsMap;

}

contract ContractCreator {

    Data myData;
    uint[] myValueList;

    event Log(bytes32, uint);

    function ContractCreator() public {

        myData = new Data();
    }

    function setElements (bytes32 _name, uint _value) public {

        myData.contractsMap[_name].push(_value); //ERROR
    }

    function getElements (bytes32 _name) public {

       myValueList = myData.contractsMap[_name];
       for (uint i = 0; i < myValueList.length; i++) {
           Log(_name, myValueList[i]);
       }
    }
}


texts:
Hi' I'm trying to get a balance of erc 20 tokens of given address in my solidity sc, but it always gives me back 0. I tried to play around with it for hours and can't find where the mistake lays. Could someone help, please ?

pragma solidity ^0.4.25;
contract ERC20 {
    function transfer(address receiver, uint amount) public;
    function balanceOf(address tokenOwner) public constant returns (uint balance);
}
contract TestErc20{

 function getBalance() public view returns(uint) {
    ERC20 t = ERC20(0xCCF1C01067E4200F0E4ddb1f2f3cCEa85A18aa2C);
   return (t.balanceOf(0xb06029664056f44437F4E82cFB2D6B153513F0B8));
  }
}


texts:
I have created an account in metamask and have got some ether tokens. Now I would like to convert them into INR so that I get hard cash.
Please let me know the procedure to do it.


texts: What does "participation rate" mean in the context of ETH2?

texts:
https://decrypt.co/41503/how-an-attacker-might-try-to-break-ethereum-2-0?utm=facebook

Jelurida co-founder Lior Yaffe claims that a low participation rate could allow whales to crash the network. But an Ethereum developer says the attack would be much more expensive.

Yaffe considered a situation where the network participation rate is low and some whales are quietly using multiple accounts. Since the network has a minimum participation rate of 66%, if a whale drops out suddenly—knocking it below this threshold—it could cause issues. And if there’s not much money being staked, this could be surprisingly feasible.
“Let’s assume that 10% of the ETH is now staking and that network participation is 75% (which is pretty much what we see on testnet now). In this case to drop the participation rate by 9% to halt the chain only requires control of 0.9% of the ETH in circulation. Certainly achievable by a large whale or a mid size exchange,” Yaffe told Decrypt.
“So all you need in order to stop the network maliciously, is to hold the difference between the current participation level [and] 66%,” he added.

What does "participation rate" mean?


texts: Can using getTransactionCount() + 1 prevent waiting for pending transactions?

texts:
I tested sending multiple transactions with a low time gap, and I knew that they will wait for previous transactions to be confirmed. I did not use Nonce in the transaction code as it is optional. But I would like to know, is there any way to send transactions without waiting for confirmation of previous ones?
I thought about using nonce = getTransactionCount() + 1, although, I am not sure is it correct or not? and which condition I have to set in it amoung latest, earliest or pending for this solution.


texts: Do you have to pay gas each time you deploy a DAPP and if so does that mean you have to pay gas for updates as well?


texts: I'd like to use regtest mode on Ethereum. Does it exist? If so, how can I use it?


texts: Executing reentrancy on Truffle Console: attacker not stealing 5 ether , why only 2 reentrant calls?

texts:
I am doing the example provided at:
JustDev
I have parameterized the withdraw method.
Victim SC is:
pragma solidity ^0.5.8;
contract Victim{
   address owner;
   constructor() public{
      owner = msg.sender;
   }
   function  withdraw(address payable to, uint amount) public{

     // uint transferAmt = 1 ether;
      require(tx.origin == owner);
      (bool success, ) = to.call.value(amount)("");
      require(success);
   }
   function() payable external {}
}

The Attacker SC:
pragma solidity ^0.5.8;
import './Victim_tx8.sol';
contract  Attacker{
   uint amount = 1 ether;
   address payable owner;
   Victim  public v;
   uint public  count;
   event LogFallback(uint c, uint balance);

   constructor (address payable victim) public {
      owner = msg.sender;
      count =0;
      v=Victim(victim);
   }

   function attack(address payable to, uint a) public {
      v.withdraw(to, a);
   }

   function () external payable{
      count++;
      emit LogFallback(count, address(this).balance);
      if(count < 5 ) {
         v.withdraw(owner,amount);
      }
    }
}

I think it is not executing the reentrant call 5 times (why?). I used the Truffle console and executed the following commands:
       V = await Victim.deployed()
       A = await Attacker.deployed()
       acc2 = accounts[2]
       web3.eth.sendTransaction({to:V.address, from:acc2, value: web3.utils.toWei('15')})//executes the transaction
       Vbal = await web3.eth.getBalance(V.address)
       web3.utils.fromWei(Vbal, "ether")
       15
       await A.attack(A.address, web3.utils.toWei('1',"ether"),{from:accounts[0]})//executes the transaction
       Vbal = await web3.eth.getBalance(V.address)
       web3.utils.fromWei(Vbal, "ether")
       '13'
       Abal = await web3.eth.getBalance(A.address)
       undefined
       web3.utils.fromWei(Abal, "ether")
       '1'

Initial balance of Victim is 0, and incremented to 15. During reentrancy Withdraw(..) is transferring Ether, but Victim final balance is '13', and attacker balance is only '1',why?. Somebody please guide me why there are not 5 rounds of reentrant calls?


texts: Factory contract pattern with ether.js and solidity

texts:
I am new to programming with solidity and ethers.js and web3.js.
I have created a factory contract with solidity as described in this blog post: factory pattern. I am now working on the front end, web3-react and ether.js. I see that ether.js has contract factory API, but it seems, if understand correctly, that ether.js allows you to deploy the "child" contracts directly, thus making a factory contract in solidity redundant.
The problem is that the factory contract in solidity serves two purposes one to deploy child contracts and two to track the deployed contracts, whereas, ether.js only deploys contracts.
How does one handle tracking, or more specifically mapping account to deployed contract address with ethers.js? Does one create a separate contract for tracking only, and then send an update that contract each time a new contract is deployed by the factory? Or, are there any other recommended patterns to solve this?


texts:
I am working on a react application and just can't catch the web3 object of mobile wallets. Catching web3 in Metamask works like a charm.

Here's my code so far:

componentDidMount() {
    window.addEventListener("load", () => {
      let web3 = window.web3;
      if (web3) {
        web3 = new Web3(web3.currentProvider);
        web3.eth.getAccounts().then(accts => {
          web3.eth.net.getNetworkType().then(network => {
            this.setState({
              web3,
              isConnected: true,
              network: network,
              user: accts[0]
            });
          });
        });
      }
    });
  }

So far I've tried Trust Wallet and Status Wallet and none of both works with the existing code.

I have also tried to user web3.currentProvider.isTrust but that doesn't seem to work either.

Edit:
I also tried to set an interval to check for the web3 object every few seconds. But that didn't work either.

Edit 2: Since I'm using web3js 1.x I tried the following:

componentDidMount() {

  window.addEventListener("load", () => {
    if (Web3.givenProvider) {
      let web3 = new Web3(Web3.givenProvider);
      alert(web3.currentProvider.host);
      console.log(web3.currentProvider);
      web3.eth.getAccounts((err, accts) => {
        if (!err) {
          web3.eth.net.getNetworkType((err, network) => {
            if (!err) {
              this.setState({
                web3,
                isConnected: true,
                network: network,
                user: accts[0]
              });
            } else {
              alert(err);
            }
          });
        } else {
          alert(err);
        }
      });
    }
  });
}

As you can see I'm trying to get error messages with the alerts. Now status responds with You tried to send "undefined" synchronously. Synchronous requests are not supported, sorry. I don't get it. This is not a synchronous request?!

Trust also tells me Error: Trust does not support calling undefined synchronously without a callback parameter to call undefined asynchronously..


texts: Homebrew parity install fails with 'no available formula'

texts:
The following installation of Parity via Homebrew on MacOS:

 brew install parity --beta --verbose

fails with

 Error: No available formula with the name "parity"

What can I do?


texts: How to issuance/earn/exchange ether coins in private/consortium network?

texts:
When we building private/consortium blockchain network with Ethereum for cross enterprise business scenario, we need to consider difficulty/gasLimit in initial genesis file to make fast transaction than public ethereum network.

We also know all transactions are NOT free, they need to pay their transations with eth coins. And they can earn eth coins via mining, but not all nodes will become mining nodes, for example, in https://labs.eleks.com/2016/10/secure-document-transfer-built-top-blockchain-technologies.html, how the client nodes can earn eth coins? buy from others? Any suggestion/practice from real project?


texts:
What are DeFi Smart Accounts?
And how they are different from ethereum accounts?
It seems "Smart Accounts" is not exact thing, non-standard within Ethereum ecosystem


texts: How can we login/unlock ethereum account using keystore file as "UTC---"

texts:
What I have

successfully unlock account with password using web3 api(personal.unlockAccount).

What I Want

If user did not remember their account password, in case of that I want to unlock account via keystore file in private blockchain, if he/she has a keystore file of their account.
If it is possible, How can I get directory path of keystore file of an account and their filename by passing their account number programmatically (web3 api or other).


texts: Is there any Reentrancy attack in given code snippet? If yes then how can I fix it?

texts:
function withdrawForeignTokens(address _tokenContract) onlyOwner IsAuthenticate public returns (bool) {
        ERC223Interface token = ERC223Interface(_tokenContract);
        return token.transfer(owner,token.balanceOf(address(this)));
    }

In above code IsAuthenticate is modifier to authenticate my current contract.


texts: web3 not connecting to Infura / Rinkeby Testnet

texts:
I've successfully deployed my Smart-Contract to the Rinkeby TestNet via Remix.
Everything works perfectly from within Remix.

But when I try to get my web DApp to fire methods in my Smart-Contract - nothing's working.

Here's my code for integrating infura to my DApp:

// WEB3 SET-UP:
if(typeof(web3) !== 'undefined') {
    console.log("Web3 provider found! Current Provider is WORKING!");
    web3 = new Web3(web3.currentProvider);
}
else {
    console.log("NO Web3 provider found!  Gonna set one up...");
    // This is NOT working:
    web3 = new Web3(new Web3.providers.HttpProvider("https://rinkeby.infura.io/<MY API KEY>"));

    // This is the code I was using to connect to localhost - as provided by Ganache
    // which IS working perfectly well:
    //web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'));
    console.log("OK, NOW we DO have a PROVIDER --> HttpProvider = ", web3.providers.HttpProvider);
}

Of note:
-I did update my Contract's Address in my js code to reflect its new address on Rinkeby, so I know that's not the issue.
-The only thing that's different about this code from the version that was working is the HttpProvider.  When its set to localhost: 8545 (provide by running Ganache) everything is fine. Its the switching to rinkeby.infura.io/<MY API KEY> that breaks things.


texts:
I'm trying to install Parity.

What i did is run:

sudo dpkg -i Ethereum.deb

And it suppose to be installed, but when I run:

sudo parity

It says:

  unable to execute /usr/bin/parity No such file or directory

When I search Parity on computer it finds it in bin folder.

So what to do?


texts: Allow a wallet to call a single contract

texts:
I want to build an electronic device. This device can be a raspberry pi with a ledger USB device, or anything else.
This device will need to call an Ethereum smart contract. For example let's suppose i want to measure temperature and to write something on the blockchain if temperature is greater than a threshold.
So i need to embed a wallet inside the device because it will spend GAS/Ether for transactions.
This device will be outdoor and i have to consider it might be stolen.
What i want to do is to protect the wallet in order to only allow calls on a specific smart contract. If someone stole the device and access to private key, i want to be sure he won't be able to spend Ether for anything else.
Is it possible to do that ?
Thanks


texts: How to trace token transfer that may contained in contract inner transactions

texts:
Take this transaction as an example.
This single transaction contains 50 inner transactions.

If directly calling api, what we get is a very long raw hex in input field. This input actually contains the contract method info and the method params. And it seems that the contract method is actually a batch transfer, but the creator does not provide the full code.

Here comes the issue, if I need to monitor this token transfer by code, how can I deal with this kind of transfer? As everyone can create new contract, do I need to trace all contracts that deal with this kind of token?


texts: How can i send Ethers from My account to sombody else using Smart contract? from truffle frontend

texts:
I am making Dapp in which a user wants to pay or transfer certain number of Ethers to another Account.
I am using truffle to build the dapp. In which including other features Users has a frontend to transfer Ether from his account to account he provides. i.e

Input for Number of ethers
Input for account address

Send ethers button
The problem i am facing is how can i transfer ethers from my account to account i have provided with Smart Contract?

reciever.transfer(amount)

is throwing an gas limit error which is confusing me as i have 100 ethers in my account.

Sending funds to a contract and have it immediately forward to a given address?

whatever the workaround could be, just that does the job of moving Ethers from one account to the given account. From frontend of my app.


texts: To perform getTransactionReceipt on old blocks do I need full or fast node?

texts: If I need to run eth_getTransactionReceipt(txhash) on old transactions, will a fast node suffice or do I need to run a full node? I have heard conflicting answers and would prefer not to download a full sync if possible.


texts: Front running, events, off-chain and on-chain

texts:
With frontrunning in the headlines these days due to raids on platforms like Uniswap I was wondering from a technical point of view how these guys are able to do it ?  I'm still learning Ethereum with all the pros and cons, especially with subjects such as the txpool.
I've watched the successful bots closely and they all seem to be using smart contracts.  My initial guess was that everything was done on-chain, however, after learning that smart contracts cannot listen to events of other smart contracts, I'm not so sure that is the case anymore.  How can a smart contract trigger a trade if it is not notified by some event of doing so ?
So all that I can think of is that an off-chain bot is going through every single pending transaction in the txpool and when it detects what it's looking for, it calls the on-chain smart contract to execute the trade.
Is my thinking correct on this ?
My second question would be is there a way to stop them?
I did not mark a correct answer below as both answers add a lot of value and completed the picture in my opinion


texts: Connecting to blockchain on azure using web3.js and websocket

texts: right now, I am trying to write a service using web3 which will 'subscribe' to all 'perndingtransactions' on blockchain to perform further actions. web3 documentation says that 'Httpprovider' cant be used for subscription, instead 'Websocketprovider' should be used. Does anybody know how to enable websocket in Azure node?


texts:
It looks like if I wanted to I could have the same private and public key for: Ethereum, Ethereum Classic, Tomochain, Vechain, Wanchain, and Aion networks because they were all built on a copy of Ethereum.

What other networks exist like this? Is there a comprehensive list somewhere?

(It got me thinking about a fun scavenger hunt: give a key but don't tell what network it is. Let the race begin!)


texts:
I made a small contract test like:

contract Test {

function send() payable public {
    address payable recipient = 0x14723A09ACff6D2A60DcdF7aA4AFf308FDDC160C;
    recipient.transfer(1000000000000000000); // send 1 Ether
}

After deploy the contract, I set the "Value" to 2 ether, then called the method "send" which will transfer 1 ether to another address.

Expected result: -1 ether in the sender and +1 in the receiver the "extra" ether (I set in value) is supposed to not be spent, but returned to the sender, right?

The result is: the receiver (0x147...) gets 1 ether, as expected, but the
amount discounted from the sender is 2 ether...

why?

where does the unused ether goes?

Thanks in advance


texts: How do I automatically mint ERC-20 Tokens Every time the owner wallet transfers coins

texts:
I want to start with a total_supply of 1,000 Tokens in the owner wallet.  Each token will represent a gram of gold. Every time 1 token is transferred from owner wallet to another wallet, the owner wallet should be refilled with 1 token.  Thus, always keeping the owner wallet at 1,000 Tokens.

Questions:
1. What is the best way to do this?
2. Is there a way where I wouldn't have to pay gas every time coins are minted to owner_wallet?
3. I'd like to accept Bitcoins and Alt coins for this token. What is a good process to have the owner tokens send automatically to people who have paid with Bitcoin and Alt coins?  Is there a Dapp or open source script you recommend looking at?
4. Do you have any recommendations or suggestions If I want each token to represent a commodity?

Thanks in advance


texts: I don't understand why my function is not working

texts:
I have a read function to check whether someone should go and use the write MakeEligible function. Here is the code:

function ShouldIMakeMyselfEligible(address) public view returns (bool) {
    if (_RestrictedFromDividend[address(msg.sender)]) {
        if (now >= (ClaimTime[address(msg.sender)] + 10 minutes)) {
            return true;
        } else {
            return false;
        }
     } else {
        return false;
    }
}

I have tested that yes, the address is _RestrictedFromDividend, and also if they claim before 10 minutes has passed in the following function:

function MakeEligible(address) public {
    if (now >= (ClaimTime[address(msg.sender)] + 10 minutes)) {
        _RestrictedFromDividend[address(msg.sender)] = false;
    } else {
        _RestrictedFromDividend[address(msg.sender)] = true;
    }
}

Nothing will happen and they will remain _RestrictedFromDividend, which is what I want to happen. Once 10 minutes has passed, even though ShouldIMakeMyselfEligible will return false, using the MakeEligible command will successfully make the _RestrictedFromDividend go away. So I know that the ClaimTime is updating and calculating correctly but in the first function something has gone wrong. Can someone help me?


texts: Will Casper be "backwards compatible" with currently issued tokens such as ERC20 tokens?

texts:
With Casper now available for testing, does the protocol work with regular ERC20 tokens?

For example if Casper becomes the main protocol for the whole Ethereum network and the old PoW method is gone, will this effect tokens already issued?

If creating a token now that wants long-term functionality with the best Ethereum possible, should I be doing something different than creating a regular token, to ensure that it is fully functional with Casper in the future?

I appreciate input on this as I cannot find much information anywhere regarding Casper and "backwards compatibility".

Thank you.


texts: Stateful data in Blockchain (modified hashes)?

texts:
I am wondering about Smart Contracts: as such, they reside inside the Blockchain, this means they have to be stateless.
If the state of a SC changes (i.e. changing the value of a variable), the hash value of the overall SC changes and as a consequence the Blockchain is broken.

So, where is the stateful data stored?
Or does it mean that each time stateful data (i.e. value of variables) change, the same SC will be stored again and again on the Blockchain, meaning a multitude of instances of the same SC?


texts: Revert not throwing error when running truffle test

texts:
I have set up a local geth on ubuntu and I'm running my project on it.

While writing test cases, I saw that the test cases which were working fine in testrpc environment started facing issues when run on local geth developement environment.

I don't get any error message from my test case when revert() is caught in my solidity code.

Here the example:

myContract {
   function ExpectedARevertWhenCalled(){
       revert();
   }
}

Now when I call this method in my test. The test cases should fail but no error is thrown.

Can someone please help understand the issue behind it?

FYI: This is how I'm calling the method in my test case:

contract('MyContract', async () => {
  it("myContractFunction", async () => {
    let obj= await TwoKeyReg.new();
    await obj.ExpectedARevertWhenCalled();
  });
});


texts: Getting transaction receipt with a reverted transaction to determine how much gas was used?

texts:
In web3.js, if a revert occurs, it doesn't give a receipt along with it. I want to determine how much gas was actually used after a revert.

In 1.0, I can't even get the tx hash from the event transmitter.


texts: What is the difference between testnet and private networks?

texts: I would like to make some improvements to ethereum's protocol and came across two terms- private network and testnet. What is the different between them? networks? Can other people see my nodes in testnet?


texts: Metamask not loading transaction fee on Ropsten

texts: I'm trying to send test Ether to a contract on Ropsten, but Metamask won't load the gas options on the send transaction screen. It displays a "Loading" text and never renders the Fastest/Fast/Slow options. It also doesn't let me manually enter the Gas price in the Advanced Options menu.


texts: Is it possible to have separate eth receive address with each user

texts: I want to accept ethereum from a crowd for selling something from my webpage. I want each individual to send ethereum on an assigned receive address. Is it possible to assign separate ethereum address to each individual.


texts: Determining Contract Address with web3 1.0

texts:
I am using a local testnet node (Geth 1.7.3) in light mode, and in such case the transaction receipt does not contain the contractAddress when a new contract is deployed.

Therefore I am looking to determine the contract address myself. From what I read it is determined from the nonce and the account: How is the address of an Ethereum contract computed?

I am trying to repliate the logic explained in this post in Python:

def mk_contract_address(sender, nonce):
    return sha3(rlp.encode([normalize_address(sender), nonce]))[12:]

In Javascript using web3 1.0.0-beta.26 and RLP package https://github.com/ethereum/wiki/wiki/RLP
My attempt is this:

var mainAccount = "0x5e03df21b770c783b1641bb3b49924e2fed0b3a7"
var Web3 = require("web3")
var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"))
var RLP = require('rlp');

web3.eth.getTransactionCount(mainAccount, (err, nonce) => {

    console.log(web3.utils.sha3(RLP.encode[sender,nonce]))) ;
});

But I do not get the same address once the contract is deployed


texts:
Is Gas displayed on "Remix" at function execution the same as when executed on the main net?

I'm using the Javascript VM as the environment.


texts:
I am really new into contracts and tokens, I wanted to learn how to deploy a contract, so I grabbed someone else's contract and tried to deploy it on BSC. I was following tutorial on youtube and everything went fine, but when I tried to deploy my contract I got:
Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
Internal JSON-RPC error. { "code": -32000, "message": "execution reverted" }

I tried changing gas fee from 300000 to more or less but nothing seemed to work.
Contract that I tried to deploy is available here


texts: If i can deploy an ERC 20 to an exchange and sell it is it technically free money?

texts:
Can you deploy an erc 20 token to an exchange?
Can you sell your own erc 20 for money?
Is this free money because when you deploy it, it gives you all the erc 20 to your address.


texts: What's a recommended way to pass secret in Solidity?

texts:
Hi I'm an Ethereum noob just trying something out.

I have a quick question for the community here about passing secrets in Solidity. Since, we can only control who can change state variables in Solidity, the values inside variables can be seen by the public.

What's the recommended way to implement a Smart Contract that shows certain values to specific address? Can I encrypt my message with the public key (address) of the intended recipient? And let the recipient decrypt the message with their private key? How would I do that in Solidity?

Thanks

Related: Current methods to send encrypted messages from contracts


texts: SHA3_512 library, convert the input and output to 512-bit bytes

texts:
The SHA3_512 library takes an input uint64[8] and outputs uint32[16]. To convert the input from 64 bytes and the output back to bytes, I wrote this, but it gives the wrong result. What are some examples that work?

    function 64bytesToSHA3_512(bytes _message) returns (bytes) {

        uint64[8] memory input;

        for(uint i = 0; i < 8; i++) {
            bytes8 oneEigth;
            // Load 8 byte from _message at position 32 + i * 8
            assembly {
                oneEigth := mload(add(_message, add(32, mul(i, 8))))
            }
            input[i] = uint64(oneEigth);
        }

        uint32[16] memory output = hash(input); // hash() is in contract SHA3_512

        bytes memory messageHash = new bytes(64);

        for(i = 0; i < 16; i++) {
            bytes4 oneSixteenth = bytes4(output[i]);
            // Store 4 byte in messageHash at position 32 + i * 4
            assembly { mstore(add(messageHash, add(32, mul(i, 4))), oneSixteenth) }
        }

        return messageHash;
    }


texts: Web3 js proper way to call a Reading contract function

texts:
So i recently took over a project that had been abandoned for a while, which involves an ECR20 smart contract and the use of the web3 library to communicate with the smart contract.
I've been trying for days to only call a read function or just a property, but I always get the following error:

Uncaught Error: The MetaMask Web3 object does not support synchronous methods like eth_call without a callback parameter

No matter which function i call, it's always the same. The contract instance is fine because there is another call to writing function in the same script and i'm using that same contract instance, but I'm not sure what is the proper syntax to call the funcion, so far i've tried these approaches (trying to call whiteListedAddresses function):

console.log(Coursetro.whiteListedAddresses(address).call()); //try 1

console.log(Coursetro.whiteListedAddresses(address)); //try 2

Coursetro.whiteListedAddresses(address).then(console.log); //try 3

Coursetro.whiteListedAddresses(address).call().then(function (result) {
  console.log(result + ' is the result');
}).then( function () {
  console.log("final call");
}); //try 4

Coursetro.whiteListedAddresses().call({'address':address}, result =>{
console.log(result);
}); //try 5

And other approaches, but nothing works, i can't get to read anything. Anyone knows what is the proper way to read from a contract?

--EDIT--

Contract initialization:

var CoursetroContract = web3.eth.contract(ABI);

 var Coursetro = CoursetroContract.at(contractAddress);

Like i said, this is working fine since other functions are being called and they are working, but they are all writting functions, and i'm trying to call reading functions.

web3js version is 0.20.7

these 4:

console.log(Coursetro.whiteListedAddresses(address).call()); //try 1

console.log(Coursetro.whiteListedAddresses(address)); //try 2

Coursetro.whiteListedAddresses(address).then(console.log); //try 3

Coursetro.whiteListedAddresses(address).call().then(function (result) {
  console.log(result + ' is the result');
}).then( function () {
  console.log("final call");
}); //try 4

output:

Uncaught Error: The MetaMask Web3 object does not support synchronous methods like eth_call without a callback parameter

and this one:

Coursetro.whiteListedAddresses().call({'address':address}, result =>{
console.log(result);
});

outputs:

Uncaught Error: Invalid number of arguments to Solidity function

which doesn't make any sense to me because the function only takes an address.


texts: creating an exchange platform based on ethereum smart contract

texts:
I am trying to build a platform ( similar to a wallet website ) that allows authenticated users to trade currency between them. this currency is not a real currency so it can be just a regular erc20 token.

my question is regarding the implementation of this idea, would it be better to start on my own ( from scratch ) or use something like the 0xProtocol. ?


texts: What are the different GUI's available for Ethereum?

texts: Are there any easy to use GUI's for Ethereum?


texts: Getting infinite gas estimates for simple functions

texts:
I am testing out solidity in remix ide using simple contracts. This is the contract that I wrote:

 contract mortal {

address owner;

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

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

contract Hello is mortal
{

string public message;

function Hello(){
    message = 'This is the initial Message';
    }

function getMessage() public constant returns(string){
    return message;
    }

function setNewMessage(string newMessage) public payable {
    message = newMessage;
    }
}

On looking at details I am getting infinite gas estimates for each of these functions.

{
"Creation": {
    "codeDepositCost": "243200",
    "executionCost": "infinite",
    "totalCost": "infinite"
},
"External": {
    "getMessage()": "infinite",
    "kill()": "30636",
    "message()": "infinite",
    "setNewMessage(string)": "infinite"
}
}

Please elaborate why am I getting infinite gasEstimates for these functions and how can I avoid this mistake ?


texts: Fail to verify source code on Etherscan using API with constructor arguments

texts:
I am trying to verify source code on etherscan using API listed here. I have successfully verified the simple contracts (without constructor).

Now I am trying to verify a sample contract with constructor like:

pragma solidity ^0.5.0;

contract HelloWorld {
    address public owner;

    constructor (address _owner) public{
        owner = _owner;

    }

}

which is deployed here. I am passing the same encoded constructor argument as shown here. Code is running fine and returns OK response with the expected GUID.
But the issue is that after all this, contract is not getting verified. And when i check the verification status here in the bottom. It says:

>> Fail - Unable to verify

I didn't get any clue of this issue anywhere. Nothing seems wrong but it is not working.


texts: Programming Practice - using requires with return types

texts:
Can I please get some help with the following?  Is it acceptable practice to allow my functions to rely on require statements "passing" to return the correct value?  In the example below if the function does not revert due to the require statements triggering, return true.

I understand that time calculation is not precise in Solidity and I'm using SafeMath.  start and end are contract variables.

Example Function:

// ensure the current duration is valid.
function isValidDuration()
    public
    view
    returns (bool)
{
    uint32 calculatedDuration = uint32(end.sub(start));

     require(
        calculatedDuration >= 15 minutes,
        "The minimum session duration is 15 minutes."
    );

    require(
        calculatedDuration <= 1 weeks,
        "The maximum session duration is 1 week."
    );

    return true;
}


texts: does @ symbol has any significance in solidity?

texts:
In hyperledger when @ symbol is used in comments and it has its significance and is required before defining a function. I was going through some solidity code examples and I saw this piece of code

/**
* @title Ownable
* @dev
*/

so does that @ has any use or significance?


texts: How to send uint as an additional data with sendTransaction

texts:
In my web interface i am sending an id of a product and some amount of ETH to a smart contract.

instance.sendTransaction(productId, {from: account, value: amountToSend });

And in the smart contract i am trying to handle it lake this:

 address[16] public balances;

  function (uint productId) external payable {
    require(productId >= 0 && productId <= 15);

    data[productId] = msg.sender;
  }

But I am getting an error:

TypeError: Fallback function cannot take parameters.

So how can I send and read that productId inside of my contract?


texts: I need to upload 8Tb data to Swarm. I read docs but I can't understand: does public swarm work?


texts: pagination when reading mappings in solidity

texts: I am trying to read a lot of data from a smart contract mapping, How can I include pagination when retrieving data through smart contract methods?


texts:
I am trying to migrate contract on a block chain network created using azure ethereum consortium blockchain, But when I am running the command Truffle migrate it stuck at

 PS D:\sl\BCSLAC\bcdemo\sol> truffle migrate --network test
 Using network 'test'.

 Running migration: 1_initial_migration.js
 Deploying Migrations...

This message persists for long time and nothing happens after this, Can some one have idea what is the problem,

And the interesting thing is I have one more block chain network setup on azure(which I am using previously), If I try to deploy it on that network It works fine but not on the new one

I have searched for this issue and found one solution here which says delete DAG file,
As I am using Windows 7, the dag file location must be

  (HOME)/Appdata/Local/Ethash/full......

but I cant see any folder named Ethash in my AppData/Local folder


texts:
So I have been looking at solidity recently and got a hold of the voting app. Pretty simple to get a hold of. But here is what I am confused about (coming from the background of developing for the web/mobile):

In the context of a simple solidity based voting app that is holding the votes for a proposal

One can increase the vote when the method call is made. But there seems to be no explicit call to the 'blockchain' (and in that I am treating it like a database) to persist it. So does the EVM automatically write to the blockchain every-time I change a variable's value to the blockchain or does it do that once the function call ends and variable values have been finalized.
How does it decide which variables are to be written to the blockchain and which aren't. I might be using a simple counter variable (i=0) to keep track of a loop, say break out of the loop if it gets executed more than a 100 times. The counter is something I don't intend to persist to the blockchain.

In some places it has also been suggested that a state is maintained inside a smart contract, if so how can the state be same for multiple users using the same application?


texts: Right approach for syncing balance between ethereum contract and local database balance

texts:
So we are using an ethereum smart contract to store investor balances and also storing their balances in local portfolio tables. What would be the right approach to sync in a balance between ethereum smart contract and local db.

What I have in mind right now is to modify local db balance when making transaction call but then again if for some reason tx fails on smart contract level, it would create a discrepancy.

What would be the correct approach of doing this especially in production level ?


texts: What will happen to legacy smart contracts when Ethereum 2.0 is released?

texts: Most importantly, ERC20 and ERC721 tokens. Will they be migrated to the new chain? Will migration only be optionally possible for contracts with an owner? What about contracts which rely on proof of work features, like the difficulty data?


texts: cannot "npm install truffle-hdwallet-provider" succesfully

texts:
The install fails. Problems seems to be the request to: https://github.com/debris/bignumber.js.git

The error message is:

npm ERR! Error while executing:
npm ERR! C:\Program Files (x86)\Git\cmd\git.EXE ls-remote -h -t https://github.com/debris/bignumber.js.git
npm ERR!
npm ERR! error: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version while accessing https://github.com/debris/bignumber.js.git/info/refs?service=git-upload-pack
npm ERR! fatal: HTTP request failed

Do you know cause and action to solve it?


texts:
Can anyone point me to a good up-to-date tutorial on ethereum private networks?  The last one that I saw that was any good still refers to the "--genesis" flat (whereas now "init" is correct) and since I'm having trouble implementing my private network, I'd like to know for sure I have an up-to-date resource so I can debug better.

Thanks!

EDIT: I have been educated as to why this post isn't ideal for this forum.  My apologies.  Live and learn.


texts: What is the maximum number of blocks in a blockchain?


texts:
I am researching into the statistics of Ethereum and I an looking for a datum of how many non-zero balance account currently exist in Ethereum?

I know that in total 30M of accounts were created but how many accounts of those do have >0 balance?


texts: Problem registering an ENS name on the testnet

texts:
My Goal

I'm trying to register a name on the Ropsten testnet using the FIFSRegistrar located at 0x21397c1a1f4acd9132fe36df011610564b87e24b. I am using MEW to send the transaction.

Label and Hashes

I'll refer to the name as "myName.test", but use the real hashes.

The hash of my label is sha3('myName') = 0xc99b34b53e4b2e6ede6d30a0bb7d62dbb1c54f68113c9c189f572687fc778ecc.

The namehash I am registering is namehash('myName.test') = 0x4c432675fc6a71ce63b71b12db314c4857a215abc7768ad213ebbcf88bdb5bd3.

Transaction Attempt

My transaction is mined and seems to work as expected. In particular I can see in the Event Logs that it called the setSubnodeOwner() function of the ENSRegistry located at 0x112234455c3a32fd11230c42e7bccd4a84e02010. So far so good.

However, when I call the owner() function of the ENSRegistry and pass it the namehash of my name, it returns 0x0. Looks like my name is not registered after all...

Any idea why it is not working?

Thanks in advance.


texts: Clique: recommended sealer setup for small networks?

texts:
For example I have Proof-of-Authority private Ethereum network that has three nodes (pretty small network), which I control all the three nodes and can decide who is sealer or not. Later additional nodes can connect to those three nodes.

As main goal: I want to use all three nodes as miners to keep blockchain growing. In order to provide better network redundancy, which path should I take:

[Case-1] Only one sealer Ethereum Account that is unlocked on each three nodes?
[Case-2] or three different sealer Ethereum account that is unlocked on each three nodes?

Please note that each node under three nodes miner.start() is activated.

Possible Scenario:

I have only one sealer Ethereum account and I am using it on the three different nodes as a signer. In that case, if two node is down, remaining one node can keep up the mining process, since its Ethereum address is the only signer on the system.

On the other hand, if I use different sealer Ethereum account per node. If two node is down, since the remaining active sealer node (one sealer account left out out three sealer account) number is smaller than the 50% the mining process will be stopped.

[Q] If we have a small network, it seems like more redundant to have same signers on different nodes. Is it recommended to do this way or should I keep each node having different signers between each other?


texts: What's the difference between using Golang and writing code in Solidity to create a decentralized application?

texts:
I've been working on creating my first decentralized application, and I'm currently working on this tutorial which attempts to create a decentralized version of Twitter.

I want to integrate an IPFS to store data from users, but another guide that I took a look at used Solidity as the language before compilation.

In fact, this tutorial just distributes the code as a go file.

I'm confused as to how this might be compiled and distributed to the EVMs on the network, and how the process of compiling this application would go. And also - what are the differences between Golang and Solidity in terms of writing decentralized applications?


texts: How can I change the password of an account through a Solidity function?

texts:
I know that the password of an account in geth can be changed using the command geth account update on the geth console.

Do I have a similar function in solidity to change the account password which I can use in my smart contract?


texts: How to know the execution time of transaction when miner execute it

texts: When i send three consecutive transactions to my contract (deployed on ethereum testnet), how can i know the exact time (at milli/micro/nano level) which transaction executed (on miner side) first and which transaction executed later, by using java script. The etherscan just show all three trx time like high level i.e. Timestamp: (Nov-08-2019 07:13:35 AM +UTC). I think there should be some time delay between each transaction !


texts: can anyone explain the format of this input string to a function?