how to make transaction like THIS TRANSACTION

anyone can help me how to build it

  • 1
    Are you asking how to use the selfdestruct() function from solidity? Commented Nov 12, 2018 at 15:27
  • yes, can you tell me remix-ethereum script form this? and how to use it? Commented Nov 12, 2018 at 15:28

2 Answers 2


For clarity, you can't make a script that runs around exterminating other contracts. You can organize things so the contracts you create are willing to selfdestruct when you tell them to.

Here, a Factory contract deploys a series of 10 contracts that will selfdestruct if the Factory (and only the Factory) tells them to. There are verbose logs from both kinds of contract.

pragma solidity 0.4.25;

contract Factory {

    address[] public volatileContracts;
    event LogCreatedVolatileContract(address sender, address volatileContract);
    event LogKilledVolatileContract(address sender, address volatileContract);

     * If this were a real implementation, you would want access control over these functions.

    function createVolatileContracts() public returns(bool success) {
        require(volatileContracts.length==0, "Ten at a time, please.");
        for(uint i=0; i<10; i++) {
            Volatile v = new Volatile();
            emit LogCreatedVolatileContract(msg.sender, address(v));
        return true;

    function destroyVolatileContracts() public returns(bool success) {
        for(uint i=0; i<10; i++) {
            emit LogKilledVolatileContract(msg.sender, volatileContracts[i]);
            Volatile v = Volatile(volatileContracts[i]);
        return true;


contract Volatile {

    address public owner;

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

    event LogSelfDestruction(address sender, address this, address owner, uint balance);

    constructor() public {
        owner = msg.sender;

    function kill() public onlyOwner {
        emit LogSelfDestruction(msg.sender, address(this), owner, address(this).balance);

It's just a scribble to give you some ideas. There are multiple non-trivial concerns you would to address before thinking about using it. No warranty.

Hope it helps.


You can try the following code:

pragma solidity ^0.4.22;

contract exampleContract {

    event Debug(bool destroyed); // Create an event to let web3 know that contract is destroyed

    constructor () public {

    // I've set this function internal which means you can only call this function from another function.
    // You can set it to public but I'd recommend you to create a modifier for owner and use it instead.
    function _destroyContract() internal {
        emit Debug(true); // call event
        // this - is the current contract address
        selfdestruct(this); // selfDestruct contract

Hope this helps someone!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.