Esempio n. 1
0
def createVTO(_from, mailid, _videoname, link, pk):

    signer = Eos({
        'http_address':
        'https://jungle2.cryptolions.io:443',
        'key_provider':
        pk,
        'chain_id':
        '1eaa0824707c8c16bd25145493bf062aecddfeb56c736f6ba6397f3195f33c9f'
    })
    #   hash = json_make(_from, mailid, _videoname, link, signer)
    signer.push_transaction(
        'dnftversion1', 'create', _from, 'active', {
            "issuer":
            _from,
            "category":
            "video",
            "token_name":
            _videoname,
            "burnable":
            True,
            "base_uri":
            link,
            "span":
            "10",
            "origin_hash":
            '883fd863b6583fe91620653f2dfcad192d69340f6024c958e7d63a4f414d5cdb'
        })
    # validate directly for now
    validate(_videoname, vidvalidatoreos)
    # issue directly 100 PERs to creator
    issue(_from, _from, _videoname, "100", signer)
    return "good job buddy"
Esempio n. 2
0
def run(private_key):
    eos = Eos(
        {"http_address": "https://nodes.get-scatter.com", "key_provider": private_key}
    )
    public_key = getPublicKey(private_key)
    print(public_key)
    account = getAccountName(public_key)
    print(account)
    eos.push_transaction(
        "theeosbutton", "claimad", account, "active", {"account": account}
    )
Esempio n. 3
0
class EosAdapter(Adapter):
    chain = Blockchain.EOS
    credentials = database.find_credentials(Blockchain.EOS)
    address = credentials['address']
    key = credentials['key']
    user = credentials['user']
    node_url = "http://jungle2.cryptolions.io:80"

    eos = Eos({
        'http_address': node_url,
        'key_provider': key,
    })

    # ---Store---
    @classmethod
    def create_transaction(cls, text):
        tx_data = {
            "from": cls.user,
            "to": "lioninjungle",
            "quantity": "0.0001 EOS",
            "memo": text
        }
        return tx_data

    @staticmethod
    def sign_transaction(tx):
        # will be signed in next step
        return tx

    @classmethod
    def send_raw_transaction(cls, tx_data):
        response = cls.eos.push_transaction('eosio.token', 'transfer',
                                            'jungletimohe', 'active', tx_data)
        transaction_hash = f"{response['transaction_id']};{response['processed']['block_num']}"
        return transaction_hash

    @staticmethod
    def add_transaction_to_database(transaction_hash):
        database.add_transaction(transaction_hash, Blockchain.EOS)

    # ---Retrieve---
    @classmethod
    def get_transaction(cls, transaction_hash):
        data = {
            "id": transaction_hash.strip(";").split(";")[0],
            "block_num_hint": int(transaction_hash.strip(";").split(";")[1])
        }
        r = requests.post(f'{cls.node_url}/v1/history/get_transaction',
                          json=data)
        response = json.loads(r.text)
        return response

    @staticmethod
    def extract_data(transaction):
        memo = transaction["trx"]["trx"]["actions"][0]["data"]["memo"]
        return memo

    @staticmethod
    def to_text(data):
        return str(data)
Esempio n. 4
0
def signin(_name, _pk):
    signineos = Eos({
        'http_address':
        'https://jungle2.cryptolions.io:443',
        'key_provider':
        _pk,
        'chain_id':
        '1eaa0824707c8c16bd25145493bf062aecddfeb56c736f6ba6397f3195f33c9f'
    })
Esempio n. 5
0
def invest(_from, quantity, sale_id, seller, pk):

    signer = Eos({
        'http_address':
        'https://jungle2.cryptolions.io:443',
        'key_provider':
        pk,
        'chain_id':
        '1eaa0824707c8c16bd25145493bf062aecddfeb56c736f6ba6397f3195f33c9f'
    })

    signer.push_transaction(
        'dnfttoken123', 'transfer', _from, 'active', {
            "from": _from,
            "to": "dnftversion1",
            "quantity": quantity + '.0000 VID',
            "memo": sale_id + ',' + seller
        })
    return 'aray wah'
Esempio n. 6
0
def startsale(seller, _videoname, percent_shares, per_percent_amt, pk):

    signer = Eos({
        'http_address':
        'https://jungle2.cryptolions.io:443',
        'key_provider':
        pk,
        'chain_id':
        '1eaa0824707c8c16bd25145493bf062aecddfeb56c736f6ba6397f3195f33c9f'
    })

    signer.push_transaction(
        'dnftversion1', 'listsale', seller, 'active', {
            "seller": seller,
            "category": "video",
            "token_name": _videoname,
            "percent_share": percent_shares + '.0000 PER',
            "per_percent_amt": per_percent_amt + '.0000 VID',
            "expiration": "2019-10-30T00:00:00"
        })
    return "done this also"
Esempio n. 7
0
def createacct(_name):
    key_pair = Eos.generate_key_pair()
    jaseos.newaccount({
        'creator': 'jasthetester',
        'name': _name,
        'owner_public_key': key_pair["public"],
        'active_public_key': key_pair["public"],
        'buyrambytes_bytes': 4000,
        'delegatebw_stake_net_quantity': '1.0000 EOS',
        'delegatebw_stake_cpu_quantity': '1.0000 EOS',
        'delegatebw_transfer': 0
    })
    return key_pair
