texts: getting started with geth and ENS commands: Error: invalid address

texts:
I'm starting from square zero, sorry. I'm just trying to get a javascript console up and running so that I can learn more about ENS:

http://docs.ens.domains/en/latest/userguide.html#resolving

I've spun up an Ubuntu 16.04.2 VM and installed geth, so in one window I just fire it up.

Then in another window I'm just trying to preload ensutils.js so I can resolve a few ENS names.

I try this:

$ geth --preload "/home/phb/ens/ensutils.js" attach

and this happens:

Fatal: Failed to start the JavaScript console: /home/phb/ens/ensutils.js: Error: invalid address
at web3.js:3879:15
at web3.js:3683:22
at web3.js:4948:28
at map (<native code>)
at web3.js:4947:12
at web3.js:4973:18
at web3.js:4998:23
at web3.js:4026:22
at apply (<native code>)
at web3.js:4151:12

Now I have no idea what to do with that. I'm hoping to get to the point where I have a geth console and I can try things like:

ens.resolver(namehash('somename.eth'));

If I can just get the extremly newbie basics of how to get that far I, it'll help. Thx in advance.


texts: Error: Returned error: The execution failed due to an exception. @ web3.eth.estimateGas

texts:
I am having problem using bignumber.js with web3:

const sender = '0xss';
const recipient = '0xxx';
const amount = 1000; // have to use Bignumber for more than 1000
const decimals = 18;
const amountHex = web3.utils.toHex(new BigNumber(`${amount}e+${decimals}`));
const count = await web3.eth.getTransactionCount(sender);
const data = contract.methods.transfer(recipient, amountHex).encodeABI();
const estimateGas = await web3.eth.estimateGas({
    from: sender,
    nonce: '0x' + count.toString(16),
    to: '0xff',
    data
});

I get error at estimateGas :

Error: Returned error: The execution failed due to an exception.


texts: How are the network shards allotted to miners?

texts:
Are they allotted randomly?

And, is there an upper limit for the number of shards for a particular miner?

Generally, it is 2-3, but is there a defined upper bound? And what is the process/process in which the network is sharded?


texts: Why is my MetaMask's account address same for both Kovan and Main network?

texts: Aren't they created randomly and separately on each network?


texts: How to deploy contract with local private key?

texts:
I am trying to deploy my contract onto the blockchain in my private network with local private key (no wallet: I used web3.auto.w3.account.create()).
I know how to send normal transaction with local private key. But deploying contract is not easy for me. I am using web3.py

>>> from web3.auto import w3
>>> account = w3.eth.account.create()
>>> account.address
'0x653E3CE959a236278cF110E7C63052cDf94DB03B'
>>> account.privateKey
HexBytes('0x2aa62ebc701c8f075dc3755a85ddc5309025494288c408bc8e66fd095c393f91')

I get address and private key. so what I want to do is ...

web3 = Web3(Web3.HTTPProvider("http://127.0.0.1:8555"))

contract_src = open('Funding.sol').read()
contract_bin = compile_source(contract_src)
contract_interface = contract_bin['<stdin>:Funding']

transaction = {
    'from': <public address which I got>,
    'gas': 100000,
    'gasPrice': 0,
    'nonce': 0,
    ...
}
signed = w3.eth.account.signTransaction(transaction, <private key which I got>)
web3.eth.sendRawTransaction(signed.rawTransaction)

In transaction, what information should I put in ??

My contract looks like below:

contract Information {
    String str;

    function modify(String s) public {
        str = s;
    }
}

contract Bag {
    mapping(uint256 => Bag) contents;
    uint256 public i = 0;

    function create() public {
        contents[i++] = new Information();
    }
}


texts: Transfer data using solidity transfer function

texts:
Can we use transfer function in solidity to transfer the data?
My code _dest.transfer(txn.value)(txn.data);
and it is showing the error that this type is not callable.


texts: Can a .eth domain from ENS be used for a website?

texts: I recently registered a .eth domain through the Ethereum Name Service. Is it possible to use this domain for a website? Or is it just an alias for an ethereum address (and other metadata)?


texts: Private Ethereum Blockchain and Parity w/ Proof-of-Authority

texts: Can someone point me in the right direction.  I want to set up a private Ethereum network using Parity w/ Proof-of-Authority to avoid mining.  I've found an example with Geth, but can't find a good example with Parity.


texts: Contract state and variable changes in pending transactions

texts:
I have a simple contract:

pragma solidity ^0.4.0;
contract Festival {

    address owner;
    uint8 max;
    address[] entered;

    function Festival(uint8 _max) {
        max = _max;
        owner = msg.sender;
    }

    function joinFestival()
    {
        if(entered.length < max)
            entered.push(msg.sender);
    }

}

For example we set max=3.
So let's say we call this function from some web page using web3.js

Festival.deployed().then(function(fest){
  return fest.joinFestival({from:web3.eth.accounts[0], gas: 100000});
});

Okay, great. When first guy calls the function we get something like that:

if(entered.length < max) // yes, length == 0, success, we can join!
   entered.push(msg.sender) //joined

After a while, when the transaction has been confirmed, second guy call the function:

if(entered.length < max) // yes, length == 1, success, we can join!
   entered.push(msg.sender) //joined

And now the interesting part. 3rd and 4th guys are trying to join at the same time.

3rd guy:

if(entered.length < max) // yes, length == 2, success, we can join!
   entered.push(msg.sender) //joined

And now his transaction is pending. At the moment the 4th guy is calling this function the 3rd guy transaction is still pending:

 if(entered.length < max) // yes, length == 2, success, we can join!
    entered.push(msg.sender) //joined

And so, the problem is in the last call. The thing is that this guy will get TX error and all gas will be spend. Since gas=ether, it is a very bad situation.
My question is: how can we prevent this situation? I have only one way in my mind: check in web page .js file for pending blocks and if there is a transaction sent to our contract and the state of a contract is 'entered.length == 2' just throw an error to the 4th guy. If you have any suggestions it would be great. Thank you.


texts:
Do you know the current status of ABIEncoderV2?
I want to know the current status of ABIEncoderV2

Live projects using ABIEncoderV2 right now
Restriction on the normal encoder
Risks of using ABIEncoderV2

As far as I know, ABIEncoderV2 still needs 'experimental' and that means officially not yet ready to the production level.

I know 0x is using
https://github.com/0xProject/0x-monorepo/search?q=ABIEncoderV2%3B&unscoped_q=ABIEncoderV2%3B

and we can't use arrays as arguments in function

Do you know anything else?


texts: Instant Transactions: Private vs Public Blockchain

texts:
I have been developing a smart contract with solidity. My question is related to the deployment of smart contracts. I have studied and followed answers in the following links:

Main Network vs Private Network: pro and cons

Private BlockChain - Cons?

Private blockchain for production?

But I am still confused about the time it will take to reflect changes  real-time in common use cases. For example, in the case of transferring Ether from one wallet to another, it may take some time in minutes or hours depending on circumstances, like from one exchange to another, etc.

So if I create a contract for exchanging assets or tokens from one account to another, will it be reflected instantaneously on both accounts if the contract is deployed on the mainnet or will it take time for that to happen?

If I want transactions to be instant, should I use a private blockchain using Geth or the public mainnet blockchain?


texts: How to add contract to a Mist account without GUI?

texts: I'm new to Ethereum. I've followed a tutorial to deploy my contract by using web3.js and solc, then I got the abi and contract address. I'm thinking how I can add the contract to my Mist account through the code or command instead of opening Mist GUI to add it manually? I'll appreciate any help with this situation.


texts: Solidity local validation call before sending state changing transaction

texts:
I have an use-case where the user should be able to change a contract's state only when the inputs pass a validation check. However the validations are expensive to perform and can be done locally because they depend only on the function parameters. Is it is possible to perform the validation with a contract call and then, if it passes, broadcast the state-changing transaction with a send transaction?

This is the example I have in mind:

contract A {

    uint8 stateVariable = 0;

    //constant callable function for expensive verification
    function constantVerifier(uint8 param) constant {
        //expensive verification
        require(param <= 5);
        //broadcast transaction to change state of this instance
        A(this).changeState();
    }

    //state changing function
    function changeState() {
        //only this contract allowed to change state
        require(msg.sender == address(this));
        //change state
        stateVariable++;
    }
}

This particular snippet doesn't change the state. Is it possible to achieve something like this in Solidity? In general, what is the design pattern to handle expensive checks before changing the state of contracts?


texts:
I am trying to use my account to deploy contracts. I used this to unlock my account :

$ web3.personal.unlockAccount(eth.accounts[0], "password")
$ web3.personal.unlockAccount(eth.accounts[0], "password", 1500000)

I have tried both of them and it still gives this error :

Running migration: 1_initial_migration.js
  Deploying Migrations...
  ... undefined
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: authentication needed: password or unlock
    at Object.InvalidResponse (/usr/lib/node_modules/truffle/build/cli.bundled.js:37295:16)
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:224765:36
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:66971:11
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:208348:9
    at XMLHttpRequest.request.onreadystatechange (/usr/lib/node_modules/truffle/build/cli.bundled.js:209773:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/usr/lib/node_modules/truffle/build/cli.bundled.js:67130:18)
    at XMLHttpRequest._setReadyState (/usr/lib/node_modules/truffle/build/cli.bundled.js:67420:12)
    at XMLHttpRequest._onHttpResponseEnd (/usr/lib/node_modules/truffle/build/cli.bundled.js:67575:12)
    at IncomingMessage.<anonymous> (/usr/lib/node_modules/truffle/build/cli.bundled.js:67535:24)
    at emitNone (events.js:110:20)

I dont understand why this error persists even after the account has been unlocked. I do have enough balance (even though thats not the error). I am deploying on a private node but I have performed enough mining to have created the initial DAG as well as have some safe blocks.


texts: How does a hard fork rollback transactions?

texts:
I'm new to ethereum. I am confused of how hard fork works in detail. I read many answers, like:
https://ethereum.stackexchange.com/a/6390
https://ethereum.stackexchange.com/a/6269

In the first link, the answer says, "It is similar to create a new blockchain with a new init point. We could create a hard fork in which we rollback all the DAOs transactions done by the hacker".
What does it mean by "a new init point"? How does "roll back" happens? Could anyone give me a detailed example? Many thanks!


texts: Solidity Encoding Function Call With A Reference Parameter

texts:
I'm deploying an external library. This library will have a function that modifies a state variable of the calling contract.
I am accessing this library through a proxy contract that stores state. So, I send an encoded function call in the payload of a transaction using Metamask to the proxy contract. The proxy contract processes the transaction through its fallback function which delegatecalls the encoded function call to the external library.
I've done some experimenting and I'm able to create successful transactions if I create simple test functions that use an elementary type (i.e. uint). I was able to send the two encoded function calls below. FYI, testfunction() returned a constant uint and testfunction2() returned the passed in argument. However, the decoded output in Remix doesn't display a value so I don't know if it fully worked. At least the transaction was successful.
// example = abi.encodeWithSignature('testfunction()');
0x7136e2a9
// example = abi.encodeWithSignature('testfunction2(uint256)',88);
0xf08628490000000000000000000000000000000000000000000000000000000000000058
When I try to encode and send in a function that references a storage variable, the transaction fails. So, I must not be encoding it correctly. Below is the struct and function definitions in the library.
    struct Data {
        uint x;
    }

    function setNumber (Data storage test1)
    public
    {
        test1.x = 10;
    }

