Skip to content

Generic propose blockchain for uses like office files, criptocurrency

Notifications You must be signed in to change notification settings

JoaoRafa19/crypto-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Teste Aprendendo Conceitos de Blockchain

Generic propose blockchain for uses like office files, criptocurrency

Test Coverage

Coverage

Features

  • Server
  • Block
    • Block's hash
    • Test
  • Transaction
    • Transaction list Hash
    • Test
  • Key
  • Transport => tcp, udp,
    • Local transport layer
  • Crypto Keypairs and signature
  • Block Signing
  • Blockchain struct
  • Storage (not memory storage)

Todos

Improvements and fixes that can be implemented

  • Add a database or a better storage method to store transactions and block data

Types

  • Hash
type Hash [32]uint8
type Address [20]uint8

Mistakes to remember

On the struct Transaction on Signing the transaction the object was missing the value of the transaction's Signature, returnning a null value

func TestSignTransaction(t *testing.T) {
	privateKey := crypto.GeneratePrivateKey()

	tx := &Transaction{
		Data: []byte("foo bar baz"),
	}

	assert.Nil(t, tx.Sign(privateKey))
	assert.NotNil(t, tx.Signature) // FAIL

}

Beacuse of the method signatue (tx T) insted of (tx *T), the object was missing the reference

old :

func (tx Transaction) Sign(privKey crypto.PrivateKey) error {

fixed:

func (tx *Transaction) Sign(privKey crypto.PrivateKey) error {

About

Generic propose blockchain for uses like office files, criptocurrency

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published