{"id":21528533,"url":"https://github.com/fibercrypto/libjava-skyfiber","last_synced_at":"2026-02-18T18:33:19.041Z","repository":{"id":39955845,"uuid":"130543908","full_name":"fibercrypto/libjava-skyfiber","owner":"fibercrypto","description":"Skycoin Java client library","archived":false,"fork":false,"pushed_at":"2022-12-10T04:45:06.000Z","size":103102,"stargazers_count":2,"open_issues_count":23,"forks_count":2,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2025-06-25T19:05:00.583Z","etag":null,"topics":["client-library","java","java-8","java-library","java8","jni","openapi","rest-api","rest-client","restapi","skycoin","swagger","swig"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fibercrypto.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-22T07:09:51.000Z","updated_at":"2019-12-26T21:27:30.000Z","dependencies_parsed_at":"2023-01-25T20:45:18.514Z","dependency_job_id":null,"html_url":"https://github.com/fibercrypto/libjava-skyfiber","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/fibercrypto/libjava-skyfiber","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibercrypto%2Flibjava-skyfiber","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibercrypto%2Flibjava-skyfiber/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibercrypto%2Flibjava-skyfiber/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibercrypto%2Flibjava-skyfiber/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fibercrypto","download_url":"https://codeload.github.com/fibercrypto/libjava-skyfiber/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fibercrypto%2Flibjava-skyfiber/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29589607,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T16:55:40.614Z","status":"ssl_error","status_checked_at":"2026-02-18T16:55:37.558Z","response_time":162,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client-library","java","java-8","java-library","java8","jni","openapi","rest-api","rest-client","restapi","skycoin","swagger","swig"],"created_at":"2024-11-24T01:53:34.912Z","updated_at":"2026-02-18T18:33:19.007Z","avatar_url":"https://github.com/fibercrypto.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LibSkyfiber for Java\n\n[![Build Status](https://travis-ci.org/fibercrypto/libjava-skyfiber.svg?branch=develop)](https://travis-ci.org/fibercrypto/libjava-skyfiber)\n\nJava client library for Skycoin API. This library is a .Net assembly generated with SWIG to access Skycoin API from Java.\n\n## Table of Contents\n\n\u003c!-- MarkdownTOC levels=\"1,2,3,4,5\" autolink=\"true\" bracket=\"round\" --\u003e\n\n- [LibSkycoin for Java](#libskycoin-for-java)\n  - [Table of Contents](#table-of-contents)\n  - [Install from sources](#install-from-sources)\n  - [Usage](#usage)\n    - [Naming](#naming)\n    - [Parameters](#parameters)\n      - [Handles](#handles)\n      - [Byte slices](#byte-slices)\n      - [Structures](#structures)\n      - [Fixed Sized Arrays](#fixed-sized-arrays)\n      - [Other Slices](#other-slices)\n    - [Memory Management](#memory-management)\n  - [Make Rules](#make-rules)\n  - [Development setup](#development-setup)\n    - [Running tests](#running-tests)\n    - [Releases](#releases)\n      - [Update the version](#update-the-version)\n      - [Pre-release testing](#pre-release-testing)\n      - [Creating release builds](#creating-release-builds)\n  \u003c!-- /MarkdownTOC --\u003e\n\n\n\n## Install from sources\n\nDownload the repository from https://github.com/fibercrypto/libjava-skyfiber.git.\nExecute (`mvn compile`) to install the library. Although executing (`mvn test`) is a better choice for making changes to the library. However, when using tox these commands are not required at all because calling tox will make any necessary installation and execute the tests.\n\n## Install from Maven\n\nAdd this dependency to your project's POM: \n\n```xml\n\u003crepositories\u003e\n  \u003crepository\u003e\n    \u003cid\u003eskycoin-libjava-skyfiber\u003c/id\u003e\n    \u003curl\u003ehttps://packagecloud.io/fibercrypto/libjava-skyfiber/maven2\u003c/url\u003e\n    \u003creleases\u003e\n      \u003cenabled\u003etrue\u003c/enabled\u003e\n    \u003c/releases\u003e\n    \u003csnapshots\u003e\n      \u003cenabled\u003etrue\u003c/enabled\u003e\n    \u003c/snapshots\u003e\n  \u003c/repository\u003e\n\u003c/repositories\u003e\n```\n\n## Usage\n\n### Naming\n\nThe exported function in Libskycoin Java have the following naming format: `SKY_package_func_name` where package is replace by the package where the original Skycoin function is and func_name is the name of the function. For example, `LoadConfig` function from `cli` package is called in Java `SKY_cli_LoadConfig`\n\n### Parameters\n\nAll skycoin exported functions return an error object as the last of the return parameters. In Java error is return as an `long` and it is the first return parameter. The rest of the parameters are returned in the same order.\n\nReceivers in Skycoin are the first of the input parameters. Simple types, like integer, float, string will be used as the corresponding types in Java, except what act as pointers.\n\n#### Handles\n\nSome of Skycoin types are too complex to be exported to a scripting language. So, handles are used instead. Therefore all functions taking a complex type will receive a handle instead of the original Skycoin type. For example, having these functions exported from Skycoin:\n\n```go\n  func LoadConfig() (Config, error)\n  func (c Config) FullWalletPath() string\n```\n\nConfig is a struct type that is treated as a handle in Libskycoin Java . The usage in Java will be:\n\n```java\n\n    public class Skycoin extends skycoin {\n\n        public void main() {\n            SWIGTYPE_p_Config__Handle configHandle = new_Config_HandlePtr();\n            long err = SKY_cli_LoadConfig(configHandle);\n            if (err == SKY_OK) {\n                // SkY_OK means no error\n                _GoString_ fullWalletPath = new _GoString_();\n                err = SKY_cli_FullWalletPath(configHandle, fullWallerPath);\n                assertEquals(err, SKY_OK);\n                System.out.println(fullWallerPath.getP());\n                //Close the handle after using the it\n                //so the garbage collector can delete the object associated with  it.\n                SKY_handle_close(configHandle);\n            } else {\n    //        Error\n                System.out.println(err);\n            }\n        }\n  }\n\n```\n\n#### Byte slices\n\nParameters of type byte[] will treated as string . Example, this function in Skycoin:\n\n```go\nfunc (s ScryptChacha20poly1305) Encrypt(data, password []byte) ([]byte, error)\n```\n\n... should be invoked like this:\n\n```java\nencrypt__ScryptChacha20poly1305 encrypt_settings = new encrypt__ScryptChacha20poly1305();\nGoSlice data = new GoSlice(); //It will be passed as a parameter of type []byte\nGoSlice pwd = new GoSlice(); //As []byte too\n_GoString_ dataStr = new _GoString_();\n_GoString_ pwdStr = new _GoString_();\nGoSlice encrypted = new GoSlice();\n\ndataStr.setString(\"Data to encrypt\" );\ndata.convertString(dataStr);\npwdStr.SetString(\"password\");\npwd.convertString(pwdStr);\n\nlong err = SKY_encrypt_ScryptChacha20poly1305_Encrypt(encrypt_settings, data, pwd,encrypted);\nif(err == SKY_OK){\n  System.out.println(encrypted.getString().getP()); //Encrypted is GoSlice\n}\n```\n\n#### Structures\n\nStructures that are not exported as handles are treated like .NET classes. In the previous example type ScryptChacha20poly1305 is created in Java like:\n\n```java\nencrypt__ScryptChacha20poly1305 encrypt_settings = new encrypt__ScryptChacha20poly1305()\n```\n\nAnd passed as first parameter in call to `SKY_encrypt_ScryptChacha20poly1305_Encrypt`.\n\n#### Fixed Sized Arrays\n\nParameters of fixed size array are wrapped in structures when called from Java.\n\nGiven these types in Skycoin and this exported function:\n\n```go\n  type PubKey [33]byte\n  type SecKey [32]byte\n\n  func GenerateDeterministicKeyPair(seed []byte) (PubKey, SecKey)\n```\n\nThis is a way to use them to write assertions in Java:\n\n```java\n//Generates random seed\nGoSlice data = new GoSlice();\nlong err = SKY_cipher_RandByte(32,data);\n\nassertEquals(err,SKY_OK);\n\ncipher_PubKey pubkey = new cipher_PubKey();\ncipher_SecKey seckey = new cipher_SecKey();\n\nerr = SKY_cipher_GenerateDeterministicKeyPair(data, pubkey,seckey);\n```\n\nIn the example above `pubkey` and `seckey` are objects of an structure type containing a field named `data` holding the corresponding instance of `PubKey` and `SecKey`. Something like:\n\n```cpp\n  cipher_PubKey struct{\n    data [33]byte;\n  } cipher_PubKey;\n\n  cipher_SecKey struct{\n    data [32]byte;\n  } ;\n```\n\n#### Other Slices\n\nOther slices of base type different from `byte` are indeed wrapped inside classes. Let's see how to call the following function:\n\n```go\nfunc GenerateDeterministicKeyPairs(seed []byte, n int) []SecKey\n```\n\nIn Java this how it should be used to generate a deterministic sequence of pairs of public / private keys given a random seed:\n\n```java\n//Generates random seed\nGoSlice seed = new GoSlice();\nlong err = SKY_cipher_RandByte(32,seed);\ncipher__SecKeys seckeys = new cipher__SecKeys();\n\nerr = SKY_cipher_GenerateDeterministicKeyPairs(seed, 2,seckeys);\n\nfor(int i=0;i\u003cseckeys.count,i++){\n  cipher_PubKey pubkey = new cipher_PubKey();\n  cipher_SecKey seckey = new cipher_SecKey();\n  seckeys.getAt(seckey,i);\n\n  SKY_cipher_PubKeyFromSecKey(seckey, pubkey);\n  err = SKY_cipher_PubKey_Verify(pubkey);\n  assertEquals(err,SKY_OK);\n}\n```\n\n### Memory Management\n\nMemory management is transparent to the user. Any object allocated inside the library is left to be managed by the Java garbage collector.\n\n## Make Rules\n\nThe following `make` rules are available after `git checkout` of this repository. They all require [Skycoin](https://github.com/fibercrypto/skycoin) to be checked out as a `git submodule` of libskycoin .NET .\n\n- `build-libc`\n  - Compiles skycoin C language library.\n- `build-swig`\n  - Creates the wrapper C code to generate the Java library.\n\n## Development setup\n\nIt is highly recommended for developers to setup their environment using\nthe available Docker images.\nRead the [LibJava Docker docs](docker/images/dev-cli/README.md) for further\ndetails.\n\nThe project has two branches: `master` and `develop`.\n\n- `develop` is the default branch and will always have the latest code.\n  The submodule at `gopath/src/github.com/fibercrypto/skycoin` has to be\n  in sync with `skycoin/skycoin` `develop` branch.\n- `master` will always be equal to the current stable release on the website, and should correspond with the latest release tag.\n  The submodule at `gopath/src/github.com/fibercrypto/skycoin` has to be\n  in sync with `skycoin/skycoin` `master` branch.\n\nSeparate stable development branches will be created to work on releases for supporting the\nmost recent stable version of Skycoin. The name of these branches should be the Skycoin\nmajor and minor version numbers followed by `dev` suffix e.g. `0.25-dev`.\nThese branches may be forked out of either `master` or `develop` branches, and \nthe submodule at `gopath/src/github.com/fibercrypto/skycoin` has to be\nin sync with the corresponding tag of `skycoin/skycoin` official repository.\n\nStable development branches are created most of the time for the following reasons:\n\n- A Skycoin release increasing [patch version number](https://semver.org/).\n- Enhanced support and bug fixes for a version of LibSkycoin Java compiled against an\n  stable version of Skycoin\n- Backporting useful features added in `develop`.\n\n### Running tests\n\n```sh\n$ make test\n```\n\n### Releases\n\n#### Update the version\n\n1. If the `master` branch has commits that are not in `develop` (e.g. due to a hotfix applied to `master`), merge `master` into `develop` (and fix any build or test failures)\n2. Switch to a new release branch named `release-X.Y.Z` for preparing the release.\n3. Ensure that the submodule at `gopath/src/github.com/fibercrypto/skycoin` is in sync with respect to the corresponding tag in https://github.com/fibercrypto/skycoin repository.\n4. Update package version (pom.xml)\n5. Run `make build` to make sure that the code base is up to date\n6. Update `CHANGELOG.md`: move the \"unreleased\" changes to the version and add the date.\n7. Follow the steps in [pre-release testing](#pre-release-testing)\n8. Make a PR merging the release branch into `master`\n9. Review the PR and merge it\n10. Update files in https://github.com/fibercrypto/repo-info/tree/master/repos/fibercrypto/remote for `skycoin/skycoindev-java` Docker image, adding a new file for the new version and adjusting any configuration text that may have changed\n11. Tag the `master` branch with the version number. Version tags start with `v`, e.g. `v0.20.0`. Sign the tag. If you have your GPG key in github, creating a release on the Github website will automatically tag the release. It can be tagged from the command line with `git tag -as v0.20.0 $COMMIT_ID`, but Github will not recognize it as a \"release\".\n12. Release builds are created and uploaded by travis. To do it manually, checkout the master branch and follow the [create release builds instructions](#creating-release-builds).\n13. Checkout `develop` branch and bump package up to next [`dev` version number](http://maven.apache.org/guides/mini/guide-releasing.html).\n\n#### Pre-release testing\n\nPerform these actions before releasing:\n\n    make test\n\n#### Creating release builds\n\nRelease builds should be created from `master` branch . After [updating release version](#update-the-version) it is necessary to follow these steps\n\n##### Requirements\nHave installed the `mvn, java` for the creation of the package.\n\nhttp://maven.apache.org/install.html\n\n##### Building\n\n    mvn package\n\nFinal results are placed in the target/ folder.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffibercrypto%2Flibjava-skyfiber","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffibercrypto%2Flibjava-skyfiber","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffibercrypto%2Flibjava-skyfiber/lists"}