{"id":18031578,"url":"https://github.com/ivanxuu/area58check","last_synced_at":"2025-12-12T00:23:25.311Z","repository":{"id":57479012,"uuid":"124432473","full_name":"ivanxuu/area58check","owner":"ivanxuu","description":"Convert to bitcoin base58check in elixir","archived":false,"fork":false,"pushed_at":"2018-05-14T09:49:31.000Z","size":39,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T22:03:48.311Z","etag":null,"topics":["bitcoin","elixir"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","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/ivanxuu.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-03-08T18:35:46.000Z","updated_at":"2023-05-14T14:49:19.000Z","dependencies_parsed_at":"2022-09-26T18:20:36.832Z","dependency_job_id":null,"html_url":"https://github.com/ivanxuu/area58check","commit_stats":null,"previous_names":["ihinojal/area58check"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanxuu%2Farea58check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanxuu%2Farea58check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanxuu%2Farea58check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanxuu%2Farea58check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivanxuu","download_url":"https://codeload.github.com/ivanxuu/area58check/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247086024,"owners_count":20881160,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["bitcoin","elixir"],"created_at":"2024-10-30T10:09:38.812Z","updated_at":"2025-12-12T00:23:25.267Z","avatar_url":"https://github.com/ivanxuu.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Area58check\n\n## What is Area58?\n\nArea58 is a library to encode and decode base58check. Base58check is\nused in Bitcoin whenever there is a need for a user to read or\ntranscribe a number, such a bitcoin adresses, encrypted key, private\nkey, or script hash.\n\n## What is NOT Area58?\n\nThis can't be used to generate bitcoin address from a private key. It's\nonly a base58check encoder/decoder. But it's easy to generate a bitcoin\naddress from the private key.\n\nExample: If you want to generate a (uncompressed) bitcoin address using\nthis library you can...\n\n    iex\u003e privkey = \"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF\" |\u003e Base.decode16!()\n    iex\u003e {uncompressed_pubkey, _priv_key} = :crypto.generate_key(:ecdh, :crypto.ec_curve(:secp256k1), privkey)\n    iex\u003e uncompressed_pubkey = :crypto.hash(:ripemd160, :crypto.hash(:sha256, uncompressed_pubkey))\n    iex\u003e Area58check.encode(uncompressed_pubkey, \u003c\u003c0\u003e\u003e)\n    %Area58check{\n      encoded: \"1CLrrRUwXswyF2EVAtuXyqdk4qb8DSUHCX\",\n      decoded: \u003c\u003c1, 35, 69, 103, 137, 171, 205, 239, 1, 35, 69, 103, 137, 171, 205, 239, 1, 35, 69, 103, 137, 171, 205, 239, 1, 35, 69, 103, 137, 171, 205, 239\u003e\u003e,\n      version: :p2pkh,\n      version_bin: \u003c\u003c0\u003e\u003e}\n\nor you can use another library that does all that for you.\n\n## What is base58check?\n\n#### Encoding\nBase58 charset is based on easy to trancribe characters, upper and\nlower case letters and numbers excluding `0`, `O`, `l`, `I`.\n\n#### Bitcoin version prefixes\nUsually there is a version (binary number) to signal what kind of string\nis being encoded.\n[list of bitcoin prefixes](https://en.bitcoin.it/wiki/List_of_address_prefixes)\n\nExample: for standard bitcoin address, is used the hexadecimal\nnumber 0x00, for compressed WIF (allows to import a private key in\nbitcoin) is used 0x80, etc.\n\n#### Checksum\n\nWhen a string is encoded, 4 bytes (or 32bits), are added to the end by\n`Area58check.encode` function as a checksum to make sure that no\ncharacters were wrongly transcribed. This checksum is not meant to allow\nto fix a wrong transcribed string, but it allows to verify if string is\ncorrect or not.\n\n## Usage\n\n#### Encoding\n\nEncode a private key into WIF (Wallet Import Format):\n\n    iex\u003e privkey = \"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF\" |\u003e Base.decode16!()\n    iex\u003e Area58check.encode(privkey, :wif)\n    %Area58check{encoded: \"5HpneLQNKrcznVCQpzodYwAmZ4AoHeyjuRf9iAHAa498rP5kuWb\",\n      decoded: \u003c\u003c1, 35, 69, 103, 137, 171, 205, 239, 1, 35, 69, 103, 137, 171, 205, 239, 1, 35, 69, 103, 137, 171, 205, 239, 1, 35, 69, 103, 137, 171, 205, 239\u003e\u003e,\n      version: :wif,\n      version_bin: \u003c\u003c128\u003e\u003e}\n    iex\u003e Area58check.encode(privkey, [128])\n    %Area58check{encoded: \"5HpneLQNKrcznVCQpzodYwAmZ4AoHeyjuRf9iAHAa498rP5kuWb\",\n      decoded: \u003c\u003c1, 35, 69, 103, 137, 171, 205, 239, 1, 35, 69, 103, 137, 171, 205, 239, 1, 35, 69, 103, 137, 171, 205, 239, 1, 35, 69, 103, 137, 171, 205, 239\u003e\u003e,\n      version: :wif,\n      version_bin: \u003c\u003c128\u003e\u003e}\n    iex\u003e Area58check.encode(privkey, \u003c\u003c128\u003e\u003e)\n    %Area58check{encoded: \"5HpneLQNKrcznVCQpzodYwAmZ4AoHeyjuRf9iAHAa498rP5kuWb\",\n      decoded: \u003c\u003c1, 35, 69, 103, 137, 171, 205, 239, 1, 35, 69, 103, 137, 171, 205, 239, 1, 35, 69, 103, 137, 171, 205, 239, 1, 35, 69, 103, 137, 171, 205, 239\u003e\u003e,\n      version: :wif,\n      version_bin: \u003c\u003c128\u003e\u003e}\n    iex\u003e Area58check.encode(privkey, 0x80)\n    %Area58check{encoded: \"5HpneLQNKrcznVCQpzodYwAmZ4AoHeyjuRf9iAHAa498rP5kuWb\",\n      decoded: \u003c\u003c1, 35, 69, 103, 137, 171, 205, 239, 1, 35, 69, 103, 137, 171, 205, 239, 1, 35, 69, 103, 137, 171, 205, 239, 1, 35, 69, 103, 137, 171, 205, 239\u003e\u003e,\n      version: :wif,\n      version_bin: \u003c\u003c128\u003e\u003e}\n\nEncode a public key into an address:\n\n    iex\u003e {uncompressed_pubkey, _priv_key} = :crypto.generate_key(:ecdh, :crypto.ec_curve(:secp256k1), privkey)\n    iex\u003e derived_uncomp_pubkey = :crypto.hash(:ripemd160, :crypto.hash(:sha256, uncompressed_pubkey))\n    iex\u003e Area58check.encode(derived_uncomp_pubkey, 0x00)\n    %Area58check{\n      decoded: \u003c\u003c124, 106, 230, 190, 9, 150, 81, 133, 169, 75, 13, 161, 139, 201, 42, 157, 252, 238, 97, 23\u003e\u003e,\n      encoded: \"1CLrrRUwXswyF2EVAtuXyqdk4qb8DSUHCX\",\n      version: :p2pkh,\n      version_bin: \u003c\u003c0\u003e\u003e}\n\nError when version is unknown:\n\n    iex\u003e Area58check.encode(privkey, :jhkdsfajhkfdasjhkfd)\n    ** (ArgumentError) :jhkdsfajhkfdasjhkfd is not a recognized version.\n    You can either pass a charlist (ex: [4, 136, 178, 30]), number (ex:\n    70617039), hexadecimal (ex: 0x043587CF), binary version (ex: \u003c\u003c4,\n    136, 178, 30\u003e\u003e), or a recognized atom like any of: :bip32_privkey,\n    :bip32_pubkey, :p2pkh, :p2sh, :testnet_bip32_privkey,\n    :testnet_bip32_pubkey, :testnet_p2pkh, :testnet_p2sh, :testnet_wif, :wif\n\n#### Decoding\n\nDecoding strings encoded with base58check:\n\n    iex\u003e Area58check.decode(\"1CLrrRUwXswyF2EVAtuXyqdk4qb8DSUHCX\")\n    {:ok, %Area58check{decoded: \u003c\u003c124, 106, 230, 190, 9, 150, 81, 133, 169, 75, 13, 161, 139, 201, 42, 157, 252, 238, 97, 23\u003e\u003e,\n      encoded: \"1CLrrRUwXswyF2EVAtuXyqdk4qb8DSUHCX\",\n      version: :p2pkh,\n      version_bin: \u003c\u003c0\u003e\u003e}}\n    iex\u003e Area58check.decode(\"5HpneLQNKrcznVCQpzodYwAmZ4AoHeyjuRf9iAHAa498rP5kuWb\")\n    {:ok, %Area58check{\n      decoded: \u003c\u003c1, 35, 69, 103, 137, 171, 205, 239, 1, 35, 69, 103, 137, 171, 205, 239, 1, 35, 69, 103, 137, 171, 205, 239, 1, 35, 69, 103, 137, 171, 205, 239\u003e\u003e,\n      encoded: \"5HpneLQNKrcznVCQpzodYwAmZ4AoHeyjuRf9iAHAa498rP5kuWb\",\n      version: :wif,\n      version_bin: \u003c\u003c128\u003e\u003e\n    }}\n\nIf checksum is not valid returns error:\n\n    iex\u003e Area58check.decode(\"1CheckSumError\")\n    {:error, :checksum_incorrect}\n\nIf contains a non valid character like `0`, `O`, `l`, `I`, returns\nerror:\n\n    iex\u003e Area58check.decode(\"ContainsInvalidCharacter0\")\n    {:error, :incorrect_base58}\n\n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed\nby adding `area58check` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:area58check, \"~\u003e 0.1\"},\n  ]\nend\n```\n\nThe docs can be found at\n[https://hexdocs.pm/area58check](https://hexdocs.pm/area58check).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanxuu%2Farea58check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivanxuu%2Farea58check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanxuu%2Farea58check/lists"}