This article is the tutorial to create an account on the test network, recharge, transfer, compile smart contracts, publish smart contracts, and call smart contracts step by step.
1, create an account using the Python SDK
Aeternity can create an account using the Python SDK, the JS SDK or the Go SDK. Here is an example of the Python SDK. After downloading the SDK, execute it:
You can see that sdk contains public chain data query, contract compilation, account block query, oracle, wallet creation and other related content. We choose to create a wallet and execute:
Add the path to save the key file after the wallet, plus the create command, you can get the above result after entering the password.
2. Recharge the generated account
The generated account will not be recorded in the chain. Only the executed transaction will have a record. Therefore, if the transfer is issued, the account will not be found because the balance of the account is 0. After entering the test network, Figure
The default recharge is 250AE. After recharging, a transaction record will be generated. You can see the transaction ID and click to jump to the blockchain transaction browser details, but it seems that it has not been developed yet. We use the Python SDK to view transaction details.
3, transfer on the testnet
We can already see that the balance is 250AE in our account. We will transfer the account below.
Ignore my print input, specify our key path, connect the send command, transfer the account to which address, and transfer the balance. Will prompt to enter the password, this password is the password output of the decryption of our key. We will look at our account balance again.
After I have repeatedly transferred the test, I found that the fee for each transfer test network is charged 1AE.
4, smart contract compilation
The Python SDK also provides the ability to compile and deploy smart contracts, but here is the online IDE for compiling. The contract uses a language called Sophia.
After clicking Deploy, a contract address will be generated. My contract address here is:
Ctrl$PzpYsHcA858UNDJLnfmQznnNKPwxmatXwFrWG6GjNhr1rScgm
Use the blockchain browser to view contracts and deals
This browser can view the process of performing actions above, including top-up transactions, transactions, and contract creation. The SDK does not provide a way to query the contract, and the browser is not perfect, so I will not find the contract I just created.
5, Call the smart contract
Here we use the IDE call, passing in the method name and parameters, and more complicated contract examples can be seen from the github example.
6, change account using the online IDE
If you need to change your account, you can enter the key of your account in the header of the online IDE. In addition, this key is a hexadecimal string.
The Python SDK generates an encrypted key file, so we can
Add an output to the location shown above, get the real private key, and save it for use.
7. Improvements
a、blockchain browser can not be queried according to the transaction ID, according to the contract ID query, the transaction details are not perfect, such as the usage of gas, transaction costs and so on.
b、compared with the Ethereum IDE, the lack of Debugger function, not perfect enough.I think Some good features can borrow the idea from Ethereum.
c、Python SDK lacks the ability to query contracts
8, the relevant address
Python sdk address: GitHub - aeternity/aepp-sdk-python: Python SDK for the Æternity blockchain
Test network recharge address: https://faucet.aepps.com/
Online Contract IDE: https://contracts.aepps.com/
_**twitter me:https://twitter.com/AEternity_IMAE**_