Accounts
Signum is an account oriented blockchain (in contrast to UTXO based concepts like it used in Bitcoin). This concept is a bit more intuitive, as this is similar to common bank accounts. Other than in Ethereum, accounts in Signum can be identified by three different types: Public Key, Numerical ID, and the so called Reed-Solomon-Address.
The public key is the origin and is being generated using a specific key generation algorithm. The Numeric ID and Reed-Solomonis are derived from the public key and are more commonly used for accounts identification due to their better readability.
The Numeric ID and Reed-Solomon address can always be derived from a public key, but you can't derive a public key from the Numeric ID or Reed-Solomon address!
Type | Example |
Public Key | 41074BDC6430FC0EAFFFAB07682C092922C39475DDFAAF09451DC9950C1BC45F |
Numeric ID | 8952122635653861124 |
Reed Solomon Address | S-5MS6-5FBY-74H4-9N4HS |
Creating an account object with SignumJS is pretty easy.
The account will not be visible (created) on the chain unless you send or receive something to that address.
As one can see here, to generate the cryptographic keys the method generateMasterKeys is being used. To work with the representations of an account the value object class Address should be used. Ideally, one creates the address object from the public key, but for common use-cases, where a public key is not really necessary, i.e. to identify a recipient, you can also create the address object from the Numeric Id or Reed-Solomon address.
As depicted in the upper example, the generateMasterKeys function needs a seed to generate the keys. It is crucial that the seed is sufficiently random, such it cannot be guessed. You can use whatever (secure) random input string to create the keys.
Math.random()is not a secure random number generator. Never use it to generate a random seed.
Ideally, you use the platforms crypto methods (NodeJS or Web Crypto API), but to facilitate the generation of a strong seed, SignumJS provides a cross-platform (isomorphic) method to generate a 12-word seed based on a 2048 english words dictionary (which is used by BIP-39)
Are 2048 known words as dictionary for a 12-word passphrase secure?! See here
To convert the account identifiers just use the Address value object class.
In Signum we different states of registered accounts in the chain:
- [Inexistent] Not registered at all - no transaction from or to that account was done yet
- [Inactive] Registered, but without public key assigned - somebody sent something to that account
- [Active] Registered and with public key assigned - usually, the account did an outgoing transaction.
An active account is considered as fully secured account, and is the only way to receive P2P encrypted messages. See more about activation here.