texts: Why is the frequency of new block header pow-hash on mining pools much higher than the average network block frequency?

texts:
I recently got back into mining on the ethereum network and experimented with a couple of mining pools in the process.
One thing I immediately noticed when taking a look at the log from the mining software (Phoenixminer), is that the amount of "new jobs"/ "new work" received from the mining pool has drastically increased since I stopped mining back in 2017.
The new work package from the pool (requested by "eth_getWork" or pushed from the pool) contains the current block header pow-hash (AKA "work") that is used by the miner to find a valid solution.
I don't understand why this hash would change more frequent, than the average time it takes, that a new block is found on a network-wide scale...
I remember receiving much fewer new jobs from the pool back in 2017. I have not done an in-depth analysis of the current status, but just looking at the terminal, it seems I'm getting  a new job more than once per second. With an average block-time of ~13 seconds this seems way too fast.
Follow-up question: Would this high rate of "job-switching" not increase the amount of stale shares submitted on a higher latency connection (especially on rental platforms)?


texts: Parity PoA chain not receiving transactions


texts: Can't recompile old "Block King" solidity contract

texts:
I've been trying to compile and analyze the so-called "Block King" contract, which can be found on Etherscan. However, I can't find a way to run the compiler which is claimed to have produced the EVM code currently on the blockchain, namely version v0.2.1-2016-02-10-7b5d96c.
I have tried to specify this version in the remix IDE but nothing happends when I try to compile it.
I also haven't found a way to get the corresponding version of solc.

Any recent version of solc (rightly, it seems) screams warnings and errors at this contract. Is there any hope to be able to compile it again?


texts: web3 py - transact call with struct parameter

texts:
I am trying to call a smart constract function with the following abi with pragma experimental ABIEncoderV2:
        "constant": false,
        "inputs": [
            {
                "name": "blockNumber",
                "type": "uint256"
            },
            {
                "name": "data",
                "type": "bytes"
            },
            {
                "name": "tokenNum",
                "type": "uint256"
            }
        ],
        "name": "execute",
        "outputs": [],
        "payable": false,
        "stateMutability": "nonpayable",
        "type": "function"

The data parameter is a struct with the following definition in solidity
struct InputParams {
        address addressFirst;
        address addressSecond;
        uint256 tokenAmount;
    }

How can I encode the data on the python side?  I am getting error
Could not identify the intended function with name `execute`, positional argument(s) of type `(<class 'int'>, <class 'list'>, <class 'int'>)` and keyword argument(s) of type `{}`. Found 1 function(s) with the name `execute`: ['execute(uint256,bytes,uint256)']
I think I need to convert the python list into 'bytes' type, but how do I specify in the bytes that necessary datatypes of the struct?


texts: How to make API calls to AWS Managed Blockchain using Nethereum?

texts:
I am testing AWS Ethereum (Preview) using Nethereum and I see this method to get a block:
var block = await web3.Eth.Blocks.GetBlockNumber.SendRequestAsync();

However, the AWS Ehtereum documentation says:

Ethereum on Managed Blockchain (Preview) only supports the
eth_sendRawTransaction method, which requires that you create and sign
the transaction before sending it to the node.

I believe to sign the transaction with Nethereum, you do this:
var signer = new EthereumMessageSigner();
var encoded = signer.EncodeUTF8AndSign(msg1, new EthECKey(privateKey));
var txId = await web3.Eth.Transactions.SendRawTransaction.SendRequestAsync("0x" + encoded);

So my question is, how would I call the "GetBlockNumber" while signing the transaction?


texts: Truffle Test Error for Hello World method

texts:
I am trying a very simple test in truffle using javascript.
This is the solidity method I have
function helloWorld() public view returns (string memory){
    return "hello world";
}

And I test it with the following javascript function
it("Hello World",async function(){
    let helloworld = await certificates.methods.helloWorld().call({from: user_1}, function(error, result){});
    console.log(" " + helloworld);
    expect(helloworld).to.be.equal("hello world");
 });

When I run the test the "helloWorld()" invocation throws the following exception:
Hello World:
Error: Returned error: VM Exception while processing transaction: revert
I have no idea how to make it work.....


texts: Are eth transactions still replayed on the etc chain?

texts:
I have read about EIP 155. I see that the main chain, test nets, and ETC were asked to implement EIP 155. If just ETH implemented EIP 155, wouldn't that have been enough to prevent ETC from being replayed and visa versa?

Second, if one is running the latest version of parity (1.5.3), has EIP 155 been implemented on both chains and splitter contracts no longer needed?


texts: Calling multiple smart contracts -- how deep can it go?

texts:
How many nested calls can an Ethereum transaction do?

Can Smart Contract A call Smart Contract B, then Smart Contract C and so on with only one call through Smart Contract A, and is there a limit to this chain of calls?


texts: Sign message with Metamask and verify with ethereumjs-utils

texts:
Client side:

web3.eth.sign(address, hash); // generates signature

Server side:

const ethutils = require('ethereumjs-util');

const extractAddress = function(signature, hash){ //signature and hash from the client side
  const o = ethutils.fromRpcSig(signature);
  const hashBuffer = ethutils.toBuffer(hash);
  const publicKeyBuffer = ethutils.ecrecover(hashBuffer, o.v, o.r, o.s);
  const publicKeyHex = ethutils.bufferToHex(publicKeyBuffer);
  const addressBuffer = ethutils.pubToAddress(publicKeyHex);
  const addressHex = ethutils.bufferToHex(addressBuffer);
  return addressHex;
}

Addresses don't match. The code worked before (a couple of months ago).

Relevant discussions https://github.com/ethereumjs/ethereumjs-util/pull/67


texts:
is it possible to keep versioning in IPFS?

Like im saving one row of record like

pid:1, mid:3, status: started --> v1

pid:1, mid:3 status;completed --> v1.1

is there any way to implement this in IPFS or swarm or any decentralised data storage?

is it possible to acheive versioning by the help of IPNS?

Regards
Mani


texts: Do you have to leave geth --rpc running forever or once it's synced you stop it?

texts:
if are supposed to stop it at some point, what is correct way and when do you need to run it again?

thanks


texts:
I'm trying to implement a binary tree in solidity.

struct BTree{
  uint x;
  BTree lesser;
  BTree greater;
  bool    nil;
}

Just realized that this is not possible as struct definition can't be recursive.
Is there any work around possible to achieve my goal?


texts: Solidity: Randomness from the dapp frontend

texts:
I have a JS function that generates a random number that is inserted into the web3js function as a parameter. I have the following questions:

1) Is it possible for people to decode that input parameter and see the number?

2) Is it possible to interfere with the JS script and inject a false number (though it will be failed, cause it verifies the number with the one stored on Ethereum).

3) What would be the safest way to generate a random number in the frontend and pass it to Ethereum?


texts: When we are searching to update the balance on ethereum we got this link Click here. But now in our server the latest block number is above 1900000 but till now we didn't get update the balance. When we look at the ethereum.io website it shows 2300000 on transaction. so please explain how it works and when it will update?


texts: Classification of the information flows and protocols within the Ethereum platform

texts:
I've been attempting to classify the information flows and protocols within the Ethereum system. To do this, I extended the OSI model to include 4 extra layers: consensus (the algorithm by which consensus is achieved amoungst computers), user interface, social, and governance.

The below is an intial effort based, in part, on this answer.

| Layer        | Ethereum Blockchain Protocols                               |
------------------------------------------------------------------------------

| Governance   | EIP process, Influencer announcements and social consensus  |

| Social       | Github, Reddit, SE, Slack, Word of Mouth etc                |

| UX/UI        | Geth, Parity, PyEthApp, Mist                                |

| Consensus    | Block derivation and PoW (Yellow Paper)                     |

| Application  | Kademlia, RPC, IPC                                          |

| Presentation | AES, ECDSA                                                  |

| Session      |                                                             |

| Transport    | DevP2P, RLPx, TCP                                           |

| Network      | As public internet                                          |

| Data Link    | As public internet                                          |

| Physical     | As public internet                                          |

Are there any ommisions or incorrect entries?

Does something like this already exist?

Would you change the upper 4 layers?

What other ways of doing it are there?


texts:
I get the error below when starting my PoA network. I have no idea what defines a bucket list. Has anyone more details?

  DEBUG[06-01|10:58:47] Found seed node in database
  id=ed8b3be93192299f addr=35.197.215.1 21:30311 age=42m41.092986442s
  DEBUG[06-01|10:58:47] IP exceeds bucket limit
  ip=35.197.215.121 DEBUG[06-01|10:58:47] IP exceeds bucket limit
  ip=35.197.215.121 DEBUG[06-01|10:58:47] Found seed node in database
  id=a332d3b08042bf20 addr=35.197.215.1 21:30312 age=42m39.093013259s
  DEBUG[06-01|10:58:47] IP exceeds bucket limit
  ip=35.197.215.121 DEBUG[06-01|10:58:47] IP exceeds bucket limit
  ip=35.197.215.121 DEBUG[06-01|10:58:47] Found seed node in database
  id=9d0c4f3a797807ae addr=35.197.215.1 21:30315 age=42m44.093043253s
  DEBUG[06-01|10:58:47] IP exceeds bucket limit
  ip=35.197.215.121 DEBUG[06-01|10:58:47] IP exceeds bucket limit


texts: The project is there for 2 years, is still under development. I'm wondering if it's mature enough to use.


texts:
I have been looking at already built and in progress dapps and some of ones that have been built have their contracts addresses listed that then can be used to check the earnings on etherscan.io

Most of the apps however do not have it linked in dapps.ethercasts.com,

Is there a way to get contract address from dapp name?


texts:
I know signed transaction got v=37.
now I am wondering how 'v=37' is used to check that the transaction is right one.
nodes check v of every transaction they received?


texts:
I was trying to create a simple quote registry having a mapping defined as:

mapping (string => quoteOwner) quoteRegistry;

where quoteOwner structure is:

struct quoteOwner{
    address ownerAdd;
    bool hasOwner;
}

I did extend typical owned contract and I identified that contract owner's address went on changing as soon as I called functions like register_quote.

The code I was using initially was:

quoteOwner new_owner;
new_owner.ownerAdd=msg.sender;
new_owner.hasOwner=true;
quoteRegistry[_quote]=new_owner;

and I figured out,the line new_owner.ownerAdd=msg.sender; was causing the issue.
As soon as I changed the above to simple assignment:

quoteRegistry[_quote]=quoteOwner(msg.sender,true);

Everything is working perfectly fine! Can anyone help with what is wrong with the former method?


texts: How to create ethreum wallet using WEB3j

texts: I want to create my own Ethereum wallet,how can I do that and is it necessary to run GETH or similar to use wallet.It will be helpful if any good reference can be provided as I am very much new to it


