<p>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.</p>

CC BY-SA 3.0
2017-07-19T21:48:05.750Z
So what is the way to build arbitrary scripts? Since they are available, this should be possible.
skydanc3r
CC BY-SA 3.0
2017-07-20T02:33:02.270Z
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
CC BY-SA 3.0
2017-07-19T02:16:32.083Z
2017-07-19T02:16:32.083Z
Ava Chow
<p>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.</p>

<p>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.</p>

CC BY-SA 3.0
2017-07-19T21:58:42.863Z
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
CC BY-SA 3.0
2017-07-19T13:00:37.257Z
2017-07-19T13:00:37.257Z
G. Maxwell
<p>In the latest bitcoind what RPC calls can I use to:</p>

<ol>
<li><p>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?</p></li>
<li><p>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).</p></li>
</ol>

<bitcoind><json-rpc>
bitcoind API rpc calls to encrypt an arbitrary message and create a script
skydanc3r
# bitcoind API rpc calls to encrypt an arbitrary message and create a script

(Asked by: username_0 on 2017-07-19)

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).

**Tags:** bitcoind, json-rpc


---

## 2 answers

### Answer by username_1 on 2017-07-19. Score: 0 | Accepted answer

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.

> **Comments:**
> **username_0**: So what is the way to build arbitrary scripts? Since they are available, this should be possible.  
> **username_1**: 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.  

---

### Answer by username_2 on 2017-07-19. Score: 1

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.

> **Comments:**
> **username_0**: 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?  

---

