1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
| zihao@zihaodeMBP:~/SmartContractDemo/HelloWorld$ truffle migrate --reset Compiling ./contracts/HelloWorld.sol...
Compilation warnings encountered:
/home/zihao/SmartContractDemo/HelloWorld/contracts/HelloWorld.sol:4:3: Warning: Function state mutability can be restricted to pure function sayHello() public constant returns (string) { ^ Spanning multiple lines. ,/home/zihao/SmartContractDemo/HelloWorld/contracts/HelloWorld.sol:8:3: Warning: Function state mutability can be restricted to pure function echo(string name) public constant returns (string) { ^ Spanning multiple lines.
Writing artifacts to ./build/contracts
Using network 'development'.
Running migration: 1_initial_migration.js Replacing Migrations... ... 0xfc5af4b443dcae96f96206e26d2bc93b9699e7d14980dd0247baea112bd04c44 Migrations: 0xee671e4bb1e86df24120041587b0a4841924f7bd Saving successful migration to network... ... 0x1d7e34e903cc04a5e5cd6e5cca1031034841bd001dd693b488500fe75c4df9e2 Saving artifacts... Running migration: 2_deploy_contracts.js Replacing HelloWorld... ... 0xdb8c8ef861498972ad769f947e9c03872b3f17f7292deff3fa25d5f5318ce94f HelloWorld: 0xace9ff211c9131362e05774335c6b3a353739119 Saving successful migration to network... ... 0x3a653f82abd0b92f389ea78ba654f51ff2256961f72b280874676cebac24f895 Saving artifacts... zihao@zihaodeMBP:~/SmartContractDemo/HelloWorld$ truffle console truffle(development)> let contract undefined truffle(development)> HelloWorld.deployed().then(instance => contract = instance) TruffleContract { constructor: { [Function: TruffleContract] _static_methods: { setProvider: [Function: setProvider], new: [Function: new], at: [Function: at], deployed: [Function: deployed], defaults: [Function: defaults], hasNetwork: [Function: hasNetwork], isDeployed: [Function: isDeployed], detectNetwork: [Function: detectNetwork], setNetwork: [Function: setNetwork], resetAddress: [Function: resetAddress], link: [Function: link], clone: [Function: clone], addProp: [Function: addProp], toJSON: [Function: toJSON] }, _properties: { contract_name: [Object], contractName: [Object], abi: [Object], network: [Function: network], networks: [Function: networks], address: [Object], links: [Function: links], events: [Function: events], binary: [Function: binary], deployedBinary: [Function: deployedBinary], unlinked_binary: [Object], bytecode: [Object], deployedBytecode: [Object], sourceMap: [Object], deployedSourceMap: [Object], source: [Object], sourcePath: [Object], ast: [Object], compiler: [Object], schema_version: [Function: schema_version], schemaVersion: [Function: schemaVersion], updated_at: [Function: updated_at], updatedAt: [Function: updatedAt] }, _property_values: {}, _json: { contractName: 'HelloWorld', abi: [Array], bytecode: '0x6060604052341561000f57600080fd5b6102488061001e6000396000f30060606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063ef5fb05b14610051578063f15da729146100df575b600080fd5b341561005c57600080fd5b6100646101b5565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100a4578082015181840152602081019050610089565b50505050905090810190601f1680156100d15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156100ea57600080fd5b61013a600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506101f8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017a57808201518184015260208101905061015f565b50505050905090810190601f1680156101a75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101bd610208565b6040805190810160405280600b81526020017f48656c6c6f20576f726c64000000000000000000000000000000000000000000815250905090565b610200610208565b819050919050565b6020604051908101604052806000815250905600a165627a7a72305820ce2a412dd03391bea1a4d86dcaa57502a5d812ad4005a99570a2bb3b3ffd25ec0029', deployedBytecode: '0x60606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063ef5fb05b14610051578063f15da729146100df575b600080fd5b341561005c57600080fd5b6100646101b5565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100a4578082015181840152602081019050610089565b50505050905090810190601f1680156100d15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156100ea57600080fd5b61013a600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506101f8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017a57808201518184015260208101905061015f565b50505050905090810190601f1680156101a75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101bd610208565b6040805190810160405280600b81526020017f48656c6c6f20576f726c64000000000000000000000000000000000000000000815250905090565b610200610208565b819050919050565b6020604051908101604052806000815250905600a165627a7a72305820ce2a412dd03391bea1a4d86dcaa57502a5d812ad4005a99570a2bb3b3ffd25ec0029', sourceMap: '25:198:0:-;;;;;;;;;;;;;;;;;', deployedSourceMap: '25:198:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;49:86;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;139:82:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:2;8:100;;;99:1;94:3;90;84:5;80:1;75:3;71;64:6;52:2;49:1;45:3;40:15;;8:100;;;12:14;3:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;49:86:0;94:6;;:::i;:::-;108:22;;;;;;;;;;;;;;;;;;;;49:86;:::o;139:82::-;191:6;;:::i;:::-;212:4;205:11;;139:82;;;:::o;25:198::-;;;;;;;;;;;;;;;:::o', source: 'pragma solidity ^0.4.4;\n\ncontract HelloWorld {\n function sayHello() public constant returns (string) {\n return ("Hello World");\n }\n\n function echo(string name) public constant returns (string) {\n return name;\n }\n}\n', sourcePath: '/home/zihao/SmartContractDemo/HelloWorld/contracts/HelloWorld.sol', ast: [Object], compiler: [Object], networks: [Object], schemaVersion: '1.0.1', updatedAt: '2018-01-10T13:34:12.869Z' }, setProvider: [Function: bound setProvider], new: [Function: bound new], at: [Function: bound at], deployed: [Function: bound deployed], defaults: [Function: bound defaults], hasNetwork: [Function: bound hasNetwork], isDeployed: [Function: bound isDeployed], detectNetwork: [Function: bound detectNetwork], setNetwork: [Function: bound setNetwork], resetAddress: [Function: bound resetAddress], link: [Function: bound link], clone: [Function: bound clone], addProp: [Function: bound addProp], toJSON: [Function: bound toJSON], web3: Web3 { _requestManager: [RequestManager], currentProvider: [Provider], eth: [Eth], db: [DB], shh: [Shh], net: [Net], personal: [Personal], bzz: [Swarm], settings: [Settings], version: [Object], providers: [Object], _extend: [Function] }, class_defaults: { from: '0x7e1897cec8e1a098384d17e85a9cd348ccb92b4a', gas: 6721975, gasPrice: 100000000000 }, currentProvider: HttpProvider { host: 'http://localhost:8545', timeout: 0, user: undefined, password: undefined, send: [Function], sendAsync: [Function], _alreadyWrapped: true }, network_id: '1515578597496' }, abi: [ { constant: true, inputs: [], name: 'sayHello', outputs: [Array], payable: false, stateMutability: 'view', type: 'function' }, { constant: true, inputs: [Array], name: 'echo', outputs: [Array], payable: false, stateMutability: 'view', type: 'function' } ], contract: Contract { _eth: Eth { _requestManager: [RequestManager], getBalance: [Function], getStorageAt: [Function], getCode: [Function], getBlock: [Function], getUncle: [Function], getCompilers: [Function], getBlockTransactionCount: [Function], getBlockUncleCount: [Function], getTransaction: [Function], getTransactionFromBlock: [Function], getTransactionReceipt: [Function], getTransactionCount: [Function], call: [Function], estimateGas: [Function], sendRawTransaction: [Function], signTransaction: [Function], sendTransaction: [Function], sign: [Function], compile: [Object], submitWork: [Function], getWork: [Function], coinbase: [Getter], getCoinbase: [Function], mining: [Getter], getMining: [Function], hashrate: [Getter], getHashrate: [Function], syncing: [Getter], getSyncing: [Function], gasPrice: [Getter], getGasPrice: [Function], accounts: [Getter], getAccounts: [Function], blockNumber: [Getter], getBlockNumber: [Function], protocolVersion: [Getter], getProtocolVersion: [Function], iban: [Function], sendIBANTransaction: [Function: bound transfer] }, transactionHash: null, address: '0xace9ff211c9131362e05774335c6b3a353739119', abi: [ [Object], [Object] ], sayHello: { [Function: bound ] request: [Function: bound ], call: [Function: bound ], sendTransaction: [Function: bound ], estimateGas: [Function: bound ], getData: [Function: bound ], '': [Circular] }, echo: { [Function: bound ] request: [Function: bound ], call: [Function: bound ], sendTransaction: [Function: bound ], estimateGas: [Function: bound ], getData: [Function: bound ], string: [Circular] }, allEvents: [Function: bound ] }, sayHello: { [Function] call: [Function], sendTransaction: [Function], request: [Function: bound ], estimateGas: [Function] }, echo: { [Function] call: [Function], sendTransaction: [Function], request: [Function: bound ], estimateGas: [Function] }, sendTransaction: [Function], send: [Function], allEvents: [Function: bound ], address: '0xace9ff211c9131362e05774335c6b3a353739119', transactionHash: null } truffle(development)> contract.echo("2018-1-10 blockchain") '2018-1-10 blockchain' truffle(development)>
|