texts: Why does division still truncate even though readthedocs.io says it does not?

texts:
According to readthedocs.io:

  "Division on integer literals used to truncate in earlier versions, but it will
  now convert into a rational number, i.e. 5 / 2 is not equal to 2, but to 2.5".

Yet, when I try simple math problems like this on Remix, they are truncated.
So, "5 / 2" still equals 2, and I have to use "%" or "remainder = _dividend - (quotient * _divisor)" to produce the remainder separately.

I believe I am using the latest compiler version "0.4.24".  So is the information from readthedocs just wrong?  Or does it means something else?


texts: Unable to import "remix_accounts.sol": File not found

texts:
I'm trying to write some unit tests with the remix but when I try to import remix_accounts.sol remix tells me Unable to import File Not Found
pragma solidity >=0.4.22 <0.7.0;
import "remix_tests.sol"; // this import is automatically injected by Remix.
import "remix_accounts.sol";

import "../TeamAtCompany.sol";

// File name has to end with '_test.sol', this file can contain more than one testSuite contracts
contract testSuite {
    TeamAtCompany teamContract;
    /// 'beforeAll' runs before all other tests
    /// More special functions are: 'beforeEach', 'beforeAll', 'afterEach' & 'afterAll'
    function beforeAll() public {
        // teamContract = new TeamAtQredo();
        // Here should instantiate tested contract
        Assert.equal(uint(1), uint(1), "1 should be equal to 1");
    }

    /// #sender: account-9
    function checkSender() public {
        Assert.equal(msg.sender, TestAccounts.getAccount(9),"This is not valid msg.sender");
    }

}


texts:
How can dapps on mobile web browsers interact with web3.js?

Is there any tool like Metamask or Mist on the roadmap for mobile?


texts: suggestion to automate creation of Ethereum wallets

texts: how I can automate the process of creating wallets manually, I want to do this automatically in my platform and users don't need to save private keys or pass-phrases I want to keep this in the backend of my website. so any API please that help in this?


texts: Storing and passing encrypted data to another owner

texts:
I've been thinking about this situation for quite a while and I wonder if there is  a way to solve this on the public Ethereum blockchain.