texts:
Im trying to store data directly on the blockchain, not on a smartcountract as they have a limit of what they can handle and it would slow down the chain to go above the limit.
My initial plan is to use mapping but I can't find confirmation if mapping uses available space on the chain or in the smartcontract.
If mapping does store on the smartcontract what functionality can I use to store data directly on the blockchain?


texts:
Objective:

user A wants to keep some data safe (encrypted) in contract;
user B can access A's data only if A does not prevent access

Idea:

user B can claim access by entering a key previously given by A on the contact platform.
The contract asks A if the information can be release to B each time B claims access.
A has a certain period (i.e. N days) to stop information release.
Failing to stop the release or denying access after the given period, data are opened (decrypted) and accessible to B.

Question :

Does such contract or service already exists in blockchain ?


texts:
I'm trying to create a token contract using openzeppelin. I managed to create the token using the ownable contract from ownable.sol, which let me transfer the ownership of the token contract.

However, I need to transfer the token contract ownership to a crowdsale contract. I'm wondering if there is a way to reclaim/transfer the token contract ownership to another address.

Here's at a glance what I'm trying to do.

Token contract created [solved]
Crowdsale contract created [solved]
Token contract ownership transferred to the crowdsale contract address [solved]
Transfer the Token contract ownership to another address. [NEED SOLUTION]

Any suggestion?


texts: Equivalent to OP_RETURN? Want to write string to be visible on blockchain

texts:
On the bitcoin blockchain, you can write a string as an OP_RETURN value and then when the block is seen on a block explorer, you see the string.

I want to do the same thing.  I want to write a string to a private Ethereum blockchain.

Can anyone suggest a way?

Another way to ask: how would you propose to a girl on the Ethereum blockchain?

EDIT: I no longer believe this needs re-opening.  I agree that I literally posted the same question twice.


texts:
Community,

I've been banging my head over the following problem and hope you can spot my mistake. I deploy the following contract with Populus on Testrpc. This is pretty simple contract:

pragma solidity ^0.4.19;

contract ICO {
    address public owner;
    mapping(address => uint) public balances;
    address[] public buyers;

    uint constant public MULTIPLIER = 1000;

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

    function getBuyersLength() public constant returns (uint) {
        return buyers.length;
    }

    function buy() public payable {
        uint coins = msg.value * MULTIPLIER;
        balances[msg.sender] += coins;
        buyers.push(msg.sender);
    }
}

I am calling the buy function with Web3js in the following way:

let contract;
let account;

window.addEventListener('load', function () {
    if (typeof web3 !== 'undefined') {
        console.log('Using MetaMask connection');
        w3 = new Web3(web3.currentProvider);
    } else {
        w3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
    }

    contract = w3.eth.contract(contractABI).at(contractAddress);
    account = w3.eth.defaultAccount;

    main()

});

function main() {
    let amount = w3.toWei(10, 'ether');
    contract.buy({'value': amount}, function (err, res) {
        if (err) {
            console.error('Error occurred: ' + err);
        } else {
            console.log('Transaction created: ' + res);
        }
    })
}

