Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change coin hours fee to 1 percent #2528

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
* Add flag `scan` to scan ahead addresses in the wallet that have history transactions.
- CLI command walletKeyExport -p flag is replaced with --path, and -p will be used as a shorthand of --password.
- CLI command `encryptWallet/decryptWallet` will only return none-sensitive data. Data like the seed, secrets and private keys will no longer be returned.
- Include change addresses for a bip44 wallet of the endpoint `/api/v1/wallet`.
- Return change addreseses in endpoint `/api/v1/wallet` for bip44 wallets as well, it used to return none change addresses only.
- Change `coinhours` burn factor to 1 percent.


### Removed
- Removed endpoint `/api/v2/metrics`. The prometheus dependency was removed, this endpoint will no long be supported.
Expand Down
16 changes: 8 additions & 8 deletions INTEGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ After each spend, wait for the transaction to confirm before trying to spend aga
For higher throughput, combine multiple spends into one transaction.

Skycoin uses "coin hours" to ratelimit transactions.
The total number of coinhours in a transaction's outputs must be 50% or less than the number of coinhours in a transaction's inputs,
The total number of coinhours in a transaction's outputs must be 99% or less than the number of coinhours in a transaction's inputs,
or else the transaction is invalid and will not be accepted. A transaction must have at least 1 input with at least 1 coin hour.
Sending too many transactions in quick succession will use up all available coinhours.
Coinhours are earned at a rate of 1 coinhour per coin per hour, calculated per second.
Expand All @@ -166,7 +166,7 @@ coinhours quickly.
When sending coins from the CLI tool, a wallet file local to the caller is used.
The CLI tool allows you to specify the wallet file on disk to use for operations.

See [CLI command API](cmd/skycoin-cli/README.md) for documentation of the CLI interface.
See [CLI command API](cmd/skycoin-cli/README.md) for the documentation of the CLI interface.

To perform a send, the preferred method follows these steps in a loop:

