texts: How do you prevent accidentally sending Ether to an inactive address?

texts:
How does one prevent a contract from accidentally sending Ether to an inactive address?  (e.g. the common error is burning ether to 0x0, or a single digit typo in an address)

I've worked on medical devices and have talked to people who work on flight control systems.  Such casual errors are prevented by the ecosystem from ever occurring, especially after the Therac-25 tragedy.

How would you do this with the current EVM+Solidity ecosystem?

In general this is called 'defensive programming'.

From the EIP156 discussion, here's a quote:

  I'm new here so take this comment with a grain of salt, but I was really surprised to learn Solidity even lets you make transactions that lock out / burn ETH (aside from semantics using some very explicit and intentional opcode). I feel like generations of accountants learned that lesson a long time ago right before they invented double-entry bookkeeping. :-)


texts: Cannot create filter on Infura via web3.py

texts:
I have an Infura account and I have the following code:

...
web3 = Web3(HTTPProvider("https://ropsten.infura.io/mytoken") )
web3_pending_filter = web3.eth.filter('pending')
...

when line web3_pending_filter = web3.eth.filter('pending') executes, I get error:

  requests.exceptions.HTTPError: 405 Client Error: Method Not Allowed
  for url: https://ropsten.infura.io/mytoken

How can I fix this issue?


texts:
I am developing an ETH game with a referral structure. Each account that exists in the game has a "Referral Count" associated with it that updates as people sign up using their referral link. I am able to call and view this number thru the contract for each individual address.
Here is where I got stuck however... How can I display the "ref count" and "address" of the current highest referrer in the website UI? Can I do this completely through JS?
This is my first somewhat complex dapp so any pointers in the right direction would be much appreciated!


texts: Erc20 token smart contract fallback function is disabled, how can I enable it?

texts:
There is a payable fallback function available now on my smart contract, but I want to function it like if someone send 0.01 / 0.05 / 0.10 / 0.50 / 1 ETH and the contract will automatically send the required amount of Token to the sender.

For Example:

Token Name: TEST TOKEN
Symbol: TEST
Total Supply: 21,000,000 TEST
Decimals: 18

My main code is given below. Now if I want to send 1 TEST to the sender who sent on my contract 0.10 ETH then what changes do I need to make on the following code.

function TESTTOKEN() public {
    symbol = "TEST";
    name = "TEST TOKEN";
    decimals = 18;
    _totalSupply = 21000000000000000000000000;
    balances[0x57669331B5c97532Bbc5Fc2bA0CE27D54E91CfdC] = _totalSupply;
    Transfer(address(0), 0x57669331B5c97532Bbc5Fc2bA0CE27D54E91CfdC, _totalSupply);
}

function () public payable {
    revert();
}


texts: How would a chain specification for a beacon chain look like?

texts:
Do Ethereum 2.0 clients, such as Lighthouse, Nimbus, or Prysm implement any standard on defining different chain specifications or genesis blocks comparable to how legacy Ethereum clients do?

Would it be possible to bootstrap new beacon-chain testnets based on a specification file fed into the beacon-chain client implementations? If so, how?

I came across the following configs/ in the eth-2.0-specs but I'm not sure whether they serve as specification or actual client configurations.


texts: How to handle forks, dropped/reverted blocks

texts:
I'm building an ethereum wallet, I've setup geth.
I'm planning to subscribe to new transactions on geth websocket, I can't figure out how to deal with dropped blocks and hardfork. let's say a user deposits 1 ether and I receive a block from geth saying it's mined, but sometime later it's found it was a fraud block, so miners drop it and create a new chain, in that case will geth notify me of the new block? how should I potentially deal with such situation, exchanges typically require 15 confirmations before they process deposits, how do they implement that?


texts:
I am trying to figure out how the ICO crowdsale is usually done?
I have a good understanding of the ERC20 Token and its standards. When a new token is created the owner is assigned all the tokens. I have looked at a couple of crowdsale contracts and saw the usage of transfer function and not transferFrom function.

Does this mean all the tokens from the owner is transferred to the crowdsale contract and then distributed to all contributors?
Why not keep the tokens in the owners' wallet and distribute them by allowing the crowsale contract to spend tokens from the owner's wallet (using the allowance in ERC20 Token)

What are the other differences in both the methods? Pros? Cons? Which is the right way to do? (If there is one)


texts: How can I determine which smart contract belongs to which vendor/app/etc. I am interacting with?

texts:
Rarible lists (on https://rarible.com/contracts.txt):
RC721Sale Contract - 0x131aebbfe55bca0c9eaad4ea24d386c5c082dd58
ERC1155Sale Contract - 0x93f2a75d771628856f37f256da95e99ea28aafbe
ERC721 Nonce Holder Contract - 0xefaefa82be8e827a15c9989417a19107ac9d54af
ERC1155 Nonce Holder Contract - 0x295fe6bc5ad4bdb770d416c066626e4207e10339
Transfer Proxy Contract - 0x4fee7b061c97c9c496b01dbce9cdb10c02f0a0be
Rari mine - 0x3b5d2b254224954547a33cbf753bcaa5eb4b27bd

But on the site I see this address associated with ERC-1155 items created Raribles:
0xd07dc4262BCDbf85190C01c996b4C06a461d2430

Another pseudorandom example:
This is the creator:
0x3482549fCa7511267C9Ef7089507c0F16eA1dcC1

Of this contract:
0xE5c783EE536cf5E63E792988335c4255169be4E1

How can I determine if the creator is Rarible/OpenSea/Decentraland/CryptoKitties/etc?
Thank you in advance if you are able to respond (even to say and link to a dup).


texts: what is the usage of web3.db.putString() ? does it log the event on node level?

texts:
what is the usage of web3.db.putString()? does it log the event on node level?  I am trying to store some information using this method I am getting below exception.

code snippet:

web3.db.putString('testDB', 'prod1', myContractReturned.address);
var value = web3.db.getString('testDB', 'prod1');

Output: "The method db_putString does not exist/is not available"


texts: How to import contract source code in etherscan.io

texts:
I'd like to learn which solidity source code is being used when I create a multisign Wallet in Parity 1.6

My goal is to import that source code into
https://kovan.etherscan.io/verifyContract?a=0xFe9b44592d4E15e9e43605d87C13958A2da42501

So I can browse the methods easily.
here is what I tried:
https://github.com/paritytech/parity/blob/master/js/src/contracts/snippets/wallet.sol
to paste this source code, but I get the following error:

  Sorry! The Compiled Contract ByteCode for 'multisig' does NOT match the
    Contract Creation Code for [0xFe9b44592d4E15e9e43605d87C13958A2da42501].


texts: Look for an address in a common.Address array in Golang

texts: Im essentially looking for a way to use bytes.Compare() but on an array of ethereum addresses that are of type common.Address. I need to search an array to see if another address exists in it and then add it only if it doesn't exist.


texts: How does Ethereum make use of bloom filters?

texts:
As stated in the yellow paper:

  Transaction Receipt. In order to encode information about a
  transaction concerning which it may be useful to form a zero-knowledge
  proof, or index and search, we encode a receipt of each transaction
  containing certain information from concerning its execution. Each
  receipt, denoted BR[i] for the ith transaction) is placed in an
  index-keyed trie and the root recorded in the header as He.

  The transaction receipt is a tuple of four items comprising the
  post-transaction state, R, the cumulative gas used in the block
  containing the transaction receipt as of immediately after the
  transaction has happened, Ru, the set of logs created through
  execution of the transaction, Rl and the Bloom filter composed from
  information in those logs, Rb:

R = (R;Ru;Rb;Rl)

Can anyone give more details of how this Rl (logs) is structured and how the Rb (bloom filters) are constructed from it?

I've been doing some research about bloom filters and Broder and Mitzenmacher state that:

  Wherever a list or set is used, and space is at
  a premium, consider using a Bloom filter if the effect of false positives can be
  mitigated.

So how does this relates to Ethereum's design rational?


texts: How to make function call through relay / entry level contract

texts:
I am trying to create an entry level contract (one that is the entry point):

  Relay.sol

pragma solidity ^0.4.8;
contract Relay {
    address public currentVersion;
    address public owner;

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

    function Relay(address initAddr) {
        currentVersion = initAddr;
        owner = msg.sender;
    }

    function changeContract(address newVersion) public
    onlyOwner()
    {
        currentVersion = newVersion;
    }

    function() {
        if(!currentVersion.delegatecall(msg.data)) throw;
    }
}

And my contract

  Access2.sol

pragma solidity ^0.4.8;
import './Storage.sol';
import './Relay.sol';

contract Access2{
Storage s;
address Storageaddress=0xcd53170a761f024a0441eb15e2f995ae94634c06;

function Access2(){
Relay r=new Relay(this);
}

 function createEntity(string entityAddress,uint entityData)public returns(uint rowNumber){
        s = Storage(Storageaddress);
        uint row=s.newEntity(entityAddress,entityData);
        return row;
    }

    function getEntityCount()public constant returns(uint entityCount){
        s = Storage(Storageaddress);
        uint count=s.getEntityCount();
        return count;
    }
}

Both the contracts are deployed.

If I access the method of Access2 via web3 using the object of Access2 it works fine, but now the problem is how can I access the the method of Access2 via Relay.

Can I use the Object of Relay?

This will look like duplicate of up-gradable contract here
but my question is not about writing upgradable contract but calling the functions of our contract from the entry level contract:
i.e. how does the concept of entry level contract work?

Thanks in advance


texts: For example can we create a pepsi token which is fix to pepsi stocks? Do you think that is useful?


texts: How do I update Geth when using Ethereum Wallet

texts:
How do I update Geth to the latest version when I am using Ethereum Wallet on a Mac OSX?

It is not prompting me for an update to Geth as I skipped it the first time Ethereum Wallet was opened after an update and I need to do it now.


texts: Are future block hashes viable as an RNG?

texts:
Let's say I want to make a gambling contract. Anyone can call the createWager function to create a new bet to flip a coin. When they win, in order to collect the payment for the wager, they have to call the collectPayment function, which uses the block hash of 2 blocks after when createWager was called for RNG. Only if they won the coin flip would  the collectPayment send money to the sender. Is this predictable in any way?

Example code:

contract Random {
    // Generates a random number from 0 to max based on the last block hash.
    function getRand(uint blockNumber, uint max) constant internal returns(uint) {
        return(uint(sha3(block.blockhash(blockNumber))) % max);
    }
}
function collectPayment() {
    uint256 blockDepth = block.number - wagers[wager_owner].creationBlockNumber;
    if (blockDepth > waitTimeBlocks) {
        // waitTimeBlocks has passed, resolve and payout this wager.
        uint256 payoutBlock = wagers[wager_owner].creationBlockNumber + waitTimeBlocks - 1;
        uint randNum = getRand(payoutBlock, 10000);
        if (randNum < payoutOdds) {
            // Wager wins, payout wager.
            uint256 winnings = safeMult(wagers[wager_owner].wagerWei, 2);
            wagers[wager_owner].active = false;
            wagers[wager_owner].sender.send(winnings))
        } else {
            // Wager loses, disable wager.
            wagers[wager_owner].active = false;
        }
    }


