In the latest bitcoind what RPC calls can I use to:

  1. Create a script with multiple 3 IFs and 1 checklocktimeverify. What are the arguments required here and what is the way to do it via rpc calls?

  2. Encrypt an arbitrary message using a bitcoin pubbkey. The arguments required here will be the plaintext message obviously and the pubkey for the recipient to encrypt the message with (I know address / pubkey hash160 will not work, and whole pubkey is required).

2 Answers 2


None. There are no RPC calls that allow you to do any of the things that you want to do. There is no functionality for building arbitrary scripts nor is there functionality to encrypt messages.

  • So what is the way to build arbitrary scripts? Since they are available, this should be possible.
    – skydanc3r
    Jul 19, 2017 at 21:48
  • To build arbitrary scripts, you will need to look up what the available opcodes are, what they do, and what their hex values are. Then you build the script by hand by writing out the hex values for the entire script. Then you can take that and insert it into an unsigned transaction. AFAIK, there is no tool that allows you to build arbitrary scripts and make transactions for them.
    – Ava Chow
    Jul 20, 2017 at 2:33

I would recommend that you use a purpose designed encryption tool like GPG to encrypt messages. If you need to bind it to a Bitcoin address for some reason, the recipient can signmessage their PGP public key using the signmessage functionality.

Secure general encryption is a complex subject area, and any "bitcoin encryption" would almost certainly be half baked and insecure in some applications compared to a real encryption tool. Because of this there is no support in Bitcoind for message encryption and I don't expect any to be planned.

  • Thanks for the info. I understand, I will look for another way to encrypt something without using a bitcoin pubkey. What about the other question, what is the easiest way to create arbitrary scripts?
    – skydanc3r
    Jul 19, 2017 at 21:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.