texts: how is the etherum block creation is around 20 sec even with using PoW

texts:
The flow of Ethereum consensus as per the answer in this question Smart contracts code: what are nodes in Ethereum actually agreeing upon during the consensus process?

explains somewhat similar consensus to bitcoin. However bitcoin reach to the creation of block in 10 min and how is this possible for 20 sec in Ethereum??


texts:
I am building out an Ethereum smart contract that allows users to create listings.  Here is part of my contract, the part thatis the culprit of the gas usage:

 struct LiveListing {
     uint id;
     string name;
     string description;
     string condition;
     uint price;
     address buyer;
     address seller;
 }

 mapping(uint => LiveListing) public liveListingsMapping;
 uint id;

     function createListing(string _name, string _description, string _condition, uint _price) public  {
         id++;
         LiveListing memory listing = LiveListing({name: _name,
         description: _description,
         condition: _condition,
         price: _price,
         seller: msg.sender,
         id: id,
         buyer: 0x0,
         });
         liveListingsMapping[id] = listing;
    }

When the mapping and my assignment of a listing to an id is commented out, the gas goes from over 1,000,000 to 300,000.  Also, the create listing goes from 300,000 to around 21,000-22,000.  Any advice?  Thank you!


texts: How to send 1-N signalling or broadcast messages on Whisper?

texts:
From Whisper wiki:

  Low-latency, 1-1 or 1-N signalling messages.

Shh.post(self, message:) and Whisper Usage / shh.post

  Creates a whisper message and injects it into the network for
  distribution.

Example usage of web3.shh.post, for more details please see this answer:

web3.shh.post({
  pubKey: 'PUBLIC_KEY_OF_THE_RECEIVER',
  ttl: 3600,
  topic: '0x07678231',
  powTarget: 2.01,
  powTime: 2,
  payload: web3.fromAscii("Hello there!")
  });

When I remove pubKey from web3.shh.post as arguments; it says: Error: specify either a symmetric or an asymmetric key.

  shh.post({ "topic": t, "payload": p }); No signature, no encryption: Anonymous broadcast; a bit like an anonymous subject-filtered twitter feed.

[Q] Since web3.shh.post()requires us to provide single public key of the receiver; is it possible to send 1-N or broadcast message using whisper protocol? If yes, how?


texts: I trade (scalping) cryptocurrency futures on binance. I'm not a developer and I don't know programming languages. Can I learn to write smart contracts without knowing js or java? and advise please , how should i start&


texts:
I have about 900+ Mh worth of power and I'm thinking of creating my own pool and putting all my miners in the pool instead of pooling with others. However I've found no instruction on how to do this. Can someone help me with this?

Or is there anything like p2pool available?


texts:
I have 2 contracts to be removed

0xc4ba2bbfc1d35d4a6dc37d7764081a1880e5a281 unable to verify source for some reason.
0xf3db7f7f6419bf537fd24eb530b6eace38850c0c contains 0 tokens.

How do i do this?

Regards,

William


texts:
This is the full code of App.js

import SimpleStorageContract from "./contracts/SimpleStorage.json";
import getWeb3 from "./utils/getWeb3";

import "./App.css";

class App extends Component {
  state = { storageValue: "", web3: null, accounts: null, contract: null, newValue: "" };

  componentDidMount = async () => {
    try {
      this.handleChange = this.handleChange.bind(this);
      this.handleSubmit = this.handleSubmit.bind(this);

      // Get network provider and web3 instance.
      const web3 = await getWeb3();

      // Use web3 to get the user's accounts.
      const accounts = await web3.eth.getAccounts();

      // Get the contract instance.
      const networkId = await web3.eth.net.getId();
      const deployedNetwork = SimpleStorageContract.networks[networkId];
      const instance = new web3.eth.Contract(
        SimpleStorageContract.abi,
        deployedNetwork && deployedNetwork.address,
      );

      // Set web3, accounts, and contract to the state, and then proceed with an
      // example of interacting with the contract's methods.
      this.setState({ web3, accounts, contract: instance }, this.runExample);
    } catch (error) {
      // Catch any errors for any of the above operations.
      alert(
        `Failed to load web3, accounts, or contract. Check console for details.`,
      );
      console.error(error);
    }
  };

  handleChange(event){
    this.setState({newValue: event.target.value});
 }

  async handleSubmit(event){
    event.preventDefault();
    const { accounts, contract } = this.state;
    await contract.set(this.state.newValue, {from: accounts[0]});
    const response = await contract.get();
    this.setState({storageValue: response})
 }

  runExample = async () => {
    const { contract } = this.state;

    // Get the value from the contract to prove it worked.
    const response = await contract.methods.get().call();

    // Update state with the result.
    this.setState({ storageValue: response });
  };

  render() {
    if (!this.state.web3) {
      return
Loading Web3, accounts, and contract...
;
    }
    return (

Welcome to your first successful dApp!

I like {this.state.storageValue}

        <form onSubmit={this.handleSubmit}>
          <input type = "text" value = {this.state.newValue} onChange={this.handleChange.bind(this)}/>
          <input type = "submit" value = "Submit"/>
        </form>

    );
  }
}

export default App;````

Error:
**Unhandled Rejection (TypeError): contract.set is not a function**

This error is generated on clicking the submit button.


texts: Updating chainspec without resetting (a private Parity blockchain)

texts: I'm running a private Parity blockchain, currently in test mode. There is always a possibility that we'll have to change some initial parameters when the blockchain is live. For example, we might want to disable Ice Age, change block rewards, etc. I know that newer Parity versions support additional parameters in the chainspec file, so it is possible to change it without resetting the blockchain. Which parameters in the chainspec file we'll be able to change and keep the blockchain running?


texts:
I'd like to install Mix in order to get experience with a Solidity IDE and its debugger, but all indications I've seen so far are that installation is a real headache.  Am I right about that?  And given that Mix has been discontinued, is it even worth giving Mix a go?  Perhaps it's better to just get started with Remix?  Would actually really like to try Mix, but not if it effects my velocity in learning other Ethereum related subjects.

Many thanks.


texts:
I made

# swarm up 1.mp4
58740257f3519e1e20a85994eefc3a4d8d40ac5f8649d5acf93d174676279ad5

and push 497Mb video to swarm. Swarm works and connected to my account.

When I try in Chrome

  localhost:8500/bzz:/58740257f3519e1e20a85994eefc3a4d8d40ac5f8649d5acf93d174676279ad5

everything is ok. Video starts, because this is local node, where video.

But when I try in Chrome external node (public or my remote server),

  https://swarm-gateways.net/bzz:/58740257f3519e1e20a85994eefc3a4d8d40ac5f8649d5acf93d174676279ad5

  http://myserver.com/bzz:/58740257f3519e1e20a85994eefc3a4d8d40ac5f8649d5acf93d174676279ad5

this video not loading, or loading very very slow by chunks.

I tested 100Mb video - almost the same. Only when I push index.html with only "Hello World" - I saw this using https://swarm-gateways.net/bzz:

I tried to add peers using this manual https://swarm-gateways.net/bzz:/swarm-gateways.eth/   - No success.

Do Swarm have peers?  Swarm works or not now? Can I use it for large files or it worth only for 1kb index.html?


texts: ENS .eth names are secretly auctioned. Why is this name publicly visible during auction?

texts:
Why is the name "newmovies.eth" visible on Etherescan in the startAuctionsAndBid public transaction with the ENS .eth Registrar?

It shows:

  ENS StartAuction for newmovies.eth

I thought that name is supposed to be secret and hashed. In this transaction it is not the case. I've tested with MEW ENS name auction creation and the name appears in clear in the test transactions. Anybody monitoring that kind of transactions can know the new auctioned names. Why aren't they kept secret and hashed?


texts:
After a long debugging I found that I had two following problems in a private ethereum network using geth:

If I have a require statement then the code is not executed on the EVM. The solution I found was to use a boolean and a if (test) { ...} statement
Some code did not work to the end (that is emission of emit Statement(...) in my case). The problem appeared to be insufficient gas. The raw solution to that was to double the gas as given by eth_estimate_gas.

What would be the real solution to those problems? What documentation exist about this kind of problems?


texts: Who is storing my data on IPFS when I upload the data and disconnect my node?

texts:
I am using IPFS desktop, is a very simple and visual tool to upload files to IPFS and get the public link (basically: "https://ipfs.io/ipfs/" + file hash)
I was doing some research, and for example I upload the file, access to the file trough the url in the browser.
All right, then I disconnect my IPFS desktop app, and I should be stopping the "sharing" of file, but it's not the case. I can access from another device to the file using the ipfs url of my file...
How does it work? Who is storing my file if it is not my node, and there is neither a service or another user pinning my file?
I know that there is a similar question to mine previously posted but does not solve my doubt.
Thanks


texts: why this contract can successfully do the transfer()

texts:
I am reading the source code of this erc20 token:

https://etherscan.io/address/0xfdfd5db568f2ecf9b06a16116b9201b0500735b4#code

the code is like this:

contract VelixIDToken is ReleasableToken, BurnableToken {
    ...

    function transfer(address _to, uint _value) public returns (bool success) {
        // Call StandardToken.transfer()
        CanTransferChecked(released || transferAgents[msg.sender], msg.sender, transferAgents[msg.sender], released);
        if (released || transferAgents[msg.sender]) {
            return super.transfer(_to, _value);
        } else {
            return false;
        }
    }

    ...
}

contract ReleasableToken is ERC20, Ownable {
    ...

    function transfer(address _to, uint _value) public returns (bool success) {
        // Call StandardToken.transfer()
        CanTransferChecked(released || transferAgents[msg.sender], msg.sender, transferAgents[msg.sender], released);
        if (released || transferAgents[msg.sender]) {revert();}
        return super.transfer(_to, _value);
    }

    ...
}

in my understanding, the token transfer()  can never really happen, released is false now, so in VelixIDToken, only transferAgent can pass the check:

if (released || transferAgents[msg.sender]),

well in ReleasableToken, the call will revert cause :

if (released || transferAgents[msg.sender]) {revert();}.

but I see successful token transfer on etherscan:

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

so where am I wrong?

ps. I even wondered if the source code uploaded to etherscan is wrong, can this happen?


texts: How to create a wallet address (say) for a user sign up with any password of user choice and login next time with the same password?

texts: I want my dapp to allow a new user when submitting a sign up to create an ethereum address with his provided password of his choice and next time when he logs into dapp, he must be able to login with his password with which he must be able to do transactions. I am aware that the user needs to have the private key to sign transactions. I am confused how his password can help him get his private key only when he needs it. I am building an html/js based dapp which communicates with ethers.js to ethereum rinkeby testnet.


texts:
Parity seems to work and comes up with the green 'homestead' button in the bottom right hand corner. When trying to sync with Kovan after using this video/tutorial for setup: https://www.youtube.com/watch?v=dTjstkfOT8E

