Documentation ¶
Index ¶
- Constants
- func CreateDocumentHash(msgBytes []byte, meta *tcrsa.KeyMeta) ([]byte, error)
- func CreateFullSignature(documentHash []byte, partSigs tcrsa.SigShareList, publicKey *tcrsa.KeyMeta) (tcrsa.Signature, error)
- func GeneratePrivateKey() (privateKey *ecdsa.PrivateKey, err error)
- func GenerateThresholdKeys(need, all int) (shares tcrsa.KeyShareList, meta *tcrsa.KeyMeta, err error)
- func Hash(block *pb.Block) []byte
- func NewCmdSet() *cmdSetImpl
- func ReadPrivateKeyFromFile(filePath string) (*ecdsa.PrivateKey, error)
- func ReadPublicKeyFromFile(filePath string) (*ecdsa.PublicKey, error)
- func ReadThresholdPrivateKeyFromFile(filePath string) (*tcrsa.KeyShare, error)
- func ReadThresholdPublicKeyFromFile(filePath string) (*tcrsa.KeyMeta, error)
- func String(block *pb.Block) string
- func TSign(documentHash []byte, privateKey *tcrsa.KeyShare, publicKey *tcrsa.KeyMeta) (*tcrsa.SigShare, error)
- func TVerify(publicKey *tcrsa.KeyMeta, signature tcrsa.Signature, msgBytes []byte) (bool, error)
- func VerifyPartSig(partSig *tcrsa.SigShare, documentHash []byte, publicKey *tcrsa.KeyMeta) error
- func WritePrivateKeyToFile(privateKey *ecdsa.PrivateKey, filePath string) error
- func WritePublicKeyToFile(publicKey *ecdsa.PublicKey, filePath string) error
- func WriteThresholdPrivateKeyToFile(privateKey *tcrsa.KeyShare, filePath string) error
- func WriteThresholdPublicKeyToFile(publicKey *tcrsa.KeyMeta, filePath string) error
- type BlockStorage
- type BlockStorageImpl
- func (bsi *BlockStorageImpl) BlockOf(cert *pb.QuorumCert) (*pb.Block, error)
- func (bsi *BlockStorageImpl) Close()
- func (bsi *BlockStorageImpl) Get(hash []byte) (*pb.Block, error)
- func (bsi *BlockStorageImpl) GetLastBlockHash() []byte
- func (bsi *BlockStorageImpl) ParentOf(block *pb.Block) (*pb.Block, error)
- func (bsi *BlockStorageImpl) Put(block *pb.Block) error
- func (bsi *BlockStorageImpl) RestoreStatus()
- func (bsi *BlockStorageImpl) UpdateState(block *pb.Block) error
- type CmdSet
- type Timer
Constants ¶
View Source
const ( PRIVATEKEYFILETYPE = "HOTSTUFF PRIVATE KEY" PUBLICKEYFILETYPE = "HOTSTUFF PUBLIC KEY" )
Variables ¶
This section is empty.
Functions ¶
func CreateDocumentHash ¶
func CreateFullSignature ¶
func GeneratePrivateKey ¶
func GeneratePrivateKey() (privateKey *ecdsa.PrivateKey, err error)
GeneratePrivateKey 使用ecdsa生成私钥
func GenerateThresholdKeys ¶
func GenerateThresholdKeys(need, all int) (shares tcrsa.KeyShareList, meta *tcrsa.KeyMeta, err error)
GenerateThresholdKeys generate threshold signature keys need: how many signatures we need ,the same as 2f+1 all: how many private keys we need generate, the same as N it may take a bit time to generate keys
func ReadPrivateKeyFromFile ¶
func ReadPrivateKeyFromFile(filePath string) (*ecdsa.PrivateKey, error)
ReadPrivateKeyFromFile 从文件中读取私钥
func ReadPublicKeyFromFile ¶
ReadPublicKeyFromFile 从硬盘中读取公钥
func TSign ¶
func TSign(documentHash []byte, privateKey *tcrsa.KeyShare, publicKey *tcrsa.KeyMeta) (*tcrsa.SigShare, error)
TSign create the partial signature of replica
func VerifyPartSig ¶
func WritePrivateKeyToFile ¶
func WritePrivateKeyToFile(privateKey *ecdsa.PrivateKey, filePath string) error
WritePrivateKeyToFile 将私钥写入磁盘
func WritePublicKeyToFile ¶
WritePublicKeyToFile 将公钥写入磁盘
Types ¶
type BlockStorage ¶
type BlockStorage interface { Put(block *pb.Block) error Get(hash []byte) (*pb.Block, error) UpdateState(block *pb.Block) error BlockOf(cert *pb.QuorumCert) (*pb.Block, error) ParentOf(block *pb.Block) (*pb.Block, error) GetLastBlockHash() []byte RestoreStatus() Close() }
用于存储和查找区块信息
type BlockStorageImpl ¶
type BlockStorageImpl struct { Tip []byte // contains filtered or unexported fields }
func NewBlockStorageImpl ¶
func NewBlockStorageImpl(id string) *BlockStorageImpl
func (*BlockStorageImpl) BlockOf ¶
func (bsi *BlockStorageImpl) BlockOf(cert *pb.QuorumCert) (*pb.Block, error)
func (*BlockStorageImpl) Close ¶
func (bsi *BlockStorageImpl) Close()
func (*BlockStorageImpl) GetLastBlockHash ¶
func (bsi *BlockStorageImpl) GetLastBlockHash() []byte
func (*BlockStorageImpl) RestoreStatus ¶
func (bsi *BlockStorageImpl) RestoreStatus()
func (*BlockStorageImpl) UpdateState ¶
func (bsi *BlockStorageImpl) UpdateState(block *pb.Block) error
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
Wrap golang sdk timer.Timer
func (*Timer) HardStartTimer ¶
func (t *Timer) HardStartTimer()
SoftStartTimer start the timer ,whether it has been started
func (*Timer) SoftStartTimer ¶
func (t *Timer) SoftStartTimer()
SoftStartTimer start the timer, if it has not been started
Source Files ¶
Click to show internal directories.
Click to hide internal directories.