Fork Document v1.0.0 - Second-Earth/setchain GitHub Wiki
Added UpdateCandidatePubKey
transaction type. The payload
parameter is the public key (as follows). After the transaction is successful, the producer can use the private key corresponding to the public key to mine, achieving the purpose of separating the account private key from the mining private key.
arg := &args.UpdateCandidatePubKey{
PubKey: pubKey,
}
Before sending the transaction, you can configure the set private key to the mining node. The command is ./set miner setcoinbase "accout123456" priKey.txt
When transferring agreement assets, from
and to
need to have a contract
account that is the agreement asset before they can transfer. After the new transferable()
method is added to the contract, when there is transferable()
in the contract
of the agreement asset, the agreement asset can be transferred just like a normal asset without restrictions. The function takes effect when the transferable()
method returns true
, and it is still subject to the original restrictions when it returns false
or there is no such method. The transferable()
method is as follows:
function transferable() public returns(bool) {
return true;
}
Newly added the commission payment function, sending transactions can be paid by a third party on behalf of the commission. Examples of transactions are as follows:
func transferfp(from, to common.Name, amount *big.Int, assetid uint64, nonce uint64, prikey *ecdsa.PrivateKey) {
Key := types.MakeKeyPair(prikey, []uint64{0})
GasPrice, _ := testcommon.GasPrice()
fp := &types.FeePayer{
GasPrice: gasPrice,//Payment fee GasPrice, required when paying on behalf
Payer: toname,//Payment fee account
Sign: &types.Signature{0, make([]*types.SignData, 0)},
}}
PayerKey := types.MakeKeyPair(minerprikey, []uint64{0})//Payment fee account private key
SendTransferTxfp(types.Transfer, from, to, nonce, assetid, amount, nil, []*types.KeyPair{key}, fp, []\*types.KeyPair{payerKey})
}
func sendTransferTxfp(txType types.ActionType, from, to common.Name, nonce, assetID uint64, value *big.Int, input []byte, keys []*types.KeyPair, fp *types.FeePayer, payerKeys []*types .KeyPair) {
Action := types.NewAction(txType, from, to, nonce, assetID, gaslimit, value, input, nil)
Gasprice, _ := testcommon.GasPrice()
if fp != nil {
Gasprice = big.NewInt(0)//When there is a payer, this gasprice must be 0
}}
Tx := types.NewTransaction(0, gasprice, action)
signer := types.MakeSigner(big.NewInt(1))
Err := types.SignActionWithMultiKey(action, tx, signer, 0, keys)
If err != nil {
Jww.ERROR.Fatalln(err)
}}
if fp != nil {
Err = types.SignPayerActionWithMultiKey(action, tx, signer, fp, 0, payerKeys)
If err != nil {
Jww.ERROR.Fatalln(err)
}
}}
rawtx, err := rlp.EncodeToBytes(tx)
If err != nil {
Jww.ERROR.Fatalln(err)
}}
hash, err := testcommon.SendRawTx(rawtx)
If err != nil {
Jww.INFO.Println("result err: ", err)
}
Jww.INFO.Println("result hash: ", hash.Hex())
}
-1. Asset amount
circulation is limited to the maximum value of uint256
type
-2. Asset founder
cannot be modified to empty
-3. Solve the problem of the contract calling sha256
gas
deduction exception
-4. Solve the deduction exception of gas
for repeated deployment contracts
-5. Solve the problem that the block node list may be abnormal after starting dpos
first and then forking