It says "kovan" where the homestead is normally, but the boundary is red, not green. It will sometimes sync the blocks but won't pickup new transactions. If I crash and restart, new transactions will show up.

I am using chrome, but also have tried (initially) firefox.

edit: @susmit, ok thx, do you still put a config file and the parity folder? If i send a transaction it will show as pending but never complete unless i crash the app!?


texts:
pragma solidity ^0.4.11;

contract Test {
    function toBytes(address a) public pure returns (bytes b) {
        assembly {
            let m := mload(0x40)
            mstore(add(m, 20), xor(0x140000000000000000000000000000000000000000, a))
            mstore(0x40, add(m, 52))
            b := m
       }
    }

    function toBytes(uint _num) public pure returns (bytes _ret) {
        assembly {
            _ret := mload(0x10)
            mstore(_ret, 0x20)
            mstore(add(_ret, 0x20), _num)
        }
    }

    function test(uint num1, uint num2) public view returns (bytes) {
        bytes memory a1 = toBytes(msg.sender);
        bytes memory a2 = toBytes(num1);
        bytes memory a3 = toBytes(num2);
        bytes memory ret = new bytes(a1.length + a2.length + a3.length);
        uint x = 0;

        for (uint i = 0; i < a1.length; i++) {
            ret[x++] = a1[i];
        }

        for (i = 0; i < a2.length; i++) {
            ret[x++] = a2[i];
        }

        for (i = 0; i < a3.length; i++) {
            ret[x++] = a3[i];
        }

        return ret;
    }
}

I tried the code in Remix, and it always gives me an error:

call to browser/test.sol:Test.test errored: VM error: out of gas.
out of gas  The transaction ran out of gas. Please increase the Gas Limit.
        Debug the transaction to get more information.

, even if I modify the gas limit to a very large value.

I thought view/pure functions will not affect the blockchain, and thus they are not executed by miners. Therefore, they consume no gas.

Am I wrong? If I'm wrong, how to make the code good for execution?

Many thanks!


texts: Token symbol is the same thing with metal(MTL)

texts: I built an ERC-20 token named Moontrail and the symbol is the same that Metal (MTL) I am afraid when listing on exchanges and coinmarketcap. Should I leave it or create another one?


texts: getTransactionCount with 'pending' not working?

texts:
Sending Ethereum transactions requires incrementing the nonce properly. In a typical application, there can be concurrent and/or consecutive requests to transfer from the same address.

Most solutions I've seen use getTransactionCount(fromAddress, 'pending') to set the nonce of the transaction, which is then sent using sendRawTransaction.

If two requests happen in the same block, then getTransactionCount(fromAddress, 'pending') should increase between the requests. However, this doesn't seem to be the case:

> web3.eth.getTransactionCount("0xf82e...", "pending");
5
> web3.eth.sendTransaction({from: "0xf82...", to: "0xf1c...", value: 42000000000000000});
I0624 15:57:41.848826 eth/api.go:1193] Tx(0xbd094a59eb8f05653f35fa93a9254db95bc6b9b5bdd3b95aedda27bb781545f9) to: 0xf1c...
"0xbd094a59eb8f05653f35fa93a9254db95bc6b9b5bdd3b95aedda27bb781545f9"
> web3.eth.getTransactionCount("0xf82...", "pending");
5
> I0624 15:57:59.315075 miner/worker.go:337]   Mined block (#4529 / 7788e873). Wait 5 blocks for confirmation
I0624 15:57:59.315639 miner/worker.go:555] commit new work on block 4530 with 1 txs & 0 uncles. Took 529.458µs
I0624 15:57:59.315664 miner/worker.go:433]    Mined 5 blocks back: block #4524
I0624 15:57:59.315989 miner/worker.go:555] commit new work on block 4530 with 1 txs & 0 uncles. Took 310.783µs
> web3.eth.getTransactionCount("0xf82...", "pending");
6

As you can see, getTransactionCount(from, 'pending') only increases after the block has been mined. In result, the second request uses the same nonce and the second transaction fails (queued, dropped, etc.).

Is this a bug with getTransactionCount? I'd assume it should return an increased nonce, because 'pending' has been specified.

Also, do we need to manage the nonce on the application side or is the some other solution to this? A stateless solution on the application side would be much simpler to manage.


texts: Syntax Error When Defining Network in truffle.js

texts:
Newbie completely stumped by the following syntax error.

dwayne@dwayne-UX305CA:~/HelloTruffle$ cat truffle.js
//module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // to customize your Truffle configuration!
//};

networks: {
  ganache: {
      host: "localhost",
      port: 7545,
      network_id: "*"
  }
}

dwayne@dwayne-UX305CA:~/HelloTruffle$ truffle migrate --reset --compile-all --network ganache
/home/dwayne/HelloTruffle/truffle.js:9
      port: 7545,
          ^

SyntaxError: Unexpected token :
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Function.Config.load (/usr/lib/node_modules/truffle/build/webpack:/~/truffle-config/index.js:259:1)
    at Function.Config.detect (/usr/lib/node_modules/truffle/build/webpack:/~/truffle-config/index.js:248:1)
    at Object.run (/usr/lib/node_modules/truffle/build/webpack:/~/truffle-core/lib/commands/migrate.js:35:1)
    at Command.run (/usr/lib/node_modules/truffle/build/webpack:/~/truffle-core/lib/command.js:101:1)
    at Object.<anonymous> (/usr/lib/node_modules/truffle/build/webpack:/~/truffle-core/cli.js:16:1)
    at __webpack_require__ (/usr/lib/node_modules/truffle/build/webpack:/webpack/bootstrap b4601922d6f11f8bff0b:19:1)
    at /usr/lib/node_modules/truffle/build/webpack:/webpack/bootstrap b4601922d6f11f8bff0b:65:1
    at Object.<anonymous> (/usr/lib/node_modules/truffle/build/cli.bundled.js:71:10)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3

dwayne@dwayne-UX305CA:~/HelloTruffle$ truffle version
Truffle v4.1.11 (core: 4.1.11)
Solidity v0.4.24 (solc-js)


texts: Recovered Sender Address from Raw Transaction

texts:
I'm trying this code example : https://thomasclowes.com/verifying-an-ethereum-signature-on-the-server-php-2/

Expected $recoveredSenderAddress = 0xd5bfc359c3a377bb8afd41db8ffc8d1349718233

Actual $recoveredSenderAddress = 0x65f0041f24b95b4d73cb128491b592f08a432c37

Tested transaction is =>  https://ropsten.etherscan.io/tx/0xc14a23d652315c871474142745bc23268e0fac2ee9f0d56a108e208571c03a86

// $transactionRaw = 'f86a06843b9aca00835d161494e2f9d68bb0d2adcb0d926e93896366d0f2a4573886313030303030801ba0a267b2cd995a8475b967f688d96af1442af777c545cac8d35d08225e31167b32a066308ac688f621ad3f284a63153af7d7c711409926ac0c7e0231fdf0f005b74f';

public function recoveredSenderAddress($transactionRaw)
{
    $rlp = new RLP; // Lib Web3p\RLP\RLP (Recursive Length Prefix)
    $decodedArray = $rlp->decode('0x'.$transactionRaw);

    $rHex = $decodedArray[7]->toString('hex');
    $sHex = $decodedArray[8]->toString('hex');
    $vValue = $decodedArray[6][0];

    //"v" => 27
    //"r" => "a267b2cd995a8475b967f688d96af1442af777c545cac8d35d08225e31167b32"
    //"s" => "66308ac688f621ad3f284a63153af7d7c711409926ac0c7e0231fdf0f005b74f"

    $messageHex       = $transactionRaw;
    $messageByteArray = unpack('C*', hex2bin($messageHex));
    $messageGmp       = gmp_init("0x" . $messageHex);

    $r = $rHex;     //hex string without 0x
    $s = $sHex;     //hex string without 0x
    $v = $vValue;   //27 or 28

    //with hex2bin it gives the same byte array as the javascript
    $rByteArray = unpack('C*', hex2bin($r));
    $sByteArray = unpack('C*', hex2bin($s));

    $rGmp = gmp_init("0x" . $r);
    $sGmp = gmp_init("0x" . $s);

    $signature = array_merge($rByteArray, $sByteArray);

    $recovery = $v - 27;
    if ($recovery !== 0 && $recovery !== 1) {
        throw new Exception('Invalid signature v value');
    }

    $publicKey = Signature::recoverPublicKey($rGmp, $sGmp, $messageGmp, $recovery);

    $recoveredSenderAddress = "0x".substr(hash('sha3-256',hex2bin($publicKey['x'].$publicKey['y'])), 24);

    return $recoveredSenderAddress;
}

What am I doing wrong ? Thx !


texts:
How do I connect to the local node run by Mist/Ethereum Wallet 0.9.0 from Web3 JavaScript app API?

I see in official site that it suggests using

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

However this call fails because there is nothing running on that port.


texts: This contract has given out ERC20 tokens called VSL. The total supply is said to be 33,390,496.03337560002666059, but if you inspect the contract, that value is stored as a uint256, which means it's value is 33390496033375600026660590. How do you convert a uint256 to get the correct amount issued?


texts: Issues with using/installing python solidity parser

texts:
I am trying to install and use python solidity parser by ConsenSys

I keep on getting the following error

File "<stdin>", line 1, in <module>
  File "/home/seed/.local/lib/python3.5/site-packages/python-solidity-parser/solidity_parser/__init__.py", line 1, in <module>
    from .parser import parse_file, parse, objectify, visit
  File "/home/seed/.local/lib/python3.5/site-packages/python-solidity-parser/solidity_parser/parser.py", line 10, in <module>
    from solidity_parser.solidity_antlr4.SolidityLexer import SolidityLexer
  File "/home/seed/.local/lib/python3.5/site-packages/python-solidity-parser/solidity_parser/solidity_antlr4/SolidityLexer.py", line 783, in <module>
    class SolidityLexer(Lexer):
NameError: name 'Lexer' is not defined

Is there any other dependency that we are supposed to install that I missed?
I am running this on ubuntu with python 3.5.2


texts: How can gasUsed of a transaction be lower than the gas used by internal transactions?

texts:
Take this transaction for example: https://etherscan.io/tx/0xb8c2ee4dcc07352b535317304ca64ada5b03ab3c868a2281609cfd4ac4c619e9

It reports a gasUsed of 163215 when calling the contract.

On the other hand, the initial call in the parity trace reports a gasUsed of 0x4a6c5, which is 304837. The contract itself calls another contract, which uses around 250k of gas if called directly or by other contracts (which is correctly reported by parity trace).

Are there advanced techniques to call another contract without using gas/hiding the gas or why is the gasUsed by the transaction lower than the gas reported by parity trace? Or is this some kind of bug/exploit?


texts: Why does selfdestruct() have an address requirement?

texts: Why must selfdestruct take the contract's original msg.sender argument? Isn't the idea that it 'self' destructs?