After waiting for the transaction to be included in a block (happens almost instantaneously since I run testrpc, I call the getBuyersLength() function like this:

function updateBalances() {
    contract.getBuyersLength(function (err, res) {
        if (err) {
            console.error('Error in getBuyers: ' + err);
        } else {
            console.log('Count of Buyers: ' + res);
        }
    }
}

However, the results is always 0, which means that the buyers.length stays the same. Can you spot a mistake I've made?


texts: is there a hardforked version of ubuntu ethereum ppa package?

texts: The ubuntu ppa still contains ETH classic.  Is there a ppa for the hard-forked version of Ethereum?


texts: Installing go-ethereum nodes using docker swarm?

texts:
Has anybody installed and configured go-ethereum nodes using dockerswarm ?
Appreciate if anybody could share any docs or relevant information.


texts: how to buy eth to my metamask 's wallet in private network?

texts: in the metamask i am using the private network - Localhost 8545 for the development, however in the private network, my wallet is empty eth, how would i buy some fake eth for the testing?


texts: What is the equivalent of Metamask in production?

texts:
I have used Metamask in test but what can I use for production? Users will not have a metamask extension and we cannot expect them to install it.

What is the standard way to check the account balance of the sender of the message to the contract and also confirm the private/public keys for the user of the contract?

This would be something like MEW in terms of actual processing of the security aspects.


texts: Is there a project that can swap ETH and BTC using atomic swaps without having to deal with wrapped tokens like WBTC?

texts: Is there a project that lets one do an atomic swap from ETH to Bitcoin or Litecoin or Monero without having to deal with wrapped tokens like WBTC(wrapped btc)? Basically a cross chain swap, without the need to deposit BTC to some service to produce a wrapped token and then swap to ETH.


texts: How does Ethereum prevents a node from mining a block with tempered transaction?

texts:
My question is rather simple, and I found this question in the Bitcoin StackExchange that somehow relates to mine, although, for the Bitcoin Blockchain, which I'm not sure if Ethereum solves the problem the same way.

Let's say I have a mining node, and for the sake of exampling, I have 1 Ether under my pkey. What prevents me from trying to mine a block in which I spend 2 Ether? At what point in the process is the balance of my address checked to make sure I do have enough Ether? Is it after I mine the block and then broadcast it to other nodes? Does it mean my mined block will become orphan after the other nodes validate that this particular transaction aint valid?

Will appreciate every help, reference.


texts: I am creating an news app which will show the ICO and Airdrop details. Is there is any API for Airdrop news ?


texts:
I see decentralization vs disintermediation used interchangeably.

I see decentralization as technically inclined while disintermediation as business inclined.

Any other subtle differences between these 2 terms/concepts?


texts: How to implement the "unique address per customer" design pattern, often used with Bitcoin?

texts:
With Bitcoin, it works because of the joinable UTXO's , like this:

Generate a key pair for each customer, and associate the public address with
the customer id.
Receive payments from multiple customers, simply identified by the addresses.
Periodically spend the total amount to offline wallet, with a single
transaction.

You can accumulate hundreds of payments in a simple and economical way.

How to implement this with Ethereum?

Note: identifying customers by their sending address is not an option for multiple reasons.

Note: if the answer is resolved to be "It's not feasible", the follow-up question would be, "What is the best alternative?".


texts:
i'm trying to test a crowdsale with a already existing token with fixed supply. I have my token already in place and everything is working just fine if i used the account to transfer my tokens but i can not attached to a crowdsale, for token i used the ERC20 standard , maybe i missed something.

my token is something like where StandardToken is the pattern from https://github.com/OpenZeppelin/zeppelin-solidity/tree/master/contracts/token :

contract INOToken is StandardToken, Ownable {

string public constant name = "test";
string public constant symbol = "WOX";
uint8  public constant decimals = 18;

functionINOToken() public {
    totalSupply = 300 * 10**6  *  10**18;
    balances[owner] = totalSupply; // put all the tokens on the owner
                                   // address
}

function getTotalSupply() public view returns (uint256) {
    return totalSupply;
  }
}

in this point, token is deployed and is working fine.

Next, i have a very simple contract for simulations of a crowdsale, but i can not use the already existing token, i tried with using an interface and using the token address. What i'm missing, thanks a lot for your help.

 interface token {
     function balanceOf(address who) public constant returns (uint256);
     function transfer(address to, uint256 value) public returns (bool);
     function getTotalSupply() public view returns (uint256);
 }

contract INOCoinBaseCrowdsale {
   using SafeMath for uint256;

  // The token being sold
  token public tokenReward;

  //commented version
  // INOCoinToken public tokenReward;

  // address where funds are collected
  address public wallet;

  address public tokenAddress;

  // amount of raised money in wei
  uint256 public weiRaised;

  //  crowdsale limit
  uint256 public constant CROWDSALE_LIMIT = 1 * (10 ** 6) * (10 ** 18);

  event INOCoinTokenPurchase(address indexed purchaser, address indexed
                       beneficiary, uint256 value, uint256 amount);

  function INOCoinBaseCrowdsale(address _wallet, address _tokens) public{
         require(_wallet != address(0));
         tokenAddress = _tokens;
         tokenReward = token(tokenAddress);
         wallet = _wallet;
   }

  // fallback function can be used to buy tokens
  function () public payable {
      buyTokens(msg.sender);
  }

  // low level token purchase function
  function buyTokens(address beneficiary) public payable {
       require(beneficiary != address(0));
       require(validPurchase());

       uint256 weiAmount = msg.value;

       // calculate token to be substracted
       uint256 tokens = computeTokens(weiAmount);

       require(isWithinCrowdsaleLimit(tokens));

       // update state
       weiRaised = weiRaised.add(weiAmount);

      // send tokens to beneficiary
      tokenReward.transfer(beneficiary, tokens);

      INOCoinTokenPurchase(msg.sender, beneficiary, weiAmount, tokens);

     forwardFunds();
 }

  // send ether to the fund collection wallet
  function forwardFunds() internal {
      wallet.transfer(msg.value);
  }

 // @return true if the transaction can buy tokens
 function validPurchase() internal view returns (bool) {
     return msg.value != 0;
  }

 function isWithinCrowdsaleLimit(uint256 _tokens) internal view returns
     (bool) {
    uint256 soldAmount =
    tokenReward.getTotalSupply().sub(tokenReward.balanceOf(tokenAddress));

    uint256 soldAmountAfterTransfer = soldAmount.add(_tokens);

    return soldAmountAfterTransfer <= CROWDSALE_LIMIT;
 }

function computeTokens(uint256 weiAmount) internal view returns (uint256) {
    uint256 appliedBonus = 0;

    return weiAmount.mul(30).mul(100 + appliedBonus);
  }
 }

Many thanks in advance


texts: What is a sealer and what is the difference between Ethhash, NoProof and BasicAuthority sealers?

texts:
Default sealer in cpp-ethereum is NoProof:

https://github.com/ethereum/cpp-ethereum/blob/43bae2c78e2a968ef4eb37bec2da4d9b85fa2392/libethcore/ChainOperationParams.h#L73

But I don't understand what is sealer in the first place, and what are differences between Ethhash, NoProof and BasicAuthority sealers.


texts:
To support Ethereum, I would like to run a Full node.
My Geth seems to be running correctly :

I see it on ethernodes.org
net.listening   returns TRUE
net.peerCount   returns a positive number

What's bothering me is that I haven't opened the 30303/30304 firewall ports... so I'm wondering if I'm really contributing to the network. I know I have to open the ports, but my question is: When I'll open them, how can I make sure that my full node is correctly configured and contributes to the network? What feedback can I have in the console that it's working?

To compare with Bitcoin, I'm running a full Bitcoin core node too, and I know I'm contributing because I have a debug info showing me "Number of connections In / Out". If "In" is 0, this means my firewall is not configured correctly.

Any other comments on how to check the Full Ethereum node is running and contributing correctly?

If you help me, you will have a new 7/7 24/24 node in the network :)


texts: Move ERC20 tokens from Ethereum Wallet Contract to Account

texts:
In my Ethereum wallet i am trying to access my wallet conract. If I sync in light mode and import the wallet contract address it just stays there displayed, greyed out and nothing happens, no matter which ethereum wallet/geth version combination I try.

Or if I download the full block chain it stops short at the last 100 blocks and never fully syncs.

Basically my wallet contact doesn't show up in any case :(

It contains all my ERC20 tokens and I can't access them.

I have tried many combinations of Geth and Ethereum wallet versions to get the desired effect, but to no use. Apparently this wallet import issue will be fixed in 0.12 but I can't wait that long.

Is there a way to use MEW to do this or some other online wallet?

Thanks in advance

Peter


texts: how can i fetch all the tokens from ethereum network to my wallet ?using web3js(nodejs) or web3j(java)?

texts: I'm trying to fetch all the available tokens from ethereum network into my android wallet but could not able to find an suitable solution other than web scrapping


texts: Web3JS sendTransaction to call function in contract

texts:
It is the first time I do this so I have no idea what I am doing !
I am trying to call a contract's function and post data to it, this contract will then create another contract. Here is my contract how my contract looks like:

contract MedicalStaffObject {
    using strings for *;
    event LogCreatedTrip(address);

    struct medicalStaffDetails {
       string phoneNumber;
       string physicalAddress;
    }

    medicalStaffDetails public details;
    address[] public trips;
    address public orgAddresses;

    function MedicalStaffObject (address orgAddress, string phoneNumber, string physicalAddress){
        details.phoneNumber = phoneNumber;
        details.physicalAddress = physicalAddress;
        orgAddresses = orgAddress;
    }

    function getDetails() public constant returns (string, string, address){
        return (details.phoneNumber, details.physicalAddress, orgAddresses);
    }

    function getTrips() public constant returns (address[]){
        return (trips);
    }

    function newTrip(address zone1, address zone2, address zone3, address zone4, bytes32 name, bytes32 startingDate, uint duration) public returns(address){
        TripObject newTrip = new TripObject(zone1, zone2, zone3, zone4, name, startingDate, duration);
        trips.push(newTrip);
        LogCreatedTrip(newTrip);
        return newTrip;
    }
}

And I am trying to call the function newTrip using this code in my NodeJS app:

 var web3 = new Web3();
    web3.setProvider(new web3.providers.HttpProvider(provider));
    var zonesTrimed = zones.slice(1, -1);
    var zonesArray = zonesTrimed.split(",");

    var contractAbi = web3.eth.contract(ethContracts.abiMedicalStaffObject);
    var myContract = contractAbi.at(address);
    // suppose you want to call a function named newTrip of myContract
    var getData = myContract.newTrip.getData(zonesArray[0], zonesArray[1], zonesArray[2], zonesArray[3], name, startDate, duration);
    //finally paas this data parameter to send Transaction
    web3.eth.sendTransaction({to:address, from:organisationWallet, data: getData});

However it just doesnt work and I keep getting this error:

Error: unknown account

First of all what does this error mean, does it mean it cann't find the 'to' or the 'from' account ? What I am supposed to put in there ?


texts: What is the best way to deploy and test smart contracts on multiple machines?

texts:
I have recently started developement on Ethereum and the concepts are pretty much new to me. I need to test event emitting/listening on multiple machines for my contract. For the same, I have tried creating a private network and adding peers. I have been stuck for a while now in submitting transactions to the network via a nodejs script. I had posted a question for that purpose Question 1, Question 2.

I am looking for another methods to do this thing. I have developed my contract on Truffle Suite. What is the an another alternate way to test these functionalities on multiple machines?

Thank you.


texts: How to debug contract in browser-solidity

texts:
contract users{
struct User{
    uint id;
    string str;
}
User [] public adds;
function del(){
    delete adds;
}
function delElem(uint i){
    delete adds[i];
}
function add(uint id,string cc){
    adds.push(User(id,cc));
}
function getLength()constant returns(uint){
    return adds.length;
}}

how to debug this contract in enter link description here, can breakpoint be valid?


texts: I'm trying to build a Dapp using Meteor and Ethereum, but I'm having trouble connecting Meteor to Ethereum testnet. How can I do that? and is it possible to do without using a client such as metamask?


texts: Parameters for making an ERC20 contract with 1 token (w/ OpenZeppelin)

texts:
Wrapping my head around totalSupply, decimals, wei, and ether is getting me very confused.

For the purposes of education, I'm trying to make an ERC20 token contract that is capped at only ONE token. My understanding is that, since Solidity doesn't deal with floating point numbers, by setting my decimals to 18, I actually have 1e18 "parts" to this "one token" of mine.

Please correct me if my understanding is wrong. But I'm going to keep going.

So I've been trying to follow this tutorial and it makes use of:

A token contract that inherits from MintableToken, and;
A crowdsale contract that inherits from TimedCrowdsale and MintedCrowdsale.

In order to change this to a capped supply token, I just made the token contract inherit from CappedToken instead, added the necessary constructor method, and initialized the cap amount on deployment.

The crowdsale contract takes a rate value, which I assume is how many tokens to return to the user for 1 wei.

There are basically 3 parameters at this point:

decimals = 18
rate = 1
cap = 1e18

I'm a bit confused at this point because I keep getting cryptic reverts when I try to send in 1 wei. Shouldn't 1 wei buy me 1 of my coins?


texts: I accidentally lost the key to my wallet

texts: So I recently formatted my drives again and wiped my hard drives. I mistakenly did not copy my Account key but I copied my password. Is there anyway to gain back my account?


texts: Given the current trend of Ethereum Network growth, is smart contract practical for long term usage/storage?

texts:
My question is actually three parts, (yes I know about the upcoming sharding development in progress):

It's free to access Ethereum Network data (we don't normally need the rest of the blockchain but we need to store everything to access a tiny part? where's the economic benefit to this? no miner reward... i know ipfs too btw)
Storing smart contracts and processing them etc may require higher cost (in gas) where the participating users need to be in a list of sorts (mapping). Is it economically viable to store all these and to process them even with gas involved in the long run? Because if I'm not mistaken, the current Ethereum node really do require SSD (yes it does full node.) to run on, and that can easily go into TBs of data in the near future. (Storage / processing pricing vs blockchain size processing... is Ethereum Network sustainable / viable for a very popular smart contract?)
How much data can we store in Ethereum Network again? Unlimited? From a single contract's point of view. I heard you can store as much data as long as it does not exceed 100GB. I understand the underlying backend db is leveldb... LEVELDB... 100GB? That's not going to be practical storage for IOT.

Please do only answer these if you are an advanced programmer of sorts. Thanks.


texts: Geth very slow mining in dev mode on windows

texts:
I'm having a very strange issue where mining using Geth on windows is very slow using in -dev mode.
I have never had that issue before as i usually use OSX but the DAG load normally then 1 block is mined every 10+ minutes. When trying to transact with a contract it takes very long aswell. It's just basic dev mode never touched the genesis block or anything.

Anyone got any resources/clue/anything to help me fix this ?

I've reinstalled Geth , deleted all my wallet and tried with a new one, rebooted and all the like it just doesn't seem to work.

what i'm using:

geth -dev --rpc --rpcport 8545 --rpcaddr localhost  --rpccorsdomain "*" -mine


texts:
Serpent was way to fetch Diesel prices from the oraclize api at fixed intervals.
On GitHub, it s written audits proved the code to be flawed, but where are such audits? I m meaning why is it flawed?


texts: How to get the full hex code that was used to create a smart contract, through solidity (another smart contract)

texts:
I have a use case where I want to whitelist some smart contracts in one Base contract.

The condition for whitelisting is that smart contract should have been deployed using the same code that was shared through my system.

Now, to validate this I want to get the entire hex-code that was used to deploy a smart contract, given that we just have the smart contract address.
I want to get this information through solidity so that it can be used in a different smart contract.

I tried to get the variable msg.data, during the contract deployment, but it seems like that does not give the full hex-code, rather it gives just the code for the executed function.


texts: How can I store multiple strings mapped to an address in Smart Contract (solidity)?

texts: I want to save multiple files in Ipfs and store its hashes mapped to an user address. I thought of having an array mapped to address and pushing to it, but does not seem to be the right approach. Please advise.


texts: Can smart contract reference its own state variables to make branching decisions?

texts:
I have to apologize for not being very familiar with solidity or the EVM ahead of time.

Say that in the contract there are several state variables, a, b, c.

It would seem like that if I wrote a function within the contract with logic that's something like,

if a > 5 then
  b = 3
else
  c = 2

then I run into a pretty big risk that depend on when this call is run, the function will branch into different sections because the contract call has no understanding for whether or not the value a that it is accessing has received enough confirmations for me to be confident that it won't produce unpredictable results. At one time when you run it, it could branch into b=3, at another later time it could branch into c=3 all depending on the ordering and which previous block won out.

Is this a valid concern? Is this allowed in smart contracts? Is there a way for me to elevate this type of branching logic into some sort of higher, application-level code to make sure that I do not produce temporarily different outcomes depending on which split second I queried it from a full node?

Thanks!


texts: How to be sure "Parity" is installed on Windows?

texts:
I installed Parity after downloading and running exe file from here : https://www.parity.io/

However, when I use following command to connect to Ropsten as follows :

parity db kill --chain ropsten

I receive following error :

C:\Users\s>parity db kill --chain ropsten
'parity' is not recognized as an internal or external command,
operable program or batch file.

What is missing ? and how can I connect to Ropsten ?

Note: Operating System is Windows 8.1.


texts:
I was going through the Create Your Own CryptoCurrency documentation and got stuck at the proofOfWork section. In this, they try to do a check i.e.

require(n >= bytes(difficulty)) //Check if its under difficulty

I wanted to understand, what kind of comparison is being done here?

Is is byte-to-byte comparison?
Is there some conversion happening before the check?
Or, its just a length check (which I think isn't the case, but just to be sure, I added it here).

If someone can point me to the right resource on the same.


texts: How to transfer ethereum from one account to another using address and password.?

texts:
I want to transfer ether from one account to another using Web3j. I have account address and password.

How to submit transaction?

EDIT 1:
I'm using this way to send the transaction:

HttpService httpService = new HttpService(envConfiguration.getTestnetkeyStorePath());
            Admin admin = Admin.build(httpService);

            PersonalUnlockAccount  credentials1 = admin.personalUnlockAccount(from, existingpassword).send();
            LOGGER.info("credentials  :"+credentials1.accountUnlocked());

            Transaction trx = Transaction.createEtherTransaction(from, nonce, gasprice, gaslimit, to, amount);
            EthSendTransaction ethSendTransaction = admin.personalSendTransaction(trx, existingpassword).send();
             transactionHash = ethSendTransaction.getTransactionHash();
            LOGGER.info("Transaction hash :"+transactionHash);

But I'm getting transaction hash as null, Don't know what is going wrong.?
ANy help.?
PS: Thanks in advance.


texts: How to get result from contract function called through web3 using sendTransaction

texts:
I use the following to call a solidity contract function in nodejs(v10.14.2) + web3(v0.20.7) + ganache(v1.2.3):

contract.getItemCount(function(err1,result1){
 console.log(result1);
}

result1(datatype BigNumber/uint256) do have the value returned from the contract function.

But sometimes i get out of gas error(ganache gas limit is 90000), I then used the following syntax:

contract.getItemCount.sendTransaction({gas: 200000},function(err1,result1){
 console.log(result1);
}

It executed(consumed 176424 gas) the function successfully. But result1 now has transaction hash as mentioned here. How should i get the result i.e., value returned by the contract function?


texts: Did f2pool manipulate transactions during the Status ICO?

texts:
Blocks such as this one and this one appear to show preferential treatment being given to f2pool transactions in blocks mined by f2pool during the beginning of the Status ICO (at block height 3903900).

Further details are being collected in this Reddit thread.

Is there a reasonable explanation for f2pool's block contents during the Status ICO, or does this constitute strong evidence of transaction manipulation and/or frontrunning?


texts: Layout of State Variables in Storage -> specifically NON Statically-sized variables e.g. Mapping

texts:
The following page provides information on how to access a contract's state variables, regardless of who the owner is or what methods are exposed.

http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage

I have been able to follow this for accessing statically sized variables (e.g. uint, address, etc) but can not follow the logic to implement this for others such as mappings and arrays using web3 JS library.

It says:

So for the following contract snippet:

contract C {
  struct s { uint a; uint b; }
  uint x;
  mapping(uint => mapping(uint => s)) data;
}
The position of data[4][9].b is at keccak256(uint256(9) . keccak256(uint256(4) .    uint256(1))) + 1.

I've tried to replicate this using web3.sha3() function but cant get it to work.


texts: How can I get the TxReceipt of a transaction with web3j?

texts:
How can I get the status of a transaction through the TxHash with web3j.

I tried it like this:

public int getEstado(String trx) {
    try {
        JSONObject json = readJsonFromUrl("https://api.infura.io/v1/jsonrpc/rinkeby/eth_getTransactionReceipt?params=[\"" + trx + "\"]");

        if (json.toString().contains("error")) {
            return -4;
        }

        String result = Parser.getMessageByKey(json.toString(), "status");
        int estado = Integer.decode(result);
        json = null;
        result = null;
        return estado;

    } catch (Exception ex) {
        return -4;
    }
}

In the end this did not work, so I wanted to know if you can guide me in another way to get the status of txHash.


texts: Out of gas transaction is included in the blockchain even if it is reversed?


texts:
In this particular scheme, we pass the address of the Attacker contract in Victim.foo.
By using delegatecall, we maintain the msg.sender field, but we are not using the storage of Storage but Attacker's.
Is the Victim contract vulnerable to an attack where the msg.sender field is maintained (here it would be Victim's address) and using the storage of Victim too?
contract Victim {
  uint some;
  function foo(address _contract) {
    // ....
    SomeInterface(_contract).changeStorage(10);
    //....
  }
}

contract Storage {
  uint value;
  function changeStorage(uint _value) {
    require(msg.sender == victim);
    value = _value;
  }
}

contract Attacker {

  function changeStorage(uint _value) {
     bytes memory data = 0x.. //abi-encoded changeStorage with some value
     execute(victim, data);
  }

  function execute(address _target, bytes memory _data) {
    (bool success,) = _target.delegatecall(_data);
  }
}


texts: Full Integration Testing smart contracts

texts: What is the most agile way to fully integration test smart contract code? I've seen people use shell, etc. Is there a golden standard somewhere?


texts: Time Specified calls in Solidity using Oraclize

texts:
I have started learning coding in Solidity and I have written the below contract using the official Oraclize guidelines.

My aim is to:

Make the update() function be called on its own on the specified time constraint in order to update the temperature measure.
Get a notification of the update every time it is being called (maybe email or by any other means on a text file)

How should I configure my code to achieve this result ?

    pragma solidity ^0.4.18;
    import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";

    contract WolframAlpha is usingOraclize {

    string public temperature;
    mapping(bytes32=>bool) validIds;
    event LogNewOraclizeQuery(string description);
    event newTemperatureMeasure(string temperature);

    function WolframAlpha() {
        update();
    }

    function __callback(bytes32 myid, string result) {
        require(validIds[myid] ==true);
        require(msg.sender == oraclize_cbAddress());
        temperature = result;
        newTemperatureMeasure(temperature);
        delete validIds[myid];
        // do something with the temperature measure..
    }

    function update() payable {
        if(oraclize_getPrice("WolframAlpha") > this.balance){
            LogNewOraclizeQuery("Oraclize query was NOT sent, please add some ETH to cover for the query fee");
        }
        else{
            LogNewOraclizeQuery("Oraclize query was sent, standing by for the answer..");
            bytes32 queryId = oraclize_query(60,"WolframAlpha","Temperature in London");
            validIds[queryId] =true;
        }
    }
}

FYI

I am using the online solidity compiler "Remix"
Deploying the
contract to ropsten testnet


texts:
I am new to geth command line for testnet in Windows. I got an error when trying to deploy this contract example

----------------------------------------------
source = "contract test { function multiply(uint a) returns(uint d) { return a * 7;} } ";

contract = eth.compile.solidity(source).test;

txhash = eth.sendTransaction({from: primary, data: contract.code});

eth.getBlock("pending", true).transactions;

miner.start(1); admin.sleepBlocks(1); miner.stop();

contractaddress = eth.getTransactionReceipt(txhash).contractAddress;

eth.getCode(contractaddress);

multiply7 = eth.contract(contract.info.abiDefinition).at(contractaddress);
fortytwo = multiply7.multiply.call(6);

I read similar questions, but did not help! most of the answers telling ignoring 'undefined' during compiling the code (the second command). But when i tried the third command i got this error

  TypeError: Cannot access member 'code' of undefined  at
  :1:52

Is there any solution?

Thanks


texts: How multi currency wallet gets connected to different blockchains?

texts:
How multi currency wallet is getting connected to different blockchains and how public and private key is managed in it?

If I want to develop multi currency wallet then how can I connect to different blockchains using different clients?


texts: We have a private network with geth 1.4.18 clients. We have 3 miners (each owned and managed by a different company) and a number of sync-only nodes. Now we would like to upgrade the network to 1.5.5. Since 1.5.5 includes the last hard fork, how do we smoothly switch the miners to the new consensus? Can we set a target block for the hard fork like it was done in the mainnet? Or do we have to simultaneously stop all nodes, upgrade and restart after all companies have upgraded?


texts:
I have two structs:

struct A{
    uint bid;
    mapping(uint => B[]) BMap; //bid - index for struct B

}

struct B{
    uint cid;
}

mapping(uint => A[]) AMap;

How can we push and fetch 'cid' in struct B?


texts:
I recently updated cpp-ethereum. I am now on ethminer version 1.2.3

when I start it to mine with ethminer --opencl-device 1 I get the folowing output.

Getting work package...
Segmentation fault: 11

What might be wrong. before the cpp-ethereum update it worked.


texts: Not able to successfully do transactions of default MetaCoins(from Truffle) on local testnet on MetaMask

texts:
I have installed truffle and ran the default contract provided by truffle.

I successfully compiled,migrate and put the default dapp on local testnet
http://localhost:8080/.I am able to see the dapp here.

I have also synced the metamask account with testrpc using
testrpc -m "mnemonics"

But when I try to send metacoins to one of the account address present in MetaMask ,I do not see any confirmation pop-up of Metamask to Accept/Reject Transaction.Neither does the transaction details shows up in Metamask window.
Though, whenever I try to send metacoins from http://localhost:8080 ,it suddenly displays message "Transaction Complete" without any confirmation or any coin amount deducted from main balance.

Truffle version : 3.4.6
npm version : 5.3.0
EthereumJS TestRPC v4.0.1

Attaching few screenshots too for your reference. Please help.


texts: Transaction out of gas but gas used less than gas limit

texts:
I have this method on a contract that I'm testing on rinkeby

function addMatch(string _name, uint _fixtureId, uint8 _home, uint8 away, uint _start) public onlyOwner returns (uint8) {
    require(_home < NUM_TEAMS && _away < NUM_TEAMS && _home != _away);
    require(_start >= now);
    Match memory newMatch = Match({
        home: _home,
        away: _away,
        fixtureId: uint2str(_fixtureId),
        winner: 0,
        start: _start,
        name: _name
    });
    uint8 matchId = uint8(matches.push(newMatch));
    string memory url = strConcat(
        "json(https://api.basketball-matches.org/[my api key]/",
        newMatch.fixtureId,
        ").[?(@.status=='FINISHED')].result[scoreHome,scoreAway]");
    bytes32 oraclizeId = oraclize_query(_start + QUERY_INTERVAL, "URL", url);
    oraclizeIds[oraclizeId] = matchId;
    emit MatchCreated(matchId);
    return matchId;
}

No matter how much I set the gas limit to the transaction still fails, however the gasUsed displayed on ether scan is less than the gasLimit (which I set to the limit of the network).
Does anyone have any idea what the issue might be. I'm using web3 and using infura through the truffle HDWallet provide.

Attempting to estimate the gas cost using web3 just throws an error. The error returned when I call this method on the blockchain is:

Error: Transaction ran out of gas. Please provide more gas:


texts: Passing ether through smart contract logic to address

texts:
I'm wanting to pass Ether through some smart contract logic then to some address set in the contract. Is this the possible, or the best way? Or should the ether be passed to contract and the receiver manually collect it?

Something like the code below:

contract Smartcontract{
    address owner;
    mapping (address => uint256) charge;

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

    function receiverSetPrice (uint256 _value) public{

        charge[msg.sender] = _value;
    }

    function sendether(address _to) public payable{
        require(msg.value >= charge[_to]);
        _to.transfer(msg.value);
    }
    function checkReceiverAmount(address _to) constant public returns (uint256){
        return charge[_to];
    }
}

The code is just so you get the rough idea.

I've noticed a problem with it complaining about gas usage.

What would be the best approach to this?


texts: Sending multiple transactions from different wallets to a single adress (Without smart contract)

texts:
Imagine the following scenario:

I have 10 wallets with 1 ETH each.
I want to send a 1 ETH transaction from each of these wallets to
0x0000000000000000000000000000000000000000

The solution "Use a smart contract" is not the solution I'm looking for.

Besides doing this manually, what tool would you use to achieve this as fast as possible?


texts: How long does Infura store a file on IPFS?

texts:
You can send files to Infura's IPFS servers but I don't know about the limits.

How long is it stored for?

What's the size limit?


texts: Denial of Service(DoS) and withdraw.pendingReturns[msg.sender]=0;

texts:
I am trying to understand the role of :
 withdraw.pendingReturns[msg.sender]=0;

in detecting denial of Service (DoS) vulnerability. The following paper  VeriSolid says that:

withdraw.pendingReturns[msg.sender]=0;  will eventually happen after
withdraw.msg.sender.transfer(amount);

how this can help us to detect DoS vulnerability because after ‘transfer’ we can’t execute anything so how this technique can help in determining DoS vulnerability.
However, in the following code
withdrawals[msg.sender].amount = 0; is done before transfer which is different as in the paper:
function withdraw() public {
   if(withdrawals[msg.sender].amount > 0
      uint amount = withdrawals[msg.sender].amount;
      withdrawals[msg.sender].amount = 0;
      msg.sender.transfer(amount);
   }
}

Can we use:
withdrawals[msg.sender].amount = 0;

after 'transfer' for determining DoS vulnerability?
Zulfi.


texts: Can I init mapping in solidity with pre-defined values?

texts:
f.e in Python:

mappingName = {
  'key1': 'value1',
  'key2': 'value2'
}

What are the best practices to achieve that?


texts: ENS is not finalizing my auction and I need to reopen it again and again

texts: I opened an auction and bidded. After that i revealed my bid. Unfortunately there is no option for finalizing the autcion, like in others. Instead after the RevealPeriod ends. ENS says I need to reopen and than shows me my bid from before. I have the issues with three auctions. Another strange thing is, that etherscan doesn't shows my bid , but ENS Registrar shows it... Can you help me?


texts: Is it possible to get the gas fee before sending an ETH?

texts:
Is there a way or api endpoint to calculate the gas fee before sending the ETH? My client requirements is to calculate the gas fee before sending an ETH to other user.
I can only get the gas price using blockcypher api.
Thank you


texts: How to Distribute token to multiple address

texts:
I'm writing a smart contract to distribute the created tokens to multiple address. Looking around on the web I may found what I was looking for but I don't know how to insert the addresses in the field; I tried in different ways but none worked. This is the function to distribute token ( Sorry, I do not know how to insert code into website):

function adminClaimAirdropMultiple(address[] _addresses, uint _amount) external {
    for (uint i = 0; i < _addresses.length; i++)
        doAirdrop(_addresses[i], _amount);
}

I tried to insert the addresses in these ways:

["0x0000000000000000000000000000000000000001",
 "0x0000000000000000000000000000000000000002",
 "0x0000000000000000000000000000000000000003"]

but no one worked. How can I solve this?


texts: What is the difference between approval and ownership in ERC721?

texts:
I saw the contract as getApproved and ownerOf functions. What is the difference between owning the token under ERC721 and having approval? When the tokenid is transferred does that transfer ownership or approval?

/**
 * @dev Gets the approved address for a token ID, or zero if no address set
 * Reverts if the token ID does not exist.
 * @param tokenId uint256 ID of the token to query the approval of
 * @return address currently approved for the given token ID
 */
function getApproved(uint256 tokenId) public view returns (address) {
    require(_exists(tokenId));
    return _tokenApprovals[tokenId];
}

/**
 * @dev Gets the owner of the specified token ID
 * @param tokenId uint256 ID of the token to query the owner of
 * @return address currently marked as the owner of the given token ID
 */
function ownerOf(uint256 tokenId) public view returns (address) {
    address owner = _tokenOwner[tokenId];
    require(owner != address(0));
    return owner;
}


texts: Repetitive validation through Modifier or function

texts:
What is the benefits from writing repetitive validation as functions instead of modifiers? The documentation clearly recommendations to use modifiers yet 'best practice' open source parties such as open zeppelin use functions some times to validate.

I found below in the general 'crowdsale.sol' contract by openZeppelin

 function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal {
    require(_beneficiary != address(0));
    require(_weiAmount != 0);
  }

The content of the function, why isn't it just moved to a modifier? is it cheaper to implement through function? what is the theory behind this decision.


texts:
I have some Truffle and Solidity produced ABI files that I am bundling with a JavaScript NPM package.

221.7kB esm5/lib/abi/IERC777.json

Currently, the ABI files include full details, like bytecode, as the files are used for unit testing, deployment and so on by Truffle itself. But the JavaScript based user interface package only needs abi function definitions themselves, nothing else.

How can I strip ABI files out from unnessary data and reduce the download size?


texts: Initializing fixed-size storage array given function parameter

texts:
I would like to store an array of fixed size in my contract storage, with a user-defined size, initialized to all 0s. Here's an example contract:
pragma solidity ^0.4.24;

contract Test {
    constructor(uint size) {
        uint[size] storage arr;
        for (uint i = 0; i < size; i++) { arr[i] = 0 }
    }
}

My problem arises when declaring the array; remix gives this error:
TypeError: Invalid array length, expected integer literal or constant expression.

One workaround would be to declare the array outside of a function, but that would require it to be a dynamic array with no immediately accessible elements, which I don't want.
Is it possible to initialize arrays of this type in a constructor at all, and if so, how?
What's the alternate way to do the same?


texts: How do I give a value to a token with a contract already deployed?

texts:
I made a token which have no value.
https://etherscan.io/token/0xd911993ae8948d19eab8822305485f8b300a6dec?a=0xb133b946f8134a2c4abbf939fc6e1ac035c776e9

I want to buy them all at a minimum price, how do I do that ?


texts: Is it possible to make the Parity software sync faster?

texts:
I start Parity software like so: parity -j

It takes a really long time to sync.

Is there any way to make it sync faster?


texts:
Etherscan says there is not enough ether, why? Arguments, which i enter => requestLoan(3,31,3) and after change account, provideGuarantee(0,3)

I have created dApp and how it looks in my code you can see here

this.etherAmount = 3;
await this.bankContract.methods.requestLoan(this.etherAmount, 31, 2).send({from: this.state.borrower}).then(res => console.log("Request loan " + res.status));
await this.bankContract.methods.provideGuarantee(0, 4).send({from: this.state.guarantor, gas: 40000, value: this.etherAmount}).then(res => console.log("Provide guarantee " + res.status));

Link to transaction => https://rinkeby.etherscan.io/tx/0xab31946f54cb86187dd517ff7c8ebc34730714a9717ee33a11ea22d54a31ed11

function requestLoan(uint etherBorrow, uint8 payBackDate, uint8
etherInterest) public
{
    Loan memory loan = Loan({loanee: msg.sender, index: loansCount, etherBorrow: etherBorrow,
                                    payBackDate: now + (payBackDate * 1 days), etherInterest: etherInterest,
                                    _isGuaranteeProvided: false, _isLoanProvided: false, _isLoanExist: true});
    loans[loansCount] = loan;
    loansCount++;
}

function provideGuarantee(uint index, uint8 guaranteeInterest) public payable // payable means that value should have ether
{
    require(
        index < loansCount,
        "This index does not exist");

    require(loans[index].loanee != msg.sender,
            "The borrower can't provide a guarantee to himself");

    require(lenders[index] != msg.sender,
            "The lender can't provide guarantee for the loan");

    require(!loans[index]._isGuaranteeProvided,
        "This loan already has a guarantee");

    require(guaranteesCount < loansCount || !guarantees[index]._isWaitingForHandling,
        "This guarantee already waiting for handling of borrower");

    require(guaranteeInterest > 0,
            "Too low interest");

    require(
        msg.value == loans[index].etherBorrow,
        "You don't have enough eather to provide guarantee");

    require(
        loans[index]._isLoanExist,
        "This loan does not exist");

    require(
        !guarantees[index]._isGuaranteeExist,
        "This guarantee does exist");

    Guarantee memory guarantee = Guarantee({guarantor: msg.sender, etherInterest: guaranteeInterest,
                                                loanIndex: index, _isWaitingForHandling: true, _isGuaranteeExist: true});
    guarantees[index] = guarantee;
    guaranteesCount++;
}


texts: What business cases can be made for using Ethereum as a platform?

texts:
I am not sure if this is the right place for a high level technology choice question. If not, please direct me to the appropriate forum.

Context
I am involved in a business that deals with payment processing, PCI compliant payment gateways, pre-paid cards, loyalty cards, point of sale, and other financial services aimed at small businesses.

Right now the architecture is a centralized Azure based set of APIs and clients.

I am in the process of researching Ethereum.

Ethereum technology questions
So far my understanding is that Ethereum does not itself bring a unique set of business benefits with it, apart from perhaps its own coolness factor and following. Am I right to perceive Ethereum as in essence an alternative platform to Azure and the various protocols used to communicate between clients and servers?

So for example, our pre-paid card payments could be implemented using multi-sig designs with a custom 'currency' in an Ethereum Dapp, and similarly with loyalty cards.  This would be an alternative architecture to running a centralized Azure hosted db+REST API+trust model.

Am I right to take the point of view that for our intents and purposes Ethereum is an alternative technology choice to some of Azure's IaaS and PaaS offerings, and that is all? The price/service comparison would be made on the basis of running costs and security risks?

Or am I missing the point to some extent? Does Ethereum bring more to the table in terms of extensibility or business use cases? For example, on Azure there is the Azure Marketplace for re-sale of multitenant apps.

In essence, what I am looking for is a reverse approach: what arguments would I be able to make to persuade the other stakeholders in the organization that moving to Ethereum for these financial services is a good idea for both the short and longer terms?


texts: Cannot able to call the contract inside the truffle console

texts:
I am new to the truffle framework. I have initialised my contract  Dapp with the constructor function as given below

pragma solidity ^0.5.0;

contract Dapp {
    uint public totalSupply;

    constructor() public {
        totalSupply = 1000000;
    }
}

and my migrations file in regards with the contract is

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

module.exports = function(deployer) {
  deployer.deploy(Dapp);
};

I have compiled and migrated using the command truffle compile and truffle migrate, which results in successful compilation.

But when accessing the contract in truffle console like

let instance = await Dapp.deployed()

It results in ReferenceError: Dapp is not defined, I cannot able to figure out what went wrong. Is there any possible solution to this. And yeah I have followed the latest Truffle documentaion.

Documentation link for migration and interacting with truffle console.

My Network is in development mode which is given below

networks: {
    development: {
     host: "127.0.0.1",     // Localhost (default: none)
     port: 7545,            // Standard Ethereum port (default: none)
     network_id: "*",       // Any network (default: none)
    },
}


texts: delegatecall method - calling context is not being set

texts:
We have an issue with delegatecall method.

We want to call contract C2 from C1 (which is supposed to be a pass through contract for the user wallet).  When we are calling C2 via C1 even using delegatecall or assembly instruction, the allowance of C1 is getting amended, but not that of the calling wallet.  Eventlogs are appended below the code.  Both delegatecallSetNum and delegatecallSetNumAssembly methods are behaving in an identical manner.

Code:

pragma solidity ^0.5.16;

contract C1 {

  uint public num;
  address public sender;

  function c2setNum(address _c2, uint _num) public{
      C2 c2 = C2(_c2);
      c2.setNum(_num);
  }
  function delegatecallSetNum(address c2, uint _num) public {
    c2.delegatecall(abi.encodeWithSignature("setNum(uint256)",_num));
  }

  function delegatecallSetNumAssembly(address c2, uint _num) public {

    address _target = c2;
    bytes memory _data = abi.encodeWithSignature("setNum(uint256)",_num);
    bytes32 response;

    // call contract in current context
    assembly {
        let succeeded := delegatecall(sub(gas, 500000), _target, add(_data, 0x20), mload(_data), 0, 32)
        response := mload(0)      // load delegatecall output
        switch iszero(succeeded)
        case 1 {
            // throw if delegatecall failed
            revert(0, 0)
        }
    }
  }

function getAddr1(address _c2) public view returns (address){
      C2 c2 = C2(_c2);
     return  c2.getAddr();
  }

}

contract C2 {
  uint public num;
  address public sender;

  event AddedValuesByDelegateCall(uint256 a, address addr, bool success);

  function setNum(uint256 _num) public {
    num = _num;
    sender = msg.sender;

    emit AddedValuesByDelegateCall(_num, msg.sender, true);
  }
    function getAddr() public view returns (address){

        return msg.sender;
    }
}

Kovan Deployment addresses:
C2 : 0xa1891c26352742Cc9d9E0ec3B34C3690D1dEB2E3
C1 : 0x2fC788e36B6B844c4B9a61804ee41fe6128A9901

Eventlog: https://kovan.etherscan.io/tx/0x36fd46c739cf556583f0ebec004d039808b758b0fb04efcad3684f57672ddb2e#eventlog


texts:
According to the JSON RPC docs, filters timeout when they aren't polled with eth_getFilterChanges for a period of time.

eth_getFilterChanges(ID) seems to return the same result {"jsonrpc"=>"2.0", "id"=>1, "result"=>[]} regardless of whether a filter with the supplied ID exists or not.

Thus, it seems that eth_getFilterChanges is ambiguous and we have no way of knowing whether the filter has timed out or if it simply doesn't contain  changes since the last poll.

I also checked the other filter related methods and didn't find any method that would allow to check the state (active or removed) of a filter.

How do we handle timeouts and what is the exact timeout period? How do we check the state of a filter? What am I missing?


texts: I created my first contract erc20, implement a mint function, the case is, if I copy the code json, I paste it in another wallet I can use the interface of the contract equally, although this is not the address that created the contract. So my question, if we could get the json of any token could we have access to its interface? Is it safe that nobody can access the json except the address that created the contract?


texts: How to deploy an owned token contract through Remix?

texts:
I have deployed a regular ERC20-compliant token contract through the Remix compiler and MetaMask. After doing so, the deployed token shows up on Etherscan as a token.  However, when I try to deploy a token contract that is owned, it requires me to deploy the token contract and the owner contract separately, resulting in two isolated contracts that are from the same source code.

I use the very simple contract code from the official Ethereum website:
https://ethereum.org/token#full-coin-code

Any help you be appreciated


texts: My Solidity files are not compiling and I am getting constant error

texts:
I'm new to blockchain and I'm following a tutorial. However, I'm getting problem compiling my first contract on Truffle.

Here's my code :

pragma solidity ^ 0.5.2;

contract ApprovalContract
{
    address public sender;
    address public receiver;
    address public constant approver = 0x6af7A9CFe4D4B938Ff4038Fd0625d18C5D671834;

function deposit(address payable _receiver) external payable{
    require(msg.value>0);
    sender = msg.sender;
    receiver = _receiver;
    }

    function viewApprover() external pure   returns(address)
        {
            return(approver);
        }

    function approve() external {
        require(msg.sender ==  approver);
        receiver.transfer(address(this).balance);
    }
}

Now while I try to compile my code through the terminal, this is the error I get.

  SyntaxError: Source file requires different compiler version (current
  compiler is 0.5.0+commit.1d4f565a.Emscripten.clang - note that nightly
  builds are considered to be strictly less than the released version
  pragma solidity ^ 0.5.2; ^----------------------^
  ,/C/Users/neonalliance/Desktop/Solidity/contracts/ApprovalContract.sol:22:3:
  TypeError: Member "transfer" not found or not visible after
  argument-dependent lookup in address.
                  receiver.transfer(address(this).balance);
                  ^---------------^

  Error: Truffle is currently using solc 0.5.0, but one or more of your
  contracts specify "pragma solidity ^ 0.5.2". Please update your
  truffle config or pragma statement(s). (See
  https://truffleframework.com/docs/truffle/reference/configuration#compiler-configuration
  for information on configuring Truffle to use a specific solc compiler
  version.)

I think the problem is due to some update or modifications in Solidity as the tutorial I am following is of 2017, but I cannot exactly figure out what I need to do.

So what could possible be the solution ?

Note: Since this is my first Blockchain Learning phase, I request you to please answer in a way I could possibly grasp the information.


texts: Signed message offline does not match public key

texts:
I'm trying to sign message with private key offline to prove private key ownership.

The issue is that when validating signed object public key from private address does not match output from recover function.

var Web3 = require('web3');
var web3 = new Web3(Web3.givenProvider || "ws://localhost:8546");

var address = '0x2394d939C761cC9bD6137B82bB9e017657509Afb',
    privateKey = '6ac2663692506980c50e239c300f2fefdac6bc95b0e9bdf8a9bd3f615c1ca726';

var signedObject = web3.eth.accounts.sign('Some data', privateKey);
console.log('Public key matches:', address == web3.eth.accounts.recover(signedObject));

This returns false. What am I missing?


texts: Can't send transaction -- "Exceeds block gas limit" or "Intrinsic gas too low"

texts:
I'm trying to send Ether using geth 1.3.5, like this:

eth.sendTransaction({
  from: eth.accounts[0],
  to:'0x[ADDRESS_HERE]',
  value: web3.toWei(5, "ether"),
  gas:21000
});`

And I'm getting "Exceeds block gas limit"

When I try:

with gas=5000 I get "Intrinsic gas too low"

Executing eth.getBlock("latest").gasLimit yields 5000.

Any ideas how to execute a transaction?  I synced the blockchain using --fast.  Any help appreciated!


texts: How does Quorum prevent double spending when states are encrypted?

texts: My understanding of Quorum is that private contracts have encrypted states hence I am confused as to how they reach consensus and prevent double spending. If each state is encrypted how can the nodes be sure a tx isn't double spent as the data is encrypted?


texts: Ether transferred to Receiver's account is not exact

texts:
I'm trying to transfer to send some ether from one account to another in a smart contract written in Solidity. The transfer is successful but the amount received is not exactly matching up with the amount transferred. There is a very minute difference, sometimes it is increasing and sometimes decreasing.

For Example -

received amount: 0.04999999999999716
Transferred amount: 0.05

Another example -

Received amount - 0.05000000000001137
Transferred amount -0.05

Is there anything I'm missing?

Solidity function which does the transfer -

function borrowBook(uint id) onlyMember payable{
    // Can't borrow book if passed value is not sufficient
    if (msg.value < 100){
        throw;
    }
    // Can't borrow a non-existent book
    if (id > numBooks || catalog[id].state != State.Available) {
        throw;
    }
    catalog[id].borrower = msg.sender;
    catalog[id].dateIssued = now;
    catalog[id].state = State.Borrowed;
    // 50% value is shared with the owner
    var owner_share = msg.value/2;
    if (!catalog[id].owner.send(owner_share)){
        throw;
    }
    Borrow(id, msg.sender, catalog[id].dateIssued);
}

Test case where I'm checking the balances of sender and receiver -

    it.only('should borrow book and transfer 50% weis to owner account', async function(){
        await lms.addBook('a', 'b', 'c');
        await lms.addMember('Michael Scofield', accounts[2]);
        // balance of owner and borrower's account before book borrow
        let ownerBal1 = web3.fromWei(web3.eth.getBalance(accounts[0]).valueOf());
        let borrowBal1 = web3.fromWei(web3.eth.getBalance(accounts[2]).valueOf());
        await lms.borrowBook(1, {from: accounts[2], value: web3.toWei(0.1)});
        // balance of owner and borrower's account after book borrow
        let ownerBal2 = web3.fromWei(web3.eth.getBalance(accounts[0]).valueOf());
        let borrowBal2 = web3.fromWei(web3.eth.getBalance(accounts[2]).valueOf());
        let contractBal = web3.fromWei(web3.eth.getBalance(lms.address).valueOf());
        // contract account get's 50% of the value
        assert.equal(contractBal, 0.05);
        // owner's account should get increased by approx 50% of sent value
        console.log(ownerBal2 - ownerBal1);
        console.log(0.05);
        console.log(borrowBal1-borrowBal2);
        assert.isAtMost(ownerBal2 - ownerBal1, 0.05);
        // borrower's account shoul d get decreased by atleat total sent value
        assert.isAtLeast(borrowBal1 - borrowBal2, 0.1);
    });


texts: creation ERC721 error: Transaction failed, invalid address,

texts:
I would like to learn how ERC721 token works. I found some sample contracts online and tried to use remix and Ethereum Wallet to deploy the contract. The compile was fine but failed in the creation.
The error message on remix is

  "creation ERC721 error: Transaction failed, invalid address. If you
  use an injected provider, please check it is properly unlocked".

Can anyone help me? what can I do to fix the problem? Thank you.


texts:
I called the mint function on a default coin to send some of my new coin to my METAMASK account but it looks like nothing was received. I can't tell what specifically could have gone wrong, so here's an image with all relevant information.

Thanks in advance for the help!


texts: How to correctly send Ether between contracts in vyper?

texts:
I have a user, Contract A, and Contract B.
I want user to call a function A of Contract A, that function executes function B from Contract B, which sends ether from Contract B to Contract A.

Here is my test:

let eco_fac = await ECOFactory.deployed()
let buyer = accounts[1]
let eco_address = await eco_fac.getEco(buyer)
let _eco = await ECO.at(eco_address)
let fund_or_exercise = await _eco.exercise({from: buyer})

Here is my exercise function of Contract A:

@public
@payable
def exercise() -> bool:
    if(msg.sender == self.seller):
        log.Error('Exercise Call must be from Buyer')
        return False
    if(msg.sender == self.buyer):
        """
        This is where cash dispersement is handled.
        ECO tx -> Vendor: withdraw(strike amount)
        ECO tx -> Vendee: deposit(strike amount)
        ECO tx -> Vendee: withdraw(spot amount)
        ECO tx -> Vendor: deposit(spot amount)
        ECO deactivated and completed
        return True
        """
        val: wei_value = as_wei_value(1, 'ether')
        log.Exercise(self.buyer, self, True)
        #elf.vendor.pay(val)
        self.vendor.withdraw(self.vendor, val)

        return self.vendor.authorizedEco(self.vendor, self)
    else:
        log.Error('Exercise attempt returns False')
        return False

Here is my withdraw function of Contract B:

@public
def withdraw(addr: address, amount: wei_value) -> bool:
    if(amount > self.balance):
        log.Error('Exceeds balance')
        return False
    if(self.authorized[addr]):
        log.AccountWithdrawal(addr, addr, amount, True)
        log.Error('Authorized, continue to withdraw')
        send(msg.sender, amount)
        return True
    log.Error('Withdraw Unsuccessful, User Unauthorized')
    return False

My code executes correctly into the

if(self.authorized[addr]):

code block, but when I call send(msg.sender, amount) is when I get a VM exception revert. The withdraw function works for everything but the Contract A address it seems. Not sure how to work this out.

In the exercise function I can do this:

send(self.vendor, val)

and it will still revert.


texts: What happens if no nonce is provided for a transaction?

texts: The nonce parameter seems to be optional for transactions. Its goal is to protect from replay attacks. In that case, why is it optional, and what happens if it's not provided? It leaves the particular transaction prone to replay attacks?


texts: Recover public key from message and signature

texts:
I try to recover a public key (not an address) from a message and a signature.

I have the following message:

def offer_hash(msg, nonce):
    types = ['bytes',
             'bytes',
             'address',
             'uint256',
             'address',
             'address',
             'uint256',
             'uint256',
             'uint256',
             'address']
    return Web3.soliditySha3(types, [base58.b58decode(msg.model.multihash),
                                     base58.b58decode(msg.objective.multihash),
                                     msg.token.address,
                                     int(msg.cost.uint256),
                                     msg.validator.address,
                                     msg.lighthouse.address,
                                     int(msg.lighthouseFee.uint256),
                                     int(msg.deadline.uint256),
                                     int(nonce.uint256),
                                     msg.sender.address])

offer = Offer()
offer.model = Multihash()
offer.model.multihash = "QmaTLSFvFh2gTv5eUDfpE1YZjiwuPwSq9RpSG9kSJ6Y9W9"
offer.objective = Multihash("QmaTLSFvFh2gTv5eUDfpE1YZjiwuPwSq9RpSG9kSJ6Y9W9")
offer.token = Address()
offer.token.address = "0x966EbbFD7ECbCF44b1e05341976e0652CFA01360"
offer.cost = UInt256("0")
offer.lighthouse = Address()
offer.lighthouse.address = "0x202a09A451DE674d2d65Bf1C90968a8d8F72cf7b"
offer.validator = Address()
offer.validator.address = '0x0000000000000000000000000000000000000000'
offer.lighthouseFee = UInt256()
offer.lighthouseFee.uint256 = "0"
offer.deadline = UInt256()
offer.deadline.uint256 = "490176"
offer.sender = Address("0xFc8C9Ed4eD3f9Eb590B18e5B35a1B3a658DF5E16")
nonce = UInt256("0")

Using offer_hash I get:

Message hash: b"A\xa5\xd8\xeds\x03:\xe2\xcf\x98\xafR\xc3\x11\x87\xa9\xc0'\xf0r\xadu\xeb\xeen\xe6\xe34\xf3\xd1\xaeM"

I know that the signature was created after from eth_account.messages import defunct_hash_message

Defunct: b'MT\xc8\xf1Lsj\xc25\xe0\xe1\xdeQ5\xa1\xfe\tjyMD\xc9\x84\xc0\x0e\x02\xe0K\xdf\xd8<\x17'

And also I have the signature:

Signature: b'n\xb3w>\xaf\xa4\xc9(F\xb8\x82\xe5w\xed\xa8_\x0e\xa6j\xce\x89&\xa2\x14M\xeaT\x92\xe1\xf6\xd1?2D|\xa8\x8fG\xbb\xebD\x8f\xf1\xce.\x1a\xe1M\x0e\xce\x9a\x04?:x+\xaeGF\xd03\x18\x86\xfa\x1c'

The question is how to recover the public key having this data?

Thank you


texts: How to store Public Key in Ethereum contract?

texts:
I want to store a Public Key of an Ethereum address in a contract. What is the advisable primitive datatype to store a Public Key?

Should I store as String or Bytes32?
Is it secure to store a Public Key in a contract? I know it is PUBLIC key, but still...I want to know any pitfalls that I should be mindful of.

Thanks!


texts: Smart contract returning values as zeros

texts:
pragma solidity ^0.4.18;

contract TransManager {
  //state variables

  // contract owner
  address private creator;

  uint transCounter;

  // File Meta metaData
  struct metaData{
    uint id;
    address owner;
    string docType;
    string fileHash;
  }

  //Array to store tranasactions
  mapping (address => metaData[])  fileLogs;

  //Send a trnsactionId

  function regTransaction(string _docType, string _fileHash) public {
    transCounter++;
    var fileLog = metaData(transCounter, msg.sender, _docType, _fileHash );

    fileLogs[msg.sender].push(fileLog);

  }

  function getTransactions() public returns (uint []){
    var temp = fileLogs[msg.sender];

    uint[] memory ids = new uint[](transCounter);

    for (uint i=0; i<= transCounter; i++){
        ids[i]=temp[i].id;
    }

    return ids;
  }

  // constructor
    function TransManager() {
        creator = msg.sender;
    }

  // kills contract and sends remaining funds back to creator
   function kill() {
       if (msg.sender == creator) {
           selfdestruct(creator);
       }
   }

}

getTransactions - is always returning array of zeros. But I am expecting to return the indexed number.

truffle console --network ganache
truffle(ganache)> TransManager.deployed().then(function(instance){app=instance;})
undefined
truffle(ganache)> app.regTransaction("EDI","Hash",{from: web3.eth.accounts[1]})
{ tx: '0x46785333bce5f682c586ccf995682203a78d26bfba54957bb0bd5593d6cc4542',
  receipt:
   { transactionHash: '0x46785333bce5f682c586ccf995682203a78d26bfba54957bb0bd5593d6cc4542',
     transactionIndex: 0,
     blockHash: '0x26bf163083f35bade4aca17c2d05706846b4dd8f555efa7117cdea0b64da51ca',
     blockNumber: 5,
     gasUsed: 146345,
     cumulativeGasUsed: 146345,
     contractAddress: null,
     logs: [],
     status: 1 },
  logs: [] }
truffle(ganache)> app.getTransactions()

Error: VM Exception while processing transaction: invalid opcode
    at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:509:1)
    at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:354:1)
    at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:64:1)
    at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/httpprovider.js:128:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-provider/wrapper.js:134:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:86:1
    at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/errors.js:38:1)


texts:
If I understand correctly after you create your BEP-20 token you should add liquidity and it will determine the base price of new token but what's happening next? How is the price determined afterwards when token is being transfered by many people?
Also how can you make your token in your wallet available for trade on demand by others?
Like if the token supply is 1000, and all 1000 is on my wallet then how can one buy this?
Sorry if these questions are stupid but I am new to this.


texts: How to add more Ether on a private blockchain

texts: In geth 1.5 the --genesis option has been removed. What do I use instead to add ether to my account?


texts: Quorum Can a non permissioned node change the states of private contract if the node knows contract addr and ABI?

texts:
I have ran the quorum-example, deploying a private contract.
https://github.com/jpmorganchase/quorum-examples/tree/master/examples/7nodes

I followed the commands written in README.
However, I'm quite confused about why node4 can modified the status of this private contract.

When execute

  private.get()

node1 got 42, node7 got 42, and node4 got 0.

But after node4 execute

  private.set(7,{from:eth.coinbase,privateFor:["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="]});

node1 still got 42, node4 got 0, and only node7 got 7.

It is a private contract between node1 and node7, so I'm wondering why node4 can change states from 42 to 7


texts: How do you trust and verify very old logs?

texts:
A couple of us on the web3.js gitter forum were discussing the need for a 3rd party check on logs that could potentially be years old.

From what we can tell, some nodes are not keeping the old logs around for filtering because they take up valuable space and are not necessary for running the current blocks.

However, those logs are valuable for off-chain third party verification. (e.g. lawyers), years later.

One can configure ones own node(s) to keep all the old logs around, but that does not constitute a third party verification.  Remember this is off-chain and understanding vs. traditions are odd sounding to the technical world.

Are there blockchain browsers that keep all the old logs around?  What are some other possible solutions?  (Or am I missing something obvious?)


texts: Can I implement 'function balance()' in a contract?

texts:
Can I do this?:

contract MyContract {
    uint256 myVar;
    function balance() external view returns (uint256, uint256) {
        return (address(this).balance, myVar);
    }
}

Both solc and truffle compile compile it successfully (i.e., no errors or warnings).

So I'm guessing that there's no problem here.

But I just want to be sure that it doesn't somehow "override" address(this).balance.

Thank you!


texts: About issuing token on private ethereum chain (POA Consensus )

texts:
I'm trying to create a private POA ETH chain and then issue my own token on it.

I have some questions about how to make the whole system work.

The one question is that after I have a private chain and before set up smart contract to issue token, how can I dig out all the coins in advance?

Another one is how to set the total coin number of private chain?

Thanks a lot!


texts:
We have a wallet structure where users send tokens to individual user wallet addresses generated for them, we then sweep all the funds in the user's wallets to a centralized pool. The individual wallets act as receiving address for the user funds. Normally when an ETH transfer happens, the transaction fee goes from the funds and we bear the cost.

When an ERC20 token deposit happens, we now have to send ETH to the address to cover the transaction cost of the sweep. This is far from a good solution (it leaves behind transaction change and is hard to implement)

The Naive Solution: Just send ETH into a user's wallet every time I detect an ERC20 deposit into that wallet, so that said wallet can pay for the gas to transfer.

Address Factory Contract: Inspired by this answer, creating a contract that would generate address for the contract. The shortfall being gas per address generation.

Looks like Meta Transactions are a way of going about this, relevant link.


texts: Does Ethereum support pairing operations?

texts:
I need to build an application that uses bilinear pairing operations for generating signatures. If I send a message with its signature to Ethereum, can Ethereum verify this message? Does the EVM support pairing operations?

This is an example of signature verification using BLS signature:

Given a signature S and a public key g^{x}, we verify that  e(S ,g)=e(H(m),g^{x}).


texts:
How can I give permission for another non-priv user on the same server to get Read/Write access /home/parity/.local/share/io.parity.ethereum/json.ipc and have that access available on reboot?

The .toml file does not have anything to specify the file permissions.


texts: Chainlink Price Feed - function fails when price not hard-coded but correctly displays in console

texts:
I'm experiencing a challenge and hoping for some guidance/help/assist... I've been working on implementing price feed. Testing locally with hardcoded return price works like a charm, no issues. When deployed on testnet (Rinkeby) with actual price fetching data, the price shows in console like it should. However, when I use a function that relies on the price feed, I get an error in Metamask. When I approve it with an error (in the hope of seeing what the issue is), console returns an error that it's run out of gas, however gas limit is not set (if you set the gas limit, no error shows in Metamask and it still runs out of gas, no matter what limit you set). Any help and insights would be greatly appreciated and here is some code to help you help me...
I start with basically importing the price feed:
interface AggregatorV3Interface {

  function decimals() external view returns (uint8);
  function description() external view returns (string memory);
  function version() external view returns (uint256);

  function getRoundData(uint80 _roundId) external view returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );

  function latestRoundData() external view returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );

}

I have a function where I can fetch the data:
 function getOracleUsdPrice(address token) public view returns (int256, uint256) {
        address oracleAddress = availableOracles[token];
        require(oracleAddress != address(0), "Mp: Token not supported.");

        (, int256 answer, , uint256 updatedAt, ) = AggregatorV3Interface(oracleAddress).latestRoundData();
        return (answer, updatedAt);
        // for local testing ONLY
        // return (100000000, now); //1 for 1 exchange
    }

and then I have a function where I can add the tokens and oracles as needed:
function addOracle(address token, address oracle) public onlyOwner{
        availableOracles[token] = oracle;
}

Inside the failing function, here is what I have:
function buy(IERC20 token, uint256 tokenId) public payable {
        Offer storage offer = offerDetails[tokenId];

        // get price conversion
        (int256 currentPrice, uint256 updatedAt) = (getOracleUsdPrice(address (token)));

        // convert USD price to crypto
        uint256 cryptoPrice = offer.price.mul(1 ether).div(uint(currentPrice));

        // transfer funds from buyer
        token.universalTransferFromSenderToThis(cryptoPrice);

        // pay the seller
        token.universalTransfer(offer.seller, cryptoPrice);

        // transfer token to buyer
        _houseToken.safeTransferFrom(offer.seller, msg.sender, tokenId);

        // remove and emit
        delete offerDetails[tokenId];
        emit MarketTransaction("Token purchased", msg.sender, tokenId);
    }

The price conversion is so that when item is listed for USD, user can see the USD price but then purchase with crypto.
I have checked that I have Rinkeby address for both token and oracle address. Transaction fails whether I use ETH or ERC20. I get the same issue on both Rinkeby and Kovan. When I re-deploy on both networks with hardcoded return numbers (like I had in ganache), it goes through. The part that stumps me is that I use the same getOracleUsdPrice() function on the front end (where console and GUI show correct price and conversion).
Thank you in advance for your help and if anything else is missing that you believe would be useful to provide an assist, please let me know. Supper appreciate your help with this.


texts: How can i deploy compilled contract with node/web3 and metamask?

texts:
Does anybody knows how to deploy smart contract with node/web3 and using unlocked metamask account. I mean over internet it is advised to use HDWalletProvider with mnemonic but I want that user that is on my website could deploy contract from personal metamask account (like this REMIX do at the moment: when push "deploy" contract then metamask pops up with my personal account)! I want same thing but from my webpage where users can deploy contracts from their personal account! Thank you

How to change provider to user users personal metamask account ?

const HDWalletProvider = require('truffle-hdwallet-provider');
const Web3 = require('web3');
const compiledContract = require('../build/deal.json');

// TODO >>> HOW TO CHANGE THIS PROVIDER TO GET ACCOUNT FROM UNLOCKED METAMASK (WHITCH IS USERS PERSONAL ACCOUNT)
const provider = new HDWalletProvider(
  'twelve words mnemonic twelve words mnemonic twelve words mnemonic twelve words mnemonic',
  'https://rinkeby.infura.io/v3/<key>'
);

let web3 = new Web3();
web3.setProvider(new
web3.providers.HttpProvider('https://rinkeby.infura.io/v3/<key>')); // http://localhost:8545

(async () => { const accounts = await web3.eth.getAccounts();
  console.log(`Attempting to deploy from account: ${accounts[0]}`);
  const deployedContract = await new web3.eth.Contract(compiledContract.abi)
    .deploy({
      data: '0x' + compiledContract.evm.bytecode.object,
      arguments: [3, 5]
    })
    .send({
      from: accounts[0],
      gas: '2000000'
    });

  console.log(
    `Contract deployed at address: ${deployedContract.options.address}`
  );

  provider.engine.stop();
})();


texts: Am I Able To Save Remix.IDE Files To My Device?

texts:
I am a computer science student and for my coursework, I want to write a smart contract program. I discovered the Remix.IDE is a web-based IDE, not like previous IDEs I have used, such as IDLE for Python. I would like to code my project in Solidility preferably 0.6.3.

I was wondering is it possible to:

A) Get a downloaded version of this IDE where I can run my projects- one similar to Python's IDLE.

B) Save files from the Web Remix IDE to my laptop? If the answer is yes, how would I do that?

Sorry for my lack of knowledge I am very new to Ethereum and smart contracts.

Thank you for reading.


texts:
All the contract deployment tutorials I have seen instruct me to deploy the via my eth.accounts[0] or some other address belonging to my nodes account list.
The code in the last step generally is (don't mind the improper syntax)

var test = testcontract.new("teststring",{ from: eth.accounts[0], data: "0x" + testOutput.contracts.bin, gas: 300000}});

I wish to use an external address in the from field, whose private key I have generated separately without any involvment with the in node wallet.
I cannot find any material which helps me with. How can I do that?


texts: hexadecimal (bytes) to binary (uint) in a smart contract

texts: What are some ways to convert from bytes8 hexadecimal to uint64 binary?


texts: Why does updating an external variable results in an error?

texts:
I'm trying to update a variable within an external contract.

My 2 contracts are as follow:

pragma solidity ^0.4.25;
contract MainContract {
string public variable1;

function setVariable1(string memory newValue) public {
    variable1 = newValue;
}}

contract SetContract {
//address MainContract;
MainContract myMainContract;

constructor(
    address _myMainContract
) public {
    myMainContract = MainContract(_myMainContract);
}

function setVariable1MainContract(string memory newValue) public {
    myMainContract.setVariable1(newValue);
}}

MainContracts holds the variable1 and de SetContract uses the setVariable1 function from MainContract.

When I deploy both contracts this works fine.

When I execute the function setVariable1MainContract I get an exception within Remix: "VM exception while processing transaction: revert".

Any suggestion is welcome.


texts:
Is it possible to watch for event triggers when the actual event and trigger is defined in a library? I get no console output with the following code

library ObjectHistoryLib {

    event SerialObjEvent(
        bytes32 description,
        bytes32 repair,
        uint indexed serialIndex
    );

    function setObj(address _storageContract, uint serialId, bytes32 description, bytes32 repair) {
        SerialObjEvent(description, repair, serialId);
    }
}

I then place a watch on the "SerialObjEvent" using truffle web3 syntax

var histLib = ObjectHistoryLib.deployed();
var objQuery = histLib.SerialObjEvent({}, {fromBlock: 10, toBlock: 'latest' });
objQuery.watch(function (error, result) { console.log(JSON.stringify(result)); });

But I get no output when I call the setObj function


texts: can you start a new token without smart contracts?

texts: What I mean is, can I start a coin on the ethereum network and distribute the tokens when I want to a set list of addresses?


texts: Error in converting ERC20 tokens with decimals to full coins without rounding errors?

texts:
How to convert token to full token without having any rounding errors.
     web3.utils.toBN(6221221111111110001).div(10**18).toFixed()

TypeError: num.isZero is not a function
at BN.divmod (node_modules/number-to-bn/node_modules/bn.js/lib/bn.js:2329:17)
at BN.div (node_modules/number-to-bn/node_modules/bn.js/lib/bn.js:2425:17)
at Promise.all.then ()
at
at process._tickCallback (internal/process/next_tick.js:182:7)
        bal=6221221111111110001/ (10**(18))

It also has some precision errors.
Any help is appreciated.


texts:
How to find ETH transaction txid by value and date ?
Smth like Blockchair, but for ETH ?


texts: Issue with autonomous contract calling erc20 token's transferFrom for approved amount

texts:
Trying to transfer fund using ERC20 token handle and calling 'transferFrom'. Assume that the specific amount is preapproved by owner account for 'MyContract' contract address.

contract StandardToken {
  function transferFrom(address from, address to, uint value);
}

contract MyContract{
  address _addrToken;
  function MyContract(address addrToken){
    _addrToken = addrToken;
  }

  event FundAcquired(address owner, uint256 amount);

  function acquireFund(address owner, uint256 amount){
    StandardToken token = StandardToken(tokenAddr);
    token.transferFrom(owner, this, amount);
    FundAcquired(owner, amount);
  }
}

When calling via web3js, the function 'acquireFund' results will following error.

  Exception: Error: VM Exception while processing transaction: revert

Can anybody guide me with what is the issue?


texts:
I installed Parity for Windows recently with the latest version 1.4.3-beta.

The syncing was going fast to start but now on 2,400,000 blocks is goes extremely slow to the point of doing only a few blocks a second.

Homestead button is green, but peers is listed as 0/25/25.

I have seen some posts saying to run with --warp, but also seen others saying that option is deprecated. The way I am running is just by double clicking the icon on my desktop (Windows).

What is the reason the sync is going so slowly?


texts:
pragma solidity ^0.4.11;
contract test2
{

    address creater;
    string username;
    string password;

    function testusernamepassword(string username,string password) returns (bool)
    {
        if (username == "deepak" && password == "123") //error: operator == is not compatible with string ?
        {
            return true;
        }
        else
        {
            return false;
        }
    }
}


texts: Save data of variable of smart contract in js

texts:
can anyone let me know how to save data of a variable of my smart contract in javascript variable. for example if i have a function in my smart contract and that function returns some value now how do i save that value in my javascript variable.

var propertycontractaddress=propertycontract.at('0x691d3fb44bc81b5e420946a0aba3d1d0555c0715');

var total;

propertycontractaddress.GetTotalNoOfProperties(function(error,result){

if(!error){

total=result;

 }else{

 console.error(error);
    }
  })
  console.log(total);

for(var i=1; i<=total;i++){

var table = document.getElementById("ListedPropertyTable");

 var row = table.insertRow(1);

var cell1 = row.insertCell(0);

var cell2 = row.insertCell(1);

var cell3 = row.insertCell(2);

var cell4 = row.insertCell(3);

propertycontractaddress.GetId(i,function(error,result)

{

    if(!error)

    {

    cell1.innerHTML = result;

console.log(result);

}

    else

    {

console.error(error);

}

});

propertycontractaddress.GetPrice(i,function(error,result)

{

if(!error)

{

cell2.innerHTML = result;

}

else

{

    console.error(error);

}

});

propertycontractaddress.GetType(i,function(error,result)

{

if(!error)

{

    cell3.innerHTML = result;

}

else

{

    console.error(error);

    }

});

propertycontractaddress.GetCityn(i,function(error,result)

{

if(!error)

{

    cell4.innerHTML = result;

}

else

{

    console.error(error);

}
                    });
}

 </script>