Here are some a few different encodings that I've tried which have all caused the transaction to fail.
//example = abi.encodeWithSignature('setNumber((uint256))');
0xfe4f1f1b
FAILS
//example = abi.encodeWithSignature('setNumber()');
0x4154b243
FAILS
//example = abi.encodeWithSignature('setNumber(())');
0x979fd110
FAILS
So, my question is how do I encode a function call to a struct storage variable? (while using delegatecall that I suspect that this is immaterial)
I'd appreciate any advice. Cheers.


texts: How to do searching in Ethereum's Ledge? (SQL)

texts:
Recently, I have a question about searching function in blockchain. Blockchain is a distributed database and as a database, there should be some searching functions such as "Select", "Join". I am wondering if I have 10 contracts in my private blockchain, how can I search according to the attribute inside the contracts? Is that the only way to do it, is to have a registration contract.

Thank


texts: "truffle migrate" running all migrations everytime

texts:
I have a very weird behavior happening whenever I run "truffle migrate". Ideally, as per the documentation, it states:

  This will run all migrations located within your project's migrations directory. At their simplest, migrations are simply a set of managed deployment scripts. If your migrations were previously run successfully, truffle migrate will start execution from the last migration that ran, running only newly created migrations. If no new migrations exist, truffle migrate won't perform any action at all

But for me, on the contrary, it's running all migration every time i.e. starting from 1_initial_migration till the last migration file I have. I am using Ganache for local testing. Is it something related to the code setup or am I missing anything important that needs to be done for migration.

Output of running truffle migrate:

Using network 'development'.

Running migration: 1_initial_migration.js   Replacing Migrations...
...0xf698fa2021847daaef0cedfc008976fbcc499eafc6f9c1eac6cc011faca77593
Migrations: 0xecfcab0a285d3380e488a39b4bb21e777f8a4eac Saving
successful migration to network...   ...
0x64df98e7d3f1cf5dc7eaa5264011714bf49802d9fda56003e202434903c2581b
Saving artifacts... Running migration:
2_factory_name_registry_migration.js
Didn't deploy FactoryNameRegistry; using
0x345ca3e014aaf5dca488057592ee47305d9b3e10
...0x0f90f0c9086735cd74a83b30f597fa5363764eb8920d5ae0b47cb6b3267be627
Saving successful migration to network...   ...
0xf048fc893066a845ec584920ab57630b213db48a619e85fc12f8d3e966fb3525
...0x81a7a0b188eadb39e207bd22fb3598830d166beb6b3f3bc7852f73dd303af6ef
Saving artifacts...

Edit: this is happening without restarting Ganache, as I do understand restarting the server will cause this behaviour to happen naturally


texts:
I have a struct in a library:

// lib
struct Data {
    int256 count;
    mapping(address => int256) indices;
    mapping(int256 => address) items;
}

// Also append function in lib
function append(Data storage self, address addr)
internal
returns (bool) {
    if (addr == ZERO_ADDRESS) {
        return false;
    }

    int256 index = self.indices[addr] - 1;
    if (index >= 0 && index < self.count) {
        return false;
    }

    self.count++;
    self.indices[addr] = self.count;
    self.items[self.count] = addr;
    return true;
}

And then another contract that uses this library struct:

// Contract.sol
using LibMap for LibMap.Data;
mapping(address => LibMap.Data) public addresses;

And then in a function I push to it

addresses[msg.sender].append(addr);

From the front end with web3 I can do contract.addresses(msg.sender) where msg.sender is the address from earlier in the contract that was set and it will return a length/count of how many have been appended. But how would I rather read all the addresses that have been pushed instead of a length/count?

Would I need a function in the contract for this?


texts: Academic and historical interest, how was the name "Solidity" conceived by Gavin Wood. Every name has an interesting history, can't find much on Solidity though. It is based on ECMA script standard, very similar to javascript. But what is the inspiration behind the name "Solidity".


texts: Sent my ETH from Remitano to COSS but I cannot find my TXID on Etherscan. Why?

texts:
I already made an ETC transfer from Remitano to COSS.IO. However, when I try to track my provided TXID, there is nothing in Etherscan.

TXID: 0x67c8b0b91db42d3184ef24cf6c6497295a02f113f0b3e4dad20b79529a86bbd4


texts:
I've looked at the wiki in search of how the information about Ethash algorithm but I did not find the answer.

Where can I find detailed information about it or can someone explain it?


texts: Getting pending transactions even with nonce in sequence

texts:
I am running a private network with 5-9 seconds block time and no diff bomb.

I am submitting thousands of transactions using a single node. The submission is managed by a job queue, and it happens at 1 transaction at a time, more or less 2 per second.

Transactions are actually contract method calls. They all have the same from and to fields, whereas gas and gasPrice start from 4000000 and 20 Wei respectively and get incremented by 1 at each transaction (and then reset back to their default "once a while").

The problem is that after 10-15 successful transactions, the node stop sending them, even though the nonce(s) are perfectly in sequence. For example, this is my current situation:

> eth.getTransactionCount("<MY ADDRESS>")
87

> txpool.inspect.pending["<MY ADDRESS>"]
{
      87: "0x08f8f7ab6fe2684df11077e4dce55479e0e05033: 0 wei + 3000050 × 50000000050 gas",
      88: "0x08f8f7ab6fe2684df11077e4dce55479e0e05033: 0 wei + 3000051 × 50000000051 gas",
      89: "0x08f8f7ab6fe2684df11077e4dce55479e0e05033: 0 wei + 3000052 × 50000000052 gas",
      90: "0x08f8f7ab6fe2684df11077e4dce55479e0e05033: 0 wei + 3000053 × 50000000053 gas",
      91: "0x08f8f7ab6fe2684df11077e4dce55479e0e05033: 0 wei + 3000054 × 50000000054 gas",
      92: "0x08f8f7ab6fe2684df11077e4dce55479e0e05033: 0 wei + 3000055 × 50000000055 gas",
      93: "0x08f8f7ab6fe2684df11077e4dce55479e0e05033: 0 wei + 3000056 × 50000000056 gas",
      94: "0x08f8f7ab6fe2684df11077e4dce55479e0e05033: 0 wei + 3000057 × 50000000057 gas",
      95: "0x08f8f7ab6fe2684df11077e4dce55479e0e05033: 0 wei + 3000058 × 50000000058 gas",
      96: "0x08f8f7ab6fe2684df11077e4dce55479e0e05033: 0 wei + 3000059 × 50000000059 gas",
      97: "0x08f8f7ab6fe2684df11077e4dce55479e0e05033: 0 wei + 3000060 × 50000000060 gas",
      98: "0x08f8f7ab6fe2684df11077e4dce55479e0e05033: 0 wei + 3000061 × 50000000061 gas",
      99: "0x08f8f7ab6fe2684df11077e4dce55479e0e05033: 0 wei + 3000062 × 50000000062 gas"
...

As you see, everything is perfectly synchronized and in sequence, but those pending transactions are there since hours.. Any idea?

go-ethereum: v1.6.7

PS: a loop that re-send every pending tx is NOT an option


texts: How to Specify Gas Limit and Value in wei or gwei?

texts:
Dear Anyone Who Can Help Me,

This is my first time posting and asking for help, I'm in the midst of Deploying and Running the Transactions in Remix IDE (as per the picture).

I'm stuck at the Gas Limit (as I don't know how much to put)

The same goes for Value in wei or gwei.

As I did try to enter the Gas Limit and Values, I got this error message below:

"Gas estimation failed-
Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
gas required exceeds allowance (10000000) or always failing transaction"

Since on the left side, you can see my first deploy smart contract, what is your suggestion to put in Gas Limit and Value in wei or gwei?

Fyi, I'm running Injected Web3 via MetaMask.

The Code:

pragma solidity >=0.4.22 <0.6.0;

contract SWLCoin {
  // declare variables
  address owner;
  string name;
  string symbol;
  uint256 totalSWLCoins;
}

Please advice, many thanks.


texts:
I am developing a private ethereum-based DApp and writing an academic paper for a final year project. I'm trying to "blockchainify" an existing system that adopts a traditional client-server approach.

The goal of the study is to prove the feasibility of a blockchain solution as an alternative platform from that of a traditional web application. The goal is not about is to prove that blockchain is more effective or ineffective than the traditional approach. So this is more of an exploratory research.

Regardless of the usecase, and the application that I am trying to build. What are some measurable functional or performance metrics that I can use to possibly compare my DApp to the other one. Security for example is a descriptive parameter which is almost always associated with DApp, but effectiveness is a broad word, and I would want to provide some measurable metrics to evaluate whether a DApp is effective or not.

Assuming that every functionality is implemented and works exactly in the Dapp as is in the original application, what are some measurable performance metrics that can be used to evaluate effectiveness or ineffectiveness of a Decentralized App?

ps. if the question is too broad, and if it helps, I can provide specific context.


texts: How would one go by accepting btc investments for an erc20 ICO? I assume a script of some sort would be necessary, has anyone dealt with this feature previously?


texts: Been at this for 1/2 a day now. How do I know if I'm getting anywhere? It's all very much Greek to me. Any input would be greatly appreciated. Cheers


texts:
uint h =10;
p.transfer(10 ether)
p.transfer(h ether);

The second line is working but I need to send token dynamically as in line 3, but it is showing an error. How can I resolve it?.
I am using 0.7.6 compiler(remix).


texts: Is there a way to make geth only allow connections from specified nodes?

texts: I'm setting up a private network with 10 geth nodes for my organization's own use, however I don't want outside nodes to accidentally (or intentionally) connect to our geth nodes. The nodes are hosted on public servers so we can access them anywhere, is there some way so the geth nodes in our private net will only allow peer connections from each other and block connections from other nodes. Currently we use the static-nodes.json to make the 10 geth nodes to connect to each other, disabled discovery, however I'm not sure if that's enough to block unwanted outside nodes connection attempts? Thanks.


texts: Replication of Files across a Private IPFS Network

