Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refertec "address change", it was "token id change" #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 0bs-samples/python/demo-address-output.log
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ nonce = 0
balances:
Waves = 50000000000
GavX8vzkqv7ew3J2V1PMC2TCzoGM2Lt7amms2G3NaMU2 (BATT1) = 1000
FH6v21twyAwDeR7J2TTp7zQEAq5rXBvyfWvK8QMvfRAZ (AustriaPro V1) = 50000000
FH6uv21twyAwDeR7J2TTp7zQEAq5rXBvyfWvK8QMvfRAZ (AustriaPro V1) = 50000000
------------------------------------------
Balance 0bsnetwork Coin: 500
Balance AustriaPro Token V1: 50
------------------------------------------
Info about Asset:
status = Issued
assetId = FH6v21twyAwDeR7J2TTp7zQEAq5rXBvyfWvK8QMvfRAZ
assetId = FH6uv21twyAwDeR7J2TTp7zQEAq5rXBvyfWvK8QMvfRAZ
issuer = 3MpZXYBKdsMKGWzNxmNSm27QPYHmev7jB5K
name = AustriaPro V1
description = AustriaPro Test Token V1
Expand Down
3 changes: 3 additions & 0 deletions docnos3-testclient/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# DocNoS-API Tests
Zwei einfache Python Scripts, um die API-Requests "create" (Erstellen einer Notarisierung) und "verify" (Pr�fen einer Notarisierung) zu testen.
Voraussetzung: Zugriff auf ein DocNoS-API Service (URL und API-Token)
18 changes: 18 additions & 0 deletions docnos3-testclient/test_common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'''
Common content and configuration for DocNoS API tests

@copyright 2020 baumann.at
@author Chris Baumann <[email protected]>
@version v0.2 2020/09/30

'''

url_create = 'https://YOUR-DOCNOS-API-SERVER/docnos3-api/create/'
url_verify = 'https://YOUR-DOCNOS-API-SERVER/dev9/docnos3-api/verify/'

# STD
apiToken = 'API-TOKEN-FOR-STD'
# BlockStempel
#apiToken = 'API-TOKEN-FOR-BLOCKSTEMPEL'

defaultContent = 'some content 12345XX'
75 changes: 75 additions & 0 deletions docnos3-testclient/test_create.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
'''
Simple script to test DocNoS API function "create"

configuration see test_common.py

@copyright 2020 baumann.at
@author Chris Baumann <[email protected]>
@version v0.2 2020/09/30

'''
import sys
import datetime
import hashlib
import json
import requests # install with "pip3 install requests" if necessary

from test_common import *

print('------------------------------------')
print('DocNos Test ... create')

'''
A valid DocNos Create Request looks like this: (sha256 is required, sha512 and sha3/512 optional)
{
"hashes": {
"sha256": "1a482edb60960719895a6b1c50121c938a62357cd68fe9ab29be1b8b343b663c",
"sha512": "294a725daacea98a340ce946182105e12448e7c1147424f94a0eb453eb531373a39f0e563d828aea092e53d4481a02282ca3ba313a029bf5c09956759de26363",
"sha3\/512": "f210c7bc0c281b844a989160186eb0f8a1ac2a996cd3d6db8e0b4074815e3521b50dccbd2ac597c7192a692e16f2ffa0491a0823a991212af44c2a8c3087dec0"
},
"remarks": "optional remarks"
}

'''

# Build API request
# SHA2 256
sha256 = hashlib.sha256(defaultContent.encode('utf-8')).hexdigest()
#print(sha256)
# SHA2 512
sha512 = hashlib.sha512(defaultContent.encode('utf-8')).hexdigest()
#print(sha512)
# SHA3 512
sha3_512 = hashlib.sha3_512(defaultContent.encode('utf-8')).hexdigest()
#print(sha3_512)
#print('------------------------------------')


hashes = {
'sha256': sha256,
'sha512': sha512,
'sha3/512' : sha3_512
}

request = {
'hashes': hashes,
'remarks': 'optional remarks'
}

postData = json.dumps(request)
print('JSON-Request:')
print(postData)
print('------------------------------------')

length = str(len(postData))

httpHeaders = {
'Content-type':'application/json',
'Accept':'application/json',
'Content-Length': length,
'X-ApiToken': apiToken}
#print(httpHeaders)

response = requests.post(url_create, data = postData, headers = httpHeaders)
print(str(response))
print('RESULT: ' + response.text)
40 changes: 40 additions & 0 deletions docnos3-testclient/test_verify.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
'''
Simple script to test DocNoS API function "verify"

configuration see test_common.py

@copyright 2020 baumann.at
@author Chris Baumann <[email protected]>
@version v0.2 2020/09/30

'''
import sys
import hashlib
import json
import requests # install with "pip3 install requests" if necessary

from test_common import *

print('------------------------------------')
print('DocNos Test ... verify')

# SHA2 256
sha256_hash_to_verify = hashlib.sha256(defaultContent.encode('utf-8')).hexdigest()
#print(sha256_hash_to_verify)

httpHeaders = {
'Accept':'application/json'
}

# search for specific hash
key = 'hash'
value = 'sha256:' + sha256_hash_to_verify

# OR search for given transaction-id
#key = 'txid'
#value = '4307fa407a136936fe8deba3babe541b59e5ebe6f8aa7df00ba7fcc83e6b792b'

response = requests.get(url_verify, params={key: value}, headers = httpHeaders)

print(str(response))
print('RESULT: ' + response.text)