Expand Down Expand Up @@ -196,8 +196,8 @@ A REST API client is also available: [Skycoin REST API Client Godoc](https://god

#### Coinhours

Transaction fees in skycoin is paid in coinhours and is currently set to `50%`,
every transaction created burns `50%` of the total coinhours in all the input
Transaction fees in skycoin is paid in coinhours and is currently set to `1%`,
every transaction created burns `1%` of the total coinhours in all the input
unspents.

You need a minimum of `1` of coinhour to create a transaction.
Expand All @@ -210,7 +210,7 @@ which are then converted to `coinhours`, `1` coinhour = `3600` coinseconds.
##### REST API

When using the REST API, the coin hours sent to the destination and change can be controlled.
The 50% burn fee is still required.
The 1% burn fee is still required.

See the [POST /wallet/transaction](https://github.com/skycoin/skycoin/blob/develop/src/api/README.md#create-transaction)
documentation for more information on how to control the coin hours.
Expand All @@ -224,12 +224,12 @@ When using the CLI the amount of coinhours sent to the receiver is capped to
the number of coins they receive with a minimum of `1` coinhour for transactions
with `<1` skycoin being sent.

The coinhours left after burning `50%` and sending to receivers are sent to the change address.
The coinhours left after burning `1%` and sending to receivers are sent to the change address.

For eg. If an address has `10` skycoins and `50` coinhours and only `1` unspent.
If we send `5` skycoins to another address then that address will receive
`5` skycoins and `5` coinhours, `26` coinhours will be burned.
The sending address will be left with `5` skycoins and `19` coinhours which
`5` skycoins and `5` coinhours, `1` coinhours will be burned.
The sending address will be left with `5` skycoins and `44` coinhours which
will then be sent to the change address.


Expand Down
4 changes: 2 additions & 2 deletions cmd/skycoin/skycoin.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ var (
WebInterfacePort: 6420,
DataDirectory: "$HOME/.skycoin",

UnconfirmedBurnFactor: 10,
UnconfirmedBurnFactor: 100,
UnconfirmedMaxTransactionSize: 32768,
UnconfirmedMaxDropletPrecision: 3,
CreateBlockBurnFactor: 10,
CreateBlockBurnFactor: 100,
CreateBlockMaxTransactionSize: 32768,
CreateBlockMaxDropletPrecision: 3,
MaxBlockTransactionsSize: 32768,
Expand Down
6 changes: 3 additions & 3 deletions fiber.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ default_connections = [
peer_list_url = "https://downloads.skycoin.com/blockchain/peers.txt"
# port = 6000
# web_interface_port = 6420
# unconfirmed_burn_factor = 10
# unconfirmed_burn_factor = 100
# unconfirmed_max_transaction_size = 32 * 1024
# unconfirmed_max_decimals = 3
# create_block_burn_factor = 10
# create_block_burn_factor = 100
# create_block_max_transaction_size = 32 * 1024
# create_block_max_decimals = 3
# max_block_transactions_size = 32 * 1024
Expand All @@ -43,7 +43,7 @@ peer_list_url = "https://downloads.skycoin.com/blockchain/peers.txt"
# unlock_time_interval = 60 * 60 * 24 * 365
# user_max_decimals = 3
# user_max_transaction_size = 32 * 1024
# user_burn_factor = 10
# user_burn_factor = 100
distribution_addresses = [
"R6aHqKWSQfvpdo2fGSrq4F1RYXkBWR9HHJ",
"2EYM4WFHe4Dgz6kjAdUkM6Etep7ruz2ia6h",
Expand Down
4 changes: 4 additions & 0 deletions src/api/health_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ import (
"github.com/skycoin/skycoin/src/visor"
)

func TestMain(m *testing.M) {
params.UserVerifyTxn.BurnFactor = 10
}

func TestHealthHandler(t *testing.T) {
cases := []struct {
name string
Expand Down
5 changes: 5 additions & 0 deletions src/cli/create_rawtx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ import (
"github.com/stretchr/testify/require"

"github.com/skycoin/skycoin/src/cipher"
"github.com/skycoin/skycoin/src/params"
"github.com/skycoin/skycoin/src/readable"
"github.com/skycoin/skycoin/src/testutil"
"github.com/skycoin/skycoin/src/transaction"
"github.com/skycoin/skycoin/src/util/fee"
)

func TestMain(m *testing.M) {
params.UserVerifyTxn.BurnFactor = 10
}

func TestMakeChangeOut(t *testing.T) {
// single destination test
uxOuts := []transaction.UxBalance{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
"gui_enabled": false,
"block_publisher": false,
"user_verify_transaction": {
"burn_factor": 10,
"burn_factor": 100,
"max_transaction_size": 32768,
"max_decimals": 3
},
"unconfirmed_verify_transaction": {
"burn_factor": 10,
"burn_factor": 100,
"max_transaction_size": 32768,
"max_decimals": 3
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
"gui_enabled": false,
"block_publisher": false,
"user_verify_transaction": {
"burn_factor": 10,
"burn_factor": 100,
"max_transaction_size": 32768,
"max_decimals": 3
},
"unconfirmed_verify_transaction": {
"burn_factor": 10,
"burn_factor": 100,
"max_transaction_size": 32768,
"max_decimals": 3
},
Expand Down
4 changes: 2 additions & 2 deletions src/cli/integration/testdata/status-no-unconfirmed.golden
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
"gui_enabled": false,
"block_publisher": false,
"user_verify_transaction": {
"burn_factor": 10,
"burn_factor": 100,
"max_transaction_size": 32768,
"max_decimals": 3
},
"unconfirmed_verify_transaction": {
"burn_factor": 10,
"burn_factor": 100,
"max_transaction_size": 32768,
"max_decimals": 3
},
Expand Down
4 changes: 2 additions & 2 deletions src/cli/integration/testdata/status.golden
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
"gui_enabled": false,
"block_publisher": false,
"user_verify_transaction": {
"burn_factor": 10,
"burn_factor": 100,
"max_transaction_size": 32768,
"max_decimals": 3
},
"unconfirmed_verify_transaction": {
"burn_factor": 10,
"burn_factor": 100,
"max_transaction_size": 32768,
"max_decimals": 3
},
Expand Down
6 changes: 3 additions & 3 deletions src/fiber/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ func setDefaults() {
viper.SetDefault("node.genesis_coin_volume", 100e12)
viper.SetDefault("node.port", 6000)
viper.SetDefault("node.web_interface_port", 6420)
viper.SetDefault("node.unconfirmed_burn_factor", 10)
viper.SetDefault("node.unconfirmed_burn_factor", 100)
viper.SetDefault("node.unconfirmed_max_transaction_size", 32*1024)
viper.SetDefault("node.unconfirmed_max_decimals", 3)
viper.SetDefault("node.create_block_burn_factor", 10)
viper.SetDefault("node.create_block_burn_factor", 100)
viper.SetDefault("node.create_block_max_transaction_size", 32*1024)
viper.SetDefault("node.create_block_max_decimals", 3)
viper.SetDefault("node.max_block_transactions_size", 32*1024)
Expand All @@ -175,6 +175,6 @@ func setDefaults() {
viper.SetDefault("params.unlock_address_rate", 5)
viper.SetDefault("params.unlock_time_interval", 60*60*24*365)
viper.SetDefault("params.user_max_decimals", 3)
viper.SetDefault("params.user_burn_factor", 10)
viper.SetDefault("params.user_burn_factor", 100)
viper.SetDefault("params.user_max_transaction_size", 32*1024)
}
2 changes: 1 addition & 1 deletion src/params/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ var (
// UserVerifyTxn transaction verification parameters for user-created transactions
UserVerifyTxn = VerifyTxn{
// BurnFactor can be overriden with `USER_BURN_FACTOR` env var
BurnFactor: 10,
BurnFactor: 100,
// MaxTransactionSize can be overriden with `USER_MAX_TXN_SIZE` env var
MaxTransactionSize: 32768, // in bytes
// MaxDropletPrecision can be overriden with `USER_MAX_DECIMALS` env var
Expand Down
6 changes: 6 additions & 0 deletions src/transaction/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ import (

"github.com/skycoin/skycoin/src/cipher"
"github.com/skycoin/skycoin/src/coin"
"github.com/skycoin/skycoin/src/params"
"github.com/skycoin/skycoin/src/testutil"
"github.com/skycoin/skycoin/src/util/fee"
)

func TestMain(m *testing.M) {
// pin the burn factor to 10
params.UserVerifyTxn.BurnFactor = 10
}

func TestCreate(t *testing.T) {
headTime := uint64(time.Now().UTC().Unix())
seed := []byte("seed")
Expand Down
4 changes: 4 additions & 0 deletions src/util/fee/fee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import (
"github.com/skycoin/skycoin/src/testutil"
)

func TestMain(m *testing.M) {
params.UserVerifyTxn.BurnFactor = 10
}

type verifyTxnFeeTestCase struct {
inputHours uint64
outputHours uint64
Expand Down
4 changes: 4 additions & 0 deletions src/visor/visor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ const (
blockchainPubkeyStr = "0328c576d3f420e7682058a981173a4b374c7cc5ff55bf394d3cf57059bbe6456a"
)

func TestMain(m *testing.M) {
params.UserVerifyTxn.BurnFactor = 10
}

func prepareDB(t *testing.T) (*dbutil.DB, func()) {
db, shutdown := testutil.PrepareDB(t)

Expand Down
5 changes: 5 additions & 0 deletions src/wallet/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@ import (

"github.com/skycoin/skycoin/src/cipher"
"github.com/skycoin/skycoin/src/coin"
"github.com/skycoin/skycoin/src/params"
"github.com/skycoin/skycoin/src/testutil"
"github.com/skycoin/skycoin/src/transaction"
"github.com/skycoin/skycoin/src/util/fee"
"github.com/skycoin/skycoin/src/wallet"
"github.com/skycoin/skycoin/src/wallet/collection"
)

func TestMain(m *testing.M) {
params.UserVerifyTxn.BurnFactor = 10
}

func TestWalletSignTransaction(t *testing.T) {
txnSigned, uxs, seckeys := makeTransaction(t, 4)
require.Equal(t, 4, len(uxs))
Expand Down