texts:
I want to create a private IPFS Network in which nodes should be able to add data and share the Hash with other nodes in the network so that they will be able to access the files and make them available for further nodes in the network. My question here is... Should I use pinning so that the files will stay longer in the network or use IPFS Cluster(Note: I still can't figure out the difference between IPFS Cluster and IPFS)?
Im actually trying to create an application like DTube but only for a particular set of nodes(A Private Network)???
Can I get some help?


texts: Geth Ethereum private network still shows connections with --nodiscover

texts:
I had reviewed this answer:

disabled private network is still discovering nodes

But did not see a resolution to my issue.

After typical setup of private network with genesis block init and then startup I see established connections in lsof that geth has made:

https://pastebin.com/9eyF2R8y

though admin.peers shows []

tcpdump on port 30303 shows requests going to outside nodes though no responses come back (only ">" seen not "<").

So what is nodiscover really doing as it seems to be discovering quite a bit?

Thanks,
Henry


texts: how to send back token after received some eth?

texts:
how to add this functionality into a token contract?
Function : whenever anyone sends any Ethereum to my contract address, any number more than 0 (even an amount like 0.000000001), I would like to send them back 1000 of my tokens, and send eth that can be contracted to a certain address?

Example contract like this : https://etherscan.io/address/0x55732acec59699e28bad93522684e0d241a64a35

thanks


texts: How are ethereum transaction prioritized ?

texts:
What will make a transaction more likely to win the following smart contract  ?

function win( address player, unit bet ) constant returns(bool) {
    if( now < gameStartTime) return false;
    if( endgame == true  ) return false;

    if( bet == theanswer )
    {
        endgame = true;
        return true;
    }
    else {
        return false;
    }
}

assuming that gas price is the same for all senders. and all transaction are sent at the same time.

Will a miner have better a chance if they sign their own transaction and send it ?

Will a sender have a better chance if they send transaction simultaneously from multiple nodes ?

Does it matter if the sender is running full vs light node ?


texts:
From what I under stands when the condition in require() is not met solidity performs revert operation. Right?

What I want to know is how can we handle this in web3. That is if i have a function in my contract, say getbalance, and I am calling this function from web3, and that it checks whether the caller is the owner of that contract.

contract myContract{
  .......
  function getbalance() public constant returns(address){
      require(msg.sender==owner);
       .....
  }
 }

what I am asking is if the require() function false, i.e. caller of the function is not the owner, what should I do in my web3 to handle it?


texts: once a contract is compiled and deployed to the blockchain, it stores the 'runtime bytecode' in the blockchain (as I understand). but to invoke the functions of a contract by an EOA, it requires ABI as an interface. Can anyone please tell me where exactly is the ABI definitions stored? is it also part of the runtime bytecode stored in blockchain?


texts: How to call a deployed contract function

texts: I deployed the smart contract into a test network. so if a new user is added to the test network and he wants to use my smart contract functions. How to call those functions by the new user in the test network


texts: Unpacking Open Zeppelin starter pack warnings and errors

texts:
When unpacking OZ starter pack I get a couple of 100 lines of red code (warnings) and then it ends with a bunch of errors (see below).

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sha3@1.2.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sha3@1.2.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I'm running

Truffle v5.1.13
Node v13.8.0

I have no idea what to make of these errors, so any kind of help is much appreciated.


texts: Solidity Contract and Library difference

texts:
I am learning to program Solidity and just playing around with it in remix.

I am creating compiling the following code in Solidity:

pragma solidity >=0.4.22 <0.6.0;
contract Ballot {
    function giveRightToVote() public {
        uint8 tempnumber = 0;
        tempnumber += 1;
    }
}

Just a simple contract with no state variables.

When I change the keyword contract to library as in:

pragma solidity >=0.4.22 <0.6.0;
library Ballot {
    function giveRightToVote() public {
        uint8 tempnumber = 0;
        tempnumber += 1;
    }
}

The bytecode generated is completely different.

As per the solidity documentation, I infer that a library is only a contract that promises not to make any state changes to the caller (due to being stateless itself), unless the caller explicitly provides it with storage pointers.

As per my understanding, the bytecode in both cases should be the same.

Why is there a difference?


texts: Creating ERC20 token: What determines price, PoW, Minting and changing code after deploying

texts:
I did a lot of research about this, but still don't understand some concepts around token price and proof-of-work.
First of all, imagine I've created a token, which is ERC20 or 223 standard smart contract, what is the best initial amount can I give it, and does it determines the price? is there any formula that can help me to understand, exactly what determines price or if it's in correlation with initial supply (and it is of course but how), how can I manage to predict approximately what will cost one my token in Euros for example?
Second, is ERC20/223 automatically PoW standard? Or I need to change something?
Third, can I modify the code after deploying on mainnet?
And for the last one, if total supply goes down and there is nothing left to mine, is minting the only solution?


texts: Does an underscore before an existing function name have a special meaning in solidity?

texts:
Within the uniswap v2 core contracts for a pair of coins, there is a mint() function. Within this mint function, there is an undeclared _mint() function. Does the underscore before the function name have some special meaning in solidity?
I have extracted the function below. I am having difficulty understanding what the _mint() function within the mint() function means and where it comes from if it is undeclared (as far as I can see)?
    // this low-level function should be called from a contract which performs important safety checks
    function mint(address to) external lock returns (uint liquidity) {
        (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
        uint balance0 = IERC20(token0).balanceOf(address(this));
        uint balance1 = IERC20(token1).balanceOf(address(this));
        uint amount0 = balance0.sub(_reserve0);
        uint amount1 = balance1.sub(_reserve1);

        bool feeOn = _mintFee(_reserve0, _reserve1);
        uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
        if (_totalSupply == 0) {
            liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
           _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
        } else {
            liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
        }
        require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED');
        _mint(to, liquidity);

        _update(balance0, balance1, _reserve0, _reserve1);
        if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
        emit Mint(msg.sender, amount0, amount1);
    }

Source: https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2Pair.sol#L121
Thanks in advance


texts: Running web3 from node.js powershell in none Administrator mode always shows an error

texts:
I am using Windows and installed web3js as general option "npm install web3@0.20.2 -g" using Windows powershell. I run powershell as administrator.

After installation i am able to get web3 object working Web3 = require('web3') only when i run cmd->node as administrator that is running by default from c:/windows/system32.

I want to be able to run code form VSCode terminal but i always getting an error:
Error: Cannot find module 'web3'

Can someone help with that? I guess it is an issue related to how installation of web3 was done.

Thank you.


texts: I input an string data as bytes32 type. Now i cannot return that string in readable form? any way to do that?


texts:
There is a website or something else that allow us to buy Ethereum with Paypal?

Thank you


texts:
I have two solidity files. Im trying to get access to one function that is in the second solidity file. I the first contract I import the file.

  import "./DateTime.sol";

How can now acced to one function of the imported file???

DateTime dateTime = new DateTime();
dateTime.getHour(1542798273);

My idea is to make what in Java it´s made like this.


texts: I am new in Linux Ubuntu and I want to install Parity UI to add an enode. For this, I need to install Parity on Ubuntu. Is there any commands for this? And where can I download its executable file?


texts: hexToNumberString not require in new web3 versions?

texts:
I have such code before

let profit = await contract.methods.calculateFundProfit().call()
   profit = web3.utils.hexToNumberString(profit._hex)

but after update web3 version, do I need do only this?

let profit = await contract.methods.calculateFundProfit().call()


texts: How to make "transaction data" come through as ASCII text?

texts:
When transfering ETH using Parity, I have the ability to add "transaction data".  Two questions:

1 - Where can I read this on a blockchain explorer (or with the web3 console)

2 - How can I make sure that this is read as ASCII text?


texts: How to compile and deploy smart contracts programmatically with Infura in NodeJs

texts:
I understand that i will need to be able to unlock my account in web3 to be able to deploy smart contracts. It's all good except i'm using Infura's hosted network instead which prevents me from interacting with accounts. I use keythereum and other methods to create user wallet generating the privatekey and public addresses.

My real questions are:

1. How can i compile my solidity contract code with solc(Nodejs package) and then "sign" it or deploy it to the Ethereum network?

2. Is there a method for me to pass in the privatekey and use that account to deploy the smart contract?


texts: How do Ethereum clients generate unique addresses?

texts: How do Ethereum clients, like Ethereum Wallet or Eth-Lightwallet, generate unique addresses that haven't been used before, and what is the likelihood that these addresses have been used?


texts: What is the collapse function, L, explained in Ethereum yellow paper?

texts:
I have learned the Ethereum yellow paper. In the 4th page of the paper, you can find the following statements:

The function, L_s of sigma is defined as p of a, and the function is used to provide a short identity. I wonder whether if L_s is a function which outputs some value (a hash) or a set of tuples of p(a) like in the picture?

What is the collapse function? And how do I understand the function L_s?


texts: What is the fastest way to export all internal transactions?

texts:
I know that the "internal transactions" are not included in the blockchain and can only be retrieved by replaying the transactions and listening to CALL, CALLCODE and other similar opcodes. Both Parity and Geth provide means to do that.

However I am having trouble performing a full sync of Geth / Parity. Geth took over a month to sync, uses ~800 GB and as of yesterday doesn't want to run anymore, failing with Fatal: Error starting protocol stack: missing block number for head header hash. I was not able to find a solution since resync is not really an option for me. On the other hand I have started syncing Parity about a week ago and the process, fast at first, slowed to a crawl at around block #2393000.

As far as I know I can't use warp / fast sync if I want to get internal transactions. Also, I can't use Infura because it doesn't offer appropriate JSON RPC interface. I could use Etherscan, but that seems like cheating - what is the point of having a decentralized system if you fetch your data from a central endpoint? I might have to use it if everything else fails though, but I would appreciate some pointers. I am sure I am not the only one attempting to do this.

TL;DR: what is the fastest way to synchronize nodes so I can fetch the internal transactions from them? Failing that, what are other options to get this data?


texts: Uniswap/Pancakeswap SWAP swapExactTokensForTokens / swapExactETHForTokens FAILED (Sniping Bot)

texts:
I'm a beginner and for the past few days I have tried to recreate this tutorial:
https://www.youtube.com/watch?v=a5at-FEyITQ
At first I tried to implement it on PancakeSwap, but got a Transaction Error, so after not finding a solution I returned to Uniswap.
I went on Uniswap (https://app.uniswap.org/#/swap), connected with my Metamask Account running on Ropsten test network and swapped some ETH for UNI... It worked. I looked At the Transaction and used WETH an UNI addresses bellow...
As before on Bscscan Testnet, now on Ropsten Etherscan I tried to execute function 14. swapExactTokensForTokens on UniswapV2Router (https://ropsten.etherscan.io/address/0x7a250d5630b4cf539739df2c5dacb4c659f2488d#writeContract) as shown in Image 1. As soon as I clicked write I saw on Metamask: "Transaction Error. Exception thrown in contract code.", Gas price (GWEI): 185 and amount + gass fee was only equal to gas fee. And result was as shown on Image 1, with Transaction Status: Status:
Fail with error 'TransferHelper: TRANSFER_FROM_FAILED' (https://ropsten.etherscan.io/tx/0x5a1caf70fa0ae3e7a74bd80f6fad1faeb5b0185426b27eb012176e15deb5931d).
Image 1:

I used the same input fields on function 10. swapExactETHForTokens and it SUCCEEDED!
So I decided to use this function in code as shown below:
const ethers = require('ethers');
const addresses = {
  WETH: '0xc778417e063141139fce010982780140aa0cd5ab',
  factory: '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f',
  router: '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
  recipient: '0x483A7239dB71fc99a630E6C71dB2508A4dE64508'
}
const mnemonic = 'MY_MNEMONIC_KEY';
const provider = new ethers.providers.WebSocketProvider('wss://ropsten.infura.io/ws/v3/INFRA_NUMBER');
const wallet = ethers.Wallet.fromMnemonic(mnemonic);
const account = wallet.connect(provider);

const router = new ethers.Contract(
  addresses.router,
  [
    'function getAmountsOut(uint amountIn, address[] memory path) public view returns (uint[] memory amounts)',
    'function swapExactTokensForTokens(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts)',
    'function swapExactETHForTokens(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts)'

  ],
  account
);

async function LOL(){
  const ethAmount = ethers.utils.parseEther("0.1");
  //const tx = await router.swapExactTokensForTokens(
    const tx = await router.swapExactETHForTokens(
    ethAmount,
    0,
    ['0xc778417e063141139fce010982780140aa0cd5ab', '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984'],
    addresses.recipient,
    Date.now() + 1000 * 60 * 10, //10 minutes,
    {
        'gasLimit': 300000,
        'gasPrice': ethers.utils.parseUnits('185', 'gwei'),
    }
  );
  console.log("https://ropsten.etherscan.io/tx/" + tx.hash);
  const receipt = await tx.wait();
  console.log('Transaction receipt');
  console.log(receipt);
}
LOL();

The result was a FAILURE as seen below:
https://ropsten.etherscan.io/tx/0xa18d2df70f04366a7ed74144d91669c37b3be02a0a57ad3a8e81c2da82806ef9
Any help/input would be much appreciated, as I have been stuck on this for a while now...


texts: What is the first ever ERC20 token creation transaction?

texts: Do you know the first ERC20 issuance transaction?


texts: i am trying to send ether to a list of addresses from backend

texts:
Below are few lines from the contract in which I am basically trying to send some ether to an array of addresses. Now, when can run this code in remix solidity by replacing "value" to "msg.value". But I am trying to achieve this from backend.

pragma solidity ^0.4.16;

contract init {
    address owner;
    address[] public userAddresses;
    function init() {
        owner = msg.sender;
    }

    function getaddresses(address rec) public {
        userAddresses.push(rec);
    }

    function seneth(uint value) public {
        for (uint i = 0; i < userAddresses.length; i++) {
            userAddresses[i].transfer(value);
        }
    }
}

Below is the code that I am trying

var txOptions = {
    nonce: web3.toHex(web3.eth.getTransactionCount(address)),
    gasLimit: web3.toHex(800000),
    gasPrice: web3.toHex(20000000000),
    to: contractAddress
}

var rawTx = txutils.functionTx(interface, 'seneth', [100000000000000], txOptions);
sendRaw(rawTx);

I am running the code in my console but I am getting the output below


texts: Mist wallet crashes when importing/dropping wallet file

texts:
After dropping the UTC--2017-06-07T19-18-29 file on a fresh Mist 0.8.10 install, Mist automatically closes.
Is this a known issue?


texts: The better way to integrate Ethereum payments into web application

texts:
I'm trying to find the best solution to integrate Ethereum-based payments into web application and I'm looking for advice from someone who already faced this task.

My case:
Online-gambling solution where users can deposit money on their account and make bets.
Requirements: Payments should be Ethereum-based i.e. users transfer ETHs and get some game money (tokens) or see their balance directly in ETHs.

Solutions I'm seeing and their issues:

1) User transfers ETH to the address of app owner and gets tokens(we add tokens to user in app database). This looks to me as not good solution because it's not easy to identify what user made the money transfer. To do this we should store user's addresses in app database and analyze transactions of address of app owner.

2) Create something similar to Token contract. In this case user will be able to transfer ETHs to some address and get tokens (stored in the blockchain).
Issue: identify the user - is again an not so easy (the same issue as described above).
I know it's possible to use MetaMask, in this case user identification isn't necessary, but in this case game logic must be placed in smart-contract. Using MetaMask and fully decentralized app aren't acceptable, it will be too expensive. Firstly, because the games are very dynamical with a lot of state changes (game in progress, money in game, etc), a lot of gas will be required.
Secondly, actions depends on state, so state changes must be available momentarily, it's not acceptable to wait while transaction will be mined.

3) Create new ethereum address for each registered user(save private keys in database). In this case some sync logic on app backend (ETH to internal currency[tokens in app database]) will be required.
For example, user transfers ETHs to created address then goes in app and clicks 'Sync' button, then app checks amount of ETHs on created for user address, transfers this ETHs to the address of app owner and adds tokens(internal currency) for this user in app database.

4) Create smart-contract for which users will be able to transfer ETHs with additional data(some unique identifier). In this case some complicated sync logic is required too.
Example: when user wants to get tokens(internal currency), app provides him contract address and generated unique identifier and saves this identifier in app database(one-to-many user/identifiers). User transfers ETHs to provided contract address and adds additional data(generated unique identifier), contract saves how much ETHs was transferred using this unique identifier, app backend uses this information to add tokens(internal currency) in app database[call of functions that doesn't change state are free].

As for me options 3 and 4 looks more acceptable, but I'm not sure my thoughts are correct, because I'm newest in blockchain development. Maybe there are better and more correct solutions.

a) Am I correctly understand described flows?
b) Are there any better or more correct solutions for my case?
c) What solution should I choose?


