texts: Where is string stored in solidity storage?

texts:
I'm trying to check where is stored a string in storage in Solidity.

For testing this I'm using this code:

pragma solidity 0.5.4;

contract AssemblyString {
    string s; // slot 0

    function set(string calldata _s) external {
        s = _s;
    }

    function get(uint i) public view returns (bytes32){
        bytes32 r;
        assembly {
            r := sload(i) //we load the slot number i
        }
        return r;
    }
}

If I set string less than 31 bytes works fine as solidity specifies:

Deploy contract
set("ether")
get(0)

Output: 0x657468657200000000000000000000000000000000000000000000000000000a

The first part stands for the encoded string:  0x6574686572 equals "ether".
The second part is the size*2: 0xA equals 10 in decimal. (ether has 5 letters, then 5 times 2 equals 10)
All the zeros in between are padded to reach 32 bytes long.

But! if I set string more than 31 bytes, I can't find the string.
As the specification says, the data of the string is contained in the keccak256(slot).

When I search for
keccak256(0) = 044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d
To decimal:
1937035142596246788172577232054709726386880441279550832067530347910661804397

Output: 0x0

But if I debug the contract in Remix IDE, I found that the data is stored always in key 0x290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563,
dec: 18569430475105882587588266137607568536673111973893317399460219858819262702947
and the string is stored at that position.

What I'm doing wrong?

Thank you for your time.


texts: Solidity: call to other contract and check-effects problem

texts:
I'm struggling with following problem:

In the main contract I have this:

 function doSomething() view public onlyAdmin
 {
     require(!myOtherContract.isActive());
     // other stuff
 }

and the contract I'm calling has:

 function isActive() public view returns(bool)
 {
     return active;
 }

and I'm getting the warning:

  Potential Violation of Checks-Effects-Interaction pattern in
  MyToken.doSomething():
  Could potentially lead to re-entrancy vulnerability. Note:
  Modifiers are currently not considered by this static analysis.

How can I make it correctly to hide the warning?


texts: Will Bitcoin and Ethereum be linked/bridged?

texts:
Will Bitcoin be linked to Ethereum in the future?
If so - how will it link, and when is this planned to happen?


texts:
I'm building a Web3 app and I'm trying it out on the Kovan testnet. I'm trying to get some DAI. As far as I understand it the way to get DAI is to:

Exchange ETH for WETH.
Use Sai Tub contract to open a CPD.
Use Sai Tub contract to exchange WETH for PETH.
Exchange PETH for DAI.

I got step one and two done. Now I'm trying to call the Sai Tub contract to get some PETH (all those recent failed transactions were me ), but it rejects all requests.

Here is how I'm calling it:

async function wrapETH({ amountToWrapInEth, from }) {
  const Weth = new window.web3.eth.Contract(wethABI, wethAddress);
  const amountToWrapInWei = window.web3.utils.toWei(amountToWrapInEth);
  const receipt = await Weth.methods
    .deposit()
    .send({ from, value: amountToWrapInWei, gas: 90000 });
  return receipt;
}

async function openCPD(from) {
  const SaiTub = new window.web3.eth.Contract(saiTubABI, saiTubAddress);
  const receipt = await SaiTub.methods.open().send({ from, gas: 90000 });
  return receipt;
}

async function joinPool({ amountToPoolInWETH, from }) {
  const SaiTub = new window.web3.eth.Contract(saiTubABI, saiTubAddress);
  const receipt = await SaiTub.methods
    .join(amountToPoolInWETH)
    .send({ from, gas: 90000 });
  return receipt;
}

What am I doing wrong? How do you programatically obtain DAI using Web3? Does it have something to do with CDP?

BTW, if you could point me to another way of exchanging ETH directly with DAI on Kovan, that would help me out, too (even though ultimately I will have to solve the aforementioned problem). Thank you for any help!


texts: Where can publicly available names for accounts and ABIs for contracts be registered?

texts:
What are the most common public on-chain and off-chain services used for getting more information on an account or the ABI of a contract?

So far I have come across:

Consensys' Regis
A GlobalRegistrar and HashReg on Frontier (not sure if it's still used and what the differences between the two are)
uPort (this data is not public I guess?)
People uploading contracts on https://etherscan.io/

What are the go to places if I want to find more information for an account (e.g. associated name) or the ABI for a contract?


texts: How to make a token with modifiable price and supply?

texts:
I need to create an erc20 token with the function "payable" thats means that when you send some ether to the token contract (like 1 Token = 0.5 ETH) send the amount of tokens to the wallet that sent the ether, see an example here:

https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20-token-and-launch-an-ico-in-next-20-minutes-cjbcpwzec01c93awtbij90uzn)

But I need the permition to change the price whenever I want, and change the supply (burn and add tokens) too.

some examples?


texts: Delete Wallet AND disable Wallet address

texts:
How can I delete my Wallet (deleting the Wallet file) AND disable the blockchain address to prevent accidential money to be send and lurking there forever without access for anyone?

Thanks


texts:
OS: Ubuntu 18.04

I am following this guide (https://www.codeooze.com/blockchain/ethereum-dev-environment-2019/) to install Ganache, npm, and then Truffle.

Everything is fine till I execute

sudo npm install -g truffle

I get error,

/usr/local/bin/truffle -> /usr/local/lib/node_modules/truffle/build/cli.bundled.js

> truffle@5.1.2 postinstall /usr/local/lib/node_modules/truffle
> node ./scripts/postinstall.js

Error: EACCES: permission denied, open '/home/solidity/.config/truffle/config.json'
You don't have access to this file.

......

Error: Error while attempting to download and cache solc 0.5.8: Command failed: node ./build/cli.bundled.js obtain --solc=0.5.8
Error: EACCES: permission denied, open '/home/solidity/.config/truffle/config.json'
You don't have access to this file.

I checked GitHub for issue, and I'm not understanding how to use nvm (other than execute nvm install stable)

Here are my software versions

solidity@solidity:~$ solc --version
solc, the solidity compiler commandline interface
Version: 0.5.13+commit.5b0b510c.Linux.g++
solidity@solidity:~$ npm --version
3.8.6
solidity@solidity:~$ nvm --version
0.35.1
solidity@solidity:~$ node --version
v5.12.0

Short of uninstalling everything and reinstalling everything, how to fix this?


texts: Injected Web3 is not working in Browser-Solidity

texts:
I am  using Metamask for ethereum testnet. And when i deploy my contract it run in my memory. And when I select the Injected Web3. It is not selected. Now what to do??

Please help me.


texts: Can client updates / upgrades be pushed over the ETH network?

texts:
Is it possible for ETH clients to securely receive a live push notification/version update like the way OSX, MacOS does?

What are the pros and cons? : )

There could be a contract filter to gain prior approval to automatically upgrade version once it becomes available. Also a feature to signal, for whatever reason, if one wishes to remain on an older version.

Is this possible?


texts: What are the initial/zero values for different data types in Solidity?

texts: Zero values, as in what would placehold the value when a key in a mapping is not yet assigned.


texts:
KeyStore keyStore = new KeyStore(seedFile.toString(), Geth.LightScryptN, Geth.LightScryptP);
byte[] jsonAccount = keyStore.exportKey(keyStore.getAccounts().get(0), seed, seed);
Account importAccount = keyStore.importKey(jsonAccount, seed, seed);

transaction = Geth.newTransaction(nonceValue, Geth.newAddressFromHex(toAddress), new BigInt(amount), gas, new BigInt(gasTransaction), null);
transaction = keyStore.signTxPassphrase(importAccount, seed, transaction, new BigInt(3));

By using this code I signed transaction successfully and got all the value successfully.

Then I'm calling API by passing hash value to send transaction.

transaction.getSigHash().getHex()

https://api-ropsten.etherscan.io/api?module=proxy&action=eth_sendRawTransaction&hex=yourhex&apikey=YourApiKeyToken

I'm getting response like this.

{"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid RLP.","data":"RlpIncorrectListLen"},"id":1}

Please help me who knows the answer.


texts:
In order to get a list of transactions by account address I used the following code snippet -

function getTransactionsByAccount(myaccount, startBlockNumber, endBlockNumber) {
   if (endBlockNumber == null) {
     endBlockNumber = eth.blockNumber;
     console.log("Using endBlockNumber: " + endBlockNumber);
   }
   if (startBlockNumber == null) {
     startBlockNumber = endBlockNumber - 1000;
     console.log("Using startBlockNumber: " + startBlockNumber);
   }
   console.log("Searching for transactions to/from account \"" + myaccount + "\" within blocks "  + startBlockNumber + " and " + endBlockNumber);

   for (var i = startBlockNumber; i <= endBlockNumber; i++) {
     if (i % 1000 == 0) {
       console.log("Searching block " + i);
     }
     var block = eth.getBlock(i, true);
     if (block != null && block.transactions != null) {
       block.transactions.forEach( function(e) {
         if (myaccount == "*" || myaccount == e.from || myaccount == e.to) {
           console.log("  tx hash          : " + e.hash + "\n"
             + "   nonce           : " + e.nonce + "\n"
             + "   blockHash       : " + e.blockHash + "\n"
             + "   blockNumber     : " + e.blockNumber + "\n"
             + "   transactionIndex: " + e.transactionIndex + "\n"
             + "   from            : " + e.from + "\n"
             + "   to              : " + e.to + "\n"
             + "   value           : " + e.value + "\n"
             + "   time            : " + block.timestamp + " " + new Date(block.timestamp * 1000).toGMTString() + "\n"
             + "   gasPrice        : " + e.gasPrice + "\n"
             + "   gas             : " + e.gas + "\n"
             + "   input           : " + e.input);
         }
       })
     }
   }
 }

However, upon running the script, I am getting the following error.

Error: invalid argument 0: hex string without 0x prefix
    at web3.js:3143:20
    at web3.js:6347:15
    at web3.js:5081:36
    at getTransactionsByAccount (/root/files/js/getTransactionsByAccount.js:16:18)
    at <anonymous>:1:43


texts: I've paid with my cb account to obtain during an ICO for EUT tokens. Looks like per etherscan that token were disbursed successfully, but not sure where I can go or wallet I can use to see my token balance and if I decide to sell the tokens in the future. Do I need to sign up for an ethereum based wallet in order to view my tokens? I have the token holder key and contract address who provided the tokens. Can someone assist?


texts: What is the intended way for Ethereum contracts to interact with third party software?

texts:
Let us assume we have an Ethereum contract to issue software licenses. The contract creates an entry in it's local database to document the availability of the license to the purchaser. In which way should the issuer of the license check if it has been granted? Typically I would want to check this at runtime from within the licensed piece of software.

So more precisely the question is: What is the intended way for a third-party client to query the blockchain if the queries have to be run quite frequently and refer to potentially "old" data?

One commenter doubted that it may be useful to involve a blockchain at all in this task and asked for a motivation. One motivation might be that by putting license information into a blockchain you avoid distributing proprietary license files, which might open a path to a more generic way of software licensing. Furthermore, you do not have the license server as a single point of failure. And, as already pointed out by the commenter, the technical use of license would not be prevented even if the issuer goes out of business.


