Skip to content

Commit

Permalink
[uml] refs fibercrypto#130 - PlantUML diagrams for API v1
Browse files Browse the repository at this point in the history
  • Loading branch information
olemis committed Dec 8, 2019
1 parent 9a3994c commit 1b28524
Show file tree
Hide file tree
Showing 4 changed files with 547 additions and 0 deletions.
10 changes: 10 additions & 0 deletions content/diagrams/plantuml/bitcoin.spv.bloom.uml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@startuml

participant "FiberCrypto Bitcoin SPV" as wallet
participant "Bitcoin node" as btcnode
wallet -> btcnode : filterload(nFlags=BLOOM_UPDATE_ALL, ...)
wallet -> btcnode : get(inventory_type=MSG_MERKLEBLOCK, ...)
wallet <-- btcnode : merkleblock(TXID1, TXID2, ...)
wallet -> wallet : validate_merkleblock

@enduml
179 changes: 179 additions & 0 deletions content/diagrams/plantuml/core.v1.simple.uml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@

@startuml
skinparam ClassBorderColor<< CryptoCurrencyToken >> Black
skinparam ClassBackgroundColor<< CryptoCurrencyToken >> White


interface CryptoAccount
interface Address
interface Iterator<T>
interface AddressIterator
interface TxnSigner
interface TxnSignerIterator
class Timestamp <<uint64>>
enum TransactionStatus
interface Transaction
interface TransactionIterator
interface TransactionInput
interface TransactionInputIterator
interface TransactionOutput
interface TransactionOutputIterator
interface Block
interface AltcoinPlugin
interface AltcoinManager
enum CoinValueMetric
interface BlockchainStatus
interface PEX
interface PexNodeIterator
interface PexNodeSet
interface PexNode
interface KeyValueStorage
interface WalletSet
interface WalletStorage
interface WalletIterator
enum AddressType
interface Wallet
interface SeedGenerator
interface WalletEnv

TxnSignerIterator --|> Iterator : bind <ItemType=TxnSigner>
AddressIterator --|> Iterator : bind <ItemType=Address>
TransactionInputIterator --|> Iterator : bind <ItemType=TransactionInput>
TransactionOutputIterator --|> Iterator : bind <ItemType=TransactionOutput>
TransactionIterator --|> Iterator : bind <ItemType=Transaction>
PexNodeIterator --|> Iterator : bind <ItemType=PexNode>
WalletIterator --|> Iterator : bind <ItemType=Wallet>

class AltcoinMetadata {
Name string
Ticker string
Family string
HasBip44 bool
Bip44CoinType int32
Accuracy int32
}

CryptoAccount : GetBalance(ticker string) (uint64, error)
CryptoAccount : ListAssets() []string
CryptoAccount : ScanUnspentOutputs() TransactionOutputIterator
CryptoAccount : ListTransactions() TransactionIterator
CryptoAccount : ListPendingTransactions() (TransactionIterator, error)

CryptoAccount --> TransactionOutputIterator
CryptoAccount --> TransactionIterator

Address --> CryptoAccount

TxnSigner --> Transaction : sign
TxnSigner ..> PasswordReader

Iterator : Value() ItemType
Iterator : Next() bool
Iterator : HasNext() bool
Iterator : Count() int

Transaction : SupportedAssets() []string
Transaction : GetTimestamp() Timestamp
Transaction : GetStatus() TransactionStatus
Transaction : GetInputs() []TransactionInput
Transaction : GetOutputs() []TransactionOutput
Transaction : GetId() string
Transaction : ComputeFee(ticker string) (uint64, error)
Transaction : VerifyUnsigned() error
Transaction : VerifySigned() error
Transaction : IsFullySigned() (bool, error)

Transaction --> Timestamp
Transaction --> TransactionStatus
Transaction "1" *--> "*" TransactionInput
Transaction "1" *--> "*" TransactionOutput

