code: function signTx (tx, privKey) {
    if (!tx.match(/^tx\_.+/)) {
      throw Error('Not a valid transaction')
    }
  
    const binaryKey = (() => {
      if (program.file) {
        return fs.readFileSync(program.file)
      } else if (privKey) {
        return Buffer.from(privKey, 'hex')
      } else {
        throw Error('Must provide either [privkey] or [file]')
      }
    })()
  
    const decryptedKey = program.password ? Crypto.decryptKey(program.password, binaryKey) : binaryKey
  
    // Split the base58Check part of the transaction
    const base58CheckTx = tx.split('_')[1]
    // ... and sign the binary create_contract transaction
    const binaryTx = Crypto.decodeBase58Check(base58CheckTx)
  
    const signature = Crypto.sign(binaryTx, decryptedKey)
  
    // the signed tx deserializer expects a 4-tuple:
    // <tag, version, signatures_array, binary_tx>
    const unpackedSignedTx = [
      Buffer.from([11]),
      Buffer.from([1]),
      [Buffer.from(signature)],
      binaryTx
    ]
  
    console.log(Crypto.encodeTx(unpackedSignedTx))
  }
docs: ## Transaction Signing  This function shows how to use a compliant private key to sign an æternity transaction and turn it into an RLP-encoded tuple ready for mining