texts: "drizzle-react-components" import Error for "LoadingContainer"

texts:
I am trying to import import { LoadingContainer } from 'drizzle-react-components'

Which I succfully installed with npm install drizzle-react-components@1.3.0

It was installed inside the directory Drizzle\client\node_modules\drizzle-react-components

However whenever I start the react app I get this error.

Failed to compile
    ./node_modules/drizzle-react-components/dist/drizzle-react-components.js
    Module not found: Can't resolve 'drizzle-react' in 'C:\Users\carl-\Dropbox\Brain\Education\Independent Software Studies\Blockchain\solidity\Drizzle\client\node_modules\drizzle-react-components\dist'

This is the complete code from inside C:\Users\carl-\Dropbox\Brain\Education\Independent Software Studies\Blockchain\solidity\Drizzle\client\src\app.js

import React from 'react';
import logo from './logo.svg';
import './App.css';
import { LoadingContainer } from 'drizzle-react-components'

function App() {
  return (

      //<LoadingContainer>

Hello Smart Contracts

      //</LoadingContainer>

Hello Mrs blockchain??

  );
}

export default App;

Any guidance would be greatly appreciated.

Thank you


texts: Wallet has disapeared, by installing updates

texts:
I had several Ethereums in that wallet so I would like to get it back.
I only managed to get the Accounts back, but no Wallet.
But I still have the complete backup off the the whole Ethereum-directory.
So if anyone can tell me what the name is of the the file that holds the wallet-info?

Hans.


texts:
What is the (a) technical difference between and (b) practical difference between these, i.e., when do you use one or the other:

bool result = address(contract).call.value(10)(bytes4(keccak256("buyItem(uint256)", _sku)));

bool result = address(contract).call.value(10)(abi.encodeWithSignature("buyItem(uint256)", _sku));

The code refers to an exercise where we buy an inventory item, identified by _sku (a uint) for an amount value aka msg.value  Thanks


texts: How do EOAs work and what is their interaction with smart contracts?

texts:
After reading and searching online, I still have many doubts about how EOAs work and their relationship with smart contracts.
The idea behind my dapp is to allow users to make reservations. It also offers a refund of the payment if certain conditions are not met.
I know that I have to implement a component in web3.js that sends the transactions (which I decided to call contract manager) and the smart contract in solidity. I have doubts about how to start the process.
My idea is that there is only one EOA (which I assume is in the contract manager (?)) that collects customer data (customer id and payment) and sends it via transaction to the smart contract.
My questions are:

Is it possible to have only one EOA that collects all the front-end requests (customer id + payment)? Is this id the customer's EOA? So an EOA (contract manager) that collects many EOA + payment?
Must the payment of each client (which is collected by the contract manager) be in ether or in real money?
Is it correct to say that my contract manager (implemented with web3.js) owns the only EOA that sends transactions to the smart contract?


texts: At first I read the tokens which based on ethereum are cannot be mined. Then I read at reddit that mining option can exist with new ERC20 standard. Are there any tokens that can be mined?


texts:
Given that I am connected to the network with at least one peer, can I be sure that a transaction I sent will be executed (either with fail or success)? Is there a possibility that it will never make it to the blockchain, so that the sender will not spend anything? What if it was included in some block, but then the block gets orphaned? Will my transaction be "removed"?

If there is such a possibility, how to deal with it? Given that I record the TxHash, can/should I check it regularly, and if it still does not exist after a "big" number of blocks, alert the user that their transaction is not executed and they should send it again? This solution looks like it's prone to double spending. Also, from this answer I understand that a transaction can disappear and reappear much later, so the "big" amount of blocks to wait is indefinite. So how can I make sure that a transaction is included in the blockchain?

Thanks


texts: How to get a index position of the storage on the smart contract?

texts:
I'm trying to get the value of private variables from web3.eth.getStorageAt() that requires 2 parameters, one is an address, and another is index position. So, I have 3 questions.

How to get the index position? (How do I know that my desired variable's index is?)
Is it possible to get the value of private variables from other contracts that I don't have any ABI of them?
Is it possible to get the value of private variables from the contract by another contract? (No need front end client like web3js)


texts: Listen for new ERC20 token deployments in golang?

texts:
Is it possible to listen for new contract deployments ?
More specifically ERC20 tokens ?
Then abstracting the decimals and ticker and name.
I am trying to create a list of all new ERC20 deployments that I need.
I have managed to listen to new headers, get the block and then get the transactions.
Now I am lost :-)
Thanks in advance.


texts: If I installed Mist, do I also need to install geth separately?

texts:
Under Mac when I try to run "geth", I get the error "command not found".

Mist is installed and in use..


texts: I've given Gwei less than 0.1 for a transaction, and it's been an hour, and it is not showing up in etherscan!

texts:
I know I pretty much messed up with Gwei, I've given it < 0.1. My doubt is if the transaction gets failed will the funds get back to my wallet or lost forever and how much time will it take for the transaction to get rejected? Do I have to wait for several days?

Thanks in advance!


texts: How can I run go-ethereum as daemon process on Ubuntu?

texts: The Installation Instructions for Ubuntu suggest running geth from the command line, how can I run it as daemon process / service on Ubuntu?


texts: What is the recommended read/write speed for an SSD when syncing an archive node?

texts:
I am planning to sync an archive node for research purposes and am preparing to buy the hardware. How does the read/write speed of the SSD affect the sync speed? Is 500 MB/S enough, or would an upgrade to a faster, more expensive SSD improve the sync speed?

And more generally: Where is usually the bottleneck for sync speed?

And on a related note, does it matter if the storage space is split accross multiple SSDs? Can geth/partiy handle this automatically?

Thanks!


texts: How do I add 7 years to a current time expressed as a block.timestamp?

texts:
Being new to solidity, I find the docs on the Internet very confusing.
I simply want to add 7 years to a

uint timeInSevenYearsFromNow = (block.timestamp).add(????);

What is the value of ???? and how do I calculate it ? Is it 220898482 ?

Yes, this is a noob question.  I do not care how precise or exact it will be when executed, whether it is off by a nano-second or several minutes.


texts: Ethereum Contract Scalability (Single vs Multiple Contracts)

texts:
I am writing a token swap contract on Ethereum Blockchain to manage ERC 20 token swap in an exchange.

The Questions is that in terms of scalability, which of the following two options would be better considering the exchange will handle up to a Million Users.

Option 1
Create multiple contracts with each responsible for swapping a single pair. This can distribute the workload on a single contract.

Option 2
Create a single contract to manage swapping of all the tokens.
This option can be used considering that the blockchain can Handle the processing in a decentralized manner and the smart contract will be able to call multiple methods in parallel without affecting the performance

So which option would be correct and more suitable in case of an Exchange with up to a Million Users


texts: In Quorum running raft consensus, what happens if one node attempts to modify the state via modofying the physical file?

texts:
In quorum running raft consensus, what happens if one node attempts to modify the state via modifying the physical file? Assuming this is even possible in the first place.

Will the update be sync across the network? Or will the updated node have its change overwritten?


texts: How to determine Gas Price and Gas Used?

texts:
I have got 2 questions actually:

How to determine the gas price? Metamask fills this in for me, but it is always too low when I click on submit.
Basically all values on ETH Gas Station seem too low?
How much Gas Limit to put in?
I've gotten a transfer through using high values. but it failed nonetheless. It seems I now lost 0.0105 Ether ($13.66)?
Is there a way to get this back? Is there a way to NOT make these mistake? It is truly a very high learning curve (and costly).

See: https://etherscan.io/tx/0x2d68ca04e623509c05713a8b80c857e49cc80d3a71aadebd0aca7eb2511c57cd

Thanks for any assistance.


texts: How much ether was transferred for the DAO hardfork?

texts: So supposedly at block 1,920,000, all of the ether in these addresses was instantly transferred to 0xbf4ed7b27f1d666546e30d74d50d173d20bca754, right?  Between all of those addresses at block 1,919,999, I have a total value of 12001961845205763407115004 wei (12,001,961.845205763407115004 ETH).  Can someone tell me if this is correct?


texts: Problem with timestamps in Solidity - modifier failing

texts:
folks. I have a weird issue that has been racking my brain all day. I have isolated it to this bit of code.

In my Crowdfund constructor:

 startsAt = now;
 endsAt = 1507852800; // 4 weeks later

I also have a modifier:

modifier crowdfundIsActive() {
    assert(now > startsAt && now < endsAt);
    _;
}

Any function with this modifier fails randomly. I currently have it on my default payable:

function () payable crowdfundIsActive {
    buyTokens();
}

It fails completely randomly. I can run my truffle tests over and over and over, even pasting the same test in there 20 times, and it will pass half of them and fail half of them. If I remove one of the assertions (ie, the comparison to endsAt or the comparison to startsAt), it still fails randomly.

Here is a picture of the same test failing 3 times and passing once:

Sometimes it passes all 4 times, sometimes fails all 4, etc.

If I deploy the contract to Ropsten, sending ETH to this function fails. If I remove the modifier, it works fine. What am I missing?

I understand using block.number is more reliable, but time manipulation is not too big of a factor in this code, as it is not a lottery or anything like that. I would like to use timestamps for this.

Any ideas?

EDIT: I fixed it by changing > and < to >= and <=. No idea why this works, as the equals shouldn't be factoring in...


texts: How can we prevent duplicate data entry in Blockchain? For example, in case of identity storage, how do we make sure that the details of a person (set of name, ssn, dob, etc) being sent to the Smart Contract was never sent earlier?


texts: can a node mine without download all of the blocks

texts:
if there is a node which doesn't have enough disk space, can i mine without download all of the blocks?
i wonder if i can mine ,with just downloading the latest states of ethereum? but i'm not sure how much space this would take up.
P.S. The help of the mining pool is not considered


texts: Receive boolean from contract to contract transaction

texts:
Is there a way to receive a boolean response when sending Ether from one contract to another contract function?
I understand that transactions return transaction hashes, but is there a safe way to call the other contract function to receive a boolean, even if that other contract is a payable function?


texts: unable to locate the block chain file read in go-ethereum

texts:
I have downloaded the go-ethereum code and analyzing it. It is working properly but I am not able to locate the file read and write for the block.

I have seen the eth.getBalance() function code but I could not find the file read option anywhere. It is going through the trie and get the data.

How the blocks are read by the programs?


texts: Using NFT paired to credentials for identity verification

texts:
I have a question on the feasibility of pairing a non fungible token (NFT) with credentials for identity verification on the Ethereum blockchain. Can we imagine a scenario where a user would have a unique NFT token assigned to him upon account creation on a platform, and that the credentials used to create the account, when re-used for logging in to the platform could match, and therefore retrieve the NFT? The process would take place in such a way that even the owner of the platform could not know what NFT is matching what account. That way, for any action performed on the platform, the user is identified by his NFT instead of his credentials (username or email) to preserve anonymity?

