texts: Have contract creator address be the only address that can execute a function in contract

texts:
I have three contracts all interacting with each other.
Contract "Receive Ether" can receive ether from one of two "Send Ether" contracts
Contract "Send Ether First" should only be accessible by whoever deployed the contracts.
Contract "Send Ether Second" should be accessible by whoever.
When I run "Send Ether First" in Remix i get

"transact to SendEtherFirst.sendViaCall 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. "

Is it saying that the address of "Receive Ether" is the only one that can "Send Ether First"?
I can send ether via "Send Ether Second" no problem.
How do I make the sender of "Send Ether First" the same person who deployed the contracts? I can't seem to work it out.

pragma solidity ^0.5.11;

contract ReceiveEther {
uint256 public count;
address public owner= address(this);

function () external payable {
    require(count < 2);
    count++;
}

function getBalance() public view returns (uint) {
    return address(this).balance;
    }
}

contract SendEtherFirst {
    address owner;
    function sendViaCall (address payable _to) public payable {
        (bool sent, bytes memory data) = _to.call.value(msg.value)("");
       require(msg.sender == owner);
        require (sent, "failed to send ether");
    }
}

  contract SendEtherSecond {
    function sendViaCall (address payable _to) public payable {
        (bool sent, bytes memory data) = _to.call.value(msg.value)("");
        require (sent, "failed to send ether");
    }
}

Thank you for any help


texts: Truffle console is hanging on function call

texts:
I have a contract deployed to ropsten. It has a function called enter:
    function enter() public payable {
        assert(msg.value == MINIMUM);
        assert(OPEN == true);
        players.push(msg.sender);
    }

It pushes a player onto an array. I want to call this function with (using truffle console --network live where live is pointing to ropsten):
let lottery = await Lottery.deployed()
lottery.enter({from: accounts[0], value: 1000000000000000000})

However, it ends up just hanging, and I see no action on Etherscan.
Am I doing something wrong?


texts: Passing struct into new contract through constructor

texts:
I have a function in my ChangeManager contract which should create multiple ChangeRequests. I tried to model a Change by using a struct and pass this from my ChangeManager to the ChangeRequest:

Code from ChangeManager:

function createNewChangeRequest(
    bytes20 gitHash, string additionalInformation, uint256 costs, uint256 estimation
) public returns (ChangeRequest)
{
    Change memory change = Change(gitHash, additionalInformation, costs, estimation);
    ChangeRequest changerequest = new ChangeRequest(change, msg.sender);
    _changes.push(changerequest);
    emit NewChangeRequest(changerequest, gitHash, additionalInformation, costs, estimation);
}

Code from ChangeRequest:

    function viewChange() public view returns (bytes20, string, uint256, uint256) {
    return (_currentChange.gitHash, _currentChange.additionalInformation, _currentChange.costs, _currentChange.estimation);
}

Code from ChangeTracker (Parent class of ChangeManager and ChangeRequest):

contract ChangeTracker {
enum State {
    changeProposed, changeManaged, changeApproved, changeRejected, changeReleased
}

struct Change {
    bytes20 gitHash;
    string additionalInformation;
    uint256 costs;
    uint256 estimation;
}
}

I have put the "pragma experimental ABIEncoderV2;" before all my codes to be able to use structs in function calls.

I am using truffle to test my code where I get the following result when I am testing the viewChange() function:

[ '0x9a034128a329f4fb7a53043dd1d1e8f74bfc91fc',
  '',
  BigNumber { s: 1, e: 3, c: [ 2400 ] },
  BigNumber {
    s: 1,
    e: 76,
    c:
     [ 6966192,
       89321109306702,
       74526880295124,
       29411066690039,
       54848211183525,
       24260684070912 ] } ]

So the gitHash and the costs work but the additionalInformation and the estimation do not deliver the correct value.
Is it even possible to pass a struct from one contract to the constructor of another one?

Maybe I should just destructure the struct for the constructor and just use static variables to initialize ChangeRequest.

Your help is highly appreciated!


texts: How can I test my purchase function on the truffle with chai?

texts:
I'm trying to test my token buying function but I encounter an error, o facilitate understanding I will show the code
"Error: Returned error: VM Exception while processing transaction: revert"
my purchase function, In the remix it works perfectly:
uint public buyprice = 50000000000000 wei;

function buy() public payable {
            require(msg.value >= buyprice);
            require(_balances[address(this)] >= msg.value.div(buyprice) * 10 ** uint(decimals));

            amount_eth += msg.value;
            uint tokens = msg.value.div(buyprice) * 10 ** uint(decimals);
            _balances[msg.sender] += tokens;

            emit Transfer(address(this), msg.sender, tokens);
        }

I'm trying to test it that way:
it("buy tokens", async () => {
        let instance = this.StudyCoin;
        const weiAmount = new BN(5000000000000000);

        let buyTokens = await instance.buy();
        let balanceOfDeployer = await instance.balanceOf(deployerAccount);

        expect(instance.sendTransaction({from: deployerAccount, value: web3.utils.toWei(0.005, "ether")})).to.be.fulfilled;
        balanceOfDeployer = balanceOfDeployer.add(new BN(100000000000000000000));
        console.log(balanceOfDeployer);
        return expect(instance.balanceOf(deployerAccount)).to.eventually.be.a.bignumber.equal(balanceOfDeployer);

    });

I tried several searches and alternatives but without success. I'm using pragma 0.7.4, can someone give me some idea how to do this test, will open doors for several other tests thanks


texts: Trading mined Eth through an unofficial mobile app is secure?

texts:
I was wondering if trading my Eth through a client mobile app such as iPhone's "Polo" client for the Poloniex site is secure. I was wondering this because I see the app is not from the Poloniex team, and it's not opensource. Trading through this app is really much easier than on the mobile version of the site, but if my account could be possibly at risk I would avoid using it anyway. I'm concerned mostly on the security of my credentials and the possibility that the app developer may be able to control my accounts or even see some details of my accounts through any other kind of tracking that may be possible through the coded app.

What do you think about my concerns? Am I paranoid or I'm actually considering something that may be possible?

