0
votes

Right now I am working on a smart contract with which, people are able to gamble.
I want to introduce a small fee, a user has to pay every time they send ether to the smart contracts address.
The fee should be automatically sent from the smart contract to my private ether wallet whenever someone starts a new game (sends ether to the contract)

since I am new to solidity and blockchain coding, any help is much appreciated

1

1 Answers

0
votes

Just transfer the amount you want (your fee) to your address.

i.e.

    uint256 yourFee = msg.value * percentFee;
    yourAdress.transfer(yourFee);

Don't forget to make the function payable.