Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Eclipse33 on January 01, 2024, 06:53:28 PM



Title: Looking for bitcoin scripting / Transaction automation resources.
Post by: Eclipse33 on January 01, 2024, 06:53:28 PM
Hello Bitcointalk,

I am looking for resources relating to bitcoin scripting /transaction automation.

These would be shell scripts that can automatically execute bitcoin transactions.

I would like to learn more about how I can program bitcoin transactions so I can develop automated interaction with the blockchain.

Ive seen transactions on the blockchain where bitcoin is automated and it skips around the blockchain to new addresses automatically without a physical person signing those transactions and I want to figure out how these people are doing it. Is there a software for this automation or is it raw back-end shell scripting?

There are little to no You-tube videos on this topic or substantial resources I have been able to locate.  

Thank you in advance for your time in locating any resources and trying to help me.

Highest regards,

-Eclipse

- - - - - - - - - - - - - - - - - - - -

Resources so far:

https://en.bitcoin.it/wiki/Script

https://bitcoin-script-debugger.visvirial.com/

https://davidederosa.com/basic-blockchain-programming/bitcoin-script-language-part-one/

https://davidederosa.com/basic-blockchain-programming/bitcoin-script-language-part-two/

https://ide.bitauth.com/

https://developer.bitaps.com/

- - - - - - - - - - - - - - - - - - - -


Title: Re: Looking for bitcoin scripting / Transaction automation resources.
Post by: digaran on January 01, 2024, 08:44:16 PM
So if I'm not mistaken, you wanna try looting puzzle 66 as soon as it moves, right? But what you are asking is kind of a hacking bot, so it's gonna cost you some money, besides why would any looter help the competition? 😉


Title: Re: Looking for bitcoin scripting / Transaction automation resources.
Post by: seoincorporation on January 04, 2024, 07:42:22 PM
Hello Eclipse.

Bitcoin scripting isn't hard at all, it's easy if we understand how to create/sign/send transactions with the bitcoin core.

Create a transaction:

Code:
bitcoin-cli createrawtransaction "[{\"txid\" : \"mytxid\",\"vout\":0}]" "{\"myaddress\":0.01}"
Sign the transaction, and get back the hex:

Code:
bitcoin-cli signrawtransactionwithwallet "myhex"
Send the transaction (signed hex):

Code:
bitcoin-cli sendrawtransaction "signedhex"

Source: https://developer.bitcoin.org/reference/rpc/sendrawtransaction.html

But to make the script you need to know the inputs for building the transaction, you can get that information from:

Code:
bitcoin-cli listunspent

Once you have the right inputs from the list unspent (txID and Vout) you already have all the data and the tools to create the script.


Title: Re: Looking for bitcoin scripting / Transaction automation resources.
Post by: cmpeq on January 07, 2024, 09:04:24 AM
Check out BitIDE, it has a full IDE, visual debugger, and integration with local testnet:
https://bitcointalk.org/index.php?topic=5478422.0


If you want to learn more about bitcoin scripting, this video has a full tutorial (0-to-1):
https://www.youtube.com/watch?v=Mp3ldiz2KQ8

For some more complex operations/testnet integrations can checkout this demonstration of how to generate a pay to tap root script-path transaction:
https://www.youtube.com/watch?v=ixHVnvq4S7g




Title: Re: Looking for bitcoin scripting / Transaction automation resources.
Post by: n0nce on January 08, 2024, 10:04:37 AM
Looking at the resources you've linked, I get the feeling you're mixing up 'scripting Bitcoin transactions' which means creating Bitcoin transactions programmatically and 'scripting Bitcoin' as in 'using the Bitcoin scripting language'.

You don't need to write any custom Bitcoin scripts (in the Bitcoin scripting language) in order to automate creation of transactions. Don't waste your time with the former; just use the bitcoin-cli as shown by seoincorporation and invoke it from your shell script or whatever programming language you prefer.

Alternatively, you could use the Bitcoin Core RPC interface through JSON-RPC calls from any programming language:
https://developer.bitcoin.org/reference/rpc/index.html

For createrawtransaction (https://developer.bitcoin.org/reference/rpc/createrawtransaction.html), it would be:
Code:
curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "createrawtransaction", "params": ["[{\"txid\":\"myid\",\"vout\":0}]", "[{\"address\":0.01}]"]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/

Instead of curl, you can use your chosen programming language's preferred framework to build and send a POST request.