Farbige Münze in Ethereum zur Unterscheidung des Ether-Guthabens der Brieftasche

Ich habe von dem Konzept der farbigen Münze in Bitcoin gehört, gibt es etwas Ähnliches in Ethereum?

Ich möchte eine einzige Brieftasche haben, die zwei Arten von Ether verwaltet

. Nehmen wir an, einer kommt von mir, indem ich Äther hinzufüge und andere, die durch das Spielen von Spielen verdient werden. Ich möchte diese beiden Ether separat in einer einzigen Brieftasche verwenden. gibt es etwas dafür?

Danke :)

Antworten (1)

Ethereum wurde unter anderem mit Blick auf diese Funktion entwickelt. Sie werden normalerweise nicht hören, dass die Leute sie "farbige Münzen" nennen, sondern eher Token.

Probieren Sie diese Links in den Einführungsdokumenten aus:

https://ethereum.org/token

https://blog.ethereum.org/2015/12/03/how-to-build-your-own-cryptocurrency/

Oder wenn Sie nur Code wollen:

contract tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData); }

contract MyToken {
    /* Public variables of the token */
    string public standard = 'Token 0.1';
    string public name;
    string public symbol;
    uint8 public decimals;
    uint256 public totalSupply;

    /* This creates an array with all balances */
    mapping (address => uint256) public balanceOf;
    mapping (address => mapping (address => uint256)) public allowance;

    /* This generates a public event on the blockchain that will notify clients */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /* Initializes contract with initial supply tokens to the creator of the contract */
    function MyToken(
        uint256 initialSupply,
        string tokenName,
        uint8 decimalUnits,
        string tokenSymbol
        ) {
        balanceOf[msg.sender] = initialSupply;              // Give the creator all initial tokens
        totalSupply = initialSupply;                        // Update total supply
        name = tokenName;                                   // Set the name for display purposes
        symbol = tokenSymbol;                               // Set the symbol for display purposes
        decimals = decimalUnits;                            // Amount of decimals for display purposes
        msg.sender.send(msg.value);                         // Send back any ether sent accidentally
    }

    /* Send coins */
    function transfer(address _to, uint256 _value) {
        if (balanceOf[msg.sender] < _value) throw;           // Check if the sender has enough
        if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows
        balanceOf[msg.sender] -= _value;                     // Subtract from the sender
        balanceOf[_to] += _value;                            // Add the same to the recipient
        Transfer(msg.sender, _to, _value);                   // Notify anyone listening that this transfer took place
    }

    /* Allow another contract to spend some tokens in your behalf */
    function approveAndCall(address _spender, uint256 _value, bytes _extraData)
        returns (bool success) {
        allowance[msg.sender][_spender] = _value;
        tokenRecipient spender = tokenRecipient(_spender);
        spender.receiveApproval(msg.sender, _value, this, _extraData);
        return true;
    }

    /* A contract attempts to get the coins */
    function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
        if (balanceOf[_from] < _value) throw;                 // Check if the sender has enough
        if (balanceOf[_to] + _value < balanceOf[_to]) throw;  // Check for overflows
        if (_value > allowance[_from][msg.sender]) throw;   // Check allowance
        balanceOf[_from] -= _value;                          // Subtract from the sender
        balanceOf[_to] += _value;                            // Add the same to the recipient
        allowance[_from][msg.sender] -= _value;
        Transfer(_from, _to, _value);
        return true;
    }

    /* This unnamed function is called whenever someone tries to send ether to it */
    function () {
        throw;     // Prevents accidental sending of ether
    }
}
Es ist sehr schwierig, dies zu verstehen. Gibt es eine einfache Möglichkeit, dies zu verstehen und umzusetzen? @koampapapa
Probieren Sie die Links, die ich Ihnen gegeben habe. Sie sind nicht so schlimm ... trinken Sie einfach zuerst einen Kaffee
hahaha... Ich habe diese Links gelesen, ich konnte Mist nicht richtig auf meinem Linux-System installieren, es macht ein Problem. Daher konnte ich bisher keine Verträge bereitstellen und blieb daher beim laufenden Vertragsteil hängen. suche also nach etwas, das einfach zu implementieren ist :D
Ja, das hat bei mir unter Linux auch nicht funktioniert. Dann habe ich dieses tolle Ding gefunden ethereum.github.io/browser-solidity/#version=soljson-latest.js Dann habe ich das Tutorial weiter durchgearbeitet und viel gelernt. Dann hatte ich ADD und habe meinen Vertrag nicht wirklich umgesetzt, aber ich wette, wenn du wolltest, könntest du es
ja das habe ich versucht aber nicht umsetzen können. Ich habe auch Trüffel/Pudding installiert. konnte aber Trüffel nicht mit Geth verbinden und kämpfte :(