10

The fundamental difference between Ethereum and Bitcoin is that while Bitcoin uses a UTXO model, Ethereum uses a state-transition model. In Bitcoin, in order for a transaction to be valid, it must point to a set of Unspent Transaction Outputs, which then become the inputs for that transaction. The output value of the transaction must equal the sum of the ...


5

Those data are unavailable as they would require access to the entire past intermediate state of the blockchain. A contract can only access the current state. If you want to do this for very specific contract addresses, you might extend them to maintain some historical data that you might be interested in, but this would be doable only for contracts that ...


5

Change addresses are a privacy feature, not a bug. The idea is users would choose a different change address for each transaction. Someone analyzing the blockchain would then not be able to tell which address was the receivers, and which was the change. In reality, most wallets do not use change addresses in this manner. When a user buys something, the ...


5

Yes When a new block is received, it should be validated that the transactions included match the advertised state. Failing verification, the block would be discarded instead of propagating to other nodes Since in this scenario, N3 directly writes a bogus transaction in the block they mine, it never exists in the transaction pool. The malformed transaction ...


5

What does it mean exactly by state change. State change in a smart contract refers to a Transaction, which means two parties involved in the transaction will have some changes. For instance, if you send some money from one account to another - there will be changes on both sides. Similarly, it applies to data related transactions as well. If you want to ...


4

The state trie contains the balance of each account. Even transactions that throw an exception result in a reduction in the sender's balance through gas costs, which means that the resulting state is different from the initial state. An interesting question would be to see if a transaction with a gas price of 0 can be excluded from a block without changing ...


4

Here's one way to do it: pragma solidity ^0.4.2; contract Test { enum GameState {noWager, wagerMade, wagerAccepted} GameState public currentState; modifier onlyState(GameState expectedState) { if (expectedState != currentState) { throw; } _; } modifier onlyStates(GameState expectedState1, GameState ...


4

The code is correct but I lacked the understanding regarding the mechanics of how Ether is accessed and sent to contracts. I will explain to aid others in their advancement of knowledge... The function depositUsingParameter establishes a required value that is provided by the Ether owner. Since contracts cannot automatically withdraw funds from an Ether ...


3

A contract can't forcefully extract ETH from a wallet address, if you want to pay Ether into a contract, you must set the "Value" of the transaction when calling a function (or just send ETH to the contracts address if the fallback function allows it). Using transfer will transfer from the contract to another address, so with address(this).transfer(msg....


3

Yes, the same contract can be mined on both sides of the fork. I don't think it's correct that each instance of the contract creation would yield a different contract address. Contract addresses are assigned deterministically based on the address creating them and a per-account nonce, so the same transaction, received on both forks in the same order, would ...


3

When tx1 and tx2 are broadcast to the network they will be picked up by miners and included in blocks. If both tx1 and tx2 originate from the same "owned" account, then they will be included in the blockchain in order (due to the transaction nonce). If you wait until tx1 has been mined before sending tx2, then they will again be included in order. Otherwise,...


2

From what I've understood through all the reading I've done on Casper CBC I'm assuming you're referring to Vlad's Casper CBC paper? Vlad has proposed a number of sharding schemes but I don't think any of them have been formally published as of today. does that mean cross-shard transactions are going to have to fit under the current tps rate? In ...


2

You could keep a map of (blockchain_number + address) -> balance in your contract, and update it every time you need to interact with that address. This will use up a large amount of storage and cost you lots of gas. (e.g. on the order of $0.005 USD per interaction with that address). I wouldn't recommend this. What I'm doing in my contract is keeping ...


1

If the transactions are created close to each other they are possibly valid transactions. If one transactions has already been processed (mined) and the wallet knows about this then the wallet refuses to even send the second transaction. If both of the transactions are accepted by the wallet they are added to an abstract transaction pool which is basically ...


1

The definition of “state” is the position the smart contract has in the space described by its permanent variables. In the case the smart contract has one bool variable and nothing more, it can assume two states. In the case it has two bool variables and nothing more, it can assume four states (00-01-11-10). If it should have one uint variable it has 2^...


1

Unlike other forms of software in which the data is (generally) external to the software that manages it, contract data is stored within a namespace (a key/value store) that is logically "inside" the contract itself. At a protocol level addresses (including contracts) have balances. Contracts also have code. That code will lay out data organization within ...


1

It is a miner mistake to allow invalid transactions. A block with invalid transactions is using blockchain space with something useless for infinite time. If the user doesn't have enough balance the miner cannot charge a fee. nonces serve the purpose of having a defined execution order and protecting from certain attacks like transaction replay.


1

You need to add a payable function to accept Ether function () public payable { // this function enables the contract to receive funds } It doesn't need to do anything, but you can add logic in there if you need some.


1

Having looked at the doc you linked, I don't think you need to simulate transactions happening at varying speeds. Since you also submit the nextTransitionCounter to the functions that you declare that modifier on, you can just submit two transactions each with the same nextTransitionCounter and assert that the second one fails. To assert that a transaction ...


1

If both transactions for the token saved in your contract are mined, it will act by whoever is higher up in the transaction pool (whoever paid more). There is only one token and two people, so only one person will get the token and the other will be thrown an error and have most of their gas sent back since they're not actually executing a transaction. Yes ...


1

What does it mean exactly by state change. Where they get stored. State change of a contract means the values of the variables that are stored on the blockchain as part of the contract are changed. Except transaction are there any events which cause state changes. Transactions are the only way to change the state of a contract.


Only top voted, non community-wiki answers of a minimum length are eligible