User A stores some data on the blockchain, encrypted in some way. (with A's private key, for instance). This data is thus only readable by A.
Now, A wants to "transfer" the ownership of this data to B, again in an encrypted way, all while guaranteeing that the data isn't being tampered with during the process.
This means that the encryption can't happen off-chain: first of all, B can't send his private key to A for obvious reasons, but more than that, if A would re-encrypt the data with B's key offchain, there would be no way to verify if the data is still the same.

I know there is no straightforward way to implement this logic with a smartcontract.
The obvious issue here is that smartcontracts "can't" encrypt, because you need to provide them with the key to do so, thus rendering the encryption useless from the start.

That being said, is there a way to achieve this exact process with other tools, while preserving maximal security?


texts: Is there a comprehensive reference list of all Solidity commands?


texts: Can only deploy contracts on Parity when --geth flag is invoked

texts:
When I try to truffle migrate a contract on a private blockchain using Parity, I get

  The contract code couldn't be stored, please check your gas amount

But when I do everything else the same, except adding "--geth --force-ui" to the Parity command line, it works fine.

This seems strange.  Has anyone had this problem?  Is there a known solution?


texts: Ethereum contract size limit for multipage contract

texts:
I got to know that there is a size limitation for Ethereum contract, but to avoid this I split up functions of my contract in two sol files and one contract extends other contract and this solve the size limit problem but I just want to confirm is I am doing anything wrong or I am missing anything?
For example
 Previously
File A.sol
Contract A {
function f1(){}
function f2(){}
function f3(){}
function f4(){}
}
 Now
A.sol
import "./B.sol"
contract A  is B{
function f3() public {}
function f4() public {}
}
B.sol
contract B{
function f2(){}
function f3(){}
}


texts:
I see there're some Solidity examples that are using mapping for storing state, and some are using arrays.

For example this example is using mapping:

struct Campaign {
   ....
}
uint numCampaigns;
mapping (uint => Campaign) campaigns;

and there is an array:

Proposal[] public proposals;
struct Proposal {
   ....
}

I understand that there're little bit different pattern for adding a new value, basically because arrays have the .length attribute. At least if we're comparing to mapping (uint => ...). That's all I see, maybe I'm missing something?

Lets say I have a similar pattern: a contract which operates some structs/documents (contract have functions to add and update such documents). There could be unlimited amount of documents processed by contract. My gut tells me that I should use mapping there, but I can't find any proof. So my questions is which one to choose and when.


texts:
Ethereum is moving to JIT-compiled EVM code: https://blog.ethereum.org/2016/06/02/go-ethereums-jit-evm/

As JIT compiled machine code has turned out to be a common attack vector in the base of web browsers (JavaScript) and Java, what additional security measures EVM JIT takes to ensure that rigged bytecode doesn't compromise Ethereum nodes?


texts:
I am looking to add a Refund function in my smart contract.
Like If User A deposited 1 ETH in the contract, and uses refund function, he gets 1 ETH - Gas Fee back.
I can do the transfer(address.balance-fee) however the issue is there can be multiple depositors.
How can I make sure they only get the amount they deposited.


texts: Is the contract metadata automatically deployed on Swarm?

texts:
From the solidity docs on contract metadata:

  You have to publish the metadata file to Swarm (or another service) so that others can access it. You create the file by using the solc --metadata command that generates a file called ContractName_meta.json.

When I use Truffle with an Infura api key, or Remix with MetaMask, does the node publish the contract metadata file on Swarm? Or, if I run my own geth or parity node, does it happen there?


texts: What is needed to make a contract that monitors an address and then send some % of the funds back automated?

texts:
I'm looking to make a smart contract that does the following:

If account X receives Y amount of Eth or tokens, it will send 50% of those coins back to the address that sent it.

How can this be done? Or does this have to be a centralized service? Doesn't this require a 3rd party to monitor this address and then fire the smart contract when it detects activity? Also wouldn't this contract require access to my private keys in order to send those funds back to the sender?

How can this be done in a decentralized way without the need of a 3rd party monitoring service?


texts: Why isn't this a vulnerability in openzeppelin's ERC-20 implementation (no allowance check)

texts:
openzeppelin's implementation of and ERC-20 token is as follows:

function transferFrom(address from, address to, uint256 value) public returns (bool) {
    _transfer(from, to, value);
    _approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
    return true;
}

There is no allowance check in this function, maybe it's in _transfer?

function _transfer(address from, address to, uint256 value) internal {
    require(to != address(0));

    _balances[from] = _balances[from].sub(value);
    _balances[to] = _balances[to].add(value);
    emit Transfer(from, to, value);
}

No allowance check here either? hmmm maybe it's in _approve? But that would be a bit strange...

function _approve(address owner, address spender, uint256 value) internal {
    require(spender != address(0));
    require(owner != address(0));

    _allowed[owner][spender] = value;
    emit Approval(owner, spender, value);
}

still no allowance check. I have to be losing my mind here because there's no way open zeppelin would allow such a glaring and severe vulnerability through right?


texts: Is go-ethereum performance much affected by linux filesystem choice?

texts:
Storage performance often seems to be a bottleneck when running a geth node, even when running on SSDs.

Does anyone know of performance comparisons under different linux filesystem choices? By default I find myself running cloud instances under xfs, but might another choice be preferable?

Thanks!


texts:
Let's consider the following completely useless code (tested in Remix):
// solium-disable linebreak-style
pragma solidity ^0.8.0;

contract MyContract
{
    struct TestVars
    {
        uint8 a;
        uint64 b;
        uint64 c;
    }

    TestVars private vals;

    constructor()
    {
        vals.a = 5;
        vals.b = 6;
        vals.c = 7;
    }

    function readValsStorage()
        external
    {
        TestVars storage v = vals;
        uint a = v.a;
        uint b = v.b;
        uint c = v.c;
    }

    function readValsMemory()
        external
    {
        TestVars memory v = vals;
        uint a = v.a;
        uint b = v.b;
        uint c = v.c;
    }
}

The thing we are into is gas cost. It wonders me why storage is cheaper.
I have read that each read from the contract storage costs gas. Also if you pack data into struct it behaves as one field unless you exceed the total size over 2^256.
So now my thougts come: if I read a, b, c from storage it will read 3 fields, so it will cause triple gas cost. It should be cheaper to read the entire struct to the memory as one field and grab variables.
But the result was opposite - the storage is cheaper. Why?


texts: Calling a mapping with array of struct. Optimization or performance recommendation?

texts:
I have a struct that has a number of fields and a mapping of StudentInfo array.

struct StudentInfo {
    uint studentId;
    uint courseId;
    uint age;
    string firstName;
    string lastName;
    string gender;
    bool hasPassed;
}

mapping(address => StudentInfo[]) public studentInfo;

Basically, a teacher can retrieve his/her list of studentInfo.

A new student info can be saved into studentInfo state variable via the function below:

function storeStudent(uint _studentId, uint _courseId, uint age, string _firstName, string _lastName, string gender) public returns (bool) {
    studentInfo[msg.sender].push(StudentInfo(_studentId, _courseId, age, _firstName, _lastName, gender, 0));
}

and when the teacher needs to retrieve the list of studentInfo, I call it like below:

function getStudentInfo(address _teacher) public view returns (uint[], uint[], uint[]) {
    uint length = studentInfo[_teacher].length;
    uint[] memory studentId = new uint[](length);
    uint[] memory courseId = new uint[](length);
    uint[] memory age = new uint[](length);

    for (uint i = 0; i < length; i++) {
        studentId[i] = studentInfo[_teacher][i].studentId;
        courseId[i] = studentInfo[_teacher][i].courseId;
        age[i] = studentInfo[_teacher][i].age;
    }

    return (studentId, courseId, age);
}

function getStudentInfo2(address _teacher) public view returns (string[], string[], string[], bool[]) {
    uint length = studentInfo[_teacher].length;
    string[] memory firstName = new string[](length);
    string[] memory lastName = new string[](length);
    string[] memory gender = new string[](length);
    bool[] memory hasPassed = new bool[](length);

    for (uint i = 0; i < length; i++) {
        firstName [i] = studentInfo[_teacher][i].firstName ;
        lastName [i] = studentInfo[_teacher][i].lastName ;
        gender [i] = studentInfo[_teacher][i].gender ;
        hasPassed [i] = studentInfo[_teacher][i].hasPassed ;
    }

    return (firstName, lastName, gender, hasPassed);
}

Those functions are working, but I'm just wondering if there could be any performance or gas (runs out) related issues if the size of studentInfo gets bigger and bigger.

Can the above logics be optimized?


texts: Is it possible to start Ethereum Wallet in --light mode by default on my Mac?

texts: I mean without using Terminal geth each time?


texts: How to synchronize with the test network in Ethereum Wallet?

texts:
I'm beginning with Ethereum Wallet to deploy the smart contracts. I utilize Rinbery testnet to work. Unfortunately, for the moment I don't possess any amount of Ether to deploy the contracts. Then I go to a faucet website (https://faucet.rinkeby.io/) to request some cash. I think that my account contains some cash now by consulting https://rinkeby.etherscan.io. But in the application Ethereum Wallet, my account still has no cash. And I see this message when consulting my account in the app :
If your balance doesn't seem updated, make sure that you are in sync with the network.
Can someone help to synchronize to the network ?

Here is what I found on rinkeby.etherscan.io:


texts: Does a Proof of Authority network consume much less energy than a PoW/PoS one?

texts:
One of the main problems of PoW networks like Bitcoin or Ethereum is its energy consumption.
Question 1: does this get solved with PoA networks?(without taking in account that these are not really suitable for public networks).
Question 2: are there any comparisons between PoW and PoA out there that look into the numbers, in terms like computational or environmental/energetic cost? For example, between an ethereum PoW blockchain and a PoA one. I haven't been able to find any.


texts: Finding total eth amount sent to contract from address

texts:
I am implementing a simple tokensale platform using web3.js.

It should display to the user 'You have already sent us 2.3 ETH and recieved 1003 tokens'.

It is easy to find out how many tokens the user has by using balanceOf(), but how can I find how much ETH that user sent to the contract. I can't calculate it based on tokens held, because the rate would change.

In the contract I have:

mapping (address => uint256) public amountPurchased;

I am currently using:

contractAbi = JSON.parse('[{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"amountPurchased","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]');

var crowdsaleContract = web3.eth.contract(contractAbi);

var crowdsale = crowdsaleContract.at('[TOKENSALE ADDRESS]');

crowdsale.amountPurchased.call(userAddress, function(err, result){
  alert(result);
});

but the result is always 0


texts:
I've got the following simple contract:

pragma solidity ^0.4.24;

contract MyContract {

  struct Person {
    uint age;
    uint size;
  }

  // Index of a person is its ID.
  Person[] persons;

  event PersonAdded(uint indexed id, uint age, uint size);

  function addPerson(uint _age, uint _size) public {
    Person memory person = Person(_age, _size);
    id = persons.push(person) - 1;

    emit PersonAdded(id, _age, _size)
  }

  function removePerson(uint _id) public {
    // Something like the following would be ideal:
    // require(persons.hasKey(_id), "Person does not exist.")

    delete persons[_id]
  }
}

How can I check if the given key exists in the persons array?


texts: Relationship between Ethereum Address and public key

texts:
Understand ethereum Address is a hash of a public key. We still need to encrypt message with public key to be verified with private key.

What is the use of the Ethereum address in the first place?


texts: get a list of all erc20 tokens including address and decimals

texts: Is there a way to programmatically fetch a list of all erc20 tokens including contract addresses and decimals? Im using web3 but if there is any rest service I dont know Im happy to get to know about it.


texts:
I just started the sync from scratch about 20 hours ago by running geth --rpc --fast --cache=1024.

What I can see now in console is that the last block that was synced is number=3918966
count=13 elapsed=11.009ms number=3918966 hash=2c8144…c066ee ignored=0 INFO [06-25|16:33:27] Imported new state entries

After that it is just counting in console like this:

count=55 flushed=45 elapsed=27.008ms processed=6452838 pending=11692 retry=10 duplicate=1208 unexpected=4863
INFO [06-25|20:28:11] Imported new state entries
count=384  flushed=428 elapsed=26.019ms  processed=8494218 pending=3621  retry=2   duplicate=1535 unexpected=7772
INFO [06-25|20:28:11] Imported new state entries

Does that means that sync is finished?

eth.syncing returns:

{
  currentBlock: 3927202,
  highestBlock: 3927287,
  knownStates: 8621554,
  pulledStates: 8618011,
  startingBlock: 3926371
}

eth.blockNumber returns 0

...\AppData\Roaming\Ethereum\geth\ folder size already reached 22 GB and I can tell that folder is continue to grow.


texts:
I have been using web3 1.0 (v26-beta) in the development of my dApp without errors. The smart contracts are already on Rinkeby and I intend to deploy them in mainnet in a near future.

Are there dApps in production using web3 1.0?


texts: How can I make Withdrawal with Metamask api?

texts:
I have a system, people buy my erc20 tokens through this system. I want to automatically transfer the token to their wallet address when they buy it. how can I do that?
Can this be done with the metamask api?


texts: I have question about fees in Ethereum.!

texts: If I deployed my contract on Ethereum. And there is some transactions between user and contract so if contract going to transfer some ether or tokens to user then contracts have to pay for fee. Is there is any way so that fee can deduct from contract creator(owner of contract)?


texts: Difference between msg.owner and msg.sender?

texts:
I'm having a hard time understand the difference between msg.owner and msg.sender. Can't find anything in the documentation that explicitly explains the difference. Suppose I create and deploy a contract. Will I be the 'owner'? Can these variables ever be the same?

This is confusing me because of line 118 in this contract. It looks like its refunding the sender the eth he sends but thats not what it does.


texts: How is gas adjusted for a transfer in solidity?

texts:
I am using Remix with Metamask on the Ropsten test system, and when I try and transfer Wei I get a gas error. I tried a few combinations but there are various errors relating to gas.

Has anyone any example code for this?

  Gas estimation errored with the following message (see below). The
  transaction execution will likely fail. Do you want to force sending?

        address public mywallet = 0xcDDb122bb4dCe8AcF90078E0e853b1414d10EDb0;
        bool public status = false;

        function payUser (uint amount) public  payable returns (bool) {
          uint GAS_LIMIT = 4000000;
       //   userAddress.transfer.gas(GAS_LIMIT)(amount);
       //  status =  mywallet.call.value(amount).gas(GAS_LIMIT)();
         mywallet.transfer(amount);
         return status;
        }

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


texts: How to search value in data field transaction

texts:
I need to look for a value in the data field of a transaction and to know which transactions contain the desired value.
Let me explain with an example.
In the data field of a transaction there is for example the variable username which has value "testusername".
How can I search among all transactions only those that have the variable with username "testusername"?
Do you know how I could do that?

Thanks


texts: Should I checkAndCallSafeTransfer while creating NFT?

texts:
As per erc721 a good practice during transfer of an NFT is to use 'safeTransfer()' which calls:

  checkAndCallSafeTransfer

of the

  IERC721Receiver

interface.

My question is, when creating a new NFT I dont have any value for 'from' address because the contract is just generating a new token and assigning it to a new owner. Most other contracts I saw use '0x' for 'from' address during creation. My new asset creation would look something like below:

MyAsset memory newAsset = MyAsset({
  ....// attributes
  });
uint256 assetId = xxxx;
require(_to != address(0), "Invalid address for transferFrom");
_assignAssetTo(_to, _assetId); //as per spec
require(_checkAndCallSafeTransfer(_from, _to, _tokenId, _data));

The sample implementations by zepellin here for IERC721Receiver doesn't do much checking of addresses or anything. So if I do this check its fine. But what about the real world exchange implementations. Do they do the same? Because if any implementation does a check of 'from' not being '0x' my creation method would fail in case the asset is being moved to a contract and not a wallet.

Any thoughts?


texts: Is it possible to call a higher-level function from within assembly?

texts:
Take the following code:
contract Foo {
    function increment(uint256 x) external returns (uint256 result) {
        result = x + 1;
    }

    function increment_twice(uint256 x) external returns (uint256 result) {
        assembly {
            result := add(increment(x), 1)
        }
    }
}

It doesn't compile:

DeclarationError: Function "increment" not found.

Is there any way to call increment from within assembly?


texts:
So https://registrar.ens.domains flat out doesn't work. So I tried using https://www.myetherwallet.com/#ens with a parity wallet, but that gives "bad instruction": https://etherscan.io/tx/0x0e0b9cd94a70c7b3894a973f61c707a3746190b655a1f683096f726b563b778a The value says 0 ETH but my screenshot from myetherwallet has ETH to bid, I'm not sure if that's the cause.

Has anyone managed to bid on a pre-existing auction? Is there an alternative way of bidding on an ENS auction?


texts:
I can't find an example showing how to use the new version of uPort. In particular, I need a recent example that deals with IPFS off-chain storage (with ERC 1056).
The examples given on https://developer.uport.me/ are not sufficient and most of them are deprecated!
Thank you


texts: Implementation of an Allowance Crowdsale. Token Interface / _prevalidatePurchase-/_delivertokens-function

texts:
I am new to solidity coding and after I created some basic contracts as well as a ERC20 token contract I wanted to create a crowdsale contract. Now I am stuck and I have a question regarding the implementation of an allowance crowdsale contract using the OpenZeppelin contracts.

Here is the code I added after importing SafeMath, Ownable, ERC20Basic, ERC20, Crowdsale, WhitelistedCrowdsale, AllowanceCrowdsale, CappedCrowdsale, TimedCrowdsale:

contract TestToken is ERC20 {
    using SafeMath for uint256;

    string public symbol = "TEST";
    string public name = "TEST Token";
    uint8 public decimals = 18;
    uint256 public _totalSupply = 140000000 * 10**uint256(decimals);
}

contract TestCrowdsale is Crowdsale, WhitelistedCrowdsale, AllowanceCrowdsale, CappedCrowdsale, TimedCrowdsale
{
function TestCrowdsale(
    uint256 _openingTime,
    uint256 _closingTime,
    uint256 _rate,
    address _wallet,
    address _tokenWallet,
    uint256 _cap,
    TestToken _token
    )
    public
    Crowdsale(_rate, _wallet, _token)
    AllowanceCrowdsale(_tokenWallet)
    CappedCrowdsale(_cap)
    TimedCrowdsale(_openingTime, _closingTime)
    {
    }
}

My Questions...

Q1: Where do I enter the token contract address if I want to use a token which was created before the crowdsale contract?

Q2: If I cannot enter it anywhere directly, how do I define the token interface in the crowdsale contract? I tried in the same way shown in the example crowdsale contract which uses a minted Token but it failed.

Q3: If the two mentioned options are wrong, do I have to create the Token and the crowdsale in one step?

Q4: Do I have to change anything to the imported contracts themselves for example because of the multiple use of _prevalidatePurchase or _deliverTokens functions?

Thank you very much in advance for your help.


texts: Is it possible to use events to implement server-like functionality?

texts:
In the documentation and suggested links and this question, it is mentioned that events are bound to methods and fire when a method is called (via a transaction). There is an example of a contract:

contract ClientReceipt {
    event Deposit(
        address indexed _from,
        bytes32 indexed _id,
        uint _value
    );

    function deposit(bytes32 _id) {
        // Any call to this function (even deeply nested) can
        // be detected from the JavaScript API by filtering
        // for `Deposit` to be called.
        Deposit(msg.sender, _id, msg.value);
    }
}

in which an event is fired every time method deposit() is called. I've tried to change the argument types and written the following, simplified, contract:

contract ClientReceipt {
    event Deposit(
        uint256 a
    );

    function deposit(uint256 a) {
        // Any call to this function (even deeply nested) can
        // be detected from the JavaScript API by filtering
        // for `Deposit` to be called.
        Deposit(a);
    }
}

but I get the error:

TypeError: Cannot read property 'event' of undefined

when deploying and calling the method (in browser-solidity).

Why doesn't the event fire properly?
Can a listener be used as a server from Javascript, in that, every
time a method is called from the script?
When an event fires in a function that changes the state of the
function, does it fire after the state has been changed (the
transaction corresponindg to it was mined)?

Edit:

The Javascript event listener:

var abi = /* abi as generated by the compiler */;
var ClientReceipt = web3.eth.contract(abi);
var clientReceipt = ClientReceipt.at(0x123 /* address */);

var event = clientReceipt.Deposit(function(error, result) {
    if (!error)
        console.log(result);
    else {
        // Based on the result call another method of the contract
        clientReceipt.callMethod({gas: 4700000});
    }
});


texts: Is the address of a Smart Contract fixed?

texts:
I would like to know if the address of the smart contract is fixed.

I want some privacy for my application, so I would like to change the sending address and receiving address each time the smart contract receives a transaction.

Is it possible ? Something like Hierarchical Key Derivation ?


texts: Able to Import my Account from Geth to MetaMask but No Balance Shown

texts:
I'm able to mined to my Accounts in Geth and have successfully imported to MetaMask. Problem, is in my Geth Console, I have the balance of the Mined Accounts but after imported to MetaMask, the Balance shows Zero.

eth.accounts[0]
"0x1345cdae234bb113e22ba7a4011c59b1817df8a8"

eth.getBalance(eth.accounts[0])
606000000000000000000

Need help in this, thanks.
enter image description here


texts: Is there any other way of creating an Ethereum account than using Ethereum full node?

texts:
In Ethereum full node, we can create an account by using something like:

geth account new

or

personal.newAccount();// in web3

I wondered if there are any other online tools, like MyEtherWallet or MetaMask, that allow us to create Ethereum account without having a full node?


texts: Windows Wallet, Beta 7, stuck at 460,000 out of 663,000?

texts:
My friend downloaded the Windows Beta 7 wallet and as you can see in the picture he is stuck at block 460.000. Also the "out of" blocks statistic keeps jumping between 663,000 to 1,000,000+.

Even when shutting down and starting again it stays the same.

Any advice appreciated.
Thanks.


texts: Truffle -- Microsoft JScript runtime error

texts:
Running truffle from command line gives me this Windows 7 popup message:

While init runs successfully. I see file truffle.js in my project folder. How can I handle this gently?


texts: smart contract in private Ethereum network

texts:
Let's say we have a private Ethereum network. One node has created a smart contract and pushed it to the network, while some validating node validates it and then every node puts it in the blockchain. I have couple of questions in this scenario, which I've tried to find online, but didn't get any definitive answer anywhere.

How do the other nodes in the network find out about all public functions that can be invoked on the smart-contract? Is there some way to 'extract' those function signatures from the EVM bytecode? If that's not feasible, then is it a good design decision, to enforce a function naming scheme network-wide? e.g. the getter will always be called getMyBalance(Address), something like that.
I read that a contract's Ethereum address is derived from the contract creation transaction as a function of the originating account and nonce. In that case, if a node somehow loses the contract's address, how can it retrieve the corresponding nonce, so that it can regenerate the address?
In a private network, can the nodes set a watch/trigger (like what Zookeeper provides), so that the nodes get notified if a new contract is deployed to the blockchain?


texts:
Having problems compiling this contract I found.

import "https://github.com/OpenZeppelin/openzeppelin-
solidity/contracts/token/ERC20/ERC20Pausable.sol";

pragma solidity ^0.4.17;

contract MetaToken is Pausable{

string public name = 'MetaMetaMeta! Token';
uint8 public decimals = 8;
string public symbol = 'M3T';
string public version = '0.4.0';

uint256 public blockReward = 1 * (10**uint256(decimals));
uint32 public halvingInterval = 210000;
uint256 public blockNumber = 0; // how many blocks mined
uint256 public totalSupply = 0;
uint256 public target   = 0x0000ffff00000000000000000000000000000000000000000000000000000000; // i.e. difficulty. miner needs to find nonce, so that (hash(nonce+random) < target)
uint256 public powLimit = 0x0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
uint40 public lastMinedOn; // will be used to check how long did it take to mine
uint256 public randomness;

address public newContractAddress;

function MetaToken() Ownable() {
    lastMinedOn = uint40(block.timestamp);
    updateRandomness();
}

/// update randomness, will be used to find next Nonce
function updateRandomness() internal {
    randomness = uint256(sha3(sha3(uint256(block.blockhash(block.number-1)) + uint256(block.coinbase) + uint256(block.timestamp))));
}

/// returns `randomness` used in PoW calculations
function getRamdomness() view returns (uint256 currentRandomness) {
    return randomness;
}

/// pure, accepts randomness & nonce and returns hash as int (which should be compared to target)
function hash(uint256 nonce, uint256 currentRandomness) pure returns (uint256){
    return uint256(sha3(nonce+currentRandomness));
}

/// pure, accepts randomness, nonce & target and returns boolian whether work is good
function checkProofOfWork(uint256 nonce, uint256 currentRandomness, uint256 currentTarget) pure returns (bool workAccepted){
    return uint256(hash(nonce, currentRandomness)) < currentTarget;
}

// accepts Nonce and tells whether it is good to mine
function checkMine(uint256 nonce) view returns (bool success) {
    return checkProofOfWork(nonce, getRamdomness(), target);
}

/*
    accepts nonce aka "mining field", checks if it passess proof of work,
    rewards if it does
*/
function mine(uint256 nonce) whenNotPaused returns (bool success) {
    require(checkMine(nonce));

    Mine(msg.sender, blockReward, uint40(block.timestamp) - uint40(lastMinedOn)); // issuing event to those who listens for it

    balances[msg.sender] += blockReward; // giving reward
    blockNumber += 1;
    totalSupply += blockReward; // increasing total supply
    updateRandomness();

    // difficulty retarget:
    var mul = (block.timestamp - lastMinedOn);
    if (mul > (60*2.5*2)) {
        mul = 60*2.5*2;
    }
    if (mul < (60*2.5/2)) {
        mul = 60*2.5/2;
    }
    target *= mul;
    target /= (60*2.5);

    if (target > powLimit) { // difficulty not lower than that
        target = powLimit;
    }

    lastMinedOn = uint40(block.timestamp); // tracking time to check how much PoW took in the future
    if (blockNumber % halvingInterval == 0) { // time to halve reward?
        blockReward /= 2;
        RewardHalved();
    }

    return true;
}

function setNewContractAddress(address newAddress) onlyOwner {
    newContractAddress = newAddress;
}

event Mine(address indexed _miner, uint256 _reward, uint40 _seconds);
event RewardHalved();

}

The error -

browser/test.sol:31:26: DeclarationError: Undeclared identifier.
    function MetaToken() Ownable() {
                         ^-----^


texts: How to call external payable contract function from app.js (DApp)?

texts:
The contract has a function:

function purchaseTokens() external payable {
    require(msg.value>0);
    ...etceteras...
}

What I need is an app.js part, something that would look like this (lets say I want to hard-code 12 wei for a deposit):

purchaseTokens : function (){
    App.contracts.name_of_contract.deployed().then(async function(instance){
        let message = await instance.purchaseTokens.call('12');
        App.showMessage(message);
    }).catch((err) =>{
        App.showError(err);
    })
},

However, the js function returns: TypeError: Cannot read property 'toString' of null.

What should I do for the app.js part ?


texts: How do purchase contracts in DAPPs get to know when someone made a payment in fiat?

texts:
I have question about payment in fiat such as Credit Card. Recently I found some dapps(Sorare, nifty, etc.) adopted fiat payment methods into their P2P marketplaces.

How do their purchase contracts get to know when someone made a payment in fiat? Did they build some sort of Oracle? I am curious how they trigger their purchase contracts in this case though they seem they don't receive any signing from a buyer through wallet.

If the transaction is signed by dapp developer, how do contracts transfer NFTs to the buyer who is not the msg.sender?


texts:
I launched my geth with those parameters :
sudo geth --syncmode "light" --cache=2048 --datadir /mnt/ssd/ethereum --pprof.addr 0.0.0.0 --pprof
It's running on a ubuntu server 20 on a raspberry pi 4.
When I try this :
from web3 import Web3, HTTPProvider

w3 = Web3(HTTPProvider('http://192.168.1.29:8545'))
latest_block_num = w3.eth.blockNumber
tx_count = w3.eth.getBlockTransactionCount(latest_block_num)
print("lastest block {} with a tx_count of {}".format(latest_block_num, tx_count))

I get :
'requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.29', port=8545): Max retries exceeded'
are my launch parameters corrects?
Firewall is disabled on the ubuntu.
Thanks


texts: Is the ETH in this Address Mine to Claim? Etherscan Shows Balance Left

texts:
I was wondering if someone could help me understand some confusing situation with a Binance ETH address I have. I was going through my records and noticed that one of the addresses I have used in the past still has over 0.06 ETH and some ERC20 tokens (the dollar value of everything is around $200, so not an insignificant amount) according to Etherscan. Here is a screenshot of the page:

This address has only 9 transactions in total, all from Dec. 2017 to May 2018.
7 of those transactions are inputs or deposits and 2 are withdrawals, as the image shows. I determined it is a Binance address because every single one of the incoming ETH into this account match with ETH deposits on my Binance account. However, the withdrawals don't match with the reports from my Binance account.
Etherscan marks those withdrawals as going to "Binance" which is an address with thousands of ETH.
At the same time, my ETH balance on Binance shows 0.00000000, but I am wondering if this is some amount that I somehow still have a claim over. The account only has my activity and nothing has moved since May 2018. Is there something I can do here, or at least some possible explanation about what this means?
Thanks everyone for their help.


texts: If Cryptokitties could take so much computing power in Ethereum network, how can the network support dapps with scale?

texts: There has been so much hype about developing dapps on Ethereum. However, even transactions of cryptokitties could clog the network, how could Ethereum network ever support some application like Whatsapp decentralized alternative?


texts: During ECDSA signing, how do I generate the Recovery ID?

texts:
I'm working on authoring Ethereum transactions using ECDSA with SECP256K1. On the tail end of an Ethereum transaction is the V, R, and S values of signing a hash of the message. V is defined as chainID * 2 + 35 + RecoveryID where chainID is some value unrelated to this question and RecoveryID is somehow extracted from the signing process or signing keys.

I'm working with the mbedtls library to generate private keys, hash with keccak, and sign using the proper curve. However the output of the signature process is just the R and S values. I keep looking around and can't find a reputable source of what the RecoveryID value is and nothing in mbedtls's documentation talks about it.

In this random (poorly documented) library they check if the Y of the public key is odd. In that forum post they say it's the sign of the Y of the public key. I've tried both and for some private keys the V value works and others it fails to properly recover the public key.

Is there a definitive resource explaining where the Recovery ID comes from?


texts: How can I append to a fixed size array at different times?

texts:
Huge newb here.  I want to create multiple arrays that are fixed size arrays of two addresses, but I want to be able to append to the fixed size array from seperate addresses at different times, i.e. after I've switched accounts in Metamask.  So from the UI I would click on the approve function that would add msg.sender to the fixed size array, and then once I switched accounts in metamask and clicked on the approve function again, it would add the new msg.sender to the array, giving me a list of arrays that looks like:
0: [msg.sender(from first appprover), msg.sender(from second approver)]
1: [msg.sender, msg.sender]

My current code looks like:
struct Approver {
    uint id;
    address approver;
}

Approver[] public approvers;

And the approve function would look like:
function approveTransfer() external {
    ...
    approver.push(Approver(approver.length, msg.sender));
}

function ApproverList() external view returns(Approver[] memory) {
    return approver;
}

This returns a list of arrays with one address, but I'm trying to get the two.  Any help would be greatly appreciated!


texts:
I am trying to deploy my contract using geth.

Contract goes like this :

pragma solidity ^0.5.0;

contract hier {

     uint i;
    uint ur=0;
    bytes15[2][20] public UserRole;

    function user_role_assignment(bytes15[] memory a) public
    {
        for(i=0;i<10;i++)
        {
            if(i%2==0)
            UserRole[ur][0]=a[i];
            else{
            UserRole[ur][1]=a[i];

            ur=ur+1;
            }
        }
    }

bytes15 public result;

function checkAccess( bytes15 username ) public {

    for(i=0;i<10;i++)
        {
            if(UserRole[i][0]==username)
               result = UserRole[i][1];
       }
}

function RESULT() public view  returns(bytes15)
 {

    return result;

}

}

When I pass array through function user_role_assignment, values are not stored. (Everything is working fine in Remix)
Why is it happening?

Someone please help!

Not only this, even simple function which just store value in a variable is not working in geth but working fine when I run on remix.

Eg:

contract Example{

uint public i = 0;

function store() {

 i = 100;

}

function check() public returns(uint){

 returns i;

}

After running store and check functions in geth, i values didn't change...
Please help!
Thank you.


texts: How are block proposers selected in Ethereum 2.0?

texts:
i'm doing some research about Ethereum 2.0 for university. I think i understand the way it works, but i have a perplexity about the proposer selection in a slot, especially after reading the codes here: https://github.com/ethereum/eth2.0-specs

From what i understand, at the beginning of a slot a validator check whether he's a proposer or not by using the compute_proposer_index, which takes as parameter the beacon state, a sequence of validator and the seed. In general all informations come from the beacon state: slot, epoch, randao_mixes, list of active validators...

My question is: assuming that the state change only with a block (like eth 1), if a proposer doesn't send a block during its slot, maintaining the same state, how is the next proposer selected? Shouldn't the random variables remain the same, causing the election of the same proposer over and over until he sends out a block?

Example: i'm at slot 500 and so the state is set at Slot: 500; from the informations i got in the state the next proposer should be X, but at slot 501 X goes offline and the state is unchanged: if at slot 502 i run again the code i should get X again, since nothing changed, and the blockchain gets stuck until X comes back online.

Ofc is not like this, i'm missing something, i just can't see what. Can you help me? Many thanks in advance.


texts:
Is it possible to explicitly tell if a node is using Geth or Parity?

This can be from a raw RPC call or the Infura (or other provider) layer. Is there an explicit way to do this without making an arbitrary call and looking for the trace methods (for example)?


texts: Which is the best way to interact between smart contracts for complex scenarios (solidity 0.6)?

texts:
I'm learning about Solidity.

I would like to write a complex scenario of demo to test the power of Solidity and smart contracts.

My doubts are about interaction between smart contracts.

If there are many smart contracts, what is the best way to interact between them?

Examples of scenarios:

I have a ContactA with its functions.
When something happened in a ContractA something have to trigger in
ContractB (in this example HelloWord.sol).

pragma solidity ^0.6.0;

contract HelloWord
{
  string hello= "Hi buddy";
  function getSaluto () public view returns (string memory saluto ){
    return hello;
  }
}

Another file with another Contract:

pragma solidity ^0.6.0;

import "HelloWord.sol";
contract ContractA is HelloWord
{
   event LogString(
     string errore,
     string saluto
   );
   receive() external payable {
     emit LogString("errore receive saluto " ,  HelloWord.getSaluto() ); //call to HelloWord function
   }
}

It works but, is this the best way to interact with another contract?

Another scenario whit different contract that I don't know how implements:

If i have to call another contract not related with ContractA
(because in not inherited) how to call it in a contraxt o from a
client application?

Thanks a lot.


texts: MyEtherWaller - Ledger - 'insufficient funds' when I do have ETH in there?

texts: Can anyone help on this? I have a Nano Ledger with some ETH on it. I then sent some ECR20 tokens to my Ledger via the MyEtherWallet webpage.  Now trying to withdraw them and it's saying 'insufficient funds' (yet I have plenty of ETH in there - in the Ledger at least, which shows up on the MEW web wallet page) - any ideas where I'm going wrong?! thanks!!  To be clear, the ETH I had on the Ledger before I started using MEW. However the ETH show up when I access MEW. Why does it say insufficient funds?!! thanks


texts: What are CUDA and OpenCL? How and why are they used for PoW Mining?

texts:
It is often suggested that, to practically participate in mining, one must obtain a graphics card and install CUDA and/or OpenCL libraries.

From their wikipeda definitions:

  CUDA is a parallel computing platform and application programming
  interface (API) model created by Nvidia. It allows software
  developers and software engineers to use a CUDA-enabled graphics
  processing unit (GPU) for general purpose processing – an approach
  termed GPGPU (General-Purpose computing on Graphics Processing Units).
  The CUDA platform is a software layer that gives direct access to the
  GPU's virtual instruction set and parallel computational elements, for
  the execution of compute kernels.

  Open Computing Language (OpenCL) is a framework for writing programs
  that execute across heterogeneous platforms consisting of central
  processing units (CPUs), graphics processing units (GPUs), digital
  signal processors (DSPs), field-programmable gate arrays (FPGAs) and
  other processors or hardware accelerators. OpenCL specifies
  programming languages (based on C99 and C++11) for programming these
  devices and application programming interfaces (APIs) to control the
  platform and execute programs on the compute devices. OpenCL provides
  a standard interface for parallel computing using task- and data-based
  parallelism.

How and why are CUDA and OpenCL used in PoW Mining?

How much, if at all, does the Ethereum platform depend on these?

What are the alternatives?


texts:
I wonder if there are any tutorials / guides out there that explain how to create your own web3 provider (like metamask), what to consider when creating one, how to handle security/privacy issues, what are the best practices and such..

I know for example that web3 provider, should implement the web3.js library, and to export some of its functions for external use. and if for example I want to create a chrome extension, my provider should inject the web3 object into the host window.

I know that my question is too general, but I am looking for some guidance basically, just to give me a lead to start.

Just to be clear, I am looking for a way to build a chrome extension that will be the web3 provider, in other words I want to build my own Metamsk / parity extension


texts: How can I install Ethereum on the Windows 10 Ubuntu Bash

texts:
Windows 10 new preview release includes the Ubuntu Bash.

I would like to know if anybody has had some luck installing ethereum using the bash, and can provide details instructions.

apt-get install cpp-ethereum does not work, as it includes the qt components like mix and alethzero.

Building from source allows you to ignore the compilation of these when creating the cmake file, but it is failing linking libscrypt.so

Note: The bash is in beta at the moment, the same issue on compilation has been reported, so it might be safe to assume, at the moment, this is a bash / windows issue.


texts:
I'm looking at this piece of code from Plasma MVP

    function startExit(uint256 utxoPos, bytes txBytes, bytes proof, bytes sigs)
        public
    {
        uint256 blknum = utxoPos / 1000000000;
        uint256 txindex = (utxoPos % 1000000000) / 10000;
        uint256 oindex = utxoPos - blknum * 1000000000 - txindex * 10000;
        var exitingTx = txBytes.createExitingTx(11, oindex);

        require(msg.sender == exitingTx.exitor);
        bytes32 root = childChain[blknum].root;
        bytes32 merkleHash = keccak256(keccak256(txBytes), ByteUtils.slice(sigs, 0, 130));
        require(Validate.checkSigs(keccak256(txBytes), root, exitingTx.inputCount, sigs));
        require(merkleHash.checkMembership(txindex, root, proof));
        addExitToQueue(utxoPos, exitingTx.exitor, exitingTx.amount, childChain[blknum].created_at);
}

What is the difference between txindex and oindex? Is it possible to explain in more layman terms? (maybe an illustration or example).


texts: How to specify nonce value of ERC token transfer?


texts: Solidity: Deleting a Struct from a Storage Array?

texts:
struct Locker {
  uint creationTime;
  uint holdTime;
  uint balance;
}

mapping (address => Locker[]) lockersByAddress;

function withdrawAll() public {
  Locker[] storage lockers = lockersByAddress[msg.sender];
  for (uint i = 0; i < lockers.length; i++) {
    if (lockers[i].creationTime + lockers[i].holdTime < now) {
      msg.sender.transfer(lockers[i].balance);
      Withdrawal(msg.sender, lockers[i].balance);
      delete lockers[i];
    }
  }
}

At the moment, running withdrawAll successfully transfers the specified funds and triggers the Withdrawal event, but doesn't delete the Locker struct from the array. The same Locker is still available after running the function.

I assumed that using the storage keyword in my lockers declaration would create a pointer to the array of Locker structs in-memory, but then why isn't delete doing anything?

Any help would be greatly appreciated.


texts: How to add fallback payable method to Issue token based on Ether received

texts:
i have created an ERC20 token. i want to send some tokens to anyone who send ETHER to the contract using fallback payable method.

how to set token price against ETHER.
receive ETHER and send tokens using fallback payable function.
solidity 0.6.


texts:
I use safemath in (more or less) any contract where the number input could be malicious.
But I have a contract that only handles ether. You can transfer ether to the contract. The ether amount can not be malicious (as far as I know).

So, I am wondering, when do I really NEED to use safemath. Adding safemath also adds some complexity, thus more gas is required.


texts: How to install Truffle 3.x, current release is Truffle 4.0

texts:
Hello I have some code examples which seem to work on Truffle 3.x but breakup with Truffle 4.x

Is there a way I can specify in Powershell to install Truffle 3.x


texts: Can we run a separate blockchain on Ethereum. if so how?

texts: I would like to know whether separate blockchain can be hosted on Ehereum and i am wiling to try this out. Hope someone will be able to guide me to right path Thanks in Advance


texts: Awarding members after an ICO: batch or individually?

texts:
My tokens will be distributed to users after a crowd sale. The amount they receive depends on how much everyone has donated, so the distribute function must be performed after the end of the crowdsale.

My first instinct was to have the distribute function iterate through an array, calculating and sending each user's token allotment in one fell swoop. But since the number of participants is unpredictable, there's a chance that operation will require more gas than the block gas limit.

A better alternative seems to require individual members to execute the "distribute" function individually, after the crowd sale.

Practically speaking, does it matter?


texts: Chainlink Price feed Main contract points to Kovan. Why?

texts:
I'm setting up price feeds with Chainlink.
https://docs.chain.link/docs/ethereum-addresses#mainnet
This page has sections: Mainnet, Rinkeby, Kovan.
Under Mainnet..
Clicking a pricefeed takes me to ..
ETH / USD  0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419
https://kovan.etherscan.io/address/0x9326BFA02ADD2366b30bacB125260Af641031331
Why is the Mainnet pricefeed URL on Kovan?


texts:
I'd like to implement WalletConnect on my site, so that users of a platform I'm trying to improve a lot (real estate tokenization) can connect their MetaMask wallet (and others eventually?!) to the site, so that we can display a portfolio with the tokens the person owns (ERC20).
Do you have any idea how to set this up? I can't easily find any documentation on this subject.
Thank you


texts: ValueError: {'code': -32000, 'message': 'invalid sender'} when calling transferFrom using web3.py

texts:
I want to make a function that allows you to send tokens from one owner to another.

    nonce = w3.eth.getTransactionCount(from_['address'])

    unsigned_transaction = contract.functions.transferFrom(
        from['address'],
        to['address'],
        1
    ).buildTransaction({
        'chainId': 1,
        'gas': 70000,
        'gasPrice': w3.toWei('1', 'gwei'),
        'nonce': nonce,
    })

    signed_transaction = sign_transaction(
        unsigned_transaction,
        from['private']
    )

    tx_ref = send_transaction(signed_transaction)

But I get the following error:

  ValueError: {'code': -32000, 'message': 'invalid sender'}

What am I doing wrong?

Who in this case is the sender?
What's wrong with him?


texts: how import erc20 from paper wallet to online wallet eg my ether

texts: does anyone know how to get my Theta (erc20 ) tokens off a paper wallet back online coinomi cant do it maybe my ether? struggling to find any where to put a private key off my paper wallet so i can transfer onto an online wallet can anyone help thank you


texts: Can you solo mine directly to an address you don't have the private key for?

texts:
Is it possible to solo mine directly to an address you don't have the private key for. I would like to directly mine into my exchange address.
Thank you


texts: Best way to store long strings in a mapping?

texts:
I want users to be able to store long URLs on Etherum.

 mapping(address => string[]) public addressToLinks;

UnimplementedFeatureError: Accessors for mapping with dynamically-sized keys not yet implemented.

I cant seem to use strings, and there doesn't seem to be a data type for larger bytes, like bytes256.

What is the best way to solve this problem? I'm not opposed to using the new experimental ABI encoder, but I still cant figure out a good solution... (I dont want to use a URL shortener)

I suppose I can store a mapping to a uint index, and have the index take me to a giant 2d array of arrays of strings... but theres gota be a better way....

Thanks!


texts:
Can I have some clarification on what is the first argument of web3.eth.sign.

it says here that the first argument is a account-- What is an account? Is it my ethereum address or a private key.
it says to make sure "the account must be unlocked" -- Im not dealing with geth. How do I unlock my account?

I am just writing test on my smart contract deployment on Ganache and now I need to sign something with a private key hopefully with one of the local account I control on Ganache.
I have tried inserting my ethereum address. After using ecrecover to verify the signer of the signature, I found that the account signing is done by an address 0x3f17f1962B36e491b30A40b2405849e597Ba5FB5 -- apparently this is the address generated from the private key 000..0. Which makes sense because I think I should be passing something like a private key (not the address), hence this api confuses me.
web3.eth.sign(
      <Ganache Ethereum address>,
      text='some-text-tö-sign')


texts:
If in solidity code the mapping is too long, I mean mapping address=>int256
If here there are too many addresses Records in this mapping, whether there is a limit for this because if I call this mapping variable it maybe cost too much gas and reach the max? How about this in Tron?


texts: What are the minimum requirements for Geth server only for API calls?

texts:
I want to run a platform based on Ethereum and PHP to let our customers to sell/buy Ethereum based currencies online, and we have not any plan to mine the blockchain. In this regard, please help me to know what are the requirements for such server?
Also, we have chosen Geth and Parity for this purpose based on our researches. Are we right?


texts: Crowdsale Contract Merged into Token Contract

texts: Is it safe to have the Crowdsale and Token contract combined as one contract instead of two separate ones? Are there any drawbacks/advantages of doing this?


texts:
I recently tried getting back into developing on Ethereum and it seems that everything about my setup has changed in the last half a year. I used to just be able to download a wallet from https://github.com/ethereum/mist/releases , and be able to connect to the public testnet easily. Now even the installation guide for geth tells me how to run a private testnet, but not how to connect to the public one...

So, I got my Windows geth from https://geth.ethereum.org/downloads/ . I tried running geth.exe --testnet --rpc --rpcapi "personal", but it doesn't appear to be synching with anything like it used to.

How can I connect geth to a public testnet, synch with it, get some ether to play around with and be able to connect to everything through a json rpc connection?


texts: How to connect Dapp front end to geth node

texts:
The very basics of the connection from front end to the contracts and how they can be invoked from front end code would help me a lot.

Please share the code and basic steps also.
And I am not using any IDE as of now.

Thanks in advance


texts: What's the chainstructure that mist is downloading?

texts:
What is the highest number of chain structures that I need to sync with? I'm currently on 10.08 million, and the block sync is stuck at 2,562,029.

Is this normal? The website telling me which block is the highest is not helpful, as my wallet is also downloading and syncing "chain structure" -- at 10.08 million now. I'm confused as to what the chain structure is and what the highest number is, to see if this is normal behavior.


texts:
module.exports = {
build: {
//"index.html":"index.html",
//"app.js": [
//"javascripts/app.js"
//],
//"app.css": [
//"stylesheets/app.css"
//],
//"images/": "images/"
},
  networks: {
    development: {
      host: "localhost",
      port: 8545,
      network_id: "*" // Match any network id
    }
  }
};

This is my truffle.js config file(the reason I have commented all those lines is that I have not created them yet.)
when I run the truffle build command, I get the following error

Build configuration can no longer be specified as an object. Please see our documentation for an updated list of supported build configurations.

I went through http://truffle.readthedocs.io/en/beta/getting_started/build/ but there it's the same. Version Details-
Truffle v3.4.7 (core: 3.4.7)
Solidity v0.4.13 (solc-js)

The build proceeds with the new config file according to the Truffle version 3 docs.

var DefaultBuilder = require("truffle-default-builder");
module.exports = {
build: new DefaultBuilder({
"index.html":"index.html",
"app.js":[
"javascripts/app.js"]
}),
  networks: {
    development: {
      host: "localhost",
      port: 8545,
      network_id: "*" // Match any network id
    }
  }
};

But now I am getting a new error

Compiling ./contracts/ConvertLib.sol...
Compiling ./contracts/MetaCoin.sol...
Compiling ./contracts/Migrations.sol...
Writing artifacts to ./build/contracts
Error: Couldn't find file at .//app/index.html.
    at DefaultBuilder.expect (/home/ankit-x3/TRUFFLE/node_modules/truffle-default-builder/index.js:281:17)
    at /home/ankit-x3/TRUFFLE/node_modules/truffle-default-builder/index.js:179:15
    at /home/ankit-x3/TRUFFLE/node_modules/async/lib/async.js:375:13
    at iterate (/home/ankit-x3/TRUFFLE/node_modules/async/lib/async.js:262:13)
    at Object.async.forEachOfSeries.async.eachOfSeries (/home/ankit-x3/TRUFFLE/node_modules/async/lib/async.js:281:9)
    at Object.async.inject.async.foldl.async.reduce (/home/ankit-x3/TRUFFLE/node_modules/async/lib/async.js:374:15)
    at DefaultBuilder.process_files (/home/ankit-x3/TRUFFLE/node_modules/truffle-default-builder/index.js:173:9)
    at DefaultBuilder.process_target (/home/ankit-x3/TRUFFLE/node_modules/truffle-default-builder/index.js:224:8)
    at /home/ankit-x3/TRUFFLE/node_modules/truffle-default-builder/index.js:263:10
    at /home/ankit-x3/TRUFFLE/node_modules/async/lib/async.js:181:20
    at iterate (/home/ankit-x3/TRUFFLE/node_modules/async/lib/async.js:262:13)
    at Object.async.forEachOfSeries.async.eachOfSeries (/home/ankit-x3/TRUFFLE/node_modules/async/lib/async.js:281:9)
    at Object.async.forEachSeries.async.eachSeries (/home/ankit-x3/TRUFFLE/node_modules/async/lib/async.js:214:22)
    at DefaultBuilder.process_all_targets (/home/ankit-x3/TRUFFLE/node_modules/truffle-default-builder/index.js:262:9)
    at DefaultBuilder.build (/home/ankit-x3/TRUFFLE/node_modules/truffle-default-builder/index.js:132:8)
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:103776:17.

Problem solved. I missed the app directory needed. Thanks.


texts: What's the difference between two params of web3.eth.filter?

texts:
I read official manual

What the difference between this

web3.eth.filter({'fromBlock': 'pending', 'toBlock': 'latest'})

and this?

web3.eth.filter('latest')


texts: How to install and test Viper programming language?

texts:
Viper is a new functional, strongly typed, bounds/overflow-checking, fixed-point-decimal python syntax-based HLL. The repository does not inlcude any documentation yet.

I built and installed pyethereum with python 3.5.2, and running test_parser.py fails with an sha3 assertion.

 viper $ python test_parser.py
Traceback (most recent call last):
  File "test_parser.py", line 3, in <module>
    from ethereum import tester as t
  File "/usr/lib/python3.5/site-packages/ethereum-1.6.0-py3.5.egg/ethereum/__init__.py", line 8, in <module>
    from . import slogging  # noqa
  File "/usr/lib/python3.5/site-packages/ethereum-1.6.0-py3.5.egg/ethereum/slogging.py", line 6, in <module>
    from ethereum.utils import bcolors, isnumeric
  File "/usr/lib/python3.5/site-packages/ethereum-1.6.0-py3.5.egg/ethereum/utils.py", line 125, in <module>
    assert encode_hex(sha3(b'')) == b'c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'
AssertionError

What are the requirements to run and install it? And how to do so? I'm assuming it's just using the incorrect sha3() method.


texts:
I am trying to write a function to get the ethereum balance of a wallet address via web3js. Problem is I am unable to make it work for some reason. Here is my code running in VSCode:

const testnet = 'https://ropsten.etherscan.io/';
const walletAddress = '0x8690F1feff62008A396B31c2C3f380bD0Ca6d8b8';

const web3 = new Web3(new Web3.providers.HttpProvider(testnet));
var balance = web3.eth.getBalance(walletAddress);

The wallet contains 0.98 ether on ropsten but for some reason its not returning when I call it from my code. What am I doing wrong?


texts: Unlocking Ethereum wallet using Geth JSON-RPC

texts:
When I use ETH with JSON-RPC I have error
"message": "authentication needed: password or unlock»
and If I manually unlock I have other error
"message": "insufficient funds for gas * price + value"
Any ideas????
POST request


texts: Could parasite contracts cripple the Ethereum ecosystem?

texts:
This critique of Ethereum presents leeching Parasite Contracts as a problem.  A Parasite Contract accesses data from other contracts (which may be charging fees for the data), and offers the same data for free.

It extends the argument to claim that ultimately all contracts will fail.

  Because of this, any Host (external-data contract) can’t grow to a
  significant size without being invaded by Parasites and leeched to
  death

While the basic premise may be valid, what are the main reasons why the extended conclusion might be wrong?


texts: What are the differences between Microsoft Azure's Ethereum and the normal Ethereum?

texts: What are the extensions of the newly announced Azure Ethereum over Ethereum?


texts:
I see that there are some ICO who collect ETH without smart contract and would like to know the negatives and positives for such decision.

Thank you


texts: How long does it take to reach consensus?

texts:
I know it takes about 10 minutes on Bitcoin?

How long does it take to reach consensus on Ethereum so that I can start trusting a transaction?

EDIT:

I am not asking about pending transactions. Pending would indicate that the transaction is in some unconfirmed state (non trustworthy). I want to know about fully confirmed transactions. Thanks.


texts: contract.deployed() not working when trying to submit an html form

texts:
i am using web3.js to communicate with my smart contract.
how ever, when i try to submit the html form, and then use contract.deployed(), it isnt working
below is the code.Html

            <form id="stuff">
                Survey Number
                <input id= "sno" type="text" placeholder="Enter survey Number" name="sno" required>

                Choose a Disease:
                <select id="disease" name="disease">
                  <option value="0">Fungal infection</option>
                  <option value="1">Allergy</option>
                  <option value="2">GERD</option>
                  <option value="3">Chronic cholestasis</option>
                  <option value="4">Drug Reaction</option>

                </select>

                <button id = "registerbtn" type="submit" class="registerbtn" >Register</button>
              </form>

js code

render: function() {
    $('#input').attr('style', 'margin-left:25%');
    $('#getCount').attr('style', 'display: none;');

    web3.eth.getCoinbase(function(err, account) {
      if (err === null) {
        App.account = account;
        $("#accountAddress").html("Your Account: " + account);
      }
    });
    $('#registerbtn').click(function(){

      $('#stuff').submit(function(){
        App.contracts.Geriatric.deployed().then( function(instance){
          alert("insatnce "+instance);
       });
      });

    });

  },

The alert in the App.contracts.Geriatric.deployed() is not occurring,i cant seem to find what the real issue is.The App.contracts.Geriatric.deployed() works fine when not inside the submit event.


texts:
Currently I import a contract into another one, wich allow me to create a new contract based on the imported one.
I would like to manage versions of the imported contract, so a RelayContract (or RegistryContract) seems fine, I will reference the address of the last version of my contract in this Relay, but how do I then create a new contract based of this last version ?

My code :

import "Contract.sol";

contract ContractFactory {
  contractAddress = new Contract();
  Contract(contractAddress).someFunction();
}

Instead of this, I would like use a relay like this :

contract ContractRelay {
  address public contractAddress;

  function setPotContractAddress (address _contractAddress) public {
    contractAddress = _contractAddress;
  }
}

To get the address of the last version of the contract and then create a new one.

Thank you


texts:
I have a crowdsale contract that inherits RefundableCrowdsale.sol from OpenZeppelin. I was using their v1.10.0 initially, but now revamping it using v1.12.0.

contract TestTokenCrowdsale is Crowdsale, MintedCrowdsale, CappedCrowdsale, TimedCrowdsale, WhitelistedCrowdsale, RefundableCrowdsale { ... }

and wrote a test script to test refunds.

In v1.10.0 this worked:

const RefundVault = artifacts.require('./RefundVault');

contract('TestTokenCrowdsale', function(accounts) {
    beforeEach(async function () {
        ...
        this.goal = ether(50);

        this.crowdsale = await TestTokenCrowdsale.new(
            ...
            this.goal
        );

        // Track refund vault
        this.vaultAddress = await this.crowdsale.vault();
        this.vault = RefundVault.at(this.vaultAddress);
    )};

    describe('during crowdsale', function() {
      it('prevents other accounts from claiming refund', async function() {
        await this.vault.refund(accounts[2], { from: accounts[2]}).should.be.rejectedWith(EVMRevert);
      });
    });
}

But in v1.12.0 RefundVault.sol has changed to RefundEscrow.sol.

Before, I could track refund vault in beforeEach.

this.vaultAddress = await this.crowdsale.vault();
this.vault = RefundVault.at(this.vaultAddress);

This was possible because this.crowdsale.vault() is public in v1.10.0. However, since in v1.12.0 escrow became private, I'm not sure how to modify it accordingly.

this.vault.refund won't work either because they removed refund in v1.12.0 as well.

How can I change to test prevents other accounts from claiming refund in v1.12.0?


texts: Let's assume I'm trying to create a password within Ethereum. If a user inputs their password into call data, would that get cached anywhere within the network (the password itself). Secondly, within a private mapping, is it possible to see all values attached to it?


texts: Remix error: "Expected token LBrace got 'View' function get() public view returns (uint)"

texts:
I have this error during the compiling of the code below on Remix.

Someone could help me ?

    pragma solidity 0.4.4;
    contract SimpleStorage{
    uint storeddata;
    function set(uint x) public{
        storeddata = x;
    }
    function get() public view returns(uint){
        return storeddata;
    }
}


texts: How to get the address of a contract deployed by another contract?

texts:
// deploy a new purchase contract
function newPurchase()
    public
    payable
    returns(address newContract)
{
    Purchase c = (new Purchase).value(msg.value)(address(msg.sender));
    contracts.push(c);
    lastContractAddress = address(c);
    return c;
}

I was going through this code: https://github.com/jacksonng77/StartEscrow/blob/master/StartEscrow.sol

and I got to this part of the code (see code above) where I am having difficulty trying to understand it. (The full code is on the link above) The difficulty is particularlly on this line

Purchase c = (new Purchase).value(msg.value)(address(msg.sender));

How does this return the address of the contract? Why are we doing a

.value(msg.value)

and what is the work of

(address(msg.sender));

Also this line...

lastContractAddress = address(c)

why can I just say

lastContractAddress = c;

what is the purpose of address()?


texts: web3 Uncaught TypeError: Cannot read property 'createBox' of undefined

texts:
i'm trying to create simple application by using solidity 5.0.0 , Truffle v5.0.0 and web3 web3@1.0.0-beta.34.

but i've gotten

  Uncaught TypeError: Cannot read property 'createBox' of undefined.

these are my codes.

pragma solidity >0.4.99 <0.6.0;

import "./SafeMath.sol";

contract PiggyBank {

using SafeMath for uint256;

struct Box {
    address owner;
    uint256 targetFigure;
    uint256 balance;
}

mapping (address =>  mapping (uint16 => Box)) public myBoxes;

event Deposit (
    address indexed _from,
    uint16 indexed _to,
    uint256 indexed _amount
);

event Withdraw (
    uint16 indexed _whichBox,
    address indexed _to,
    uint256 indexed _amount
);

function createBox(uint16 _boxid, uint _targetFigure) public {
    myBoxes[msg.sender][_boxid].owner = msg.sender;
    myBoxes[msg.sender][_boxid].targetFigure = _targetFigure;
    myBoxes[msg.sender][_boxid].balance = 0;
}

function getBoxInfo(uint16 _boxid) onlyOwner(_boxid) public view returns (uint256, uint256) {
    return (myBoxes[msg.sender][_boxid].targetFigure, myBoxes[msg.sender][_boxid].balance);
}

function deposit(uint16 _boxid,uint256 _amount) onlyOwner(_boxid) public payable {
    require(msg.value == _amount);
    myBoxes[msg.sender][_boxid].balance = myBoxes[msg.sender][_boxid].balance.add(msg.value);
    emit Deposit(msg.sender,_boxid, _amount);
}

function withdraw(uint16 _boxid) onlyOwner(_boxid) public payable {
    require(myBoxes[msg.sender][_boxid].targetFigure <= myBoxes[msg.sender][_boxid].balance);
    uint amount = myBoxes[msg.sender][_boxid].balance;
    myBoxes[msg.sender][_boxid].balance = 0 ;
    msg.sender.transfer(amount);
    breakBox(_boxid);
    emit Withdraw (_boxid, msg.sender, amount);
}

function checkBalance() view public returns (uint){
    return(msg.sender.balance);
}

function breakBox(uint16 _boxid) public {
    delete myBoxes[msg.sender][_boxid];
}

 modifier onlyOwner(uint16 _boxid) {
   require(msg.sender == myBoxes[msg.sender][_boxid].owner);
    _;
}
}

web3

        var PiggyBank;

        var userAccount;

        function startApp() {

            var piggyBankAddress = "0xEa6294cDB3F810215ebAcd76367365F1C611f422";
            PiggyBank = web3js.eth.contract(PiggyBankABI, piggyBankAddress);
            console.log(PiggyBank)
                var accountInterval = setInterval(function() {
                // Check if account has changed
                if (web3.eth.accounts[0] !== userAccount) {
                    userAccount = web3.eth.accounts[0];
                }
                }, 100);
            }

        window.addEventListener('load', function() {

        if (typeof web3 !== 'undefined') {
            if (web3.currentProvider.isMetaMask === true) {
                console.log('MetaMask is active')
                web3js = new Web3(web3.currentProvider);
                startApp()

                } else {
                alert("MetaMask is not active")
                }
        } else {
                alert("Use Mist/MetaMask's provider")
            }
        });

        function create(){
            event.preventDefault();
            var _boxId = document.getElementById("boxId").value;
            var _targetFigure = document.getElementById("targetFigure").value;
            console.log(_boxId)
            console.log(_targetFigure)
            return PiggyBank.methods.createBox(_boxid, _targetFigure).send({from:userAccount})
            .on("receipt", function(receipt) {
            console.log(receipt)
            //$("#txStatus").text("Successfully created ");
            })
            .on("error", function(error) {
            console.log(error)
            //$("#txStatus").text(error);
        });
        }

could anyone tell me how to solve this error?
i spend 2 hours to try to solve this error,but i still got in stack...


texts: I lost my keyfile. Is it possible to access my account again?

texts: I lost my account's keyfile. Is it somehow possible to access it again?


texts: parity json RPC eth_getBalance timeout on light mode

texts:
I have timeout problem with eth_getBalance on light mode enable on parity json-rpc. I have no problem with light mode disabled.
Here my command on parity

  parity --chain ropsten --jsonrpc-apis all --jsonrpc-cors all --pruning
  fast --db-compaction ssd --cache-size 1024 --mode active --warp
  --light

is there any way to fix it ?
I am running on Mac OS.


texts: Error when connecting geth to local network rpc

texts:
I have been working on trying to run a geth node on my home server (FreeBSD jail on a freenas) and setting up my laptop geth to attach to the rpc to save space on my laptop. I have confirmed that the geth node on the server works and I can connect locally on the jail through geth attach http://localhost:8545. However, when I try to connect to the node through my windows laptop using geth.exe attach http://XXX:8545 I get the error:

Fatal: Failed to start the JavaScript console: api modules: invalid character 'i' looking for beginning of value.

Has anyone tried something similar or know why this may be happening?


texts: Can i recover my private key with the keystore file?

texts:
I have a wallet on myetherwallet.com.
I lost my private key. I am still able to open my wallet using the keystore JSON file.

Can i have my private key back? How?


texts: Where I can find the response in the blockchain (transaction inputs) or storage file in smart contract (resultat of transaction)?

texts:
when a user sends a tarnsaction to define the access control of a resource to a device s1,then it will be executed by smart contract and the result of the transaction is stored in the storage file of the smart contract (i.e. access control to the resource s1 is r, x, w), and the transaction input (i.e. from, to, data, sign, etc) will be included in the blockchain after mining.

What I would like to know for example: when a device s2 wants to know the access of the control to the resource of s1, is s1 will contact the nearest miner and the miner looks in the blockchain (contains the transaction inputs) and sends the answer to s1 or s1 can directly contact the smart contract which has the result of the transaction execution in its storage file?


texts: GUI miners for Private Ethereum Blockchain

texts:
I have setup a multinode private Ethereum blockchain with geth. I am using geth miner (miner.start(thread) at geth console) for mining blocks but my other nodes users want to use GUI miner instead of geth.

Can anyone help with any suggestions to how to use any GUI miner with private ethereum blockchain?


texts: Probe network for events and transactions while hosting on AWS ubuntu

texts:
My intention is to be able to log events and transactions on the ethereum chain, in order to display user updates in a standard http web application. if i am running geth on a AWS ubuntu server, i will be able to probe the chain with the web3js interface right? what is the correct way to probe the hosted chain for events and transactions to display in-app, without forcing the user to use a metamask plugin or web3 browser?

just diving into the eth dev world, with limited documentation resources. is there an easier way to probe the chian, like a web service or something? thanks


texts: How to monitor token flow after crowd-sale?

texts:
I have created a token with Token name as TestToken and Symbol as TTT for crowd-sale. During Crowd-sale I have transferred TTT token to my investors say Bob. After crowd-sale, he (Bob) transferred TTT token to his friend Alice. Now, How to ensure Alice Token TTT was created by me? What if he created another token contract with the same name and symbol and claim that was the original token. How to differentiate original one and false token?
And how to track my token flow after crowd-sale.


texts: How could sidechains be used for auditing fiat transactions?

texts: Can the blockchain be used for auditing in financial institutions?


texts: Can't see deployed contract in truffle console

texts:
As seen in the screenshot, I deploy a contract named TulkerSale using Ganache. Then in truffle console, TulkerSale.deployed() returns an error...

How can I access the deployed contract in the console?


texts: Is it possible to create ERC223 token that is ERC20 backwards compatible

texts:
I'm going to use ERC223 token, but worry about backward compatibility with ERC20. Here are questions that bother me:

Two different Transfer events: 3 args ERC20 Transfer(address indexed _from, address indexed _to, uint256 _value) and 4 args ERC223 Transfer(address indexed from, address indexed to, uint value, bytes data)
transferFrom/approve/allowance functions and Approval event are specified in ERC20 standard, but lacks in ERC223 though it is said that "ERC223 is a superset of the ERC20 token standard".

Could anybody clarify this points for me? I want to avoid situation when token is already deployed and sent to people, but it is not operable at trading exchange and does not not work with services designed for ERC20.


texts:
Getting error with this code

**/*

Meta Mining Token

 https://github.com/Overtorment/MetaMining

  */

  import "https://github.com/OpenZeppelin/openzeppelin-
  solidity/contracts/token/ERC20/ERC20Pausable.sol";
  import "https://github.com/OpenZeppelin/openzeppelin-
  solidity/contracts/ownership/Ownable.sol";

  pragma solidity ^0.4.17;

 contract MetaToken is Pausable{

string public name = 'MetaMetaMeta! Token';
uint8 public decimals = 8;
string public symbol = 'M3T';
string public version = '0.4.0';

uint256 public blockReward = 1 * (10**uint256(decimals));
uint32 public halvingInterval = 210000;
uint256 public blockNumber = 0; // how many blocks mined
uint256 public totalSupply = 0;
uint256 public target   = 0x0000ffff00000000000000000000000000000000000000000000000000000000; // i.e. difficulty. miner needs to find nonce, so that (hash(nonce+random) < target)
uint256 public powLimit = 0x0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
uint40 public lastMinedOn; // will be used to check how long did it take to mine
uint256 public randomness;

address public newContractAddress;

function MetaToken() Ownable() {
    lastMinedOn = uint40(block.timestamp);
    updateRandomness();
}

/// update randomness, will be used to find next Nonce
function updateRandomness() internal {
    randomness = uint256(sha3(sha3(uint256(block.blockhash(block.number-1)) + uint256(block.coinbase) + uint256(block.timestamp))));
}

/// returns `randomness` used in PoW calculations
function getRamdomness() view returns (uint256 currentRandomness) {
    return randomness;
}

/// pure, accepts randomness & nonce and returns hash as int (which should be compared to target)
function hash(uint256 nonce, uint256 currentRandomness) pure returns (uint256){
    return uint256(sha3(nonce+currentRandomness));
}

/// pure, accepts randomness, nonce & target and returns boolian whether work is good
function checkProofOfWork(uint256 nonce, uint256 currentRandomness, uint256 currentTarget) pure returns (bool workAccepted){
    return uint256(hash(nonce, currentRandomness)) < currentTarget;
}

// accepts Nonce and tells whether it is good to mine
function checkMine(uint256 nonce) view returns (bool success) {
    return checkProofOfWork(nonce, getRamdomness(), target);
}

/*
    accepts nonce aka "mining field", checks if it passess proof of work,
    rewards if it does
*/
function mine(uint256 nonce) whenNotPaused returns (bool success) {
    require(checkMine(nonce));

    Mine(msg.sender, blockReward, uint40(block.timestamp) - uint40(lastMinedOn)); // issuing event to those who listens for it

    balances[msg.sender] += blockReward; // giving reward
    blockNumber += 1;
    totalSupply += blockReward; // increasing total supply
    updateRandomness();

    // difficulty retarget:
    var mul = (block.timestamp - lastMinedOn);
    if (mul > (60*2.5*2)) {
        mul = 60*2.5*2;
    }
    if (mul < (60*2.5/2)) {
        mul = 60*2.5/2;
    }
    target *= mul;
    target /= (60*2.5);

    if (target > powLimit) { // difficulty not lower than that
        target = powLimit;
    }

    lastMinedOn = uint40(block.timestamp); // tracking time to check how much PoW took in the future
    if (blockNumber % halvingInterval == 0) { // time to halve reward?
        blockReward /= 2;
        RewardHalved();
    }

    return true;
}

function setNewContractAddress(address newAddress) onlyOwner {
    newContractAddress = newAddress;
}

event Mine(address indexed _miner, uint256 _reward, uint40 _seconds);
event RewardHalved();
}**

Error :

browser/XGD..sol:100:56: DeclarationError: Undeclared identifier.
function setNewContractAddress(address newAddress) onlyOwner {
                                                   ^-------^


texts: How to generate sugared assembly code from Solidity code?

texts:
In the Solidity documentation I see a sample assembly code:

{
  mstore(0x40, 0x60) // store the "free memory pointer"
  // function dispatcher
  switch div(calldataload(0), exp(2, 226))
  case 0xb3de648b {
    let (r) = f(calldataload(4))
    let ret := $allocate(0x20)
    mstore(ret, r)
    return(ret, 0x20)
  }
  default { revert(0, 0) }
  // memory allocator
  function $allocate(size) -> pos {
    pos := mload(0x40)
    mstore(0x40, add(pos, size))
  }
  // the contract function
  function f(x) -> y {
    y := 1
    for { let i := 0 } lt(i, x) { i := add(i, 1) } {
      y := mul(2, y)
    }
  }
}

that's generated from this Solidity code:

pragma solidity ^0.4.0;

contract C {
  function f(uint x) returns (uint y) {
    y = 1;
    for (uint i = 0; i < x; i++)
      y = 2 * y;
  }
}

How can I generate the same assembly code with solc?

I know I can use --asm option but it produces desugared code.


texts:
I am compiling using sol 0.8.0 and the following line is producing the error in the title:
uint256 public constant MASK = uint128(~0);

Error:
Explicit type conversion not allowed from "int_const -1" to "uint128".

When changing the variable to this:
uint256 public constant MASK = ~0;

The error changes to:
Type int_const -1 is not implicitly convertible to expected type uint256. Cannot implicitly convert signed literal to unsigned type.


texts: Returns filtered array of structs without push

texts:
I have this contract with an array of structs:

pragma solidity ^0.6.0;
pragma experimental ABIEncoderV2;

contract Tickets {
  struct Ticket {
    uint id;
    int val;
  }

  Ticket[] tickets;

  function addTicket(uint id, int val) public returns(bool success) {
    Ticket memory newTicket;
    newTicket.id = id;
    newTicket.val = val;
    tickets.push(newTicket);

    return true;
  }

  function getTicket(uint id) public view returns(Ticket memory) {
    uint index;

    for(uint i = 0; i<tickets.length; i++){
      if (tickets[i].id == id) {
        index = i;
        break;
      }
    }

    Ticket memory t = tickets[index];

    return t;
  }

  function findTickets(int val) public view returns(Ticket[] memory) {
    Ticket[] memory result;

    for(uint i = 0; i<tickets.length; i++){
      if (tickets[i].val == val) {
        result.push(tickets[i]); // HERE IS THE ERROR
      }
    }

    return result;
  }
}

I need to returns a filtered by val array but when I buil this code: result.push(tickets[i].id); it throw this error:

TypeError: Member "push" is not available in struct Tickets.Ticket memory[] memory outside of storage.

How I can implement the filter without using push ?


texts:
I've opened Chrome extension and downloaded the Brave search engine. However, even though I've selected to show MetaMask in my tool bar it's not showing anywhere and I don't know how to access it. So, further to that, does MetaMask work on Android phones or only on PCs? (it's my android that I've tried to use it on).

Thanks


texts: What is the tech stack behind the Teku client?

texts:
What are Teku's major components? What databases did it consider and decide on?

Are there architectural elements and market goals that are particularly differentiated from how other beacon chain clients are designed and implemented?


texts: Why is my hashrate so low? (R9 280x at 7 mhs / GTX 960 Strix at 2 mhs)

texts:
I have two graphics card (1x R9 280x and 1x GTX 960 STRIX 4 GB version). By using the Claymore Miner I only get 7.5 Mh/s with the r9 and 2.5 Mh/s with the GTX...

I'm using Win10, 16 GB RAM, Z170 Pro Gaming Mainboard, 500 W Power supply and an Intel i7 6700

All drivers are installed.

What is the problem? What am I doing wrong? How can I improve my hashrate?

Thank you so much! Looking forward to hearing from you!


texts:
I have read few transaction diagrams about Ethereum and am not seeing use cases to decline a transaction.
If a sender (erroneously) identifies me as the receiving EOA on a transaction, how can I prevent it?
How does this translate for group transactions?
This may be a very naive question.


texts:
I have a recurring problem with web3.  I follow the instructions on this page: https://github.com/paritytech/parity/wiki/Basic-Usage

Where it says "Node.js CLI Console" and instead of getting the expected results, this is the end of what I see:

     { [Function: send]
        method: [Object],
        request: [Function: bound ],
        call: 'shh_getSymKey' },
     deleteSymKey:
      { [Function: send]
        method: [Object],
        request: [Function: bound ],
        call: 'shh_deleteSymKey' },
     newMessageFilter:
      { [Function: send]
        method: [Object],
        request: [Function: bound ],
        call: 'shh_newMessageFilter' },
     getFilterMessages:
      { [Function: send]
        method: [Object],
        request: [Function: bound ],
        call: 'shh_getFilterMessages' },
     deleteMessageFilter:
      { [Function: send]
        method: [Object],
        request: [Function: bound ],
        call: 'shh_deleteMessageFilter' },
     post:
      { [Function: send]
        method: [Object],
        request: [Function: bound ],
        call: 'shh_post' } },
  bzz:
   Bzz {
     givenProvider: null,
     currentProvider: null,
     isAvailable: [Function],
     upload: [Function],
     download: [Function] } }
> web3.eth.blockNumber
undefined
>

Does anyone recognize this and if so what could I be missing?  I have tried installing web3 globally as root too but the result is the same.


texts: How do I plan for an upgrade on my contract?

texts:
Absolute beginner question: If I assume that my contract is complex and will need future features or bugfixes, and that it holds assets and records privileged addresses, how should I prepare for an upgrade?

Should I include a function that disables the contract and transfers all the assets and addresses to a new contract? To plan in advance, what other arguments should this function accept? How should I manage the authority to execute this upgrade - hard-code my public-key? Or should I try to separate out a "back end" with business logic, and leave the front end to find the correct back-end? How should I deal with users attempting to execute the contract after it's been made obsolete?


texts: Geth transaction pending on Ropsten testnet that will not send

texts:
On a Raspbian linux system I have been using geth --testnet --syncmode light to sync the Blockchain in one terminal and running geth --testnet attach in the other, but when the Blockchain is synced I am unable to send a transaction it just stays as pending. This is odd as the same method worked a few weeks ago.

I am connected to several peers (admin.peers in the geth --testnet attach terminal) who appear not to be mining it.

The transaction is being run with a 60000 gas and 100000 gas price as it had been before and is sending 0.05 Eth from one Ropsten account to another.

Does anyone have any advice for how I can fix this? I have upgraded geth to v19.14 and deleted the chain several times to resync, the block number is the same as the Ropsten one. I have also tried geth --ropsten --syncmode light to no avail.

Thanks for any advice as I am completely out of ideas.


texts: Ethereum Decentralized Wallet Service API

texts:
With the decentralized nature of the blockchain space it makes sense for this to be a thing.

I need a wallet API service that does not store private keys, allows our servers to create a wallet & send and receive Ether & ERC20 tokens through an API calls.

I prefer something with all of the needs and it's decentralized.

I've considered just building a wallet service to meet my need. Would this be ape s@!# hard or pretty straight forward? My background is research side ML/AI and distributed systems. Any help would be appreciated thank you for your time.


texts:
I am a newbie to the blockchain world. I have written contract code in solidity and tested in remix. I am able to get the list values from the struct, but I am confused on how I can get a single record from the blockchain.

How could the input data which I previously set be retrieved using solidity?

Can anyone help me, please?


texts:
I'm trying to use web3.py with infura.io to interact with my smartcontract. here is my simple greeter contract code

pragma solidity ^0.5.7;
contract greeter{
    string greeting;

    function greet(string memory _greeting)public {
        greeting=_greeting;
    }
    function getGreeting() public view returns(string memory) {
        return greeting;
    }
}

I deployed it on ropsten testnet. with web3.py I can read greeting from chain. I wanted to add new greeting string  with greet function. but somehow I have no idea about signing transaction. could anyone help me in understanding how to sign transacion and adding greeting to the contract using web3.py?


texts: Extra mining fees added in etherbase account

texts:
1st scenario -

I have set miner.setEtherbase(eth.accounts[1]) and gasPrize is 0.

1 coin Transaction -

And done transaction from 0th account to one random account. I expect 0 mining fees will add in 1st(Etherbase) account but it will get 3000000000000000000 mining fees in 1st(Etherbase) account.

in this scenario 0 mining cost deducted from sender account.

2nd scenario -

I have set miner.setEtherbase(eth.accounts[1]) and gasPrize is 100.

1 coin Transaction -

And done transaction from 0th account to one random account. I expect 2508000 mining fees will add in 1st(Etherbase) account but it will get 9000000000002508000 mining fees in 1st(Etherbase) account.

in this scenario 2508000 mining cost deducted from sender account.

I am not understanding that why extra mining cost added in 1st(Etherbase) account in both scenario.


texts: Is supplying new ETH prohibitive with Casper or an economic decision?

texts: It has been said that the creation of new ETH will be discontinued with Caspar and PoS. Is there a fundamental reason why this is necessary, rooted in the protocol or is this a deliberate decision by the Ethereum Foundation?


texts: Find freshly deployed contracts on ethereum network

texts: Hi folks is there a simple way using which I can find the latest contracts being deployed(for an erc20 token) on the ethereum network, I mean may be etherscan.io or something where I could see that what were the contracts deployed in the last 1 hour/ 1 day etc?


texts: Web3js 1.0.0-beta.35 sendSignedTransaction() Error

texts:
I am using ropsten.infura as my provider. It is my very first time to use infura so please bear with me.

This is my code for requesting the transaction.

web3().eth.getTransactionCount(coinbase)
    .then(nonce => {
            console.log(nonce)
            const privateKey = new Buffer(pKey, 'hex')
            let data = newContractInstance.methods.redeem('0x91320aBaa4eA71BcDaE54f99eD6a6D36D44539C7', 5).encodeABI()
            let rawTx = {
                nonce: nonce,
                gasPrice: 10000000000,
                gasLimit: 3000000,
                data: data
            }

            let Tx = new ETHtx(rawTx)
            Tx.sign(privateKey)
            let serializedTx = '0x' + Tx.serialize().toString('hex')

            web3().eth.sendSignedTransaction(serializedTx)
            .then(result => {
                console.log(result)
                resolve(result)
            })
            .catch(error => {
                console.error(error)
                reject(error)
            })

I believe that it is successfully contacting the contract but the transaction is being reverted with this error below.

index.js:2178 Error: Transaction has been reverted by the EVM:

{
  "blockHash": "0x50af6435e625d8f52043c376ebd7d890651f64fcc847089a781bb700967ea048",
  "blockNumber": 4063823,
  "contractAddress": "0x253cE628Df83F20AFAD04C86852D154707e1BF62",
  "cumulativeGasUsed": 5180761,
  "from": "0x91320abaa4ea71bcdae54f99ed6a6d36d44539c7",
  "gasUsed": 3000000,
  "logs": [],
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "status": false,
  "to": null,
  "transactionHash": "0xc52822264a278afdc521b3759d9b4fbb56e4c18d5c52ccb62f90d0741e4dcfc7",
  "transactionIndex": 38
}

I am not so sure why the transaction is being reverted. I believe it has nothing to do with the modifiers as I have successfully used the same method using metamask before. One thing I noticed about using the sendSignedTransaction() is the contractAddress property. The given contractAddress is not the contractAddress that I was trying to contact and the value also changes on each transaction. Is it really how it behaves and does it represent the contractAddress that you are going to access? I hope someone can enlighten me with this.

Contract Code

    function redeem(address _user, uint256 _amount)
    public
    hasStarted
    onlyOwner
    returns (bool)
{
    uint256 _balanceOf = balanceOf[_user];
    if (totalRemainingToken < _amount) return false;
    if (_balanceOf + _amount < _balanceOf) return false;
    totalRemainingToken -= _amount;
    balanceOf[_user] += _amount;
    emit Redeem(msg.sender, _user, _amount);
    return true;
}


texts: How could I update default homesteadBlock value on my private Ethereum blockchain?

texts:
I am trying to create my private Ethereum blockchain with homesteadBlock value that I want to assign. As I understand default homesteadBlock value is 1500000.

[Q] How could I assign homesteadBlock value to 0? And inside geth is it possible to check its value that it has been updated to 0? or how could I check that the homesteadBlock value is updated?

and more importantly how could I create my private Ethereum blockchain? I know there is many resources about this problem, but I could not find one for geth 1.4.17 version.

I am not sure if my private blockchain's homesteadBlock value is updated.
Here is the way I have followed to create my private Ethereum blockchain from scratch:

First empty previous setup data:

[$] rm -rf ~/.ethash/* && rm -rf ~/.ethereum/*
[$] sudo rm -rf /home/miner/MyEthereumEbloc/  && mkdir /home/miner/MyEthereumEbloc/

Create an new account:

[$] sudo geth --datadir="/home/miner/MyEthereumEbloc/" account new

account new
Address: {eda8c89a68f059c1659272076e85e4373717b0d8}

This address will be added into CustomGenesis.json file.

Setup CustomGenesis.json: This file should be same for all nodes that are connecting into the private ethereum network:

{
    "config": {
            "homesteadBlock": 0
    },
    "nonce": "0",
    "difficulty": "0x400",
    "mixhash": "0x00000000000000000000000000000000000000647572616c65787365646c6578",
    "coinbase": "0x0000000000000000000000000000000000000000",
    "timestamp": "0x00",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "0x",
    "gasLimit": "0x3B4A1B44",
    "alloc": {
        "0xeda8c89a68f059c1659272076e85e4373717b0d8":   //added line
        { "balance": "1000000000000000000000000000000" } //added line
    }
}

Blockchain Initialisation:

[$] sudo geth --datadir="/home/miner/MyEthereumEbloc/" init /home/CustomGenesis.json

Note,  I can see updated balance, when I run:

sudo geth --datadir="/home/miner/MyEthereumEbloc/" console

primaryAddress = eth.accounts[0]
> web3.fromWei(eth.getBalance(primaryAddress), "ether")
1000000000000000000000000000000

To mine:

$ sudo ./geth --port 3000 --networkid 23422 --identity node1 --verbosity 3
--nodiscover --nat none --datadir="/home/miner/MyEthereumEbloc" --mine
 --ipcpath /home/miner/MyEthereumEbloc/geth.ipc console

Thank you for your valuable help and time.


texts:
I have this:
ethereum.request({
        method: 'eth_sign',
        params:
            {
                from: account, //this is the address
                message: '0xfafa'
            }

    }).then(data => {
        console.log("data ", data);
    })

Seems like the error states:  RPC Error: Invalid parameters: must
provide an Ethereum address.

What's the right syntax to make it work ?


texts: How to use Library with 1 File on browser solidity?

texts:
I use browser solidity.
Now, I wanna create this C Contract.

But, I have a message "Deploying and liking required libraries" on the right side of the picture. I have already create Math Library, and I can create Math Library, but I take this message.

What do I do to create C contract on browser solidity?

Postscript：
This is my opinion, the cause is in Bytecode.

There are "__Math:Math_______________________________" in Bytecode.
I think I should replace this text to the Math Library address, But I can't change Bytecode on browser solidity. Dose anyone know how to solve it?