-
Notifications
You must be signed in to change notification settings - Fork 12
Developer Guide
Introduction
Core Concepts
Develop your application with the SDK
Build the SDK project
ToDo List
Reference Projects
-
Deploy a WaykiChain node as your online wallet that internally creates and manages your wallet keys and addresses as well as submits your transactions via its JSON RPC interface for coin transfer or contract invocation etc. type of tasks
-
Deploy a WaykiChain node only as your proxy to the WaykiChain network and also deploy an application that create keys and addresses separately in an environment that's disconnected from any network for safety reasons. Use the application to generate the so-called raw transaction data that's signed offline and can be safely transferred to the proxy (E.g. via QR code scan from another device) for the eventual network submission without getting any network mounted attacks.
This project was hailed as the need arises hugely for providing offline-signing of transactions by Java based software usually deployed in some backend system. Prior to that, only mobile-based local signing was made available to the open source community. In both ways, signing a transaction is done in a decentralized manner to ensure the best interest of the key holders. With the byte-code based Kotlin release that is native to Java application development, all sorts of Java based server applications can do the key generation and transaction signing freely without relying on another node which owns the singing key before submitting the data to the network for final processing and packing into a block.
Name | Description |
---|---|
Private Key | a key in its binary form that can be generated by this wallet utils and shall never be leaked to any unauthorized party |
Public Key | a key in its binary form that corresponds to the private key and has a hash of 66 Hex String or 33 bytes |
WIF | Wallet Import Format, usually a private key encoded in a 52-char string with a head character of P for mainnet or Y for testnet |
Address | A 34-char string with a head character of W for mainnet or w for testnet is a representation of one's address for sending/receiving WICC coins/tokens or even invoking contracts. It can be mutually reversed with a 20-byte public-key hash value |
RegId | In WaykiChain's implementation, each key must be first registered with the network composed of WaykiChain nodes in order to get a RegId (a combination of block height and index) before the key can do any value transfer. But a key can receive coin transfer before registering with the network |
gas fees | In order to let miners add your transaction into a block, you need to provide a certain amount of fees with the transaction. Usually it can be 0.0001 WICC coins. Only in a heavy and/or somewhat congested traffic, you might want to increase the gas fees to a higher value to prioritize your transactions amongst those of others |
block height | Usually it is the current longest block size. In this SDK, many functions requires an input parameter of the block height which needs to be within the range of (current - 250, current + 250) to impose an expiry period for security reasons |
- generation of private-public key pairs and their corresponding addresses
- registering the keys with the WaykiChain miner nodes in order to get their RegIds (we also casually call it account registration or account activation) and it shall be only conducted after receiving a certain amount of coins
- transferring WICC coins to any target address
- invocation of some contract by its address (E.g. contract issued token transferring)
All the outcomes of the above function calls are raw transaction data (alpha-numerical string) that needs to be further submitted to the network via a WaykiChain node. For sample code, please refer to the Project Unit Test Code
Because this JDK relies on an open-source C++ based secp256k1 ECDSA signing/verification library, you must first build a binary release of this C++ library for your environment where your Java application runs. Please refer to ECDSA Signing C++ Project to learn how to build for its binary release. After that, you can launch your Java application as follows:
java -Djava.library.path=$LIBS_DIR -jar $YOUR_APP.jar
P.S. $LISB_DIR is the path to the directory that contains "libsecp256k1.so" for Linux or "libsecp256k1.dylib" for MAC OSX.
After successfully generating raw transaction data($RAW_TX),one can submit it to the network via a WaykiChain light node by running the following command:
./coind -datadir=. submittx $RAW_TX
- Create a WICC key-pair and address for your cold or offline wallet
- Transfer a certain amount of WICC coins to the above address just created
- Register the address with the network in order to get a RegId for the address
- Transfer a certain amount of WICC coins to the address in your cold wallet
- Transfer some coins to any other target address
- Repeat any of the above two steps as your daily business requires
wicc-wallet-utils.1.0.0.jar for your download. It is also encouraged for open-source community developers to raise issues or feature requests for further improvement of this SDK for betterment of wider community and use cases.
If you truly want to modify the SDK source code and build it locally for your own usage, you can use a Java/Kotlin IDE like Eclipse or IntelliJ for code editing and gradlew for build:
./gradlew build
- HD Wallet
This project utilizes some source code from following projects: