Bitcoin Forum
June 20, 2024, 10:18:42 AM *
News: Voting for pizza day contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: honeypot contract  (Read 116 times)
cyberjs (OP)
Newbie
*
Offline Offline

Activity: 62
Merit: 0


View Profile
March 10, 2022, 12:43:45 PM
 #1

Hello, I am nodejs software developer. I'm learning solidity. I'm beginner level.

I have seen a lot of honeypot contracts, what is the logic of their operation? Are there any places where it is used other than rug-pull? Is it completely made to defraud people?
Is there a contract similar to this one? I would like to examine.

(if the relevant topic is prohibited, I can remove it.)
TryNinja
Legendary
*
Offline Offline

Activity: 2870
Merit: 7116


Crypto Swap Exchange


View Profile WWW
March 10, 2022, 12:58:03 PM
 #2

One I've seen a few times is the contract of a modified ERC20 token where an EOA (Externally Owned Address) can disable swaps from any address other than his own by calling a function.

Something like this:

Code:
address owner = MY_ADDRESS;
bool isHoneypotActivated = false;

modifier onlyOwner {
  require(msg.sender == owner);
}

function transfer(address _to, uint256 _amount) public {
  require(msg.sender == owner || isHoneypotActivated == false);
  // NORMAL ERC20 TRANSFER BELOW
}

function enableHoneypot() onlyOwner public {
  isHoneypotActivated = true;
}


When isHoneypotActivated is true, which happens after the owner (me) calls enableHoneypot, no one else will be able to transfer the tokens (i.e to sell).

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
cyberjs (OP)
Newbie
*
Offline Offline

Activity: 62
Merit: 0


View Profile
March 10, 2022, 01:15:41 PM
 #3

One I've seen a few times is the contract of a modified ERC20 token where an EOA (Externally Owned Address) can disable swaps from any address other than his own by calling a function.

Something like this:

Code:
address owner = MY_ADDRESS;
bool isHoneypotActivated = false;

modifier onlyOwner {
  require(msg.sender == owner);
}

function transfer(address _to, uint256 _amount) public {
  require(msg.sender == owner || isHoneypotActivated == false);
  // NORMAL ERC20 TRANSFER BELOW
}

function enableHoneypot() onlyOwner public {
  isHoneypotActivated = true;
}


When isHoneypotActivated is true, which happens after the owner (me) calls enableHoneypot, no one else will be able to transfer the tokens (i.e to sell).



So, after compiling this code and creating the contract, the owner can change the wallet and write it on the same contract?

So can it be changed to total suply or ownership afterwards?
TryNinja
Legendary
*
Offline Offline

Activity: 2870
Merit: 7116


Crypto Swap Exchange


View Profile WWW
March 10, 2022, 01:26:46 PM
 #4

So, after compiling this code and creating the contract, the owner can change the wallet and write it on the same contract?

So can it be changed to total suply or ownership afterwards?
No. Read what require() does and what modifiers are on Solidity and then just read my code. The logic is quite simple.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
cyberjs (OP)
Newbie
*
Offline Offline

Activity: 62
Merit: 0


View Profile
March 10, 2022, 01:33:04 PM
 #5

they just change the transfer code as above. am I getting this right?



if I run the above functions on the zeplin inside interface , I think I will get a honeypot contract.
DaveF
Legendary
*
Offline Offline

Activity: 3514
Merit: 6353


Crypto Swap Exchange


View Profile WWW
March 10, 2022, 03:30:05 PM
 #6

Hello, I am nodejs software developer. I'm learning solidity. I'm beginner level.

I have seen a lot of honeypot contracts, what is the logic of their operation? Are there any places where it is used other than rug-pull? Is it completely made to defraud people?
Is there a contract similar to this one? I would like to examine.

(if the relevant topic is prohibited, I can remove it.)


99.999% of the time it is as you said for a rug-pull / rip off.
I can only think of 1 reason to use one and it would have to be disclosed up front and the people sending funds to it would have to be aware of why it's being done.
However, I don't think anyone has ever used it that way as there would be better ways of doing it.

Essentially it would be for a no back out purchase that would be issued only after it's all done and then could only be calculated after the fact.

-Dave

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
cyberjs (OP)
Newbie
*
Offline Offline

Activity: 62
Merit: 0


View Profile
March 10, 2022, 05:10:52 PM
 #7

can honeypot contracts be opened for sale later? After the contract is created?



Hello, I am nodejs software developer. I'm learning solidity. I'm beginner level.

I have seen a lot of honeypot contracts, what is the logic of their operation? Are there any places where it is used other than rug-pull? Is it completely made to defraud people?
Is there a contract similar to this one? I would like to examine.

(if the relevant topic is prohibited, I can remove it.)


99.999% of the time it is as you said for a rug-pull / rip off.
I can only think of 1 reason to use one and it would have to be disclosed up front and the people sending funds to it would have to be aware of why it's being done.
However, I don't think anyone has ever used it that way as there would be better ways of doing it.

Essentially it would be for a no back out purchase that would be issued only after it's all done and then could only be calculated after the fact.

-Dave
cyberjs (OP)
Newbie
*
Offline Offline

Activity: 62
Merit: 0


View Profile
March 10, 2022, 05:16:15 PM
 #8

For example; Can honeypot be used in the Voting System?
you take it once and then you can't take it back.



A honeypot is a smart contract that pretends to leak its funds to an arbitrary user (victim), provided that the user sends additional funds to it. However, the funds provided by the user will be trapped and at most the honeypot creator (attacker) will be able to retrieve them. a honeypot operation consists of a computer, applications and data that simulate the behavior of a real system that would be attractive to attackers, such as a financial system, internet of things (IoT) devices, or a public utility or transportation network.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!