How to Send 0G Transactions via SMS on the Core Blockchain
In today’s day and age, nearly 100% of all data is transmitted over digital networks, primarily the Internet. The shift from 0G to the internet age marks a nearly total transformation in how data is transmitted globally. But what about those 0.01% of cases where you urgently need to get information through but have no internet connectivity?
Well, before the introduction of GPRS, 2G, 3G, and 4G mobile data networks, the signaling and transmission of information was mostly done via 0G. 0G transmission refers to early mobile communication systems that used basic cellular networks to transmit data between devices.
The benefits of 0G transactions
Though a 5G or 4G connection is almost a given in the world we live in today, the key word here is ‘almost’. That is because even in well-developed areas, coverage limitations and cost constraints play a huge role in your ability to reliably send and receive data. On the other hand, while lacking in a lot of areas, 0G transactions have their own benefits when compared to modern digital transactions, namely:
Wider coverage area: 0G systems rely on analog signals, which allows them to cover large areas with fewer base stations, especially useful in remote or rural regions. Simplicity and maintenance: These systems are simpler to implement and maintain compared to modern digital networks, making them more accessible in certain situations.
To illustrate the feasibility of 0G transactions on blockchain, imagine enjoying wine in a cellar where there’s no internet connectivity and wanting to pay via crypto. This is possible using TxMS, which operates without data connections.
The capabilities of 0G transactions
Core Blockchain’s TxMS can handle any data in hexadecimal format, as described in the binary-to-text encoding process. This means any transaction you want to be recorded on the blockchain’s ledger can be recorded with zero internet connectivity. This is primarily beneficial in rural areas, areas with shoddy connectivity, or even emergency cases where you urgently need to get information through to the blockchain’s ledger. To test and try out TxMS technology and explore its possible use cases and implementations more thoroughly, you can either utilize the Core Blockchain endpoints or set up your own TxMS server.
So, here’s how you can try this out
Step 1: Create and Sign a Core Blockchain Transaction
First, you need to create and sign a Core Blockchain transaction.
If you don't have the go-core
client installed, you can download it here for your platform.
Once downloaded, make the file executable by navigating to the directory containing gocore
and running the following command:
chmod +x gocore
You can now run the client with:
./gocore --verbosity 2 --nat any console
This opens an interactive console where you can execute commands.
Step 2: Create a New Account
To sign transactions, you need an account. You can either create a new account or import an existing one (UTC file). For now, let’s create a new account:
personal.newAccount("your_passphrase")
Replace your_passphrase
with something you will remember! If you'd rather not use a passphrase, simply omit it. The UTC file will be stored in ~/Library/Core/keystore/
(on Mac).
Step 3: Check Sync Status (Optional)
You may not be fully synchronized with the Core Blockchain, which is not strictly required but can be helpful. Use the following command to check your sync status:
xcb.syncing
If you're synchronized, this command returns false
. Synchronization consumes bandwidth and computing power, so you might want to leave it running when you're not actively using it.
Step 4: Create and Prepare a Transaction
To get the nonce for your account (which should be 0
for the first transaction), run:
web3.xcb.getTransactionCount("cb…")
Make sure your client is synchronized to get the correct nonce.
Now, compose your first transaction:
var tx = {nonce: '0x0', energy: 21000, energyPrice: 1000000000, from: "cb…", to: "cb…", value: web3.toOre(1)}
Here's a breakdown of the fields:
nonce
: The transaction count (in hexadecimal format).energy
: The computational effort required, 21000 is standard for simple transfers.energyPrice
: The amount of Core you're willing to pay per unit of energy (measured in 'nucle' from Core denomination table).from
: The sender's ICAN address.to
: The recipient's ICAN address.value
: The amount of Core to send, using the helper functionweb3.toOre
.
Step 5: Sign the Transaction
Before signing, you'll need to unlock your account:
personal.unlockAccount("cb…")
You'll be prompted for your passphrase (or just press Enter if you didn't set one). The account will remain unlocked for 300 seconds (5 minutes).
Next, sign the transaction and store it in the txSigned
variable:
var txSigned = xcb.signTransaction(tx)
Step 6: Prepare the Raw Transaction for TxMS
To prepare the raw transaction, print it with:
txSigned.raw
Copy the raw transaction, as you'll need it for the next step.
That is all what we need from Core console now. Keep it running for synchronization or shut down using the command Ctrl + D
.
Step 7: Install TxMS
If you haven't already installed TxMS, you'll need Node.js installed. I recommend using nvm for Mac users. Once you've finished installing Node.js, proceed to the next step.
Install the TxMS library globally:
npm i -g txms.js
After installation, restart your terminal and verify that txms
is recognized by typing command for opening help context:
txms -h
Step 8: Encode the Transaction with TxMS
To encode your transaction with TxMS, run:
txms -e=rawtransaction