texts: How do you configure eth-lightwallet txutils example_usage.js to use a local eth node?

texts:
The example code for eth-lightwallet that shows how to use it with the hooked web3 provider can be configured to use the local node as follows:

var ethClient = "http://localhost:1111";
var web3 = new Web3();
var global_keystore;

function setWeb3Provider(keystore) {

    var web3Provider = new HookedWeb3Provider({
        host: ethClient,
        transaction_signer: keystore;
    });

    web3.setProvider(web3Provider);

}

The example_usage.js that demonstrates the use of txutils however does not show how the eth node can be set.  Can anyone advise?

example_usage.js starts...

// Example usage: Name Registry
// Create the contract, register the key 123, set the value 456

var lightwallet = require('../index.js')
var txutils = lightwallet.txutils
var signing = lightwallet.signing
var encryption = lightwallet.encryption
.....


texts: Will Ethereum be able to support apps like Whatsapp?

texts:
Two sources:

If Cryptokitties could take so much computing power in Ethereum network, how can the network support dapps with scale?, and;
ONO White Paper: Chapter 3 Technical Framework

In the first link, Edmund Edgar kindly listed several scaling options for Ethereum. In the second link, which includes a part of ONO (a messaging app running on EOS) white paper, the author estimates that the blockchain may need to run more than 600 transactions per second for 5 million users of such messaging app.

There are hundreds of millions of Whatsapp users, thus 60000 transactions per second would probably be required for such an app. Would Ethereum network ever be able to support apps with such scale after the scaling updates?


texts: " SyntaxError: Unexpected end of JSON input" while interacting with smart contract using node instance

texts:
Im trying to interact with my smart contract using web3js.

when i run js file using node instance i.e. node myfile.js

Im getting error like

undefined 1

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Object.<anonymous> (~/Documents/Project/miner1/requestor.js:234:19)

line 234 code is var accAbi = JSON.parse(web3.utils.hexToAscii(accAbiBytes));

Here is my code from line number 228

var methodName = "Method1";
var register = web3.eth.Contract(regAbi, regAddr);
var accAddr = register.methods.getContractAddr(methodName);
var accAbiBytes = web3.utils.bytesToHex(register.methods.getContractAbi(methodName));
//var accAbiBytes_new = web3.utils.utf8ToHex(accAbiBytes);
//console.log(web3.utils.isHex(accAbiBytes_new));
var accAbi = JSON.parse(web3.utils.hexToAscii(accAbiBytes));

can anybody help me. I tried some solutions in stackoverflow but nothing worked.


texts: How is Ethereum wallet checking the contract condition to show the alert?

texts:
I have a condition in my contract.

require(msg.sender == tempTeam.getConvener());

If I send a transaction to this contract which violates this condition, ethereum wallet immediately notifies me with an alert without even executing the transaction that it is going to fail. How is it doing that?
Is there a web3 API that can pre-verify the execution.


texts: Are pending transactions "dropped" and "reinstated"?

texts:
I tried a simple transfer of ether between two accounts using geth, but set quite a low gas price (2 gwei). After two hours the transaction was still showing in geth under eth.pendingTransactions - I assumed this was due to lack of demand to mine at that gas price.

However, at that point I checked both accounts on Etherscan to establish whether the transaction had been broadcast from my local machine. The transaction showed as pending but with an age of only 40 minutes. Around ten minutes later I refreshed, and the transaction had disappeared from both Etherscan pages - but still showed in geth. A few minutes later the transaction had reappeared on Etherscan but age was reset to 2 minutes. From that point I checked intermittently until the transaction eventually completed (four hours after sending), without dropping off Etherscan again.

Since I was concerned for a short time while the transaction had disappeared, I'd like to understand the underlying process a little better. My understanding would be something like this:

Transaction sent
First shows as pending in geth
Propagates to rest of network - eventually visible as pending on all up-to-date nodes
"Chosen" to be mined (by a number of miners or just one?) as part of a specific block
Once block is completed, the updated transaction status propagates to rest of network
When my local copy of geth syncs to that block, change in account balances shows

However, my experience today suggests it may not be so simple, since my pending transaction disappeared and then reappeared from Etherscan (one node?).
What would be a more accurate sequence of events?


texts: How to login to account with only address and passphrase?

texts:
I downloaded ethereum years ago. I forget which brokerage I used, but I created an ethereum account with the geth console and sent money to the address.

I recorded the address and am fairly sure I know the passphrase since I have written down 6 random words beside my address. My computer crashed sometime between then and now.

With my address, with my known passphrase, how do I access my wallet / account?


texts: ERC223 backwards compatibility with ERC20

texts:
I agree with most of the ideas behind ERC223 and it fits closer with what I think a token should do. However, the ERC20 backwards compatibility story is not flawless.

I've searched around for examples and I've found contracts that emit both the ERC20 Transfer event and an ERC223 Transfer event for every transfer. This sounds bad. Transfers appear fine (once per transfer) in Etherscan, but there are still 2 events emitted behind the scenes, so anyone viewing raw events would see 2.

Example: https://etherscan.io/address/0x40395044Ac3c0C57051906dA938B54BD6557F212#code (see lines 158 and 159).

What are some options for developers of new tokens?

Stick with ERC20 and its flaws.
Support only ERC223.
Support both, emitting the two Transfer events for each transfer.

Some questions:

How bad is it to have 2 Transfer events?
If I only had 1 Transfer event, the token would not be fully compliant with either ERC20 or ERC223. How bad is that? I am considering supporting only the ERC20 Transfer event, and leaving an enum in the contract that toggles this decision between 1, 2, or both.

What do you guys think?


texts:
I implemented selfdestruct(), also it showed succeeded on Etherscan.
Afterwards, I still am able to send transactions to the contract. Can you tell me why? Doesn't selfdestruct() delete the contract code & storage from the network. Why it still accepts subsequent transaction requests? Help please...
Here the function:

function kill() public {
    selfdestruct(owner);
}


texts:
I've been facing some troubles when I call the liquidation smart contract in the Alpha Homora vBSC
This was the Tx in BSCScan
https://bscscan.com/tx/0x42f8a0cc50ffae0309d67e01220241c48a4302f580ce97896a4e903a54ebe480
I don't understand what should I do to get my incentives paid in the platform.
Alpha says is a UI issue but the smart contract is working, i don't think so, any thoughts?
Btw, I'm using Metamask.
thank you


texts: Do you need to use/learn Solidity to make smart contracts

texts:
I'm working on an API that sends multiple transactions out from one wallet.

I realized I cannot do it without creating a smart contract the way Ethereum is structured which is actually quite a great thing.

But I am facing a dilemma, do I have to learn Solidity in order to create smart contracts?

I got myself up to speed with Javascript & Nodejs and a bunch of other frameworks just very recently with nearly zero coding background. I was able to implement a batch transaction API for Monero and it was quite easy using only Javascript and the RPC daemon. The way Monero is set up actually, you're required to batch all your transactions into one as Monero locks your balance once a transaction is sent out so it would be impossible to send more than one consecutively in a short amount of time.

I'm seeing it is not quite as easy with Ethereum and the conclusion I'm making so far is I am going to have to learn a WHOLE new language just to create the smart contract needed to send multiple or batch transactions to my clients.

Is this true or can I create smart contracts using just Javascript / Nodejs ?


texts: Is it possible Filter events with wildcards based on recorded indexed parameters

texts:
Let's say I have a contract that fire an event PersonCreated(uint personId, bytes32 indexed name) every time a person is created.

To query for all the past events with name equal to Jason, we can use:

contract.getPastEvents('PersonCreated', {
    filter: {
        "name": [web3.utils.toHex("Jason") ]
    },
    fromBlock: 0,
    toBlock: 'latest'
}).then((events)=> {
    console.log("Events: ", events)
})

[Q] Is it possible to create filter to query all event with name start with "J" instead?


texts: Assembly for array with bytes64, to bypass nested array error

texts:
Since it is not possible to pass call code with an array of bytes64, as an array with types bigger than bytes32 becomes a nested array, Why is bytes[] a nested array?

How would assembly be used to pass call code with an array of bytes64?


texts: What filetype is the Mist wallet backup file?

texts: Also, is it possible for another program to be able to read the file and use it in another wallet that's not mist? Or is it only usable in Mist? Thanks.


texts:
I have been resolving issues related to IPFS access and it seems the design is that 127.0.0.1 is used for local updates with an API interface to a app. I have 5001 access issues and I have checked already IPFS CORS.

Here is the error -

POST http://jenbil.com:5001/api/v0/cat?arg=QmU5KhkgvweYgE3Gsr8A19uFQrq7mszx7dubcoo89cTmAV&stream-channels=true net::ERR_CONNECTION_REFUSED

I have this config -

