Because there is no Apple computer, so the use of Linux in this environment to operate, windows can, but did not try, also read a lot of articles, said there will be a lot of problems.
This article addresses the following issues:
1.geth after upgrading to 1.6 version, no longer use eth.getcompilers () or ADMIN.SETSOLC () and so on by JS to compile in real-time, but with the ABI contract interface binary representation. Compile by converting to JSON to Geth's console platform
See the following article for details:
https://ethereum.stackexchange.com/questions/15435/how-to-compile-solidity-contracts-with-geth-v1-6/15436
2. The latest version of solc0.4.16 has changed, previously using the SOLC command to convert. Sol files to ABI contract interface binary, now using SOLCJS to change, after the transformation, the. Abi and. Bin are modified with a text editor. To change to an approximate format like this:
The generated *.abi is changed to look like this, and the original does not have eth.contract ([{these:
var simplecontract = Eth.contract ([{"Constant": false, "inputs": [{"Name": "_a", "type": "uint256"},{"name": "_b", "type" : "uint256"}], "name": "Multiply", "outputs": [{"Name": "", "type": "uint256"}], "payable": false, "type": "Function"},{" Constant ": false," inputs ": [{" Name ":" _a "," type ":" uint256 "},{" name ":" _b "," type ":" uint256 "}]," name ":" Arithmetics ", "Outputs": [{"Name": "O_sum", "type": "uint256"},{"name": "O_product", "type": "uint256"}], "payable": false, "type": " Function "}])
The generated. bin file is changed to look like the original without simplecontract.new (, from,data these
var simple = Simplecontract.new (
{from:eth.accounts[0],
data: " 0x6060604052341561000f57600080fd5b5b6101178061001f6000396000f30060606040526000357c010000000000000000000000000000000000000 0000000000000000000900463ffffffff168063165c4a161460475780638c12d8f0146084575b600080fd5b3415605157600080fd5b606e6004808035 90602001909190803590602001909190505060c8565b6040518082815260200191505060405180910390f35b3415608e57600080fd5b60ab600480803 590602001909190803590602001909190505060d6565b604051808381526020018281526020019250505060405180910390f35b600081830290505b92 915050565b600080828401915082840290505b92509290505600a165627a7a72305820389009d0e8aec0e9007e8551ca12061194d624aaaf623e9e7e9 81da7e69b2e090029 ",
gas:500000
}
)
1.1.1. install Ubuntu 16.04 version 1.1.1.1. Installing and configuring SSH
Allow root user ssh remote login under Ubuntu
Http://www.linuxidc.com/Linux/2016-07/133256.htm 1.1.1.2. What is the default root password for Ubuntu, change the root password
Http://jingyan.baidu.com/article/5225f26b0ac250e6fb09084e.html 1.1.1.3. installing Ethereum and Solc
$sudo Apt-get Install Software-properties-common
$sudo add-apt-repository-y Ppa:ethereum/ethereum
$sudo apt-get Update
$sudo Apt-get Install Ethereum
$sudo apt-get Install Solc 1.1.1.4. install node. js Download source. tar.gz, compiling and installing
TAR-ZXVF node-v6.9.2.tar.gz CD node-v6.9.2
sudo./configure
sudo make
sudo make install 1.1.1.5. Installing SOLC
$solc whether the--help is valid. If you do not laugh, you can try to install SOLC in the following way
$NPM install-g Solc
$NPM install-g SOLC-CLI
After the operation, try the $solc--help 1.1.1.6 again. Mining , creating users, establishing simple contracts
Please see this article below
https://alanbuxton.wordpress.com/2017/07/19/ first-steps-with-ethereum-private-networks-and-smart-contracts-on-ubuntu-16-04/
The inductive operation is as follows:
Open a Xshell terminal, connect Ubuntu, run Ethereum Dev environment
Geth--datadir "~/ethdev"--dev--ipcdisable--rpcapi "DB,ETH,NET,WEB3"
Open a Xshell terminal and enter the console operating environment
Geth--dev Console 2>> file_to_log_output
Open a Xshell terminal to view the log
Tail-f File_to_log_output
Console operating environment, run the following command
>personal.newaccount (' 123456 ')
>personal.newaccount (' 123456 ')
>eth.accounts
>user1 = Eth.accounts[0]
>user2 = eth.accounts[1]
>eth.getbalance (User1)
>eth.sendtransaction ({from:user1, To:user2, Value:web3.toWei (3, "Ether")})
>personal.unlockaccount ("0x**************", "123456")
>miner.start ()
>miner.stop ()
>eth.blocknumber ()
Build contract
The default path for Linux is/root/,
Generate the Test.sol file under the default path
$ more Simple.sol
pragma solidity ^0.4.13;
Contract Simple {
function arithmetics (UINT _a, UINT _b) returns (UINT o_sum, uint o_product) {
O_sum = _a + _b;
o_product = _a * _b;
}
function multiply (uint _a, UINT _b) returns (UINT) {
return _a * _b;
}
}
ethuser@host01:~/contract$ Cat Simple.abi
var simplecontract = Eth.contract ([{"Constant": false, "inputs": [{"Name": "_a", "type": "uint256"},{"name": "_b", "type" : "uint256"}], "name": "Multiply", "outputs": [{"Name": "", "type": "uint256"}], "payable": false, "type": "Function"},{" Constant ": false," inputs ": [{" Name ":" _a "," type ":" uint256 "},{" name ":" _b "," type ":" uint256 "}]," name ":" Arithmetics ", "Outputs": [{"Name": "O_sum", "type": "uint256"},{"name": "O_product", "type": "uint256"}], "payable": false, "type": " Function "}])
and
ethuser@host01:~/contract$ Cat Simple.bin
Personal.unlockaccount (Eth.accounts[0])
var simple = Simplecontract.new (
{From:eth.accounts[0],
Data: " 0x6060604052341561000f57600080fd5b5b6101178061001f6000396000f30060606040526000357c010000000000000000000000000000000000000 0000000000000000000900463ffffffff168063165c4a161460475780638c12d8f0146084575b600080fd5b3415605157600080fd5b606e6004808035 90602001909190803590602001909190505060c8565b6040518082815260200191505060405180910390f35b3415608e57600080fd5b60ab600480803 590602001909190803590602001909190505060d6565b604051808381526020018281526020019250505060405180910390f35b600081830290505b92 915050565b600080828401915082840290505b92509290505600a165627a7a72305820389009d0e8aec0e9007e8551ca12061194d624aaaf623e9e7e9 81da7e69b2e090029 ",
gas:500000
}
)
>loadscript ("Simple.abi")
>loadscript ("Simple.bin")
>simple.multiply
>miner.start (1)
>miner.stop ()
>simple.multiply.call (5,6)