Menu

Making MetaMask and TronLink sign transactions for a custom Rust blockchain
📰

Making MetaMask and TronLink sign transactions for a custom Rust blockchain

DEV Community: rust·Mehran Mazhar·about 23 hours ago
#vo8KRVPI
#devtorust#devto#dev#chain#block
Reading 0:00
15s threshold

A few months ago I wrote How I Built a Custom Rust Blockchain for On-Chain Ride Lifecycle . Clutch is a ride-sharing protocol where the rider pays the driver directly, and every step of a ride (request, offer, accept, pay, cancel) is a native transaction type on a small Proof-of-Authority chain written in Rust.

Since then it went from "testnet with a faucet" to a mainnet that holds real money. This post is about the parts I did not expect to be hard: getting normal wallets to sign for a chain they have never heard of, and keeping the token honest once it is backed by real USDT.

If you read part 1: block rewards are gone. The block author is now paid by a flat fee on each transaction.

The problem: wallets refuse to sign a bare hash

In part 1, the SDK held a local key and signed the transaction hash directly:

hash = keccak256(rlp([from, nonce, chain_id, data])) signature = secp256k1_sign(keccak256(hash_as_hex_string))

Enter fullscreen mode

Exit fullscreen mode

That works for an SDK.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.