<p>I don't think it is possible in the way you are describing it.</p>

<p>Even if there was a smart contract which replicates itself and pays transactions and stuff. The thing is, a smart contract cannot act by itself. There has to be a user who initiates the actions. Then the smart contract could send a few transactions, but only within the block where the user started the actions of the smart contract. And as far as I know are smart contracts not able to pay gascosts, so the user itself has to pay for it.</p>

<p>Transactions which send other transactions are executed within the same block. So every action only lasts for one block and the initiating user would have to start the contract over and over again. Additionally there is a limit of executed gas within a block. So the smart contract could only send a few transactions before the block is full and will cancel all further transaction calls.</p>

<p>Besides this initiation issue, I cannot imagine a way how a smart contract could harm people by itself. Only if some other users would send money there, these funds might be lost. But it would be obviously stupid to do so.</p>

CC BY-SA 4.0
2018-07-17T11:32:02.450Z
2018-07-17T11:32:02.450Z
noobWithAComputer
<p>Good Question.</p>

<p>To avoid such circumstance Consensus mechanisms are used to find faulty nodes as some blockchains are permission-less and anyone can participate.And their is no guarantee that every participant is valid one.For simple nodes faults RAFT consensus mechanism can be used.For nodes which is acting maliciously Byzantine Fault Tolerance mechanism can be used to remove the faulty node from the network.</p>

CC BY-SA 4.0
2018-09-06T15:21:40.710Z
2018-09-06T15:21:40.710Z
VforVendetta
<p>can a blockchain ever get a 'virus', that continually replicates itself, continues paying for gas (if on the ethereum network) and survives/self-replicates through the blockchain, similar to viruses on a PC? </p>

<blockchain><ethereum><dapp>
Is it possible for there to be a virus in the blockchain?
J. Roibal - BlockchainEng
# Is it possible for there to be a virus in the blockchain?

(Asked by: username_0 on 2018-07-17)

can a blockchain ever get a 'virus', that continually replicates itself, continues paying for gas (if on the ethereum network) and survives/self-replicates through the blockchain, similar to viruses on a PC?

**Tags:** blockchain, ethereum, dapp


---

## 2 answers

### Answer by username_1 on 2018-07-17. Score: 1

I don't think it is possible in the way you are describing it.

Even if there was a smart contract which replicates itself and pays transactions and stuff. The thing is, a smart contract cannot act by itself. There has to be a user who initiates the actions. Then the smart contract could send a few transactions, but only within the block where the user started the actions of the smart contract. And as far as I know are smart contracts not able to pay gascosts, so the user itself has to pay for it.

Transactions which send other transactions are executed within the same block. So every action only lasts for one block and the initiating user would have to start the contract over and over again. Additionally there is a limit of executed gas within a block. So the smart contract could only send a few transactions before the block is full and will cancel all further transaction calls.

Besides this initiation issue, I cannot imagine a way how a smart contract could harm people by itself. Only if some other users would send money there, these funds might be lost. But it would be obviously stupid to do so.


---

### Answer by username_2 on 2018-09-06. Score: -1

Good Question.

To avoid such circumstance Consensus mechanisms are used to find faulty nodes as some blockchains are permission-less and anyone can participate.And their is no guarantee that every participant is valid one.For simple nodes faults RAFT consensus mechanism can be used.For nodes which is acting maliciously Byzantine Fault Tolerance mechanism can be used to remove the faulty node from the network.


---

