# signTransaction

Sign the provided transaction with the account selected by the user.

## **Input Arguments**

<table><thead><tr><th width="370">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>transaction: TransactionLike</code></td><td>The transaction to sign</td></tr><tr><td><code>magicNumber?: number</code></td><td>Magic number of network found in protocol.json.</td></tr></tbody></table>

## **Success Response**

| Parameter                      | Description        |
| ------------------------------ | ------------------ |
| `transaction: TransactionLike` | Signed transaction |

## **Error Response**

<table><thead><tr><th width="331">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>type: string</code></td><td>The type of error which has occured</td></tr><tr><td><code>description: string</code></td><td>A description of the error which has occured</td></tr><tr><td><code>data: string</code></td><td>Any raw data associated with the error</td></tr></tbody></table>

## Example

### Request

```js
neolineN3.signTransaction({
  transaction: {
    version: 0,
    nonce: 1262108766,
    systemFee: 997775,
    networkFee: 122862,
    validUntilBlock: 667132,
    attributes: [],
    signers: [{ account: "8ddd95c4b5aa2b049abae570cf9bd4476e9b7667", scopes: 1 }],
    witnesses: [],
    script: "0b110c1467769b6e47d49bcf70e5ba9a042baab5c495dd8d0c1467769b6e47d49bcf70e5ba9a042baab5c495dd8d14c01f0c087472616e736665720c14f563ea40bc283d4d0e05c48ea305b3f2a07340ef41627d5b52"
  },
  magicNumber: 877933390
})
.then(signedTx => {
  console.log('Signed Transaction:', signedTx);
})
.catch((error) => {
  const {type, description, data} = error;
  switch(type) {
    case 'UNKNOWN_ERROR':
        console.log(description);
        break;
    default:
        // Not an expected error object.  Just write the error to the console.
        console.error(error);
        break;
  }
});
```

### Response

```js
{
  version: 0,
  nonce: 1262108766,
  systemFee: 997775,
  networkFee: 122862,
  validUntilBlock: 667132,
  attributes: [],
  signers: [{ account: "8ddd95c4b5aa2b049abae570cf9bd4476e9b7667", scopes: 1 }],
  witnesses: [{
    invocationScript: "0c408f8bee3201d41706834fb91c8696d59744dfd927bea5a6bddd21d952d231f8836b0386989ecf017a1d0096c0acdb99503d29f65588bc4021b66a80f4b277ad8c",
    verificationScript: "0c2102f9667a14b62a551f25a1b1ec4562e1c963ec6334d1ef5e088f3b5febddf4e6484156e7b327"
  }],
  script: "0b110c1467769b6e47d49bcf70e5ba9a042baab5c495dd8d0c1467769b6e47d49bcf70e5ba9a042baab5c495dd8d14c01f0c087472616e736665720c14f563ea40bc283d4d0e05c48ea305b3f2a07340ef41627d5b52"
}
```
