iwallet

package
v3.0.0-rc2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2019 License: LGPL-3.0 Imports: 23 Imported by: 4

README

A brief introduction for iwallet
-How to use iwallet?
the first thing you should do is to read this document.and if you meet some diffcuties in using iwallet,please use -h parameter with no hesitation.
for example:iwallet -h , iwallet account -h .there is a -h parameter for each subcommand too.

-How to generate an account?
iwallet account -n filename
this command create a pair of sec-key and pub-key in the files ~/.iwallet/filename_ed25519 and ~/.iwallet/filename_ed25519.pub.and this command return the corresponding iost account ID,please keep it.

-How to deploy a contract?
(1)If you want to deploy a contract to the iost blockchain,use the subcommand compile,if you don't have a iost account,please generate an account first with the command account and ensure this account can afford the fee of deploying your contract(typically it equals to the gas cost for deployment),it's a small amount normally.
(2)Use the subcommand compile to generate the tx,there are two situations:
	1)if you don't include --signers in subcommand compile,iwallet thinks this tx doesn't need any other signatures except the publisher for this tx(the publisher means the signature of the person who create this tx,every tx has a publisher).So it send the generated tx to the iost node you indicated(you can specify the destination with -s,see iwallet -h for more information) directly.
	2)if you indicate --signers,then the subcommand compile will save the unsigned tx to a .sc file.
(3)if it's 2) in step (2),send the .sc file to signers you indicate in --signers,then they should sign this contract with the subcommand sign.the subcommand sign generate the corresponding .sig file which is the signature you need.After collecting all the .sig files from the signers,we advance to (4).
(4)use the subcommand publish to merge all the signatures to the unsigned tx,and sign the tx with -k,iwallet publish will send the tx to the iost node you indicate with -s ip:port(port is typically 30002),it's localhost:30002 by default.

-How to call a method(function) in a deployed contract which is on the blockchain?
the steps are similar to deploying a contract.get more info from iwallet call -h.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func NewAction added in v1.1.0

func NewAction(contract string, name string, data string) *rpcpb.Action

NewAction ...

Types

type SDK added in v1.1.0

type SDK struct {
	// contains filtered or unexported fields
}

SDK ...

func (*SDK) CreateNewAccount added in v1.1.0

func (s *SDK) CreateNewAccount(newID string, ownerKey string, activeKey string, initialGasPledge int64, initialRAM int64, initialCoins int64) (string, error)

CreateNewAccount ... return txHash

func (*SDK) GetContractStorage added in v1.1.0

func (s *SDK) GetContractStorage(r *rpcpb.GetContractStorageRequest) (*rpcpb.GetContractStorageResponse, error)

GetContractStorage ...

func (*SDK) GetProducerVoteInfo

func (s *SDK) GetProducerVoteInfo(r *rpcpb.GetProducerVoteInfoRequest) (*rpcpb.GetProducerVoteInfoResponse, error)

GetProducerVoteInfo ...

func (*SDK) GetSignAlgo

func (s *SDK) GetSignAlgo() crypto.Algorithm

GetSignAlgo ...

func (*SDK) GetSignAlgoByEnum

func (s *SDK) GetSignAlgoByEnum(enum rpcpb.Signature_Algorithm) crypto.Algorithm

GetSignAlgoByEnum ...

func (*SDK) GetSignAlgoByName

func (s *SDK) GetSignAlgoByName(name string) crypto.Algorithm

GetSignAlgoByName ...

func (*SDK) GetTxReceiptByTxHash added in v1.1.0

func (s *SDK) GetTxReceiptByTxHash(txHashStr string) (*rpcpb.TxReceipt, error)

GetTxReceiptByTxHash ...

func (*SDK) LoadAccount

func (s *SDK) LoadAccount() error

LoadAccount load account from file

func (*SDK) PledgeForGasAndRAM added in v1.1.0

func (s *SDK) PledgeForGasAndRAM(gasPledged int64, ram int64) error

PledgeForGasAndRAM ...

func (*SDK) PublishContract added in v1.1.0

func (s *SDK) PublishContract(codePath string, abiPath string, conID string, update bool, updateID string) (*rpcpb.TransactionRequest, string, error)

PublishContract converts contract js code to transaction. If 'send', also send it to chain.

func (*SDK) SaveAccount

func (s *SDK) SaveAccount(name string, kp *account.KeyPair) error

SaveAccount save account to file

func (*SDK) SendTx

func (s *SDK) SendTx(tx *rpcpb.TransactionRequest) (string, error)

SendTx send transaction and check result if sdk.checkResult is set

func (*SDK) SendTxFromActions

func (s *SDK) SendTxFromActions(actions []*rpcpb.Action) (txHash string, err error)

SendTxFromActions send transaction and check result if sdk.checkResult is set

func (*SDK) SetAccount added in v1.1.0

func (s *SDK) SetAccount(name string, kp *account.KeyPair)

SetAccount ...

func (*SDK) SetAmountLimit

func (s *SDK) SetAmountLimit(amountLimit string)

SetAmountLimit ...

func (*SDK) SetChainID

func (s *SDK) SetChainID(chainID uint32)

SetChainID sets chainID.

func (*SDK) SetCheckResult added in v1.1.0

func (s *SDK) SetCheckResult(checkResult bool, checkResultDelay float32, checkResultMaxRetry int32)

SetCheckResult ...

func (*SDK) SetServer added in v1.1.0

func (s *SDK) SetServer(server string)

SetServer ...

func (*SDK) SetSignAlgo

func (s *SDK) SetSignAlgo(signAlgo string)

SetSignAlgo ...

func (*SDK) SetTxInfo added in v1.1.0

func (s *SDK) SetTxInfo(gasLimit float64, gasRatio float64, expiration int64, delaySecond int64)

SetTxInfo ...

func (*SDK) SetVerbose

func (s *SDK) SetVerbose(verbose bool)

SetVerbose ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL