Two sample scripts demonstrating transaction and payload signing via the Turnkey API.
Signs an arbitrary hex-encoded payload using Keccak256 hashing.
Copy .env.example to .env and fill in the values:
cp examples/signing/sign_raw_payload/.env.example examples/signing/sign_raw_payload/.envset -a && source examples/signing/sign_raw_payload/.env && set +a && go run ./examples/signing/sign_raw_payloadPrints the signature r, s, and v values on success.
Signs an Ethereum transaction (EIP-1559) using a Turnkey wallet address or private key ID.
Follow the Quickstart to get your API key and organization ID, then create a wallet to sign with.
Copy .env.example to .env and fill in the values:
cp examples/signing/sign_transaction/.env.example examples/signing/sign_transaction/.envTURNKEY_UNSIGNED_TRANSACTION defaults to an EIP-1559 transaction sending 0 ETH to the zero address on mainnet if not set.
set -a && source examples/signing/sign_transaction/.env && set +a && go run ./examples/signing/sign_transactionPrints the signed transaction hex on success.