# Defining and Validating Blockchain Transactions in an In-Memory Accounting Database

DevFeed: [Defining and Validating Blockchain Transactions in an In-Memory Accounting Database](<https://devfeed.tech/articles/ultimate-go-advanced-engineering-episode-18-22207.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2023/01/ultimate-go-advanced-engineering-episode-18.html>)

Published: 2023-01-24T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Blockchain](<https://devfeed.tech/topics/blockchain.md>), [Transactions](<https://devfeed.tech/topics/transactions.md>), [data](<https://devfeed.tech/topics/data.md>), [Ethereum](<https://devfeed.tech/topics/ethereum.md>)

Tags: [bitcoin](<https://devfeed.tech/tags/bitcoin.md>), [blockchain](<https://devfeed.tech/tags/blockchain.md>), [blockchain-transaction](<https://devfeed.tech/tags/blockchain-transaction.md>), [code](<https://devfeed.tech/tags/code.md>), [data](<https://devfeed.tech/tags/data.md>), [ethereum](<https://devfeed.tech/tags/ethereum.md>), [factory-function](<https://devfeed.tech/tags/factory-function.md>), [function](<https://devfeed.tech/tags/function.md>), [go-blockchain](<https://devfeed.tech/tags/go-blockchain.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [learn](<https://devfeed.tech/tags/learn.md>), [reference](<https://devfeed.tech/tags/reference.md>), [transactions](<https://devfeed.tech/tags/transactions.md>), [types](<https://devfeed.tech/tags/types.md>), [video](<https://devfeed.tech/tags/video.md>)

## AI overview

This video explains how to define and validate transaction types for a blockchain's in-memory accounting database. It covers the transaction data type, field design, validation methods, nonce tokens, and a transaction factory function, with concepts borrowed from Ethereum for reference.

## Source excerpt

Introduction In episode 17, Bill began to design an in-memory accounting database that will store the account balances on his blockchain. To build this database, Bill will add a memory pool on each node that stores a list of public addresses with their respective balances. The balances on these addresses are reconstructed by reading the previous transaction records found on his blockchain. In this video, Bill will define the types of transactions his blockchain will support. The first step Bill takes is to define the transaction data type and give a full walkthrough of the reasoning behind the fields he chose for this data type. Next, he'll define methods for this type that will validate a transaction. While writing this code, Bill will borrow a few concepts from Ethereum to build a reference implementation. Watch to learn how transactions are managed on the blockchain and how to define one on your blockchain.