Contract-Deployment

部署乙太坊合約時出錯:從“賬戶名”到未定義的交易無法成功執行

  • October 20, 2017

我正在瀏覽乙太坊網站上的教程並嘗試將合約部署到 TESTNET,從乙太坊頁面複製。

當我部署它時,它會出錯:

“從測試合約賬戶到未定義的交易無法成功執行”

當我在我的 TESTNET 帳戶之間轉移乙太幣時也會發生這種情況。

在此處輸入圖像描述

這是合約程式碼:

pragma solidity ^0.4.2;

contract AramCoin {
   /* This creates an array with all balances */
   mapping (address => uint256) public balanceOf;
   string public name;
   string public symbol;
   uint8 public decimals;

   /* Initializes contract with initial supply tokens to the creator of the contract */
   function AramCoin(uint256 initialSupply, string tokenName, uint8 decimalUnits, string tokenSymbol) {
       balanceOf[msg.sender] = initialSupply;              // Give the creator all initial tokens
       name = tokenName;                                   // Set the name for display purposes
       symbol = tokenSymbol;                               // Set the symbol for display purposes
       decimals = decimalUnits;                            // Amount of decimals for display purposes
   }

   /* 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

       /* Notify anyone listening that this transfer took place */
       Transfer(msg.sender, _to, _value);

   }

   event Transfer(address indexed from, address indexed to, uint256 value);

}

看起來我是一個新手,給我帶來了很多問題。還有對於絕對初學者來說不夠清晰的乙太坊文件。

事實證明,我必須讓 Geth 執行才能使這個合約部署發生。

所以我執行了這個命令並讓它執行,並且合約部署以及乙太傳輸都通過了:

Geth --testnet

引用自:https://ethereum.stackexchange.com/questions/11376