Additional note based on received answers: people would actually be registering with their identity cards on the platform to make sure that one person can't have more than one account. Another important point here, is that the owner of the platform should not be able to match the created account with the associated "transaction-maker" entity while by re logging-in with the same ID, the system should be able to do the association.

I know this may look like a dumb question, but any answer would be really appreciated.

Thanks.


texts: How to access public variables, and getting return values in smart contracts

texts:
Say I have a smart contract such as:

contact Rabbit {
    string public name;

    function setName(string n) returns (bool) {
        name = n;
        return true;
    }
}

How can I get the value of name after having set it? I'm using Truffle. I've tried (where rabbit is a handle of Rabbit:

rabbit.name();

This just returns ''.

Also, how can I get the return value? If I execute setName I just see the transaction, not the return value. I read somewhere I can use call(), such as: rabbit.setName.call("barry"), though it wont save the transaction so it needs ot be call again, without call(). Have I got this wrong?

Thanks.


texts: What happens if you chained delegatecalls?

texts:
Solidity docs say "only the code of the given address is used, all other aspects (storage, balance, ...) are taken from the current contract." This is useful when creating a library.

But what happens if you chain delegatecall( )?


texts: Brew linkapps deprecated, unable to install on Mac

texts:
brew linkapps solidity
Warning: brew linkapps has been deprecated and will eventually be removed!

Unfortunately brew linkapps cannot behave nicely with e.g. Spotlight using
either aliases or symlinks and Homebrew formulae do not build "proper" .app
bundles that can be relocated. Instead, please consider using brew cask and
migrate formulae using .apps to casks.

From: http://solidity.readthedocs.io/en/develop/installing-solidity.html


texts:
I want to convert address to bytes8, but I only managed to convert address to bytes this way:

bytes memory shortAddress = new bytes(8);
for(uint i = 0; i < 8; i++) {
  shortAddress[i] = byte(uint8(uint(newContractAddress) / (2**(8*(19 - i)))));
}

Now I search for a way to convert from bytes to bytes8, but I think it would be more efficient to go directly from address to bytes8. Is there a way to do so?


texts: When sync'ing with geth, what is the meaning of the value of "processed"?

texts:
I had thought that the value of the "processed" during a sync was the block number, but the number goes far beyond the latest block.

What is the meaning of this number?


texts: Can I use import {address [ ] } from 'filename' to pass a address array to another smart contract's function?

texts:
In my PersonalInfo.sol file I want to pass address array Users(maybe by function SendUserArray, but I don't know how...) to another contract System.sol file. Is it possible to use import {Users} from PersonalInfo in System.sol to access the Users address array?

This is my PersonalInfo.sol

pragma solidity ^0.4.17;
contract PersonalInfo{
    address public userAddress;
    address public manager;
    address[] public Users;  // include Recruiters and Workers

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

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

    function AddUsers()public payable{
        if(msg.sender != manager)
            Users.push(msg.sender);
    }
    function SendUsersArray()public{

    }

}


texts: How do I fix this compile error: "throw" is deprecated in favour of "revert()", "require()" and "assert()"?

texts:
I've just downloaded Mist 0.9.0 and I tried to compile a new contract but it does not let me do it with this error:

"throw" is deprecated in favour of "revert()", "require()" and "assert()".
      throw;
      ^---^

In this code caused by the modifier onlyOwner:

/*
 * Ownable
 *
 * Base contract with an owner.
 * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner.
 */
contract Ownable {
  address public owner;

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

  modifier onlyOwner() {
    if (msg.sender != owner) {
      throw;
    }
    _;
  }

  function transferOwnership(address newOwner) onlyOwner {
    if (newOwner != address(0)) {
      owner = newOwner;
    }
  }

}

I'm not a Solidity developer, is it correct this edit?

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


texts: I can't see my Oraichain tokens on Metamask

texts:
I swapped Ethereum for Oriachain tokens on Metamask.
The Oraichain tokens only show up on the computer that I used for the transaction.
My other devices show Ethereum, but not Oraichain.
It doesn't list Oraichain on the list of tokens to add.
How do I get Oraichai to show on all devices?


texts: How would I best resolve this specific type of 'Unused local variable' warning?

texts:
I have a function which returns multiple values.

In some places I use all of them, while in other places I use only some of them.

This short snippet can illustrate the problem:

contract A {
    uint256 x;
    uint256 y;
    uint256 z;
    uint256 w;
    function getVars() external constant returns (uint256, uint256, uint256, uint256) {
        return (x, y, z, w);
    }
}

contract B {
    A private a;

    function func1() external {
        var (x, y, z, w) = a.getVars();
        // Do something with all variables (x, y, z, w)
    }

    function func2() external {
        var (x, y, z, w) = a.getVars();
        // Do something with only some variables (x, y)
    }
}

For which, Solidity compiler gives me the following two warnings:

contracts/B.sol: Warning: Unused local variable.
        var (x, y, z, w) = a.getVars();
                   ^
contracts/B.sol: Warning: Unused local variable.
        var (x, y, z, w) = a.getVars();
                      ^

How would I best resolve this problem?

Of course, I could just "state" them explicitly, for example:

    function func2() external {
        var (x, y, z, w) = a.getVars();
        (w, z); // Avoid compilation warning
        // Do something with only some variables (x, y)
    }

But it seems like a pretty ugly solution.

Is there a compilation flag which I can apply only for this specific file?

Or ideally, is there something "nicer" that I could put in the code in order to revoke this warning?

Thank you.


texts: I'm fetching the logs using client.SubscribeFilterLogs. The event parameters are encoded in types.Log.Data. How can I decode it in go?


texts: Ethereum Wallet "The DAO" token watch widget displays more token than what I actualy have

texts:
I'm using Ethereum Wallet 0.7.3 on OSX el capitan.
When I go to the DAO hub page to check my token balance, it displays

  DAO Tokens owned : 3591.5

In Ethereum Wallet, the token widget displays 3701.5 DAO tokens.

But when I go to my DAO account view in Ethereum Wallet it shows me the right (3591.5) token count.

I only have two accounts loaded in my Ethereum Wallet, one with which I sent ETH to the DAO and my mining account. I verified that the mining account is not associated with any DAO token on the DAO hub page. So all token I have and that should be displayed in that widget are associated with the first account.

I used a blockchain explorer to check again the amount sent (using 3 tx) to the DAO and it's 35,915 ETH, so 3591.5 DAO tokens is the right count.

Any one experiences this strange thing ? How to explain the difference ?

Thanks.


texts:
Type get attach (an error appears: fatal:unable to attach to remote geth: timed out waiting for pipe '\\,pipe\geth.ipc'to come available)
Type eth.sendTransaction({from: eth.coinbase, to: "RECEIVER ACCOUNT", value: web3.toWei(1.00, "ether")}) (an error appears: web3.from wei is not recognized as an external internal command,operable program or batch).

Can anyone help me with this ?
Regards


texts: Is it possible to see contract raw code from TxHash?

texts:
I created a contract.

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

I can see the input Data in hex on etherscan. How can I decode from this? I want to see the raw contract or contract code so that I can confirm whether my contract is correct or not.


texts: Mist: how to view private key of an account

texts:
Question:

How do I use Mist to extract the Raw private key of an account. The account is password protected (if that makes a difference I don't know).

Elaborating:

I made an account with  mist that has a a password associated to it
I already backed up the JSON file which can be used to import the account into another mist wallet

What I want however is the RAW private key. I understand I don't need it since I have the JSON file, though I still want to at least know how to get it if I do want it.

Ideally there would be some easy UI option in Mist, though I recognize that there might be a geth command as well. All help is really appreciated.


texts: miner.start() returns null but no transactions take place

texts:
I have created a genesis block and initialized it in the private network. Account creation is also successful. As soon as I hit miner.start() [or miner.start(1)], the following appears:

  INFO [12-20|12:49:24.958] New local node record                    seq=6 id=cfffe86baf054a73 ip=42.106.20.83 udp=11567 tcp=4321
  INFO [12-20|12:49:33.299] Updated mining threads                   threads=4
  INFO [12-20|12:49:33.299] Transaction pool price threshold updated price=1000000000
  INFO [12-20|12:49:33.300] Commit new mining work                   number=1 sealhash=12a617…a2a645 uncles=0 txs=0 gas=0 fees=0 elapsed=729.339µs

After this, the machine stops responding altogether. It is not generating DAG and nor is it mining any ethers.

Stuck at a dead end. Any help would be greatly appreciated.
Thank you.


texts: Cannot access geth by JSON-RPC. It returns {"jsonrpc":"2.0","error":{"code":-32600,"message":"EOF"}}

texts:
I've tried to access geth by rpc.

$ geth --dev --datadir mydir --rpc --rpcaddr "localhost" --rpcport "8545" --rpccorsdomain "*" console

However it has returned the error. Could you tell me how to solve the problem?

{"jsonrpc":"2.0","error":{"code":-32600,"message":"EOF"}}

Update
I've got connected by rpc, however on the browser-solidity I cannot connect my private node.


texts: ipfs files ls not showing all the files uploaded to it

texts:
When I am using ipfs files ls, it is not showing all the files which are being added.
But when I am searching the files in ipfs explorer through the hash I am getting the file.


texts: Deploying Migrations.sol file in mainnet

texts:
I've seen some tutorials about deploying a smart contract to mainnet using Truffle.
In those tutorials they are also deploying Migrations.sol contract to mainnet.
What is the purpose of doing that? I think it's not necessary to deploy Migrations.sol contract to mainnet. Isn't it just for development purposes? What would happen if I don't deploy that contract to mainnet?


texts: I have a ledger nano s and it shows up as new wallet and ethereum app online when its plugged in but I'm not sure how I can tell if anythings going in it. I am disgustingly new at this and trying to learn as fast as I can and still maintain control in my life with my responsibilities. I'm running 2 MSI radeon rx 570 8gb gddr5 soon to be 3 I'm not sure how long it will take to pull in a coin and I believe I am in the dwarf pool


texts: Is that worth to take the latest CPU to mine Ethereum?

texts: I've been thinking that it's actually worth, but I'm pretty sure I'm missing something there, as I looked into the last AMD 8x R9 390, that has a 250MH/s rate, which is pretty impressive, while it only costs 300€. So, shall I go for this GPU ?


texts: Does ethstats.net include blocks with 0 transactions?

texts:
Does the The Ethereum network status monitor (ethstats.net) include blocks with 0 transactions?
Thanks in advance.


texts: Ethereum RPC equivalent of bitcoind's listsinceblock

texts: Is it something have go-ethereum or parity similar as listsinceblock? Because iterate step by step from chosen block number/hash to actual eth.blockNumber will be very expensive operation.


texts: Non-specific error from truffle debugger

texts:
I am testing a contract which is using ecrecover function of solidity. While its testing when i go with a failed test case while debugging, it doesn't go step by step and at the end return the same error as below. What is the reason of all this?

  TypeError: Cannot read property 'start' of undefined
      at Debugger.step (/home/aniket/.nvm/versions/node/v8.9.3/lib/node_modules/truffle/build/cli.bundled.js:322984:59)
      at Object.interpreter (/home/aniket/.nvm/versions/node/v8.9.3/lib/node_modules/truffle/build/cli.bundled.js:318096:22)
      at ReplManager.interpret (/home/aniket/.nvm/versions/node/v8.9.3/lib/node_modules/truffle/build/cli.bundled.js:203345:18)
      at bound (domain.js:301:14)
      at REPLServer.runBound [as eval] (domain.js:314:12)
      at REPLServer.onLine (repl.js:442:10)
      at emitOne (events.js:116:13)
      at REPLServer.emit (events.js:211:7)
      at REPLServer.Interface._onLine (readline.js:282:10)
      at REPLServer.Interface._line (readline.js:631:8)


texts: Can 3rd party call public functions of Solidity library?

texts:
A library is deployed separately and a contract is linked to it. All internal library functions are copied to the contract using it. But what about public functions?

If the library declares struct Storage and public functions make changes to the storage, is it safe to assume no third party can call those functions and that they are accessible only for the contract using the library?

library Friends {

  struct Storage {
    address[] friendsList;
  }

  function addFriend(
    Storage storage self,
    address friend
  ) public { // <- can anyone but MyContract make changes?
    self.push(friend);
  }
}

contract MyContract {
  using Friends for Friends.Storage;

  Friends.Storage friendsStorage;
}


texts: I have two Metamask accounts with the same password and seed phrase. How is this possible?

texts: So after doing a 'system restore' on my Ol' Faithful laptop, and reinstalling Chrome, my MMask extension was no longer there. Thankfully it's on mobile and I have the seed-phrase. The probs started when I attempted to reinstall MMask w the seed-phrase and same PW...now to my horror I have TWO MMask accounts (diff. Eth addresses) under the SAME seed-phrase and password. How is this even possible? I'd like to say the Eth address is the only thing differentiating the two accounts. But I can't think any further than that. Thx in advance.


texts: Etherscan Forked Blocks' Reorg-Depth is Incorrect?

texts:
I suddenly found there is an reorg happened today whose depth is 3 on Etherscan.io here. The uncle blocks is at height 9919331 and the hash is 0x3b1161a8bdf5107f1dc2092781798d143b5ae66b6604823630b57f5d9450e1cb. However I further checked the structure of the blockchain history and found the structure is like this:

0xa0f0 => 0xc535 => 0x7ea3
        \
          0x3b11

0xa0f0,0xc535,0x7ea3 represent the blocks (first 16 bits of their hashes) in canonical chain, while 0x3b11 is the uncle block reported by Etherscan with reorg-depth 3. The hash of 0x3b11 is included as uncles in the block 0x7ea3.

I am very confused why Etherscan reports this uncle blocks as reorg-depth 3. It seem this reorg only discard one block (i.e. 0x3b11). Is this a problem in Etherscan? or are there some uncle blocks overlooked by me?


texts: Modify Geth miner to filter which transactions include in the blocks

texts:
Where should I start if Im trying to modify the Geth client to filter transactions by sender to include only specific transactions in the mined blocks ? What files of code should I understand to do it ?
Note: Im playing with a private PoA network if it matters.


texts: Are Transactions originating from one account mined in nonce order?

texts:
Discussion in another thread raises an interesting point. how many transactions could be included in a new block from the same account?

Since

miners can opt to omit a known transaction from the block they're
working on
miners don't have simultaneous knowledge of pending
transactions

is it correct to conclude that transactions submitted from the same node  more or less simultaneously (and with ascending nonce) are not necessarily mined in nonce order?


texts: What does mutability guarantees mean in erc721

texts:
Some functions from ERC-721 interface contain payable modifiers.

function transferFrom(address _from, address _to, uint256 _tokenId) external payable;

I was wondering why it is payable and found from EIP-721 that explains why.

  Solidity issue #3412: The above interfaces include explicit mutability guarantees for each function. Mutability guarantees are, in order weak to strong: payable, implicit nonpayable, view, and pure. Your implementation MUST meet the mutability guarantee in this interface and you MAY meet a stronger guarantee. For example, a payable function in this interface may be implemented as nonpayble (no state mutability specified) in your contract. We expect a later Solidity release will allow your stricter contract to inherit from this interface, but a workaround for version 0.4.20 is that you can edit this interface to add stricter mutability before inheriting from your contract.

Does this mean that when a function in the interface includes payable and when it is implemented, it can be changed to anything? such as public, view,  pure?  or did it mean that it can only be changed to nonpayable which is nothing? I don't get why it is not

function transferFrom(address _from, address _to, uint256 _tokenId) external;

in the first place. Also the definition Mutability guarantees is hard to understand. Can someone explain this in a simpler way please?


texts: How can I obtain testnet REP for use on Kovan?

texts: I would like to test the new version of Augur on the Kovan testnet. Where can I obtain testnet REP in order to do so? I found https://faucet.kovan.network/ for Kovan Ether (KETH) but cannot find anything similar for Kovan REP (KREP)


texts:
In JavaScript, there is "Math.abs":

Is there a similar function in solidity itself or some other popular library such as SafeMath?


texts:
I do not understand something: ERC721 standard interface contains a name and a symbol.
ERC1155 is very similar to ERC721 and I do not understand why there are no symbol and name variables in ERC1155.
I know I can add it but is there a specific reason for this missing?
Thanks a lot.


texts:
I am trying to deploy a smart contract in private network using mist, but when I deploy my contract and provide transaction fee as 0.04 ether it throws error as exceeding block gas limit. Here is the pic

What fee should I provide for proper deployment?

This is my contract-

    pragma solidity ^0.4.24;
    contract Greet
    {
  string message;
  constructor() public
  {
    message = "I'm ready!";

}
function setgreetings(string _message)public
{
    message = _message;

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

my blockchain gas limit is -

    "gasLimit": "2100000",


texts: Best practice for triggering a function every x blocks

texts: I would like to trigger a function every 20 blocks. Are there any good 3rd party contracts that do this?


texts: transfer ether from contract to another contract

texts:
Have code like this:

pragma solidity ^0.4.21;

contract Forwarder {
    address public owner;
    mapping(address => uint256) public stored;

    function Forwarder () public {
        owner = msg.sender;
    }

    function () public payable {
        owner.transfer(msg.value);
    }

    function transfer (address contractAddress) public {
        require (stored[msg.sender] > 0);
        contractAddress.transfer(stored[msg.sender]);
    }

    function store () public payable {
        stored[msg.sender] += msg.value;
    }
}

But i cannot use "transfer" method if i set contractAddres = 0xSomeContractAddress, but if it will be account address all found will be successfully sent.

What am i doing wrong?(except English skills)


texts: using Ethereum without any gas or coins usage for transactions

texts:
I am new to Ethereum.

We are planning to use Ethereum for building an application where-in we don't want the users to buy and use Ether's. We want the user's to safely store and retrieve / share the information in the Ethereum Blockchain.

I have explored on the basics of Gas and their reduction for each step of execution in the SmartContract.

However, I would like to know if I can use the platform without requiring the user's to buy Ether and submit their data for sharing / storage. Also note that, I am planning to try out building an application that uses 0 Gas and 0 GasPrice.

I have read this question to be relevant, but the user wants to run in the local system, where as I would like to have it hosted in Ethereum network and make it available for public use.


texts: solidity how to test a crowdsale contract in truffle and testrpc by sending 1 ether

texts:
my solidity MyContract running on testrpc with truffle

i am trying to write a test using solidity to test the crowdsale contract
i want to test when an address send 1 eth to the contract address the contract produce the right tokens number that's how i went about it

MyCrowdSale.sol

function () payable {
    // codes....
}

TestMyCrowdSale.sol

pragma solidity ^0.4.11;

import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/MyToken.sol";
import "../contracts/MyCrowdsale.sol";

contract TestMyCrowdsale {

    function testCrowdsaleTransfer() {
        address _address1 = 0x9facfb4743b844222ba4a5ef5b7ef46ce916716e;
        address _address2 = 0x996b2237118af309c74adc16665f29f60bcb7437;

        MyToken coin = new MyToken();
        MyCrowdsale crowdsale = new MyCrowdsale(DeployedAddresses.MyToken(), _address1, _address1, 1504423393);

        // Send 1 ether to the crowdsale contract Address
        _address2.transfer(DeployedAddresses.MyCrowdsale(), 1 ether);

        Assert.equal(coin.balanceOf(_address2), 150000000000, "_address2 should have 150000000000 Token");
        Assert.equal(crowdsale.balanceOf(_address2), 150000000000, "_address2 should have 150000000000 Token");

    }

}


texts: How can I read any token units received in a Smart Contract? (Ether and other Tokens)

texts:
I would like to know how to identify units of specific tokens received in a Smart Contract.

I am building a Smart Contract that can receive ether or other ethereum tokens and in exchange for the tokens received another token will be issued.

Which code can I use in the Smart Contract to identify how many ether or any other token are received?

And in which function should it be used?


texts: Why is gas needed when fees can be derived intrinsically?

texts:
If fees are derived based on the equation (startGas - remainingGas) * gasPrice, why is gas even needed to be specified for a transaction?

The intrinsic gas can be derived from the contract itself, and as such so can the fee. So what is the reason for allowing originators to edit this?


texts:
Using the following code as an example:

// SPDX-License-Identifier: MIT

pragma solidity ^0.5.0;

contract SimpleStorage {
    event StorageSet(string _message);

    uint256 public storedData;

    function set(uint256 x) external returns(uint256){
        storedData = x;

        emit StorageSet("Data stored successfully!");

        return x;
    }
}

When calling the set function, Remix IDE does not show the return value. I know I could write a getter but in more complex scenarios, it might be helpful to get the return value directly from the function call. What am I missing or is this not possible?


texts: "data" field is not working in Ethereum QR Code mobile payment

texts:
Recently, I am working on generating an Ethereum QR code that mobile wallet (e.g. imToken) can scan and pay from there.
But the problem is that I cannot pass the data value.

I use C# code to generate the QR code as following:

using (MemoryStream ms = new MemoryStream())
            {
                QRCodeGenerator qrGenerator = new QRCodeGenerator();
                var url = "ethereum:" + coinAddress + "?amount=" + value + "&data=3130302c4852313739383337363236342c3836";
                ViewBag.QRCodeUrl = url;
                QRCodeData qrCodeData = qrGenerator.CreateQrCode(url, QRCodeGenerator.ECCLevel.Q);
                QRCode qrCode = new QRCode(qrCodeData);
                using (Bitmap bitMap = qrCode.GetGraphic(20))
                {
                    bitMap.Save(ms, ImageFormat.Png);
                    ViewBag.QRCodeImage = "data:image/png;base64," + Convert.ToBase64String(ms.ToArray());
                }
            }

I follow this url syntax:

ethereum:<address>[?amount=<ethamount>][&data=<Hexadecimal>]

I can get the address and amount
But not the data

Please help correcting me if I have done wrongly.
Any solutions or corrections, I highly appreciated. Thank you in advance.


texts: when an account is created using web3.eth.personal.newAccount(password), it will give u the account address but not the private key. How to get the private key of that newly created account. Can someone help me out


texts:
Having a difficult time with mininig for Eth. GPU does not have enough RAM, so that's out of the picture, but it's fine. I do this for fun and learning...

When I mine with CPU, it does a few hashes, and then errors galore:

miner  11:38:14.090|ethminer  Mining on PoWhash #e6d67189… : 224672 H/s = 188500 hashes / 0.839 s
  ✘  11:38:14.261|ethminer  Failed to submit hashrate.
  ✘  11:38:14.261|ethminer  Dynamic exception type: jsonrpc::JsonRpcException
std::exception::what: Exception -32700 : JSON_PARSE_ERROR: The JSON-Object is not JSON-Valid:  Database Error

In the background, I have geth --rpc running to have it catch up to the Blockchain. Not sure if anything got corrupted? Is that what those errors are? This is running on a Ubuntu 16.04 VM with 8GB RAM

# ethminer --version
ethminer version 1.2.9
Build: Linux/g++/Interpreter/RelWithDebInfo

Please help!


texts: i'm creating new account and when i get the balance for that account it returns 0 and cant do any transaction saying dont have enough funds

texts:
How to load funds/ether into newly created account. I'm using Ganache and Web3js

            var web3 = new Web3("HTTP://localhost:7545");
            var privateAccount = await web3.Personal.NewAccount.SendRequestAsync("ethics subject regret beyond coach grant soft clean sauce identify benefit club");
            var accountsList = await web3.Eth.Accounts.SendRequestAsync();
            var result = await web3.Personal.UnlockAccount.SendRequestAsync(privateAccount, "ethics subject regret beyond coach grant soft clean sauce identify benefit club", 1500000);
            var gas = await web3.Eth.DeployContract.EstimateGasAsync(ABI, byteCode, privateAccount);

            var balance = await web3.Eth.GetBalance.SendRequestAsync(privateAccount);
            var transaction = await web3.Eth.DeployContract.SendRequestAndWaitForReceiptAsync(ABI, byteCode, privateAccount, new HexBigInteger(gas.Value));


texts: Struct member access in web3 requires additional dummy field

texts:
If a struct contains a single field, then that field is inaccessible from web3. In the below example, field uint b must also be present in order to access field uint c from web3.
Of course, it's not the best use of structs if you're only storing a single field, but this unexpected behavior is also present in the more realistic scenario of using any number of additional array or mapping fields.

Workaround for now is to add unused dummy fields to my structs, but I'm wondering if this is expected behavior, and if this quirk is noted anywhere in the solidity documentation? I didn't find anything mentioned in the structs section.

Contract code:

pragma solidity ^0.5.0;

contract StructAccess {

    struct SimpleStruct {
        //uint b; // c inaccessible if this is commented-out.
        uint c;
        uint[] d; // This has no impact on ability to access c.
        mapping (uint => uint) e; // This has no impact on ability to access c.

    }

    SimpleStruct public singleStruct;

    constructor() public {
        singleStruct.c = 5;
    }
}

Testing code:

const StructAccess = artifacts.require("StructAccess");

contract('StructAccess', (accounts) => {

  it('should pass struct access test', async () => {
    const accessInstance = await StructAccess.deployed();

    const singleStruct = await accessInstance.singleStruct();

    console.log(singleStruct.c);
    assert.equal(singleStruct.c, 5);
  });

});

Test results:

With uint b, singleStruct.c is 5
Without uint b, singleStruct.c is undefined

Version info:

> truffle version
Truffle v5.0.13 (core: 5.0.13)
Solidity v0.5.0 (solc-js)
Node v8.11.2
Web3.js v1.0.0-beta.37


texts: How Ethereum NFT Protect Artist Work ( How NFT IMMUTABILITY works on BLOCKCHAIN)?

texts:
Hi Guys let discuss how NFT Immutable works on ethereum blockchain
I'm new to nft, just created my first one with opensea:) as in image1. My question
https://imgur.com/a/KX6TRgi
Is my art piece on blockchain now ? and No body can claim it's own or imitate it ? Or I have to pay eth fee to list, that will only make it immutable as in image2
https://imgur.com/a/u3yR5uP
Or it is not immutable (anyone can copy and create it own ) until it is sold to someone as shown in image3??
https://imgur.com/a/VymOQdZ
Thanks :)


texts:
I am having trouble migrating a contract using truffle.  So I want to test with another contract.  I know nothing about this.

Can someone point me to a contract/project I can download and migrate?  I'm using a private blockchain, so amount of gas is not an issue.


texts: Beside the block reward winner who will get most rewards from transaction fees?

texts: We know the only winner will get the block reward. Besides the block reward, we know nodes/node clients get rewards from transaction fees. So do all node clients get the same rewards? or the ones who received direct transactions get more?


texts: What is Input Data in transaction used for?

texts:
When one submits a transaction with data ex: eth.sendTransaction({from:eth.accounts[0],to:contractAddress,value:web3.toWei(1,"ether"),data: ...)

What is the purpose of including input data? especially when it is sending it to contract address?


texts:
I am following the truffle tutorial for creating a token.
I get this error when trying to  compile the contract.

ParserError: Expected identifier, got 'LParen'
    constructor () public {
            ^

Here is the code for the contract

pragma solidity ^0.4.24;

import "node_modules/openzeppelin/solidity/contracts/token/ERC20/StandardToken.sol";

contract AirtimeToken is StandardToken {
    string public name = "AirtimeToken";
    string public symbol = "AirTK";
    uint8 public decimals = 18;
    uint public INITIAL_SUPPLY = 12000;

constructor () public {
    totalSupply_ = INITIAL_SUPPLY;
    balances[msg.sender] = INITIAL_SUPPLY;

    }

}

I tried passing in the properties as params in the constructor and got the same error

UPDATE:
link to StandardToken.sol


texts:
I am using Parity and I want to see a list of the IP addresses of every node my node is talking to.  I am sure I have done this before but I can't remember how.  Please share the curl/RPC command to do this.

This does NOT work:

$ curl -X POST --data '{"jsonrpc":"2.0","method":"admin.peers","params":[],"id":83}' -H "Content-Type: application/json" -X POST localhost:8545
{"jsonrpc":"2.0","error":{"code":-32601,"message":"Method not found"},"id":83}

The Parity search gives no answer with this search: https://wiki.parity.io/index.html?q=admin.peers

parity_netPeers also does not work.  This lists many peers that I am not connected to.  I only want the list of the (1) node I am connected to.


texts: To transfer tokens using google cloud function

texts:
I am transferring token to the User's wallet when they create account. For that I am using google cloud functions. Here, on the account creation event, tokens will get transferred to the address. My cloud function is working fine but the token transfer function is not getting triggered. Here is the code-

 const admin = require('firebase-admin');
 const functions = require('firebase-functions');
 admin.initializeApp(functions.config().firebase);
 var Web3 = require('web3');
 var web3 = new Web3(new
 Web3.providers.HttpProvider("http://localhost:8545"));
 var Personal = require('web3-eth-personal')
 var personal = new Personal(Personal.givenProvider)]
 var ABI = [{
     ' contract ABI'
 }]
 var contract = new web3.eth.Contract(ABI, '0xF62E01...571ae957')
 exports.newUser = (event, callback) => {
const triggerResource = event.resource;
web3.eth.personal.unlockAccount("0xc..9050f547", "password", 60, (unlock) =>
 {
         contract.methods.transfer('0x4..bB7d982D8A8632e', 2).
         send({
             from: '0xC3Fe4...0F547',
             gas: 900000
         }, (error, txhash) => {
             if (!error && txhash) {
                 console.log(triggerResource);
             }
              callback();
          });
         })
       };

I have deployed the contract on the private network.


texts: What is the ethersjs equivalent of `web3.eth.call` in web3js?

texts:
web3.js has the ability to call a transaction and get return data without sending a transaction:

web3.eth.call(callObject [, defaultBlock] [, callback])

ethersjs apparently does not have this ability. These docs state:

  These methods cannot return their result to the caller.

Using etherjs, how can I get the return data of a transaction without making the actual transaction?


texts: How to find constructor values being passed to a contract

texts:
I'd like to find out which values were passed in when someone deployed a CrowdSale token. Is there a way to find out.

Here is Lunyr Crowdsale contract

How would I find out which values they passed in when they deployed a contract.


texts: On Rinkeby, after I deploy my gas limit is low for function, even though it was high when I deployed

texts:
I deployed my smart contracts to Rinkeby. I made my gas limit 3000000 in truffle.js like so:

rinkeby: {
  host: "localhost",
  port: 8545,
  network_id: 4,
  gas: 3000000
}

On Etherscan, it shows my gas limit is indeed 3000000. But when I try to use some functions, I exceed the gas limit. On etherscan it shows my gas limit is only 9000 and I exceeded it

Gas Limit: 90000

Gas Used By Transaction:90000 (100%)

As a result, the transaciton fails. Why is this the case?


texts: truffle deployment - runs out of gas on simple contract

texts:
I am trying to deploy the SimpleToken code from the Open Zeppelin project and seem to always run out of gas when deploying it to either Kovan or Ganache.

I even specified 4700000 gas in the truffle.js file which is the max gas I can provide. There is nothing fancy in the code - its literally copy and paste from Open Zeppelin.

https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/ERC20/StandardToken.sol

and I have all the dependent files as well using the import statements.

Any advise is greatly appreciated!

Running migration: 1_initial_migration.js
  Deploying Migrations...
  ... 0x627e13286c9ecbf8f9a0eae53a5e9a0788c9fe42cb6234d9734868a8eb4a70d9
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: The contract code couldn't be stored, please check your gas amount.
    at Object.callback (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:328412:46)
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:37990:25
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:330356:9
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:176198:11
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:326008:9
    at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:329052:7)
    at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176427:18)
    at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176717:12)
    at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176872:12)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176832:24)


