truffle框架初使用

时间:2025-02-24 15:29:09
truffle(develop)> helloWorld
TruffleContract {
constructor:
{ [Function: TruffleContract]
_constructorMethods:
{ 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],
setWallet: [Function: setWallet],
resetAddress: [Function: resetAddress],
link: [Function: link],
clone: [Function: clone],
addProp: [Function: addProp],
toJSON: [Function: toJSON],
decodeLogs: [Function: decodeLogs] },
_properties:
{ contract_name: [Object],
contractName: [Object],
gasMultiplier: [Object],
timeoutBlocks: [Object],
autoGas: [Object],
numberFormat: [Object],
abi: [Object],
network: [Function: network],
networks: [Function: networks],
address: [Object],
transactionHash: [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],
legacyAST: [Object],
ast: [Object],
compiler: [Object],
schema_version: [Function: schema_version],
schemaVersion: [Function: schemaVersion],
updated_at: [Function: updated_at],
updatedAt: [Function: updatedAt],
userdoc: [Function: userdoc],
devdoc: [Function: devdoc] },
_property_values: {},
_json:
{ contractName: ‘HelloWorld’,
abi: [Array],
bytecode: ‘0x608060405234801561001057600080fd5b5061013f806100206000396000f3fe608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063f8a8fd6d14610046575b600080fd5b34801561005257600080fd5b5061005b6100d6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561009b578082015181840152602081019050610080565b50505050905090810190601f1680156100c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60606040805190810160405280600a81526020017f48656c6c6f576f726c640000000000000000000000000000000000000000000081525090509056fea165627a7a72305820903d53a33c88326dd2f332c3a2be2ef8db8c54ce836e7652e83aaf0970f941170029’,
deployedBytecode: ‘0x608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063f8a8fd6d14610046575b600080fd5b34801561005257600080fd5b5061005b6100d6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561009b578082015181840152602081019050610080565b50505050905090810190601f1680156100c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60606040805190810160405280600a81526020017f48656c6c6f576f726c640000000000000000000000000000000000000000000081525090509056fea165627a7a72305820903d53a33c88326dd2f332c3a2be2ef8db8c54ce836e7652e83aaf0970f941170029’,
sourceMap: ‘28:114:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;28:114:0;;;;;;;’,
deployedSourceMap: ‘28:114:0:-;;;;;;;;;;;;;;;;;;;;;;;;55:84;;8:9:-1;5:2;;;30:1;27;20:12;5:2;55:84:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;55:84:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;92:13;114:19;;;;;;;;;;;;;;;;;;;;55:84;::?’,
source: ‘pragma solidity ^ 0.5.0;\r\n\r\ncontract HelloWorld {\r\n\r\n function test() pure public returns (string memory) {\r\n return ‘HelloWorld’;\r\n }\r\n}\r\n’,
sourcePath: ‘D:/Desktop/Code/Truffle/demo1/contracts/’,
ast: [Object],
legacyAST: [Object],
compiler: [Object],
networks: [Object],
schemaVersion: ‘3.0.1’,
updatedAt: ‘2019-03-08T14:20:37.002Z’,
devdoc: [Object],
userdoc: [Object] },
setProvider: [Function: bound setProvider],
new: { [Function: bound new] estimateGas: [Function: bound estimateDeployment] },
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],
setWallet: [Function: bound setWallet],
resetAddress: [Function: bound resetAddress],
link: [Function: bound link],
clone: [Function: bound clone],
addProp: [Function: bound addProp],
toJSON: [Function: bound toJSON],
decodeLogs: [Function: bound decodeLogs],
web3:
Web3 {
currentProvider: [Getter/Setter],
_requestManager: [Object],
givenProvider: null,
providers: [Object],
_provider: [Object],
setProvider: [Function],
BatchRequest: [Function: bound Batch],
extend: [Object],
version: ‘1.0.0-beta.37’,
utils: [Object],
eth: [Object],
shh: [Object],
bzz: [Object] },
class_defaults:
{ from: ‘0x9A37E2b824bB3FBd4429D0CEb2c7ef3471cb0fE3’,
gas: 6721975,
gasPrice: 20000000000 },
currentProvider:
HttpProvider {
host: ‘http://127.0.0.1:9545/’,
httpAgent: [Object],
timeout: 0,
headers: undefined,
connected: true,
send: [Function],
_alreadyWrapped: true },
network_id: ‘4447’ },
methods:
{ ‘test()’:
{ [Function]
call: [Function],
sendTransaction: [Function],
estimateGas: [Function],
request: [Function] } },
abi:
[ { constant: true,
inputs: [],
name: ‘test’,
outputs: [Array],
payable: false,
stateMutability: ‘pure’,
type: ‘function’,
signature: ‘0xf8a8fd6d’ } ],
address: ‘0x487B6C076809d7Db11C9B5fF75A4289f1A739914’,
transactionHash: undefined,
contract:
Contract {
currentProvider: [Getter/Setter],
_requestManager: RequestManager { provider: [Object], providers: [Object], subscriptions: {} },
givenProvider: null,
providers:
{ WebsocketProvider: [Function: WebsocketProvider],
HttpProvider: [Function: HttpProvider],
IpcProvider: [Function: IpcProvider] },
_provider:
HttpProvider {
host: ‘http://127.0.0.1:9545/’,
httpAgent: [Object],
timeout: 0,
headers: undefined,
connected: true,
send: [Function],
_alreadyWrapped: true },
setProvider: [Function],
BatchRequest: [Function: bound Batch],
extend:
{ [Function: ex]
formatters: [Object],
utils: [Object],
Method: [Function: Method] },
clearSubscriptions: [Function],
options: { address: [Getter/Setter], jsonInterface: [Getter/Setter] },
defaultAccount: [Getter/Setter],
defaultBlock: [Getter/Setter],
methods:
{ test: [Function: bound _createTxObject],
‘0xf8a8fd6d’: [Function: bound _createTxObject],
‘test()’: [Function: bound _createTxObject] },
events: { allEvents: [Function: bound ] },
_address: ‘0x487B6C076809d7Db11C9B5fF75A4289f1A739914’,
_jsonInterface: [ [Object] ] },
test:
{ [Function]
call: [Function],
sendTransaction: [Function],
estimateGas: [Function],
request: [Function] },
sendTransaction: [Function],
send: [Function],
allEvents: [Function],
getPastEvents: [Function] }