func (tx *SignedTransaction) Sign(privKeys [][]byte, chain string) error {
	var buf bytes.Buffer
	chainid, errdec := hex.DecodeString(chain)
	if errdec != nil {
		return errdec
	}

	txRaw, err := tx.Serialize()
	if err != nil {
		return err
	}

	buf.Write(chainid)
	buf.Write(txRaw)
	data := buf.Bytes()
	//msg_sha := crypto.Sha256(buf.Bytes())

	var sigsHex []string

	for _, privB := range privKeys {
		sigBytes, err := tx.SignSingle(privB, data)
		if err != nil {
			return err
		}
		sigsHex = append(sigsHex, hex.EncodeToString(sigBytes))
	}

	tx.Transaction.Signatures = sigsHex
	return nil
}
//Sign function directly generating transaction signature
Sign function directly generating transaction signature
// Sign function directly generating transaction signature
func (tx *SignedTransaction) Sign(privKeys [][]byte, chain string) error {
	var buf bytes.Buffer
	chainid, errdec := hex.DecodeString(chain)
	if errdec != nil {
		return errdec
	}
	txRaw, err := tx.Serialize()
	if err != nil {
		return err
	}
	buf.Write(chainid)
	buf.Write(txRaw)
	data := buf.Bytes()
	var sigsHex []string
	for _, privB := range privKeys {
		sigBytes, err := tx.SignSingle(privB, data)
		if err != nil {
			return err
		}
		sigsHex = append(sigsHex, hex.EncodeToString(sigBytes))
	}
	tx.Transaction.Signatures = sigsHex
	return nil
}
func ( tx * SignedTransaction ) Sign ( privKeys [ ] [ ] byte , chain string ) error { var buf bytes . Buffer chainid , errdec := hex . DecodeString ( chain ) if errdec != nil { return errdec } txRaw , err := tx . Serialize ( ) if err != nil { return err } buf . Write ( chainid ) buf . Write ( txRaw ) data := buf . Bytes ( ) var sigsHex [ ] string for _ , privB := range privKeys { sigBytes , err := tx . SignSingle ( privB , data ) if err != nil { return err } sigsHex = append ( sigsHex , hex . EncodeToString ( sigBytes ) ) } tx . Transaction . Signatures = sigsHex return nil }
Sign function directly generating transaction signature
Sign function directly generating transaction signature
//msg_sha := crypto.Sha256(buf.Bytes())