I don't even know if Apple does any kind of control of what the apps does before they're published. As far as I know they're much more careful than Google on andorid's Play store abou that, but that doesn't represent to me any guarantee about this app's (such kind of app's) security.

Please consider Polo/Poloniex just as an example, the question is if it would be more secure using an unofficial app or the browser as client for such sites.


texts: How to model mining competition between miners & uncles?

texts:
I would like to really understand pow mining by implementing a simple one, but still struggle.

assume we have five miners, m1,...,m5. Each miner has hash rate, m1=30%, m=20%,m3=15,m4,25, m5=10%, in total 100%

How to simulate (e.g., in simple python code) minig competition between these miners in such a way each 15 seconds a new block is found by one of them taking their hash rate into consideration. for example it could be possible that two or three miners got a block at the same time. so each block is distributed (let us say time dealy) and got confirmed by others. How to model this? decide number of stale/uncle blocks etc

Could anyone help and advise in this.


texts: Accessing off-chain data from a smart contract to make a decision

texts: I just started studying about smart contracts and from what I understand, smart contracts only deal with the data present on the blockchain. While working on a private blockchain, I want to know whether a smart contract in the blockchain can access external data and make changes to it. By external, I mean the data present on the nodes in the blockchain network, not data from the internet. So, no oracles. Since smart contracts are deterministic and gets executed on every node, assume I have the same file in the "datadir" of every node on the network. Can I access this file from a smart contract and make changes to it if necessary?


texts: On a Raiden network how are contracts called?

texts:
As I understand the Raiden network a smart contract is set up between two addresses, and loaded by each participant with tokens, and this instance of the smart contract sits in the blockchain. At this point we are all standard blockchain. Normally a write type operation in the contract would be called by creating a standard ethereum transaction targeting the contract address, and the mining process would result in the write operation being called in the contract. Again, this is all standard ethereum blockchain (as far as I know).

So my question is, what is the mechanism to call a write operation (e.g. Balance transfer) in the Raiden network? It can't go through the blockchain/miners as that would defeat the point of the Raiden network.


texts: How to deploy a contract and its abstract/interface?

texts:
Assume I have a contract A:

pragma solidity ^0.4.4;
contract A{
  struct St{
    uint val;
  }
  function double(uint a)external returns (uint res){
  res= 2*a;
  }
}

Let's call the above lines of code block 1.

I deploy contract A. Then I have a contract B that wants to call a function of contract A:

pragma solidity ^0.4.4;
contract B{
   uint res;
   function call_double(uint val) {
   A a=A(0x1);// 0x1 is the address of contract A after it's deployed.
   res = a.double(val);
   }
 }
 // how to include this contract abstract when deploying contract B?
 contract A{
    function double(uint a)external returns (uint res);
    struct St{
    uint val;
   }
 }

Let's call the above lines of code block 2.

Question: How can I include contract A when I'm deploying contract B? In other words, how can I deploy block2?

Please note that when I'm using remix, (after I deploy contract A) I put both contract B and abstract of contract A in one page and deploy B, and everything works fine. But it's not clear to me how it's done when Im manually deploying to a private blockchain using web3. Also, it's not clear which ABI I need when I want to interact with contract B.


texts: Contract structure for storing user application

texts:
I have a Nodejs application in which users fill up multiple forms and that data is saved to the centralized DB i.e MongoDB. Admin can review the user data and can push the user data to Blockchain to maintain the integrity of data so that any third party can view the data in future and verify its integrity.

Now, as data is large it can't be stored directly to the blockchain. So, I am converting the data first to pdf and then creating the hash of pdf using Keccack 256 algorithm and storing the hash to the contract. And in return, I get a transaction Id which I can later use for retrieving the data from the blockchain.

Please suggest If I am on right track or there is a better approach for this.

Note:- If a user updates his application, Admin will again push the user data to the blockchain.

This is the contract code I am using:

pragma solidity ^0.4.17;
contract AddUserApplication {
    string public userdata;
    function addUserData(string data) public {
        userdata = data;
    }
}

// Code for retreiving the data from Block:

    const viewTransaction = async () => {
    let viewData = await web3.eth.getTransaction('0xd819b09a906232a37b6ad102a7616eed6af9d968718b23878e023ccf7f967f8');
    console.log('viewdata: ',viewData.input);
    const decodedData = abiDecoder.decodeMethod(viewData.input);
    console.log('decodedData',decodedData);
}


texts: Setting up private Ethereum blockchain using static nodes

texts:
I have to connect to 4 nodes. In static - nodes.json file I put all the 4 enodes with their IP addresses, each with a different rpc port and --port number but the same network ID and genesis file.

When I am running net.peerCount it displays 0. I am not understanding what is the problem.


texts: Can I combine multiple transactions from same users?

texts:
If I send 10 transactions from user A to B within let's say an hour, is it possible to combine these transactions into one to save on transaction fees?

It's important these transactions are still viewable by putting the transaction codes or hash in the metadata or some other place.


texts: Error: Identifier not found or not unique. when deploying a smart contract which calls another contract

texts:
I am trying to call a contract from another contract.

first contract is the source of items like a data table.
second contract is like a logic layer for the items.

I first deployed the contract1 and got the address, it is working fine.

When I tried to deploy the second contract which has the variable of type contract1 it is throwing the below error when compiling

 Error: Identifier not found or not unique.

below is my second contact code

contract itemlistcallercontract {
     ItemListContract itemlistcontract;
     function itemlistcallercontract()
     {
     itemlistcontract = ItemListContract("0x16c5d0c8fccaf7e5824f5ae25c1662877cec6452");
     }

     function getitemcount() constant returns(int count)
     {
     return itemlistcontract.countItemList();
     }
}

i am trying to take the reference of contract1 by passing its address in the contract2 constructor.

But the error is thrown in the declaration of the itemlistcontract variable it self.

Cant we call a contract deploying them seperately?
Is there any point I am missing here?


texts: gRPC is modern high-performance RPC framework. Using gRPC is certainly than the use of JSON RPC for communication between geth nodes and the clients such as web3. Is gRPC is part of the Ethereum roadmap?


texts: How do you get a string value from msg.data in the fallback function?

texts:
Im trying to do what The DAO did and do something when a sender sent money to my contract address. But im not sure how to.
The something I want to do is to just create a new user in a mapping with the string sent in the msg.data object.

I have heard about the fallback function, and thought I could extract the msg.data. But that seems to be bytes. Do I have to convert it? If so how do you do that?

Here is my code:

Premium.sol

struct User {
    address user;
    bool paid;
}

mapping(string => User) PremiumUsers;
address owner;

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

function () {
  var mail = byteconverterToString(msg.data);
  var newUser = PremiumUsers[mail];
  newUser.user = msg.sender;
  newUser.paid = true;
}


texts: Automating Listing Addresses and Balances Using PHP

texts:
I want to incorporate a javascript in php that list all the accounts and shows balances for those. This is my script for that:

<script language="javascript">
function checkAllBalances() {

var totalBal = 0;

for (var acctNum in eth.accounts) {

    var acct = eth.accounts[acctNum];

    var acctBal = web3.fromWei(eth.getBalance(acct), "ether");

    totalBal += parseFloat(acctBal);

    console.log("  eth.accounts[" + acctNum + "]: \t" + acct + " \tbalance: " + acctBal + " ether");

    alert("eth.accounts[" + acctNum + "]: ");

}

console.log("  Total balance: " + totalBal + " ether");
}</script>

I incorporated this into php and and call it but it's not executing it properly. Any ideas?


texts: How critical is timing to the Proof of Stake system?

texts:
I’m imagining that in the future it may be profitable for attackers to try to undermine consensus using novel means that are yet unanticipated. So I would like to contribute to speculation on possible vectors.
One such possibility would be a timing based attack. I am not quite sure how such an attack could be carried out, but nonetheless is there any possibility of an exploitation based on the way the network, or related systems, utilizes time signals?


texts: Creating a smart contract which add people to the list based on voting?

texts:
I was trying to write a smart contract which will add a person information to the cities population only if the 2 people(both are city hall representatives) vote that the requested person lives in the city.

I am not able to understand the voting part. I think this will be executed by mapping and then using other 2 smart contracts(for city hall people) but how the voting is done was tough to implement. I also looked at The DAO smart contract but couldn't relate much. Any help will be good.

My code looks like,

mapping (bytes32 => bool) ConsensusStatus;

function addPerson(bytes32 _Name, uint _age, bytes32 _Value, bytes32 _Country, bytes32 _State, bytes32 _City, bytes32 _Email, uint _Phone) returns(bool success) {

Person memory newPerson;

newPerson.Name = _Name;
newPerson.age = _age;
newPerson.Male = _Value;
newPerson.Country = _Country;
newPerson.State = _State;
newPerson.City = _City;
newPerson.Email = _Email;
newPerson.Phone = _Phone;
// Below consensus code is most probably wrong

if (ConsensusStatus[_Name].Member1Vote && ConsensusStatus[_Name].Member2Vote) {
        People.push(newPerson); //People is the tuple storing the info of the city residents
return true;

        }

}


texts: What gets mined in a private test network?

texts:
I followed the instructions in this  answer to get a private testnet.

When I start mining in dev/private network using miner.start() what exactly is being mined?

Since I am the only node in the test network and I am not sending any transaction, I don't understand what the newly mined blocks contain!

Is the network supposed to mine a block every x seconds even if there is no transaction in the network?


texts: Ethereum contract called successfully with Remix but failed when processed from Paruity wallet

texts:
I have contract that return random numbers using oraclize.it deployed to Ropsten. I am running local node using Parity and connected Remix to it. Contract deployed by Remix and when I making transfer it works correectly (transactions 0xe364fa6e75e8dee7bea419345c8d28a5f1cabbb1192fff5aaffd77d3eae710af and 0x93a85b04e1c02020e96f3d2c17efa5457d7a27de7e2c7cc931320cf8f3842733 for instance). But when I trying to send money using Parity web ui it always failed with meaningless "Bad instruction" error (in Parity I see "transaction may be run out of gas" error).

How it could be at least debugged? Because I am totally stuck why it works by one transfer way and does not - by another.

UPD: The same issue with Mist. I found that Remix and console web3 performs function call, not funds transfer. Exactly this breaks the contract.

Here is contract source:

pragma solidity ^0.4.0;

import "./oraclizeAPI_0.4.sol";

contract GetRandom is usingOraclize {
    event newRandomNumber(bytes);
    event numbers(uint n1, uint n2, uint n3);

    function GetRandom() {
        oraclize_setProof(proofType_Ledger);
    }

    function __callback(bytes32 _queryId, string _result, bytes _proof) oraclize_randomDS_proofVerify(_queryId, _result, _proof) {
        // if we reach this point successfully, it means that the attached authenticity proof has passed!
        if (msg.sender != oraclize_cbAddress()) throw;

        bytes memory n = bytes(_result);

        numbers(uint(n[0]), uint(n[1]), uint(n[2]));
        newRandomNumber(n);
    }

    function update() payable {
        uint N = 3; // number of random bytes we want the datasource to return
        uint delay = 0; // number of seconds to wait before the execution takes place
        uint callbackGas = 200000; // amount of gas we want Oraclize to set for the callback function

        // this function internally generates the correct oraclize_query and returns its queryId
        bytes32 queryId = oraclize_newRandomDSQuery(delay, N, callbackGas);
    }
}


texts: Can miners read the restricted data on our Smart Contract?

texts:
I'm thinking to store around half a dozen private keys on a smart contract. The function to read private keys is restricted to owner (deployer) of the smart contract.

Do miners have access to the restricted data? If yes - Is there any way to protect our data on ethereum blockchain?


texts: Capture events from a state variable which is a contract

texts:
I developed a contract which uses another contract in it state variable, but looks like the events from the contract in the state variable aren’t dispatched.

contract A {
  event Hello(uint num);
  function doSomething() {
   Hello(1);
  }
}

contract B {
  A public a;

  function doAnotherThing() public {
    a = new A();
    a.doSomething();
  }
}

What is expected: To be possible to capture the events from the contract A which is a state variable in the contract B. So when call a.doSomething() in the contract B should be dispatched the event Hello(1) and be possible to capture in the watch.


texts: How to Unlock account via web3js without geth(web3-extended doesn't work)

texts:
Need to unlock account to call contracts functions on client side. So i need to use web 3 or web 3 extanded. But it doesn't work.Method are not availebly.
Maybe you know some others ways how to call function specially in IOS-app.


texts:
I am trying to follow the following example.

http://hypernephelist.com/2016/12/13/compile-deploy-ethereum-smart-contract-web3-solc.html

But I get the following error. Can anybody show me what is wrong in my code? Thanks.

$ cat contracts/HelloWorld.sol
pragma solidity ^0.4.16;
contract HelloWorld {
  function get() public pure returns (string retVal) {
    return "HelloWorld!!";
  }
}

$ cat test.js
const fs = require('fs')
const input = fs.readFileSync('contracts/HelloWorld.sol', 'utf8');

const solc = require('solc')
const output = solc.compile(input, 1);
const bytecode = output.contracts[':HelloWorld'].bytecode;
const abi = JSON.parse(output.contracts[':HelloWorld'].interface);

const Web3 = require('web3')
const web3 = new Web3('ws://localhost:8546');

web3.eth.getAccounts().then((accounts) => {
  const testContract = new web3.eth.Contract(abi);
  testContract.deploy({
    data: "0x" + bytecode,
  })
    .send({from: accounts[0], gas: 4700000})
    .then((instance) => {
      console.log(`Address: ${instance.options.address}`);
    })
    .catch(console.log);
});
$ node  test.js
connection not open on send()
(node:11309) UnhandledPromiseRejectionWarning: Error: connection not open
    at WebsocketProvider.send (/Users/pengy/linux/test/gnu/geth/bin/Hello-Ethereum/node_modules/web3-providers-ws/src/index.js:211:18)
    at Timeout._onTimeout (/Users/pengy/linux/test/gnu/geth/bin/Hello-Ethereum/node_modules/web3-providers-ws/src/index.js:196:19)
    at ontimeout (timers.js:466:11)
    at tryOnTimeout (timers.js:304:5)
    at Timer.listOnTimeout (timers.js:267:5)
(node:11309) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:11309) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.


texts: moving funds from contract that owns all total supply

texts:
So I've given the total supply to this contract via making an address state variable address creditsContract = address(this), and was wondering if I could call the transfer function from another contract, with credits.approve(msg.sender, _amount) and credits.transferFrom(creditsContract, _to, _amount) .
Would ^ work or would I need to do something else to make this work?
I just don't want to make the total supply go to a wallet, to increase security that the owner wont just run away with the funds, like SushiSwap (I know he put them back, luckily for SushiSwap).
Another thing with the above sequence is that if my contract is able to do this, wouldn't another smart contract dev be able to do this as well and then be able to drain the contract of the funds?
Thank you!


texts: I am looking for historical datasets of the price of Ether. Similar to Bitcoin closing market price on blockchain.info or Coindesk OHLC dataset. Datasets in raw form are preferred (.json or .csv).  Where can I find such datasets?


texts: Is geth / parity an on-chain or off-chain node?

texts: I am drawing the architecture of a dapp but I cannot understand if the node (geth / parity) is in the on-chain or in the off-chain part.


texts: Why do I never see eth.blockNumber nor eth.coinbase on light sync testnet?

texts:
I'm trying to get geth running on the testnet. I've successfully built it, but these commands never seem to work.

blockchain@ethereum:~/go-ethereum$ ./build/bin/geth --testnet --light console
INFO [08-25|22:58:28] Starting peer-to-peer node               instance=Geth/v1.7.0-unstable-3e0dbe0e/linux-amd64/go1.9
INFO [08-25|22:58:28] Allocated cache and file handles         database=/home/blockchain/.ethereum/testnet/geth/lightchaindata cache=128 handles=1024
INFO [08-25|22:58:28] Initialised chain configuration          config="{ChainID: 3 Homestead: 0 DAO: <nil> DAOSupport: true EIP150: 0 EIP155: 10 EIP158: 10 Metropolis: 9223372036854775807 Engine: ethash}"
INFO [08-25|22:58:28] Disk storage enabled for ethash caches   dir=/home/blockchain/.ethereum/testnet/geth/ethash count=3
INFO [08-25|22:58:28] Disk storage enabled for ethash DAGs     dir=/home/blockchain/.ethash                       count=2
INFO [08-25|22:58:28] Loaded most recent local header          number=0 hash=419410…ca4a2d td=1048576
INFO [08-25|22:58:28] Starting P2P networking
WARN [08-25|22:58:28] Light client mode is an experimental feature
INFO [08-25|22:58:28] RLPx listener up                         self="enode://569e2233c2908ba6a721bd682d5e34c99a4a033373628e649d4135daa041931886b0c23478933e87b7809de607f9672c6ecd8b1a301c7e3f6897a818254e8bd6@[::]:30303?discport=0"
INFO [08-25|22:58:28] IPC endpoint opened: /home/blockchain/.ethereum/testnet/geth.ipc
Welcome to the Geth JavaScript console!

instance: Geth/v1.7.0-unstable-3e0dbe0e/linux-amd64/go1.9
 modules: admin:1.0 debug:1.0 eth:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

> eth.coinbase
Error: not supported
    at web3.js:3104:20
    at web3.js:6191:15
    at get (web3.js:6091:38)
    at <unknown>

> eth.blockNumber
0

I've waited over ten minutes; shouldn't I see coinbase and blockNumber updated when I am synced? Isn't --light supposed to make a "light sync" so I don't need to download the entire chain?


texts: Can the exchange get my ether in any way

texts: I send some ether from exchange A to B via smart contract, however the latter does not support smart contract at moment, is there any way to get those ether back?


texts:
pragma solidity ^0.5.0;

import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/Adoption.sol";

contract testAdoption{
    Adoption adoption = Adoption(DeployedAddresses.Adoption());

    //Testing the adopt() function
    function testUserCanAdoptPet() public{
        uint returnedId = adoption.adopt(8);

        uint expected = 8;

        Assert.equal(returnedId, expected, "Adoption of pet ID 8 should be recorded");
    }

    //Testing retrieval of a single pet's owner
    function testGetAdopterAddressBypetId() public {
        //Expected owner is this contract
        address expected = this;

        address adopter = adoption.adopters(8);

        Assert.equal(adopter, expected, "Owner of pet ID 8 should be recorded");
    }

    //Testing retrieval of all pet owners
    function testGetAdopterAddressBypetIdInArray() public {
        //Expected owner is this contract
        address expected = this;

        //Store adopters in memory rather than contract's storage
        address[16] memory adopters = adoption.getAdopters();

        Assert.equal(adopters[8], expected, "Owner of pet ID 8 should be recorded");
    }

}

  TypeError: Type contract testAdoption is not implicitly convertible to
  expected type address.
          address expected = this;
          ^---------------------^


texts: MIX dapp IDE - how to run your dapp after deployment, error web3 is not defined

texts:
I managed to run a personal test chain. I deploy the Sample contract and everything is ok. Transactions included.
Now how can I run the dapp?
I go to the local package folder inside www I open the index.html file but

  I get the error : web3 is not defined

Where are the web libraries defined? inside the node? Am I running the node in a wrong way?

geth --identity "Computer" --genesis myChain/myChainGenesys.json --rpc --rpcport "8000" --rpccorsdomain "*" --datadir "myChain" --port "30303" --nodiscover --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --rpcapi "db,eth,net,web3" --autodag --networkid 666666666 --nat "any" --unlock 0 console

This works for mining and deployment, does it work to play with the deployed app?

is the app here?

file:///home/computer/ttt/package//www/

thanks in advance


texts: What is the use case of transferFrom function in ERC20 token contract?

texts:
In @openZeppelin's ERC20 implementation here is the code for function transferFrom:
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
    _transfer(sender, recipient, amount);
    _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
    return true;
}