Esempio n. 8
0

def get_accPublickey(_accname):
    url = "http://jungle.eoscafeblock.com:8888/v1/chain/get_account"
    payload = "{\"account_name\":\"" + _accname + "\"}"
    response = requests.request("POST", url, data=payload, headers=headers)
    pub = json.loads(response.text)
    return pub['permissions'][1]['required_auth']['keys'][0]['key']


from eosjs_python import Eos

jaseos = Eos({
    'http_address':
    'https://jungle2.cryptolions.io:443',
    'key_provider':
    '5JPwrk36HBiHq1YY1Vhpp9JQifQ6biki3mVejV9HFWSkAKdgK8U',
    'chain_id':
    '1eaa0824707c8c16bd25145493bf062aecddfeb56c736f6ba6397f3195f33c9f'
})

piyushtester = Eos({
    'http_address':
    'https://jungle2.cryptolions.io:443',
    'key_provider':
    '5HqWmHV449uUePaDm9QWXxsftkHkrzpiHxYsvNjkSddbe64jfKz',
    'chain_id':
    '1eaa0824707c8c16bd25145493bf062aecddfeb56c736f6ba6397f3195f33c9f'
})

dnfteos = Eos({
    'http_address':
Esempio n. 9
0
from eosjs_python import Eos

eos = Eos({
    'http_address': 'https://chain-net-prod.eva.cab/',
    'key_provider': '5KR93vcDVtJJ8eZ3td4gU87p8PPhsfgK5NZKyDij83kSRJ2UTrM'
})

print(eos.get_block('2454645'))
Esempio n. 10
0
from eosjs_python import Eos

eos = Eos({
	'http_address': 'http://172.18.0.1:8888',
	'key_provider': '5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3'
})

eos.newaccount({
	'creator': 'eosio',
	'name': 'mytestacc13',
	'owner_public_key': 'EOS7aJDVdDjcpjAXS53sFoVMHQJdFTMhaS3mThnXE3okFEtvxmQov',
	'active_public_key': 'EOS7aJDVdDjcpjAXS53sFoVMHQJdFTMhaS3mThnXE3okFEtvxmQov',
	'buyrambytes_bytes': 8192,
	'delegatebw_stake_net_quantity': '100.0000 SYS',
	'delegatebw_stake_cpu_quantity': '100.0000 SYS',
	'delegatebw_transfer': 0
})
Esempio n. 11
0
from eosjs_python import Eos

eos = Eos({
    'http_address': 'http://localhost:8888',
    'key_provider': '5KR93vcDVtJJ8eZ3td4gU87p8PPhsfgK5NZKyDij83kSRJ2UTrM'
})

eos.get_currency_balance('eosio.token', 'xcdzdbkqamvu', 'EVA')
from eosjs_python import Eos

eos = Eos({
    'http_address': 'http://localhost:8888',
    'key_provider': '5JhhMGNPsuU42XXjZ57FcDKvbb7KLrehN65tdTQFrH51uruZLHi'
})

#cleos push action eosio.token transfer '["eva","rider1","1 EVA","initial balance"]' -p eva

eos.push_transaction('eosio.token', 'transfer', 'eva', 'active', {
    "from": "eva",
    "to": "rider1",
    "quantity": "1 EVA",
    "memo": ""
})

#cleos push action eva createrider '["rider3"]' -p rider3

eos.push_transaction('eva', 'createrider', 'rider3', 'active',
                     {"account": "rider3"})
Esempio n. 13
0
from eosjs_python import Eos
import json

eos = Eos({
    'http_address': ''  #Your endpoint
})

abi_hex = ""  #Your ABI hex-encoded binary data for the contract
data_hex = ""  #Your hex-encoded binary data for the action

contract = eos.deserialize_contract(abi_hex[0])
contract_r = json.dumps(contract)

action = eos.deserialize_action_data(""" YOUR DATA """)

print(action)
from eosjs_python import Eos

key_pair = Eos.generate_key_pair()
print(key_pair)
Esempio n. 15
0
def keyGenBtn(request):

    key_pair = Eos.generate_key_pair()
    return HttpResponse(json.dumps(key_pair), content_type='application/json')
Esempio n. 16
0
from eosjs_python import Eos

eos = Eos({
    "http_address":
    "http://172.18.0.1:8888",
    "key_provider":
    "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3",
})

eos.newaccount({
    "creator": "eosio",
    "name": "mytestacc13",
    "owner_public_key":
    "EOS7aJDVdDjcpjAXS53sFoVMHQJdFTMhaS3mThnXE3okFEtvxmQov",
    "active_public_key":
    "EOS7aJDVdDjcpjAXS53sFoVMHQJdFTMhaS3mThnXE3okFEtvxmQov",
    "buyrambytes_bytes": 8192,
    "delegatebw_stake_net_quantity": "100.0000 SYS",
    "delegatebw_stake_cpu_quantity": "100.0000 SYS",
    "delegatebw_transfer": 0,
})