Пример #1
0
import os
from blockstack.client import BlockstackClient
from blockstack.util import BlockstackRestException
import time

token = os.environ.get('BK_TOKEN')
client = BlockstackClient(base_uri=('%s/api' % os.environ['BK_INSTANCE']),
                          token=token)
alice = client.wallets.get('Blue')
bob = client.wallets.get('Red')
alice_oracle = client.oracles.get('Blue')
bob_oracle = client.oracles.get('Red')
print(alice.currentAddress)
print("current height:", alice.currentHeight)

alice_txs = alice.transactions
bob_txs = bob.transactions
print(len(alice_txs.list()), "transactions in history for Blue")

sent = 0
while sent < 10:
    try:
        partial = alice_txs.propose(atomic=True,
                                    asset='TRY',
                                    address=bob.assetAddress,
                                    amount=1)
        complete = bob_txs.create(atomic=True,
                                  asset='USD',
                                  address=alice.assetAddress,
                                  amount=2,
                                  transaction=partial['transaction'])
Пример #2
0
 def setUp(self):
     self.client = BlockstackClient(
         base_uri='https://test.blockstack.io/api')