{
  "API": {
    "HTTPHeaders": {
      "Access-Control-Allow-Credentials": [
        "true"
      ],
      "Access-Control-Allow-Methods": [
        "PUT",
        "POST",
        "GET"
      ],
      "Access-Control-Allow-Origin": [
        "*"
      ]
    }
  },
  "Addresses": {
    "API": "/ip4/127.0.0.1/tcp/5001",
    "Gateway": "/ip4/127.0.0.1/tcp/8180",
    "Swarm": [
      "/ip4/0.0.0.0/tcp/4001",
      "/ip6/::/tcp/4001"
    ]
  },
  "Bootstrap": [
    "/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",

    "/ip6/2604:a880:1:20::1d9:6001/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx"
  ],
   "Datastore": {
     "BloomFilterSize": 0,
     "GCPeriod": "1h",
     "HashOnRead": false,
     "NoSync": false,
     "Params": null,
     "Path": "/root/.ipfs/datastore",
     "StorageGCWatermark": 90,
     "StorageMax": "10GB",
     "Type": "leveldb"
   },
   "Discovery": {
     "MDNS": {
       "Enabled": true,
       "Interval": 10
     }
   },
   "Experimental": {
     "FilestoreEnabled": false,
     "ShardingEnabled": false
   },
   "Gateway": {
     "HTTPHeaders": {
       "Access-Control-Allow-Headers": [
         "X-Requested-With"
       ],
       "Access-Control-Allow-Methods": [
         "GET"
       ],
       "Access-Control-Allow-Origin": [
         "*"
       ]
     },
     "PathPrefixes": [],
"RootRedirect": "",
     "Writable": false
   },
   "Identity": {
     "PeerID": "QmNwbtyFuEBDoB2BQGNe144jJXGJPJ9QrcwzNDMuqGYiZ9"
   },
   "Ipns": {
     "RecordLifetime": "",
     "RepublishPeriod": "",
     "ResolveCacheSize": 128
   },
   "Mounts": {
     "FuseAllowOther": false,
     "IPFS": "/ipfs",
     "IPNS": "/ipns"
   },
   "Reprovider": {
     "Interval": "12h"
   },
   "SupernodeRouting": {
     "Servers": null
   },
   "Swarm": {
     "AddrFilters": null,
     "DisableBandwidthMetrics": false,
     "DisableNatPortMap": false
   },
   "Tour": {
     "Last": ""
   }

And the config file for Nginx

server {
    listen 80 default_server;
listen 8080;
listen 5001;
listen 8180;
    listen [::]:80 default_server ipv6only=on;

#   root /usr/share/nginx/html/ipfs/src;
#
root /usr/share/nginx/html;
#root /var/www/html;
index index.html index.htm index.nginx-debian.html;
#   index App.js index.html index.htm;
#listen   443 ssl;
server_name jenbil.com;
#server_name _;
#ssl    on;
#ssl_certificate    /home/keys/jenbil.com.chained.crt;
#ssl_certificate_key    /home/keys/jenbil.key;

    # Make site accessible from http://localhost/
###jenbil   server_name localhost;

    location / {


texts: How is it possible for a contract to automatically charge an amount to an external account?

texts:
How is it possible for a contract to automatically charge an amount to an EOA?
I mean, in example, in a car rental smart contract (by hours) If balance of the EOA (Who has rented) is enough, how a new price unit (x wei) could be charged every hour.


texts:
I know I must be getting some basic idea wrong, so I'd like you to explain to me:
If I have for example Mist wallet installed on multiple computers that are connected to the internet, all with the same account, and also I moved the wallet file to a Ledger USB drive, how does it protect me from unwanted transactions? I understand that from the Ledger itself it cannot be stolen, but the same wallet file is connected to the internet in other computers, so how can it protect?


texts: transaction conformation in blockchain using web3 1.0

texts:
How can i know the transaction that i send to the blockchain is confirmed and the transaction is added to the blockchain using web3.js ?
methods.myMethod.send returns promise combined with event emitter, when is transactionHash, conformation, and receipt is fired ? and what these three term exactly mean can anyone describe in detail?


texts: (Parity) How do I correct "columns families not opened"

texts:
Starting Parity/v1.5.0-unstable-0c7b7fc-20161204/x86_64-macos/rustc1.13.0
2016-12-04 18:50:47 State DB configuration: fast
2016-12-04 18:50:47 Operating mode: active
2016-12-04 18:50:47 Configured for Frontier/Homestead using Ethash engine
Client service error: Client(Database("Invalid argument: You have to open all column families. Column families not opened: col5, col4, col3, col2, col1, col0"))


texts: How do I decrease the difficulty on a private testnet?

texts:
I've created a private test network. On the genesis.json file, I've changed the difficulty to 1. Yet, mining a block still takes hours on my CPU. I suspect that is due to some configuration related to the network adaptation.

What is the correct procedure to decrease the difficulty on a private testnet, so that I can mine the first blocks in a not very powerful CPU?


texts: How to avoid collisions between Ethereum-like networks?

texts:
Lets say, that there are two networks, Ethereum 1 and Ethereum 2, and they have different blockchains.

How would you configure both networks the way that nodes wouldn't collide with when discovering each other? Because if networks have thousands of nodes, checking chainID is a very time consuming task, there would be a lot of wasted resources if both networks collide with each other.

EDIT:
or , in other words, how to you make it that both networks don't interchange TCP / UDP traffic and avoid collisions this way?


texts: why do people call interfaces with constructors when there is none in the contract?

texts:
I'm just looking at some code to see common design patterns but this one really doesn't make sense to me:

import "./zeppelin/token/ERC20/IERC20.sol";

IERC20(tokenAddress).transfer(projectAddress, _tokenAmount)

how is tokenAddress being injected into an interface here?
It's not a class, and the underlying erc20 has no constructor either.


texts: What is the difference between IPDB and Blockchain Databases?

texts: I wanted to know what are the differences between IPFS, interplanetary file system and a block chain database like IPDB and BigChainDB


texts: How to deploy a Vyper smart contract? Remix fails to compile

texts: I have been trying all the solutions and tutorials I found on the Internet, with no success. Remix fails to compile vyper smart contracts in local and remote. How to make it work?


texts: Where do I find the "constructor arguments" for a contract deployed with Remix?

texts:
When try to verify token, I dont know what to put in for this line:

  Constructor Arguments ABI-encoded (For contracts that accept constructor parameters)

I made token after looking at a YouTube video on how to do it.

I used this code:

https://gitlab.com/pedram31/cryptocoopx-ccx/blob/master/ccx-src.sol

And pasted it here:

http://remix.ethereum.org/#optimize=true&version=soljson-v0.4.24+commit.e67f0147.js

Now I have no idea how to verify my token:

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

I saw that there you can copy some numbers after 0029 but there is nothing after 0029.

I also saw that I can use https://abi.hashex.org/ or this https://abi.sonnguyen.ws/, but I do not know how to use these websites.


texts: TypeError: different number of components either side of equation

texts:
I am working on a project using ERC721. Code below
pragma solidity >=0.4.21 <0.7.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract Sketch is ERC721 {
  string[] public sketchs;
  mapping(string => bool) _sketchExists;
  constructor() ERC721("Sketch", "SKETCH") public {
  }
  function mint(string memory _sketch) public {
    uint _id = sketchs.push(_sketch);
    _mint(msg.sender, _id);
    _sketchExists[_sketch] = true;
  }
}

But when I truffle migrate I get a TypeError "Different number of components on the left hand side (1) than on the right hand side (0)". Because uint _id has 1 and sketchs has 0
uint _id = sketchs.push(_sketch);

Is that because my sketchs array starts at 0? If that is the case how would I initialize this then? Any direction/assistance would be great, thanks in advance!


texts: Will Ethereum generate the same private key?

texts:
We know that Ethereum first generates a 256-bit private key, and then generates a 160-bit address on the basis of this private key. So in theory, it is possible for Ethereum to generate the same private key. If an existing private key is generated, how will Ethereum handle this situation?
Hope you can give me some help, thanks!


texts: Should dapp backend sign all transaction. What problems may occur?

texts:
I have a dapp that communicates with one contract address. I want users to submit data in the frontend and then the data will be transferred to backend, where an ethereum account will make and sign the transactions in order to send these data to the smart contract.
I am thinking will there be a problem if the same account has to send simultaneously many transaction to the same contract address?
What happens if one transaction is not mined? Will all the other fail, maybe because of nonce?
Do you think I could use one account in backend to handle all transactions because users are not aware of blockchain technology, so I don't want them to use a wallet.


texts:
I try to add more property to the scenario struct but when I run the compile the same error appear:

 struct Scenario {
        uint id;
        address payable author;
        address editor;
        string title;
        string objective;
        uint256 price;
        string copyrigthDate;
        string patientCase;
        string EnvironmentFidality;
        string MedicalDevices;
        string briefingDescription;
        string EventFlow;
        string debriefingDescription;

    }

The error message:

PS C:\Users\user\desktop\chainlist-truffle5> truffle compile

Compiling your contracts...
===========================
> Compiling .\contracts\ChainList.sol
> Compiling .\contracts\Ownable.sol

Error: CompileError: InternalCompilerError: Stack too deep, try using fewer variables.

Compilation failed. See above.
    at Object.compile (C:\Users\user\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\workflow-compile\legacy\index.js:72:1)
Truffle v5.0.40 (core: 5.0.40)
Node v10.16.0

So, what the best solution in this case? should I create nested structures??


texts: How to get event from geth ethereum node using web3.js

texts:
I have created a simple contract where I am trying to write a value to a state variable in solidity smart contract, and emit that written value.
I am using Truffle v5.1.28 (core: 5.1.28)
Solidity - 0.6.6 (solc-js)
Node v8.10.0
Web3.js v1.2.1
Geth
Version: 1.9.15-stable
I have created my own geth node, and started it using the below command.
sudo geth --datadir="ethdata" --verbosity 10 --ipcdisable --port 30303 --networkid 15 --nodiscover console --allow-insecure-unlock  --unlock 0x81f2d8DcaEffE200826710DD4f642387b3b0D182  --password password --rpc --rpcport "8000" --rpcaddr "0.0.0.0" –rpccorsdomain "*" --rpcapi "eth,net,web3,miner,debug,personal,rpc" --wsorigins "*"

The node starts successfully, and I start mining it on using miner.start(1).
After, that I am also able to deploy my contract successfully, on the node.
Now, when I am trying to use web3.js from a file that I have created to interact with the contract, it is throwing me an error. I am not able to get instance of my contract if I am using
     App.web3Provider = new Web3.providers.WebsocketProvider(
    "ws://localhost:8000"
  );

instead of
   App.web3Provider = new Web3.providers.HttpProvider(
    "http://localhost:8000"
  );

If I use HttpProvider, I get the instance, and I am also able to write to my contract using it, but, as I need to listen for events for my blockchain, I cannot use HttpProvider .
But, if I use WebsocketProvider, I get below error, while trying to get the instance of my contract: The rest all of the code is same for both the cases, I only change the providers in these cases.
Error: connection not open on send()
at Object.ConnectionError (/home/silmonk/code/BlockchainNetwork/truffle-init-default/src/node_modules/web3-core-helpers/src/errors.js:69:23)
at Object.ConnectionNotOpenError (/home/silmonk/code/BlockchainNetwork/truffle-init-default/src/node_modules/web3-core-helpers/src/errors.js:48:21)
at /home/silmonk/code/BlockchainNetwork/truffle-init-default/src/node_modules/web3-providers-ws/src/index.js:181:37
at Map.forEach (<anonymous>)
at WebsocketProvider._onClose (/home/silmonk/code/BlockchainNetwork/truffle-init-default/src/node_modules/web3-providers-ws/src/index.js:180:27)
at W3CWebSocket._dispatchEvent [as dispatchEvent] (/home/silmonk/code/BlockchainNetwork/truffle-init-default/src/node_modules/yaeti/lib/EventTarget.js:115:12)
at W3CWebSocket.onConnectFailed (/home/silmonk/code/BlockchainNetwork/truffle-init-default/src/node_modules/websocket/lib/W3CWebSocket.js:219:14)
at WebSocketClient.<anonymous> (/home/silmonk/code/BlockchainNetwork/truffle-init-default/src/node_modules/websocket/lib/W3CWebSocket.js:59:25)
at emitOne (events.js:116:13)
at WebSocketClient.emit (events.js:211:7)
at WebSocketClient.failHandshake (/home/silmonk/code/BlockchainNetwork/truffle-init-default/src/node_modules/websocket/lib/WebSocketClient.js:339:10)
at ClientRequest.<anonymous> (/home/silmonk/code/BlockchainNetwork/truffle-init-default/src/node_modules/websocket/lib/WebSocketClient.js:278:18)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at HTTPParser.parserOnIncomingClient (_http_client.js:551:21)
at HTTPParser.parserOnHeadersComplete (_http_common.js:115:23)

I would really appreciate it, if I can get any help regarding this.


texts: Can I Mine with The Linux OS that I use To Already Mine With?

texts:
I am thinking of starting to mine ETH or try in the next day or so. I use a version of BAMT i customized and upgraded to mine some of the latest currencies that have been released. I have checked using a mining calc that I would actually make some coins with my rig.

Can I use BAMT to mine ETH?
If so, what settings etc.. do I need to use/switch to? I will be using a pool to mine. Also I read that the algo that ETH uses is memory based while my current mining I OC'd the GPU which gives me a better hash rate
with ETH do I need to lower the GPU core speed and then increase the memory?

The current coin I mine uses the core proc power so I lowered the memory.


texts: How does Parity decide which account to use when migrating a contract?

texts:
Parity 1.7.6

Three accounts active, two have funds.

Am migrating a contract using truffle.

Parity UI prompts me for the password for one of the accounts with funds.  Why did it choose this one?


texts: Geth node with RPC - accounts created automatically, always same addresses "0xffa4658ff14e486a3a57cc7163c153724c9d1904"

texts:
I am testing a private ethereum network using Geth 1.9.x.  On all instances serving RPC (universally enabled CORS), a series of 3 accounts are created (always the same 3 addresses):
0xb50970d977fe010dfb6f6759bb5c832a8ef0017b
0xa33281e32fcf19ff284e0381bcfb426f5e7c0f58
0xffa4658ff14e486a3a57cc7163c153724c9d1904

If I delete the files in the keystore, new files are eventually created again, with the same account addresses, though.  Relaunched new instances a dozen times, same thing always happens.
I have no access to these accounts (passphrases unknown).  Nothing else seems to be happening.
Gethinstance works ok.
Other nodes without JSON-RPC enabled are unaffected, until they are enabled.  On occasion, accounts have insterted themselves in between two previously created accounts.
Environment is a clean Ubuntu 20.04 AWS VM (open TCP/UDP 8500-8599)  with JSON-RPC HTTP server running on one of these ports (not on 8545).  Also open ssh 22 and TCP/UDP 30300-30399.  Private key authentication for ssh.
Is this a security issue, a bug, or a feature?


texts: How to implement cryptographic algorithms in smart contracts?

texts:
I need to implement cryptographic algorithms such as AESCCM and elliptic curve algorithms (ECDSA, ECIES) within a smart contract. Is there any implementation of such algorithms in Solidity or Serpent?

Or is there is any way to integrate Python code (or other language) within Serpent for example (there many cryptographic libraries in Python)?

Or any other suggestions on how can I implement those algorithms?


texts: How do you get the Contract JSON Interface from Truffle?

texts: I'm developing smart contracts using Truffle. I got the contract's bytecode through truffle compile. This produced a large json file and it wasn't too ahrd to find the bytecode. Now, how can I find the Contract JSON Interface for easy testing of the contract, especially those that import from multiple files and so on?


texts:
I do not understand how this address has a balnce of >$55k at current prices: https://etherscan.io/address/0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
There have been >300 transactions to it, but most with 0 Eth.
Also I am assuming that this isn't a real address because nobody could brute force a private key from it, and it's extremely unlikely that one would just arrive at it.
What gives?


texts: An overview of fungible Ethereum Token standards/proposals?

texts:
Beside the well known EIP-20, we have a number of other proposals for fungible tokens. Each of them addressing a different set of requirements.

[Q] Is there an overview of fungible Token standards/proposals?


texts: When testing a contract, NodeJS returns: "SyntaxError: Unexpected token u in JSON at position 0"

texts:
My NodeJS script gives me this error:

1)"before each" hook for "deploy a factory and a lottery"
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse((anonymous))
at Context.(anonymous) (test/lottery/test.js:18:46)
at processTicksAndRejections(internal/process/task_queues.js:94:5)

File test.js

const assert = require('assert');
const ganache = require('ganache-cli');
const Web3 = require('web3');
const web3 = new Web3(ganache.provider());

const compiledFactory = require('../ethereum/build/LotteriaFactory.json');
const compiledLotteria = require('../ethereum/build/Lotteria.json');
//two istances of the contract inside the build dir

let accounts;
let factory;
let lotteriaAddress;
let lotteria;

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

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

  await factory.methods.createNew('5').send({
    from: accounts[0], //manager
    gas: '1000000'
  });

  const addresses = await factory.methods.active().call();
  lotteriaAddress = addresses[0]; //[LotteriaFactory]

   lotteria = new web3.eth.Contract(
     JSON.parse(compiledLotteria.interface),
     lotteriaAddress
   );
});

