Skip to content

Tooling and documentation for generating transaction and signatures in the Oasis network

Notifications You must be signed in to change notification settings

Tessellated-io/oasis-signature-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Oasis Signature Tools

Tessellated Logo By Tessellated // tessellated.io


This repository contains tooling and documentation for manually generating and signing airgapped transactions on Oasis Protocol.

Usage

This program formulates bytes to sign from the outputs of Oasis network's tools.

Usage:

go run main.go <base64 raw value>

Transaction Signing Mini Manual

You need a few things to sign a transaction.

Creating the bytes to sign

First, get the Oasis CLI tools:

git clone https://github.com/oasisprotocol/cli
cd cli && make && mv ./oasis ~/go/bin/oasis-cli

Grab your nonce from OasisScan

export NONCE=31

Use Oasis tools to generate a dummy account. This account prevents the CLI from complaining you don't have a private key.

oasis-cli wallet create insecure_dummy

Use the Oasis tool to build a transaction from the dummy account. We do this so that we can get the raw bytes of the transaction. The CLI will estimate gas and fees automatically, but we have to override the nonce since the CLI is signign from a different account:

Note: You can mess around with the CLI's node endpoints by running ./oasis networks list and related commands

Here's an example for casting a governace vote, but this will work with any transaction at the consensus layer:

oasis-cli network governance cast-vote --account insecure_dummy --format json --nonce $NONCE --output-file tmp-dummy-tx.json 4 yes

Extract the raw bytes and cleanup the dummy transaction file

export RAW_BYTES=$(cat tmp-dummy-tx.json | jq -r .untrusted_raw_value)
rm tmp-dummy-tx.json

The program in this repository will generate bytes to sign for the transaction.

Note: This program only works with consensus layer transactions. If you need to make a different transaction, consider introspecting this code in a debugger.

From this repository's root:

go run main.go $RAW_BYTES

Sign Tx Bytes

Sign the bytes output from above in whatever way you want to. This tool can help you check that your signatures is valid.

Assemble the Final Transaction

The final transaction JSON file is in the following format.

{
  "untrusted_raw_value": "",
  "signature": {
    "public_key": "",
    "signature": ""
  }
}

Set:

  • untrusted_raw_value: To be the raw value outputted by the Oasis CLI (the value we saved in $RAW_BYTES)
  • public_key: To be your public key
  • signature: To be the base64 encoded signature you created

Here's an example:

{
  "untrusted_raw_value": "pGNmZWWiY2dhcxkE2WZhbW91bnRAZGJvZHmiYmlkBGR2b3RlAWVub25jZRgeZm1ldGhvZHNnb3Zlcm5hbmNlLkNhc3RWb3Rl",
  "signature": {
    "public_key": "RS+saioy8ukcohygmbUH0IKGXhLjaE6BWrkdOBBqpDc=",
    "signature": "s7Y5qOojP4U+ku+ZKyRpB0m071vFsKbaDs1XeVeLLh5PDzWCyculhaK7HJIop2KQr7kgD4w/Ef0ll30ZSvFyDA=="
  }
}

Save this to a file, like tx.json.

Broadcast

Lastly, broadcast with the Oasis CLI and cleanup.

oasis-cli tx submit tx.json
rm tx.json

About

Tooling and documentation for generating transaction and signatures in the Oasis network

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages