The scoinAPI is a Python package providing fast, simplify, and to manage the role's authority. It aims to be a fundamental package to access the method of the SCoin system instead of writing a method without fully understood. Besides that, it's easy to get started in creating a role in the SCoin system. Also, This package will auto-update after the real API has been updated.
- The light package for SCU blockchain in the IOTA system.
- The developer of SCoin system.
-
Run the following command to install:
$ pip install SCoinAPI
- There are three roles which are the central bank, bank, and retailer.
- Each role has a different authority to access the method.
-
To import the package based on the roles:
from SCoinAPI import centralbank cb = centralbank.Central_Bank()
from SCoinAPI import bank bk = bank.Bank()
from SCoinAPI import retailer rt = retailer.Retailer()
- The layer in SCoin system means that the role of user. (a) layer 1 = the central bank (b) layer 2 = the bank or retailer
-
- connection_test
- send_token
- get_balance
- create_did
- get_did
- verify_token
- send_token
- send_tokens
- remove_layer1
- get_transactions_by_timestamp
- get_user_by_timestamp
- get_info
- set_central_bank
- get_all_cluster [ To be develop ]
- bridge [ To be delete ]
- snapshot [ To be delete ]
- get_enseed [ To be develop ]
-
- To test the real API connection wether is serving.
-
- l(str) : Optional,To set the real API link if it has been changed.
- Dict of status and message.
-
r = cb.connection_test()
-
- To make transaction within two user of SCoin system,but it only available for layer 1 user did.
-
- password(str) : The user's password.
- sen(str) : The sender's username.
- rev(str) : The receiver's username.
- num(int) : The transaction amount.
- method(str) : Optinal,The user method, default value is light.
- description(any) : Optional,The metadata of transaction.
- l(str) : Optional,To set the real API link if it has been changed.
- Dict of status, response data and message.
-
r = cb.send_token('SENDER_PASSWORD','SENDER','RECEIVABLE',20)
-
- To make transaction within two user of SCoin system,it is available for basic transaction.
-
- password(str) : The user's password.
- sen(str) : The sender's username.
- rev(str) : The receiver's username.
- num(int) : The transaction amount.
- method(str) : Optinal,The user method, default value is light.
- description(any) : Optional,The metadata of transaction.
- l(str) : Optional,To set the real API link if it has been changed.
- Dict of status, response data and message.
-
r = cb.send_token('SENDER_PASSWORD','SENDER','RECEIVABLE',20)
-
- To get the user's balance through the user's did.
-
- name(str) : The user's did.
- l(str) : Optional,To set the real API link if it has been changed.
- Dict of status, response data and message.
-
r = cb.get_balance('USERNAME')
-
- To create an user did in the SCoin system.
-
- name(str) : The user's did.
- password(str) : The user's password.
- method(str) : Optinal,The user method, default value is light.
- description(any) : Optional,The metadata of transaction.
- l(str) : Optional,To set the real API link if it has been changed.
- pub_key(str) : Optional,RSA public key or endpoint, service will generate one key-pair if this field is empty.
- Dict of status, response data and message.
-
r = cb.create_did('DID','PASSWORD')
-
- To get an user's did detail through hash value(pub_key).
-
- hash_(str) : The public key of user's did.
- l(str) : Optional,To set the real API link if it has been changed.
- Dict of status, response data and message.
-
r = cb.get_did('HASH_VALUE')
-
- To verify self-token.
-
- name(str) : The user's did.
- password(str) : The user's password.
- token(str) : The hash value of token to be verify.
- l(str) : Optional,To set the real API link if it has been changed.
- Dict of status and message.
-
r = cb.verify_token('DID','PASSWORD','HASH_VALUE')
-
- To downgrade the authority of the user to layer-2.
-
- name(str) : The user's did to be downgrade.
- password(str) : The user's password to be downgrade.
- l(str) : Optional,To set the real API link if it has been changed.
- Dict of status and message.
-
r = cb.remove_layer1('DID','PASSWORD','HASH_VALUE')
-
- To get the transaction during a specific time range.
-
- start_time(int) : The start time.
- end_time(int) : The end time.
- l(str) : Optional,To set the real API link if it has been changed.
- Dict of status, response data and message.
-
r = cb.get_transactions_by_timestamp(0,10000000)
-
- To get the sign up user during a specific time range.
-
- start_time(int) : The start time.
- end_time(int) : The end time.
- l(str) : Optional,To set the real API link if it has been changed.
- Dict of status, response data and message.
-
r = cb.get_user_by_timestamp(0,10000000)
-
- To get the total number of sign up user.
-
- l(str) : Optional,To set the real API link if it has been changed.
- Dict of status, response data and message.
-
r = cb.get_info()
-
- To upgrade the authority of the user to layer-1.
-
- name(str) : The user's did to be upgrade.
- password(str) : The user's password to be upgrade.
- l(str) : Optional,To set the real API link if it has been changed.
- Dict of status and message.
-
r = cb.set_central_bank('DID','PASSWORD')
- LINE : nus_jie
- Email : sefx5ever@gmail.com