From 94de341ce9f9aa79338bdbe042095ad6e06bc80b Mon Sep 17 00:00:00 2001
From: Silas Davis <silas@erisindustries.com>
Date: Fri, 6 May 2016 18:21:19 +0100
Subject: [PATCH] move files under txs/ into txs package

---
 erisdb/event_filters.go    |   3 +-
 erisdb/methods.go          |   2 +-
 erisdb/params.go           |   2 +-
 erisdb/pipe/namereg.go     |  16 ++--
 erisdb/pipe/transactor.go  |  48 ++++++------
 erisdb/restServer.go       |   2 +-
 evm/vm.go                  |  10 +--
 glide.lock                 |  37 +++++-----
 glide.yaml                 |   4 +-
 rpc/client/client.go       |  10 +--
 rpc/core/names.go          |   2 +-
 rpc/core/routes.go         |   4 +-
 rpc/core/txs.go            |  23 +++---
 rpc/test/client_ws_test.go |  20 ++---
 rpc/test/tests.go          |  30 ++++----
 state/block_cache.go       |   8 +-
 state/execution.go         | 146 ++++++++++++++++++-------------------
 state/tx_cache.go          |   2 +-
 txs/config.go              |   2 +-
 txs/events.go              |   2 +-
 txs/log.go                 |   2 +-
 txs/names.go               |   2 +-
 txs/tx.go                  |   2 +-
 txs/tx_test.go             |   2 +-
 txs/tx_utils.go            |   2 +-
 25 files changed, 194 insertions(+), 189 deletions(-)

diff --git a/erisdb/event_filters.go b/erisdb/event_filters.go
index 498b79ce..498fab48 100644
--- a/erisdb/event_filters.go
+++ b/erisdb/event_filters.go
@@ -4,6 +4,7 @@ import (
 	"bytes"
 	"encoding/hex"
 	"fmt"
+
 	ep "github.com/eris-ltd/eris-db/erisdb/pipe"
 	"github.com/eris-ltd/eris-db/txs"
 )
