geth常用命令

转载地址

https://blog.csdn.net/qq_36124194/article/details/83686823

geth常用命令

初始化私链

geth	--datadir	/path/to/datadir	init	/path/to/genesis.json

启动私链

geth	--identity	"TestNode"	--rpc	--rpcport	"8545"	--datadir	/path/to/datadir	--port	"30303"	--nodiscover	consol

在这里插入图片描述

创建账户

可直接在括号加密码

personal.newAccount()

获取账户余额

eth.getBalance(myAddress)

编译

solc	--bin	testContract.sol
solc	--abi	testContract.sol

解锁账户

personal.unlockAccount(myAddress)

发送部署的合约

myContract	=	eth.contract(abi) 
contract	=	myContract.new({from:myAddress,data:code,gas:1000000})

获取正在等待确认的交易

eth.getBlock("pending",true).transactions

调用智能合约

contract.multiply.sendTransaction(10,	{from:myAddress})

本地测试合约

contract.multiply.call(10) 

获取区块

eth.getBlock()

获取交易

eth.getTransaction()
原文地址:https://www.cnblogs.com/qq874455953/p/10264452.html