texts: Invalid JSON RPC response error for sendTransaction on Infura + Ropsten node + Truffle console

texts:
Calls work but transactions throw the error -

  Error: Invalid JSON RPC response: ""

I am using web3 v0.19.0 & Truffle v3.4.9. Deploying contract using truffle,
truffle migrate --network ropsten
which successfully provides api and contract address.

My web3 provider and ropsten network (infura node) are defined in truffle.js on top of react-auth-box project.

I open truffle console --network ropsten, and define web3 -

var Web3 = require('web3')
let web3 = new Web3()
web3.setProvider(new web3.providers.HttpProvider('https://ropsten.infura.io/my_access_token_here'))

There is no default account
web3.eth.defaultAccount (returns null)
web3.eth.accounts (returns [])

Set default account,
web3.eth.defaultAccount = '0xpersonalaccount'

Define contract instance,
let contract = web3.eth.contract(abi).at(address)

All good so far and Calls work -
contract.checkIdExists.call(1, {'from': account, 'to': address})
(Returns '0x0000000000')

contract.fetchDataById.call(1, {'from': account, 'to': address})
(Returns '0x')

1. Transactions fail -
contract.addRecord.sendTransaction(1, 'fjdnjsnkjnsd', '03:00:21 12-12-12', 'true', '', {'from': account, 'to': address})

  Error: Invalid JSON RPC response: ""
      at Object.InvalidResponse (/var/www/html/react-auth-box/node_modules/web3/lib/web3/errors.js:38:16)
      at HttpProvider.send (/var/www/html/react-auth-box/node_modules/web3/lib/web3/httpprovider.js:91:22)
      at RequestManager.send (/var/www/html/react-auth-box/node_modules/web3/lib/web3/requestmanager.js:58:32)
      at Eth.send [as sendTransaction] (/var/www/html/react-auth-box/node_modules/web3/lib/web3/method.js:145:58)
      at SolidityFunction.sendTransaction (/var/www/html/react-auth-box/node_modules/web3/lib/web3/function.js:167:26)
      at evalmachine.:1:20
      at ContextifyScript.Script.runInContext (vm.js:53:29)
      at Object.runInContext (vm.js:108:6)
      at TruffleInterpreter.interpret (/home/shivam/.npm-global/lib/node_modules/truffle/build/cli.bundled.js:213786:17)
      at bound (domain.js:301:14)

2. Makes me think I probably have to unlock account first (do I?)
web3.personal.unlockAccount(account, password)

  Error: Invalid JSON RPC response: ""
      at Object.InvalidResponse (/var/www/html/react-auth-box/node_modules/web3/lib/web3/errors.js:38:16)
      at HttpProvider.send (/var/www/html/react-auth-box/node_modules/web3/lib/web3/httpprovider.js:91:22)
      at RequestManager.send (/var/www/html/react-auth-box/node_modules/web3/lib/web3/requestmanager.js:58:32)
      at Personal.send [as unlockAccount] (/var/www/html/react-auth-box/node_modules/web3/lib/web3/method.js:145:58)
      at evalmachine.:1:15
      at ContextifyScript.Script.runInContext (vm.js:53:29)
      at Object.runInContext (vm.js:108:6)
      at TruffleInterpreter.interpret (/home/shivam/.npm-global/lib/node_modules/truffle/build/cli.bundled.js:213786:17)
      at bound (domain.js:301:14)
      at REPLServer.runBound [as eval] (domain.js:314:12)

Running pretty clueless by now. Any support will be appreciated. Thanks!


texts: How to handle a Solidity return value/event in JavaScript test?

texts:
I'm trying to create a basic ERC721 NFT, using OpenZeppelin contarct. I started with something similar to their example code:
//SPDX-License-Identifier: MIT
pragma solidity >=0.4.21 <0.7.0;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721Burnable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

contract Artist is ERC721, ERC721Burnable {
  using Counters for Counters.Counter;
  Counters.Counter private _tokenIds;

  constructor(string memory name, string memory symbol, string memory baseURI) public ERC721(name, symbol) {
    _setBaseURI(baseURI);
  }

  function createArtist(address artist, string memory profileURI) public returns (uint256) {
    _tokenIds.increment();
    uint256 newItemId = _tokenIds.current();
    _safeMint(artist, newItemId);
    _setTokenURI(newItemId, profileURI);

    return newItemId;
  }
}

My problem is, when I call createArtist in my test like this:
it('mints properly', async () => {
  instance.Transfer().on('data', data => console.log('data', data));
  const id = await instance.createArtist(accounts[0], 'myurl');
  console.log(id);
  assert(id > 0);
});

instead of getting an ID back, I get this:
{
  tx: '0xfca7bcbc2e860d1a7f63df808ae0b974a80801f3ebb745b213ac9622374492c3',
  receipt: {
    transactionHash: '0xfca7bcbc2e860d1a7f63df808ae0b974a80801f3ebb745b213ac9622374492c3',
    transactionIndex: 0,
    blockHash: '0x5532b7dbdb888e878890f73e1e346ba8ab71602dfa43f621a3ac9a9efc4e6f49',
    blockNumber: 39,
    from: '0x944274a88ac56b20fb1d1ec01d2c9410606d851f',
    to: '0x34d3941670f5580a97010aecb73110394ddc7fb2',
    gasUsed: 216872,
    cumulativeGasUsed: 216872,
    contractAddress: null,
    logs: [ [Object] ],
    status: true,
    logsBloom: '0x00000000000000000000000000000000000000000000000000000004000000000001000000000000000000080000000000000000000000000000000000040002000000000000000000002008000000000000000000040000000000000000000000000000020000000000000000000800000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000040000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000',
    rawLogs: [ [Object] ]
  },
  logs: [
    {
      logIndex: 0,
      transactionIndex: 0,
      transactionHash: '0xfca7bcbc2e860d1a7f63df808ae0b974a80801f3ebb745b213ac9622374492c3',
      blockHash: '0x5532b7dbdb888e878890f73e1e346ba8ab71602dfa43f621a3ac9a9efc4e6f49',
      blockNumber: 39,
      address: '0x34d3941670F5580a97010AEcB73110394dDc7fb2',
      type: 'mined',
      id: 'log_93167e1c',
      event: 'Transfer',
      args: [Result]
    }
  ]
}