function _transfer(address sender, address recipient, uint256 amount) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

The amount is reduced from the balance of sender and added to the balance of recipient. Also the caller's allowance from sender is reduced by amount. The implementation puzzles me in that there is no sender and recipient verification and that means sender and recipient can be any 2 arbitrary addresses. What if the sender and caller msg.sender are not the same address? What is the use case for transferFrom?


texts: Mist reloading chain structure from scratch

texts: How come every time I close and open ethereumwallet it starts downloading the chain structure from scratch?


texts:
I am running a private network using Parity with a custom chain specs defined in a json file.
If i realized later that I should change a parameter in the spec, can i update it and the change will be reflected directly? Or i should kill and start all the nodes again?


texts: How to access events logs in ethereumJ ( java )

texts: Accessing event logs from javascript is easy and straight forward, however I am trying to access the logs from the Java client. Any example code would help


texts: sendTransaction and events not working in NodeJS app

texts:
I have a contract deployed on the testnet, I can do the following within geth:
reference.transfer.sendTransaction(bob, 467, {from:me})

However I can't do this within my node console (with web3 etc. all loaded), as I receive the following error:

reference.transfer.sendTransaction(bob, 246, {from: me, gas:200000})
Error: Transaction not confirmed
at Object.module.exports.InvalidResponse (/Users/jbowkett/node_modules/web3/lib/web3/errors.js:35:16)
at RequestManager.send (/Users/jbowkett/node_modules/web3/lib/web3/requestmanager.js:61:22)
at Eth.send [as sendTransaction] (/Users/jbowkett/node_modules/web3/lib/web3/method.js:145:58)
at SolidityFunction.sendTransaction (/Users/jbowkett/node_modules/web3/lib/web3/function.js:133:26)
at repl:1:20
at REPLServer.defaultEval (repl.js:252:27)
at bound (domain.js:287:14)
at REPLServer.runBound [as eval] (domain.js:300:12)
at REPLServer.<anonymous> (repl.js:417:12)
at emitOne (events.js:82:20)
at REPLServer.emit (events.js:169:7)

Also, my events on transfer fire in geth, but I can't see if they will fire within my node app, because of the above error.

I need the node app to receive events because I want to make external calls to other node apis.


texts:
Can anybody explain the reward mechanism in Proof of Authority (PoA)
protocol? What kind of reward is received by the validators in PoA?

So far I came up with the following points:

There is no competition between miners, new blocks are created by the authorized nodes at any time.
As there is no mining in PoA so there is no reward mechanism.
The winning block contains only a header and address of the miner for reward.

But, I could not figure out what is the reward actually. Is this
ether, transaction fee in gas or something else?
One incentive I could figure out is that individuals maintain their
    identity as a validator. Is there any other incentive for the
    validators?


texts: Can I use conversation messages stored on Blockchain

texts:
I'm new to Blockchain and exploring if I can safely store textual and media content in the transaction. This will help me with the following outcomes

I can have a safe, secure storage of contents between users
I can share it later with any other user at ease
There is no public views allowed and no moderation on these contents
I can also reward the user based on the content he had shared with me.

If there's transaction size limits, how best can we leverage the power of Blockchain.
This would be a private Blockchain and I am exploring on using Azure


texts: Is mining specific to unpermissioned blockchain?

texts:
I was studying the differences between permissioned vs. unpermissioned blockchain and came across this: https://www.youtube.com/watch?v=llCjL1up65M

Here it mentions that mining is not required for validating and verifying transactions in permissioned blockchain.

I am curious to know - what is the alternative of mining in permissioned blockchain?


texts: Reasons for and debugging a contract that failed when deploying into blockchain

texts:
I have a program that has been tested from remix's VM, and compiled with solc, in both cases without any failure.

However, when I try to use a custom script for deploying it into the rinkeby testnet (MIT-licensed script for deploying with works as I have succesfully deployed other contracts before), the tx ends up failing:

https://rinkeby.etherscan.io/tx/0x2794f7da8422e086d1ff22ececed2c971c869ae8729efedf562ca5b0e1576b23

What are the reasons for a tx to fail? is there any way of debugging it or figuring out the problem?


texts: How do I determine whether the transaction is used for the contract creation?

texts:
I want to monitor Ethereum and memorise every contract published on the blockchain (basically the same thing that Etherscan does). How it is possible to do this using NodeJS & web3? How can I determine whether specific transaction was used to publish a new contract?

It is possible to get the input data, but how do I analyze it?

I'm interested NOT in determining whether the address is a contract address, I'm interested in finding specifically CONTRACT CREATION transactions without having to keep all contracts in my database.


texts: Is there a privacy token implementation in the works for Ethereum like Monero's Tari system?

texts:
With the recent announcement of being able to have privacy type tokens on the Monero blockchain. Is there a proposal on ethereum for something similar? The usecase of having a private ERC20 would be useful. What privacy enhancing features have been proposed?

https://www.reddit.com/r/Monero/comments/8lgvw4/introducing_tari_a_decentralised_assets_protocol/


texts: Convert 64 byte public key to 20 byte address in Solidity

texts:
I am trying to convert a 128 characters hex encoded public key to an address in Solidity (0.5).

For example the pubkey would be:

af80b90d25145da28c583359beb47b21796b2fe1a23c1511e443e7a64dfdb27d7434c380f0aa4c500e220aa1a9d068514b1ff4d5019e624e7ba1efe82b340a59

which should generate an address of:

0x627306090abaB3A6e1400e9345bC60c78a8BEf57

How to convert a 64 byte public key to a 20 byte address in Solidity?


texts: Cannot enter commands into eth 1.2.1 on Windows