texts: Can't find funded ropsten account using truffle console

texts:
I am not able to see my account on the ropsten network in truffle console when connecting to the ropsten network. I copied the mnemonic out of metamask and start truffle console with 'truffle console --network ropsten'. I do see a single account in truffle console, but this account can not be found in etherscan.
The network configuration in the migration script looks like (the api key is from infura):
ropsten: {
  provider: function() {
    return new HDWalletProvider(process.env.MNEMONIC, `https://ropsten.infura.io/v3/${process.env.INFURA_API_KEY}`)
  },
  gas: 5000000,
  gasPrice: 25000000000,
  network_id: 3
}

I'm using truffle console because I'm trying to troubleshoot a problem; when I attempt to deploy my contracts to ropsten, with 'truffle migrate --network ropsten --verbose-rpc', I am getting an error:
Error encountered, bailing. Network state unknown. Review successful transactions manually.
insufficient funds for gas * price + value

...and it looks like its using the account visible in truffle console, which does not appear to be on the ropsten network, nor is it funded.
I've created an account on the ropsten test network, and funded it with a faucet. I am able to see the account on ropsten.etherscan.io, as well as in my metamask chrome plugin. The account also appears with the expected amount of eth. I do not see this account when I connect with truffle console.
This is probably just a lack of understanding on my part of how the tools work, so an explanation of what is going on in addition to any workarounds/resolutions would be greatly appreciated.