I know _mint emits a Transfer event, but the event code I've added doesn't get triggered, and I still cannot get the ID back.
I'm not using Truffle, not ethers.js. I'm trying to handle the event/response in tests.
What am I doing wrong?


texts:
I wonder the capacity of smart contract
how many smart contracts are signed in a day or a month?
how many connections can access to one smart contract at the same time?
how many smart contracts are signed in parallel in a second?
I wonder network part, capacity, ability of process of smart contract overall
(whether PoW or PoS doesn't matter)


texts: Does the solC compiler work in the geth Javascript console anymore

texts:
does the solC compiler work in the javascript console anymore, and if it does how can I install it. I have tried using the compiler methods in the javascript console api however they do not work and seem to have been deprecated.

I know remix is the best choice to compile my contracts but I would like to use the console if at all possible


texts: Where Do I Find web3.min.js for Beta 55?

texts:
There is this issue on github (among several other duplicate complaints): https://github.com/ethereum/web3.js/issues/2623.

There is also this stack question: How can the web3 library be imported in a web application?. Unfortunately, this answer only provides how to inject beta 37 (which for whatever reason is also now version 1.2). Beta 37 doesn't work for what I am doing, I need Beta 55. How do I acquire this version in a minified form for browser injection?

Edit: Link to github for Beta 55 branch is dead. https://github.com/ethereum/web3.js/tree/v1.0.0-beta.55/dist


texts: What is Ethereum's inflationary model going to be after switching to Casper?

texts: Some time ago I read Vitalik Buterin's blog post about possible attitude to inflation and transaction fees. From it it followed that nothing was decided yet and there are various possibilities. Has a decision been taken and will block reward and/or transaction fee mechanism change with Serenity?


texts: NOOB to mining, getting strange results from ethminer

texts:
I have just started mining and using ethminer on my mac using the Blackmagic eGPU and I am getting the following output, which doesn't seem correct:-
 m 18:21:12          Speed 6445.46 Mh/s    gpu/0 6445.46  [A0+0:R0+0:F0] Time: 00:58
 i 18:21:13 stratum  Job: #bafa5552… eu1.ethermine.org [172.65.207.106:4444]
 i 18:21:14 stratum  Job: #d7efc5d5… eu1.ethermine.org [172.65.207.106:4444]
 i 18:21:14 stratum  Job: #5bfdd888… eu1.ethermine.org [172.65.207.106:4444]
 i 18:21:15 stratum  Job: #68297577… eu1.ethermine.org [172.65.207.106:4444]
 i 18:21:15 stratum  Job: #79cc44bc… eu1.ethermine.org [172.65.207.106:4444]
 m 18:21:17          Speed 6598.35 Mh/s    gpu/0 6598.35  [A0+0:R0+0:F0] Time: 00:59
 i 18:21:19 stratum  Job: #b9939336… eu1.ethermine.org [172.65.207.106:4444]
 i 18:21:22 stratum  Job: #d7971950… eu1.ethermine.org [172.65.207.106:4444]
 i 18:21:22 stratum  Job: #c78a33d1… eu1.ethermine.org [172.65.207.106:4444]
 m 18:21:22          Speed 6360.41 Mh/s    gpu/0 6360.41  [A0+0:R0+0:F0] Time: 00:59
 i 18:21:26 stratum  Job: #dc564b9d… eu1.ethermine.org [172.65.207.106:4444]
 i 18:21:26 stratum  Job: #d012f3d2… eu1.ethermine.org [172.65.207.106:4444]
 i 18:21:27 stratum  Job: #61a357c4… eu1.ethermine.org [172.65.207.106:4444]
 m 18:21:27          Speed 5958.92 Mh/s    gpu/0 5958.92  [A0+0:R0+0:F0] Time: 00:59

I am concerned that I am going to be running this expecting a good result but the numbers are wrong.
If I go to a service like https://www.cryptocompare.com/mining/calculator/eth and plug in my hash rate (~6100MH/s) it seems like the gain is too much, am I reading the number correctly?
I can also see it switch jobs constantly is this correct? Am I actually mining anything?


texts: Why would users care that non-money related dapps are built on Ethereum?

texts:
I'm new to Ethereum. The way I see it, the catch of Ethereum is that everything is decentralized so dapps are transparent and users can be sure of how their information is being used, that their money goes to the right places, and that certain conditions are met in order for a procedure (a.k.a. Smart Contracts) to proceed. Basically it's a completely transparent system that no one party owns so we can be sure that everything is peer to peer. Is this correct?

So lets say I build a Facebookthereum (Facebook on Ethereum). Why would anyone use that over Facebook itself? I don't believe users care enough about their privacy to ditch the mainstream applications. Ethereum feels like a hard sell that only focus on implementation details that users don't really care about. They just want pretty UX / UI, and a working app. Sure Facebook uses my demographic info to generate ads and stuff, but does it really bother me that much? Not really.

So how is Ethereum so revolutionary? I could see it used but only for a limited amount of things mostly related to money like how Augur does event betting. In the betting space, you want to make sure you get your money if you win, etc. But I don't see how it could replace all of the huge corporations or how any non-money related apps would make money.

Please enlighten me!!


texts: Can't connect client Mongo with server side

texts:
I'm creating a Meteor App using this boilerplate.

I'd like to insert some data into MongoDB from the client-side, and then use this data in html files.

However, the Meteor app does not seem to connect client Mongo (minimongo) with server-side (MongoDB). If I try a {CollectionObj}.insert command in  the client-side repository, the data does not get written to MongoDB. I checked the collection with meteor mongo command, but there is no new data.

So, I wrote the below code on the server-side. (Contracts collection is defined in a separate file.)

Meteor.methods({
  'insert_contracts': function(address, price, amount, exeday, premium, position, contract_address, abi){
     Contracts.insert({
       seller: address,
       price: price,
       amount: amount,
       exeday: exeday,
       premium: premium,
       position: position,
       contract_address: contract_address,
       abi: abi
     });
  }
});

And I wrote this on the client-side:

Meteor.call('insert_contracts', address, price, amount, exeday, premium, position, contract_address, abi);

So I have implemented an insert function, but I want to change it into a simple implementation using only client-side code.

I also have a problem with the find function.

On the server I have tried:

'find_contracts': function(){
  return Contracts.find({});
}

Then called it from client-side:

'click .btn-success': function(event) {
   var hoge = Meteor.call('find_contracts');

But hoge was stil undefined.

What am I doing wrong?


texts: Can we improve the performance of Geth server by setting maxpeers to 0?

texts:
I've lunched a Geth server in full node. I think the performance of machine for syncing is not acceptable and needs much more time to be synced fully.
I would like to know if I set maxpeers to a low amount like 0, can I improve the server performance? This is why I think maxpeers will be used as a number of light remote servers that can connect to my full node and retrieve some data from it, and if I say no light server is allowed to use my full node, I might have higher performance.
May you help me please?


texts: Why do I get big number occasionally wherever I call Smart Contract functions using web3js?

texts:
I have column named total balance, which has a type of uint and function named getBalance which return its balance and the corresponding functionality has been also declared in Web3js..They get called automatically on page load..
Now Whenever I refresh the page, I get

3963877391197344453575983046348115674221700746820753546331.534351508065746944

sometimes not always..What is the case behind these ?? is it network issue or some error in my code.

Solidity

mapping(address => uint) public balances;

modifier onlyRegistered(address _userAddress) {
    require(isUserExists(_userAddress), "User Doesn't exists");
        _;
    }
function getBalance() onlyRegistered(msg.sender) external view returns(uint) {
     return balances[msg.sender];
 }

Web3js

contract.getBalance((err, balance) => {
  if (balance) {
    // var newBal = balance.toLocaleString();
    var newBal = web3.utils.fromWei(balance.toFixed(), "ether");
    // var newBal = web3.utils.toDecimal(balance);
    $(".user_balance").text(newBal);
    console.log(newBal);
  }
});


texts: How to decoding transaction value from an input string? (a specific case)

texts:
I tried to decode an input string of an ethereum transaction, based on ERC20 ABI.

0xa9059cbb0000000000000000000000003f5ce5fbfe3e9af3971dd833d26ba9b5c936f0be0000000000000000000000000000000000000000000000080ed1c1dc26503758

I get the below string decoded. But I am unable to read the transfer value < BN: 80ed1c1dc26503758 >. How would I get back to actual number?

{ name: 'transfer',
  types: [ 'address', 'uint256' ],
  inputs:
   [ '3f5ce5fbfe3e9af3971dd833d26ba9b5c936f0be',
     < BN: 80ed1c1dc26503758 > ] }


texts: Is state read from the current or previous block for external function calls?

texts:
Given that a computer must execute in a sequence, I assume the VM is also doing so before deciding the final block state. Let's say my contract calls an external function from another contract that gives the state of a storage variable in that function. Assume the VM executes the instructions from that contract updating that variable first. Will my call to this external variable on the new block represent the old state it was in at the current block (soon to be previous block) or will it represent the state it is in at the very moment the new block is being created?

Ie: Whether this occurs through broadcast order, execution order etc is irrelevant, I'm only interested to know in what block the state is read.


texts: Bytes memory as a function parameter increase gas cost

texts:
I've a smartcontract compiled with pragma solidity ^0.4.0; version and one function receives a bytes parameters which contain a long string. In these version it doesnt need to set the parameters as "memory".

I've create a new contract with version pragma solidity >=0.4.25 <0.6.0; and i'm not able to create unless I mark the byte parameters as memory.

bytes memory dBlock

These have increase the gas cost for the transaction more them 3x. I've test with a bytes32 variable the gas cost is almost nothing.

However in these particular case I often receive a long string much longer than 32 chars. How I can pass a long string to a smartcontract and on same time save some gas in the transaction?


texts: EIP 155 - Replay Attack and Backwards Compatibility on ETC chain

texts:
I accidentally sent ETC to an address that previously only had ETH on it.  This was an address created after the DAO hardfork.  As far as I understand with EIP 155 I have replay protection from any transactions that I sign with this address on the ETH chain.  The address in question is an address that I was using frequently to sign transactions with.

However, at some point I am going to want to move the ETC on this address, and as far as I understand backwards compatibility with EIP 155 is that my ETH address won't be protected.  I send my ETC and the tx can be replayed on the ETH chain.

Questions:
(1) The replay attack can only be for the amount that was send on the original tx?  Or can it be for a larger amount if the the ETH address holds more Ether?

(2) Also what happens to tokens that are on my address?  Say the answer to question (1) is that a replay attack from an ETC transaction could drain my entire ETH address.  Before I send the ETC tx I send all my ETH to a different address.  Then my tokens are still on the ETH address.  When I then go and send an ETC tx could someone use that tx to move my tokens to a different ETH address?


texts: Event propagation from imported contracts

texts:
Im implementing a contract with imported subcontracts of my own. I'm trying to understand if I can receive the events emitted by the imported contracts, but since contracts can be inherit other ones or called all the information I'm searching for is a little bit fuzzed.

Are those events received in the main contract? Please be kind, I dont have much experience with the smart contract transactional model.

Thanks.


texts: I bought Tokens Using Metamask But I need MyEtherWallet to See Them - How Do I Do This?

texts:
Please can you help.

I bought tokens using Metamask and I am advised that the tokens can be seen in MyEtherWallet but I am not sure what to do next.

Do I need to set up a new MyEtherWallet account?
MyEtherWallet say I can access my account using "Mnemonic Phrase" from Metamask, what is this phrase as I don't remember setting such a phrase when installing Metamask?

Thank you in advance and best regards,


texts:
I'm developing ETH and ERC20 tokens deposit service.
for every user I need unique wallet address,

Can I develop a smart contract to generate unique wallet address for every user?
Can I transfer deposited ERC20 tokens from user wallets to another wallet and pay fee for transactions with smart contract main account?


texts: How to get all internal transactions from Etherscan?

texts: Just like we can crawl all external transactions in Etherscan, Is there a tool/method to collect all internal transactions from there ?


texts: What is the best way to imbricate structs of data?

texts:
I'm creating a DAPP and i'm currently drafting the structure of my code. I'm not really experienced with Solidity so i'm trying to have a clear representation of my code before starting to code it.
I need to have the following structure :

├── Client 1
│   ├── Year 2018
│   │   ├── Case 1
│   │   └── Case 2
│   └── Year 2017
│       └── Case 1
├── Client 2
│   └── Year 2018
│          ├──Case1
│          └──Case2

So the Client would be a contract, the Year would be simple struct and Cases would be complex structs.
So first of all , Is it correct to use this structure ? I saw a post about struct in struct but it seemed to generate error so I want to be sure that it won't cause me problems later before using it.

Thank you and have a good day/night.


texts: How to get the result by parsing the log after executing the contract? How can I get the execution result?

texts: How to get the result by parsing the log after executing the contract? How can I get the execution result ?


texts: I've read that eth.gasPrice isn't reliable, because sometimes it suggests gas prices too low. Is there some API or something similar where I can get the current gas price? This is for an automated script, so I can't check and update gas prices manually.


texts:
I have recently used the ABI generator fo remix, but when I copy the ABI and paste it in my Geth I get an error:

var abi=x; // where x is abi copied from remix ethereum website.

However, if I copy the content of "interface" from her (when I use the same smart contract code), and replace it with x above I don't get any error.

Question: Has anyone experienced the same problem?


texts:
Hi Guys

I have two contacts first one is SubToken and second one is MainContract.

First I deploy MainContract after that I use createNewContract function and I create  new SubToken.

and then

I deploy SubToken with a address which is come from create contract function in my MainContract.

I want to access my name and I make a few functions in SubToken contract for that but I see revert error :(

VM error: revert.
revert  The transaction has been reverted to the initial state.
Note: The called function should be payable if you send value and the value you send should be less than your current balance.  Debug the transaction to get more information.

I dont know what am I supposed to do. Anyone can help me please :)

Here's the a few ss of my code:

https://eksiup.com/p/aj79538kzmgp

https://eksiup.com/p/w779539wzqmc

https://eksiup.com/p/9t79541aevh6

pragma solidity ^0.5.0;
import 'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/SafeMath.sol';

contract SubToken{
    MainContract mc;

    constructor(address _address) public{
       mc=MainContract(_address);

    }

    function getName1() view public returns(string memory){
        return mc.getNameMain(address(this));
    }

    //function transferFrom(address from, address to, uint tokens) public returns (bool success);
    //function allowance(address tokenOwner, address spender) public view returns (uint remaining);
    //function transfer(address to, uint tokens) public returns (bool success) ;
    //function approve(address spender, uint tokens) public returns (bool success);
    //function transferFrom(address from, address to, uint tokens) public returns (bool success);

    event Transfer(address indexed from, address indexed to, uint tokens);
    event Approval(address indexed tokenOwner, address indexed spender, uint tokens);

}
contract MainContract {
    //mapping(address => mapping(address=>uint)) balances;

    //mapping(address => mapping(address => uint)) allowed;

    address[] public contracts;

    using SafeMath for uint;

    address contract_address;

    struct token{
        string  name;
        string   symbol;
        uint8  decimals;
        uint  totalSupply;
        uint balances;
    }
    mapping(address => token) public tokens;

    address mycontraddress;

    function createNewContract(string memory _name,string memory _symbol,uint8 _decimals,uint256 _totalSupply,uint _balance) public returns(address youraddress){
        SubToken st = new SubToken(address(this));//address(this)
        tokens[address(st)] = token(_name,_symbol,_decimals,_totalSupply,_balance);
        mycontraddress=address(st);
        return mycontraddress;
    }
    function seeContracttAddress() public view returns(address){
        return mycontraddress;
    }

    function getNameMain(address _address) public view returns(string memory){
        return tokens[_address].name;
    }

    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event Approval(address indexed _owner, address indexed _spender, uint256 _value);

}


texts: Could not find declaration module for file 'solc'

texts: I was trying with a simple contract,when I do  "node compile.js" in my windows cmd it throws an error.I was using vscode it showing error in const solc = require('solc'),I installed everything perfectly but I don't know why the error occurs.


texts: How can a database be connected to a blockchain 'record'?

texts:
If I have state stored in a contract for say dbkeys, and I want to use the keys to access some data stored in a normal off-chain database, is there an expert means of doing that?

I think we could simply access the dbkeys via a getter method which sends back the data as return to the calling method in the contract instance. But my question is really can we link at an architectural level the dbkey stored in state in a contract on the blockchain with the actual dbkey as used in an off-chain database?


texts: Differentiating Pre-ICO and ICO in contract

texts:
I am developing an ICO contract that has a presale and main crowdsale event and I'm really new to this having experience of building only basic ICOs. I wanted to know what the best way would be to differentiate between those two because the investors would have different authorities based on when they invested on tokens.

During my google search I landed to the link below.

Pre ico and ico crowdsale contracts

However, it was closed with no answer and I couldn't figure out what the best way to deal with it would be. Or How the contracts generally handle such events. Would it be by creating two different contracts or using different start and end times.

Thanks.


texts: What is the best language to start programming in Ethereum?

texts:
I have an introduction to C++ under my belt (very simple stuff), and other skills like an occasional R script, that's about it.

Where should I go from here?


texts: Verifying my initial constructor on Remix

texts:
I discovered Solidity two days ago but I couldn't imagine how difficult it would be to even get started. Most tutorials and documentation are outdated and google results are very sparse. I followed a tutorial from youtube by Reitweissner (which cut off half way) and I am trying to run this constructor from their code. What I would like to do at this time is display the address of the sender and of value. Is there some sort of console.log or similar that I can use? I have heard of Events but how would I display that event log in remix if that's the case?

pragma solidity ^0.4.0;

contract Purchase {
address seller;
uint value;

function Purchase() payable {
    seller = msg.sender;
    value = msg.value / 2;
    //Console.log(value); //expect value 4 since msg.value should be 8
    }
}


texts:
I have a smart contract deployed to mainnet. A user has executed a transaction that resulted in a revert failure. How can I debug this transaction to determine what exactly happened that resulted in this failure?

(I have the smart contract source code)


texts: How to decode SHA256 hash value and retrieve data in Solidity

texts:
I am working on a project in solidity where i am encode a string to SHA256 hash value, and now i want to decode SHA256 hash value and retrieve the actual data. please help hoe to do it.

Below is the code i using to hash a string.

pragma solidity ^0.4.26;

contract TestShaAlgo {
  function getSha256(string str) public view returns (bytes32) {
  bytes32 hash = sha256(abi.encodePacked(str));
  return hash;
  }
}


texts: How can I make a transaction go to a random address in Solidity?

texts:
I want to write a cryptocurrency that has a feature that sends tokens from the sender to a random receipient address that has made a transaction recently on the blockchain.
How would I start off doing something like this?

Basically in the following, I'd like balances[to] to be a random address, selected from adresses that have been involved recently in transactions

function Send(address to, uint tokens) public returns (bool success) {
         balances[msg.sender] = balances[msg.sender].sub(tokens);
         balances[to] = balances[to].add(tokens);
         Transfer(msg.sender, to, tokens);
         return true;
}

Thanks for the help!


texts: what kind of Hardware required for run geth private chain for ethereum on windows?

texts: i need to help to find out what were the minimum hardware requirements needed for deploy the private chain on ethereum.


texts: What kind of bytecode is it in etherscan.io?

texts:
I have read some contracts from etherscan.io, and here are something that I don't understand:

Why there are some contract addresses that do not have contract source code?

Here is an example:https://etherscan.io/address/0x1c8d404c27d9c1705d459f351e9b609dbc9f10f9#code
As for the contracts that have source code on the website, the bytecode is creation bytecode, here is an example:https://etherscan.io/address/0xc3f5d1d366e73c24374f49ca7ec732ec9a42ee10#code. But I noticed that like the above example https://etherscan.io/address/0x1c8d404c27d9c1705d459f351e9b609dbc9f10f9#code, the bytecode of contracts that don't have source code on etherscan.io is not creation bytecode, by comparing to the input data in https://etherscan.io/tx/0x892211402dfb11ea162b3d7d302a866a2d1d2dae5b7ed5bcf7ddabc541c6032a (This is the transaction that creates the contract above). So is this bytecode runtime bytecode?


texts: Float not allowed in solidity vs decimal places asked for token contract

texts: We know that solidity doesn't support the float values. But here (https://www.ethereum.org/token#understanding-the-code) they accept one input parameter 'decimal places' for calculation purpose. How this action has been executed when this token is created using the contract written using solidity?


texts: DeclarationError: Identifier already declared. Two imports import the same ERC721 contract

texts:
Im building a contract that uses two contracts that both use the ERC721 zeppelin contract, when I import the two as such:

import nonFungableWidthAddedFunctionality1.sol;
import nonFungableWidthAddedFunctionality2.sol;

I get the following error:

$PATH DeclarationError: Identifier already declared.
import "./../nonFungableWidthAddedFunctionality2.sol";
^--------------------------^
$PATH The previous declaration is here:
contract ERC721 {
^

Both of these contracts need the ERC721 implementation since they are also used separately.


texts: Why contract function multiply always returns 0

texts:
I have setup my private blockchain for testing. And created and deployed following contract:

pragma solidity 0.4.11;

contract Multiply7 {
   event Print(uint);
   function multiply(uint input) returns (uint) {
      Print(input * 7);
      return input * 7;
   }
}

Generated abi and code using solc:

6060604052341561000c57fe5b5b60df8061001b6000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063c6888fa114603a575bfe5b3415604157fe5b60556004808035906020019091905050606b565b6040518082815260200191505060405180910390f35b60007f24abdb5865df5079dcc5ac590ff6f01d5c16edbc5fab4e195d9febd1114503da600783026040518082815260200191505060405180910390a16007820290505b9190505600a165627a7a7230582089c25c3ddf32ed3ef55436bff071176b9b807c9cac456721766027c17261657e0029

ABI here:

[{"constant":false,"inputs":[{"name":"input","type":"uint256"}],"name":"multiply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"","type":"uint256"}],"name":"Print","type":"event"}]

Deployed contract and got transaction receipt:

eth.sendTransaction({from: eth.accounts[0], data: code})
contractAddress = eth.getTransactionReceipt('0x2d1483f05c0420284ccc4f1ad4003466cc6b51e119c1009d6edfd966a9ec399f').contractAddress
//0x84a56a919232516d2f928ed1b66423e974de4c8b

Now I am accessing this contract:

myContract = eth.contract(abi)
contract = myContract.at('0x84a56a919232516d2f928ed1b66423e974de4c8b')
contract.multiple.call(6) // always returns 0

When I paste code from example from here everything works just fine.

I am not understanding what is the problem with my approach. My solc code and abi are correct? Any help would be appreciated. Thank you.


texts: New Genoil Miner on Ubuntu - How Does this Start? I Only See Windows Instructions

texts: Entering any of this into terminal doesn't get it mining. I have NEVER figured out how to get Genoil mining (I'm on Ubuntu). Where is this information entered and how does the mining get started?


texts: How to verify crowdsale contract on etherscan

texts: I'm deployed a crowdsale contract how to verify my contract on etherscan.io


texts: Ethereum Merkle Patricia Trie and Hashes

texts:
In Ethereum, there's a hash of all of the 3 tries in each block.

Out of curiosity.

The docs state that the functionality is supposed to just provide a mapping between 160bit keys and values. I find this not clear.

If there's a hash for each trie, the hash depends on a particular order of data etc. So if we implement the trie as a Merkle-Patricia trie with 3 types of nodes then if each of these 3 node types contains a hash of itself (and in case of a Branch-node the hashes of all the nodes below then the hash IS implementation-dependant.

Would you shed some light?

Specific questions:

Which trie nodes contain a hash? In case of a leaf-node, it is clear. it contains a hash of the data it contains. In case of an extension node, it is the same. What about the branch node? does it contain a hash of all of its children located one level below?

Or do maybe the branch nodes just contain a hash of all the leaf nodes below. Even if so, the hash in the root of each of the 3 tries would depend on the order of leaves.

So even if we leave the implementation details omitted, all the implementations would need to come up with the very same hash for each of the 3 tries.

The entire question could be formulated as:

How exactly is the hash for each of the 3 tries computed?

For instance, from a cryptographic point of view, there would be no point for an extension node to contain a hash of itself or even to take such an abstract object under consideration when computing the higher-level (in the-trie) hash what would only matter in the end would be the data stored in the leaves below.


texts:
I need some help for a little Project.

The idea is that I have three Raspberry Pi devices. Each one is connected to an temperature sensor.

I want to create an autonomous system in which these objects can communicate through the Ethereum Network and send data to a fourth Raspberry.

I want do store the data Transaction in the Chain an the temperature too. So I will have the Chance to get the data in the Chain and on my Server Raspberry.

Is this possible?


texts: Ethereum 2.0 - how to avoid being penalised when moving to a new location - is it possible to move the validator to the cloud?

texts:
Of course, I can test on testnet and try for myself but maybe you'll know.
In the spirit of decentralisation, I would like to run my full node.
But things change, I may want to travel (change location) and I don't want to be penalized.
Is it possible to start with a physical validator node and then a few months down the line move it to the cloud location?

Launch stream: "but the simple thing is, do not run the validator keys on two different machines at the same time" - https://youtu.be/ciE75qkZXFw?t=2095


texts: Do ERC-20 ETH tokens gain value if minted tokens get more use?

texts:
So I am trying to understand ethereum better. If someone could help me by correcting me where I am wrong here.
As I understand ERC-20 is the ETH token. When you buy ETH on Binance or Uphold or wherver, you are buying ERC-20. Correct?
So then other tokens are minted like BAT or Enjin. What is the relation of these minted tokens to ERC-20? Other than ERC-20 just being the protocol? More speicifcally, if BAT or Enjin tokens gain value and popularity, does this somehow increase the value of the original ERC-20 token?
Also I understand minted tokens all run on the same Ethereum Network as ERC-20. So this means the Ethereum Network "miners" are also validating the transactions for minted tokens. If this is the case, do miners get a small payout of whatever token transaction they helped to validate? Or do the miners get some payout converted back to ERC-20? What I am trying to understand is, what is the monetary incentive for miners to validate minted token transaction? Like if I mint a new token right now, and that token is literally worth $0, why would miners start validating the transactions?


texts: library modifying string vs string literal

texts:
I have a library which has the following function:

function strConcat(
    string memory _a,
    string memory _b
)
    internal pure
    returns (string memory)

My contract implements the library and uses the following:

using StringConverter for *;
...
uint minLevel = getStorageUint(
    r,
    ("_conf_").strConcat(pSetting),
    pSettingIndex,
    0
);

This is working, but if I change:

using StringConverter for string;

I can see the error:

TypeError: Member "strConcat" not found or not visible after argument-dependent lookup in literal_string "_conf_".
        ("_conf_").strConcat(pSetting),

What can I type at using to make it working correctly?


texts: Cannot connect to ethereum Ropsten testnet node

texts:
I installed Ropsten (revival) testnet on an Ubuntu server, Then I start my testnet node:

geth --testnet

I can connect to my node via

geth attach ipc:/home/myusername/.ethereum/testnet/geth.ipc

and I get this info from my node instance:

> admin.nodeInfo
{
  enode: "enode://03aa54...0689be3@24.230.213.120:30303",
  id: "03aa54b894aec...a49d8490689be3",
  ip: "www.xxx.yyy.zzz",
  listenAddr: "[::]:30303",
  name: "Geth/v1.6.7-stable-ab5646c5/linux-amd64/go1.8.1",
  ports: {
    discovery: 30303,
    listener: 30303
  },
  protocols: {
    eth: {
      difficulty: 1621387497788667,
      genesis: "0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d",
      head: "0x84e8e85cdd7a5fa79d26b9fa89cd850be23b13d2079208e052eceb06c436654b",
      network: 3
    }
  }
}

But I cannot connect to the testnet node from my nodejs script:

Web3 = require("web3");
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:30303"));
console.log(web3.isConnected());

always return false !
Any advice ?


texts:
I am trying to test a smart contract which uses the Ethereum Alarm Clock . They have mentioned a contract address for the testnet. But that is old and it is not available for any of the new testnets. I am running my contract on ropsten network.

I saw a couple of solutions which suggested to deploy the contract from source separately and use that for development purpose. Also there were a lot of issues posted. Just wondering if there is a better workaround or any previously deployed Scheduler Contract on ropsten that I can use for development purpose.


texts: How is it possible to move ETH out of an Ethereum address as soon as it gets into it?

texts:
How is it possible to move ETH out of a non-contract Ethereum address as soon as ETH gets into it?

There is someone, who apparently gave out his private key and public Ethereum address, which has many tokens, one of which (ICX) is worth USD$280K.

So, this address has 0 ETH, but based on what I see, in order to move the ICX token out, the address needs to have a balance of at least 0.00024 ETH.

But then, from what I can see, as soon as ETH gets into this account address, it is immediately moved out, so anyone is prevented from moving the ICX token out, due to the account address not having sufficient ETH.

How is this (the near-instantaneous moving out of ETH from the account) achievable?


texts: Is it possible to create a Multisig wallet with only 1 owner confirmation?

texts:
I am asking this because of I am looking for a way in case something happens to me, someone else has full authorization.

Thanks.


texts: executing functions on a Smart Contract on ropsten via web3.py

texts:
I am trying to use web3.py to interact with a smart contract deployed on Ropsten. The Contract lives on the address 0xb80206789De27D14b3f458Bed9072d4a0129b41e and has two functions, one to save a string and one for an integer. I need to be able to use a python script to set the string and the integer on the contract and read from it. I have managed reading, but writing is where I find problems. the problem lies on how to build a transaction containing a new integer I want to set- (note: through remix.eethereum.org, the contract works and interacts fine)
solidity contract code:
pragma solidity ^0.6.2;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol";
contract dbim_basic is Ownable {
    string public IPFSHash = "I pretend to be a hash";
    uint public myUint;
    function setIPFSHash(string memory _IPFSHash) public  {
    IPFSHash = _IPFSHash;
    }
    function setMyUint(uint _myUint) public  {
        myUint = _myUint;
    }
}

the python code for the transaction is this:
contract_abi = "contract abi goes here"
contract_address = "0xb80206789De27D14b3f458Bed9072d4a0129b41e"

myContract = web3.eth.contract(address=contract_address, abi=contract_abi)

nonce = web3.eth.getTransactionCount(account)

tx = myContract.functions.setMyUint(8888).buildTransaction({
    'chainId' : 3,
    'gas' : 210000,
    'gasPrice' : web3.toWei('50', 'gwei'),
    'nonce' : nonce,
})

signed_tx = web3.eth.account.sign_transaction(tx, key)
result = web3.eth.sendRawTransaction(signed_tx.rawTransaction)
tx_receipt = web3.eth.getTransactionReceipt(result)

and web3.py reports back this error:
Warning: TransactionNotFound : Transaction with hash: 0xc5106c1438ad654c990cc749d5ce7b028413f3f97841ecbdcdcb2a98f4cb94b1 not found. ['  File "<string>", line 28, in <module>\n', '  File "C:\\Users\\arlav\\anaconda3\\envs\\dynamo383\\lib\\site-packages\\web3\\module.py", line 58, in caller\n    result = w3.manager.request_blocking(method_str, params, error_formatters)\n', '  File "C:\\Users\\arlav\\anaconda3\\envs\\dynamo383\\lib\\site-packages\\web3\\manager.py", line 160, in request_blocking\n    apply_error_formatters(error_formatters, response, params)\n', '  File "C:\\Users\\arlav\\anaconda3\\envs\\dynamo383\\lib\\site-packages\\web3\\manager.py", line 65, in apply_error_formatters\n    formatted_response = pipe(params, error_formatters)\n', '  File "cytoolz/functoolz.pyx", line 667, in cytoolz.f

It appears that web3.py formulates the whole transaction but is not able to send it because it does not find it on the account? Any advice on how to formulate transactions so that they are able to use a writing function on the smart contract code?


texts: What inputs to smart contracts can be maliciously modified by miners, beyond timestamps? Why isn't this caught by mining verification?

texts: Are there other trusted inputs which miners could maliciously modify which still get accepted by blockchain verification?  I realize the timestamp can be modified in a small way to potentially modify the outcome for a malicious purpose.


texts: Swap tokens to Ether on Uniswap V2 TRANSFER_FROM_FAILED

texts:
I am trying to swap DAI to ETH on kovan testnet my wallet and contract both have DAI tokens. Whenever I swap the token through web3 the transaction fails Fail with error 'TransferHelper: TRANSFER_FROM_FAILED'
and it says on Tenderly about Dai/insufficient-balance as an error. I don't understand why this happen and how to resolve this. Here is the snippet of the Sell.
onSell = async (event) => {
    event.preventDefault();

    const tokenAmount = web3.utils.toWei(this.state.SellValue, 'ether');
    const requiredEth = await frontrun.methods.getEstimatedTokenforETH(tokenAmount).call();

    this.setState({ message: 'Transaction Processing ...'});

    try {
      await dai.methods.approve('0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D', tokenAmount).send({from: this.state.accounts[0]}) // change to variable

      await myContract.methods.Sell(tokenAmount).send({
        from: this.state.accounts[0],
        value: requiredEth[1] // change this to price oracle
      });

      this.setState({ message: 'Transaction successfully completed!'});
    } catch (err) {

      this.setState({ message: 'Transaction failed!'});

    }

  }

I used the router address of uniswap for the first argument on the approve and I tried changing that to the contract address or spender address and still I get the error.


texts:
I've started learning solidity and have some simple questions:

What is it that in contracts people write _varname, but not varname?
In remix, I can execute inline functions like (function a() { b=4; }  ) Why is this possible as the function isn't external or public?
If instantiating a variable of type byte32 requires less gas than of type string, why do people use strings?

Thanks


texts: Is it safe to remove the "view" modifier from the function "getTokenAmount" in the OpenZeppelin crowdsale contract?

texts:
This function from the openzeppelin crowdsale sample is marked view as seen here:

 // Override this method to have a way to add business logic to your crowdsale when buying

  function getTokenAmount(uint256 weiAmount) internal view
returns(uint256) {
    return weiAmount.mul(rate);
  }

If I want to add logic to alter the rate based on time (for a tiered ICO), is it safe to remove the view constraint and place that logic in this function?

I'm not sure if it had a view modifier for performance/cost reasons or if it is a security feature that could cause problems if I remove it.

I want to implement logic and I think it would be more suited to the function that calculates the token amount than anywhere else?

I'm very new to this though and appreciate any help or answers you may have.

Thank you.


texts: web3js API - web3.eth.contract.new - Fallback not called after successful deployment

texts:
I'm deploying a contract with web3js successfully, but the fallback function does not get called a second time after finishing the deployment.

I read that this was an on-going issue (people not implementing it properly?), but I couldn't solve it even with dirty fixes like waiting for quiet some time and then try to access the contract.address.

Successfully deployed contract:
https://ropsten.etherscan.io/tx/0xee03d8da3546e9c8aef1bc1704d20708f34b33f54c2ccfeccb870f5baeb242e6

var deployedContract = contract.new(constructor_param,params,function(error,result){
if(error){
    console.log("error contract.new: " + error);
} else {
    console.log("fallback no error");
    if(result.address){
        // gets set in the second call
        console.log("contract address: " + result.address);
        console.log(createEtherscanIoUrl('address',result.address));
    } else {
        // gets set in the first call
        console.log("contract transaction hash: " + result.transactionHash);
        console.log(createEtherscanIoUrl('tx',result.transactionHash));
    }
}
});

function createEtherscanIoUrl(type,hashOrNumber){

var etherscanBaseUrl='https://ropsten.etherscan.io/';

var url = etherscanBaseUrl;
if(type === 'tx'){
    url += 'tx/'+hashOrNumber;
} else if(type === 'block'){
    url += 'block/'+hashOrNumber;
} else if(type === 'address'){
    url += 'address/'+hashOrNumber;
}
return url;
}

How can I solve this issue, as I'm not able to continue working with the freshly deployed contract when I'm not receiving the address after deployment.

As I'm quiet new to this topic which causes me being limited in thinking about how to solve this issue. Any hint/help appreciated.


texts:
How do I resolve an ENS name to an address?

Hopefully with a pretty interface, something my grandmom can use.


texts:
When I follow the instructions on ethereum.org I need to download the wallet and sync it again by downloading all the blocks. This takes hours everytime, I feel I'm missing out on something. Is there another way to code tokens and check how I can write my code or is the wallet the only way and will I have to wait for all the blocks to be downloaded everytime? I tried going to wallet.ethereum.org in my browser but I get a pop up saying:

Unable to connect. Please start geth with the following options:

geth --rpc --rpccorsdomain "https://wallet.ethereum.org"

Optional add: --unlock .

I am stupid, please help.


texts: Setting up gasPrice in testrpc doesn't influence the transaction cost

texts:
Testing this function:

function withdrawAll ()
public
stopInEmergency () {
    if (!msg.sender.send(12 finney)) {
        throw;
    }
}

My truffle test:

it("Should let correct payouts and withdrawals", function(done) {
var my_contract = My15.deployed();
var unit = "finney";
const user_6_initialBalance = web3.eth.getBalance(user_6);
var  user_6_gas_cost = 0;

return my_contract.withdrawAll ({from: user_6});
    .then(function(tx_id){

        user_6_gas_cost = web3.eth.getTransactionReceipt(tx_id).gasUsed * web3.eth.gasPrice;

        const user_6_finalBalance = web3.eth.getBalance(user_6);
        const withdrawn = web3.toWei(12, unit);
        const recieved = user_6_finalBalance - user_6_initialBalance;
        const diff = withdrawn - recieved;

        console.log('gasPrice: ', web3.eth.gasPrice.toString(10));
        console.log('withdrawn: ', web3.fromWei(withdrawn, unit));
        console.log('recieved: ', web3.fromWei(recieved, unit));
        console.log("gas cost: ", web3.fromWei(user_6_gas_cost, unit));
        console.log('diff: ', web3.fromWei(diff, unit));

    }).then(function(){
        done();
    }).catch(done);

});

When running testrpc --g 1

gasPrice:  1
withdrawn:  12
recieved:  9.127600000008192
gas comission:  0.000000000028724
diff:  2.872399999991808

When running testrpc --g 100000000000

gasPrice:  100000000000
withdrawn:  12
recieved:  9.127600000008192
gas comission:  2.8724
diff:  2.872399999991808

Why doesn't gas price influence the amount user_6 receives?


texts: Invalid opcode when trying to pass address as parameter to contract

texts:
When I try to pass address as parameter to this addEmployee function it gives me this error:

invalid opcode
    The execution might have thrown.
    Debug to get more information.

modifier onlyOwner()
{
    require(msg.sender==owner,"msg.sender is not the Owner");
    _;
}

function addEmployee(address payable employeeWallet) onlyOwner external
{
    emp[emp.length-1] = employeeWallet;
}


texts: Emergency Metamask Withdrawal - Fastest & Easiest Way to Withdraw Tokens From Metamask (You're Being Hacked)

texts:
I recently was hacked and had all of my tokens stolen, from a variety of chains (ERC20, BEP20, Matic, Wanchain).
This made me realize how poor of a system I had in place, because I had realized that someone was inside my account pretty quickly (before they had a chance to send anything).
Even so, I wasn't able to recover most of the tokens, simply because I hadn't prepared by having a system in place where I could efficiently get all my tokens out to another wallet.
I didn't have ETH in my wallet, and I didn't have all the tokens added to each chain as I was using 3rd party tools to monitor tokens and balances (bogged.finance, dextools.io), especially for BEP20 tokens. This means I had to go find the contract address and add the custom tokens to my wallet in order to send them, and I had to get another wallet on the go to send to.
Now I am thinking I want to have a setup where if something were to happen, and I was lucky enough to catch it soon enough, I could mindlessly get all my assets to safety.
I'm looking for any systems and/or software someone might know of to achieve this result - obviously I am going to need two wallets with all the chains & tokens setup and the wallet addresses always easily accessible. But maybe there's something I am totally missing here since I am pretty knew.
Any feedback appreciated
Thanks
T


texts:
I am trying to run geth on google cloud.
I finnaly managed to install it, but when running it, it's not syncyng with the blockchain (rynkeby).

INFO [10-18|10:24:28] Initialising Ethereum protocol           versions="[63 62]" network=1
INFO [10-18|10:24:28] Loaded most recent local header          number=0 hash=d4e567…cb8fa3 td=17
179869184
INFO [10-18|10:24:28] Loaded most recent local full block      number=0 hash=d4e567…cb8fa3 td=17
179869184
INFO [10-18|10:24:28] Loaded most recent local fast block      number=0 hash=d4e567…cb8fa3 td=17
179869184

Running geth --fast at beggining did not change anything.

Why is it not syncyng?


texts: ALERT: Transaction Error. Exception thrown in contract code while using Safemoon fork

texts:
I'm currently trying to use dxlock to lock my tokens, but whenever I try to lock them, it gives me ALERT: Transaction Error. Exception thrown in contract code. Anyone has any idea what's going on?
https://bscscan.com/tx/0xaa5641fc4ca0f6af75bf45e5bb1d7e72d3a249966d438fd8bb779f2960b30b13


texts: I have a computer with 2 gpus (Intel and Nvidia), i would like to know how i could use both of them to mine Ethers? is it better to use only one gpu or more? and how to calculate the hashrate. does ethereum cpp supports Cuda? Thanks


texts:
I wanted to create a getter function to access a mapping nested inside a struct. But the function that I made required me to use the expiremental version (I'm on Remix).
So I used the expiremental version to verify if the code I had done was correct and it was. Here the used code that I simplified as much as I could:
pragma solidity  ^0.5.16;
pragma experimental ABIEncoderV2;
contract SupChain{

enum StateType {Created, InTransit, Stored, OutOfComplicance, Completed}

struct Status{
    StateType state;
    address currentCounterparty;
    string test;
}

struct Order{
    uint256 orderID;
    uint256 NumberOfUpdate;
    string test;
    mapping (uint256 => Status) statutes;
}

mapping (uint256 => Order) public orders;

function getStatus(uint256 id, uint256 concernedStatusNumber)
                   public returns (Status memory status){
    Order storage concernedOrder = orders[id];
    Status memory concernedStatus = concernedOrder.statutes[concernedStatusNumber];
    return concernedStatus;
}

Now I would like to be capable to access to the map without using the expiremental version. How do I code such a getter version ?