texts: How do I know Mist-type programs don't have access to my keyfile and password?

texts: These programs create the keyfile and I enter my password into them whenever I send a transaction. What's to stop them from sending that info somewhere?


texts: Reading gas limit inside solidity smart contract?

texts: As we can read the gas left and the gas price inside solidity smart contract, is there any way that I can read the gas limit set for the transaction inside the solidity ?


texts:
I was faced with the problem of exceeding the maximum contract size. Therefore, you have to divide one contract into several. I need to establish communication between the two contracts. The most important thing is to make sure that a number of functions can only call a specific contract selected by me (functions that pass the user's address).

Can I save the address of a contract that is allowed to call functions to a variable? Will checking msg.sender==allowedContract be safe? Maybe there is an alternative?


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

texts:
I am trying to deploy the following contract in Remix IDE and I get the error message in the title:

pragma solidity ^0.4.22;

contract University {
    address public owner;
    address public student;
    address firstName;
    address lastName;
    bytes32 Studies;
    uint age;
    uint DateOfBirth;
    bytes32 public caCertificate;
    bytes32 ipfs_hash;
    constructor() public {
        owner = msg.sender;
    }
    modifier onlyOwner()  {
        if (msg.sender == owner) _;
    }
    modifier onlyOwnerOrStudent() {
        if (msg.sender == owner || msg.sender == student) _;
    }
    function setstudent () public;

    function getStudent () public;

    event student(
        bytes32 firstNameName,
        bytes32 lastName,
        bytes32 Studies,
        uint age,
        uint DateOfBirth,
        bytes32 ipfs_hash
        );

    function checkStudentExists() public constant returns (bool) {
        if (student == firstName && student == lastName) return true;
    }

    function setIPFSHash(bytes32 _ipfs_hash) public onlyOwnerOrStudent {
        ipfs_hash = _ipfs_hash;
    }
}

Can someone help me please?

Thank you


texts:
2018/03/16 17:41:20 ssdp: got unexpected search target result "urn:schemas-upnp-org:device:WANConnectionDevice:1"

2018/03/16 17:41:20 ssdp: got unexpected search target result "urn:schemas-upnp-org:device:WANConnectionDevice:1"

2018/03/16 17:41:20 ssdp: got unexpected search target result "urn:schemas-upnp-org:device:WANConnectionDevice:1"

What does this mean?


texts: A common error at time of using web3 options

texts:
When i use some web3 options as follows, I receive a common error i.e.

TypeError: web3.[option] is not a function

For example :

TypeError: web3.toAscii is not a function

web3.toAscii(0x37361fd8eb5f78c7558ccfaa338c1935ecbc3d486f7a63c5b3e1b245779bc90e.input)
TypeError: web3.toAscii is not a function

And I receive same error using another format of this command as follows :

var str = web3.toAscii("0x37361fd8eb5f78c7558ccfaa338c1935ecbc3d486f7a63c5b3e1b245779bc90e");
console.log(str);

Or

TypeError: MyContract.MyEvent is not a function

var Ev = contractInstance.LogNewObject({}, {fromBlock: 0, toBlock: 'latest'});
       Ev.get((error, events) => {
       if (!error) {
          function ShowResults(event) {
            console.log('sub_states_types: ' + event.args.sub_states_types);
            console.log('sub_states_values: ' + event.args.sub_states_values);
            }
          events.forEach(ShowResults);
        } else {
        console.log('Error');
          }
        });

And my smart contract is as follows :

pragma solidity 0.4.23;

contract RFID {

    struct StateStruct {
        bytes32 description;
        mapping(bytes32 => bytes32) sub_state;
    }

    struct ObjectStruct {
        StateStruct state;
        address owner;
        bool isObject;
    }

    mapping(bytes32 => ObjectStruct) objectStructs;
    bytes32[] public objectList;

    event LogNewObject(address sender, bytes32 indexed id, bytes32 sub_states_types, bytes32 sub_states_values, address owner);
    event LogChangeObjectState(address sender, bytes32 indexed id, bytes32 sub_states_types, bytes32 sub_states_values);
    event LogChangeObjectOwner(address sender, bytes32 indexed id, address newOwner);

    function isObject(bytes32 _id) public view returns(bool isIndeed) {
        return objectStructs[_id].isObject;
    }

    function getObjectCount() public view returns(uint count) {
        return objectList.length;
    }

    /*function setArraySize(uint256 _number_of_sub_states) public {

        number_of_sub_states = _number_of_sub_states;

    }

    function getArraySize() view public returns (uint256) {
       return number_of_sub_states;
    }*/

    function newObject(bytes32 _id, uint256 number_of_sub_states, bytes32[10] sub_states_types, bytes32[10] sub_states_values, address _owner) public returns(bool success) {
        require(!isObject(_id));

        uint256 counter=0;
        for(counter; counter < number_of_sub_states; counter++) {

            objectStructs[_id].state.sub_state[sub_states_types[counter]] = sub_states_values[counter];

            emit LogNewObject(msg.sender, _id, bytes32(sub_states_types[counter]), bytes32(sub_states_values[counter]), _owner);

        }

        objectStructs[_id].owner = _owner;
        objectStructs[_id].isObject = true;

        objectList.push(_id);

        return true;
    }

    function changeObjectState(bytes32 _id, uint256 number_of_sub_states, bytes32[10] sub_states_types, bytes32[10] sub_states_values) public returns(bool success) {
        require(isObject(_id));
        uint256 counter=0;
        for(counter; counter < number_of_sub_states; counter++) {

            objectStructs[_id].state.sub_state[sub_states_types[counter]] = sub_states_values[counter];

            emit LogChangeObjectState(msg.sender, _id, bytes32(sub_states_types[counter]), bytes32(sub_states_values[counter]));

        }
        //objectStructs[_id].state = StateStruct(_newState);
        //emit LogChangeObjectState(msg.sender, _id, _newState);
        return true;
    }

    function changeObjectOwner(bytes32 _id, address _newOwner) public returns(bool success) {
        require(isObject(_id));
        objectStructs[_id].owner = _newOwner;
        emit LogChangeObjectOwner(msg.sender, _id, _newOwner);
        return true;
    }

}

Whate is the reason ?


texts: I have some eth keys that I would like to convert to geth keys. There was a previous post about this, however the solution provided was to use ethkey, but this tool has now been deprecated. Any help would be appreciated.


texts: Metamask web3js ERC20 token transfer function throws error when amount is less than 1

texts:
I'm working on a Dapp that allows users to pay with an ERC20 token. I made a standard ERC20 token and deployed the contract to a testrpc node with truffle, and I was able to get an instance of the token contract in with truffle contract.

I can call the token transfer function with an amount that's greater than 1, and after signing the transaction with metamask, everything works properly, I get the transaction receipt, and the token balance gets deducted.

tokenContract.deployed().then(async token => {
      token.transfer(toAddress, amount, {
        from: web3.eth.accounts[0],
        gas: 4612388
      });
    });

However, when the amount parameter is less than one, I get an error in the chrome console:

  errors.js:35 Uncaught (in promise) Error: Error: [ethjs-rpc] rpc error
  with payload
  {"id":7447005951567,"jsonrpc":"2.0","params":["0xf8b0178504a817c8008346612494e7194e2016d5454d5791d94d8a6aff6c1ead645780b844a9059cbb00000000000000000000000000d1ae0a6fc13b9ecdefa118b94cf95ac16d4ab000000000000000000000000000000000000000000000000000000000000000008602c0d0e327cba0a30d94d6e74e0e2f602c5fba9ea677f5d81d99e52acde754bbbe65b9dd295d9fa01e5d09addbdcd9f5cd311f06790406b69d92b162386789277bdde2de6d18cb13"],"method":"eth_sendRawTransaction"}
  Error: VM Exception while processing transaction: revert

At first I thought that you can't send floats into truffle contract instances because solidity doesn't handle floats, but calling the amount with 1.1 works just fine. I also tried to convert the float into a BigNumber by setting the amount to new BigNumber(0.1), and the same error still persists.

Am I missing something here? Being able to send less than 1 token seems to be a very typical use case.


texts:
I starting to work on blockchain and dapps, would like to help with issues in augur can anyone explain how to debug or test run the application on my local machine to know how it works? i tried to use the augur core and follow the instruction but i get held up somewhere.

https://github.com/AugurProject/augur-core


texts: Issue with the "npm install drizzle" command on Windows

texts:
I want to install Drizzle.  Running "npm install drizzle" only displays errors and the installation has failed.
I have been able to install drizzle-react and drizzle-react-components without an issue but how can I install drizzle?


texts: Is it possible for the miner of a block to be address 0x0?

texts:
Take a look at this transaction: https://etherscan.io/block/5305. The miner is listed as 0x0000000000000000000000000000000000000000. Is this reasonable? Did someone configure their node incorrectly? How can the miner address be zero?

It also happens on the following blocks: 5748 6011 6133 6320 6398 6424 6505 6515 6801 6818 6822 6845 6884 6935 6937 6968 6973 6985 6994 7022 7129 7158 7252 7485 7997 8506 8579 8618 8636 8648 8671 8701 8737 8847 8877 8976 8993 (These are the ones I found under block 10,000.)

Can anyone explain why this happens?


texts: MetaMask - RPC Error: Error: WalletMiddleware - Invalid "from" address

texts:
I'm trying to create a simple Dapp (via tutorial) which would allow me to send Ether from sender to receiver (via a contract with an address that automatically approves the transaction). The truffle test server is local. I get the following error.

Error: Error: Returned error: Error: WalletMiddleware - Invalid "from" address. at l (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/background.js:1:1243523) at async chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/background.js:1:1241740

According to the tutorial I've setup and deployed the contract and created a html page that interfaces with the server. I'm using Chrome with Metamask installed. What should happen is that when I put the send and the receiving address into the web form page Metamask should pop up in chrome allowing me to sign the amount before submitting.

In the Chrome development console it highlights that the code block generating the error is (this is in my index.html file):

    AprrovalContract.methods.deposit(toAddress).send({from: fromAddress, gas: 100000, value: web3.utils.toWei(amount,'ether')},
  function(error, result) {
    if (error) {
      console.log('error: '+ error);
        $('#deposit-result').html('Error: ' + error);
    } else {
      $('#deposit-result').html('Success TX: <b>' + result + '</b>');
    }
  })

Thanks


texts: How to catch solidity contract revert message using web3j

texts:
Is there any way to catch solidity revert message like Remix Javascript VM in web3j

Revert message(Remix)

transact to Erecruitment.issueNewAdmitCard errored: VM error: revert.
revert  The transaction has been reverted to the initial state.
Reason provided by the contract: "Admit card ID already exists in Blockchain".  Debug the transaction to get more information.

Event message (Remix)

 logs   [
    {
        "from": "0x692a70d2e424a56d2c6c27aa97d1a86395877b3a",
        "topic": "0xbf970614f4ff9483c34fa1a053bc6614e06003a1faef2d0876e9255bfa3167fc",
        "event": "LogIssueNewCard",
        "args": {
            "0": "2",
            "1": "4",
            "2": "New Card is issued in Blockchain",
            "admitCardId": "2",
            "applicantName": "4",
            "message": "New Card is issued in Blockchain",
            "length": 3
        }
    }
]

I get event messages for successful transactions in web3j. So, I can be sure that whether my transaction is completed without any error. If transaction is reverted there will be no event as usual(it's ok). But I am not getting any revert message too for a failed transaction.

And I am getting transaction status null each and every time using web3j as byzantiumBlock is missing in my genesis file. Then how can I check the transaction status?


texts: Ethereum is not showing up in my ledger nano wallet from coin base

texts: I transferred my ethereum from my coin base account to my ledger nano wallet 15 hours ago and it is not showing up in my ledger nano wallet. It shows as transaction complete in coin base account and also shows in etherscan. How do I get it in my ledger nano wallet? I am sure about the address I copied from my ledger nano ethereum wallet. Still, how do I make sure that the address came out of my specific wallet? I am at a state of panic. Any help will be much appreciated. Thanks a lot.


texts: Why downloading the Blockchain with GETH --fast is still very slow

texts:
My attempt to install Mist on my PC since May 16, 2017 failed miserably many times. Fact is, I am able to install the app no problem. The problem I have is that it just takes forever to download the whole BlockChain. Hence, rending my installation useless. I've done a lot of reading about how to speed up the process and found the commonly suggested solution as follow:

geth --fast --cache=2048 --jitvm and many variants.
All variants have been tried with not much efficiency increase.

Also, on my 64bits 6Gigs RAM Intel i5 2.5GHz decent PC I did the following:

*Uninstall the whole Ethereum Mist program from Windows 7
*Deleted all folders created on prior installation attempts,
   including all ethereum related folders in my AppData folder.
*re-installed a fresh version of the newest Mist Mist-win64-0-8-10.zip
*Once installed I stopped the blockchain sync process
*opened a console windows
*called

GETH removedb
GETH --fast --cache=2048     also tried  GETH --fast --cache=2048 --jitvm

The process started correctly.
That process is suppose to start downloading the whole blockchain without any calculations or details. Should be much faster.
I waited 5 days until I decided to stop the attempt, for at every time extrapolation calculation I found that the termination date was pushed further and further ahead to some 20 days in the future.

This is just insane. There's got to be something I am doing wrong.

Furthermore, when stopped, the GETH --fast --cache=2048 will not continue as in the first attempt.
The console will mention and error message containing  "fast mode disable" ??

I realize that this subject has been addressed many times here but none have been recent. I am just hoping to find an up-to-date solution since all previous attempts have failed.

Does anyone have any suggestion as to how one can install the Ethereum blockchain faster than a whole month of computer saturation ? !

*Note for similar previous questions: In my view this question is different from many of the other questions addressing the slow speed for syncing the Ethereum wallet by the fact that the previous answers are not relatively recent and the Ethereum wallet as taken a huge size increase since a year (2016 to 2017). Clearly, this issue is becoming a major one. Taking over one month to get a synced blockchain is way out of sense. My question is an attempt to seek a recent answer to an old question that clearly need a fresher approach.


texts: How are storage pointers implemented in the EVM layer?

texts: I'm trying to understand how storage pointers work. From looking at the ethereumjs-vm implementation it seems that the actual value is returned from SLOAD. Does the compiler handle the 'pointer' functionality? (ie. calls SSTORE if its modified).


texts:
Contract :

mapping (bytes32 => MyStruct) public myMapping;

  struct  MyStruct {
      uint256 myMember;
      uint256 someOtherMember;
  }

Test (Truffle)

This works:

let myStructResult = await this.contract.myMapping(id);
console.log(myStructResult);

But logs unfamiliar output (I'm not too solid on BN lib):

    Result {
  '0': '0x0000000000000000000000000000000000000000',
  '1': BN {
    negative: 0,
    words: [ 5, <1 empty item> ],
    length: 1,
    red: null
  },
  myMember: BN {
    negative: 0,
    words: [ 5, <1 empty item> ],
    length: 1,
    red: null
    },
   someOtherMember: BN {
    negative: 0,
    words: [ 5, <1 empty item> ],
    length: 1,
    red: null},

I see the value I want to log myMember, along with a few integer keys for which I don't understand their purpose

So I go:

let myMemberResult = await this.contract.myMapping(id).myMember;
let myMemberResultToNum = myMemberResult.toNumber()
console.log(myMemberResult)
Result: undefined
console.log(myMemberResultToNum)
Result: cannot read property 'toNumber' of undefined

Why can I log the struct, but I can't log one of its members?


texts:
In the documentation for parity's PoA chain it is mentioned that you should add the address of the contract which determines the validators to the genesis file.

  The function getValidators will be called on every block to determine the current list. The switching rules are then determined by the contract implementing that method. The spec should contain the contract address:

"validators": {
    "contract": "0x0000000000000000000000000000000000000005"
}

Is it possible to create a contract with an arbitrary address? Or to obtain a contract's address without deploying it?


texts: Require: How to avoid users of my smart contract from losing their ether

texts:
I have a smart contract lottery that requires people to send exactly 0.2 ethers to its address in order to participate.

In the constructor:

    ante = 0.2 ether;

And in the payable function

require(msg.value == ante);

If someone sends the wrong amount, not only do do they lose the 0.2 ethers, but they also get penalized with extra ether. I tried sending 0.3 ethers on purpose from Metamask and I lost 0.45 ethers from my test account.

How do I avoid this?

Thanks


texts: Which web3js version should I use for getting DApp output?

texts: I'm using web3js(1.0.0-beta.51) and I wrote the simple code that not returned any output and exact application result which I have expected.


texts: Do all Chainlink feeds return prices with 8 decimals of precision?

texts:
It looks like many Chainlink feed aggregators have 8 decimals of precision:

ETH/USD, which returns 140330173736 = $1,403.30173736
BTC/USD, which returns 3696759888474 = $36,967.59888474

I found the contracts above on feeds.chain.link.
Do all Chainlink feed aggregators have 8 decimals of precision?


texts: How to get contract creator using web3j?

texts:
How can I get the address of the creator of a contract using web3j?
Is it possible to get the first transaction of a contract and assume that the "from" field is the contract creator? If so, how can I get the first transaction?


texts:
When we search "Ethereum" keyword in Google or Amazom, we find a lot of books on this topic. I bought some kindle books, however they mostly talk about basic topics that are usually repeated in most of books: ex. General explanation about Blockchain technology, a bit about Bitcoin, differences of Ethereum with Bitcoin etc...

I'm looking for a reference book on Ethereum which explain almost everything on this topic. Does someone know such a book on Ethereum ?
Thanks


texts:
If you create a function that you only want the owner to interact with
would you use

require(msg.sender == owner)

or

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

Which would be the most cost efficient for smart contracts, since both essentially do the same thing?


texts: Get input data from specific transaction

texts:
I have a contract. I store data in ethereum using contract. Is it possible, to work with contract in git-like way.
For example, i have a list of previous transaction hashes. Can i fetch data from any specific transaction using web3j for example?


texts: I want my ESP32 to make transactions and check for the details of blockchain using a secure method. Actually, I want to use make calls to the blockchain instead of relying on a single node. In my opinion, using an SPV wallet would be the best idea but how can I make calls to the Ethereum blockchain instead of depending solely on a single node. Is there any other secure way to make transactions to the blockchain? Need help!!!


texts: Uniswap Factory contract event - how to find addresses for new token pair

texts:
When creating a new pair on Uniswap, Uniswap emits a PairCreated event that details which tokens are invovled. However, it sorts the token like this in the factory contract:
        (address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);

I'm lost as to retrieving specific token(s) as the order changes, here's what I did by comparing the bytes:
token0 := vLog.Topics[1].Hex()
bA := []byte(token0)

token1 := vLog.Topics[2].Hex()
bB := []byte(token1)

if bytes.Compare(bA, bB) < 0 {
        newToken = token0
        backedToken = token1
    } else {
        newToken = token1
        backedToken = token0
    }
fmt.Println("newToken", newToken)
fmt.Println("backedToken", backedToken)

But it is still incorrect. What's the right way to go about this, and why does Uniswap compare the token addresses like this?


texts: I want to have an upgradable contract so that I can have additional functionalities in upgraded contract. I know there are numerous of questions around it, most of them pointing towards Upgradable Contract. I tried to understand the codes from here and writing upgradable contracts in solidity, but failed. Are there any simpler examples illustrating the versioning system. Any sample codes that illustrate how to have upgradable contract in simpler way.


texts:
I creat token contract using remix.

The function approveAndCall code is following.

function approveAndCall(address _spender, uint256 _value, bytes
_extraData) public
    returns (bool success) {
    allowance[msg.sender][_spender] = _value;
    tokenRecipient spender = tokenRecipient(_spender);
    if (approve(_spender, _value)) {
    spender.receiveApproval(msg.sender, _value, this, _extraData);
    return true;
}

When I run this function,it shows:

approveAndCall errored: Error encoding arguments: Error: invalid bytes value (arg=undefined, type="number", value=undefined)

What should I string "bytes _extraData"?


texts: What configurations can miners set to select transactions to execute from their pool?

texts:
I know every miner has a pool of pending transactions (those are waiting to be executed). The miner can decide which transactions to execute and include in his block.However, miner is not setting and selecting transactions by himself, rather miner usually uses a configurable software to select specific transactions.

My question is what the miner can configure in selecting transactions apart from transaction fees and size??


texts: Web3 1.2.6 appears to ignore require in view function

texts:
Given the following function:

    function checkLock() external view returns (bool) {
        require(
            address(this) == IERC721(_nftRegistryAddress).ownerOf(_tokenId),
            "[checkLock] Contract is not owner of tokenId"
        );
        return true;
    }

The correct state is false - the contract does not own the NFT.

If I call this function with Metamask's web3, i.e. 0.20.7, it correctly returns false.

If I call this function with web3 1.2.6, it incorrectly returns true!

I'm aware that relying on a require to return state is nonstandard, but would be interested in understanding the discrepancy.


texts: When sending either to a contract, it fails silently

texts:
I'm getting a strange issue where if I send ether to a payable function, none of the events fire in that function, but I'm getting no error value in the Web3 callback.
I have this function:

function makeDatum(string dataStr)  payable returns (bool) {
    debug("datum");
    data[msg.sender].payment += msg.value;
}

The debug is an event I've made that sends whatever you give it to the listener:
    event debug(string data);

Here is my Datum struct:
    struct Datum {
        bool exists;
        bytes32 name;
        uint payment;
    }

Now, if I exclude this line:

data[msg.sender] += msg.value;

The debug event fires properly. Also, if I send zero Wei, it works fine and debug fires. Only when I send a value of Wei greater than zero do I not get the debug event.

Here is how I'm sending Wei:

contract.methods.makeDatum("test").estimateGas({from: defaultAccount}, function(error, gas) {
    console.log("Gas estimate:" + gas);
    contract.methods.makeDatum("test").send({from: defaultAccount, gas:gas, value: 50000}, function(error, result) {
        console.log(result);
        console.log("error:" + JSON.stringify(error));
    });
});

The error parameter here is returning NULL, so solidity doesn't seem to be throwing any errors...it's just failing silently. I'm using Solidity compiler 0.4.13 with Truffle.


texts: Tokens All-or-Nothing Atomic Transaction Support

texts:
I'm running into a situation where i need to do an atomic transaction the spans multiple contracts. The issue is it seems that ethereum doesn't support this natively. What i ended up doing is something similar to QueueBot where you have a transaction contract that then takes an aggregate of your call data, splits it and then runs it in one transaction.

Although this works, i had to change my contracts to now use tx.origin because the calls are being done by a contract and not the original sender, which i'm not happy with.

Other than the potential security flaws with this approach, this is really ugly too and can be error prone.

Is there any improvements that can be made to this, even if it is just using msg.sender, i tried to use delegatecall but i kept getting OOG error, which tells me that's not what it was designed for


texts: Why is go-ethereum reporting very small block sizes?

texts:
I am running a full geth node and was interested in the blockchain size.

Therefore, I compared the sum of all blocks' sizes with the actual disk size the blockchain copy consumes.

While the chaindata folder is 136 GiB large, the sum over all block sizes is just under 5 GiB. Where does this difference come from?

Obtaining Disk Size

$ du -hs geth/chaindata/
136G    geth/chaindata/

Obtaining Block Sizes

Here, I use the JSON-RPC interface and query each block (eth_getBlockByHash), going backwards from the best block I know (using the eth_getBlockByNumber API call).

From each block, I get the size value (which is in bytes according to the wiki).
However, the sum of all size attributes is only roughly 4.76 GiB.

What am I missing here?

(I know I could just fetch each block by its number, but this is irrelevant for the question.)


texts: Truffle Smart Contract Testing does not reset state

texts:
I have the following javascript test for a simple ERC 20 token. Which on the call return token.balanceOf.call(accounts[2]); will fetch some old data and fail from a previous test transaction writting similar, but in another contract() scope on the same contract. Using TestRpc

contract('ERC Allowance', function (accounts) {

    it("should be able to lend money and that user spend it", function () {
        var token;

        return Token.deployed().then(function (instance) {
            token= instance;
            return instance.approve(accounts[1], 5555, {from: accounts[0]});
        })
            .then(function (approveTransaction) {
                return chftoken .allowance.call(accounts[0], accounts[1]);
            })
            .then(function (allowance) {
                assert.equal(allowance, 5555, "allowance should be increased");
                return token.transferFrom.call(accounts[0], accounts[2], 55555, {from: accounts[1]});
            })
            .then(function (failedTransaction) {
                return token.balanceOf.call(accounts[2]);
            })
            .then(function (balance) {
                assert.equal(balance.valueOf(), 0, "transfer should not go through");
                return token.transferFrom.call(accounts[0], accounts[9], 10000, {from: accounts[1]});
            })
            .then(function (transactionCompleted) {
                return token.balanceOf.call(accounts[2])
            })
            .then(function (balance) {
                assert.equal(balance, 5555, "the balance should be transferred")
            });
    });
});


texts: How do I swap a low amount of Monero for ETH?

texts:
I wish to swap 0.0175 XMR to ETH. I tried everywhere online, but it is below the minimum amount. Morphtoken's XMR exchange has been down for maintenance. Next, I tried crypto wallets with built-in exchanges. But the minimum exchange amount was still above 0.0175 XMR. I use Linux.
What do you suggest I do?
Thank you.


texts: Can I arrange for refunded gas to go to the recipient instead of the sender?

texts:
I've sent some small test transactions around and noticed that, unless gas is precisely calculated, if you try to send everything in one address to another, the spare gas ends up in the sender's account but is then unspendable if the network gas price goes up. If this is a systemic occurrence, it seems to me that this will end up with dust amounts in many unusable addresses.

If I am emptying one address into another, it makes sense for the destination account to receive the refund for unused gas. Can I express this in sendTransaction?


texts: How can I test someone else‘s ETH contract with only bytecode and ABI？

texts: If I just have someone else's ETH contract bytecod an ABI, how can I test it's function?


texts:
CodeWars SPOILER

I'm trying to learn by doing, and I'm pretty confused. I'm working on a kata for making a coin and sending it to others. My solution fails the test because it says I'm not checking the balance, but I've got this line as the first command in the function:

require( (amount > 0) && (balanceOf(msg.sender) >= amount) );

I've looked at the other solutions that passed and they all use an if statement:

if(balanceOf(msg.sender) < amount) return;

Are there limits to how many require() statements I have in a contract or function?

From what I've read, I thought require() is always preferred as the cheapest (least gas) way of checking something and failing gracefully. I can obviously just write an if statement...

I just need to know if I'm missing something or if the kata test is just borked.


texts: How to refund a wallet address from a contract with solidity and web3

texts:
I am building an app where I'd like a purchaser to be able to seek a refund from the contract. Essentially I am trying to transfer eth from a contract to a wallet. When I get to the point of issuing a refund, the transaction in MetaMask shows that my wallet is transferring to the contract, not vice versa as I'd like. I'm using web3 and solidity. Here is my js function that is called from the account seeking refund:

window.resellTicket = async function () {
// send a refund from contract to reseller
try {
  // Call resell method from contract
  const resell = TicketEvent.methods.resellTicket();
  await resell.send({'value': web3.utils.toHex(web3.utils.toWei('.1234', "ether"))});

} catch (err) {
  console.log(err);
}
load();
}

The resellTicket method in my contract:

function resellTicket() public payable {
  msg.sender.transfer(ticketPrice);
  isHoldingValidTicket[msg.sender] = false;
  increaseInventory();
}

What I see in MetaMask:

I've also tried hard coding the contract address as from: contract_address in my resellTicket js function in which case I get this error: Error: Returned error: Error: WalletMiddleware - Invalid "from" address.

I'm totally stuck here, any guidance would be appreciated!


texts: What are the options to use Ethereum on my mobile (Android) smartphone? Is there a "mist for mobile"?


texts: The thoughts of develop a dapp in the website

texts:
I’m trying to develop a dapp of storing image files with Parity and IPFS. And at first I just want to develop it in the website. Just like a platform or a cloud disk. But today I communicated with others I found there are some problems.
If I just make it like a platform, it means it need to maintain the blockchain for all users. It's still conformed to the thought of "decentration"?
And if so, I need to set some nodes to keep the blockchain running. But how many nodes should I set？One more user, one more node? That seems unpractical...

I think there are some wrong thoughts about blockchain in my mind... Please give me some advice about developing dapps in the website. Thanks a lot!! :)


texts: What is an accetable delay for ETH transaction during congestion

texts: I have withdrawn Eth from coinexchange 2 days ago. They have said it was successfully processed from their site and due to congestion may take a while.I have checked block explorer and it can't find the transaction. What would you experts consider a reasonable time for the transaction to appear.


texts: Get enum value from smart contract with javascript

texts:
This is my contract:
enum State { Active, Refunding, Pending, Releasing}

function state(uint orderid) public view returns (State) {
        return State.Releasing;
    }

In one Javascript to interact with contract:
async getState(order_id) {
    const contractInstance = await this.contract.deployed()
    //const status = ['Active', 'Refunding', 'Pending', 'Releasing']
    return contractInstance.state.call(order_id);
  }

In another javascript to call that function:
case RELEASE_PAYMENT:

        console.log("order_id in orderReducer:",action.id);

        (new PaypalContract())
                    .releasePayment(action.id)
                    .then(() => (new PaypalContract()).getState(action.id))
                    .then((e)=> {
                        console.log("status in orderReducer:",e)
                        return{
                          ...state,
                          orderStatus:e
                        }
                    })
        return{
                ...state,
                orderStatus:'Releasing'
              }

From web dev tool, I can see the returned 'e' is always a object, not a string value I expected. Any ideas?
Another question is about react, it looks the react just render once with the first returned state, after I got 'e' from contract, it won't render with the updated state.
Thanks.


texts: 2FA / Authentication Through Smart Contract

texts: How can I generate something similar to 2FA on-chain? Could the private key or public key be used somehow in secrecy to compute a value or something? I need a way to authenticate a smart contract user caller so no-one else can falsely pretend to possess his claim.


texts: What is the category of the 2 consensus algorithms here presented?

texts:
From the Ethereum Wiki:

  In a private chain context, there are three consensus algorithms that make the most sense:

  Proof of authority - essentially, one client with one particular private key makes all of the blocks

  PBFT (or some other traditional byzantine-fault-tolerant consensus algorithm)

  DPOS (or some other chain-based limited-validator consensus algorithm)

Algorithm 1:

From Chain.com (a private chain software):

  A consensus program specifies a set of N public keys and uses the CHECKMULTISIG and BLOCKSIGHASH instructions to confirm that the block witness includes M valid signatures on the block hash (where M and N are parameters of the algorithm).
  Each public key corresponds to a block signer. Block signers should never sign two different blocks with the same height. As long as no more than 2M - N - 1 block signers violate this rule, the blockchain cannot be forked.
  Because of this rule, block signers must coordinate to make sure they sign the same block. To ensure this, they rely on a single block generator. > The block generator collects transactions, periodically batching valid ones together into blocks.
  The generator sends each proposed new block to the block signers. Block signers only sign blocks that have already been signed by the generator.

Algorithm 2:

Suppose that there is a publicly known list of permissioned participants (pub keys). At every X seconds, one participant is deterministically, randomly chosen to be a validator. That participant signs a block and broadcasts to the rest of the network. Peers accept that block because it was signed by the correct validator. If a validator fails to broadcast a block within Y seconds, the network picks another validator.

Question

My question is: under what of those 3 categories the algorithms above fall? I assume Chain.com uses proof of authority, despite having many validators, since there is only one node generating blocks (so it doesn't really solve the problem). Algorithm 2 seems to be an instance of DPOS where all nodes have a fixed stake. Is that correct?


texts:
I am stuck at Step-6 of Bitdegree's Solidity tutorial. Question is to Emit an event ScoreChanged with two arguments: int amount (equal to the value that was sent) and bool direction (true for up function and false for down).

This is my solution for this,I have previously checked it with remix and there are no errors in my code. I am able to pass second test case where I have to write bool direction event but stuck at int amount event.I am not able to figure out why my solution is not getting accepted? I hope someone can help me. I am beginner in Solidity.

pragma solidity 0.4.17;
contract TugOfWar {

    int public score = 0;
    int constant endAt = 1 ether;
    bool public gameOver = false;
    bool public _direction;
    /*I even tried this
    event ScoreChanged(int indexed _amount, bool indexed _direction);*/
    event ScoreChanged(int _amount, bool _direction);
    event GameEnded(bool _gameOver);

    function up() external payable {
        require(msg.value > 0);
        require(!gameOver);

        int value = int(msg.value);
        score += value;

         ScoreChanged(value,true);

        checkIfGameOver();
    }

    function down() external payable {
        require(msg.value > 0);
        require(!gameOver);

        int value = int(msg.value);
        score -= value;

         ScoreChanged(value,false);

        checkIfGameOver();
    }

    function checkIfGameOver() internal {
        if(score >= endAt || score <= endAt * -1) {
            gameOver = true;
             GameEnded(gameOver);
        }
    }
}


texts: Invalid type for argument in function call. Invalid implicit conversion from mapping

texts:
I have defined struct for saving data to ethereum blockchain. I am using uint to map the data stored with a unique ID. I am using truffle framework to write smart contracts with solidity version: 0.4.24

Here are Structs:

    struct Location {
            string longitude;
            string latitude;
            string locationName;
        }

        struct Farm {
            uint farmId;
            string farmName;
            Location location;
        }

    struct Grapes {
            uint grapesId;
            string notes;
            uint vintageYear;
            address farmOwner;
            GrapeState state;
            Farm farm;
        }

mapping (uint => Farm) farms;
mapping (uint => Location) farmLocation;
mapping (uint => Grapes) grapes;

I am getting an error while writing data to struct:

function harvestGrapes(string _notes, uint _vintageYear, uint farmId) public verifyCaller(deployer) {

        previousGrapesId = previousGrapesId + 1;

        grapes[previousGrapesId] = Grapes ({
            grapesId: previousGrapesId,
            notes: _notes,
            vintageYear: _vintageYear,
            farmOwner: msg.sender,
            GrapeState: GrapeState.Harvested,
            farm: farms[farmId].farmName
        });

        emit GrapesHarvested(previousGrapesId);
    }

Here is the error log for the function call.

Named argument does not match function declaration.
        grapes[previousGrapesId] = Grapes ({
                                   ^ (Relevant source part starts here and spans across multiple lines).
,/C/Blockchain/WineSupplyChain/contracts/winebase/SupplyChain.sol:141:19: TypeError: Invalid type for argument in function call. Invalid implicit conversion from string storage ref to struct SupplyChain.Farm memory requested.
            farm: farms[farmId].farmName
                  ^--------------------^


texts: Why can't I deploy a Dapp on the testnet?

texts:
Considering testnet Ether is basically free, why would I have to use the real network?

If my Dapp doesn't revolve entirely around currency, why can't I deploy it on the testnet? (My Dapp would be a service that uses the unique features of the blockchain, and you'd simply pay for the service, without it being directly related to currency).

Is it less safe? Less used? What are the advantages of the real network over the testnet?

If I want to make something unofficial with my friends, is it ok to use the testnet? (I don't have the computing material to use and maintain a private blockchain).


texts: Sending entire contract balance to address

texts:
I am trying to establish a basic reversed auction in solidity using the Remix IDE.

In the last function i want to pay back the whole contract balance to a certain address.

My approach with .transfer(address(this).balance); does not work. Compiling is fine but after deploying the contract this line is not working.

Is there another way i can "empty" the contract balance. Or do i use the wrong syntax?

Help would be much appreciated ;)
Thanks

complete contract:

pragma solidity ^0.5.11;

contract ReverseAuction {

address payable public auctioneer;
address payable public lowestBidder;
uint public auctionEndTime;
uint public WTP;
uint public lowestBid;
bool ended;

mapping(address => uint) pendingReturns;

constructor(uint biddingTime) public payable {
    auctioneer = msg.sender;
    auctionEndTime = now + biddingTime;
    WTP = msg.value;
    lowestBid = WTP;
    ended = false;
}

function bid() public payable {                                         ///insurance deposit (linking with tracking contract!)
    require(now <= auctionEndTime,"Auction already ended.");
    require(msg.value < WTP,"Bid exceeds willingness to pay.");
    require(msg.value < lowestBid,"There already is a lower bid.");
    if (lowestBid != 0) {
        lowestBidder.transfer(lowestBid);
        pendingReturns[lowestBidder] += lowestBid;
        lowestBidder = msg.sender;
        lowestBid = msg.value;
    }
}

function AuctionEnd() public {
    require(msg.sender == auctioneer,"Insufficient permission.");
    require(now >= auctionEndTime, "Auction not yet ended.");
    require(ended == false, "AuctionEnd has already been called.");
    lowestBidder.transfer(lowestBid*2); ///paying back safety deposit + actual payment (so 2 times lowest bid)
    auctioneer.transfer(address(this).balance);  ///rest of the contract balance (WTP-lowest bid) should go back to the auctioneer
    ended = true;
}

}

Error message:

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


texts: Store data on Blockchain via Backend App

texts:
First of all, sorry about my bad english.

I looked in the forum but I did not find a similar situation, but I apologize if I'm repeating something here.

I need to develop an application that runs on my backend server, without Metamask, and write a hash in the transaction input data (or any other place I can retrieve later through the transaction address).

I'll only use one wallet, which I believe may have your information stored in my backend code. This wallet will only have the purpose of paying the GAS of the transactions.

Is this possible? I barely know where to start. I just know that I should develop this through web3.js and run through node.js, and everything I found tells me to use Metamask.

Can anyone help me?


texts: Are there any decentralized local exchanges for euro/usd to ether?

texts:
Is it possible to have something like a DApp to find the closest Ether owner to purchase or sell ether?

Something that can be used as a decentralized market.


texts: If a contract's function calls a function of another contract within it, is the address of the contract the msg.sender?

texts:
For example, a crowdsale contract has a function that creates an ERC20 token called "token" using a token contract that is already defined further up in the code being deployed. The constructor contains

token = createTokenContract();

And the createTokenContract() method contains:

function createTokenContract() internal returns (TierToken) {
    return new ERC20Token();
}

When inside a payable function in the crowdsale it now calls a function of "token" inside my crowdsale contract like

token.transfer(beneficiary, tokenAmount);

Inside of that call who is the msg.sender? The transfer function is from OpenZeppelins implementation so contains:

    function transfer(address _to, uint256 _value) public returns (bool success) {
      require(_to != address(0)); //not sending to burn address
      require(_value <= balances[msg.sender]); // If the sender has sufficient funds to send
      require(_value>0);// and the amount is not zero or negative

      // SafeMath.sub will throw if there is not enough balance.
      balances[msg.sender] = balances[msg.sender].sub(_value);
      balances[_to] = balances[_to].add(_value);
      Transfer(msg.sender, _to, _value);
      return true;
   }

In these balance checks and transfers where it uses balances[msg.sender], is that sender now the address of the crowdsale contract that contained the call to this function? Or is the sender the user that sent the ether to the contract (which then made the call to the token function)?

This may be simple but I cannot find this explained well in the docs in terms of  msg.sender relating to contracts calling functions of other contracts.

Thanks for any help.


texts: Cannot use abigen to make vyper bindings

texts:
using the command

abigen --vy=uniswap_exchange.vy --pkg=uniswap --out=UniswapExchange.go

results in the error: flag provided but not defined: -vy

support for the vyper compiler was just added a few days ago so I wanted to give it a try. I have the vyper compiler install in a virtual env which is running when trying the command above. I have also tested the compiler and it is working on my machine, and made sure to replace the abigen binaries using the

make && make devtools

command after updating my local go-ethereum source code.

any help would be much appreciated


texts: Do Structs inherit the visibility of the variable it is used in?

texts:
Do the variables MyStruct.name & MyStruct.balances inherit the public visibility since I assigned results to public?

Is it possible to make MyStruct.balances private while name to be public? I basically want to restrict access to balances only to the caller of the contract.

contract MyContract {
    struct MyStruct {
        bytes32 name;
        mapping (address => uint256) balances;
    }

    Result[] public results;
}

Is the best way to achieve this:

change Result[] public results > Result[] results
add public getter for results[x].name
add public getter for results[x].balances with modifier to only allow the contract caller to get their own


texts: How Do I Know If I Still Have Remaining DAO Refunds?

texts:
I purchased a small amount of DAO contracts last June. I followed articles on how to retrieve them on and off, and I may have acted on some of the instructions posted. However, because the whole process baffles me, I'm not sure if I did it or not. How can I find out if I still have DAO's left to retrieve?

Following the recommendation below to use Mist (why is my version displayed as Ethereum Wallet anyway?), I obtain the following screenshot

I'm not clear if that tells me that I have already retrieved my token from the DAO or I still have a balance in there.


texts: Is there a document describing the design rationale behind Ethereum?

texts:
What are the design decissions behind Ethereum?
Why are storage words 256-bit long?
Why is Ethereum using the account model and not the UTXO model?
...

Is there a document describing these design decissions?


texts: Is the cost of updating storage different than the cost of adding to storage?

texts:
Do these have a separate cost?

sstore(1, 10) # first time adding a value to storage with this key
sstore(1, 20) # changing the value in storage.

I looked for a list of gas costs / opcodes, and the only one I could find (https://docs.google.com/spreadsheets/d/1m89CVujrQe5LAFJ8-YAUCcNK950dUzMQPMJBxRtGCqs/edit#gid=0) is a year old. It seems to say that modifying storage is cheaper, but I'm not sure if these values are outdated.


texts: Is it possible to restrict smart contracts to particular users or "hide" the functions (e.g. by encrypting it) after it has been deployed?

texts: Such as by restricting use or views of the smart contract to holders of select public keys.


texts: How to create private key from mnemonic and extra-word using web3

texts:
In web3js, I can use below code to get private key and wallet address from mnemonic. But how can I get private key if user has mnemonic and extra-word from MEW

const ethers = require('ethers');
let mnemonicWallet = ethers.Wallet.fromMnemonic(mnemonic);


texts: Unable to store array of hash as a string in Smart Contract

texts:
I am converting array of hash into a string then store it in the smart contract. It is throwing error as;

  transact to Test.set errored: Error encoding arguments: SyntaxError:
  Unexpected number in JSON at position 46

Array: [0xca35b7d915458ef540ade6068dfe2f44e8fa733c,0xca35b7d915458ef540ade6068dfe2f44e8fa733c,0xca35b7d915458ef540ade6068dfe2f44e8fa733c,0xca35b7d915458ef540ade6068dfe2f44e8fa733c,0xca35b7d915458ef540ade6068dfe2f44e8fa733c,0xca35b7d915458ef540ade6068dfe2f44e8fa733c,0xca35b7d915458ef540ade6068dfe2f44e8fa733c,0xca35b7d915458ef540ade6068dfe2f44e8fa733c,0xca35b7d915458ef540ade6068dfe2f44e8fa733c,0xca35b7d915458ef540ade6068dfe2f44e8fa733c]

It is working fine when length of array is 2, more than this it is not working.

pragma solidity ^0.4.24;

contract Test {
   string public t;
   function set(string _t) public {
       t = _t;
   }
}

Conversion from array to string is handle by a separate javascript.


texts: I have used Metamask to generate a ERC20 wallet i think the wallet number for deposit of coins is  the public key.I have a log in for Metamask does this produce the private key??


texts: Error: VM Exception when inserting into ordered statistics tree

texts:
I am trying to use an ordered statistics tree library in solidity based on this implementation https://github.com/drcode/ethereum-order-statistic-tree with some minor modifications to make it into a library. I have a second library that uses this ordered statistics tree library inserting and retrieving data.I am testing it with truffle using contract based tests. I am able to insert and retrieve up to 3 values in the tree with no issues. When I insert a 4th value the test fails with the error  "Error: VM Exception while processing transaction: revert". I have no idea why this would be happening.
The basic data structure in the tree library is defined by

struct Node {
    mapping (bool => uint) children; //false left child,true right child
    uint parent;
    bool side;  //side of the tree?
    uint height;
    uint count;
    uint dupes;  //duplicates
}

struct Index {

        mapping (uint => Node) nodes;
        uint numberofInserts;
}

The insert function is defined in two components

function insert(Index storage index,uint value) {
    if(index.numberofInserts==0){
     //index.nodes[0]=Node(0,true,0,0,0);

    }
     index.numberofInserts+=1;
    if (value==0){
        index.nodes[value].dupes++;
    }
    else{
        insert_helper(index,0,true,value);
    }
}
function insert_helper(Index storage index,uint p_value,bool side,uint value) private {
    Node root=index.nodes[p_value];
    uint c_value=root.children[side];
    if (c_value==0){
        root.children[side]=value;
        Node child=index.nodes[value];
        child.parent=p_value;
        child.side=side;
        child.height=1;
        child.count=1;
        update_counts(index,value);
        rebalance_insert(index,value);
    }
    else if (c_value==value){
        index.nodes[c_value].dupes++;
        update_count(index,value);
        update_counts(index,value);
    }
    else{
        bool side_new=(value >= c_value);
        insert_helper(index,c_value,side_new,value);
    }
}


texts: What is the bootnode command in the go-ethereum documentation?

texts:
In the go-ethereum docs there is reference to a bootnode command:

  Creating the rendezvous point

  With all nodes that you want to run initialized to the desired genesis
  state, you'll need to start a bootstrap node that others can use to
  find each other in your network and/or over the internet. The clean
  way is to configure and run a dedicated bootnode:

  $ bootnode --genkey=boot.key

  $ bootnode --nodekey=boot.key

  With the bootnode online, it will display an enode URL that other
  nodes can use to connect to it and exchange peer information. Make
  sure to replace the displayed IP address information (most probably
  [::]) with your externally accessible IP to get the actual enode URL.

  Note: You could also use a full fledged Geth node as a bootnode, but
  it's the less recommended way.

Is this command part of go-ethereum or a separate program?

My computer fails to find the command.

I have tried install via apt-get install bootnode gives "no such package"

I'm also unsure what the boot object is (with key attribute).

Is anyone able to clarify this?

Why is it not recommended to have the bootnode be a full node?


texts: Why doesn't my contract call create a new transaction in my ganache transaction section?

texts:
goes easy on me because I'm quite new to all of this stuff.

So I've created a function which signs my transaction using web3js library and looks like this:

   signTx = async () => {
     const { accounts, contract, web3} = this.state
     const msg = 'henlo frendo'
     const hex_msg = web3.utils.toHex(msg)
     let signature = await web3.eth.sign(hex_msg, accounts[0])

     signature = signature.substr(2);
     var r = '0x' + signature.slice(0, 64)
     var s = '0x' + signature.slice(64, 128)
     var v = '0x' + signature.slice(128, 130)
     var v_decimal = this.state.web3.utils.toDecimal(v)
     //v_decimal has to be either 27 or 28
     if (v_decimal != 27 || v_decimal != 28) {
       v_decimal += 27
     }

    // Get the value from the contract to prove it worked.
const fixed_msg = `\x19Ethereum Signed Message:\n${msg.length}${msg}`
const fixed_msg_sha = this.state.web3.utils.sha3(fixed_msg)
const response = await contract.methods.recoverAddr(fixed_msg_sha,
v_decimal, r, s).call()

};

I can clearly see the that the transaction is signed properly if I do some console logs, but for example if I add a button to my front end which keeps calling this signTx() function, new transaction is never being made. What is the reason of this? Is it because I'm not fueling transaction with funds? If anyone could provide some documentation regarding this I would highly appreciate it!

P.S. I am using ganache as my network provider.


texts: How many miners are necessary for correct private blockchain work?

texts:
Can we calculate the number of miners,that we will need in private blockchain in advance and how?
for POW algorithm


texts: call: Alternative transfer at the byte code level

texts:
I am reading the following stuff from the research paper at:
Restricted Transfer

  We define a property that guarantees that ether transfers (via call)
  cannot be invoked by any user a. Violation of this property can detect
  Ponzi schemes [20]. Our compliance pattern requires that for all
  users, invocations of that call instruction do not transfer ether. Our
  first violation pattern checks if the call instruction transfers
  non-zero amount of ether and its execution is independent of the
  sender. For the second violation pattern, the amount of ether
  transferred depends on the transaction data (and thus can be set to a
  non-zero value), while the execution is independent of this data (and
  will thus take place).

It look like that the tool (Securify) eliminates transfers by 'call' by declaring them vulnerable. If this is the case then what are the other ways of transferring Ether at the bytecode level?

Zulfi.


texts: Failing to add liquidity to pancakeswap on bsc testnet

texts:
Here is the error message.
Fail with error 'PancakeRouter: EXPIRED'

Here is the transaction details
I suspect its because of the deadline attribute? I have no clue on how to do a  block.timestamp , so I try to time it by checking when is the "nearest" blocktime from https://testnet.bscscan.com/block/countdown/
Does anyone know why im getting this error, and is there a way to fix it?


texts:
I am trying to run someone else's code from GitHub and I encounter this issue.
It said that Invalid implicit conversion from uint256 to bytes32 requested.
Please have a look on this code.
function signDocument(int id) public payable {
        if(msg.value != signaturePrice) {
            revert();
        }
        if(id <= lastId) {
            documents[uint256(id)].signatures.push(msg.sender);

            // ======== Something wrong with the line below ======= //
            documents[uint256(id)].signaturesSring += bytes32ToString(msg.value);
            // ==================================================== //

        }
        emit Status('Signed Document ID at Last row:', msg.sender, uint256(id));
        emit Status('New Signature On Document', msg.sender, block.timestamp);
        owner.transfer(address(this).balance);
    }

Full Code
pragma solidity ^0.5.11;

contract Notary2 {

    struct Document {
        address[] signatures;
        string documentToSign;
        string signaturesSring;
    }

    address payable public owner;
    Document[] public documents;
    int public lastId = -1;
    uint256 documentCreationPrice = 0.001 ether;
    uint256 signaturePrice = 0.0001 ether;
    address[] temp;

    event Status(string _msg, address user, uint256 time);

    constructor() public{
        owner = msg.sender;
        emit Status('Notary Created', msg.sender, block.timestamp);
    }

    function createDocument(string memory _document) public payable {
        if(msg.value != documentCreationPrice) {
            revert();
        }
        //address[] signature;
        temp.push(msg.sender);
        documents.push(Document({
                documentToSign: _document,
                signatures: temp,
                signaturesSring: addresstoString(msg.sender)
            }));
        delete temp[0];
        emit Status('New Document Created', msg.sender, block.timestamp);
        emit Status('New Document ID at Last row:', msg.sender, uint256(lastId));
        lastId += 1;
        owner.transfer(address(this).balance);
    }

    function signDocument(int id) public payable {
        if(msg.value != signaturePrice) {
            revert();
        }
        if(id <= lastId) {
            documents[uint256(id)].signatures.push(msg.sender);
            documents[uint256(id)].signaturesSring += bytes32ToString(msg.value);
        }
        emit Status('Signed Document ID at Last row:', msg.sender, uint256(id));
        emit Status('New Signature On Document', msg.sender, block.timestamp);
        owner.transfer(address(this).balance);
    }

    function bytes32ToString (bytes32 data) public returns (string memory) {
        bytes memory bytesString = new bytes(32);
        for (uint j=0; j<32; j++) {
            byte char = byte(bytes32(uint(data) * 2 ** (8 * j)));
            if (char != 0) {
                bytesString[j] = char;
            }
        }
        return string(bytesString);
    }
    function addresstoString(address x)public returns (string memory) {
        bytes memory b = new bytes(20);
        for (uint i = 0; i < 20; i++)
            b[i] = byte(uint8(uint(x) / (2**(8*(19 - i)))));
        return string(b);
    }

}

Sorry, I am new with solidity and solidity seems to have various versions and each version has different syntax. Please help me in this issue. I am looking forward to hear all of your idea. Thank you in advance.
Link : https://github.com/magonicolas/Ethereum-Solidity/blob/master/Notary.sol


texts:
I'm running Manjaro Linux (based on Arch), so I already have very up-to-date system versions of geth and parity.

I want to use my system geth without being forced to download another copy.

Alternately, I may not want to have geth on my system at all, using a parity node with config file:

[parity]
geth = true

and mist --gethpath $(which parity) (but this issue is currently a blocker).


texts:
I've created a config.toml for Ropsten (NetworkId =3) that looks like this:
https://pastebin.com/raw/2DxWE1jf
But when I run
geth --config /home/path-to-config

From the cli I get: (Note ChainID:1, should be 3)
INFO [08-27|00:10:34.285] Initialised chain configuration config="{ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000 Byzantium: 4370000 Constantinople: 7280000 Petersburg: 7280000 Istanbul: 9069000, Muir Glacier: 9200000, YOLO v1: <nil>, Engine: ethash}"

And the clients is stucked looking for peers.
What I'm missing? If I run geth --testnet it works fine.
In Geth the configuration file works differently from bitcoin/parity?
I've also tried to dump the config file from geth --testnet, that works, but if I delete the chaindata I have the same problem. I need to pass the configuration file on the first run of the node


texts:
I am developing a website (Php/mysql) for trading, which will communicate with block chain via smart contract. My website will be a service based website. it will not a high traffic website and have restricted access.
So I need to host the website somewhere and also need to download Ethereum blockchain. I believe hosting website and creating ethereum node in same server will be a good idea so that code can connect locally to the blockchain. I will be using go-ethereum client and node.js.

I was thinking of using a VPS. My question is what should be the minimum hardware requirements (CPU, RAM. memory etc). Anything that I might need to take care of? Is AWS EC2 instance a better option ?


texts: Has Truffle's call() function stopped working as expected?

texts:
I recently upgraded ganache-cli and many of my truffle tests stopped working. In particular, there were tests where I make a contract method invocation with .call() in order to get the return value instead of a transaction back.

For instance, with a method that creates a new thingy and returns the ID that was assigned to it, I used to invoke with 'call()' to get the id back, expecting that no actual data would be persisted. Then I'd make the call 'for real' by not using .call(), and it would yield a transaction. The actual ID assigned would be the one that the invocation with .call() had returned.

My tests are now failing all over the place, and particularly, if I invoke a view function that returns the number of thingies that have been created the number is greater than expected. This is happening within the controlled environment of a unit test running against a local ganache-cli instance.

Can anyone confirm that .call() no longer works as expected and is actually creating data?


texts: Remix: 0x0 Transaction mined but execution failed due to construction

texts:
I have the following example smart contract, where I cannot deploy using remix into my private network using environment Web3 provider. The error I am getting is Transaction mined but execution failed due to construction.

Please note, that my actual smart contract takes around 6.500.000 gas to deploy. I can deploy it if its constructor is empty, but I cannot if I set a storage variable in the constructor like I shown on the example.

Update: I am able to deploy my contract using solidity ^0.5.0 but higher versions does not work.

pragma solidity ^0.5.7;

contract Contract {
    address public owner;
    constructor() public
    {
        owner = msg.sender;
    }

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

Transaction receipt:

When I comment out owner = msg.sender; the contract deploys successfully. But later if I call the set function, I get Gas estimation failed warning message and the set() does not deploy.

When I call the set() function warning message:


texts:
How realistic is to shutdown Ethereum network, so the smart contracts won't be executed anymore?

Are there any practical or theoretical destructive ways to do it? Intentionally or not?

Like a multiple major security threats, DDoS attacks, injecting malicious nodes or governments will start blocking the nodes. Is it even possible?


texts:
binance smart chain v1.0.7
When new node complete syncing, RPC returns 0x0 values few hours.Can I fix that? Please help me


texts:
I am looking to implement the zk-SNARK capabilities of Ethereum to allow a user to prove that they have all the components required ('a', 'b', 'c', 'd') to create a publicly known hash 'x'. My general problem can be defined as:

def main(x):
    sha3(a, b, c, d) == x
    return 1

I understand that there are two options to use when it comes to converting this general form program into a QAP and subsequent verification: ZoKrates (https://github.com/JacobEberhardt/ZoKrates) and libsnark (https://github.com/scipr-lab/libsnark).

Would anyone be able to help in guiding me through the steps to convert this into a workable piece of code:

Constructing the circuit either using ZoKrates or libsnark
Generating the proving and verifying key
Generating proofs
Verify the proof in Solidity

The documentation / practical examples are fairly limited so will appreciate any help that can be given.


texts: TypeError: push is not detected as a function for address payable dynamic array

texts:
I'm trying to add the manager address to the playes array. I get the following error:

TypeError: Member "push" not found or not visible after argument-dependent lookup in address payable[] storage ref.

This is my code:
pragma solidity ^0.7.1;

contract Lottery{
    address public manager;
    uint public value;
    address payable[] private players;

    constructor() payable {
            manager = msg.sender;
            value = msg.value;
    }

    function enter() public payable {
            require(value > 0.01 ether);
            players.push(manager);
    }

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

    function pickWinner() public{
            uint index = random() % players.length;
            players[index].transfer(address(this).balance);
    }
}

Any ideas? Thanks!


texts: Subscribe to events usign geth websocket

texts:
I'm trying to subscribe to geth using the websocket api. First step was to start geth:

geth --ws --wsport=8456 --wsorigins="*" --fast --cache=512 --rpcport=8455 --rpc --rpcapi="personal,eth,network"

Then I tried to connect to it using websockets from python:

from websockets import connect
import asyncio

async def get_event():
    async with connect("ws://localhost:8456") as ws:
        await ws.send(json.dumps({"id": 1, "method": "eth_subscribe", "params": ["newPendingTransactions"]}))
        subscription_response = await ws.recv()
        while True:
            try:
                message = await asyncio.wait_for(ws.recv(), timeout=60)
                pass
            except asyncio.TimeoutError:
                # No data in 20 seconds, check the connection.
                try:
                    pong_waiter = await ws.ping()
                    await asyncio.wait_for(pong_waiter, timeout=10)
                except asyncio.TimeoutError:
                    # No response to ping in 10 seconds, disconnect.
                    logger.critical("socket timeout")
                    break
            else:
                pprint(message)
if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    while True:
        loop.run_until_complete(get_event())

I'm getting subscription response:
'{"jsonrpc":"2.0","id":1,"result":"0xde19c48fe52cd12207f807f330630e2b"}'

But not receiving any messages after that and running in the TimeoutError. Any idea what is going wrong?


texts: How do you send ether using truffle/ether-pudding?

texts:
How do you do a sendTransaction to simply send ether from one account to another in ether-pudding?

In web3 I would do this:

web3.eth.sendTransaction({ from: a, to: b, value: 100 })

I would like the promisey goodness of ether-pudding though.


texts: How to enable and mine Testnet (Morden)?

texts:
I have installed Ethereum Wallet on Ubuntu 14.04.
After the installation was completed, I realized that my Testnet (Morden) mode was disabled.
Looking in the Develop -> Network menu, the Main network is selected and I cannot change it to Testnet. The mining function on Testnet is also disabled.

I tried to update the blockchain by running the command:

geth --testnet

I then ran Ethereum Wallet. The banned besides the "send button" has now changed to "TEST-NET" with a red color. But the mining function is still disabled.

When I tried to use the hotkey "ctrl+shift+2" to change to Testnet, a popup to input new password appeared. But after I entered the password, Ethereum Wallet automatically shut down.

Please help me get back the Testnet & Mining functions.

Thanks a lot.


texts: Does the Ethereum source code only get updated during hard forks? What about clients?

texts:
The goal of Ethereum is to be decentralized, but (cmiiw) at the end of the day it's a collection of code maintained by the Ethereum Foundation. I know they update it and constantly add new, great features all the time, but who has the decision-making power here? list of hard forks, and list of EIPs.

Is it considered decentralized/community-based simply because it's open-sourced code that anybody can contribute to?

Basically, who accepts the pull requests at end of day, and how do they decide what to accept.

Bonus: how does Ethereum's responses to ^ contrast with that of Bitcoin?


texts: How can I output the latest block number to a web page using web3.js 1.0.0 beta?

texts:
On a previous version of web3js it was just

document.write(web3.eth.blockNumber + "

");

and it outputs it in the section of the page where the script is as seen in the infura example tutorial here

But in v1.0.0 it returns "undefined" and displays that on the screen.

from the documentation the new getBlockNumber method is

web3.eth.getBlockNumber([callback])

I have tried

               web3.eth.getBlockNumber(function (error, result) {
                        if(!error)
                        {
                            console.log(result);
                            document.write(result);
                        }
                        else{
                            console.log(error);
                        }
                });

But that just removed all other html from the page and wrote the block number.

I just want to be able to output the current block number to the screen at a particular html element. Can anyone help me out?

I don't know javascript so web3 is obviously a bit of a struggle for me. Still struggling to wrap my head around promises, callbacks, etc.

BAsically I think my problem is not understanding why this method requires a callback, or what the callback is supposed to be.

I'd really appreciate any help. Thanks guys.


texts:
If I create a new Ethereum blockchain using a new genesis block and network id, is it possible to restrict the access to it only to specific nodes?

In other words, can I avoid that undesirable nodes with the same genesis block and same network id attach to my blockchain?


texts: Functions that are used for token transfers for ERC20 and ERC721 tokens

texts:
Let's suppose there is a contract address A of an erc721 token B. If I want to monitor all of its transfers from A to another address say C then should I only filter the Transfer function or should I also monitor safeTransferFrom and transferFrom here. If yes then is there any other event apart from these three that I should be monitoring? And if no then why?
If the same scenario is considered for an erc20 contract then which functions should be monitored just Transfer or transferFrom as well?


texts:
I working with projects on the blockchain. Making web apps which communicating with smart contracts, giving tokens or etc.

For web apps, I need to get users wallet (Ethereum). I using these software/extensions: MetaMask, Portis, Fortmatic.

Now I making an app on Unity and I starting research of Web3 providers software for Unity.

MetaMask - is working only in PC browsers, working like an extension (Chrome). Portis - working on JavaScript (I using in React framework), they didn't support an opportunity to integrate that in Unity. Fortmatic - same like Portis.

Maybe you know someone, who solve the same problem or some software to do that. That would be great!


texts: A decentralized marketplace with Swarm/Whisper and Ethereum Smart Contract

texts:
I was thinking about a workflow where we could use Swarm, Whisper and Ethereum in order to sell any kind of digital data.

I drew a sequence chart and I wanted to have some feedbacks:

Is there anything that I missed ?

I know that the file can be decrypted then leaked but that happens with all digital data.


texts:
Absurd Gas Prices From the BAT Token Creation Period

118 GWEI * 200000 == 0.0236 ETH == $6.13 USD
7590 GWEI * 200000 == 1.518 ETH == $394.68 USD
58000 GWEI * 200000 == 11.6 ETH == $3,016 USD

How to set custom gas price? No matter what way, I can't set gas price more than 60GWEI on MyEtherWallet.


texts: Invalid block header RLP and rlp: input string too short for common.Hash, decoding into (types.Header).Root

texts:
when I run the geth as a private chain node it shows error below:
C:\tools\src\github.com\ethereum\go-ethereum\geth.exe init C:\tools\src\github.com\ethereum\go-ethereum\genesis.json #gosetup
INFO [09-14|14:23:29.550] Maximum peer count                       ETH=50 LES=0 total=50
INFO [09-14|14:23:30.116] Set global gas cap                       cap=25000000
INFO [09-14|14:23:30.171] Allocated cache and file handles         database=C:\Users\root\AppData\Roaming\Ethereum\geth\chainda
ta cache=16.00MiB handles=16
ERROR[09-14|14:23:30.330] Invalid block header RLP                 hash="f7973e…d25ea5" err="rlp: input string too short for c
ommon.Hash, decoding into (types.Header).Root"
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x54 pc=0x7b2e77]

goroutine 1 [running]:
github.com/ethereum/go-ethereum/core.SetupGenesisBlock(0x12af540, 0xc00000a000, 0xc0000d0160, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc00000
a000, 0x0)
        C:/tools/src/github.com/ethereum/go-ethereum/core/genesis.go:178 +0x397
main.initGenesis(0xc000202420, 0x0, 0x0)
        C:/tools/src/github.com/ethereum/go-ethereum/cmd/geth/chaincmd.go:251 +0x809
github.com/ethereum/go-ethereum/cmd/utils.MigrateFlags.func1(0xc000202420, 0x0, 0xc000202420)
        C:/tools/src/github.com/ethereum/go-ethereum/cmd/utils/flags.go:1899 +0xc7
gopkg.in/urfave/cli%2ev1.HandleAction(0xeafaa0, 0xc00004ed70, 0xc000202420, 0xc00013ce00, 0x0)
        C:/tools/pkg/mod/gopkg.in/urfave/cli.v1@v1.20.0/app.go:490 +0x89
gopkg.in/urfave/cli%2ev1.Command.Run(0x1078a71, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10b026e, 0x2c, 0x0, ...)
        C:/tools/pkg/mod/gopkg.in/urfave/cli.v1@v1.20.0/command.go:210 +0x9fb
gopkg.in/urfave/cli%2ev1.(*App).Run(0xc0000641a0, 0xc000098000, 0x3, 0x4, 0x0, 0x0)
        C:/tools/pkg/mod/gopkg.in/urfave/cli.v1@v1.20.0/app.go:255 +0x768
main.main()
        C:/tools/src/github.com/ethereum/go-ethereum/cmd/geth/main.go:273 +0x6a

Process finished with exit code 2
the genesis.json is :
{
  "config": {
    "chainId": 10,
    "homesteadBlock": 0,
    "eip150Block": 0,
    "eip155Block": 0,
    "eip158Block": 0,
    "byzantiumBlock": 0,
    "constantinopleBlock": 0,
    "petersburgBlock": 0,
    "istanbulBlock": 0
  },
  "alloc": {},
  "coinbase": "0x0000000000000000000000000000000000000000",
  "difficulty": "0x20000",
  "extraData": "",
  "gasLimit": "0x47e7c4",
  "nonce": "0x0000000000000042",
  "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp": "0x00"
}

C:\tools\src\github.com\ethereum\go-ethereum>geth.exe version
Geth
Version: 1.9.22-unstable
Architecture: amd64
Protocol Versions: [65 64 63]
Go Version: go1.15.2
Operating System: windows
GOPATH=C:\tools
GOROOT=C:\Go\

So how to solve it? thank you very much !


texts: How are patricia trees used to prove the balance of an account?

texts: I understand how merkle trees are used to prove the balance of an address with a small subset of the blockchain. On the Ethereum case, though, the result of a transaction could depend on the final state of a contract, which could depend on all transactions ever sent to it. How can you be able to prove the balance of an account while at the same time ignoring all transactions that modified the state of a contract that sent Ether to that account?


texts: Can a Smart contract post an advert on facebook, twitter, etc?

texts:
Assume we have a variable in a smart contract. When it reaches a certain value (as a result of interacting with), it posts an advert on social media, like Facebook, and pays for it.

Question: Is it possible that a smart contract automatically places an advert on social media and pays for it?


texts: Costs/efficiency of locating stored data on Ethereum

texts:
Based on the answer to this question, storing IPFS hashes on Ethereum could be done in 3 ways:

Store it as a string
Store it as a struct
Store it in event log

Ordered from most expensive to least expensive.

Now, assuming I would like to continue to store multiple hashes from time [t0 - t1] using one specified method, what would be the costs to locate these hashes over the blockchain beyond time t1?

For example, consider a scenario where students upload IPFS hashes of their homework assignments to the blockchain while the actual data lives on IPFS. After the submission deadline, I would like to trace who has submitted within that time frame.

Can someone compare all three methods in terms of finding these hashes?


texts: Can't open the wallet (Windows 10, 64 bit)

texts:
Only thing I have is an image saying

  Starting Ethereum node...

If I quit and start it again it says:

  Couldn't start an Ethereum node! Are you already running a node

Windows 10 64bit


texts:
Is it possible to save the REMIX environmental settings.  Every time I reopen REMIX I have to change the THEME (I prefer Light theme) and adjust the ZOOM.
Thank you


texts: Are contracts able to send messages to EOA's?

texts:
I know that EOA's can send transactions between each other, but also to contracts.

However, contracts can only send so-called messages, i.e. data without signature (authentication).

I'm confused, whether contracts may only send messages between each other in the Ethereum execution environment (EVM), or they can also send messages to EOA's (e.g., send ether).

Can someone clarify?


texts: Direct sale smart contract, is this working without security issue?

texts:
I want to make a page for direct sale of my token, just like the one in Loomx, with a fixed token price (changeable later by me) and immediately transfer token to buyer securely after purchase.

I try to "steal" their smart contract but it's not verified and public. When I try search online, most are Crowdsale, which seems to be over complicated.

I also found a direct-corwdsale library, but it seems not being used widely.

Here's my code which is very simple:

pragma solidity ^0.4.24;

import 'http://github.com/OpenZeppelin/openzeppelin-solidity/contracts/ownership/Ownable.sol';
import 'http://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/ERC20.sol';

contract Directsale is Ownable {

    uint public tokensPerEther;
    ERC20 public token;
    bool public saleClosed = false;

    event FundTransfer(address backer, uint amount);

    constructor (
        uint tokenPerEachEther,
        address tokenAddress
    ) public {
        tokensPerEther = tokenPerEachEther * 1 ether;
        token = ERC20(tokenAddress);
    }

    function closeSale() external onlyOwner {
        saleClosed = true;
    }

    function setTokenPrice(uint tokenPerEachEther) external onlyOwner {
       tokensPerEther  = tokenPerEachEther * 1 ether;
    }

    function () payable public {
        require(!saleClosed);
        require(msg.value > 0);
        uint amount = msg.value;
        token.transfer(msg.sender, amount * tokensPerEther);
        emit FundTransfer(msg.sender, amount);
    }

}

Would that be ok and would not cause any security issue?

And, is there any good open-source example including the web3 javascript, so I can study with?


texts: What are the alternative methods of specifying gas price for contract execution?

texts:
This is possibly a rhetoric question, but I didn't find an answer to it. There are excellent answers to similar questions from @eth How much does it cost to use a contract? and When calling a smart contract function, who gets paid and how much does the caller pay?

Q1. Please validate the inputs and outputs of the following statement:

GIVEN All the following statements validate true:
1. Only transactions are mined.
2. Gas price "market" is non-deterministic (example: http://ethgasstation.info/)

THEN One the the only acceptable method of specifying gasPrice is for a transaction, before invocation by an external account, i.e. before the transaction is signed and submitted to blockchain.

Q2. Are there alternative methods of specifying gasPrice and what are their guarantees that that transaction will be mined?


texts: How to hide "Events emitted during test" in truffle test?

texts:
When I run truffle test and my test fails - the log gets polluted with numerous messages which make difficult to read the error message itself and other debug outputs
 Events emitted during test:
    ---------------------------
 Ownable.OwnershipTransferred(
      previousOwner: <indexed> 0x0000000000000000000000000000000000000000 (type: address),
      newOwner: <indexed> 0x627306090abaB3A6e1400e9345bC60c78a8BEf57 (type: address)
 )
 IERC20.Transfer(
      from: <indexed> 0x8065F4c7b8c2bf53561af92D9DA2Ea022A0b28Ca (type: address),
      to: <indexed> 0x0d1d4e623D10F9FBA5Db95830F7d3839406C6AF2 (type: address),
      value: 119951999785389 (type: uint256)
    )

    Warning: Could not decode event!

... lots of other events ...

---------------------------

finally useful data

is there any way to hide events from the logs?


texts: Should I convert Centeralised web app to Multichain because it is free to use and more secure compare to webapp?

texts:
I am Web app developer and exploring the blockchain technology from few months.

I want to convert the live centralized WebApp to Decentralized Blockchain application.

I know there is a high cost of Inserting data in to blockchain and there is 15 GB of data I want to put into Blockchain.

I came across the Multichain and found that, we can use it if we want to create private blockchain and there is no cost apart from server on which data is stored.

1 - The webApp is not having any Financial Info but simple user Info and Images. So is it advisable to use Multichain here?

2 - Can normal user like users outside organization can update the data?

3 - What is the your advise Normal Blockchain or Multichain?

Thanks.


texts: How to verify my account in order to use the Kovan testnet?

texts:
I am new to parity and kovan-testnet.

I have to verify my account in order to receive keth.

I am confused as to where to execute the following code:

curl http://github-faucet.kovan.network/url --data "address=https://gist.github.com/[github_username]/[gist_hash]"


texts: solidity - forever can't return the msg.sender balance

texts:
this is my contract code

pragma solidity ^0.4.4;
contract IamHongKongTokenBack_00{

  // 現在我錢包的地址+Eth量
function SeeMyAddAndETHVar() public constant returns (address, uint) {
    address _myadd = msg.sender;
    return ( _myadd,  _myadd.balance);
}

// 查看其他地址的Eth量
function SeeSheEthVar(address _InputAdd) public constant returns (address, uint) {
    address _SheAc = _InputAdd;
    return (_SheAc, _SheAc.balance);
}

}

the SeeMyAddAndETHVar is use see my address and ETH amount

and SeeSheEthVar is use input address and see this address and ETH amount

If i use 0X123... address go to this contract
now i use the SeeSheEthVar Input address 0X789...
i can see the correct address and correct ETH amount

but use SeeMyAddAndETHVar
i will see the correct address and error ETH amount

so strange
When I change use 0X789... address go to this contract
i will can see 0X123... correct address and correct ETH amount
but 0X789... address is both error ETH amount

May I ask where my problem is
Thanks for answer~!!


texts: What does this import code in solidity actually do? Where are the files located?

texts:
If MyCo.sol contract needs to access the Owned.sol contract, how is the file firing? Does the Owned.sol file have to be added to the blockchain prior to firing MyCo.sol; if so, does it just need to be set under the owners contract/address prior to executing ? Does the ./ or ../ location reference some location on the chain or only used to locate the file prior to setting it with a tx?

MyCo.sol

import "../lib/Owned.sol";

how does MyCo.sol know where to find the imported files?  Have they become embedded somehow in the initial migration? I think I am just confused about the blockchain file structure and how it would access these imported files.  Is it all resident on the chain, or a hybrid between the MyCo.sol, the native go-ethereum language, and wbd3.js protocols?


texts: Deploy a contract (factory) with web3 based on the connected wallet?

texts:
A big newbie into solidity here.
I’ve managed to compile and deploy  (with truffle) a ContractFactory from OpenSea repository.
Long story short the part with the deployment is this
if (DEPLOY_CREATURES_SALE) {
    await deployer.deploy(CreatureFactory, proxyRegistryAddress, Creature.address, {gas: 7000000});
    const creature = await Creature.deployed();
    await creature.transferOwnership(CreatureFactory.address);
  }

I would like to use a user interface that on click it will deploy this contract, based on the connected wallet on that page with web3js. Is it possible? Or do I have to compile it every time for a new wallet?
This is all because, if you want to mint a token you need to own the contract.


texts: Proof of Stake Contracts, after deployment?

texts:
I'm curious, for reference lets use this tokens for example. They all seem to have close to the same contract.
1. PoSToken (POS) - https://etherscan.io/address/0xee609fe292128cad03b786dbb9bc2634ccdbe7fc#code
2. Rebellious (REBL) - https://etherscan.io/address/0x5f53f7a8075614b699baad0bc2c899f4bad8fbbf#code
3. Staker (STR) - https://etherscan.io/address/0xbae235823d7255d9d48635ced4735227244cd583#code

Looking at the "Write Contract" page of these tokens on etherscan and this spot "4. ownerSetStakeStartTime".

I'm curious to know after the contract creator deploys this sort of contract do they have to place a number of some sort or timestamp in this spot "4. ownerSetStakeStartTime" then write to start the contract.


texts: address.transfer no transaction on etherscan

texts:
I tested fallback function in my smart contract, and noticed, that there is no transaction on etherscan from smart contract to my account.

In short: i try to send money to contract and receive back a half of sent amount. Here is a code of fallback function (really simple):

function () payable {
    uint money = msg.value;
    uint half = money / 2;
    msg.sender.transfer(half);
}

For example, when i send 6 eth on contract, i receive back 3. It works, and i see transaction of sending 6 eth to contract in etherscan. But i don't see transaction of sending 3 eth back to my address.

Why?


texts:
I'm trying to get Transaction Action information from Etherscan Apis by using a transaction hash without success.
Here is what I want to extract (Swap 1 Ether For 2 Yf-DAI) with the API.
I have already tried to decode information returned by
eth_getTransactionByHash

Here but nothing close to getting transaction action.
My question is which endpoint should I query or what do I do to get the transaction Action


texts:
I am trying am trying to follow this tutorial to build a blockchain based voting app. When I run,

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

It shows me a following in the next line,

...

Basically, the program stops executing commands after that. How to solve it?


texts: How to get the transaction confirmations using the JSON RPC

texts:
How do I get the block confirmations for a specific transaction using the JSON RPC?

This is information that would come inside the transaction JSON in bitcoin but it doesn't seem to come in ethereum.

What am I missing?


texts: What aspect affects the GPU's mining speed?

texts:
I recently got my Asus Radeon RX 580 8GB and decided to test it out on mining. It has default core clock speed 1380 MHz, and memory clock 2000 MHz.

Now, my first test with stock settings (no OC, no modded bios), I get around 23 Mh/s.
Second try with modded bios, without OC, I get merely 26 Mh/s, mostly stayed at 25.9 Mh/s or so.

After some researches, I found some other people's settings in Afterburner that claimed to have high hash rate like around 30 Mh/s, so I tried theirs and it only lowered my hash rate a bit, and not increasing it at all. For example this user claimed 29-30 Mh/s, with his settings applied, I get nowhere near 30. Similarly with this user, but his settings doesn't get me the same hash rate neither.

So I decided to tweak around Afterburner myself, and it seems that my core clock at 1250 Mhz, and memory clock at 2100 MHz can get me up to just 27 Mh/s. If I go higher with those 2 settings, it doesn't affect too much and sometimes even drop down.

So here I am, wondering what settings affect the mining performance? Core clock and memory clock? And how do they affect the performance, because it's clear that it's not the higher the better!

Another thing I don't understand is with the same settings in Afterburner applied, some users claim they get up to 30 Mh/s, and I reach around 25 Mh/s only. What's the catch here?


texts: I am trying to list circulating supply on coingecko for an ERC20 token - how would I go about doing this? I've been able to find one for total supply, but not circulating however.


texts: How to send correct SwapExactEthForTokens params types on ethers/web3.js?

texts:
I need to know how to send correct paramaters / paramater types as in what does the parameter type has to be is it a hex number , a string ?
help would be massively appreciated.
Notes:
1)i cant set value in trade (object sent with value and gasPrice) to 1 bnb in wei i get an error that its a bignumber.
2)sometimes the code actually works and i get a hashcode but this hashcode doesnt yield any information of an existing transaction at all.
I imported pancake swaps router functions like this :
const router = new ethers.Contract('0x10ED43C718714eb63d5aA57B78B54704E256024E', [
'function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
 external virtual override payable returns (uint[] memory amounts)',
'function getAmountsOut(uint amountIn, address[] memory path) public view virtual override returns
(uint[] memory amounts)'], account);

Then I proceeded to use these functions to pull a trade with the following code :
const init = async () => {
desiredCoin = '0x0231f91e02DebD20345Ae8AB7D71A41f8E140cE7';
bnb = '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c';
const pairAddress = [bnb, desiredCoin];
//use https://bscscan.com/unitconverter to input bnb amount.
const amountIn = 1
amounts = await router.getAmountsOut(
    amountIn,
    pairAddress
);
amountOutMin = amounts[1].sub(amounts[1].div(slippage)); //slipapge set here
console.log('Calculated Amounts out: ' + amountOutMin);
const to = bnbwalletAdress;
const deadline = Math.floor(Date.now() / 1000) + 60 * 10; //this represents 10 mins of deadline, change to ur liking.
const tx = await router.swapExactETHForTokens(
    amountOutMin,
    pairAddress,
    to,
    deadline,
    {value: 1, gasPrice: 10e9}
)
console.log('Transaction Submitted, heres the hashcode '+ tx.hash)
receipt = await tx.wait();
console.log(receipt);
}


texts: Can't we incentivize miners to include more transactions in their block?

texts:
If you go to etherscan.io, you can see that each block has the different number of transactions. Can't we incentivize miners(e.g. give more rewards ) to include more transactions in their block so that the ethereum network can compute more transactions per a second?

Currently, it doesn’t make much economical sense for miners to wait and include more transactions because transaction fees are too small of a part of the total block reward for them to bother with that.


texts: There is some way that I can subscribe to the balance to a address using web3js of Eth


texts: How do I deposit Ether to Smart Contract using Web3.js

texts:
So I am creating a web application that interacts with a smart contract that I deployed on the Ropsten TestNet.

I am able to withdraw ether from the contract to my Metamask account using a withdraw function.

However I am struggling to find out the correct method to deposit ether to the Smart Contract i.e what syntax/function do I need to use. My contract is definitely Payable(), and lets me deposit ether when I view and interact with it through Etherscan.

Any help would be greatly appreciated as I am under a lot of pressure. Thanks!

Here is how I can withdraw ether... now I need a deposit function

abi = JSON.parse('[{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getMyBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"deposit","outputs":[],"payable":true,"stateMutability":"payable","type":"function"}]');
var bankContract = web3.eth.contract(abi);
contractInstance = bankContract.at('TheContractAddressHere');

function withdraw() {
  contractInstance.withdraw(300000000000000000, { from: web3.eth.accounts[0]}, function(err, result){ revert(); } );
}


texts: How do I count the elements of an array in solidity?

texts:
In my project, I want to count the elements of an array as follows:
    struct Server{

       uint sernum;
       uint num;
       uint data;
    }
    Server [] public datta;

    function count() public constant returns(uint sercount) {

        return datta.length;
    }
    function set_data (uint Sernum ,uint Num, uint Data  ) public  {
        Server memory xserver = Server(Sernum,Num,Data);
        uint x= count();
        bool y;
        if(x>=1){

            for (uint i = 0; i<datta.length;i++){

                if(datta[i].sernum == Sernum && datta[i].num==Num && datta[i].data<Data){

                    y=true;
                }
                else{

                    y==false;
                }
            }
            if (y==true){

                datta.push(xserver);
      }
   }

When I call a count function to see how many elements in the array it always gives me 1 no matter how many of the elements of the array
   print( format(contract.functions.count().call()))

How do I count the elements of an array ??


texts: What are the practical uses of Allowance in ERC20 tokens?

texts:
I'm studying ERC20 specification and all seems to make sense. Well, all but allowance. I couldn't grasp to the concept and it's usefulness.

What should I use it for? (Should I at all?)

What are the drawbacks of setting an allowance for too high or too low?


texts: How to write on the blockchain from vb.net?

texts:
Is there any way for write on the blockchain from vb.net desktop app?
Any sample about how to do this?
thanks in advance.


texts:
Who can give a working example IncreasingPriceCrowdsale or or find error in my code:

contract TestCrowdsale is IncreasingPriceCrowdsale, MintedCrowdsale {
    function TestCrowdsale(
        uint256 _openingTime,
        uint256 _closingTime,
        uint256 _initialRate,
        uint256 _finalRate,
        address _wallet,
        MintableToken _token
    ) public
      Crowdsale(_initialRate, _wallet, _token)
      TimedCrowdsale(_openingTime, _closingTime)
      IncreasingPriceCrowdsale(_initialRate, _finalRate)
    {

    }
}

It's can been compiled and deploy on ganache, but don't work and can't be deployed on local or ropsten network.