describe('Lottery', () => {
  it('deploy a factory and a lottery', () => {
    assert.ok(factory.options.address);
    assert.ok(lotteria.options.address);
  });
});

My dependencies are:

solc 0.5.0
web3 1.2.6

Can someone help me? What I am missing?


texts: Meteor's EthBlocks.latest.number not updating

texts:
Created a very simple Meteor app to display the current block number using ethereum:block.

Problem: Even though the current block number is displayed when the page loads, it does not update both on the page and when running EthBlocks.latest.number

The valaue of EthBlock.latest.number updates only when the page is refreshed.

Shouldnt the variable EthBlocks.latest.number updates whenever geth detects a new block?

client/currentBlock.html

  <title>myDapp</title>

  {{> currentBlock}}

<template name="currentBlock">

Current Block

 {{ currentBlock }}

</template>

client/currentBlock.js

    import { Template } from 'meteor/templating';
    import { ReactiveVar } from 'meteor/reactive-var';

    import './currentBlock.html';

    Template.currentBlock.onCreated(function helloOnCreated() {
      EthBlocks.init();
    });

    Template.currentBlock.helpers({
      currentBlock() {
        return EthBlocks.latest.number;
      }
    });

client/init.js

if (typeof web3 == 'undefined')
    web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'));

Geth is started using

geth --rpc --rpccorsdomain "http://localhost:3000"


texts: DeployedAddresses.sol - Test contracts on remix

texts:
I have the following contract:

pragma solidity ^0.4.17;

//import "github.com/ethereum/dapp-bin/library/stringUtils.sol";
import "github.com/OpenZeppelin/zeppelin-solidity/contracts/ownership/Ownable.sol";

contract TodoList is Ownable {

    event NewTodo(uint todoId, string value);
    event DeleteTodo(uint todoId, string value);

    //every user has an array of todo items
    mapping(uint => address) todoOwner;
    //every address has a certain number of todos on it
    mapping(address => uint) ownerTodoCount;

    TodoItem[] public todoItems;

    struct TodoItem {
        string value;
        bool active;
    }

    function createTodo(string _value) public returns(uint) {
        uint id = todoItems.push(TodoItem(_value, true)) - 1;
        todoOwner[id] = msg.sender;
        ownerTodoCount[msg.sender]++;
        NewTodo(id, _value);
        return id;
    }
}

Now I would like to write a test on remix to check the behavior of the contract.

pragma solidity ^0.4.17;

import "github.com/trufflesuite/truffle/build/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "./TodoList.sol";

contract TestTodoList {
    TodoList todolist = TodoList(DeployedAddresses.TodoList());

    // Testing the adopt() function
    function testUserCanAddTodo() public {
      uint returnedTodo = todolist.createTodo("test");

      uint expectedValue = 1;

      Assert.equal(returnedTodo, expectedValue, "Todo should be added to the list and return 1.");
    }

}