@@ -41,7 +42,7 @@ func (this *AccountCallTxHashFilter) Configure(fd *ep.FilterData) error {
 }
 
 func (this *AccountCallTxHashFilter) Match(v interface{}) bool {
-	emct, ok := v.(*types.EventDataCall)
+	emct, ok := v.(*txs.EventDataCall)
 	if !ok {
 		return false
 	}
diff --git a/erisdb/methods.go b/erisdb/methods.go
index 810cb4cd..f242cfa7 100644
--- a/erisdb/methods.go
+++ b/erisdb/methods.go
@@ -378,7 +378,7 @@ func (this *ErisDbMethods) CallCode(request *rpc.RPCRequest, requester interface
 }
 
 func (this *ErisDbMethods) BroadcastTx(request *rpc.RPCRequest, requester interface{}) (interface{}, int, error) {
-	param := &types.CallTx{}
+	param := &txs.CallTx{}
 	err := this.codec.DecodeBytes(param, request.Params)
 	if err != nil {
 		return nil, rpc.INVALID_PARAMS, err
diff --git a/erisdb/params.go b/erisdb/params.go
index 42d12d92..7c68fe2f 100644
--- a/erisdb/params.go
+++ b/erisdb/params.go
@@ -76,7 +76,7 @@ type (
 
 	// Used when signing a tx. Uses placeholders just like TxParam
 	SignTxParam struct {
-		Tx           *types.CallTx          `json:"tx"`
+		Tx           *txs.CallTx            `json:"tx"`
 		PrivAccounts []*account.PrivAccount `json:"priv_accounts"`
 	}
 
diff --git a/erisdb/pipe/namereg.go b/erisdb/pipe/namereg.go
index ac15350d..87cf1d27 100644
--- a/erisdb/pipe/namereg.go
+++ b/erisdb/pipe/namereg.go
@@ -48,7 +48,7 @@ func newNamereg(erisdbApp *tmsp.ErisDBApp) *namereg {
 	return &namereg{erisdbApp, ff}
 }
 
-func (this *namereg) Entry(key string) (*types.NameRegEntry, error) {
+func (this *namereg) Entry(key string) (*txs.NameRegEntry, error) {
 	st := this.erisdbApp.GetState() // performs a copy
 	entry := st.GetNameRegEntry(key)
 	if entry == nil {
@@ -59,7 +59,7 @@ func (this *namereg) Entry(key string) (*types.NameRegEntry, error) {
 
 func (this *namereg) Entries(filters []*FilterData) (*ResultListNames, error) {
 	var blockHeight int
-	var names []*types.NameRegEntry
+	var names []*txs.NameRegEntry
 	state := this.erisdbApp.GetState()
 	blockHeight = state.LastBlockHeight
 	filter, err := this.filterFactory.NewFilter(filters)
@@ -77,8 +77,8 @@ func (this *namereg) Entries(filters []*FilterData) (*ResultListNames, error) {
 }
 
 type ResultListNames struct {
-	BlockHeight int                   `json:"block_height"`
-	Names       []*types.NameRegEntry `json:"names"`
+	BlockHeight int                 `json:"block_height"`
+	Names       []*txs.NameRegEntry `json:"names"`
 }
 
 // Filter for namereg name. This should not be used to get individual entries by name.
@@ -110,7 +110,7 @@ func (this *NameRegNameFilter) Configure(fd *FilterData) error {
 }
 
 func (this *NameRegNameFilter) Match(v interface{}) bool {
-	nre, ok := v.(*types.NameRegEntry)
+	nre, ok := v.(*txs.NameRegEntry)
 	if !ok {
 		return false
 	}
@@ -149,7 +149,7 @@ func (this *NameRegOwnerFilter) Configure(fd *FilterData) error {
 }
 
 func (this *NameRegOwnerFilter) Match(v interface{}) bool {
-	nre, ok := v.(*types.NameRegEntry)
+	nre, ok := v.(*txs.NameRegEntry)
 	if !ok {
 		return false
 	}
@@ -185,7 +185,7 @@ func (this *NameRegDataFilter) Configure(fd *FilterData) error {
 }
 
 func (this *NameRegDataFilter) Match(v interface{}) bool {
-	nre, ok := v.(*types.NameRegEntry)
+	nre, ok := v.(*txs.NameRegEntry)
 	if !ok {
 		return false
 	}
@@ -216,7 +216,7 @@ func (this *NameRegExpiresFilter) Configure(fd *FilterData) error {
 }
 
 func (this *NameRegExpiresFilter) Match(v interface{}) bool {
-	nre, ok := v.(*types.NameRegEntry)
+	nre, ok := v.(*txs.NameRegEntry)
 	if !ok {
 		return false
 	}
diff --git a/erisdb/pipe/transactor.go b/erisdb/pipe/transactor.go
index cd8d5d51..6f9bc29f 100644
--- a/erisdb/pipe/transactor.go
+++ b/erisdb/pipe/transactor.go
@@ -97,7 +97,7 @@ func (this *transactor) CallCode(fromAddress, code, data []byte) (*Call, error)
 }
 
 // Broadcast a transaction.
-func (this *transactor) BroadcastTx(tx types.Tx) (*Receipt, error) {
+func (this *transactor) BroadcastTx(tx txs.Tx) (*Receipt, error) {
 
 	err := this.erisdbApp.BroadcastTx(tx)
 	if err != nil {
@@ -105,11 +105,11 @@ func (this *transactor) BroadcastTx(tx types.Tx) (*Receipt, error) {
 	}
 
 	chainId := config.GetString("erisdb.chain_id")
-	txHash := types.TxID(chainId, tx)
+	txHash := txs.TxID(chainId, tx)
 	var createsContract uint8
 	var contractAddr []byte
 	// check if creates new contract
-	if callTx, ok := tx.(*types.CallTx); ok {
+	if callTx, ok := tx.(*txs.CallTx); ok {
 		if len(callTx.Address) == 0 {
 			createsContract = 1
 			contractAddr = state.NewContractAddress(callTx.Input.Address, callTx.Input.Sequence)
@@ -149,13 +149,13 @@ func (this *transactor) Transact(privKey, address, data []byte, gasLimit, fee in
 		sequence = acc.Sequence + 1
 	}
 	// fmt.Printf("Sequence %d\n", sequence)
-	txInput := &types.TxInput{
+	txInput := &txs.TxInput{
 		Address:  pa.Address,
 		Amount:   1,
 		Sequence: sequence,
 		PubKey:   pa.PubKey,
 	}
-	tx := &types.CallTx{
+	tx := &txs.CallTx{
 		Input:    txInput,
 		Address:  addr,
 		GasLimit: gasLimit,
@@ -171,7 +171,7 @@ func (this *transactor) Transact(privKey, address, data []byte, gasLimit, fee in
 	return this.BroadcastTx(txS)
 }
 
-func (this *transactor) TransactAndHold(privKey, address, data []byte, gasLimit, fee int64) (*types.EventDataCall, error) {
+func (this *transactor) TransactAndHold(privKey, address, data []byte, gasLimit, fee int64) (*txs.EventDataCall, error) {
 	rec, tErr := this.Transact(privKey, address, data, gasLimit, fee)
 	if tErr != nil {
 		return nil, tErr
@@ -182,10 +182,10 @@ func (this *transactor) TransactAndHold(privKey, address, data []byte, gasLimit,
 	} else {
 		addr = address
 	}
-	wc := make(chan *types.EventDataCall)
+	wc := make(chan *txs.EventDataCall)
 	subId := fmt.Sprintf("%X", rec.TxHash)
-	this.eventEmitter.Subscribe(subId, types.EventStringAccCall(addr), func(evt tEvents.EventData) {
-		event := evt.(types.EventDataCall)
+	this.eventEmitter.Subscribe(subId, txs.EventStringAccCall(addr), func(evt tEvents.EventData) {
+		event := evt.(txs.EventDataCall)
 		if bytes.Equal(event.TxID, rec.TxHash) {
 			wc <- &event
 		}
@@ -194,7 +194,7 @@ func (this *transactor) TransactAndHold(privKey, address, data []byte, gasLimit,
 	timer := time.NewTimer(300 * time.Second)
 	toChan := timer.C
 
-	var ret *types.EventDataCall
+	var ret *txs.EventDataCall
 	var rErr error
 
 	select {
@@ -228,7 +228,7 @@ func (this *transactor) TransactNameReg(privKey []byte, name, data string, amoun
 	} else {
 		sequence = acc.Sequence + 1
 	}
-	tx := types.NewNameTxWithNonce(pa.PubKey, name, data, amount, fee, sequence)
+	tx := txs.NewNameTxWithNonce(pa.PubKey, name, data, amount, fee, sequence)
 	// Got ourselves a tx.
 	txS, errS := this.SignTx(tx, []*account.PrivAccount{pa})
 	if errS != nil {
@@ -238,7 +238,7 @@ func (this *transactor) TransactNameReg(privKey []byte, name, data string, amoun
 }
 
 // Sign a transaction
-func (this *transactor) SignTx(tx types.Tx, privAccounts []*account.PrivAccount) (types.Tx, error) {
+func (this *transactor) SignTx(tx txs.Tx, privAccounts []*account.PrivAccount) (txs.Tx, error) {
 	// more checks?
 
 	for i, privAccount := range privAccounts {
@@ -248,24 +248,24 @@ func (this *transactor) SignTx(tx types.Tx, privAccounts []*account.PrivAccount)
 	}
 	chainId := config.GetString("erisdb.chain_id")
 	switch tx.(type) {
-	case *types.NameTx:
-		nameTx := tx.(*types.NameTx)
+	case *txs.NameTx:
+		nameTx := tx.(*txs.NameTx)
 		nameTx.Input.PubKey = privAccounts[0].PubKey
 		nameTx.Input.Signature = privAccounts[0].Sign(config.GetString("erisdb.chain_id"), nameTx)
-	case *types.SendTx:
-		sendTx := tx.(*types.SendTx)
+	case *txs.SendTx:
+		sendTx := tx.(*txs.SendTx)
 		for i, input := range sendTx.Inputs {
 			input.PubKey = privAccounts[i].PubKey
 			input.Signature = privAccounts[i].Sign(chainId, sendTx)
 		}
 		break
-	case *types.CallTx:
-		callTx := tx.(*types.CallTx)
+	case *txs.CallTx:
+		callTx := tx.(*txs.CallTx)
 		callTx.Input.PubKey = privAccounts[0].PubKey
 		callTx.Input.Signature = privAccounts[0].Sign(chainId, callTx)
 		break
-	case *types.BondTx:
-		bondTx := tx.(*types.BondTx)
+	case *txs.BondTx:
+		bondTx := tx.(*txs.BondTx)
 		// the first privaccount corresponds to the BondTx pub key.
 		// the rest to the inputs
 		bondTx.Signature = privAccounts[0].Sign(chainId, bondTx).(crypto.SignatureEd25519)
@@ -274,12 +274,12 @@ func (this *transactor) SignTx(tx types.Tx, privAccounts []*account.PrivAccount)
 			input.Signature = privAccounts[i+1].Sign(chainId, bondTx)
 		}
 		break
-	case *types.UnbondTx:
-		unbondTx := tx.(*types.UnbondTx)
+	case *txs.UnbondTx:
+		unbondTx := tx.(*txs.UnbondTx)
 		unbondTx.Signature = privAccounts[0].Sign(chainId, unbondTx).(crypto.SignatureEd25519)
 		break
-	case *types.RebondTx:
-		rebondTx := tx.(*types.RebondTx)
+	case *txs.RebondTx:
+		rebondTx := tx.(*txs.RebondTx)
 		rebondTx.Signature = privAccounts[0].Sign(chainId, rebondTx).(crypto.SignatureEd25519)
 		break
 	default:
diff --git a/erisdb/restServer.go b/erisdb/restServer.go
index 5b0feee8..e6a7ca16 100644
--- a/erisdb/restServer.go
+++ b/erisdb/restServer.go
@@ -374,7 +374,7 @@ func (this *RestServer) handlePeer(c *gin.Context) {
 // ********************************* Transactions *********************************
 
 func (this *RestServer) handleBroadcastTx(c *gin.Context) {
-	param := &types.CallTx{}
+	param := &txs.CallTx{}
 	errD := this.codec.Decode(param, c.Request.Body)
 	if errD != nil {
 		c.AbortWithError(500, errD)
diff --git a/evm/vm.go b/evm/vm.go
index 656350bf..ff405eb1 100644
--- a/evm/vm.go
+++ b/evm/vm.go
@@ -8,7 +8,7 @@ import (
 
 	"github.com/eris-ltd/eris-db/evm/sha3"
 	ptypes "github.com/eris-ltd/eris-db/permission/types"
-	types "github.com/eris-ltd/eris-db/txs"
+	"github.com/eris-ltd/eris-db/txs"
 	. "github.com/tendermint/go-common"
 	"github.com/tendermint/go-events"
 )
@@ -103,8 +103,8 @@ func HasPermission(appState AppState, acc *Account, perm ptypes.PermFlag) bool {
 func (vm *VM) fireCallEvent(exception *string, output *[]byte, caller, callee *Account, input []byte, value int64, gas *int64) {
 	// fire the post call event (including exception if applicable)
 	if vm.evc != nil {
-		vm.evc.FireEvent(types.EventStringAccCall(callee.Address.Postfix(20)), types.EventDataCall{
-			&types.CallData{caller.Address.Postfix(20), callee.Address.Postfix(20), input, value, *gas},
+		vm.evc.FireEvent(txs.EventStringAccCall(callee.Address.Postfix(20)), txs.EventDataCall{
+			&txs.CallData{caller.Address.Postfix(20), callee.Address.Postfix(20), input, value, *gas},
 			vm.origin.Postfix(20),
 			vm.txid,
 			*output,
@@ -697,9 +697,9 @@ func (vm *VM) call(caller, callee *Account, code, input []byte, value int64, gas
 				return nil, firstErr(err, ErrMemoryOutOfBounds)
 			}
 			if vm.evc != nil {
-				eventID := types.EventStringLogEvent(callee.Address.Postfix(20))
+				eventID := txs.EventStringLogEvent(callee.Address.Postfix(20))
 				fmt.Printf("eventID: %s\n", eventID)
-				log := types.EventDataLog{
+				log := txs.EventDataLog{
 					callee.Address,
 					topics,
 					data,
diff --git a/glide.lock b/glide.lock
index ac08c345..fec9549d 100644
--- a/glide.lock
+++ b/glide.lock
@@ -1,12 +1,14 @@
-hash: ebfa16e47dd0e0b486fc4435f53391b6bd9df5cb6dda53377ad2a0cde065c056
-updated: 2016-04-19T16:32:29.646405777+01:00
+hash: 03fc6626a41c42482068e6bb7c691f003d555d21ef8ee6d4d358ca0994b2975d
+updated: 2016-05-05T14:28:48.951275503+01:00
 imports:
 - name: github.com/btcsuite/btcd
-  version: 474547b211c8f5566d094478318fcfd3c2c838d4
+  version: 0d7f52660096c5a22f2cb95c102e0693f773a593
   subpackages:
   - btcec
 - name: github.com/btcsuite/fastsha256
   version: 302ad4db268b46f9ebda3078f6f7397f96047735
+- name: github.com/BurntSushi/toml
+  version: f0aeabca5a127c4078abb8c8d64298b147264b55
 - name: github.com/gin-gonic/gin
   version: 542be2fe77724f800fcab7eb6c01a4e597fb8506
   subpackages:
@@ -17,9 +19,9 @@ imports:
   subpackages:
   - proto
 - name: github.com/golang/snappy
-  version: 774a97396f7bfa4165e9dcf4bfa0747ea3edcc02
+  version: d7b1e156f50d3c4664f683603af70e3e47fa0aa2
 - name: github.com/gorilla/websocket
-  version: e2e3d8414d0fbae04004f151979f4e27c6747fe7
+  version: 1f512fc3f05332ba7117626cdfb4e07474e58e60
 - name: github.com/inconshreveable/log15
   version: 57a084d014d4150152b19e4e531399a7145d1540
   subpackages:
@@ -28,7 +30,7 @@ imports:
 - name: github.com/manucorporat/sse
   version: ee05b128a739a0fb76c7ebd3ae4810c1de808d6d
 - name: github.com/mattn/go-colorable
-  version: 9cbef7c35391cca05f15f8181dc0b18bc9736dbb
+  version: 45ce6a6f60010487dd0dbab368b5fbbed1c14ef0
 - name: github.com/mattn/go-isatty
   version: 56b76bdf51f7708750eac80fa38b952bb9f32639
 - name: github.com/naoina/go-stringutil
@@ -40,9 +42,9 @@ imports:
 - name: github.com/sfreiberg/gotwilio
   version: f024bbefe80fdb7bcc8c43b6add05dae97744e0e
 - name: github.com/stretchr/testify
-  version: c5d7a69bf8a2c9c374798160849c071093e41dd1
+  version: 6cb3b85ef5a0efef77caef88363ec4d4b5c0976d
 - name: github.com/syndtr/goleveldb
-  version: 93fc893f2dadb96ffde441c7546cc67ea290a3a8
+  version: cfa635847112c5dc4782e128fa7e0d05fdbfb394
   subpackages:
   - leveldb
   - leveldb/errors
@@ -70,11 +72,11 @@ imports:
 - name: github.com/tendermint/go-common
   version: dcfa46af1341d03b80d32e4901019d1668b978b9
 - name: github.com/tendermint/go-config
-  version: c47b67203b070d8bea835a928d50cb739972c48a
+  version: 4a3947582fc1b0b42967fbda4836437538e6b94c
 - name: github.com/tendermint/go-crypto
-  version: d57d5ff3c925149e62f3a3c3f6ecaf4c8250d678
+  version: 41cfb7b677f4e16cdfd22b6ce0946c89919fbc7b
 - name: github.com/tendermint/go-db
-  version: a7878f1d0d8eaebf15f87bc2df15f7a1088cce7f
+  version: 16d1493718a519baff4f92dfec63a463525fb2fb
 - name: github.com/tendermint/go-events
   version: 7b75ca7bb55aa25e9ef765eb8c0b69486b227357
 - name: github.com/tendermint/go-logger
@@ -86,17 +88,17 @@ imports:
   subpackages:
   - upnp
 - name: github.com/tendermint/go-rpc
-  version: 1410693eae5400a50efbbac3f23b9e3e94b7d6c8
+  version: e8538d606aa9700da03f748f61d734e8cbc1438b
   subpackages:
-  - client
   - server
+  - client
   - types
 - name: github.com/tendermint/go-wire
   version: 3b0adbc86ed8425eaed98516165b6788d9f4de7a
 - name: github.com/tendermint/log15
   version: 6e460758f10ef42a4724b8e4a82fee59aaa0e41d
 - name: github.com/tendermint/tendermint
-  version: 0df4a723e9d189db26577a2a7b17652e8f1fd2f4
+  version: a31b718cff5a3ae95377fa4488ac303f8ec2da2f
   subpackages:
   - config/tendermint
   - consensus
@@ -106,11 +108,12 @@ imports:
   - proxy
   - blockchain
   - mempool
+  - config/tendermint_test
   - rpc/core
   - state
   - version
 - name: github.com/tendermint/tmsp
-  version: d471b06bd8ddb12f7275d49422b9b376dbdd84ad
+  version: 9a8d40b87cceeb44117c6ae08fa0ff636747d3c8
   subpackages:
   - server
   - types
@@ -120,7 +123,7 @@ imports:
 - name: github.com/tommy351/gin-cors
   version: dc91dec6313ae4db53481bf3b29cf6b94bf80357
 - name: golang.org/x/crypto
-  version: 2f6fccd33b9b1fc23ebb73ad4890698820f7174d
+  version: 019870fc9d457ee8abd13a2e93e3f2a3b55b7119
   subpackages:
   - ripemd160
   - nacl/secretbox
@@ -136,7 +139,7 @@ imports:
   - context
   - netutil
 - name: golang.org/x/sys
-  version: f64b50fbea64174967a8882830d621a18ee1548e
+  version: b776ec39b3e54652e09028aaaaac9757f4f8211a
   subpackages:
   - unix
 - name: gopkg.in/fatih/set.v0
diff --git a/glide.yaml b/glide.yaml
index 0e2f5ab8..f7fb8925 100644
--- a/glide.yaml
+++ b/glide.yaml
@@ -8,18 +8,18 @@ import:
 - package: github.com/tendermint/go-config
 - package: github.com/tendermint/go-crypto
 - package: github.com/tendermint/go-db
+  version: develop
 - package: github.com/tendermint/go-events
 - package: github.com/tendermint/go-logger
 - package: github.com/tendermint/go-merkle
 - package: github.com/tendermint/go-p2p
 - package: github.com/stretchr/testify
 - package: github.com/tendermint/go-rpc
-  subpackages:
-  - client
 - package: github.com/tendermint/go-wire
   version: 3b0adbc86ed8425eaed98516165b6788d9f4de7a
 - package: github.com/tendermint/log15
 - package: github.com/tendermint/tendermint
+  version: develop
   subpackages:
   - config/tendermint
   - consensus
diff --git a/rpc/client/client.go b/rpc/client/client.go
index ac3cd270..01b57512 100644
--- a/rpc/client/client.go
+++ b/rpc/client/client.go
@@ -53,9 +53,9 @@ func GetAccount(client rpcclient.Client, addr []byte) (*acm.Account, error) {
 	return res.(*ctypes.ResultGetAccount).Account, nil
 }
 
-func SignTx(client rpcclient.Client, tx types.Tx, privAccs []*acm.PrivAccount) (types.Tx, error) {
+func SignTx(client rpcclient.Client, tx txs.Tx, privAccs []*acm.PrivAccount) (txs.Tx, error) {
 	wrapTx := struct {
-		types.Tx `json:"unwrap"`
+		txs.Tx `json:"unwrap"`
 	}{tx}
 	var res ctypes.ErisDBResult
 	var err error
@@ -71,9 +71,9 @@ func SignTx(client rpcclient.Client, tx types.Tx, privAccs []*acm.PrivAccount) (
 	return res.(*ctypes.ResultSignTx).Tx, nil
 }
 
-func BroadcastTx(client rpcclient.Client, tx types.Tx) (ctypes.Receipt, error) {
+func BroadcastTx(client rpcclient.Client, tx txs.Tx) (ctypes.Receipt, error) {
 	wrapTx := struct {
-		types.Tx `json:"unwrap"`
+		txs.Tx `json:"unwrap"`
 	}{tx}
 	var res ctypes.ErisDBResult
 	var err error
@@ -155,7 +155,7 @@ func Call(client rpcclient.Client, fromAddress, toAddress, data []byte) (*ctypes
 	return res.(*ctypes.ResultCall), err
 }
 
-func GetName(client rpcclient.Client, name string) (*types.NameRegEntry, error) {
+func GetName(client rpcclient.Client, name string) (*txs.NameRegEntry, error) {
 	var res ctypes.ErisDBResult
 	var err error
 	switch cli := client.(type) {
diff --git a/rpc/core/names.go b/rpc/core/names.go
index 4dcd891e..063f0703 100644
--- a/rpc/core/names.go
+++ b/rpc/core/names.go
@@ -19,7 +19,7 @@ func GetName(name string) (*ctypes.ResultGetName, error) {
 
 func ListNames() (*ctypes.ResultListNames, error) {
 	var blockHeight int
-	var names []*types.NameRegEntry
+	var names []*txs.NameRegEntry
 	state := erisdbApp.GetState()
 	blockHeight = state.LastBlockHeight
 	state.GetNames().Iterate(func(key []byte, value []byte) bool {
diff --git a/rpc/core/routes.go b/rpc/core/routes.go
index 80eee8a2..cb527569 100644
--- a/rpc/core/routes.go
+++ b/rpc/core/routes.go
@@ -129,7 +129,7 @@ func GenPrivAccountResult() (ctypes.ErisDBResult, error) {
 	}
 }
 
-func SignTxResult(tx types.Tx, privAccounts []*acm.PrivAccount) (ctypes.ErisDBResult, error) {
+func SignTxResult(tx txs.Tx, privAccounts []*acm.PrivAccount) (ctypes.ErisDBResult, error) {
 	if r, err := SignTx(tx, privAccounts); err != nil {
 		return nil, err
 	} else {
@@ -137,7 +137,7 @@ func SignTxResult(tx types.Tx, privAccounts []*acm.PrivAccount) (ctypes.ErisDBRe
 	}
 }
 
-func BroadcastTxResult(tx types.Tx) (ctypes.ErisDBResult, error) {
+func BroadcastTxResult(tx txs.Tx) (ctypes.ErisDBResult, error) {
 	if r, err := BroadcastTxSync(tx); err != nil {
 		return nil, err
 	} else {
diff --git a/rpc/core/txs.go b/rpc/core/txs.go
index 7a93dec4..2029ce01 100644
--- a/rpc/core/txs.go
+++ b/rpc/core/txs.go
@@ -2,6 +2,7 @@ package core
 
 import (
 	"fmt"
+
 	acm "github.com/eris-ltd/eris-db/account"
 	"github.com/eris-ltd/eris-db/evm"
 	ctypes "github.com/eris-ltd/eris-db/rpc/core/types"
@@ -79,7 +80,7 @@ func CallCode(fromAddress, code, data []byte) (*ctypes.ResultCall, error) {
 
 //-----------------------------------------------------------------------------
 
-func SignTx(tx types.Tx, privAccounts []*acm.PrivAccount) (*ctypes.ResultSignTx, error) {
+func SignTx(tx txs.Tx, privAccounts []*acm.PrivAccount) (*ctypes.ResultSignTx, error) {
 	// more checks?
 
 	for i, privAccount := range privAccounts {
@@ -88,18 +89,18 @@ func SignTx(tx types.Tx, privAccounts []*acm.PrivAccount) (*ctypes.ResultSignTx,
 		}
 	}
 	switch tx.(type) {
-	case *types.SendTx:
-		sendTx := tx.(*types.SendTx)
+	case *txs.SendTx:
+		sendTx := tx.(*txs.SendTx)
 		for i, input := range sendTx.Inputs {
 			input.PubKey = privAccounts[i].PubKey
 			input.Signature = privAccounts[i].Sign(config.GetString("erisdb.chain_id"), sendTx)
 		}
-	case *types.CallTx:
-		callTx := tx.(*types.CallTx)
+	case *txs.CallTx:
+		callTx := tx.(*txs.CallTx)
 		callTx.Input.PubKey = privAccounts[0].PubKey
 		callTx.Input.Signature = privAccounts[0].Sign(config.GetString("erisdb.chain_id"), callTx)
-	case *types.BondTx:
-		bondTx := tx.(*types.BondTx)
+	case *txs.BondTx:
+		bondTx := tx.(*txs.BondTx)
 		// the first privaccount corresponds to the BondTx pub key.
 		// the rest to the inputs
 		bondTx.Signature = privAccounts[0].Sign(config.GetString("erisdb.chain_id"), bondTx).(crypto.SignatureEd25519)
@@ -107,11 +108,11 @@ func SignTx(tx types.Tx, privAccounts []*acm.PrivAccount) (*ctypes.ResultSignTx,
 			input.PubKey = privAccounts[i+1].PubKey
 			input.Signature = privAccounts[i+1].Sign(config.GetString("erisdb.chain_id"), bondTx)
 		}
-	case *types.UnbondTx:
-		unbondTx := tx.(*types.UnbondTx)
+	case *txs.UnbondTx:
+		unbondTx := tx.(*txs.UnbondTx)
 		unbondTx.Signature = privAccounts[0].Sign(config.GetString("erisdb.chain_id"), unbondTx).(crypto.SignatureEd25519)
-	case *types.RebondTx:
-		rebondTx := tx.(*types.RebondTx)
+	case *txs.RebondTx:
+		rebondTx := tx.(*txs.RebondTx)
 		rebondTx.Signature = privAccounts[0].Sign(config.GetString("erisdb.chain_id"), rebondTx).(crypto.SignatureEd25519)
 	}
 	return &ctypes.ResultSignTx{tx}, nil
diff --git a/rpc/test/client_ws_test.go b/rpc/test/client_ws_test.go
index 94e85508..7cb64ecd 100644
--- a/rpc/test/client_ws_test.go
+++ b/rpc/test/client_ws_test.go
@@ -22,7 +22,7 @@ func TestWSConnect(t *testing.T) {
 // receive a new block message
 func TestWSNewBlock(t *testing.T) {
 	wsc := newWSClient(t)
-	eid := types.EventStringNewBlock()
+	eid := txs.EventStringNewBlock()
 	subscribe(t, wsc, eid)
 	defer func() {
 		unsubscribe(t, wsc, eid)
@@ -40,7 +40,7 @@ func TestWSBlockchainGrowth(t *testing.T) {
 		t.Skip("skipping test in short mode.")
 	}
 	wsc := newWSClient(t)
-	eid := types.EventStringNewBlock()
+	eid := txs.EventStringNewBlock()
 	subscribe(t, wsc, eid)
 	defer func() {
 		unsubscribe(t, wsc, eid)
@@ -56,8 +56,8 @@ func TestWSSend(t *testing.T) {
 	amt := int64(100)
 
 	wsc := newWSClient(t)
-	eidInput := types.EventStringAccInput(user[0].Address)
-	eidOutput := types.EventStringAccOutput(toAddr)
+	eidInput := txs.EventStringAccInput(user[0].Address)
+	eidOutput := txs.EventStringAccOutput(toAddr)
 	subscribe(t, wsc, eidInput)
 	subscribe(t, wsc, eidOutput)
 	defer func() {
@@ -78,7 +78,7 @@ func TestWSDoubleFire(t *testing.T) {
 		t.Skip("skipping test in short mode.")
 	}
 	wsc := newWSClient(t)
-	eid := types.EventStringAccInput(user[0].Address)
+	eid := txs.EventStringAccInput(user[0].Address)
 	subscribe(t, wsc, eid)
 	defer func() {
 		unsubscribe(t, wsc, eid)
@@ -106,7 +106,7 @@ func TestWSCallWait(t *testing.T) {
 		t.Skip("skipping test in short mode.")
 	}
 	wsc := newWSClient(t)
-	eid1 := types.EventStringAccInput(user[0].Address)
+	eid1 := txs.EventStringAccInput(user[0].Address)
 	subscribe(t, wsc, eid1)
 	defer func() {
 		unsubscribe(t, wsc, eid1)
@@ -124,7 +124,7 @@ func TestWSCallWait(t *testing.T) {
 
 	// susbscribe to the new contract
 	amt = int64(10001)
-	eid2 := types.EventStringAccOutput(contractAddr)
+	eid2 := txs.EventStringAccOutput(contractAddr)
 	subscribe(t, wsc, eid2)
 	defer func() {
 		unsubscribe(t, wsc, eid2)
@@ -154,7 +154,7 @@ func TestWSCallNoWait(t *testing.T) {
 
 	// susbscribe to the new contract
 	amt = int64(10001)
-	eid := types.EventStringAccOutput(contractAddr)
+	eid := txs.EventStringAccOutput(contractAddr)
 	subscribe(t, wsc, eid)
 	defer func() {
 		unsubscribe(t, wsc, eid)
@@ -190,7 +190,7 @@ func TestWSCallCall(t *testing.T) {
 
 	// susbscribe to the new contracts
 	amt = int64(10001)
-	eid1 := types.EventStringAccCall(contractAddr1)
+	eid1 := txs.EventStringAccCall(contractAddr1)
 	subscribe(t, wsc, eid1)
 	defer func() {
 		unsubscribe(t, wsc, eid1)
@@ -207,6 +207,6 @@ func TestWSCallCall(t *testing.T) {
 	waitForEvent(t, wsc, eid1, true, func() {
 		tx := makeDefaultCallTx(t, wsTyp, contractAddr2, nil, amt, gasLim, fee)
 		broadcastTx(t, wsTyp, tx)
-		*txid = types.TxID(chainID, tx)
+		*txid = txs.TxID(chainID, tx)
 	}, unmarshalValidateCall(user[0].Address, returnVal, txid))
 }
diff --git a/rpc/test/tests.go b/rpc/test/tests.go
index b6ed2c84..8b0552a5 100644
--- a/rpc/test/tests.go
+++ b/rpc/test/tests.go
@@ -62,15 +62,15 @@ func testSignedTx(t *testing.T, typ string) {
 func testOneSignTx(t *testing.T, typ string, addr []byte, amt int64) {
 	tx := makeDefaultSendTx(t, typ, addr, amt)
 	tx2 := signTx(t, typ, tx, user[0])
-	tx2hash := types.TxID(chainID, tx2)
+	tx2hash := txs.TxID(chainID, tx2)
 	tx.SignInput(chainID, 0, user[0])
-	txhash := types.TxID(chainID, tx)
+	txhash := txs.TxID(chainID, tx)
 	if bytes.Compare(txhash, tx2hash) != 0 {
 		t.Fatal("Got different signatures for signing via rpc vs tx_utils")
 	}
 
 	tx_ := signTx(t, typ, tx, user[0])
-	tx = tx_.(*types.SendTx)
+	tx = tx_.(*txs.SendTx)
 	checkTx(t, user[0].Address, user[0], tx)
 }
 
@@ -86,11 +86,11 @@ func testBroadcastTx(t *testing.T, typ string) {
 		t.Fatal("Failed to compute tx hash")
 	}
 	pool := node.MempoolReactor().Mempool
-	txs := pool.Reap(-1)
-	if len(txs) != mempoolCount {
-		t.Fatalf("The mem pool has %d txs. Expected %d", len(txs), mempoolCount)
+	trnxs := pool.Reap(-1)
+	if len(trnxs) != mempoolCount {
+		t.Fatalf("The mem pool has %d txs. Expected %d", len(trnxs), mempoolCount)
 	}
-	tx2 := types.DecodeTx(txs[mempoolCount-1]).(*types.SendTx)
+	tx2 := txs.DecodeTx(trnxs[mempoolCount-1]).(*txs.SendTx)
 	n, err := new(int), new(error)
 	buf1, buf2 := new(bytes.Buffer), new(bytes.Buffer)
 	tx.WriteSignBytes(chainID, buf1, n, err)
@@ -102,7 +102,7 @@ func testBroadcastTx(t *testing.T, typ string) {
 
 func testGetStorage(t *testing.T, typ string) {
 	wsc := newWSClient(t)
-	eid := types.EventStringNewBlock()
+	eid := txs.EventStringNewBlock()
 	subscribe(t, wsc, eid)
 	defer func() {
 		unsubscribe(t, wsc, eid)
@@ -154,7 +154,7 @@ func testCallCode(t *testing.T, typ string) {
 
 func testCall(t *testing.T, typ string) {
 	wsc := newWSClient(t)
-	eid := types.EventStringNewBlock()
+	eid := txs.EventStringNewBlock()
 	subscribe(t, wsc, eid)
 	defer func() {
 		unsubscribe(t, wsc, eid)
@@ -194,7 +194,7 @@ func testNameReg(t *testing.T, typ string) {
 	client := clients[typ]
 	wsc := newWSClient(t)
 
-	types.MinNameRegistrationPeriod = 1
+	txs.MinNameRegistrationPeriod = 1
 
 	// register a new name, check if its there
 	// since entries ought to be unique and these run against different clients, we append the typ
@@ -202,9 +202,9 @@ func testNameReg(t *testing.T, typ string) {
 	data := "if not now, when"
 	fee := int64(1000)
 	numDesiredBlocks := int64(2)
-	amt := fee + numDesiredBlocks*types.NameByteCostMultiplier*types.NameBlockCostMultiplier*types.NameBaseCost(name, data)
+	amt := fee + numDesiredBlocks*txs.NameByteCostMultiplier*txs.NameBlockCostMultiplier*txs.NameBaseCost(name, data)
 
-	eid := types.EventStringNameReg(name)
+	eid := txs.EventStringNameReg(name)
 	subscribe(t, wsc, eid)
 
 	tx := makeDefaultNameTx(t, typ, name, data, amt, fee)
@@ -238,7 +238,7 @@ func testNameReg(t *testing.T, typ string) {
 
 	// for the rest we just use new block event
 	// since we already tested the namereg event
-	eid = types.EventStringNewBlock()
+	eid = txs.EventStringNewBlock()
 	subscribe(t, wsc, eid)
 	defer func() {
 		unsubscribe(t, wsc, eid)
@@ -248,7 +248,7 @@ func testNameReg(t *testing.T, typ string) {
 	// update the data as the owner, make sure still there
 	numDesiredBlocks = int64(2)
 	data = "these are amongst the things I wish to bestow upon the youth of generations come: a safe supply of honey, and a better money. For what else shall they need"
-	amt = fee + numDesiredBlocks*types.NameByteCostMultiplier*types.NameBlockCostMultiplier*types.NameBaseCost(name, data)
+	amt = fee + numDesiredBlocks*txs.NameByteCostMultiplier*txs.NameBlockCostMultiplier*txs.NameBaseCost(name, data)
 	tx = makeDefaultNameTx(t, typ, name, data, amt, fee)
 	broadcastTx(t, typ, tx)
 	// commit block
@@ -262,7 +262,7 @@ func testNameReg(t *testing.T, typ string) {
 	// try to update as non owner, should fail
 	nonce := getNonce(t, typ, user[1].Address)
 	data2 := "this is not my beautiful house"
-	tx = types.NewNameTxWithNonce(user[1].PubKey, name, data2, amt, fee, nonce+1)
+	tx = txs.NewNameTxWithNonce(user[1].PubKey, name, data2, amt, fee, nonce+1)
 	tx.Sign(chainID, user[1])
 	_, err := edbcli.BroadcastTx(client, tx)
 	if err == nil {
diff --git a/state/block_cache.go b/state/block_cache.go
index a0d282ed..1cefa6a3 100644
--- a/state/block_cache.go
+++ b/state/block_cache.go
@@ -120,7 +120,7 @@ func (cache *BlockCache) SetStorage(addr Word256, key Word256, value Word256) {
 //-------------------------------------
 // BlockCache.names
 
-func (cache *BlockCache) GetNameRegEntry(name string) *types.NameRegEntry {
+func (cache *BlockCache) GetNameRegEntry(name string) *txs.NameRegEntry {
 	entry, removed, _ := cache.names[name].unpack()
 	if removed {
 		return nil
@@ -133,7 +133,7 @@ func (cache *BlockCache) GetNameRegEntry(name string) *types.NameRegEntry {
 	}
 }
 
-func (cache *BlockCache) UpdateNameRegEntry(entry *types.NameRegEntry) {
+func (cache *BlockCache) UpdateNameRegEntry(entry *txs.NameRegEntry) {
 	name := entry.Name
 	cache.names[name] = nameInfo{entry, false, true}
 }
@@ -278,11 +278,11 @@ func (stjInfo storageInfo) unpack() (Word256, bool) {
 }
 
 type nameInfo struct {
-	name    *types.NameRegEntry
+	name    *txs.NameRegEntry
 	removed bool
 	dirty   bool
 }
 
-func (nInfo nameInfo) unpack() (*types.NameRegEntry, bool, bool) {
+func (nInfo nameInfo) unpack() (*txs.NameRegEntry, bool, bool) {
 	return nInfo.name, nInfo.removed, nInfo.dirty
 }
diff --git a/state/execution.go b/state/execution.go
index bb635d0c..7247dd50 100644
--- a/state/execution.go
+++ b/state/execution.go
@@ -22,7 +22,7 @@ import (
 
 // NOTE: If an error occurs during block execution, state will be left
 // at an invalid state.  Copy the state before calling ExecBlock!
-func ExecBlock(s *State, block *types.Block, blockPartsHeader types.PartSetHeader) error {
+func ExecBlock(s *State, block *txs.Block, blockPartsHeader txs.PartSetHeader) error {
 	err := execBlock(s, block, blockPartsHeader)
 	if err != nil {
 		return err
@@ -39,7 +39,7 @@ func ExecBlock(s *State, block *types.Block, blockPartsHeader types.PartSetHeade
 // executes transactions of a block, does not check block.StateHash
 // NOTE: If an error occurs during block execution, state will be left
 // at an invalid state.  Copy the state before calling execBlock!
-func execBlock(s *State, block *types.Block, blockPartsHeader types.PartSetHeader) error {
+func execBlock(s *State, block *txs.Block, blockPartsHeader txs.PartSetHeader) error {
 	// Basic block validation.
 	err := block.ValidateBasic(s.ChainID, s.LastBlockHeight, s.LastBlockHash, s.LastBlockParts, s.LastBlockTime)
 	if err != nil {
@@ -108,8 +108,8 @@ func execBlock(s *State, block *types.Block, blockPartsHeader types.PartSetHeade
 
 	// If any unbonding periods are over,
 	// reward account with bonded coins.
-	toRelease := []*types.Validator{}
-	s.UnbondingValidators.Iterate(func(index int, val *types.Validator) bool {
+	toRelease := []*txs.Validator{}
+	s.UnbondingValidators.Iterate(func(index int, val *txs.Validator) bool {
 		if val.UnbondHeight+unbondingPeriodBlocks < block.Height {
 			toRelease = append(toRelease, val)
 		}
@@ -121,8 +121,8 @@ func execBlock(s *State, block *types.Block, blockPartsHeader types.PartSetHeade
 
 	// If any validators haven't signed in a while,
 	// unbond them, they have timed out.
-	toTimeout := []*types.Validator{}
-	s.BondedValidators.Iterate(func(index int, val *types.Validator) bool {
+	toTimeout := []*txs.Validator{}
+	s.BondedValidators.Iterate(func(index int, val *txs.Validator) bool {
 		lastActivityHeight := MaxInt(val.BondHeight, val.LastCommitHeight)
 		if lastActivityHeight+validatorTimeoutBlocks < block.Height {
 			log.Notice("Validator timeout", "validator", val, "height", block.Height)
@@ -148,16 +148,16 @@ func execBlock(s *State, block *types.Block, blockPartsHeader types.PartSetHeade
 // acm.PubKey.(type) != nil, (it must be known),
 // or it must be specified in the TxInput.  If redeclared,
 // the TxInput is modified and input.PubKey set to nil.
-func getInputs(state AccountGetter, ins []*types.TxInput) (map[string]*acm.Account, error) {
+func getInputs(state AccountGetter, ins []*txs.TxInput) (map[string]*acm.Account, error) {
 	accounts := map[string]*acm.Account{}
 	for _, in := range ins {
 		// Account shouldn't be duplicated
 		if _, ok := accounts[string(in.Address)]; ok {
-			return nil, types.ErrTxDuplicateAddress
+			return nil, txs.ErrTxDuplicateAddress
 		}
 		acc := state.GetAccount(in.Address)
 		if acc == nil {
-			return nil, types.ErrTxInvalidAddress
+			return nil, txs.ErrTxInvalidAddress
 		}
 		// PubKey should be present in either "account" or "in"
 		if err := checkInputPubKey(acc, in); err != nil {
@@ -168,7 +168,7 @@ func getInputs(state AccountGetter, ins []*types.TxInput) (map[string]*acm.Accou
 	return accounts, nil
 }
 
-func getOrMakeOutputs(state AccountGetter, accounts map[string]*acm.Account, outs []*types.TxOutput) (map[string]*acm.Account, error) {
+func getOrMakeOutputs(state AccountGetter, accounts map[string]*acm.Account, outs []*txs.TxOutput) (map[string]*acm.Account, error) {
 	if accounts == nil {
 		accounts = make(map[string]*acm.Account)
 	}
@@ -178,7 +178,7 @@ func getOrMakeOutputs(state AccountGetter, accounts map[string]*acm.Account, out
 	for _, out := range outs {
 		// Account shouldn't be duplicated
 		if _, ok := accounts[string(out.Address)]; ok {
-			return nil, types.ErrTxDuplicateAddress
+			return nil, txs.ErrTxDuplicateAddress
 		}
 		acc := state.GetAccount(out.Address)
 		// output account may be nil (new)
@@ -202,13 +202,13 @@ func getOrMakeOutputs(state AccountGetter, accounts map[string]*acm.Account, out
 	return accounts, nil
 }
 
-func checkInputPubKey(acc *acm.Account, in *types.TxInput) error {
+func checkInputPubKey(acc *acm.Account, in *txs.TxInput) error {
 	if acc.PubKey == nil {
 		if in.PubKey == nil {
-			return types.ErrTxUnknownPubKey
+			return txs.ErrTxUnknownPubKey
 		}
 		if !bytes.Equal(in.PubKey.Address(), acc.Address) {
-			return types.ErrTxInvalidPubKey
+			return txs.ErrTxInvalidPubKey
 		}
 		acc.PubKey = in.PubKey
 	} else {
@@ -217,7 +217,7 @@ func checkInputPubKey(acc *acm.Account, in *types.TxInput) error {
 	return nil
 }
 
-func validateInputs(accounts map[string]*acm.Account, signBytes []byte, ins []*types.TxInput) (total int64, err error) {
+func validateInputs(accounts map[string]*acm.Account, signBytes []byte, ins []*txs.TxInput) (total int64, err error) {
 	for _, in := range ins {
 		acc := accounts[string(in.Address)]
 		if acc == nil {
@@ -233,30 +233,30 @@ func validateInputs(accounts map[string]*acm.Account, signBytes []byte, ins []*t
 	return total, nil
 }
 
-func validateInput(acc *acm.Account, signBytes []byte, in *types.TxInput) (err error) {
+func validateInput(acc *acm.Account, signBytes []byte, in *txs.TxInput) (err error) {
 	// Check TxInput basic
 	if err := in.ValidateBasic(); err != nil {
 		return err
 	}
 	// Check signatures
 	if !acc.PubKey.VerifyBytes(signBytes, in.Signature) {
-		return types.ErrTxInvalidSignature
+		return txs.ErrTxInvalidSignature
 	}
 	// Check sequences
 	if acc.Sequence+1 != in.Sequence {
-		return types.ErrTxInvalidSequence{
+		return txs.ErrTxInvalidSequence{
 			Got:      in.Sequence,
 			Expected: acc.Sequence + 1,
 		}
 	}
 	// Check amount
 	if acc.Balance < in.Amount {
-		return types.ErrTxInsufficientFunds
+		return txs.ErrTxInsufficientFunds
 	}
 	return nil
 }
 
-func validateOutputs(outs []*types.TxOutput) (total int64, err error) {
+func validateOutputs(outs []*txs.TxOutput) (total int64, err error) {
 	for _, out := range outs {
 		// Check TxOutput basic
 		if err := out.ValidateBasic(); err != nil {
@@ -268,7 +268,7 @@ func validateOutputs(outs []*types.TxOutput) (total int64, err error) {
 	return total, nil
 }
 
-func adjustByInputs(accounts map[string]*acm.Account, ins []*types.TxInput) {
+func adjustByInputs(accounts map[string]*acm.Account, ins []*txs.TxInput) {
 	for _, in := range ins {
 		acc := accounts[string(in.Address)]
 		if acc == nil {
@@ -282,7 +282,7 @@ func adjustByInputs(accounts map[string]*acm.Account, ins []*types.TxInput) {
 	}
 }
 
-func adjustByOutputs(accounts map[string]*acm.Account, outs []*types.TxOutput) {
+func adjustByOutputs(accounts map[string]*acm.Account, outs []*txs.TxOutput) {
 	for _, out := range outs {
 		acc := accounts[string(out.Address)]
 		if acc == nil {
@@ -294,7 +294,7 @@ func adjustByOutputs(accounts map[string]*acm.Account, outs []*types.TxOutput) {
 
 // If the tx is invalid, an error will be returned.
 // Unlike ExecBlock(), state will not be altered.
-func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireable) (err error) {
+func ExecTx(blockCache *BlockCache, tx txs.Tx, runCall bool, evc events.Fireable) (err error) {
 
 	// TODO: do something with fees
 	fees := int64(0)
@@ -302,7 +302,7 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 
 	// Exec tx
 	switch tx := tx.(type) {
-	case *types.SendTx:
+	case *txs.SendTx:
 		accounts, err := getInputs(blockCache, tx.Inputs)
 		if err != nil {
 			return err
@@ -330,7 +330,7 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 			return err
 		}
 		if outTotal > inTotal {
-			return types.ErrTxInsufficientFunds
+			return txs.ErrTxInsufficientFunds
 		}
 		fee := inTotal - outTotal
 		fees += fee
@@ -345,23 +345,23 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 		// if the evc is nil, nothing will happen
 		if evc != nil {
 			for _, i := range tx.Inputs {
-				evc.FireEvent(types.EventStringAccInput(i.Address), types.EventDataTx{tx, nil, ""})
+				evc.FireEvent(txs.EventStringAccInput(i.Address), txs.EventDataTx{tx, nil, ""})
 			}
 
 			for _, o := range tx.Outputs {
-				evc.FireEvent(types.EventStringAccOutput(o.Address), types.EventDataTx{tx, nil, ""})
+				evc.FireEvent(txs.EventStringAccOutput(o.Address), txs.EventDataTx{tx, nil, ""})
 			}
 		}
 		return nil
 
-	case *types.CallTx:
+	case *txs.CallTx:
 		var inAcc, outAcc *acm.Account
 
 		// Validate input
 		inAcc = blockCache.GetAccount(tx.Input.Address)
 		if inAcc == nil {
 			log.Info(Fmt("Can't find in account %X", tx.Input.Address))
-			return types.ErrTxInvalidAddress
+			return txs.ErrTxInvalidAddress
 		}
 
 		createContract := len(tx.Address) == 0
@@ -388,14 +388,14 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 		}
 		if tx.Input.Amount < tx.Fee {
 			log.Info(Fmt("Sender did not send enough to cover the fee %X", tx.Input.Address))
-			return types.ErrTxInsufficientFunds
+			return txs.ErrTxInsufficientFunds
 		}
 
 		if !createContract {
 			// Validate output
 			if len(tx.Address) != 20 {
 				log.Info(Fmt("Destination address is not 20 bytes %X", tx.Address))
-				return types.ErrTxInvalidAddress
+				return txs.ErrTxInvalidAddress
 			}
 			// check if its a native contract
 			if vm.RegisteredNativeContract(LeftPadWord256(tx.Address)) {
@@ -451,7 +451,7 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 					log.Info(Fmt("%X tries to call %X but code is blank.",
 						inAcc.Address, tx.Address))
 				}
-				err = types.ErrTxInvalidAddress
+				err = txs.ErrTxInvalidAddress
 				goto CALL_COMPLETE
 			}
 
@@ -473,7 +473,7 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 				// Write caller/callee to txCache.
 				txCache.UpdateAccount(caller)
 				txCache.UpdateAccount(callee)
-				vmach := vm.NewVM(txCache, params, caller.Address, types.TxID(_s.ChainID, tx))
+				vmach := vm.NewVM(txCache, params, caller.Address, txs.TxID(_s.ChainID, tx))
 				vmach.SetFireable(evc)
 				// NOTE: Call() transfers the value from caller to callee iff call succeeds.
 				ret, err = vmach.Call(caller, callee, code, tx.Data, value, &gas)
@@ -502,8 +502,8 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 				if err != nil {
 					exception = err.Error()
 				}
-				evc.FireEvent(types.EventStringAccInput(tx.Input.Address), types.EventDataTx{tx, ret, exception})
-				evc.FireEvent(types.EventStringAccOutput(tx.Address), types.EventDataTx{tx, ret, exception})
+				evc.FireEvent(txs.EventStringAccInput(tx.Input.Address), txs.EventDataTx{tx, ret, exception})
+				evc.FireEvent(txs.EventStringAccOutput(tx.Address), txs.EventDataTx{tx, ret, exception})
 			}
 		} else {
 			// The mempool does not call txs until
@@ -519,14 +519,14 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 
 		return nil
 
-	case *types.NameTx:
+	case *txs.NameTx:
 		var inAcc *acm.Account
 
 		// Validate input
 		inAcc = blockCache.GetAccount(tx.Input.Address)
 		if inAcc == nil {
 			log.Info(Fmt("Can't find in account %X", tx.Input.Address))
-			return types.ErrTxInvalidAddress
+			return txs.ErrTxInvalidAddress
 		}
 		// check permission
 		if !hasNamePermission(blockCache, inAcc) {
@@ -546,7 +546,7 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 		// fee is in addition to the amount which is used to determine the TTL
 		if tx.Input.Amount < tx.Fee {
 			log.Info(Fmt("Sender did not send enough to cover the fee %X", tx.Input.Address))
-			return types.ErrTxInsufficientFunds
+			return txs.ErrTxInsufficientFunds
 		}
 
 		// validate the input strings
@@ -557,7 +557,7 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 		value := tx.Input.Amount - tx.Fee
 
 		// let's say cost of a name for one block is len(data) + 32
-		costPerBlock := types.NameCostPerBlock(types.NameBaseCost(tx.Name, tx.Data))
+		costPerBlock := txs.NameCostPerBlock(txs.NameBaseCost(tx.Name, tx.Data))
 		expiresIn := int(value / costPerBlock)
 		lastBlockHeight := _s.LastBlockHeight
 
@@ -573,7 +573,7 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 				// ensure we are owner
 				if bytes.Compare(entry.Owner, tx.Input.Address) != 0 {
 					log.Info(Fmt("Sender %X is trying to update a name (%s) for which he is not owner", tx.Input.Address, tx.Name))
-					return types.ErrTxPermissionDenied
+					return txs.ErrTxPermissionDenied
 				}
 			} else {
 				expired = true
@@ -589,8 +589,8 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 				// update the entry by bumping the expiry
 				// and changing the data
 				if expired {
-					if expiresIn < types.MinNameRegistrationPeriod {
-						return errors.New(Fmt("Names must be registered for at least %d blocks", types.MinNameRegistrationPeriod))
+					if expiresIn < txs.MinNameRegistrationPeriod {
+						return errors.New(Fmt("Names must be registered for at least %d blocks", txs.MinNameRegistrationPeriod))
 					}
 					entry.Expires = lastBlockHeight + expiresIn
 					entry.Owner = tx.Input.Address
@@ -598,11 +598,11 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 				} else {
 					// since the size of the data may have changed
 					// we use the total amount of "credit"
-					oldCredit := int64(entry.Expires-lastBlockHeight) * types.NameBaseCost(entry.Name, entry.Data)
+					oldCredit := int64(entry.Expires-lastBlockHeight) * txs.NameBaseCost(entry.Name, entry.Data)
 					credit := oldCredit + value
 					expiresIn = int(credit / costPerBlock)
-					if expiresIn < types.MinNameRegistrationPeriod {
-						return errors.New(Fmt("Names must be registered for at least %d blocks", types.MinNameRegistrationPeriod))
+					if expiresIn < txs.MinNameRegistrationPeriod {
+						return errors.New(Fmt("Names must be registered for at least %d blocks", txs.MinNameRegistrationPeriod))
 					}
 					entry.Expires = lastBlockHeight + expiresIn
 					log.Info("Updated namereg entry", "name", entry.Name, "expiresIn", expiresIn, "oldCredit", oldCredit, "value", value, "credit", credit)
@@ -611,11 +611,11 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 				blockCache.UpdateNameRegEntry(entry)
 			}
 		} else {
-			if expiresIn < types.MinNameRegistrationPeriod {
-				return errors.New(Fmt("Names must be registered for at least %d blocks", types.MinNameRegistrationPeriod))
+			if expiresIn < txs.MinNameRegistrationPeriod {
+				return errors.New(Fmt("Names must be registered for at least %d blocks", txs.MinNameRegistrationPeriod))
 			}
 			// entry does not exist, so create it
-			entry = &types.NameRegEntry{
+			entry = &txs.NameRegEntry{
 				Name:    tx.Name,
 				Owner:   tx.Input.Address,
 				Data:    tx.Data,
@@ -635,8 +635,8 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 		// TODO: maybe we want to take funds on error and allow txs in that don't do anythingi?
 
 		if evc != nil {
-			evc.FireEvent(types.EventStringAccInput(tx.Input.Address), types.EventDataTx{tx, nil, ""})
-			evc.FireEvent(types.EventStringNameReg(tx.Name), types.EventDataTx{tx, nil, ""})
+			evc.FireEvent(txs.EventStringAccInput(tx.Input.Address), txs.EventDataTx{tx, nil, ""})
+			evc.FireEvent(txs.EventStringNameReg(tx.Name), txs.EventDataTx{tx, nil, ""})
 		}
 
 		return nil
@@ -644,7 +644,7 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 		// Consensus related Txs inactivated for now
 		// TODO!
 		/*
-			case *types.BondTx:
+			case *txs.BondTx:
 						valInfo := blockCache.State().GetValidatorInfo(tx.PubKey.Address())
 						if valInfo != nil {
 							// TODO: In the future, check that the validator wasn't destroyed,
@@ -683,14 +683,14 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 							return err
 						}
 						if !tx.PubKey.VerifyBytes(signBytes, tx.Signature) {
-							return types.ErrTxInvalidSignature
+							return txs.ErrTxInvalidSignature
 						}
 						outTotal, err := validateOutputs(tx.UnbondTo)
 						if err != nil {
 							return err
 						}
 						if outTotal > inTotal {
-							return types.ErrTxInsufficientFunds
+							return txs.ErrTxInsufficientFunds
 						}
 						fee := inTotal - outTotal
 						fees += fee
@@ -701,7 +701,7 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 							blockCache.UpdateAccount(acc)
 						}
 						// Add ValidatorInfo
-						_s.SetValidatorInfo(&types.ValidatorInfo{
+						_s.SetValidatorInfo(&txs.ValidatorInfo{
 							Address:         tx.PubKey.Address(),
 							PubKey:          tx.PubKey,
 							UnbondTo:        tx.UnbondTo,
@@ -709,7 +709,7 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 							FirstBondAmount: outTotal,
 						})
 						// Add Validator
-						added := _s.BondedValidators.Add(&types.Validator{
+						added := _s.BondedValidators.Add(&txs.Validator{
 							Address:     tx.PubKey.Address(),
 							PubKey:      tx.PubKey,
 							BondHeight:  _s.LastBlockHeight + 1,
@@ -721,21 +721,21 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 						}
 						if evc != nil {
 							// TODO: fire for all inputs
-							evc.FireEvent(types.EventStringBond(), types.EventDataTx{tx, nil, ""})
+							evc.FireEvent(txs.EventStringBond(), txs.EventDataTx{tx, nil, ""})
 						}
 						return nil
 
-					case *types.UnbondTx:
+					case *txs.UnbondTx:
 						// The validator must be active
 						_, val := _s.BondedValidators.GetByAddress(tx.Address)
 						if val == nil {
-							return types.ErrTxInvalidAddress
+							return txs.ErrTxInvalidAddress
 						}
 
 						// Verify the signature
 						signBytes := acm.SignBytes(_s.ChainID, tx)
 						if !val.PubKey.VerifyBytes(signBytes, tx.Signature) {
-							return types.ErrTxInvalidSignature
+							return txs.ErrTxInvalidSignature
 						}
 
 						// tx.Height must be greater than val.LastCommitHeight
@@ -746,21 +746,21 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 						// Good!
 						_s.unbondValidator(val)
 						if evc != nil {
-							evc.FireEvent(types.EventStringUnbond(), types.EventDataTx{tx, nil, ""})
+							evc.FireEvent(txs.EventStringUnbond(), txs.EventDataTx{tx, nil, ""})
 						}
 						return nil
 
-					case *types.RebondTx:
+					case *txs.RebondTx:
 						// The validator must be inactive
 						_, val := _s.UnbondingValidators.GetByAddress(tx.Address)
 						if val == nil {
-							return types.ErrTxInvalidAddress
+							return txs.ErrTxInvalidAddress
 						}
 
 						// Verify the signature
 						signBytes := acm.SignBytes(_s.ChainID, tx)
 						if !val.PubKey.VerifyBytes(signBytes, tx.Signature) {
-							return types.ErrTxInvalidSignature
+							return txs.ErrTxInvalidSignature
 						}
 
 						// tx.Height must be in a suitable range
@@ -774,24 +774,24 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 						// Good!
 						_s.rebondValidator(val)
 						if evc != nil {
-							evc.FireEvent(types.EventStringRebond(), types.EventDataTx{tx, nil, ""})
+							evc.FireEvent(txs.EventStringRebond(), txs.EventDataTx{tx, nil, ""})
 						}
 						return nil
 
-					case *types.DupeoutTx:
+					case *txs.DupeoutTx:
 						// Verify the signatures
 						_, accused := _s.BondedValidators.GetByAddress(tx.Address)
 						if accused == nil {
 							_, accused = _s.UnbondingValidators.GetByAddress(tx.Address)
 							if accused == nil {
-								return types.ErrTxInvalidAddress
+								return txs.ErrTxInvalidAddress
 							}
 						}
 						voteASignBytes := acm.SignBytes(_s.ChainID, &tx.VoteA)
 						voteBSignBytes := acm.SignBytes(_s.ChainID, &tx.VoteB)
 						if !accused.PubKey.VerifyBytes(voteASignBytes, tx.VoteA.Signature) ||
 							!accused.PubKey.VerifyBytes(voteBSignBytes, tx.VoteB.Signature) {
-							return types.ErrTxInvalidSignature
+							return txs.ErrTxInvalidSignature
 						}
 
 						// Verify equivocation
@@ -813,19 +813,19 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 						// Good! (Bad validator!)
 						_s.destroyValidator(accused)
 						if evc != nil {
-							evc.FireEvent(types.EventStringDupeout(), types.EventDataTx{tx, nil, ""})
+							evc.FireEvent(txs.EventStringDupeout(), txs.EventDataTx{tx, nil, ""})
 						}
 						return nil
 		*/
 
-	case *types.PermissionsTx:
+	case *txs.PermissionsTx:
 		var inAcc *acm.Account
 
 		// Validate input
 		inAcc = blockCache.GetAccount(tx.Input.Address)
 		if inAcc == nil {
 			log.Debug(Fmt("Can't find in account %X", tx.Input.Address))
-			return types.ErrTxInvalidAddress
+			return txs.ErrTxInvalidAddress
 		}
 
 		permFlag := tx.PermArgs.PermFlag()
@@ -904,8 +904,8 @@ func ExecTx(blockCache *BlockCache, tx types.Tx, runCall bool, evc events.Fireab
 		}
 
 		if evc != nil {
-			evc.FireEvent(types.EventStringAccInput(tx.Input.Address), types.EventDataTx{tx, nil, ""})
-			evc.FireEvent(types.EventStringPermissions(ptypes.PermFlagToString(permFlag)), types.EventDataTx{tx, nil, ""})
+			evc.FireEvent(txs.EventStringAccInput(tx.Input.Address), txs.EventDataTx{tx, nil, ""})
+			evc.FireEvent(txs.EventStringPermissions(ptypes.PermFlagToString(permFlag)), txs.EventDataTx{tx, nil, ""})
 		}
 
 		return nil
@@ -996,7 +996,7 @@ func hasBondOrSendPermission(state AccountGetter, accs map[string]*acm.Account)
 //-----------------------------------------------------------------------------
 
 type InvalidTxError struct {
-	Tx     types.Tx
+	Tx     txs.Tx
 	Reason error
 }
 
diff --git a/state/tx_cache.go b/state/tx_cache.go
index 0bc4a801..292c3531 100644
--- a/state/tx_cache.go
+++ b/state/tx_cache.go
@@ -142,7 +142,7 @@ func (cache *TxCache) Sync() {
 
 // Convenience function to return address of new contract
 func NewContractAddress(caller []byte, nonce int) []byte {
-	return types.NewContractAddress(caller, nonce)
+	return txs.NewContractAddress(caller, nonce)
 }
 
 // Converts backend.Account to vm.Account struct.
diff --git a/txs/config.go b/txs/config.go
index cb982879..aa534896 100644
--- a/txs/config.go
+++ b/txs/config.go
@@ -1,4 +1,4 @@
-package types
+package txs
 
 import (
 	cfg "github.com/tendermint/go-config"
diff --git a/txs/events.go b/txs/events.go
index edf7046c..14185c3a 100644
--- a/txs/events.go
+++ b/txs/events.go
@@ -1,4 +1,4 @@
-package types
+package txs
 
 import (
 	"fmt"
diff --git a/txs/log.go b/txs/log.go
index dbe8a678..b967a58d 100644
--- a/txs/log.go
+++ b/txs/log.go
@@ -1,4 +1,4 @@
-package types
+package txs
 
 import (
 	"github.com/tendermint/go-logger"
diff --git a/txs/names.go b/txs/names.go
index 7c170141..ddaec87d 100644
--- a/txs/names.go
+++ b/txs/names.go
@@ -1,4 +1,4 @@
-package types
+package txs
 
 import (
 	"regexp"
diff --git a/txs/tx.go b/txs/tx.go
index d84807ed..e6d49bc0 100644
--- a/txs/tx.go
+++ b/txs/tx.go
@@ -1,4 +1,4 @@
-package types
+package txs
 
 import (
 	"bytes"
diff --git a/txs/tx_test.go b/txs/tx_test.go
index 4e984fc3..92d0d408 100644
--- a/txs/tx_test.go
+++ b/txs/tx_test.go
@@ -1,4 +1,4 @@
-package types
+package txs
 
 import (
 	"testing"
diff --git a/txs/tx_utils.go b/txs/tx_utils.go
index f8ce376a..e6979510 100644
--- a/txs/tx_utils.go
+++ b/txs/tx_utils.go
@@ -1,4 +1,4 @@
-package types
+package txs
 
 import (
 	"fmt"
-- 
GitLab