An introduction to client development on testnet using the official SDKs.
In this tutorial, we demonstrate the key elements of a basic client using the official SDKs to interact with the Blockchain. The code for the tutorial is available here: my-first-client. The code in this project can be run from the root of the project directory by issuing the
The example code uses the official Client SDKs. Currently, Go, Java, and Python are available. These libraries are developed to simplify aspects of the development process. If your language is not currently supported, or on the upcoming roadmap (Rust), then you will want to refer to the low-level JSON-RPC API. To request additional functionality or to track when it is implemented, you can submit a GitHub issue on the corresponding project repository.
To see advanced usage, refer to the Reference Wallet project.
All code examples are shared in the my-first-client repo on GitHub.
Each SDK has the following system requirements:
- Java: Java 8+
- Go: Go v1.1+
- Python: Python v3.7+, pipenv
make python for Python
make java for Java
The first thing your client code will need to do is connect to the network.
Wallets are addresses on the Blockchain that may issue transactions that send or receive funds. Private and Public key are needed.
A faucet is a blockchain tool for testing blockchain transactions by providing coins for testing. When instructed, the testnet faucet will send the requested amount of Coin1 to the address provided.
Here, we request 100 Coin1 from the faucet and deposit it in Wallet A.
In the previous step we requested 100 Coin1 from the faucet. We can verify that our test wallet now has the expected balance.
Note: There are several types of peer to peer transactions. These transactions shall have regulatory and compliance requirements that must be followed. To learn more about requirements, please visit the Prospective VASPs document here.
Next we demonstrate sending 10 units of Coin1 from a Sender wallet to a Receiver wallet.
We can verify that 10 Coin1 was sent by verifying the sender’s wallet balance is 90 and receiver’s balance is 10.
DIP-5 introduces a standard way for communicating information about a specific transaction. DIP-5 encodes a destination address, currency, and amount. You can use this information to handle the user’s intent.
Each SDK provides the following helper function for processing this information.
To monitor and react to transactions, you may subscribe to events.
In the example below, we will setup a wallet with 100 Coin1 and then call the mint to add 1 Coin1 ten times.