As you can I imported the Assert.sol file from github, but havent imported theDeployableContract.sol` file, as it seems that this is automatically generated by truffle.

Any suggestions how to still write my test within the remix browser IDE?

I appreciate your replies


texts: How is it possible to look for if a certain word is part of a string in solidity? let's say someone upload a string to a smart contract, this string must contain the word "solidity" to be accepted by a function. Is it possible to create a modifier or require() check that ensures this?


texts:
How do you calculate how much gas to use in a send_transaction?

Amount: 0x670479cb5385800, // (decimal: 463949500000000000 wei 0.4639495 eth)

Gas price: 0x6ddd00  // (decimal: 7200000 wei)

Gas: 0x15F90 // (decimal: 90000)

What I did was the gas price I use for base is 10.

Then I know the send_transaction RPC makes the gas default to 90,000 and returns the difference.  So I set my gas to 90,000.

To get my gas price I did 90,000 * 10.  Then I multiplied by 8 (idk just a magic number) to get the gas price value I have.  What did I do wrong?

I keep getting error:

code: -32000,
message: 'insufficient funds for gas * price + value' } }

What am I doing wrong?


texts:
When I start the mist Ethereum Wallet it shows Rinkeby in the top, right corner, and it goes through the node connection process; then it says it needs to sync and it is looking for peers. Because this seems to take a while, I click on the Launch Application button, and after that when I check the menu develop it shows "Main network" is checked. However, there is only 1 peer, 9 months since last block and a 0 balance. I'm positive I have a few Ethers from checking on etherscan.io.

What am I doing wrong?


texts: Can a smart contract know its address where it has been mined?

texts:
I'm using Solidity in order to create smart contracts. From contract only has access to the current state, I can't see where I'm able to get directly the address where this contract has been mined.

The only way I see to achieve this, is to use the Web3 JavaScript API so as to get contract.address, and then call a setter function,implemented inside the smart contract with contract.address as input parameter.

Is this the only way to do it?

Thanks


texts:
i tried to connect my token via pancake just want to ask if i remove LP of my token so ppl can still trade or not?
And if someone bought my token will his money convert into LP?
And if yes? Then if i remove his money from LP and there is still my money in LP for trading can he still able to sell and buy? And there will be deduction in my LP?


texts: Truffle sample Dapp doesn't show Metacoin balance when Metamask is active

texts:
The sample Truffle Dapp doesn't work when Metamask active.
 I'm running testrpc, I imported the tesrpc account's private key to Metamask and Metamask is connecting to the local testrpc according to chrome console log:

Using web3 detected from external source. If you find that your accounts don't appear or you have 0 MetaCoin, ensure you've configured that source properly. If using MetaMask, see the following link. Feel free to delete this warning. :) http://truffleframework.com/tutorials/truffle-and-metamask

However  Metamask doesn't show any ether balance on the account and the Dapp page shows empty string for Metacoin balance.

I debugged it and it seems web.3eth.getBalance never calls the callback function when Metamask is active:

  web3.eth.getBalance(myAccount, web3.eth.defaultBlock,
        function(error,result){
          if(error) {
            console.error("Error while retrieving the balance for address["+myAccount+"]: "+err);
          } else {
            var balance = web3.fromWei(result.toNumber());
            console.debug("Balance for address["+myAccount+"]: "+balance);

          }
        }
      );

It works perfectly when Metamask isn't active.


texts: How to execute transactions of my Ethereum contract deployed on Rinkeby test client using REST apis?

texts:
I would like to build a UI on top of my ethereum contract and how can I get a use a REST API to execute transactions in my contract ?
which one of Rinkeby etherscan API could be used ?


texts:
I'm struggling with transferring my own ERC20 Token.

I got following code:

contract AccountingToken is ERC20, ERC20Detailed {
constructor () public ERC20Detailed("AccountingToken", "MAC", 18) {
        _mint(msg.sender, 10000 * (10 ** uint256(decimals())));
    }
}

contract Accounting{
AccountingToken instance=AccountingToken(0x000...);

function get_balance()public view returns(uint){
        uint balance;
        balance=instance.balanceOf(msg.sender);
        return balance;
    }
function transfer_to_contract(uint tokens)public{
        address receiver=0x..receiver_address;
        instance.transfer(receiver,tokens);
}
}

Running the get_balance() function gives me the correct amount back.

But running the transfer() function always ends in a JSON-RPC error.

What am I doing wrong?

Thanks!


texts: Is it possible to get the transaction hash of a function call in Ethereum Pudding/ Truffle?. It seems that it works straight forward with web3 but Pudding is hiding it?


texts: How to get the same output using `sha3` by providing same address as input on nodejs?

texts:
I have following contract:

pragma solidity ^0.4.0;

contract Lottery {
  address public owner;
  bytes32 public hash;

  function Lottery() {
    owner = msg.sender;
    hash = sha3(owner);
  }

  function get() constant returns (address, bytes32) {
    return (owner, hash);
  }
}

Which returns:

{
    "0": "address: 0xca35b7d915458ef540ade6068dfe2f44e8fa733c",
    "1": "bytes32: 0xb1591967aed668a4b27645ff40c444892d91bf5951b382995d4d4f6ee3a2ce03"
}

I want to obtain same bytes32 hash on the nodejs by providing same inputs as "address: 0xca35b7d915458ef540ade6068dfe2f44e8fa733c".

The javascript code I have:

module.exports = require('js-sha3');

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

if(!web3.isConnected()){
    console.log("not connected");
    process.exit();
}

var owner = "0xca35b7d915458ef540ade6068dfe2f44e8fa733c"; //given input on the smart-contract.

has=web3.sha3(owner);
console.log(hash)

Which prints:

0d87bf1419ed1b24bad65bbf117fcaded953923cb4eff8ca80bcde0aacb97357

That is not the same output I got on the solidity.

[Q] What should I do to get the same output using sha3 by providing same address as input on nodejs?

Thank you for your valuable time and help.


texts: Which signer shall be used to sign transaction message?

texts:
Here is the code to create wallet and signer with ethers.js 5.0.5:
  let url = "http://localhost:8545";
  const provider = new ethers.providers.JsonRpcProvider(url);
  const signer = provider.getSigner(); //forJsonRPC
  let privateKey = "0x8d8073c48cd4ba11c9d659dcb31f3523d13874b7b3d6d31bc0271652f9541ac0"; //32bytes and 64hex
  let wallet = new ethers.Wallet(privateKey,provider);  //address of the wallet
  let signerAddress = await signer.getAddress();

Here the wallet.address is 0xc95b6B8Ec0Eee5eBF18E3c519DBdafaE17AD568F and the signerAddress is 0x7FdACa197B9D149F8BA75a6b7bbba8959b157135.
According to ethers document, there are 2 type of signers. One is wallet and another is jsonRpcProvider. To sign transaction message in dapp, which signer shall be used, wallet or JsonRpcProvider? Also why the wallet.address and the signer address (see above) are not the same?


texts: does it cost gas when executing view or pure function in solidity?

texts:
Let's suppose i have the following code in ethereum's solidity function:

function getArray() external pure returns(uint[]) {
  // Instantiate a new array in memory with a length of 3
  uint[] memory values = new uint[](3);
  // Add some values to it
  values.push(1);
  values.push(2);
  values.push(3);
  // Return the array
  return values;
}

As it's pure, it doesn't even read data from storage, doesn't change anything in storage. So imagine I deployed this contract. then there're people who want to invoke this function from web3.js or remix for example. Will this function cost them gas? I've read that view functions and pure functions are the way that don't change the storage. so they're free (no gas). If users use above function, why is it free? i still make the calculation and save temprorary data to memory.


texts: How can I view pending events, without much delay?

texts:
I can view pending events like so:
pending_events_filter = my_contract.events.TestEvent.createFilter(fromBlock='pending', toBlock='pending')
pending_events_filter.get_new_entries()

But the events are occasionally delayed up to a minute after my geth node gets the transaction in its mempool, and sometimes don't even show up until the transaction has been mined.
I am running geth locally, and connected to it via websocket.
How can I get these pending events immediately?
My suspicion is that my geth node is not bothering running them in the EVM until it needs to for mining purposes, but I don't know.
Thanks for any help!


texts:
I’m trying to build this escrow contract that will hold the funds from a transaction until both the buyer and the seller have accepted the release. Additionally, if the either one of them does not accept the funds will be withheld by the smart contract for a duration of 30 days. How can I add the address that initially deployed the smart and transfer 3% of the total deposit to that address if the transaction was successful ?
Also being relatively new to this, can multiple pairs of users interact with the contract at the same time and benefit from the escrow (will it instantiate a new version for every pair) ?
This is what I have tried for now:
pragma solidity 0.7.0;

contract NewEscrow {

enum State {AWAITING_FUNDS,AWAITING_CLAIM,CLAIM,COMPLETE}

State public currentState;

address payable public buyer;
address payable public seller;
address payable public owner;

uint256 public agreementDay;

mapping (address => uint256) deposits;

// checks if msg.sender is equal to buyer
modifier onlyBuyer (){
    require(msg.sender == buyer);
    _;
}

// checks if msg.sender is equal to seller
modifier onlySeller(){
    require(msg.sender == seller);
    _;
}

constructor (){
    owner = msg.sender;
}

function setVariables (address payable _buyer, address payable _seller, uint256 _agreementDay) public {
    buyer = _buyer;
    seller = _seller;
    agreementDay = _agreementDay + 30 days;
    currentState = State.AWAITING_FUNDS;
}

function deposit() public onlyBuyer payable {
    require(currentState == State.AWAITING_FUNDS);
    uint256 amount = msg.value;
    deposits[seller] = deposits[seller] + amount;
    currentState = State.AWAITING_CLAIM;
}

function claim () public onlySeller {
    require(currentState == State.AWAITING_CLAIM);
    currentState = State.CLAIM;
}

function confirm () public onlyBuyer {
    uint256 payment = deposits[seller];
    deposits[seller] = 0;
    seller.transfer(payment);
    currentState = State.COMPLETE;
}

function cancelPayement () public onlySeller  {
    uint256 payment = deposits[seller];
    deposits[seller] = 0;
    buyer.transfer(payment);
    currentState = State.COMPLETE;
}

function release() public{

        // funds cannot be retrieved before release day
        require (agreementDay < block.timestamp);
        uint256 payment = deposits[seller];
        deposits[seller] = 0;
        buyer.transfer(payment);
        revert('funds returned');
    }
}


texts: Serious problem! web3j-android EckeyPair returning Private Key length of 63 characters, not 64

texts:
So this is a pretty huge problem I've run into once before:

I'm using web3j-android and I'm going through the process of generating random private keys and public keys using the ECKeyPair class

Now I know private keys are generally supposed to be random 64 length strings but every once in a while (it's happened twice in around ~200 tests) I'll get this:

Note the sillyness here for 2 reasons:

1 - The key is triple verified as you can see in the logs, to be 63 characters

2 - a a 40 char length public address is still produced, which is weird because if it my private key was 63 characters how can that happen?

I consider this a serious error because if that were to happen silently and I were to trust it as good, there would be no way for me to sign transactions at all, much less import the wallet, the private key would be invalid.  And the ether I would send to the public address would be lost forever.

The sinister part is that this all seems to check out as valid, at first glance.  The key is only off by 1 char. I only happened to notice it as I was playing with the character counter on android studio's IDE.

I could run a check to make sure that the string produced is 64 char, but my overarching question is why does this happen to begin with?


texts: I want to create some usdt translation function by ethers.js but I cannot find the testing usdt on rinkeby. Just test code purpose.


texts: quorum-maker-no web UI is exposing on any host ports after creating nodes

texts:
Im trying to deploy contract using quorum-maker, I've followed every step as mentioned in wiki, but still not able to connect web UI and have no idea where Web app is deployed(in wiki. http://10.50.0.2:22004).
BTW I'm trying on GCP instance and AWS instance also. here is my docker ps status.


texts: How do the nodes of Ethereum discover each other? Can there be a risk of centralisation or control over the discovery protocol or bootstrap nodes by few people in the network?


texts: Difference between ethereum blockchain and Hyperledger blockchian

texts:
I have found the answers for this question, but still not getting proper answers, that's why I am posting it here for going into dive deeper.

I just came to know that Hyperledger in permissioned network while Ethereum is public. But I am not getting proper idea about the consensus mechanism inside both the blockchains. May be consensus mechanism makes more sense to understand the difference between them.

Can anyone have any proper explanation or updated reference link for that ?


texts:
Using web3j is possibile get network ID using the following method:

// Contract ABI Load
const ABISimpleStorage = require("./build/contracts/SimpleStorage.json");

// Besu Connection Web3 Load
let web3 = new Web3(
  new Web3.providers.WebsocketProvider("ws://127.0.0.1:8546")
);
    const netID = await web3.eth.net.getId();

How we could do same thing in ethers.js?

const ABISimpleStorage = require("./build/contracts/SimpleStorage.json");
let provider = new ethers.providers.JsonRpcProvider();

let contract = new ethers.Contract(
  ABISimpleStorage.networks["2020"].address,
  ABISimpleStorage.abi,
  provider
);

Thanks


texts: Turnkey/White-label solution for custom ERC20 token wallet GUI

texts:
I've created a token and I feel Ethereum's Wallet/Mist is too cumbersome for my users, as well as Parity. I don't want to guide my users step-by-step into watching my contracts, I want to give them everything harcoded and preconfigured.

I want a web app or an Electron executable that will display token balance as well as functions (allowances, transfers, etc.) and events. If it includes its own Ethereum client that would be ideal.

If there are no good contenders, is there anything close?

Thanks!


texts: Transaction to deploy a contract still pending?

texts:
I made a sample smart contract and wanted to deploy it.
I used mist wallet to do that and everything seems to be ok except the transaction is still in "pending" mode.

Can you hightlight common practices for deploying a smart contract and common issues?


texts: How a consensus algorithm is implemented in a private Blockchain network ( ethereum )?

texts: How to implement a new custom consensus algorithm in a network.


texts:
I am working on dapp with web3js 1.0.0.37-beta with reactjs.
I got blank in web3.eth.getAccounts. Following is my code

App.js

import React, {Component} from 'react';
import '../node_modules/bootstrap/dist/css/bootstrap.min.css';
import web3 from './web3.js';
import voting from './voting.js';
import './App.css';

class App extends Component {
  constructor(){
    super();
    this.state = {
     account: '',

  }
}

componentDidMount = async () =>  {
    const accounts = await web3.eth.getAccounts();
    console.log(accounts[0]);
}

web3.js

import Web3 from 'web3';
const web3 = new Web3(window.web3.currentProvider);
export default web3;

voting.js

import web3 from './web3';

const address = "0xd278D619eBca4583bc9923F0ac0043525CD08bA8";

const abi = [.......];

export default web3.eth.contract(abi, address);

I got error in console

Please help me.


texts:
i am trying to deploy my contract to testnet using the following :

Web3 = require('web3')

solc = require('solc')

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

code = fs.readFileSync('testVote.sol').toString()

contract = solc.compile(code)

abi = contract.contracts['Voting'].interface

code = contract.contracts['Voting'].bytecode

TestContract = web3.eth.contract(abi)

deployedContract = TestContract .new({data: code, from: web3.eth.accounts[0], gas: 4700000})

contractInstance = TestContract .at(deployedContract.address)
deployedContract.address

but the address is always undefined, why is it not getting mined? I am using geth


texts:
The function caller() below does not return any value

pragma solidity ^0.4.18;

contract M2M{

    function setvalues(uint a ,uint b) returns (uint){
        return a;
    }

    function caller() public returns (uint) {
      return  setvalues({b:90,a:45});
    }
}


texts: How do i create smart contract backed by a physical object?

texts: I want to crowdfund a real estate Project on Ethereum blockchain (smart contracts) by creating my own token( Its a small scale Project) with the token holders gaining rental income plus any capital appreciation. What would be the simplest way to go for this? all suggestions are greatly appreciated. Thank you in advance.


texts: Efficiently convert address to truncated uint128?

texts:
Say I have the following address:

0x9dd1e8169e76a9226b07ab9f85cc20a5e1ed44dd

I can use this function to convert it to a bytes

function toBytes(address a) public constant returns (bytes b){
    assembly{
      let m := mload(0x40)
      mstore(add(m,20),xor(0x140000000000000000000000000000000000000000,a))   //20 bytes in an address
      mstore(0x40,add(m,52))
      b := m
    }
  }

It works great!

However, how can I just get the last 128 bits of the address and return a uint128?

e.g. this type of function signature:

function toUint128(address a) public constant returns (uint128 u){
    assembly{
      let m := mload(0x40)
      //what goes here??
      //??
      //??
      //mstore(add(m,20),xor(0x140000000000000000000000000000000000000000,a))
      //mstore(0x40,add(m,52))
      u := m
    }
  }

And I want the uint128 equivalent of "0x9dd1e8169e76a9226b07ab9f85cc20a5e1ed", where the last 4 hex chars ("44dd", 32 bits) are removed. This is a 160 bit number minus 32 bits = a 128 bit number.

Edit:

This is actually quite simple, all you have to do is:

uint160 x=uint160(myAddress);


texts: Generating child smart contracts from a parent smart contract

texts:
Let's say that we have a parent smart contract which functions as a blueprint for a business marketplace which covers various use cases and each use case is defined in this parent smart contract, e.g. Pizzaria use case and its associated functionality/parameters. However, there might be more than one Pizzaria company part of the marketplace, so different parameters might be needed such as price etc.

How would one go about generating child smart contracts from a parent smart contract with different parameters?


texts: Speed of syncing the chain in parity using archive pruning mode

texts:
I am using parity v1.7.0-beta-5f2cabd-20170727 and I sync with ethereum chain in archive mode in order to keep all states of smart contracts. The command i use to launch parity is

parity --pruning archive

Due to the chain size I recently moved the location of the parity db for the ethereum chain from my computer's internal ssd to an external hdd. Subsequent to that i found myself unable to catchup with the chain when i launch parity (I switched off my computer a few days ago before i go on hols a few days ago). Although the client successfully connects to peers and proceeds with the syncing, the rate at which it is able to aqcuire blocks is pretty much the same as the rate at which blocks effectively get mined so as a consequence i am always "behind".

So therefore my questions are the following

1) what are the drivers for the speed of the syncing in archive mode in parity ? Is that CPU ? Disk (hdd vs ssd) ? Memory (I also tried increasing the cache size to 4GB but it did not help) ? Network (i have a fast connection and it was sufficient until recently) ?

2) Could my move from ssd to hdd be the cause of this performance drop ? In the past i had no problem catching up so that's a new problem for me.

3) Alternatively does there exists things like "checkpoints" of the full chain which i could download directly from a trusted source (like parity tech themselves perhaps) ?

4) Perhaps orthogonal to the question itself but what i need is the Events logs recorded by Smart Contracts when they are executed. Is it really necessary for me to keep the full states when i sync the chain in order to get those ?

5) assuming the issue is with the I/O of the drive. Is there a way for me to keep the bulk of the chain db on a slow drive (like external hdd) while using my ssd only for performing the syncing of recent blocks only (like the last 100000 would be enough for my purpose) ?

Thanks very much in advance for your insights!


texts: Is testrpc loading my parity ropsten accounts?

texts: I'm not sure I understand how testrpc accounts work.


texts:
I am getting an error when trying to sign data with web3 and metamask

signed_data = myWeb3.eth.sign("hello", web3.eth.accounts[0])

web3.eth.accounts[0] is populated with my account number in string form

Results in error:

Uncaught Error: invalid address
    at c (inpage.js:1)
    at inpage.js:1
    at Array.map (<anonymous>)
    at o.formatInput (inpage.js:1)
    at o.toPayload (inpage.js:1)
    at n.e [as sign] (inpage.js:1)
    at test.html:12


texts: how users interact with deployed smart contract in ethereum wallet/Mist browser?

texts:
What is the next step after contract  deployment in ethereum wallet?

i have implemented crypto currency using this tutorial.
link to tutorial

and successfully deployed.

How this contract will use outside Mist browser or other people? Like in browser or need to develop like app by using other tools? . Please suggest? I am very new to this block chain.


texts: Do I have to over/underclock for mining?

texts:
I have RX480 and RX580. Two GPUs together giving stable 23,4Mh each.
I'm using linux so clocking them will require playing with bios which I'm bit afraid to do.

Can I run them like that, without any modification for a long period ?
I prefer stability over high hashrate now.

Thank you


texts:
I am able to deposit eth into this contract using the remoteAdd() function, and I can confirm that the eth has been added by using the getBalance() function. However, I am unable to withdraw the contract balance to msg.sender using the withdraw() function. Could someone please help me out, thanks!

pragma solidity 0.5.1;

contract tictactoe {

    //Making explicit all the variables
    uint256 public playerCount;
    uint public betAmount;
    uint public totalBets;
    mapping(uint => Player) public player;
    address owner;

    //This is the state of the game
    enum State { Waiting, InProgress, Finished }
    State public state;

    //You can only send requests to the original contract address
    modifier onlyOwner() {
        require(msg.sender == owner);
        _;
    }

    //This is the structure of a player
    struct Player {
        uint _id;
        uint _betAmount;
        address _owner;
    }

    constructor() public {
        owner = msg.sender;
        state = State.Waiting;
        playerCount = 0;
    }

    function remoteAdd() public payable {
        require(msg.value >= 0);
        incrementCount();
        betAmount = msg.value;
        owner = msg.sender;
        player[playerCount] = Player(playerCount, betAmount, owner);
        totalBets += betAmount;
    }

    function () external payable{
        remoteAdd();
    }

    //See how much ether the contract is currently holding
    function getBalance() public view returns(uint){
        return totalBets;
    }

    //Function that increases player count
    function incrementCount() internal {
        playerCount += 1;
    }

    //Function that signals the start of the game once two players have
    //placed bets.
    function beginGame() public {
        require(playerCount == 2);
        state = State.InProgress;
    }

    function endGame() public {
        require(state == State.InProgress);
        state = State.Finished;
    }

    function payout() public returns (bool success){
       require(state == State.Finished);
       msg.sender.transfer(totalBets);
       msg.sender.call.value(totalBets).gas(7000)("");
       return true;
    }

    function withdraw() public {
        uint bal = address(this).balance;
        msg.sender.transfer(bal);
    }

}


texts:
To access any function of contract, we use : contractInstance.functionname.sendtransaction() or contractInstance.functionname.call()
Is it possible to call it as : contractInstance[functionname].sendtransaction() or contractInstance["functionname"].call()?


texts:
The following link describes some of how the function web3.eth.filter(...) works:

https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethfilter

What I would like to do is get a list of the transaction objects of all transactions happening to one account. Currently I have the following code:

var options = {
  fromBlock: "pending",
  toBlock: "latest",
  address: "0xab1323fe3234234234fa34324324234af3423432",
};
var filter = web3.eth.filter(options);

filter.watch(function(error, result){
  if (!error)
    console.log(result);
});

Question:

Is the previous code doing what I want? This is what I want it to do:

Whenever the App starts running, so does geth and all the blocks that are added to the blockchain start getting filtered, and when a match for the address in the options object is found, it saves that log. though I'm not sure if it's whenever that address is found either being sent to or if it's when it is the sender.
I don't want any blocks to be skipped. But the previous javascript code then has to be applied to geth, and in order for that to happen, geth must be running before the filter is applied, so doesn't that mean some of the blocks are skipped before the filter is applied?

EDITED:

I went to the website https://etherscan.io/txs?block=4067373

and with that information choose the following address (third in line) to test on:

0x25f000254108a104A7127B5a5697cb3C12643e62

And the following code was tested:

var options = {
  fromBlock: 4067373,
  toBlock: 4067373,
  address: "0x25f000254108a104A7127B5a5697cb3C12643e62",
};
var filter = web3.eth.filter(options);

filter.get(function(error, result){
  if (!error)
    console.log(JSON.stringify(result, null, 2));
});

I also did another test with the options object being:

var options = {
  fromBlock: 4067372,
  toBlock: 4067374,
  address: "0x25f000254108a104A7127B5a5697cb3C12643e62",
};

In both cases, the result was an empty array:

[]

Question:

Is there anything being done wrong above? I expected to get some values in the result array and I don't know why it is empty.


texts: Zero knowledge contingent payment on etherum?

texts: I know that bitcoin supports Zero knowledge contingent payment (ZKCP) , can etherum support such ZKCP Payment ?


texts: Load another deployed contract's public values

texts:
pragma solidity ^0.4.24;

I'm trying to call another contract's functions to return values.

I have the below which successfully returns a true/false

_childAddress.call(bytes4(keccak256("isValidChild(uint256, uint256)")), _childModule6, 6) == true)

But when I try to return an actual value like so:

uint256 tokenId = _childAddress.call(bytes4(keccak256("totalSupply()")));

I get the following error:

Type bool is not implicitly convertible to expected type uint256.
tokenId

I can't find the syntax anywhere for returning a value.

Any help appreciated.


texts:
What's the correct definition of Decentralized Applications? Some, like https://dappsforbeginners.wordpress.com/tutorials/your-first-dapp
points the two layer architecture (web/front layer and the ledger), but others (http://cdn.oreillystatic.com/oreilly/booksamplers/9781491924549_sampler.pdf) focus on 4 main features (open source, internal cryptocurrency, consensus and no central point of failure).
May I say a true Dapp is a two layer app (frontend + ledger) following all the four principles?


texts:
I currently have a local chain with Ganache. Say I have two contracts written in Solidity:
Foo_v0_0_1.sol
Bar_v0_0_1.sol

In the code for my smart contract Foo_v0_0_1, I have the following:
import "./Bar_v0_0_1.sol";

Bar_v0_0_1 private _bar;

...

function callBar() external {
    _bar.func(msg.sender); // <-- EXECUTION FAILS HERE
}

I deploy these contracts and attempt the callBar RPC call. This transaction fails on the internal call to the _bar contract. I open this transaction with truffle debug <tx_hash>, and step to the line where the transaction fails. When I print out the state and local variables, I see this in the output:
Contract variables:
    _bar: 0x0000000000000000000000000000000000000000 of unknown class

My question: Why is this variable coming up as all zeroes? Is it an issue with how I deployed my contracts? Is it an issue with the truffle debugger not being able to correctly find the contract?
Any insight is greatly appreciated.


texts: Are transactions on one chain automatically broadcasted to other chains?

texts:
I know how to split but I'd like to know if, technically, all transactions on the Ethereum chain are automatically broadcasted on the "Ethereum Classic" chain and vice-versa or if replay "attacks" have to be specifically made by someone.

The one transaction I did to test it out, without using any splitter contract, was nearly instantly carried out on both chain. It was moreover valid on both chain, so the transaction happened on both chain (which was fine: it was just a test, with adresses I control).

So my question is: are all transactions automatically broadcasted to both chains and, for each chain, only those who are valid executed, or are there bots automatically replaying some (or all) the transactions?


texts: I'm using Truffle (Webpack Box) and watching events on the front end. I'm having to design around ensuring I do not initiate watching for events more than once. Is there a best practice on how to do this? Is there a quick way to tell if an event is already being watched?


texts: Transaction does not trigger a Solidity revert statement.↵

texts:
When I make a transaction on Ropsten from Metamask, Metamask throws a StatusError after 2 minutes:

{
  message: "Transaction: 0xedceb98a6fa59803022bc688bef7546034d… does not trigger a Solidity `revert` statement.↵",
  stack: "Error: Transaction: 0xedceb98a6fa59803022bc688bef7…gaeaoehlefnkodbefgpgknn/scripts/inpage.js:1:84270",
  name: "StatusError",
  tx: "0xedceb98a6fa59803022bc688bef7546034d06e00150a9eef276ca771202b4505",
  receipt: {…}
}

Thanks in advance


texts: Error transferring balance. Runs out of gas

texts:
This is probably a simple problem to fix, but it is very frustrating.

I am developing in Solidity using Remix 0.5.10.

I have a loan contract that collects funds from borrowers. I now want to collect those funds and pass them through to the portfolio which owns those loans. The code is as follows:

        function passThrough() payable public
        {
        address(portfolio).transfer(address(this).balance);
        }

The error I get is:

**Gas Estimation Fail**
Gas estimation errored with the following message (see below).
The transaction execution will likely fail. Do you want to force sending?
Internal JSON-RPC error.

If I do press Send Anyway, I get the following error:

I would have thought that gas will just be taken from the amount sent correct? Or do I need to reduce the amount snet by the estimated amount of gas explicitly?

@Ismael: Regarding your question, yes Portfolio is a contract and it has a fallback function which is as follows:

function () payable external {
    // fallback function to receive funds
    received = msg.value;
    availableFunds += received;
    } // function () payable external {

After trying Ismael's suggestion, I have changed the call as follows:

    address(portfolio).call.gas(100000).value(address(this).balance);

I also tried:

    address(portfolio).call.value(address(this).balance).gas(100000)("");

Neither worked. They do not throw up an error, however, for some reason the funds are not transferred. Now I am really confused. I understand the point about not enough gas, but with that solved and the transaction completing succesfully, why is the value not also sent? I did check to make sure that there was a balance to send, by the way!

I really appreciate your feedback. Thanks.


texts: Contract is sent and gets an address, but eth.getCode returns 0x

texts:
I'm trying to deploy a contract on a private blockchain network.
My solidity code has a lot of variables used in it.
The deployment does give me a contract address, however, when trying to retrieve the bytecode from eth.getCode()(by passing the contract address which was generated from the transaction receipt), it returns 0x.

I tried increasing the gas limit in the solidity browser and created the contract. The contract does get created, however, the functions in the code does not return any value (i.e. it is not writing any data to the block). I assume, this boils down to the insufficient gas problem. The question is, how/where do i increase the gas? Why isnt my gasEstimate giving a proper estimate sufficient enough to execute the contract?

if anyone had a similar issue and found a solution for this, please help.

Thanks,
Jacob

Below given is the format in which the code is written. However, it does have much more get and set functions and 2 more structs used. Around 20 variables in each struct. The code when put into the solidity compiler shows 20404 bytes and when created use 4689378 amount of gas.

 pragma solidity ^0.4.0;
contract ABC{
        uint i;
        uint rowCount = 0;
        User userObj;

 function ABC() {}
        struct User{
            uint rowCount;
            string id;
            string ABCData;
            string DEFData;
            ......
            ......
            ......
            around 20 variables.
    }

     mapping(uint => User) ABClist;
    function setABCData(string uid,string ABCData,string DEFData,........) {

        rowCount = rowCount + 1;
        ABClist[rowCount].rowCount = rowCount;
        ABClist[rowCount].id = uid;
        ABClist[rowCount].ABCData = ABCData;
        ABClist[rowCount].DEFData = DEFData;
        ...........
        ...........
        ...........
        ...........

    }

        function getABCData(string uid) constant returns ( string _id, string _ABCData, string _DEFData, ........)
    {
        uint rowNumber;
        for(i = 0; i <=rowCount; i++){
            if(stringsEqual(ABClist[i].id, uid) || stringsEqual(ABClist[i].ABCData, uid) || stringsEqual(ABClist[i].DEFData, uid)){
                userObj.id = ABClist[i].id;
                userObj.ABCData = ABClist[i].ABCData;
                userObj.DEFData = ABClist[i].DEFData;
                rowNumber = i;
            }
        }
        return (userObj.id, userObj.ABCData, userObj.DEFData, rowNumber);
    }

    }


texts: why does it not work if I don't handle the return value of call/callcode/delegatecall？

texts:
This is my Contract code :

pragma solidity ^0.4.15;

contract D {
  uint public n;
  address public sender;
  event CallStatus(bool);

  function callSetN(address _e, uint _n) {
    if (!_e.call.gas(500000)(bytes4(sha3("setN(uint256)")), _n)) {
        CallStatus(false);
    } else {
        CallStatus(true);
    }// E's storage is set, D is not modified
  }
  function callSetN2(address _e, uint _n) {
      _e.call.gas(500000)(bytes4(sha3("setN(uint256)")), _n);
  }

  function callcodeSetN(address _e, uint _n) {
    if (!_e.callcode.gas(500000)(bytes4(sha3("setN(uint256)")), _n)) {
        CallStatus(false);
    } else {
        CallStatus(true);
    }// D's storage is set, E is not modified
  }

  function delegatecallSetN(address _e, uint _n) {
    if (!_e.delegatecall.gas(500000)(bytes4(sha3("setN(uint256)")), _n)) {
        CallStatus(false);
    } else {
        CallStatus(true);
    }// D's storage is set, E is not modified
  }
}

contract E {
  uint public n;
  address public sender;

  function setN(uint _n) {
    n = _n;
    sender = msg.sender;
    // msg.sender is D if invoked by D's callcodeSetN. None of E's storage is updated
    // msg.sender is C if invoked by C.foo(). None of E's storage is updated
  }
}

the execute environment is web3 provider connected to my geth private chain, when I use the default environment javascript VM, callsetN2 works fine.

when i call callSetN function using parameter ("0xe143a6ecbe6374463485664aecda3d0f0a6590d6", 10), I can get right number n from E contract. then I call callSetN2 function using parameter ("0xe143a6ecbe6374463485664aecda3d0f0a6590d6", 11), I can't get right number n from E, it's still 10 not 11. why does this happen? I tried to debug the callSetN2 function,

it should execute sstore opcode, but when I step on, the pc goes to D's contract, instead 257 of E's code.

this confuses me. Can someone tell me why?


texts: Remix Ethereum: Sorry, We are unable to locate this TxnHash

texts:
I want to deploy a contract, a very simple ECR20 standard. Im using Remix/solidity and when I test with the Ropsten test network it works well. I'm using MetaMask
I then tried to deploy to the main network keeping the suggested gas fee on Metamask (like 60 gewi or so) and it didn't go through. I tried any gas fee from very low to very high... no success even waiting 5 days.. nothing, still the same message "Sorry, We are unable to locate this TxnHas" despite Remix generates the hash
is anything wrong with my setup? see pic


texts:
I'm having difficulty coming up with suitable logic to handle a hot-wallet style deposit/withdraw system where funds that are deposited have to be sent out to any number of different addresses. This seems to be common place for exchanges or any other centralised system.

I've implemented this already for Bitcoin and that's rather easy to generate new addresses, get users to send coins to a central wallet, then sending out to any other wallet. This is easy due to Bitcoin's multiple input/outputs. This is proving to be a bigger challenge than I thought with Ethereum's single input and single output.

From my understanding it's not possible to have multiple addresses for a single account, since the account is the address. So the only option I'm left with is making deposit addresses as new accounts for every user that generates an address.

This is the major issue I'm facing. The funds that got deposited are now split over an unknown number of addresses/accounts. I've noticed that exchanges like Poloniex have a single main ETH account (which can be seen on etherscan).

So my main question is: How can I create different addresses and have the funds sent to a single address for full control?


texts:
I use the Geth framework and Swift 4 to boot a node inside an iOS 11.0 app. This node connects to my local BKC (to 4 nodes to be precise).

Here are some tests I made :

if I start 3 computer nodes and start mining, the 4th computer node will sync on start
if I start all my nodes (computer and app) and start mining on a computer node, each node will notice it and sync
if I start all my computer nodes and start mining and then I boot a fresh new app node, the app node won't sync (even if he connects without any issue to computer nodes)
if I start my app node with Rinkeby genesis and bootnodes, it will sync after a few seconds

So, I probably missed something but I don't understand why my app node syncs with Rinkeby and not with my private blockchain.

I'm using a static-nodes.json file to connect all my nodes together (computer and app).

I start my computer nodes with :
geth --datadir <datadir> --port <port> --networkid <id> --v5disc --lightserv <int> console.

I use a custom genesis file. The admin.peers method confirms me that all my nodes connect to each other without any issue. And I use the GethSetVerbosity(9) to display trace and debug in my Xcode console.

Any idea ?


texts: Managing ERC-20 tokens in a corporate setting

texts: What are my options for managing large quantities ERC-20 tokens in a more corporate manner. In particular multi-sig and disaster recovery. I like the features in Mist/EW, but do these multi-sig and withdrawl limits work for tokens too?


texts: How do I fix Truffle deployment not working on struct array: "components found but type is not tuple; report on GitHub."?

texts:
I wrote the following, which compiles in truffle just fine, but will not deploy. I get the error "components found but type is not tuple; report on GitHub." Am I doing something wrong appending to a struct array?

pragma solidity ^0.5.0;

contract Sandbox {

  struct Leader {
    address host;
    uint fitness;
  }

  Leader[] public myList;

  function append(uint value) public {
    Leader memory leader = Leader(msg.sender, value);
    myList.push(leader);
  }

}


texts:
The Yellow Paper states:

  These are four so-called ‘precompiled’ contracts, meant as a
  preliminary piece of architecture that may later become native
  extensions. The four contracts in addresses 1, 2, 3 and 4 execute the
  elliptic curve public key recovery function, the SHA2 256-bit hash
  scheme, the RIPEMD 160-bit hash scheme and the identity function
  respectively.

What's a precompiled contract and how are they different from native opcodes?  If a precompiled contract becomes a native extension, what does it gain?  Given widespread usage of SHA2-256, why wasn't it implemented natively?


texts:
i deploy tokens in private net. If i deploy tokens in offical net, how people buy tokens? If they send ether on contract address, they will receives tokens?

For example function buy

function buy() payable {
    uint amount = msg.value / buyPrice;                // calculates the amount
    if (balanceOf[this] < amount) throw;               // checks if it has enough to sell
    balanceOf[msg.sender] += amount;                   // adds the amount to buyer's balance
    balanceOf[this] -= amount;                         // subtracts amount from seller's balance
    Transfer(this, msg.sender, amount);                // execute an event reflecting the change
}

If have payable, people can buy tokens through the wallet, for example myetherwallet?


texts: REMIX:This contract does not implement all functions and thus cannot be created

texts:
What should I do?

pragma solidity ^0.4.21;
contract ScoreInterface {
         function hit() public;
         function score() public view returns (uint);
}

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


texts: What's the difference between the Parity-Ethereum and the Parity client?

texts: If you open https://etherscan.io/nodetracker you can see that the second most prevalent Ethereum client is Parity-Ethereum followed by Parity. What is the difference between these two client types?


texts:
I am just looking for the prices for the ENS. Can anyone help me understand the economics of ENS domain, their price depends on the fluctuations of Ethereum and if we assume that it'll always go up then the very simple thing like domain registering would be impossible to purchase in ENS(Currently it is 348$ to register a domain).
How onboarding of new users which is really important for the adoption of any technology will become with this pricing?
How ethereum developers/team is thinking of tackling this problem?
Also, are there any solutions ongoing for the high gas issue too?
I am really intrigued by this whole decentralized technology that is why I am trying to learn as much as I can. Any literature directions to read are also welcome.


texts: For my project I created vesting contract. The contract codes and vesting contract codes are same with MATIC token contracts but in my vesting contract there is wrong. https://etherscan.io/address/0xcbfe11b78c2e6cb25c6eda2c6ff46cd4755c8fca#readContract . If you check this link there is owner and token. It is true but in my vesting contract both owner and token are same which is main wallet adress. I entered wrong thing for token. I wrote main adress for _token but it must be TOKEN contract adress. Now can we change this or upgrade this.


texts: OpenZeppelin contract not working on Kovan testnet

texts:
I created a simple smart contract using OpenZeppelin and deployed the contract to the Kovan testnet. However, when I send KEth to the contract using MetaMask, nothing happens (I believe the buyTokens function is not being called). Using EtherScan, the contract address balance is just incremented with the amount sent and new tokens are not being minted.

When I tested the same contract on a local network, everything worked as expected, i.e. I sent ETH to the contract and received tokens. Could you please help me figure out the issue?

The Kovan transaction hash is: 0x2f5473270df1a9f4bf9f6f8934740518d292fe3003f79f9a4fb06618ad94b6a0

Here is the contract:

pragma solidity 0.5.2;

import "openzeppelin-solidity/contracts/crowdsale/Crowdsale.sol";
import "openzeppelin-solidity/contracts/crowdsale/validation/TimedCrowdsale.sol";
import "openzeppelin-solidity/contracts/crowdsale/validation/CappedCrowdsale.sol";
import "openzeppelin-solidity/contracts/crowdsale/emission/MintedCrowdsale.sol";
import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol";

contract TestCrowdsale is Crowdsale, TimedCrowdsale, CappedCrowdsale, MintedCrowdsale {

  constructor(
    uint256 rate,
    address payable wallet,
    IERC20 token,
    uint256 openingTime,
    uint256 closingTime,
    uint256 cap
    )

    Crowdsale(rate, wallet, token)
    TimedCrowdsale(openingTime, closingTime)
    CappedCrowdsale(cap)

    public
    {

    }
}


texts: Who pays for the gas when i send a transaction containing a signed transaction of another user

texts:
I would love it if there was a way for me to pay the gas costs for a signed transaction I receive and then relay to a node.
So I am the submitting the transaction, but its data contains a signed raw transaction (ethereumjs-tx) of a different user.


texts: Problems with transferFrom within a contract

texts:
I am playing around with this repo, more exactly with the ERC20ContinuousToken.sol contract. I am able to successfully run the truffle tests after connecting the project to Ganache, so I know that everything is fine with the repo.

When I'm testing out things in python however, I'm getting an annoying error. Here is part of my code:

acc0 = web3.eth.accounts[0]

txargs0 = {"from": acc0 }

erc20contract = web3.eth.contract(
address=tx_receipt.contractAddress,
abi=erc20_abi,
)

continuous_contract = web3.eth.contract(
address=tx_receipt.contractAddress,
abi=continuous_abi,
)

continuous_addr = tx_receipt["contractAddress"]

erc20contract.functions.approve(acc1, web3.toWei(4,'ether')).transact(txargs0)

print(web3.fromWei(erc20contract.functions.allowance(acc0, continuous_addr).call(txargs0),'ether'))

continuous_contract.functions.mint(web3.toWei(2,'ether')).transact(txargs0)

The last line of the code is throwing an ValueError and I have no idea why:

ValueError: {'message': 'VM Exception while processing transaction: revert Invalid inputs.', 'code': -32000, 'data': {'stack': 'RuntimeError: VM Exception while processing transaction: revert Invalid inputs.\n    at Function.RuntimeError.fromResults (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/utils/runtimeerror.js:89:13)\n    at module.exports (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/utils/gas/guestimation.js:142:32)', 'name': 'RuntimeError'}}

The mint function of the ERC20ContinuousToken contract requires uses transferFrom and requires an approval. The weird thing is that the repos tests also use the mint function and it works.

Within the ERC20ContinuousToken.test.js file we have these two lines:

await this.reserveToken.approve(this.continuousToken.address, depositAmount, { from: A });
const result = await this.continuousToken.mint(depositAmount, { from: A });

This part of the test passes. My python code, which does the same thing, returns an error. Can anyone help me figure out whats wrong with the python code?


texts: What's the difference between proof of stake and proof of work?

texts: The Ethereum frontier network currently uses a proof of work (PoW) consensus algorithm, while a future version of the network plans to utilise a proof of stake (PoS) algorithm instead.  What's the difference between these two types of algorithm?


texts:
I'm new here and try to make my own token. I kinda made it actually, but fee for it is very big(cheapest one is 0.65 eth). Here's my code:

pragma solidity ^0.4.13;

library SafeMath {
  function mul(uint256 a, uint256 b) internal constant returns (uint256) {
    uint256 c = a * b;
    assert(a == 0 || c / a == b);
    return c;
  }

  function div(uint256 a, uint256 b) internal constant returns (uint256) {
    uint256 c = a / b;
    return c;
  }

  function sub(uint256 a, uint256 b) internal constant returns (uint256) {
    assert(b <= a);
    return a - b;
  }

  function add(uint256 a, uint256 b) internal constant returns (uint256) {
    uint256 c = a + b;
    assert(c >= a);
    return c;
  }
}

contract owned {
    address public owner;

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

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

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

contract MuviGen is owned {

    using SafeMath for uint256;

    uint public _totalSupply = 0;
    string public constant symbol = "MUVI";
    string public constant name = "Muvi";
    uint8 public constant decimals = 18;
    uint256 public constant RATE = 1000000000000000000000;
    uint256 public constant maxTokens = 1000000000000000000000000000;

    mapping(address => uint256) balances;
    mapping(address => mapping(address => uint256)) allowed;

    function () payable {
        createTokens();
    }

    function MuviGen() {
        balances[owner] = balances[owner].add(100000000000000000000000000);
        _totalSupply = _totalSupply.add(100000000000000000000000000);
    }

    function createTokens() payable {
        require(msg.value > 0);
        uint256 tokens = msg.value.mul(RATE);
        require(_totalSupply.add(tokens) <= maxTokens);
        balances[msg.sender] = balances[msg.sender].add(tokens);
        _totalSupply = _totalSupply.add(tokens);
        owner.transfer(msg.value);
    }

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

    function balanceOf(address _owner) constant returns(uint256 balance) {
        return balances[_owner];
    }

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

    function transferFrom(address _from, address _to, uint256 _value) returns(bool success) {
        require(allowed[_from][msg.sender] >= _value && balances[_from] >= _value && _value > 0);
        balances[_from] = balances[_from].sub(_value);
        balances[_to] = balances[_from].add(_value);
        allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
        Transfer(_from, _to, _value);
        return true;
    }

    function approve(address _spender, uint256 _value) returns(bool success) {
        allowed[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
        return true;
    }

    function allowance(address _owner, address _spender) constant returns(uint256 remaining) {
        return allowed[_owner][_spender];
    }

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

}

Can you please help an tell me what am I doing wrong? Maybe I need somehow change gas price or something like that? Tnx in advance


texts:
In the geth console:

eth.sign(eth.accounts[0],web3.sha3('yesyesyall'))

Returns: "0x6df4a058e304c2e42032e6b812e268f4d4d4006698f41a2345ed88a161b00e52176b333fb5945dc02e860a4e9c29351eccba19316a82bf86530b977d4629efcf1c"

How do I verify that was signed by eth.accounts[0]?  Everything I see online mentions contracts.


texts: Can't see GPU when starting with rc.local (Linux)

texts:
I'm mining ethereum on my Linux Mint mining rig with the claymore miner. I can manually launch my miner with the command line but if I try to start the miner with /etc/init.d/rc.local then I get the following error in my log file.

  No AMD OPENCL or NVIDIA CUDA GPUs found, exit

Any ideas why my miner mines just mine when manually launched but it can't see the GPU when launched through rc.local? Thanks.


texts:
What's the purpose of such a call to this stub?
contract Sacrifice {
    constructor(address payable _recipient) payable {
        selfdestruct(_recipient);
    }
}

Usage:
if (_token == address(0)) {
    if (!_to.send(_amount)) {
            (new Sacrifice).value(_amount)(_to);
}

Compiler error:
CompileError: /token/contracts/EasyStaking.sol:313:17: TypeError: Member "call" not found or not visible after argument-dependent lookup in function (address payable) payable returns (contract Sacrifice). Did you intend to call the function?
                (new Sacrifice).call(_amount)(_to);
                ^------------------^

Fixed it with this:
        if (_token == address(0)) {
            if (!_to.send(_amount)) { // solium-disable-line security/no-send
                (new Sacrifice){value: _amount}(_to);
            }
        }