4thTech entered the Solana Ignition hackathon with FOURdx & FOURim
2
1
4thpillar Technologies or short 4thTech is the next-gen multi-blockchain ecosystem, platform, cryptocurrency, and a suite of decentralized applications that enable users to exchange metadata, data files and instant messages from wallet to wallet in a secure and decentralized manner. 4thTech Solana FOURdx and FOURim development coincide directly with Solana Ignition, so entering the hackathon seems the right call to make.

We believe that multi-blockchain support enables transaction cost and speed choice, which is especially important when dealing with public blockchains. Next, to already supported Ethereum, HashNet and Edgeware, we are adding Solana blockchain as the fourth FOURdx (i.e., wallet to wallet data exchange) supported blockchain. Due to high transaction speeds and low transaction costs, Solana enables a new 4thTech FOURim protocol (i.e., on-chain instant messaging).
4thTech Hackathon Submissions
(1) FOURdx, a 4thTech Blockchain “WeTransfer” Alternative
Solana data file exchange protocol (FOURdx)
(2) FOURim, Solana Blockchain Instant Messaging Protocol
Solana blockchain instant messaging protocol (FOURim)
FOURdx, a 4thTech Blockchain “WeTransfer” Alternative
## Inspiration
The need for immutable, unmodifiable ultra-fast digital data file exchange is imminent. E-mail is not appropriate, non-secure and does not fulfil the task in question. The moment we exchange data files using a centralised solution using an intermediary we lose control. Digital content can be created, edited, manipulated and exchanged very easily, which causes trust issues and slows down digital transformation. 4thTech is already solving this challenge with its blockchain data file exchange protocol or FOURdx, which can now with Solana deployment reach new levels of adoption in regards to speed and low transaction cost.
## What it does
FOURdx, a 4thTech Blockchain “WeTransfer” Alternative. Unlike current centralized online data file exchange solutions, FOURdx leverages trust sourced from the blockchain and provides a secure, immutable wallet A to wallet B (i.e., FOURwaL) data file exchange. It can also be defined as a decentralized network framework that supports any data exchange between wallet addresses of supported blockchains (i.e., Ethereum, HashNet, Polkadot, Edgeware and now Solana). Supported by a modern intuitive web platform and thanks to multi-chain support, the FOURdx enables organizations and individuals to collaborate and exchange data in a secure, accessible, affordable and decentralised manner.
## How we built it
A so-called envelope was prepared, which is an object that contains additional data of data that we want to send, data of the receiver and sender. This envelope object is later on converted to JSON string encrypted with receiver RSA public key and saved as a file. This file is in our documentation called `JSON metadata file`.
1. **Prepare an envelope**
At this step, we prepare the envelope object.
```ts
const envelope: Envelope = await prepareEnvelope();
```
_Retrieve the public key_
First, we need a receiver RSA public key which is used for encrypting data. Those data can later decrypt only the receiver with his private key.
```ts
// Retrieve a receiver RSA public key
const recipientPublicKey = await storageService.retrievePublicKey(
formData.recipient.account.address,
);
```
_Prepare attachments_
Our post-service library takes care of all the necessary steps and for every attachment return name, URL, and checksum.
```ts
return {
document: {
// …
attachments: await postService.prepareAttachments(
formData.document.attachments,
recipientPublicKey,
),
},
// …
};
```
1.1. Checksum calculation
```ts
crypto.createHash(‘sha256’).update(data).digest(‘hex’)
```
1.2. File encryption
```ts
// Symmetric encrypt
const symKey = crypto.randomBytes(32);
const iv = crypto.randomBytes(16);
const cipher = crypto.createCipheriv(‘aes-256-cbc’, symKey, iv);
const symEncrypted = Buffer.concat([cipher.update(fileData), cipher.final()]).toString(
‘base64’,
);
// Asymmetric encrypt — encrypt just symmetric key & iv
const key = new NodeRSA();
key.importKey(publicKey, ‘pkcs8-public’);
const symPrefix = `${symKey.toString(‘base64’)}:${iv.toString(‘base64’)}`;
const encrypted = key.encrypt(symPrefix, ‘base64’);
// Join asymmetric and symmetric part
const data = Buffer.from(`${encrypted}:${symEncrypted}`);
```
1.3. File upload
```ts
await new StorageService().uploadFile(encryptedFile.file)
```
_Envelope example_
Below is an example of an envelope converted to JSON string.
```json
{
“document”:{
“subject”:”Test subject”,
“content”:”Test content…”,
“attachments”:[
{
“name”:”Screenshot 2021–01–25 at 23.48.41.png”,
“url”:”https://www.the4thpillar.com/storage/documents/9237dc3008f1f9be6ca76656eedbcbb26070100b32e21.png",
“checksum”:”026ce0abf35fc9c28b98eaa4639680920bbd2ac550045b3810171f18ce14a43f”
},
{
“name”:”Screenshot 2020–02–18 at 17.22.17.png”,
“url”:”https://www.the4thpillar.com/storage/documents/803c46f0e579d3726d08dbade4c70ca36070100b5ff8b.png",
“checksum”:”e970c5da38c8a8a747ca14f8efc74d0c5b22fa07a185d75a4f9e9871900bfab0"
}
]
},
“recipient”:{
“account”:{
“address”:”5FPEZd1bUNLVpLAzTc2Sx3i3bvbxVDzezu18sDsLHDVSMqWd”
},
“name”:””
},
“sender”:{
“account”:{
“address”:”5GUBxVyG1dKEuPw3VVD2tRADptViYsxi2TRD6V5cA3cnj4pa”,
“type”:”DOT”
},
“name”:”John Doe”
}
}
```
2. **Upload envelope**
At this step, we upload the envelope to file storage as a JSON metadata file.
```ts
// Upload envelope
const envelopePath = await postService.uploadEnvelope(envelope, recipientPublicKey);
```
Our post-service library takes care of all the necessary steps:
* convert envelope object to a JSON string
* encrypt it
* upload to a file storage
* return envelope path which contains checksum and URL of a JSON metadata file
```ts
// EnvelopePath type
export type EnvelopePath = {
checksum: string;
url: string;
};
```
3. **Save to blockchain**
At this step, we store JSON metadata file URL and checksum to the blockchain.
Our blockchain-service library takes care of all the necessary steps:
* detect target chain
* delegate job to a target chain service which executes all the necessary steps to store data on chain
* return transaction details which contain transaction hash and explorer URL where we can see transaction details
```ts
// Save data to blockcahin
const txDetails: TransactionDetails = await blockchainService.sendDocument(
envelope.sender.account,
envelope.recipient.account.address,
envelopePath,
);
```
## Challenges we ran into
The biggest challenge was finding a solution to GDPR legal framework. GDPR states that the data should be modified or erased. Because the data stored on the blockchain is immutable, the FOURdx protocol does not store any data on the blockchain. The data is stored off-chain. The protocol records links to encrypted files and hashes of the encrypted content on the blockchain. The hashing of exchange data enables GDPR compliance, for example, if there were a request to delete some data files, the network controller would be able to delete the requested data files from off-chain storage, leaving what would then become an empty hash on-chain.
Another challenge was interoperability. We added multi-blockchain support to enable transaction cost and speed choice, which is especially important when dealing with public blockchains. Next, to already supported `Ethereum`, two additional blockchains were already added; `HashNet` and `Polkadot substrate Edgeware`, both chosen based on their uniqueness. Due to extreme transaction speed, `Solana` comes as the fourth supported blockchain and will serve as the blockchain of choice enabling the instant messaging protocol (i.e., FOURim) and digital data file exchange (i.e., FOURdx).
## Accomplishments that we’re proud of
We are proud of our coming fourth-year birthday. We are extremely proud of our breakthroughs in the fields of multi-blockchain application deployment and our research and development from the fields of decentralized data file and instant messaging exchange. And lastly, we are proud of our 4thTech multi-blockchain wallet (i.e., FOURwaL), which we have build from the ground up.
## What we learned
During the past four years, we have learned that the need for a secure data file exchange is crucial. We have also learned that besides 4thTech there are no working solutions to enable end-users to exchange data files from wallet to wallet in a simple and affordable way. We have learned how to enable GDPR compliance and how to tokenize the service.
## What’s next for Solana data file exchange protocol (FOURdx)
Currently, 4htTech uses an off-chain cloud file repository for storing encrypted data files that can be accessed only by the user’s private key. The next step would be to develop a decentralized data storage that will upgrade the current solution. The final goal is to enable users to choose between a temporary (i.e., GDPR compliant current enabled option) centralized cloud storage or to choose a secure permanent decentralized storage for their files.
FOURim, Solana Blockchain Instant Messaging Protocol
## Inspiration
Privacy in online communication is a fundamental right of every person. Exchanging private instant messages securely over the internet should be easy and accessible to all. Blockchain technology proposes the ideal foundation to enable this solution. Up to now, on-chain instant messaging deployment would be hard to achieve due to slow blockchain network speed, congestion and transaction cost. With the arrival of the Solana blockchain on-chain, instant messaging is becoming a reality.
## What it does
The FOURim protocol leverages the Solana blockchain to serve as an immutable ledger exchanging encrypted messages from FOURwaL wallet address A to FOURwaL wallet address B theoretically in real-time. Messages on the blockchain are encrypted with the asymmetric algorithm (i.e., `RSA`), which is used to encrypt the instant message with the public key of the receiver. This design does not allow an attacker to infer relationships between segments of the encrypted message. Smart contracts are used to facilitate two unique requirements: (1) saving instant messages from the sender; and (2) retrieving instant messages from receivers.
## How we built it
FOURim is being added to the existing 4thTech framework which already includes some components needed. Those components are (1) 4thTech Chromium and Firefox add-on wallet with added Solana blockchain support; (2) 4thTech digital identity which serves as a public key exchange point between users; and (3) 4thTech web platform client which enables users to interact with instant messaging protocol.
4thTech web platform client codebase was rewritten with TypeScript and has overgone the crucial performance upgrade from Vue 2 to Vue 3. New features and functions are embedded, so the user experience can be as intuitive as possible. The update includes automatic electronic data verification (i.e., FOURns), while the blockchain network address recognition system simplifies the data file exchange (i.e., FOURdx) process. The 4thTech web platform client enables users to solve important technical blockchain challenges within a niche sector of data file exchange and instant messaging while supporting Ethereum, HashNet, Polkadot-Edgeware and now Solana public chains.
// Retrieve a receiver RSA public key
const recipientPublicKey = await storageService.retrievePublicKey(
formData.recipient.account.address,
);
// Asymmetric encrypt — encrypt message
const key = new NodeRSA();
key.importKey(publicKey, ‘pkcs8-public’);
const encryptedMessage = key.encrypt(message, ‘base64’);
// Save data to blockcahin
const txDetails: TransactionDetails = await blockchainService.sendInstantMessage(
sender.account,
recipient.account.address,
encryptedMessage,
);
## Challenges we ran into
The capacity of the message length and exact TX message cost will be determined in the test phase. There is a possibility of the unlimited message length which would directly correlate with TX price.
## Accomplishments that we’re proud of
We are proud of our coming fourth-year birthday. We are extremely proud of our breakthroughs in the fields of multi-blockchain application deployment and our research and development from the fields of decentralized data file and instant messaging exchange.
## What we learned
During the past four years, we have learned that blockchain adoption will be coming first from the crypto space and later from the mainstream sectors. When Ethereum TX cost for executing our wallet to wallet data file exchange SC went to 160$, we learned that you can not rely only on one chain and that blockchain interoperability and multi-chain deployment is a must.
## What’s next for Solana blockchain instant messaging protocol
After a successful deployment of the Solana instant messaging protocol (i.e., FOURim) on the 4thTech web platform client, we are planning to develop a mobile client application.
More 4thTech information
4thTech entered the Solana Ignition hackathon with FOURdx & FOURim was originally published in /4thtech on Medium, where people are continuing the conversation by highlighting and responding to this story.
2
1
Securely connect the portfolio you’re using to start.