texts:
When I enter eth console I get this back  and am not given a prompt back to give any commands. Also when I go to enter the password, it does not give me a prompt, but typing in my password and hitting enter still seems to work. I have already looked at this question here, and have tried the answers given. I still cannot enter commands. I am running windows 10, and eth 1.2.1

EDIT:
It does eventually start doing the blockchain synchronization, but I am nonetheless unable to enter commands. If I run a test network
eth --private 234 --genesis-json C:\ether\CustomGenesis.json --db-path C:\ether\ctestchain console It still just hangs at JSONRPC

CustomGenesis.json:

{
    "nonce": "0x0000000000000042",
    "timestamp": "0x0",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "0x0",
    "gasLimit": "0x8000000",
    "difficulty": "0xf00",
    "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "coinbase": "0x3333333333333333333333333333333333333333",
    "alloc": {
    }
}


texts: I am wondering if the Ethereum Virtual Machine can verify a proof generated from a certain statement? Are there any precompiled contracts for verifying a proof?


texts:
What is the purpose of the smart contract code Etherscan verification?

Is it meant to verify ownership, or malicious lines of code, or something else?


texts: ethminer not picking up Radeon R9 RX 480

texts:
I hope someone can help.

My system has 3 GPUs, one that sits on the motherboard and two RX 480s that I added for mining purposes.

I've installed the latest AMD drivers (Version Crimson-16.7.1) to see if that helps, but no change.

I'm using the following to start mining:

ethminer -G --opencl-device 1 -F http://eth-eu.dwarfpool.com:80/0xD...48e/VarlicGPU1

Trying to force mining from device 1 which is one of the Radeon cards. ethminer reports that it is using the Intel card, even though that is device 0.

"Found suitable OpenCL device [Intel(R) HD Graphics 530]"

Would be great if anyone has any ideas!


texts: Is "Proof-of-work" a subset of "Byzantine fault tolerance (BFT)"?

texts:
Can we say that Proof-of-work is a type of Byzantine fault tolerance (BFT) ? In other words, is PoW a subset of BFT ? Or they are two different categories?

Please note that there is a similar question here (Can Proof of Work be Considered as a Byzantine Fault Tolerance (BFT) consensus algorithm since it addresses the Byzantine Generals Problem as well?) but without any answer.


texts:
When miners M1 and M2 compete to mine block B and miner M2 mines it just after miner M1, his mined block is called ommer/uncle/orphaned.
I read that these blocks (untill sixth generation) can be included in the blockchain. Does this mean that transactions of block B are included twice?


texts: Can we pass some verification values from web to solidity contract?

texts:
Is there a way we can pass some value checks from web to solidity contract
Just for example if we want to make sure, the person who is calling contract function is present on our website and not suing some other source of calling like bot or compilers

My function is a payable function with which ethers are transferred to users on calling the receive () function.

If any such solution to make a check and pass it to contract where it be a conditional require or some other check to make sure users is present on the site.


texts: Ethereum2.0 Shard chains will be PoW or PoS

texts:
I'm sorry if this is a basic question. But will the new shard chains for Ethereum2.0 be PoW or PoS?
I know the plan is for Eth1 mainnet to "dock" onto the beacon chain eventually and be its own shard. But are all other new shards going to be PoS?


texts: Understanding transaction broadcast better

texts:
I'm trying to understand better how the Ethereum protocol works, and in particular, how transactions are broadcasted across peers.
I created a test transaction with very little gas price to test what would happen, then I used web3.eth to send the transaction. As expected, the transaction never makes it to a block, it's still showing under eth.pendingTransactions. The part I don't understand is why I can't see the transaction on Etherscan pending transactions here.
Did my geth client ever broadcast that low gas price transaction to my peers? Did those peers also broadcast that transaction to their peers? Did the Etherscan node receive my transaction at some point, and then eventually drop it, or did my transaction never make it to the Etherscan node?
Does this behavior (e.g., how long to keep a transaction in pending transactions) vary per client? E.g., parity vs geth. Or is that something that is defined in the protocol and all clients implement the same behavior?
Finally, I did read this question about the difference between pendingTransactions and getBlock('pending').transactions, but I'm still unclear on something. Why doesn't my local pending transaction show in the pending block? In other words:

> eth.getBlock('pending').transactions.indexOf(eth.pendingTransactions[0])
-1

I would have expected that my client's understand of the "pending" block at least includes the local pending transactions.


texts: I have 2 questions. 1: Is it possible to generate an array of random numbers, with every number to distinct, say 10 numbers in range of 0 and 1000?

texts:
I know, that using block hash or timestamp is not secure for gambling applications, and I know that I can use Oraclize to get a real random number.
But is it possible to ask for an array of distinct numbers?

Also, even I am getting a number from Oraclize, the miners can throw the block away in the same way, until they are satisfied with the random isn't it true? So what sense of using Oraclize then? many thanks


texts:
WIth the recent EOS token snapshot, and many other erc20 tokens taking snapshots for airdrops and stuff like that, I'm very curious as to how they actually would go about doing that.

I'm not a programmer/coder by any means, but I understand enough to write a smart contract... (which isn't much really... haha)

I do understand that etherscan shows you the token holders list, but they don't offer a way to export to a csv file, as they do with token transfers.

Already asked etherscan about it...

"You may refer to our available list of APIs here: https://etherscan.io/apis#accounts

However, we are unable to offer token holders for a token at the moment.

Regards"

So, how would a regular joe like me would take a snapshot of a token at a given time?


texts:
Assuming that there are multiple parties on the private blockchain, few general questions on the private blockchain usage:

Can Personally identifiable information (PII) data be stored on blockchain? does it fall under good architecture?
Lets say Party A (Entity) created a some data for one of its user U1 on the block chain. Around a week later, Party B just want to check if there exists anything on that blockchain for the same user U1 on the blockchain. Can Party B query on the blockchain on whether any Party created entry for U1?

My understanding is that no one else can read/verify anything on the blockchain for the entry that was created by another Party. Is that correct? If so, if I have the need to do the lookup on the blockchain, how can Party B do the lookup.


texts: Problem with Mist Wallet synchronization

texts:
I've installed the Mist wallet app v0.9.3 and it says "Synchronizing", and then after a few minutes the progress numbers stop changing. The log file shows repetitious socket errors (what is strange because my network is working perfectly fine). I kill the Mist process and restart it, and then it starts synchronizing again for a few minutes, and then gets stuck again. Rinse and repeat.
Any idea how to fix it?


texts: Is it possible to run a program/function written in different language from solidity?

texts: I have a script written in a different language to get executed and verified by miners of the network. Is there a way to call this script from solidity smart contract?


texts: How is the length of the message counted when calling eth_sign?

texts:
According to https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign

  The sign method calculates an Ethereum specific signature with:

sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message)))

It does not, however, specify how the len function works.  If you give it a string containing emojis and zero width joiners, for example, how is the length calculated?  Is it a count of code points, code units, graphemes or glyphs? (https://stackoverflow.com/a/27331885/879046)


texts: SOLVED How to retrieve Ether from old multisig wallet contract?

texts:
I have a 1.5 years old multisig wallet contract. I am able to import it to Ethereum Wallet (version 0.11.1) through Contracts -> Watch Contract menu and that way I can run some functions on it ("Add owner", "Execute", etc.). After reading the contract code, it would appear that "Execute" is the function that is used to transfer Ether out of the contract. I'm quite hesitant to use it, though.

"Execute" takes three parameters, address, value and data. Is it safe to leave data empty? And is the unit of value wei or ETH? In the contract there is daily limit of 100000000000000000000000000(!). I assume this is wei, which would mean it's 100 million ETH. The contract also has multiple security warnings on it, if there's something there I should take into account, i'd be supper happy to know.

Any help is appreciated! Here's the contract info: https://etherscan.io/address/0x5248e5fd5d3b43126e5352807f75d6a7d6d7eafb

SOLVED

The solution in this case turned out to be pretty simple. After syncing geth (fastsync) I was able to import wallet contract by using older version of Ethereum Wallet (0.8.9).

See also this issue: https://github.com/ethereum/mist/issues/4032


texts: Ropsten testnet is under kind of attack? What can we do?

texts:
For the last approximately 24 hours, Ropsten testnet is under an attack in my opinion. The gas limit is raised to 200m and the attacker was proposing blocks with more than 4,000 internal txs transfering 1 wei to different addresses. Mining reward is more than 12 eth now.

I think this is the block started the attack https://testnet.etherscan.io/block/586948.

I believe this makes my computer sync extremely slow and for the past 24 hours, I haven't been able to catch up with the chain.

However, looks like the attacker stopped attacking but other miners are still follow the gas limit. Maybe people don't know how to lower gas limit even that miners can do so at some point, some percent of current gas limit.

So my question is: What is the easiest way for miners to lower gas limit? Does it actually help?

Edit 1:
There is a hero with this address 0x00d92369a644ab070f38f8877b50feb5b61508ed is trying to lower the gas limit by proposing many (almost 2000 blocks now) empty blocks with lowered gas limit set. His first block is here https://testnet.etherscan.io/block/590360.

Edit 2:
The testnet is forked now. It split at block number 590359. Looks like the joke hasn't ended yet.


texts:
Is it possible as the creater of the smart contract to access a not public variable? E.g.:

contract MyContract {

    uint256 someLevel;

    function changeLevel(uint _newLevel) public {
        someLevel = _newLevel;
    }
}

How would I access in this case someLevel via web3 or at all?


texts: How to add a 2% burn and 2% redistribution to holders?

texts:
I've been compiling a project on remix.ethereum.org and would like to launch a crypto that has a burn on each transaction.  Is it possible to add in just a few lines of code into the token contract that would burn 2% of supply with each transaction and redistributes 2% of the supply to holders of the token (ie: sender sends 100 token, 96 arrive with recipient, 2 are burned and 2 are automatically redistributed proportionally between all other holders of the token)?
Thanks :)


texts:
The setup of Ethereum Mist worked like a charm (MacOS).
Then, I tried to connect to a test Network but the program crashed and continues to do so.

How can I fix this issue?

Node type: geth

Network: main

Platform: darwin (Architecure x64)