texts: how to initialize a account in genesis.json file and fund it some money before mining?

texts:
in ethereum page of github,we can see something about genesis file below:

  Defining the private genesis state

  First, you'll need to create the genesis state of your networks, which
  all nodes need to be aware of and agree upon. This consists of a small
  JSON file (e.g. call it genesis.json):

{
"config": {
"chainId": 0,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"alloc" : {},
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x20000",
"extraData" : "",
"gasLimit" : "0x2fefd8",
"nonce" : "0x0000000000000042",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00"
}

  The above fields should be fine for most purposes, although we'd
  recommend changing the nonce to some random value so you prevent
  unknown remote nodes from being able to connect to you. If you'd like
  to pre-fund some accounts for easier testing, you can populate the
  alloc field with account configs:

  "alloc": { "0x0000000000000000000000000000000000000001": {"balance":
  "111111111"}, "0x0000000000000000000000000000000000000002":
  {"balance": "222222222"} }

I define "alloc": {
"0x0000000000000000000000000000000000000001": {"balance": "111111111"}
} in my genesis.json file, then I run command below:

./geth --datadir ethereum init genesis.json

but in geth console, after I run eth.accounts, it returns null

instance: Geth/helloworld/v1.6.6-unstable/linux-amd64/go1.8.3
 modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

> eth.accounts
[]
>


texts: Can I reuse a signed transaction generated offline by MyEtherWallet?

texts: I generated a signed transaction using MyEtherWallet on an air-gapped computer, and used it to successfully send a transaction.  Does anything prevent the signed transaction from being reused?


texts: Someone placed 7.77 VIN tokens into my MyEtherWallet account according to EtherScan, what can I do?

texts:
I use MyEtherWallet and a Ledger for my tokens.  I check today that in Etherscan that 15 days ago some different address placed 7.77 VIN tokens and sent them to my MyEtherWallet address in my account when I connect my Ledger to it. I'm afraid someone will steal my tokens from me.

Can I change my MyEtherWallet address or get a new one? How can I transfer all my tokens from one address to a new one? Or what should I do now?


texts:
I need to get transaction list within theDAO system. Is it possible or it's the same case of getting the internal transactions in Ethereum?
I want to know if there is a mechanism within theDAO to get these transactions.


texts: How to simulate p2p network for blockchain systems?

texts:
I am wondering how to build a simulator to simulate P2P network for blockchain such as Bitcoin or Ethereum. Specifcally, how to simulate transaction processing and propogation. Also, the same thing for blocks, Network topology and nodes distributions.

Is better to put these info as time delay and assumption (e.g., a transaction with size x requires Time = x*distance of node) or one needs to implement the network infrastructure? if it is based on delay and assumption, how to get such parameters for the simulator? If the network has to be implemented, is there any tool that helps to impement p2p network easily and accurately?

Any advice is welecom! Thanks


texts: Ethereum-PHP How to receive outbound parameters from smart contract function

texts:
In contract sol file I have function definition:

function product(uint32 _prdId) public view
returns (uint32 prdId, string prdName, address prd, uint closeTime,
         uint promoTime,uint8 bonus, uint256 price, uint8 numberOfOptions,
         uint256 totalSupply, uint8 status, uint32 next)

I'm calling this using:

$result[] = $schemaContract->product(new EthQ($prdId, ['abi'=>'uint32']));

And as result I'm receiving the error:

InvalidArgumentException: NOT IN RANGE:
33305383022926077062160769047565073723568839191253455377021159521291545790954752953639166213543... (967 digits) ...> (u)int256 in /home/.../public_html/test/ethereum-php-master/src/DataType/EthQ.php:153 Stack trace:
#0 /home/.../public_html/test/ethereum-php-master/src/DataType/EthQ.php(100): Ethereum\DataType\EthQ->getAbiFromNumber(Object(Math_BigInteger))
#1 /home/.../public_html/test/ethereum-php-master/src/DataType/EthDataType.php(112): Ethereum\DataType\EthQ->validate('0x0000000000000...', Array)
#2 /home/.../public_html/test/ethereum-php-master/src/DataType/EthD.php(138): Ethereum\DataType\EthDataType->setValue('0x0000000000000...', Array)
#3 /home/.../public_html/test/ethereum-php-master/src/DataType/EthQ.php(45): Ethereum\DataType\EthD->__construct('0x0000000000000...', Array)
#4 /home/.../public_html/test/ethereum-php-master/src/DataType/EthD.php(199): Ethereum\DataType\EthQ->__construct('0x0000000000000...', Array)
#5 /home/.../public_html/test/ethereum-php-master/src/SmartContract.php(92): Ethereum\DataType\EthD->convertByAbi('uint32')
#6 /home/.../public_html/test/ethereum-php-master/testcontract.php(63): Ethereum\SmartContract->__call('product', Array)
#7 {main}Unable to connect.

I have no idea how to receive outbound parameters. I think I should also use abi (the same as for sending parameters) for decoding this string of numbers but don't know how and if it is good path.

Thanks for any ideas,
Best regards,
TB


texts:
Lets say I have a private chain with 3 nodes (all mining) A, B and C.

I want to get the latest block of my chain. I connect to node A and get this information with getBlock("latest").

Lets imagine that node A mined the same block as B but did not sync. When it just finished mining, is the mined block already considered as the correct one by the node (without syncing with other nodes)?

Furthermore, if A and B synced and B's block is considered as the correct one, what happens to the block mined by A?

To finish, in a more general way, is it possible to have two different blocks considered as valid blocks on two different nodes at the very same time, or does a block, to be considered as valid by a node (including the one which mined this block), need to synchronize sucessfully with other nodes?


texts: How to use private key to encrypt message

texts:
I try to develop a storing image file dapp with Parity these days.
And I asked a question about private key some days ago. And Someone said that each account has a private key in Ethereum so that I can use it to encrypt.

But today I try to find the API to encrypt with private key. But I just found encrypt with public key, like this web says:parity_encryptMessage

So how to use the private key of Ethereum? Are there any APIs or something else that I can use to encrypt message? Thanks a lot~


texts: ERC20 Token paying ERC20 token -- this is not Inception

texts:
I'd like to know if the following can be implemented on the Ethereum platform:

I need users to be able to send a USD stable coin, eg TUSD, or DIA (which is an ERC20 token) to a smart contract address. This will keep some TUSD and send on some of the TUSD to another account; and it will record a holding and issue a token XXXX back to the sending account. Holders of the XXXX token will be able to call the smart contract and obtain TUSD (according to what they are owned, as stored in the SC).

I have seen SCs that pay dividends to token holders in Ether, but I need this to pay the token holders in an ERC20 token (TUSD, or DIA).

Is it possible?


texts: web3.eth.Contract send() throws error invalid sender code -32000

texts:
I'm trying to invoke ERC20's contracts transfer function but I keep getting "invalid sender" error. I checked that the from address matches the local private key I imported into HDWalletProvider. I have checked chainId is also correct. Token transfer also also works fine in Metamask for the from account. Is there additional logging I could enable in web3 to troubleshoot this?
let contract = new web3.eth.Contract(MY_TOKEN_ABI, MY_TOKEN_CONTRACT_ADDRESS)
let result = await contract.methods.transfer(to, web3.utils.toWei(amount)).send({ from: from })


texts: "out of gas" when trying to send back ETH from a contract to tx.origin

texts:
(UPDATED)
The contract should have more than enough ETH. I deploy the contract with 0.1 ETH: https://git.io/JUBdy
const consumerExample = await ConsumerExampleFactory.deploy(process.env.REGISTRATION_GATEWAY_ADDRESS, { value: ethers.utils.parseEther("0.1") });
The contract then sends a transaction with a value of 100 wei to another contract: https://git.io/JUBd9
constructor(address simplorRegistrationGatewayAddress) SimplorConsumer(simplorRegistrationGatewayAddress) payable {
    registerSimplorEvent("RequestEthPriceEvent");
}

and
function registerSimplorEvent(string memory eventName) public payable {
  _registrationGateway.registerEvent{ value: 100 }(
    eventName,
    address(this)
  );
}

Then an event is triggered (https://git.io/JUBd7) to which a node responds (https://git.io/JUBd5) to fulfillInt (https://git.io/JUBdF) which then (in the SimplorFulfill modifier) is supposed to send 100 wei back to the node's address (https://git.io/JUBdN).
Calling the method that triggers the event:
const ethPrice = await consumerExample.requestEthPrice()

A node listening for it and sending back data:
consumers[callbackContractAddress].methods[fulfillTypeMethod](fulfillCallback, response.value, requestId, response.requestPrice).send({
  from: process.env.NODE_ACCOUNT
}).then(tx => { ...

(fulfillTypeMethod = "fulfilInt", response.requestPrice = 100)
The receiving function:
function fulfillInt(
  bytes4 fulfillCallback,
  uint256 value,
  uint256 requestId,
  uint256 requestPrice
) external onlySimplOracle SimplorFulfill(requestId, requestPrice) {...

and finally in it's second modfier:
modifier SimplorFulfill(uint256 requestId, uint256 requestPrice) {
  // check/increase confirmations
  require(_simplorCurrentResponses[requestId] < _simplorRequiredResponses[requestId], "Request already confirmed.");
  require(address(this).balance > requestPrice, "Consumer does not have enough ETH to pay for the fulfillment.");
  _simplorCurrentResponses[requestId]++;
  // transfer 100 wei (TODO: calculate/set fees)
  payable(tx.origin).transfer(requestPrice); // This seems to cause the "out ouf gas" error.

  _;
}

UPDATE I added the second require(...) to check if the consumer has anough ETH.
Causes: Returned error: VM Exception while processing transaction: out of gas
Remember the contract was deployed with 0.1 ETH and already managed to send 100 Wei to the _registrationGateway when calling registerSimplorEvent in its constructor.
The requestPrice comes from another package (https://git.io/JUBb9):
return {
  value: result.data.ethereum.usd * 100,
  type: 'int', // currently supported: 'bool', 'int' and 'string'
  requestPrice: 100 // Wei
}

Here is my repository with the full code: https://github.com/mktcode/simplor/blob/master/contracts/SimplorConsumer.sol#L81


texts: Still Unable to Unlock Personal Account in Geth - Syntax Errors, GoError

texts:
In my MacBook Terminal -> Geth,
I have successfully created my new -> personal.newAccount(0xA93d5aC3B28587DA16E4821F571ACF44B6B28176)  along with its given generated password.
I’m still unable to “Unlock Account” as I keep getting errors though I have tried the following commands along with their errors shown:

geth --unlock ‘0xA93d5aC3B28587DA16E4821F571ACF44B6B28176’ --password ‘0x9169b03a06ba19b44f4237772e5a8dd0f1124094’
SyntaxError: (anonymous): Line 1:8 Unexpected identifier (and 1 more errors)

personal.unlockAccount(eth.accounts[0], 0xA93d5aC3B28587DA16E4821F571ACF44B6B28176)
GoError: password must be a string
at native
at :1:41(7)

personal.unlockAccount(eth.accounts[0], 0xA93d5aC3B28587DA16E4821F571ACF44B6B28176, 0x9169b03a06ba19b44f4237772e5a8dd0f1124094)
GoError: password must be a string
at native
at :1:85(8)

web3.eth.personal.unlockAccount(eth.accounts[0], “0xA93d5aC3B28587DA16E4821F571ACF44B6B28176”)
SyntaxError: (anonymous): Line 1:50 Unexpected token ILLEGAL (and 3 more errors)

web3.eth.personal.unlockAccount(0xA93d5aC3B28587DA16E4821F571ACF44B6B28176, 0x9169b03a06ba19b44f4237772e5a8dd0f1124094, 600)
TypeError: Cannot read property 'unlockAccount' of undefined
at :1:1(4)

web3.eth.personal.unlockAccount(‘0xA93d5aC3B28587DA16E4821F571ACF44B6B28176’, ‘0x9169b03a06ba19b44f4237772e5a8dd0f1124094’, 600)
SyntaxError: (anonymous): Line 1:33 Unexpected token ILLEGAL (and 5 more errors)

web3.eth.personal.unlockAccount(eth.accounts[0], 0xA93d5aC3B28587DA16E4821F571ACF44B6B28176, "0x9169b03a06ba19b44f4237772e5a8dd0f1124094")web3.eth.personal.unlockAccount(eth.accounts[0], 0xA93d5aC3B28587DA16E4821F571ACF44B6B28176, "0x9169b03a06ba19b44f4237772e5a8dd0f1124094")
SyntaxError: (anonymous): Line 1:139 Unexpected identifier (and 1 more errors)

I need help in this.
Thanks.


texts:
I was asked to "timestamp" document in a "trusted way". I first begin by RFC 3161 and TSA, then I meet blockchains.

I would like to test my undestranding.

Let's say I deploy the following contract:

pragma solidity ^0.4.0;

contract SimpleTimeStamp {
    uint lastHash;

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

I will get, in return, a contract addrees.

Then for a doc, "all" I have to do is:

calculate the sha 256
convert it to an uint
call the set function of the contract
get a transaction hash in return
store this transaction hash in relation with the doc.

If I want the date I "only" have to use a chain broswer to seek the transaction by his hash and I will get:

the transaction date
the unint associated <=> the file sha 256

Am I correct ?


texts: I've seen these notions in ICO articles and didn't find an answer on the internet. What are and why we use this(locking, unlocking) mechanism?


texts: compile_files gives errror for given path of the contract

texts:
pragma solidity ^0.5.1;

import "./Owned.sol";

contract Greeter is Owned {
    bytes32 public greeting;

    event GreetingChange (
        address indexed changer,
        bytes32 indexed _from,
        bytes32 indexed _to
    );

    constructor() public {
        greeting = 'Hello';
    }

    function setGreeting(bytes32 _greeting) public onlyBy (owner) {
        emit GreetingChange(msg.sender, greeting, _greeting);
        greeting = _greeting;
    }

    function greet() view public returns (bytes32) {
        return greeting;
    }
}

here i am importing a contract and when i compile it using py-solc-x compile_files , it gives me error.

greeter_interface.compile_source_files()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "D:\blockchain\bpoc\smartContract\interface.py", line 25, in compile_source_files
    self.all_compiled_contracts = compile_files(deployment_list)
  File "D:\blockchain\venv\lib\site-packages\solcx\main.py", line 137, in compile_files
    contracts = _parse_compiler_output(stdoutdata)
  File "D:\blockchain\venv\lib\site-packages\solcx\main.py", line 73, in _parse_compiler_output
    data['ast'] = sources[source.split(':')[0]]['AST']
KeyError: 'D'

Owned.sol 's  file apth is  'D:\\blockchain\\bpoc\\static\\contracts\\Owened.sol'

how can i solve this?


texts: How to unit test when a function depends on hardcoded deployed contract address?

texts:
I've been writing unit tests for a contract using Hardhat + Ethers + Typescript, let's call it ContractA. This ContractA has a hardcoded address of a deployed ERC20 token in it like this TokenA = '0x...'.
So in the tests I do:
ContractA = await ethers.getContractFactory("ContractA");
contractA = await upgrades.deployProxy(ContractA);

and then I proceed to test some functions, which work normally.
But when I try to test a particular function in ContractA that uses the hardcoded ERC20 address like this:
function buyExtra(address Owner, uint256 count) public whenNotPaused {
...
IERC20Upgradeable(TokenA).safeTransferFrom(msg.sender, address(this), count);
...
}

it doesn't work, and I received the error
Error: VM Exception while processing transaction: revert Address: call to non-contract.
PS: I think I understand the reason, that is because the hardcoded address given in ContractA is the address of the ERC20 token in Rinkeby. As such, it does not exist in the test environment.
So what should I do? Is it possible to deploy the ERC20 contract in the test environment with the exact the same address it has in Rinkeby? Is this what I need to do? Btw, I don't have the ERC20 contract in my project.


texts: How can you get the price of token on Uniswap using solidity?

texts: I'm trying to create a function that takes a token address as the parameter and returns the price of the token.  I saw another post that mentioned the Uniswap SDK, but that used javascript.  I'm wondering is there anyway to get the token price using solidity?


texts: Encoding multidimensional arrays in raw transaction data

texts:
Say, there is a function in a contract:

function foo(uint[2][2][2] numbers) {}

How the following array should be encoded in raw transaction data?

[
    [
        [ 1, 2 ],
        [ 3, 4 ]
    ],
    [
        [ 5, 6 ],
        [ 7, 8 ]
    ]
]

What if array is incomplete?

[
    [
        [ 1, 2 ]
    ],
    [
        [ 5 ],
        [ 7, 8 ]
    ]
]

Also, is there a plan to support dynamically-sized multidimensional arrays (e.g. uint[][][], string[][]) in function arguments / return values?


texts: How are Tether ( which is using ERC20 token standard) connected to Ethereum?

texts: I know tether is built using ERC20 Token standard and tether use the infrastructure of ethereum to operate, so there could be network congestion in ethereum when usage of tether spike. Other than that , how is tether connected to ethereum ecosystem? How is Tether working with ethereum besides using ERC20 standard?


texts: I read an article recently about a blueberry producer in Chile selling his blueberries to a large wholesaler in Scotland. The transaction (for 4 million USD) went through Wells Fargo. Wells Fargo delayed the transaction because a bank employee decided selling blueberries was not legitimate. Lots of time and money was wasted by the blueberry seller. Could the use of Ethereum instead of US bank routing prevent this kind of problem? I know you all are probably busy with other things but being new to crypto, could someone please explain exactly how the two parties could use Ethereum to transact their sales contract instead of having to transact through a US bank? Thanks in advance.


texts:
I am new to Ethereum. Using pywallet, In my project, I had make ethereum wallet in local.
Infura API is used as a provider for me.

https://mainnet.infura.io/MYTOKEN

So I get balance of address generated by my wallet using web3.py.
And I want to send ether to some recipient(address).
But I can't make transaction and can't find docs about that.
Help me.

EDITED ADD QUESTIONS
What is the default gasprice? How to determine gasprice and gas amount?
Thanks.


texts: Possibility to authorize access to a web resource based on possession of NFT?

texts:
Would it be feasible to contract access to a web resource based on whether the Metamask wallet connected to the web client owns an NFT of a certain kind?
For example, I have a video hosted somewhere, password-protected, and I can call an API on my video host to create a password for the video on the fly. And I would like to use that to control access to that video based on whether the wallet accessing the page owns an ERC721 token of a certain kind.
I was thinking of something like:

client sends wallet address to server
server checks ownership of token
if wallet owns token, server generates a session-specific password with a given expiration and sets it in a cookie or something like that to initiate a session
client can use that password to load the video
next time he comes back, we check the cookie, and if the cookie expired we restart the process, otherwise direct access

Is that possible? Is there an easier way to implement something like a Pay-per-view system like that? Are there attack vectors I'm not seeing?


texts:
I have tested with eth.getStorageAt() and it shows what I think is 32 bytes of storage. But what is the point of this function? Are we meant to see unused space with it?

This is what I have:

> con
{
  abi: [{
  constant: true,
  inputs: [],
  name: "studentAge",
  outputs: [{...}],
  payable: false,
  stateMutability: "view",
  type: "function"
  }, {
  constant: false,
  inputs: [{...}],
  name: "setAge",
  outputs: [],
  payable: false,
  stateMutability: "nonpayable",
  type: "function"
  }, {
  anonymous: false,
  inputs: [{...}],
  name: "changedAge",
  type: "event"
 }],
 address: "0xa6b4017e8437ace3301f9751735e84836cfc0b21",
 transactionHash: null,
 allEvents: function(),
 changedAge: function(),
 setAge: function(),
 studentAge: function()
}
> eth.getStorageAt(con.address,0)
"0x000000000000000000000000000000000000000000000000000000000000002d"
> eth.getStorageAt(con.address,1)
"0x0000000000000000000000000000000000000000000000000000000000000000"
>

Code:

pragma solidity ^0.4.18;
contract CollegeAdmin {
uint public studentAge=18;
event changedAge(uint age);
function setAge(uint age) public {
studentAge = age;
changedAge(age);
}
}


texts: What does web3.eth.Contract.transactionconfirmationblocks mean?

texts: The definition of web3.eth.Contract.transactionconfirmationblocks is here. But I don't quite understand the meaning. The default value is 24, does it mean a transaction will not be confirmed (i.e. the Promise returned by sendTransaction() is resolved) until 24 more blocks are mined after the transaction are mined?


texts: Following web3.js docs raises TypeError: .once is not a function

texts:
I deployed  a contract which has a function recordData(bizname, id) function.  I have a expressjs api layer. I want to make sure that when the function is called from this api layer using web3 the transaction is completed

contract.recordData('abc', 123, {from: '0x123...'})
.once('transactionHash', function(hash){ ... })
.once('receipt', function(receipt){ ... })
.on('confirmation', function(confNumber, receipt){ ... })
.on('error', function(error){ ... })
.then(function(receipt){
    // will be fired once the receipt its mined
});

when i run this i get TypeError: .once is not a function.