Choose the provider most reliable for your needs and region.
This tool is used for converting HEX encoding to UTF-16 Big Endian (UTF-16BE).
UTF-16 is a character encoding that can encode all 1,112,064 valid Unicode code points.
Big-endian is an order in which the "big end" (most significant value in the sequence) is stored first at the lowest storage address.
In contrast, little-endian is an order where the "little end" (least significant value in the sequence) is stored first.
Byte Index | 0 | 1 |
---|---|---|
Big-Endian | 12 | 34 |
Little-Endian | 34 | 12 |
An SMS can encode 160 7-bit characters into 140 bytes. However, not all characters represent 1 character. Certain characters in GSM 03.38 require an escape character, such as: |, ^, {, }, €, [, ~, ]
and \
.
For Unicode SMS, we are limited to 70 characters (or 67 in multipart SMS).
Most providers do not accept invisible control characters and unused code points
or any type of invisible separator
. They replace these with the character �
U+FFFD
, which makes the transaction invalid.
Modern providers and phones support UCS-2 (a now-defunct character encoding), which has been replaced with UTF-16 Big Endian (UTF-16BE).
To prevent the rejection of certain characters, we prefix them with a tilde ~
character (007E), followed by the 2+2 hex digits converted to Unicode characters.
Both 2 hex digits receive the 01
prefix.
For example:
- We receive hex
09CA
, which is not a valid Unicode character in Bengali. - We split it into two 2+2 parts.
- We prefix the first half with
01
, resulting in0109
, which is converted to ĉ. - We prefix the second part with
01
, resulting in01CA
, which is converted to NJ. - The converted characters are prefixed with a
~
tilde. - The result is the
~ĉNJ
string.
To divide transactions in the data feed, use the Line feed character. In scripts, this is usually referred to as \n
or \r
, depending on the OS.
Based on these findings, you should be capable of sending CORE transactions (or any others) encoded by UTF-16BE on modern networks and phones through SMS.
Notes:
- In some instances, you may need to swap the buffer from Little Endian to Big Endian.
- Base62 is a great tool for converting UTF-16 characters into ASCII.
- We exclude characters from the UTF-16 Basic Multilingual Plane:
Core Blockchain transactions should be packed into 2-3 SMS messages.
TXMS, while dependent on UTF-16, is shorter, making it slightly more efficient than plain HEX in the context of SMS.
However, there is a significant difference in the length of the messages.
In native systems that support UTF-16, you will always achieve the best or most competitive results.
npm i txms.js
yarn add txms.js
import txms from 'txms.js';
let encoded = txms.encode(hex);
let decoded = txms.decode(string);
or
var txms = require('txms.js');
var encoded = txms.encode(hex);
var decoded = txms.decode(string);
-
encode(hex: string): string
— Convert hex transaction into UTF-16BE. -
decode(data: string): string
— Convert UTF-16BE into hex transaction. -
getEndpoint(network?: number | string, countriesList?: string | Array<string>): { [key: string]: Array<string> }
— Get object of SMS endpoints (phone numbers) per country.
-
hex
= hexadecimal representation of transaction without 0x prefix. (If a prefix is present, it is removed.) -
data
= UTF-16BE data -
network
(default: 1) = ID of Core Blockchain network or its name (such as: mainnet, devin). -
countriesList
(default: all) = ISO 3166 Alpha-2 country/ies code/s.
npm i -g txms.js
$ txms {type} {value} {location}
- type:
encode
(e
),decode
(d
),getendpoint
(g
) - value: message; network for getendpoint
- location: ISO 3166 Alpha-2 country/ies code/s for getendpoint
$ echo {value} | txms {type} {location}
Unit tests are included and can be executed with the command yarn test
or npm run test
.
GitHub automatically tests the commits into the source code.
Contributions and extensions to our test cases are welcome.
We use the Core Blockchain - Devin (testnet) wallets for tests.
We can send an SMS back with the status and stream success/failure statuses into the database.
If you need an API endpoint or want to receive an SMS back to the sender's number, please contact us.
You can use our predefined endpoints or create your own service.
To provide the best results, we check the online status of the service with the uptime checker.
Follow these steps:
- Test your service.
- Return the 200 "OK" status code at the
yoururl.tld/ping
endpoint. - Submit a Listing request.
This tool doesn't encrypt, it converts. Therefore, anyone can read your signed transaction, but don't worry as they could do this on the Blockchain anyway.
Stay safe. Do not broadcast your private key or any sensitive data you wish to safeguard.
You're welcome to contribute in any capacity.
We welcome:
- Forking this repository
- Opening a pull request
- Creating your own SMS endpoint
- Sending us some Øres / ₡ores: cb7147879011ea207df5b35a24ca6f0859dcfb145999
- Starring this repository
「Cryptoni Confidimus」
Licensed under the CORE License.