Tutorial for the test network step by step and improvement

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
Z%5B4A%5DH3%5D)%60_Y)6%24K4KJUU4G
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.
NW(%60879%60KS%40%60I)I%24W%7BV%40%7D1P

3, transfer on the testnet

We can already see that the balance is 250AE in our account. We will transfer the account below.
1
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.
2
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**_

6 Likes

Love it! Thank you for this!

Hey, John here from the aepp-dev-tools team–this is great, thank you very much.

We’ll be releasing a CLI for the JS SDK this week with exactly the same functionality and syntax as the one for the Python SDK. The plan is that all SDKs going forward will support this CLI. We’ll be extending it to optionally return JSON, for easier parsing, and to support all of the features of the æternity. At release the JS CLI will support contract calling, and we’ll be implementing this in Python Real Soon Now.

It’s very encouraging to see other people using our software–thanks, and please give us feedback on what we can do better.

2 Likes

You mention that there is a Go SDK. Where can I find this SDK?

Go to the link: GitHub - aeternity/aepp-sdk-go: Golang SDK to interact with the Æternity blockchain

1 Like