TransactionInput --> TransactionOutput : spend

TransactionOutput "*" --> "1" Address : fund

Block "*" *--> Transaction
Block --> Timestamp
Block --> TransactionIterator

AltcoinPlugin : ListSupportedAltcoins() []AltcoinMetadata
AltcoinPlugin : ListSupportedFamilies() []string
AltcoinPlugin : RegisterTo(manager AltcoinManager)
AltcoinPlugin : GetName() string
AltcoinPlugin : GetDescription() string
AltcoinPlugin : LoadWalletEnvs() []WalletEnv
AltcoinPlugin : LoadPEX(netType string) (PEX, error)

class CryptoCurrencyToken

AltcoinPlugin "1" -- "*" CryptoCurrencyToken : implements
AltcoinManager "registry" <-- "plugin" AltcoinPlugin : registration
AltcoinPlugin "1" --> "*" WalletEnv
AltcoinPlugin --> PEX

(AltcoinPlugin, CryptoCurrencyToken) .. AltcoinMetadata

AltcoinManager : RegisterPlugin(p AltcoinPlugin)
AltcoinManager : RegisterAltcoin(info AltcoinMetadata, plugin AltcoinPlugin)
AltcoinManager : ListRegisteredPlugins() []AltcoinPlugin
AltcoinManager : LookupAltcoinPlugin(ticker string) (AltcoinPlugin, bool)
AltcoinManager : DescribeAltcoin(ticker string) (AltcoinMetadata, bool)

AltcoinManager "1" o--> "*" AltcoinPlugin
AltcoinManager "cache" --> "record" AltcoinMetadata

BlockchainStatus --> Block
BlockchainStatus ..> CoinValueMetric

PEX --> TransactionIterator
PEX --> PexNodeSet
PEX ..> Transaction : P2P broadcast

PexNodeSet --> PexNodeIterator
PexNodeSet "*" o--> "*" PexNode

WalletSet --> WalletIterator
WalletSet o--> Wallet
WalletSet ..> PasswordReader

WalletStorage : Encrypt(walletName string, password PasswordReader)
WalletStorage : Decrypt(walletName string, password PasswordReader)
WalletStorage : IsEncrypted(walletName string) (bool, error)

WalletStorage ..> PasswordReader

Wallet : GetId() string
Wallet : GetLabel() string
Wallet : SetLabel(wltName string)
Wallet : Transfer(to TransactionOutput, options KeyValueStorage) (Transaction, error)
Wallet : SendFromAddress(from []Address, to []TransactionOutput, change Address, options KeyValueStorage) (Transaction, error)
Wallet : Spend(unspent, new []TransactionOutput, change Address, options KeyValueStorage) (Transaction, error)
Wallet : GenAddresses(addrType AddressType, startIndex, count uint32, pwd PasswordReader) AddressIterator
Wallet : GetCryptoAccount() CryptoAccount
Wallet : GetLoadedAddresses() (AddressIterator, error)
Wallet : Sign(txn Transaction, source UID, pwd PasswordReader, index []string) (Transaction, error)
Wallet : AttachSignService(TxnSigner) error
Wallet : RemoveSignService(TxnSigner) error
Wallet : EnumerateSignServices() TxnSignerIterator

Wallet ..> PasswordReader
Wallet ..> KeyValueStorage
Wallet ..> TransactionOutput
Wallet --> Transaction : create
Wallet --> Transaction : sign
Wallet "1" ..> "*" TxnSigner
Wallet ..> Address
Wallet ..> AddressType
Wallet --> AddressIterator
Wallet --> TxnSignerIterator

Wallet ..> SeedGenerator

WalletEnv : GetStorage() WalletStorage
WalletEnv : GetWalletSet() WalletSet

WalletEnv "1" o--> "1" WalletStorage
WalletEnv "1" o--> "1" WalletSet

@enduml

Loading

0 comments on commit 1b28524

Please sign in to comment.