aleph-im / aleph-sdk-docs-python Goto Github PK
View Code? Open in Web Editor NEWAleph Python SDK Documentation
Aleph Python SDK Documentation
Amrik in the Dev TG chat: (https://t.me/c/1599881637/1044)
Is it possible to connect to the network using metmask wallet?
Currently we need user's private key to sign the transaction however, I want a user to able to connect to the dapp using metmask and they can send messages to the network (a decentralized chat app) without always approving the transaction with pop up.
Hugo:
We are aware of this issue. In the future, we will add a "delegation" method so you'll be able to use multiple (sub)keys on behalf of your master key (the one holding aleph tokens).
Moshe:
In the meantime you can do this by yourself:
If the users needs to reconnect:
You can also not encrypt and store the private key if you support multiple browser-local keys (then just generate a new one on every new browser that doesn't have it in storage... even though having it encrypted neds to allow to decrypt it on every opening so no risk linked to local storage)
Article written by Gabriel:
The first step is to generate a private key to import it on Metamask. If you already have a private key, you can jump to the next step.
So firstly you will need to upload your script, in this way a new private key will be generated in device.key
at root of your repository.
This key is encrypted with the PrivateKey
class of coincurve.
To recover this private key you will have to transform its content into hexadecimal.
Here is the code for achieving this
from coincurve import PrivateKey
# In case we don't want to bother with handling private key ourselves
# do an ugly and insecure write and read from disk to this file.
PRIVATE_KEY_FILE = "device.key"
def get_fallback_private_key() -> bytes:
private_key: bytes
try:
with open(PRIVATE_KEY_FILE, "rb") as prvfile:
private_key = prvfile.read()
except OSError:
private_key = generate_key()
with open(PRIVATE_KEY_FILE, "wb") as prvfile:
prvfile.write(private_key)
return private_key
k = get_fallback_private_key()
print('your private key is', PrivateKey(k).to_hex())
You will get a printed message like your private key is b3bxxxxxxxxxxxxxxxxxx
If you do not have Metamask, you should install the extension here , then create an account.
Open Metamask browser extension
Click on profile and import account
Then copy and paste your private key from device.key
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.