texts:
What's the quickest way to find the current blockchain size of the chain you're on?  I am sure there are ways to look up an authoritative size for ETH.

EDIT: Apparently I wasn't clear.  I am not curious about the size of the file on disk.  I want to know the size of the blockchain without downloading it.  I want to know the size of blockchains for currencies I am NOT running a client for.


texts:
I am testing a smart contract in Remix and I get the following error when trying to compare two bytes memory using "==":
TypeError: Operator == not compatible with types bytes memory and bytes memory.
This is my code :
function removeCertificate(bytes memory CertificateHash, address holder) external
    isAProvider
    isTheProviderOrHimself(holder, CertificateHash)
{
    address provider = _CertificatesPerHolder[holder]._CertificateFromProvider[CertificateHash];
    bytes[] memory listOfCert = _CertificatesPerHolder[holder]._ListOfCertificates;

    for(uint i=0; i < listOfCert.length; i++){
        if(CertificateHash == listOfCert[i]){
            ArrayRemoveResize(i, _CertificatesPerHolder[holder]._ListOfCertificates);
            break;
        }
    }

    delete _CertificatesPerHolder[holder]._CertificateFromProvider[CertificateHash];

    emit _RemoveCertificateIdEvent(provider, holder);

}

I get the error at line : " if(CertificateHash == listOfCert[i]){"


