Oasis Signature Tools
This repository contains tooling and documentation for manually generating and signing airgapped transactions on Oasis Protocol.
This program formulates bytes to sign from the outputs of Oasis network's tools.
Usage:
go run main.go <base64 raw value>
You need a few things to sign a transaction.
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 the bytes output from above in whatever way you want to. This tool can help you check that your signatures is valid.
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 keysignature
: 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
.
Lastly, broadcast with the Oasis CLI and cleanup.
oasis-cli tx submit tx.json
rm tx.json