...eum/geth/ethash count=3
INFO [10-14|17:34:19] Disk storage enabled for ethash DAGs     dir=/Users/stefanschares/.ethash                      count=2
INFO [10-14|17:34:19] Initialising Ethereum protocol           versions="[63 62]" network=1
INFO [10-14|17:34:19] Loaded most recent local header          number=4362351 hash=188b4f…0c8c34 td=1174172911787544706344
INFO [10-14|17:34:19] Loaded most recent local full block      number=0       hash=d4e567…cb8fa3 td=17179869184
INFO [10-14|17:34:19] Loaded most recent local fast block      number=4362114 hash=d11d53…f16574 td=1173445059230676622547
INFO [10-14|17:34:19] Upgrading chain index                    type=bloombits percentage=0
INFO [10-14|17:34:19] Loaded local transaction journal         transactions=0 dropped=0
INFO [10-14|17:34:19] Regenerated local transaction journal    transactions=0 accounts=0
INFO [10-14|17:34:19] Starting P2P networking
Fatal: Error starting protocol stack: listen udp :30303: bind:
address already in use


texts: Paying gas costs in custom cryptocurrency

texts: Can you pay transaction fees in an ERC token you generate on a private chain? IE if I make ABC coin, can I pay gas costs in ABC instead of in ETH?


texts: Logic in approveAndCall function for erc20 token deprecated & not working

texts:
I am following along with a older tutorial on making an ERC20 token in order to learn Solidity a little better.
Since the tutorial is old, I've had to change a lot of things so far to get it up to speed with version 0.8.0 (The version I am working with)
Now I am having an issue with function that is created to approve then call the receiving contract. Below is my code:
  /* Approves and then calls the receiving contract */
function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public returns (bool success) {
    allowed[msg.sender][_spender] = _value;
    Approval(msg.sender, _spender, _value);

    //call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this.
    //receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData)
    //it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead.
    if(!_spender.call(abi.encode(bytes4(bytes32(keccak256("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)))
    {
        revert();

    }

    return true;
}

The error I am getting is on the IF statement:
TypeError unary operator ! cannot be applied to type tuple(bool, bytes memory)

And
TypeError tuple(bool, bytes memory) is not implicitly convertible to expected type bool.

From my understanding call() is outdates and can be eliminated if I just simply use something else? However I am not sure what my other options are here.
If there are no other options, can someone please help me understand what I should be using this call() function for? And how I can implement a fix that would make sense?
Thank you!


texts: End-loop condition to retrieve my mined smart contract using backlink?

texts:
I want to retrieve all my smart contracts and interact with them, without the need of scanning over and over the blockchain.

In order to do that, I inspire myself about a simple but clever property of the blockchain: the backlink. I'm storing the address of my previous smart contract each time I'll deploying a new one:

pragma solidity ^0.4.2;

contract Test {

    address public scAddress; //current address of the smart contract
    address public lastSCAddress; // address of the previous smart contract

}

So I'm creating my own smart contract chain inside the blockchain. My problem is when I want to retrieve it and interact with them: using web3.js:

function retrieveSmartcontract(lastKnownAddress) {
  for(var i = 0; i < (until it reaches the oldest one); i++) {
    var documentContract = web3.eth.contract(abiArray);
    var sc = documentContract.at(lastKnownAddress);
    var result = sc.getData.call();
    console.log('Data: '+ result)

    var newaddress = sc.getLastSCAddress().call();
    var sc[i] = documentContract.at(newaddress);
    var result[i] = sc2.getData.call();
    console.log('Data2: '+ result[i]);

}
})

Take it more as a pseudo-code. I will always know lastKnownAddress.
I don't know what is the ending condition for my loop. I thought about contract.address == unfinied, but I'm not sure about it.

Thank you for your valuable time and help.

EDIT: Can It be solved by this?

Since I do know the address of the last smart contract deployed, when I am initiate this process the last smart contract address is also equal to the "oldest" one. I just need to save it in an other smart contract.

pragma solidity ^0.4.2;

contract Test {

   address public lastSCAddress; // address of the previous smart contract
   string name;

}

Here is the code of the new smart contract:

pragma solidity ^0.4.2;

contract Test2 {

   address public lastSCAddress; // address of the last contract mined
     address public oldestSCAddress; // address of the first ever smart contract deployed
   string name;

}

Last, my code for the loop:

function retrieveSmartcontract(lastKnownAddress) {
    // interacting with test2.sol

    var test2 = web3.eth.contract(abiArray);
    var sc = test2.at(lastKnownAddress);
    var oldestAddress = sc.getOldestSCAddress.call();
    var tmpAddress = lastKnownAddress;

  while(oldestAddress!== tmpAddress) {
    // interacting with test.sol

    var test = web3.eth.contract(abiArray);
    var sc2 = test.at(lastSCAddress);
    var result = sc2.getData.call();
    console.log('Data: '+ result)
    var tmp = sc2.getLastAddress.call();
    tmpAddress = tmp;
}
})

I hope I can use the while loop here. So basically, it will call the getLastAddress until oldestAddress does not match tmpAddress.

Can someone confirm this please?

Thanks


texts:
I am trying to upload my file to IPFS and save its hash to my Ethereum contract but neither ipfs.add nor ipfs.files.add is working for me...
I have tried usin for loop i.e.
for await (const result of ipfs.add(this.state.buffer)) {
      console.log(result);
  }

and also this way:
ipfs.add(this.state.buffer, (error, ipfsHash) =>
    {
      console.log('Trying to add');
      if(error) {
        console.error(error)
        return
      }
    })

but both of them are not working.... I've tried to debug my code but the control doesn't go beyond ipfs.add line....
Any help will be highly recommended as I am not able to find any help on the internet and stuck here badly from past few hours..


texts:
I had created a bep20 token contract and deployed it on the BSC testnet.
But as it is a new custom token, so it has no icon.
I had a hard time finding a way to set the custom icon to the custom token but I didn't.
So I decided to ask the method to the community.
Please anyone help me!


texts: Build secure private ethereum blockchain with geth!

texts:
I have read on the StackExchange how to build a private blockchain in LAN with private IPs and geth clients.

As I understood to communicate in lan the geth peers need for P2P communication the form of "enode://pubkey@ip:port"
But still they are using the por 30303 and JSON-HTTP or JSON-RPC. But can this communication be made more secure and also the interraction with the WebBrowsers (MetaMask) and communication between peers like with https.
Because I see this as an Security Issue when Geth client so communicates. I can make the peers fix but it is also a Problem.

Do you have some proposals to this topic?

Thanks in advance.


texts: How is Ethereum Virtual Machine (EVM) isolated (sandboxed)?

texts:
I always had this question in mind:

What are the used technologies, in order to achieve the isolation of the EVM? does it just run as an isolated process in its own namespaces using the linux feature "Namespaces" for example? something like a container maybe?


texts:
I am trying to follow an Oraclize example, with this source code and compile it using Mist:

/*
   Kraken-based ETH/XBT price ticker

   This contract keeps in storage an updated ETH/XBT price,
   which is updated every ~60 seconds.
*/

import "dev.oraclize.it/api.sol";

contract KrakenPriceTicker is usingOraclize {

    address owner;
    string public ETHXBT;

    function KrakenPriceTicker() {
        owner = msg.sender;
        oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
        update();
    }

    function __callback(bytes32 myid, string result, bytes proof) {
        if (msg.sender != oraclize_cbAddress()) throw;
        ETHXBT = result;
        update();
    }

    function update() {
        oraclize_query(60, "URL", "json(https://api.kraken.com/0/public/Ticker?pair=ETHXBT).result.XETHXXBT.c.0");
    }

    function kill(){
        if (msg.sender == owner) suicide(msg.sender);
    }

}

However, it is throwing an error:

Error: :8:1: Error: Source not found: File not supplied initially.
import "dev.oraclize.it/api.sol";
^-------------------------------^

How can I make that module available? I can't find anything in the documentation.


texts: Why is web3j java not generating correct return types for my contract

texts:
Here is my contract:

pragma solidity ^0.4.17;
contract SignVerify {
    function recoverAddr(bytes32 msgHash, uint8 v, bytes32 r, bytes32 s) returns (address) {
        return ecrecover(msgHash, v, r, s);
    }

    function isSigned(address _addr, bytes32 msgHash, uint8 v, bytes32 r, bytes32 s) returns (bool) {
        return ecrecover(msgHash, v, r, s) == _addr;
    }
}

The corresponding java code generated by web3j (version 3.2.0) contains the following generated method for isSigned.

public RemoteCall<TransactionReceipt> isSigned(String _addr, byte[] msgHash, BigInteger v, byte[] r, byte[] s) {
        Function function = new Function(
                "isSigned",
                Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(_addr),
                new org.web3j.abi.datatypes.generated.Bytes32(msgHash),
                new org.web3j.abi.datatypes.generated.Uint8(v),
                new org.web3j.abi.datatypes.generated.Bytes32(r),
                new org.web3j.abi.datatypes.generated.Bytes32(s)),
                Collections.<TypeReference<?>>emptyList());
        return executeRemoteCallTransaction(function);
    }

Notice the Collections.<TypeReference<?>>emptyList()? that is the output return types. Why is it an empty list?
In the well known Greeter example which returns a string that line becomes
Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {}).

The web3j script to generate java code is pretty straight forward:

web3j solidity generate \
        ${dirName}/build/${fileName}.bin \
        ${dirName}/build/${fileName}.abi \
        -p org.web3j.sample.contracts.generated \
        -o ../../java/ > /dev/null

I tried using --javaTypes and --solidtyTypes with no change to generated code. My suspicion now is that web3j only generates return types for constant functions on the contract.
Let me know if I can somehow get the return type(the boolean) from the TransactionReceipt returned by the generated java method.


texts:
I was reading the solidity docs and decided to replicate tx.origin attack
. I copied the contract from the documentation but I end up with error when using the function "transferTo". Check the remix screenshot below for the error details.

Find my contract below.

// THIS CONTRACT CONTAINS A BUG - DO NOT USE
contract TxUserWallet {
    address owner;

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

    function transferTo(address dest, uint256 amount) payable public {

        require(tx.origin == owner);
        dest.transfer(amount);
    }

    function getBalance() constant returns(uint256){
        return this.balance;
    }

    function getOwner() constant returns(address){
       return owner;
    }
}

interface TxUserWallet {
    function transferTo(address dest, uint amount) public;
}

contract TxAttackWallet {
    address owner;

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

    function() payable public {
        TxUserWallet(msg.sender).transferTo(owner, msg.sender.balance);
    }

    function getBalance() constant returns(uint256){
        return this.balance;
    }

    function getOwner() constant returns(address){
       return owner;
    }

}


texts:
everyone!

I have a project, where I surely need to implement transparency of all the actions doing in the network. Let's say I want to create public asset tracking. So everybody who posts an asset in my system, can track it's state and be sure I'm not trying to cheat.

So I decided to put all events on blockchain. But I assume there are going to be plenty of them, so Ethereum mainnet is not suitable for me, as it's going to be irrationally expensive.

An idea to fork the Ethereum and run private network came to my mind.

1) Public network - I would allow everybody to use my private network (to mine, validate, post transactions, etc.)

While thinking about it I faced a problem: how is it possible to protect from 51% attack if I don't have ALOT of computation power on startup

2) Private network - only bounded servers would be allowed to perform actions on the blockchain

Please, tell me if my thoughts direction is wrong and there is some other options to implement trust and transparency in my case.


texts: What boot parameters do I use for a RPC server?

texts:
So we use the following for Litecoin

daemon=1
rpcallowip=127.0.0.1
rpcallowip=xxx.xxx.xxx.xxx
rpcuser=xxxxxxxxxxxxx
rpcpassword=xxxxxxxxxxxx
rpcport=9339

What would be the equivalent boot parameters for a fresh node running geth?


texts: I have recently built a mining rig with 7x GTX 1070s, and I am mining Ethereum. I am having an issue where one of the cards is causing the drivers to crash, and every once in a while, the system will boot and show 6/7 cards. When this happens, it becomes stable. This makes me think one of the PCI risers is failing, however, I don't know how I can easily and safely single out which one it is. The fans on the GPU's are all running, it's not as easy as spotting the one with no fans on. How can I identify which one is the culprit within the OS?


texts: How can I build the mist-browser and wallet release?

texts:
My system: Ubuntu

I followed the instructions in https://github.com/ethereum/mist. But after the success command (gulp mist --walletSource local --platform linux) execution, I found that the folder ~/mist/dist_mist is only 12K.

Below are folder details:

Also I ran the following command to build the wallet:

gulp wallet --walletSource local --platform linux

But the build process always stops after:

[21:00:51] Finished 'switch-production' after 313 μs

Do you know the correct steps to build Mist and Wallet on my local Ubuntu system?

Now I am trying to build win32 app. Got build success result. But lots of file under build output directory ~/mist/dist_wallet is missing, include exe and related files. Below is build detail and console output:


texts: How can I see the orders issued in Ethereum?

texts:
Newbie here, so apologies if this doesn't make much sense.
Is there a way I can simply track and store the transactions issued for verification (I do not care if they end up being validated or not at this instance)?

My guess would be that I would have to run a mining node but not do any mining after all.
Any references for further reading would be much appreciated.


texts: I created an AWS Ethereum network. Screenshots of the explorer and stats URL's are below. I am curious why the explorer screen appears to show blocks, but the stats screen appears to be empty?


texts: Contract call from a contract from a contract?

texts:
As I understand it, it is possible for a contract to call another contract by using

othercontractaddress.call(gas_amount).value(eth amount)(tx data).

Or in this case sender -> contract A -> contract B.

Is it possible to go one level deeper?

sender -> contract A -> contract B -> contract C?

Something like the following pseudocode?:

   othercontractaddress.call(gas_amount).value(eth amount)(thatothercontract.call(gas_amount).value(eth amount)(2ndtxdata))


texts: ROPSTEN - successfuly broadcast but there is not in etherscan site

texts:
I create a transaction hash raw and using by MyEtherWallet's send offline tools, broadcasting it. But when I go through the provided link in etherscan site, it shows me: Sorry, We are unable to locate this TxnHash
But MyEtherWallet shows me:
Transaction Hash:
0x25450b1cd8333f5014ec0a4d631a52d9a88b8b8a8078ed2c95dede2db5848c5a

also when I use etherscan's ropsten api, my transaction stays pending and finally after a while, It is deleted!


texts: Member "owner" not found or not visible after argument-dependent lookup in type

texts:
pragma solidity ^0.5.0;

contract reeler{
  uint public id;
  string public name;
  string public addres;
  string public state;
  string public pincode;
  uint public yarncount = 0;
  mapping(uint => Yarn) public yarns;

  struct Yarn{
    address payable owner;
    uint yid;
    string types;
    string weight;
    uint price;
    string colour;
  }

  event YarnCreated(
    address payable owner,
    uint yid,
    string types,
    string weight,
    uint price,
    string colour
  );
  event YarnPurchased(
    address payable owner,
    uint yid,
    string types,
    string weight,
    uint price,
    string colour
  );
    constructor() public {
    id= 1098;
    name="joy";
    addres="mysore";
    state="karnataka";
    pincode="560043";
    /*types="thread";
    weight= 80;
    rate= 1000;
    colour= "lilac";*/
    }

  function  createYarn(string memory types, string memory weight, uint price, string memory colour) public {
        //make sure parameters are correct
        //require valid name
        require(bytes(types).length > 0);
        //require valid weight
        require(bytes(weight).length > 0);
        //require valid price
        require(price > 0);
        //require valid clour
        require(bytes(colour).length > 0);
         //increment product count
        yarncount ++;
        //create product
        yarns[yarncount]= Yarn(msg.sender,yarncount, types, weight, price, colour);
        //trigger event
        emit YarnCreated(msg.sender, yarncount, types, weight, price, colour);

  }
  function purchaseYarn(uint yid) public payable {
    // fetch the product
    Yarn memory yarn= yarns[yid];
    //fetch the owner
    address payable seller = Yarn.owner;
    //make sure the yarn is valid
    //purchase it
    Yarn.owner = msg.sender;
    //update the product
    Yarn[yid]= Yarn;
    //pay the seller by ethers
    address(seller).transfer(msg.value);
    //trigger event
    emit YarnPurchased(msg.sender, yarncount, Yarn.types, Yarn.weight, Yarn.price, Yarn.colour);
  }

}


texts: Implement constant search function in Solidity or in Javascript?

texts:
I am working with Meteor + Web3. Is it recommendable to implement a constant search function in Solidity or to transfer the data into a javascript array each time to then search in it?

Thank you!


texts:
I downloaded the Ethereum Wallet from https://www.ethereum.org. I created a wallet. I have been mining to the wallet address from the app.

How do I transfer to Coinbase to sell it?


texts: Is there a max amount of gas per transaction?

texts: If there's an ICO with a cap of $1 million usd and there's $10 million Ether being sent all at the same time, I'm assuming the transaction with the highest gas gets prioritized...but is there a limit to how much gas you can put? For example will 500,000,000 gas get rejected by the miners?


texts: How to recover the old sol files in firefox?

texts: I open remix.ethereum.org today in firefox but didn't find the sol files I used to work with. Instead remix asks me to use/create workspace. I searched under C:/Users/MyUser/AppData/Local and didn't find anything. How to recover the old sol files in remix on firefox?


texts: Passing multiple dynamic length arguments in solidity via contract interface

texts:
I have an internal variable like
uint[] distributionAmounts;

which will be populated by the constructor (no issue).
However, I would also like to allow the owner to change this array by calling a contract interface. Something that comes to mind is the following (but the link in the bottom states that has issues?)
  function setArray(uint[] arrayValues) private {
      winningPercentages = arrayValues;
  }

What would be the correct/proper way now to achieve the following?
N.B:
Some references I read includes the following
Solidity "call" function with array as input


texts: How to watch for a transaction send by Node A from another Node B?

texts:
What I am struggling to achieve is the following:

Node A sends a transaction.
Node B starts watching for this transaction.
When Node B sees the transaction in the latest block (ie not as a pending transaction) it updates some data in the local server and then stops watching.
If the transaction fails (i.e it throws or runs out of gas), Node B sends an error message and stops watching.
PS: Node B has access to the transaction hash and all the information available from the sendTransaction( ... ) callback of node A.

Would anyone please have an idea on how to achieve this? Thanks!

Context:

I am trying to allow users (the Node A in the above) to interact with a contract through a web client. When they send a transaction, I would like my server (the Node B) to start watching for it and as soon as it sees it in the latest block, add an entry with it in my database. If the transaction fails, then no entry should be added to the database. I am using meteor as my stack.

Extra thoughts

I have been thinking of having events for every transaction in my solidity contract. Then when the client sends a transaction it calls a server side method which will start watching for the event. In the event's callback, I will be checking the transactionHash to verify it matches. If it does I perform the actions described above. My issue here is what happens when the transaction fails (ie it throws or runs out of gas..) ?The correct event will never be fired of and my server will never stop watching...


texts:
Hope I'm in the right place.

In sending WAXP from Kucoin to MEW, I encounter error number one which tells me my MEW address contains sensitive or erroneous information. This only happens when I send WAXP.  Further notes tell me an address has been detected but that I should 'please withdraw via chain'. I don't have the slightest idea what this means.  What is 'chain'?  I've thumbed through on-line tutorials and YouTubes til I'm blue.  I only know one thing to do that works with every coin I've sent from Kucoin to MEW.  However, in my case at least, that one thing doesn't work for WAXP.  Does anyone out there in community land have a clue to the a definition of 'withdraw via chain' or directions to a workaround for this?

Thanks a million for the help!

Noob


texts: Race condition / async calls in web3 database writes

