So moving forward, we would like to retrieve all the contracts that are particular wallet address was part of. Just like how we store account information and block metadata, we will create a contract table.
The contract will have the following fields:
Version (unsigned 16 bit int)
Sender Public Key (blob)
Signature Length (unsigned 8 bit int)
Signature (blob)
Recipient public key hash (blob)
Value (unsigned 64 bit int)
State nonce (unsigned 64 bit int).
This issue is broken down into the following steps:
1 Adding sql statements.
Add the following constants with their appropriate string sql query command:
CREATE_CONTRACT_TABLE = sql query that will create the contract table is if already doesn't exist.
SELECT_CONTRACT_BY_SENDER_PUBLIC_KEY_AND_NONCE = sql query that will return all the contract information given a sender_public_key, nonce combination.
-INSERT_VALUES_INTO_CONTRACTS = sql query that inserts a contract into the contract table.
2 Adding contracts to contracts table.
Create a new package named contractstable with a contractstable.go file. . For now we will have the following functions
Branch:
contract_table
So moving forward, we would like to retrieve all the contracts that are particular wallet address was part of. Just like how we store account information and block metadata, we will create a contract table.
The contract will have the following fields:
This issue is broken down into the following steps:
1 Adding sql statements.
Add the following constants with their appropriate string sql query command:
CREATE_CONTRACT_TABLE
= sql query that will create the contract table is if already doesn't exist.SELECT_CONTRACT_BY_SENDER_PUBLIC_KEY_AND_NONCE
= sql query that will return all the contract information given a sender_public_key, nonce combination. -INSERT_VALUES_INTO_CONTRACTS
= sql query that inserts a contract into the contract table.2 Adding contracts to contracts table.
Create a new package named
contractstable
with acontractstable.go
file. . For now we will have the following functionsAddContract(dbConnection *sql.DB, contract* Contract)
AddContracts(dbConnection *sql.DB, contract []Contract)
RetrieveBySenderPubKeyNonce(dbConnection *sql.DB, pubKey ecdsa.PublicKey, uint64)