diff --git a/pkg/rpc/txBuilder.go b/pkg/rpc/txBuilder.go index 1f4b001d8..1d7f4dc46 100644 --- a/pkg/rpc/txBuilder.go +++ b/pkg/rpc/txBuilder.go @@ -48,8 +48,10 @@ func CreateRawContractTransaction(params ContractTxParams) (*transaction.Transac tx.AddInput(&input) } - senderOutput = transaction.NewOutput(assetID, spent-amount, fromAddressHash) - tx.AddOutput(senderOutput) + if senderUnspent := spent - amount; senderUnspent > 0 { + senderOutput = transaction.NewOutput(assetID, senderUnspent, fromAddressHash) + tx.AddOutput(senderOutput) + } receiverOutput = transaction.NewOutput(assetID, amount, toAddressHash) tx.AddOutput(receiverOutput)