PlayTrain

2023–24 · Toshi · Ethereum mainnet, ENS (NameWrapper)

0x77b01feb029aba23fd3fcfd448b942fdbd437464

I’ve tried thinking in terms of lines, not planes.

The birth of NFTs has resulted in a variety of collections being born and visualized online. Within this context, decentralization is envisioned, and individual entities that exist as points become planes through NFTs.

This time, I used the ENS, a symbol of individual identity in the realm of NFTs, to conceptualize a single collection as a line.

Please take a ride on the train headed by tsh.eth.

How to get on the train

New rides are currently suspended.

Check boarding status

https://app.ens.domains/midorikanemitsu.onigiriman1998.yujiym.pon24.haukun.maishumai.caicaikiki.borddy.mayuzou.eotel.june29.yuhei4on6.hiraiken.hasaqui.themassage.gin-graphic.daumkuchen.niinomi.uminonaka.noriakinft.royalmilktea.rugstore.ara721.sanjrow.takawo.hnmhdk.miyakodub.kumaartcollective.bouze.proofofx.tsh.eth

OpenSea

https://opensea.io/assets/ethereum/0xd4416b13d2b3a9abae7acd5d6c2bbdbe25686401/52639631494175751531733296501683006532342588420061402245205873236250032378898

Technical Note

In this project, we utilize the ENS (Ethereum Name Service) and its NameWrapper on the Ethereum Mainnet. ENS makes ETH wallet addresses more human-readable. It also allows for the association of diverse records, enabling you to express your own identity.

Furthermore, in ENS, there is something called a “Subname” which corresponds to the concept of a subdomain in a URL. In this project, we are playing “train” by layering these Subnames.

Subnames are generated only from nodes already existing on the NameWrapper, and when they are distributed as NFTs, they are sent to the holder of that node. Therefore, participants need to wrap their own ENS in advance.

Subnames coupled behind tsh.eth like carriages, so that one name runs as a line

Subnames coupled behind tsh.eth like carriages, so that one name runs as a line

Contract

The source verified on Etherscan.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "./INameWrapper.sol";
import "./ENS.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "https://github.com/ensdomains/name-wrapper/blob/master/contracts/BytesUtil.sol";

contract PlayTrain is Ownable, ERC1155Holder {
    using BytesUtils for bytes;

    INameWrapper nameWrapper;

    uint256 public index;
    address public resolver;
    bool public isMintable;

    mapping(bytes32 => bool) public isMinted;
    mapping(uint256 => bytes32) public indexToNode;
    mapping(uint256 => address) public indexToOwner;

    function setEnsData(address _nameWrapper, address _resolver, bytes32 _startNode) external onlyOwner {
        nameWrapper = INameWrapper(_nameWrapper);
        resolver = _resolver;
        indexToNode[0] = _startNode;
    }

    function getOnTheTrain(bytes32 yourNode, string memory label) public {
        require(isMintable, "PlayTrain: not mintable");
        require(!isMinted[yourNode], "PlayTrain: Already minted");
        bytes memory name = nameWrapper.names(yourNode);
        (bytes32 labelhash, ) = name.readLabel(0);
        require(labelhash == keccak256(bytes(label)), "PlayTrain: label is not correct");

        nameWrapper.setSubnodeRecord(
            indexToNode[index],
            label,
            address(this),
            resolver,
            0,
            0,
            0
        );

        bytes32 nextParentNode = _makeNode(indexToNode[index], labelhash);
        (address owner, ,) = nameWrapper.getData(uint256(yourNode));

        uint256 nextIndex = ++index;
        indexToOwner[nextIndex] = owner;
        indexToNode[nextIndex] = nextParentNode;
        isMinted[yourNode] = true;

        if(index > 2){
            uint256 tokenid = uint256(indexToNode[index - 2]);
            nameWrapper.safeTransferFrom(address(this), indexToOwner[index - 2], tokenid, 1, "");
        }
    }

    function setMintable(bool _isMintable) external onlyOwner {
        isMintable = _isMintable;
    }
    
    function _makeNode(bytes32 node, bytes32 labelhash) private pure returns (bytes32) {
        return keccak256(abi.encodePacked(node, labelhash));
    }

    function getIndex() external view returns(uint256) {
        return index;
    }

    function getNode(uint256 _index) external view returns(bytes32) {
        return indexToNode[_index];
    }

    function transfer(address from, address to, uint256 id) external onlyOwner {
        nameWrapper.safeTransferFrom(from, to, id, 1, "");
    }

    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes memory data
    ) public override(ERC1155Holder) returns(bytes4) {
        return ERC1155Holder.onERC1155Received(operator, from, id, value, data);
    }
}

Read / Write

PlayTrain0x77b01FeB029abA23FD3FCfD448B942FDBd437464

Read Contract on EtherscanWrite Contract on Etherscan

Exhibitions

Responses

  1. Fakewhale LOG

    Blockchain As A New Medium For Art

    Mimi NguyenEN

  2. Right Click Save

    On Curation: Yusuke Shono

    Yusuke ShonoEN

  3. MASSAGE MAGAZINE

    Proof of X – Blockchain As A New Medium For Art / 空間との対話から生まれた10の視点

    Yusuke ShonoJA

Links

Back to the list of works