func getRootEnvelope(part PartRecord) string {
	tokenSize := len(_ROOT_TOKEN)  
	if len(part.Label) > tokenSize && part.Label[:tokenSize] == _ROOT_TOKEN {
		return part.Label[tokenSize:]
	}
	return ""
}
Returns "" if error encountered.
package main
import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"text/tabwriter"
	"net/http"
	"strings"
)
type PartSupplierRecord struct {
	PartUUID     string `json:"part_uuid"`      
	SupplierUUID string `json:"supplier_uuid"`  
}
type PartArtifactRecord struct {
	PartUUID     string `json:"part_uuid"`      
	ArtifactUUID string `json:"envelope_uuid"`  
}
func displayPartsFromLedger(partsList []PartItemRecord) {
	if len(partsList) == 0 {
		return
	}
	for k := range partsList {
		part, err := getPartInfo(partsList[k].PartUUID)
		if err != nil {
			fmt.Println("Could not retrieve part for uuid=", partsList[k].PartUUID)
			continue  
		}
		fmt.Println()
		fmt.Println("    " + _CYAN_FG + part.Name + _COLOR_END)
		fmt.Print("    ")
		fmt.Print()
		fmt.Println("-------------------------------------------------")
		fmt.Println("    Name: \t " + part.Name)
		fmt.Println("    Version: \t " + part.Version)
		fmt.Println("    UUID: \t " + part.UUID)
		chuckSize := 60
		for len(part.Description) > chuckSize && part.Description[chuckSize] != ' ' {
			chuckSize++
		}
		chuckSize++
		descriptionStr := strings.Join(chunkString(part.Description, chuckSize), "\n                 ")
		fmt.Println("    Description: " + descriptionStr)
		fmt.Println()
	}
}
func displayPartList() {
	var list []PartRecord
	list, err := getPartListFromDBWhere("", "")  
	if checkAndReportError(err) {
		return
	}
	if len(list) == 0 {
		fmt.Printf(" There are no parts cached locally. Try '%s synch ledger'\n", filepath.Base(os.Args[0]))
		return
	}
	const padding = 1
	w := tabwriter.NewWriter(os.Stdout, 0, 0, padding, ' ',
		tabwriter.Debug)
	fmt.Println("    			     PARTS      ")
	fmt.Fprintf(w, "\t%s\t %s\t %s\n", " ------------------", "-----------", "------------------------------------")
	fmt.Fprintf(w, "\t%s\t %s\t %s\n", " Name  ", "   Alias ", "UUID  ")
	fmt.Fprintf(w, "\t%s\t %s\t %s\n", " ------------------", "-----------", "------------------------------------")
	for k := range list {
		alias, _ := getAliasUsingValue(list[k].UUID)
		if alias == "" {
			alias = "<none>"
		}
		fmt.Fprintf(w, "\t %s\t %s\t %s\n", list[k].Name, alias, list[k].UUID)
	}
	fmt.Fprintf(w, "\n")
	w.Flush()
}
func pushPartToLedger(part PartRecord) error {
	var requestRecord PartAddRecord
	requestRecord.PrivateKey = getLocalConfigValue(_PRIVATE_KEY)
	requestRecord.PublicKey = getLocalConfigValue(_PUBLIC_KEY)
	if requestRecord.PrivateKey == "" || requestRecord.PublicKey == "" {
		return fmt.Errorf("Private and/or Public key(s) are not set \n Use 'sparts config' to set keys")
	}
	requestRecord.Part = part
	var replyRecord ReplyType
	err := sendPostRequest(_PARTS_API, requestRecord, replyRecord)
	if err != nil {
		return err
	}
	return nil
}
func createPartSupplierRelationship(part_uuid string, supplier_uuid string) (bool, error) {
	var requestRecord PartToSupplierRecord
	var partSupplierItem PartSupplierPair
	partSupplierItem.PartUUID = part_uuid
	partSupplierItem.SupplierUUID = supplier_uuid
	requestRecord.PrivateKey = getLocalConfigValue(_PRIVATE_KEY)
	requestRecord.PublicKey = getLocalConfigValue(_PUBLIC_KEY)
	if requestRecord.PrivateKey == "" || requestRecord.PublicKey == "" {
		return false, fmt.Errorf("Private and/or Public key(s) are not set \n Use 'sparts config' to set keys")
	}
	requestRecord.Relation = partSupplierItem
	var replyRecord ReplyType
	err := sendPostRequest(_PARTS_TO_SUPPLIER_API, requestRecord, replyRecord)
	if err != nil {
		return false, err
	}
	return true, nil
}
func createPartArtifactRelationship(part_uuid string, artifact_uuid string) bool {
	var partArtifactInfo PartArtifactRecord
	partArtifactInfo.PartUUID = part_uuid
	partArtifactInfo.ArtifactUUID = artifact_uuid
	partArtifactAsBytes, err := json.Marshal(partArtifactInfo)
	if err != nil {
		fmt.Printf("Error: %s", err)
		return false
	}
	requestURL := "http://" + getLocalConfigValue(_LEDGER_ADDRESS_KEY) + "/api/sparts/ledger/parts/AddEnvelope"
	req, err := http.NewRequest("POST", requestURL, bytes.NewBuffer(partArtifactAsBytes))
	if err != nil {
		fmt.Printf("Error: %s", err)
		return false
	}
	req.Header.Set("X-Custom-Header", "PartToArtifact")
	req.Header.Set("Content-Type", "application/json")
	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		fmt.Printf("Error: %s", err)
		return false
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Printf("Error: %s", err)
		return false
	}
	fmt.Println("PartToArtifact: response Body:", string(body))
	if strings.Contains(string(body), "success") {
		return true
	} else {
		return false
	}
}