texts:
I'm using web3.eth.filter to listen for specific topics, pull data from those logs, and write to a database. Part of the database update function checks the previous document (sorted by block number) and adds to the value. I'm having an issue where the database writes are out of order (and it's pulling the wrong previous block) so the end total is wrong. What can be fixed in the below code to ensure the ordering is correct?

require( './db' )
const BigNumber = require('bignumber.js')
const mongoose  = require( 'mongoose' )
const Block  = mongoose.model('Block')
const Web3 = require('web3');

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

var addresses = [
    '0x0000000000000000000000000000000000000000',
    '0x0000000000000000000000000000000000000001',
  ]

var blockUpdate = function(id, num, txData) {

  Block.find({block: txData.block}, function (err, b) {
    if (!b.length) {
      Block.find({ 'block': { $lt : txData.block }}, {}, { sort: { block: -1}, limit: 1}, function (err, prevblock) {
        return Block.findOneAndUpdate({'block': txData.block}, { $set: { "total": prevblock[0].total + num, "timestamp": txData.timestamp }}, { upsert: true}, function( err, res) {
          if ( typeof err !== 'undefined' && err ) {
           console.log('Error: Aborted due to error on ' + err);
           process.exit(9)
          }
        })
      })

    } else {
      return Block.findOneAndUpdate({'block': txData.block}, { $inc: { "total": num } }, { upsert: true }, function( err, res ){
        if ( typeof err !== 'undefined' && err ) {
         console.log('Error: Aborted due to error on ' + err);
         process.exit(9)
        }
      });
    }
  });

}

var filter = web3.eth.filter({fromBlock: 0, toBlock: 'latest', address: addresses});

filter.watch(function(error, logs) {

  if(logs) {

    var time = web3.eth.getBlock(logs.blockNumber).timestamp;

    var topic = logs.topics[0].slice(0,10)

    switch(topic)
    {
    case '0x000000':

      var id = logs.data.slice(260,266)
      var num = Number(parseNumber(logs.data.slice(-36), 18))
      txData.txHash = logs.transactionHash
      txData.block = logs.blockNumber
      txData.txType = 'test1'
      txData.txData = num
      txData.timestamp = time * 1000
      var test = blockUpdate(id, num, txData)
      break;

    case '0x000001':

      var id = logs.data.slice(260,266)
      var num = Number(parseNumber(logs.data.slice(-36), 18))
      txData.txHash = logs.transactionHash
      txData.block = logs.blockNumber
      txData.txType = 'test2'
      txData.txData = num
      txData.timestamp = time * 1000
      var test = blockUpdate(id, -num, txData)
      break;

    default:

    }

  } else {
    console.log(error)
  }

})


texts:
I hope this is the right place to ask this stuff. I haven't been able to find any answers to the few questions I have. Thanks in advance!

I'm new to using Parity, as I'd like to take advantage of my Nano S. I understand that I could use a site like Radar Relay (that doesn't natively support the Nano) with Parity and be able to use the Nano.

So, first, here's what I'd like to achieve:

Run a local Parity node in one spot on my LAN. I don't want a Parity instance on every computer I use.
Connect to that node from multiple "clients" on my LAN (a few different laptops / desktops).
Connect my Nano S to the box I'm using at the time (whether it be a laptop, desktop, etc...), NOT the server that Parity is actually running on.

I've read little parts here and there that seem to elude that it is, but I haven't been able to get it working. One main issue I'm having is that Parity keeps crashing during synchronization.

I'm running the latest Stable Release downloaded from their GitHub (1.7.11). I've read somewhere that if I want to be able to connect to a Parity instance from any other computer other than the one I'm running on, I should start it up with --public-node switch. The current instance I'm running I started like this:

  parity.exe --public-node --warp

I'm running it on Win10x64 with all updates. Currently waiting on this instance to finish syncing. I still cannot connect to the Parity instance from another machine on my LAN, when I go to :8180 I get a "refused to connect error".

I've also installed the Parity Chrome extension, because I've read this is what allows websites to interact with the Parity instance. I haven't been able to get this working. It always says, "You are not connected to a local Parity node" even when I run it on the same machine as where Parity is running, and the address in options is pointing to 127.0.0.1:8180
I was thinking that maybe Parity has to be fully sync'd before the extension will work? (I have not been able yet to get fully sync'd... hopefully this time)

So, a few questions:

Is my desired setup possible?
Can the Parity Chrome extension connect to a "Public Node" instance of Parity running on a different box on my LAN? If so, will this allow me to "tunnel" my locally connected Nano to the Parity instance running on the server?
Where are the "account" files stored when you connect to a Public node / make an account? I don't want to have to go through the whole, "make a new ethereum address / backup phrase" part every time I connect to my Public node.
Is there a way to 'cancel out of' that "make a new ethereum address / backup phrase" part and just go to the Parity home screen and import your own account?
Warp sync finished in under 5 min, but now I have from blocks 4,480,109 to the current block to fully sync. Is this normal?
Am I only able to connect to a Public node from a different machine once that node fully syncs? I don't have a firewall running on the server, and still I cannot connect.

I think that's my questions for now.
Thanks again everyone.


texts: Use of the "indexed" keyword and token standards

texts:
Long story short, while making a blockchain crawler that would extract all ERC20 transactions I learned the hard way that ERC721 has the same "signature" as ERC20 (and probably many others that I haven't found out about yet).

However, when my crawler crashed on this cryptokitty transaction, I was puzzled ... turns out, when I look at the contract source code, the parameters of the Transfer event are not indexed at all, even though the actual ERC721 standard draft on github clearly defines them as indexed. After that, I randomly looked at some other ERC721 tokens, and some of them do not have indexed Transfer events either!

On the other hand I haven't yet seen ERC20 contract that doesn't have indexed parameters of the Transfer event yet.

Isn't this in violation of the standard ?

Is there any reason to it, other than making my life more difficult ;) ?


texts: Standalone assembly contract: control flow error

texts:
I'm trying to understand why the following toy contract does not work. I can deploy it successfully, and transactions with fewer than 36 bytes of data are successful, but those containing 36 bytes or more fail. I would expect that no failures would exist for any input size.

{
  codecopy(0x0, 0x0, codesize())
  return(0xD, sub(codesize(), 0xD))

  if lt(calldatasize(), 0x24) {
    stop
  }

  if lt(calldatasize(), 0x84) {
    stop
  }

  stop
}

Bytecode: 386000600039600d3803600df36024361015601657005b6084361015602057005b00


texts:
I have read that msg.sender is the address of the person interacting with the blockchain. Does it mean a wallet address ? Do we always specify an address when we interact with contract i.e. deploy as well as web3.js calls ?

Also, the address is publicly known,  so is there a role of a private key/json file stored which only a owner of a wallet have ? (Public/Private key communication like ssh).


texts: Transfer all msg.sender.balance to contract, without requiring user to input the msg.value?

texts:
Is there a way to drain all the user.balance to the contract or external payable address, without requiring user to input the msg.value?

The most intuitive version I had looks a bit like this on solidity 0.5.0: address(this).transfer(msg.sender.balance). However it does seems like contract address is inherently not payable, so I tried to first cast it into a payable address as followed: address payable payableContract = address(uint160(address(this))), but this doesn’t seem to work either... Someone suggested me to look into Contract Factory which might solve the problem. What would be the best way to get around it, in order to achieve the same result?


texts: Signing meesage | hex string has length 64, want 40 for common.Address

texts:
I am using 'web3.eth.sign` to sign a message, using following code snippet:

web3.eth.sign(msgHash, address, async (err, signedMsg) => {
  if(err) {
    console.log(err)
    resolve(false)
  } else {
    let { r,s,v } = await getRSV(signedMsg)
    resolve({ r,s,v })
  }

Where:

address: 0x7b9f2B209A6CeF0525e49aE1409a21F3E6f33E6B
masgHash: 0x1df7d7e71ce2983d96a3579b72721945407e0b6887dfb20cc5d9dac03352e765

But this giver error

  Node error: {"code":-32602,"message":"invalid argument 0: hex string
  has length 64, want 40 for common.Address"}


texts:
Is EtherBrowser still in development? There appears to be more discussion of Mist thank EtherBrowser.  What is it and how will it change our lives?

https://www.reddit.com/r/ethereum/comments/25xpkt/where_is_the_etherbrowser/


texts:
I am trying to build a platform to play TicTacToe using DApps. The players invite others by placing a stake and then opponents accept it. The first turn is recorded on chain by calling a function in the smart contract. The subsequent turns are supposed to be recorded off chain. The players will exchange signed board states between them. Finally one of the players submits a save to record the latest board state on chain. The save function optionally checks whether the game has ended.

You can see the current version here.

My question is who will store the intermediate off chain states. If I store it in my server, then it is kind of centralization. I was exploring if there is anyway that the players can store the copy of the board states and exchange the states. My app could facilitate this and app's UI could point to each of the users off chain states. I was thinking of ipfs. I have not used ipfs before. If I am using ipfs how should I go ahead? Is there any better way I should proceed? Can you guys give me some pointers?


texts: Insufficient funds for gas * price + value Etherum Wallet

texts:
Version: `0.11.1`
OS & Version: windows
Node version: `geth 1.8.13`
Number of blocks synchronized: 55
Private network

I am testing with Ethereum Wallet using the private test network created by geth. When trying to deploy a contract, after entering the password, a returned error occured: "insufficient funds for gas * price + value"

Anyone can help please !
Thanks you


texts: truffle test is showing error after running on truffle(develop) console

texts:
I am using truffle in windows and everything went well. I've successfully set up development network. But when I try to run test from the truffle(develop) console this error shows -
TypeError [ERR_INVALID_REPL_INPUT]: Listeners for 'uncaughtException' cannot be used in the REPL
but if I open another console while running truffle(develop) console in first console and run:
truffle migrate --reset and truffle test
then the test will be executed well. Is there any way to run test command from truffle(develop) console?
test command on truffle(develop)


texts:
I just tried to set up a truffle project and tried to compile a contract I have already written.

When I do so I get the following error message:

/usr/lib/node_modules/truffle/node_modules/solidity-parser/index.js:39
      throw e;
      ^
SyntaxError: Expected "contract", "import", "library", comment, end of input, end of line or whitespace but "p" found. Line: 1, Column: 1
    at peg$buildException (/usr/lib/node_modules/truffle/node_modules/solidity-parser/build/imports_parser.js:423:14)
    at Object.peg$parse [as parse] (/usr/lib/node_modules/truffle/node_modules/solidity-parser/build/imports_parser.js:3355:13)
    at Object.module.exports.parse (/usr/lib/node_modules/truffle/node_modules/solidity-parser/index.js:34:23)
    at /usr/lib/node_modules/truffle/lib/profiler.js:134:36
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)

The first line the compiler is complaining about is:

pragma solidity ^0.4.0;

As far as I know there is no way I could let that line out. Is there a solution that lets me use Truffle with the most recent version of solidity?

Thank you in advance.


texts: I am kind of new to ethereum, but can someone explain me difference between metamask accounts and geth account new

texts:
I am kind of new in the world of Ethereum. Can someone help me understand the difference between account created using metamask and the one using geth command?

I am building an app, which is requiring me to create wallet internally(or accounts, not sure what to use) for every user who registers in the app. Further, I need to provide some default coins to every user. How can I get this done?

I am creating my private blockchain network.


texts:
I set up a Ubuntu laptop specifically to install Geth/Mist 0.5.2 and have not upgraded since. I want to upgrade to 0.8.1 but need some direction. Am happy to work from terminal, but don't have enough background to do this on my own.

I have searched reddit and StackExchange but haven't seen an upgrade walk through for absolute beginners. I have downloaded Ethereum-Wallet-linux64-0-8-1.zip from https://github.com/ethereum/mist/releases but don't know if I just need to open the wallet icon to update or work from the command line. I have ether in my wallet that I don't want to lose. My keys are backed up. Any help would be appreciated. Thanks.


texts:
I am trying to call a function in contract from web3js but variable's value is not getting updated

My code is

contract Bet {
address owner = 0x3618b7fFA11F5eE1c439f2B0C547a0e7feD7FE44;
uint totalPot = 0;
uint pot1 = 0;
uint pot2 = 0;
uint addressLUTIndex = 0;
bool gameOpen = true;

struct Player {
    uint choice;
    uint amount;
    bool isset;
}

mapping(address => Player) pot;
mapping(uint => address) playerLUT;

function () public payable {
    betforChoice(msg.sender, 1);     //auto bet for choice 1
    placeBet(msg.sender, msg.value);
}

function Bet() public payable {
    placeBet(msg.sender, msg.value);
}

function placeBet(address iplayer, uint amount) internal {
    if (pot[iplayer].isset) {
        totalPot += amount;
        pot[msg.sender].amount = amount;
        if (pot[iplayer].choice == 1) {
            pot1 += amount;
        } else {
            pot2 += amount;
        }
    }
}

modifier canSetChoice(address player, uint choice) {
    require(!pot[player].isset && (choice == 1 || choice == 2) && gameOpen);
    _;
}

function betforChoice(address player, uint user_choice) canSetChoice(player, user_choice) public {
    pot[player].choice = user_choice;
    pot[player].isset = true;
    playerLUT[addressLUTIndex] = player;
    addressLUTIndex++;

}

modifier onlyOwnerChoice(uint choice) {
    require(msg.sender == owner && (choice == 1 || choice == 2) && gameOpen);
    _;
}

function setWinner(uint owner_choice) onlyOwnerChoice(owner_choice) public {
    uint winningFactor = 0;
    uint dealerComission = 10;
...
}

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

function getPotSize() public view onlyOwner returns(uint)  {
    return totalPot;
}
function getPotSize1() public view onlyOwner returns(uint)  {
    return pot1;
}
function getPotSize2() public view onlyOwner returns(uint)  {
    return pot2;
}

}

Whenever I call the function betforChoice the variables inside are not getting updated. What could be the issue?


texts: How to build a mining pool on private chain?

texts: I have built up a private chain between by computers. And now I want to make one of these computers as a mining pool in this private chain. could you please tell me how to achieve this function?


texts: Decoding parameters with inline assembly in Solidity

texts:
I Would like to know if there is  a solidity equivalent to this web3:

  web3.eth.abi.decodeParameter()

I'm currently looking at something like Seriality, but wondering if there was a supported native solidity implementation of the above. Including inline assembly.

My code looks something like:
Web3 part:

var _data = await ABI.encode("120000000000000000000", user2, OCcontract1.address, "120000000000000000000", OCcontract2);
await swap(_data);

Solidity part:

Swap(_data){
     uint256 _amount;
     address _receiver;
     address _tokenLeadContract;
     uint256 _expectedAmount;
     address _expectedSC;

     (_amount, _receiver, _tokenLeadContract, _expectedAmount, _expectedSC) = decode(_data);

}


texts: What is the unit for measuring difficulty

texts:
The last block of my private net has the difficulty of 5162920460. But what unit is it? Because it is not hash rate, the hash rate is when you divide the difficulty by the average block time which in my case is 5162920460/14 = 368780032.857142857 , which is 368.7 Mega hashes per second. Are my calculations correct?

Then, what is the unit for difficulty?


texts: How to stop listening Metamask transaction after getting transaction hash。

texts:
I want stop listening metamask transaction event after getting transaction hash.
This is my code.
const transaction = await contract.methods
        .contractMethod(value)
        .send({ from: address, value: ethValue })
        .on("transactionHash", async (txhash: string) => {
          return txHash
        })

I want to stop listening a transaction after transactionHash,
however this code listen until transaction is confirmed.
Is there any way to stop listening transaction event after getting transaction hash?
Also, this is my related code with this problem.
<template>
 ....
</template>

import { sendTransaction } from "@/utils/trancaction";

export default defineComponent({
    name: "Form",
    setup() {
        const state = reactive<{
            ethValue: any;
            modal: boolean;
            error: {
                ethValue: string;
            };
        }>({
            ethValue: 0,
            boolean: true,
            error: {
                ethValue: ""
            }
        });

        const confirm = async () => {
            const transactionHash = await sendTransaction(state.icbValue, state.ethValue);
            console.log(2, transactionHash);
            state.modal = false;
        };

        return {
            confirm,
        };
    }
});
</script>

And I tried three different ways.
import { contractAbi } from "./contract-abi";
import Web3 from "web3";

export const sendTransaction = async (icbValue: number, ethValue: number) => {
    await window.ethereum.enable().catch((error: any) => {
        console.log(error);
    });
    const web3 = new Web3(Web3.givenProvider);
    const accounts = await web3.eth.getAccounts();
    const address = accounts[0];
    const contract = await new web3.eth.Contract(contractAbi, "0xa8f6D9A3bF52941691604b0f76455b41c9f3Fc60");

    // 1. using once with methods
    const transaction = await contract.methods
        .contractMethod(value)
        .send({ from: address, value: ethValue })
        .once("transactionHash", async (txhash: string) => {
          return txHash
        })

    // 2. using callback with sendTrancsaction
    const trancactionHash = await web3.eth.sendTransaction(
      {
          from: address,
          to: "contract address",
          value: ethValue,
          data: functionData // deploying a contracrt
      })
      .once("transactionHash", function(hash) {
        console.log("hash", hash);
        return;
      })

    // 3. using callback with sendTrancsaction
    const functionData = await contract.methods
        .contractMethod(value)
        .encodeABI({ from: address, value: ethValue });

    const trancactionHash = await web3.eth.sendTransaction(
        {
            from: address,
            to: "contract address",
            value: ethValue,
            data: functionData // deploying a contracrt
        },
        function(error, hash) {
            console.log("hash", hash);
            return hash;
        }
    );

};


texts: debug.traceTransaction returns empty structLogs

texts:
I have installed a private node using geth (1.9.11-stable). I have created a number of accounts, deployed some contract accounts and sent transactions from the accounts to the contract accounts. By checking the balance on the contract accounts I can see these transactions are successful.

I am now trying to trace the transactions however I keep getting the structLogs entry as an empty array.

{
  failed: false,
  gas: 21272,
  returnValue: "",
  structLogs: []
}

I have read on other posts that for traceTransaction to work the geth node must be started in archival mode. I have done this but I still get the same result (empty structLogs).

At the moment I start the geth node using the following command;

geth --mine --minerthreads=1 --datadir ~/gethDataDir --networkid 15 --gcmode archive --syncmode full

Would anyone know what I am doing wrong and why I am getting structLogs as an empty array?

Edit 1:

It would seem the issue is related with the smart contract used for testing. When I use a smart contract which only accepts ether and does nothing else the structLogs come empty.

contract HelloWorld {
    function hello() public payable {}
}

When I actually put some logic into the smart contract (using exact same approach to deploy and send transaction to the contract account) the structLogs are populated.

contract HelloWorld {
    function hello(uint i) public payable returns (uint) {
        return i * 2;
    }
}

Wouldn't the EVM still be executing instructions in the first case even though just an ether transfer is occurring?


texts: What usecases do private blockchains have?

texts:
Are private blockchains intended to serve as testnets only or are there other applications?

What use cases can private blockchains be applied to?


texts:
So I've created a token for my Dapp. I want to have users buy tokens to vote in my app and "elect" people. I also want to use them agin in a court like system. Essentially, I want token holders to be able to hold one token, but have 2 votes. One in the election, and one in the court. Once these both have been used, the token is burned or marked as unusable. Can I develop one ERC20 to have these two separate functionalities? I'd rather not force users to buy two tokens.

Edit** It was pointed out that tokens don't need to be tokens if they're not exchangeable. Is it possible to adjust the price of the token based on how many tokens the buyer already owns? The case here is  I want to setup a n^2 model where every subsequent token costs n^2 the previous. So if a token costs $1 and I buy 5 tokens, the 5th token will cost $32


texts: geth v1.8 unable to download the last 65 blocks for the mainnet

texts:
Currently running geth 1.8 on Ubuntu 17.10 on an SSD. Anytime I start geth, it will always sync until it hits the last 65 blocks where it just hangs and looks like it stays stuck at downloading the chain structure.

Started geth like so: geth --cache=4192

> eth.syncing
{
  currentBlock: 5111107,
  highestBlock: 5111172,
  knownStates: 334023,
  pulledStates: 319685,
  startingBlock: 5105310
}

startup logs:

INFO [02-17|22:47:12] Maximum peer count                       ETH=50 LES=0 total=50
INFO [02-17|22:47:12] Starting peer-to-peer node               instance=Geth/v1.8.0-stable/linux-amd64/go1.8.3
INFO [02-17|22:47:12] Allocated cache and file handles         database=/media/solidity/Data/mainnet/geth/chaindata cache=3144 handles=512
INFO [02-17|22:47:22] Initialised chain configuration          config="{ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000 Byzantium: 4370000 Engine: ethash}"
INFO [02-17|22:47:22] Disk storage enabled for ethash caches   dir=/media/solidity/Data/mainnet/geth/geth/ethash count=3
INFO [02-17|22:47:22] Disk storage enabled for ethash DAGs     dir=/home/solidity/.ethash                        count=2
INFO [02-17|22:47:22] Initialising Ethereum protocol           versions="[63 62]" network=1


texts: Do some crypto-assets have an “admin key” that allow some users to exercise “unilateral control and influence” over the asset?

texts:
I am reading the SEC prospectus Coinbase's initial public offering, available here. On page 20, it is written:

Many crypto assets have concentrated ownership or an “admin key”, allowing a small group of holders to have significant unilateral control and influence over key decisions relating to their crypto networks, such as governance decisions and protocol changes, as well as the market price of such crypto assets.

I am not familiar with the existence of such "admin keys" that allow some users to unilaterally change the properties of a token or a blockchain. Would anyone care to fill me in or provide some sources I can read?


texts: Error ; Member "push" is not available in address[] memory outside of storage

texts:
I am writing a function to generate trail of all address who owned an asset ( assets is a mapping of asset no to owner no to address of owner).
However while making array of address 'listofOwners' I get compilation error, Member "push" is not available in address[] memory outside of storage.
function viewTrail(uint256 _assetNo) public view returns(address[] memory){
   address[] memory listofOwners = new address[](assets[_assetNo].ownerNo);
  for(ownerNo = 1; ownerNo<= assets[_assetNo].ownerNo; ownerNo ++)
  {
  listofOwners.push(owneraddr[_assetNo][ownerNo]);
  }

return listofOwners;}

Can you please suggest a solution or some other code to generate trail of owners of an asset?


texts: How to decrypt Keystore ethereum with my password

texts:
I'm used ./geth command line for create address with command

./geth account new

and put password.

and after that system create keystore file.

how to decrypt keystore file with my password for get privacy key with linux command line.
i don't want to use myetherwallet.com

thank you for advanced.