texts:
I would like to deploy an Ethereum template (the one provided on aws website : https://docs.aws.amazon.com/blockchain-templates/latest/developerguide/blockchain-templates-ethereum.html) in a private network with 3 nodes and I would like to understand how to estimate the price. I tried using the AWS calculator but it's too complicated. I know that depends on multiple parameters , but I would like to have an average ...

Thanks for the help !


texts: How smart contract versioning work with compiler?

texts:
As Solidity is keep updating and so the compiler.
In the beginning there was constant keyword which now is deprecated. So how does that smart contract is still working?
If i make some contract with ^0.4.21 and now the latest is 0.4.24 how it work?
I not getting the idea behind the working of smart contract.
Any help is much appreciated.
Thanks in advance


texts:
I wrote a function that takes three arguments and assigns the data to 3 public variables. This is the code in .sol file

uint[] public rule1;
uint cond1;
string name1;

function setRule (string _name, uint _cond, uint[] _rule) public {

        for (uint i = 0; i < _rule.length; i++) {
            rule1[i] = _rule[i];
        }
        name1 = _name;
        cond1 = _cond;
    }

After compiling and running the contract in geth CLI. I am checking the following commands.

token.rule1[0]

returns 0

token.setRule("my rule", 1, [1,2,3])

Tx is mined

token.rule1(0)

returns 0

token.name1

returns ""

token.rule1[1]

returns 0

I want to assign the values passed in arguments to the public variables. How to do it?


texts: Why does syncing with the Ropsten testnet appear to pause?

texts:
I am running a node with geth via the command geth --testnet --fast --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"

It is on block 924332 and I am trying to sync the full blockchain, but am getting a lot of warnings that say

  Synchronisation failed, retrying

and

  Ancestor below allowance

There are currently 986074 blocks in the blockchain (https://ropsten.etherscan.io/), and all I am getting in the console is those warnings and it no longer shows how many blocks are "pending", so I'm assuming that it thinks no blocks are left. Anyone know what I'm doing wrong?


texts: Passing very large array from solidity to web3

texts:
I have a large data array in the BC.
The array has 15,000,000 items of Car struct

struct Car{
 string tag;
 uint mileage;
 string make;
 string model;
 address address;
 string country;
}

I need to search for a:
specific model and
millage between X , Y and
country equals to X and
tag starts with a specific letter
(it gets more complicated).

Do you think its a good practice to pass back to WEB3 15M items and search in JS?
Doing this search in solidity will cost a lot of gas. and JS will be easier to search in.

How fast will WEB3 return this amount of rows?

Thanks


texts:
I have the following deployment script

var contract = web3.eth.contract(response.abi);
                var bytecode = response.bytecode;
                var options = {
                    from: web3.eth.defaultAccount,
                    gas: 1004000,
                    data: bytecode
                };

                console.log("Deploying the contract");

                contract.new(options

Everything seems to work also my contracts is deployed

https://ropsten.etherscan.io/address/0x12c135a0f44940f34379a063118a2a08143c3262

The problem is msg.sender is empty into the contracts
and the function return
0x0000000000000000000000000000000000000000

this is set in the constructor in the Ownable OpenZeppelin contract
but deployed this way it return 0x0000000000000000000000000000000000000000

My ABI https://pastebin.com/0XU4heNN

and bytecode https://pastebin.com/ThnDd1FC

The contract

pragma solidity ^0.5.2;

import '../../../node_modules/openzeppelin-solidity/contracts/ownership/Ownable.sol';
import '../../../node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20Mintable.sol';

contract PropertyContract is ERC20Mintable, Ownable {

}


texts:
I wrote a function that generate a key value.
the function codes is here

   mapping(string => bool) processedHash;
   mapping(uint   => bool) HashList;

function generateHash(uint256 _mintAmount, string memory _refNumber) onlyWhitelistAdmin whenNotPaused public returns(bool){
    require(processedHash[_refNumber] == false,'This transaction already processed');
    CreateKey memory cK = CreateKey({
    mintAmount:_mintAmount,
    ReferenceNumber:_refNumber});
    uint _Hash = uint(keccak256(abi.encodePacked(cK.mintAmount, cK.ReferenceNumber)));
    require(HashList[_Hash] == false,'This hash already generated.');
    HashList[_Hash] = true;
    processedHash[_refNumber] = true;
    return true;
    }

if generated a key before by a reference number, the key mustn't generate there for first require must run in the function and then the transaction must revert.

also I wrote this test in truffle:

const assertLib = require('truffle-assertions');
...

it('should not generate the hash for same reference number', async()=>{
  actions.generateHash.call(100, '123', {from: accounts[0]});
  await assertLib.reverts(actions.generateHash.call(100, '123', {from: accounts[0]}));

  });

Truffle can't catch the require statement. And truffle giving this output to me

AssertionError: Did not fail

how can I catch this require statement? or how can I write test for the function?

thank you,


texts:
I am trying to figure out how to use Web3 filters, as I need to sync a backend with my blockchain.

Ideally, I want a function to trigger every time a transaction takes place.

I have it working fine based on the examples here, however this only works in the interactive shell. If run in a Python script, it just executes synchronously and terminates immediately. Here is the code:

import sys

from web3 import Web3, IPCProvider

from web3.utils.filters import TransactionFilter

w3 = Web3(IPCProvider('/x/x/x/ethereum/geth.ipc'))

def new_transaction_callback(transaction_hash):
    sys.stdout.write("New Block: {0}".format(transaction_hash))

new_transaction_filter = w3.eth.filter('pending')
new_transaction_filter.watch(new_transaction_callback)

What is the correct way to wait indefinitely, and execute the callback whenever a transaction takes place?


texts:
I am trying to deploy a private ethereum network in my machine using Proof-Of-Authority and geth client.
I followed this tutorial but I can't realize where the information about authorities are stored?


texts: simulate multiple connexions to the ethereum blockchain on a unique PC

texts:
How to simulate that i have several connections to the ethereum blockchain(line in red in the picture)? what tools can i use to do this?Geth?

the goal is:

Sent requests or simultaneous transactions in order to get the data,
Then launch the same processing on the same data
and at the end compare the results obtained

how to simulate multiples connection on my computer


texts: How smart contracts written in solidity be expressed in legal prose so it becomes legally enforcing/binding?

texts: How can smart contracts written in solidity be expressed in legal prose so it becomes legally enforcing/binding?


texts: Mapping multiple keys in a mapping to a single struct

texts:
I've done some research on mappings and structs, and I know it's possible to store structs in a mapping as the value but not the key.

I am trying to creating a mapping of addresses => structs where multiple addresses are pointing to the same struct.

For example, I have the following test structure and mapping.

struct test{
uint nonce;
address friend;
}

mapping (address => test) testMapping;

Is it possible for me have two different addresses mapping to the same struct (not just the same data - I don't want to make a copy for efficiencies sake)?

If I were to writing the following code, would I be making a copy of the data within the struct or simply pointing two different keys to the same location in memory within the mapping?

testMapping[address1].nonce = 1;
testMapping[address1].friend = address2;
testMapping[address3] = testMapping[address1];

AKA, do the above commands copy the values from testMapping[address1] into testMapping[address2], or does it simply point testMapping[address2] to the same memory location as testMapping[address1], in which case, when I update one, both are updated?

Thanks for any help.


texts: Trouble deploying one contract from another

texts:
Why creating a contract new RewardCourts() in another contract takes more than ten kilobytes of bytecode in the contract it is called from? (It makes bytecode too big and I can't deploy it!)

What to do to deploy one contract from another?

It is line 142 here:

    function _installCourtWrapper(
        Kernel _dao
    )
        internal returns (CourtWrapper)
    {
        bytes32 _appId = keccak256(abi.encodePacked(apmNamehash("open"), keccak256("reward")));
        bytes memory initializeData = abi.encodeWithSelector(CourtWrapper(0).initialize.selector);
        CourtWrapper _wrapper = CourtWrapper(_installDefaultApp(_dao, _appId, initializeData));
//        _courtContract = new RewardCourts(); // takes too much bytecode
//        if (_courtContract != address(0) && _courtId == 0) {
//            _courtId = _courtContract.createCourt();
//        }
//        _wrapper.setCourt(_courtContract, _courtId);
        return _wrapper;
    }


texts: Are linkable ring signatures available in Ethereum?

texts:
Are transactions with ring signatures available in Ethereum? There should be as anonymity/fungibility is important.

Also, I think Vitalk Buterin mentioned it may be possible to implement an EVM operation that allows for less gas usage for ring transactions. Did I get that right? If so, what is the operation and is anyone working on implementing it in the EVM?


texts: Function with 3 return values returning zeros, but was working fine for 2 return values

texts:
I have this sample contract that I am trying to run. The function getvalues returns me correct values set earlier, when the setvalues function was written to set 2 values. when i modified the contract to set & return 3 values instead of 2, contract was mined successfully, but getvalues function returns only zeros.

Sample run:

sampcont2.setvalues(2500,100,120,130)
sampcont2.getvalues(2500)

output:

  [0,0,0]

When the contract was written to set and return 2 values:

sampcont2.setvalues(2500,100,120)
sampcont2.getvalues(2500)

output:

  [100,120]

Here is the contract that returns 3 values:

contract sampcont2{

    struct customer{
        uint custid;
        uint custvalue1;
        uint custvalue2;
        uint custvalue3;
        string comments;

    }

    mapping(uint => customer) customers;

      function setvalues(uint cid,uint a,uint b,uint c) {
        customers[cid].custid = cid;
        customers[cid].custvalue1 = a;
        customers[cid].custvalue2 = b;
        customers[cid].custvalue3 = c;

    }

    function getvalues(uint id) constant returns (uint x,uint y,uint z) {

         return (customers[id].custvalue1,customers[id].custvalue2,
         customers[id].custvalue3);
    }
}

Edit:
This is what I see:

  I0922 13:49:51.737177 core/database_util.go:353] stored block receipts [01f78178.]
  I0922 13:49:51.737177 core/tx_pool.go:547] removed tx (
         TX(c56cb49dcfd4828ea4bc7dd903de834b4119dbf6d368d9015df423dff11d82f4)
         Contract: false
         From:     85e148c97b24c1c1a3bfe91782cb2c9831c38b98
         To:       4d37aa6cc5c73464265faefe668d5beb8f517edd
         Nonce:    248
         GasPrice: 20000000000
         GasLimit  90000
         Value:    0
         Data:     >0x4378d76f00000000000000000000000000000000000000000000000000000000000003ec00000>00000000000000000000000000000000000000
  0000000000000000000660000000000000000000000000000000000000000000000000000000000>00010e00000000000000000000000000000000000000000000000000
  0000000000010e
         V:        0x1b
         R:        >0xb52e254bb50c4c244124b9ac96b215b0d3265bd5bb676b22a8c081801c715037
         S:        >0x42889e66fcdcb0734dc78f081b598b0a3b467cf3e13d14cfa832035a19309163
         Hex:      >f8eb81f88504a817c80083015f90944d37aa6cc5c73464265faefe668d5beb8f517edd80b884437>8d76f000000000000000000000000000000000
  00000000000000000000000000003ec000000000000000000000000000000000000000000000000>00000000000000660000000000000000000000000000000000000000
  00000000000000000000010e0000000000000000000000000000000000000000000000000000000>00000010e1ba0b52e254bb50c4c244124b9ac96b215b0d3265bd5bb6
  76b22a8c081801c715037a042889e66fcdcb0734dc78f081b598b0a3b467cf3e13d14cfa832035a>19309163
  ) from pool: low tx nonce or out of funds

So is it actually a gas problem?


texts: What's to stop Ledger from sending to a hacker's address?

texts:
Why can't a hacker edit the Ledger Chrome app to display the address the user thinks he's sending to while actually sending to a different address?

Suppose the scenario: Ledger employee wants a nice retirement, puts out a "software update" to the Chrome app to send all ETH to his address while the software shows the addresses the user thinks they're sending to; steals a bunch of ETH from many users at once before the message spreads on social media warning people to stop using the app. (Or suppose it's someone who hacked their software repository unbeknownst to Ledger.)


texts:
In the new version of web3.py, the personal.newAccount functionality has been retained only for the geth client.

What is the right cross-client approach to creating new accounts?

See v5 migration and new RPC spec.


texts:
How will Ethereum stop evil-miner attacks where a gas-guzzling tx is added to a just-solved block to slow down competition once gasLimit goes high ?

For relevant discussion see this reddit thread, however from my perspective No satisfactory answer was provided there

https://www.reddit.com/r/ethereum/comments/3fcw0i/verifiers_dilemma_renders_ethereum_nonincentive/ctodv4k?context=3


texts: Unable to use Solidity Visual Studio Extension

texts:
I've installed Solidity Extension in Visual Studio and then created a new project. All looked fine except that the sample files have a + on the left which indicates with a tooltip 'pending add':

In addition to this, when I right click on any item of the project, the focus of the window changes to the README.html file contained in the project and the context menu hides immediately.

Am I loosing something or it isn't working?


texts: "exceeds block gas limit" on partially synced geth

texts:
I am trying to send eth when my geth node is not fully synced (it's very, very slow)
{
  currentBlock: 10683052,
  highestBlock: 10780597,
  knownStates: 57935524,
  pulledStates: 57929853,
  startingBlock: 10666347
}

If I
GP=eth.gasPrice
GAS=50000
TX={ from: FROM, to: TO, value: VALUE, nonce: NONCE, gas: GAS , gasPrice: GP}
tx_signed=eth.signTransaction(TX)

that succeeds
eth.sendRawTransaction(tx_signed.raw)

I get
Error: exceeds block gas limit
        at web3.js:6347:37(47)
        at web3.js:5081:62(37)
        at <eval>:1:23(5)

I tried sending the raw transaction on https://etherscan.io/pushTx but that also failed.
Ideally, I want to solve this at my geth node. How do I send a normal transaction like this without fully syncing?


texts: Why gas-used are different for same transfer() tx?

texts:
I noticed that the same transfer() calls for a certain ERC20 token cost different gas-used:

Gas Used By Txn: 52595

https://etherscan.io/tx/0xa7c1639040725e92d3905cc6b8a4d4a3b21a3e23800c75950da682ce2043c274

Gas Used By Txn: 37595

https://etherscan.io/tx/0x34728b3f03d859eb701e0bfaf253033cf26d2e9b6be5562d7ab7f2d7518a84cb

I think the executions of transfer() should take extract same gas because only the parameters are different.


texts: How to spend ether from multiple accounts?

texts:
I would like to know how to send ether from multiple accounts. For example, suppose I have 3 accounts with 5 ether in each account, how do I send the total (15 ether) to an account in a single transaction? I'm asking because from what I understand the "from" parameter in "sendTransaction" only accepts a single account.

The reason I'm asking this is because I need to accept Ether payments in my system and I would like to generate a unique account for each deposit, but I'm not sure how to spend the Ether I receive without having to send multiple transactions.

Thanks!


texts: How do I implement a maximum investment limit in a crowdsale or ICO contract?

texts:
I have a crowdsale contract which creates tokens and assigns them to the crowdsale address. Investors can then send ether to the address and receive tokens from the crowdsale.

In this case how can I set a maximum investment limit? Is it possible to make it so that only a certain number of tokens can be purchased from a particular address?

Similarly, is it possible to implement any form of KYC in a smart contract so that only people that have verified their identity can invest? (If this question should be a separate post, I will edit this post to remove it and resubmit).

Thank you for any help in setting a limit. I appreciate it.


texts: How to prevent selfdestruct from another contract

texts:
I have a contract A calling another contract B

Contract A

contract A {

   function sendValue(B _externalContract, uint _value) {
     _externalContract.acceptValue(_value);
   }
}

contract B {
   function acceptValue(unit value);
}

Contract B (contract A expect contract B acceptValue to be safe)

  contract B {
       function acceptValue(unit _value) {
         dosomethingWith(_value)
       }
    }

If a malicious user now design contract B function acceptValue to self destruct like so

Contract B

  contract B {
       function acceptValue(unit _value) {
         selfdestruct(msg.sender);
       }
    }

Will that function destroy my contract A or malicious user Contract B?
Is there a check I can perform in contract A sendValue to prevent that?


texts: does solidity support signed integers in regards to input arguments

texts:
Does Solidity support signed integer and negative input arguments or would require comparisons with 0 be meaningless?

E.g

function transfer(address _to, uint256 _amount) public returns (bool success) {
        require( _to != 0x0);
        require(balances[msg.sender] >= _amount && _amount >= 0);
        balances[msg.sender] = (balances[msg.sender]).sub(_amount);
        balances[_to] = (balances[_to]).add(_amount);
        Transfer(msg.sender, _to, _amount);
             return true;
         }


texts:
var Tx = require('ethereumjs-tx').Transaction;
const init1 = async()=>
{
  console.log("async function called ....")
  var count = await web3.eth.getTransactionCount("0xd946F28962A96C45d9Bc16F16ca50d8350296A4E",'pending');
  console.log(count);
  // var abiArray = JSON.parse(fs.readFileSync('mycoin.json', 'utf-8'));
  var contract = new web3.eth.Contract(hello,contractAddress);
  console.log("async function called2 ....");
  const accountNonce='0x'+(count+1).toString(16);
  var rawTransaction =
  {
  // "from": "0xd946F28962A96C45d9Bc16F16ca50d8350296A4E",
     "nonce": web3.utils.toHex(count),
     "gasPrice": "0x04e3b29200",
  // "gasPrice": "1000000",
     "gasLimit": 300000,
     "to": contractAddress,
     "value": "0x0",
  // SimpleERC20Token()
  // "data": await
  contract.methods.transfer("0x38be032340C655CF40cfCa95976c157850ACFe9E", 10).encodeABI(),
    "data": await
 contract.methods.transferFrom("0xd946F28962A96C45d9Bc16F16ca50d8350296A4E","0x38be032340C655CF40cfCa95976c157850ACFe9E",1).encodeABI(),

 //   "chainId": 0x04
};
console.log("async function called3 ...");
var privKey = new Buffer('8d6577c01ce9adf3293a89c06ab28b7b18817920b724d869bedac732006c380f', 'hex');

console.log("async function called 4 ...");
var tx = new Tx(rawTransaction,{'chain':'rinkeby'});

console.log("async function called 5 ...");
tx.sign(privKey);
//var serializedTx = tx.serialize();

console.log("async function called 6 ...");
const serializedTx= tx.serialize().toString("hex");
const receipt = await web3.eth.sendSignedTransaction(`0x${serializedTx}`).catch(error => { throw error});

console.log(JSON.stringify(receipt, null, 4));[![enter image description here][1]][1]

  [1]: https://i.stack.imgur.com/AZknw.png


texts: Difference between public private and consortium blockchain

texts: I am new to blockchain therefore i am trying to understand difference between private public and consortium blockchain. I do understand public blockchain but i am unable to differentiate between private and consortium. Can anyone please explain me with any example ? Also can we create all 3 using ethereum ?


texts: Property 'personal' does not exist on type 'Web3' by using web3.personal.unlockAccount()

texts:
I am using

  web3.personal.unlockAccount()

but meeting a issue

  " Property 'personal' does not exist on type 'Web3'."

what is the problem?


texts:
I am new to block chain and Ethereum and I have question regarding it.

As per my understanding

Ethereum is a decentralized platform that runs smart contracts: applications that run exactly as programmed without any possibility of downtime, censorship, fraud or third party interference. When the smart contract is deployed, the network propagate to executable code into the network and this way each node can run the smart contract.

But what if we need to build an application with GUI which provide graphical screen to interact with the smart contract. How our GUI will be deployed to each node? How do we push it? What is the mechanism for it?


texts: What does it really mean to burn tokens?

texts:
I don't quite understand what it really means to burn tokens.  Since the blockchain is immutable, there should be no way to delete the record.  Thus, in my understanding, to burn the token merely means to send it to the address without the private key or the address that has lost its private key.

However, token issuers claim that the value of a token goes up because they burn tokens.

Are they actually burning tokens in any way or am I right that there is no way to delete tokens?


texts: How to manually initialise an array in Solidity?

texts:
I can't find a way to manually initialize an array.

string[] public cool;

function constructor() {
    cool[0] = "one";
}

Won't execute, while

function constructor(){
    cool[cool.length++] = "one";
}

will.

What might be the reason behind it?


texts:
I executed a call checkConstant("ein schnitzel") on the following contract, and it worked. Obviously, type coercion but the documentation doesn't tell. How does this happen in detail?

contract X{
uint a=12+1 ether;

function checkConstant(uint conversionRate) constant returns(uint integer, uint decimal){

    integer= a / conversionRate;
    decimal= a % conversionRate;
}

}

Output:

Value:
"0x00000000000000000000000000000000000000000000000000000000cac53f2b000000000000000000000000000000000000000000000000000000000e88c37f"
Decoded:
uint256 integer: 3401924395
uint256 decimal: 243843967


texts: How can configure EthereumJ to connect to the public testnet.?

texts:
I need to connect to the public testnet via ethereumj
can anybody help me please.


texts: Multisender.app transactions aren't emitting transfer events for Ampleforth

texts:
I am trying to collate the whole of Ampleforth's transaction history. To do this I was grabbing the transfer events every 1000 blocks since Ampleforth's inception. In doing this I noticed that some addresses were sending Ampl that had not yet had Ample sent to them. Upon closer inspection (checking the account history in etherscan) they had received Ampl from Multisender.app.
Why do these transactions not emit transfer events? And is there a way to track all token transfers?
Example of what I mean:
https://etherscan.io/token/0xd46ba6d942050d489dbd938a2c909a5d5039a161?a=0xbb478118ed70800b160c9c06afd69324cedeafdc
Method is a multisend event and there are also disperse events.


texts: Is there any difference between address that have Smart Contract and "normal" one?

texts:
Is there any difference between address that have smart contract on it, and "normal" address (address that You can create private and public key pair)?

For more context, this is the problem I'm thinking about:

  Let's assume that Smart Contract has address 0xfoo, and we - either by pure random chance, or we generated somehow collision - also generated address 0xfoo.

  Can I now access ether and/or tokens that are on 0xfoo Smart Contract address? Or there is some mechanism in EVM to block transactions from "Smart Contract Address"?


texts: How do I deploy a Truffle Dapp on webserver?

texts: how do I deploy a in Truffle built, working and migrated Dapp to a webserver so that I could send the link to friends to interact with my smart contract via MetaMask e.g.?


texts:
To get Transaction count on an Account, we use eth.getTransactionCount(Address).

But How will I get the Transaction count from one Block?


texts: Bad Jump Destination, how can i tell programmatically?

texts:
Let's say i'm programmatically making a transaction to a contract.  How can I tell (programmatically) that the confirmed transaction has a Bad Jump Destination?  Right now, the only way I know of is it go to etherscan.io and look for the red text.  But how can i determine this programmatically?

I'm looking at the response data from a eth_getTransactionByHash call and I can't tell the difference between a Bad Jump Destination and one that worked.

Seems like etherscan has an API that may be able to do this. But shouldn't there be a built in way that doesn't involve etherscan?
  https://etherscan.io/apis#transactions

------Edit------

My current solution is to check if my transaction has at least 1 confirmation.  If it has at least 1 confirmation, then I make an API call to etherscan and check it for errors.  Etherscan's response tells me that it's either good or bad jump destination or out of gas.  It's pretty amazing, but it seems very round about and hacky.  I'll review the other posts you guys have mentioned to see if that solution is better.


texts: Tracking Non-Deployer Transaction Gas Use In Truffle Migrate

texts:
In Truffle, gas used by a Migration in deployer.deploy() is tracked by a Reporter using events emitted by the Migration.

If I have code of the form:

deployer.deploy(MyContract)
  .then(instance => instance.callSomeExpensiveMethod())

where a contract is deployed then a function is called on the deployed instance (for example an expensive configuration function that would cost too much gas to call during contract creation) the gas cost of the first line will be tracked but the gas cost of the second line will not (because it doesn't emit any events that the Reporter can use to update the total gas used).

Is this correct?

If this is correct, is there a way of notifying the Reporter that extra gas has been used so that the totals reported at the end are accurate?

Or would this be an incorrect use of the reporter?

I'm currently tracking and reporting on non-contract-creation transaction gas usage separately so if that is the correct approach I can keep doing that.


texts:
I am writing a c++ wallet and I need to be able to encode smart contract function calls in ABI format. I found that the web3 library has the ability, but it is written in JS. Is there a c++ alternative?
Thank you


texts: PetShop Dapp error with when compiling and testing adoption.sol but completes anyway

texts:
Since the Petshop Dapp was updated earlier this week I noticed an error while compiling and and again whilst testing it seems to be on the adoption.sol file - now it could be something I did in rebuilding the file but just want to ask if anyone else has encountered similar - is this a real error or a warning?

I can see it error both when I compile and test it

Here is the solidity code within the adoption.sol file

pragma solidity ^0.4.17;

contract Adoption {

    address[16] public adopters;

    function adopt(uint8 petId) public returns (uint8) {
        require(petId >= 0 && petId <= 15);
        adopters[petId] = msg.sender;
        return petId;
    }

    function getAdopters() public returns (address[16]) {
        return adopters;
    }
}


texts: Verify result of gas expensive view calculation in transaction

texts:
I'm have an expensive view function which calculates rewards over time and investment.
When it comes to withdrawing rewards I would need to run this, which could overrun gas for the block.
Is there a secure way I can sign the results of the view and verify in a transaction call so that I do not need to run the view function in the transaction. So essentially verify the results of the view being passed into a transaction?


texts: How do you expose the ethereum private key from the brave browser?

texts: I have some funds on the brave browser, but how do I extract the ethereum private key from the brave browser?


texts:
i am trying to send a transaction but it throws an error. still i am not sending any transaction just signing it...
Error: Expected private key to be an Uint8Array with length 32
at assert (C:\web3\node_modules\secp256k1\lib\index.js:18:20)
at isUint8Array (C:\web3\node_modules\secp256k1\lib\index.js:31:7)
at Object.ecdsaSign (C:\web3\node_modules\secp256k1\lib\index.js:254:7)
at Object.exports.sign (C:\web3\node_modules\ethereumjs-util\dist\secp256k1v3-adapter.js:247:25)
at Object.exports.ecsign (C:\web3\node_modules\ethereumjs-util\dist\signature.js:12:25)
at Transaction.sign (C:\web3\node_modules\ethereumjs-tx\dist\transaction.js:230:37)
at Object.callback (C:\web3\transaction1.js:28:8)
at sendTxCallback (C:\web3\node_modules\web3-core-method\lib\index.js:533:29)
at C:\web3\node_modules\web3-core-requestmanager\lib\index.js:308:9
at XMLHttpRequest.request.onreadystatechange (C:\web3\node_modules\web3-providers-http\lib\index.js:98:13)
at XMLHttpRequestEventTarget.dispatchEvent (C:\web3\node_modules\xhr2-cookies\dist\xml-http-request-event-target.js:34:22)
at XMLHttpRequest._setReadyState (C:\web3\node_modules\xhr2-cookies\dist\xml-http-request.js:208:14)
at XMLHttpRequest._onHttpResponseEnd (C:\web3\node_modules\xhr2-cookies\dist\xml-http-request.js:318:14)
at IncomingMessage. (C:\web3\node_modules\xhr2-cookies\dist\xml-http-request.js:289:61)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (internal/streams/readable.js:1327:12)
var Tx = require('ethereumjs-tx')

const Web3 = require('web3')
const web3 = new Web3('http://127.0.0.1:7545')

const account1 = '0x67d30ef950015Ab1a03e30ED5d5F2A26de196C4d'
const account2 = '0x04bCD71C67656cFda695F14a9E9Bf8B6064b8AD1'

const privateKey1 = 'c429601ee7a6167356f15baa70fd8fe17b0325dab7047a658a31039e5384bffd'
const privateKey2 = '60495127495614d5aadb1f4561a3989d6636cbe55ada58c685ef28cff01bde21'

const privateKey1Buffer = Buffer.from(privateKey1, 'hex')
const privateKey2Buffer = Buffer.from(privateKey2, 'hex')

console.log('Buffer 1: ', privateKey1Buffer)
console.log('Buffer 2: ', privateKey2Buffer)

web3.eth.getTransactionCount(account1, (err, txCount) => {
    const txObject = {
      nonce:    web3.utils.toHex(txCount),
      to:       account2,
      value:    web3.utils.toHex(web3.utils.toWei('0.1', 'ether')),
      gasLimit: web3.utils.toHex(21000),
      gasPrice: web3.utils.toHex(web3.utils.toWei('10', 'gwei'))
    }

    const tx = new Tx.Transaction(txObject)
    tx.sign(privateKey1)

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

    console.log('tx :', tx)
    console.log('serializedTx :', serializedTx)
    console.log('raw :', raw)
  })


texts: Parity web3 access for another user account on same server?

texts:
I am following the instructions from the Parity github page: https://github.com/paritytech/parity/wiki/Basic-Usage

Specifically:

$ npm install web3

$ node
> Web3 = require("web3")
> web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

> web3.eth.blockNumber
743397

All of this is working when I do it as the same Linux user that is running Parity.  But when I try to create a new user account and access the RPC from that account, I get a different result for the Web3 and web3 commands and then I see:

  bzz: Bzz { givenProvider: null, currentProvider: null } }
> web3.eth.blockNumber
undefined

It's like it is not finding the RPC port connection.  Is there a reason that the user account should matter?  The RPC port is the RPC port right?  Am I missing something important?


texts:
I need to connect to Ropsten network from my Node.js backend .
I need to read logs and extract data from them and listen to changes in the network for my contract.
The problem is that i don't know how to input credentials of the account that's going to read it (address and private key  )

 if (typeof web3 !== 'undefined') {
    web3 = new Web3(web3.currentProvider);
} else {
    web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
}

This is my code from frontend . I'm using metamask and it's getting me the current provider perfectly.
But when changing to Node.js , there's no provider of course (Metamask in my case ) .

So the question is :
How to input Ropsten network instead of "http://localhost:8545" which refers to a private network and how can i input the account's address and secret key ?
Thanks .


texts: Can I interact with an ethereum contract through C/C++?

texts:
Assuming I have a device that receives sensor data in C, and I want to make calls to an Ethereum smart contract directly through it, is there a way to use C/C++ for that communication? Something similar to web3 for js or python is what I am ideally looking for.
I am interested in knowing whether or not this is possible at all, so feel free to ignore my rough example. If it is not, then suggestions as to how this could be approached through a device like the one mentioned are welcome.


texts: truffle unbox pet-shop gives DownloadingError: read ECONNRESET at TLSWrap.onStreamRead (internal/stream_base_commons.js:201:27)

texts:
Ubuntu 18.04.

Truffle v5.1.2 (core: 5.1.2)

Solidity v0.5.12 (solc-js)

Node v13.2.0

Web3.js v1.2.2

When I execute truffle unbox pet-shop on terminal, I get error

✔ Preparing to download
⠼ DownloadingError: read ECONNRESET
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:201:27)

I am expecting contents of directory to look like this (from https://www.dappuniversity.com/articles/the-ultimate-ethereum-dapp-tutorial)

Instead it looks like this,

And I didn't see issue on Github (I just created one, https://github.com/truffle-box/pet-shop-box/issues/49).

And I get same error when I run

truffle init

Can you help me straighten this out?

Thanks!


texts: Trying to send a transaction with ethers.js

texts:
I'm trying to send this transaction using etthers.js and getting transaction details as output but when I try to put the txnhash on etherscan it shows nothing, I tried rinkeby and kovan.
[private key and Web3 provider API keys are hidden]
var ethers = require('ethers');
var url = 'https url of a web3 provider like QuikNode, Infura etc';
var customHttpProvider = new ethers.providers.JsonRpcProvider(url);

var privateKey = "";
var wallet = new ethers.Wallet(privateKey);
console.log("Address: " + wallet.address);

tx = {
  to: "0x6E0d01A76C3Cf4288372a29124A26D4353EE51BE",
  value: ethers.utils.parseEther("0.5"),
  gasLimit: 10000000,
  gasPrice: "0x07f9acf02",
  nonce: 3,
  chainId: 42,
}

wallet.signTransaction(tx).then((signedTX)=>{
    customHttpProvider.sendTransaction(signedTX).then(console.log);
});


texts: Solidity standard library: how to contribute?

texts:
I'd like to contribute to Solidity standard library, which seems a bit feature-less. How can I do that? Is there are some agreements about Solidity standard lib like in c++?
I have implemented some functions that are probably useful in Smart Contracts: https://github.com/alianse777/solidity-standard-library


texts: Web3 empty response when geth not synced

texts:
I am running my own geth node and doing some test transactions.

When making a transaction trough web3 I get an response of transaction information. But sometimes it happens that my node is not fully in sync so when I make a transaction from geth I get an empty response.

Since I want to save all the transaction hashes in my databas this is a problem.

How should I handle this kind of situation? Is there a way to get transaction hash from web3 anyway if this happens? I know geth shows it but it is not returned by web3..


texts: Where is the attack contract used for the dao attack?

texts:
I studied The DAO attack.
I want to see attack contract.
but I found just child dao(0x304a554a310C7e546dfe434669C62820b7D83490)

Reentrant attack is needed fallback function.
How can I find the contract that is used for the actual attack where the code exists?
Do you have any source code?


texts: Whats exactly Ether unit return web3.eth.estimateGas, wei, gwei ...?

texts:
I am testing with function  web3.eth.estimateGas and is not clear what Ether unit is returning.
Looks like it's gwei, but my final calculations don't match.
In my code, the EGAS returned is 84753.
I think it is too little to be wei or gwei
How can I convert to wei the uint returned by estimateGas function?


texts:
After learning to create and deploy my contract to my testrpc, now I can't figure out how to get my contract mined.

I created my contract and my testrpc is up and running. But my solidity online compiler shows me "Waiting for transaction to be mined..."

How can I start to mine blocks in my testrpc? (Metamask shows Contract published)


texts: Should I use 'bytes' or 'string' always?

texts: So after my understandings, bytes and strings are basically doing the same just in different formats and using bytes is cheaper -leading to my question, should I then only use string for data that is longer than 32 bytes and specify byte type for anything below?


texts: Web3 - Uncaught TypeError: contract.abi.filter is not a function

texts:
I have compiled and deployed a simple Hello World contract using truffle:

pragma solidity ^0.4.4;

contract Greeter {

    function Greeter() {

    }

    function sayHello() returns(string) {
        return "hello";
    }
}

Now I want to interact with it in a web application using web3:

if (typeof web3 !== 'undefined') {
  web3 = new Web3(web3.currentProvider);
} else {
  // set the provider you want from Web3.providers
  web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
}

var abiArray = JSON.parse('{"contract_name": "Greeter","abi": [{"constant": false,"inputs": [],"name": "sayHello","outputs": [{"name": "","type": "string"}],"payable": false,"type": "function"},{"inputs": [],"payable": false,"type": "constructor"}],"unlinked_binary": "0x6060604052341561000c57fe5b5b5b5b6101118061001e6000396000f300606060405263ffffffff60e060020a600035041663ef5fb05b81146020575bfe5b3415602757fe5b602d60a9565b6040805160208082528351818301528351919283929083019185019080838382156070575b805182526020831115607057601f1990920191602091820191016052565b505050905090810190601f168015609b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60af60d3565b50604080518082019091526005815260d860020a6468656c6c6f0260208201525b90565b604080516020810190915260008152905600a165627a7a723058205c8157cef185e2881f9f3c49092242ef4418bb30363100e00c373e157ebb6a540029","networks": {"1496042639874": {"events": {},"links": {},"address": "0xc90f7594a02ecc8fe27dad58023537da569ebbc6","updated_at": 1496042652979}},"schema_version": "0.0.5","updated_at": 1496042652979}');

var MyContract = web3.eth.contract(abiArray);

var contractAddress = '0x03c99a158d7c5f94da4333b044a940c4c3a58582';
var contractInstance = MyContract.at(contractAddress);

console.log(contractInstance);

var result = contractInstance.sayHello().call();
console.log(result);

The problem is that when calling MyContract.at(contractAddress); there is an error:

contract.js:56 Uncaught TypeError: contract.abi.filter is not a function
    at addFunctionsToContract (contract.js:56)
    at ContractFactory.at (contract.js:267)
    at ethereum.js:26

Any idea what's wrong?


texts: How to create custom ERC20 wallet into my app , to send and receive my tokens?

texts: We have an app for rewards and would like to have a functionality for users to exchange or transfer there tokens to each other. Is there a way i can add that into my app?


texts: Error when using the original crowdsale code

texts:
I have copied the original crowd sale code from the Ethereum website and pasted it in the solidity contract source code field. Code is untouched, precisely as on the Ethereum website. For some reason the network says could not compile source code and Expected token Semicolon got 'eth_compileSolidity' uint amount += msg.value;

I have tried to restart the Ethereum wallet but nothing works.


texts: populus: How to have multiple transactions in a single block?

texts:
My goal is to write a test case to simulate my contract inside populus. I observe that each transaction()(even it is a empty function call) will increment block number as one no matter what.

[Q] As we know in a single block there could be multiple transactions. Is it possible to have multiple transactions in a single block, inside the test case of populus?

test.py:

blkArrayIndex =  0;
gasUsed       = [];
blockNumber   = [];

set_txn_hash     = my_contract.transact().dummy(); #this is a dummy transaction.
contract_address = unmigrated_chain.wait.for_receipt(set_txn_hash)

gasUsed.append( contract_address["gasUsed"] );
blockNumber.append( contract_address["blockNumber"] );
blkArrayIndex = blkArrayIndex + 1;

set_txn_hash     = my_contract.transact().dummy(); #added line.#
set_txn_hash     = my_contract.transact().dummy(); #added line.#
set_txn_hash     = my_contract.transact().dummy(); #added line.#
set_txn_hash     = my_contract.transact().dummy(); #this is a dummy transaction.
contract_address = unmigrated_chain.wait.for_receipt(set_txn_hash);

gasUsed.append( contract_address["gasUsed"] );
blockNumber.append( contract_address["blockNumber"] );
blkArrayIndex = blkArrayIndex + 1;

for j in range(0, blkArrayIndex):
    print '%s:%d |%s: %d' % ("gasUsed", gasUsed[j], "blockNumber", blockNumber[j])

Output (without added lines):

gasUsed:222648 |blockNumber: 4
gasUsed:290051 |blockNumber: 5

Output (when new lines are added): block number changed from 5 to 8.

gasUsed:222648|blockNumber: 4
gasUsed:350051|blockNumber: 8 <= after the added lines I want block number as 5 instead of 8.


texts: How do mappings in solidity occupy memory

texts:
Say, I declare a mapping that uses uint256 numbers as keys and maps them to a single 8 bit character. I add 5 members to this mapping.

Obviously, I can then access any of these 5 characters using their respective indices.

So what I wanna know is, does this mapping consume 5*8 = 40 bits of memory or 5*8 + 5*256 = 1320 bits?


texts: Why does declaring returns type bytes memory give a compiler error?

texts:
If we have the following code:

pragma solidity >= 0.5;
contract stringsContract {
    function takesTwo(string memory str, uint idx) public pure returns (bytes memory) {
        bytes memory bytesStr = bytes(str);
        return bytesStr[idx];
    }
}

Why do we get TypeError return argument bytes1 is not explicitly convertible to expected type (type of first return variable bytes memory).

The fix was to change bytes memory to bytes:

contract stringsContract {
        function takesTwo(string memory str, uint idx) public pure returns (byte) {
            bytes memory bytesStr = bytes(str);
            return bytesStr[idx];
        }
    }

Nevertheless, I'm still curious about the reason of the compilation error. Any thoughts?


texts: Why does web3.js throw anonymous errors and swallow errors?

texts:
web3.js throws a lot of errors with no stack trace, making it hard to debug.

for example:

./node_modules/web3/lib/web3/formatters.js:    throw 'invalid address';
./node_modules/web3/dist/web3-light.js:    throw 'invalid address';
./node_modules/web3/dist/web3.js:    throw 'invalid address';

These should be throw(Error('invalid address')), preferably adding the contents of whatever structure is causing the problem.

Also, in Http provider, any XML related issues get swallowed and thrown away, e.g.

HttpProvider.prototype.send = function (payload) {
    var request = this.prepareRequest(false);

    try {
        request.send(JSON.stringify(payload));
    } catch(error) {
        throw errors.InvalidConnection(this.host);
    }

error should be continued in the throw or it's very hard to debug.

Is there a reason for errors to be thrown this way?  Can this be changed?


texts:
I'm trying to use personal_sign and getting not supported error. I'm using web3 v 0.20.1

I first tried using infura and was not able to resolve the issue, so then I connected to a geth node with this setup: geth --rpc --rpcport "8434" --rpccorsdomain "*" --ipcdisable --rpcapi "db,eth,net,web3,personal" --networkid 4

I've not been able to understand how to access this personal_sign method despite being able to access the web3.currentProvider object.

**Edit - seems to now be solved with version 1.0.0 + if the personal flag is set for rpcapi. Is there any way to set this flag when using infura?


texts: Cannot read property 'EIP712Domain' of undefined

texts:
I get this when trying to recover the address using eth-sig-util as described here. The code is very simple and this is all it contains:

var sigUtil = require('eth-sig-util')

var recovered = sigUtil.recoverTypedSignature({
  data: JSON.parse('[{"type":"string","name":"Order Type","value":"sell"},{"type":"string","name":"Token Symbol","value":"FDR"},{"type":"string","name":"Amount","value":"10"},{"type":"string","name":"Rate","value":"0.001"},{"type":"string","name":"Expires In","value":"2"}]'),
  sig: '0xdeletedsomechars1944340987bb77f08d1383f791f097f4f6ddceead4dc77f28bac053c0cbd6465dc3844de12aea36f9d8e67db6f80f92ef0f4027ee6f08ef6feefe63a1c'
})


texts: How does Ethereum ensure that "users can own their data, and your apps don’t spy and steal from you"?

texts: What features in ehtereum would ensure that the Dapp would never spy on you or steal your data?


texts: Just purchased Mantra DAO (OM) with ETH and the transaction went through but it shows zero value for the OM token

texts:
I have gone through Uniswap and successfully purchased over $9000 worth of the token OM.  However, it does not show any value in USD.  It does show the amount of OM tokens I purchased however.  How can I get the current value to show up on Etherscan?
In doing further research, it appears that OM may be an old token name and that perhaps it has been changed.   Could that the problem?
Help.  How can I resolve this issue?
God bless,
Brent


texts:
Using Web3.js, how do I call a function on multiple instances of a contract and then store their results in an array? I've tried .map and .forEach, but they don't return the objects I expected.

I am able to get a desirable result when I call the function on one instance:

let giftStats = await SmartGift(
        '0xbb6810057e1D82deE83A981b002F2E0C60293a27'
    )
        .methods.getGiftStats()
        .call()

console.log(giftStats)

  Result {
   '0': '0xfAA7541C5cBe22E4518736D2b5fC34D07347eE45',
   '1': '0x0000000000000000000000000000000000000000',
   '2': '0x0000000000000000000000000000000000000000',
   '3': '0',
   '4': '0',
   '5': '0',
   '6': '100',
   '7': '0',
   '8': false,
   '9': false,
   '10': '' }

I'm looking for a method that enables me to store two objects like the one above in an array. But when I try to call map() or forEach() on an array of addresses, the resulting array is not what I'd expect.

ATTEMPT 1: .map( )

const recipientGifts = ['0xAEaadCd9499127Ae0826aC2E918372927E4B55D4','0xbb6810057e1D82deE83A981b002F2E0C60293a27']
let giftStats = await recipientGifts.map((address) => {
JSON.stringify(
    SmartGift(address)
    .methods.getGiftStats()
    .call()
)
console.log(giftStats)

  [ undefined, undefined ]

ATTEMPT 2: .forEach( )

const recipientGifts = ['0xAEaadCd9499127Ae0826aC2E918372927E4B55D4','0xbb6810057e1D82deE83A981b002F2E0C60293a27']
let giftStats = []
await recipientGifts.forEach((address) =>giftStats.push(SmartGift(address)
    .methods.getGiftStats()
    .call() ))

console.log(giftStats)

  [ Promise {
     _bitField: 0,
     _fulfillmentHandler0: undefined,
     _rejectionHandler0: undefined,
     _promise0: undefined,
     _receiver0: undefined },
   Promise {
     _bitField: 0,
     _fulfillmentHandler0: undefined,
     _rejectionHandler0: undefined,
     _promise0: undefined,
     _receiver0: undefined } ]


texts: Is signatures from web3.eth/personal.sign deterministic and a safe to be used as seeds for private keys?

texts:
The first part of the question: if I give the same inputs (content and signing address) to the web3.eth/personal.sign, am I correct to expect the signature generated to be the same no matter how many times I call it?

The second part of the question is, is it secure that I use the generated signature as a secret source for seed and derive things like private key from it?


texts: How to find value of non-public state variable

texts:
I understand that public state variables automatically creates a getter function when deployed, its value can be accessed via the getter function.
However, if a state variable is not public, how can we access the value? I am doing this for experiment purpose. Since everything is on the blockchain, even if a state variable is not public, we should still be able to find its value in the contract storage right?
I am running my contracts on Ganache, I saw one of the RPC for ganache is eth_getStorageAt(), maybe somehow it can be accomplished here?
eth_getStorageAt seems to return very raw information, if we can access the non-public state variable values, how do we locate it in the storage?


texts:
I have the variable w1_temp, which i need to send to contract
I have the following code:

var W1Temp = require('w1temp')
var Web3 = require('web3')
var web3 = new Web3()

web3.setProvider(new web3.providers.HttpProvider('http://localhost:8042'))
var contractAddress = '0x414c49c9552c4bd41401ff0a67ff84431a900c66'
var ABI = JSON.parse(
'[ { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "constant": false, "inputs": [
{ "name": "_sensorData", "type": "int256" } ], "name": "setSensorData", "outputs": [], "payable": false, "stateMutability":
"nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "getSensorData", "outputs": [ { "name": "",
"type": "int256", "value": "0" } ], "payable": false, "stateMutability": "view", "type": "function" } ] ')

var StoreIntegerValue = web3.eth.contract(ABI).at(contractAddress)

W1Temp.setGpioData(7)
W1Temp.getSensor('28-0316612396ff').then(function (sensor) {
    var _sensorData = sensor.getTemperature();
});

eth.sendTransaction({
    from: 'a57f7e5347bd04076dd02c02212c0221522289ff38940e',
    to: '0x414c49c9552c4bd41401ff0a67ff84431a900c66',
    value: web3.toWei(100,'finney'),
    data: web3.toHex('_sensorData')
})

But I’m almost sure that it is not correct
Please help to make it work


texts: Vehicle Ownership/Registry on the Blockchain

texts:
I am currently trying my hand at a basic PoC in the form of vehicle ownership on the Bockchain. I am familiar with Ethereum but not very good at coding.

Basically, the idea is that there will be a currency created on the blockchain with an initial supply and a small amount of inflation to deal with new vehicles after every vehicle has been registered. As of now, There will have to be a trusted party involved in the form of a government service and this trusted party will be responsible for registering each vehicle. Each single unit of currency will represent a vehicle in the real world and thus will have a unique identifier. Once a vehicle has been registered with the trusted party, it can be freely transferred on the blockchain.

Ideally, I would code a smart contract which would act as a intermediary for this transaction. For example, if x amount of Ether is received, send y vehicle ownership deed. However, I am unsure where to even begin. I have reasonable skills in coding in Java.

Any thoughts would be greatly appreciated, as would any help or resources.

Thanks.


texts: I'm developing my first dapp with solidity and I was wondering in which cases should I use hashing functions like keccak. I know how they work but it is not clear to me when should I use them and to do what. Thank you so much


texts: Is it possible to create a mapping where the keys are an existing array?

texts:
I'm trying to create a mapping whit this structure:
mapping(string => House) public houses;

where House is a Struct:
    struct House {
    address payable owner;
    uint256 base_price;
}

I already have an array where I store all the strings that I want in my mapping keys, lets say something like this:
string[] public cities = ["New York", "Las Vegas", "London", "Paris", "Moscow"];

The only exception is that my array is much longer (250 elements) and I wanted to know if it'd possible to create the mapping without looping through the array using something like a map function in javascript giving to all of the initial element the same starting Struct.
At the moment I'm doing it like this:
    for (uint i=0; i<cities.length; i++) {
        houses[cities[i]] = House(payable(0), 0.0005 ether, "");
    }

Is there a more efficient way of doing this?
Thank you in advance.


texts: Append address to bytecode and then deploy it

texts:
I'm trying to write a deployer function which would allow me do deploy arbitraty code. So far, I can deploy a contract with parameters using this snippet found here:

// js truffle
const tokenWeb3 = web3.eth.contract(Token.abi)
const tokenData = tokenWeb3.new.getData(totalSupply, name, symbol, decimals, { data: Token.bytecode })
await contract.deploy(tokenData)

// solidity
function deploy(bytes _code) public {
    address tokenAddress;
    assembly {
        tokenAddress := create(0, add(_code, 0x20), mload(_code))
        if iszero(extcodesize(tokenAddress)) { revert(0, 0) }
    }
}

What I need is to append this new token address as a parameter to a new deployment, something like this:

// solidity
function deploy(bytes _code1, bytes _code2) public {
    address tokenAddress;
    assembly {
        tokenAddress := create(0, add(_code, 0x20), mload(_code))

        // converts address to bytes?
        let m := mload(0x40)
        mstore(add(m, 20), xor(0x140000000000000000000000000000000000000000, tokenAddress))
        mstore(0x40, add(m, 52))
        let b := m

        // adds address to deployment bytecode?
        let appended := add(_code2, b)

        saleAddress := create(0, add(appended, 0x20), mload(_code2))
        if iszero(extcodesize(saleAddress)) { revert(0, 0) }
    }
}

But the transaction get reverted. The _code2 bytecode contract constructor has only one parameter, which is the token address. I'm not sure I can just append parameters like this, I'm gonna take a look at web3 contract.new.getData(). I'm not familiar with solidity assembly, so help?


texts: In EtherJs how to find account number of balance change event?

texts:
I am creating Ethereum Wallet application & I am using EtherJs for Web wallet development. When I try to listen for Balance Change event for multiple accounts then How do I find account number from the events. Below is the code snipet.

Accounts Address Listener

let provider = ethers.getDefaultProvider('ropsten');
provider.on("address1",(balance) => {
    console.log('New Balance address1: ' + balance);
});
provider.on("address2",(balance) => {
    console.log('New Balance address2: ' + balance);
});
provider.on("address3",(balance) => {
    console.log('New Balance address3: ' + balance);
});

Now when any callback function called then how do I know the event for which address that is "address1" Or "address2" Or "address3"?


texts: What should I prepare for the coming ETH 2.0 upgrade as a Dapps developer?

texts:
As announced, Ethereum is expected to be its upgraded version Eth2.0 probably from 2020. There will be several upgrades like

PoW to PoS/Casper FFG
eWasm integration
sharding (Casper CBC)

These changes are gonna be implemented gradually.
So, Are there any recommended preparation for the coming upgrade?

UPDATES on January 7th, 2020

Contracts would need upgrades in some way.

Because of the upcoming Ethreum upgrade including sharding, cross-shard communication will be required and that might break the composability in the current pattern.

In the multi-shard environment, hotel and train problem might occur. In order to prevent it, there might be some pattern to solve it with cross-shard receipt.
However, because those mechanisms are not implemented in the current ERC standards, it seems there needs to be some upgrades after phase2 of Eth2.0. See 'The ERC20 standard would need to be modified.'

Not sure about how contracts upgrade can be achieved. I'll keep an eye on the progress.

Note: Vitalik also says ' the changes and disruptions that you experience will actually be quite limited. Existing applications will keep running with no change.' but, concerns along with the above are not addressed here.

Note2: Storage rent mechanism is being discussed and this might affect the current contract pattern too.  'A key consideration to future proof your contract code for Ethereum 2.0 is sustainable storage. It's known as "storage rent" and "storage maintenance fees". [Justin Drake]'


texts: How does the ERC20 tutorial instantiate an unimplemented interface?

texts:
I've been going through the official Ethereum token tutorial and I noticed that the provided token code includes the following lines within the approveAndCall function:

tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
    spender.receiveApproval(msg.sender, _value, this, _extraData);
    return true;
}

I'm confused how this works and what it does. Given that tokenRecipient is an interface [0] without a corresponding implementation, how can and why does approveAndCall call tokenRecipient's constructor and its receiveApproval method? While I can imagine that unimplemented interfaces like tokenRecipient might have default constructors and no-op implementations, I still don't see why approveAndCall would then call receiveApproval on the returned tokenRecipient contract.

At first, I was thinking that Solidity had copied Go and allowed implicit interface implementation i.e. if a contract and interface have matching methods and signatures, the contract implements that interface. But even that doesn't explain this case because the token contracts in this tutorial don't include receiveApproval implementations and therefore aren't implicitly implementing the tokenRecipient interface.

The only other option I can think of is that we're assuming that there's a tokenRecipient implementation that corresponds to the address passed in to approveAndCall as _spender. Is that what's happening? If so, I wish the tutorial made that more clear.

[0] tokenRecipient has the following signature.

interface tokenRecipient {
    function receiveApproval(
        address _from, uint256 _value, address _token, bytes _extraData
    ) public;
}


texts: Importing OpenZeppelin loads all node_modules contracts into Ganache

texts:
I install OpenZeppelin's contracts npm install @openzeppelin/contracts

Create a contract:

pragma solidity ^0.5.0;

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

contract NewCoin is ERC20Mintable {

  constructor() public {

  }
}

truffle compile (successful)

When I load Ganache it imports every single node_module contract into the "Contracts" tab and the program rapidly starts OOMing.

truffle migrate then kills it completely.

What am I doing wrong here? I'm using VS Code with Truffle version:

Truffle v5.1.12 (core: 5.1.12)
Solidity - ^0.5.0 (solc-js)
Node v8.17.0
Web3.js v1.2.1


texts:
Is there a way so that I can mock blockchain for unit test in quorum.
I do not want to set up a test blockchain for unit testing. Is there any possibility.


texts: pending transaction blocked on a local private node

texts:
Geth v1.6.1-stable on linux

i have initialized my data localy with :

geth --datadir "data" init "genesis.json"

then i run geth to launch local node with very low gasPrice

geth --datadir "data" --rpc --rpcaddr "localhost" --rpcport "8545" --rpccorsdomain "*" --mine --minerthreads 8 --unlock 0,1 --gasprice 10 console 2>console.log

i want to access this node through web3js from a local firefox running remix to compile a very simple smartcontract

i have 2 accounts with ether
but anytime i execute a function from my smartcontract
operations keep being locked "pending"
they are never processed by the node..

What is wrong with this node ?
all accounts are local, unlocked ..

Thanks by advance if you have any idea ..

Vinz


texts: token.balanceOf causing error in solidity

texts:
pragma solidity ^0.6.6;
import "./newERC20.sol";
contract TokenTimelock {

  newERC20 token;
  address beneficiary;
  uint releaseTime;

  function timelock(newERC20 _token, address _beneficiary, uint _releaseTime) public {
    require(_releaseTime > now);
    token = _token;
    beneficiary = _beneficiary;
    releaseTime = _releaseTime;
  }
  function claim() public {
    require(msg.sender == beneficiary);
    require(now >= releaseTime);

    uint amount = token.balanceOf(this);
    // what the purpose of using "uint amount" here, this amount produces an error

    require(amount > 0);

    token.transfer(beneficiary, amount);
  }
}

Or can you share more ways to lock certain amount of tokens and release on a specific time.


texts:
I want to create a website where my users can register and login but not using any kind of database. I want to use public/private key. Let's take https://www.myetherwallet.com/. It says that It doesn't store keys for me. so where are they? when I want to login on that website and type private key, how does it make me login at all?

Main question is: How do I do the same principle by using php and website that myetherwallet.com has right now?


texts: How can a factory contract clone the bytecode of an existing contract?

texts:
Using new to create a contract causes the factory contract to compile with the product contract's bytecode appended to the end...

contract Foo
{
    function Foo() {}
}

bytecode: 60606040525b600056

contract FooFactory
{
    function newFoo() returns (Foo) {
       return new Foo();
    }
}

bytecode: 6060604052346000575b6092806100166000396000f3606060405260e060020a60003504639a67a7068114601c575b6000565b346000576026604f565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6000604051602080607283396040519101819003906000f0801560005790505b90566060604052346000575b5b5b60098060176000396000f360606040525b600056
                                                                                ^ Foo bytecode starts here

For large factory/product contracts this can become a block gas limit issue upon deployment.

Is there a way for a factory contract to clone the bytecode of an existing contract?


texts:
I've looked through the documentation and haven't found that to be helpful.

I would like to know the best way to do a healthcheck on my websocket connection to geth (Yesterday, I found out that I did not receive the new event from a few days ago without any reason).

I have a solution but it is not likely the best practice approach.

const web3 = new Web3(new Web3.providers.WebsocketProvider(networkUri));

setInterval(() => {
  console.log('Check WS status');
  let subscription;
  new Promise((resolve, reject) => {
    subscription = web3.eth.subscribe('pendingTransactions')
      .on('data', function () {
        return resolve(true);
      })
      .on('error', function () {
        return reject(false);
      });
  })
    .then(() => {
      console.log('OK');
    })
    .catch(() => {
      console.log('NOK');
      reconnect();
    })
    .finally(() => {
      // unsubscribes the subscription
      subscription.unsubscribe(function (error, success) {
        if (success)
          console.log('Successfully unsubscribed!');
      });
    })
}, 30000);

Regards


texts: is it possible to change block' gas limit?

texts:
I'm trying to execute some heavy transactions. Before execute it, Remix advises me about the gas limit:

Ok, then I change my gas limit on Metamask to 9,000,000 (I'm on Ropsten network):

And finally, when I'm gonna execute it, I got this error about block' gas limit:

So... I'm not sure if there's a solution to this, because I'm thinking that if the block hasn't created, then nobody knows its gas limit, right? Is there another solution available to execute some heavy transactions?
Thanks in advance.


texts: what unit is used for the gas/gas limit in the ethereum/types lib?

texts:
I'm trying to create a raw transaction using NewTransaction send 1ETH to one transaction, set 21000 gasLimit(I understand this is fixed for any simple transaction) and set the gas price to 51 Gwei.

The issue I have is that there is no documentation about the unit used for Amount, gasLimit and gasPrice. Is it safe to use big.NewInt(1) (for 1ETH), uint64(21000) for gasLimit and big.NewInt(51) for gasPrice ?

NewTransaction(nonce uint64, to common.Address, amount *big.Int, gasLimit
uint64, gasPrice *big.Int, data []byte) *Transaction


texts:
I want to basically create a raffle system through ETH where I can essentially have people send "entries" to. eth or. Crypto address or addresses to raffle of digital assets such as NFT or domain names.
Is this possible and what is the complexity?


texts:
Just tried to convert byte to uint using Solidity 0.5.x:

uint length = uint(arr[i]);

and got:

MyCode.sol:88:29: TypeError: Explicit type conversion not allowed from "bytes1" to "uint256".
       uint length = uint(arr[i]);
                          ^----^


texts: How to build an incentivization model for a behavioural change using smart contracts?

texts: I have been researching various incentivization models and reading whitepapers regarding crypto-economics(e.g: steemit whitepaper) for a while but is it necessary to have a private blockchain for that purpose? Can't we use smart contracts on a public blockchain like ethereum to design such models and if yes then is there any resource for the same?


texts: Is there a "gas price oracle" method in Web3j?

texts:
I read about the Gas Price Oracle in Geth, but I need to use it outside the Geth client.

Is there something similar in Web3j?

If not can I call the oracle programatically somehow (in Java)?


texts: Miner taking a long time to start on private network

texts:
When I start the mining process it can take over an hour before the first block is mined. Once the mining has started each new block is very quick.

My mac is the only node on a private chain so it shouldn't need to synchronise before starting. I tried deleting all of the chain data and starting again from block 0. Does anyone know of a way to speed the process up?


texts: Is it possible to create an user interface for a new token created with ERC20 and metaMask? If yes, how is it possible?


texts:
A few weeks back, I took a notion to look into Solidity. As a long-time developer, it seemed to me an important technology to know about.  I installed geth on my dev machine, and started the process of downloading the Ethereum blockchain. I soon discovered that my low-bandwidth connection (the fate of US rural denizens) would keep me waiting until the next decade before I could proceed to the next step.

My question is: does a cloud-based Solidity platform exist—one that would let me learn and play around without having to have a local copy of the blockchain?

Thanks in advance,

Mark


texts: how smart contract work, does every peer has same copy of smarcontract?

texts:
If yes then how smart contract interact with each other in network?

Actually I was facing issue with understanding contract interaction


texts: Why is there a possibility to increase block gas limit?

texts:
As I know, in Bitcoin block size is limited to 1MB. This limits the number of transactions in a block and thus the transaction throughput and blockchain size growth rate. This in turn prevents centralization because less powerful nodes can participate in the network consensus.

In Ethereum there is no block size limit, however there is block gas limit. It plays the same role as the block size limit in Bitcoin and prevents centralization.

The majority in the Bitcoin community decided to cancel segwit2x fork (increasing block size) mainly because it will increase centralization.

Isn't increasing block gas limit equivalent to increasing centralization? What is the design rationale behind the decision to give this freedom to miners, unlike Bitcoin community?


texts:
I started exploring the both the clients (go client and the EthereumJ) and saw the folder structure both of the client generates are so very different. For example the go client would have the following directory structure

databasedir\chaindata
databasedir\dapp
databasedir\nodes
...

However the java client has the following structure

databasedir\block
databasedir\details
databasedir\state
....

What it could mean that we can't swap between the clients? Is my understanding correct?


texts: Solc-js: error "before each" hook for "deploys a contract": ReferenceError: accounts is not defined

texts:
I have just started building contracts. Kindly help me in resolving this error. Attached image of error.
Lottery/contract/Lottery.sol:
pragma solidity ^0.4.17;

contract Lottery{
    address public manager;
    address[] public players;

    function lottery() public{
        manager = msg.sender;
    }

    function enter() public payable{
        require(msg.value > 0.01 ether);

        players.push(msg.sender);
    }

    function random() private view returns (uint){
        return uint(keccak256(block.difficulty, now, players));
    }

    function pickWinner() public restricted{

        uint index = random() % players.length;
        players[index].transfer(this.balance);
        players = new address[](0);
    }

    modifier restricted(){
        require(msg.sender == manager);
        _;
    }

    function getPlayers() public view returns (address[] memory){
        return players;
    }
}

Lottery/test/lottery_test.js:
const assert = require('assert');
const ganache = require('ganache-cli');
const Web3 = require('web3');

const web3 = new Web3(ganache.provider());

const {interface, bytecode} = require('../compile');

let lottery;
let account;

beforeEach(async()=> {
    account = await web3.eth.getAccounts();

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

describe('Lottery Contract',() => {
it('deploys a contract', () => {
    assert.ok(lottery.options.address);
    });
});

Lottery/compile.js:
const path = require('path');
const fs = require('fs');
const solc = require('solc');

const lotteryPath = path.resolve(__dirname, 'contract', 'Lottery.sol');
const source = fs.readFileSync(lotteryPath, 'utf-8');

module.exports = solc.compile(source,1).contracts[':Lottery'];


texts: Set and delete storage variable in same tx

texts:
I did some poking around and didn't see an answer... and I figure someone knows this off the top of their head.

Question: what is the gas cost associated with setting and deleting a storage variable in the same transaction? Since at the end of the tx, there is no new state, I vaguely recall reading once that the gas costs are different. Can anyone confirm this or point me at the documentation for this?

If there's no special treatment, I'd expect this to cost 20k (set) + 5k (delete) - 15k (refund) = 10k per variable, which is a lot...

Thank you!

Edit: to clarify, my hope is to have a mapping which I can use for essentially "flash storage" during a single tx. To my knowledge there is no memory equivalent of mappings, as they only exist in storage, which is why I don't think there's an alternative which uses only local variables.


texts: Is it possible have SPV clients in ETH2.0? It feels like PoS cannot benefit from spv verification.


texts:
Are all events registered forever in the blockchain?

If I build a client may I see all the events that have ever occurred using web3.js?


texts: Is there a way to use My BAT coins which I moved to Coinomi Ethereum wallet By mistake?

texts:
I didn't understand that Coinomi Ethereum wallet doesn't support BAT coins and I transfered my coin into that account.

Is There a way to use my coins? or they are lost for good?


texts: Solidity error message on compilation (DeclarationError: Identifier not found or not unique. using Address for address;)

texts:
I'm trying to compile a code for a crowdsale contract (Timed and with allowance) from openzeppelin library that is based on a deployed token. However during compilation on remix i get a syntax error as below

browser/TestCrowdsale.sol:330:11: DeclarationError: Identifier not found or not unique.
using Address for address;
^-----^

I tried with latest compiler 0.6.1 and with 0.5.0 still same result.
can someone advise whats the issue with the code
Also where should i pass the address of the deployed contract to the crowdsale contract?
Code: https://paste2.org/ULhxpLAv


texts: The exact size of Ethereum full node blockchain

texts:
I have been trying to get the answer to this question for an article that i am writing:'What is de current size of a full node (e.g. a node that has the encapsulates the whole ethereum blockchain which is needed for upholding the network), and how has that full node progressed from the inception of ethereum until now? preferably with a link of up to data.

The smallest full node possible (i heard parity is also a full node but haven't heard back from parity concerning this).

My question is similar to this question, but it was left unanswered


texts: Read function returning blank array in geth

texts:
I have deployed a smart contract on geth which has 2 simple read, write functions in it. Then I called the write function;
e.g. payment.place_order("Laptop", 10,{from:eth.accounts[0]}).

After the transaction is mined, when the read function is called as payment.get_info() ,it returns a blank array to me [[] , []] while the expected output is [["Laptop"],[10]].

When I do the same on truffle, it returns me the expected output [["Laptop"],[10]].

  contract Payment{

  Order[] public order;
  struct Order {
  bytes32 item;
  bytes32 location;
  uint qty;
  bytes32 bank;
  bytes32 vendor;
  }

  address add;

function place_order(bytes32 _location, uint _qty,bytes32 _item,bytes32 _bank, bytes32 _vendor) returns (bool success){
        Order memory newOrder;
        newOrder.item=_item;
        newOrder.location=_location;
        newOrder.qty=_qty;
        newOrder.bank=_bank;
        newOrder.vendor=_vendor;

        order.push(newOrder);
        return true;
}

function get_info(bytes32 _vendor) constant returns ( bytes32[],uint[],bytes32[],bytes32[]){

       uint length=order.length;

       bytes32[] memory items = new bytes32[](length);
       bytes32[] memory locations = new bytes32[](length);
       uint[] memory quantities = new uint[](length);
       bytes32[] memory banks = new bytes32[](length);

       for(uint i=0; i< order.length; i++){
         Order memory currentOrder;
         currentOrder = order[i];

         if(currentOrder.vendor == _vendor){
         items[i]=currentOrder.item;
         locations[i]=currentOrder.location;
          quantities[i]=currentOrder.qty;
          banks[i]=currentOrder.bank;

          }
      }
        return (items,quantities,locations,banks);

}
}

place_order(....) is submitting and I am getting a transaction hash.

Now, get_info(bytes32 _vendor) is my read function. It is returning me blank arrays. Please help with this.


texts: Ethereum wallet for Tor and Tails OS (Darknet users)

texts:
Tor is a web browser for the darknet, while Tails OS, is an operating system that you install on a USB drive that leaves no traces on the computer itself after shut down. Browsing with Tor on the Tails OS is a common combination for Darknet users to retain their anonymity online.
Which ethereum wallet is most appropriate for use for Tor and Tails users, given that Tails wipes the entire session after shutdown? This means that Tails will wipe clean any ethereum wallet installed. Which ethereum wallet will survive this, perhaps as a perpetual installation, or by repeatedly recovering the wallet during next start-ups with its private key? Metamask is a google chrome extension, which is a different browser than Tor, itself being a completely different web browser.
The point is to prevent the wallet from being disposable: we want to use it as our go-to wallet over the course of weeks if not months and years.


texts: Why store account nonce on chain instead of using timestamp to prevent replay attacks?

texts:
Why store account nonce on chain instead of using timestamp to prevent replay attacks, or any other random bit of information that will change thr hash and differentiate the transaction?

As far as I was able to understand, the account nonce is a bit of information added to a transaction to counteract replay attacks by making the transaction hash used to identify the account unique.

My question is, why is there a need for a permanent record that occupies space on the chain of the amount of transaction each account has made? Couldn't the same effect be achieved with the addition of any other kind of random or unique data to the transaction, such as a timestamp at the moment the transaction is generated by the wallet client? Is there any other advantage to recording account nonces that I am failing to see?


texts: Ethereum 2nd Layer Solutions, Side-Chains, Child-Chains, Root-Chains:

texts:
There are many projects implementing a so-called side-chain or a new chain which works as 2nd layer solution. What does this mean technically? How can one connect a 2nd layer chain with a root-chain e.g. Ethereum?

If anyone can cut this out in simple terms, or provide useful ressources, it would be very appreciated.


texts:
Here is what i've understood (please tell me if i am wrong):

Mocha (mochajs.org) is a testing framework
Waffle (getwaffle.io) is another testing framework
chai: This is not a framework, this is a library which contains helpers for assertions
openzeppelin-test-helpers: This is not a framework: This is just helpers. And some of this helpers are calling chai helpers

Mocha and Waffle syntaxes are very similar and looks like something like that:
describe(... it('...) =>  ...)

There is something i do not understand: Look at this project:
https://github.com/aave/protocol-v2/blob/master/package.json

I can see both mocha and waffle dependencies.
How is it possible to work with 2 testing frameworks ?
Thanks


texts: If the spender account holds more than one type of token, how does the transfer in solidity work?

texts: If an account holds more than one type of token and I want to transfer only a specific token to other addresses using solidity emit Transfer(_from, _to, _tokens), how do I make sure that I'm able to send the right token?


texts:
I need to obtain Rinkeby DAI token with this token address:

0x8f2e097e79b1c51be9cba42658862f0192c3e487

I tried a faucet and https://rinkeby.uniswap.exchange/swap - both give me a different token (however with the same token symbol "DAI").


texts: I want to build a blockchain similar to that of Ethereum but not from scratch. Are there any platforms that allow you to build your blockchain? I have came across MultiChain but not sure whether this is a good choice. Can I get some good platforms that allow to build blockchain?


texts:
I'm on Ropsten network and since yesterday I did a transaction with 5 039 400 Gas and now all my transactions are in status pending. But with another account I can make a transaction to this stuck account.

Someone can explain to me what is wrong ?


texts: Why does an ERC721 contract need to conform to the ERC721 and ERC165 standard?

texts:
Reading through the EIP for ERC 721 I notice that it is required to implement 2 different interfaces. Why is this?

I noticed this portion in the documentation, but I think some clarification is necessary.

  ERC-165 Interface

  We chose Standard Interface Detection (ERC-165) to expose the
  interfaces that a ERC-721 smart contract supports.

  A future EIP may create a global registry of interfaces for contracts.
  We strongly support such an EIP and it would allow your ERC-721
  implementation to implement ERC721Enumerable, ERC721Metadata, or other
  interfaces by delegating to a separate contract.


texts: How to import a contract in another one without using import but using the address in different files?

texts: How to import a contract in another one without using import but using the address of that particular contract and accessing its functions and variables in different files in Solidity?


texts: Why does changing comments in the smart contract change its bytecode?

texts:
Why are these 2 smart contracts, which differ only in the comments, result in different bytecode:

1st

pragma solidity 0.4.20;

contract Test {

  // test
  function test() pure public {

  }
}

2nd

pragma solidity 0.4.20;

contract Test {

  // test2
  function test() pure public {

  }
}


texts: how to maintain msg.sender when internal function call

texts:
i want to make multiple transfer
this is my code

function transferMulti(address[] _to, uint[] _value) public returns(bool success) {
    require(_to.length == _value.length, "require _to[] size == _value[] size");

    for(uint8 i=0; i<_to.length; i++) {
      transfer(_to[i], _value[i]);
    }

    return true;
}

but Actually, it was like Mint, Not Transfer...
how to maintain msg.sender?


texts: What does each genesis.json parameter mean?

texts:
I'm trying to setup genesis.json for my private network. What does each parameter mean and what value can I set in genesis.json?

nonce: any data?
timestamp: any time?
parentHash: any hash?
extraData: put any data if you wish to add? what is the max size?
gasLimit: What is the max number?
difficulty: What is the lowest number?
mixhash: What is this?
coinbase: Ethereum address for coinbase, right?
alloc: first ether allocation

Sample genesis json file from How To Create A Private Ethereum Chain.
Official document for private network genesis json is here. Connecting to the network

{
    "nonce": "0xdeadbeefdeadbeef",
    "timestamp": "0x0",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "0x0",
    "gasLimit": "0x8000000",
    "difficulty": "0x400",
    "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "coinbase": "0x3333333333333333333333333333333333333333",
    "alloc": {
    }
}


texts: I am using Etherscan API to retrieve certain erc20 token balance on given ETH address and get a number like 62910000000 without decimals separator. In fact the proper balance is 6291000.0000. How to fix it? Or maybe how can I display it in a correct way?


texts: My transaction showing up in internal transactions??? How to acquire it?

texts:
Hello and sorry if this problem is already solved, but i cant find it here unfortunately.

So, my problems started 8 days ago. I've withdrawn my ETH from Bitstamp to friends wallet using MEW and afterwards i've withdrawn to my JAXX wallet. I've already withdrawn numerous times from bitstamp, either to my wallet or to other exchange, so never had problem with any of transactions. This is their warning prior to witdhrawal
Please make sure that the receiving party supports Ethereum transactions generated from smart contracts prior to initiating an ETH withdrawal.

I've seen that MEW and JAXX supports smart contracts so no big deal. But, altough my transactions are checked as success, they never arrived in wallet.
https://etherscan.io/tx/0x0e658604dd8086aaf3f6b6e1b959820cfc1692b4d37b65374eb9584df179176a
https://etherscan.io/tx/0x084e1aa6bfa2f0ee9b8477ad1255844efb4aed54f5164e2533bfcf2b24a91def

Both of this transactions are in internal transactions of the wallet.

https://etherscan.io/address/0x4af9ccf222277493aae29e5b894d01e78298b1df#internaltx
https://etherscan.io/address/0x24db32e8a937e22f609885a66bf8861a0519b515#internaltx

As you can see, on second link, i've already had internal transactions which was actually shown in my wallet, but not this one (last one - 0.96eth).

I've read about internal transactions now and still not understand what should i do. I've contacted bitstamp support and all they said to me is that funds left their wallet and they are not able to do anything.

Please help me, i am becoming desperate with this. I will send 0.33eth to the guy who help me solve this :(