func Sign(privKey ecdsa.PrivateKey, rawDataDigest []byte) []byte {
	signature, err := crypto.Sign(rawDataDigest, &privKey)
	if err != nil {
		log.Error(err)
	}
	return signature
}
Sign signs the digest of rawData
package blockchain
import (
	"bytes"
	"crypto/ecdsa"
	"crypto/sha256"
	"encoding/gob"
	"time"
	"github.com/ethereum/go-ethereum/crypto"
	uuid "github.com/satori/go.uuid"
	log "github.com/sirupsen/logrus"
)
type Transaction struct {
	ID                 []byte  
	BlockHash          []byte
	PeerId             []byte  
	RawData            []byte
	AcceptedTimestamp  int64
	Collection         string
	PubKey             []byte
	Signature          []byte
	PermittedAddresses []string
}
func (tx *Transaction) SetID() {
	idHash := sha256.Sum256(uuid.NewV4().Bytes())
	tx.ID = idHash[:]
}
func (tx *Transaction) Serialize() []byte {
	var result bytes.Buffer
	encoder := gob.NewEncoder(&result)
	err := encoder.Encode(tx)
	if err != nil {
		log.Error(err)
	}
	return result.Bytes()
}
func DeserializeTransaction(d []byte) *Transaction {
	var tx Transaction
	decoder := gob.NewDecoder(bytes.NewReader(d))
	err := decoder.Decode(&tx)
	if err != nil {
		log.Error(err)
	}
	return &tx
}