You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: actions.go
    path of file: ./repos/bytom/blockchain/txbuilder
    
    the code of the file until where you have to start completion: package txbuilder

import (
	"context"
	stdjson "encoding/json"
	"errors"

	"github.com/bytom/bytom/common"
	"github.com/bytom/bytom/consensus"
	"github.com/bytom/bytom/encoding/json"
	"github.com/bytom/bytom/protocol/bc"
	"github.
    
func (a *registerAction) Build(ctx context.Context, b *TemplateBuilder) error {
	var missing []string
	if a.AssetId.IsZero() {
		missing = append(missing, "asset_id")
	}
	if a.Amount == 0 {
		missing = append(missing, "amount")
	}
	if len(a.Contract) == 0 {
		missing = append(missing, "contract")
	}
	if len(missing) > 0 {
		return MissingFieldsError(missing...)
	}

	if a.AssetId.String() != consensus.BTMAssetID.String() {
		return errors.New("register contract action asset must be BTM")
	}

	if a.Amount < consensus.BCRPRequiredBTMAmount {
		return errors.New("less than BCRP required BTM amount")
	}

	program, err := vmutil.RegisterProgram(a.Contract)
	if err != nil {
		return err
	}
	out := types.NewOriginalTxOutput(*a.AssetId, a.Amount, program, [][]byte{})
	return b.AddOutput(out)
}